[Registry-dev] svn commit r9393 - in trunk/registry/modules/core/src/main/java/org/wso2/registry: secure servlet

svn at wso2.org svn at wso2.org
Thu Nov 1 18:31:55 PDT 2007


Author: deepal
Date: Thu Nov  1 18:31:54 2007
New Revision: 9393

Modified:
   trunk/registry/modules/core/src/main/java/org/wso2/registry/secure/HSQLDBInitializer.java
   trunk/registry/modules/core/src/main/java/org/wso2/registry/secure/RegistryUserManager.java
   trunk/registry/modules/core/src/main/java/org/wso2/registry/secure/SecureRegistry.java
   trunk/registry/modules/core/src/main/java/org/wso2/registry/servlet/FileUploadUtil.java
   trunk/registry/modules/core/src/main/java/org/wso2/registry/servlet/RegistryServlet.java
   trunk/registry/modules/core/src/main/java/org/wso2/registry/servlet/Utils.java
Log:
making code cleaner

Modified: trunk/registry/modules/core/src/main/java/org/wso2/registry/secure/HSQLDBInitializer.java
==============================================================================
--- trunk/registry/modules/core/src/main/java/org/wso2/registry/secure/HSQLDBInitializer.java	(original)
+++ trunk/registry/modules/core/src/main/java/org/wso2/registry/secure/HSQLDBInitializer.java	Thu Nov  1 18:31:54 2007
@@ -39,7 +39,7 @@
             throw new RegistryException(msg);
         }
 
-        Connection conn = null;
+        Connection conn ;
         try {
             conn = DriverManager.getConnection(UserManagerConstants.HSQL_DB_URL, "sa", "");
 
@@ -77,11 +77,9 @@
             throw new RegistryException(msg);
 
         } finally {
-            if (conn != null) {
-                try {
-                    conn.close();
-                } catch (SQLException ignore) {}
-            }
+            try {
+                conn.close();
+            } catch (SQLException ignore) {}
         }
     }
 }

Modified: trunk/registry/modules/core/src/main/java/org/wso2/registry/secure/RegistryUserManager.java
==============================================================================
--- trunk/registry/modules/core/src/main/java/org/wso2/registry/secure/RegistryUserManager.java	(original)
+++ trunk/registry/modules/core/src/main/java/org/wso2/registry/secure/RegistryUserManager.java	Thu Nov  1 18:31:54 2007
@@ -194,15 +194,12 @@
     }
 
     public Map getUserProperties(String userName) throws RegistryException {
-
-        Map properties = null;
-
+        Map properties ;
         try {
             properties = realm.getUserProperties(userName);
         } catch (UserManagerException e) {
             throw new RegistryException(e.getMessage());
         }
-
         return properties;
     }
 

Modified: trunk/registry/modules/core/src/main/java/org/wso2/registry/secure/SecureRegistry.java
==============================================================================
--- trunk/registry/modules/core/src/main/java/org/wso2/registry/secure/SecureRegistry.java	(original)
+++ trunk/registry/modules/core/src/main/java/org/wso2/registry/secure/SecureRegistry.java	Thu Nov  1 18:31:54 2007
@@ -141,7 +141,7 @@
 
         String[] parts = pathToSplit.split(RegistryConstants.PATH_SEPARATOR);
         int partCount = parts.length;
-        String existingAscendant = "";
+        String existingAscendant;
         do {
             existingAscendant = "";
             if (partCount == 0) {

Modified: trunk/registry/modules/core/src/main/java/org/wso2/registry/servlet/FileUploadUtil.java
==============================================================================
--- trunk/registry/modules/core/src/main/java/org/wso2/registry/servlet/FileUploadUtil.java	(original)
+++ trunk/registry/modules/core/src/main/java/org/wso2/registry/servlet/FileUploadUtil.java	Thu Nov  1 18:31:54 2007
@@ -35,7 +35,7 @@
 
 public class FileUploadUtil {
     //TODO , we need to change the method signature
-    public static Artifact processUpload(HttpServletRequest req, HttpServletResponse res)
+    public static Artifact processUpload(HttpServletRequest req)
             throws IOException, ServletException {
         RequestContext reqContext = new ServletRequestContext(req);
         boolean isMultipart = ServletFileUpload.isMultipartContent(reqContext);

Modified: trunk/registry/modules/core/src/main/java/org/wso2/registry/servlet/RegistryServlet.java
==============================================================================
--- trunk/registry/modules/core/src/main/java/org/wso2/registry/servlet/RegistryServlet.java	(original)
+++ trunk/registry/modules/core/src/main/java/org/wso2/registry/servlet/RegistryServlet.java	Thu Nov  1 18:31:54 2007
@@ -60,7 +60,7 @@
     public void init(ServletConfig config) throws ServletException {
         super.init(config);
         Realm registryRealm;
-        Registry coreRegistry = null;
+        Registry coreRegistry ;
         try {
 
             // get the database config of the user manager from servlet init parameters. We can omit
@@ -98,14 +98,6 @@
 
         config.getServletContext().setAttribute(RegistryConstants.REGISTRY, coreRegistry);
         config.getServletContext().setAttribute(RegistryConstants.REGISTRY_REALM, registryRealm);
-
-        //following method is just to populate
-        // the repo for testing , we will remove this once we have working system
-        String mashupData = config.getInitParameter("mashupInit");
-        if (mashupData != null && mashupData.equalsIgnoreCase("true")) {
-            Utils.populateDummyData(coreRegistry);
-        }
-
         log.info(Messages.getMessage("server.initalized"));
     }
 
@@ -138,7 +130,7 @@
             Registry registry = Utils.getSecureRegistry(request);
 
             Artifact fileElement =
-                    FileUploadUtil.processUpload(request, response);
+                    FileUploadUtil.processUpload(request);
             String path = fileElement.getPath();
 
             registry.put(path, fileElement);

Modified: trunk/registry/modules/core/src/main/java/org/wso2/registry/servlet/Utils.java
==============================================================================
--- trunk/registry/modules/core/src/main/java/org/wso2/registry/servlet/Utils.java	(original)
+++ trunk/registry/modules/core/src/main/java/org/wso2/registry/servlet/Utils.java	Thu Nov  1 18:31:54 2007
@@ -62,6 +62,7 @@
      *
      * @param request Servlet request
      * @return SecureRegistry instance for the current session.
+     * @throws org.wso2.registry.RegistryException : if something went wrong
      */
     public static synchronized SecureRegistry getSecureRegistry(HttpServletRequest request)
             throws RegistryException {
@@ -91,8 +92,4 @@
         
         request.getSession().setAttribute(RegistryConstants.USER_REGISTRY, secureRegistry);
     }
-
-    public static void populateDummyData(Registry JDBCRegistry) {
-        // initialize the Registry with data here...
-    }
 }



More information about the Registry-dev mailing list