Properly build WAR and install $IDP_HOME
authorlajoie <lajoie@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Mon, 21 May 2007 21:42:52 +0000 (21:42 +0000)
committerlajoie <lajoie@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Mon, 21 May 2007 21:42:52 +0000 (21:42 +0000)
Properly load profile handler configuration

git-svn-id: https://subversion.switch.ch/svn/shibboleth/java-idp/trunk@2207 ab3bd59b-922f-494d-bb5f-6f0a3c29deca

15 files changed:
build.xml
resources/META-INF/spring.handlers [new file with mode: 0644]
resources/META-INF/spring.schemas [new file with mode: 0644]
resources/WEB-INF/web.xml
resources/classpath/schema/shibboleth-2.0-idp-service.xsd
resources/conf/internal.xml
resources/conf/logging.xml [moved from resources/conf/log4j.xml with 85% similarity]
resources/conf/protocol.xml
resources/conf/service.xml
resources/webpages/error.jsp
src/edu/internet2/middleware/shibboleth/idp/config/service/IdPConfigBeanDefinitionParser.java [new file with mode: 0644]
src/edu/internet2/middleware/shibboleth/idp/config/service/IdPLoggingService.java [new file with mode: 0644]
src/edu/internet2/middleware/shibboleth/idp/config/service/IdPLoggingServiceBeanDefinitionParser.java [new file with mode: 0644]
src/edu/internet2/middleware/shibboleth/idp/config/service/IdPServicesBean.java [new file with mode: 0644]
src/edu/internet2/middleware/shibboleth/idp/config/service/IdPServicesNamespaceHandler.java [new file with mode: 0644]

index 3a83aa2..9cb2855 100755 (executable)
--- a/build.xml
+++ b/build.xml
 \r
        <!-- Removes previously compiled files -->\r
        <target name="clean-compile">\r
-               <delete dir="${build.dir}" />\r
+               <delete dir="${build.dir}" />
+               <delete dir="${dist.dir}" />\r
        </target>\r
 \r
        <!-- Removes all build generated content -->\r
 
                <jar destfile="${dist.dir}/${jar.name}" whenempty="fail">
                        <fileset dir="${classpathres.dir}" />
-                       <fileset dir="${metainf.dir}" />
+                       <zipfileset dir="${metainf.dir}" prefix="META-INF/"/>
                        <zipfileset dir="${core-classes.dir}" />
                </jar>
 
                        </filterset>
                </copy>
 \r
-               <jar destfile="${dist.dir}/${war.name}" whenempty="fail">\r
-                       <fileset dir="${classpathres.dir}" />
-                       <fileset dir="${metainf.dir}" />
-                       <fileset dir="${webinf-temp.dir}" />
-                       <fileset dir="${webpages.dir}" />
-                       <zipfileset dir="${lib.dir}" prefix="/WEB-INF/lib/" />
-                       <zipfileset file="${dist.dir}/${jar.name}" prefix="/WEB-INF/lib/" />\r
+               <jar destfile="${dist.dir}/${war.name}" whenempty="fail">
+                       <zipfileset dir="${classpathres.dir}" prefix="WEB-INF/classes/" />
+                       <zipfileset dir="${webinf-temp.dir}" prefix="WEB-INF/" />
+                       <zipfileset dir="${webpages.dir}" prefix="" />
+                       <zipfileset dir="${lib.dir}" prefix="WEB-INF/lib/" />
+                       <zipfileset file="${dist.dir}/${jar.name}" prefix="WEB-INF/lib/" />\r
                </jar>\r
 \r
        </target>
diff --git a/resources/META-INF/spring.handlers b/resources/META-INF/spring.handlers
new file mode 100644 (file)
index 0000000..8d74ada
--- /dev/null
@@ -0,0 +1,2 @@
+urn\:mace\:shibboleth\:2.0\:idp\:services = edu.internet2.middleware.shibboleth.idp.config.service.IdPServicesNamespaceHandler
+urn\:mace\:shibboleth\:2.0\:idp\:profiles = edu.internet2.middleware.shibboleth.idp.config.profile.IdPProfileHandlerNamespaceHandler
\ No newline at end of file
diff --git a/resources/META-INF/spring.schemas b/resources/META-INF/spring.schemas
new file mode 100644 (file)
index 0000000..97411ff
--- /dev/null
@@ -0,0 +1,2 @@
+urn\:mace\:shibboleth\:2.0\:idp\:services = schema/shibboleth-2.0-idp-service.xsd
+urn\:mace\:shibboleth\:2.0\:idp\:profiles = schema/shibboleth-2.0-idp-profile.xsd
\ No newline at end of file
index 057d684..25cb9f9 100644 (file)
@@ -14,7 +14,7 @@
         <param-name>contextConfigLocation</param-name>
         <param-value>
             file://$IDP_HOME$/conf/internal.xml;
-            file://$IDP_HOME$/conf/services.xml;
+            file://$IDP_HOME$/conf/service.xml;
         </param-value>
     </context-param>
 
@@ -47,7 +47,7 @@
 
     <servlet-mapping>
         <servlet-name>ProfileRequestDispatcher</servlet-name>
-        <url-pattern>/IdP</url-pattern>
+        <url-pattern>/profile/*</url-pattern>
     </servlet-mapping>
 
     <!--
index caafb49..eedabc1 100644 (file)
@@ -13,8 +13,7 @@
 
     <complexType name="IdPConfigType">
         <sequence>
-            <!-- TODO default logging configuration location -->
-            <element name="LoggingConfiguration" type="string" minOccurs="0">
+            <element name="LoggingConfiguration" type="idpconf:LoggingConfigurationType" minOccurs="0">
                 <annotation>
                     <documentation>
                         Location, on the filesystem, where the Log4j configuration file is located.
         </sequence>
     </complexType>
 
+    <complexType name="LoggingConfigurationType">
+        <simpleContent>
+            <extension base="string">
+                <attribute name="timerId" type="string" default="shibboleth.TaskTimer">
+                    <annotation>
+                        <documentation>
+                            Component ID for the task timer used to schedule configuration file polling.
+                        </documentation>
+                    </annotation>
+                </attribute>
+            </extension>
+        </simpleContent>
+    </complexType>
+
 </schema>
\ No newline at end of file
index 2ea72df..330168b 100644 (file)
@@ -1,18 +1,41 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
 <!-- 
-  This file contains advanced configuration options for the Identity Providers.
-  
-  DO NOT EDIT THIS FILE unless you're absolutely certain you understand what you are doing.
+    This file contains advanced configuration options for the Identity Providers.
+    
+    DO NOT EDIT THIS FILE unless you're absolutely certain you understand what you are doing.
 -->
 
-<beans xmlns="http://www.springframework.org/schema/beans"
-          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-          xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"
-          default-autowire="byType">
-  
-    <bean id="shibboleth.RequestDispatcher" class="edu.internet2.middleware.shibboleth.idp.profile">
-        <property name="handlerManager" ref="shibboleth.ProfileHandler" />
+<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"
+    default-autowire="byType">
+
+    <bean id="shibboleth.TaskTimer" class="java.util.Timer" destroy-method="cancel">
+        <constructor-arg value="true" type="boolean" />
+    </bean>
+
+    <bean id="shibboleth.ParserPool" class="org.opensaml.xml.parse.BasicParserPool">
+        <property name="maxPoolSize" value="50" />
+        <property name="createBuildersAtPoolLimit" value="true" />
+        <property name="coalescing" value="true" />
+        <property name="ignoreComments" value="true" />
+        <property name="ignoreElementContentWhitespace" value="true" />
+        <property name="namespaceAware" value="true" />
     </bean>
 
+    <bean id="shibboleth.ServletAttributeExporter"
+        class="org.springframework.web.context.support.ServletContextAttributeExporter">
+        <property name="attributes">
+            <map>
+                <entry>
+                    <key>
+                        <value>handlerManager</value>
+                    </key>
+                    <ref bean="shibboleth.ProfileHandler" />
+                </entry>
+            </map>
+        </property>
+    </bean>
+
+
 </beans>
\ No newline at end of file
similarity index 85%
rename from resources/conf/log4j.xml
rename to resources/conf/logging.xml
index 3b3ef96..faadbcd 100644 (file)
@@ -4,18 +4,23 @@
 
 <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
 
+    <!-- ======================================= -->
+    <!-- Renderers for specific types of objects -->
+    <!-- ======================================= -->
     <renderer renderedClass="edu.internet2.middleware.shibboleth.common.log.AuditLogEntry"
         renderingClass="edu.internet2.middleware.shibboleth.common.log.CSVAuditEventRenderer" />
 
     <renderer renderedClass="edu.internet2.middleware.shibboleth.common.log.AccessLogEntry"
         renderingClass="edu.internet2.middleware.shibboleth.common.log.CSVAcessEventRenderer" />
 
+    <renderer renderedClass="org.w3c.dom.Node" renderingClass="org.opensaml.log.DOMNodeRenderer" />
+
+    <renderer renderedClass="org.opensaml.xml.XMLObject" renderingClass="org.opensaml.log.XMLObjectRenderer" />
+
     <!-- ================================= -->
-    <!-- Preserve messages in a local file -->
+    <!-- Send messages to local files      -->
     <!-- ================================= -->
-
-    <!-- A time/date based rolling appender -->
-    <appender name="IDP_LOG" class="org.apache.log4j.DailyRollingFileAppender">
+    <appender name="IDP_LOG" class="org.opensaml.log.RollingFileAppender">
         <param name="File" value="$IDP_HOME$/conf/idp.log" />
         <param name="Append" value="false" />
 
@@ -33,7 +38,7 @@
         </layout>
     </appender>
 
-    <appender name="IDP_AUDIT" class="org.apache.log4j.DailyRollingFileAppender">
+    <appender name="IDP_AUDIT" class="org.opensaml.log.RollingFileAppender">
         <param name="File" value="$IDP_HOME$/conf/audit.log" />
         <param name="Append" value="false" />
 
@@ -51,7 +56,7 @@
         </layout>
     </appender>
 
-    <appender name="IDP_ACCESS" class="org.apache.log4j.DailyRollingFileAppender">
+    <appender name="IDP_ACCESS" class="org.opensaml.log.RollingFileAppender">
         <param name="File" value="$IDP_HOME$/conf/access.log" />
         <param name="Append" value="false" />
 
index 0f4858d..cf4c320 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
-<ProfileHandlers xmlns="urn:mace:shibboleth:2.0:profile-handler"
+<ProfileHandlerGroup xmlns="urn:mace:shibboleth:2.0:profile-handler"
                  xmlns:idpProfile="urn:mace:shibboleth:2.0:idp:profiles"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="urn:mace:shibboleth:2.0:profile-handler classpath:/schema/shibboleth-2.0-profile-handler.xsd
@@ -16,4 +16,4 @@
         <RequestPath>/shibboleth/IdP/saml2/SOAP/attribute</RequestPath>
     </ProfileHandler>
 
-</ProfileHandlers>
\ No newline at end of file
+</ProfileHandlerGroup>
\ No newline at end of file
index 0cd4680..b640741 100644 (file)
     xmlns:profile="urn:mace:shibboleth:2.0:profile-handler" xmlns:relyingParty="urn:mace:shibboleth:2.0:relying-party"
     xmlns:resolver="urn:mace:shibboleth:2.0:resolver" xmlns:afp="urn:mace:shibboleth:2.0:afp"
     xmlns:resource="urn:mace:shibboleth:2.0:resource" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="urn:mace:shibboleth:2.0:idp-config classpath:/schema/shibboleth-2.0-idp-service.xsd
-                        urn:mace:shibboleth:2.0:idp:services classpath:/schema/shibboleth-2.0-services.xsd
+    xsi:schemaLocation="urn:mace:shibboleth:2.0:idp:services classpath:/schema/shibboleth-2.0-idp-service.xsd
+                        urn:mace:shibboleth:2.0:services classpath:/schema/shibboleth-2.0-services.xsd
                         urn:mace:shibboleth:2.0:profile-handler classpath:/schema/shibboleth-2.0-profile-handler.xsd
                         urn:mace:shibboleth:2.0:relying-party classpath:/schema/shibboleth-2.0-relying-party.xsd
                         urn:mace:shibboleth:2.0:resolver classpath:/schema/shibboleth-2.0-attribute-resolver.xsd
                         urn:mace:shibboleth:2.0:afp classpath:/schema/shibboleth-2.0-afp.xsd 
                         urn:mace:shibboleth:2.0:resource classpath:/schema/shibboleth-2.0-resource.xsd">
 
-    <LoggingConfiguration>$IdP_HOME$/conf/logging.xml</LoggingConfiguration>
-
-    <service:Service id="shibboleth.ProfileHandler"
-                           type="profile:ShibbolethProfileHandlerManager"
-                           configurationResourcePollingFrequency="300000"
-                           configurationResourcePollingRetryAttempts="10">
-        <resource:ConfigurationResource type="resource:FileSystemResource">
-            $IDP_HOME$/conf/protocol.xml
-        </resource:ConfigurationResource>
-    </service:Service>
-
-    <service:Service id="shibboleth.RelyingPartyConfigurationManager"
-                           type="relyingParty:SAMLMDRelyingPartyConfigurationManager"
-                           configurationResourcePollingFrequency="300000"
-                           configurationResourcePollingRetryAttempts="10">
-        <resource:ConfigurationResource type="resource:FileSystemResource">
-            $IDP_HOME$/conf/relying-party.xml
-        </resource:ConfigurationResource>
-    </service:Service>
-
-    <service:Service id="shibboleth.AttributeResolver"
-                           type="resolver:ShibbolethAttributeResolver"
-                           configurationResourcePollingFrequency="300000"
-                           configurationResourcePollingRetryAttempts="10">
-        <resource:ConfigurationResource type="resource:FileSystemResource">
-            $IDP_HOME$/conf/attribute-resolver.xml
-        </resource:ConfigurationResource>
-    </service:Service>
-
-    <service:Service id="shibboleth.AttributeFilterEngine"
-                           type="afp:ShibbolethAttributeFilteringEngine"
-                           configurationResourcePollingFrequency="60000"
-                           configurationResourcePollingRetryAttempts="10">
-        <resource:ConfigurationResource type="resource:FileSystemResource">
-            $IDP_HOME$/conf/attribute-filter.xml
-        </resource:ConfigurationResource>
-    </service:Service>
+    <LoggingConfiguration>$IDP_HOME$/conf/logging.xml</LoggingConfiguration>
+
+    <Service id="shibboleth.ProfileHandler"
+             xmlns="urn:mace:shibboleth:2.0:services"
+             xsi:type="profile:ShibbolethProfileHandlerManager"
+             configurationResourcePollingFrequency="300000"
+             configurationResourcePollingRetryAttempts="10">
+        <ConfigurationResource file="$IDP_HOME$/conf/protocol.xml" xsi:type="resource:FilesystemResource" />
+    </Service>
+
+    <Service id="shibboleth.RelyingPartyConfigurationManager"
+             xmlns="urn:mace:shibboleth:2.0:services"
+             xsi:type="relyingParty:SAMLMDRelyingPartyConfigurationManager"
+             configurationResourcePollingFrequency="300000"
+             configurationResourcePollingRetryAttempts="10">
+        <ConfigurationResource file="$IDP_HOME$/conf/relying-party.xml" xsi:type="resource:FilesystemResource" />
+    </Service>
+
+    <Service id="shibboleth.AttributeResolver"
+             xmlns="urn:mace:shibboleth:2.0:services"
+             xsi:type="resolver:ShibbolethAttributeResolver"
+             configurationResourcePollingFrequency="300000"
+             configurationResourcePollingRetryAttempts="10">
+        <ConfigurationResource file="$IDP_HOME$/conf/attribute-resolver.xml" xsi:type="resource:FilesystemResource" />
+    </Service>
+
+    <Service id="shibboleth.AttributeFilterEngine"
+             xmlns="urn:mace:shibboleth:2.0:services"
+             xsi:type="afp:ShibbolethAttributeFilteringEngine"
+             configurationResourcePollingFrequency="60000"
+             configurationResourcePollingRetryAttempts="10">
+        <ConfigurationResource file="$IDP_HOME$/conf/attribute-filter.xml" xsi:type="resource:FilesystemResource" />
+    </Service>
 
 </IdPConfig>
\ No newline at end of file
index e69de29..0658cb5 100644 (file)
@@ -0,0 +1,8 @@
+<html>
+
+<body>
+       <h1>ERROR</h1>
+       <%= request.getAttribute("requestError") %>
+</body>
+
+</html>
\ No newline at end of file
diff --git a/src/edu/internet2/middleware/shibboleth/idp/config/service/IdPConfigBeanDefinitionParser.java b/src/edu/internet2/middleware/shibboleth/idp/config/service/IdPConfigBeanDefinitionParser.java
new file mode 100644 (file)
index 0000000..10af298
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * Copyright [2007] [University Corporation for Advanced Internet Development, Inc.]
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package edu.internet2.middleware.shibboleth.idp.config.service;
+
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.opensaml.xml.util.XMLHelper;
+import org.springframework.beans.factory.support.BeanDefinitionBuilder;
+import org.springframework.beans.factory.xml.AbstractSimpleBeanDefinitionParser;
+import org.springframework.beans.factory.xml.ParserContext;
+import org.w3c.dom.Element;
+
+import edu.internet2.middleware.shibboleth.common.config.SpringConfigurationUtils;
+import edu.internet2.middleware.shibboleth.common.config.service.ServiceNamespaceHandler;
+
+/**
+ * Bean definition parser for IdP services config root element.
+ */
+public class IdPConfigBeanDefinitionParser extends AbstractSimpleBeanDefinitionParser {
+
+    /** Element name. */
+    public static final QName ELEMENT_NAME = new QName(IdPServicesNamespaceHandler.NAMESPACE, "IdPConfig");
+
+    /** Schema type. */
+    public static final QName SCHEMA_TYPE = new QName(IdPServicesNamespaceHandler.NAMESPACE, "IdPConfigType");
+
+    /** {@inheritDoc} */
+    protected Class getBeanClass(Element arg0) {
+        return IdPServicesBean.class;
+    }
+
+    /** {@inheritDoc} */
+    protected void doParse(Element config, ParserContext context, BeanDefinitionBuilder builder) {
+        Map<QName, List<Element>> configChildren = XMLHelper.getChildElements(config);
+        List<Element> children;
+
+        children = configChildren.get(new QName(IdPServicesNamespaceHandler.NAMESPACE, "LoggingConfiguration"));
+        if (children != null && children.size() > 0) {
+            builder.addConstructorArg(SpringConfigurationUtils.parseCustomElement(children.get(0), context));
+        }
+
+        children = configChildren.get(new QName(ServiceNamespaceHandler.NAMESPACE, "Service"));
+        builder.addConstructorArg(SpringConfigurationUtils.parseCustomElements(children, context));
+    }
+    
+    /** {@inheritDoc} */
+    protected boolean shouldGenerateId() {
+        return true;
+    }
+}
\ No newline at end of file
diff --git a/src/edu/internet2/middleware/shibboleth/idp/config/service/IdPLoggingService.java b/src/edu/internet2/middleware/shibboleth/idp/config/service/IdPLoggingService.java
new file mode 100644 (file)
index 0000000..1760692
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ * Copyright [2007] [University Corporation for Advanced Internet Development, Inc.]
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package edu.internet2.middleware.shibboleth.idp.config.service;
+
+import java.util.Timer;
+
+import org.apache.log4j.Logger;
+import org.opensaml.log.Level;
+import org.opensaml.resource.FilesystemResource;
+import org.opensaml.resource.ResourceChangeWatcher;
+import org.opensaml.resource.ResourceException;
+import org.opensaml.xml.util.DatatypeHelper;
+
+import edu.internet2.middleware.shibboleth.common.log.Log4jConfigFileResourceListener;
+
+/**
+ * Logging service for the IdP.
+ */
+public class IdPLoggingService {
+
+    /** Location of the Log4j configuration file. */
+    private FilesystemResource loggingConfiguration;
+
+    /** Timer used to schedule configuration file polling. */
+    private Timer taskTimer;
+
+    /**
+     * Constructor.
+     * 
+     * @param timer timer used to schedule configuration file polling
+     * @param logConf location, on the filesystem, of the log4j configuration file
+     * 
+     * @throws ResourceException thrown if the given configuration file does not exist
+     */
+    public IdPLoggingService(Timer timer, String logConf) throws ResourceException {
+        taskTimer = timer;
+        loggingConfiguration = new FilesystemResource(DatatypeHelper.safeTrimOrNullString(logConf));
+        if (!loggingConfiguration.exists()) {
+            throw new ResourceException("Logging configuration file does not exist: "
+                    + loggingConfiguration.getLocation());
+        }
+    }
+
+    /**
+     * Initializes the logging service.
+     * 
+     * @throws ResourceException thrown if logging configuration file does not exist
+     */
+    public void initialize() throws ResourceException {
+        ResourceChangeWatcher configurationWatcher = new ResourceChangeWatcher(loggingConfiguration, 1000 * 60);
+        configurationWatcher.getResourceListeners().add(new Log4jConfigFileResourceListener());
+        taskTimer.schedule(configurationWatcher, 0, configurationWatcher.getPollingFrequency());
+        Logger log = Logger.getLogger(IdPLoggingService.class);
+        log.log(Level.CRITICAL, "Logging service initialized");
+    }
+
+    /**
+     * Gets the location of the logging configuration file.
+     * 
+     * @return location of the logging configuration file
+     */
+    public String getLoggingConfigurationLocation() {
+        return loggingConfiguration.getLocation();
+    }
+}
\ No newline at end of file
diff --git a/src/edu/internet2/middleware/shibboleth/idp/config/service/IdPLoggingServiceBeanDefinitionParser.java b/src/edu/internet2/middleware/shibboleth/idp/config/service/IdPLoggingServiceBeanDefinitionParser.java
new file mode 100644 (file)
index 0000000..e7f9adf
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Copyright [2007] [University Corporation for Advanced Internet Development, Inc.]
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package edu.internet2.middleware.shibboleth.idp.config.service;
+
+import javax.xml.namespace.QName;
+
+import org.springframework.beans.factory.support.BeanDefinitionBuilder;
+import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser;
+import org.w3c.dom.Element;
+
+/**
+ * Spring bean definition parser for the IdP logging service.
+ */
+public class IdPLoggingServiceBeanDefinitionParser extends AbstractSingleBeanDefinitionParser {
+
+    /** Element name. */
+    public static final QName ELEMENT_NAME = new QName(IdPServicesNamespaceHandler.NAMESPACE, "LoggingConfiguration");
+
+    /** {@inheritDoc} */
+    protected Class getBeanClass(Element arg0) {
+        return IdPLoggingService.class;
+    }
+
+    /** {@inheritDoc} */
+    protected void doParse(Element config, BeanDefinitionBuilder builder) {
+        builder.addConstructorArgReference(config.getAttributeNS(null, "timerId"));
+        builder.addConstructorArg(config.getTextContent());
+        builder.setInitMethodName("initialize");
+    }
+    
+    /** {@inheritDoc} */
+    protected boolean shouldGenerateId() {
+        return true;
+    }
+}
\ No newline at end of file
diff --git a/src/edu/internet2/middleware/shibboleth/idp/config/service/IdPServicesBean.java b/src/edu/internet2/middleware/shibboleth/idp/config/service/IdPServicesBean.java
new file mode 100644 (file)
index 0000000..025e030
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * Copyright [2007] [University Corporation for Advanced Internet Development, Inc.]
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package edu.internet2.middleware.shibboleth.idp.config.service;
+
+import java.util.List;
+
+import edu.internet2.middleware.shibboleth.common.config.BaseService;
+
+/**
+ * Collection of services loaded by the IdP.
+ */
+public class IdPServicesBean {
+
+    /** Logging service for the IdP. */
+    private IdPLoggingService loggingService;
+
+    /** Serivce components loaded into the IdP. */
+    private List<BaseService> services;
+
+    /**
+     * Constructor.
+     * 
+     * @param logging logging service for the IdP
+     * @param loadedServices service components loaded into the IdP
+     */
+    public IdPServicesBean(IdPLoggingService logging, List<BaseService> loadedServices) {
+        loggingService = logging;
+        services = loadedServices;
+    }
+
+    /**
+     * Gets the logging service for the IdP.
+     * 
+     * @return logging service for the IdP
+     */
+    public IdPLoggingService getLoggingService() {
+        return loggingService;
+    }
+
+    /**
+     * Gets the service components loaded into the IdP.
+     * 
+     * @return service components loaded into the IdP
+     */
+    public List<BaseService> getServices() {
+        return services;
+    }
+}
\ No newline at end of file
diff --git a/src/edu/internet2/middleware/shibboleth/idp/config/service/IdPServicesNamespaceHandler.java b/src/edu/internet2/middleware/shibboleth/idp/config/service/IdPServicesNamespaceHandler.java
new file mode 100644 (file)
index 0000000..cf49c69
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Copyright [2007] [University Corporation for Advanced Internet Development, Inc.]
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package edu.internet2.middleware.shibboleth.idp.config.service;
+
+import edu.internet2.middleware.shibboleth.common.config.BaseSpringNamespaceHandler;
+
+/**
+ * Spring namespace handler for IdP service definitions.
+ */
+public class IdPServicesNamespaceHandler extends BaseSpringNamespaceHandler {
+
+    /** IdP services namespace URI. */
+    public static final String NAMESPACE = "urn:mace:shibboleth:2.0:idp:services";
+
+    /** {@inheritDoc} */
+    public void init() {
+        IdPConfigBeanDefinitionParser parser = new IdPConfigBeanDefinitionParser();
+        registerBeanDefinitionParser(IdPConfigBeanDefinitionParser.ELEMENT_NAME, parser);
+        registerBeanDefinitionParser(IdPConfigBeanDefinitionParser.SCHEMA_TYPE, parser);
+
+        registerBeanDefinitionParser(IdPLoggingServiceBeanDefinitionParser.ELEMENT_NAME,
+                new IdPLoggingServiceBeanDefinitionParser());
+    }
+}
\ No newline at end of file