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/01 16:47:35 UTC

svn commit: r179381 - /incubator/muse/trunk/src/java/org/apache/ws/muws/v1_0/topics/impl/XmlBeansAdvertisementTopicImpl.java

Author: scamp
Date: Wed Jun  1 07:47:34 2005
New Revision: 179381

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

Modified:
    incubator/muse/trunk/src/java/org/apache/ws/muws/v1_0/topics/impl/XmlBeansAdvertisementTopicImpl.java

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=179381&r1=179380&r2=179381&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 Wed Jun  1 07:47:34 2005
@@ -31,11 +31,11 @@
 public class XmlBeansAdvertisementTopicImpl extends TopicImpl implements ResourceCreationListener, ResourceDestructionListener
 {
 
-    private static final Log LOG = LogFactory.getLog( XmlBeansAdvertisementTopicImpl.class );
+    private static final Log LOG = LogFactory.getLog(XmlBeansAdvertisementTopicImpl.class);
 
-    public XmlBeansAdvertisementTopicImpl( String topicName )
+    public XmlBeansAdvertisementTopicImpl(String topicName)
     {
-        super( topicName );
+        super(topicName);
     }
 
     /**
@@ -44,38 +44,38 @@
      *
      * @param event
      */
-    public void creationOccurred( ResourceCreationEvent event )
+    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 )
+        if (epr != null && epr instanceof XmlBeansEndpointReference)
         {
             XmlBeansEndpointReference xBeansEPR = (XmlBeansEndpointReference) epr;
-            XmlObject xBean = xBeansEPR.getXmlObject( org.apache.ws.addressing.v2004_08_10.AddressingConstants.NSURI_ADDRESSING_SCHEMA );
-            if ( xBean instanceof EndpointReferenceType )
+            XmlObject xBean = xBeansEPR.getXmlObject(org.apache.ws.addressing.v2004_08_10.AddressingConstants.NSURI_ADDRESSING_SCHEMA);
+            if (xBean instanceof EndpointReferenceType)
             {
-                creationNotif.setManageabilityEndpointReferenceArray( new EndpointReferenceType[]{(EndpointReferenceType) xBean} );
+                creationNotif.setManageabilityEndpointReferenceArray(new EndpointReferenceType[]{(EndpointReferenceType) xBean});
                 try
                 {
-                    publish( buildManagementEvent( creationNotifDoc ) );
+                    publish(buildManagementEvent(creationNotifDoc));
                 }
-                catch ( Exception e )
+                catch (Exception e)
                 {
-                    if ( LOG.isDebugEnabled() )
+                    if (LOG.isDebugEnabled())
                     {
-                        LOG.debug( "Publishing of the notification: " + creationNotifDoc + " failed.", e );
+                        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() );
+                LOG.debug("EPR did not contain an instance of: " + EndpointReferenceType.class.getName() + " but rather it was: " + xBean.getClass().getName());
             }
         }
         else
         {
-            LOG.debug( "The EndpointReference was either null or it was not an instance of XmlObjectWrapper.  EPR: " + epr );
+            LOG.debug("The EndpointReference was either null or it was not an instance of XmlObjectWrapper.  EPR: " + epr);
         }
     }
 
@@ -85,42 +85,44 @@
      *
      * @param event
      */
-    public void destructionOccurred( ResourceDestructionEvent event )
+    public void destructionOccurred(ResourceDestructionEvent event)
     {
         Object resourceID = event.getResourceID();
-        if ( resourceID != null )
+        if (resourceID == null)
         {
-            DestructionNotificationDocument destructionNotifDoc = DestructionNotificationDocument.Factory.newInstance();
-            DestructionNotificationDocument.DestructionNotification destructionNotif = destructionNotifDoc.addNewDestructionNotification();
-            destructionNotif.setResourceId( (String) resourceID );
-            try
-            {
-                publish( buildManagementEvent( destructionNotifDoc ) );
-            }
-            catch ( Exception e )
+            resourceID = "ResourceID Unknown.  May be singleton.";
+        }
+
+        DestructionNotificationDocument destructionNotifDoc = DestructionNotificationDocument.Factory.newInstance();
+        DestructionNotificationDocument.DestructionNotification destructionNotif = destructionNotifDoc.addNewDestructionNotification();
+        destructionNotif.setResourceId((String) resourceID);
+        try
+        {
+            publish(buildManagementEvent(destructionNotifDoc));
+        }
+        catch (Exception e)
+        {
+            if (LOG.isDebugEnabled())
             {
-                if ( LOG.isDebugEnabled() )
-                {
-                    LOG.debug( "Publishing of the notification: " + destructionNotifDoc + " failed.", e );
-                }
+                LOG.debug("Publishing of the notification: " + destructionNotifDoc + " failed.", e);
             }
         }
+
     }
 
     /**
      * Builds a ManagementEvent to hold the Creation/Destruction event.
      *
      * @param event
-     *
      * @return ManagementEvent
      */
-    private XmlObject buildManagementEvent( XmlObject event )
+    private XmlObject buildManagementEvent(XmlObject event)
     {
-        Situation situation = new SituationImpl( new CategoryImpl( MuwsConstants.SITUATION_OTHER ) );
-        XmlBeansManagementEvent xme = new XmlBeansManagementEvent( situation );
-        ManagementEventDocument mgmtEventDoc = (ManagementEventDocument) ( (XmlObjectWrapper) xme ).getXmlObject();
+        Situation situation = new SituationImpl(new CategoryImpl(MuwsConstants.SITUATION_OTHER));
+        XmlBeansManagementEvent xme = new XmlBeansManagementEvent(situation);
+        ManagementEventDocument mgmtEventDoc = (ManagementEventDocument) ((XmlObjectWrapper) xme).getXmlObject();
         ManagementEventType mgmtEvent = mgmtEventDoc.getManagementEvent();
-        XmlBeanUtils.addChildElement( mgmtEvent, event );
+        XmlBeanUtils.addChildElement(mgmtEvent, event);
         return mgmtEventDoc;
     }
 



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