Author: jochen
Date: Fri Oct 21 05:30:35 2005
New Revision: 327160

URL: http://svn.apache.org/viewcvs?rev=327160&view=rev
Log:
Added support for the TaminoAPI4J without the resource adapter.
In other words, this is usable in the absence of an EJB container.

Added:
    
webservices/jaxme/branches/b0_5/src/pm/org/apache/ws/jaxme/pm/ino/api4j/TaminoAPI4JRaPm.java
      - copied, changed from r232222, 
webservices/jaxme/branches/b0_5/src/pm/org/apache/ws/jaxme/pm/ino/api4j/TaminoAPI4JPm.java
Modified:
    webservices/jaxme/branches/b0_5/prerequisites/   (props changed)
    webservices/jaxme/branches/b0_5/src/documentation/content/xdocs/pm/ino.xml
    
webservices/jaxme/branches/b0_5/src/pm/org/apache/ws/jaxme/generator/ino/api4j/TaminoAPI4JSG.java
    
webservices/jaxme/branches/b0_5/src/pm/org/apache/ws/jaxme/generator/ino/api4j/TaminoAPI4JSchemaSG.java
    
webservices/jaxme/branches/b0_5/src/pm/org/apache/ws/jaxme/pm/ino/api4j/DocumentDefaultHandler.java
    
webservices/jaxme/branches/b0_5/src/pm/org/apache/ws/jaxme/pm/ino/api4j/ElementDefaultHandler.java
    
webservices/jaxme/branches/b0_5/src/pm/org/apache/ws/jaxme/pm/ino/api4j/TJMElement.java

Propchange: webservices/jaxme/branches/b0_5/prerequisites/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Fri Oct 21 05:30:35 2005
@@ -1,2 +1,4 @@
+
 TaminoAPI4J.jar
 TaminoJCA.jar
+jdom.jar

Modified: 
webservices/jaxme/branches/b0_5/src/documentation/content/xdocs/pm/ino.xml
URL: 
http://svn.apache.org/viewcvs/webservices/jaxme/branches/b0_5/src/documentation/content/xdocs/pm/ino.xml?rev=327160&r1=327159&r2=327160&view=diff
==============================================================================
--- webservices/jaxme/branches/b0_5/src/documentation/content/xdocs/pm/ino.xml 
(original)
+++ webservices/jaxme/branches/b0_5/src/documentation/content/xdocs/pm/ino.xml 
Fri Oct 21 05:30:35 2005
@@ -76,6 +76,12 @@
        </section>
 
        <section><title>Preparing the Tamino Resource Adapter</title>
+               <p>If you are not using the Tamino Resource Adapter (which
+                 is typically the case, if you are <em>not</em> using
+                 an EJB container like JBoss, WebSphere, or the like.
+                 In that case you may very well skip this section and
+                 proceed to the next section, which is about creating
+                 the schema file.</p>
                <p>Adding the Tamino Resource Adapter is covered in the
                  documentation of the TaminoAPI4J. However, we'll provide
                  specific details for JBoss 3.2 here, because the docs
@@ -197,6 +203,11 @@
       <jaxb:globalBindings>
         <xjc:serializable/>
         <inoapi:raDetails collection="adr" 
jndiReference="java:MyTaminoLocalTxConnector"/>
+        <!-- If you are not using the Tamino Resource Adapter, then the 
following
+             will fit for you:
+          <inoapi:dbDetails collection="adr" 
url="http://127.0.0.1/tamino/adrDb";
+            user="me" password="MySecretPassword"/>
+        -->
       </jaxb:globalBindings>
       <tsd:schemaInfo name="Address">
         <tsd:collection name="adr"></tsd:collection>

Modified: 
webservices/jaxme/branches/b0_5/src/pm/org/apache/ws/jaxme/generator/ino/api4j/TaminoAPI4JSG.java
URL: 
http://svn.apache.org/viewcvs/webservices/jaxme/branches/b0_5/src/pm/org/apache/ws/jaxme/generator/ino/api4j/TaminoAPI4JSG.java?rev=327160&r1=327159&r2=327160&view=diff
==============================================================================
--- 
webservices/jaxme/branches/b0_5/src/pm/org/apache/ws/jaxme/generator/ino/api4j/TaminoAPI4JSG.java
 (original)
+++ 
webservices/jaxme/branches/b0_5/src/pm/org/apache/ws/jaxme/generator/ino/api4j/TaminoAPI4JSG.java
 Fri Oct 21 05:30:35 2005
@@ -72,9 +72,9 @@
     private static final JavaQName INO_OBJECT_TYPE = 
JavaQNameImpl.getInstance(InoObject.class);
     private static final JavaQName JMELEMENT_TYPE = 
JavaQNameImpl.getInstance(JMElement.class);
 
-    public class RaDetails extends XsObjectImpl {
-        private String collection, jndiReference;
-        RaDetails(XsObject pParent) {
+    public abstract class InoDetails extends XsObjectImpl {
+        private String collection;
+        InoDetails(XsObject pParent) {
             super(pParent);
         }
         public void setCollection(String pCollection) {
@@ -84,6 +84,41 @@
             String p = "taminoapi4j.collection";
             return sgFactory.getGenerator().getProperty(p, collection);
         }
+    }
+
+    public class DbDetails extends InoDetails {
+       private String url, user, password;
+       DbDetails(XsObject pParent) {
+               super(pParent);
+       }
+        public void setUrl(String pUrl) {
+            url = pUrl;
+        }
+        public String getUrl() {
+            String p = "taminoapi4j.url";
+            return sgFactory.getGenerator().getProperty(p, url);
+        }
+        public void setUser(String pUser) {
+            user = pUser;
+        }
+        public String getUser() {
+            String p = "taminoapi4j.user";
+            return sgFactory.getGenerator().getProperty(p, user);
+        }
+        public void setPassword(String pPassword) {
+            password = pPassword;
+        }
+        public String getPassword() {
+            String p = "taminoapi4j.password";
+            return sgFactory.getGenerator().getProperty(p, password);
+        }
+    }
+
+    public class RaDetails extends InoDetails {
+        private String jndiReference;
+        RaDetails(XsObject pParent) {
+            super(pParent);
+        }
         public void setJndiReference(String pReference) {
             jndiReference = pReference;
         }
@@ -94,19 +129,27 @@
     }
 
     private RaDetails raDetails;
+    private DbDetails dbDetails;
     private SGFactory sgFactory;
 
     public TaminoAPI4JSG(SGFactoryChain o) {
         super(o);
     }
 
-    public void setRaDetails(RaDetails pDetails) {
+    public void setRaDetails(RaDetails pDetails) throws SAXException {
         raDetails = pDetails;
     }
     public RaDetails getRaDetails() {
         return raDetails;
     }
-    
+
+    public void setDbDetails(DbDetails pDetails) {
+        dbDetails = pDetails;
+    }
+    public DbDetails getDbDetails() {
+        return dbDetails;
+    }
+
     public void init(SGFactory pFactory) {
         super.init(pFactory);
         sgFactory = pFactory;
@@ -115,16 +158,32 @@
             JaxMeSchemaReader jaxmeSchemaReader = (JaxMeSchemaReader) 
schemaReader;
             jaxmeSchemaReader.addXsObjectCreator(new XsObjectCreator(){
                 public XsObject newBean(XsObject pParent, Locator pLocator, 
XsQName pQName) throws SAXException {
-                    if (pParent instanceof JAXBGlobalBindings) {
+                       if (pParent instanceof JAXBGlobalBindings) {
                         if 
(TAMINOAPI4J_SCHEMA_URI.equals(pQName.getNamespaceURI())) {
                             if ("raDetails".equals(pQName.getLocalName())) {
                                 if (getRaDetails() != null) {
                                     throw new LocSAXException("An element 
named " + pQName + " has already been specified.",
                                                                          
pLocator);
                                 }
+                                if (getDbDetails() != null) {
+                                    throw new LocSAXException("The elements 
dbDetails and raDetails are mutually exclusive.",
+                                                                         
pLocator);
+                                }
                                 RaDetails details = new RaDetails(pParent);
                                 setRaDetails(details);
                                 return details;
+                            } else if 
("dbDetails".equals(pQName.getLocalName())) {
+                               if (getDbDetails() != null) {
+                                       throw new LocSAXException("An element 
named " + pQName + " has already been specified.",
+                                                       pLocator);
+                               }
+                               if (getRaDetails() != null) {
+                                    throw new LocSAXException("The elements 
dbDetails and raDetails are mutually exclusive.",
+                                                                         
pLocator);
+                                }
+                               DbDetails details = new DbDetails(pParent);
+                               setDbDetails(details);
+                               return details;
                             } else {
                                 throw new LocSAXException("Invalid element 
name: " + pQName, pLocator);
                             }

Modified: 
webservices/jaxme/branches/b0_5/src/pm/org/apache/ws/jaxme/generator/ino/api4j/TaminoAPI4JSchemaSG.java
URL: 
http://svn.apache.org/viewcvs/webservices/jaxme/branches/b0_5/src/pm/org/apache/ws/jaxme/generator/ino/api4j/TaminoAPI4JSchemaSG.java?rev=327160&r1=327159&r2=327160&view=diff
==============================================================================
--- 
webservices/jaxme/branches/b0_5/src/pm/org/apache/ws/jaxme/generator/ino/api4j/TaminoAPI4JSchemaSG.java
 (original)
+++ 
webservices/jaxme/branches/b0_5/src/pm/org/apache/ws/jaxme/generator/ino/api4j/TaminoAPI4JSchemaSG.java
 Fri Oct 21 05:30:35 2005
@@ -16,6 +16,7 @@
 
 package org.apache.ws.jaxme.generator.ino.api4j;
 
+
 import java.util.Iterator;
 import java.util.List;
 
@@ -25,7 +26,8 @@
 import org.apache.ws.jaxme.generator.sg.TypeSG;
 import org.apache.ws.jaxme.generator.sg.impl.SchemaSGChainImpl;
 import org.apache.ws.jaxme.impl.JAXBContextImpl;
-import org.apache.ws.jaxme.pm.ino.api4j.TaminoAPI4JPm;
+import org.apache.ws.jaxme.pm.ino.api4j.TaminoAPI4JDbPm;
+import org.apache.ws.jaxme.pm.ino.api4j.TaminoAPI4JRaPm;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
@@ -37,6 +39,8 @@
 public class TaminoAPI4JSchemaSG extends SchemaSGChainImpl {
     private final TaminoAPI4JSG baseSG;
 
+    /** Creates a new instance with the given backing chains.
+     */
     public TaminoAPI4JSchemaSG(SchemaSGChain pChain, TaminoAPI4JSG pBaseSG) {
         super(pChain);
         baseSG = pBaseSG;
@@ -60,7 +64,8 @@
         final Document doc = super.getConfigFile(pController, pPackageName, 
pContextList);
         final Element root = doc.getDocumentElement();
         final Iterator iter = pContextList.iterator();
-        TaminoAPI4JSG.RaDetails details = baseSG.getRaDetails();
+        TaminoAPI4JSG.RaDetails raDetails = baseSG.getRaDetails();
+        TaminoAPI4JSG.DbDetails dbDetails = baseSG.getDbDetails();
         for (Node node = root.getFirstChild();  node != null;  node = 
node.getNextSibling()) {
             if (node.getNodeType() == Node.ELEMENT_NODE
                     &&  
JAXBContextImpl.CONFIGURATION_URI.equals(node.getNamespaceURI())
@@ -68,19 +73,44 @@
                 Element manager = (Element) node;
                 final ObjectSG objectSG = (ObjectSG) iter.next();
                 final TypeSG typeSG = objectSG.getTypeSG();
-                if (typeSG.isComplex()) {
-                    manager.setAttributeNS(uri, "pmClass", 
TaminoAPI4JPm.class.getName());
+                if (!typeSG.isComplex()) {
+                       continue;
                 }
 
-                if (details != null) {
-                    String collection = details.getCollection();
+                final Class managerClass;
+                if (raDetails != null) {
+                    String collection = raDetails.getCollection();
                     if (collection != null  &&  collection.length() > 0) {
                         createProperty(manager, "collection", collection);
                     }
-                    String jndiRef = details.getJndiReference();
+                    String jndiRef = raDetails.getJndiReference();
                     if (jndiRef != null  &&  jndiRef.length() > 0) {
                         createProperty(manager, "jndiReference", jndiRef);
                     }
+                    managerClass = TaminoAPI4JRaPm.class;
+                } else if (dbDetails != null) {
+                       String collection = dbDetails.getCollection();
+                    if (collection != null  &&  collection.length() > 0) {
+                        createProperty(manager, "collection", collection);
+                    }
+                    String url = dbDetails.getUrl();
+                    if (url != null  &&  url.length() > 0) {
+                        createProperty(manager, "url", url);
+                    }
+                    String user = dbDetails.getUser();
+                    if (user != null  &&  user.length() > 0) {
+                        createProperty(manager, "user", user);
+                    }
+                    String password = dbDetails.getPassword();
+                    if (password != null  &&  password.length() > 0) {
+                        createProperty(manager, "password", password);
+                    }
+                    managerClass = TaminoAPI4JDbPm.class;
+                } else {
+                       managerClass = null;
+                }
+                if (managerClass != null) {
+                    manager.setAttributeNS(uri, "pmClass", 
managerClass.getName());
                 }
             }
         }

Modified: 
webservices/jaxme/branches/b0_5/src/pm/org/apache/ws/jaxme/pm/ino/api4j/DocumentDefaultHandler.java
URL: 
http://svn.apache.org/viewcvs/webservices/jaxme/branches/b0_5/src/pm/org/apache/ws/jaxme/pm/ino/api4j/DocumentDefaultHandler.java?rev=327160&r1=327159&r2=327160&view=diff
==============================================================================
--- 
webservices/jaxme/branches/b0_5/src/pm/org/apache/ws/jaxme/pm/ino/api4j/DocumentDefaultHandler.java
 (original)
+++ 
webservices/jaxme/branches/b0_5/src/pm/org/apache/ws/jaxme/pm/ino/api4j/DocumentDefaultHandler.java
 Fri Oct 21 05:30:35 2005
@@ -43,9 +43,6 @@
     static void setUnmarshallerHandler(JMUnmarshallerHandlerImpl pHandler) {
         handler.set(pHandler);
     }
-    
-    public DocumentDefaultHandler() {
-    }
 
     public void startDocument() throws SAXException {
         getUnmarshallerHandler().startDocument();

Modified: 
webservices/jaxme/branches/b0_5/src/pm/org/apache/ws/jaxme/pm/ino/api4j/ElementDefaultHandler.java
URL: 
http://svn.apache.org/viewcvs/webservices/jaxme/branches/b0_5/src/pm/org/apache/ws/jaxme/pm/ino/api4j/ElementDefaultHandler.java?rev=327160&r1=327159&r2=327160&view=diff
==============================================================================
--- 
webservices/jaxme/branches/b0_5/src/pm/org/apache/ws/jaxme/pm/ino/api4j/ElementDefaultHandler.java
 (original)
+++ 
webservices/jaxme/branches/b0_5/src/pm/org/apache/ws/jaxme/pm/ino/api4j/ElementDefaultHandler.java
 Fri Oct 21 05:30:35 2005
@@ -53,9 +53,6 @@
         return (Data) data.get();
     }
 
-    public ElementDefaultHandler() {
-    }
-
     public TSAXElement getFirstElement() {
         List result = getData().result;
         if (result.size() > 0) {

Modified: 
webservices/jaxme/branches/b0_5/src/pm/org/apache/ws/jaxme/pm/ino/api4j/TJMElement.java
URL: 
http://svn.apache.org/viewcvs/webservices/jaxme/branches/b0_5/src/pm/org/apache/ws/jaxme/pm/ino/api4j/TJMElement.java?rev=327160&r1=327159&r2=327160&view=diff
==============================================================================
--- 
webservices/jaxme/branches/b0_5/src/pm/org/apache/ws/jaxme/pm/ino/api4j/TJMElement.java
 (original)
+++ 
webservices/jaxme/branches/b0_5/src/pm/org/apache/ws/jaxme/pm/ino/api4j/TJMElement.java
 Fri Oct 21 05:30:35 2005
@@ -28,16 +28,23 @@
 import com.softwareag.tamino.db.api.objectModel.sax.TSAXElement;
 
 
-/**
- * @author <a href="mailto:[EMAIL PROTECTED]">Jochen Wiedmann</a>
+/** JaxMe specific implementation of
+ * [EMAIL PROTECTED] com.softwareag.tamino.db.api.objectModel.sax.TSAXElement},
+ * and [EMAIL PROTECTED] 
com.softwareag.tamino.db.api.objectModel.sax.TSAXDocument}.
  */
 public class TJMElement implements TSAXDocument, TSAXElement {
     private final InoObject element;
 
+    /** Creates a new instance, which reads or writes
+     * the given [EMAIL PROTECTED] InoObject}.
+     */
     public TJMElement(InoObject pElement) {
         element = pElement;
     }
 
+    /** Returns the [EMAIL PROTECTED] InoObject}, which is being
+     * read, or written.
+     */
     public InoObject getJMElement() {
         return element;
     }
@@ -48,7 +55,7 @@
 
     public void writeTo(Writer pWriter) {
         try {
-            
TaminoAPI4JPm.getJAXBContext().createMarshaller().marshal(getJMElement(), 
pWriter);
+            
TaminoAPI4JRaPm.getJAXBContext().createMarshaller().marshal(getJMElement(), 
pWriter);
         } catch (JAXBException e) {
             throw new UndeclaredThrowableException(e);
         }

Copied: 
webservices/jaxme/branches/b0_5/src/pm/org/apache/ws/jaxme/pm/ino/api4j/TaminoAPI4JRaPm.java
 (from r232222, 
webservices/jaxme/branches/b0_5/src/pm/org/apache/ws/jaxme/pm/ino/api4j/TaminoAPI4JPm.java)
URL: 
http://svn.apache.org/viewcvs/webservices/jaxme/branches/b0_5/src/pm/org/apache/ws/jaxme/pm/ino/api4j/TaminoAPI4JRaPm.java?p2=webservices/jaxme/branches/b0_5/src/pm/org/apache/ws/jaxme/pm/ino/api4j/TaminoAPI4JRaPm.java&p1=webservices/jaxme/branches/b0_5/src/pm/org/apache/ws/jaxme/pm/ino/api4j/TaminoAPI4JPm.java&r1=232222&r2=327160&rev=327160&view=diff
==============================================================================
--- 
webservices/jaxme/branches/b0_5/src/pm/org/apache/ws/jaxme/pm/ino/api4j/TaminoAPI4JPm.java
 (original)
+++ 
webservices/jaxme/branches/b0_5/src/pm/org/apache/ws/jaxme/pm/ino/api4j/TaminoAPI4JRaPm.java
 Fri Oct 21 05:30:35 2005
@@ -13,207 +13,59 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
- 
 package org.apache.ws.jaxme.pm.ino.api4j;
 
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
-import javax.xml.bind.Element;
 import javax.xml.bind.JAXBException;
 
 import org.apache.ws.jaxme.JMManager;
-import org.apache.ws.jaxme.Observer;
 import org.apache.ws.jaxme.PMException;
-import org.apache.ws.jaxme.PMParams;
-import org.apache.ws.jaxme.impl.JAXBContextImpl;
-import org.apache.ws.jaxme.impl.JMUnmarshallerHandlerImpl;
-import org.apache.ws.jaxme.pm.impl.PMImpl;
-import org.apache.ws.jaxme.pm.ino.InoObject;
-
-import com.softwareag.tamino.db.api.accessor.TAccessLocation;
-import com.softwareag.tamino.db.api.accessor.TDeleteException;
-import com.softwareag.tamino.db.api.accessor.TInsertException;
-import com.softwareag.tamino.db.api.accessor.TQuery;
-import com.softwareag.tamino.db.api.accessor.TQueryException;
-import com.softwareag.tamino.db.api.accessor.TUpdateException;
-import com.softwareag.tamino.db.api.accessor.TXMLObjectAccessor;
+
 import com.softwareag.tamino.db.api.connection.TConnection;
 import com.softwareag.tamino.db.api.connection.TServerNotAvailableException;
 import com.softwareag.tamino.db.api.connector.TaminoDataSource;
-import com.softwareag.tamino.db.api.objectModel.TIteratorException;
-import com.softwareag.tamino.db.api.objectModel.TNoSuchXMLObjectException;
-import com.softwareag.tamino.db.api.objectModel.TXMLObject;
-import com.softwareag.tamino.db.api.objectModel.TXMLObjectIterator;
-import com.softwareag.tamino.db.api.objectModel.TXMLObjectModel;
-import com.softwareag.tamino.db.api.objectModel.sax.TSAXObjectModel;
-import com.softwareag.tamino.db.api.response.TResponse;
-
-/**
- * @author <a href="mailto:[EMAIL PROTECTED]">Jochen Wiedmann</a>
- */
-public class TaminoAPI4JPm extends PMImpl {
-    private static final ThreadLocal context = new ThreadLocal();
-    private static TSAXObjectModel model;
-    private static boolean isInitialized;
 
-    static JAXBContextImpl getJAXBContext() {
-        return (JAXBContextImpl) context.get();
-    }
 
-    static void setJAXBContext(JAXBContextImpl pContext) {
-        context.set(pContext);
-    }
-
-    private String collection;
+/** [EMAIL PROTECTED] org.apache.ws.jaxme.PM} implementation for accessing
+ * a Tamino database via the resource adapter version of the
+ * TaminoAPI4J.
+ */
+public class TaminoAPI4JRaPm extends TaminoAPI4JPm {
     private String jndiReference;
 
-    public String getCollection() {
-        return collection;
-    }
-
-    public void setCollection(String pCollection) {
-        collection = pCollection;
-    }
-
+    /** Returns the JNDI reference.
+     */
     public String getJndiReference() {
         return jndiReference;
     }
 
+    /** Sets the JNDI reference.
+     */
     public void setJndiReference(String pJndiReference) {
         jndiReference = pJndiReference;
     }
 
+    protected TConnection getTConnection() throws PMException {
+       TaminoDataSource tds;
+       try {
+               InitialContext ic = new InitialContext();
+               tds = (TaminoDataSource) ic.lookup(jndiReference);
+       } catch (NamingException e) {
+               throw new PMException(e);
+       }
+       try {
+                       return tds.getConnection();
+               } catch (TServerNotAvailableException e) {
+                       throw new PMException(e);
+               }
+    }
+
     public void init(JMManager pManager) throws JAXBException {
         super.init(pManager);
-        if (!isInitialized) {
-            synchronized(TaminoAPI4JPm.class) {
-                if (!isInitialized) {
-                    System.err.println("Registering object model in class " + 
TXMLObjectModel.class + " with class loader " + 
TXMLObjectModel.class.getClassLoader());
-                    TSAXObjectModel m = new 
TSAXObjectModel(TaminoAPI4JPm.class.getName(),
-                                                                               
        TJMElement.class, TJMElement.class,
-                                                                               
        new DocumentDefaultHandler(),
-                                                                               
                                        new ElementDefaultHandler());
-                    TXMLObjectModel.register(m);
-                    model = m;
-                    isInitialized = true;
-                }
-            }
-        }
-        collection = pManager.getProperty("collection");
-        if (collection == null  ||  collection.length() == 0) {
-            throw new JAXBException("The property 'collection' must be set.");
-        }
         jndiReference = pManager.getProperty("jndiReference");
         if (jndiReference == null  ||  jndiReference.length() == 0) {
             throw new JAXBException("The property 'jndiReference' must be 
set.");
-        }
-    }
-    
-    protected TXMLObject getTXMLObject(InoObject pElement) {
-        return TXMLObject.newInstance(new TJMElement(pElement));
-    }
-
-    protected TSAXObjectModel getTSAXObjectModel() throws JAXBException {
-        return model;
-    }
-
-    protected TConnection getTConnection() throws NamingException, 
TServerNotAvailableException {
-        InitialContext ic = new InitialContext();
-        TaminoDataSource tds = (TaminoDataSource) ic.lookup(jndiReference);
-        TConnection con =  tds.getConnection();
-        return con;
-    }
-
-    public void select(Observer pObserver, String pQuery, PMParams pParams) 
throws PMException {
-        TConnection conn = null;
-        try {
-            JAXBContextImpl c = getManager().getFactory();
-            setJAXBContext(c);
-            JMUnmarshallerHandlerImpl h = (JMUnmarshallerHandlerImpl) 
c.createUnmarshaller().getUnmarshallerHandler();
-            DocumentDefaultHandler.setUnmarshallerHandler(h);
-            ElementDefaultHandler.initData();
-            conn = getTConnection();
-            TXMLObjectAccessor accessor = 
conn.newXMLObjectAccessor(TAccessLocation.newInstance(collection), model);
-            TResponse response = accessor.query(TQuery.newInstance(pQuery));
-            for (TXMLObjectIterator iter = response.getXMLObjectIterator();
-                 iter.hasNext();  ) {
-                TXMLObject object = iter.next();
-                pObserver.notify(((TJMElement) 
object.getElement()).getJMElement());
-            }
-        } catch (TServerNotAvailableException e) {
-            throw new PMException(e);
-        } catch (NamingException e) {
-            throw new PMException(e);
-        } catch (TQueryException e) {
-            throw new PMException(e);
-        } catch (TNoSuchXMLObjectException e) {
-            throw new PMException(e);
-        } catch (TIteratorException e) {
-            throw new PMException(e);
-        } catch (JAXBException e) {
-            throw new PMException(e);
-        } finally {
-            if (conn != null) { try { conn.close(); } catch (Throwable ignore) 
{} }
-            setJAXBContext(null);
-            DocumentDefaultHandler.setUnmarshallerHandler(null);
-            ElementDefaultHandler.initData();
-        }
-    }
-
-    public void insert(Element pElement) throws PMException {
-        TConnection conn = null;
-        try {
-            setJAXBContext(getManager().getFactory());
-            conn = getTConnection();
-            TXMLObjectAccessor accessor = 
conn.newXMLObjectAccessor(TAccessLocation.newInstance(collection), model);
-            accessor.insert(getTXMLObject((InoObject) pElement));
-        } catch (TServerNotAvailableException e) {
-            throw new PMException(e);
-        } catch (NamingException e) {
-            throw new PMException(e);
-        } catch (TInsertException e) {
-            throw new PMException(e);
-        } finally {
-            if (conn != null) { try { conn.close(); } catch (Throwable ignore) 
{} }
-            setJAXBContext(null);
-        }
-    }
-
-    public void update(Element pElement) throws PMException {
-        TConnection conn = null;
-        try {
-            setJAXBContext(getManager().getFactory());
-            conn = getTConnection();
-            TXMLObjectAccessor accessor = 
conn.newXMLObjectAccessor(TAccessLocation.newInstance(collection), model);
-            accessor.update(getTXMLObject((InoObject) pElement));
-        } catch (TServerNotAvailableException e) {
-            throw new PMException(e);
-        } catch (NamingException e) {
-            throw new PMException(e);
-        } catch (TUpdateException e) {
-            throw new PMException(e);
-        } finally {
-            if (conn != null) { try { conn.close(); } catch (Throwable ignore) 
{} }
-            setJAXBContext(null);
-        }
-    }
-
-    public void delete(Element pElement) throws PMException {
-        TConnection conn = null;
-        try {
-            setJAXBContext(getManager().getFactory());
-            conn = getTConnection();
-            TXMLObjectAccessor accessor = 
conn.newXMLObjectAccessor(TAccessLocation.newInstance(collection), model);
-            accessor.delete(getTXMLObject((InoObject) pElement));
-        } catch (TServerNotAvailableException e) {
-            throw new PMException(e);
-        } catch (NamingException e) {
-            throw new PMException(e);
-        } catch (TDeleteException e) {
-            throw new PMException(e);
-        } finally {
-            if (conn != null) { try { conn.close(); } catch (Throwable ignore) 
{} }
-            setJAXBContext(null);
         }
     }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to