Author: deepal
Date: Sun Dec 23 08:44:33 2007
New Revision: 11697

Log:

code cleanup 

Modified:
   
trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/JDBCRegistry.java
   
trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/dao/VersionedResourceDAO.java
   
trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/queries/SQLQueryProcessor.java
   
trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/urlhandlers/CommentCollectionURLHandler.java
   
trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/urlhandlers/CommentURLHandler.java
   
trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/urlhandlers/RatingsCollectionURLHandler.java
   
trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/urlhandlers/TagURLHandler.java

Modified: 
trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/JDBCRegistry.java
==============================================================================
--- 
trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/JDBCRegistry.java
  (original)
+++ 
trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/JDBCRegistry.java
  Sun Dec 23 08:44:33 2007
@@ -65,7 +65,7 @@
 
     /**
      * Default constructor. JDBC registry should be configured using the 
configure(...) method, if
-     * it is instantiated using this contructor.
+     * it is instantiated using this constructor.
      */
     public JDBCRegistry() {
     }
@@ -89,8 +89,8 @@
      *
      * @param dataSource Data source to be used to store resources and 
metadata. Note that the same
      *                   data source may or may not be used as the data source 
of user manager.
-     * @param realm      User manager realm to handle authorizations. It is 
strongly recommented to
-     *                   use a realm instance contructed using the 
RegistryRealmFactory. All initail
+     * @param realm      User manager realm to handle authorizations. It is 
strongly recommended to
+     *                   use a realm instance constructed using the 
RegistryRealmFactory. All initial
      *                   users, roles and authorizations will be set on realms 
obtained using the
      *                   RegistryRealmFactory.
      * @throws RegistryException
@@ -191,7 +191,7 @@
         path = preparePath(path);
         Resource resource;
 
-        // check if this path referes to a resource referred by a URL query 
(e.g. comment)
+        // check if this path refers to a resource referred by a URL query 
(e.g. comment)
         resource = urlHandlerManager.handleURL(path);
 
         // check if the resource in the path has a mediatype handler
@@ -314,7 +314,7 @@
                 conn.close();
             } catch (SQLException ignore) {
                 log.info(
-                        "Exception while closing the DB connection in delte 
method of JDBCRegistry");
+                        "Exception while closing the DB connection in delete 
method of JDBCRegistry");
             }
         }
     }
@@ -787,7 +787,7 @@
     }
 
     /**
-     * Returns the avarage rating for the given resource. This is the average 
of all ratings done by
+     * Returns the average rating for the given resource. This is the average 
of all ratings done by
      * all users for the given resource.
      *
      * @param resourcePath Path of the resource.

Modified: 
trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/dao/VersionedResourceDAO.java
==============================================================================
--- 
trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/dao/VersionedResourceDAO.java
      (original)
+++ 
trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/dao/VersionedResourceDAO.java
      Sun Dec 23 08:44:33 2007
@@ -89,7 +89,7 @@
             
resource.setContent(versionResults.getBytes(DatabaseConstants.VERSION_CONTENT_FIELD));
         }
 
-        // get resource chidren
+        // get resource children
 
         if (resource.isDirectory()) {
 
@@ -165,7 +165,7 @@
             
resource.setContent(versionResults.getBytes(DatabaseConstants.VERSION_CONTENT_FIELD));
         }
 
-        // get resource chidren
+        // get resource children
 
         if (resource.isDirectory()) {
 
@@ -195,10 +195,10 @@
      * Returns the latest (current) version of an artifact. If artifact is a 
collection, all child
      * paths will be added as latest paths in the form /a/b
      *
-     * @param path : path of the artifacy
+     * @param path : path of the artifact
      * @param conn :Connection to DB
-     * @return : Result artifcat
-     * @throws SQLException : if somthing went wrong
+     * @return : Result artifact
+     * @throws SQLException : if something went wrong
      */
     public Resource getLatestVersion(String path, Connection conn) throws 
SQLException {
         /*
@@ -255,7 +255,7 @@
                     
versionResults.getTimestamp(DatabaseConstants.VERSION_UPDATED_TIME));
             
resource.setContent(versionResults.getBytes(DatabaseConstants.VERSION_CONTENT_FIELD));
         }
-        // get resource chidren
+        // get resource children
         if (resource.isDirectory()) {
             String[] children = getLatestChildPaths(resource.getId(),
                                                     
getCurrentVerisonNumber(path, conn), conn);
@@ -279,10 +279,10 @@
     }
 
     /**
-     * To get the currenet version for a give resource , current version may 
not be the latest
-     * version in all the caess. If someone retore a resource then the child 
nodes will remain same
-     * But the parent version will be changed. In that case the parent 
[foo/bar] verion will be the
-     * latest version but the child node verion [foo/bar/v1] will be an old 
verion . So when some
+     * To get the current version for a give resource , current version may 
not be the latest
+     * version in all the cases. If someone restore a resource then the child 
nodes will remain same
+     * But the parent version will be changed. In that case the parent 
[foo/bar] version will be the
+     * latest version but the child node version [foo/bar/v1] will be an old 
version . So when some
      * one ask for the resource value foo/bar/v1 then we need to calculate 
them correctly and give
      * that.
      *
@@ -513,7 +513,7 @@
 
         s.executeUpdate();
 
-        // remove existing properties for the updated artfact
+        // remove existing properties for the updated artifact
         removeProperties(resource.getId(), conn);
 
         // now add the updated properties to the properties table
@@ -626,8 +626,8 @@
         PreparedStatement statement = connection.prepareStatement(sql);
         statement.setLong(1, resource.getId());
 
-        // Need to getthe old version and increment that
-        // Selecet VID from latest table ,
+        // Need to get the old version and increment that
+        // Select VID from latest table ,
         // if it is there then find from that  , if it is not there then we 
need ti start from 0
         long versionNumber = getLatestVerisonNumber(resource.getId(), 
connection);
         if (versionNumber == -1) {
@@ -691,11 +691,11 @@
     }
 
     /**
-     * @param resource      : Artifcat we need to update itslef and its 
immediate parent
-     * @param versionNumber : Version number of the artifcat
+     * @param resource      : Artifact we need to update itself and its 
immediate parent
+     * @param versionNumber : Version number of the artifact
      * @param delete        : delete or adding
-     * @param connection    : DB connetion
-     * @return : Will retuen the resource version of the parent resource
+     * @param connection    : DB connection
+     * @return : Will return the resource version of the parent resource
      * @throws SQLException : if something went wrong
      */
     private long updateDependencyTable(Resource resource,
@@ -860,7 +860,7 @@
     }
 
     /**
-     * To restoreVersion or rollback artifcat to a given version number
+     * To restoreVersion or rollback artifact to a given version number
      *
      * @param resourceId : Resource ID
      * @param connection : Connection to DB
@@ -914,8 +914,8 @@
     }
 
     /**
-     * To delete a resource , what actualy happen here is that update the 
version table with the new
-     * data and resource will not actualy removed from the table
+     * To delete a resource , what actually happen here is that update the 
version table with the new
+     * data and resource will not actually removed from the table
      *
      * @param resource   : Resource to be deleted
      * @param connection : Connection to the DB
@@ -966,7 +966,7 @@
     }
 
     /**
-     * This method is use to see whether a give resource is actve or not , one 
can delte a resource
+     * This method is use to see whether a give resource is active or not , 
one can delete a resource
      * and try to access that giving the path of the resource in that case we 
should not return the
      * resource if it is deleted.
      *
@@ -992,7 +992,7 @@
 
     /**
      * Will check whether the status of the given resource is active in the DB 
., this method differ
-     * from isResourceActive b'coz this is actulay call the DB Not the other
+     * from isResourceActive because this is actually call the DB Not the other
      *
      * @param resourcePath : path to resource
      * @param connection   : connection to DB

Modified: 
trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/queries/SQLQueryProcessor.java
==============================================================================
--- 
trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/queries/SQLQueryProcessor.java
     (original)
+++ 
trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/queries/SQLQueryProcessor.java
     Sun Dec 23 08:44:33 2007
@@ -63,23 +63,19 @@
                 // Result is a normal resource, which is stored in the 
Resources table or a collection
                 // of normal resources.
 
-                Resource resourcesCollection = 
fillResourcesCollection(results, conn);
-                return resourcesCollection;
+                return fillResourcesCollection(results, conn);
 
             } else if 
(resultType.equals(RegistryConstants.COMMENTS_RESULT_TYPE)) {
 
-                Resource commentsCollection = fillCommentsCollection(results, 
conn);
-                return commentsCollection;
+                return fillCommentsCollection(results, conn);
 
             } else if 
(resultType.equals(RegistryConstants.RATINGS_RESULT_TYPE)) {
 
-                Resource ratingsCollection = fillRatingsCollection(results, 
conn);
-                return ratingsCollection;
+                return fillRatingsCollection(results, conn);
 
             } else if (resultType.equals(RegistryConstants.TAGS_RESULT_TYPE)) {
 
-                Resource tagsCollection = fillTagsCollection(results, conn);
-                return tagsCollection;
+                return fillTagsCollection(results, conn);
 
             } else if (resultType.equals("TagsWithCount")) {
 
@@ -129,7 +125,7 @@
     private Resource fillCommentsCollection(ResultSet results, Connection conn)
             throws SQLException {
 
-        // SQL query should resturn a list of 
DatabaseConstants.COMMENT_ID_FIELDs.
+        // SQL query should restrun a list of 
DatabaseConstants.COMMENT_ID_FIELDs.
         // resultArtifact contains a String[] of URLs for comments.
 
         // URL for a comment <resource_path>?comment<comment_id>
@@ -169,7 +165,7 @@
     private Resource fillRatingsCollection(ResultSet results, Connection conn)
             throws SQLException {
 
-        // SQL query should resturn a list of 
DatabaseConstants.RATING_ID_FIELDs
+        // SQL query should restrun a list of 
DatabaseConstants.RATING_ID_FIELDs
         // resultArtifact contains a String[] of URLs for ratings.
 
         // URL for a comment <resource_path>;ratings:<userName>

Modified: 
trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/urlhandlers/CommentCollectionURLHandler.java
==============================================================================
--- 
trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/urlhandlers/CommentCollectionURLHandler.java
       (original)
+++ 
trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/urlhandlers/CommentCollectionURLHandler.java
       Sun Dec 23 08:44:33 2007
@@ -59,7 +59,7 @@
 
         String resourcePath = parts[0];
 
-        Connection conn = null;
+        Connection conn ;
         try {
             conn = dataSource.getConnection();
         } catch (SQLException e) {

Modified: 
trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/urlhandlers/CommentURLHandler.java
==============================================================================
--- 
trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/urlhandlers/CommentURLHandler.java
 (original)
+++ 
trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/urlhandlers/CommentURLHandler.java
 Sun Dec 23 08:44:33 2007
@@ -66,7 +66,7 @@
             return false;
         }
 
-        long cID = 0;
+        long cID ;
         try {
             cID = Long.parseLong(commentID);
 

Modified: 
trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/urlhandlers/RatingsCollectionURLHandler.java
==============================================================================
--- 
trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/urlhandlers/RatingsCollectionURLHandler.java
       (original)
+++ 
trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/urlhandlers/RatingsCollectionURLHandler.java
       Sun Dec 23 08:44:33 2007
@@ -58,7 +58,7 @@
 
         String resourcePath = parts[0];
 
-        Connection conn = null;
+        Connection conn ;
         try {
             conn = dataSource.getConnection();
         } catch (SQLException e) {

Modified: 
trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/urlhandlers/TagURLHandler.java
==============================================================================
--- 
trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/urlhandlers/TagURLHandler.java
     (original)
+++ 
trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/urlhandlers/TagURLHandler.java
     Sun Dec 23 08:44:33 2007
@@ -62,7 +62,7 @@
         String tagName = queries[1];
         String userName = queries[2];
 
-        Connection conn = null;
+        Connection conn ;
         try {
             conn = dataSource.getConnection();
         } catch (SQLException e) {

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

Reply via email to