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 ip...@apache.org on 2004/12/20 19:34:08 UTC

svn commit: r122863 - in incubator/apollo/trunk/src: java/org/apache/ws/resource/lifetime/callback java/org/apache/ws/resource/properties site/content/tutorial/src/example/filesystem

Author: ips
Date: Mon Dec 20 10:34:04 2004
New Revision: 122863

URL: http://svn.apache.org/viewcvs?view=rev&rev=122863
Log:
added Callback impl for wsrl:CurrentTime

Added:
   incubator/apollo/trunk/src/java/org/apache/ws/resource/lifetime/callback/
   incubator/apollo/trunk/src/java/org/apache/ws/resource/lifetime/callback/CurrentTimeCallback.java
   incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/XmlBeansResourcePropertyUtils.java
      - copied, changed from r122855, incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/ResourcePropertyUtils.java
Removed:
   incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/ResourcePropertyUtils.java
Modified:
   incubator/apollo/trunk/src/site/content/tutorial/src/example/filesystem/FileSystemResource.java

Added: incubator/apollo/trunk/src/java/org/apache/ws/resource/lifetime/callback/CurrentTimeCallback.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/lifetime/callback/CurrentTimeCallback.java?view=auto&rev=122863
==============================================================================
--- (empty file)
+++ incubator/apollo/trunk/src/java/org/apache/ws/resource/lifetime/callback/CurrentTimeCallback.java	Mon Dec 20 10:34:04 2004
@@ -0,0 +1,40 @@
+/*=============================================================================*
+ *  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.resource.lifetime.callback;
+
+import org.apache.ws.resource.properties.ResourcePropertyCallback;
+import org.apache.ws.resource.properties.ResourceProperty;
+import org.apache.ws.resource.properties.XmlBeansResourcePropertyUtils;
+import org.apache.ws.resource.properties.impl.XmlBeansResourceProperty;
+
+import java.util.Calendar;
+
+/**
+ * A callback for the WSRF-RL CurrentTime property - assumes the property is implemented
+ * as an XMLBean.
+ *
+ * @author Ian Springer
+ */
+public class CurrentTimeCallback implements ResourcePropertyCallback
+{
+
+    public ResourceProperty refreshProperty( ResourceProperty prop )
+    {
+        XmlBeansResourcePropertyUtils.setDateTimeProperty( (XmlBeansResourceProperty)prop, Calendar.getInstance( ) );
+        return prop;
+    }
+
+}

Deleted: /incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/ResourcePropertyUtils.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/ResourcePropertyUtils.java?view=auto&rev=122862
==============================================================================

Copied: incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/XmlBeansResourcePropertyUtils.java (from r122855, incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/ResourcePropertyUtils.java)
Url: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/XmlBeansResourcePropertyUtils.java?view=diff&rev=122863&p1=incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/ResourcePropertyUtils.java&r1=122855&p2=incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/XmlBeansResourcePropertyUtils.java&r2=122863
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/ResourcePropertyUtils.java	(original)
+++ incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/XmlBeansResourcePropertyUtils.java	Mon Dec 20 10:34:04 2004
@@ -15,68 +15,48 @@
  *=============================================================================*/
 package org.apache.ws.resource.properties;
 
-import org.apache.xmlbeans.XmlDateTime;
-import org.apache.commons.logging.LogFactory;
 import org.apache.commons.logging.Log;
-import org.apache.ws.resource.i18n.MessagesImpl;
+import org.apache.commons.logging.LogFactory;
 import org.apache.ws.resource.i18n.Keys;
+import org.apache.ws.resource.i18n.MessagesImpl;
+import org.apache.ws.resource.properties.impl.XmlBeansResourceProperty;
 import org.apache.ws.util.i18n.Messages;
+import org.apache.xmlbeans.XmlDateTime;
 
-import javax.xml.namespace.QName;
 import javax.xml.rpc.JAXRPCException;
 import java.util.Calendar;
 
 /**
- * LOG-DONE
- * TODO
+ * LOG-DONE TODO
  *
  * @author Ian P. Springer (Hewlett-Packard Company)
  */
-public abstract class ResourcePropertyUtils
+public abstract class XmlBeansResourcePropertyUtils
 {
-    private static final Log LOG = LogFactory.getLog( ResourcePropertyUtils.class );
+    private static final Log LOG = LogFactory.getLog( XmlBeansResourcePropertyUtils.class );
     public static final Messages MSG = MessagesImpl.getInstance();
-   /**
-    * DOCUMENT_ME
-    *
-    * @param propSet  DOCUMENT_ME
-    * @param propName DOCUMENT_ME
-    * @param time     DOCUMENT_ME
-    */
-   public static void setDateTimeProperty( ResourcePropertySet propSet,
-                                           QName               propName,
-                                           Calendar            time )
-   {
-      LOG.debug(MSG.getMessage( Keys.SET_PROP_TIME,propName,time.toString()));
-      XmlDateTime propElem = getDateTimePropertyElement( propSet, propName );
-      propElem.setCalendarValue( time );
-   }
-
-   /**
-    * DOCUMENT_ME
-    *
-    * @param propSet  DOCUMENT_ME
-    * @param propName DOCUMENT_ME
-    *
-    * @return DOCUMENT_ME
-    */
-   public static Calendar getDateTimeProperty( ResourcePropertySet propSet,
-                                               QName               propName )
-   {
-      XmlDateTime propElem = getDateTimePropertyElement( propSet, propName );
-      return propElem.getCalendarValue(  );
-   }
-
-   private static XmlDateTime getDateTimePropertyElement( ResourcePropertySet propSet,
-                                                          QName               propName )
-   {
-      ResourceProperty prop = propSet.get( propName );
-      if ( ( prop == null ) || prop.isEmpty(  ) )
-      {
-         throw new JAXRPCException( MSG.getMessage( Keys.PROP_NOT_DEFINED,propName));
-      }
-
-      XmlDateTime propElem = (XmlDateTime) prop.get( 0 );
-      return propElem;
-   }
+
+    public static void setDateTimeProperty( XmlBeansResourceProperty prop,
+                                            Calendar time )
+    {
+        LOG.debug( MSG.getMessage( Keys.SET_PROP_TIME, prop.getMetaData().getName(), time.toString() ) );
+        XmlDateTime propElem = getDateTimePropertyElement( prop );
+        propElem.setCalendarValue( time );
+    }
+
+    public static Calendar getDateTimeProperty( XmlBeansResourceProperty prop )
+    {
+        return getDateTimePropertyElement( prop ).getCalendarValue();
+    }
+
+    private static XmlDateTime getDateTimePropertyElement( XmlBeansResourceProperty prop )
+    {
+        if ( ( prop == null ) || prop.isEmpty() )
+        {
+            throw new JAXRPCException( MSG.getMessage( Keys.PROP_NOT_DEFINED, prop.getMetaData().getName() ) );
+        }
+
+        XmlDateTime propElem = (XmlDateTime) prop.get( 0 );
+        return propElem;
+    }
 }

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=122863&p1=incubator/apollo/trunk/src/site/content/tutorial/src/example/filesystem/FileSystemResource.java&r1=122862&p2=incubator/apollo/trunk/src/site/content/tutorial/src/example/filesystem/FileSystemResource.java&r2=122863
==============================================================================
--- 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 10:34:04 2004
@@ -36,8 +36,10 @@
 import org.apache.ws.resource.lifetime.ScheduledResourceTerminationResource;
 import org.apache.ws.resource.properties.ResourceProperty;
 import org.apache.ws.resource.properties.ResourcePropertySet;
-import org.apache.ws.resource.properties.ResourcePropertyUtils;
+import org.apache.ws.resource.properties.XmlBeansResourcePropertyUtils;
 import org.apache.ws.resource.properties.impl.XmlBeansResourcePropertySet;
+import org.apache.ws.resource.properties.impl.XmlBeansResourceProperty;
+
 import java.util.Calendar;
 import java.util.List;
 import java.util.Map;
@@ -77,8 +79,7 @@
     */
    public Calendar getCurrentTime(  )
    {
-      return ResourcePropertyUtils.getDateTimeProperty( getResourcePropertySet(  ),
-                                                        ResourceLifetime1_2Constants.PROP_QNAME_CURRENT_TIME );
+      return XmlBeansResourcePropertyUtils.getDateTimeProperty( (XmlBeansResourceProperty)m_propSet.get( ResourceLifetime1_2Constants.PROP_QNAME_CURRENT_TIME ) );
    }
 
    /**
@@ -136,7 +137,7 @@
     */
    public void setTerminationTime( Calendar time )
    {
-      ResourcePropertyUtils.setDateTimeProperty( getResourcePropertySet(  ),
+      XmlBeansResourcePropertyUtils.setDateTimeProperty( getResourcePropertySet(  ),
                                                  ResourceLifetime1_2Constants.PROP_QNAME_TERMINATION_TIME,
                                                  time );
    }
@@ -148,8 +149,7 @@
     */
    public Calendar getTerminationTime(  )
    {
-      return ResourcePropertyUtils.getDateTimeProperty( getResourcePropertySet(  ),
-                                                        ResourceLifetime1_2Constants.PROP_QNAME_TERMINATION_TIME );
+      return XmlBeansResourcePropertyUtils.getDateTimeProperty( (XmlBeansResourceProperty) m_propSet.get( ResourceLifetime1_2Constants.PROP_QNAME_TERMINATION_TIME ) );
    }
 
    /**
@@ -226,13 +226,4 @@
       prop.setCallback( new OptionsCallback( m_fileSystem ) );
    }
 
-   /**
-    * DOCUMENT_ME
-    */
-   public void refreshCurrentTime(  )
-   {
-      ResourcePropertyUtils.setDateTimeProperty( getResourcePropertySet(  ),
-                                                 ResourceLifetime1_2Constants.PROP_QNAME_CURRENT_TIME,
-                                                 Calendar.getInstance(  ) );
-   }
 }

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