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 23:35:22 UTC

svn commit: r185046 - in /incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service: ./ weatherClientConfig/ weatherStation/ weatherStationDir/

Author: scamp
Date: Mon Jun  6 14:35:21 2005
New Revision: 185046

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

Modified:
    incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/InteropConstants.java
    incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/InteropRequestUtils.java
    incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherClientConfig/AbstractWeatherClientConfigService.java
    incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherClientConfig/WeatherClientConfigResource.java
    incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStation/WeatherStationResource.java
    incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStation/WeatherStationService.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/InteropConstants.java
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/InteropConstants.java?rev=185046&r1=185045&r2=185046&view=diff
==============================================================================
--- incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/InteropConstants.java (original)
+++ incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/InteropConstants.java Mon Jun  6 14:35:21 2005
@@ -11,6 +11,17 @@
  */
 public interface InteropConstants
 {
+
+    /**
+     * Sysprops for config params
+     */
+    String SYSPROP_WS1_EPR_URL = "WS1_EPR_URL";
+    String SYSPROP_WS_DIR_SERVICE_URL = "WS_DIR_SERVICE_URL";
+    String SYSPROP_WS_CLIENT_CONFIG_EPR_URL = "WS_CLIENT_CONFIG_EPR_URL";
+    String SYSPROP_WS2_EPR_URL = "WS2_EPR_URL";
+    String SYSPROP_BASE_ADDRESS = "BASE_ADDRESS";
+    String SYSPROP_REFRESH_INTERVAL = "REFRESH";
+
     /**
      * Resource Keys for the Weather Stations *
      */
@@ -21,16 +32,14 @@
      * default relationship *
      */
     QName RELATIONSHIP_RELATION = new QName(WeatherStationDirHome.SERVICE_NAME.getNamespaceURI(), "Contains", "wsdir");
+    String PARENT_RELATION = "urn://parent";
+    String CHILD_RELATION = "urn://child";
 
     /**
      * Directory service Muws ResourceID *
      */
     String DIR_RESOURCEID = "urn:SINGLETON";
 
-    /**
-     * BASE SERVICE ADDRESS *
-     */
-    String BASE_ADDRESS = System.getProperty("BASE_ADDRESS", "http://localhost:8080/muse/services");
 
     /**
      * Min/Max Values
@@ -48,14 +57,14 @@
     double DEFAULT_HUMIDITY = 65.0;
     double DEFAULT_TEMP = 69.0;
     double DEFAULT_VISIBILITY = 10.09;
+    double PRICE = 99.99;
+    String OWNER = "Weather.com";
 
     /**
-     * Sysprops for config params
+     * Refresh Interval for retrieving data...initially 20 seconds.
      */
-    String SYSPROP_WS1_EPR_URL = "WS1_EPR_URL";
-    String SYSPROP_WS_DIR_SERVICE_URL = "WS_DIR_SERVICE_URL";
-    String SYSPROP_WS_CLIENT_CONFIG_EPR_URL = "WS_CLIENT_CONFIG_EPR_URL";
-    String SYSPROP_WS2_EPR_URL = "WS2_EPR_URL";
+    int INITIAL_REFRESH = Integer.parseInt(System.getProperty(SYSPROP_REFRESH_INTERVAL, "10"));
+
 
     /**
      * EPR URLS
@@ -70,7 +79,9 @@
     //String WEATHER_STATION_DIR_SERVICE_URL = System.getProperty(InteropConstants.SYSPROP_WS_DIR_SERVICE_URL, "http://localhost:8080/muse/services/WeatherStationDir");
 
     /**
-     * Refresh Interval for retrieving data...initially 20 seconds.
+     * BASE SERVICE ADDRESS *
      */
-    int INITIAL_REFRESH = 10;
+    String BASE_ADDRESS = System.getProperty(SYSPROP_BASE_ADDRESS, "http://localhost:8080/muse/services");
+
+
 }

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=185046&r1=185045&r2=185046&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 14:35:21 2005
@@ -2,20 +2,23 @@
 
 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.muws.v1_0.capability.IdentityCapability;
 import org.apache.ws.util.XmlBeanUtils;
 import org.apache.ws.util.soap.SoapClient;
+import org.apache.xmlbeans.XmlException;
 import org.apache.xmlbeans.XmlObject;
 import org.apache.xmlbeans.impl.values.XmlAnyUriImpl;
+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.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;
@@ -153,27 +156,43 @@
         XmlBeanUtils.addChildElement(header, actionElem);
     }
 
-    public static EndpointReferenceDocument getEndpointReference( URL url ) throws Exception
+    public static EndpointReferenceDocument getEndpointReference(URL url) throws Exception
     {
-        return (EndpointReferenceDocument) XmlObject.Factory.parse( url );
+        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;
-         }
-     }
+    {
+        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;
+        }
+    }
+
+    public static RelationshipType createRelationshipType(RelationshipType relationshipType)
+    {
+        try
+        {
+            //define the relationship type
+            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);
+        }
+        catch (XmlException e)
+        {
+            e.printStackTrace();
+        }
+        return relationshipType;
+    }
 }

Modified: incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherClientConfig/AbstractWeatherClientConfigService.java
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherClientConfig/AbstractWeatherClientConfigService.java?rev=185046&r1=185045&r2=185046&view=diff
==============================================================================
--- incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherClientConfig/AbstractWeatherClientConfigService.java (original)
+++ incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherClientConfig/AbstractWeatherClientConfigService.java Mon Jun  6 14:35:21 2005
@@ -16,7 +16,7 @@
  * NOTE: This class is generated and is NOT meant to be modified.
  */
 public abstract class AbstractWeatherClientConfigService extends AbstractPortType
-        implements org.apache.ws.resource.handler.WsrfService, 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.notification.base.v2004_06.porttype.NotificationProducerPortType , org.apache.ws.muws.v1_0.capability.RelationshipsCapability
+        implements org.apache.ws.resource.handler.WsrfService, 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.notification.base.v2004_06.porttype.NotificationProducerPortType, org.apache.ws.muws.v1_0.capability.RelationshipsCapability
 {
 
     public static final String TARGET_NSURI = "http://wsdmdemo.org/service/weather-client-config";
@@ -139,9 +139,9 @@
         return new org.apache.ws.notification.base.v2004_06.porttype.impl.NotificationProducerPortTypeImpl(getResourceContext()).getCurrentMessage(requestDoc);
     }
 
-    public org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.QueryRelationshipsByTypeResponseDocument queryRelationshipsByType( org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.QueryRelationshipsByTypeDocument 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 );
+        return new org.apache.ws.muws.v1_0.capability.impl.RelationshipsCapabilityImpl(getResourceContext()).queryRelationshipsByType(requestDoc);
     }
 
 }

Modified: incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherClientConfig/WeatherClientConfigResource.java
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherClientConfig/WeatherClientConfigResource.java?rev=185046&r1=185045&r2=185046&view=diff
==============================================================================
--- incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherClientConfig/WeatherClientConfigResource.java (original)
+++ incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherClientConfig/WeatherClientConfigResource.java Mon Jun  6 14:35:21 2005
@@ -1,5 +1,6 @@
 package org.wsdmdemo.service.weatherClientConfig;
 
+import org.apache.ws.Soap1_1Constants;
 import org.apache.ws.addressing.XmlBeansEndpointReference;
 import org.apache.ws.addressing.v2004_08_10.AddressingConstants;
 import org.apache.ws.muws.v1_0.MuwsConstants;
@@ -13,6 +14,7 @@
 import org.apache.ws.notification.topics.impl.TopicSpaceImpl;
 import org.apache.ws.resource.PropertiesResource;
 import org.apache.ws.resource.ResourceException;
+import org.apache.ws.resource.faults.FaultException;
 import org.apache.ws.resource.properties.ResourceProperty;
 import org.apache.ws.resource.properties.ResourcePropertySet;
 import org.apache.ws.resource.properties.SetResourcePropertyCallback;
@@ -170,7 +172,7 @@
         }
         catch (Exception e)
         {
-            throw new javax.xml.rpc.JAXRPCException("Unable to init the ResourceProperty Changed topics. Cause: " + e.getLocalizedMessage(), e);
+            throw new FaultException(Soap1_1Constants.FAULT_SERVER, "Unable to init the ResourceProperty Changed topics. Cause: " + e.getLocalizedMessage());
         }
 
         /**
@@ -219,54 +221,53 @@
      */
     public void insertProperty(Object[] propElems) throws CallbackFailedException
     {
-         if(propElems.length == 1)
-         {
-              //get the request epr
-             EndpointReferenceType weatherStationEpr = (EndpointReferenceType) propElems[0];
-             ResourcePropertySet resourcePropertySet = ((PropertiesResource) this).getResourcePropertySet();
-             ResourceProperty resourceProperty = resourcePropertySet.get(WeatherClientConfigPropertyQNames.RELATIONSHIP);
-
-             //define a relationship
-             RelationshipDocument relationshipDocument = RelationshipDocument.Factory.newInstance();
-             RelationshipType relationshipType = relationshipDocument.addNewRelationship();
-
-             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);
-             }
-             catch (XmlException e)
-             {
-                 e.printStackTrace();
-             }
-
-             //add self as a participant
-             RelationshipParticipantType relationshipParticipantType = relationshipType.addNewParticipant();
-             XmlBeansEndpointReference xmlEpr = (XmlBeansEndpointReference) this.getEndpointReference();
-             EndpointReferenceType configEndpointReferenceType = (EndpointReferenceType) xmlEpr.getXmlObject(AddressingConstants.NSURI_ADDRESSING_SCHEMA);
-             relationshipParticipantType.setResourceId("urn:" + getID());
-             relationshipParticipantType.setRole("urn://parent");//uri
-             relationshipParticipantType.setManageabilityEndpointReferenceArray(new EndpointReferenceType[]{configEndpointReferenceType});
-
-
-             //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[]{weatherStationEpr});
+        if (propElems.length == 1)
+        {
+            //get the request epr
+            EndpointReferenceType weatherStationEpr = (EndpointReferenceType) propElems[0];
+            ResourcePropertySet resourcePropertySet = ((PropertiesResource) this).getResourcePropertySet();
+            ResourceProperty resourceProperty = resourcePropertySet.get(WeatherClientConfigPropertyQNames.RELATIONSHIP);
+
+            //define a relationship
+            RelationshipDocument relationshipDocument = RelationshipDocument.Factory.newInstance();
+            RelationshipType relationshipType = relationshipDocument.addNewRelationship();
+
+            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);
+            }
+            catch (XmlException e)
+            {
+                e.printStackTrace();
+            }
+
+            //add self as a participant
+            RelationshipParticipantType parentRelationshipParticipantType = relationshipType.addNewParticipant();
+            XmlBeansEndpointReference xmlEpr = (XmlBeansEndpointReference) this.getEndpointReference();
+            EndpointReferenceType configEndpointReferenceType = (EndpointReferenceType) xmlEpr.getXmlObject(AddressingConstants.NSURI_ADDRESSING_SCHEMA);
+            parentRelationshipParticipantType.setResourceId("urn:" + getID());
+            parentRelationshipParticipantType.setRole(InteropConstants.PARENT_RELATION);//uri
+            parentRelationshipParticipantType.setManageabilityEndpointReferenceArray(new EndpointReferenceType[]{configEndpointReferenceType});
+
+
+            //add the new ws as the other participant
+            RelationshipParticipantType childRelationshipParticipantType = relationshipType.addNewParticipant();
+            childRelationshipParticipantType.setResourceId(InteropRequestUtils.getResourceId(weatherStationEpr));
+            childRelationshipParticipantType.setResourceId(InteropConstants.WS1_KEY);
+            childRelationshipParticipantType.setRole(InteropConstants.CHILD_RELATION);//uri
+            childRelationshipParticipantType.setManageabilityEndpointReferenceArray(new EndpointReferenceType[]{weatherStationEpr});
 
-             resourceProperty.add(relationshipDocument);
+            resourceProperty.add(relationshipDocument);
 
-         }
+        }
         else
-         {
-             throw new CallbackFailedException("There was more than one reference passed!");
-         }
+        {
+            throw new CallbackFailedException("There was more than one reference passed!");
+        }
     }
 
     /**
@@ -278,7 +279,7 @@
      */
     public void updateProperty(Object[] propElems) throws CallbackFailedException
     {
-         insertProperty(propElems);
+        insertProperty(propElems);
     }
 
     /**

Modified: incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStation/WeatherStationResource.java
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStation/WeatherStationResource.java?rev=185046&r1=185045&r2=185046&view=diff
==============================================================================
--- incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStation/WeatherStationResource.java (original)
+++ incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStation/WeatherStationResource.java Mon Jun  6 14:35:21 2005
@@ -1,5 +1,6 @@
 package org.wsdmdemo.service.weatherStation;
 
+import org.apache.ws.Soap1_1Constants;
 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;
@@ -8,6 +9,7 @@
 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.resource.faults.FaultException;
 import org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.OperationalStatusDocument;
 import org.wsdmdemo.service.InteropConstants;
 import org.wsdmdemo.service.weatherStation.callbacks.HumidityCallback;
@@ -27,13 +29,10 @@
 public class WeatherStationResource extends AbstractWeatherStationResource
 
 {
-
     /**
      * 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();
-    private static final double PRICE = 99.99;
-    private static final String OWNER = "Weather.com";
 
     /**
      * Initializes this resource's state (properties, etc.).
@@ -129,7 +128,7 @@
             // init the {http://wsdmdemo.org/service/weather-station}Price Resource Property
             resourceProperty = resourcePropertySet.get(WeatherStationPropertyQNames.PRICE);
             org.wsdmdemo.service.weatherStation.PriceDocument prop_price = org.wsdmdemo.service.weatherStation.PriceDocument.Factory.newInstance();
-            prop_price.setPrice(PRICE);
+            prop_price.setPrice(InteropConstants.PRICE);
             resourceProperty.add(prop_price);
 
 
@@ -150,14 +149,14 @@
             // init the {http://wsdmdemo.org/service/weather-station}Owner Resource Property
             resourceProperty = resourcePropertySet.get(WeatherStationPropertyQNames.OWNER);
             org.wsdmdemo.service.weatherStation.OwnerDocument prop_owner = org.wsdmdemo.service.weatherStation.OwnerDocument.Factory.newInstance();
-            prop_owner.setOwner(OWNER);
+            prop_owner.setOwner(InteropConstants.OWNER);
             resourceProperty.add(prop_owner);
             /** END RESOURCE PROPERTIES **/
 
         }
         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());
+            throw new FaultException(Soap1_1Constants.FAULT_SERVER, "There was a problem in initializing resource properties.  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.

Modified: incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStation/WeatherStationService.java
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStation/WeatherStationService.java?rev=185046&r1=185045&r2=185046&view=diff
==============================================================================
--- incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStation/WeatherStationService.java (original)
+++ incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStation/WeatherStationService.java Mon Jun  6 14:35:21 2005
@@ -29,11 +29,6 @@
     public static final org.apache.ws.muws.v1_0.impl.WsdmNamespaceVersionHolderImpl SPEC_NAMESPACE_SET = new org.apache.ws.muws.v1_0.impl.WsdmNamespaceVersionHolderImpl();
 
     /**
-     * Time in millliseconds the service will pause before changing resource status to unavailable
-     */
-    private static final long RECONFIGURATION_PAUSE = 60000;
-
-    /**
      * Creates a new {@link WeatherStationService } object.
      *
      * @param resourceContext DOCUMENT_ME
@@ -60,30 +55,6 @@
     {
         org.wsdmdemo.service.weatherStation.RecalibrateResponseDocument responseDocument = org.wsdmdemo.service.weatherStation.RecalibrateResponseDocument.Factory.newInstance();
         org.wsdmdemo.service.weatherStation.RecalibrateResponseDocument.RecalibrateResponse response = responseDocument.addNewRecalibrateResponse();
-
-        //set status to partially unavailable
-        //changeOperationalStatus(OperationalStatusDocument.OperationalStatus.PARTIALLY_AVAILABLE);
-
-        //remove service from dir
-        //ResourceProperty resourceProperty = ((PropertiesResource)getResource()).getResourcePropertySet().get(WeatherStationPropertyQNames.RESOURCEID);
-        //org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart1.ResourceIdDocument prop_name = (org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart1.ResourceIdDocument) resourceProperty.get(0);
-        //String id = prop_name.getResourceId();
-        //RemoveWeatherStationDocument removeWeatherStationDocument = RemoveWeatherStationDocument.Factory.newInstance();
-        //org.wsdmdemo.service.weatherStationDir.RemoveWeatherStationDocument.RemoveWeatherStation removeWeatherStation = removeWeatherStationDocument.addNewRemoveWeatherStation();
-        //removeWeatherStation.setResourceId(id);
-
-        //need to send request.
-        //XmlObject xmlObject = InteropRequestUtils.sendRequest(removeWeatherStationDocument,"http://wsdmdemo.org/service/weather-station-dir/RemoveWeatherStation", InteropConstants.DIR_SERVICE_ADDRESS);
-
-        /*try
-        {
-            wait(RECONFIGURATION_PAUSE);
-        }
-        catch (InterruptedException e)
-        {
-            ;
-        }*/
-
         //set status to unavailable
         changeOperationalStatus(OperationalStatusDocument.OperationalStatus.UNAVAILABLE);
         //todo spawn thread with timer to reset the op status to avail
@@ -97,7 +68,6 @@
      */
     private void changeOperationalStatus(OperationalStatusDocument.OperationalStatus.Enum status)
     {
-        //todo is there another way? ..without manually creating event?
         SetResourcePropertiesPortTypeImpl setResourcePropertiesPortType = new SetResourcePropertiesPortTypeImpl(getResourceContext());
         SetResourcePropertiesDocument setResourcePropertiesDocument = SetResourcePropertiesDocument.Factory.newInstance();
         SetResourcePropertiesDocument.SetResourceProperties setResourceProperties = setResourcePropertiesDocument.addNewSetResourceProperties();

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=185046&r1=185045&r2=185046&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 14:35:21 2005
@@ -11,13 +11,9 @@
 import org.apache.ws.notification.topics.TopicSpace;
 import org.apache.ws.notification.topics.impl.TopicSpaceImpl;
 import org.apache.ws.resource.properties.ResourceProperty;
-import org.apache.ws.util.XmlBeanUtils;
-import org.apache.xmlbeans.XmlException;
-import org.apache.xmlbeans.XmlObject;
 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.wsdmdemo.service.InteropConstants;
 import org.wsdmdemo.service.InteropRequestUtils;
 import org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceType;
@@ -145,8 +141,8 @@
     {
         org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceType ws1Epr = InteropRequestUtils.getEndpointReference(new URL(InteropConstants.WEATHER_STATION_1_EPR_URL)).getEndpointReference();
         org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceType ws2Epr = InteropRequestUtils.getEndpointReference(new URL(InteropConstants.WEATHER_STATION_2_EPR_URL)).getEndpointReference();
-        addRelation(resourceProperty,ws1Epr);
-        addRelation(resourceProperty,ws2Epr);
+        addRelation(resourceProperty, ws1Epr);
+        addRelation(resourceProperty, ws2Epr);
     }
 
     /**
@@ -159,40 +155,24 @@
     {
         //define a relationship
         RelationshipDocument relationshipDocument = RelationshipDocument.Factory.newInstance();
-        RelationshipType  relationshipType = createRelationshipType(relationshipDocument.addNewRelationship());
+        RelationshipType relationshipType = InteropRequestUtils.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(InteropConstants.DIR_RESOURCEID);
-        parentRelationshipParticipantType.setRole("urn://parent");//uri
+        parentRelationshipParticipantType.setRole(InteropConstants.PARENT_RELATION);//uri
         parentRelationshipParticipantType.setManageabilityEndpointReferenceArray(new EndpointReferenceType[]{dirEndpointReferenceType});
 
 
         //add the new ws as the other participant
         RelationshipParticipantType childRelationshipParticipantType = relationshipType.addNewParticipant();
         childRelationshipParticipantType.setResourceId(InteropRequestUtils.getResourceId(childEpr));
-        childRelationshipParticipantType.setRole("urn://child");//uri
+        childRelationshipParticipantType.setRole(InteropConstants.CHILD_RELATION);//uri
         childRelationshipParticipantType.setManageabilityEndpointReferenceArray(new EndpointReferenceType[]{childEpr});
 
         resourceProperty.add(relationshipDocument);
-    }
-
-    private RelationshipType createRelationshipType(RelationshipType relationshipType)
-    {
-        try
-        {
-            //define the relationship type
-            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);
-        }
-        catch (XmlException e)
-        {
-            e.printStackTrace();
-        }
-        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=185046&r1=185045&r2=185046&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 14:35:21 2005
@@ -6,13 +6,9 @@
 import org.apache.ws.resource.ResourceContext;
 import org.apache.ws.resource.properties.ResourceProperty;
 import org.apache.ws.resource.properties.ResourcePropertySet;
-import org.apache.ws.util.XmlBeanUtils;
-import org.apache.xmlbeans.XmlException;
-import org.apache.xmlbeans.XmlObject;
 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.wsdmdemo.service.InteropConstants;
 import org.wsdmdemo.service.InteropRequestUtils;
 import org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceType;
@@ -118,18 +114,11 @@
         RelationshipDocument relationshipDocument = RelationshipDocument.Factory.newInstance();
         RelationshipType relationshipType = relationshipDocument.addNewRelationship();
 
-        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);
-        }
-        catch (XmlException e)
-        {
-            e.printStackTrace();
-        }
+
+        //define the relationship type
+        relationshipType = relationshipDocument.addNewRelationship();
+        InteropRequestUtils.createRelationshipType(relationshipType);
+
 
         //add self as a participant
         RelationshipParticipantType parentRelationshipParticipantType = relationshipType.addNewParticipant();
@@ -137,22 +126,20 @@
         XmlBeansEndpointReference xmlEpr = (XmlBeansEndpointReference) resource.getEndpointReference();
         EndpointReferenceType dirEndpointReferenceType = (EndpointReferenceType) xmlEpr.getXmlObject(AddressingConstants.NSURI_ADDRESSING_SCHEMA);
         parentRelationshipParticipantType.setResourceId(InteropConstants.DIR_RESOURCEID);
-        parentRelationshipParticipantType.setRole("urn://parent");//uri
+        parentRelationshipParticipantType.setRole(InteropConstants.PARENT_RELATION);//uri
         parentRelationshipParticipantType.setManageabilityEndpointReferenceArray(new EndpointReferenceType[]{dirEndpointReferenceType});
 
 
         //add the new ws as the other participant
         RelationshipParticipantType childRelationshipParticipantType = relationshipType.addNewParticipant();
         childRelationshipParticipantType.setResourceId(InteropRequestUtils.getResourceId(addedEpr));
-        childRelationshipParticipantType.setRole("urn://child");//uri
+        childRelationshipParticipantType.setRole(InteropConstants.CHILD_RELATION);//uri
         childRelationshipParticipantType.setManageabilityEndpointReferenceArray(new EndpointReferenceType[]{addedEpr});
 
         resourceProperty.add(relationshipDocument);
 
         return responseDocument;
     }
-
-
 
 
 }



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