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/19 22:36:16 UTC
svn commit: r219771 - in /webservices/wsrf/trunk/src:
examples/filesystem/src/java/org/apache/ws/resource/example/filesystem/
examples/interop/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/
java/org/apache/ws/resource/ java/org/ap...
Author: ips
Date: Tue Jul 19 13:36:15 2005
New Revision: 219771
URL: http://svn.apache.org/viewcvs?rev=219771&view=rev
Log:
completed refactoring of resource context + home; NOTE: Pubscribe and Muse still need to be updated
Modified:
webservices/wsrf/trunk/src/examples/filesystem/src/java/org/apache/ws/resource/example/filesystem/AbstractFilesystemHome.java
webservices/wsrf/trunk/src/examples/filesystem/src/java/org/apache/ws/resource/example/filesystem/FilesystemHome.java
webservices/wsrf/trunk/src/examples/interop/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/JobPortHome.java
webservices/wsrf/trunk/src/examples/interop/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/JobPortResource.java
webservices/wsrf/trunk/src/examples/interop/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/JobPortService.java
webservices/wsrf/trunk/src/examples/interop/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/PrinterFactoryHome.java
webservices/wsrf/trunk/src/examples/interop/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/PrinterPortHome.java
webservices/wsrf/trunk/src/examples/interop/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/PrinterPortResource.java
webservices/wsrf/trunk/src/java/org/apache/ws/resource/ResourceContext.java
webservices/wsrf/trunk/src/java/org/apache/ws/resource/ResourceHome.java
webservices/wsrf/trunk/src/java/org/apache/ws/resource/handler/ResourceHandler.java
webservices/wsrf/trunk/src/java/org/apache/ws/resource/handler/axis/AxisResourceContext.java
webservices/wsrf/trunk/src/java/org/apache/ws/resource/handler/axis/ResourceProvider.java
webservices/wsrf/trunk/src/java/org/apache/ws/resource/impl/AbstractResourceContext.java
webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/SushiResourceContext.java
webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/v2004_06/porttype/impl/GetResourcePropertyProviderTestCase.java
webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/v2004_06/porttype/impl/QueryResourcePropertiesProviderTestCase.java
Modified: webservices/wsrf/trunk/src/examples/filesystem/src/java/org/apache/ws/resource/example/filesystem/AbstractFilesystemHome.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/examples/filesystem/src/java/org/apache/ws/resource/example/filesystem/AbstractFilesystemHome.java?rev=219771&r1=219770&r2=219771&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/examples/filesystem/src/java/org/apache/ws/resource/example/filesystem/AbstractFilesystemHome.java (original)
+++ webservices/wsrf/trunk/src/examples/filesystem/src/java/org/apache/ws/resource/example/filesystem/AbstractFilesystemHome.java Tue Jul 19 13:36:15 2005
@@ -1,50 +1,37 @@
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.
- *
+ * This class should <em>not</em> be modified.
+ * <p/>
* The class acts as an extension of the AbstractResourceHome which
* maintains a reference to the STATIC map needed for accessing resources via JNDI.
- *
+ * <p/>
* This ensures the resources will be accessible if serialized via JNDI in certain platforms.
*/
abstract class AbstractFilesystemHome extends AbstractResourceHome
{
+
/**
- * The static reference which is maintained and used by the AbstractResourceHome.
- *
- * 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 AbstractResourceHome}
+ * superclass.
*/
- protected final Map initResourceMap( )
- throws NamingException
+ protected synchronized final Map getResourceMap()
{
- Context initialContext = new InitialContext();
- if ( m_resourceIsPersistent )
- {
- m_resources = new ReferenceMap( ReferenceMap.HARD, ReferenceMap.SOFT, true );
- initCachePolicy( initialContext );
- }
- else
- {
- m_resources = new HashMap();
- }
-
- m_resources = Collections.synchronizedMap( m_resources );
- return m_resources;
+ if ( s_resources == null )
+ {
+ s_resources = AbstractResourceHome.createResourceMap( m_resourceIsPersistent );
+ }
+ return s_resources;
}
}
Modified: webservices/wsrf/trunk/src/examples/filesystem/src/java/org/apache/ws/resource/example/filesystem/FilesystemHome.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/examples/filesystem/src/java/org/apache/ws/resource/example/filesystem/FilesystemHome.java?rev=219771&r1=219770&r2=219771&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/examples/filesystem/src/java/org/apache/ws/resource/example/filesystem/FilesystemHome.java (original)
+++ webservices/wsrf/trunk/src/examples/filesystem/src/java/org/apache/ws/resource/example/filesystem/FilesystemHome.java Tue Jul 19 13:36:15 2005
@@ -1,22 +1,11 @@
-
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;
/**
- * **** NOTE: This file will not be overwritten during generation ****
- *
+ * <em>NOTE: This file will not be overwritten during generation.</em>
+ * <p/>
* Home for Filesystem WS-Resources.
*/
public class FilesystemHome
@@ -24,118 +13,52 @@
implements Serializable
{
- /** 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");
+ /**
+ * 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" );
- /** The management PortType associated with this resource. This is useful for building EPR's.**/
- public static final QName PORT_TYPE = javax.xml.namespace.QName.valueOf("{http://ws.apache.org/resource/example/filesystem}FileSystemPortType");
+ /**
+ * The management PortType associated with this resource. This is useful for building EPR's.*
+ */
+ public static final QName PORT_TYPE = javax.xml.namespace.QName.valueOf( "{http://ws.apache.org/resource/example/filesystem}FileSystemPortType" );
- /** The WSDL Port name associated with the resource. This is useful for building EPR's. **/
+ /**
+ * The WSDL Port name associated with the resource. This is useful for building EPR's. *
+ */
public static final String PORT_NAME = "filesystem";
- /** The name of the resource key for this resource. **/
- public static final QName RESOURCE_KEY_NAME = javax.xml.namespace.QName.valueOf("{http://ws.apache.org/resource/example/filesystem}ResourceIdentifier");
+ /**
+ * The name of the resource key for this resource. *
+ */
+ public static final QName RESOURCE_KEY_NAME = javax.xml.namespace.QName.valueOf( "{http://ws.apache.org/resource/example/filesystem}ResourceIdentifier" );
- /**
+ /**
* A NamespaceVerionHolder which maintains the QNames of Spec Wsdls
*/
- public static final org.apache.ws.resource.properties.v2004_06.impl.NamespaceVersionHolderImpl SPEC_NAMESPACE_SET = new org.apache.ws.resource.properties.v2004_06.impl.NamespaceVersionHolderImpl();
- /** 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;
-
+ public static final org.apache.ws.resource.properties.v2004_06.impl.NamespaceVersionHolderImpl SPEC_NAMESPACE_SET = new org.apache.ws.resource.properties.v2004_06.impl.NamespaceVersionHolderImpl();
/**
- *
- * @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;
- }
-
+ * 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;
+ private static final String LVOL1_ID = "/dev/vg00/lvol1";
+ private static final String LVOL2_ID = "/dev/vg00/lvol2";
/**
- public Resource getInstance( ResourceContext resourceContext )
- throws ResourceException,
- ResourceContextException,
- ResourceUnknownException
+ * Create and add two resource instances.
+ *
+ * @throws Exception on error
+ */
+ public void init() throws Exception
{
- ResourceKey key = resourceContext.getResourceKey();
- Resource resource = null;
- try
- {
- resource = find( key ); //attempt to find from the underlying cache
- }
- catch ( ResourceException re )
- {
- //TODO add any checking for key validity if you plan to create instances here
-
- /**
- * Commented below is an example of creating a resource instance, adding its epr and adding to the cache.
- * Note: You can set the EndpointReference on your Resource using the setter (not in Resource interface)
- */
-
- /*
- try
- {
- FilesystemResource myresource = (FilesystemResource)createInstance(key); //this will create the resource IF it is has default constructor. It also calls init() on the resource.
- //the next line will create an EPR
- EndpointReference epr = getEndpointReference(resourceContext.getBaseURL( ) + "/" + getServiceName().getLocalPart() , key, SPEC_NAMESPACE_SET.getAddressingNamespace());
- myresource.setEndpointReference(epr); //make sure to set the EPR on your new instance
- add(key, myresource); //make sure to add your instance to the underlying cache to be found in future requests using find(..)
- }
- catch (Exception e)
- {
- throw new ResourceException(e);
- }
-
-
- }
- return resource;
+ super.init();
+ FilesystemResource lvol1Resource = (FilesystemResource) createInstance( LVOL1_ID );
+ add( LVOL1_ID, lvol1Resource );
+ FilesystemResource lvol2Resource = (FilesystemResource) createInstance( LVOL1_ID );
+ add( LVOL2_ID, lvol2Resource );
}
- */
+
public QName getServiceName()
{
return SERVICE_NAME;
Modified: webservices/wsrf/trunk/src/examples/interop/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/JobPortHome.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/examples/interop/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/JobPortHome.java?rev=219771&r1=219770&r2=219771&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/examples/interop/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/JobPortHome.java (original)
+++ webservices/wsrf/trunk/src/examples/interop/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/JobPortHome.java Tue Jul 19 13:36:15 2005
@@ -15,166 +15,93 @@
*=============================================================================*/
package org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03Wsdl;
+import org.apache.axis.message.addressing.Constants;
+import org.apache.ws.addressing.EndpointReference;
import org.apache.ws.resource.JndiConstants;
-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.resource.impl.SimpleTypeResourceKey;
-import org.apache.ws.resource.properties.faults.ResourceUnknownFaultException;
-import org.apache.ws.resource.properties.v2004_11.impl.NamespaceVersionHolderImpl;
-import org.apache.ws.util.XmlBeanUtils;
-import org.apache.xmlbeans.XmlObject;
import org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.MimeMediaTypeType;
-import org.xmlsoap.schemas.ws.x2004.x08.addressing.AttributedURI;
-import org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceDocument;
-import org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceType;
-import org.xmlsoap.schemas.ws.x2004.x08.addressing.ReferencePropertiesType;
import javax.xml.namespace.QName;
import java.io.Serializable;
+import java.util.Map;
/**
* Home for JobPort WS-Resources.
*/
public class JobPortHome
- extends AbstractResourceHome
- implements Serializable
+ extends AbstractResourceHome
+ implements Serializable
{
- private static final String SERVICE_NAME = "JobPort";
- /** DOCUMENT_ME */
- public static final String HOME_LOCATION =
- JndiConstants.CONTEXT_NAME_SERVICES + "/" + SERVICE_NAME + "/" + JndiConstants.ATOMIC_NAME_HOME;
- private long m_jobId = 0;
+ private static final String SERVICE_NAME = "JobPort";
+ /**
+ * DOCUMENT_ME
+ */
+ public static final String HOME_LOCATION =
+ JndiConstants.CONTEXT_NAME_SERVICES + "/" + SERVICE_NAME + "/" + JndiConstants.ATOMIC_NAME_HOME;
+ private long m_jobId;
/**
- * DOCUMENT_ME
- *
- * @param key DOCUMENT_ME
- * @param serviceUrl DOCUMENT_ME
- *
- * @return DOCUMENT_ME
- */
- public EndpointReferenceType getEprForResource( ResourceKey key,
- String serviceUrl )
- {
- EndpointReferenceDocument eprDoc = EndpointReferenceDocument.Factory.newInstance( );
- EndpointReferenceType epr = eprDoc.addNewEndpointReference( );
- AttributedURI address = epr.addNewAddress( );
- address.setStringValue( serviceUrl + "/" +SERVICE_NAME );
- ReferencePropertiesType refProps = epr.addNewReferenceProperties( );
-
- XmlObject xmlObject = XmlBeanUtils.addChildElement( refProps,
- key.getName( ) );
- XmlBeanUtils.setValue( xmlObject,
- key.getValue( ).toString( ) );
-
- return epr;
- }
-
- /**
- * @param resourceContext DOCUMENT_ME
- * @return DOCUMENT_ME
- * @throws ResourceException DOCUMENT_ME
- * @throws ResourceContextException DOCUMENT_ME
- * @throws ResourceUnknownException DOCUMENT_ME
- */
- public Resource getInstance( ResourceContext resourceContext )
- throws ResourceException,
- ResourceContextException,
- ResourceUnknownException
- {
- ResourceKey key = resourceContext.getResourceKey( );
- Resource resource = null;
- try
- {
- resource = find( key );
- }
- catch ( ResourceException re )
- {
- throw new ResourceUnknownFaultException( new NamespaceVersionHolderImpl( ),
- new ResourceUnknownException( null, "An error occurred" ) );
- }
-
- return resource;
- }
-
- /**
- * DOCUMENT_ME
- *
- * @param resourceContext DOCUMENT_ME
- * @param jobName DOCUMENT_ME
- * @param origUserName DOCUMENT_ME
- * @param documentFormat DOCUMENT_ME
- * @param base64Data DOCUMENT_ME
- * @param printerResource DOCUMENT_ME
- *
- * @return DOCUMENT_ME
- */
- public JobPortResource createJob( ResourceContext resourceContext,
- String jobName,
- String origUserName,
- MimeMediaTypeType.Enum documentFormat,
- byte[] base64Data,
- PrinterPortResource printerResource )
- {
- ++m_jobId;
- int jobId = (int)m_jobId;
- SimpleTypeResourceKey key = createResourceKey(jobId);
- EndpointReferenceType jobEpr = getEprForResource( key,
- resourceContext.getBaseURL( ) );
- JobPortResource job = new JobPortResource( jobEpr, jobId, jobName, origUserName, printerResource );
- job.init( );
- add( key, job );
- return job;
- }
-
- private SimpleTypeResourceKey createResourceKey(int jobId)
- {
- SimpleTypeResourceKey key =
- new SimpleTypeResourceKey( QName.valueOf( "{http://docs.oasis-open.org/wsrf/2005/01/wsrf-Interop-2.0-draft-03.wsdl}ResourceID" ),
- "Job" + Integer.toString( jobId ) );
- return key;
+ * DOCUMENT_ME
+ *
+ * @param resourceContext DOCUMENT_ME
+ * @param jobName DOCUMENT_ME
+ * @param origUserName DOCUMENT_ME
+ * @param documentFormat DOCUMENT_ME
+ * @param base64Data DOCUMENT_ME
+ * @param printerResource DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public JobPortResource createJob( ResourceContext resourceContext,
+ String jobName,
+ String origUserName,
+ MimeMediaTypeType.Enum documentFormat,
+ byte[] base64Data,
+ PrinterPortResource printerResource )
+ {
+ ++m_jobId;
+ String jobId = "Job" + m_jobId;
+ EndpointReference jobEpr = getEndpointReference( resourceContext.getBaseURL() + "/" + SERVICE_NAME, jobId, Constants.NS_URI_ADDRESSING_2004_08 );
+ JobPortResource job = new JobPortResource( jobEpr, jobId, jobName, printerResource, origUserName );
+ job.init();
+ add( jobId, job );
+ return job;
}
/**
- * DOCUMENT_ME
- *
- * @param resourceContext DOCUMENT_ME
- * @param jobName DOCUMENT_ME
- * @param printerResource DOCUMENT_ME
- *
- * @return DOCUMENT_ME
- */
- public JobPortResource createJob( ResourceContext resourceContext,
- String jobName,
- PrinterPortResource printerResource )
- {
- ++m_jobId;
- int jobId = (int)m_jobId;
- SimpleTypeResourceKey key = createResourceKey(jobId);
- EndpointReferenceType jobEpr = getEprForResource( key,
- resourceContext.getBaseURL( ) );
- JobPortResource job = new JobPortResource( jobEpr, jobId, jobName, printerResource );
- job.init( );
- add( key, job );
- return job;
- }
+ * DOCUMENT_ME
+ *
+ * @param resourceContext DOCUMENT_ME
+ * @param jobName DOCUMENT_ME
+ * @param printerResource DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public JobPortResource createJob( ResourceContext resourceContext,
+ String jobName,
+ PrinterPortResource printerResource )
+ {
+ ++m_jobId;
+ String jobId = "Job" + m_jobId;
+ EndpointReference jobEpr = getEndpointReference( resourceContext.getBaseURL() + "/" + SERVICE_NAME, jobId, Constants.NS_URI_ADDRESSING_2004_08 );
+ JobPortResource job = new JobPortResource( jobEpr, jobId, jobName, printerResource );
+ job.init();
+ add( jobId, job );
+ return job;
+ }
public QName getServiceName()
{
- return new QName(JobPortPropertyQNames.JOB_PRINTER_REFERENCE.getNamespaceURI(),SERVICE_NAME);
+ return new QName( JobPortPropertyQNames.JOB_PRINTER_REFERENCE.getNamespaceURI(), SERVICE_NAME );
}
public QName getPortType()
{
- return new QName(JobPortPropertyQNames.JOB_PRINTER_REFERENCE.getNamespaceURI(),"Job");
+ return new QName( JobPortPropertyQNames.JOB_PRINTER_REFERENCE.getNamespaceURI(), "Job" );
}
public String getServicePortName()
@@ -184,6 +111,26 @@
public QName getResourceIdentifierReferenceParameterQName()
{
- return QName.valueOf("{http://docs.oasis-open.org/wsrf/2005/01/wsrf-Interop-2.0-draft-03.wsdl}ResourceID");
+ return QName.valueOf( "{http://docs.oasis-open.org/wsrf/2005/01/wsrf-Interop-2.0-draft-03.wsdl}ResourceID" );
}
+
+ /**
+ * Map containing all SushiResource instances - this map <em>must</em> be static for
+ * compatibility with certain JNDI providers.
+ */
+ private static Map s_resources;
+
+ /**
+ * Returns a map of all SushiResource 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/wsrf/trunk/src/examples/interop/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/JobPortResource.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/examples/interop/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/JobPortResource.java?rev=219771&r1=219770&r2=219771&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/examples/interop/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/JobPortResource.java (original)
+++ webservices/wsrf/trunk/src/examples/interop/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/JobPortResource.java Tue Jul 19 13:36:15 2005
@@ -17,6 +17,9 @@
import org.apache.ws.resource.properties.ResourceProperty;
import org.apache.ws.resource.lifetime.ResourceTerminationListener;
+import org.apache.ws.addressing.EndpointReference;
+import org.apache.ws.addressing.XmlBeansEndpointReference;
+import org.apache.axis.message.addressing.Constants;
import org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.*;
import org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceType;
import java.math.BigInteger;
@@ -31,12 +34,11 @@
extends AbstractJobPortResource
{
private String m_jobName;
- private long m_jobId;
+ private String m_jobId;
private String m_origUserName = "Johann Gutenberg";
- private EndpointReferenceType m_jobRef;
- private EndpointReferenceType m_printerRef;
+ private EndpointReference m_printerRef;
private boolean m_isReady = false;
- private PrinterPortResource m_printerResource;
+ private PrinterPortResource m_printerResource;
/**
@@ -53,16 +55,16 @@
* Creates a new {@link JobPortResource} object.
*
* @param jobEpr DOCUMENT_ME
- * @param jobId DOCUMENT_ME
- * @param jobName DOCUMENT_ME
- * @param origUserName DOCUMENT_ME
- * @param printerResource DOCUMENT_ME
- */
- public JobPortResource( EndpointReferenceType jobEpr,
- long jobId,
- String jobName,
- String origUserName,
- PrinterPortResource printerResource )
+ * @param jobId DOCUMENT_ME
+ * @param jobName DOCUMENT_ME
+ * @param printerResource DOCUMENT_ME
+ * @param origUserName DOCUMENT_ME
+ */
+ public JobPortResource( EndpointReference jobEpr,
+ String jobId,
+ String jobName,
+ PrinterPortResource printerResource,
+ String origUserName )
{
super( );
m_jobName = jobName;
@@ -71,9 +73,9 @@
{
m_origUserName = origUserName;
}
- m_jobRef = jobEpr;
+ setEndpointReference( jobEpr );
m_printerResource = printerResource;
- m_printerRef = printerResource.getEpr();
+ m_printerRef = printerResource.getEndpointReference();
}
/**
@@ -84,17 +86,12 @@
* @param jobName DOCUMENT_ME
* @param printerResource DOCUMENT_ME
*/
- public JobPortResource( EndpointReferenceType jobEpr,
- long jobId,
+ public JobPortResource( EndpointReference jobEpr,
+ String jobId,
String jobName,
- PrinterPortResource printerResource )
+ PrinterPortResource printerResource )
{
- super( );
- m_jobId = jobId;
- m_jobName = jobName;
- m_jobRef = jobEpr;
- m_printerResource = printerResource;
- m_printerRef = printerResource.getEpr();
+ this( jobEpr, jobId, jobName, printerResource, null );
}
public PrinterPortResource getPrinterResource()
@@ -116,7 +113,7 @@
resourceProperty = m_propSet.get( JobPortPropertyQNames.JOB_ID );
JobIdDocument jobIdDocument = JobIdDocument.Factory.newInstance( );
- jobIdDocument.setJobId( BigInteger.valueOf( m_jobId ) );
+ jobIdDocument.setJobId( new BigInteger( m_jobId ) );
resourceProperty.add( jobIdDocument );
resourceProperty = m_propSet.get( JobPortPropertyQNames.JOB_ORIGINATING_USER_NAME );
@@ -128,12 +125,12 @@
resourceProperty = m_propSet.get( JobPortPropertyQNames.JOB_PRINTER_REFERENCE );
JobPrinterReferenceDocument jobPrinterReferenceDocument =
JobPrinterReferenceDocument.Factory.newInstance( );
- jobPrinterReferenceDocument.setJobPrinterReference( m_printerRef );
+ jobPrinterReferenceDocument.setJobPrinterReference( (EndpointReferenceType) ((XmlBeansEndpointReference)m_printerRef).getXmlObject( Constants.NS_URI_ADDRESSING_2004_08 ) );
resourceProperty.add( jobPrinterReferenceDocument );
resourceProperty = m_propSet.get( JobPortPropertyQNames.JOB_REFERENCE );
JobReferenceDocument jobReferenceDocument = JobReferenceDocument.Factory.newInstance( );
- jobReferenceDocument.setJobReference( getEpr( ) );
+ jobReferenceDocument.setJobReference( (EndpointReferenceType) ((XmlBeansEndpointReference)getEndpointReference()).getXmlObject( Constants.NS_URI_ADDRESSING_2004_08 ) );
resourceProperty.add( jobReferenceDocument );
resourceProperty = m_propSet.get( JobPortPropertyQNames.JOB_STATE );
@@ -147,11 +144,6 @@
currentTime.get( Calendar.MONTH ),
currentTime.get( Calendar.DATE ) + 2 );
setTerminationTime( termTime );
- }
-
- private EndpointReferenceType getEpr( )
- {
- return m_jobRef;
}
public boolean isQueued() {
Modified: webservices/wsrf/trunk/src/examples/interop/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/JobPortService.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/examples/interop/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/JobPortService.java?rev=219771&r1=219770&r2=219771&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/examples/interop/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/JobPortService.java (original)
+++ webservices/wsrf/trunk/src/examples/interop/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/JobPortService.java Tue Jul 19 13:36:15 2005
@@ -16,7 +16,6 @@
package org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03Wsdl;
import org.apache.ws.resource.ResourceContext;
-import org.apache.ws.resource.ResourceContextException;
import org.apache.ws.resource.ResourceException;
import org.apache.ws.resource.ResourceUnknownException;
import org.apache.ws.resource.lifetime.v2004_11.porttype.ImmediateResourceTerminationPortType;
@@ -110,11 +109,11 @@
{
try
{
- throw new ResourceUnknownFaultException(new NamespaceVersionHolderImpl(),getResourceContext().getResourceKey(), getResourceContext().getServiceName() );
+ throw new ResourceUnknownFaultException(new NamespaceVersionHolderImpl(),getResourceContext().getResource().getID(), getResourceContext().getServiceName() );
}
- catch (ResourceContextException e)
+ catch (ResourceException re)
{
- throw new ClientErrorNotPossibleFaultException(new NamespaceVersionHolderImpl(), "Error Occurred: " + e.getLocalizedMessage());
+ throw new ClientErrorNotPossibleFaultException(new NamespaceVersionHolderImpl(), "Error Occurred: " + re.getLocalizedMessage());
}
}
@@ -142,7 +141,6 @@
}
private boolean isDocTypeSupported(String documentFormat, JobPortResource jobResource)
- throws ResourceException
{
boolean docTypeSupported = false;
Modified: webservices/wsrf/trunk/src/examples/interop/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/PrinterFactoryHome.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/examples/interop/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/PrinterFactoryHome.java?rev=219771&r1=219770&r2=219771&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/examples/interop/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/PrinterFactoryHome.java (original)
+++ webservices/wsrf/trunk/src/examples/interop/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/PrinterFactoryHome.java Tue Jul 19 13:36:15 2005
@@ -20,6 +20,7 @@
import javax.xml.namespace.QName;
import java.io.Serializable;
+import java.util.Map;
/**
* Home for PrinterFactory WS-Resources.
@@ -76,4 +77,24 @@
{
return null;
}
+
+ /**
+ * Map containing all SushiResource instances - this map <em>must</em> be static for
+ * compatibility with certain JNDI providers.
+ */
+ private static Map s_resources;
+
+ /**
+ * Returns a map of all SushiResource 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/wsrf/trunk/src/examples/interop/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/PrinterPortHome.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/examples/interop/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/PrinterPortHome.java?rev=219771&r1=219770&r2=219771&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/examples/interop/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/PrinterPortHome.java (original)
+++ webservices/wsrf/trunk/src/examples/interop/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/PrinterPortHome.java Tue Jul 19 13:36:15 2005
@@ -15,126 +15,72 @@
*=============================================================================*/
package org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03Wsdl;
-import org.apache.ws.resource.*;
-import org.apache.ws.resource.properties.faults.ResourceUnknownFaultException;
-import org.apache.ws.resource.properties.v2004_11.impl.NamespaceVersionHolderImpl;
+import org.apache.ws.resource.JndiConstants;
+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.ResourceUnknownException;
import org.apache.ws.resource.impl.AbstractResourceHome;
-import org.apache.ws.resource.impl.SimpleTypeResourceKey;
-import org.apache.ws.util.XmlBeanUtils;
-import org.apache.xmlbeans.XmlObject;
-import org.xmlsoap.schemas.ws.x2004.x08.addressing.AttributedURI;
-import org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceDocument;
+import org.apache.ws.addressing.EndpointReference;
+import org.apache.axis.message.addressing.Constants;
import org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceType;
-import org.xmlsoap.schemas.ws.x2004.x08.addressing.ReferencePropertiesType;
import javax.xml.namespace.QName;
import java.io.Serializable;
+import java.util.Map;
/**
* Home for PrinterPort WS-Resources.
*/
public class PrinterPortHome
- extends AbstractResourceHome
- implements Serializable
+ extends AbstractResourceHome
+ implements Serializable
{
- private static final String SERVICE_NAME = "PrinterPort";
+ private static final String SERVICE_NAME = "PrinterPort";
- /** DOCUMENT_ME */
- public static final String HOME_LOCATION =
- JndiConstants.CONTEXT_NAME_SERVICES + "/" + SERVICE_NAME + "/" + JndiConstants.ATOMIC_NAME_HOME;
- // private PrinterPortResource m_printer;
- private int m_printerId = 0;
+ /**
+ * DOCUMENT_ME
+ */
+ public static final String HOME_LOCATION =
+ JndiConstants.CONTEXT_NAME_SERVICES + "/" + SERVICE_NAME + "/" + JndiConstants.ATOMIC_NAME_HOME;
+ // private PrinterPortResource m_printer;
+ private int m_printerId;
/**
- * @param resourceContext DOCUMENT_ME
- * @return DOCUMENT_ME
- * @throws ResourceException DOCUMENT_ME
- * @throws ResourceContextException DOCUMENT_ME
- * @throws ResourceUnknownException DOCUMENT_ME
- */
- public Resource getInstance( ResourceContext resourceContext )
- throws ResourceException,
- ResourceContextException,
- ResourceUnknownException
- {
- ResourceKey key = resourceContext.getResourceKey( );
- Resource resource = null;
- try
- {
- resource = find( key );
- }
- catch ( ResourceException re )
- {
- throw new ResourceUnknownFaultException( new NamespaceVersionHolderImpl( ),
- new ResourceUnknownException( null, "An error occurred" ) );
- }
-
- return resource;
- }
-
-
- public EndpointReferenceType getEprForResource( ResourceKey key,
- String serviceUrl )
- {
- EndpointReferenceDocument eprDoc = EndpointReferenceDocument.Factory.newInstance( );
- EndpointReferenceType epr = eprDoc.addNewEndpointReference( );
- AttributedURI address = epr.addNewAddress( );
- address.setStringValue( serviceUrl + "/" +SERVICE_NAME );
- ReferencePropertiesType refProps = epr.addNewReferenceProperties( );
-
- XmlObject xmlObject = XmlBeanUtils.addChildElement( refProps,
- key.getName( ) );
- XmlBeanUtils.setValue( xmlObject,
- key.getValue( ).toString( ) );
-
- return epr;
- }
-
- /**
- * DOCUMENT_ME
- *
- * @param resourceContext DOCUMENT_ME
- *
- * @return DOCUMENT_ME
- *
- * @throws ResourceException DOCUMENT_ME
- * @throws ResourceContextException DOCUMENT_ME
- * @throws ResourceUnknownException DOCUMENT_ME
- */
- public Resource createPrinter( ResourceContext resourceContext )
- throws ResourceException,
- ResourceContextException,
- ResourceUnknownException
- {
- ++m_printerId;
- int printerId = m_printerId;
- SimpleTypeResourceKey key = createResourceKey(printerId);
- EndpointReferenceType printerEpr = getEprForResource( key,
- resourceContext.getBaseURL( ) );
- PrinterPortResource printer = new PrinterPortResource( "Printer" + printerId,
- getEprForResource( key, resourceContext.getBaseURL( ) ) );
- printer.init( );
- add(key, printer);
-
- return printer;
- }
-
- private SimpleTypeResourceKey createResourceKey(int printerId)
- {
- SimpleTypeResourceKey key =
- new SimpleTypeResourceKey( QName.valueOf( "{http://docs.oasis-open.org/wsrf/2005/01/wsrf-Interop-2.0-draft-03.wsdl}ResourceID" ),
- "Printer" + Integer.toString( printerId ) );
- return key;
+ * DOCUMENT_ME
+ *
+ * @param resourceContext DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ *
+ * @throws ResourceException DOCUMENT_ME
+ * @throws ResourceContextException DOCUMENT_ME
+ * @throws ResourceUnknownException DOCUMENT_ME
+ */
+ public Resource createPrinter( ResourceContext resourceContext )
+ throws ResourceException,
+ ResourceContextException,
+ ResourceUnknownException
+ {
+ ++m_printerId;
+ String printerId = "Printer" + m_printerId;
+ EndpointReference printerEpr = getEndpointReference( resourceContext.getBaseURL() + "/" + SERVICE_NAME, printerId, Constants.NS_URI_ADDRESSING_2004_08 );
+ PrinterPortResource printer = new PrinterPortResource( "Printer" + printerId,
+ printerEpr );
+ printer.init();
+ add( printerId, printer );
+ return printer;
}
public QName getServiceName()
{
- return new QName(PrinterPortPropertyQNames.PRINTER_REFERENCE.getNamespaceURI(),"PrinterPort");
+ return new QName( PrinterPortPropertyQNames.PRINTER_REFERENCE.getNamespaceURI(), "PrinterPort" );
}
public QName getPortType()
{
- return new QName(PrinterPortPropertyQNames.PRINTER_REFERENCE.getNamespaceURI(),"Printer");
+ return new QName( PrinterPortPropertyQNames.PRINTER_REFERENCE.getNamespaceURI(), "Printer" );
}
public String getServicePortName()
@@ -144,6 +90,26 @@
public QName getResourceIdentifierReferenceParameterQName()
{
- return new QName("{http://docs.oasis-open.org/wsrf/2005/01/wsrf-Interop-2.0-draft-03.wsdl}ResourceID");
+ return new QName( "{http://docs.oasis-open.org/wsrf/2005/01/wsrf-Interop-2.0-draft-03.wsdl}ResourceID" );
}
+
+ /**
+ * Map containing all SushiResource instances - this map <em>must</em> be static for
+ * compatibility with certain JNDI providers.
+ */
+ private static Map s_resources;
+
+ /**
+ * Returns a map of all SushiResource 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/wsrf/trunk/src/examples/interop/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/PrinterPortResource.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/examples/interop/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/PrinterPortResource.java?rev=219771&r1=219770&r2=219771&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/examples/interop/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/PrinterPortResource.java (original)
+++ webservices/wsrf/trunk/src/examples/interop/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/PrinterPortResource.java Tue Jul 19 13:36:15 2005
@@ -18,14 +18,16 @@
import commonj.timers.Timer;
import commonj.timers.TimerListener;
import commonj.timers.TimerManager;
+import org.apache.axis.message.addressing.Constants;
+import org.apache.ws.addressing.EndpointReference;
+import org.apache.ws.addressing.XmlBeansEndpointReference;
+import org.apache.ws.resource.lifetime.ResourceTerminationListener;
import org.apache.ws.resource.properties.ResourceProperty;
import org.apache.ws.resource.properties.impl.XmlBeansResourceProperty;
import org.apache.ws.resource.properties.impl.XmlBeansResourcePropertySet;
-import org.apache.ws.resource.lifetime.ResourceTerminationListener;
import org.apache.ws.util.timer.TimerManagerImpl;
import org.apache.xmlbeans.XmlInteger;
import org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.DocumentFormatSupportedDocument;
-import org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.JobPropertiesDocument;
import org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.JobStateType;
import org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.MimeMediaTypeType;
import org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.MimeMediaTypes;
@@ -43,7 +45,6 @@
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
-import java.util.Iterator;
import java.util.List;
import java.util.Random;
@@ -57,8 +58,6 @@
{
private String m_name;
- private EndpointReferenceType m_epr;
-
private List m_printQueue = new ArrayList();
private Timer m_timer;
private Random m_random = new Random(new Date().getTime());;
@@ -67,23 +66,13 @@
* Creates a new {@link PrinterPortResource} object.
*
* @param name DOCUMENT_ME
- * @param eprForResource DOCUMENT_ME
+ * @param epr DOCUMENT_ME
*/
public PrinterPortResource(String name,
- EndpointReferenceType eprForResource)
+ EndpointReference epr)
{
m_name = name;
- m_epr = eprForResource;
- }
-
- /**
- * DOCUMENT_ME
- *
- * @return DOCUMENT_ME
- */
- public EndpointReferenceType getEpr()
- {
- return m_epr;
+ setEndpointReference( epr );
}
/**
@@ -94,7 +83,7 @@
super.init();
ResourceProperty resourceProperty = m_propSet.get(PrinterPortPropertyQNames.PRINTER_REFERENCE);
PrinterReferenceDocument printerRefDoc = PrinterReferenceDocument.Factory.newInstance();
- printerRefDoc.setPrinterReference(getEpr());
+ printerRefDoc.setPrinterReference((EndpointReferenceType) ((XmlBeansEndpointReference)getEndpointReference()).getXmlObject( Constants.NS_URI_ADDRESSING_2004_08 ));
resourceProperty.add(printerRefDoc);
resourceProperty = m_propSet.get(PrinterPortPropertyQNames.PRINTER_STATE);
@@ -198,12 +187,10 @@
setJobState(job, JobStateType.PROCESSING);
//set termination time to now to make it be removed.
job.setTerminationTime(Calendar.getInstance());
-
XmlBeansResourcePropertySet jobPropSet = (XmlBeansResourcePropertySet) job.getResourcePropertySet();
ResourceProperty resourceProperty = jobPropSet.get(JobPortPropertyQNames.JOB_ID);
XmlInteger jobint = (XmlInteger) resourceProperty.get(0);
- BigInteger bigIntegerValue = jobint.getBigIntegerValue();
-
+ BigInteger bigIntegerValue = jobint.getBigIntegerValue();
decrementQueueCount();
setJobState(job, JobStateType.COMPLETED);
}
Modified: webservices/wsrf/trunk/src/java/org/apache/ws/resource/ResourceContext.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/resource/ResourceContext.java?rev=219771&r1=219770&r2=219771&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/resource/ResourceContext.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/resource/ResourceContext.java Tue Jul 19 13:36:15 2005
@@ -29,82 +29,82 @@
public interface ResourceContext
{
- /**
- * @see SOAPMessageContext#setProperty(String, Object)
- */
- void setProperty( String name, Object value );
-
- /**
- * @see SOAPMessageContext#getProperty(String)
- */
- public abstract Object getProperty( String name );
-
- /**
- * @see SOAPMessageContext#getPropertyNames()
- */
- public abstract Iterator getPropertyNames( );
-
- /**
- * Gets actual resource.
- *
- * @return The actual resource object. Cannot be null.
- *
- * @throws ResourceUnknownException if resource was not specified in the request or it does not exist.
- * @throws ResourceContextException if error occurs during resource lookup.
- */
- Resource getResource( )
- throws ResourceContextException, ResourceException;
-
- /**
- * Gets <code>ResourceHome</code> associated with the service.
- *
- * @return <code>ResourceHome</code> associated with the service. Cannot be null.
- */
- ResourceHome getResourceHome( );
-
- /**
- * DOCUMENT_ME
- *
- * @return DOCUMENT_ME
- */
- SOAPMessage getSOAPMessage( );
-
- /**
- * Gets name of the service.
- *
- * @return The name of the service.
- */
- String getServiceName( );
-
- /**
- * Gets the endpoint URL of the service.
- *
- * @return The endpoint URL of the service
- */
- URL getServiceURL( );
-
- /**
- * Gets the base URL from which service URLs are based.
- *
- * @return The String representation of the base url
- */
- String getBaseURL( );
-
- /**
- * @see SOAPMessageContext#containsProperty(String)
- */
- boolean containsProperty( String name );
-
- /**
- * @see SOAPMessageContext#removeProperty(String)
- */
- void removeProperty( String name );
-
- /**
- * Returns the value of the WS-Addressing Action header element.
- *
- * @return value of the WS-Addressing Action header element
- */
- String getAddressingAction();
+ /**
+ * @see SOAPMessageContext#setProperty(String, Object)
+ */
+ void setProperty( String name, Object value );
+
+ /**
+ * @see SOAPMessageContext#getProperty(String)
+ */
+ public abstract Object getProperty( String name );
+
+ /**
+ * @see SOAPMessageContext#getPropertyNames()
+ */
+ public abstract Iterator getPropertyNames();
+
+ /**
+ * Returns the resource instance that was targeted by the request associated
+ * with this context.
+ *
+ * @return the resource instance that was targeted by the request associated
+ * with this context
+ *
+ * @throws ResourceException upon failure to lookup a resource instance from the home
+ */
+ Resource getResource() throws ResourceException;
+
+ /**
+ * Gets <code>ResourceHome</code> associated with the service.
+ *
+ * @return <code>ResourceHome</code> associated with the service. Cannot be null.
+ */
+ ResourceHome getResourceHome();
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ SOAPMessage getSOAPMessage();
+
+ /**
+ * Gets name of the service.
+ *
+ * @return The name of the service.
+ */
+ String getServiceName();
+
+ /**
+ * Gets the endpoint URL of the service.
+ *
+ * @return The endpoint URL of the service
+ */
+ URL getServiceURL();
+
+ /**
+ * Gets the base URL from which service URLs are based.
+ *
+ * @return The String representation of the base url
+ */
+ String getBaseURL();
+
+ /**
+ * @see SOAPMessageContext#containsProperty(String)
+ */
+ boolean containsProperty( String name );
+
+ /**
+ * @see SOAPMessageContext#removeProperty(String)
+ */
+ void removeProperty( String name );
+
+ /**
+ * Returns the value of the WS-Addressing Action header element.
+ *
+ * @return value of the WS-Addressing Action header element
+ */
+ String getAddressingAction();
}
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=219771&r1=219770&r2=219771&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 Tue Jul 19 13:36:15 2005
@@ -123,20 +123,6 @@
RemoveNotSupportedException;
/**
- * Retrieves the <code>Resource</code> instance that is corresponds to the id contained
- * in the specified <code>ResourceContext</code>.
- *
- * @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 getInstance( ResourceContext resourceContext )
- throws
- ResourceContextException,
- ResourceUnknownException,
- ResourceException;
-
- /**
* Builds an EPR based on the specified endpoint address, resource key, and WS-Addressing
* namespace URI.
*
Modified: webservices/wsrf/trunk/src/java/org/apache/ws/resource/handler/ResourceHandler.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/resource/handler/ResourceHandler.java?rev=219771&r1=219770&r2=219771&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/resource/handler/ResourceHandler.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/resource/handler/ResourceHandler.java Tue Jul 19 13:36:15 2005
@@ -245,7 +245,7 @@
* @return a ResourceContext for this request
*/
protected abstract ResourceContext createResourceContext( SOAPMessageContext soapMsgContext )
- throws ResourceContextException;
+ throws Exception;
/**
* DOCUMENT_ME
Modified: webservices/wsrf/trunk/src/java/org/apache/ws/resource/handler/axis/AxisResourceContext.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/resource/handler/axis/AxisResourceContext.java?rev=219771&r1=219770&r2=219771&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/resource/handler/axis/AxisResourceContext.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/resource/handler/axis/AxisResourceContext.java Tue Jul 19 13:36:15 2005
@@ -16,9 +16,6 @@
package org.apache.ws.resource.handler.axis;
import org.apache.axis.handlers.soap.SOAPService;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.ws.resource.ResourceContextException;
import org.apache.ws.resource.i18n.Keys;
import org.apache.ws.resource.i18n.MessagesImpl;
import org.apache.ws.resource.impl.AbstractResourceContext;
@@ -41,7 +38,7 @@
extends AbstractResourceContext
{
- private static final Log LOG = LogFactory.getLog( AxisResourceContext.class.getName( ) );
+ //private static final Log LOG = LogFactory.getLog( AxisResourceContext.class.getName( ) );
private static final Messages MSG = MessagesImpl.getInstance();
/**
@@ -49,7 +46,7 @@
*
* @param msgContext SOAPMessageContext
*/
- public AxisResourceContext( SOAPMessageContext msgContext ) throws ResourceContextException
+ public AxisResourceContext( SOAPMessageContext msgContext ) throws Exception
{
super( msgContext );
importServiceOptions( msgContext );
Modified: webservices/wsrf/trunk/src/java/org/apache/ws/resource/handler/axis/ResourceProvider.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/resource/handler/axis/ResourceProvider.java?rev=219771&r1=219770&r2=219771&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/resource/handler/axis/ResourceProvider.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/resource/handler/axis/ResourceProvider.java Tue Jul 19 13:36:15 2005
@@ -26,7 +26,6 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.ws.resource.ResourceContext;
-import org.apache.ws.resource.ResourceContextException;
import org.apache.ws.resource.handler.ResourceHandler;
import org.apache.ws.resource.i18n.Keys;
import org.apache.ws.resource.i18n.MessagesImpl;
@@ -271,7 +270,7 @@
* @return DOCUMENT_ME
*/
protected ResourceContext createResourceContext( SOAPMessageContext soapMsgContext )
- throws ResourceContextException
+ throws Exception
{
return new AxisResourceContext( soapMsgContext );
}
Modified: webservices/wsrf/trunk/src/java/org/apache/ws/resource/impl/AbstractResourceContext.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/resource/impl/AbstractResourceContext.java?rev=219771&r1=219770&r2=219771&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/resource/impl/AbstractResourceContext.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/resource/impl/AbstractResourceContext.java Tue Jul 19 13:36:15 2005
@@ -122,16 +122,9 @@
}
/**
- * DOCUMENT_ME
- *
- * @return DOCUMENT_ME
- *
- * @throws ResourceContextException DOCUMENT_ME
- * @throws ResourceException DOCUMENT_ME
+ * @see org.apache.ws.resource.ResourceContext#getResource()
*/
- public Resource getResource()
- throws ResourceContextException,
- ResourceException
+ public Resource getResource() throws ResourceException
{
ResourceHome home = getResourceHome();
Object id = home.extractResourceIdentifier( this );
Modified: webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/SushiResourceContext.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/SushiResourceContext.java?rev=219771&r1=219770&r2=219771&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/SushiResourceContext.java (original)
+++ webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/SushiResourceContext.java Tue Jul 19 13:36:15 2005
@@ -2,7 +2,6 @@
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.ResourceHome;
@@ -134,7 +133,7 @@
return null;
}
- public Resource getResource() throws ResourceContextException, ResourceException
+ public Resource getResource() throws ResourceException
{
return m_resource;
}
Modified: webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/v2004_06/porttype/impl/GetResourcePropertyProviderTestCase.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/v2004_06/porttype/impl/GetResourcePropertyProviderTestCase.java?rev=219771&r1=219770&r2=219771&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/v2004_06/porttype/impl/GetResourcePropertyProviderTestCase.java (original)
+++ webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/v2004_06/porttype/impl/GetResourcePropertyProviderTestCase.java Tue Jul 19 13:36:15 2005
@@ -39,7 +39,7 @@
/**
* Tests that a GetRP request for an existing prop returns a GetRPResponse elem containing that prop.
*/
- public void testGetExistingProp()
+ public void testGetExistingProp() throws Exception
{
m_resourceContext = new SushiResourceContext();
GetResourcePropertyResponseDocument.GetResourcePropertyResponse response = getResourceProperty( SushiPropertyQNames.IKA );
@@ -52,7 +52,7 @@
/**
* Tests that a GetRP request for a non-existing optional prop returns an empty GetRPResponse elem.
*/
- public void testGetNonexistingOptionalProp()
+ public void testGetNonexistingOptionalProp() throws Exception
{
m_resourceContext = new SushiResourceContext();
GetResourcePropertyResponseDocument.GetResourcePropertyResponse response = getResourceProperty( SushiPropertyQNames.UNI );
@@ -65,7 +65,7 @@
* Tests that a GetRP request for an invalid prop QName throws a fault exception,
* wether or not the RP doc permits open content.
*/
- public void testGetInvalidProp()
+ public void testGetInvalidProp() throws Exception
{
m_resourceContext = new SushiResourceContext( true );
assertGetRequestForInvalidPropThrowsFault();
Modified: webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/v2004_06/porttype/impl/QueryResourcePropertiesProviderTestCase.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/v2004_06/porttype/impl/QueryResourcePropertiesProviderTestCase.java?rev=219771&r1=219770&r2=219771&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/v2004_06/porttype/impl/QueryResourcePropertiesProviderTestCase.java (original)
+++ webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/v2004_06/porttype/impl/QueryResourcePropertiesProviderTestCase.java Tue Jul 19 13:36:15 2005
@@ -15,8 +15,6 @@
*=============================================================================*/
package org.apache.ws.resource.properties.v2004_06.porttype.impl;
-import org.apache.ws.resource.ResourceContextException;
-import org.apache.ws.resource.ResourceException;
import org.apache.ws.resource.properties.ResourceProperty;
import org.apache.ws.resource.properties.SushiCallback;
import org.apache.ws.resource.properties.SushiPlate;
@@ -27,7 +25,6 @@
import org.apache.ws.resource.properties.faults.UnknownQueryExpressionDialectFaultException;
import org.apache.ws.resource.properties.query.QueryConstants;
import org.apache.ws.util.XmlBeanUtils;
-import org.apache.xmlbeans.XmlException;
import org.apache.xmlbeans.XmlObject;
import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.QueryExpressionType;
import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.QueryResourcePropertiesDocument;
@@ -92,7 +89,7 @@
}
- public void testQueryOpenContent() throws XmlException
+ public void testQueryOpenContent() throws Exception
{
m_resourceContext = new SushiResourceContext();
insertXsdAnyPropElem();
@@ -109,8 +106,7 @@
* DOCUMENT_ME
*/
public void testQueryResourcePropertiesCallback()
- throws ResourceException,
- ResourceContextException
+ throws Exception
{
m_resourceContext = new SushiResourceContext();