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 ip...@apache.org on 2005/05/28 03:36:42 UTC

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

Author: ips
Date: Fri May 27 18:36:41 2005
New Revision: 178851

URL: http://svn.apache.org/viewcvs?rev=178851&view=rev
Log:
cosmetic

Modified:
    incubator/muse/trunk/src/java/org/apache/ws/muws/MuwsUtils.java
    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/MuwsUtils.java
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/java/org/apache/ws/muws/MuwsUtils.java?rev=178851&r1=178850&r2=178851&view=diff
==============================================================================
--- incubator/muse/trunk/src/java/org/apache/ws/muws/MuwsUtils.java (original)
+++ incubator/muse/trunk/src/java/org/apache/ws/muws/MuwsUtils.java Fri May 27 18:36:41 2005
@@ -1,13 +1,12 @@
 package org.apache.ws.muws;
 
-import org.apache.ws.resource.properties.ResourcePropertySet;
-import org.apache.ws.notification.topics.TopicSpaceSet;
-import org.apache.ws.notification.topics.TopicSpace;
-import org.apache.ws.notification.topics.Topic;
-import org.apache.ws.notification.topics.impl.TopicSpaceImpl;
 import org.apache.ws.muws.v1_0.MuwsConstants;
 import org.apache.ws.muws.v1_0.capability.RelationshipsCapability;
-
+import org.apache.ws.notification.topics.Topic;
+import org.apache.ws.notification.topics.TopicSpace;
+import org.apache.ws.notification.topics.TopicSpaceSet;
+import org.apache.ws.notification.topics.impl.TopicSpaceImpl;
+import org.apache.ws.resource.properties.ResourcePropertySet;
 
 /**
  * @author Sal Campana
@@ -20,29 +19,31 @@
      *
      * @param propSet
      */
-    public static void updateRelationshipResourceProperty(ResourcePropertySet propSet, org.apache.ws.notification.base.NotificationProducerResource notifResource)
+    public static void updateRelationshipResourceProperty( ResourcePropertySet propSet, org.apache.ws.notification.base.NotificationProducerResource notifResource )
     {
         //init the RelationshipsProperties Resource
-        if(propSet.get(org.apache.ws.muws.v1_0.capability.RelationshipsCapability.PROP_NAME_RELATIONSHIP) != null)
+        if ( propSet.get( org.apache.ws.muws.v1_0.capability.RelationshipsCapability.PROP_NAME_RELATIONSHIP ) != null )
         {
-        org.apache.ws.muws.v1_0.impl.XmlBeansRelationshipResourceProperty relationshipResourceProperty = new org.apache.ws.muws.v1_0.impl.XmlBeansRelationshipResourceProperty(propSet.getMetaData().getPropertyMetaData(org.apache.ws.muws.v1_0.capability.RelationshipsCapability.PROP_NAME_RELATIONSHIP),
-                                                                                                                                                                               (org.apache.ws.resource.properties.impl.XmlBeansResourcePropertySet) propSet, notifResource);
-        ((org.apache.ws.resource.properties.impl.XmlBeansResourcePropertySet) propSet).set(relationshipResourceProperty);
+            org.apache.ws.muws.v1_0.impl.XmlBeansRelationshipResourceProperty relationshipResourceProperty = new org.apache.ws.muws.v1_0.impl.XmlBeansRelationshipResourceProperty( propSet.getMetaData().getPropertyMetaData( org.apache.ws.muws.v1_0.capability.RelationshipsCapability.PROP_NAME_RELATIONSHIP ),
+                    (org.apache.ws.resource.properties.impl.XmlBeansResourcePropertySet) propSet, notifResource );
+            ( (org.apache.ws.resource.properties.impl.XmlBeansResourcePropertySet) propSet ).set( relationshipResourceProperty );
         }
     }
 
     /**
      * Initializes the Muws Relationship topics in the TopicSet
      *
-     * @param set
+     * @param topicSet
+     *
      * @throws Exception
      */
-    public static void addRelationshipTopics(TopicSpaceSet set) throws Exception
+    public static void addRelationshipTopics( TopicSpaceSet topicSet ) throws Exception
     {
-        TopicSpace topicSpace = new TopicSpaceImpl(MuwsConstants.NSURI_MUWS_PART2_TOPICS);
-        Topic topic = topicSpace.addTopic(RelationshipsCapability.TOPIC_NAME);
-        topic.addTopic(RelationshipsCapability.SUBTOPIC_NAME_RELATIONSHIP_CREATED);
-        topic.addTopic(RelationshipsCapability.SUBTOPIC_NAME_RELATIONSHIP_DELETED);
-        set.addTopicSpace(topicSpace);
+        TopicSpace topicSpace = new TopicSpaceImpl( MuwsConstants.NSURI_MUWS_PART2_TOPICS );
+        Topic topic = topicSpace.addTopic( RelationshipsCapability.TOPIC_NAME );
+        topic.addTopic( RelationshipsCapability.SUBTOPIC_NAME_RELATIONSHIP_CREATED );
+        topic.addTopic( RelationshipsCapability.SUBTOPIC_NAME_RELATIONSHIP_DELETED );
+        topicSet.addTopicSpace( topicSpace );
     }
+    
 }

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=178851&r1=178850&r2=178851&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 May 27 18:36:41 2005
@@ -15,16 +15,14 @@
 import org.apache.ws.resource.ResourceCreationListener;
 import org.apache.ws.resource.ResourceDestructionEvent;
 import org.apache.ws.resource.ResourceDestructionListener;
-import org.apache.ws.resource.i18n.MessagesImpl;
 import org.apache.ws.util.XmlBeanUtils;
-import org.apache.ws.util.i18n.Messages;
 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;
 import org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.CreationNotificationDocument;
 import org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.DestructionNotificationDocument;
 import org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceType;
 
-
 /**
  * An Advertisement Topic impl for Resource Creation and Deletion.
  *
@@ -34,22 +32,10 @@
 {
 
     private static final Log LOG = LogFactory.getLog( XmlBeansAdvertisementTopicImpl.class );
-    private static final Messages MSG = MessagesImpl.getInstance();
 
-    public XmlBeansAdvertisementTopicImpl(String s)
+    public XmlBeansAdvertisementTopicImpl( String topicName )
     {
-        super(s);
-    }
-
-    /**
-     * Publishes an event to subscribers.
-     *
-     * @param o
-     * @throws Exception
-     */
-    public void publish(Object o) throws Exception
-    {
-        super.publish(o);
+        super( topicName );
     }
 
     /**
@@ -58,38 +44,38 @@
      *
      * @param event
      */
-    public void creationOccurred(ResourceCreationEvent event)
+    public void creationOccurred( ResourceCreationEvent event )
     {
-        CreationNotificationDocument creationNotificationDocument = CreationNotificationDocument.Factory.newInstance();
-        org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.CreationNotificationDocument.CreationNotification creationNotification = creationNotificationDocument.addNewCreationNotification();
-        EndpointReference endpointReference = event.getEndpointReference();
-        if(endpointReference != null && endpointReference instanceof XmlBeansEndpointReference)
+        CreationNotificationDocument creationNotifDoc = CreationNotificationDocument.Factory.newInstance();
+        CreationNotificationDocument.CreationNotification creationNotif = creationNotifDoc.addNewCreationNotification();
+        EndpointReference epr = event.getEndpointReference();
+        if ( epr != null && epr instanceof XmlBeansEndpointReference )
         {
-            XmlBeansEndpointReference xmlepr = (XmlBeansEndpointReference)endpointReference;
-            XmlObject xmlObject = xmlepr.getXmlObject(org.apache.ws.addressing.v2004_08_10.AddressingConstants.NSURI_ADDRESSING_SCHEMA);
-            if(xmlObject instanceof EndpointReferenceType)
+            XmlBeansEndpointReference xBeansEPR = (XmlBeansEndpointReference) epr;
+            XmlObject xBean = xBeansEPR.getXmlObject( org.apache.ws.addressing.v2004_08_10.AddressingConstants.NSURI_ADDRESSING_SCHEMA );
+            if ( xBean instanceof EndpointReferenceType )
             {
-                creationNotification.setManageabilityEndpointReferenceArray(new EndpointReferenceType[]{(EndpointReferenceType)xmlObject});
+                creationNotif.setManageabilityEndpointReferenceArray( new EndpointReferenceType[]{(EndpointReferenceType) xBean} );
                 try
                 {
-                    publish(buildManagementEvent(creationNotificationDocument));
+                    publish( buildManagementEvent( creationNotifDoc ) );
                 }
-                catch (Exception e)
+                catch ( Exception e )
                 {
-                    if (LOG.isDebugEnabled())
-                        {
-                            LOG.debug("Publishing of the notification: " + creationNotificationDocument.toString() + " 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: " + xmlObject.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: " + endpointReference );
+            LOG.debug( "The EndpointReference was either null or it was not an instance of XmlObjectWrapper.  EPR: " + epr );
         }
     }
 
@@ -99,24 +85,23 @@
      *
      * @param event
      */
-    public void destructionOccurred(ResourceDestructionEvent event)
+    public void destructionOccurred( ResourceDestructionEvent event )
     {
         Object resourceID = event.getResourceID();
-        if (resourceID != null)
+        if ( resourceID != null )
         {
-            DestructionNotificationDocument destructionNotificationDocument = DestructionNotificationDocument.Factory.newInstance();
-            org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.DestructionNotificationDocument.DestructionNotification destructionNotification = destructionNotificationDocument.addNewDestructionNotification();
-
-            destructionNotification.setResourceId((String) resourceID);
+            DestructionNotificationDocument destructionNotifDoc = DestructionNotificationDocument.Factory.newInstance();
+            DestructionNotificationDocument.DestructionNotification destructionNotif = destructionNotifDoc.addNewDestructionNotification();
+            destructionNotif.setResourceId( (String) resourceID );
             try
             {
-                publish(buildManagementEvent(destructionNotificationDocument));
+                publish( buildManagementEvent( destructionNotifDoc ) );
             }
-            catch (Exception e)
+            catch ( Exception e )
             {
-                if (LOG.isDebugEnabled())
+                if ( LOG.isDebugEnabled() )
                 {
-                    LOG.debug("Publishing of the notification: " + destructionNotificationDocument.toString() + " failed.", e);
+                    LOG.debug( "Publishing of the notification: " + destructionNotifDoc + " failed.", e );
                 }
             }
         }
@@ -126,17 +111,17 @@
      * Builds a ManagementEvent to hold the Creation/Destruction event.
      *
      * @param event
-     * @return  ManagementEvent
+     *
+     * @return ManagementEvent
      */
-    private XmlObject buildManagementEvent(XmlObject event)
+    private XmlObject buildManagementEvent( XmlObject event )
     {
-        ManagementEventDocument me;
-        Situation situation = new SituationImpl(new CategoryImpl(MuwsConstants.SITUATION_OTHER));
-        XmlBeansManagementEvent xme = new XmlBeansManagementEvent(situation);
-        me = (ManagementEventDocument) ((XmlObjectWrapper) xme).getXmlObject();
-        org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart1.ManagementEventType managementEvent = me.getManagementEvent();
-        XmlBeanUtils.addChildElement(managementEvent, event);
-        return me;
+        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 );
+        return mgmtEventDoc;
     }
 
 }



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