[exo-jcr-commits] exo-jcr SVN: r216 - jcr/trunk/component/ext/src/main/java/org/exoplatform/services/jcr/ext/registry.

do-not-reply at jboss.org do-not-reply at jboss.org
Mon Oct 5 07:03:36 EDT 2009


Author: nfilotto
Date: 2009-10-05 07:03:36 -0400 (Mon, 05 Oct 2009)
New Revision: 216

Modified:
   jcr/trunk/component/ext/src/main/java/org/exoplatform/services/jcr/ext/registry/RegistryService.java
Log:
EXOJCR-166: Support separated ear delivery

Modified: jcr/trunk/component/ext/src/main/java/org/exoplatform/services/jcr/ext/registry/RegistryService.java
===================================================================
--- jcr/trunk/component/ext/src/main/java/org/exoplatform/services/jcr/ext/registry/RegistryService.java	2009-10-05 11:01:34 UTC (rev 215)
+++ jcr/trunk/component/ext/src/main/java/org/exoplatform/services/jcr/ext/registry/RegistryService.java	2009-10-05 11:03:36 UTC (rev 216)
@@ -101,6 +101,8 @@
    private HashMap<String, String> appConfigurations = new HashMap<String, String>();
 
    private String entryLocation;
+   
+   private final PropertiesParam props;
 
    protected final RepositoryService repositoryService;
 
@@ -123,25 +125,9 @@
       this.regWorkspaces = new HashMap<String, String>();
       if (params == null)
          throw new RepositoryConfigurationException("Init parameters expected");
-      PropertiesParam props = params.getPropertiesParam("locations");
+      this.props = params.getPropertiesParam("locations");
       if (props == null)
          throw new RepositoryConfigurationException("Property parameters 'locations' expected");
-      for (RepositoryEntry repConfiguration : repConfigurations())
-      {
-         String repName = repConfiguration.getName();
-         String wsName = null;
-         if (props != null)
-         {
-            wsName = props.getProperty(repName);
-            if (wsName == null)
-               wsName = repConfiguration.getDefaultWorkspaceName();
-         }
-         else
-         {
-            wsName = repConfiguration.getDefaultWorkspaceName();
-         }
-         addRegistryLocation(repName, wsName);
-      }
    }
 
    /**
@@ -292,11 +278,36 @@
          {
             for (RepositoryEntry repConfiguration : repConfigurations())
             {
+               String repName = repConfiguration.getName();
+               String wsName = null;
+               if (props != null)
+               {
+                  wsName = props.getProperty(repName);
+                  if (wsName == null)
+                     wsName = repConfiguration.getDefaultWorkspaceName();
+               }
+               else
+               {
+                  wsName = repConfiguration.getDefaultWorkspaceName();
+               }
+               addRegistryLocation(repName, wsName);
                InputStream xml = getClass().getResourceAsStream(NT_FILE);
-               String repName = repConfiguration.getName();
-               repositoryService.getRepository(repName).getNodeTypeManager().registerNodeTypes(xml,
-                  ExtendedNodeTypeManager.IGNORE_IF_EXISTS);
-               xml.close();
+               try
+               {
+                  repositoryService.getRepository(repName).getNodeTypeManager().registerNodeTypes(xml,
+                     ExtendedNodeTypeManager.IGNORE_IF_EXISTS);
+               }
+               finally
+               {
+                  try
+                  {
+                     xml.close();
+                  }
+                  catch (Exception e)
+                  {
+                     //ignore me
+                  }                  
+               }
             }
             initStorage(false);
 
@@ -312,11 +323,6 @@
             log.error(e.getLocalizedMessage());
             e.printStackTrace();
          }
-         catch (IOException e)
-         {
-            log.error(e.getLocalizedMessage());
-            e.printStackTrace();
-         }
       else if (log.isDebugEnabled())
          log.warn("Registry service already started");
    }



More information about the exo-jcr-commits mailing list