View Javadoc

1   /*
2    * Copyright 2001-2005 The Apache Software Foundation.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package net.sf.nxqd.xmldb;
17  
18  import java.util.List;
19  import java.util.ArrayList;
20  import java.util.logging.Level;
21  import java.util.logging.Logger;
22  
23  import net.sf.nxqd.NxqdException;
24  
25  import org.xmldb.api.base.Collection;
26  import org.xmldb.api.base.Database;
27  import org.xmldb.api.base.XMLDBException;
28  import org.xmldb.api.base.ErrorCodes;
29  import org.xmldb.api.base.Resource;
30  import org.xmldb.api.modules.XMLResource;
31  
32  
33  /**
34   * @see org.xmldb.api.base.Resource
35   *
36   * @author <a href="mailto:"></a>
37   * @version 1.0
38   */
39  abstract class NxqdResource extends NxqdService implements Resource {
40  
41      /**
42       * The variable <code>logger</code> is used for logging events.
43       *
44       */
45      private static Logger logger = Logger.getLogger(NxqdResource.class.getName());
46      private Object content;
47      private String type;
48  
49      /**
50       * The a new <code>NxqdResource</code> constructor creates a new instance
51       * of a NxqdResource.
52       *
53       */
54      public NxqdResource(Collection parent, String id, String type)
55  	throws NxqdException, XMLDBException {
56  	super(id, "1.0");
57  	setCollection(parent);
58  	this.type = type; // XML or Binary
59      }
60  
61      /**
62       * @see org.xmldb.api.base.Resource#getContent()
63       */
64      public java.lang.Object getContent()
65  	throws XMLDBException {
66  	return content;
67      }
68  
69      /**
70       * @see org.xmldb.api.base.Resource#setContent(java.lang.Object)
71       */
72      public void setContent(java.lang.Object value)
73  	throws XMLDBException {
74  	this.content = value;
75      }
76      
77      /**
78       * @see org.xmldb.api.base.Resource#getResourceType()
79       */
80      public java.lang.String getResourceType()
81  	throws XMLDBException {
82  	return type;
83      }
84  
85      /**
86       * @see org.xmldb.api.base.Resource#getId()
87       */
88      public java.lang.String getId()
89  	throws XMLDBException {
90  	return getName();
91      }
92  
93      /**
94       * @see org.xmldb.api.base.Resource#getParentCollection()
95       */
96      public Collection getParentCollection()
97  	throws XMLDBException {
98  	return getCollection();
99      }
100 }
101