You are viewing a plain text version of this content. The canonical link for it is here.
Posted to muse-commits@ws.apache.org by sc...@apache.org on 2006/06/02 19:33:13 UTC

svn commit: r411218 [13/34] - in /webservices/muse: branches/1.0/ branches/1.0/src/examples/broker/ branches/1.0/src/examples/broker/WEB-INF/ branches/1.0/src/examples/consumer/ branches/1.0/src/examples/consumer/epr/ branches/1.0/src/examples/consumer...

Added: webservices/muse/branches/1.0/src/java/org/apache/ws/resource/impl/ResourceDefinitionImpl.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/resource/impl/ResourceDefinitionImpl.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/resource/impl/ResourceDefinitionImpl.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/resource/impl/ResourceDefinitionImpl.java Fri Jun  2 10:32:46 2006
@@ -0,0 +1,138 @@
+/*=============================================================================*
+ *  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.impl;
+
+import org.apache.ws.resource.InvalidWsrfWsdlException;
+import org.apache.ws.resource.ResourceDefinition;
+import javax.wsdl.Binding;
+import javax.wsdl.Definition;
+import javax.wsdl.Port;
+import javax.wsdl.PortType;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.soap.SOAPAddress;
+import java.net.URL;
+import java.util.List;
+
+/**
+ * A {@link ResourceDefinition} implementation.
+ *
+ * @author Ian Springer (ian DOT springer AT hp DOT com)
+ */
+public class ResourceDefinitionImpl
+   extends ResourceCapabilityImpl
+   implements ResourceDefinition
+{
+   private Port   m_port;
+   private String m_name;
+   private String m_endpointURL;
+
+   /**
+    * Creates a new {@link ResourceDefinitionImpl} object.
+    *
+    * @param def DOCUMENT_ME
+    * @param port DOCUMENT_ME
+    * @param baseUrl DOCUMENT_ME
+    *
+    * @throws InvalidWsrfWsdlException DOCUMENT_ME
+    */
+   public ResourceDefinitionImpl( Definition      def,
+                                  javax.wsdl.Port port,
+                                  URL             baseUrl )
+   throws InvalidWsrfWsdlException
+   {
+      super( def,
+             getResourcePortType( port ), baseUrl );
+      m_port           = port;
+      m_name           = port.getName(  );
+      m_endpointURL    = extractEndpointURL( m_port );
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public String getEndpointURL(  )
+   {
+      return m_endpointURL;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public String getName(  )
+   {
+      return m_name;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public Port getPort(  )
+   {
+      return m_port;
+   }
+
+   private static PortType getResourcePortType( Port port )
+   throws InvalidWsrfWsdlException
+   {
+      Binding binding = port.getBinding(  );
+      if ( binding != null )
+      {
+         PortType portType = binding.getPortType(  );
+         if ( portType == null )
+         {
+            throw new InvalidWsrfWsdlException( "The binding has no portType associated with it!" );
+         }
+
+         return portType;
+      }
+      else
+      {
+         throw new InvalidWsrfWsdlException( "The port has no binding associated with it!" );
+      }
+   }
+
+   private String extractEndpointURL( Port port )
+   throws InvalidWsrfWsdlException
+   {
+      String endpointURL = null;
+
+      List   extElems = port.getExtensibilityElements(  );
+      for ( int i = 0; i < extElems.size(  ); i++ )
+      {
+         ExtensibilityElement extElem = (ExtensibilityElement) extElems.get( i );
+         if ( extElem instanceof SOAPAddress )
+         {
+            SOAPAddress soapAddr = (SOAPAddress) extElem;
+            endpointURL = soapAddr.getLocationURI(  );
+            break;
+         }
+      }
+
+      if ( endpointURL == null )
+      {
+         throw new InvalidWsrfWsdlException( "Failed to obtain service endpoint URL from port " + m_name
+                                             + " service's wsdl:port/soap:address/@location attribute" );
+      }
+
+      return endpointURL;
+   }
+}
\ No newline at end of file

Added: webservices/muse/branches/1.0/src/java/org/apache/ws/resource/impl/ResourceSweeper.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/resource/impl/ResourceSweeper.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/resource/impl/ResourceSweeper.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/resource/impl/ResourceSweeper.java Fri Jun  2 10:32:46 2006
@@ -0,0 +1,185 @@
+/*=============================================================================*
+ *  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.impl;
+
+import commonj.timers.Timer;
+import commonj.timers.TimerListener;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ws.resource.Resource;
+import org.apache.ws.resource.ResourceException;
+import org.apache.ws.resource.ResourceHome;
+import org.apache.ws.resource.i18n.Keys;
+import org.apache.ws.resource.i18n.MessagesImpl;
+import org.apache.ws.resource.lifetime.ScheduledResourceTerminationResource;
+import org.apache.ws.util.i18n.Messages;
+import java.util.Calendar;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.Map;
+
+/**
+ * LOG-DONE
+ * DOCUMENT_ME
+ */
+public class ResourceSweeper
+   implements TimerListener
+{
+   /**
+    * DOCUMENT_ME
+    */
+   private static final Log LOG = LogFactory.getLog( ResourceSweeper.class.getName(  ) );
+
+   /** DOCUMENT_ME */
+   public static final Messages MSG = MessagesImpl.getInstance(  );
+
+   /**
+    * DOCUMENT_ME
+    */
+   protected Map m_resources;
+
+   /**
+    * DOCUMENT_ME
+    */
+   protected ResourceHome m_home;
+
+   /**
+    * @param resources must be synchronized map
+    */
+   public ResourceSweeper( ResourceHome home,
+                           Map          resources )
+   {
+      m_home         = home;
+      m_resources    = resources;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @param resource DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public static boolean isExpired( Resource resource )
+   {
+      if ( !( resource instanceof ScheduledResourceTerminationResource ) )
+      {
+         return false;
+      }
+
+      return isExpired( (ScheduledResourceTerminationResource) resource,
+                        Calendar.getInstance(  ) );
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @param resource    DOCUMENT_ME
+    * @param currentTime DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public static boolean isExpired( ScheduledResourceTerminationResource resource,
+                                    Calendar                             currentTime )
+   {
+      Calendar terminationTime = resource.getTerminationTime(  );
+      return ( ( terminationTime != null ) && terminationTime.before( currentTime ) );
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @param timer DOCUMENT_ME
+    */
+   public void timerExpired( Timer timer )
+   {
+      LOG.debug( MSG.getMessage( Keys.CLEANING_EXPIRED_RESOURCES ) );
+
+      Calendar   currentTime = Calendar.getInstance(  );
+      Object     key;
+      Resource   resource;
+      LinkedList list = new LinkedList(  );
+
+      synchronized ( m_resources )
+      {
+         Iterator keyIter = m_resources.keySet(  ).iterator(  );
+         while ( keyIter.hasNext(  ) )
+         {
+            key = keyIter.next(  );
+            try
+            {
+               resource = getResource( key );
+               if ( ( resource != null ) && isExpired( resource, currentTime ) )
+               {
+                  list.add( key );
+               }
+            }
+            catch ( ResourceException re )
+            {
+               LOG.error( re );
+            }
+         }
+      }
+
+      Iterator expiredKeyIter = list.iterator(  );
+      while ( expiredKeyIter.hasNext(  ) )
+      {
+         key = expiredKeyIter.next(  );
+         try
+         {
+            m_home.remove( key );
+         }
+         catch ( ResourceException re )
+         {
+            LOG.error( re );
+         }
+      }
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @param resource    DOCUMENT_ME
+    * @param currentTime DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   protected boolean isExpired( Resource resource,
+                                Calendar currentTime )
+   {
+      if ( !( resource instanceof ScheduledResourceTerminationResource ) )
+      {
+         return false;
+      }
+
+      return isExpired( (ScheduledResourceTerminationResource) resource, currentTime );
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @param id DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    *
+    * @throws ResourceException DOCUMENT_ME
+    */
+   protected Resource getResource( Object id )
+   throws ResourceException
+   {
+      return m_home.find( id );
+   }
+}
\ No newline at end of file

Added: webservices/muse/branches/1.0/src/java/org/apache/ws/resource/impl/UnsupportedVersionException.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/resource/impl/UnsupportedVersionException.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/resource/impl/UnsupportedVersionException.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/resource/impl/UnsupportedVersionException.java Fri Jun  2 10:32:46 2006
@@ -0,0 +1,39 @@
+/*=============================================================================*
+ *  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.impl;
+
+import org.apache.ws.resource.properties.NamespaceVersionHolder;
+
+/**
+ * An exception to be thrown when a version is unknown...This can be used to help flush out incomplete
+ * version upgrades.
+ *
+ * @author Sal Campana
+ */
+public class UnsupportedVersionException
+   extends RuntimeException
+{
+   /**
+    * Creates a new {@link UnsupportedVersionException} object.
+    *
+    * @param namespaces DOCUMENT_ME
+    */
+   public UnsupportedVersionException( NamespaceVersionHolder namespaces )
+   {
+      super( "The NamespaceVersionHolder implementation in " + namespaces.getClass(  ).getPackage(  ).getName(  )
+             + " is unsupported." );
+   }
+}
\ No newline at end of file

Added: webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/ResourceNotDestroyedException.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/ResourceNotDestroyedException.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/ResourceNotDestroyedException.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/ResourceNotDestroyedException.java Fri Jun  2 10:32:46 2006
@@ -0,0 +1,61 @@
+/*=============================================================================*
+ *  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;
+
+
+/**
+ *
+ *
+ * @author Ian Springer
+ */
+public class ResourceNotDestroyedException
+   extends Exception
+{
+   private Object m_resourceId;
+   private String m_serviceName;
+
+   /**
+    * @param resourceId
+    * @param serviceName
+    */
+   public ResourceNotDestroyedException( Object resourceId,
+                                         String serviceName )
+   {
+      super( serviceName + " resource with Id " + resourceId + " could not be destroyed." );
+      m_resourceId     = resourceId;
+      m_serviceName    = serviceName;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public Object getResourceId(  )
+   {
+      return m_resourceId;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public String getServiceName(  )
+   {
+      return m_serviceName;
+   }
+}
\ No newline at end of file

Added: webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/ResourceTerminationEvent.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/ResourceTerminationEvent.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/ResourceTerminationEvent.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/ResourceTerminationEvent.java Fri Jun  2 10:32:46 2006
@@ -0,0 +1,44 @@
+/*=============================================================================*
+ *  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;
+
+import java.util.Calendar;
+
+/**
+ * Interface describing a TerminationNotification of a resource.
+ *
+ * @author Sal Campana
+ */
+public interface ResourceTerminationEvent
+{
+   /**
+    * Returns the reason for temrination.
+    *
+    * minOccurs="0" maxOccurs="1"
+    *
+    * @return The reason for termination.
+    */
+   Object getReason(  );
+
+   /**
+    * Returns the termination time.
+    *
+    * minOccurs="1" maxOccurs="1" nillable="true"
+    *
+    * @return The termination time represented as a Calendar instance.
+    */
+   Calendar getTerminationTime(  );
+}
\ No newline at end of file

Added: webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/ResourceTerminationListener.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/ResourceTerminationListener.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/ResourceTerminationListener.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/ResourceTerminationListener.java Fri Jun  2 10:32:46 2006
@@ -0,0 +1,32 @@
+/*=============================================================================*
+ *  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;
+
+
+/**
+ * An interface defining the
+ *
+ * @author Sal Campana
+ */
+public interface ResourceTerminationListener
+{
+   /**
+    * A method that is called whenever a particular resource is terminated.
+    *
+    * @param resourceTerminationEvent
+    */
+   void terminationOccurred( ResourceTerminationEvent resourceTerminationEvent );
+}
\ No newline at end of file

Added: webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/ScheduledResourceTerminationResource.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/ScheduledResourceTerminationResource.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/ScheduledResourceTerminationResource.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/ScheduledResourceTerminationResource.java Fri Jun  2 10:32:46 2006
@@ -0,0 +1,48 @@
+/*=============================================================================*
+ *  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;
+
+import org.apache.ws.resource.Resource;
+import java.util.Calendar;
+
+/**
+ * Interface that contains operations which expose the state associated with the wsrlw:ScheduledResourceTermination
+ * portType.
+ */
+public interface ScheduledResourceTerminationResource
+   extends Resource
+{
+   /**
+    * Get the current time
+    *
+    * @return The current time
+    */
+   Calendar getCurrentTime(  );
+
+   /**
+    * Set the termination time
+    *
+    * @param time The termination time to set
+    */
+   void setTerminationTime( Calendar time );
+
+   /**
+    * Get the termination time
+    *
+    * @return The termination time
+    */
+   Calendar getTerminationTime(  );
+}
\ No newline at end of file

Added: webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/callback/CurrentTimeCallback.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/callback/CurrentTimeCallback.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/callback/CurrentTimeCallback.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/callback/CurrentTimeCallback.java Fri Jun  2 10:32:46 2006
@@ -0,0 +1,50 @@
+/*=============================================================================*
+ *  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.ResourceProperty;
+import org.apache.ws.resource.properties.ResourcePropertyCallback;
+import org.apache.ws.resource.properties.XmlBeansResourcePropertyUtils;
+import org.apache.ws.resource.properties.impl.CallbackFailedException;
+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
+{
+   /**
+    * DOCUMENT_ME
+    *
+    * @param prop DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    *
+    * @throws CallbackFailedException DOCUMENT_ME
+    */
+   public ResourceProperty refreshProperty( ResourceProperty prop )
+   throws CallbackFailedException
+   {
+      XmlBeansResourcePropertyUtils.setDateTimePropertyValue( (XmlBeansResourceProperty) prop,
+                                                              Calendar.getInstance(  ) );
+      return prop;
+   }
+}
\ No newline at end of file

Added: webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/faults/ResourceNotDestroyedFaultException.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/faults/ResourceNotDestroyedFaultException.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/faults/ResourceNotDestroyedFaultException.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/faults/ResourceNotDestroyedFaultException.java Fri Jun  2 10:32:46 2006
@@ -0,0 +1,101 @@
+/*=============================================================================*
+ *  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.faults;
+
+import org.apache.ws.resource.ResourceUnknownException;
+import org.apache.ws.resource.faults.AbstractBaseFaultException;
+import org.apache.ws.resource.i18n.Keys;
+import org.apache.ws.resource.i18n.MessagesImpl;
+import org.apache.ws.resource.properties.NamespaceVersionHolder;
+import org.apache.ws.util.i18n.Messages;
+import javax.xml.namespace.QName;
+
+/**
+ * An Exception representing the WSRL-defined ResourceNotDestroyed fault,
+ * which is thrown by the Destroy operation if it cannot destroy the
+ * resource.
+ *
+ * @author Ian Springer
+ */
+public class ResourceNotDestroyedFaultException
+   extends AbstractBaseFaultException
+{
+   private static final Messages MSG           = MessagesImpl.getInstance(  );
+   private QName                 m_name;
+   private Object                m_resourceId;
+   private String                m_serviceName;
+
+   /**
+    * Constructs a new ResourceNotDestroyedFaultException, specifying the resource id and service name
+    * of the resource.
+    *
+    * @param resourceId
+    * @param serviceName
+    */
+   public ResourceNotDestroyedFaultException( NamespaceVersionHolder namespaces,
+                                              Object                 resourceId,
+                                              String                 serviceName )
+   {
+      super( namespaces,
+             MSG.getMessage( Keys.UNABLE_TO_DESTROY_RESOURCE, serviceName, resourceId ) );
+      m_name    = new QName( namespaces.getLifetimeXsdNamespace(  ),
+                             "ResourceUnknownFault",
+                             "wsrl" );
+      m_resourceId     = resourceId;
+      m_serviceName    = serviceName;
+   }
+
+   /**
+    * @param rue
+    */
+   public ResourceNotDestroyedFaultException( NamespaceVersionHolder   namespaces,
+                                              ResourceUnknownException rue )
+   {
+      this( namespaces,
+            rue.getResourceId(  ),
+            rue.getServiceName(  ) );
+   }
+
+   /**
+    * Returns the element name for this base fault.
+    *
+    * @return the element name for this base fault
+    */
+   public QName getBaseFaultName(  )
+   {
+      return m_name;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public Object getResourceId(  )
+   {
+      return m_resourceId;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public String getServiceName(  )
+   {
+      return m_serviceName;
+   }
+}
\ No newline at end of file

Added: webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/faults/ResourceUnknownFaultException.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/faults/ResourceUnknownFaultException.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/faults/ResourceUnknownFaultException.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/faults/ResourceUnknownFaultException.java Fri Jun  2 10:32:46 2006
@@ -0,0 +1,99 @@
+/*=============================================================================*
+ *  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.faults;
+
+import org.apache.ws.resource.ResourceUnknownException;
+import org.apache.ws.resource.faults.AbstractBaseFaultException;
+import org.apache.ws.resource.i18n.Keys;
+import org.apache.ws.resource.i18n.MessagesImpl;
+import org.apache.ws.resource.properties.NamespaceVersionHolder;
+import org.apache.ws.util.i18n.Messages;
+import javax.xml.namespace.QName;
+
+/**
+ * LOG-DONE Indicates that the resource identified in the message is not known to the Web service.
+ *
+ * @author Ian P. Springer
+ */
+public class ResourceUnknownFaultException
+   extends AbstractBaseFaultException
+{
+   private static final Messages MSG           = MessagesImpl.getInstance(  );
+   private QName                 m_name;
+   private Object                m_resourceId;
+   private String                m_serviceName;
+
+   /**
+    * Constructs a new ResourceUnknownFaultException, specifying the resource id and service name of the unknown
+    * resource.
+    *
+    * @param resourceId
+    * @param serviceName
+    */
+   public ResourceUnknownFaultException( NamespaceVersionHolder namespaces,
+                                         Object                 resourceId,
+                                         String                 serviceName )
+   {
+      super( namespaces,
+             MSG.getMessage( Keys.RESOURCEID_NOT_FOUND_FOR_SERVICE, resourceId, serviceName ) );
+      m_name    = new QName( namespaces.getLifetimeXsdNamespace(  ),
+                             "ResourceUnknownFault",
+                             "wsrl" );
+      m_resourceId     = resourceId;
+      m_serviceName    = serviceName;
+   }
+
+   /**
+    * @param rue
+    */
+   public ResourceUnknownFaultException( NamespaceVersionHolder   namespaces,
+                                         ResourceUnknownException rue )
+   {
+      this( namespaces,
+            rue.getResourceId(  ),
+            rue.getServiceName(  ) );
+   }
+
+   /**
+    * Returns the element name for this base fault.
+    *
+    * @return the element name for this base fault
+    */
+   public QName getBaseFaultName(  )
+   {
+      return m_name;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public Object getResourceId(  )
+   {
+      return m_resourceId;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public String getServiceName(  )
+   {
+      return m_serviceName;
+   }
+}
\ No newline at end of file

Added: webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/faults/TerminationTimeChangeRejectedFaultException.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/faults/TerminationTimeChangeRejectedFaultException.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/faults/TerminationTimeChangeRejectedFaultException.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/faults/TerminationTimeChangeRejectedFaultException.java Fri Jun  2 10:32:46 2006
@@ -0,0 +1,99 @@
+/*=============================================================================*
+ *  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.faults;
+
+import org.apache.ws.resource.ResourceUnknownException;
+import org.apache.ws.resource.faults.AbstractBaseFaultException;
+import org.apache.ws.resource.i18n.Keys;
+import org.apache.ws.resource.i18n.MessagesImpl;
+import org.apache.ws.resource.properties.NamespaceVersionHolder;
+import org.apache.ws.util.i18n.Messages;
+import javax.xml.namespace.QName;
+
+/**
+ * LOG-DONE Indicates that a WS-Resource could not be destroyed for some reason.
+ *
+ * @author Ian P. Springer
+ */
+public class TerminationTimeChangeRejectedFaultException
+   extends AbstractBaseFaultException
+{
+   private static final Messages MSG           = MessagesImpl.getInstance(  );
+   private QName                 m_name;
+   private Object                m_resourceId;
+   private String                m_serviceName;
+
+   /**
+    * Constructs a new TerminationTimeChangeRejectedFaultException, specifying the resource id and
+    * service name of the resource.
+    *
+    * @param resourceId
+    * @param serviceName
+    */
+   public TerminationTimeChangeRejectedFaultException( NamespaceVersionHolder namespaces,
+                                                       Object                 resourceId,
+                                                       String                 serviceName )
+   {
+      super( namespaces,
+             MSG.getMessage( Keys.UNABLE_TO_SET_TERM_TIME, serviceName, resourceId ) );
+      m_name    = new QName( namespaces.getLifetimeXsdNamespace(  ),
+                             "TerminationTimeChangeRejectedFault",
+                             "wsrl" );
+      m_resourceId     = resourceId;
+      m_serviceName    = serviceName;
+   }
+
+   /**
+    * @param rue
+    */
+   public TerminationTimeChangeRejectedFaultException( NamespaceVersionHolder   namespaces,
+                                                       ResourceUnknownException rue )
+   {
+      this( namespaces,
+            rue.getResourceId(  ),
+            rue.getServiceName(  ) );
+   }
+
+   /**
+    * Returns the element name for this base fault.
+    *
+    * @return the element name for this base fault
+    */
+   public QName getBaseFaultName(  )
+   {
+      return m_name;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public Object getResourceId(  )
+   {
+      return m_resourceId;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public String getServiceName(  )
+   {
+      return m_serviceName;
+   }
+}
\ No newline at end of file

Added: webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/faults/UnableToSetTerminationTimeFaultException.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/faults/UnableToSetTerminationTimeFaultException.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/faults/UnableToSetTerminationTimeFaultException.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/faults/UnableToSetTerminationTimeFaultException.java Fri Jun  2 10:32:46 2006
@@ -0,0 +1,101 @@
+/*=============================================================================*
+ *  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.faults;
+
+import org.apache.ws.resource.ResourceUnknownException;
+import org.apache.ws.resource.faults.AbstractBaseFaultException;
+import org.apache.ws.resource.i18n.Keys;
+import org.apache.ws.resource.i18n.MessagesImpl;
+import org.apache.ws.resource.properties.NamespaceVersionHolder;
+import org.apache.ws.util.i18n.Messages;
+import javax.xml.namespace.QName;
+
+/**
+ * An Exception representing the WSRL-defined UnableToSetTerminationTime fault,
+ * which is thrown by the SetTerminationTime operation if it cannot set the
+ * resource's termination time.
+ *
+ * @author Ian Springer
+ */
+public class UnableToSetTerminationTimeFaultException
+   extends AbstractBaseFaultException
+{
+   private static final Messages MSG           = MessagesImpl.getInstance(  );
+   private QName                 m_name;
+   private Object                m_resourceId;
+   private String                m_serviceName;
+
+   /**
+    * Constructs a new UnableToSetTerminationTimeFaultException, specifying the resource id and service name of the unknown
+    * resource.
+    *
+    * @param resourceId
+    * @param serviceName
+    */
+   public UnableToSetTerminationTimeFaultException( NamespaceVersionHolder namespaces,
+                                                    Object                 resourceId,
+                                                    String                 serviceName )
+   {
+      super( namespaces,
+             MSG.getMessage( Keys.UNABLE_TO_SET_TERM_TIME, serviceName, resourceId ) );
+      m_name    = new QName( namespaces.getLifetimeXsdNamespace(  ),
+                             "UnableToSetTerminationTimeFault",
+                             "wsrl" );
+      m_resourceId     = resourceId;
+      m_serviceName    = serviceName;
+   }
+
+   /**
+    * @param rue
+    */
+   public UnableToSetTerminationTimeFaultException( NamespaceVersionHolder   namespaces,
+                                                    ResourceUnknownException rue )
+   {
+      this( namespaces,
+            rue.getResourceId(  ),
+            rue.getServiceName(  ) );
+   }
+
+   /**
+    * Returns the element name for this base fault.
+    *
+    * @return the element name for this base fault
+    */
+   public QName getBaseFaultName(  )
+   {
+      return m_name;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public Object getResourceId(  )
+   {
+      return m_resourceId;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public String getServiceName(  )
+   {
+      return m_serviceName;
+   }
+}
\ No newline at end of file

Added: webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/impl/AbstractResourceTerminationEvent.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/impl/AbstractResourceTerminationEvent.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/impl/AbstractResourceTerminationEvent.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/impl/AbstractResourceTerminationEvent.java Fri Jun  2 10:32:46 2006
@@ -0,0 +1,115 @@
+/*=============================================================================*
+ *  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.impl;
+
+import org.apache.ws.resource.lifetime.ResourceTerminationEvent;
+import org.apache.ws.resource.properties.NamespaceVersionHolder;
+import org.apache.xmlbeans.XmlObject;
+import java.util.Calendar;
+
+/**
+ * @author Sal Campana
+ */
+public abstract class AbstractResourceTerminationEvent
+   implements ResourceTerminationEvent
+{
+   private Calendar m_terminationTime;
+   private Object   m_reason;
+   private Object   m_resourceId;
+
+   /**
+    * Sets termination time and reason to passed in params.
+    *
+    * @param resourceId The resource Id of the resource being destroyed.
+    * @param terminationTime
+    * @param reason
+    */
+   public AbstractResourceTerminationEvent( Object   resourceId,
+                                            Calendar terminationTime,
+                                            Object   reason )
+   {
+      m_terminationTime    = terminationTime;
+      m_reason             = reason;
+      m_resourceId         = resourceId;
+   }
+
+   /**
+    * Set the reson to the object specified and termination time is set upon construction.
+    *
+    * @param resourceId The resource Id of the resource being destroyed.
+    * @param reason
+    */
+   public AbstractResourceTerminationEvent( Object resourceId,
+                                            Object reason )
+   {
+      this( resourceId,
+            Calendar.getInstance(  ), reason );
+   }
+
+   /**
+    * Constructor creates termination time upon construction.  Reason is null.
+    *
+    * @param resourceId The resource Id of the resource being destroyed.
+    */
+   public AbstractResourceTerminationEvent( Object resourceId )
+   {
+      this( resourceId,
+            Calendar.getInstance(  ), null );
+   }
+
+   /**
+    * Returns the reason for temrination.
+    * <p/>
+    * minOccurs="0" maxOccurs="1"
+    *
+    * @return The reason for termination.
+    */
+   public Object getReason(  )
+   {
+      return m_reason;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public Object getResourceId(  )
+   {
+      return m_resourceId;
+   }
+
+   /**
+    * Returns the termination time.
+    * <p/>
+    * minOccurs="1" maxOccurs="1" nillable="true"
+    *
+    * @return The termination time represented as a Calendar instance.
+    */
+   public Calendar getTerminationTime(  )
+   {
+      return m_terminationTime;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @param namespaces DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   protected abstract XmlObject getTerminationNotifDocXmlBean( NamespaceVersionHolder namespaces );
+}
\ No newline at end of file

Added: webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/impl/ResourceTerminationEventImpl.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/impl/ResourceTerminationEventImpl.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/impl/ResourceTerminationEventImpl.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/impl/ResourceTerminationEventImpl.java Fri Jun  2 10:32:46 2006
@@ -0,0 +1,120 @@
+/*=============================================================================*
+ *  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.impl;
+
+import org.apache.ws.resource.lifetime.ResourceTerminationEvent;
+import org.apache.ws.resource.properties.NamespaceVersionHolder;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlString;
+import java.util.Calendar;
+
+/**
+ * @author Sal Campana
+ */
+public class ResourceTerminationEventImpl
+   extends AbstractResourceTerminationEvent
+   implements ResourceTerminationEvent
+{
+   /**
+    * Sets termination time and reason to passed in params.
+    *
+    * @param resourceId      The resource Id of the resource being destroyed.
+    * @param terminationTime
+    * @param reason
+    */
+   public ResourceTerminationEventImpl( Object   resourceId,
+                                        Calendar terminationTime,
+                                        Object   reason )
+   {
+      super( resourceId, terminationTime, reason );
+   }
+
+   /**
+    * Constructor creates termination time upon construction.  Reason is null.
+    *
+    * @param resourceId The resource Id of the resource being destroyed.
+    */
+   public ResourceTerminationEventImpl( Object resourceId )
+   {
+      super( resourceId );
+   }
+
+   /**
+    * Set the reson to the object specified and termination time is set upon construction.
+    *
+    * @param resourceId The resource Id of the resource being destroyed.
+    * @param reason
+    */
+   public ResourceTerminationEventImpl( Object resourceId,
+                                        Object reason )
+   {
+      super( resourceId, reason );
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @param namespaces DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public XmlObject getTerminationNotifDocXmlBean( NamespaceVersionHolder namespaces )
+   {
+      Object reason = getReason(  );
+      if ( !( reason instanceof XmlObject ) )
+      {
+         reason = XmlString.Factory.newInstance(  );
+         ( (XmlString) reason ).setStringValue( reason.toString(  ) );
+      }
+
+      if ( namespaces instanceof org.apache.ws.resource.properties.v2004_11.impl.NamespaceVersionHolderImpl )
+      {
+         org.oasisOpen.docs.wsrf.x2004.x11.wsrfWSResourceLifetime12Draft04.TerminationNotificationDocument notifDoc =
+            org.oasisOpen.docs.wsrf.x2004.x11.wsrfWSResourceLifetime12Draft04.TerminationNotificationDocument.Factory
+            .newInstance(  );
+         org.oasisOpen.docs.wsrf.x2004.x11.wsrfWSResourceLifetime12Draft04.TerminationNotificationDocument.TerminationNotification terminationNotification =
+            notifDoc.addNewTerminationNotification(  );
+         terminationNotification.setTerminationTime( getTerminationTime(  ) );
+
+         if ( reason != null )
+         {
+            terminationNotification.setTerminationReason( (XmlObject) reason );
+         }
+
+         return notifDoc;
+      }
+      else if ( namespaces instanceof org.apache.ws.resource.properties.v2004_06.impl.NamespaceVersionHolderImpl )
+      {
+         org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceLifetime12Draft01.TerminationNotificationDocument notifDoc =
+            org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceLifetime12Draft01.TerminationNotificationDocument.Factory
+            .newInstance(  );
+         org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceLifetime12Draft01.TerminationNotificationDocument.TerminationNotification terminationNotification =
+            notifDoc.addNewTerminationNotification(  );
+         terminationNotification.setTerminationTime( getTerminationTime(  ) );
+
+         if ( reason != null )
+         {
+            terminationNotification.setTerminationReason( (XmlObject) reason );
+         }
+
+         return notifDoc;
+      }
+      else
+      {
+         throw new org.apache.ws.resource.impl.UnsupportedVersionException( namespaces );
+      }
+   }
+}
\ No newline at end of file

Added: webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/v2004_06/ResourceLifetimeConstants.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/v2004_06/ResourceLifetimeConstants.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/v2004_06/ResourceLifetimeConstants.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/v2004_06/ResourceLifetimeConstants.java Fri Jun  2 10:32:46 2006
@@ -0,0 +1,44 @@
+/*=============================================================================*
+ *  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.v2004_06;
+
+import org.apache.ws.resource.v2004_06.WsrfConstants;
+
+/**
+ * Constants for namespaces defined by the 2004/06 version of the WSRF ResourceLifetime specification.
+ */
+public interface ResourceLifetimeConstants
+{
+   /**
+    * Namespace URI for WS-ResourceLifetime schema.
+    */
+   String NSURI_WSRL_SCHEMA = WsrfConstants.BASE_URI_WSRF + "wsrf-WS-ResourceLifetime-1.2-draft-01.xsd";
+
+   /**
+    * Namespace prefix for WS-ResourceLifetime schema.
+    */
+   String NSPREFIX_WSRL_SCHEMA = "wsrl";
+
+   /**
+    * Namespace URI for WS-ResourceLifetime WSDL.
+    */
+   String NSURI_WSRL_WSDL = WsrfConstants.BASE_URI_WSRF + "wsrf-WS-ResourceLifetime-1.2-draft-01.wsdl";
+
+   /**
+    * Namespace prefix for WS-ResourceLifetime WSDL.
+    */
+   String NSPREFIX_WSRL_WSDL = "wsrlw";
+}
\ No newline at end of file

Added: webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/v2004_06/porttype/ImmediateResourceTerminationPortType.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/v2004_06/porttype/ImmediateResourceTerminationPortType.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/v2004_06/porttype/ImmediateResourceTerminationPortType.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/v2004_06/porttype/ImmediateResourceTerminationPortType.java Fri Jun  2 10:32:46 2006
@@ -0,0 +1,43 @@
+/*=============================================================================*
+ *  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.v2004_06.porttype;
+
+import org.apache.ws.resource.lifetime.v2004_06.ResourceLifetimeConstants;
+import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceLifetime12Draft01.DestroyDocument;
+import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceLifetime12Draft01.DestroyResponseDocument;
+import javax.xml.namespace.QName;
+
+/**
+ * The WSRF-RL ImmediateResourceTermination portType.
+ *
+ * @author Ian P. Springer (Hewlett-Packard Company)
+ */
+public interface ImmediateResourceTerminationPortType
+{
+   /** DOCUMENT_ME */
+   QName NAME =
+      new QName( ResourceLifetimeConstants.NSURI_WSRL_WSDL, "ImmediateResourceTermination",
+                 ResourceLifetimeConstants.NSPREFIX_WSRL_WSDL );
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @param requestDoc DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   DestroyResponseDocument destroy( DestroyDocument requestDoc );
+}
\ No newline at end of file

Added: webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/v2004_06/porttype/ScheduledResourceTerminationPortType.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/v2004_06/porttype/ScheduledResourceTerminationPortType.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/v2004_06/porttype/ScheduledResourceTerminationPortType.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/v2004_06/porttype/ScheduledResourceTerminationPortType.java Fri Jun  2 10:32:46 2006
@@ -0,0 +1,57 @@
+/*=============================================================================*
+ *  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.v2004_06.porttype;
+
+import org.apache.ws.resource.lifetime.v2004_06.ResourceLifetimeConstants;
+import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceLifetime12Draft01.SetTerminationTimeDocument;
+import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceLifetime12Draft01.SetTerminationTimeResponseDocument;
+import javax.xml.namespace.QName;
+
+/**
+ * The WSRF-RL ScheduledResourceTermination portType.
+ *
+ * @author Ian P. Springer (Hewlett-Packard Company)
+ */
+public interface ScheduledResourceTerminationPortType
+{
+   /** DOCUMENT_ME */
+   QName NAME =
+      new QName( ResourceLifetimeConstants.NSURI_WSRL_WSDL, "ScheduledResourceTermination",
+                 ResourceLifetimeConstants.NSPREFIX_WSRL_WSDL );
+
+   /**
+    * CurrentTime property name.
+    */
+   QName PROP_QNAME_CURRENT_TIME =
+      new QName( ResourceLifetimeConstants.NSURI_WSRL_SCHEMA, "CurrentTime",
+                 ResourceLifetimeConstants.NSPREFIX_WSRL_SCHEMA );
+
+   /**
+    * TerminationTime property name.
+    */
+   QName PROP_QNAME_TERMINATION_TIME =
+      new QName( ResourceLifetimeConstants.NSURI_WSRL_SCHEMA, "TerminationTime",
+                 ResourceLifetimeConstants.NSPREFIX_WSRL_SCHEMA );
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @param requestDoc DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   SetTerminationTimeResponseDocument setTerminationTime( SetTerminationTimeDocument requestDoc );
+}
\ No newline at end of file

Added: webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/v2004_06/porttype/impl/ImmediateResourceTerminationPortTypeImpl.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/v2004_06/porttype/impl/ImmediateResourceTerminationPortTypeImpl.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/v2004_06/porttype/impl/ImmediateResourceTerminationPortTypeImpl.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/v2004_06/porttype/impl/ImmediateResourceTerminationPortTypeImpl.java Fri Jun  2 10:32:46 2006
@@ -0,0 +1,103 @@
+/*=============================================================================*
+ *  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.v2004_06.porttype.impl;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ws.resource.AbstractPortType;
+import org.apache.ws.resource.ResourceContext;
+import org.apache.ws.resource.ResourceException;
+import org.apache.ws.resource.i18n.Keys;
+import org.apache.ws.resource.i18n.MessagesImpl;
+import org.apache.ws.resource.lifetime.faults.ResourceNotDestroyedFaultException;
+import org.apache.ws.resource.lifetime.v2004_06.porttype.ImmediateResourceTerminationPortType;
+import org.apache.ws.resource.properties.NamespaceVersionHolder;
+import org.apache.ws.resource.properties.v2004_06.impl.NamespaceVersionHolderImpl;
+import org.apache.ws.util.i18n.Messages;
+import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceLifetime12Draft01.DestroyDocument;
+import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceLifetime12Draft01.DestroyResponseDocument;
+
+/**
+ * LOG-DONE An implementation of the wsrlw:ImmediateResourceTermination portType.
+ *
+ * @author Ian P. Springer (Hewlett-Packard Company)
+ */
+public class ImmediateResourceTerminationPortTypeImpl
+   extends AbstractPortType
+   implements ImmediateResourceTerminationPortType
+{
+   /**
+    * DOCUMENT_ME
+    */
+   private static final Log LOG = LogFactory.getLog( ImmediateResourceTerminationPortTypeImpl.class.getName(  ) );
+
+   /** DOCUMENT_ME */
+   public static final Messages                MSG           = MessagesImpl.getInstance(  );
+   private static final NamespaceVersionHolder NAMESPACE_SET = new NamespaceVersionHolderImpl(  );
+
+   /**
+    * Creates a new {@link ImmediateResourceTerminationPortTypeImpl} object.
+    *
+    * @param resourceContext DOCUMENT_ME
+    */
+   public ImmediateResourceTerminationPortTypeImpl( ResourceContext resourceContext )
+   {
+      super( resourceContext );
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @param requestDoc DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public DestroyResponseDocument destroy( DestroyDocument requestDoc )
+   {
+      LOG.debug( MSG.getMessage( Keys.DESTROYING_RESOURCE,
+                                 getResourceContext(  ).getServiceName(  ),
+                                 String.valueOf( getResource(  ).getID(  ) ) ) );
+      try
+      {
+         getResourceContext(  ).getResourceHome(  ).remove( getResource(  ).getID(  ) );
+      }
+      catch ( ResourceException re )
+      {
+         throw new ResourceNotDestroyedFaultException( NAMESPACE_SET,
+                                                       String.valueOf( String.valueOf( getResource(  ).getID(  ) ) ),
+                                                       getResourceContext(  ).getServiceName(  ) );
+      }
+
+      return createResponseDocument(  );
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   protected NamespaceVersionHolder getNamespaceSet(  )
+   {
+      return NAMESPACE_SET;
+   }
+
+   private DestroyResponseDocument createResponseDocument(  )
+   {
+      DestroyResponseDocument responseDoc = DestroyResponseDocument.Factory.newInstance(  );
+      responseDoc.addNewDestroyResponse(  );
+      return responseDoc;
+   }
+}
\ No newline at end of file

Added: webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/v2004_06/porttype/impl/ScheduledResourceTerminationPortTypeImpl.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/v2004_06/porttype/impl/ScheduledResourceTerminationPortTypeImpl.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/v2004_06/porttype/impl/ScheduledResourceTerminationPortTypeImpl.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/v2004_06/porttype/impl/ScheduledResourceTerminationPortTypeImpl.java Fri Jun  2 10:32:46 2006
@@ -0,0 +1,146 @@
+/*=============================================================================*
+ *  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.v2004_06.porttype.impl;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ws.resource.ResourceContext;
+import org.apache.ws.resource.ResourceException;
+import org.apache.ws.resource.i18n.Keys;
+import org.apache.ws.resource.i18n.MessagesImpl;
+import org.apache.ws.resource.lifetime.ScheduledResourceTerminationResource;
+import org.apache.ws.resource.lifetime.faults.UnableToSetTerminationTimeFaultException;
+import org.apache.ws.resource.lifetime.v2004_06.porttype.ScheduledResourceTerminationPortType;
+import org.apache.ws.resource.properties.NamespaceVersionHolder;
+import org.apache.ws.resource.properties.impl.AbstractResourcePropertiesPortType;
+import org.apache.ws.resource.properties.v2004_06.impl.NamespaceVersionHolderImpl;
+import org.apache.ws.util.i18n.Messages;
+import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceLifetime12Draft01.SetTerminationTimeDocument;
+import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceLifetime12Draft01.SetTerminationTimeResponseDocument;
+import java.util.Calendar;
+
+/**
+ * LOG-DONE An implementation of the wsrlw:ScheduledResourceTermination portType.
+ *
+ * @author Ian P. Springer (Hewlett-Packard Company)
+ */
+public class ScheduledResourceTerminationPortTypeImpl
+   extends AbstractResourcePropertiesPortType
+   implements ScheduledResourceTerminationPortType
+{
+   /**
+    * DOCUMENT_ME
+    */
+   private static final Log                    LOG =
+      LogFactory.getLog( ScheduledResourceTerminationPortTypeImpl.class.getName(  ) );
+   private static final Messages               MSG           = MessagesImpl.getInstance(  );
+   private static final NamespaceVersionHolder NAMESPACE_SET = new NamespaceVersionHolderImpl(  );
+
+   /**
+    * Creates a new {@link ScheduledResourceTerminationPortTypeImpl} object.
+    *
+    * @param resourceContext DOCUMENT_ME
+    */
+   public ScheduledResourceTerminationPortTypeImpl( ResourceContext resourceContext )
+   {
+      super( resourceContext );
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @param requestDoc DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public SetTerminationTimeResponseDocument setTerminationTime( SetTerminationTimeDocument requestDoc )
+   {
+      SetTerminationTimeResponseDocument responseDoc       = createResponseDocument(  );
+      Calendar                           currentTime       = Calendar.getInstance(  );
+      Calendar                           requestedTermTime =
+         requestDoc.getSetTerminationTime(  ).getRequestedTerminationTime(  );
+      Calendar                           newTermTime = null;
+
+      // if requested termination time is in the past, destroy immediately
+      if ( ( requestedTermTime != null ) && requestedTermTime.getTime(  ).before( currentTime.getTime(  ) ) )
+      {
+         try
+         {
+            destroyResource(  );
+         }
+         catch ( ResourceException re )
+         {
+            throw new UnableToSetTerminationTimeFaultException( NAMESPACE_SET, null );
+         }
+
+         newTermTime = currentTime;
+      }
+      else
+      {
+         newTermTime = requestedTermTime;
+      }
+
+      getResourceState(  ).setTerminationTime( newTermTime );
+      populateResponseDocument( responseDoc, currentTime, newTermTime );
+      return responseDoc;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   protected final ScheduledResourceTerminationResource getResourceState(  )
+   {
+      return (ScheduledResourceTerminationResource) getResource(  );
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   protected NamespaceVersionHolder getNamespaceSet(  )
+   {
+      return NAMESPACE_SET;
+   }
+
+   private SetTerminationTimeResponseDocument createResponseDocument(  )
+   {
+      SetTerminationTimeResponseDocument responseDoc = SetTerminationTimeResponseDocument.Factory.newInstance(  );
+      responseDoc.addNewSetTerminationTimeResponse(  );
+      return responseDoc;
+   }
+
+   private void destroyResource(  )
+   throws ResourceException
+   {
+      LOG.debug( MSG.getMessage( Keys.DESTROYING_RESOURCE,
+                                 getResourceContext(  ).getServiceName(  ),
+                                 String.valueOf( getResource(  ).getID(  ) ) ) );
+      getResourceContext(  ).getResourceHome(  ).remove( getResource(  ).getID(  ) );
+   }
+
+   private void populateResponseDocument( SetTerminationTimeResponseDocument responseDoc,
+                                          Calendar                           currentTime,
+                                          Calendar                           newTermTime )
+   {
+      SetTerminationTimeResponseDocument.SetTerminationTimeResponse response =
+         responseDoc.getSetTerminationTimeResponse(  );
+      response.setCurrentTime( currentTime );
+      response.setNewTerminationTime( newTermTime );
+   }
+}
\ No newline at end of file

Added: webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/v2004_11/ResourceLifetimeConstants.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/v2004_11/ResourceLifetimeConstants.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/v2004_11/ResourceLifetimeConstants.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/v2004_11/ResourceLifetimeConstants.java Fri Jun  2 10:32:46 2006
@@ -0,0 +1,44 @@
+/*=============================================================================*
+ *  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.v2004_11;
+
+import org.apache.ws.resource.v2004_11.WsrfConstants;
+
+/**
+ * Constants for namespaces defined by the 2004/11 version of the WSRF ResourceLifetime specification.
+ */
+public interface ResourceLifetimeConstants
+{
+   /**
+    * Namespace URI for WS-ResourceLifetime schema.
+    */
+   String NSURI_WSRL_SCHEMA = WsrfConstants.BASE_URI_WSRF + "wsrf-WS-ResourceLifetime-1.2-draft-04.xsd";
+
+   /**
+    * Namespace prefix for WS-ResourceLifetime schema.
+    */
+   String NSPREFIX_WSRL_SCHEMA = "wsrf-rl";
+
+   /**
+    * Namespace URI for WS-ResourceLifetime WSDL.
+    */
+   String NSURI_WSRL_WSDL = WsrfConstants.BASE_URI_WSRF + "wsrf-WS-ResourceLifetime-1.2-draft-04.wsdl";
+
+   /**
+    * Namespace prefix for WS-ResourceLifetime WSDL.
+    */
+   String NSPREFIX_WSRL_WSDL = "wsrf-rlw";
+}
\ No newline at end of file

Added: webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/v2004_11/porttype/ImmediateResourceTerminationPortType.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/v2004_11/porttype/ImmediateResourceTerminationPortType.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/v2004_11/porttype/ImmediateResourceTerminationPortType.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/v2004_11/porttype/ImmediateResourceTerminationPortType.java Fri Jun  2 10:32:46 2006
@@ -0,0 +1,43 @@
+/*=============================================================================*
+ *  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.v2004_11.porttype;
+
+import org.apache.ws.resource.lifetime.v2004_11.ResourceLifetimeConstants;
+import org.oasisOpen.docs.wsrf.x2004.x11.wsrfWSResourceLifetime12Draft04.DestroyDocument;
+import org.oasisOpen.docs.wsrf.x2004.x11.wsrfWSResourceLifetime12Draft04.DestroyResponseDocument;
+import javax.xml.namespace.QName;
+
+/**
+ * The WSRF-RL ImmediateResourceTermination portType.
+ *
+ * @author Ian P. Springer (Hewlett-Packard Company)
+ */
+public interface ImmediateResourceTerminationPortType
+{
+   /** DOCUMENT_ME */
+   QName NAME =
+      new QName( ResourceLifetimeConstants.NSURI_WSRL_WSDL, "ImmediateResourceTermination",
+                 ResourceLifetimeConstants.NSPREFIX_WSRL_WSDL );
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @param requestDoc DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   DestroyResponseDocument destroy( DestroyDocument requestDoc );
+}
\ No newline at end of file

Added: webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/v2004_11/porttype/ScheduledResourceTerminationPortType.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/v2004_11/porttype/ScheduledResourceTerminationPortType.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/v2004_11/porttype/ScheduledResourceTerminationPortType.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/v2004_11/porttype/ScheduledResourceTerminationPortType.java Fri Jun  2 10:32:46 2006
@@ -0,0 +1,57 @@
+/*=============================================================================*
+ *  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.v2004_11.porttype;
+
+import org.apache.ws.resource.lifetime.v2004_11.ResourceLifetimeConstants;
+import org.oasisOpen.docs.wsrf.x2004.x11.wsrfWSResourceLifetime12Draft04.SetTerminationTimeDocument;
+import org.oasisOpen.docs.wsrf.x2004.x11.wsrfWSResourceLifetime12Draft04.SetTerminationTimeResponseDocument;
+import javax.xml.namespace.QName;
+
+/**
+ * The WSRF-RL ScheduledResourceTermination portType.
+ *
+ * @author Ian P. Springer (Hewlett-Packard Company)
+ */
+public interface ScheduledResourceTerminationPortType
+{
+   /** DOCUMENT_ME */
+   QName NAME =
+      new QName( ResourceLifetimeConstants.NSURI_WSRL_WSDL, "ScheduledResourceTermination",
+                 ResourceLifetimeConstants.NSPREFIX_WSRL_WSDL );
+
+   /**
+    * CurrentTime property name.
+    */
+   QName PROP_QNAME_CURRENT_TIME =
+      new QName( ResourceLifetimeConstants.NSURI_WSRL_SCHEMA, "CurrentTime",
+                 ResourceLifetimeConstants.NSPREFIX_WSRL_SCHEMA );
+
+   /**
+    * TerminationTime property name.
+    */
+   QName PROP_QNAME_TERMINATION_TIME =
+      new QName( ResourceLifetimeConstants.NSURI_WSRL_SCHEMA, "TerminationTime",
+                 ResourceLifetimeConstants.NSPREFIX_WSRL_SCHEMA );
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @param requestDoc DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   SetTerminationTimeResponseDocument setTerminationTime( SetTerminationTimeDocument requestDoc );
+}
\ No newline at end of file

Added: webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/v2004_11/porttype/impl/ImmediateResourceTerminationPortTypeImpl.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/v2004_11/porttype/impl/ImmediateResourceTerminationPortTypeImpl.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/v2004_11/porttype/impl/ImmediateResourceTerminationPortTypeImpl.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/v2004_11/porttype/impl/ImmediateResourceTerminationPortTypeImpl.java Fri Jun  2 10:32:46 2006
@@ -0,0 +1,104 @@
+/*=============================================================================*
+ *  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.v2004_11.porttype.impl;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ws.resource.AbstractPortType;
+import org.apache.ws.resource.ResourceContext;
+import org.apache.ws.resource.ResourceException;
+import org.apache.ws.resource.i18n.Keys;
+import org.apache.ws.resource.i18n.MessagesImpl;
+import org.apache.ws.resource.lifetime.faults.ResourceNotDestroyedFaultException;
+import org.apache.ws.resource.lifetime.v2004_11.porttype.ImmediateResourceTerminationPortType;
+import org.apache.ws.resource.properties.NamespaceVersionHolder;
+import org.apache.ws.resource.properties.v2004_11.impl.NamespaceVersionHolderImpl;
+import org.apache.ws.util.i18n.Messages;
+import org.oasisOpen.docs.wsrf.x2004.x11.wsrfWSResourceLifetime12Draft04.DestroyDocument;
+import org.oasisOpen.docs.wsrf.x2004.x11.wsrfWSResourceLifetime12Draft04.DestroyResponseDocument;
+
+/**
+ * LOG-DONE
+ * An implementation of the wsrlw:ImmediateResourceTermination portType.
+ *
+ * @author Ian P. Springer (Hewlett-Packard Company)
+ */
+public class ImmediateResourceTerminationPortTypeImpl
+   extends AbstractPortType
+   implements ImmediateResourceTerminationPortType
+{
+   /**
+    * DOCUMENT_ME
+    */
+   private static final Log LOG = LogFactory.getLog( ImmediateResourceTerminationPortTypeImpl.class.getName(  ) );
+
+   /** DOCUMENT_ME */
+   public static final Messages                MSG           = MessagesImpl.getInstance(  );
+   private static final NamespaceVersionHolder NAMESPACE_SET = new NamespaceVersionHolderImpl(  );
+
+   /**
+    * Creates a new {@link ImmediateResourceTerminationPortTypeImpl} object.
+    *
+    * @param resourceContext DOCUMENT_ME
+    */
+   public ImmediateResourceTerminationPortTypeImpl( ResourceContext resourceContext )
+   {
+      super( resourceContext );
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @param requestDoc DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public DestroyResponseDocument destroy( DestroyDocument requestDoc )
+   {
+      LOG.debug( MSG.getMessage( Keys.DESTROYING_RESOURCE,
+                                 getResourceContext(  ).getServiceName(  ),
+                                 String.valueOf( getResource(  ).getID(  ) ) ) );
+      try
+      {
+         getResourceContext(  ).getResourceHome(  ).remove( getResource(  ).getID(  ) );
+      }
+      catch ( ResourceException re )
+      {
+         throw new ResourceNotDestroyedFaultException( NAMESPACE_SET,
+                                                       String.valueOf( getResource(  ).getID(  ) ),
+                                                       getResourceContext(  ).getServiceName(  ) );
+      }
+
+      return createResponseDocument(  );
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   protected NamespaceVersionHolder getNamespaceSet(  )
+   {
+      return NAMESPACE_SET;
+   }
+
+   private DestroyResponseDocument createResponseDocument(  )
+   {
+      DestroyResponseDocument responseDoc = DestroyResponseDocument.Factory.newInstance(  );
+      responseDoc.addNewDestroyResponse(  );
+      return responseDoc;
+   }
+}
\ No newline at end of file

Added: webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/v2004_11/porttype/impl/ScheduledResourceTerminationPortTypeImpl.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/v2004_11/porttype/impl/ScheduledResourceTerminationPortTypeImpl.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/v2004_11/porttype/impl/ScheduledResourceTerminationPortTypeImpl.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/resource/lifetime/v2004_11/porttype/impl/ScheduledResourceTerminationPortTypeImpl.java Fri Jun  2 10:32:46 2006
@@ -0,0 +1,146 @@
+/*=============================================================================*
+ *  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.v2004_11.porttype.impl;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ws.resource.ResourceContext;
+import org.apache.ws.resource.ResourceException;
+import org.apache.ws.resource.i18n.Keys;
+import org.apache.ws.resource.i18n.MessagesImpl;
+import org.apache.ws.resource.lifetime.ScheduledResourceTerminationResource;
+import org.apache.ws.resource.lifetime.faults.UnableToSetTerminationTimeFaultException;
+import org.apache.ws.resource.lifetime.v2004_11.porttype.ScheduledResourceTerminationPortType;
+import org.apache.ws.resource.properties.NamespaceVersionHolder;
+import org.apache.ws.resource.properties.impl.AbstractResourcePropertiesPortType;
+import org.apache.ws.resource.properties.v2004_11.impl.NamespaceVersionHolderImpl;
+import org.apache.ws.util.i18n.Messages;
+import org.oasisOpen.docs.wsrf.x2004.x11.wsrfWSResourceLifetime12Draft04.SetTerminationTimeDocument;
+import org.oasisOpen.docs.wsrf.x2004.x11.wsrfWSResourceLifetime12Draft04.SetTerminationTimeResponseDocument;
+import java.util.Calendar;
+
+/**
+ * LOG-DONE An implementation of the wsrlw:ScheduledResourceTermination portType.
+ *
+ * @author Ian P. Springer (Hewlett-Packard Company)
+ */
+public class ScheduledResourceTerminationPortTypeImpl
+   extends AbstractResourcePropertiesPortType
+   implements ScheduledResourceTerminationPortType
+{
+   /**
+    * DOCUMENT_ME
+    */
+   private static final Log                    LOG =
+      LogFactory.getLog( ScheduledResourceTerminationPortTypeImpl.class.getName(  ) );
+   private static final Messages               MSG           = MessagesImpl.getInstance(  );
+   private static final NamespaceVersionHolder NAMESPACE_SET = new NamespaceVersionHolderImpl(  );
+
+   /**
+    * Creates a new {@link ScheduledResourceTerminationPortTypeImpl} object.
+    *
+    * @param resourceContext DOCUMENT_ME
+    */
+   public ScheduledResourceTerminationPortTypeImpl( ResourceContext resourceContext )
+   {
+      super( resourceContext );
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @param requestDoc DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public SetTerminationTimeResponseDocument setTerminationTime( SetTerminationTimeDocument requestDoc )
+   {
+      SetTerminationTimeResponseDocument responseDoc       = createResponseDocument(  );
+      Calendar                           currentTime       = Calendar.getInstance(  );
+      Calendar                           requestedTermTime =
+         requestDoc.getSetTerminationTime(  ).getRequestedTerminationTime(  );
+      Calendar                           newTermTime = null;
+
+      // if requested termination time is in the past, destroy immediately
+      if ( ( requestedTermTime != null ) && requestedTermTime.getTime(  ).before( currentTime.getTime(  ) ) )
+      {
+         try
+         {
+            destroyResource(  );
+         }
+         catch ( ResourceException re )
+         {
+            throw new UnableToSetTerminationTimeFaultException( NAMESPACE_SET, null );
+         }
+
+         newTermTime = currentTime;
+      }
+      else
+      {
+         newTermTime = requestedTermTime;
+      }
+
+      getResourceState(  ).setTerminationTime( newTermTime );
+      populateResponseDocument( responseDoc, currentTime, newTermTime );
+      return responseDoc;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   protected NamespaceVersionHolder getNamespaceSet(  )
+   {
+      return NAMESPACE_SET;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   protected final ScheduledResourceTerminationResource getResourceState(  )
+   {
+      return (ScheduledResourceTerminationResource) getResource(  );
+   }
+
+   private SetTerminationTimeResponseDocument createResponseDocument(  )
+   {
+      SetTerminationTimeResponseDocument responseDoc = SetTerminationTimeResponseDocument.Factory.newInstance(  );
+      responseDoc.addNewSetTerminationTimeResponse(  );
+      return responseDoc;
+   }
+
+   private void destroyResource(  )
+   throws ResourceException
+   {
+      LOG.debug( MSG.getMessage( Keys.DESTROYING_RESOURCE,
+                                 getResourceContext(  ).getServiceName(  ),
+                                 String.valueOf( getResource(  ).getID(  ) ) ) );
+      getResourceContext(  ).getResourceHome(  ).remove( getResource(  ).getID(  ) );
+   }
+
+   private void populateResponseDocument( SetTerminationTimeResponseDocument responseDoc,
+                                          Calendar                           currentTime,
+                                          Calendar                           newTermTime )
+   {
+      SetTerminationTimeResponseDocument.SetTerminationTimeResponse response =
+         responseDoc.getSetTerminationTimeResponse(  );
+      response.setCurrentTime( currentTime );
+      response.setNewTerminationTime( newTermTime );
+   }
+}
\ No newline at end of file



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