Author: scamp
Date: Fri Jun  3 13:44:32 2005
New Revision: 179884

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

Modified:
    incubator/muse/trunk/project.xml
    
incubator/muse/trunk/src/java/org/apache/ws/muws/v1_0/topics/impl/XmlBeansAdvertisementTopicImpl.java
    
incubator/muse/trunk/src/site/content/interop/src/test/org/apache/ws/muws/interop/client/WebServicesMgmtTestCase.java

Modified: incubator/muse/trunk/project.xml
URL: 
http://svn.apache.org/viewcvs/incubator/muse/trunk/project.xml?rev=179884&r1=179883&r2=179884&view=diff
==============================================================================
--- incubator/muse/trunk/project.xml (original)
+++ incubator/muse/trunk/project.xml Fri Jun  3 13:44:32 2005
@@ -11,7 +11,7 @@
   <id>muse-incubating</id>
   <name>Muse</name>
   <groupId>muse</groupId>
-  <currentVersion>1.0-beta</currentVersion>
+  <currentVersion>1.0-SNAPSHOT</currentVersion>
   <organization>
     <name>Apache Software Foundation</name>
     <url>http://www.apache.org/</url>
@@ -121,7 +121,7 @@
     <dependency>
       <groupId>apollo</groupId>
       <artifactId>apollo-incubating</artifactId>
-      <version>1.0-beta</version>    
+      <version>1.0-SNAPSHOT</version>    
       <url>http://incubator.apache.org/apollo/</url>
       <properties>
        <license>ApacheLicense-2.0.txt</license>
@@ -388,7 +388,7 @@
     <dependency> 
        <groupId>hermes</groupId>
        <artifactId>hermes-incubating</artifactId>
-       <version>1.0-beta</version>
+       <version>1.0-SNAPSHOT</version>
        <url>http://incubator.apache.org/hermes/</url>
        <properties>
            <license>ApacheLicense-2.0.txt</license>

Modified: 
incubator/muse/trunk/src/java/org/apache/ws/muws/v1_0/topics/impl/XmlBeansAdvertisementTopicImpl.java
URL: 
http://svn.apache.org/viewcvs/incubator/muse/trunk/src/java/org/apache/ws/muws/v1_0/topics/impl/XmlBeansAdvertisementTopicImpl.java?rev=179884&r1=179883&r2=179884&view=diff
==============================================================================
--- 
incubator/muse/trunk/src/java/org/apache/ws/muws/v1_0/topics/impl/XmlBeansAdvertisementTopicImpl.java
 (original)
+++ 
incubator/muse/trunk/src/java/org/apache/ws/muws/v1_0/topics/impl/XmlBeansAdvertisementTopicImpl.java
 Fri Jun  3 13:44:32 2005
@@ -7,15 +7,20 @@
 import org.apache.ws.addressing.XmlBeansEndpointReference;
 import org.apache.ws.muws.impl.CategoryImpl;
 import org.apache.ws.muws.v1_0.MuwsConstants;
+import org.apache.ws.muws.v1_0.capability.IdentityCapability;
 import org.apache.ws.muws.v1_0.events.Situation;
 import org.apache.ws.muws.v1_0.events.impl.SituationImpl;
 import org.apache.ws.muws.v1_0.events.impl.XmlBeansManagementEvent;
 import org.apache.ws.notification.topics.impl.TopicImpl;
+import org.apache.ws.resource.PropertiesResource;
+import org.apache.ws.resource.Resource;
 import org.apache.ws.resource.ResourceCreationEvent;
 import org.apache.ws.resource.ResourceCreationListener;
 import org.apache.ws.resource.ResourceDestructionEvent;
 import org.apache.ws.resource.ResourceDestructionListener;
+import org.apache.ws.resource.properties.ResourceProperty;
 import org.apache.ws.util.XmlBeanUtils;
+import org.apache.xmlbeans.XmlAnyURI;
 import org.apache.xmlbeans.XmlObject;
 import 
org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart1.ManagementEventDocument;
 import 
org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart1.ManagementEventType;
@@ -43,6 +48,29 @@
         super(topicName);
         setIsVisible(isVisible);
     }
+
+    /**
+     * Returns the Muws Identity ResourceProperty from the Resource or null if 
the prop doesn't exist
+     *
+     * @param resource
+     * @return Muws Identity ResourceProperty or null if prop doesn't exist
+     */
+    private ResourceProperty getIdentityProperty(Resource resource)
+    {
+        ResourceProperty identityProp = null;
+
+        if (resource instanceof PropertiesResource)
+        {
+            ResourceProperty resourceProperty = ((PropertiesResource) 
resource).getResourcePropertySet().get(IdentityCapability.PROP_NAME_RESOURCE_ID);
+            if (resourceProperty != null)
+            {
+                identityProp = resourceProperty;
+            }
+        }
+
+        return identityProp;
+    }
+
     /**
      * Handles the event when a creation occurs.  Builds a CreationNotification
      * and sends notif to subscribers
@@ -51,37 +79,44 @@
      */
     public void creationOccurred(ResourceCreationEvent event)
     {
-        CreationNotificationDocument creationNotifDoc = 
CreationNotificationDocument.Factory.newInstance();
-        CreationNotificationDocument.CreationNotification creationNotif = 
creationNotifDoc.addNewCreationNotification();
-        EndpointReference epr = event.getEndpointReference();
-        if (epr != null && epr instanceof XmlBeansEndpointReference)
+        Resource resource = event.getResource();
+
+        //determine if resource is a muws resource
+        ResourceProperty identityProperty = getIdentityProperty(resource);
+        if (identityProperty != null)
         {
-            XmlBeansEndpointReference xBeansEPR = (XmlBeansEndpointReference) 
epr;
-            XmlObject xBean = 
xBeansEPR.getXmlObject(org.apache.ws.addressing.v2004_08_10.AddressingConstants.NSURI_ADDRESSING_SCHEMA);
-            if (xBean instanceof EndpointReferenceType)
+            CreationNotificationDocument creationNotifDoc = 
CreationNotificationDocument.Factory.newInstance();
+            CreationNotificationDocument.CreationNotification creationNotif = 
creationNotifDoc.addNewCreationNotification();
+            EndpointReference epr = resource.getEndpointReference();
+            if (epr != null && epr instanceof XmlBeansEndpointReference)
             {
-                creationNotif.setManageabilityEndpointReferenceArray(new 
EndpointReferenceType[]{(EndpointReferenceType) xBean});
-                try
+                XmlBeansEndpointReference xBeansEPR = 
(XmlBeansEndpointReference) epr;
+                XmlObject xBean = 
xBeansEPR.getXmlObject(org.apache.ws.addressing.v2004_08_10.AddressingConstants.NSURI_ADDRESSING_SCHEMA);
+                if (xBean instanceof EndpointReferenceType)
                 {
-                    publish(buildManagementEvent(creationNotifDoc));
-                }
-                catch (Exception e)
-                {
-                    if (LOG.isDebugEnabled())
+                    creationNotif.setManageabilityEndpointReferenceArray(new 
EndpointReferenceType[]{(EndpointReferenceType) xBean});
+                    try
+                    {
+                        publish(buildManagementEvent(creationNotifDoc));
+                    }
+                    catch (Exception e)
                     {
-                        LOG.debug("Publishing of the notification: " + 
creationNotifDoc + " failed.", e);
+                        if (LOG.isDebugEnabled())
+                        {
+                            LOG.debug("Publishing of the notification: " + 
creationNotifDoc + " failed.", e);
+                        }
                     }
                 }
+                else
+                {
+                    LOG.debug("EPR did not contain an instance of: " + 
EndpointReferenceType.class.getName() + " but rather it was: " + 
xBean.getClass().getName());
+                }
             }
             else
             {
-                LOG.debug("EPR did not contain an instance of: " + 
EndpointReferenceType.class.getName() + " but rather it was: " + 
xBean.getClass().getName());
+                LOG.debug("The EndpointReference was either null or it was not 
an instance of XmlObjectWrapper.  EPR: " + epr);
             }
         }
-        else
-        {
-            LOG.debug("The EndpointReference was either null or it was not an 
instance of XmlObjectWrapper.  EPR: " + epr);
-        }
     }
 
     /**
@@ -92,27 +127,36 @@
      */
     public void destructionOccurred(ResourceDestructionEvent event)
     {
-        Object resourceID = event.getResourceID();
-        if (resourceID == null)
+        Resource resource = event.getResource();
+        ResourceProperty identityProperty = getIdentityProperty(resource);
+        if (identityProperty != null)
         {
-            resourceID = "ResourceID Unknown.  May be singleton.";
-        }
+            XmlAnyURI id = (XmlAnyURI) identityProperty.get(0);
+            String resourceID = null;
+            if (id == null)
+            {
+                resourceID = "ResourceID Unknown.  May be singleton.";
+            }
+            else
+            {
+                resourceID = id.toString();
+            }
 
-        DestructionNotificationDocument destructionNotifDoc = 
DestructionNotificationDocument.Factory.newInstance();
-        DestructionNotificationDocument.DestructionNotification 
destructionNotif = destructionNotifDoc.addNewDestructionNotification();
-        destructionNotif.setResourceId((String) resourceID);
-        try
-        {
-            publish(buildManagementEvent(destructionNotifDoc));
-        }
-        catch (Exception e)
-        {
-            if (LOG.isDebugEnabled())
+            DestructionNotificationDocument destructionNotifDoc = 
DestructionNotificationDocument.Factory.newInstance();
+            DestructionNotificationDocument.DestructionNotification 
destructionNotif = destructionNotifDoc.addNewDestructionNotification();
+            destructionNotif.setResourceId((String) resourceID);
+            try
             {
-                LOG.debug("Publishing of the notification: " + 
destructionNotifDoc + " failed.", e);
+                publish(buildManagementEvent(destructionNotifDoc));
+            }
+            catch (Exception e)
+            {
+                if (LOG.isDebugEnabled())
+                {
+                    LOG.debug("Publishing of the notification: " + 
destructionNotifDoc + " failed.", e);
+                }
             }
         }
-
     }
 
     /**

Modified: 
incubator/muse/trunk/src/site/content/interop/src/test/org/apache/ws/muws/interop/client/WebServicesMgmtTestCase.java
URL: 
http://svn.apache.org/viewcvs/incubator/muse/trunk/src/site/content/interop/src/test/org/apache/ws/muws/interop/client/WebServicesMgmtTestCase.java?rev=179884&r1=179883&r2=179884&view=diff
==============================================================================
--- 
incubator/muse/trunk/src/site/content/interop/src/test/org/apache/ws/muws/interop/client/WebServicesMgmtTestCase.java
 (original)
+++ 
incubator/muse/trunk/src/site/content/interop/src/test/org/apache/ws/muws/interop/client/WebServicesMgmtTestCase.java
 Fri Jun  3 13:44:32 2005
@@ -31,9 +31,9 @@
 import org.apache.xmlbeans.XmlDateTime;
 import org.apache.xmlbeans.XmlException;
 import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlOptions;
 import org.apache.xmlbeans.XmlQName;
 import org.apache.xmlbeans.XmlString;
-import org.apache.xmlbeans.XmlOptions;
 import 
org.everestWeather.wsdm.samples.x2005.x04.schema.WeatherstationPropertyQNames;
 import org.everestWeather.wsdm.samples.x2005.x04.schema.WeatherstationResource;
 import org.oasisOpen.docs.wsdm.x2004.x12.mows.wsdmMows.DurationMetric;



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

Reply via email to