jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r446973 - in /jackrabbit/trunk/jca/src: main/java/org/apache/jackrabbit/jca/ test/java/org/apache/jackrabbit/jca/test/
Date Sat, 16 Sep 2006 23:33:08 GMT
Author: jukka
Date: Sat Sep 16 16:33:07 2006
New Revision: 446973

URL: http://svn.apache.org/viewvc?view=rev&rev=446973
Log:
JCR-97: Improved checkstyle conformance of the JCA adapter

Modified:
    jackrabbit/trunk/jca/src/main/java/org/apache/jackrabbit/jca/JCAConnectionManager.java
    jackrabbit/trunk/jca/src/main/java/org/apache/jackrabbit/jca/JCAConnectionRequestInfo.java
    jackrabbit/trunk/jca/src/main/java/org/apache/jackrabbit/jca/JCAManagedConnection.java
    jackrabbit/trunk/jca/src/main/java/org/apache/jackrabbit/jca/JCAManagedConnectionFactory.java
    jackrabbit/trunk/jca/src/main/java/org/apache/jackrabbit/jca/JCARepositoryManager.java
    jackrabbit/trunk/jca/src/main/java/org/apache/jackrabbit/jca/JCAResourceAdapter.java
    jackrabbit/trunk/jca/src/main/java/org/apache/jackrabbit/jca/TransactionBoundXAResource.java
    jackrabbit/trunk/jca/src/test/java/org/apache/jackrabbit/jca/test/AbstractTestCase.java
    jackrabbit/trunk/jca/src/test/java/org/apache/jackrabbit/jca/test/ConnectionFactoryTest.java

Modified: jackrabbit/trunk/jca/src/main/java/org/apache/jackrabbit/jca/JCAConnectionManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jca/src/main/java/org/apache/jackrabbit/jca/JCAConnectionManager.java?view=diff&rev=446973&r1=446972&r2=446973
==============================================================================
--- jackrabbit/trunk/jca/src/main/java/org/apache/jackrabbit/jca/JCAConnectionManager.java
(original)
+++ jackrabbit/trunk/jca/src/main/java/org/apache/jackrabbit/jca/JCAConnectionManager.java
Sat Sep 16 16:33:07 2006
@@ -25,9 +25,8 @@
 /**
  * This class implements the default connection manager.
  */
-public final class JCAConnectionManager
-        implements ConnectionManager {
-    
+public final class JCAConnectionManager implements ConnectionManager {
+
     /**
      * The method allocateConnection gets called by the resource adapter's
      * connection factory instance.

Modified: jackrabbit/trunk/jca/src/main/java/org/apache/jackrabbit/jca/JCAConnectionRequestInfo.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jca/src/main/java/org/apache/jackrabbit/jca/JCAConnectionRequestInfo.java?view=diff&rev=446973&r1=446972&r2=446973
==============================================================================
--- jackrabbit/trunk/jca/src/main/java/org/apache/jackrabbit/jca/JCAConnectionRequestInfo.java
(original)
+++ jackrabbit/trunk/jca/src/main/java/org/apache/jackrabbit/jca/JCAConnectionRequestInfo.java
Sat Sep 16 16:33:07 2006
@@ -26,9 +26,8 @@
  * This class encapsulates the credentials for creating a
  * session from the repository.
  */
-public final class JCAConnectionRequestInfo
-        implements ConnectionRequestInfo {
-    
+public final class JCAConnectionRequestInfo implements ConnectionRequestInfo {
+
     /**
      * Credentials.
      */
@@ -94,8 +93,8 @@
      * Return true if equals.
      */
     private boolean equals(JCAConnectionRequestInfo o) {
-        return equals(workspace, o.workspace) &&
-                equals(creds, o.creds);
+        return equals(workspace, o.workspace)
+            && equals(creds, o.creds);
     }
 
     /**

Modified: jackrabbit/trunk/jca/src/main/java/org/apache/jackrabbit/jca/JCAManagedConnection.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jca/src/main/java/org/apache/jackrabbit/jca/JCAManagedConnection.java?view=diff&rev=446973&r1=446972&r2=446973
==============================================================================
--- jackrabbit/trunk/jca/src/main/java/org/apache/jackrabbit/jca/JCAManagedConnection.java
(original)
+++ jackrabbit/trunk/jca/src/main/java/org/apache/jackrabbit/jca/JCAManagedConnection.java
Sat Sep 16 16:33:07 2006
@@ -40,7 +40,7 @@
  */
 public final class JCAManagedConnection
         implements ManagedConnection, ManagedConnectionMetaData {
-    
+
     /**
      * Managed connection factory.
      */
@@ -322,6 +322,8 @@
                     case ConnectionEvent.LOCAL_TRANSACTION_STARTED:
                         listener.localTransactionStarted(event);
                         break;
+                    default:
+                        // Unknown event, skip
                 }
             }
         }

Modified: jackrabbit/trunk/jca/src/main/java/org/apache/jackrabbit/jca/JCAManagedConnectionFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jca/src/main/java/org/apache/jackrabbit/jca/JCAManagedConnectionFactory.java?view=diff&rev=446973&r1=446972&r2=446973
==============================================================================
--- jackrabbit/trunk/jca/src/main/java/org/apache/jackrabbit/jca/JCAManagedConnectionFactory.java
(original)
+++ jackrabbit/trunk/jca/src/main/java/org/apache/jackrabbit/jca/JCAManagedConnectionFactory.java
Sat Sep 16 16:33:07 2006
@@ -238,8 +238,8 @@
      * Return true if equals.
      */
     private boolean equals(JCAManagedConnectionFactory o) {
-        return equals(homeDir, o.homeDir) &&
-               equals(configFile, o.configFile);
+        return equals(homeDir, o.homeDir)
+            && equals(configFile, o.configFile);
     }
 
     /**
@@ -283,13 +283,13 @@
         }
     }
 
-	/**
-	 * Shutdown the repository.
-	 */
-	protected void finalize() {
+    /**
+     * Shutdown the repository.
+     */
+    protected void finalize() {
         JCARepositoryManager mgr = JCARepositoryManager.getInstance();
         mgr.autoShutdownRepository(homeDir, configFile);
-	}
+    }
 
     public Boolean getBindSessionToTrasaction() {
         return bindSessionToTrasaction;

Modified: jackrabbit/trunk/jca/src/main/java/org/apache/jackrabbit/jca/JCARepositoryManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jca/src/main/java/org/apache/jackrabbit/jca/JCARepositoryManager.java?view=diff&rev=446973&r1=446972&r2=446973
==============================================================================
--- jackrabbit/trunk/jca/src/main/java/org/apache/jackrabbit/jca/JCARepositoryManager.java
(original)
+++ jackrabbit/trunk/jca/src/main/java/org/apache/jackrabbit/jca/JCARepositoryManager.java
Sat Sep 16 16:33:07 2006
@@ -31,27 +31,27 @@
  * This class implements the repository manager.
  */
 public final class JCARepositoryManager {
-	
+
     /** The config file prefix that signifies the file is to be loaded from the classpath.
*/
     public static final String CLASSPATH_CONFIG_PREFIX = "classpath:";
 
     /**
      * Instance of manager.
      */
-    private final static JCARepositoryManager INSTANCE =
+    private static final JCARepositoryManager INSTANCE =
             new JCARepositoryManager();
 
     /**
      * References.
      */
     private final Map references;
-    
+
     /**
-     * Flag indicating that the life cycle 
+     * Flag indicating that the life cycle
      * of the resource is not managed by the
-     * application server 
+     * application server
      */
-    private boolean autoShutdown = true ;
+    private boolean autoShutdown = true;
 
     /**
      * Construct the manager.
@@ -67,7 +67,7 @@
      * @param configFile The path to the repository configuration file. If the file is located
on
      *                   the classpath, the path should be prepended with
      *                   JCARepositoryManager.CLASSPATH_CONFIG_PREFIX.
-     *
+     * @return repository instance
      */
     public RepositoryImpl createRepository(String homeDir, String configFile)
             throws RepositoryException {
@@ -79,19 +79,18 @@
      * Shutdown all the repositories.
      */
     public void shutdown() {
-    	Collection references = this.references.values() ;
-    	Iterator iter = references.iterator() ;
-    	while (iter.hasNext()) {
-			Reference ref = (Reference) iter.next();
-			ref.shutdown();	
-		}
+        Collection references = this.references.values();
+        Iterator iter = references.iterator();
+        while (iter.hasNext()) {
+            Reference ref = (Reference) iter.next();
+            ref.shutdown();
+        }
         this.references.clear();
     }
-    
 
     /**
      * Return the reference.
-     * 
+     *
      * @param homeDir   The location of the repository.
      * @param configFile The path to the repository configuration file.
      */
@@ -125,7 +124,7 @@
 
         /**
          * Configuration file.
-         * 
+         *
          * Configuration files located on the classpath begin with
          * JCARepositoryManager.CLASSPATH_CONFIG_PREFIX.
          */
@@ -158,7 +157,7 @@
                     if (cl == null) {
                         cl = this.getClass().getClassLoader();
                     }
-                    
+
                     InputStream configInputStream = cl.getResourceAsStream(
                         configFile.substring(CLASSPATH_CONFIG_PREFIX.length()));
                     config = RepositoryConfig.create(configInputStream, homeDir);
@@ -175,7 +174,7 @@
          * Shutdown the repository.
          */
         public void shutdown() {
-	        repository.shutdown();
+            repository.shutdown();
         }
 
         /**
@@ -204,8 +203,8 @@
          * Return true if equals.
          */
         private boolean equals(Reference o) {
-            return equals(homeDir, o.homeDir) &&
-                   equals(configFile, o.configFile);
+            return equals(homeDir, o.homeDir)
+                && equals(configFile, o.configFile);
         }
 
         /**
@@ -222,26 +221,27 @@
         }
     }
 
-	public boolean isAutoShutdown() {
-		return autoShutdown;
-	}
-
-	public void setAutoShutdown(boolean autoShutdown) {
-		this.autoShutdown = autoShutdown;
-	}
-
-	/**
-	 * Try to shutdown the repository only if
-	 * {@link JCARepositoryManager#autoShutdown} is true.
+    public boolean isAutoShutdown() {
+        return autoShutdown;
+    }
+
+    public void setAutoShutdown(boolean autoShutdown) {
+        this.autoShutdown = autoShutdown;
+    }
+
+    /**
+     * Try to shutdown the repository only if
+     * {@link JCARepositoryManager#autoShutdown} is true.
      *
      * @param homeDir   The location of the repository.
      * @param configFile The path to the repository configuration file.
-      */
-	public void autoShutdownRepository(String homeDir, String configFile) {
-		if (this.isAutoShutdown()) {
-		    Reference ref = getReference(homeDir, configFile);
-		    ref.shutdown();
-		}
-	}
+     */
+    public void autoShutdownRepository(String homeDir, String configFile) {
+        if (this.isAutoShutdown()) {
+            Reference ref = getReference(homeDir, configFile);
+            ref.shutdown();
+        }
+    }
+
 }
 

Modified: jackrabbit/trunk/jca/src/main/java/org/apache/jackrabbit/jca/JCAResourceAdapter.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jca/src/main/java/org/apache/jackrabbit/jca/JCAResourceAdapter.java?view=diff&rev=446973&r1=446972&r2=446973
==============================================================================
--- jackrabbit/trunk/jca/src/main/java/org/apache/jackrabbit/jca/JCAResourceAdapter.java (original)
+++ jackrabbit/trunk/jca/src/main/java/org/apache/jackrabbit/jca/JCAResourceAdapter.java Sat
Sep 16 16:33:07 2006
@@ -10,35 +10,35 @@
 
 
 /**
- * JCR ResourceAdapter. 
+ * JCR ResourceAdapter.
  */
 public class JCAResourceAdapter implements ResourceAdapter {
-	private final XAResource[] xaResources = new XAResource[0];
 
-	/**
-	 * Notify the RepositoryManager that the lifecycle is managed by
-	 * the container
-	 */
-	public void start(BootstrapContext ctx) throws ResourceAdapterInternalException {
-		JCARepositoryManager.getInstance().setAutoShutdown(false);
-	}
-
-	/**
-	 * Shutdown jackrabbit repositories
-	 */
-	public void stop() {
-		JCARepositoryManager.getInstance().shutdown();
-	}
-
-	public void endpointActivation(MessageEndpointFactory mef, ActivationSpec as) throws ResourceException
{
-	}
-
-	public void endpointDeactivation(MessageEndpointFactory mef, ActivationSpec as) {
-	}
-
-	public XAResource[] getXAResources(ActivationSpec[] as) throws ResourceException {
-		return xaResources;
-	}
+    private final XAResource[] xaResources = new XAResource[0];
 
+    /**
+     * Notify the RepositoryManager that the lifecycle is managed by
+     * the container
+     */
+    public void start(BootstrapContext ctx) throws ResourceAdapterInternalException {
+        JCARepositoryManager.getInstance().setAutoShutdown(false);
+    }
+
+    /**
+     * Shutdown jackrabbit repositories
+     */
+    public void stop() {
+        JCARepositoryManager.getInstance().shutdown();
+    }
+
+    public void endpointActivation(MessageEndpointFactory mef, ActivationSpec as) throws
ResourceException {
+    }
+
+    public void endpointDeactivation(MessageEndpointFactory mef, ActivationSpec as) {
+    }
+
+    public XAResource[] getXAResources(ActivationSpec[] as) throws ResourceException {
+        return xaResources;
+    }
 
 }

Modified: jackrabbit/trunk/jca/src/main/java/org/apache/jackrabbit/jca/TransactionBoundXAResource.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jca/src/main/java/org/apache/jackrabbit/jca/TransactionBoundXAResource.java?view=diff&rev=446973&r1=446972&r2=446973
==============================================================================
--- jackrabbit/trunk/jca/src/main/java/org/apache/jackrabbit/jca/TransactionBoundXAResource.java
(original)
+++ jackrabbit/trunk/jca/src/main/java/org/apache/jackrabbit/jca/TransactionBoundXAResource.java
Sat Sep 16 16:33:07 2006
@@ -48,7 +48,7 @@
                 this.connection.closeHandles();
             }
             // reuse the XAResource
-            this.ending = false ;
+            this.ending = false;
         }
     }
 

Modified: jackrabbit/trunk/jca/src/test/java/org/apache/jackrabbit/jca/test/AbstractTestCase.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jca/src/test/java/org/apache/jackrabbit/jca/test/AbstractTestCase.java?view=diff&rev=446973&r1=446972&r2=446973
==============================================================================
--- jackrabbit/trunk/jca/src/test/java/org/apache/jackrabbit/jca/test/AbstractTestCase.java
(original)
+++ jackrabbit/trunk/jca/src/test/java/org/apache/jackrabbit/jca/test/AbstractTestCase.java
Sat Sep 16 16:33:07 2006
@@ -31,32 +31,30 @@
     /**
      * Repository home directory.
      */
-    public final static String JCR_HOME_DIR =
-            "applications/test";
+    public static final String JCR_HOME_DIR = "applications/test";
 
     /**
      * Repository configuration file.
      */
-    public final static String JCR_CONFIG_FILE =
-            "applications/test/repository.xml";
+    public static final String JCR_CONFIG_FILE =
+        "applications/test/repository.xml";
 
     /**
      * Default credentials.
      */
-    public final static Credentials JCR_SUPERUSER =
+    public static final Credentials JCR_SUPERUSER =
             new SimpleCredentials("superuser", new char[0]);
 
     /**
      * Anonymous credentials.
      */
-    public final static Credentials JCR_ANONUSER =
+    public static final Credentials JCR_ANONUSER =
             new SimpleCredentials("anonymous", new char[0]);
 
     /**
      * Repository workspace.
      */
-    public final static String JCR_WORKSPACE =
-            "default";
+    public static final String JCR_WORKSPACE = "default";
 
     /**
      * Managed connection factory.
@@ -66,11 +64,11 @@
     /**
      * Setup the test.
      */
-    protected void setUp()
-            throws Exception {
+    protected void setUp() {
         // Construct the managed connection factory
         this.mcf = new JCAManagedConnectionFactory();
         this.mcf.setHomeDir(JCR_HOME_DIR);
         this.mcf.setConfigFile(JCR_CONFIG_FILE);
     }
+
 }

Modified: jackrabbit/trunk/jca/src/test/java/org/apache/jackrabbit/jca/test/ConnectionFactoryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jca/src/test/java/org/apache/jackrabbit/jca/test/ConnectionFactoryTest.java?view=diff&rev=446973&r1=446972&r2=446973
==============================================================================
--- jackrabbit/trunk/jca/src/test/java/org/apache/jackrabbit/jca/test/ConnectionFactoryTest.java
(original)
+++ jackrabbit/trunk/jca/src/test/java/org/apache/jackrabbit/jca/test/ConnectionFactoryTest.java
Sat Sep 16 16:33:07 2006
@@ -36,8 +36,7 @@
     /**
      * Test the connection factory allocation.
      */
-    public void testAllocation()
-            throws Exception {
+    public void testAllocation() throws Exception {
 
         // Create the connection factory
         Object cf = mcf.createConnectionFactory();
@@ -56,8 +55,7 @@
     /**
      * Test the connection matching.
      */
-    public void testMatching()
-            throws Exception {
+    public void testMatching() throws Exception {
 
         // Create connection request infos
         JCAConnectionRequestInfo cri1 = new JCAConnectionRequestInfo(JCR_SUPERUSER, JCR_WORKSPACE);
@@ -77,7 +75,7 @@
         HashSet connectionSet = new HashSet();
         connectionSet.add(mc1);
         connectionSet.add(mc2);
-        
+
         // Match the first connection
         JCAConnectionRequestInfo cri3 = new JCAConnectionRequestInfo(cri1);
         assertTrue((cri1 != cri3) && cri1.equals(cri3));
@@ -94,15 +92,15 @@
     /**
      * Test if the connection factory is serializable.
      */
-    public void testSerializable()
-            throws Exception {
+    public void testSerializable() throws Exception {
 
         // Create the connection factory
         Object cf = mcf.createConnectionFactory();
-        
+
         // Check if serializable and referenceable
         assertTrue(cf != null);
         assertTrue(cf instanceof Serializable);
         assertTrue(cf instanceof Referenceable);
     }
+
 }



Mime
View raw message