You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pubscribe-commits@ws.apache.org by ip...@apache.org on 2005/07/28 21:06:51 UTC

svn commit: r225853 - /webservices/pubscribe/trunk/src/examples/filesystem/src/java/org/apache/ws/resource/example/filesystem/FilesystemResource.java

Author: ips
Date: Thu Jul 28 12:06:50 2005
New Revision: 225853

URL: http://svn.apache.org/viewcvs?rev=225853&view=rev
Log:
removed call to TopicUtils#initNotifProducerProps() in init()


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

Modified: webservices/pubscribe/trunk/src/examples/filesystem/src/java/org/apache/ws/resource/example/filesystem/FilesystemResource.java
URL: http://svn.apache.org/viewcvs/webservices/pubscribe/trunk/src/examples/filesystem/src/java/org/apache/ws/resource/example/filesystem/FilesystemResource.java?rev=225853&r1=225852&r2=225853&view=diff
==============================================================================
--- webservices/pubscribe/trunk/src/examples/filesystem/src/java/org/apache/ws/resource/example/filesystem/FilesystemResource.java (original)
+++ webservices/pubscribe/trunk/src/examples/filesystem/src/java/org/apache/ws/resource/example/filesystem/FilesystemResource.java Thu Jul 28 12:06:50 2005
@@ -1,9 +1,8 @@
-
 package org.apache.ws.resource.example.filesystem;
 
 /**
  * **** NOTE: This file will not be overwritten during generation ****
- *
+ * <p/>
  * A Filesystem WS-Resource.
  * <p/>
  * NOTE: This class is generated but IS meant to be modified.
@@ -12,143 +11,148 @@
 
 {
 
-        /**
-     * A NamespaceVerionHolder which maintains the QNames of Spec Wsdls
+    /**
+     * A NamespaceVerionHolder which maintains the XML namespaces for all specifications supported by this resource.
      */
     public static final org.apache.ws.notification.base.v2004_06.impl.WsnNamespaceVersionHolderImpl SPEC_NAMESPACE_SET = new org.apache.ws.notification.base.v2004_06.impl.WsnNamespaceVersionHolderImpl();
 
+    private example.filesystem.backend.FileSystem m_filesystem;
+
     /**
      * Initializes this resource's state (properties, etc.).
      */
     public void init()
-	    {
+    {
 
-	        super.init();
+        super.init();
+
+        /*
+         * This is where you should associate the backend instance with
+         * the resource instance for a given id.
+         */
+        m_filesystem = new example.filesystem.backend.UnixFileSystem( m_id );
+
+        /*
+         * The resource property set which contains all of resource properties that were defined in the WSDL.
+         */
+        org.apache.ws.resource.properties.ResourcePropertySet resourcePropertySet = getResourcePropertySet();
+        org.apache.ws.resource.properties.ResourceProperty resourceProperty = null;
+
+        try
+        {
+            /*
+             * Initialize each of our properties by calling resourceProperty.add(propElem) and/or resourceProperty.setCallback(callback)...
+             */
+            resourceProperty = resourcePropertySet.get( FilesystemPropertyQNames.DEVICESPECIALFILE );
+            DeviceSpecialFileDocument deviceDocXBean = DeviceSpecialFileDocument.Factory.newInstance();
+            deviceDocXBean.setDeviceSpecialFile( m_filesystem.getDeviceSpecialFile() );
+            resourceProperty.add( deviceDocXBean );
+
+            resourceProperty = resourcePropertySet.get( FilesystemPropertyQNames.TYPE );
+            TypeDocument typeDocXBean = TypeDocument.Factory.newInstance();
+            typeDocXBean.setType( m_filesystem.getType() );
+            resourceProperty.add( typeDocXBean );
+
+            BackupFrequencyDocument backupDocXBean = BackupFrequencyDocument.Factory.newInstance();
+            backupDocXBean.setBackupFrequency( m_filesystem.getBackupFrequency() );
+            resourceProperty = resourcePropertySet.get( FilesystemPropertyQNames.BACKUPFREQUENCY );
+            resourceProperty.add( backupDocXBean );
+            resourceProperty.setCallback( new example.filesystem.callback.BackupFrequencyCallback( m_filesystem ) );
+
+            CommentDocument commentDocXBean = CommentDocument.Factory.newInstance();
+            commentDocXBean.setComment( m_filesystem.getComment() );
+            resourceProperty = resourcePropertySet.get( FilesystemPropertyQNames.COMMENT );
+            resourceProperty.add( commentDocXBean );
+            resourceProperty.setCallback( new example.filesystem.callback.CommentCallback( m_filesystem ) );
+
+            FsckPassNumberDocument fsckDocXBean = FsckPassNumberDocument.Factory.newInstance();
+            fsckDocXBean.setFsckPassNumber( m_filesystem.getFsckPassNumber() );
+            resourceProperty = resourcePropertySet.get( FilesystemPropertyQNames.FSCKPASSNUMBER );
+            resourceProperty.add( fsckDocXBean );
+            resourceProperty.setCallback( new example.filesystem.callback.FsckPassNumberCallback( m_filesystem ) );
+
+            MountPointDirectoryDocument mountPointDocXBean = MountPointDirectoryDocument.Factory.newInstance();
+            mountPointDocXBean.setMountPointDirectory( m_filesystem.getMountPoint() );
+            resourceProperty = resourcePropertySet.get( FilesystemPropertyQNames.MOUNTPOINTDIRECTORY );
+            resourceProperty.add( mountPointDocXBean );
+            resourceProperty.setCallback( new example.filesystem.callback.MountPointCallback( m_filesystem ) );
+
+            OptionsDocument optionsDocXBean =
+                    OptionsDocument.Factory.newInstance();
+            org.apache.ws.resource.example.filesystem.OptionsDocument.Options options =
+                    optionsDocXBean.addNewOptions();
+            java.util.List backendOptions =
+                    m_filesystem.getOptions();
+            for ( int i = 0; i < backendOptions.size(); i++ )
+            {
+                options.addOption( (String) backendOptions.get( i ) );
+            }
+
+            resourceProperty = resourcePropertySet.get( FilesystemPropertyQNames.OPTIONS );
+            resourceProperty.add( optionsDocXBean );
+            resourceProperty.setCallback( new example.filesystem.callback.OptionsCallback( m_filesystem ) );
+        }
+        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/wsrf/2004/06/wsrf-WS-ResourceLifetime-1.2-draft-01.xsd}TerminationTime is implemented by the framework.
+        // Resource Property {http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceLifetime-1.2-draft-01.xsd}CurrentTime is implemented by the framework.
+        // 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.
+
+        /**
+         * This method enables the ResourceTermination Topic for notifications
+         * about this resource's termination.  If you would not like this
+         * behaviour either comment or remove the line of code.
+         */
+        try
+        {
+            org.apache.ws.notification.topics.util.TopicUtils.addResourceTerminationTopic( getTopicSpaceSet(), this,
+                    SPEC_NAMESPACE_SET );
+        }
+        catch ( Exception e )
+        {
+            throw new javax.xml.rpc.JAXRPCException(
+                    "Unable to init the ResourceTermination topic. Cause: " + e.getLocalizedMessage(), e );
+        }
+
+        /**
+         * This method call will make all resource properties be exposed
+         * as Topics.  If you would like to change that behaviour you can
+         * call TopicUtils.addResourcePropertyValueChangeTopic for each
+         * Topic you'd like to expose property change notifications for.
+         */
+        try
+        {
+            org.apache.ws.notification.topics.util.TopicUtils.addResourcePropertyValueChangeTopics(
+                    getResourcePropertySet(), getTopicSpaceSet() );
+        }
+        catch ( Exception e )
+        {
+            throw new javax.xml.rpc.JAXRPCException(
+                    "Unable to init the ResourceProperty Changed topics. Cause: " + e.getLocalizedMessage(), e );
+        }
+
+    }
+
+    public void mount() throws Exception
+    {
+        m_filesystem.mount();
+    }
+
+    public void unmount() throws Exception
+    {
+        m_filesystem.unmount();
+    }
+
+    public boolean isMounted()
+    {
+        return m_filesystem.isMounted();
+    }
 
-	      /**
-	       * The ResourcePropertySet which contains all the defined ResourceProperties
-	       */
-	      org.apache.ws.resource.properties.ResourcePropertySet resourcePropertySet = getResourcePropertySet();
-	      org.apache.ws.resource.properties.ResourceProperty resourceProperty = null;
-
-
-
-	        /*
-	         * This is where you should associate the backend instance with
-	         * the resource instance for a given id.
-	         */
-	        example.filesystem.backend.FileSystem m_fileSystem = new example.filesystem.backend.UnixFileSystem( m_id );
-
-	      try{
-	        /*
-	         * Initialize each of our properties by calling resourceProperty.add(propElem) and/or resourceProperty.setCallback(callback)...
-	         */
-	        resourceProperty = resourcePropertySet.get( FilesystemPropertyQNames.DEVICESPECIALFILE );
-	        DeviceSpecialFileDocument deviceDocXBean = DeviceSpecialFileDocument.Factory.newInstance();
-	        deviceDocXBean.setDeviceSpecialFile( m_fileSystem.getDeviceSpecialFile() );
-	        resourceProperty.add( deviceDocXBean );
-
-	        resourceProperty = resourcePropertySet.get( FilesystemPropertyQNames.TYPE );
-	        TypeDocument typeDocXBean = TypeDocument.Factory.newInstance();
-	        typeDocXBean.setType( m_fileSystem.getType() );
-	        resourceProperty.add( typeDocXBean );
-
-	        BackupFrequencyDocument backupDocXBean = BackupFrequencyDocument.Factory.newInstance();
-	        backupDocXBean.setBackupFrequency( m_fileSystem.getBackupFrequency() );
-	        resourceProperty = resourcePropertySet.get( FilesystemPropertyQNames.BACKUPFREQUENCY );
-	        resourceProperty.add( backupDocXBean );
-	        resourceProperty.setCallback( new example.filesystem.callback.BackupFrequencyCallback( m_fileSystem ) );
-
-	        CommentDocument commentDocXBean = CommentDocument.Factory.newInstance();
-	        commentDocXBean.setComment( m_fileSystem.getComment() );
-	        resourceProperty = resourcePropertySet.get( FilesystemPropertyQNames.COMMENT );
-	        resourceProperty.add( commentDocXBean );
-	        resourceProperty.setCallback( new example.filesystem.callback.CommentCallback( m_fileSystem ) );
-
-	        FsckPassNumberDocument fsckDocXBean = FsckPassNumberDocument.Factory.newInstance();
-	        fsckDocXBean.setFsckPassNumber( m_fileSystem.getFsckPassNumber() );
-	        resourceProperty = resourcePropertySet.get( FilesystemPropertyQNames.FSCKPASSNUMBER );
-	        resourceProperty.add( fsckDocXBean );
-	        resourceProperty.setCallback( new example.filesystem.callback.FsckPassNumberCallback( m_fileSystem ) );
-
-	        MountPointDirectoryDocument mountPointDocXBean = MountPointDirectoryDocument.Factory.newInstance();
-	        mountPointDocXBean.setMountPointDirectory( m_fileSystem.getMountPoint() );
-	        resourceProperty = resourcePropertySet.get( FilesystemPropertyQNames.MOUNTPOINTDIRECTORY );
-	        resourceProperty.add( mountPointDocXBean );
-	        resourceProperty.setCallback( new example.filesystem.callback.MountPointCallback( m_fileSystem ) );
-
-	        OptionsDocument optionsDocXBean =
-	                OptionsDocument.Factory.newInstance();
-	        org.apache.ws.resource.example.filesystem.OptionsDocument.Options options =
-	                optionsDocXBean.addNewOptions();
-	        java.util.List backendOptions =
-	                m_fileSystem.getOptions();
-	        for ( int i = 0; i < backendOptions.size(); i++ )
-	        {
-	            options.addOption( (String) backendOptions.get( i ) );
-	        }
-
-	        resourceProperty = resourcePropertySet.get( FilesystemPropertyQNames.OPTIONS );
-	        resourceProperty.add( optionsDocXBean );
-	        resourceProperty.setCallback( new example.filesystem.callback.OptionsCallback( m_fileSystem ) );
-	      }
-	   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/wsrf/2004/06/wsrf-WS-ResourceLifetime-1.2-draft-01.xsd}TerminationTime is implemented by the framework.
-	      // Resource Property {http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceLifetime-1.2-draft-01.xsd}CurrentTime is implemented by the framework.
-	      // 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.
-
-
-
-	   /**
-	    * This method enables the ResourceTermination Topic for notifications
-	    * about this resource's termination.  If you would not like this
-	    * behaviour either comment or remove the line of code.
-	    */
-	   try
-	   {
-	   org.apache.ws.notification.topics.util.TopicUtils.addResourceTerminationTopic( getTopicSpaceSet(), this, SPEC_NAMESPACE_SET );
-	   }
-	   catch (Exception e)
-	   {
-	   throw new javax.xml.rpc.JAXRPCException("Unable to init the ResourceTermination topic. Cause: " + e.getLocalizedMessage(), e);
-	   }
-	   /**
-	    * This method call will make all resource properties be exposed
-	    * as Topics.  If you would like to change that behaviour you can
-	    * call TopicUtils.addResourcePropertyValueChangeTopic for each
-	    * Topic you'd like to expose property change notifications for.
-	    */
-	   try
-	   {
-	   org.apache.ws.notification.topics.util.TopicUtils.addResourcePropertyValueChangeTopics( getResourcePropertySet(), getTopicSpaceSet() );
-	   }
-	   catch (Exception e)
-	   {
-	   throw new javax.xml.rpc.JAXRPCException("Unable to init the ResourceProperty Changed topics. Cause: " + e.getLocalizedMessage(), e);
-	   }
-
-	            /**
-	     * Initializes the Topic, TopicExpressionDialects and FixedTopicSet resource properties
-	     *
-	     * </br>
-	     * <strong>NOTE this MUST be called last in the Resource.init() method to ensure all topics get registered</strong>
-	     * </br>
-	     * FixedTopicSet will be set based on the value returned from the {@see TopicSpaceSet#isFixed()} method.
-	     * </br>
-	     * Topic will have all root topics in the TopicSpaceSet, set to Simple dialect AND all child topics set ot
-	     * Concrete dialect.
-	     * </br>
-	     *
-	     * TopicExpressionDialects will be set to the engine's known Topic Dialects acquired from the TopicExpressionEngine
-	     *
-	     * @param topicSpaceSet
-	     * @param propSet
-	     */
-	        org.apache.ws.notification.topics.util.TopicUtils.initNotificationProducerProperties(getTopicSpaceSet() , getResourcePropertySet());
-  }
 }