Author: ips
Date: Tue Jul 26 16:15:51 2005
New Revision: 225416
URL: http://svn.apache.org/viewcvs?rev=225416&view=rev
Log:
the ResourceId callback now uses the Jakarta Commons-Id lib to generate UUIDs;
began to refactor example homes/resources to work with updates made to WSRF
home interface
Removed:
webservices/muse/trunk/src/examples/enterprise/logic/src/java/org/apache/ws/muse/example/utils/EndPointReferenceFactory.java
webservices/muse/trunk/src/examples/enterprise/logic/src/java/org/apache/ws/muse/example/utils/ResourceKeyFactory.java
webservices/muse/trunk/src/examples/enterprise/services/application/src/java/org/apache/ws/muse/example/application/AbstractApplicationHome.java
Modified:
webservices/muse/trunk/project.xml
webservices/muse/trunk/src/examples/enterprise/services/application/src/java/org/apache/ws/muse/example/application/ApplicationHome.java
webservices/muse/trunk/src/examples/enterprise/services/application/src/java/org/apache/ws/muse/example/application/ApplicationResource.java
webservices/muse/trunk/src/examples/interop/src/test/org/apache/xmlbeans/BugTester.java
webservices/muse/trunk/src/java/org/apache/ws/muws/ResourceIdResourcePropertyCallback.java
Modified: webservices/muse/trunk/project.xml
URL:
http://svn.apache.org/viewcvs/webservices/muse/trunk/project.xml?rev=225416&r1=225415&r2=225416&view=diff
==============================================================================
--- webservices/muse/trunk/project.xml (original)
+++ webservices/muse/trunk/project.xml Tue Jul 26 16:15:51 2005
@@ -270,6 +270,18 @@
<war.bundle>true</war.bundle>
</properties>
</dependency>
+
+ <dependency>
+ <groupId>commons-id</groupId>
+ <artifactId>commons-id</artifactId>
+ <version>0.1-dev</version>
+ <url>http://jakarta.apache.org/commons/sandbox/id/</url>
+ <properties>
+ <license>ApacheLicense-2.0.txt</license>
+ <usage>Library for generating UUIDs</usage>
+ <war.bundle>true</war.bundle>
+ </properties>
+ </dependency>
<dependency>
<groupId>commons-io</groupId>
Modified:
webservices/muse/trunk/src/examples/enterprise/services/application/src/java/org/apache/ws/muse/example/application/ApplicationHome.java
URL:
http://svn.apache.org/viewcvs/webservices/muse/trunk/src/examples/enterprise/services/application/src/java/org/apache/ws/muse/example/application/ApplicationHome.java?rev=225416&r1=225415&r2=225416&view=diff
==============================================================================
---
webservices/muse/trunk/src/examples/enterprise/services/application/src/java/org/apache/ws/muse/example/application/ApplicationHome.java
(original)
+++
webservices/muse/trunk/src/examples/enterprise/services/application/src/java/org/apache/ws/muse/example/application/ApplicationHome.java
Tue Jul 26 16:15:51 2005
@@ -18,23 +18,22 @@
import org.apache.ws.addressing.EndpointReference;
import org.apache.ws.muse.example.ExampleConstants;
import org.apache.ws.muse.example.resourceadmin.properties.CreateParamsType;
-import org.apache.ws.muse.example.utils.ResourceKeyFactory;
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 javax.xml.namespace.QName;
import java.io.Serializable;
+import java.util.Map;
/**
* Home for Application WS-Resources.
*/
public class ApplicationHome
- extends AbstractApplicationHome
+ extends AbstractResourceHome
implements Serializable
{
/** The service endpoint name as registered with the SOAP Platform. This
is useful for building EPR's. **/
@@ -75,43 +74,6 @@
private long m_instances = 0;
/**
- *
- * @param resourceContext
- *
- * @return A Resource
- *
- * @throws ResourceException
- * @throws ResourceContextException
- * @throws ResourceUnknownException
- */
- 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 ResourceUnknownException( key.getValue( ),
- resourceContext.getServiceName(
) );
-
- /**
- * You can build an EndpointReference for a Resource you create by
uncommenting the following code.
- * Note: You can set the EndpointReference on your Resource using the
setter (not in Resource interface)
- */
-
- //EndpointReference epr =
getEndpointReference(resourceContext.getBaseURL( ) + "/" +
getServiceName().getLocalPart() , key,
SPEC_NAMESPACE_SET.getAddressingNamespace());
- }
-
- return resource;
- }
-
- /**
* DOCUMENT_ME
*
* @return DOCUMENT_ME
@@ -171,23 +133,22 @@
{
Resource resource = null;
long currentId = ++m_instances;
- SimpleTypeResourceKey aKey =
- ResourceKeyFactory.createKey( RESOURCE_ID, SERVICE_NAME +
Long.toString( currentId ) );
+ Object resourceId = SERVICE_NAME + Long.toString( currentId );
try
{
// resource = createInstance(aKey);
- resource = new ApplicationResource( aKey, params );
+ resource = new ApplicationResource( resourceId, params );
//The EPRs should be build using
"http://schemas.xmlsoap.org/ws/2003/03/addressing" addressing namespace. It
introduces spec conflicts
//To work around thes problem the
"http://schemas.xmlsoap.org/ws/2004/08/addressing" is used as namespace for
addressing
//EndpointReference epr =
getEndpointReference(resourceContext.getBaseURL( ) + "/" +
getServiceName().getLocalPart() , null,
SPEC_NAMESPACE_SET.getAddressingNamespace());
EndpointReference epr =
getEndpointReference( resourceContext.getBaseURL( ) + "/" +
getServiceName( ).getLocalPart( ),
- aKey,
+ resourceId,
ExampleConstants.getAddressingNamespace( )
);
( (ApplicationResource) resource ).setEndpointReference( epr );
resource.init( );
- add( aKey, resource );
+ add( resource );
}
catch ( Exception e )
{
@@ -196,4 +157,24 @@
return resource;
}
+
+ /**
+ * 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 [EMAIL
PROTECTED] org.apache.ws.resource.impl.AbstractResourceHome}
+ * superclass.
+ */
+ protected synchronized final Map getResourceMap()
+ {
+ if ( s_resources == null )
+ {
+ s_resources = AbstractResourceHome.createResourceMap(
m_resourceIsPersistent );
+ }
+ return s_resources;
+ }
+
}
Modified:
webservices/muse/trunk/src/examples/enterprise/services/application/src/java/org/apache/ws/muse/example/application/ApplicationResource.java
URL:
http://svn.apache.org/viewcvs/webservices/muse/trunk/src/examples/enterprise/services/application/src/java/org/apache/ws/muse/example/application/ApplicationResource.java?rev=225416&r1=225415&r2=225416&view=diff
==============================================================================
---
webservices/muse/trunk/src/examples/enterprise/services/application/src/java/org/apache/ws/muse/example/application/ApplicationResource.java
(original)
+++
webservices/muse/trunk/src/examples/enterprise/services/application/src/java/org/apache/ws/muse/example/application/ApplicationResource.java
Tue Jul 26 16:15:51 2005
@@ -34,7 +34,6 @@
import org.apache.ws.notification.topics.TopicSpace;
import org.apache.ws.notification.topics.TopicSpaceSet;
import org.apache.ws.notification.topics.impl.TopicSpaceImpl;
-import org.apache.ws.resource.ResourceKey;
import
org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart1.ManageabilityCapabilityDocument;
import
org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.CurrentTimeDocument;
import org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.LangString;
@@ -82,14 +81,13 @@
/**
* Creates a new [EMAIL PROTECTED] ApplicationResource} object.
*
- * @param key DOCUMENT_ME
+ * @param resourceId DOCUMENT_ME
* @param params DOCUMENT_ME
*/
- public ApplicationResource( ResourceKey key,
+ public ApplicationResource( Object resourceId,
CreateParamsType params )
{
- setID( ( key != null ) ? key.getValue( ) : null );
-
+ setID( resourceId );
// params can have any important information for the creation of Resource
// in this example it is not used
}
Modified:
webservices/muse/trunk/src/examples/interop/src/test/org/apache/xmlbeans/BugTester.java
URL:
http://svn.apache.org/viewcvs/webservices/muse/trunk/src/examples/interop/src/test/org/apache/xmlbeans/BugTester.java?rev=225416&r1=225415&r2=225416&view=diff
==============================================================================
---
webservices/muse/trunk/src/examples/interop/src/test/org/apache/xmlbeans/BugTester.java
(original)
+++
webservices/muse/trunk/src/examples/interop/src/test/org/apache/xmlbeans/BugTester.java
Tue Jul 26 16:15:51 2005
@@ -16,19 +16,16 @@
package org.apache.xmlbeans;
import junit.framework.TestCase;
-
-import java.net.URL;
-import java.io.File;
-
-import org.w3c.dom.Node;
import org.apache.ws.util.JaxpUtils;
import org.apache.ws.util.XmlBeanUtils;
import
org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.SubscribeDocument;
-import org.xmlsoap.schemas.ws.x2003.x03.addressing.EndpointReferenceType;
+import org.w3c.dom.Node;
import org.xmlsoap.schemas.ws.x2003.x03.addressing.AttributedURI;
+import org.xmlsoap.schemas.ws.x2003.x03.addressing.EndpointReferenceType;
import org.xmlsoap.schemas.ws.x2003.x03.addressing.ReferencePropertiesType;
import javax.xml.namespace.QName;
+import java.net.URL;
/**
* TODO
@@ -69,7 +66,7 @@
XmlBeanUtils.addChildElement( referencePropertiesType, new QName(
"Fudge" ) );
Node domNode = subscribeDocument.getDomNode();
// TODO: this isn't working - figure out how to reproduce the bug...
- System.out.println( JaxpUtils.toString( domNode );
+ System.out.println( JaxpUtils.toString( domNode ) );
}
}
Modified:
webservices/muse/trunk/src/java/org/apache/ws/muws/ResourceIdResourcePropertyCallback.java
URL:
http://svn.apache.org/viewcvs/webservices/muse/trunk/src/java/org/apache/ws/muws/ResourceIdResourcePropertyCallback.java?rev=225416&r1=225415&r2=225416&view=diff
==============================================================================
---
webservices/muse/trunk/src/java/org/apache/ws/muws/ResourceIdResourcePropertyCallback.java
(original)
+++
webservices/muse/trunk/src/java/org/apache/ws/muws/ResourceIdResourcePropertyCallback.java
Tue Jul 26 16:15:51 2005
@@ -15,12 +15,13 @@
*=============================================================================*/
package org.apache.ws.muws;
+import org.apache.commons.id.IdentifierUtils;
+import org.apache.commons.id.uuid.UUID;
import org.apache.ws.muws.v1_0.capability.IdentityCapability;
import org.apache.ws.resource.Resource;
import org.apache.ws.resource.properties.ResourceProperty;
import org.apache.ws.resource.properties.ResourcePropertyCallback;
import org.apache.ws.resource.properties.impl.CallbackFailedException;
-import org.apache.ws.addressing.uuid.UUIdGeneratorFactory;
import org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart1.ResourceIdDocument;
import javax.xml.namespace.QName;
@@ -113,14 +114,22 @@
/**
* Returns the base URI to which [EMAIL PROTECTED] #toURI} will append a
stringified version
- * of a resource identifier.
+ * of a resource identifier. The default implementation returns a URN
representation
+ * of a v4 UUID.
*
* @return the base URI to which [EMAIL PROTECTED] #toURI} will append a
stringified version
* of a resource identifier
*/
protected static String getBaseURI()
{
- return "urn:" +
UUIdGeneratorFactory.createUUIdGenerator().generateUUId();
+ try
+ {
+ return ((UUID)
IdentifierUtils.UUID_VERSION_FOUR_GENERATOR.nextIdentifier()).toUrn();
+ }
+ catch ( Exception e )
+ {
+ throw new RuntimeException( "Failed to generate UUID.", e );
+ }
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]