Author: scamp
Date: Tue May 31 13:07:22 2005
New Revision: 179268

URL: http://svn.apache.org/viewcvs?rev=179268&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/weatherStation/WeatherStationHome.java
    
incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStation/WeatherStationService.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=179268&r1=179267&r2=179268&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
 Tue May 31 13:07:22 2005
@@ -12,6 +12,16 @@
     /** Resource Keys for the Weather Stations **/
     String WS1_KEY = "weather-station-1";
     String WS2_KEY = "weather-station-2";
+    /** default relationship **/
     QName RELATIONSHIP_RELATION = new 
QName(WeatherStationDirHome.SERVICE_NAME.getNamespaceURI(), "contains", 
"wsdir");
+
+    /** Directory service Muws ResourceID **/
     String DIR_RESOURCEID = "urn:SINGLETON";
+
+    /** Directory Service Location **/
+    String DIR_SERVICE_ADDRESS = 
System.getProperty("DIRECTORY_SERVICE","http://localhost:8080/muse/services/WeatherStationDir";);
+
+    /** BASE SERVICE ADDRESS **/
+    String BASE_ADDRESS = 
System.getProperty("BASE_ADDRESS","http://localhost:8080/muse/services/WeatherStationDir";);
+
 }

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=179268&r1=179267&r2=179268&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
 Tue May 31 13:07:22 2005
@@ -101,7 +101,7 @@
         }
     }
 
-    public static XmlObject sendRequest(RemoveWeatherStationDocument 
requestDoc, String action, String address)
+    public static XmlObject sendRequest(XmlObject requestDoc, String action, 
String address)
     {
         EnvelopeDocument requestEnvelopeDoc = createEnvelope();
         Envelope requestEnvelope = requestEnvelopeDoc.getEnvelope();

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=179268&r1=179267&r2=179268&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
 Tue May 31 13:07:22 2005
@@ -1,6 +1,8 @@
 package org.wsdmdemo.service.weatherStation;
 
 import org.apache.ws.addressing.EndpointReference;
+import org.apache.ws.addressing.XmlBeansEndpointReference;
+import org.apache.ws.addressing.v2004_08_10.AddressingConstants;
 import org.apache.ws.resource.Resource;
 import org.apache.ws.resource.ResourceContext;
 import org.apache.ws.resource.ResourceContextException;
@@ -9,7 +11,10 @@
 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;
+import org.wsdmdemo.service.weatherStationDir.AddWeatherStationDocument;
 
 import javax.xml.namespace.QName;
 import java.io.Serializable;
@@ -59,25 +64,37 @@
     {
         try
         {
-            //bootstrap the weather stations  todo not sure we need this
+            //bootstrap the weather stations  todo not sure we need to do this
             SimpleTypeResourceKey ws1Key = new 
SimpleTypeResourceKey(RESOURCE_KEY_NAME, InteropConstants.WS1_KEY);
             WeatherStationResource ws1 = (WeatherStationResource) 
createInstance(ws1Key);
             SimpleTypeResourceKey ws2Key = new 
SimpleTypeResourceKey(RESOURCE_KEY_NAME, InteropConstants.WS2_KEY);
             WeatherStationResource ws2 = (WeatherStationResource) 
createInstance(ws2Key);
 
             //todo how to get resource ctx in constructor for base url..may 
not be possible
-            EndpointReference ws1Epr = 
getEndpointReference("http://localhost:8080/muse/services"; + "/" + 
getServiceName().getLocalPart(), ws1Key, 
SPEC_NAMESPACE_SET.getAddressingNamespace());
+            EndpointReference ws1Epr = 
getEndpointReference(InteropConstants.BASE_ADDRESS + "/" + 
getServiceName().getLocalPart(), ws1Key, 
SPEC_NAMESPACE_SET.getAddressingNamespace());
             ws1.setEndpointReference(ws1Epr);
             add(ws1Key, ws1);
 
-            EndpointReference ws2Epr = 
getEndpointReference("http://localhost:8080/muse/services"; + "/" + 
getServiceName().getLocalPart(), ws2Key, 
SPEC_NAMESPACE_SET.getAddressingNamespace());
+            EndpointReference ws2Epr = 
getEndpointReference(InteropConstants.BASE_ADDRESS + "/" + 
getServiceName().getLocalPart(), ws2Key, 
SPEC_NAMESPACE_SET.getAddressingNamespace());
             ws2.setEndpointReference(ws2Epr);
             add(ws2Key, ws2);
+
+            //register with the directory service
+            registerWeatherStation(ws1Epr);
+            registerWeatherStation(ws2Epr);
         }
         catch (ResourceException e)
         {
-            e.printStackTrace();//todo not this!
+            e.printStackTrace();
         }
+    }
+
+    private void registerWeatherStation(EndpointReference epr)
+    {
+        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.DIR_SERVICE_ADDRESS);
     }
 
     /**

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=179268&r1=179267&r2=179268&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
 Tue May 31 13:07:22 2005
@@ -14,6 +14,7 @@
 import org.wsdmdemo.service.weatherStationDir.RemoveWeatherStationDocument;
 import org.wsdmdemo.service.weatherStationDir.WeatherStationDirHome;
 import org.wsdmdemo.service.InteropRequestUtils;
+import org.wsdmdemo.service.InteropConstants;
 
 /**
  * **** NOTE: This file will not be overwritten during generation ****
@@ -80,8 +81,7 @@
         removeWeatherStation.setResourceId(id);
 
         //need to send request.
-        String address = getResourceContext().getBaseURL() + "/" + 
WeatherStationDirHome.SERVICE_NAME.getLocalPart();
-        XmlObject xmlObject = 
InteropRequestUtils.sendRequest(removeWeatherStationDocument,"Remove", address);
+        XmlObject xmlObject = 
InteropRequestUtils.sendRequest(removeWeatherStationDocument,"http://wsdmdemo.org/service/weather-station-dir/RemoveWeatherStation";,
 InteropConstants.DIR_SERVICE_ADDRESS);
 
         try
         {



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to