Blame SOURCES/ws-jaxme-remove-xmldb.patch

22ee4d
diff -rauN ws-jaxme-0.5.2.old/build.xml ws-jaxme-0.5.2/build.xml
22ee4d
--- ws-jaxme-0.5.2.old/build.xml	2006-10-24 17:38:01.000000000 -0400
22ee4d
+++ ws-jaxme-0.5.2/build.xml	2012-02-08 10:29:55.000000000 -0500
22ee4d
@@ -35,7 +35,6 @@
22ee4d
                <include name="prerequisites/log4j*.jar"/>
22ee4d
                <include name="prerequisites/xercesImpl.jar"/>
22ee4d
                <include name="prerequisites/xml-apis-1.3.02.jar"/>
22ee4d
-               <include name="prerequisites/xmldb-api-*.jar"/>
22ee4d
 	       </tarfileset>
22ee4d
 	       <tarfileset prefix="ws-jaxme-${version}/docs" dir="${build.site}"/>
22ee4d
            <tarfileset prefix="ws-jaxme-${version}/lib" dir="dist">
22ee4d
diff -rauN ws-jaxme-0.5.2.old/src/pm/org/apache/ws/jaxme/pm/xmldb/package.html ws-jaxme-0.5.2/src/pm/org/apache/ws/jaxme/pm/xmldb/package.html
22ee4d
--- ws-jaxme-0.5.2.old/src/pm/org/apache/ws/jaxme/pm/xmldb/package.html	2004-07-23 03:18:09.000000000 -0400
22ee4d
+++ ws-jaxme-0.5.2/src/pm/org/apache/ws/jaxme/pm/xmldb/package.html	1969-12-31 19:00:00.000000000 -0500
22ee4d
@@ -1,31 +0,0 @@
22ee4d
-
22ee4d
-
22ee4d
- Copyright 2004 The Apache Software Foundation.
22ee4d
- 
22ee4d
- Licensed under the Apache License, Version 2.0 (the "License");
22ee4d
- you may not use this file except in compliance with the License.
22ee4d
- You may obtain a copy of the License at
22ee4d
- 
22ee4d
-      http://www.apache.org/licenses/LICENSE-2.0
22ee4d
- 
22ee4d
- Unless required by applicable law or agreed to in writing, software
22ee4d
- distributed under the License is distributed on an "AS IS" BASIS,
22ee4d
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22ee4d
- See the License for the specific language governing permissions and
22ee4d
- limitations under the License.
22ee4d
-
22ee4d
--->
22ee4d
-<html>
22ee4d
-    <head>
22ee4d
-        <title>
22ee4d
-Package Documentation for org.apache.ws.jaxme.pm.xmldb Package
22ee4d
-    </title>
22ee4d
-</head>
22ee4d
-    <body bgcolor="white">
22ee4d
-        

22ee4d
-Contains an implementation of
22ee4d
-the JaxMe persistence management framework
22ee4d
-targeting the XML::DB API.
22ee4d
-    

22ee4d
-</body>
22ee4d
-</html>
22ee4d
diff -rauN ws-jaxme-0.5.2.old/src/pm/org/apache/ws/jaxme/pm/xmldb/XmlDbPM.java ws-jaxme-0.5.2/src/pm/org/apache/ws/jaxme/pm/xmldb/XmlDbPM.java
22ee4d
--- ws-jaxme-0.5.2.old/src/pm/org/apache/ws/jaxme/pm/xmldb/XmlDbPM.java	2005-03-04 05:41:53.000000000 -0500
22ee4d
+++ ws-jaxme-0.5.2/src/pm/org/apache/ws/jaxme/pm/xmldb/XmlDbPM.java	1969-12-31 19:00:00.000000000 -0500
22ee4d
@@ -1,338 +0,0 @@
22ee4d
-/*
22ee4d
- * Copyright 2003, 2004  The Apache Software Foundation
22ee4d
- * 
22ee4d
- * Licensed under the Apache License, Version 2.0 (the "License");
22ee4d
- * you may not use this file except in compliance with the License.
22ee4d
- * You may obtain a copy of the License at
22ee4d
- * 
22ee4d
- * http://www.apache.org/licenses/LICENSE-2.0
22ee4d
- * 
22ee4d
- * Unless required by applicable law or agreed to in writing, software
22ee4d
- * distributed under the License is distributed on an "AS IS" BASIS,
22ee4d
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22ee4d
- * See the License for the specific language governing permissions and
22ee4d
- * limitations under the License.
22ee4d
-
22ee4d
- */
22ee4d
-package org.apache.ws.jaxme.pm.xmldb;
22ee4d
-
22ee4d
-import java.lang.reflect.InvocationTargetException;
22ee4d
-import java.util.HashMap;
22ee4d
-import java.util.Iterator;
22ee4d
-import java.util.Map;
22ee4d
-
22ee4d
-import javax.xml.bind.Element;
22ee4d
-import javax.xml.bind.JAXBException;
22ee4d
-import javax.xml.bind.Marshaller;
22ee4d
-
22ee4d
-import org.apache.ws.jaxme.JMManager;
22ee4d
-import org.apache.ws.jaxme.JMUnmarshallerHandler;
22ee4d
-import org.apache.ws.jaxme.Observer;
22ee4d
-import org.apache.ws.jaxme.PMException;
22ee4d
-import org.apache.ws.jaxme.PMParams;
22ee4d
-import org.apache.ws.jaxme.pm.impl.PMIdImpl;
22ee4d
-import org.xml.sax.ContentHandler;
22ee4d
-import org.xmldb.api.DatabaseManager;
22ee4d
-import org.xmldb.api.base.Collection;
22ee4d
-import org.xmldb.api.base.Database;
22ee4d
-import org.xmldb.api.base.ResourceIterator;
22ee4d
-import org.xmldb.api.base.ResourceSet;
22ee4d
-import org.xmldb.api.base.XMLDBException;
22ee4d
-import org.xmldb.api.modules.XMLResource;
22ee4d
-import org.xmldb.api.modules.XPathQueryService;
22ee4d
-
22ee4d
-
22ee4d
-/** This is a persistence manager for the XML::DB interface. In other
22ee4d
- * words, using this persistence manager you may read documents from a
22ee4d
- * database via the XML::DB API or write them into the database using the
22ee4d
- * same API.
22ee4d
- * This persistence manager is generic: The same manager works fine for
22ee4d
- * any JAXB element.
22ee4d
- */
22ee4d
-public class XmlDbPM extends PMIdImpl {
22ee4d
-  private Class driverClass;
22ee4d
-  private String collection;
22ee4d
-  private String user;
22ee4d
-  private String password;
22ee4d
-  private Map databaseProperties;
22ee4d
-  private String xPathQueryService = "XPathQueryService";
22ee4d
-  private String xPathQueryServiceVersion = "1.0";
22ee4d
-
22ee4d
-  /** Creates a new instance of XmlDbPM.
22ee4d
-   */
22ee4d
-  public XmlDbPM() {
22ee4d
-  }
22ee4d
-
22ee4d
-  public void init(JMManager pManager) throws JAXBException {
22ee4d
-    super.init(pManager);
22ee4d
-
22ee4d
-    String driverClassName = pManager.getProperty("xmldb.driver");
22ee4d
-    if (driverClassName == null  ||  driverClassName.length() == 0) {
22ee4d
-      throw new JAXBException("Missing property: 'xmldb.driver' (driver class name)");
22ee4d
-    }
22ee4d
-
22ee4d
-    String coll = pManager.getProperty("xmldb.collection");
22ee4d
-    if (coll == null  ||  coll.length() == 0) {
22ee4d
-      throw new JAXBException("Missing property: 'xmldb.collection' (collection name)");
22ee4d
-    }
22ee4d
-    setCollection(coll);
22ee4d
-    setUser(pManager.getProperty("xmldb.user"));
22ee4d
-    setPassword(pManager.getProperty("xmldb.password"));
22ee4d
-
22ee4d
-    for (int i = 0;  ;  i++) {
22ee4d
-      String p = "xmldb.property." + i;
22ee4d
-      String v = pManager.getProperty(p);
22ee4d
-      if (v == null) {
22ee4d
-        break;
22ee4d
-      }
22ee4d
-      int offset = v.indexOf('=');
22ee4d
-      if (offset == -1) {
22ee4d
-        throw new JAXBException("Invalid database property value " + p + ": Expected name=value, got " + v);
22ee4d
-      }
22ee4d
-      String name = v.substring(0, offset);
22ee4d
-      String value = v.substring(offset+1);
22ee4d
-      if (databaseProperties != null) {
22ee4d
-        databaseProperties = new HashMap();
22ee4d
-      }
22ee4d
-      databaseProperties.put(name, value);
22ee4d
-    }
22ee4d
-
22ee4d
-    Class c;
22ee4d
-    try {
22ee4d
-      c = Class.forName(driverClassName);
22ee4d
-    } catch (ClassNotFoundException e) {
22ee4d
-      try {
22ee4d
-        ClassLoader cl = Thread.currentThread().getContextClassLoader();
22ee4d
-        if (cl == null) {
22ee4d
-          cl = getClass().getClassLoader();   
22ee4d
-        }
22ee4d
-        c = cl.loadClass(driverClassName);
22ee4d
-      } catch (ClassNotFoundException f) {
22ee4d
-        throw new JAXBException("Failed to load driver class " + driverClassName, e);
22ee4d
-      }
22ee4d
-    }
22ee4d
-    setDriverClass(c);
22ee4d
-  }
22ee4d
-
22ee4d
-  /** Returns the collection name.
22ee4d
-   */
22ee4d
-  public String getCollection() {
22ee4d
-    return collection;
22ee4d
-  }
22ee4d
-
22ee4d
-  /** Sets the collection name.
22ee4d
-   */
22ee4d
-  public void setCollection(String pCollection) {
22ee4d
-    collection = pCollection;
22ee4d
-  }
22ee4d
-
22ee4d
-  /** Returns the driver class.
22ee4d
-   */
22ee4d
-  public Class getDriverClass() {
22ee4d
-    return driverClass;
22ee4d
-  }
22ee4d
-
22ee4d
-  /** Sets the driver class.
22ee4d
-   */
22ee4d
-  public void setDriverClass(Class pDriverClass) {
22ee4d
-    driverClass = pDriverClass;
22ee4d
-  }
22ee4d
-
22ee4d
-  /** Returns the password.
22ee4d
-   */
22ee4d
-  public String getPassword() {
22ee4d
-    return password;
22ee4d
-  }
22ee4d
-
22ee4d
-  /** Sets the password.
22ee4d
-   */
22ee4d
-  public void setPassword(String pPassword) {
22ee4d
-    password = pPassword;
22ee4d
-  }
22ee4d
-
22ee4d
-  /** Returns the users name.
22ee4d
-   */
22ee4d
-  public String getUser() {
22ee4d
-    return user;
22ee4d
-  }
22ee4d
-
22ee4d
-  /** Sets the users name.
22ee4d
-   */
22ee4d
-  public void setUser(String pUser) {
22ee4d
-    user = pUser;
22ee4d
-  }
22ee4d
-
22ee4d
-  /** Returns the name of the XPathQueryService. Defaults to
22ee4d
-   * "XPathQueryService".
22ee4d
-   */
22ee4d
-  public String getXPathQueryService() {
22ee4d
-    return xPathQueryService;
22ee4d
-  }
22ee4d
-
22ee4d
-  /** Sets the name of the XPathQueryService. Defaults to
22ee4d
-   * "XPathQueryService".
22ee4d
-   */
22ee4d
-  public void setXPathQueryService(String pXpathQueryService) {
22ee4d
-    xPathQueryService = pXpathQueryService;
22ee4d
-  }
22ee4d
-
22ee4d
-  /** Returns the version of the XPathQueryService. Defaults to
22ee4d
-   * "1.0".
22ee4d
-   */
22ee4d
-  public String getXPathQueryServiceVersion() {
22ee4d
-    return xPathQueryServiceVersion;
22ee4d
-  }
22ee4d
-
22ee4d
-  /** Sets the version of the XPathQueryService. Defaults to
22ee4d
-   * "1.0".
22ee4d
-   */
22ee4d
-  public void setXPathQueryServiceVersion(String pXpathQueryServiceVersion) {
22ee4d
-    xPathQueryServiceVersion = pXpathQueryServiceVersion;
22ee4d
-  }
22ee4d
-
22ee4d
-  /** Returns the database collection by invoking
22ee4d
-   * {@link DatabaseManager#getCollection(String)}.
22ee4d
-   */
22ee4d
-  protected Collection getXmlDbCollection()
22ee4d
-      throws XMLDBException, IllegalAccessException, InstantiationException {
22ee4d
-    Database database = (Database) getDriverClass().newInstance();
22ee4d
-    if (databaseProperties != null) {
22ee4d
-      for (Iterator iter = databaseProperties.entrySet().iterator();  iter.hasNext();  ) {
22ee4d
-        Map.Entry entry = (Map.Entry) iter.next();
22ee4d
-        database.setProperty((String) entry.getKey(), (String) entry.getValue());
22ee4d
-      }
22ee4d
-    }
22ee4d
-    DatabaseManager.registerDatabase(database); 
22ee4d
-    return DatabaseManager.getCollection(getCollection());
22ee4d
-  }
22ee4d
-
22ee4d
-
22ee4d
-  /* (non-Javadoc)
22ee4d
-   * @see org.apache.ws.jaxme.PM#select(org.apache.ws.jaxme.Observer, java.lang.String, org.apache.ws.jaxme.PMParams)
22ee4d
-   */
22ee4d
-  public void select(Observer pObserver, String pQuery, PMParams pPlaceHolderArgs) throws JAXBException {
22ee4d
-    if (pPlaceHolderArgs != null) {
22ee4d
-      pQuery = super.parseQuery(pQuery, pPlaceHolderArgs);
22ee4d
-    }
22ee4d
-
22ee4d
-    if (pQuery == null) {
22ee4d
-      throw new IllegalArgumentException("A query must be specified");
22ee4d
-    }
22ee4d
-
22ee4d
-	Collection col;
22ee4d
-	try {
22ee4d
-		col = getXmlDbCollection();
22ee4d
-		XPathQueryService service = (XPathQueryService) col.getService(getXPathQueryService(),
22ee4d
-																	   getXPathQueryServiceVersion());
22ee4d
-		ResourceSet result = service.query(pQuery);
22ee4d
-		if (result != null) {
22ee4d
-			ResourceIterator i = result.getIterator();
22ee4d
-			if (i.hasMoreResources()) {
22ee4d
-				JMUnmarshallerHandler handler = (JMUnmarshallerHandler) getManager().getFactory().createUnmarshaller().getUnmarshallerHandler();
22ee4d
-				handler.setObserver(pObserver);
22ee4d
-				while(i.hasMoreResources()) {
22ee4d
-					XMLResource r = (XMLResource) i.nextResource();
22ee4d
-					r.getContentAsSAX(handler);
22ee4d
-				}
22ee4d
-			}
22ee4d
-		}
22ee4d
-	} catch (XMLDBException e) {
22ee4d
-		throw new PMException(e);
22ee4d
-	} catch (IllegalAccessException e) {
22ee4d
-		throw new PMException(e);
22ee4d
-	} catch (InstantiationException e) {
22ee4d
-		throw new PMException(e);
22ee4d
-	}
22ee4d
-  }
22ee4d
-
22ee4d
-  /* (non-Javadoc)
22ee4d
-   * @see org.apache.ws.jaxme.PM#insert(javax.xml.bind.Element)
22ee4d
-   */
22ee4d
-  public void insert(Element pElement) throws PMException {
22ee4d
-    try {
22ee4d
-      Collection col = getXmlDbCollection();
22ee4d
-      String id = getId(pElement);
22ee4d
-      XMLResource resource = (XMLResource) col.createResource(id, XMLResource.RESOURCE_TYPE);
22ee4d
-      ContentHandler ch = resource.setContentAsSAX();
22ee4d
-      Marshaller marshaller = getManager().getFactory().createMarshaller();
22ee4d
-      marshaller.marshal(pElement, ch);
22ee4d
-      col.storeResource(resource);
22ee4d
-    } catch (XMLDBException e) {
22ee4d
-      throw new PMException(e);
22ee4d
-    } catch (IllegalAccessException e) {
22ee4d
-      throw new PMException(e);
22ee4d
-    } catch (InstantiationException e) {
22ee4d
-      throw new PMException(e);
22ee4d
-    } catch (NoSuchMethodException e) {
22ee4d
-      throw new PMException(e);
22ee4d
-    } catch (InvocationTargetException e) {
22ee4d
-      throw new PMException(e.getTargetException());
22ee4d
-    } catch (JAXBException e) {
22ee4d
-      if (e instanceof PMException) {
22ee4d
-        throw (PMException) e;
22ee4d
-      } else {
22ee4d
-        throw new PMException(e);
22ee4d
-      }
22ee4d
-    }
22ee4d
-  }
22ee4d
-
22ee4d
-  /* (non-Javadoc)
22ee4d
-   * @see org.apache.ws.jaxme.PM#update(javax.xml.bind.Element)
22ee4d
-   */
22ee4d
-  public void update(Element pElement) throws PMException {
22ee4d
-    try {
22ee4d
-      Collection col = getXmlDbCollection();
22ee4d
-      String id = getId(pElement);
22ee4d
-      XMLResource resource = (XMLResource) col.getResource(id);
22ee4d
-      ContentHandler ch = resource.setContentAsSAX();
22ee4d
-      Marshaller marshaller = getManager().getFactory().createMarshaller();
22ee4d
-      marshaller.marshal(pElement, ch);
22ee4d
-      col.storeResource(resource);
22ee4d
-    } catch (XMLDBException e) {
22ee4d
-      throw new PMException(e);
22ee4d
-    } catch (IllegalAccessException e) {
22ee4d
-      throw new PMException(e);
22ee4d
-    } catch (InstantiationException e) {
22ee4d
-      throw new PMException(e);
22ee4d
-    } catch (NoSuchMethodException e) {
22ee4d
-      throw new PMException(e);
22ee4d
-    } catch (InvocationTargetException e) {
22ee4d
-      throw new PMException(e.getTargetException());
22ee4d
-    } catch (JAXBException e) {
22ee4d
-      if (e instanceof PMException) {
22ee4d
-        throw (PMException) e;
22ee4d
-      } else {
22ee4d
-        throw new PMException(e);
22ee4d
-      }
22ee4d
-    }
22ee4d
-  }
22ee4d
-
22ee4d
-  /* (non-Javadoc)
22ee4d
-   * @see org.apache.ws.jaxme.PM#delete(javax.xml.bind.Element)
22ee4d
-   */
22ee4d
-  public void delete(Element pElement) throws PMException {
22ee4d
-    try {
22ee4d
-     Collection col = getXmlDbCollection();
22ee4d
-     String id = getId(pElement);
22ee4d
-     XMLResource resource = (XMLResource) col.createResource(id, XMLResource.RESOURCE_TYPE);
22ee4d
-     col.removeResource(resource);
22ee4d
-   } catch (XMLDBException e) {
22ee4d
-     throw new PMException(e);
22ee4d
-   } catch (IllegalAccessException e) {
22ee4d
-     throw new PMException(e);
22ee4d
-   } catch (InstantiationException e) {
22ee4d
-     throw new PMException(e);
22ee4d
-   } catch (InvocationTargetException e) {
22ee4d
-     throw new PMException(e.getTargetException());
22ee4d
-   } catch (NoSuchMethodException e) {
22ee4d
-     throw new PMException(e);
22ee4d
-    } catch (JAXBException e) {
22ee4d
-      if (e instanceof PMException) {
22ee4d
-        throw (PMException) e;
22ee4d
-      } else {
22ee4d
-        throw new PMException(e);
22ee4d
-      }
22ee4d
-   }
22ee4d
-  }
22ee4d
-
22ee4d
-}