KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > ws > jaxme > PM


1 /*
2  * Copyright 2003, 2004 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  */

17 package org.apache.ws.jaxme;
18
19 import javax.xml.bind.Element;
20 import javax.xml.bind.JAXBException;
21
22
23 /** <p>The <code>persistence manager</code> (or <code>PM</code>
24  * for short) is responsible for reading objects from the
25  * database or storing them into the database.</p>
26  *
27  * @author <a HREF="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
28  */

29 public interface PM {
30   /** <p>Initializes the PM. Called from the
31    * {@link org.apache.ws.jaxme.impl.JAXBContextImpl} upon initialization.</p>
32    * @param pManager The manager being queried for configuration details.
33    */

34   public void init(JMManager pManager) throws JAXBException;
35
36   /** <p>Returns the manager being queried for configuration details.</p>
37    */

38   public JMManager getManager();
39
40   /** <p>Reads documents matching the given query. For any document
41    * matching, the Observer's notify method is executed with the
42    * matching document as an argument.</p>
43    *
44    * @param pObserver This Observer is notified for any matching document.
45    * The document is added as an argument.
46    * @param pQuery The query to perform.
47    */

48   public void select(Observer pObserver, String JavaDoc pQuery) throws JAXBException;
49
50   /** <p>Reads documents matching the given query. For any document
51    * matching, the Observer's notify method is executed with the
52    * matching document as an argument.</p>
53    * <p>The query may contain placeholders. If it does, you have
54    * to supply an instance of {@link PMParams} with the placeholder
55    * values. Example:
56    * <pre>
57    * manager.select("Name = ? and Id = ?",
58    * new PMParams().addString("Someone").addInt(4));
59    * </pre></p>
60    *
61    * @param pObserver This Observer is notified for any matching document.
62    * The document is added as an argument.
63    * @param pQuery The query to perform. May contain placeholders.
64    * @param pPlaceHolderArgs An array of objects or null, if the
65    * query doesn't contain any placeholders.
66    */

67   public void select(Observer pObserver, String JavaDoc pQuery,
68                       PMParams pPlaceHolderArgs) throws JAXBException;
69
70   /** <p>Returns an iterator to all documents matching the given query.</p>
71    *
72    * @param pQuery The query to perform.
73    */

74   public java.util.Iterator JavaDoc select(String JavaDoc pQuery) throws JAXBException;
75
76   /** <p>Returns an iterator to all documents matching the given query.
77    * The query may contain placeholders. If it does, you have
78    * to supply an instance of {@link PMParams} with the placeholder
79    * values. Example:
80    * <pre>
81    * manager.select("Name = ? and Id = ?",
82    * new PMParams().addString("Someone").addInt(4));
83    * </pre></p>
84    *
85    * @param pQuery The query to perform. May contain placeholders.
86    * @param pPlaceHolderArgs An array of objects or null, if the
87    * query doesn't contain any placeholders.
88    */

89   public java.util.Iterator JavaDoc select(String JavaDoc pQuery,
90                                     PMParams pPlaceHolderArgs)
91     throws JAXBException;
92
93   /** <p>Inserts the given document into the database.</p>
94    */

95   public void insert(Element element) throws JAXBException;
96
97   /** <p>Updates the given document in the database.</p>
98    */

99   public void update(Element element) throws JAXBException;
100
101   /** <p>Deletes the given document from the database.</p>
102    */

103   public void delete(Element element) throws JAXBException;
104
105   /** <p>Creates a new, empty element.</p>
106    */

107   public Object JavaDoc create() throws JAXBException;
108 }
109
Popular Tags