ws-wsrf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sc...@apache.org
Subject svn commit: r295055 - in /webservices/wsrf/trunk/src/java/org/apache/ws/resource: WsrfRuntime.java impl/AbstractResourceHome.java impl/ResourceContextImpl.java
Date Wed, 05 Oct 2005 17:51:54 GMT
Author: scamp
Date: Wed Oct  5 10:51:50 2005
New Revision: 295055

URL: http://svn.apache.org/viewcvs?rev=295055&view=rev
Log: (empty)

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

Modified: webservices/wsrf/trunk/src/java/org/apache/ws/resource/WsrfRuntime.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/resource/WsrfRuntime.java?rev=295055&r1=295054&r2=295055&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/resource/WsrfRuntime.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/resource/WsrfRuntime.java Wed Oct  5 10:51:50
2005
@@ -34,13 +34,14 @@
 import javax.naming.NamingException;
 import javax.naming.NameNotFoundException;
 import java.io.InputStream;
+import java.io.Serializable;
 import java.net.URL;
 import java.util.Properties;
 
 /**
  * A singleton respresenting the WSRF runtime.
  */
-public class WsrfRuntime
+public class WsrfRuntime implements Serializable
 {
 
     private static final Log LOG = LogFactory.getLog( WsrfRuntime.class );
@@ -56,7 +57,7 @@
 
     private static final WsrfRuntime INSTANCE = new WsrfRuntime();
 
-    private ConfigurableListableBeanFactory m_beanFactory;
+    private static ConfigurableListableBeanFactory m_beanFactory;
     private URL m_baseWebappUrl;
 
     public static final String JNDI_CONFIG_DIALECT = "jndi.config.dialect";

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=295055&r1=295054&r2=295055&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 Oct  5 10:51:50 2005
@@ -69,6 +69,7 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.io.Serializable;
 
 /**
  * TODO: Update these Javadocs
@@ -116,7 +117,7 @@
  */
 public abstract class AbstractResourceHome
         implements ResourceHome,
-        Initializable
+                   Initializable, Serializable
 {
     private static final int DEFAULT_SWEEPER_DELAY = 60000;
     private static final Log LOG = LogFactory.getLog( AbstractResourceHome.class );
@@ -207,7 +208,7 @@
     {
         String endpointAddress =
                 JaxRpcPlatform.getJaxRpcPlatform().getEndpointUrl( getBaseWebappUrl(),
-                        getServiceName().getLocalPart() );
+                                                                   getServiceName().getLocalPart()
);
         String wsAddressingURI = getNamespaceVersionHolder().getAddressingNamespace();
 
         XmlBeansEndpointReference xBeansEPR =
@@ -279,8 +280,8 @@
         if ( resourceClass != null && !Resource.class.isAssignableFrom( resourceClass
) )
         {
             throw new IllegalArgumentException( "Specified resource class '" + resourceClass.getName()
-                    + "' does not implement the " + Resource.class.getName()
-                    + " interface." );
+                                                + "' does not implement the " + Resource.class.getName()
+                                                + " interface." );
         }
         m_resourceClass = resourceClass;
     }
@@ -353,20 +354,20 @@
             {
                 m_baseWebappUrl = getDefaultUrl();
                 LOG.fatal( "The baseWebappUrl from the jndi-config.xml file was invalid!
Defaulting to: "
-                        + m_baseWebappUrl );
+                           + m_baseWebappUrl );
             }
             catch ( java.net.UnknownHostException e )
             {
                 m_baseWebappUrl = "http://127.0.0.1:8080/wsrf";
                 LOG.fatal( "The baseWebappUrl from the jndi-config.xml file was invalid!
Unable to determine host IP address using java.net.InetAddress.getLocalHost().getHostAddress()
defaulting to: "
-                        + m_baseWebappUrl, e );
+                           + m_baseWebappUrl, e );
                 return;
             }
         }
 
         //the url is not to be modified
         else if ( ( baseWebappUrl.indexOf( PLACEHOLDER_IPADDRESS ) == -1 )
-                && ( baseWebappUrl.indexOf( PLACEHOLDER_HOSTNAME ) == -1 ) )
+                  && ( baseWebappUrl.indexOf( PLACEHOLDER_HOSTNAME ) == -1 ) )
         {
             m_baseWebappUrl = baseWebappUrl;
             return;
@@ -400,9 +401,9 @@
 
             m_baseWebappUrl =
                     baseWebappUrl.substring( 0,
-                            baseWebappUrl.indexOf( PLACEHOLDER_IPADDRESS ) ) + ipAddress
-                    + baseWebappUrl.substring( baseWebappUrl.indexOf( PLACEHOLDER_IPADDRESS
)
-                    + PLACEHOLDER_IPADDRESS.length() );
+                                             baseWebappUrl.indexOf( PLACEHOLDER_IPADDRESS
) ) + ipAddress
+                                                                                        
     + baseWebappUrl.substring( baseWebappUrl.indexOf( PLACEHOLDER_IPADDRESS )
+                                                                                        
                                + PLACEHOLDER_IPADDRESS.length() );
             return;
         } //end if
 
@@ -420,9 +421,9 @@
 
             m_baseWebappUrl =
                     baseWebappUrl.substring( 0,
-                            baseWebappUrl.indexOf( PLACEHOLDER_HOSTNAME ) ) + hostname
-                    + baseWebappUrl.substring( baseWebappUrl.indexOf( PLACEHOLDER_HOSTNAME
)
-                    + PLACEHOLDER_HOSTNAME.length() );
+                                             baseWebappUrl.indexOf( PLACEHOLDER_HOSTNAME
) ) + hostname
+                                                                                        
    + baseWebappUrl.substring( baseWebappUrl.indexOf( PLACEHOLDER_HOSTNAME )
+                                                                                        
                               + PLACEHOLDER_HOSTNAME.length() );
             return;
         } //end else if
     }
@@ -533,7 +534,7 @@
         if ( !m_resourceClass.isAssignableFrom( resource.getClass() ) )
         {
             throw new IllegalResourceTypeException( "This home only supports resources of
type "
-                    + m_resourceClass.getName() );
+                                                    + m_resourceClass.getName() );
         }
         if ( m_resources == null )
         {
@@ -546,8 +547,8 @@
             if ( !m_resources.containsKey( key ) )
             {
                 LOG.debug( MSG.getMessage( Keys.ADDING_RESOURCE_WITH_ID,
-                        resource.getID(),
-                        getClass().getName() ) );
+                                           resource.getID(),
+                                           getClass().getName() ) );
                 m_resources.put( key, resource );
                 scheduleSweeperTask();
                 notifyResourceCreatedListeners( resource );
@@ -608,18 +609,18 @@
             if ( !resourceIdElemsIter.hasNext() )
             {
                 throw new FaultException( Soap1_1Constants.FAULT_CLIENT,
-                        "The expected resource identifier reference parameter named "
-                        + getResourceIdentifierReferenceParameterName()
-                        + " was not found in the SOAP header." );
+                                          "The expected resource identifier reference parameter
named "
+                                          + getResourceIdentifierReferenceParameterName()
+                                          + " was not found in the SOAP header." );
             }
 
             SOAPHeaderElement resourceIdElem = (SOAPHeaderElement) resourceIdElemsIter.next();
             if ( resourceIdElemsIter.hasNext() )
             {
                 throw new FaultException( Soap1_1Constants.FAULT_CLIENT,
-                        "More than one resource identifier reference parameter named "
-                        + getResourceIdentifierReferenceParameterName()
-                        + " was found in the SOAP header. Exactly one is expected." );
+                                          "More than one resource identifier reference parameter
named "
+                                          + getResourceIdentifierReferenceParameterName()
+                                          + " was found in the SOAP header. Exactly one is
expected." );
             }
 
             return resourceIdElem.getValue();
@@ -671,9 +672,9 @@
             if ( resourceId == null )
             {
                 throw new FaultException( Soap1_1Constants.FAULT_CLIENT,
-                        "The expected resource identifier reference parameter named "
-                        + getResourceIdentifierReferenceParameterName()
-                        + " was not found in the SOAP header." );
+                                          "The expected resource identifier reference parameter
named "
+                                          + getResourceIdentifierReferenceParameterName()
+                                          + " was not found in the SOAP header." );
             }
         }
         return resourceId;
@@ -684,10 +685,10 @@
      */
     public Resource find( Object resourceId )
             throws ResourceUnknownException,
-            ResourceException
+                   ResourceException
     {
         LOG.debug( MSG.getMessage( Keys.FINDING_RESOURCE_WITH_KEY,
-                String.valueOf( resourceId ) ) );
+                                   String.valueOf( resourceId ) ) );
         Resource resource = null;
         synchronized ( m_resources )
         {
@@ -750,7 +751,7 @@
      */
     public void remove( Object resourceId )
             throws ResourceUnknownException,
-            ResourceException
+                   ResourceException
     {
         Resource resource = null;
         Lock lock = acquireLock( resourceId );
@@ -774,8 +775,8 @@
             }
 
             LOG.debug( MSG.getMessage( Keys.REMOVED_RESOURCE_WITH_KEY,
-                    resource.getClass().getName(),
-                    String.valueOf( resourceId ) ) );
+                                       resource.getClass().getName(),
+                                       String.valueOf( resourceId ) ) );
             if ( m_cache != null )
             {
                 m_cache.remove( resource );
@@ -858,7 +859,7 @@
             throws ResourceException
     {
         LOG.debug( MSG.getMessage( Keys.CREATING_INSTANCE_WITH_KEY,
-                String.valueOf( id ) ) );
+                                   String.valueOf( id ) ) );
         Resource resource = createInstanceViaSpringBeanFactory();
         if ( resource == null )
         {
@@ -892,12 +893,12 @@
     {
         Resource resource = createInstance( id );
         LOG.debug( MSG.getMessage( Keys.LOADING_RESOURCE_FROM_PERSISTENCE,
-                String.valueOf( id ) ) );
+                                   String.valueOf( id ) ) );
         ( (PersistentResource) resource ).load();
         if ( ResourceSweeper.isExpired( resource ) )
         {
             throw new ResourceUnknownException( getNonNullKey( id ),
-                    getServicePortName() );
+                                                getServicePortName() );
         }
 
         return resource;
@@ -975,15 +976,15 @@
             throws ResourceException
     {
         LOG.debug( MSG.getMessage( Keys.GETTING_RESOURCE_WITH_ID,
-                resourceId,
-                getClass().getName() ) );
+                                   resourceId,
+                                   getClass().getName() ) );
         Resource resource = (Resource) m_resources.get( getNonNullKey( resourceId ) );
         if ( resource == null )
         {
             if ( !m_resourceIsPersistent )
             {
                 throw new ResourceUnknownException( resourceId,
-                        getServicePortName() );
+                                                    getServicePortName() );
             }
 
             add( createNewInstanceAndLoad( resourceId ) );

Modified: webservices/wsrf/trunk/src/java/org/apache/ws/resource/impl/ResourceContextImpl.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/resource/impl/ResourceContextImpl.java?rev=295055&r1=295054&r2=295055&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/resource/impl/ResourceContextImpl.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/resource/impl/ResourceContextImpl.java Wed
Oct  5 10:51:50 2005
@@ -74,9 +74,13 @@
         m_msgContext = soapMsgContext;
         m_msg = soapMsgContext.getMessage();
         extractFields( soapMsgContext );
+        lookupHome();        
+    }
+
+    protected void lookupHome() throws Exception
+    {
         m_home = WsrfRuntime.getRuntime().getResourceHome( getServiceName() );
         initializeResourceHome();
-        extractFields(soapMsgContext);
     }
 
     /**
@@ -275,7 +279,7 @@
                         "The WS-Addressing destination specified in the SOAP header (i.e.
wsa:To header element) is not a valid URI." );
             }
         }
-        return null;  // should an exception be thrown here instead of returning null? 
+        return null;  // should an exception be thrown here instead of returning null?
     }
 
     protected String getBaseURL( URL serviceURL )



Mime
View raw message