Author: scamp
Date: Mon Aug  1 13:51:50 2005
New Revision: 226881

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

Modified:
    
webservices/muse/trunk/src/examples/filesystem/src/java/org/apache/ws/resource/example/filesystem/FilesystemResource.java
    
webservices/muse/trunk/src/examples/filesystem/src/java/org/apache/ws/resource/example/filesystem/FilesystemService.java

Modified: 
webservices/muse/trunk/src/examples/filesystem/src/java/org/apache/ws/resource/example/filesystem/FilesystemResource.java
URL: 
http://svn.apache.org/viewcvs/webservices/muse/trunk/src/examples/filesystem/src/java/org/apache/ws/resource/example/filesystem/FilesystemResource.java?rev=226881&r1=226880&r2=226881&view=diff
==============================================================================
--- 
webservices/muse/trunk/src/examples/filesystem/src/java/org/apache/ws/resource/example/filesystem/FilesystemResource.java
 (original)
+++ 
webservices/muse/trunk/src/examples/filesystem/src/java/org/apache/ws/resource/example/filesystem/FilesystemResource.java
 Mon Aug  1 13:51:50 2005
@@ -1,7 +1,5 @@
 package org.apache.ws.resource.example.filesystem;

 

-import org.apache.ws.muws.MuwsUtils;

-

 

 /**

  * **** NOTE: This file will not be overwritten during generation ****

@@ -125,7 +123,7 @@
              * MUWS-defined properties.

              */

             // init the 
{http://docs.oasis-open.org/wsdm/2004/12/muws/wsdm-muws-part1.xsd}ResourceId 
resource property

-            MuwsUtils.initResourceIdProperty(this);

+            org.apache.ws.muws.MuwsUtils.initResourceIdProperty(this);

             // NOTE: it's not necessary to add a property change listener, 
since the ResourceId prop is immutable

 

             // init the 
{http://docs.oasis-open.org/wsdm/2004/12/muws/wsdm-muws-part1.xsd}ManageabilityCapability
 resource property

@@ -151,6 +149,9 @@
 

             // init the 
{http://docs.oasis-open.org/wsdm/2004/12/muws/wsdm-muws-part2.xsd}OperationalStatus
 resource property

             resourceProperty = resourcePropertySet.get( 
FilesystemPropertyQNames.OPERATIONALSTATUS );

+            
org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.OperationalStatusDocument 
statusDoc = 
org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.OperationalStatusDocument.Factory.newInstance();

+            statusDoc.setOperationalStatus( 
org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.OperationalStatusDocument.OperationalStatus.AVAILABLE
 );

+            resourceProperty.add(statusDoc);

             resourceProperty.setCallback( new 
example.filesystem.callback.OperationalStatusCallback( m_filesystem ) );

             resourceProperty.addChangeListener( 
operationalStatusCapabilityTopic ); // add for property-value-changed 
management events

 


Modified: 
webservices/muse/trunk/src/examples/filesystem/src/java/org/apache/ws/resource/example/filesystem/FilesystemService.java
URL: 
http://svn.apache.org/viewcvs/webservices/muse/trunk/src/examples/filesystem/src/java/org/apache/ws/resource/example/filesystem/FilesystemService.java?rev=226881&r1=226880&r2=226881&view=diff
==============================================================================
--- 
webservices/muse/trunk/src/examples/filesystem/src/java/org/apache/ws/resource/example/filesystem/FilesystemService.java
 (original)
+++ 
webservices/muse/trunk/src/examples/filesystem/src/java/org/apache/ws/resource/example/filesystem/FilesystemService.java
 Mon Aug  1 13:51:50 2005
@@ -1,88 +1,107 @@
 package org.apache.ws.resource.example.filesystem;

 

+import org.apache.ws.notification.base.NotificationProducerResource;

 import org.apache.ws.resource.ResourceContext;

 import org.apache.xmlbeans.XmlObject;

-import org.apache.xmlbeans.XmlException;

-

-import javax.xml.rpc.JAXRPCException;

+import 
org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.OperationalStatusDocument;

 

 /**

  * **** NOTE: This file will not be overwritten during generation ****

- *

+ * <p/>

  * 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.

- *

+ * <p/>

  * NOTE: This class is generated. However, it will not be overwritten by 
subsequent

- *       calls to the code generator.

- *

+ * calls to the code generator.

  */

 public class FilesystemService

-   extends AbstractFilesystemService

-   implements FilesystemCustomOperationsPortType

+        extends AbstractFilesystemService

+        implements FilesystemCustomOperationsPortType

 {

 

 

-   /**

-    * 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 [EMAIL PROTECTED] FilesystemService } object.

-    *

-    * @param resourceContext DOCUMENT_ME

-    */

-   public FilesystemService( 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;

-   }

+    /**

+     * 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 [EMAIL PROTECTED] FilesystemService } object.

+     *

+     * @param resourceContext DOCUMENT_ME

+     */

+    public FilesystemService(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;

+    }

 

-    public org.apache.ws.resource.example.filesystem.UnmountResponseDocument 
unmount(

-            org.apache.ws.resource.example.filesystem.UnmountDocument 
requestDoc )

+    public org.apache.ws.resource.example.filesystem.UnmountResponseDocument 
unmount(org.apache.ws.resource.example.filesystem.UnmountDocument requestDoc)

             throws 
org.apache.ws.resource.example.filesystem.MountDeviceBusyFaultException

     {

         try

         {

-            ( (FilesystemResource) getResource() ).unmount();

+            ((FilesystemResource) getResource()).unmount();

+            
updateOperationalStatus(OperationalStatusDocument.OperationalStatus.UNAVAILABLE);

         }

-        catch ( Exception e )

+        catch (Exception e)

         {

-            throw new MountDeviceBusyFaultException( getNamespaceSet(), 
e.getLocalizedMessage() );

+            throw new MountDeviceBusyFaultException(getNamespaceSet(), 
e.getLocalizedMessage());

         }

         org.apache.ws.resource.example.filesystem.UnmountResponseDocument 
responseDocument = 
org.apache.ws.resource.example.filesystem.UnmountResponseDocument.Factory.newInstance();

         
org.apache.ws.resource.example.filesystem.UnmountResponseDocument.UnmountResponse
 response = responseDocument.addNewUnmountResponse();

         return responseDocument;

     }

 

-    public org.apache.ws.resource.example.filesystem.MountResponseDocument 
mount(

-            org.apache.ws.resource.example.filesystem.MountDocument requestDoc 
)

+    public org.apache.ws.resource.example.filesystem.MountResponseDocument 
mount(org.apache.ws.resource.example.filesystem.MountDocument requestDoc)

             throws 
org.apache.ws.resource.example.filesystem.MountDeviceBusyFaultException

     {

         try

         {

-            ( (FilesystemResource) getResource() ).mount();

+            ((FilesystemResource) getResource()).mount();

+            
updateOperationalStatus(OperationalStatusDocument.OperationalStatus.AVAILABLE);

         }

-        catch ( Exception e )

+        catch (Exception e)

         {

-            throw new MountDeviceBusyFaultException( getNamespaceSet(), 
e.getLocalizedMessage() );

+            throw new MountDeviceBusyFaultException(getNamespaceSet(), 
e.getLocalizedMessage());

         }

         org.apache.ws.resource.example.filesystem.MountResponseDocument 
responseDocument = 
org.apache.ws.resource.example.filesystem.MountResponseDocument.Factory.newInstance();

         
org.apache.ws.resource.example.filesystem.MountResponseDocument.MountResponse 
response = responseDocument.addNewMountResponse();

         return responseDocument;

     }

 

+    /**

+     * Updates the OperationalStatus resourceproperty

+     *

+     * @param newStatus  The status to which the property should be set/

+     */

+    public void 
updateOperationalStatus(OperationalStatusDocument.OperationalStatus.Enum 
newStatus)

+    {

+        NotificationProducerResource resource = 
(NotificationProducerResource)getResource();

+        org.apache.ws.resource.properties.ResourceProperty statusProp = 
resource.getResourcePropertySet().get(FilesystemPropertyQNames.OPERATIONALSTATUS);

+        
org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.OperationalStatusDocument.OperationalStatus
 currentStatus = 
(org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.OperationalStatusDocument.OperationalStatus)
 statusProp.get(0);

+        if (!currentStatus.enumValue().equals(newStatus))

+        {

+            XmlObject oldStatus = 
org.apache.ws.util.XmlBeanUtils.copyXmlBean(currentStatus);

+            currentStatus.set(newStatus);

+            org.apache.ws.notification.topics.TopicSpace muwsTopicSpace = 
resource.getTopicSpaceSet().getTopicSpace(org.apache.ws.muws.v1_0.MuwsConstants.NSURI_MUWS_PART2_TOPICS);

+            
org.apache.ws.muws.v1_0.topics.impl.XmlBeansManagementEventTopicImpl 
statusTopic = 
(org.apache.ws.muws.v1_0.topics.impl.XmlBeansManagementEventTopicImpl) 
muwsTopicSpace.getTopic(org.apache.ws.muws.v1_0.capability.OperationalStatusCapability.TOPIC_NAME);

+            org.apache.ws.resource.properties.ResourcePropertyValueChangeEvent 
statusChangeEvent = new 
org.apache.ws.resource.properties.v2004_06.impl.XmlBeansResourcePropertyValueChangeEvent(new
 Object[]{oldStatus}, new Object[]{currentStatus});

+            statusTopic.propertyChanged(statusChangeEvent);  // publish the 
event

+        }

+        return;

+    }

 }




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

Reply via email to