You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wsrf-dev@ws.apache.org by sc...@apache.org on 2004/12/20 20:52:21 UTC

svn commit: r122870 - /incubator/apollo/trunk/src/site/content/tutorial/src/example/filesystem/AbstractFileSystemResource.java /incubator/apollo/trunk/src/site/content/tutorial/src/example/filesystem/FileSystemResource.java

Author: scamp
Date: Mon Dec 20 11:52:19 2004
New Revision: 122870

URL: http://svn.apache.org/viewcvs?view=rev&rev=122870
Log:
made abstract class for FileSystemReosurce
Added:
   incubator/apollo/trunk/src/site/content/tutorial/src/example/filesystem/AbstractFileSystemResource.java
Modified:
   incubator/apollo/trunk/src/site/content/tutorial/src/example/filesystem/FileSystemResource.java

Added: incubator/apollo/trunk/src/site/content/tutorial/src/example/filesystem/AbstractFileSystemResource.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/site/content/tutorial/src/example/filesystem/AbstractFileSystemResource.java?view=auto&rev=122870
==============================================================================
--- (empty file)
+++ incubator/apollo/trunk/src/site/content/tutorial/src/example/filesystem/AbstractFileSystemResource.java	Mon Dec 20 11:52:19 2004
@@ -0,0 +1,123 @@
+/*=============================================================================*
+ *  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 example.filesystem;
+
+import org.apache.ws.resource.Resource;
+import org.apache.ws.resource.PropertiesInterface;
+import org.apache.ws.resource.properties.XmlBeansResourcePropertyUtils;
+import org.apache.ws.resource.properties.ResourcePropertySet;
+import org.apache.ws.resource.properties.impl.XmlBeansResourceProperty;
+import org.apache.ws.resource.lifetime.ScheduledResourceTerminationResource;
+import org.apache.ws.resource.lifetime.ResourceLifetime1_2Constants;
+
+import java.util.Calendar;
+
+
+public abstract class AbstractFileSystemResource implements Resource, PropertiesInterface, ScheduledResourceTerminationResource
+{
+    /**
+     * The resource ID of the instance.
+     */
+    String m_id;
+    /**
+    * The ResourceProperty Set containing the resource props.
+    */
+   ResourcePropertySet m_propSet;
+
+
+    /**
+     * Returns the current time from the prop set.
+     *
+     * @return Calendar
+     */
+    public Calendar getCurrentTime(  )
+    {
+       return XmlBeansResourcePropertyUtils.getDateTimeProperty( (XmlBeansResourceProperty)m_propSet.get( ResourceLifetime1_2Constants.PROP_QNAME_CURRENT_TIME ) );
+    }
+
+    /**
+    * DOCUMENT_ME
+    *
+    * @param id DOCUMENT_ME
+    */
+   public void setID( Object id )
+   {
+      if ( m_id != null )
+      {
+         throw new IllegalStateException( "This resource's ID has already been set." );
+      }
+
+      try
+      {
+         m_id = (String) id;
+      }
+      catch ( ClassCastException cce )
+      {
+         throw new IllegalArgumentException( "Specified ID is not a String." );
+      }
+   }
+
+    /**
+    * DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public Object getID(  )
+   {
+      return m_id;
+   }
+
+    /**
+    * @see org.apache.ws.resource.PropertiesInterface#setResourcePropertySet(org.apache.ws.resource.properties.ResourcePropertySet)
+    */
+   public void setResourcePropertySet( ResourcePropertySet propSet )
+   {
+      m_propSet = propSet;
+   }
+
+    /**
+    * @see org.apache.ws.resource.PropertiesInterface#getResourcePropertySet()
+    */
+   public ResourcePropertySet getResourcePropertySet(  )
+   {
+      return m_propSet;
+   }
+
+    /**
+    * DOCUMENT_ME
+    *
+    * @param time DOCUMENT_ME
+    */
+   public void setTerminationTime( Calendar time )
+   {
+      XmlBeansResourcePropertyUtils.setDateTimeProperty( (XmlBeansResourceProperty)getResourcePropertySet(  ).get(ResourceLifetime1_2Constants.PROP_QNAME_TERMINATION_TIME),
+                                                 time );
+   }
+
+    /**
+    * DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public Calendar getTerminationTime(  )
+   {
+      return XmlBeansResourcePropertyUtils.getDateTimeProperty( (XmlBeansResourceProperty) m_propSet.get( ResourceLifetime1_2Constants.PROP_QNAME_TERMINATION_TIME ) );
+   }
+
+    public abstract void destroy(  );
+
+    public abstract void init(  );
+}

Modified: incubator/apollo/trunk/src/site/content/tutorial/src/example/filesystem/FileSystemResource.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/site/content/tutorial/src/example/filesystem/FileSystemResource.java?view=diff&rev=122870&p1=incubator/apollo/trunk/src/site/content/tutorial/src/example/filesystem/FileSystemResource.java&r1=122869&p2=incubator/apollo/trunk/src/site/content/tutorial/src/example/filesystem/FileSystemResource.java&r2=122870
==============================================================================
--- incubator/apollo/trunk/src/site/content/tutorial/src/example/filesystem/FileSystemResource.java	(original)
+++ incubator/apollo/trunk/src/site/content/tutorial/src/example/filesystem/FileSystemResource.java	Mon Dec 20 11:52:19 2004
@@ -34,11 +34,14 @@
 import org.apache.ws.resource.example.filesystem.TypeDocument;
 import org.apache.ws.resource.lifetime.ResourceLifetime1_2Constants;
 import org.apache.ws.resource.lifetime.ScheduledResourceTerminationResource;
+import org.apache.ws.resource.lifetime.callback.CurrentTimeCallback;
 import org.apache.ws.resource.properties.ResourceProperty;
 import org.apache.ws.resource.properties.ResourcePropertySet;
 import org.apache.ws.resource.properties.XmlBeansResourcePropertyUtils;
 import org.apache.ws.resource.properties.impl.XmlBeansResourcePropertySet;
 import org.apache.ws.resource.properties.impl.XmlBeansResourceProperty;
+import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceLifetime12Draft01.CurrentTimeDocument;
+import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceLifetime12Draft01.TerminationTimeDocument;
 
 import java.util.Calendar;
 import java.util.List;
@@ -52,107 +55,16 @@
  * @author Ian P. Springer
  * @author Sal Campana
  */
-public class FileSystemResource
-   implements Resource,
-              PropertiesInterface,
-              ScheduledResourceTerminationResource
+public class FileSystemResource extends AbstractFileSystemResource
+
 {
    /**
     * This bean represents our "backend" for the resource.
     */
    private FileSystem m_fileSystem;
 
-   /**
-    * The resource ID of the instance.
-    */
-   String m_id;
-
-   /**
-    * The ResourceProperty Set containing the resource props.
-    */
-   ResourcePropertySet m_propSet;
-
-   /**
-    * Returns the current time from the prop set.
-    *
-    * @return Calendar
-    */
-   public Calendar getCurrentTime(  )
-   {
-      return XmlBeansResourcePropertyUtils.getDateTimeProperty( (XmlBeansResourceProperty)m_propSet.get( ResourceLifetime1_2Constants.PROP_QNAME_CURRENT_TIME ) );
-   }
-
-   /**
-    * DOCUMENT_ME
-    *
-    * @param id DOCUMENT_ME
-    */
-   public void setID( Object id )
-   {
-      if ( m_id != null )
-      {
-         throw new IllegalStateException( "This resource's ID has already been set." );
-      }
-
-      try
-      {
-         m_id = (String) id;
-      }
-      catch ( ClassCastException cce )
-      {
-         throw new IllegalArgumentException( "Specified ID is not a String." );
-      }
-   }
-
-   /**
-    * DOCUMENT_ME
-    *
-    * @return DOCUMENT_ME
-    */
-   public Object getID(  )
-   {
-      return m_id;
-   }
-
-   /**
-    * @see PropertiesInterface#setResourcePropertySet(org.apache.ws.resource.properties.ResourcePropertySet)
-    */
-   public void setResourcePropertySet( ResourcePropertySet propSet )
-   {
-      m_propSet = propSet;
-   }
-
-   /**
-    * @see org.apache.ws.resource.PropertiesInterface#getResourcePropertySet()
-    */
-   public ResourcePropertySet getResourcePropertySet(  )
-   {
-      return m_propSet;
-   }
-
-   /**
-    * DOCUMENT_ME
-    *
-    * @param time DOCUMENT_ME
-    */
-   public void setTerminationTime( Calendar time )
-   {
-      XmlBeansResourcePropertyUtils.setDateTimeProperty( getResourcePropertySet(  ),
-                                                 ResourceLifetime1_2Constants.PROP_QNAME_TERMINATION_TIME,
-                                                 time );
-   }
-
-   /**
-    * DOCUMENT_ME
-    *
-    * @return DOCUMENT_ME
-    */
-   public Calendar getTerminationTime(  )
-   {
-      return XmlBeansResourcePropertyUtils.getDateTimeProperty( (XmlBeansResourceProperty) m_propSet.get( ResourceLifetime1_2Constants.PROP_QNAME_TERMINATION_TIME ) );
-   }
 
-   /**
+    /**
     * DOCUMENT_ME
     */
    public void destroy(  )
@@ -224,6 +136,18 @@
       prop = m_propSet.get( FileSystemPropertyQNames.OPTIONS );
       prop.add( optionsDocXBean );
       prop.setCallback( new OptionsCallback( m_fileSystem ) );
+
+      prop = m_propSet.get( ResourceLifetime1_2Constants.PROP_QNAME_CURRENT_TIME );
+      CurrentTimeDocument currTime = CurrentTimeDocument.Factory.newInstance();
+      currTime.setCurrentTime(Calendar.getInstance());
+      prop.add(currTime);
+      prop.setCallback( new CurrentTimeCallback());
+
+      prop = m_propSet.get( ResourceLifetime1_2Constants.PROP_QNAME_TERMINATION_TIME );
+      TerminationTimeDocument termTime = TerminationTimeDocument.Factory.newInstance();
+      termTime.setNilTerminationTime();
+
+
    }
 
 }

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