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/08/02 18:48:40 UTC
svn commit: r227038 [4/4] - in /webservices/muse/trunk: ./
src/java/org/apache/ws/mows/tool/v1_0/ src/java/org/apache/ws/mows/v1_0/
src/java/org/apache/ws/mows/v1_0/capability/ src/java/org/apache/ws/muws/
src/java/org/apache/ws/muws/impl/ src/java/org...
Modified: webservices/muse/trunk/src/java/org/apache/ws/muws/v1_0/impl/advertiser/ResourceAdvertiserPropertyQNames.java
URL: http://svn.apache.org/viewcvs/webservices/muse/trunk/src/java/org/apache/ws/muws/v1_0/impl/advertiser/ResourceAdvertiserPropertyQNames.java?rev=227038&r1=227037&r2=227038&view=diff
==============================================================================
--- webservices/muse/trunk/src/java/org/apache/ws/muws/v1_0/impl/advertiser/ResourceAdvertiserPropertyQNames.java (original)
+++ webservices/muse/trunk/src/java/org/apache/ws/muws/v1_0/impl/advertiser/ResourceAdvertiserPropertyQNames.java Tue Aug 2 09:48:21 2005
@@ -1,25 +1,50 @@
-package org.apache.ws.muws.v1_0.impl.advertiser;
-
-import javax.xml.namespace.QName;
-
-/**
- * QNames of the resource properties defined by ResourceAdvertiser WSDL.
- * <p/>
- * NOTE: This class is generated and is NOT meant to be modified.
- *
- */
-public interface ResourceAdvertiserPropertyQNames
-{
-
- QName MANAGEABILITYCAPABILITY =
- new QName( "http://docs.oasis-open.org/wsdm/2004/12/muws/wsdm-muws-part1.xsd", "ManageabilityCapability", "muws-p1-xs");
- QName TOPICEXPRESSIONDIALECTS =
- new QName( "http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.xsd", "TopicExpressionDialects", "wsnt");
- QName RESOURCEID =
- new QName( "http://docs.oasis-open.org/wsdm/2004/12/muws/wsdm-muws-part1.xsd", "ResourceId", "muws-p1-xs");
- QName FIXEDTOPICSET =
- new QName( "http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.xsd", "FixedTopicSet", "wsnt");
- QName TOPIC =
- new QName( "http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.xsd", "Topic", "wsnt");
-
-}
+/*=============================================================================*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *=============================================================================*/
+package org.apache.ws.muws.v1_0.impl.advertiser;
+
+import javax.xml.namespace.QName;
+
+/**
+ * QNames of the resource properties defined by ResourceAdvertiser WSDL.
+ * <p/>
+ * NOTE: This class is generated and is NOT meant to be modified.
+ *
+ */
+public interface ResourceAdvertiserPropertyQNames
+{
+ /** DOCUMENT_ME */
+ QName MANAGEABILITYCAPABILITY =
+ new QName( "http://docs.oasis-open.org/wsdm/2004/12/muws/wsdm-muws-part1.xsd", "ManageabilityCapability",
+ "muws-p1-xs" );
+
+ /** DOCUMENT_ME */
+ QName TOPICEXPRESSIONDIALECTS =
+ new QName( "http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.xsd",
+ "TopicExpressionDialects", "wsnt" );
+
+ /** DOCUMENT_ME */
+ QName RESOURCEID =
+ new QName( "http://docs.oasis-open.org/wsdm/2004/12/muws/wsdm-muws-part1.xsd", "ResourceId", "muws-p1-xs" );
+
+ /** DOCUMENT_ME */
+ QName FIXEDTOPICSET =
+ new QName( "http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.xsd",
+ "FixedTopicSet", "wsnt" );
+
+ /** DOCUMENT_ME */
+ QName TOPIC =
+ new QName( "http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.xsd", "Topic", "wsnt" );
+}
\ No newline at end of file
Modified: webservices/muse/trunk/src/java/org/apache/ws/muws/v1_0/impl/advertiser/ResourceAdvertiserResource.java
URL: http://svn.apache.org/viewcvs/webservices/muse/trunk/src/java/org/apache/ws/muws/v1_0/impl/advertiser/ResourceAdvertiserResource.java?rev=227038&r1=227037&r2=227038&view=diff
==============================================================================
--- webservices/muse/trunk/src/java/org/apache/ws/muws/v1_0/impl/advertiser/ResourceAdvertiserResource.java (original)
+++ webservices/muse/trunk/src/java/org/apache/ws/muws/v1_0/impl/advertiser/ResourceAdvertiserResource.java Tue Aug 2 09:48:21 2005
@@ -1,146 +1,172 @@
-package org.apache.ws.muws.v1_0.impl.advertiser;
-
-import org.apache.ws.muws.v1_0.MuwsConstants;
-import org.apache.ws.muws.v1_0.capability.AdvertisementCapability;
-import org.apache.ws.muws.v1_0.topics.impl.XmlBeansAdvertisementTopicImpl;
-import org.apache.ws.notification.topics.Topic;
-import org.apache.ws.notification.topics.TopicSpace;
-import org.apache.ws.notification.topics.impl.TopicSpaceImpl;
-import org.apache.ws.resource.impl.AbstractResourceHome;
-
-import javax.naming.Binding;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * A ResourceAdvertiser WS-Resource.
- * <p/>
- * NOTE: This class is generated but IS meant to be modified.
- */
-public class ResourceAdvertiserResource extends AbstractResourceAdvertiserResource
-
-{
-
- /**
- * 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();
-
- public ResourceAdvertiserResource()
- {
- //init();
- }
-
- /**
- * Initializes this resource's state (properties, etc.).
- */
- public void init()
- {
- super.init();
-
- /**
- * The ResourcePropertySet which contains all the defined ResourceProperties
- */
- org.apache.ws.resource.properties.ResourcePropertySet resourcePropertySet = getResourcePropertySet();
- org.apache.ws.resource.properties.ResourceProperty resourceProperty = null;
-
- try
- {
- // init the {http://docs.oasis-open.org/wsdm/2004/12/muws/wsdm-muws-part1.xsd}ManageabilityCapability Resource Property
- resourceProperty = resourcePropertySet.get( ResourceAdvertiserPropertyQNames.MANAGEABILITYCAPABILITY );
- org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart1.ManageabilityCapabilityDocument prop_manageabilitycapability = org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart1.ManageabilityCapabilityDocument.Factory.newInstance();
- prop_manageabilitycapability.setManageabilityCapability( AdvertisementCapability.URI );
- resourceProperty.add( prop_manageabilitycapability );
-
- // init the {http://docs.oasis-open.org/wsdm/2004/12/muws/wsdm-muws-part1.xsd}ResourceId Resource Property
- resourceProperty = resourcePropertySet.get( ResourceAdvertiserPropertyQNames.RESOURCEID );
- org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart1.ResourceIdDocument prop_resourceid = org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart1.ResourceIdDocument.Factory.newInstance();
- prop_resourceid.setResourceId( " " ); //singleton
- resourceProperty.add( prop_resourceid );
-
- org.apache.ws.notification.topics.TopicSpaceSet topicSpaceSet = getTopicSpaceSet();
- TopicSpace topicSpace = new TopicSpaceImpl( MuwsConstants.NSURI_MUWS_PART2_TOPICS );
-
- Topic manageabilityEndpointCreation = new XmlBeansAdvertisementTopicImpl(
- AdvertisementCapability.TOPIC_MANAGEABILITY_ENPOINT_CREATION_NAME, false );
- Topic manageabilityEndpointDestruction = new XmlBeansAdvertisementTopicImpl(
- AdvertisementCapability.TOPIC_MANAGEABILITY_ENPOINT_DESTRUCTION_NAME, false );
-
- XmlBeansAdvertisementTopicImpl manageableResourceCreation = new XmlBeansAdvertisementTopicImpl(
- AdvertisementCapability.TOPIC_MANAGEABLE_RESOURCE_CREATION_NAME );
- XmlBeansAdvertisementTopicImpl manageableResourceDestruction = new XmlBeansAdvertisementTopicImpl(
- AdvertisementCapability.TOPIC_MANAGEABLE_RESOURCE_DESTRUCTION_NAME );
-
- InitialContext ctx = new InitialContext();
- List homes = findHomes( ctx, new ArrayList(), "" );
- for ( int i = 0; i < homes.size(); i++ )
- {
- String home = (String) homes.get( i );
- if ( !home.equals( ResourceAdvertiserHome.HOME_LOCATION ) ) //do not register its own home
- {
- AbstractResourceHome absHome = (AbstractResourceHome) ctx.lookup( home );
- absHome.addResourceCreationListener( manageableResourceCreation );
- absHome.addResourceDestructionListener( manageableResourceDestruction );
- }
- }
- manageabilityEndpointCreation.addTopic( manageableResourceCreation );
- manageabilityEndpointDestruction.addTopic( manageableResourceDestruction );
- topicSpace.addTopic( manageabilityEndpointCreation );
- topicSpace.addTopic( manageabilityEndpointDestruction );
- topicSpaceSet.addTopicSpace( topicSpace );
-
- }
- 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() );
- }
-
- // 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.
- // Resource Property {http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.xsd}TopicExpressionDialects is implemented by the framework.
-
- }
-
- /**
- * Locates the JNDI-deployed homes and returns a list containing their lookup strings
- *
- * @param ctx
- * @param list
- * @param fullname
- *
- * @return A list of homes.
- *
- * @throws NamingException
- */
- public List findHomes( Context ctx, List list, String fullname ) throws NamingException
- {
- NamingEnumeration namingEnumeration = ctx.listBindings( "" );
- while ( namingEnumeration.hasMore() )
- {
- Binding o = (Binding) namingEnumeration.next();
- String name = o.getName();
- Object value = o.getObject();
-
- if ( name.equals( "home" ) )
- {
- list.add( fullname + "/home" );
- }
- else if ( value instanceof Context )
- {
- findHomes( (Context) value, list, fullname + "/" + name );
- }
- else
- {
- fullname = "";
- }
- }
-
- return list;
- }
-}
+/*=============================================================================*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *=============================================================================*/
+package org.apache.ws.muws.v1_0.impl.advertiser;
+
+import org.apache.ws.muws.v1_0.MuwsConstants;
+import org.apache.ws.muws.v1_0.capability.AdvertisementCapability;
+import org.apache.ws.muws.v1_0.topics.impl.XmlBeansAdvertisementTopicImpl;
+import org.apache.ws.notification.topics.Topic;
+import org.apache.ws.notification.topics.TopicSpace;
+import org.apache.ws.notification.topics.impl.TopicSpaceImpl;
+import org.apache.ws.resource.impl.AbstractResourceHome;
+import javax.naming.Binding;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * A ResourceAdvertiser WS-Resource.
+ * <p/>
+ * NOTE: This class is generated but IS meant to be modified.
+ */
+public class ResourceAdvertiserResource
+ extends AbstractResourceAdvertiserResource
+{
+ /**
+ * 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( );
+
+ /**
+ * Creates a new {@link ResourceAdvertiserResource} object.
+ */
+ public ResourceAdvertiserResource( )
+ {
+ //init();
+ }
+
+ /**
+ * Locates the JNDI-deployed homes and returns a list containing their lookup strings
+ *
+ * @param ctx
+ * @param list
+ * @param fullname
+ *
+ * @return A list of homes.
+ *
+ * @throws NamingException
+ */
+ public List findHomes( Context ctx,
+ List list,
+ String fullname )
+ throws NamingException
+ {
+ NamingEnumeration namingEnumeration = ctx.listBindings( "" );
+ while ( namingEnumeration.hasMore( ) )
+ {
+ Binding o = (Binding) namingEnumeration.next( );
+ String name = o.getName( );
+ Object value = o.getObject( );
+
+ if ( name.equals( "home" ) )
+ {
+ list.add( fullname + "/home" );
+ }
+ else if ( value instanceof Context )
+ {
+ findHomes( (Context) value, list, fullname + "/" + name );
+ }
+ else
+ {
+ fullname = "";
+ }
+ }
+
+ return list;
+ }
+
+ /**
+ * Initializes this resource's state (properties, etc.).
+ */
+ public void init( )
+ {
+ super.init( );
+
+ /**
+ * The ResourcePropertySet which contains all the defined ResourceProperties
+ */
+ org.apache.ws.resource.properties.ResourcePropertySet resourcePropertySet = getResourcePropertySet( );
+ org.apache.ws.resource.properties.ResourceProperty resourceProperty = null;
+
+ try
+ {
+ // init the {http://docs.oasis-open.org/wsdm/2004/12/muws/wsdm-muws-part1.xsd}ManageabilityCapability Resource Property
+ resourceProperty = resourcePropertySet.get( ResourceAdvertiserPropertyQNames.MANAGEABILITYCAPABILITY );
+ org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart1.ManageabilityCapabilityDocument prop_manageabilitycapability =
+ org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart1.ManageabilityCapabilityDocument.Factory
+ .newInstance( );
+ prop_manageabilitycapability.setManageabilityCapability( AdvertisementCapability.URI );
+ resourceProperty.add( prop_manageabilitycapability );
+
+ // init the {http://docs.oasis-open.org/wsdm/2004/12/muws/wsdm-muws-part1.xsd}ResourceId Resource Property
+ resourceProperty = resourcePropertySet.get( ResourceAdvertiserPropertyQNames.RESOURCEID );
+ org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart1.ResourceIdDocument prop_resourceid =
+ org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart1.ResourceIdDocument.Factory.newInstance( );
+ prop_resourceid.setResourceId( " " ); //singleton
+ resourceProperty.add( prop_resourceid );
+
+ org.apache.ws.notification.topics.TopicSpaceSet topicSpaceSet = getTopicSpaceSet( );
+ TopicSpace topicSpace =
+ new TopicSpaceImpl( MuwsConstants.NSURI_MUWS_PART2_TOPICS );
+
+ Topic manageabilityEndpointCreation =
+ new XmlBeansAdvertisementTopicImpl( AdvertisementCapability.TOPIC_MANAGEABILITY_ENPOINT_CREATION_NAME,
+ false );
+ Topic manageabilityEndpointDestruction =
+ new XmlBeansAdvertisementTopicImpl( AdvertisementCapability.TOPIC_MANAGEABILITY_ENPOINT_DESTRUCTION_NAME,
+ false );
+
+ XmlBeansAdvertisementTopicImpl manageableResourceCreation =
+ new XmlBeansAdvertisementTopicImpl( AdvertisementCapability.TOPIC_MANAGEABLE_RESOURCE_CREATION_NAME );
+ XmlBeansAdvertisementTopicImpl manageableResourceDestruction =
+ new XmlBeansAdvertisementTopicImpl( AdvertisementCapability.TOPIC_MANAGEABLE_RESOURCE_DESTRUCTION_NAME );
+
+ InitialContext ctx = new InitialContext( );
+ List homes = findHomes( ctx,
+ new ArrayList( ),
+ "" );
+ for ( int i = 0; i < homes.size( ); i++ )
+ {
+ String home = (String) homes.get( i );
+ if ( !home.equals( ResourceAdvertiserHome.HOME_LOCATION ) ) //do not register its own home
+ {
+ AbstractResourceHome absHome = (AbstractResourceHome) ctx.lookup( home );
+ absHome.addResourceCreationListener( manageableResourceCreation );
+ absHome.addResourceDestructionListener( manageableResourceDestruction );
+ }
+ }
+
+ manageabilityEndpointCreation.addTopic( manageableResourceCreation );
+ manageabilityEndpointDestruction.addTopic( manageableResourceDestruction );
+ topicSpace.addTopic( manageabilityEndpointCreation );
+ topicSpace.addTopic( manageabilityEndpointDestruction );
+ topicSpaceSet.addTopicSpace( topicSpace );
+ }
+ 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( ) );
+ }
+
+ // 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.
+ // Resource Property {http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.xsd}TopicExpressionDialects is implemented by the framework.
+ }
+}
\ No newline at end of file
Modified: webservices/muse/trunk/src/java/org/apache/ws/muws/v1_0/impl/advertiser/ResourceAdvertiserService.java
URL: http://svn.apache.org/viewcvs/webservices/muse/trunk/src/java/org/apache/ws/muws/v1_0/impl/advertiser/ResourceAdvertiserService.java?rev=227038&r1=227037&r2=227038&view=diff
==============================================================================
--- webservices/muse/trunk/src/java/org/apache/ws/muws/v1_0/impl/advertiser/ResourceAdvertiserService.java (original)
+++ webservices/muse/trunk/src/java/org/apache/ws/muws/v1_0/impl/advertiser/ResourceAdvertiserService.java Tue Aug 2 09:48:21 2005
@@ -1,53 +1,64 @@
-package org.apache.ws.muws.v1_0.impl.advertiser;
-
-import org.apache.ws.resource.ResourceContext;
-import org.apache.xmlbeans.XmlObject;
-import org.apache.xmlbeans.XmlException;
-
-import javax.xml.rpc.JAXRPCException;
-
-/**
- * This class should be generated ONCE (and not overwritten) to maintain user-added code.
- * If there is a change to the WSDL, then the generated implemented interfaces
- * (representing the "base" portTypes) will change, thus showing a compile error to the
- * user.
- *
- * NOTE: This class is generated. However, it will not be overwritten by subsequent
- * calls to the code generator.
- *
- */
-public class ResourceAdvertiserService
- extends AbstractResourceAdvertiserService
- implements ResourceAdvertiserCustomOperationsPortType
-{
-
-
- /**
- * 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();
-
- /**
- * Creates a new {@link ResourceAdvertiserService } object.
- *
- * @param resourceContext DOCUMENT_ME
- */
- public ResourceAdvertiserService( ResourceContext resourceContext )
- {
- super(resourceContext);
- init();
- }
-
- /**
- * Returns a collection of Spec Namespaces associated with this Service
- *
- * @return A NamespaceVersionHolder impl which represents the collection of spec namespaces
- * associated with this service.
- */
- protected org.apache.ws.resource.properties.NamespaceVersionHolder getNamespaceSet()
- {
- return SPEC_NAMESPACE_SET;
- }
-
-
-}
+/*=============================================================================*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *=============================================================================*/
+package org.apache.ws.muws.v1_0.impl.advertiser;
+
+import org.apache.ws.resource.ResourceContext;
+import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.XmlObject;
+import javax.xml.rpc.JAXRPCException;
+
+/**
+ * This class should be generated ONCE (and not overwritten) to maintain user-added code.
+ * If there is a change to the WSDL, then the generated implemented interfaces
+ * (representing the "base" portTypes) will change, thus showing a compile error to the
+ * user.
+ *
+ * NOTE: This class is generated. However, it will not be overwritten by subsequent
+ * calls to the code generator.
+ *
+ */
+public class ResourceAdvertiserService
+ extends AbstractResourceAdvertiserService
+ implements ResourceAdvertiserCustomOperationsPortType
+{
+ /**
+ * 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( );
+
+ /**
+ * Creates a new {@link ResourceAdvertiserService } object.
+ *
+ * @param resourceContext DOCUMENT_ME
+ */
+ public ResourceAdvertiserService( ResourceContext resourceContext )
+ {
+ super( resourceContext );
+ init( );
+ }
+
+ /**
+ * Returns a collection of Spec Namespaces associated with this Service
+ *
+ * @return A NamespaceVersionHolder impl which represents the collection of spec namespaces
+ * associated with this service.
+ */
+ protected org.apache.ws.resource.properties.NamespaceVersionHolder getNamespaceSet( )
+ {
+ return SPEC_NAMESPACE_SET;
+ }
+}
\ No newline at end of file
Modified: webservices/muse/trunk/src/java/org/apache/ws/muws/v1_0/topics/ManagementEventTopic.java
URL: http://svn.apache.org/viewcvs/webservices/muse/trunk/src/java/org/apache/ws/muws/v1_0/topics/ManagementEventTopic.java?rev=227038&r1=227037&r2=227038&view=diff
==============================================================================
--- webservices/muse/trunk/src/java/org/apache/ws/muws/v1_0/topics/ManagementEventTopic.java (original)
+++ webservices/muse/trunk/src/java/org/apache/ws/muws/v1_0/topics/ManagementEventTopic.java Tue Aug 2 09:48:21 2005
@@ -1,18 +1,35 @@
-package org.apache.ws.muws.v1_0.topics;
-
-import org.apache.ws.muws.v1_0.events.ManagementEvent;
-import org.apache.ws.notification.topics.Topic;
-import org.apache.ws.notification.topics.ResourcePropertyValueChangeTopic;
-
-/**
- * @author Sal Campana
- */
-public interface ManagementEventTopic extends Topic, ResourcePropertyValueChangeTopic
-{
- /**
- * This method is used to send a ManagementEvent to subscribers to this topic.
- *
- * @param me
- */
- void publish(ManagementEvent me);
-}
+/*=============================================================================*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *=============================================================================*/
+package org.apache.ws.muws.v1_0.topics;
+
+import org.apache.ws.muws.v1_0.events.ManagementEvent;
+import org.apache.ws.notification.topics.ResourcePropertyValueChangeTopic;
+import org.apache.ws.notification.topics.Topic;
+
+/**
+ * @author Sal Campana
+ */
+public interface ManagementEventTopic
+ extends Topic,
+ ResourcePropertyValueChangeTopic
+{
+ /**
+ * This method is used to send a ManagementEvent to subscribers to this topic.
+ *
+ * @param me
+ */
+ void publish( ManagementEvent me );
+}
\ No newline at end of file
Modified: webservices/muse/trunk/src/java/org/apache/ws/muws/v1_0/topics/MuwsTopicsConstants.java
URL: http://svn.apache.org/viewcvs/webservices/muse/trunk/src/java/org/apache/ws/muws/v1_0/topics/MuwsTopicsConstants.java?rev=227038&r1=227037&r2=227038&view=diff
==============================================================================
--- webservices/muse/trunk/src/java/org/apache/ws/muws/v1_0/topics/MuwsTopicsConstants.java (original)
+++ webservices/muse/trunk/src/java/org/apache/ws/muws/v1_0/topics/MuwsTopicsConstants.java Tue Aug 2 09:48:21 2005
@@ -1,102 +1,119 @@
-/*=============================================================================*
- * Copyright 2004 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *=============================================================================*/
-package org.apache.ws.muws.v1_0.topics;
-
-import org.apache.ws.mows.v1_0.capability.OperationalStateCapability;
-import org.apache.ws.muws.v1_0.MuwsConstants;
-import org.apache.ws.muws.v1_0.capability.AdvertisementCapability;
-import org.apache.ws.muws.v1_0.capability.ConfigurationCapability;
-import org.apache.ws.muws.v1_0.capability.CorrelatablePropertiesCapability;
-import org.apache.ws.muws.v1_0.capability.DescriptionCapability;
-import org.apache.ws.muws.v1_0.capability.IdentityCapability;
-import org.apache.ws.muws.v1_0.capability.ManageabilityCharacteristicsCapability;
-import org.apache.ws.muws.v1_0.capability.MetricsCapability;
-import org.apache.ws.muws.v1_0.capability.RelationshipAccessCapability;
-import org.apache.ws.muws.v1_0.capability.RelationshipResourceCapability;
-import org.apache.ws.muws.v1_0.capability.RelationshipsCapability;
-import org.apache.ws.muws.v1_0.capability.StateCapability;
-import javax.xml.namespace.QName;
-
-/**
- * A Constant class for maintaining one place to look for the Topic QNames
- * defined in the Muws Spec.
- *
- * This is useful for registering for notifs from these topics.
- *
- * This class utilizes the fields from the Capability interfaces and is meant
- * to make a collection of the Topic qnames.
- *
- * @author Sal Campana
- */
-public interface MuwsTopicsConstants
-{
-
- QName MUWS_TOPICSPACE_NAME = new QName( MuwsConstants.NSURI_MUWS_PART2_TOPICS, "MuwsNotificationTopics" );
-
- QName IDENTITYCAPABILITY_TOPIC_NAME =
- new QName( MuwsConstants.NSURI_MUWS_PART2_TOPICS, IdentityCapability.TOPIC_NAME );
-
- QName MANAGEABILITYCHARACTERISTICSCAPABILITY_TOPIC_NAME =
- new QName( MuwsConstants.NSURI_MUWS_PART2_TOPICS, ManageabilityCharacteristicsCapability.TOPIC_NAME );
-
- QName CORRELATABLEPROPERTIESCAPABILITY_TOPIC_NAME =
- new QName( MuwsConstants.NSURI_MUWS_PART2_TOPICS, CorrelatablePropertiesCapability.TOPIC_NAME );
-
- QName DESCRIPTIONCAPABILITY_TOPIC_NAME =
- new QName( MuwsConstants.NSURI_MUWS_PART2_TOPICS, DescriptionCapability.TOPIC_NAME );
-
- QName STATE_TOPIC_NAME = new QName( MuwsConstants.NSURI_MUWS_PART2_TOPICS, StateCapability.TOPIC_NAME );
-
- QName OPERATIONALSTATECAPABILITY_TOPIC_NAME =
- new QName( MuwsConstants.NSURI_MUWS_PART2_TOPICS, OperationalStateCapability.TOPIC_NAME );
-
- QName METRICSCAPABILITY_TOPIC_NAME =
- new QName( MuwsConstants.NSURI_MUWS_PART2_TOPICS, MetricsCapability.TOPIC_NAME );
-
- QName CONFIGURATIONCAPABILITY_TOPIC_NAME =
- new QName( MuwsConstants.NSURI_MUWS_PART2_TOPICS, ConfigurationCapability.TOPIC_NAME );
-
- QName RELATIONSHIPSCAPABILITY_TOPIC_NAME =
- new QName( MuwsConstants.NSURI_MUWS_PART2_TOPICS, RelationshipsCapability.TOPIC_NAME );
-
- QName RELATIONSHIP_CREATED_SUBTOPIC_NAME =
- new QName( MuwsConstants.NSURI_MUWS_PART2_TOPICS, RelationshipsCapability.SUBTOPIC_NAME_RELATIONSHIP_CREATED );
-
- QName RELATIONSHIP_DELETED_SUBTOPIC_NAME =
- new QName( MuwsConstants.NSURI_MUWS_PART2_TOPICS, RelationshipsCapability.SUBTOPIC_NAME_RELATIONSHIP_DELETED );
-
- QName RELATIONSHIP_ACCESS_TOPIC_NAME =
- new QName( MuwsConstants.NSURI_MUWS_PART2_TOPICS, RelationshipAccessCapability.TOPIC_NAME );
-
- QName RELATIONSHIPRESOURCECAPABILITY_TOPIC_NAME =
- new QName( MuwsConstants.NSURI_MUWS_PART2_TOPICS, RelationshipResourceCapability.TOPIC_NAME );
-
- QName MANAGEABILITY_ENPOINT_CREATION_TOPIC_NAME =
- new QName( MuwsConstants.NSURI_MUWS_PART2_TOPICS,
- AdvertisementCapability.TOPIC_MANAGEABILITY_ENPOINT_CREATION_NAME );
-
- QName MANAGEABLE_RESOURCE_CREATION_SUBTOPIC_NAME =
- new QName( MuwsConstants.NSURI_MUWS_PART2_TOPICS,
- AdvertisementCapability.TOPIC_MANAGEABLE_RESOURCE_CREATION_NAME );
-
- QName MANAGEABILITY_ENPOINT_DESTRUCTION_TOPIC_NAME =
- new QName( MuwsConstants.NSURI_MUWS_PART2_TOPICS,
- AdvertisementCapability.TOPIC_MANAGEABILITY_ENPOINT_DESTRUCTION_NAME );
-
- QName MANAGEABLE_RESOURCE_DESTRUCTION_SUBTOPIC_NAME =
- new QName( MuwsConstants.NSURI_MUWS_PART2_TOPICS,
- AdvertisementCapability.TOPIC_MANAGEABLE_RESOURCE_DESTRUCTION_NAME );
+/*=============================================================================*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *=============================================================================*/
+package org.apache.ws.muws.v1_0.topics;
+
+import org.apache.ws.mows.v1_0.capability.OperationalStateCapability;
+import org.apache.ws.muws.v1_0.MuwsConstants;
+import org.apache.ws.muws.v1_0.capability.AdvertisementCapability;
+import org.apache.ws.muws.v1_0.capability.ConfigurationCapability;
+import org.apache.ws.muws.v1_0.capability.CorrelatablePropertiesCapability;
+import org.apache.ws.muws.v1_0.capability.DescriptionCapability;
+import org.apache.ws.muws.v1_0.capability.IdentityCapability;
+import org.apache.ws.muws.v1_0.capability.ManageabilityCharacteristicsCapability;
+import org.apache.ws.muws.v1_0.capability.MetricsCapability;
+import org.apache.ws.muws.v1_0.capability.RelationshipAccessCapability;
+import org.apache.ws.muws.v1_0.capability.RelationshipResourceCapability;
+import org.apache.ws.muws.v1_0.capability.RelationshipsCapability;
+import org.apache.ws.muws.v1_0.capability.StateCapability;
+import javax.xml.namespace.QName;
+
+/**
+ * A Constant class for maintaining one place to look for the Topic QNames
+ * defined in the Muws Spec.
+ *
+ * This is useful for registering for notifs from these topics.
+ *
+ * This class utilizes the fields from the Capability interfaces and is meant
+ * to make a collection of the Topic qnames.
+ *
+ * @author Sal Campana
+ */
+public interface MuwsTopicsConstants
+{
+ /** DOCUMENT_ME */
+ QName MUWS_TOPICSPACE_NAME = new QName( MuwsConstants.NSURI_MUWS_PART2_TOPICS, "MuwsNotificationTopics" );
+
+ /** DOCUMENT_ME */
+ QName IDENTITYCAPABILITY_TOPIC_NAME =
+ new QName( MuwsConstants.NSURI_MUWS_PART2_TOPICS, IdentityCapability.TOPIC_NAME );
+
+ /** DOCUMENT_ME */
+ QName MANAGEABILITYCHARACTERISTICSCAPABILITY_TOPIC_NAME =
+ new QName( MuwsConstants.NSURI_MUWS_PART2_TOPICS, ManageabilityCharacteristicsCapability.TOPIC_NAME );
+
+ /** DOCUMENT_ME */
+ QName CORRELATABLEPROPERTIESCAPABILITY_TOPIC_NAME =
+ new QName( MuwsConstants.NSURI_MUWS_PART2_TOPICS, CorrelatablePropertiesCapability.TOPIC_NAME );
+
+ /** DOCUMENT_ME */
+ QName DESCRIPTIONCAPABILITY_TOPIC_NAME =
+ new QName( MuwsConstants.NSURI_MUWS_PART2_TOPICS, DescriptionCapability.TOPIC_NAME );
+
+ /** DOCUMENT_ME */
+ QName STATE_TOPIC_NAME = new QName( MuwsConstants.NSURI_MUWS_PART2_TOPICS, StateCapability.TOPIC_NAME );
+
+ /** DOCUMENT_ME */
+ QName OPERATIONALSTATECAPABILITY_TOPIC_NAME =
+ new QName( MuwsConstants.NSURI_MUWS_PART2_TOPICS, OperationalStateCapability.TOPIC_NAME );
+
+ /** DOCUMENT_ME */
+ QName METRICSCAPABILITY_TOPIC_NAME =
+ new QName( MuwsConstants.NSURI_MUWS_PART2_TOPICS, MetricsCapability.TOPIC_NAME );
+
+ /** DOCUMENT_ME */
+ QName CONFIGURATIONCAPABILITY_TOPIC_NAME =
+ new QName( MuwsConstants.NSURI_MUWS_PART2_TOPICS, ConfigurationCapability.TOPIC_NAME );
+
+ /** DOCUMENT_ME */
+ QName RELATIONSHIPSCAPABILITY_TOPIC_NAME =
+ new QName( MuwsConstants.NSURI_MUWS_PART2_TOPICS, RelationshipsCapability.TOPIC_NAME );
+
+ /** DOCUMENT_ME */
+ QName RELATIONSHIP_CREATED_SUBTOPIC_NAME =
+ new QName( MuwsConstants.NSURI_MUWS_PART2_TOPICS, RelationshipsCapability.SUBTOPIC_NAME_RELATIONSHIP_CREATED );
+
+ /** DOCUMENT_ME */
+ QName RELATIONSHIP_DELETED_SUBTOPIC_NAME =
+ new QName( MuwsConstants.NSURI_MUWS_PART2_TOPICS, RelationshipsCapability.SUBTOPIC_NAME_RELATIONSHIP_DELETED );
+
+ /** DOCUMENT_ME */
+ QName RELATIONSHIP_ACCESS_TOPIC_NAME =
+ new QName( MuwsConstants.NSURI_MUWS_PART2_TOPICS, RelationshipAccessCapability.TOPIC_NAME );
+
+ /** DOCUMENT_ME */
+ QName RELATIONSHIPRESOURCECAPABILITY_TOPIC_NAME =
+ new QName( MuwsConstants.NSURI_MUWS_PART2_TOPICS, RelationshipResourceCapability.TOPIC_NAME );
+
+ /** DOCUMENT_ME */
+ QName MANAGEABILITY_ENPOINT_CREATION_TOPIC_NAME =
+ new QName( MuwsConstants.NSURI_MUWS_PART2_TOPICS,
+ AdvertisementCapability.TOPIC_MANAGEABILITY_ENPOINT_CREATION_NAME );
+
+ /** DOCUMENT_ME */
+ QName MANAGEABLE_RESOURCE_CREATION_SUBTOPIC_NAME =
+ new QName( MuwsConstants.NSURI_MUWS_PART2_TOPICS,
+ AdvertisementCapability.TOPIC_MANAGEABLE_RESOURCE_CREATION_NAME );
+
+ /** DOCUMENT_ME */
+ QName MANAGEABILITY_ENPOINT_DESTRUCTION_TOPIC_NAME =
+ new QName( MuwsConstants.NSURI_MUWS_PART2_TOPICS,
+ AdvertisementCapability.TOPIC_MANAGEABILITY_ENPOINT_DESTRUCTION_NAME );
+
+ /** DOCUMENT_ME */
+ QName MANAGEABLE_RESOURCE_DESTRUCTION_SUBTOPIC_NAME =
+ new QName( MuwsConstants.NSURI_MUWS_PART2_TOPICS,
+ AdvertisementCapability.TOPIC_MANAGEABLE_RESOURCE_DESTRUCTION_NAME );
}
Modified: webservices/muse/trunk/src/java/org/apache/ws/muws/v1_0/topics/impl/XmlBeansAdvertisementTopicImpl.java
URL: http://svn.apache.org/viewcvs/webservices/muse/trunk/src/java/org/apache/ws/muws/v1_0/topics/impl/XmlBeansAdvertisementTopicImpl.java?rev=227038&r1=227037&r2=227038&view=diff
==============================================================================
--- webservices/muse/trunk/src/java/org/apache/ws/muws/v1_0/topics/impl/XmlBeansAdvertisementTopicImpl.java (original)
+++ webservices/muse/trunk/src/java/org/apache/ws/muws/v1_0/topics/impl/XmlBeansAdvertisementTopicImpl.java Tue Aug 2 09:48:21 2005
@@ -1,182 +1,228 @@
-package org.apache.ws.muws.v1_0.topics.impl;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.ws.XmlObjectWrapper;
-import org.apache.ws.addressing.EndpointReference;
-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;
-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.
- *
- * @author Sal Campana
- */
-public class XmlBeansAdvertisementTopicImpl extends TopicImpl implements ResourceCreationListener, ResourceDestructionListener
-{
-
- private static final Log LOG = LogFactory.getLog(XmlBeansAdvertisementTopicImpl.class);
-
- public XmlBeansAdvertisementTopicImpl(String topicName)
- {
- super(topicName);
- }
-
- public XmlBeansAdvertisementTopicImpl(String topicName, boolean isVisible)
- {
- 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
- *
- * @param event
- */
- public void creationOccurred(ResourceCreationEvent event)
- {
- Resource resource = event.getResource();
-
- //determine if resource is a muws resource
- ResourceProperty identityProperty = getIdentityProperty(resource);
- if (identityProperty != null)
- {
- CreationNotificationDocument creationNotifDoc = CreationNotificationDocument.Factory.newInstance();
- CreationNotificationDocument.CreationNotification creationNotif = creationNotifDoc.addNewCreationNotification();
- EndpointReference epr = resource.getEndpointReference();
- 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)
- {
- creationNotif.setManageabilityEndpointReferenceArray(new EndpointReferenceType[]{(EndpointReferenceType) xBean});
- try
- {
- publish(buildManagementEvent(creationNotifDoc));
- }
- catch (Exception 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("The EndpointReference was either null or it was not an instance of XmlObjectWrapper. EPR: " + epr);
- }
- }
- }
-
- /**
- * Handles the event when a destruction occurs. Builds a DestructionNotificationDocument
- * and sends notif to subscribers
- *
- * @param event
- */
- public void destructionOccurred(ResourceDestructionEvent event)
- {
- Resource resource = event.getResource();
- ResourceProperty identityProperty = getIdentityProperty(resource);
- if (identityProperty != null)
- {
- 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())
- {
- 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)
- {
- 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;
- }
-
- public boolean isVisible()
- {
- return m_isVisible;
- }
-}
+/*=============================================================================*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *=============================================================================*/
+package org.apache.ws.muws.v1_0.topics.impl;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ws.XmlObjectWrapper;
+import org.apache.ws.addressing.EndpointReference;
+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;
+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.
+ *
+ * @author Sal Campana
+ */
+public class XmlBeansAdvertisementTopicImpl
+ extends TopicImpl
+ implements ResourceCreationListener,
+ ResourceDestructionListener
+{
+ private static final Log LOG = LogFactory.getLog( XmlBeansAdvertisementTopicImpl.class );
+
+ /**
+ * Creates a new {@link XmlBeansAdvertisementTopicImpl} object.
+ *
+ * @param topicName DOCUMENT_ME
+ */
+ public XmlBeansAdvertisementTopicImpl( String topicName )
+ {
+ super( topicName );
+ }
+
+ /**
+ * Creates a new {@link XmlBeansAdvertisementTopicImpl} object.
+ *
+ * @param topicName DOCUMENT_ME
+ * @param isVisible DOCUMENT_ME
+ */
+ public XmlBeansAdvertisementTopicImpl( String topicName,
+ boolean isVisible )
+ {
+ super( topicName );
+ setIsVisible( isVisible );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public boolean isVisible( )
+ {
+ return m_isVisible;
+ }
+
+ /**
+ * Handles the event when a creation occurs. Builds a CreationNotification
+ * and sends notif to subscribers
+ *
+ * @param event
+ */
+ public void creationOccurred( ResourceCreationEvent event )
+ {
+ Resource resource = event.getResource( );
+
+ //determine if resource is a muws resource
+ ResourceProperty identityProperty = getIdentityProperty( resource );
+ if ( identityProperty != null )
+ {
+ CreationNotificationDocument creationNotifDoc =
+ CreationNotificationDocument.Factory.newInstance( );
+ CreationNotificationDocument.CreationNotification creationNotif =
+ creationNotifDoc.addNewCreationNotification( );
+ EndpointReference epr = resource.getEndpointReference( );
+ 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 )
+ {
+ creationNotif.setManageabilityEndpointReferenceArray( new EndpointReferenceType[]
+ {
+ (EndpointReferenceType) xBean
+ } );
+ try
+ {
+ publish( buildManagementEvent( creationNotifDoc ) );
+ }
+ catch ( Exception 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( "The EndpointReference was either null or it was not an instance of XmlObjectWrapper. EPR: "
+ + epr );
+ }
+ }
+ }
+
+ /**
+ * Handles the event when a destruction occurs. Builds a DestructionNotificationDocument
+ * and sends notif to subscribers
+ *
+ * @param event
+ */
+ public void destructionOccurred( ResourceDestructionEvent event )
+ {
+ Resource resource = event.getResource( );
+ ResourceProperty identityProperty = getIdentityProperty( resource );
+ if ( identityProperty != null )
+ {
+ 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( ) )
+ {
+ LOG.debug( "Publishing of the notification: " + destructionNotifDoc + " failed.", e );
+ }
+ }
+ }
+ }
+
+ /**
+ * 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;
+ }
+
+ /**
+ * Builds a ManagementEvent to hold the Creation/Destruction event.
+ *
+ * @param event
+ * @return ManagementEvent
+ */
+ 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( );
+ ManagementEventType mgmtEvent = mgmtEventDoc.getManagementEvent( );
+ XmlBeanUtils.addChildElement( mgmtEvent, event );
+ return mgmtEventDoc;
+ }
+}
\ No newline at end of file
Modified: webservices/muse/trunk/src/java/org/apache/ws/muws/v1_0/topics/impl/XmlBeansManagementEventTopicImpl.java
URL: http://svn.apache.org/viewcvs/webservices/muse/trunk/src/java/org/apache/ws/muws/v1_0/topics/impl/XmlBeansManagementEventTopicImpl.java?rev=227038&r1=227037&r2=227038&view=diff
==============================================================================
--- webservices/muse/trunk/src/java/org/apache/ws/muws/v1_0/topics/impl/XmlBeansManagementEventTopicImpl.java (original)
+++ webservices/muse/trunk/src/java/org/apache/ws/muws/v1_0/topics/impl/XmlBeansManagementEventTopicImpl.java Tue Aug 2 09:48:21 2005
@@ -1,133 +1,162 @@
-package org.apache.ws.muws.v1_0.topics.impl;
-
-import org.apache.ws.XmlObjectWrapper;
-import org.apache.ws.muws.impl.CategoryImpl;
-import org.apache.ws.muws.v1_0.MuwsConstants;
-import org.apache.ws.muws.v1_0.events.ManagementEvent;
-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.muws.v1_0.topics.ManagementEventTopic;
-import org.apache.ws.notification.topics.impl.TopicImpl;
-import org.apache.ws.resource.properties.ResourcePropertyValueChangeEvent;
-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.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart1.ManagementEventDocument;
-
-
-/**
- * A ManagementEvent topic listener for generic management events and PropChange->Management Events.
- *
- * @author Sal Campana
- */
-public class XmlBeansManagementEventTopicImpl extends TopicImpl implements ManagementEventTopic
-{
- private static final Log LOG = LogFactory.getLog( XmlBeansManagementEventTopicImpl.class );
- private static final Messages MSG = MessagesImpl.getInstance();
-
- private ManagementEvent m_propChangeManagementEvent;
-
-
- public XmlBeansManagementEventTopicImpl( String capabilityName )
- {
- super( capabilityName );
-
- }
-
- /**
- * This operation is used to set the default ManagementEvent to
- * be used when sending Property Changed Management Events.
- *
- * Note: The object must implement XmlObjectWrapper, the getXmlObject() operation will be used to get a new instance
- * of the Management Event for use to throw the event.
- *
- * @param me
- */
- public void setPropChangeManagemntEvent (ManagementEvent me)
- {
- if(!(me instanceof XmlObjectWrapper))
- {
- throw new IllegalArgumentException("The Management Event must implement the XmlObjectWrpper interface.");
- }
- m_propChangeManagementEvent = me;
- }
-
- public void propertyChanged(ResourcePropertyValueChangeEvent event)
- {
- XmlObject me = buildManagementEvent(event);
-
- Object msg;
- if ( me instanceof XmlObjectWrapper )
- {
- msg = ((XmlObjectWrapper)me).getXmlObject();
- }
- else
- {
- msg = me;
- }
- try
- {
- publish( msg );
- }
- catch ( Exception e )
- {
- LOG.debug("An exception occurred when attempting to publish a ResourcePropertyValueChangeEvent:", e);
- // TODO: *SJC* This is tricky, we may need to devise a List of Exceptions to collect any exceptions. The other thing to consider is where does the exception go?
- }
- }
-
- private XmlObject buildManagementEvent(ResourcePropertyValueChangeEvent event)
- {
- ManagementEventDocument me;
- if(m_propChangeManagementEvent != null)
- {
- me = (ManagementEventDocument) ((XmlObjectWrapper)m_propChangeManagementEvent).getXmlObject();
- }
- else
- {
- 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, ((XmlObjectWrapper)event).getXmlObject());
- return me;
- }
-
-
- /**
- * This method is used to send a ManagementEvent to subscribers to this topic.
- *
- * precondition: The param ManagementEvent should be complete and not rely on
- * any setters in this topic.
- *
- * @param me
- */
- public void publish(ManagementEvent me)
- {
- Object msg;
- if ( me instanceof XmlObjectWrapper )
- {
- msg = ((XmlObjectWrapper)me).getXmlObject();
- }
- else
- {
- msg = me;
- }
- try
- {
- publish( msg );
- }
- catch ( Exception e )
- {
- LOG.debug("An Exception occurred when trying to publish a ManagementEvent: ", e);
- // TODO: *SJC* This is tricky, we may need to devise a List of Exceptions to collect any exceptions. The other thing to consider is where does the exception go?
- }
- }
-
-}
+/*=============================================================================*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *=============================================================================*/
+package org.apache.ws.muws.v1_0.topics.impl;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ws.XmlObjectWrapper;
+import org.apache.ws.muws.impl.CategoryImpl;
+import org.apache.ws.muws.v1_0.MuwsConstants;
+import org.apache.ws.muws.v1_0.events.ManagementEvent;
+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.muws.v1_0.topics.ManagementEventTopic;
+import org.apache.ws.notification.topics.impl.TopicImpl;
+import org.apache.ws.resource.i18n.MessagesImpl;
+import org.apache.ws.resource.properties.ResourcePropertyValueChangeEvent;
+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;
+
+/**
+ * A ManagementEvent topic listener for generic management events and PropChange->Management Events.
+ *
+ * @author Sal Campana
+ */
+public class XmlBeansManagementEventTopicImpl
+ extends TopicImpl
+ implements ManagementEventTopic
+{
+ private static final Log LOG = LogFactory.getLog( XmlBeansManagementEventTopicImpl.class );
+ private static final Messages MSG = MessagesImpl.getInstance( );
+ private ManagementEvent m_propChangeManagementEvent;
+
+ /**
+ * Creates a new {@link XmlBeansManagementEventTopicImpl} object.
+ *
+ * @param capabilityName DOCUMENT_ME
+ */
+ public XmlBeansManagementEventTopicImpl( String capabilityName )
+ {
+ super( capabilityName );
+ }
+
+ /**
+ * This operation is used to set the default ManagementEvent to
+ * be used when sending Property Changed Management Events.
+ *
+ * Note: The object must implement XmlObjectWrapper, the getXmlObject() operation will be used to get a new instance
+ * of the Management Event for use to throw the event.
+ *
+ * @param me
+ */
+ public void setPropChangeManagemntEvent( ManagementEvent me )
+ {
+ if ( !( me instanceof XmlObjectWrapper ) )
+ {
+ throw new IllegalArgumentException( "The Management Event must implement the XmlObjectWrpper interface." );
+ }
+
+ m_propChangeManagementEvent = me;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param event DOCUMENT_ME
+ */
+ public void propertyChanged( ResourcePropertyValueChangeEvent event )
+ {
+ XmlObject me = buildManagementEvent( event );
+
+ Object msg;
+ if ( me instanceof XmlObjectWrapper )
+ {
+ msg = ( (XmlObjectWrapper) me ).getXmlObject( );
+ }
+ else
+ {
+ msg = me;
+ }
+
+ try
+ {
+ publish( msg );
+ }
+ catch ( Exception e )
+ {
+ LOG.debug( "An exception occurred when attempting to publish a ResourcePropertyValueChangeEvent:", e );
+
+ // TODO: *SJC* This is tricky, we may need to devise a List of Exceptions to collect any exceptions. The other thing to consider is where does the exception go?
+ }
+ }
+
+ /**
+ * This method is used to send a ManagementEvent to subscribers to this topic.
+ *
+ * precondition: The param ManagementEvent should be complete and not rely on
+ * any setters in this topic.
+ *
+ * @param me
+ */
+ public void publish( ManagementEvent me )
+ {
+ Object msg;
+ if ( me instanceof XmlObjectWrapper )
+ {
+ msg = ( (XmlObjectWrapper) me ).getXmlObject( );
+ }
+ else
+ {
+ msg = me;
+ }
+
+ try
+ {
+ publish( msg );
+ }
+ catch ( Exception e )
+ {
+ LOG.debug( "An Exception occurred when trying to publish a ManagementEvent: ", e );
+
+ // TODO: *SJC* This is tricky, we may need to devise a List of Exceptions to collect any exceptions. The other thing to consider is where does the exception go?
+ }
+ }
+
+ private XmlObject buildManagementEvent( ResourcePropertyValueChangeEvent event )
+ {
+ ManagementEventDocument me;
+ if ( m_propChangeManagementEvent != null )
+ {
+ me = (ManagementEventDocument) ( (XmlObjectWrapper) m_propChangeManagementEvent ).getXmlObject( );
+ }
+ else
+ {
+ 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,
+ ( (XmlObjectWrapper) event ).getXmlObject( ) );
+ return me;
+ }
+}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: muse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-dev-help@ws.apache.org