You are viewing a plain text version of this content. The canonical link for it is here.
Posted to muse-dev@ws.apache.org by ki...@apache.org on 2005/08/02 16:06:57 UTC
svn commit: r227010 - in
/webservices/muse/trunk/src/examples/enterprise/services/resourceadmin/src:
java/org/apache/ws/muse/example/resourceadmin/ wsdl/
Author: kidz
Date: Tue Aug 2 07:06:52 2005
New Revision: 227010
URL: http://svn.apache.org/viewcvs?rev=227010&view=rev
Log:
Support for muse-ext properties, refactored for home interface changes
Modified:
webservices/muse/trunk/src/examples/enterprise/services/resourceadmin/src/java/org/apache/ws/muse/example/resourceadmin/DiscoveryCallback.java
webservices/muse/trunk/src/examples/enterprise/services/resourceadmin/src/java/org/apache/ws/muse/example/resourceadmin/ResourceadminHome.java
webservices/muse/trunk/src/examples/enterprise/services/resourceadmin/src/java/org/apache/ws/muse/example/resourceadmin/ResourceadminPropertyQNames.java
webservices/muse/trunk/src/examples/enterprise/services/resourceadmin/src/java/org/apache/ws/muse/example/resourceadmin/ResourceadminResource.java
webservices/muse/trunk/src/examples/enterprise/services/resourceadmin/src/java/org/apache/ws/muse/example/resourceadmin/ResourceadminService.java
webservices/muse/trunk/src/examples/enterprise/services/resourceadmin/src/wsdl/resourceadmin.wsdl
Modified: webservices/muse/trunk/src/examples/enterprise/services/resourceadmin/src/java/org/apache/ws/muse/example/resourceadmin/DiscoveryCallback.java
URL: http://svn.apache.org/viewcvs/webservices/muse/trunk/src/examples/enterprise/services/resourceadmin/src/java/org/apache/ws/muse/example/resourceadmin/DiscoveryCallback.java?rev=227010&r1=227009&r2=227010&view=diff
==============================================================================
--- webservices/muse/trunk/src/examples/enterprise/services/resourceadmin/src/java/org/apache/ws/muse/example/resourceadmin/DiscoveryCallback.java (original)
+++ webservices/muse/trunk/src/examples/enterprise/services/resourceadmin/src/java/org/apache/ws/muse/example/resourceadmin/DiscoveryCallback.java Tue Aug 2 07:06:52 2005
@@ -84,35 +84,36 @@
{
ApplicationResource appResource = (ApplicationResource) resource;
epr = appResource.getEndpointReference( );
- System.out.println( "Application " + epr.toString( ) );
+
}
else if ( resource instanceof HostResource )
{
HostResource hostResource = (HostResource) resource;
epr = hostResource.getEndpointReference( );
- System.out.println( "Host " + epr.toString( ) );
+
}
else if ( resource instanceof IntegrationserverResource )
{
IntegrationserverResource integrationResource = (IntegrationserverResource) resource;
epr = integrationResource.getEndpointReference( );
- System.out.println( "Integration " + epr.toString( ) );
+
}
else if ( resource instanceof BusinessprocesstypeResource )
{
BusinessprocesstypeResource bpResource = (BusinessprocesstypeResource) resource;
epr = bpResource.getEndpointReference( );
- System.out.println( "BP " + epr.toString( ) );
+
}
else
{
- throw new Exception( " unknown resource type" );
+ throw new Exception( " Unknown resource type" );
}
if ( ( epr != null ) && epr instanceof XmlBeansEndpointReference )
{
XmlBeansEndpointReference eprType = (XmlBeansEndpointReference) epr;
- XmlObject obj = eprType.getXmlObject( );
+ // we need to make sure the returned EPR is in 2004 namespace
+ XmlObject obj = eprType.getXmlObject( org.apache.ws.addressing.v2004_08_10.AddressingConstants.NSURI_ADDRESSING_SCHEMA );
if ( obj instanceof EndpointReferenceType )
{
eprs[i] = (EndpointReferenceType) obj;
@@ -120,7 +121,7 @@
}
else
{
- System.out.println( "Exception " + epr.toString( ) );
+
throw new Exception( "Expected type - EndpointReferenceType" + resource.toString( ) );
}
}
Modified: webservices/muse/trunk/src/examples/enterprise/services/resourceadmin/src/java/org/apache/ws/muse/example/resourceadmin/ResourceadminHome.java
URL: http://svn.apache.org/viewcvs/webservices/muse/trunk/src/examples/enterprise/services/resourceadmin/src/java/org/apache/ws/muse/example/resourceadmin/ResourceadminHome.java?rev=227010&r1=227009&r2=227010&view=diff
==============================================================================
--- webservices/muse/trunk/src/examples/enterprise/services/resourceadmin/src/java/org/apache/ws/muse/example/resourceadmin/ResourceadminHome.java (original)
+++ webservices/muse/trunk/src/examples/enterprise/services/resourceadmin/src/java/org/apache/ws/muse/example/resourceadmin/ResourceadminHome.java Tue Aug 2 07:06:52 2005
@@ -16,18 +16,13 @@
package org.apache.ws.muse.example.resourceadmin;
import org.apache.ws.addressing.EndpointReference;
-import org.apache.ws.muse.example.ExampleConstants;
import org.apache.ws.muse.example.application.ApplicationHome;
import org.apache.ws.muse.example.businessprocesstype.BusinessprocesstypeHome;
import org.apache.ws.muse.example.host.HostHome;
import org.apache.ws.muse.example.integrationserver.IntegrationserverHome;
-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 javax.xml.namespace.QName;
import java.io.Serializable;
import java.util.HashMap;
@@ -35,7 +30,7 @@
/**
* @author Kinga Dziembowski
- *
+ *
* Home for Resourceadmin WS-Resources.
*/
public class ResourceadminHome
@@ -91,47 +86,35 @@
/** DOCUMENT_ME */
protected Map m_allResources = new HashMap( );
- /**
- *
- * @param resourceContext
- *
- * @return A Resource
- *
- * @throws ResourceException
- * @throws ResourceContextException
- * @throws ResourceUnknownException
- */
- public Resource getInstance( ResourceContext resourceContext )
- throws ResourceException,
- ResourceContextException,
- ResourceUnknownException
- {
- try
- {
- if ( m_adminResource == null )
- {
- m_adminResource = (ResourceadminResource) createInstance( null );
-
- //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( null );
- m_adminResource.setEndpointReference( epr );
- add( m_adminResource );
- }
- }
- catch ( ResourceException e )
- {
- throw new ResourceUnknownException( "ResourceadminResource",
- resourceContext.getServiceName( ) );
- }
-
- return m_adminResource;
+ /**
+ * This method is called by the system to initialize Home.
+ */
+
+ public void init() throws Exception
+ {
+ super.init();
+ try
+ {
+
+ if ( m_adminResource == null )
+ {
+ m_adminResource = (ResourceadminResource) createInstance( null );
+ EndpointReference epr =
+ getEndpointReference( null );
+ m_adminResource.setEndpointReference( epr );
+ add( m_adminResource );
+ System.out.println("epr is " + epr.toString());
+ }
+ }
+ catch ( ResourceException e )
+ {
+ throw new ResourceUnknownException( "ResourceadminResource","ResourceadminResource"
+ );
+ }
}
// The list of jndi locations for resource homes
- public String[] getKnownHomes( )
+ public static String[] getKnownHomes( )
{
return m_homesNames;
}
@@ -195,7 +178,7 @@
private static Map s_resources;
/**
- * Returns a map of all FilesystemResource instances. Used by the {@link org.apache.ws.resource.impl.AbstractResourceHome}
+ * Returns a map of all ResourceAdmin instances. Used by the {@link org.apache.ws.resource.impl.AbstractResourceHome}
* superclass.
*/
protected synchronized final Map getResourceMap()
Modified: webservices/muse/trunk/src/examples/enterprise/services/resourceadmin/src/java/org/apache/ws/muse/example/resourceadmin/ResourceadminPropertyQNames.java
URL: http://svn.apache.org/viewcvs/webservices/muse/trunk/src/examples/enterprise/services/resourceadmin/src/java/org/apache/ws/muse/example/resourceadmin/ResourceadminPropertyQNames.java?rev=227010&r1=227009&r2=227010&view=diff
==============================================================================
--- webservices/muse/trunk/src/examples/enterprise/services/resourceadmin/src/java/org/apache/ws/muse/example/resourceadmin/ResourceadminPropertyQNames.java (original)
+++ webservices/muse/trunk/src/examples/enterprise/services/resourceadmin/src/java/org/apache/ws/muse/example/resourceadmin/ResourceadminPropertyQNames.java Tue Aug 2 07:06:52 2005
@@ -27,63 +27,38 @@
*/
public interface ResourceadminPropertyQNames
{
- /** DOCUMENT_ME */
- QName SUPPORTEDRESOURCES =
- new QName( "http://ws.apache.org/muse/example/resourceadmin/properties", "SupportedResources", "resAdm-prop" );
-
- /** DOCUMENT_ME */
- QName TOPICEXPRESSIONDIALECTS =
- new QName( "http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.xsd",
- "TopicExpressionDialects", "wsnt" );
-
- /** DOCUMENT_ME */
- QName RESOURCEID =
- new QName( "http://docs.oasis-open.org/wsdm/2004/12/muws/wsdm-muws-part1.xsd", "ResourceId", "muws-p1-xs" );
-
- /** DOCUMENT_ME */
- QName RESOURCEHOSTNAME =
- new QName( "http://ws.apache.org/namespaces/muse/muws-ext-1.xsd", "ResourceHostname", "ws-ext" );
-
- /** DOCUMENT_ME */
- QName VERSION =
- new QName( "http://docs.oasis-open.org/wsdm/2004/12/muws/wsdm-muws-part2.xsd", "Version", "muws-p2-xs" );
-
- /** DOCUMENT_ME */
- QName MANAGEABILITYCAPABILITY =
- new QName( "http://docs.oasis-open.org/wsdm/2004/12/muws/wsdm-muws-part1.xsd", "ManageabilityCapability",
- "muws-p1-xs" );
-
- /** DOCUMENT_ME */
- QName CAPTION =
- new QName( "http://docs.oasis-open.org/wsdm/2004/12/muws/wsdm-muws-part2.xsd", "Caption", "muws-p2-xs" );
-
- /** DOCUMENT_ME */
- QName DISCOVERY =
- new QName( "http://ws.apache.org/muse/example/resourceadmin/properties", "Discovery", "resAdm-prop" );
-
- /** DOCUMENT_ME */
- QName DESCRIPTION =
- new QName( "http://docs.oasis-open.org/wsdm/2004/12/muws/wsdm-muws-part2.xsd", "Description", "muws-p2-xs" );
-
- /** DOCUMENT_ME */
- QName OPERATIONALSTATUS =
- new QName( "http://docs.oasis-open.org/wsdm/2004/12/muws/wsdm-muws-part2.xsd", "OperationalStatus",
- "muws-p2-xs" );
-
- /** DOCUMENT_ME */
- QName FIXEDTOPICSET =
- new QName( "http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.xsd",
- "FixedTopicSet", "wsnt" );
-
- /** DOCUMENT_ME */
- QName CURRENTTIME =
- new QName( "http://docs.oasis-open.org/wsdm/2004/12/muws/wsdm-muws-part2.xsd", "CurrentTime", "muws-p2-xs" );
-
- /** DOCUMENT_ME */
- QName RESOURCETYPE =
- new QName( "http://ws.apache.org/namespaces/muse/muws-ext-1.xsd", "ResourceType", "ws-ext" );
-
- /** DOCUMENT_ME */
- QName TOPIC =
- new QName( "http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.xsd", "Topic", "wsnt" );
-}
\ No newline at end of file
+
+ QName SUPPORTEDRESOURCES =
+ new QName( "http://ws.apache.org/muse/example/resourceadmin/properties", "SupportedResources", "resAdm-prop");
+ QName TOPICEXPRESSIONDIALECTS =
+ new QName( "http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.xsd", "TopicExpressionDialects", "wsnt");
+ QName RESOURCEID =
+ new QName( "http://docs.oasis-open.org/wsdm/2004/12/muws/wsdm-muws-part1.xsd", "ResourceId", "muws-p1-xs");
+ QName CREATIONTIME =
+ new QName( "http://ws.apache.org/namespaces/muse/muws-ext-1.xsd", "CreationTime", "ws-ext");
+ QName RESOURCEHOSTNAME =
+ new QName( "http://ws.apache.org/namespaces/muse/muws-ext-1.xsd", "ResourceHostname", "ws-ext");
+ QName VERSION =
+ new QName( "http://docs.oasis-open.org/wsdm/2004/12/muws/wsdm-muws-part2.xsd", "Version", "muws-p2-xs");
+ QName MANAGEABILITYCAPABILITY =
+ new QName( "http://docs.oasis-open.org/wsdm/2004/12/muws/wsdm-muws-part1.xsd", "ManageabilityCapability", "muws-p1-xs");
+ QName CAPTION =
+ new QName( "http://docs.oasis-open.org/wsdm/2004/12/muws/wsdm-muws-part2.xsd", "Caption", "muws-p2-xs");
+ QName DISCOVERY =
+ new QName( "http://ws.apache.org/muse/example/resourceadmin/properties", "Discovery", "resAdm-prop");
+ QName DESCRIPTION =
+ new QName( "http://docs.oasis-open.org/wsdm/2004/12/muws/wsdm-muws-part2.xsd", "Description", "muws-p2-xs");
+ QName OPERATIONALSTATUS =
+ new QName( "http://docs.oasis-open.org/wsdm/2004/12/muws/wsdm-muws-part2.xsd", "OperationalStatus", "muws-p2-xs");
+ QName FIXEDTOPICSET =
+ new QName( "http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.xsd", "FixedTopicSet", "wsnt");
+ QName CURRENTTIME =
+ new QName( "http://docs.oasis-open.org/wsdm/2004/12/muws/wsdm-muws-part2.xsd", "CurrentTime", "muws-p2-xs");
+ QName RESOURCETYPE =
+ new QName( "http://ws.apache.org/namespaces/muse/muws-ext-1.xsd", "ResourceType", "ws-ext");
+ QName OWNER =
+ new QName( "http://ws.apache.org/namespaces/muse/muws-ext-1.xsd", "Owner", "ws-ext");
+ QName TOPIC =
+ new QName( "http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.xsd", "Topic", "wsnt");
+
+}
Modified: webservices/muse/trunk/src/examples/enterprise/services/resourceadmin/src/java/org/apache/ws/muse/example/resourceadmin/ResourceadminResource.java
URL: http://svn.apache.org/viewcvs/webservices/muse/trunk/src/examples/enterprise/services/resourceadmin/src/java/org/apache/ws/muse/example/resourceadmin/ResourceadminResource.java?rev=227010&r1=227009&r2=227010&view=diff
==============================================================================
--- webservices/muse/trunk/src/examples/enterprise/services/resourceadmin/src/java/org/apache/ws/muse/example/resourceadmin/ResourceadminResource.java (original)
+++ webservices/muse/trunk/src/examples/enterprise/services/resourceadmin/src/java/org/apache/ws/muse/example/resourceadmin/ResourceadminResource.java Tue Aug 2 07:06:52 2005
@@ -40,11 +40,13 @@
import org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceType;
import javax.naming.InitialContext;
import java.util.Calendar;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
/**
- *
+ *
* @author Kinga Dziembowski
- *
+ *
* A Resourceadmin WS-Resource.
* <p/>
* NOTE: This class is generated but IS meant to be modified.
@@ -78,6 +80,10 @@
*/
public static final String RESOURCE_TYPE = "AdminForResources";
+ /** A log object */
+ private static final Log LOG = LogFactory.getLog( ResourceadminResource.class.getName() );
+
+
/**
* Initializes this resource's state (properties, etc.).
*/
@@ -225,9 +231,8 @@
// init the {http://docs.oasis-open.org/wsdm/2004/12/muws/wsdm-muws-part2.xsd}Description Resource Property
resourceProperty = resourcePropertySet.get( ResourceadminPropertyQNames.DESCRIPTION );
org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.DescriptionDocument prop_description =
- org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.DescriptionDocument.Factory.newInstance( );
- org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.LangString lString =
- LangString.Factory.newInstance( );
+ org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.DescriptionDocument.Factory.newInstance( );
+ org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.LangString lString = LangString.Factory.newInstance( );
lString.setStringValue( "This is an Admin for resources objects" );
lString.setLang( "en" );
prop_description.setDescription( lString );
@@ -254,6 +259,22 @@
resourceProperty.add( currentTimeDocument );
resourceProperty.setCallback( new org.apache.ws.resource.lifetime.callback.CurrentTimeCallback( ) );
resourceProperty.addChangeListener( metricCapability );
+
+ // init the {http://ws.apache.org/namespaces/muse/muws-ext-1.xsd}Owner Resource Property
+ resourceProperty = resourcePropertySet.get(ResourceadminPropertyQNames.OWNER);
+ org.apache.ws.namespaces.muse.muwsExt1.OwnerDocument prop_owner = org.apache.ws.namespaces.muse.muwsExt1.OwnerDocument.Factory.newInstance();
+ org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.LangString oString = LangString.Factory.newInstance( );
+ oString.setStringValue( ExampleConstants.RES_ADMIN_OWNER );
+ oString.setLang( "en" );
+ prop_owner.setOwner( oString );
+ resourceProperty.add(prop_owner);
+
+ // init the {http://ws.apache.org/namespaces/muse/muws-ext-1.xsd}CreationTime Resource Property
+ resourceProperty = resourcePropertySet.get(ResourceadminPropertyQNames.CREATIONTIME);
+ org.apache.ws.namespaces.muse.muwsExt1.CreationTimeDocument prop_creationtime = org.apache.ws.namespaces.muse.muwsExt1.CreationTimeDocument.Factory.newInstance();
+ prop_creationtime.setCreationTime(Calendar.getInstance( ));
+ resourceProperty.add(prop_creationtime);
+
}
catch ( Exception e )
{
@@ -264,7 +285,7 @@
// Resource Property {http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.xsd}FixedTopicSet is implemented by the framework.
// Resource Property {http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.xsd}Topic is implemented by the framework.
// Resource Property {http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.xsd}TopicExpressionDialects is implemented by the framework.
-
+
}
/**
@@ -275,12 +296,12 @@
protected String getHostName( )
{
String name = null;
-
+
try
{
java.net.InetAddress localMachine = java.net.InetAddress.getLocalHost( );
name = localMachine.getCanonicalHostName( );
-
+
}
catch ( java.net.UnknownHostException uhe )
{
@@ -304,8 +325,7 @@
throws Exception
{
InitialContext ctx = new InitialContext( );
- ResourceadminHome aHome = (ResourceadminHome) ( ctx.lookup( ResourceadminHome.HOME_LOCATION ) );
- String[] homes = aHome.getKnownHomes( );
+ String[] homes = ResourceadminHome.getKnownHomes();
for ( int i = 0; i < homes.length; i++ )
{
AbstractResourceHome absHome = (AbstractResourceHome) ctx.lookup( homes[i] );
Modified: webservices/muse/trunk/src/examples/enterprise/services/resourceadmin/src/java/org/apache/ws/muse/example/resourceadmin/ResourceadminService.java
URL: http://svn.apache.org/viewcvs/webservices/muse/trunk/src/examples/enterprise/services/resourceadmin/src/java/org/apache/ws/muse/example/resourceadmin/ResourceadminService.java?rev=227010&r1=227009&r2=227010&view=diff
==============================================================================
--- webservices/muse/trunk/src/examples/enterprise/services/resourceadmin/src/java/org/apache/ws/muse/example/resourceadmin/ResourceadminService.java (original)
+++ webservices/muse/trunk/src/examples/enterprise/services/resourceadmin/src/java/org/apache/ws/muse/example/resourceadmin/ResourceadminService.java Tue Aug 2 07:06:52 2005
@@ -130,7 +130,7 @@
if ( epr instanceof XmlBeansEndpointReference )
{
XmlBeansEndpointReference eprType = (XmlBeansEndpointReference) epr;
- XmlObject obj = eprType.getXmlObject( ADRESSING_2004_08_NAMESPACE );
+ XmlObject obj = eprType.getXmlObject( org.apache.ws.addressing.v2004_08_10.AddressingConstants.NSURI_ADDRESSING_SCHEMA );
if ( obj instanceof EndpointReferenceType )
{
response.setEndpointReference( (EndpointReferenceType) obj );
@@ -237,7 +237,7 @@
}
else
{
- throw new Exception( "The EPR is unregistered." );
+ throw new Exception( "The EPR is unknown." );
}
break;
Modified: webservices/muse/trunk/src/examples/enterprise/services/resourceadmin/src/wsdl/resourceadmin.wsdl
URL: http://svn.apache.org/viewcvs/webservices/muse/trunk/src/examples/enterprise/services/resourceadmin/src/wsdl/resourceadmin.wsdl?rev=227010&r1=227009&r2=227010&view=diff
==============================================================================
--- webservices/muse/trunk/src/examples/enterprise/services/resourceadmin/src/wsdl/resourceadmin.wsdl (original)
+++ webservices/muse/trunk/src/examples/enterprise/services/resourceadmin/src/wsdl/resourceadmin.wsdl Tue Aug 2 07:06:52 2005
@@ -134,6 +134,8 @@
<element ref="ws-ext:ResourceType" minOccurs="1" maxOccurs="1" />
<element ref="ws-ext:ResourceHostname" minOccurs="1" maxOccurs="1" />
+ <element ref="ws-ext:CreationTime" minOccurs="1" maxOccurs="1" />
+ <element ref="ws-ext:Owner" minOccurs="1" maxOccurs="1" />
<!-- PROPERTIES DEFINED resourceadmin.xsd -->
<element ref="resAdm-prop:SupportedResources" minOccurs="1" maxOccurs="1" />
---------------------------------------------------------------------
To unsubscribe, e-mail: muse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-dev-help@ws.apache.org