You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wsrf-dev@ws.apache.org by sc...@apache.org on 2005/02/16 19:58:57 UTC

svn commit: r154066 - in incubator/apollo/trunk/src/java/org/apache/ws/resource: faults/v1_2_draft01/ lifetime/v1_2_draft01/ lifetime/v1_2_draft01/porttype/ lifetime/v1_2_draft01/porttype/impl/

Author: scamp
Date: Wed Feb 16 10:58:56 2005
New Revision: 154066

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


Added:
    incubator/apollo/trunk/src/java/org/apache/ws/resource/faults/v1_2_draft01/
    incubator/apollo/trunk/src/java/org/apache/ws/resource/faults/v1_2_draft01/Faults1_2Constants.java
    incubator/apollo/trunk/src/java/org/apache/ws/resource/lifetime/v1_2_draft01/
    incubator/apollo/trunk/src/java/org/apache/ws/resource/lifetime/v1_2_draft01/ResourceLifetime1_2Constants.java
    incubator/apollo/trunk/src/java/org/apache/ws/resource/lifetime/v1_2_draft01/porttype/
    incubator/apollo/trunk/src/java/org/apache/ws/resource/lifetime/v1_2_draft01/porttype/ImmediateResourceTerminationPortType.java
    incubator/apollo/trunk/src/java/org/apache/ws/resource/lifetime/v1_2_draft01/porttype/ScheduledResourceTerminationPortType.java
    incubator/apollo/trunk/src/java/org/apache/ws/resource/lifetime/v1_2_draft01/porttype/impl/
    incubator/apollo/trunk/src/java/org/apache/ws/resource/lifetime/v1_2_draft01/porttype/impl/ImmediateResourceTerminationPortTypeImpl.java
    incubator/apollo/trunk/src/java/org/apache/ws/resource/lifetime/v1_2_draft01/porttype/impl/ScheduledResourceTerminationPortTypeImpl.java

Added: incubator/apollo/trunk/src/java/org/apache/ws/resource/faults/v1_2_draft01/Faults1_2Constants.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/faults/v1_2_draft01/Faults1_2Constants.java?view=auto&rev=154066
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/resource/faults/v1_2_draft01/Faults1_2Constants.java (added)
+++ incubator/apollo/trunk/src/java/org/apache/ws/resource/faults/v1_2_draft01/Faults1_2Constants.java Wed Feb 16 10:58:56 2005
@@ -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.faults.v1_2_draft01;
+
+
+/**
+ * @author Ian P. Springer
+ */
+public interface Faults1_2Constants
+{
+   /**
+    * DOCUMENT_ME
+    */
+   String NSURI_BASEFAULTS_WSDL = "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-BaseFaults-1.2-draft-01.wsdl";
+
+   /**
+    * DOCUMENT_ME
+    */
+   String NSPREFIX_BASEFAULTS_WSDL = "wsbfw";
+
+   /**
+    * DOCUMENT_ME
+    */
+   String NSURI_BASEFAULTS_SCHEMA = "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-BaseFaults-1.2-draft-01.xsd";
+
+   /**
+    * DOCUMENT_ME
+    */
+   String NSPREFIX_BASEFAULTS_SCHEMA = "wsbf";
+}
\ No newline at end of file

Added: incubator/apollo/trunk/src/java/org/apache/ws/resource/lifetime/v1_2_draft01/ResourceLifetime1_2Constants.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/lifetime/v1_2_draft01/ResourceLifetime1_2Constants.java?view=auto&rev=154066
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/resource/lifetime/v1_2_draft01/ResourceLifetime1_2Constants.java (added)
+++ incubator/apollo/trunk/src/java/org/apache/ws/resource/lifetime/v1_2_draft01/ResourceLifetime1_2Constants.java Wed Feb 16 10:58:56 2005
@@ -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.v1_2_draft01;
+
+/**
+ * @author Ian P. Springer
+ */
+public interface ResourceLifetime1_2Constants
+{
+
+   /**
+    * DOCUMENT_ME
+    */
+   String NSURI_WSRL_SCHEMA = "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceLifetime-1.2-draft-01.xsd";
+
+   /**
+    * DOCUMENT_ME
+    */
+   String NSPREFIX_WSRL_SCHEMA = "wsrl";
+
+   /**
+    * DOCUMENT_ME
+    */
+   String NSURI_WSRL_WSDL = "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceLifetime-1.2-draft-01.wsdl";
+
+   /**
+    * DOCUMENT_ME
+    */
+   String NSPREFIX_WSRL_WSDL = "wsrlw";
+
+}
\ No newline at end of file

Added: incubator/apollo/trunk/src/java/org/apache/ws/resource/lifetime/v1_2_draft01/porttype/ImmediateResourceTerminationPortType.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/lifetime/v1_2_draft01/porttype/ImmediateResourceTerminationPortType.java?view=auto&rev=154066
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/resource/lifetime/v1_2_draft01/porttype/ImmediateResourceTerminationPortType.java (added)
+++ incubator/apollo/trunk/src/java/org/apache/ws/resource/lifetime/v1_2_draft01/porttype/ImmediateResourceTerminationPortType.java Wed Feb 16 10:58:56 2005
@@ -0,0 +1,42 @@
+/*=============================================================================*
+ *  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.v1_2_draft01.porttype;
+
+import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceLifetime12Draft01.DestroyDocument;
+import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceLifetime12Draft01.DestroyResponseDocument;
+import org.apache.ws.resource.lifetime.v1_2_draft01.ResourceLifetime1_2Constants;
+
+import javax.xml.namespace.QName;
+
+/**
+ * The WSRF-RL ImmediateResourceTermination portType.
+ *
+ * @author Ian P. Springer (Hewlett-Packard Company)
+ */
+public interface ImmediateResourceTerminationPortType
+{
+
+   QName NAME = new QName( ResourceLifetime1_2Constants.NSURI_WSRL_WSDL, "ImmediateResourceTermination", ResourceLifetime1_2Constants.NSPREFIX_WSRL_WSDL );
+
+    /**
+    * DOCUMENT_ME
+    *
+    * @param requestDoc DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   DestroyResponseDocument destroy( DestroyDocument requestDoc );
+}
\ No newline at end of file

Added: incubator/apollo/trunk/src/java/org/apache/ws/resource/lifetime/v1_2_draft01/porttype/ScheduledResourceTerminationPortType.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/lifetime/v1_2_draft01/porttype/ScheduledResourceTerminationPortType.java?view=auto&rev=154066
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/resource/lifetime/v1_2_draft01/porttype/ScheduledResourceTerminationPortType.java (added)
+++ incubator/apollo/trunk/src/java/org/apache/ws/resource/lifetime/v1_2_draft01/porttype/ScheduledResourceTerminationPortType.java Wed Feb 16 10:58:56 2005
@@ -0,0 +1,53 @@
+/*=============================================================================*
+ *  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.v1_2_draft01.porttype;
+
+import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceLifetime12Draft01.SetTerminationTimeDocument;
+import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceLifetime12Draft01.SetTerminationTimeResponseDocument;
+import org.apache.ws.resource.lifetime.v1_2_draft01.ResourceLifetime1_2Constants;
+
+import javax.xml.namespace.QName;
+
+/**
+ * The WSRF-RL ScheduledResourceTermination portType.
+ *
+ * @author Ian P. Springer (Hewlett-Packard Company)
+ */
+public interface ScheduledResourceTerminationPortType
+{
+
+    QName NAME = new QName( ResourceLifetime1_2Constants.NSURI_WSRL_WSDL, "ScheduledResourceTermination", ResourceLifetime1_2Constants.NSPREFIX_WSRL_WSDL );
+
+    /**
+     * CurrentTime property name.
+     */
+    QName PROP_QNAME_CURRENT_TIME = new QName( ResourceLifetime1_2Constants.NSURI_WSRL_SCHEMA, "CurrentTime", ResourceLifetime1_2Constants.NSPREFIX_WSRL_SCHEMA );
+
+    /**
+     * TerminationTime property name.
+     */
+    QName PROP_QNAME_TERMINATION_TIME = new QName( ResourceLifetime1_2Constants.NSURI_WSRL_SCHEMA, "TerminationTime", ResourceLifetime1_2Constants.NSPREFIX_WSRL_SCHEMA );
+
+    /**
+     * DOCUMENT_ME
+     *
+     * @param requestDoc DOCUMENT_ME
+     *
+     * @return DOCUMENT_ME
+     */
+    SetTerminationTimeResponseDocument setTerminationTime( SetTerminationTimeDocument requestDoc );
+
+}
\ No newline at end of file

Added: incubator/apollo/trunk/src/java/org/apache/ws/resource/lifetime/v1_2_draft01/porttype/impl/ImmediateResourceTerminationPortTypeImpl.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/lifetime/v1_2_draft01/porttype/impl/ImmediateResourceTerminationPortTypeImpl.java?view=auto&rev=154066
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/resource/lifetime/v1_2_draft01/porttype/impl/ImmediateResourceTerminationPortTypeImpl.java (added)
+++ incubator/apollo/trunk/src/java/org/apache/ws/resource/lifetime/v1_2_draft01/porttype/impl/ImmediateResourceTerminationPortTypeImpl.java Wed Feb 16 10:58:56 2005
@@ -0,0 +1,94 @@
+/*=============================================================================*
+ *  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.v1_2_draft01.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.properties.NamespaceVersionHolder;
+import org.apache.ws.resource.properties.v1_2_draft01.porttype.impl.NamespaceVersionHolderImpl;
+import org.apache.ws.resource.i18n.MessagesImpl;
+import org.apache.ws.resource.i18n.Keys;
+import org.apache.ws.resource.lifetime.faults.ResourceNotDestroyedFaultException;
+import org.apache.ws.resource.lifetime.v1_2_draft01.porttype.ImmediateResourceTerminationPortType;
+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(  ) );
+   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 );
+   }
+
+    protected NamespaceVersionHolder getNamespaceSet()
+    {
+        return NAMESPACE_SET;
+    }
+
+    /**
+    * 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(getResourceKey(  ))) );
+      try
+      {
+         getResourceHome(  ).remove( getResourceKey(  ) );
+      }
+      catch ( ResourceException re )
+      {
+         throw new ResourceNotDestroyedFaultException( NAMESPACE_SET, String.valueOf( getResourceKey(  ).getValue(  ) ),
+                                                       getResourceContext(  ).getServiceName(  ) );
+      }
+
+      return createResponseDocument(  );
+   }
+
+   private DestroyResponseDocument createResponseDocument(  )
+   {
+      DestroyResponseDocument responseDoc = DestroyResponseDocument.Factory.newInstance(  );
+      responseDoc.addNewDestroyResponse(  );
+      return responseDoc;
+   }
+}
\ No newline at end of file

Added: incubator/apollo/trunk/src/java/org/apache/ws/resource/lifetime/v1_2_draft01/porttype/impl/ScheduledResourceTerminationPortTypeImpl.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/lifetime/v1_2_draft01/porttype/impl/ScheduledResourceTerminationPortTypeImpl.java?view=auto&rev=154066
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/resource/lifetime/v1_2_draft01/porttype/impl/ScheduledResourceTerminationPortTypeImpl.java (added)
+++ incubator/apollo/trunk/src/java/org/apache/ws/resource/lifetime/v1_2_draft01/porttype/impl/ScheduledResourceTerminationPortTypeImpl.java Wed Feb 16 10:58:56 2005
@@ -0,0 +1,141 @@
+/*=============================================================================*
+ *  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.v1_2_draft01.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.v1_2_draft01.porttype.ScheduledResourceTerminationPortType;
+import org.apache.ws.resource.properties.impl.AbstractResourcePropertiesPortType;
+import org.apache.ws.resource.properties.NamespaceVersionHolder;
+import org.apache.ws.resource.properties.v1_2_draft01.porttype.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 );
+   }
+
+    protected NamespaceVersionHolder getNamespaceSet()
+    {
+        return NAMESPACE_SET;
+    }
+
+    /**
+    * 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(  ) ) )
+      {
+         destroyResource(  );
+         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(  );
+   }
+
+   private SetTerminationTimeResponseDocument createResponseDocument(  )
+   {
+      SetTerminationTimeResponseDocument responseDoc = SetTerminationTimeResponseDocument.Factory.newInstance(  );
+      responseDoc.addNewSetTerminationTimeResponse(  );
+      return responseDoc;
+   }
+
+   private void destroyResource(  )
+   {
+      LOG.debug( MSG.getMessage( Keys.DESTROYING_RESOURCE,getResourceContext(  ).getServiceName(  ),
+                 String.valueOf( getResourceKey(  ))) );
+      try
+      {
+         getResourceHome(  ).remove( getResourceKey(  ) );
+      }
+      catch ( ResourceException re )
+      {
+         throw new UnableToSetTerminationTimeFaultException( NAMESPACE_SET, null );
+      }
+   }
+
+   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: apollo-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: apollo-dev-help@ws.apache.org