1
2
3
4
5
6
7 package gov.noaa.gdsg.xmldbremote.xmldbClient;
8
9 /***
10 * This uses the Resource Transport object and the stub to create an
11 * API compatable with the XML:DB API.
12 *
13 * @author tns
14 * @version $Id: XmldbClientResource.java,v 1.2 2004/11/03 23:52:39 mrxtravis Exp $
15 */
16 public abstract class XmldbClientResource implements org.xmldb.api.base.Resource {
17
18 /***
19 * Used to make the SOAP calls.
20 */
21 protected gov.noaa.gdsg.xmldbremote.NmmrdbSoapBindingStub stub = null;
22 /*** Holds value of property resourceTransport. */
23 protected gov.noaa.gdsg.xmldbremote.Resource resourceTransport;
24
25 /***
26 * Holds the parent collection.
27 */
28 protected gov.noaa.gdsg.xmldbremote.xmldbClient.XmldbClientCollection parentCollection = null;
29
30
31 /***
32 * Creates a new instance of XmldbClientResource
33 * @param resourceTransport represents a resource transport on the remote machine.
34 * @param stub Used to make calls to the server
35 * @param parentCollection The collectoin this resource is associated with.
36 */
37 public XmldbClientResource(gov.noaa.gdsg.xmldbremote.Resource resourceTransport,
38 gov.noaa.gdsg.xmldbremote.NmmrdbSoapBindingStub stub,
39 gov.noaa.gdsg.xmldbremote.xmldbClient.XmldbClientCollection parentCollection) {
40
41 if (stub == null){
42 throw new NullPointerException("XmldbClientResource cannot have a null "
43 + " stub parameter");
44 }
45 if (resourceTransport == null){
46 throw new NullPointerException("XmldbClientResource cannot have a null "
47 + " resourceTransport parameter");
48 }
49 if (parentCollection == null){
50 throw new NullPointerException("XmldbClientResource cannot have a null "
51 + " parentCollection parameter");
52 }
53
54 this.stub = stub;
55 this.resourceTransport = resourceTransport;
56 this.parentCollection = parentCollection;
57 }
58
59 /*** Getter method for the resrouceTransport object
60 *@return The Resource
61 */
62 public gov.noaa.gdsg.xmldbremote.Resource getResourceTransport(){
63 return this.resourceTransport;
64 }
65
66 /***
67 * Throws a NOT_IMPLEMENTED exception because we do not know how to
68 * support XML objects that are not a generic DOM. Use {@link XmldbClientResource}
69 * to get the content as a {@link org.w3c.dom.Node}.
70 * @return Nothing, ever.
71 * @throws org.xmldb.api.base.XMLDBException Always with ErrorCodes.NOT_IMPLEMENTED
72 */
73 public Object getContent() throws org.xmldb.api.base.XMLDBException {
74 throw new org.xmldb.api.base.XMLDBException(
75 org.xmldb.api.base.ErrorCodes.NOT_IMPLEMENTED);
76 }
77
78 /***
79 * Returts the ID representing this resource.
80 * @return The id as a String
81 *@throws org.xmldb.api.base.XMLDBException All exceptions are caught and rethrown as one.
82 */
83 public String getId() throws org.xmldb.api.base.XMLDBException {
84 return this.resourceTransport.getId();
85 }
86
87 /*** Retrieves the parent collection.
88 *@throws org.xmldb.api.base.XMLDBException All exceptions are caught and rethrown as one.
89 *@return The parent collection.
90 */
91 public org.xmldb.api.base.Collection getParentCollection() throws org.xmldb.api.base.XMLDBException {
92 return this.parentCollection;
93 }
94
95 /*** Returns the resource type of this resource
96 * @return the resource as a String
97 *@throws org.xmldb.api.base.XMLDBException All exceptions are caught and rethrown as one.
98 */
99 public abstract String getResourceType() throws org.xmldb.api.base.XMLDBException;
100
101 /***Throws a NOT_IMPLEMENTED exception because we can not deal with
102 * unknown objects over SOAP. Use the {@link XmddbClientXMLResource} class to set content as DOM.
103 *@throws org.xmldb.api.base.XMLDBException always as ErrorCodes.NOT_IMPLEMENTED
104 * @param obj Ignored.
105 */
106 public void setContent(Object obj) throws org.xmldb.api.base.XMLDBException {
107 throw new org.xmldb.api.base.XMLDBException(
108 org.xmldb.api.base.ErrorCodes.NOT_IMPLEMENTED);
109 }
110
111 }