ws-muse-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From w...@apache.org
Subject svn commit: r291979 - in /webservices/muse/trunk/src/examples/client/src/java/org/apache/ws/client/muse/client: ManageableResource.java impl/ManageableResourceImpl.java
Date Tue, 27 Sep 2005 15:56:06 GMT
Author: wire
Date: Tue Sep 27 08:56:03 2005
New Revision: 291979

URL: http://svn.apache.org/viewcvs?rev=291979&view=rev
Log:
Added Javadocs

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

Modified: webservices/muse/trunk/src/examples/client/src/java/org/apache/ws/client/muse/client/ManageableResource.java
URL: http://svn.apache.org/viewcvs/webservices/muse/trunk/src/examples/client/src/java/org/apache/ws/client/muse/client/ManageableResource.java?rev=291979&r1=291978&r2=291979&view=diff
==============================================================================
--- webservices/muse/trunk/src/examples/client/src/java/org/apache/ws/client/muse/client/ManageableResource.java
(original)
+++ webservices/muse/trunk/src/examples/client/src/java/org/apache/ws/client/muse/client/ManageableResource.java
Tue Sep 27 08:56:03 2005
@@ -10,6 +10,7 @@
 
 import org.apache.ws.addressing.EndpointReference;
 import org.apache.ws.addressing.XmlBeansEndpointReference;
+import org.apache.ws.client.muse.client.impl.ManageableResourceImpl;
 import org.apache.ws.client.muse.client.impl.exceptions.FaultException;
 import org.apache.ws.client.muse.client.impl.exceptions.UnexpectedServerResponseException;
 import org.apache.ws.client.muse.client.impl.notification.NotifyableResourceImpl;
@@ -62,46 +63,89 @@
 			UnexpectedServerResponseException, URISyntaxException, IOException,
 			XmlException;
 
+	/** 
+	 * Returns a specific property value as a String.
+	 * <b>Note:</b> this operation may not be supported by this resource.
+	 * A resource must implement GetResourceProperty for this method to work.
+	 * @return
+	 * @throws FaultException
+	 * @throws URISyntaxException
+	 * @throws IOException
+	 * @throws XmlException
+	 * @throws UnexpectedServerResponseException
+	 */	
 	public abstract String getPropertyAsString(QName propertyName)
 			throws FaultException, URISyntaxException, IOException,
 			XmlException, UnexpectedServerResponseException;
 
 	public abstract EndpointReference getEpr();
 
-	/* Returns a specific property value as a double.
-	 * 
-	 */
+	/** 
+	 * Returns a specific property value as a double.
+	 * <b>Note:</b> this operation may not be supported by this resource.
+	 * A resource must implement GetResourceProperty for this method to work.
+	 * @return
+	 * @throws FaultException	 * 
+	 * @throws URISyntaxException
+	 * @throws IOException
+	 * @throws XmlException
+	 * @throws UnexpectedServerResponseException
+	 */	
 	public abstract double getPropertyAsDouble(QName propertyName)
 			throws FaultException, URISyntaxException, IOException,
 			XmlException, UnexpectedServerResponseException;
 
-	/* 
+	/** 
 	 * Returns a specific property value as an integer.
-	 */
+	 * <b>Note:</b> this operation may not be supported by this resource.
+	 * A resource must implement GetResourceProperty for this method to work.
+	 * @return
+	 * @throws URISyntaxException
+	 * @throws IOException
+	 * @throws XmlException
+	 * @throws UnexpectedServerResponseException
+	 */	
 	public abstract int getPropertyAsInt(QName propertyName)
 			throws FaultException, URISyntaxException, IOException,
 			XmlException, UnexpectedServerResponseException;
 
-	/* 
-	 * Returns a specific property value as a bolean.
-	 */
+	/** 
+	 * Returns a specific property value as a boolean.
+	 * <b>Note:</b> this operation may not be supported by this resource.
+	 * A resource must implement GetResourceProperty for this method to work.
+	 * @return
+	 * @throws URISyntaxException
+	 * @throws IOException
+	 * @throws XmlException
+	 * @throws UnexpectedServerResponseException
+	 */	
 	public abstract boolean getPropertyAsBoolean(QName propertyName)
 			throws FaultException, URISyntaxException, IOException,
 			XmlException, UnexpectedServerResponseException;
 
-	/* Returns a specific property value as a untyped property as XMLObject[]. For clients
-	 * preferring to parse pure XML.
-	 * 
-	 */
+	/** 
+	 * Returns a specific property value as a untyped property as XMLObject[].
+	 * resource properties document. For clients preferring to parse pure XML.
+	 * <b>Note:</b> this operation may not be supported by this resource.
+	 * A resource must implement GetResourceProperty for this method to work.
+	 * @return
+	 * @throws FaultException
+	 * @throws URISyntaxException
+	 * @throws IOException
+	 * @throws XmlException
+	 * @throws UnexpectedServerResponseException
+	 */	
 	public abstract XmlObject[] getProperty(QName propertyName)
 			throws FaultException, URISyntaxException, IOException,
 			XmlException, UnexpectedServerResponseException;
 
+
 	/**
 	 * Returns a list of QNames of valid wsrf properties for this resource.
 	 * <b>Note:</b> this operation may not be supported by this resource. 
 	 * A resource must implement QueryResourceProperties for this method to work.
 	 * @return
+	 * @throws FaultException
 	 * @throws URISyntaxException
 	 * @throws IOException
 	 * @throws XmlException
@@ -110,11 +154,21 @@
 	public abstract QName[] getPropertyQNames() throws URISyntaxException,
 			IOException, XmlException, UnexpectedServerResponseException,FaultException;
 	
-
+	/** 
+	 * Takes and array of QNames and returns an XMLObject[] with corresponding values.
+	 * <b>Note:</b> this operation may not be supported by this resource.
+	 * A resource must implement GetMultipleResourceProperties for this method to work.
+	 * @return
+	 * @throws FaultException
+	 * @throws URISyntaxException
+	 * @throws IOException
+	 * @throws XmlException
+	 * @throws UnexpectedServerResponseException
+	 */	
 	public abstract XmlObject[] getMultipleResourceProperties(
 			QName[] requestedValues) throws URISyntaxException, IOException,
 			XmlException, UnexpectedServerResponseException,FaultException;
-
+	
 	/***************************** Notifications **************************/
 
 	/* (non-Javadoc)
@@ -122,7 +176,7 @@
 	 */
 	public abstract TopicExpression[] getTopics() throws FaultException,
 			URISyntaxException, IOException, XmlException,
-			UnexpectedServerResponseException,FaultException;
+			UnexpectedServerResponseException;
 
 	/* (non-Javadoc)
 	 * @see org.apache.ws.client.muse.client.impl.notification.Temp#isFixedTopicSet()
@@ -175,49 +229,198 @@
 
 	public abstract void destroy() throws URISyntaxException, IOException, XmlException, UnexpectedServerResponseException,
FaultException;
 
-	public abstract void updateProperty(QName property, double newValue)
-	throws URISyntaxException, IOException, XmlException,
-	UnexpectedServerResponseException, FaultException;
-
-public abstract void updateProperty(QName property, int newValue)
-	throws URISyntaxException, IOException, XmlException,
-	UnexpectedServerResponseException, FaultException;
-
-public abstract void updateProperty(QName property, float newValue)
-	throws URISyntaxException, IOException, XmlException,
-	UnexpectedServerResponseException, FaultException;
-
-public abstract void updateProperty(QName property, String newValue)
-	throws URISyntaxException, IOException, XmlException,
-	UnexpectedServerResponseException, FaultException;
-
-public abstract void insertProperty(QName property, double newValue)
-	throws URISyntaxException, IOException, XmlException,
-	UnexpectedServerResponseException, FaultException;
-
-public abstract void insertProperty(QName property, int newValue)
-	throws URISyntaxException, IOException, XmlException,
-	UnexpectedServerResponseException, FaultException;
-
-public abstract void insertProperty(QName property, float newValue)
-	throws URISyntaxException, IOException, XmlException,
-	UnexpectedServerResponseException, FaultException;
-
-public abstract void insertProperty(QName property, String newValue)
-	throws URISyntaxException, IOException, XmlException,
-	UnexpectedServerResponseException, FaultException;
-
-public abstract void deleteProperty(QName propertyToDelete)
-	throws URISyntaxException, IOException, XmlException,
-	UnexpectedServerResponseException, FaultException;
-
-/* updateProperties takes a SetPropertiesRequest instance which defines
-* Insert, Update and Delete requests and the order in which they were made.
-*/
-public abstract XmlObject setProperties(
-	SetPropertiesRequest modificationList)
-	throws URISyntaxException, IOException, XmlException,
-	UnexpectedServerResponseException, FaultException;
+	/** 
+	 * Updates the String contents for the QName component into the 
+	 * resource properties document.
+	 * <b>Note:</b> this operation may not be supported by this resource.
+	 * A resource must implement SetResourceProperties for this method to work.
+	 * @return
+	 * @throws FaultException
+	 * @throws URISyntaxException
+	 * @throws IOException
+	 * @throws XmlException
+	 * @throws UnexpectedServerResponseException
+	 */
+	public abstract void updateProperty(QName propertyName, String value)
+		throws FaultException, URISyntaxException, IOException, XmlException, 
+		UnexpectedServerResponseException;
+	
+	/** 
+	 * Updates the double contents for the QName component into the 
+	 * resource properties document.
+	 * <b>Note:</b> this operation may not be supported by this resource.
+	 * A resource must implement SetResourceProperties for this method to work.
+	 * @return
+	 * @throws FaultException 
+	 * @throws URISyntaxException
+	 * @throws IOException
+	 * @throws XmlException
+	 * @throws UnexpectedServerResponseException
+	 */
+	public abstract void updateProperty(QName propertyName, double value)
+		throws FaultException, URISyntaxException, IOException, XmlException, 
+		UnexpectedServerResponseException;
+	
+	/** 
+	 * Updates the integer contents for the QName component into the 
+	 * resource properties document.
+	 * <b>Note:</b> this operation may not be supported by this resource.
+	 * A resource must implement SetResourceProperties for this method to work.
+	 * @return
+	 * @throws FaultException
+	 * @throws URISyntaxException
+	 * @throws IOException
+	 * @throws XmlException
+	 * @throws UnexpectedServerResponseException
+	 */
+	public abstract void updateProperty(QName propertyName, int value)
+		throws FaultException, URISyntaxException, IOException, XmlException, 
+		UnexpectedServerResponseException;
+	
+	/** 
+	 * Updates the float contents for the QName component into the 
+	 * resource properties document.
+	 * <b>Note:</b> this operation may not be supported by this resource.
+	 * A resource must implement SetResourceProperties for this method to work.
+	 * @return
+	 * @throws FaultException
+	 * @throws URISyntaxException
+	 * @throws IOException
+	 * @throws XmlException
+	 * @throws UnexpectedServerResponseException
+	 */
+	public abstract void updateProperty(QName propertyName, float value)
+		throws FaultException, URISyntaxException, IOException, XmlException, 
+		UnexpectedServerResponseException;
+
+	/** 
+	 * Updates the boolean contents for the QName component into the 
+	 * resource properties document.
+	 * <b>Note:</b> this operation may not be supported by this resource.
+	 * A resource must implement SetResourceProperties for this method to work.
+	 * @return
+	 * @throws FaultException
+	 * @throws URISyntaxException
+	 * @throws IOException
+	 * @throws XmlException
+	 * @throws UnexpectedServerResponseException
+	 */
+	public abstract void updateProperty(QName propertyName, boolean value)
+		throws FaultException, URISyntaxException, IOException, XmlException, 
+		UnexpectedServerResponseException;
+
+	/** 
+	 * Inserts the String contents for the QName component into the 
+	 * resource properties document.
+	 * <b>Note:</b> this operation may not be supported by this resource.
+	 * A resource must implement SetResourceProperties for this method to work.
+	 * @return
+	 * @throws FaultException
+	 * @throws URISyntaxException
+	 * @throws IOException
+	 * @throws XmlException
+	 * @throws UnexpectedServerResponseException
+	 */
+	public abstract void insertProperty(QName propertyName, String value)
+			throws FaultException, URISyntaxException, IOException, XmlException, 
+			UnexpectedServerResponseException;
+
+	/** 
+	 * Inserts the double contents for the QName component into the 
+	 * resource properties document.
+	 * <b>Note:</b> this operation may not be supported by this resource.
+	 * A resource must implement SetResourceProperties for this method to work.
+	 * @return
+	 * @throws FaultException
+	 * @throws URISyntaxException
+	 * @throws IOException
+	 * @throws XmlException
+	 * @throws UnexpectedServerResponseException
+	 */
+	public abstract void insertProperty(QName propertyName, double value)
+			throws FaultException, URISyntaxException, IOException, XmlException, 
+			UnexpectedServerResponseException;
+
+	/** 
+	 * Inserts the integer contents for the QName component into the 
+	 * resource properties document.
+	 * <b>Note:</b> this operation may not be supported by this resource.
+	 * A resource must implement SetResourceProperties for this method to work.
+	 * @return
+	 * @throws FaultException
+	 * @throws URISyntaxException
+	 * @throws IOException
+	 * @throws XmlException
+	 * @throws UnexpectedServerResponseException
+	 */
+	public abstract void insertProperty(QName propertyName, int value)
+			throws FaultException, URISyntaxException, IOException, XmlException, 
+			UnexpectedServerResponseException;
+
+	/** 
+	 * Inserts the boolean contents for the QName component into the 
+	 * resource properties document.
+	 * <b>Note:</b> this operation may not be supported by this resource.
+	 * A resource must implement SetResourceProperties for this method to work.
+	 * @return
+	 * @throws FaultException
+	 * @throws URISyntaxException
+	 * @throws IOException
+	 * @throws XmlException
+	 * @throws UnexpectedServerResponseException
+	 */
+	public abstract void insertProperty(QName propertyName, boolean value)
+		throws FaultException, URISyntaxException, IOException, XmlException, 
+		UnexpectedServerResponseException;
+
+	/** 
+	 * Inserts the float contents for the QName component into the 
+	 * resource properties document.
+	 * <b>Note:</b> this operation may not be supported by this resource.
+	 * A resource must implement SetResourceProperties for this method to work.
+	 * @return
+	 * @throws FaultException
+	 * @throws URISyntaxException
+	 * @throws IOException
+	 * @throws XmlException
+	 * @throws UnexpectedServerResponseException
+	 */
+	public abstract void insertProperty(QName propertyName, float value)
+			throws FaultException, URISyntaxException, IOException, XmlException, 
+			UnexpectedServerResponseException;
+
+	/** 
+	 * Deletes all property with the specific QName passed in.
+	 * <b>Note:</b> this operation may not be supported by this resource.
+	 * A resource must implement SetResourceProperties for this method to work. 
+	 * @return
+	 * @throws FaultException
+	 * @throws URISyntaxException
+	 * @throws IOException
+	 * @throws XmlException
+	 * @throws UnexpectedServerResponseException
+	 */
+	public abstract void deleteProperty(QName propertyName)
+			throws FaultException, URISyntaxException, IOException, XmlException, 
+			UnexpectedServerResponseException;
+
+	
 
+	/** 
+	 * Takes a SetPropertiesRequest instance which stores all Insert, Update and Delete 
+	 * requests in order.
+	 * <b>Note:</b> this operation may not be supported by this resource.
+	 * A resource must implement SetResourceProperties for this method to work.
+	 * @return
+	 * @throws FaultException
+	 * @throws URISyntaxException
+	 * @throws IOException
+	 * @throws XmlException
+	 * @throws UnexpectedServerResponseException
+	 */	
+	public abstract XmlObject setProperties(
+		SetPropertiesRequest modificationList)
+		throws URISyntaxException, IOException, XmlException,
+		UnexpectedServerResponseException, FaultException;
 
  }

Modified: webservices/muse/trunk/src/examples/client/src/java/org/apache/ws/client/muse/client/impl/ManageableResourceImpl.java
URL: http://svn.apache.org/viewcvs/webservices/muse/trunk/src/examples/client/src/java/org/apache/ws/client/muse/client/impl/ManageableResourceImpl.java?rev=291979&r1=291978&r2=291979&view=diff
==============================================================================
--- webservices/muse/trunk/src/examples/client/src/java/org/apache/ws/client/muse/client/impl/ManageableResourceImpl.java
(original)
+++ webservices/muse/trunk/src/examples/client/src/java/org/apache/ws/client/muse/client/impl/ManageableResourceImpl.java
Tue Sep 27 08:56:03 2005
@@ -22,10 +22,14 @@
 import java.net.URISyntaxException;
 import java.net.URL;
 import java.util.ArrayList;
+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,12 +43,17 @@
 import org.apache.ws.client.muse.client.impl.wsrf.SetPropertiesRequestImpl;
 import org.apache.ws.client.muse.client.model.SetPropertiesRequest;
 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.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.XmlDoubleImpl;
@@ -52,17 +61,28 @@
 import org.apache.xmlbeans.impl.values.XmlStringImpl;
 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;
 
 public class ManageableResourceImpl  {
@@ -78,7 +98,7 @@
 	/**
 	 * Creates a ManageableResource from a class that implements
 	 * EndpointReference.
-	 * 
+	 *
 	 * @param epr
 	 * @throws MalformedURLException
 	 */
@@ -89,10 +109,10 @@
 		this.rs = new ResourceStub(epr);
 		this.ss = new ServiceStub(new URL(epr.getAddress()));
 	}
-		
+
 	/**
 	 * Creates a MangeableResource from an EPR persisted to a URL.
-	 * 
+	 *
 	 * @param url
 	 * @throws MalformedURLException
 	 * @throws XmlException
@@ -105,7 +125,7 @@
 
 	/**
 	 * Creates a MangeableResource from an Sting based text.
-	 * 
+	 *
 	 * @param url
 	 * @throws MalformedURLException
 	 * @throws XmlException
@@ -122,7 +142,7 @@
 	public String getId() throws FaultException,
 			UnexpectedServerResponseException, URISyntaxException, IOException,
 			XmlException {
-		LOG.info("Calling getId on " + this.epr.getAddress()); 
+		LOG.info("Calling getId on " + this.epr.getAddress());
 		XmlObject[] parts = rs
 				.getResourceProperty(IdentityCapability.PROP_NAME_RESOURCE_ID);
 		for (int i = 0; i < parts.length; i++) {
@@ -146,7 +166,7 @@
 	 * @see org.apache.ws.client.muse.client.impl.ManageableResource#getPropertyAsString(javax.xml.namespace.QName)
 	 */
 	public String getPropertyAsString(QName propertyName) throws FaultException, URISyntaxException,
IOException, XmlException, UnexpectedServerResponseException{
-		LOG.info("getting property value  "+propertyName+" from " + this.epr.getAddress()); 
+		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];
@@ -157,9 +177,9 @@
 			}
 		}
 		throw new UnexpectedServerResponseException(
-				"Server returned either an unrecognizable response or no String type was returned as
a response.");		
+				"Server returned either an unrecognizable response or no String type was returned as
a response.");
 	}
-	
+
 	/* (non-Javadoc)
 	 * @see org.apache.ws.client.muse.client.impl.ManageableResource#getEpr()
 	 */
@@ -185,13 +205,13 @@
 	}
 
 	/* Returns a specific property value as a double.
-	 * 
+	 *
 	 */
 	/* (non-Javadoc)
 	 * @see org.apache.ws.client.muse.client.impl.ManageableResource#getPropertyAsDouble(javax.xml.namespace.QName)
 	 */
 	public double getPropertyAsDouble(QName propertyName) throws FaultException, URISyntaxException,
IOException, XmlException, UnexpectedServerResponseException {
-		LOG.info("getting property value  "+propertyName+" from " + this.epr.getAddress()); 
+		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];
@@ -202,17 +222,17 @@
 			}
 		}
 		throw new UnexpectedServerResponseException(
-		"Server returned either an unrecognizable response or no String type was returned as a
response.");		
+		"Server returned either an unrecognizable response or no String type was returned as a
response.");
 	}
 
-	/* 
+	/*
 	 * Returns a specific property value as an integer.
 	 */
 	/* (non-Javadoc)
 	 * @see org.apache.ws.client.muse.client.impl.ManageableResource#getPropertyAsInt(javax.xml.namespace.QName)
 	 */
 	public int getPropertyAsInt(QName propertyName) throws FaultException, URISyntaxException,
IOException, XmlException, UnexpectedServerResponseException {
-		LOG.info("getting property value  "+propertyName+" from " + this.epr.getAddress()); 
+		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];
@@ -223,17 +243,17 @@
 			}
 		}
 		throw new UnexpectedServerResponseException(
-		"Server returned either an unrecognizable response or no String type was returned as a
response.");		
+		"Server returned either an unrecognizable response or no String type was returned as a
response.");
 	}
 
-	/* 
+	/*
 	 * Returns a specific property value as a bolean.
 	 */
 	/* (non-Javadoc)
 	 * @see org.apache.ws.client.muse.client.impl.ManageableResource#getPropertyAsBoolean(javax.xml.namespace.QName)
 	 */
 	public boolean getPropertyAsBoolean(QName propertyName) throws FaultException, URISyntaxException,
IOException, XmlException, UnexpectedServerResponseException {
-		LOG.info("getting property value  "+propertyName+" from " + this.epr.getAddress()); 
+		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];
@@ -244,18 +264,18 @@
 			}
 		}
 		throw new UnexpectedServerResponseException(
-		"Server returned either an unrecognizable response or no boolean type was returned as a
response.");		
+		"Server returned either an unrecognizable response or no boolean type was returned as a
response.");
 	}
 
 	/* Returns a specific property value as a untyped property as XMLObject[]. For clients
 	 * preferring to parse pure XML.
-	 * 
+	 *
 	 */
 	/* (non-Javadoc)
 	 * @see org.apache.ws.client.muse.client.impl.ManageableResource#getProperty(javax.xml.namespace.QName)
 	 */
 	public XmlObject[] getProperty(QName propertyName) throws FaultException, URISyntaxException,
IOException, XmlException, UnexpectedServerResponseException {
-		LOG.info("getting property value  "+propertyName+" from " + this.epr.getAddress()); 
+		LOG.info("getting property value  "+propertyName+" from " + this.epr.getAddress());
 		XmlObject[] parts = rs.getResourceProperty(propertyName);
 		return parts;
 	}
@@ -270,9 +290,9 @@
 		 XmlCursor cursor = expression.newCursor();
 		 cursor.setTextValue("/");
 		 cursor.dispose();
-		
+
         XmlObject parts = rs.sendRequest(queryDocument,"http://queryresourcepropertydocument","M");
-        
+
         if(!(parts instanceof QueryResourcePropertiesResponseDocument.QueryResourcePropertiesResponse))
         	throw new UnexpectedServerResponseException("Expected QueryResourcePropertiesResponseDocument
but received "+parts.getClass().getName());
         QueryResourcePropertiesResponseDocument.QueryResourcePropertiesResponse response=(QueryResourcePropertiesResponseDocument.QueryResourcePropertiesResponse)parts;
@@ -307,16 +327,16 @@
 		for (int i = 0; i < requestedValues.length; i++) {
 			query.addResourceProperty(requestedValues[i]);
 		}
-		
+
 		//Now send the request
        XmlObject parts = rs.sendRequest(gmpDoc,"http://getmultipleresourcepropertydocument","M");
-       
+
        if(!(parts instanceof GetMultipleResourcePropertiesResponseDocumentImpl.GetMultipleResourcePropertiesResponseImpl))
        	throw new UnexpectedServerResponseException("Expected GetMultipleResourcePropertiesResponseDocumentImpl
but received "+parts.getClass().getName());
 
        //type cast and walk the array to extract the responses
        GetMultipleResourcePropertiesResponseDocumentImpl.GetMultipleResourcePropertiesResponseImpl
response = (GetMultipleResourcePropertiesResponseDocumentImpl.GetMultipleResourcePropertiesResponseImpl)parts;
-       
+
        //Create cursor to walk through the response.
        XmlCursor cursor = response.newCursor();
         cursor.toChild(0);
@@ -324,18 +344,18 @@
 
        XmlObject obj = cursor.getObject();
        Vector infoList = new Vector(20);
-       
+
        //extract the first XmlObject
        XmlObject prop=cursor.getObject();
        infoList.add(prop);
-       
+
        //walk the sibling list to extract all objects
        while(cursor.toNextSibling()){
        	prop=cursor.getObject();
            infoList.add(prop);
        }
        cursor.dispose();
-       
+
 		return (XmlObject[]) infoList.toArray(new XmlObject[0]);
 	}
 
@@ -351,7 +371,7 @@
 ////		XmlDocumentProperties query = resPropDoc.documentProperties();
 ////		XmlDocumentProperties query = resPropDoc.();
 ////		GetMultipleResourceProperties query = gmpDoc.addNewGetMultipleResourceProperties();
-//		
+//
 //		//Now send the request
 //		XmlObject parts = rs.sendRequest(resPropDoc,
 //				"http://docs.oasis-open.org/wsrf/rpw-1/GetResourcePropertyDocument/GetResourcePropertyDocumentRequest","M");
@@ -359,14 +379,14 @@
 ////       XmlObject parts = rs.sendRequest(gmpDoc,"http://getmultipleresourcepropertydocument","M");
 //
 //		if(!(parts instanceof GetResourcePropertyDocumentImpl))
-//			throw new UnexpectedServerResponseException("Expected GetResourcePropertyDocumentImpl
but received "+parts.getClass().getName());	
+//			throw new UnexpectedServerResponseException("Expected GetResourcePropertyDocumentImpl
but received "+parts.getClass().getName());
 ////       if(!(parts instanceof GetMultipleResourcePropertiesResponseDocumentImpl.GetMultipleResourcePropertiesResponseImpl))
 ////       	throw new UnexpectedServerResponseException("Expected GetMultipleResourcePropertiesResponseDocumentImpl
but received "+parts.getClass().getName());
 //
 //       //type cast and walk the array to extract the responses
 //		GetResourcePropertyDocumentImpl response = (GetResourcePropertyDocumentImpl)parts;
 ////       GetMultipleResourcePropertiesResponseDocumentImpl.GetMultipleResourcePropertiesResponseImpl
response = (GetMultipleResourcePropertiesResponseDocumentImpl.GetMultipleResourcePropertiesResponseImpl)parts;
-//       
+//
 //       //Create cursor to walk through the response.
 //       XmlCursor cursor = response.newCursor();
 //        cursor.toChild(0);
@@ -374,25 +394,25 @@
 //
 ////       XmlObject obj = cursor.getObject();
 ////       Vector infoList = new Vector(20);
-//       
+//
 //       //extract the first XmlObject
 //       XmlObject prop=cursor.getObject();
 ////       infoList.add(prop);
-////       
+////
 ////       //walk the sibling list to extract all objects
 ////       while(cursor.toNextSibling()){
 ////       	prop=cursor.getObject();
 ////           infoList.add(prop);
 ////       }
 //       cursor.dispose();
-//       
+//
 //       return prop;
 ////		return (XmlObject[]) infoList.toArray(new XmlObject[0]);
 //	}
 
 	/* Takes an XPath query and a dialect, and returns the results as an XMLObject[].
-	 * Operation returns a subset of the ResourceProperties or an XPath operation on 
-	 * the same. 
+	 * Operation returns a subset of the ResourceProperties or an XPath operation on
+	 * the same.
 	 */
 	public XmlObject[] queryResourceProperties(String xpathExp, String xpthDialect) throws URISyntaxException,
IOException, XmlException, UnexpectedServerResponseException, FaultException {
 
@@ -403,17 +423,20 @@
 		//add the query expression
 		QueryExpressionType expression = query.addNewQueryExpression();
 		 //set the specific dialect to use
-		 expression.setDialect("http://www.w3.org/TR/1999/REC-xpath-19991116");
-		 //Manipulate the xml 
+		expression.setDialect("http://www.w3.org/TR/1999/REC-xpath-19991116");
+		 expression.setDialect(xpthDialect.trim());
+		 //Manipulate the xml
 		 XmlCursor cursor = expression.newCursor();
 		 //insert the xpath component
 		 cursor.setTextValue(xpathExp);
 		 cursor.dispose();
-		
+
        XmlObject parts = rs.sendRequest(queryDocument,"http://queryresourcepropertydocument","M");
+       if(parts instanceof FaultImpl)
+          	throw new FaultException(parts.toString());
        if(!(parts instanceof QueryResourcePropertiesResponseDocument.QueryResourcePropertiesResponse))
        	throw new UnexpectedServerResponseException("Expected QueryResourcePropertiesResponseDocument
but received "+parts.getClass().getName());
-       
+
        //cast to response
        QueryResourcePropertiesResponseDocument.QueryResourcePropertiesResponse response=(QueryResourcePropertiesResponseDocument.QueryResourcePropertiesResponse)parts;
 
@@ -421,19 +444,19 @@
        cursor=response.newCursor();
        cursor.toChild(0);
        cursor.toFirstChild();
-       
+
        //store all encountered responses
        Vector infoList = new Vector(20);
        XmlObject propValue=cursor.getObject();
        infoList.add(propValue);
-       
+
        //for numerous response components
        while(cursor.toNextSibling()){
        		propValue=cursor.getObject();
             infoList.add(propValue);
        }
        cursor.dispose();
-       
+
        //build the response
        return (XmlObject[]) infoList.toArray(new XmlObject[0]);
 	}
@@ -445,24 +468,28 @@
 		boolean completed =setRequest.addUpdateRequest(property,updates);
 		setProperties(setRequest);
 		success = true;
-		return success;
+	  return success;
 	}
-	
+
 	public void updateProperty(QName property, double newValue) throws URISyntaxException, IOException,
XmlException, UnexpectedServerResponseException, FaultException{
 		String[] updates = {String.valueOf(newValue)};
-		boolean success = updateProperty(property, updates);
+		updateProperty(property, updates);
 	}
 	public void updateProperty(QName property, int newValue) throws URISyntaxException, IOException,
XmlException, UnexpectedServerResponseException, FaultException{
 		String[] updates = {String.valueOf(newValue)};
-		boolean success = updateProperty(property, updates);
+		updateProperty(property, updates);
 	}
 	public void updateProperty(QName property, float newValue) throws URISyntaxException, IOException,
XmlException, UnexpectedServerResponseException, FaultException{
 		String[] updates = {String.valueOf(newValue)};
-		boolean success = updateProperty(property, updates);
+		updateProperty(property, updates);
 	}
 	public void updateProperty(QName property, String newValue) throws URISyntaxException, IOException,
XmlException, UnexpectedServerResponseException, FaultException{
 		String[] updates = {newValue};
-		boolean success = updateProperty(property, updates);
+		updateProperty(property, updates);
+	}
+	public void updateProperty(QName property, boolean newValue) throws URISyntaxException,
IOException, XmlException, UnexpectedServerResponseException, FaultException{
+		String[] updates = {String.valueOf(newValue)};
+		updateProperty(property, updates);
 	}
 
 	private void insertProperty(QName property, String[] updates) throws URISyntaxException,
IOException, XmlException, UnexpectedServerResponseException, FaultException {
@@ -487,106 +514,40 @@
 		insertProperty(property, inserts);
 	}
 	public void insertProperty(QName property, String newValue) throws URISyntaxException, IOException,
XmlException, UnexpectedServerResponseException, FaultException{
-		 String[] inserts = {newValue};
+		String[] inserts = {newValue};
+		insertProperty(property, inserts);
+	}
+	public void insertProperty(QName property, boolean newValue) throws URISyntaxException,
IOException, XmlException, UnexpectedServerResponseException, FaultException{
+		 String[] inserts = {String.valueOf(newValue)};
 		 insertProperty(property, inserts);
 	}
-	
+
 	public void deleteProperty(QName propertyToDelete) throws URISyntaxException, IOException,
XmlException, UnexpectedServerResponseException, FaultException{
 		boolean success = false;
-		//insert that property
-			SetPropertiesRequestImpl setRequest = new SetPropertiesRequestImpl();
-			boolean completed =setRequest.addDeleteRequest(propertyToDelete);
-			setProperties(setRequest);
-			 success = true;
+		//delete that property
+		SetPropertiesRequestImpl setRequest = new SetPropertiesRequestImpl();
+		boolean completed =setRequest.addDeleteRequest(propertyToDelete);
+		setProperties(setRequest);
 	}
 
-//	public boolean updatePropertyWithDouble(QName price, double newVal) throws URISyntaxException,
IOException, XmlException, UnexpectedServerResponseException {
-//		boolean success = false;
-//		
-//		//build the change document
-//		SetResourcePropertiesDocument setPropsDocument = SetResourcePropertiesDocument.Factory.newInstance();
-//		//add the set properties component
-//		SetResourceProperties query = setPropsDocument.addNewSetResourceProperties();
-//		//add the update expression
-//		UpdateType modification = query.addNewUpdate();
-//		//Manipulate the xml 
-//		XmlCursor cursor = modification.newCursor();
-//		//Now begin to add each update element
-//		//tmp string conversion?
-//		String txt = String.valueOf(newVal);
-////		modification.
-//		//add all update parameters to the current node
-//		
-////		addItemsToNode(price, cursor, txt);
-////		QName[] updateQnameList = new QName[2]; updateQnameList[0] = TestResourcePropertyQNames.PRICE;
-//		QName[] updateQnameList = new QName[1]; updateQnameList[0] = TestResourcePropertyQNames.PRICE;
-////		updateQnameList[1] = TestResourcePropertyQNames.NAME;
-////		String[] updatePropValList = new String[2]; updatePropValList[0]=String.valueOf(newVal);
-//		String[] updatePropValList = new String[1]; updatePropValList[0]=String.valueOf(newVal);
-////		updatePropValList[1]="NewlyTHoughtOfName";
-//		
-//		addItemsToNode(updateQnameList, cursor, updatePropValList);
-//		
-//		
-////		validateXmlBean(setPropsDocument);
-//		
-////		//now add the other two elements
-////		DeleteType delete = query.addNewDelete();
-////		delete.setResourceProperty(TestResourcePropertyQNames.OPERATIONALSTATUS);
-////		InsertType insert = query.addNewInsert();
-////		XmlCursor iCursor = insert.newCursor();
-////		QName[] updateQnameList = new QName[1]; updateQnameList[0] = TestResourcePropertyQNames.NAME;
-////		String[] updatePropValList = new String[1]; updatePropValList[0]=String.valueOf("NewName");
-////		addItemsToNode(updateQnameList,iCursor,updatePropValList);
-//		
-////		XmlObject parts = rs.sendRequest(queryDocument,"http://updateresourcepropertydocument","M");
-//		XmlObject parts = rs.sendRequest(setPropsDocument,"http://docs.oasis-open.org/wsrf/2004/06/WS-ResourceProperties/SetResourceProperties","M");
-//		if(!(parts instanceof SetResourcePropertiesResponseDocumentImpl.SetResourcePropertiesResponseImpl))
-//			throw new UnexpectedServerResponseException("Expected SetResourcePropertiesResponseDocumentImpl
but received "+parts.getClass().getName());
-//		
-//		//cast to response
-//		SetResourcePropertiesResponseDocumentImpl.SetResourcePropertiesResponseImpl response

-//		=(SetResourcePropertiesResponseDocumentImpl.SetResourcePropertiesResponseImpl)parts;
-//		
-//		//navigate the document to retrieve all the properties
-//		cursor=response.newCursor();
-//		cursor.toChild(0);
-//		cursor.toFirstChild();
-//		
-//		//store all encountered responses
-//		Vector infoList = new Vector(20);
-//		XmlObject propValue=cursor.getObject();
-//		infoList.add(propValue);
-//		
-//		//for numerous response components
-//		while(cursor.toNextSibling()){
-//			propValue=cursor.getObject();
-//			infoList.add(propValue);
-//		}
-//		cursor.dispose();
-//		success = true;	
-//		
-//		return success;
-//	}
-
 	/* updateProperties takes a SetPropertiesRequest instance which defines
 	 * Insert, Update and Delete requests and the order in which they were made.
 	 */
 	public XmlObject setProperties(SetPropertiesRequest modificationList) throws URISyntaxException,
IOException, XmlException, UnexpectedServerResponseException, FaultException {
-		
+
 		//build the SetResourceProperties document
-		SetResourcePropertiesDocument setPropsDocument = 
+		SetResourcePropertiesDocument setPropsDocument =
 			SetResourcePropertiesDocument.Factory.newInstance();
 		//add the set properties component
 		SetResourceProperties request = setPropsDocument.addNewSetResourceProperties();
 		XmlCursor cursor = null;
-		
+
 		//iterate through the SetPropertiesRequest to populate the SetResourcePropertiesDocument
 		for (int i = 0; i < modificationList.getAllResourcesIndex(); i++) {
-			
+
 			//Retrieve the current object
 			Object resMod = modificationList.getAllSetResourceRequests().get(i);
-			
+
 			if (resMod instanceof QName) { //Then this is a delete request
 				QName deleteParameter = (QName) resMod;
 				//Then create the xml for the delete
@@ -599,51 +560,53 @@
 					//is an insert request.  Building appropriate xml
 					//add the insert expression
 					InsertType modification = request.addNewInsert();
-					//Manipulate the xml 
+					//Manipulate the xml
 					cursor = modification.newCursor();
-					
+
 					//add all update parameters to the current node
 					addItemsToNode(custRequest.getProperty(),cursor,custRequest.getPropetyValues());
 				}
 				else{//is an update request.  Building appropriate xml
 					//add the update expression
 					UpdateType modification = request.addNewUpdate();
-					//Manipulate the xml 
+					//Manipulate the xml
 					cursor = modification.newCursor();
-					
+
 					//add all update parameters to the current node
 					addItemsToNode(custRequest.getProperty(),cursor,custRequest.getPropetyValues());
 				}
 			}
 		}
-		
-//		validateXmlBean(setPropsDocument);
+
+		validateXmlBean(setPropsDocument);
 
 		XmlObject parts = rs.sendRequest(setPropsDocument,"http://docs.oasis-open.org/wsrf/2004/06/WS-ResourceProperties/SetResourceProperties","M");
+		if(parts instanceof FaultImpl)
+			throw new FaultException(parts.toString());
 		if(!(parts instanceof SetResourcePropertiesResponseDocumentImpl.SetResourcePropertiesResponseImpl))
 			throw new UnexpectedServerResponseException("Expected SetResourcePropertiesResponseDocumentImpl
but received "+parts.getClass().getName());
-		
+
 		//cast to response
-		SetResourcePropertiesResponseDocumentImpl.SetResourcePropertiesResponseImpl response 
+		SetResourcePropertiesResponseDocumentImpl.SetResourcePropertiesResponseImpl response
 		=(SetResourcePropertiesResponseDocumentImpl.SetResourcePropertiesResponseImpl)parts;
-		
+
 		//navigate the document to retrieve all the properties
 		cursor=response.newCursor();
 		cursor.toChild(0);
 		cursor.toFirstChild();
-		
+
 		//store all encountered responses
 		Vector infoList = new Vector(20);
 		XmlObject propValue=cursor.getObject();
 		infoList.add(propValue);
-		
+
 		//for numerous response components
 		while(cursor.toNextSibling()){
 			propValue=cursor.getObject();
 			infoList.add(propValue);
 		}
 		cursor.dispose();
-		
+
 		return propValue;
 	}
 
@@ -653,27 +616,20 @@
 	private void addItemsToNode(QName propQname, XmlCursor cursor, String[] propList) throws
IllegalArgumentException {
 		//store away reference to original cursor location
 		XmlCursor origCursorLocation = cursor.newCursor();
-		
+
 		//For each property value encountered, create sub nodes
 		for (int i = 0; i < propList.length; i++) {
 			XmlCursor listCursorPosition = origCursorLocation.newCursor();
 			cursor = origCursorLocation.newCursor();
-			//Create a new node 
+			//Create a new node
 			cursor.insertElementWithText(propQname,propList[i]);
-//			   System.out.println("QName:"+propQname);
-//			   System.out.println("Val:"+cursor.getName());
-//			   System.out.println("Val:"+listCursorPosition.getName());
-			   boolean suc = cursor.toParent();
-//			   System.out.println("To Par:"+suc);
-//			   System.out.println("Val:"+cursor.getName());
-//			   System.out.println("Val:"+listCursorPosition.getName());
+			cursor.toParent();
 
 			cursor.toChild(propQname);
 			//move the cursor positioning
 			listCursorPosition.toNextToken();
 			//stitch the node into new location
 			cursor.copyXml(listCursorPosition);
-//			   System.out.println("Val-q:"+cursor.getName());
 			//remove the original node
 			cursor.removeXml();
 			//clean up
@@ -683,20 +639,19 @@
 	}
 
 //	public XmlObject[] getMetric(QName testmetric) throws FaultException, URISyntaxException,
IOException, XmlException, UnexpectedServerResponseException {
-//		LOG.info("getting Metric value  "+testmetric+" from " + this.epr.getAddress()); 
+//		LOG.info("getting Metric value  "+testmetric+" from " + this.epr.getAddress());
 //		XmlObject[] parts = rs.getResourceProperty(testmetric);
 //		if(parts==null||parts.length==0){
 //			throw new UnexpectedServerResponseException(
-//			"Server returned no metric values in response.");		
+//			"Server returned no metric values in response.");
 //		}
-//		
+//
 //		XmlObject part = parts[0];
 //		part.changeType();
-//		
+//
 //		return parts;
 //	}
 
-	
 	public static void validateXmlBean(XmlObject requestXBean) throws ParseException{
 	    XmlOptions validateOptions = new XmlOptions(  );
 	    List       errorList = new ArrayList(  );
@@ -721,9 +676,9 @@
 	       throw new ParseException(
 	                                 strBuf.toString(  ),0 );
 	    }
-	        
+
 	}
-	
+
 	//helper method to create SetPropertiesRequest instance
 	public SetPropertiesRequest createNewSetPropertiesRequest(){
 		return new SetPropertiesRequestImpl();



Mime
View raw message