You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pubscribe-commits@ws.apache.org by ip...@apache.org on 2005/07/27 19:32:15 UTC

svn commit: r225555 - in /webservices/pubscribe/trunk/src: examples/broker/ examples/filesystem/src/java/org/apache/ws/resource/example/filesystem/ test/org/apache/ws/notification/base/impl/

Author: ips
Date: Wed Jul 27 10:32:10 2005
New Revision: 225555

URL: http://svn.apache.org/viewcvs?rev=225555&view=rev
Log:
compile fixes

Removed:
    webservices/pubscribe/trunk/src/examples/broker/AbstractBrokerHome.java
Modified:
    webservices/pubscribe/trunk/src/examples/broker/BrokerHome.java
    webservices/pubscribe/trunk/src/examples/broker/BrokerResource.java
    webservices/pubscribe/trunk/src/examples/filesystem/src/java/org/apache/ws/resource/example/filesystem/AbstractFilesystemHome.java
    webservices/pubscribe/trunk/src/examples/filesystem/src/java/org/apache/ws/resource/example/filesystem/FilesystemHome.java
    webservices/pubscribe/trunk/src/test/org/apache/ws/notification/base/impl/UnitResourceContext.java

Modified: webservices/pubscribe/trunk/src/examples/broker/BrokerHome.java
URL: http://svn.apache.org/viewcvs/webservices/pubscribe/trunk/src/examples/broker/BrokerHome.java?rev=225555&r1=225554&r2=225555&view=diff
==============================================================================
--- webservices/pubscribe/trunk/src/examples/broker/BrokerHome.java (original)
+++ webservices/pubscribe/trunk/src/examples/broker/BrokerHome.java Wed Jul 27 10:32:10 2005
@@ -6,8 +6,9 @@
 import org.apache.ws.resource.impl.AbstractResourceHome;
 
 import javax.xml.namespace.QName;
+import java.util.Map;
 
-public class BrokerHome extends AbstractBrokerHome{
+public class BrokerHome extends AbstractResourceHome{
     
     /** Creates a new instance of NotificationProducerHome */
     public BrokerHome() {
@@ -40,6 +41,25 @@
     public org.apache.ws.resource.properties.NamespaceVersionHolder getNamespaceVersionHolder()
     {
         return null;
+    }
+
+    /**
+     * Map containing all FilesystemResource instances - this map <em>must</em> be static for
+     * compatibility with certain JNDI providers.
+     */
+    private static Map s_resources;
+
+    /**
+     * Returns a map of all FilesystemResource instances. Used by the {@link AbstractResourceHome}
+     * superclass.
+     */
+    protected synchronized final Map getResourceMap()
+    {
+        if ( s_resources == null )
+        {
+            s_resources = AbstractResourceHome.createResourceMap( m_resourceIsPersistent );
+        }
+        return s_resources;
     }
 
 }

Modified: webservices/pubscribe/trunk/src/examples/broker/BrokerResource.java
URL: http://svn.apache.org/viewcvs/webservices/pubscribe/trunk/src/examples/broker/BrokerResource.java?rev=225555&r1=225554&r2=225555&view=diff
==============================================================================
--- webservices/pubscribe/trunk/src/examples/broker/BrokerResource.java (original)
+++ webservices/pubscribe/trunk/src/examples/broker/BrokerResource.java Wed Jul 27 10:32:10 2005
@@ -13,7 +13,7 @@
     
     /** Creates a new instance of BrokerResource */
     public BrokerResource() {
-        m_topicSpaceSet = new TopicSpaceSetImpl();
+        m_topicSpaceSet = new TopicSpaceSetImpl( true );
         //m_topicSpace = new TopicSpaceImpl("http://www.borker.de");
         //m_topicSpace.addTopic(new TopicImpl("root"));
         m_topicSpaceSet.addTopicSpace(org.apache.ws.notification.topics.util.TopicSpaceParser.parse(Thread.currentThread().getContextClassLoader().getResourceAsStream("topicspace.xml")));   

Modified: webservices/pubscribe/trunk/src/examples/filesystem/src/java/org/apache/ws/resource/example/filesystem/AbstractFilesystemHome.java
URL: http://svn.apache.org/viewcvs/webservices/pubscribe/trunk/src/examples/filesystem/src/java/org/apache/ws/resource/example/filesystem/AbstractFilesystemHome.java?rev=225555&r1=225554&r2=225555&view=diff
==============================================================================
--- webservices/pubscribe/trunk/src/examples/filesystem/src/java/org/apache/ws/resource/example/filesystem/AbstractFilesystemHome.java (original)
+++ webservices/pubscribe/trunk/src/examples/filesystem/src/java/org/apache/ws/resource/example/filesystem/AbstractFilesystemHome.java Wed Jul 27 10:32:10 2005
@@ -1,14 +1,8 @@
 package org.apache.ws.resource.example.filesystem;
 
 import org.apache.ws.resource.impl.AbstractResourceHome;
-import org.apache.commons.collections.map.ReferenceMap;
 
 import java.util.Map;
-import java.util.HashMap;
-import java.util.Collections;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
 
 /**
  * This class should not be modified.
@@ -20,32 +14,24 @@
  */
 abstract class AbstractFilesystemHome extends AbstractResourceHome
 {
+    
     /**
-     * The static reference which is maintained and used by the AbstractResourceHome.
-     * <p/>
-     * Do not modify.
+     * Map containing all FilesystemResource instances - this map <em>must</em> be static for
+     * compatibility with certain JNDI providers.
      */
-    private static Map m_resource;
+    private static Map s_resources;
 
     /**
-     * Do not modify this method.
+     * Returns a map of all FilesystemResource instances. Used by the {@link org.apache.ws.resource.impl.AbstractResourceHome}
+     * superclass.
      */
-    protected final Map initResourceMap()
-            throws NamingException
+    protected synchronized final Map getResourceMap()
     {
-        Context initialContext = new InitialContext();
-        if (m_resourceIsPersistent)
+        if ( s_resources == null )
         {
-            m_resources = new ReferenceMap(ReferenceMap.HARD, ReferenceMap.SOFT, true);
-            initCachePolicy(initialContext);
+            s_resources = AbstractResourceHome.createResourceMap( m_resourceIsPersistent );
         }
-        else
-        {
-            m_resources = new HashMap();
-        }
-
-        m_resources = Collections.synchronizedMap(m_resources);
-        return m_resources;
+        return s_resources;
     }
 
 }

Modified: webservices/pubscribe/trunk/src/examples/filesystem/src/java/org/apache/ws/resource/example/filesystem/FilesystemHome.java
URL: http://svn.apache.org/viewcvs/webservices/pubscribe/trunk/src/examples/filesystem/src/java/org/apache/ws/resource/example/filesystem/FilesystemHome.java?rev=225555&r1=225554&r2=225555&view=diff
==============================================================================
--- webservices/pubscribe/trunk/src/examples/filesystem/src/java/org/apache/ws/resource/example/filesystem/FilesystemHome.java (original)
+++ webservices/pubscribe/trunk/src/examples/filesystem/src/java/org/apache/ws/resource/example/filesystem/FilesystemHome.java Wed Jul 27 10:32:10 2005
@@ -1,17 +1,7 @@
 
 package org.apache.ws.resource.example.filesystem;
 
-import org.apache.ws.resource.Resource;
-import org.apache.ws.resource.ResourceContext;
-import org.apache.ws.resource.ResourceContextException;
-import org.apache.ws.resource.ResourceException;
-import org.apache.ws.resource.ResourceKey;
-import org.apache.ws.resource.ResourceUnknownException;
-import org.apache.ws.resource.impl.AbstractResourceHome;
-import org.apache.ws.addressing.EndpointReference;
-
 import javax.xml.namespace.QName;
-
 import java.io.Serializable;
 
 /**
@@ -24,6 +14,21 @@
         implements Serializable
 {
 
+    private static final String LVOL1_ID = "/dev/vg00/lvol1";
+    private static final String LVOL2_ID = "/dev/vg00/lvol2";
+
+    /**
+     * Create and add two resource instances.
+     *
+     * @throws Exception on error
+     */
+    public void init() throws Exception
+    {
+        super.init();
+        add( createInstance( LVOL1_ID ) );
+        add( createInstance( LVOL2_ID ) );
+    }
+
     /**  The service endpoint name as registered with the SOAP Platform.  This is useful for building EPR's. **/
     public static final QName SERVICE_NAME = javax.xml.namespace.QName.valueOf("{http://ws.apache.org/resource/example/filesystem}filesystem");
 
@@ -43,56 +48,6 @@
         /** A constant for the JNDI Lookup name for this home. **/
     public static final String  HOME_LOCATION =
      org.apache.ws.resource.JndiConstants.CONTEXT_NAME_SERVICES + "/" + SERVICE_NAME.getLocalPart() + "/" + org.apache.ws.resource.JndiConstants.ATOMIC_NAME_HOME;
-
-    /**
-     *
-     * @param resourceContext
-     *
-     * @return A Resource
-     *
-     * @throws ResourceException
-     * @throws ResourceContextException
-     * @throws ResourceUnknownException
-     */
-    public Resource getInstance( ResourceContext resourceContext )
-	            throws ResourceException,
-	            ResourceContextException,
-	            ResourceUnknownException
-	    {
-	        ResourceKey key = resourceContext.getResourceKey();
-	        FilesystemResource resource = null;
-	        try
-	        {
-	            resource = (FilesystemResource)find( key );
-	        }
-	        catch ( ResourceException re )
-	        {
-	            Object id = key.getValue();
-	         /**
-	          * Determine if the passed-in key is, in fact, something we expect.
-	          */
-	         if ( id.equals( "/dev/vg00/lvol1" ) || id.equals( "/dev/vg00/lvol2" ) )
-	         {
-	            try
-	            {
-	               resource = (FilesystemResource)createInstance( key);
-	               EndpointReference epr = getEndpointReference(resourceContext.getBaseURL(  ) + "/" + getServiceName().getLocalPart() , key, SPEC_NAMESPACE_SET.getAddressingNamespace());
-	               resource.setEndpointReference(epr);
-	            }
-	            catch ( Exception e )
-	            {
-	               throw new ResourceException( e );
-	            }
-	            add( key, resource );
-	         }
-	         else
-	         {
-	            throw new ResourceUnknownException( id,
-	                  resourceContext.getServiceName() );
-	            }
-	        }
-	        return resource;
-    }
 
     public QName getServiceName()
     {

Modified: webservices/pubscribe/trunk/src/test/org/apache/ws/notification/base/impl/UnitResourceContext.java
URL: http://svn.apache.org/viewcvs/webservices/pubscribe/trunk/src/test/org/apache/ws/notification/base/impl/UnitResourceContext.java?rev=225555&r1=225554&r2=225555&view=diff
==============================================================================
--- webservices/pubscribe/trunk/src/test/org/apache/ws/notification/base/impl/UnitResourceContext.java (original)
+++ webservices/pubscribe/trunk/src/test/org/apache/ws/notification/base/impl/UnitResourceContext.java Wed Jul 27 10:32:10 2005
@@ -10,6 +10,7 @@
 import javax.xml.soap.SOAPMessage;
 import java.net.MalformedURLException;
 import java.net.URL;
+import java.net.URI;
 import java.util.Iterator;
 
 
@@ -81,16 +82,6 @@
 
     }
 
-    /**
-     * Returns the value of the WS-Addressing Action header
-     *
-     * @return WS-Addressing Action Header value
-     */
-    public String getAddressingAction()
-    {
-        return null;
-    }
-
     public void setProperty( String name, Object value )
     {
 
@@ -110,4 +101,15 @@
     {
         return m_resource;
     }
+
+    public String getRequestAction()
+    {
+        return null;
+    }
+
+    public void setResponseAction( URI uri )
+    {
+        return;
+    }
+
 }