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 sc...@apache.org on 2005/06/06 22:36:52 UTC

svn commit: r180563 - in /incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service: InteropRequestUtils.java weatherStation/WeatherStationHome.java weatherStationDir/WeatherStationDirResource.java weatherStationDir/WeatherStationDirService.java

Author: scamp
Date: Mon Jun  6 13:36:52 2005
New Revision: 180563

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

Modified:
    incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/InteropRequestUtils.java
    incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStation/WeatherStationHome.java
    incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStationDir/WeatherStationDirResource.java
    incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStationDir/WeatherStationDirService.java

Modified: incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/InteropRequestUtils.java
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/InteropRequestUtils.java?rev=180563&r1=180562&r2=180563&view=diff
==============================================================================
--- incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/InteropRequestUtils.java (original)
+++ incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/InteropRequestUtils.java Mon Jun  6 13:36:52 2005
@@ -2,14 +2,20 @@
 
 import org.apache.axis.message.addressing.Constants;
 import org.apache.ws.XmlObjectWrapper;
+import org.apache.ws.muws.v1_0.capability.IdentityCapability;
 import org.apache.ws.addressing.EndpointReference;
+import org.apache.ws.addressing.XmlBeansEndpointReference;
 import org.apache.ws.util.XmlBeanUtils;
 import org.apache.ws.util.soap.SoapClient;
 import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.impl.values.XmlAnyUriImpl;
 import org.xmlsoap.schemas.soap.envelope.Envelope;
 import org.xmlsoap.schemas.soap.envelope.EnvelopeDocument;
 import org.xmlsoap.schemas.soap.envelope.Header;
 import org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceDocument;
+import org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceType;
+import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.GetResourcePropertyDocument;
+import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.GetResourcePropertyResponseDocument;
 
 import java.net.URI;
 import java.net.URL;
@@ -151,4 +157,23 @@
     {
         return (EndpointReferenceDocument) XmlObject.Factory.parse( url );
     }
+
+    public static String getResourceId(EndpointReferenceType endpointReferenceType)
+     {
+         GetResourcePropertyDocument getResourcePropertyDocument = GetResourcePropertyDocument.Factory.newInstance();
+         getResourcePropertyDocument.setGetResourceProperty(IdentityCapability.PROP_NAME_RESOURCE_ID);
+         XmlObject xmlObject = sendRequest(getResourcePropertyDocument, "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.wsdl/GetResourceProperty", new XmlBeansEndpointReference(endpointReferenceType));
+         if (xmlObject instanceof GetResourcePropertyResponseDocument.GetResourcePropertyResponse)
+         {
+             GetResourcePropertyResponseDocument.GetResourcePropertyResponse getResourcePropertyResponse = (GetResourcePropertyResponseDocument.GetResourcePropertyResponse) xmlObject;
+             XmlObject[] childElements = XmlBeanUtils.getChildElements(getResourcePropertyResponse);
+             XmlAnyUriImpl childElement = (XmlAnyUriImpl) childElements[0];
+             String resourceid = childElement.getStringValue();             
+             return resourceid;
+         }
+         else
+         {
+             return null;
+         }
+     }
 }

Modified: incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStation/WeatherStationHome.java
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStation/WeatherStationHome.java?rev=180563&r1=180562&r2=180563&view=diff
==============================================================================
--- incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStation/WeatherStationHome.java (original)
+++ incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStation/WeatherStationHome.java Mon Jun  6 13:36:52 2005
@@ -10,7 +10,6 @@
 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.xmlbeans.XmlObject;
 import org.wsdmdemo.service.InteropConstants;
 import org.wsdmdemo.service.InteropRequestUtils;
@@ -105,7 +104,7 @@
         AddWeatherStationDocument addWeatherStationDocument = AddWeatherStationDocument.Factory.newInstance();
         org.wsdmdemo.service.weatherStationDir.AddWeatherStationDocument.AddWeatherStation addWeatherStation = addWeatherStationDocument.addNewAddWeatherStation();
         addWeatherStation.setEndpointReference((org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceType) ((XmlBeansEndpointReference) epr).getXmlObject(AddressingConstants.NSURI_ADDRESSING_SCHEMA));
-        XmlObject xmlObject = InteropRequestUtils.sendRequest(addWeatherStationDocument, "http://wsdmdemo.org/service/weather-station-dir/AddWeatherStation", InteropConstants.WEATHER_STATION_DIR_SERVICE_URL);
+        XmlObject xmlObject = InteropRequestUtils.sendRequest(addWeatherStationDocument, "http://wsdmdemo.org/service/weather-station-dir/AddWeatherStation", InteropConstants.SYSPROP_WS_DIR_SERVICE_URL);
     }
 
     /**

Modified: incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStationDir/WeatherStationDirResource.java
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStationDir/WeatherStationDirResource.java?rev=180563&r1=180562&r2=180563&view=diff
==============================================================================
--- incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStationDir/WeatherStationDirResource.java (original)
+++ incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStationDir/WeatherStationDirResource.java Mon Jun  6 13:36:52 2005
@@ -18,6 +18,8 @@
 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.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.GetResourcePropertyDocument;
+import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.GetResourcePropertyResponseDocument;
 import org.wsdmdemo.service.InteropConstants;
 import org.wsdmdemo.service.InteropRequestUtils;
 import org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceType;
@@ -159,34 +161,31 @@
     {
         //define a relationship
         RelationshipDocument relationshipDocument = RelationshipDocument.Factory.newInstance();
-        RelationshipType  relationshipType = createRelationshipType(relationshipDocument, relationshipDocument.addNewRelationship());
+        RelationshipType  relationshipType = createRelationshipType(relationshipDocument.addNewRelationship());
 
         //add self as a participant
-        RelationshipParticipantType relationshipParticipantType = relationshipType.addNewParticipant();
+        RelationshipParticipantType parentRelationshipParticipantType = relationshipType.addNewParticipant();
         XmlBeansEndpointReference dirEpr = (XmlBeansEndpointReference) getEndpointReference();
         EndpointReferenceType dirEndpointReferenceType = (EndpointReferenceType) dirEpr.getXmlObject(AddressingConstants.NSURI_ADDRESSING_SCHEMA);
-        relationshipParticipantType.setResourceId(InteropConstants.DIR_RESOURCEID);
-        relationshipParticipantType.setRole("urn://parent");//uri
-        relationshipParticipantType.setManageabilityEndpointReferenceArray(new EndpointReferenceType[]{dirEndpointReferenceType});
+        parentRelationshipParticipantType.setResourceId(InteropConstants.DIR_RESOURCEID);
+        parentRelationshipParticipantType.setRole("urn://parent");//uri
+        parentRelationshipParticipantType.setManageabilityEndpointReferenceArray(new EndpointReferenceType[]{dirEndpointReferenceType});
 
 
         //add the new ws as the other participant
-        RelationshipParticipantType relationshipParticipantType2 = relationshipType.addNewParticipant();
-        //todo barties needs to fix communications
-        // relationshipParticipantType2.setResourceId(getResourceId(addedEpr));
-        relationshipParticipantType2.setResourceId(InteropConstants.WS1_KEY);
-        relationshipParticipantType2.setRole("urn://child");//uri
-        relationshipParticipantType.setManageabilityEndpointReferenceArray(new EndpointReferenceType[]{childEpr});
+        RelationshipParticipantType childRelationshipParticipantType = relationshipType.addNewParticipant();
+        childRelationshipParticipantType.setResourceId(InteropRequestUtils.getResourceId(childEpr));
+        childRelationshipParticipantType.setRole("urn://child");//uri
+        childRelationshipParticipantType.setManageabilityEndpointReferenceArray(new EndpointReferenceType[]{childEpr});
 
         resourceProperty.add(relationshipDocument);
     }
 
-    private RelationshipType createRelationshipType(RelationshipDocument relationshipDocument, RelationshipType relationshipType)
+    private RelationshipType createRelationshipType(RelationshipType relationshipType)
     {
         try
         {
             //define the relationship type
-            relationshipType = relationshipDocument.addNewRelationship();
             RelationshipTypeType relationshipTypeType = relationshipType.addNewType();
             XmlObject relationType = XmlObject.Factory.parse("<" + InteropConstants.RELATIONSHIP_RELATION.getPrefix() + ":" + InteropConstants.RELATIONSHIP_RELATION.getLocalPart() + " xmlns:" + InteropConstants.RELATIONSHIP_RELATION.getPrefix() + "=" + "\"" + InteropConstants.RELATIONSHIP_RELATION.getNamespaceURI() + "\" />");
             XmlBeanUtils.addChildElement(relationshipTypeType, relationType);
@@ -197,4 +196,5 @@
         }
         return relationshipType;
     }
+
 }

Modified: incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStationDir/WeatherStationDirService.java
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStationDir/WeatherStationDirService.java?rev=180563&r1=180562&r2=180563&view=diff
==============================================================================
--- incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStationDir/WeatherStationDirService.java (original)
+++ incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStationDir/WeatherStationDirService.java Mon Jun  6 13:36:52 2005
@@ -135,46 +135,27 @@
         }
 
         //add self as a participant
-        RelationshipParticipantType relationshipParticipantType = relationshipType.addNewParticipant();
+        RelationshipParticipantType parentRelationshipParticipantType = relationshipType.addNewParticipant();
         WeatherStationDirResource resource = (WeatherStationDirResource) getResource();
         XmlBeansEndpointReference xmlEpr = (XmlBeansEndpointReference) resource.getEndpointReference();
         EndpointReferenceType dirEndpointReferenceType = (EndpointReferenceType) xmlEpr.getXmlObject(AddressingConstants.NSURI_ADDRESSING_SCHEMA);
-        relationshipParticipantType.setResourceId(InteropConstants.DIR_RESOURCEID);
-        relationshipParticipantType.setRole("urn://parent");//uri
-        relationshipParticipantType.setManageabilityEndpointReferenceArray(new EndpointReferenceType[]{dirEndpointReferenceType});
+        parentRelationshipParticipantType.setResourceId(InteropConstants.DIR_RESOURCEID);
+        parentRelationshipParticipantType.setRole("urn://parent");//uri
+        parentRelationshipParticipantType.setManageabilityEndpointReferenceArray(new EndpointReferenceType[]{dirEndpointReferenceType});
 
 
         //add the new ws as the other participant
-        RelationshipParticipantType relationshipParticipantType2 = relationshipType.addNewParticipant();
-        //todo barties needs to fix communications
-        // relationshipParticipantType2.setResourceId(getResourceId(addedEpr));
-        relationshipParticipantType2.setResourceId(InteropConstants.WS1_KEY);
-        relationshipParticipantType2.setRole("urn://child");//uri
-        relationshipParticipantType.setManageabilityEndpointReferenceArray(new EndpointReferenceType[]{addedEpr});
+        RelationshipParticipantType childRelationshipParticipantType = relationshipType.addNewParticipant();
+        childRelationshipParticipantType.setResourceId(InteropRequestUtils.getResourceId(addedEpr));
+        childRelationshipParticipantType.setRole("urn://child");//uri
+        childRelationshipParticipantType.setManageabilityEndpointReferenceArray(new EndpointReferenceType[]{addedEpr});
 
         resourceProperty.add(relationshipDocument);
 
         return responseDocument;
     }
 
-    private String getResourceId(EndpointReferenceType endpointReferenceType)
-    {
-        GetResourcePropertyDocument getResourcePropertyDocument = GetResourcePropertyDocument.Factory.newInstance();
-        getResourcePropertyDocument.setGetResourceProperty(IdentityCapability.PROP_NAME_RESOURCE_ID);
-        XmlObject xmlObject = InteropRequestUtils.sendRequest(getResourcePropertyDocument, "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.wsdl/GetResourceProperty", new XmlBeansEndpointReference(endpointReferenceType));
-        if (xmlObject instanceof GetResourcePropertyResponseDocument)
-        {
-            GetResourcePropertyResponseDocument response = (GetResourcePropertyResponseDocument) xmlObject;
-            GetResourcePropertyResponseDocument.GetResourcePropertyResponse getResourcePropertyResponse = response.getGetResourcePropertyResponse();
-            XmlObject[] childElements = XmlBeanUtils.getChildElements(getResourcePropertyResponse);
-            String resourceid = ((org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart1.ResourceIdDocument) childElements[0]).getResourceId();
-            return resourceid;
-        }
-        else
-        {
-            return null;
-        }
-    }
+
 
 
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: muse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-dev-help@ws.apache.org