[java-identity-provider COMMIT] /trunk/idp-core/src/main/java/net/shibboleth/idp/spring/SpringSupport.java

noreply at shibboleth.net noreply at shibboleth.net
Thu Mar 7 18:01:29 EST 2013


Author: tzeller
Date: Thu Mar  7 18:01:28 2013
New Revision: 4305

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=4305&view=rev
Log:
A temporary way to convert opensaml resources into spring resources.

Modified:
    trunk/idp-core/src/main/java/net/shibboleth/idp/spring/SpringSupport.java

Modified: trunk/idp-core/src/main/java/net/shibboleth/idp/spring/SpringSupport.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-core/src/main/java/net/shibboleth/idp/spring/SpringSupport.java?rev=4305&r1=4304&r2=4305&view=diff
==============================================================================
--- trunk/idp-core/src/main/java/net/shibboleth/idp/spring/SpringSupport.java (original)
+++ trunk/idp-core/src/main/java/net/shibboleth/idp/spring/SpringSupport.java Thu Mar  7 18:01:28 2013
@@ -20,11 +20,14 @@
 import java.util.List;
 
 import net.shibboleth.utilities.java.support.resource.Resource;
+import net.shibboleth.utilities.java.support.resource.ResourceException;
 
+import org.springframework.beans.factory.BeanDefinitionStoreException;
 import org.springframework.beans.factory.support.ManagedList;
 import org.springframework.beans.factory.xml.ParserContext;
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.support.GenericApplicationContext;
+import org.springframework.core.io.InputStreamResource;
 import org.w3c.dom.Element;
 
 /**
@@ -50,10 +53,21 @@
         GenericApplicationContext context = new GenericApplicationContext(parentContext);
         context.setDisplayName("ApplicationContext:" + name);
 
-        SchemaTypeAwareXMLBeanDefinitionReader beanDefinitionReader = new SchemaTypeAwareXMLBeanDefinitionReader(
-                context);
-        //TODO change opensaml resources in to Spring resource
-        // beanDefinitionReader.loadBeanDefinitions(configurationResources.toArray(new Resource[] {}));
+        SchemaTypeAwareXMLBeanDefinitionReader beanDefinitionReader =
+                new SchemaTypeAwareXMLBeanDefinitionReader(context);
+
+        // TODO change opensaml resources in to Spring resource
+        // beanDefinitionReader.loadBeanDefinitions(configurationResources.toArray(new Resource[] {}));        
+        try {
+            for (Resource configurationResource : configurationResources) {
+                beanDefinitionReader.loadBeanDefinitions(new InputStreamResource(
+                        configurationResource.getInputStream(), configurationResource.getLocation()));
+            }
+        } catch (BeanDefinitionStoreException | ResourceException e) {
+            // TODO fix exception handling
+            e.printStackTrace();
+            throw new RuntimeException(e);
+        }
 
         context.refresh();
         return context;



More information about the commits mailing list