Author: chathura
Date: Fri Feb  8 04:02:08 2008
New Revision: 13474

Log:


Fixed minor issue. /system should not be created if it is already there.
Removed the old user guide.



Removed:
   branches/registry/1_0/modules/documentation/xdocs/userguide.xml
Modified:
   
branches/registry/1_0/modules/core/src/main/java/org/wso2/registry/servlet/RegistryServlet.java
   
branches/registry/1_0/modules/core/src/main/java/org/wso2/registry/servlet/registry.xml

Modified: 
branches/registry/1_0/modules/core/src/main/java/org/wso2/registry/servlet/RegistryServlet.java
==============================================================================
--- 
branches/registry/1_0/modules/core/src/main/java/org/wso2/registry/servlet/RegistryServlet.java
     (original)
+++ 
branches/registry/1_0/modules/core/src/main/java/org/wso2/registry/servlet/RegistryServlet.java
     Fri Feb  8 04:02:08 2008
@@ -87,13 +87,13 @@
                     registryContext.getDefaultDataBaseConfiguration();
             String dbType = System.getProperty("in-memory");
             if ((dbType != null && "true".equals(dbType)) ||
-                dbConfiguration.getConfigName().equals("in-memory")) {
+                    dbConfiguration.getConfigName().equals("in-memory")) {
                 registryRealm = new InMemoryRegistryRealm();
                 coreRegistry = new InMemoryJDBCRegistry(registryRealm);
             } else {
                 DataSource dataSource;
                 if (dbConfiguration.getDataSourceName() != null &&
-                    dbConfiguration.getDataSourceName().length() > 0) {
+                        dbConfiguration.getDataSourceName().length() > 0) {
                     try {
                         Context context = new InitialContext();
                         dataSource =
@@ -102,8 +102,8 @@
                     } catch (NamingException e) {
 
                         String msg = "Could not find the specified data source 
named: " +
-                                     dbConfiguration.getDataSourceName() + ". 
Caused by: " +
-                                     e.getMessage();
+                                dbConfiguration.getDataSourceName() + ". 
Caused by: " +
+                                e.getMessage();
                         log.fatal(msg, e);
                         throw new ServletException(msg, e);
                     }
@@ -121,19 +121,22 @@
 
             // create a system registry and put it in the context
             SecureRegistry systemRegistry = new 
SecureRegistry(RegistryConstants.SYSTEM_USER,
-                                                               
RegistryConstants.SYSTEM_PASSWORD,
-                                                               coreRegistry,
-                                                               registryRealm);
+                    RegistryConstants.SYSTEM_PASSWORD,
+                    coreRegistry,
+                    registryRealm);
 
             // create system resources
-            Resource systemCollection = new Resource();
-            systemCollection.setDirectory(true);
-            String systemDesc = "This collection is used to store system data 
of the " +
-                                "WSO2 Registry server. User nor the admins of 
the registry are not expected " +
-                                "to edit any content of this collection. 
Changing content of this collection " +
-                                "may result in unexpected behaviors.";
-            systemCollection.setDescription(systemDesc);
-            systemRegistry.put("/system", systemCollection);
+            if (!systemRegistry.resourceExists("/system")) {
+                
+                Resource systemCollection = new Resource();
+                systemCollection.setDirectory(true);
+                String systemDesc = "This collection is used to store system 
data of the " +
+                        "WSO2 Registry server. User nor the admins of the 
registry are not expected " +
+                        "to edit any content of this collection. Changing 
content of this collection " +
+                        "may result in unexpected behaviors.";
+                systemCollection.setDescription(systemDesc);
+                systemRegistry.put("/system", systemCollection);
+            }
 
             try {
                 AccessControlAdmin ac = registryRealm.getAccessControlAdmin();
@@ -206,8 +209,8 @@
             String path = fileElement.getPath();
             registry.put(path, fileElement);
             
request.getSession().setAttribute(RegistryConstants.STATUS_MESSAGE_NAME,
-                                              "Resource " + path +
-                                              " was successfully added to the 
registry.");
+                    "Resource " + path +
+                            " was successfully added to the registry.");
             response.setContentType("text/html");
             request.getRequestDispatcher(RegistryConstants.RESOURCES_JSP)
                     .forward(request, response);
@@ -216,7 +219,7 @@
 
             e.printStackTrace();
             
request.getSession().setAttribute(RegistryConstants.STATUS_MESSAGE_NAME,
-                                              e.getMessage());
+                    e.getMessage());
             response.setContentType("text/html");
             request.getRequestDispatcher(RegistryConstants.RESOURCES_JSP)
                     .forward(request, response);
@@ -238,11 +241,11 @@
             String path;
 
             if (uri.equals("") || 
uri.endsWith(RegistryConstants.RESOURCES_PATH +
-                                               
RegistryConstants.PATH_SEPARATOR)) {
+                    RegistryConstants.PATH_SEPARATOR)) {
                 path = RegistryConstants.ROOT_PATH;
             } else {
                 path = uri.substring((contextRoot + 
RegistryConstants.PATH_SEPARATOR +
-                                      
RegistryConstants.RESOURCES_PATH).length(), uri.length());
+                        RegistryConstants.RESOURCES_PATH).length(), 
uri.length());
             }
 
             // if user is browsing an old version of the resource, we append 
it to the path, so that

Modified: 
branches/registry/1_0/modules/core/src/main/java/org/wso2/registry/servlet/registry.xml
==============================================================================
--- 
branches/registry/1_0/modules/core/src/main/java/org/wso2/registry/servlet/registry.xml
     (original)
+++ 
branches/registry/1_0/modules/core/src/main/java/org/wso2/registry/servlet/registry.xml
     Fri Feb  8 04:02:08 2008
@@ -14,6 +14,7 @@
         <password>password</password>
         <driverName>org.apache.derby.jdbc.ClientDriver</driverName>
     </dbconfig>
+    
      <dbconfig name="mysql">
         <url>jdbc:mysql://localhost:3306/wso2registry</url>
         <userName>root</userName>

_______________________________________________
Registry-dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/registry-dev

Reply via email to