You are viewing a plain text version of this content. The canonical link for it is here.
Posted to muse-commits@ws.apache.org by wi...@apache.org on 2005/10/12 16:25:17 UTC
svn commit: r314924 -
/webservices/muse/trunk/client/src/resource/target/TestResource/src/java/org/apache/ws/service/testresource/
Author: wire
Date: Wed Oct 12 07:25:13 2005
New Revision: 314924
URL: http://svn.apache.org/viewcvs?rev=314924&view=rev
Log:
Updated for Relationships
Modified:
webservices/muse/trunk/client/src/resource/target/TestResource/src/java/org/apache/ws/service/testresource/AbstractTestResourceResource.java
webservices/muse/trunk/client/src/resource/target/TestResource/src/java/org/apache/ws/service/testresource/AbstractTestResourceService.java
webservices/muse/trunk/client/src/resource/target/TestResource/src/java/org/apache/ws/service/testresource/TestResourcePropertyQNames.java
webservices/muse/trunk/client/src/resource/target/TestResource/src/java/org/apache/ws/service/testresource/TestResourceResource.java
Modified: webservices/muse/trunk/client/src/resource/target/TestResource/src/java/org/apache/ws/service/testresource/AbstractTestResourceResource.java
URL: http://svn.apache.org/viewcvs/webservices/muse/trunk/client/src/resource/target/TestResource/src/java/org/apache/ws/service/testresource/AbstractTestResourceResource.java?rev=314924&r1=314923&r2=314924&view=diff
==============================================================================
--- webservices/muse/trunk/client/src/resource/target/TestResource/src/java/org/apache/ws/service/testresource/AbstractTestResourceResource.java (original)
+++ webservices/muse/trunk/client/src/resource/target/TestResource/src/java/org/apache/ws/service/testresource/AbstractTestResourceResource.java Wed Oct 12 07:25:13 2005
@@ -10,7 +10,7 @@
* This class is generated by Wsdl2Java and is NOT meant to be modified.
* It will be overwritten by subsequent runs of Wsdl2Java.
*/
-public abstract class AbstractTestResourceResource implements org.apache.ws.resource.lifetime.ScheduledResourceTerminationResource, org.apache.ws.resource.PropertiesResource, org.apache.ws.notification.base.NotificationProducerResource {
+public abstract class AbstractTestResourceResource implements org.apache.ws.resource.PropertiesResource, org.apache.ws.resource.lifetime.ScheduledResourceTerminationResource, org.apache.ws.notification.base.NotificationProducerResource {
/**
* The resource ID of the instance.
@@ -113,7 +113,21 @@
org.apache.ws.resource.properties.ResourceProperty topicExpressionDialectsProp = getResourcePropertySet().get( org.apache.ws.notification.base.v2004_06.porttype.NotificationProducerPortType.PROP_QNAME_TOPIC_EXPRESSION_DIALECTS );
topicExpressionDialectsProp.setCallback( new org.apache.ws.notification.base.TopicExpressionDialectsResourcePropertyCallback() );
-
+ /**
+ * Add a specialized version of the Relationship ResourceProperty that will automatically publish
+ * RelationshipCreated/Deleted events when elements are added to or removed from the ResourceProperty.
+ */
+ org.apache.ws.muws.MuwsUtils.updateRelationshipResourceProperty( m_propSet, this );
+ /**
+ * Add the MUWS RelationshipCreated/Deleted topics to our topic set.
+ *
+ * NOTE: IF ADDING additional Topics to the Muws2 TopicSpace AFTER this method call, make sure to use
+ * the returned muws2topics TopicSpace. Anytime a TopicSpace is added to a TopicSpaceSet, the set returns
+ * the active handle to that TopicSpace and INVALIDATES the previous handle.
+ */
+ org.apache.ws.notification.topics.TopicSpace muws2topics = org.apache.ws.muws.MuwsUtils.addRelationshipTopics( getTopicSpaceSet() );
+
+
}
/**
@@ -142,6 +156,20 @@
/**
+ * @see org.apache.ws.resource.PropertiesResource#setResourcePropertySet(org.apache.ws.resource.properties.ResourcePropertySet)
+ */
+ public void setResourcePropertySet( org.apache.ws.resource.properties.ResourcePropertySet propSet )
+ {
+ m_propSet = propSet;
+ }
+
+ /**
+ * @see org.apache.ws.resource.PropertiesResource#getResourcePropertySet()
+ */
+ public org.apache.ws.resource.properties.ResourcePropertySet getResourcePropertySet()
+ {
+ return m_propSet;
+ } /**
* DOCUMENT_ME
*
* @param time DOCUMENT_ME
@@ -172,21 +200,7 @@
{
return org.apache.ws.resource.properties.XmlBeansResourcePropertyUtils.getDateTimePropertyValue( (org.apache.ws.resource.properties.impl.XmlBeansResourceProperty) m_propSet.get( org.apache.ws.resource.lifetime.v2004_06.porttype.ScheduledResourceTerminationPortType.PROP_QNAME_TERMINATION_TIME ) );
}
- /**
- * @see org.apache.ws.resource.PropertiesResource#setResourcePropertySet(org.apache.ws.resource.properties.ResourcePropertySet)
- */
- public void setResourcePropertySet( org.apache.ws.resource.properties.ResourcePropertySet propSet )
- {
- m_propSet = propSet;
- }
-
- /**
- * @see org.apache.ws.resource.PropertiesResource#getResourcePropertySet()
- */
- public org.apache.ws.resource.properties.ResourcePropertySet getResourcePropertySet()
- {
- return m_propSet;
- }
+
org.apache.ws.notification.topics.TopicSpaceSet m_topicSpaceSet = new org.apache.ws.notification.topics.impl.TopicSpaceSetImpl(true);
public org.apache.ws.notification.topics.TopicSpaceSet getTopicSpaceSet()
Modified: webservices/muse/trunk/client/src/resource/target/TestResource/src/java/org/apache/ws/service/testresource/AbstractTestResourceService.java
URL: http://svn.apache.org/viewcvs/webservices/muse/trunk/client/src/resource/target/TestResource/src/java/org/apache/ws/service/testresource/AbstractTestResourceService.java?rev=314924&r1=314923&r2=314924&view=diff
==============================================================================
--- webservices/muse/trunk/client/src/resource/target/TestResource/src/java/org/apache/ws/service/testresource/AbstractTestResourceService.java (original)
+++ webservices/muse/trunk/client/src/resource/target/TestResource/src/java/org/apache/ws/service/testresource/AbstractTestResourceService.java Wed Oct 12 07:25:13 2005
@@ -16,7 +16,7 @@
* It will be overwritten by subsequent runs of Wsdl2Java.
*/
public abstract class AbstractTestResourceService extends AbstractPortType
- implements org.apache.ws.resource.handler.WsrfService, org.apache.ws.resource.properties.v2004_06.porttype.QueryResourcePropertiesPortType, org.apache.ws.resource.properties.v2004_06.porttype.SetResourcePropertiesPortType, org.apache.ws.resource.properties.v2004_06.porttype.GetMultipleResourcePropertiesPortType, org.apache.ws.resource.lifetime.v2004_06.porttype.ScheduledResourceTerminationPortType, org.apache.ws.resource.properties.v2004_06.porttype.GetResourcePropertyPortType, org.apache.ws.resource.lifetime.v2004_06.porttype.ImmediateResourceTerminationPortType, org.apache.ws.notification.base.v2004_06.porttype.NotificationProducerPortType {
+ implements org.apache.ws.resource.handler.WsrfService, org.apache.ws.resource.properties.v2004_06.porttype.QueryResourcePropertiesPortType, org.apache.ws.resource.properties.v2004_06.porttype.SetResourcePropertiesPortType, org.apache.ws.resource.properties.v2004_06.porttype.GetMultipleResourcePropertiesPortType, org.apache.ws.resource.properties.v2004_06.porttype.GetResourcePropertyPortType, org.apache.ws.resource.lifetime.v2004_06.porttype.ScheduledResourceTerminationPortType, org.apache.ws.notification.base.v2004_06.porttype.NotificationProducerPortType, org.apache.ws.resource.lifetime.v2004_06.porttype.ImmediateResourceTerminationPortType, org.apache.ws.muws.v1_0.capability.RelationshipsCapability {
public static final String TARGET_NSURI = "http://ws.apache.org/service/testresource";
public static final String TARGET_NSPREFIX = "testresource";
@@ -117,17 +117,6 @@
}
/**
- * DOCUMENT_ME
- *
- * @param requestDoc DOCUMENT_ME
- *
- * @return DOCUMENT_ME
- */
- public org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceLifetime12Draft01.SetTerminationTimeResponseDocument setTerminationTime( org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceLifetime12Draft01.SetTerminationTimeDocument requestDoc )
- {
- return new org.apache.ws.resource.lifetime.v2004_06.porttype.impl.ScheduledResourceTerminationPortTypeImpl( getResourceContext( ) ).setTerminationTime( requestDoc );
- }
- /**
* @see
*/
public org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.GetResourcePropertyResponseDocument getResourceProperty( org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.GetResourcePropertyDocument requestDoc )
@@ -142,9 +131,9 @@
*
* @return DOCUMENT_ME
*/
- public org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceLifetime12Draft01.DestroyResponseDocument destroy( org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceLifetime12Draft01.DestroyDocument requestDoc )
+ public org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceLifetime12Draft01.SetTerminationTimeResponseDocument setTerminationTime( org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceLifetime12Draft01.SetTerminationTimeDocument requestDoc )
{
- return new org.apache.ws.resource.lifetime.v2004_06.porttype.impl.ImmediateResourceTerminationPortTypeImpl( getResourceContext( ) ).destroy( requestDoc );
+ return new org.apache.ws.resource.lifetime.v2004_06.porttype.impl.ScheduledResourceTerminationPortTypeImpl( getResourceContext( ) ).setTerminationTime( requestDoc );
}
/**
* DOCUMENT_ME
@@ -170,6 +159,24 @@
return new org.apache.ws.notification.base.v2004_06.porttype.impl.NotificationProducerPortTypeImpl( getResourceContext( ) ).getCurrentMessage( requestDoc );
}
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param requestDoc DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceLifetime12Draft01.DestroyResponseDocument destroy( org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceLifetime12Draft01.DestroyDocument requestDoc )
+ {
+ return new org.apache.ws.resource.lifetime.v2004_06.porttype.impl.ImmediateResourceTerminationPortTypeImpl( getResourceContext( ) ).destroy( requestDoc );
+ }
+
+public org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.QueryRelationshipsByTypeResponseDocument queryRelationshipsByType( org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.QueryRelationshipsByTypeDocument requestDoc )
+{
+ return new org.apache.ws.muws.v1_0.capability.impl.RelationshipsCapabilityImpl( getResourceContext( ) ).queryRelationshipsByType( requestDoc );
+}
+
}
Modified: webservices/muse/trunk/client/src/resource/target/TestResource/src/java/org/apache/ws/service/testresource/TestResourcePropertyQNames.java
URL: http://svn.apache.org/viewcvs/webservices/muse/trunk/client/src/resource/target/TestResource/src/java/org/apache/ws/service/testresource/TestResourcePropertyQNames.java?rev=314924&r1=314923&r2=314924&view=diff
==============================================================================
--- webservices/muse/trunk/client/src/resource/target/TestResource/src/java/org/apache/ws/service/testresource/TestResourcePropertyQNames.java (original)
+++ webservices/muse/trunk/client/src/resource/target/TestResource/src/java/org/apache/ws/service/testresource/TestResourcePropertyQNames.java Wed Oct 12 07:25:13 2005
@@ -24,10 +24,10 @@
new QName( "http://docs.oasis-open.org/wsdm/2004/12/muws/wsdm-muws-part1.xsd", "ManageabilityCapability", "muws-p1-xs");
QName TERMINATIONTIME =
new QName( "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceLifetime-1.2-draft-01.xsd", "TerminationTime", "wsrl");
- QName CURRENTTIME2 =
- new QName( "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceLifetime-1.2-draft-01.xsd", "CurrentTime", "wsrl");
QName PRICE =
new QName( "http://ws.apache.org/service/testresource", "Price", "tns");
+ QName CURRENTTIME2 =
+ new QName( "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceLifetime-1.2-draft-01.xsd", "CurrentTime", "wsrl");
QName NAME =
new QName( "http://ws.apache.org/service/testresource", "Name", "tns");
QName OPERATIONALSTATUS =
@@ -36,6 +36,8 @@
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 RELATIONSHIP =
+ new QName( "http://docs.oasis-open.org/wsdm/2004/12/muws/wsdm-muws-part2.xsd", "Relationship", "muws-p2-xs");
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/client/src/resource/target/TestResource/src/java/org/apache/ws/service/testresource/TestResourceResource.java
URL: http://svn.apache.org/viewcvs/webservices/muse/trunk/client/src/resource/target/TestResource/src/java/org/apache/ws/service/testresource/TestResourceResource.java?rev=314924&r1=314923&r2=314924&view=diff
==============================================================================
--- webservices/muse/trunk/client/src/resource/target/TestResource/src/java/org/apache/ws/service/testresource/TestResourceResource.java (original)
+++ webservices/muse/trunk/client/src/resource/target/TestResource/src/java/org/apache/ws/service/testresource/TestResourceResource.java Wed Oct 12 07:25:13 2005
@@ -1,190 +1,323 @@
-
package org.apache.ws.service.testresource;
+
import java.math.BigDecimal;
import java.util.Calendar;
+import javax.xml.namespace.QName;
+
import org.apache.ws.muws.v1_0.MuwsConstants;
import org.apache.ws.muws.v1_0.capability.IdentityCapability;
import org.apache.ws.muws.v1_0.capability.ManageabilityCharacteristicsCapability;
import org.apache.ws.muws.v1_0.capability.OperationalStatusCapability;
+import org.apache.ws.muws.v1_0.capability.RelationshipsCapability;
import org.apache.ws.muws.v1_0.topics.ManagementEventTopic;
import org.apache.ws.muws.v1_0.topics.impl.XmlBeansManagementEventTopicImpl;
import org.apache.ws.notification.topics.TopicSpace;
import org.apache.ws.notification.topics.impl.TopicSpaceImpl;
import org.apache.ws.service.testresource.AbstractTestResourceResource;
+import org.apache.ws.service.testresource.TestResourceHome;
import org.apache.ws.service.testresource.TestResourcePropertyQNames;
+import org.apache.ws.util.XmlBeanUtils;
import org.apache.xmlbeans.GDurationBuilder;
+import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.XmlObject;
import org.oasisOpen.docs.wsdm.x2004.x12.mows.wsdmMows.DurationMetric;
import org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.OperationalStatusDocument;
+import org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.RelationshipDocument;
+import org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.RelationshipParticipantType;
+import org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.RelationshipType;
+import org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.RelationshipTypeType;
+import org.apache.ws.resource.properties.ResourceProperty;
+import org.apache.ws.addressing.XmlBeansEndpointReference;
+import org.apache.ws.addressing.v2004_08_10.AddressingConstants;
+import org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceType;
/**
* A TestResource WS-Resource.
* <p />
- * NOTE: This file is generated, but is meant to be modified.
- * It will NOT be overwritten by subsequent runs of Wsdl2Java.
+ * NOTE: This file is generated, but is meant to be modified. It will NOT be
+ * overwritten by subsequent runs of Wsdl2Java.
*/
public class TestResourceResource extends AbstractTestResourceResource
{
+ static QName RELATIONSHIP_RELATION = new QName(TestResourceHome.SERVICE_NAME.getNamespaceURI(), "Contains", "wsdir");
- /**
- * A NamespaceVerionHolder which maintains the QNames of Spec Wsdls
- */
- public static final org.apache.ws.muws.v1_0.impl.WsdmNamespaceVersionHolderImpl SPEC_NAMESPACE_SET = new org.apache.ws.muws.v1_0.impl.WsdmNamespaceVersionHolderImpl();
-
- /**
- * Initializes this resource's state (properties, etc.).
- */
- public void init()
- {
- super.init();
-
- /**
- * The ResourcePropertySet which contains all the defined ResourceProperties
+ /**
+ * A NamespaceVerionHolder which maintains the QNames of Spec Wsdls
+ */
+ public static final org.apache.ws.muws.v1_0.impl.WsdmNamespaceVersionHolderImpl SPEC_NAMESPACE_SET = new org.apache.ws.muws.v1_0.impl.WsdmNamespaceVersionHolderImpl();
+
+ /**
+ * Initializes this resource's state (properties, etc.).
+ */
+ public void init() {
+ super.init();
+
+ /**
+ * The ResourcePropertySet which contains all the defined
+ * ResourceProperties
*/
org.apache.ws.resource.properties.ResourcePropertySet resourcePropertySet = getResourcePropertySet();
org.apache.ws.resource.properties.ResourceProperty resourceProperty = null;
- try{
- /** TOPICS * */
- TopicSpace muwsTopicSpace = new TopicSpaceImpl(
- MuwsConstants.NSURI_MUWS_PART2_TOPICS);
- getTopicSpaceSet().addTopicSpace(muwsTopicSpace);
-
- // identity
- ManagementEventTopic identityCapability = new XmlBeansManagementEventTopicImpl(
- IdentityCapability.TOPIC_NAME);
- muwsTopicSpace.addTopic(identityCapability);
- // manageability
- ManagementEventTopic manageabilityCharacteristicsCapability = new XmlBeansManagementEventTopicImpl(
- ManageabilityCharacteristicsCapability.TOPIC_NAME);
- muwsTopicSpace.addTopic(manageabilityCharacteristicsCapability);
-
- // operational status
- ManagementEventTopic operationalCapability = new XmlBeansManagementEventTopicImpl(
- OperationalStatusCapability.TOPIC_NAME);
- muwsTopicSpace.addTopic(operationalCapability);
-
- // operational status
- ManagementEventTopic testMetricCapability = new XmlBeansManagementEventTopicImpl(
- "TestMetricMonitorChannel");
- muwsTopicSpace.addTopic(testMetricCapability);
-
-
- /** END TOPICS * */
-
- // DEFINE CAPABILITIES
- // init the {http://docs.oasis-open.org/wsdm/2004/12/muws/wsdm-muws-part1.xsd}
- // ManageabilityCapability Resource Property
- resourceProperty = resourcePropertySet.get(TestResourcePropertyQNames.MANAGEABILITYCAPABILITY);
- org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart1.ManageabilityCapabilityDocument prop_manageabilitycapability = org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart1.ManageabilityCapabilityDocument.Factory.newInstance();
+ try {
+ /** TOPICS * */
+ TopicSpace muwsTopicSpace = new TopicSpaceImpl(
+ MuwsConstants.NSURI_MUWS_PART2_TOPICS);
+ getTopicSpaceSet().addTopicSpace(muwsTopicSpace);
+
+ // identity
+ ManagementEventTopic identityCapability = new XmlBeansManagementEventTopicImpl(
+ IdentityCapability.TOPIC_NAME);
+ muwsTopicSpace.addTopic(identityCapability);
+ // manageability
+ ManagementEventTopic manageabilityCharacteristicsCapability = new XmlBeansManagementEventTopicImpl(
+ ManageabilityCharacteristicsCapability.TOPIC_NAME);
+ muwsTopicSpace.addTopic(manageabilityCharacteristicsCapability);
+
+ // operational status
+ ManagementEventTopic operationalCapability = new XmlBeansManagementEventTopicImpl(
+ OperationalStatusCapability.TOPIC_NAME);
+ muwsTopicSpace.addTopic(operationalCapability);
+
+ // operational status
+ ManagementEventTopic testMetricCapability = new XmlBeansManagementEventTopicImpl(
+ "TestMetricMonitorChannel");
+ muwsTopicSpace.addTopic(testMetricCapability);
+
+ //relationships
+ ManagementEventTopic relationshipCapability = new XmlBeansManagementEventTopicImpl(RelationshipsCapability.TOPIC_NAME);
+ muwsTopicSpace.addTopic(relationshipCapability);
+
+ /** END TOPICS * */
+
+ // DEFINE CAPABILITIES
+ // init the
+ // {http://docs.oasis-open.org/wsdm/2004/12/muws/wsdm-muws-part1.xsd}
+ // ManageabilityCapability Resource Property
+ resourceProperty = resourcePropertySet
+ .get(TestResourcePropertyQNames.MANAGEABILITYCAPABILITY);
+ org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart1.ManageabilityCapabilityDocument prop_manageabilitycapability = org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart1.ManageabilityCapabilityDocument.Factory
+ .newInstance();
// identity capability
prop_manageabilitycapability
- .setManageabilityCapability(IdentityCapability.URI);
+ .setManageabilityCapability(IdentityCapability.URI);
resourceProperty.add(prop_manageabilitycapability);
-
+
// operational status capability
prop_manageabilitycapability = org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart1.ManageabilityCapabilityDocument.Factory
- .newInstance();
+ .newInstance();
prop_manageabilitycapability
- .setManageabilityCapability(OperationalStatusCapability.URI);
+ .setManageabilityCapability(OperationalStatusCapability.URI);
resourceProperty.add(prop_manageabilitycapability);
-
+
+ // relationships
+ prop_manageabilitycapability = org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart1.ManageabilityCapabilityDocument.Factory
+ .newInstance();
+ prop_manageabilitycapability
+ .setManageabilityCapability(RelationshipsCapability.URI);
+ resourceProperty.add(prop_manageabilitycapability);
+
// manageability listener capability
-// resourceProperty
-// .addChangeListener(manageabilityCharacteristicsCapability);
+ // resourceProperty
+ // .addChangeListener(manageabilityCharacteristicsCapability);
- // END DEFINE CAPABILITIES
+ // END DEFINE CAPABILITIES
-
- // DEFINE PROPERTIES
- // init the {http://docs.oasis-open.org/wsdm/2004/12/muws/wsdm-muws-part1.xsd}
- // ResourceId Resource Property
- resourceProperty = resourcePropertySet.get(TestResourcePropertyQNames.RESOURCEID);
- org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart1.ResourceIdDocument prop_resourceid = org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart1.ResourceIdDocument.Factory.newInstance();
- prop_resourceid.setResourceId("urn:" + getID());
- resourceProperty.add(prop_resourceid);
- resourceProperty.addChangeListener(identityCapability);
-
-
- // init the {http://ws.apache.org/service/testresource}
- // Name Resource Property
- resourceProperty = resourcePropertySet.get(TestResourcePropertyQNames.NAME);
- org.apache.ws.service.testresource.NameDocument prop_name = org.apache.ws.service.testresource.NameDocument.Factory.newInstance();
- prop_name.setName("UnitTestResource");
- resourceProperty.add(prop_name);
-
- // init the {http://docs.oasis-open.org/wsdm/2004/12/mows/wsdm-mows.xsd}
- // LastResponseTime Resource Property
- Calendar resetAt = Calendar.getInstance();
- resourceProperty = resourcePropertySet.get(TestResourcePropertyQNames.LASTRESPONSETIME);
- org.oasisOpen.docs.wsdm.x2004.x12.mows.wsdmMows.LastResponseTimeDocument prop_lastresponsetime = org.oasisOpen.docs.wsdm.x2004.x12.mows.wsdmMows.LastResponseTimeDocument.Factory.newInstance();
- DurationMetric durationMetric = DurationMetric.Factory.newInstance();
- GDurationBuilder builder = new GDurationBuilder(+1, 1, 2, 3, 4, 5,
- 6, new BigDecimal("0.789"));
- durationMetric.setGDurationValue(builder.toGDuration());
- durationMetric.setLastUpdated(resetAt);
- durationMetric.setResetAt(resetAt);
- prop_lastresponsetime.setLastResponseTime(durationMetric);
- resourceProperty.add(prop_lastresponsetime);
-
-
- // init the {http://ws.apache.org/service/testresource}
- // TestMetric Resource Property
- resourceProperty = resourcePropertySet.get(TestResourcePropertyQNames.TESTMETRIC);
- org.apache.ws.service.testresource.TestMetricDocument prop_testmetric = org.apache.ws.service.testresource.TestMetricDocument.Factory.newInstance();
-
- org.apache.ws.service.testresource.TestMetricMetricType testMetricMetricType = prop_testmetric
- .addNewTestMetric();
- testMetricMetricType.setDoubleValue(100.0);
- testMetricMetricType.setResetAt(resetAt);
-
- resourceProperty.add(prop_testmetric);
- resourceProperty.addChangeListener(testMetricCapability);
-
-
- // init the {http://ws.apache.org/service/testresource}
- // Price Resource Property
- resourceProperty = resourcePropertySet.get(TestResourcePropertyQNames.PRICE);
- org.apache.ws.service.testresource.PriceDocument prop_price = org.apache.ws.service.testresource.PriceDocument.Factory.newInstance();
- prop_price.setPrice(0.99);
- resourceProperty.add(prop_price);
-
-
-
- // init the {http://docs.oasis-open.org/wsdm/2004/12/muws/wsdm-muws-part2.xsd}
- // OperationalStatus Resource Property
- resourceProperty = resourcePropertySet.get(TestResourcePropertyQNames.OPERATIONALSTATUS);
- org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.OperationalStatusDocument prop_operationalstatus = org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.OperationalStatusDocument.Factory.newInstance();
- prop_operationalstatus
- .setOperationalStatus(OperationalStatusDocument.OperationalStatus.AVAILABLE);
- resourceProperty.add(prop_operationalstatus);
- resourceProperty.addChangeListener(operationalCapability);
-
-
- // init the {http://docs.oasis-open.org/wsdm/2004/12/muws/wsdm-muws-part2.xsd}
- // CurrentTime Resource Property
- resourceProperty = resourcePropertySet.get(TestResourcePropertyQNames.CURRENTTIME);
- org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.CurrentTimeDocument prop_currenttime = org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.CurrentTimeDocument.Factory.newInstance();
- prop_currenttime.setCurrentTime(Calendar.getInstance());
- // TODO: Initialize the prop_currenttime by calling its operations.
- //also could call resourceProperty.setCallback(...); to add a custom callback object for this property
- resourceProperty.add(prop_currenttime);
-
-
+ // DEFINE PROPERTIES
+ // init the
+ // {http://docs.oasis-open.org/wsdm/2004/12/muws/wsdm-muws-part1.xsd}
+ // ResourceId Resource Property
+ resourceProperty = resourcePropertySet
+ .get(TestResourcePropertyQNames.RESOURCEID);
+ org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart1.ResourceIdDocument prop_resourceid = org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart1.ResourceIdDocument.Factory
+ .newInstance();
+ prop_resourceid.setResourceId("urn:" + getID());
+ resourceProperty.add(prop_resourceid);
+ resourceProperty.addChangeListener(identityCapability);
+
+ // init the {http://ws.apache.org/service/testresource}
+ // Name Resource Property
+ resourceProperty = resourcePropertySet
+ .get(TestResourcePropertyQNames.NAME);
+ org.apache.ws.service.testresource.NameDocument prop_name = org.apache.ws.service.testresource.NameDocument.Factory
+ .newInstance();
+ prop_name.setName("UnitTestResource");
+ resourceProperty.add(prop_name);
+
+ // init the
+ // {http://docs.oasis-open.org/wsdm/2004/12/mows/wsdm-mows.xsd}
+ // LastResponseTime Resource Property
+ Calendar resetAt = Calendar.getInstance();
+ resourceProperty = resourcePropertySet
+ .get(TestResourcePropertyQNames.LASTRESPONSETIME);
+ org.oasisOpen.docs.wsdm.x2004.x12.mows.wsdmMows.LastResponseTimeDocument prop_lastresponsetime = org.oasisOpen.docs.wsdm.x2004.x12.mows.wsdmMows.LastResponseTimeDocument.Factory
+ .newInstance();
+ DurationMetric durationMetric = DurationMetric.Factory
+ .newInstance();
+ GDurationBuilder builder = new GDurationBuilder(+1, 1, 2, 3, 4, 5,
+ 6, new BigDecimal("0.789"));
+ durationMetric.setGDurationValue(builder.toGDuration());
+ durationMetric.setLastUpdated(resetAt);
+ durationMetric.setResetAt(resetAt);
+ prop_lastresponsetime.setLastResponseTime(durationMetric);
+ resourceProperty.add(prop_lastresponsetime);
+
+ // init the {http://ws.apache.org/service/testresource}
+ // TestMetric Resource Property
+ resourceProperty = resourcePropertySet
+ .get(TestResourcePropertyQNames.TESTMETRIC);
+ org.apache.ws.service.testresource.TestMetricDocument prop_testmetric = org.apache.ws.service.testresource.TestMetricDocument.Factory
+ .newInstance();
+
+ org.apache.ws.service.testresource.TestMetricMetricType testMetricMetricType = prop_testmetric
+ .addNewTestMetric();
+ testMetricMetricType.setDoubleValue(100.0);
+ testMetricMetricType.setResetAt(resetAt);
+
+ resourceProperty.add(prop_testmetric);
+ resourceProperty.addChangeListener(testMetricCapability);
+
+ // init the {http://ws.apache.org/service/testresource}
+ // Price Resource Property
+ resourceProperty = resourcePropertySet
+ .get(TestResourcePropertyQNames.PRICE);
+ org.apache.ws.service.testresource.PriceDocument prop_price = org.apache.ws.service.testresource.PriceDocument.Factory
+ .newInstance();
+ prop_price.setPrice(0.99);
+ resourceProperty.add(prop_price);
+
+ // init the
+ // {http://docs.oasis-open.org/wsdm/2004/12/muws/wsdm-muws-part2.xsd}
+ // OperationalStatus Resource Property
+ resourceProperty = resourcePropertySet
+ .get(TestResourcePropertyQNames.OPERATIONALSTATUS);
+ org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.OperationalStatusDocument prop_operationalstatus = org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.OperationalStatusDocument.Factory
+ .newInstance();
+ prop_operationalstatus
+ .setOperationalStatus(OperationalStatusDocument.OperationalStatus.AVAILABLE);
+ resourceProperty.add(prop_operationalstatus);
+ resourceProperty.addChangeListener(operationalCapability);
+
+ // init the
+ // {http://docs.oasis-open.org/wsdm/2004/12/muws/wsdm-muws-part2.xsd}
+ // CurrentTime Resource Property
+ resourceProperty = resourcePropertySet
+ .get(TestResourcePropertyQNames.CURRENTTIME);
+ org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.CurrentTimeDocument prop_currenttime = org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.CurrentTimeDocument.Factory
+ .newInstance();
+ prop_currenttime.setCurrentTime(Calendar.getInstance());
+ // TODO: Initialize the prop_currenttime by calling its operations.
+ // also could call resourceProperty.setCallback(...); to add a
+ // custom callback object for this property
+ resourceProperty.add(prop_currenttime);
+
+ // init the
+ // {http://docs.oasis-open.org/wsdm/2004/12/muws/wsdm-muws-part2.xsd}Relationship
+ // Resource Property
+ resourceProperty = resourcePropertySet
+ .get(TestResourcePropertyQNames.RELATIONSHIP);
+ initRelationships(resourceProperty);
+ resourceProperty.addChangeListener(relationshipCapability);
+
+ } catch (Exception e) {
+ throw new javax.xml.rpc.JAXRPCException(
+ "There was a problem in initializing your resource properties. Please check your init() method. Cause: "
+ + e.getLocalizedMessage());
}
- catch (Exception e)
- {
- throw new javax.xml.rpc.JAXRPCException("There was a problem in initializing your resource properties. Please check your init() method. Cause: " + e.getLocalizedMessage());
+ // 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.
+
+ }
+
+ /**
+ * Adds a relationship to this resource with a given epr as the child
+ * relation
+ *
+ * @param resourceProperty
+ * @param childEpr
+ */
+ private void addRelation(ResourceProperty resourceProperty,
+ EndpointReferenceType childEpr,String resourceId) {
+ // define a relationship
+ RelationshipDocument relationshipDocument = RelationshipDocument.Factory
+ .newInstance();
+ RelationshipType relationshipType = createRelationshipType(relationshipDocument
+ .addNewRelationship());
+
+ // add self as a participant
+ RelationshipParticipantType parentRelationshipParticipantType = relationshipType
+ .addNewParticipant();
+ XmlBeansEndpointReference dirEpr = (XmlBeansEndpointReference) getEndpointReference();
+ EndpointReferenceType dirEndpointReferenceType = (EndpointReferenceType) dirEpr
+ .getXmlObject(AddressingConstants.NSURI_ADDRESSING_SCHEMA);
+ parentRelationshipParticipantType
+ .setResourceId("0001");
+ parentRelationshipParticipantType
+ .setRole("urn://parent");// uri
+ parentRelationshipParticipantType
+ .setManageabilityEndpointReferenceArray(new EndpointReferenceType[] { dirEndpointReferenceType });
+
+ // add the new ws as the other participant
+ RelationshipParticipantType childRelationshipParticipantType = relationshipType
+ .addNewParticipant();
+ System.out.println("Getting the Resource ID for the EPR: "
+ + childEpr.getAddress().getStringValue());
+ //String resourceId = InteropRequestUtils.getResourceId(childEpr);
+ if (resourceId == null) {
+ resourceId = "UNKNOWN";
+ }
+ childRelationshipParticipantType.setResourceId(resourceId);
+ childRelationshipParticipantType
+ .setRole("urn://child");// uri
+ childRelationshipParticipantType
+ .setManageabilityEndpointReferenceArray(new EndpointReferenceType[] { childEpr });
+
+ resourceProperty.add(relationshipDocument);
}
- // 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.
-
-
- }
+ /**
+ * Initializes the default relationships
+ *
+ * @param resourceProperty
+ * @throws Exception
+ */
+ private void initRelationships(ResourceProperty resourceProperty)
+ throws Exception {
+ try {
+ addRelation(resourceProperty, (EndpointReferenceType) new XmlBeansEndpointReference(
+ "http://localhost:8080/axis/TestResource", "0002"),"0002");
+ addRelation(resourceProperty,(EndpointReferenceType) new XmlBeansEndpointReference(
+ "http://localhost:8080/axis/TestResource", "0003"),"0003");
+ } catch (Exception e) {
+ }
+ }
+ public static RelationshipType createRelationshipType(RelationshipType relationshipType)
+ {
+ try
+ {
+ //define the relationship type
+ RelationshipTypeType relationshipTypeType = relationshipType.addNewType();
+ XmlObject relationType = XmlObject.Factory.parse("<" + RELATIONSHIP_RELATION.getPrefix() + ":" + RELATIONSHIP_RELATION.getLocalPart() + " xmlns:" + RELATIONSHIP_RELATION.getPrefix() + "=" + "\"" +RELATIONSHIP_RELATION.getNamespaceURI() + "\" />");
+ XmlBeanUtils.addChildElement(relationshipTypeType, relationType);
+ }
+ catch (XmlException e)
+ {
+ e.printStackTrace();
+ }
+ return relationshipType;
+ }
+
+
}