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 wi...@apache.org on 2005/10/06 18:19:26 UTC

svn commit: r306799 - /webservices/muse/trunk/client/src/java/org/apache/ws/client/muse/client/impl/ManageableResourceImpl.java

Author: wire
Date: Thu Oct  6 09:19:21 2005
New Revision: 306799

URL: http://svn.apache.org/viewcvs?rev=306799&view=rev
Log:
-add convenience method for XMLDateTime

Modified:
    webservices/muse/trunk/client/src/java/org/apache/ws/client/muse/client/impl/ManageableResourceImpl.java

Modified: webservices/muse/trunk/client/src/java/org/apache/ws/client/muse/client/impl/ManageableResourceImpl.java
URL: http://svn.apache.org/viewcvs/webservices/muse/trunk/client/src/java/org/apache/ws/client/muse/client/impl/ManageableResourceImpl.java?rev=306799&r1=306798&r2=306799&view=diff
==============================================================================
--- webservices/muse/trunk/client/src/java/org/apache/ws/client/muse/client/impl/ManageableResourceImpl.java (original)
+++ webservices/muse/trunk/client/src/java/org/apache/ws/client/muse/client/impl/ManageableResourceImpl.java Thu Oct  6 09:19:21 2005
@@ -22,10 +22,15 @@
 import java.net.URISyntaxException;
 import java.net.URL;
 import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Vector;
 
 import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -39,29 +44,56 @@
 import org.apache.ws.client.muse.client.impl.wsrf.SetPropertiesRequestImpl;
 import org.apache.ws.client.muse.client.model.PropertiesList;
 import org.apache.ws.muws.v1_0.capability.IdentityCapability;
+import org.apache.ws.service.testresource.TestResourcePropertyQNames;
 import org.apache.ws.util.XmlBeanUtils;
 import org.apache.xmlbeans.XmlCursor;
+import org.apache.xmlbeans.XmlDateTime;
+import org.apache.xmlbeans.XmlDocumentProperties;
 import org.apache.xmlbeans.XmlException;
 import org.apache.xmlbeans.XmlObject;
 import org.apache.xmlbeans.XmlOptions;
 import org.apache.xmlbeans.impl.regex.ParseException;
+import org.apache.xmlbeans.impl.soap.Node;
+import org.apache.xmlbeans.impl.soap.SOAPElement;
+import org.apache.xmlbeans.impl.soap.SOAPException;
 import org.apache.xmlbeans.impl.values.XmlAnyUriImpl;
 import org.apache.xmlbeans.impl.values.XmlBooleanImpl;
+import org.apache.xmlbeans.impl.values.XmlDateTimeImpl;
 import org.apache.xmlbeans.impl.values.XmlDoubleImpl;
 import org.apache.xmlbeans.impl.values.XmlIntImpl;
 import org.apache.xmlbeans.impl.values.XmlStringImpl;
+import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceLifetime12Draft01.CurrentTimeDocument;
+import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceLifetime12Draft01.DestroyDocument;
+import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceLifetime12Draft01.DestroyResponseDocument;
+import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceLifetime12Draft01.SetTerminationTimeDocument;
+import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceLifetime12Draft01.SetTerminationTimeResponseDocument;
+import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceLifetime12Draft01.SetTerminationTimeDocument.SetTerminationTime;
+import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceLifetime12Draft01.impl.DestroyDocumentImpl;
+import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceLifetime12Draft01.impl.DestroyResponseDocumentImpl;
+import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceLifetime12Draft01.impl.SetTerminationTimeResponseDocumentImpl;
 import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.DeleteType;
 import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.GetMultipleResourcePropertiesDocument;
+import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.GetResourcePropertyDocument;
 import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.InsertType;
 import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.QueryExpressionType;
 import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.QueryResourcePropertiesDocument;
 import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.QueryResourcePropertiesResponseDocument;
 import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.SetResourcePropertiesDocument;
+import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.QueryResourcePropertiesResponseDocument;
+import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.SetResourcePropertiesResponseDocument;
 import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.UpdateType;
 import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.GetMultipleResourcePropertiesDocument.GetMultipleResourceProperties;
 import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.QueryResourcePropertiesDocument.QueryResourceProperties;
 import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.SetResourcePropertiesDocument.SetResourceProperties;
+import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.impl.GetMultipleResourcePropertiesDocumentImpl;
 import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.impl.GetMultipleResourcePropertiesResponseDocumentImpl;
+import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.impl.GetResourcePropertyDocumentImpl;
+import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.impl.QueryResourcePropertiesDocumentImpl;
+import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.impl.SetResourcePropertiesResponseDocumentImpl;
+import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.impl.QueryResourcePropertiesDocumentImpl.QueryResourcePropertiesImpl;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Text;
 import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.impl.SetResourcePropertiesResponseDocumentImpl;
 import org.xmlsoap.schemas.soap.envelope.impl.FaultImpl;
 import org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceDocument;
@@ -228,6 +260,26 @@
 	}
 
 	/*
+	 * Returns a specific property value as an XmlDateTime object.
+	 */
+	/* (non-Javadoc)
+	 * @see org.apache.ws.client.muse.client.impl.ManageableResource#getPropertyAsBoolean(javax.xml.namespace.QName)
+	 */
+	public XmlDateTime getPropertyAsDateTime(QName propertyName) throws FaultException, URISyntaxException, IOException, XmlException, UnexpectedServerResponseException {
+		LOG.info("getting property value  "+propertyName+" from " + this.epr.getAddress());
+		XmlObject[] parts = rs.getResourceProperty(propertyName);
+		for (int i = 0; i < parts.length; i++) {
+			XmlObject xmlObject = parts[i];
+			if (xmlObject instanceof XmlDateTimeImpl) {
+				XmlDateTimeImpl childElement = (XmlDateTimeImpl) xmlObject;
+				return childElement;
+			}
+		}
+		throw new UnexpectedServerResponseException(
+		"Server returned either an unrecognizable response or no boolean type was returned as a response.");
+	}
+
+	/*
 	 * Returns a specific property value as a bolean.
 	 */
 	/* (non-Javadoc)
@@ -280,7 +332,6 @@
         cursor=response.newCursor();
         cursor.toChild(0);
         cursor.toFirstChild();
-        XmlAnyUriImpl obj = (XmlAnyUriImpl)cursor.getObject();
         Vector infoList = new Vector(20);
         QName propName=cursor.getName();
         infoList.add(propName);
@@ -673,4 +724,5 @@
 	public PropertiesList createNewSetPropertiesRequest(){
 		return new SetPropertiesRequestImpl();
 	}
+
 }