You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wsrf-commits@ws.apache.org by ip...@apache.org on 2005/07/20 17:05:28 UTC

svn commit: r219922 - in /webservices/wsrf/trunk/src/java/org/apache/ws/resource: ResourceHome.java impl/AbstractResourceHome.java

Author: ips
Date: Wed Jul 20 08:05:27 2005
New Revision: 219922

URL: http://svn.apache.org/viewcvs?rev=219922&view=rev
Log:
javadoc

Modified:
    webservices/wsrf/trunk/src/java/org/apache/ws/resource/ResourceHome.java
    webservices/wsrf/trunk/src/java/org/apache/ws/resource/impl/AbstractResourceHome.java

Modified: webservices/wsrf/trunk/src/java/org/apache/ws/resource/ResourceHome.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/resource/ResourceHome.java?rev=219922&r1=219921&r2=219922&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/resource/ResourceHome.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/resource/ResourceHome.java Wed Jul 20 08:05:27 2005
@@ -31,7 +31,8 @@
      * a resource identifier.
      *
      * @return the resource identifier header element name, represented as
-     *         a string as defined by {@link javax.xml.namespace.QName#toString()};
+     *         a string in the format defined by
+     *         {@link javax.xml.namespace.QName#toString()};
      *         or null if this home manages a singleton resource
      */
     String getResourceIdentifierReferenceParameterName();
@@ -98,13 +99,11 @@
      * @return non-null resource
      *
      * @throws ResourceUnknownException    if no resource exists with the given key
-     * @throws InvalidResourceKeyException if the resource key is invalid.
      * @throws ResourceException           if any other error occurs.
      */
     Resource find( Object resourceId )
             throws
             ResourceUnknownException,
-            InvalidResourceKeyException,
             ResourceException;
 
     /**
@@ -112,15 +111,9 @@
      * prior to removal.
      *
      * @throws ResourceUnknownException    if no resource exists with the given key
-     * @throws InvalidResourceKeyException if the resource key is invalid.
-     * @throws RemoveNotSupportedException if remove operation is not supported.
-     * @throws ResourceException           if any other error occurs.
+     * @throws ResourceException           if any other error occurs
      */
-    void remove( Object resourceId )
-            throws ResourceException,
-            ResourceUnknownException,
-            InvalidResourceKeyException,
-            RemoveNotSupportedException;
+    void remove( Object resourceId ) throws ResourceUnknownException, ResourceException;
 
     /**
      * Builds an EPR based on the specified endpoint address, resource key, and WS-Addressing

Modified: webservices/wsrf/trunk/src/java/org/apache/ws/resource/impl/AbstractResourceHome.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/resource/impl/AbstractResourceHome.java?rev=219922&r1=219921&r2=219922&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/resource/impl/AbstractResourceHome.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/resource/impl/AbstractResourceHome.java Wed Jul 20 08:05:27 2005
@@ -17,13 +17,12 @@
 
 import commonj.timers.Timer;
 import commonj.timers.TimerManager;
+import org.apache.commons.collections.map.ReferenceMap;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.commons.collections.map.ReferenceMap;
 import org.apache.ws.Soap1_1Constants;
 import org.apache.ws.addressing.EndpointReference;
 import org.apache.ws.addressing.XmlBeansEndpointReference;
-import org.apache.ws.resource.InvalidResourceKeyException;
 import org.apache.ws.resource.JndiConstants;
 import org.apache.ws.resource.PropertiesResource;
 import org.apache.ws.resource.Resource;
@@ -56,13 +55,15 @@
 import javax.xml.soap.SOAPHeader;
 import javax.xml.soap.SOAPHeaderElement;
 import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import java.util.HashMap;
-import java.util.Collections;
 
 /**
+ * TODO: update these Javadocs
+ * 
  * LOG-DONE An implementation of the <code>ResourceHome</code> interface. This implementation was designed to work with
  * resources that implement the {@link PersistentResource PersistenceCallback} interface as well as memory resident
  * resources. If the resource class implements the {@link PersistentResource PersistenceCallback} interface
@@ -329,35 +330,19 @@
     }
 
     /**
-     * DOCUMENT_ME
-     *
-     * @param id DOCUMENT_ME
-     *
-     * @return DOCUMENT_ME
-     *
-     * @throws ResourceException           if
-     * @throws InvalidResourceKeyException DOCUMENT_ME
+     * @see ResourceHome#find(Object)
      */
-    public Resource find( Object id )
-            throws ResourceException
+    public Resource find( Object resourceId )
+            throws
+            ResourceUnknownException,
+            ResourceException
     {
-
-        LOG.debug( MSG.getMessage( Keys.FINDING_RESOURCE_WITH_KEY, String.valueOf( id ) ) );
-
+        LOG.debug( MSG.getMessage( Keys.FINDING_RESOURCE_WITH_KEY, String.valueOf( resourceId ) ) );
         Resource resource = null;
-        Lock lock = getLock( id );
-        try
-        {
-            lock.acquire();
-        }
-        catch ( InterruptedException ie )
-        {
-            throw new ResourceException( ie );
-        }
-
+        Lock lock = acquireLock( resourceId );
         try
         {
-            resource = get( id );
+            resource = get( resourceId );
             if ( m_cache != null )
             {
                 m_cache.update( resource );
@@ -367,41 +352,20 @@
         {
             lock.release();
         }
-
         return resource;
     }
 
-    private synchronized Lock getLock( Object id )
-    {
-        return m_lockManager.getLock( getNonNullKey( id ) );
-    }
-
     /**
-     * DOCUMENT_ME
-     *
-     * @param id DOCUMENT_ME
-     *
-     * @throws ResourceException           DOCUMENT_ME
-     * @throws InvalidResourceKeyException DOCUMENT_ME
+     * @see ResourceHome#remove(Object)
      */
-    public void remove( Object id )
-            throws ResourceException
+    public void remove( Object resourceId )
+            throws ResourceUnknownException, ResourceException
     {
-
         Resource resource = null;
-        Lock lock = getLock( id );
+        Lock lock = acquireLock( resourceId );
         try
         {
-            lock.acquire();
-        }
-        catch ( InterruptedException ie )
-        {
-            throw new ResourceException( ie );
-        }
-
-        try
-        {
-            resource = get( id );
+            resource = get( resourceId );
 
             try
             {
@@ -412,13 +376,13 @@
                 throw new ResourceException( MSG.getMessage( Keys.FAILED_TO_DESTROY_RESOURCE, resource, re ) );
             }
 
-            Resource removedResource = (Resource) m_resources.remove( getNonNullKey( id ) );
+            Resource removedResource = (Resource) m_resources.remove( getNonNullKey( resourceId ) );
             if ( removedResource instanceof PropertiesResource )
             {
                 notifyResourceDeletedListeners( removedResource );
             }
             LOG.debug( MSG.getMessage( Keys.REMOVED_RESOURCE_WITH_KEY, resource.getClass().getName(),
-                    String.valueOf( id ) ) );
+                    String.valueOf( resourceId ) ) );
             if ( m_cache != null )
             {
                 m_cache.remove( resource );
@@ -431,6 +395,21 @@
 
     }
 
+    private Lock acquireLock( Object resourceId )
+            throws ResourceException
+    {
+        Lock lock = m_lockManager.getLock( getNonNullKey( resourceId ) );
+        try
+        {
+            lock.acquire();
+        }
+        catch ( InterruptedException ie )
+        {
+            throw new ResourceException( ie );
+        }
+        return lock;
+    }
+
     /**
      * DOCUMENT_ME
      *
@@ -551,11 +530,11 @@
         notifyResourceCreatedListeners( resource );
     }
 
-    private Resource get( Object id )
+    private Resource get( Object resourceId )
             throws ResourceException
     {
-        LOG.debug( MSG.getMessage( Keys.GET_RESOURCE_FOR_KEY, String.valueOf( id ) ) );
-        Object key = getNonNullKey( id );
+        LOG.debug( MSG.getMessage( Keys.GET_RESOURCE_FOR_KEY, String.valueOf( resourceId ) ) );
+        Object key = getNonNullKey( resourceId );
         Resource resource = (Resource) m_resources.get( key );
         if ( resource == null )
         {
@@ -563,7 +542,7 @@
             {
                 throw new ResourceUnknownException( key, getServicePortName() );
             }
-            addResource( key, createNewInstanceAndLoad( id ) );
+            addResource( key, createNewInstanceAndLoad( resourceId ) );
         }
         return resource;
     }