geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r348828 - in /geronimo/trunk/modules: client-builder/src/java/org/apache/geronimo/client/builder/ connector-builder/src/java/org/apache/geronimo/connector/deployment/ connector-builder/src/test/org/apache/geronimo/connector/deployment/ j2ee...
Date Thu, 24 Nov 2005 22:55:25 GMT
Author: djencks
Date: Thu Nov 24 14:55:13 2005
New Revision: 348828

URL: http://svn.apache.org/viewcvs?rev=348828&view=rev
Log:
GERONIMO-1229 Use QName rather than local part in most element name searches

Modified:
    geronimo/trunk/modules/client-builder/src/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java
    geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java
    geronimo/trunk/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/PlanParsingTest.java
    geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java
    geronimo/trunk/modules/j2ee-schema/src/java/org/apache/geronimo/schema/SchemaConversionUtils.java
    geronimo/trunk/modules/j2ee-schema/src/test/org/apache/geronimo/schema/SchemaConversionUtilsTest.java
    geronimo/trunk/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/PlanParsingTest.java
    geronimo/trunk/modules/service-builder/src/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java
    geronimo/trunk/modules/service-builder/src/test/org/apache/geronimo/deployment/service/ParentIDTest.java
    geronimo/trunk/modules/web-builder/src/test/org/apache/geronimo/web/deployment/GenericToSpecificPlanConverterTest.java

Modified: geronimo/trunk/modules/client-builder/src/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/client-builder/src/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java?rev=348828&r1=348827&r2=348828&view=diff
==============================================================================
--- geronimo/trunk/modules/client-builder/src/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java
(original)
+++ geronimo/trunk/modules/client-builder/src/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java
Thu Nov 24 14:55:13 2005
@@ -219,7 +219,7 @@
 
             // if we got one extract the validate it otherwise create a default one
             if (rawPlan != null) {
-                gerAppClient = (GerApplicationClientType) SchemaConversionUtils.fixGeronimoSchema(rawPlan,
"application-client", GerApplicationClientType.type);
+                gerAppClient = (GerApplicationClientType) SchemaConversionUtils.fixGeronimoSchema(rawPlan,
GerApplicationClientDocument.type.getDocumentElementName(), GerApplicationClientType.type);
             } else {
                 String path;
                 if (standAlone) {

Modified: geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java?rev=348828&r1=348827&r2=348828&view=diff
==============================================================================
--- geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java
(original)
+++ geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java
Thu Nov 24 14:55:13 2005
@@ -128,7 +128,8 @@
     private final List defaultParentId;
     private final Repository repository;
     private final Kernel kernel;
-    static final String GERCONNECTOR_NAMESPACE = GerConnectorDocument.type.getDocumentElementName().getNamespaceURI();
+    private static QName CONNECTOR_QNAME = GerConnectorDocument.type.getDocumentElementName();
+    static final String GERCONNECTOR_NAMESPACE = CONNECTOR_QNAME.getNamespaceURI();
 
     public ConnectorModuleBuilder(URI[] defaultParentId,
                                   int defaultMaxSize,
@@ -194,7 +195,7 @@
             try {
                 if (plan instanceof XmlObject) {
                     gerConnector = (GerConnectorType) SchemaConversionUtils.getNestedObjectAsType((XmlObject)
plan,
-                            "connector",
+                            CONNECTOR_QNAME,
                             GerConnectorType.type);
                 } else {
                     GerConnectorDocument gerConnectorDoc = null;
@@ -281,10 +282,10 @@
         if (vendorConnector.isSetInverseClassloading()) {
             earContext.setInverseClassloading(vendorConnector.getInverseClassloading());
         }
-        
+
         ClassFilterType[] filters = vendorConnector.getHiddenClassesArray();
         ServiceConfigBuilder.addHiddenClasses(earContext, filters);
-        
+
         filters = vendorConnector.getNonOverridableClassesArray();
         ServiceConfigBuilder.addNonOverridableClasses(earContext, filters);
     }

Modified: geronimo/trunk/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/PlanParsingTest.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/PlanParsingTest.java?rev=348828&r1=348827&r2=348828&view=diff
==============================================================================
--- geronimo/trunk/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/PlanParsingTest.java
(original)
+++ geronimo/trunk/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/PlanParsingTest.java
Thu Nov 24 14:55:13 2005
@@ -2,6 +2,8 @@
 
 import java.io.File;
 
+import javax.xml.namespace.QName;
+
 import junit.framework.TestCase;
 import org.apache.geronimo.schema.SchemaConversionUtils;
 import org.apache.geronimo.xbeans.geronimo.GerConnectorDocument;
@@ -15,6 +17,7 @@
 /**
  */
 public class PlanParsingTest extends TestCase {
+    private final static QName CONNECTOR_QNAME = GerConnectorDocument.type.getDocumentElementName();
 
     File basedir = new File(System.getProperty("basedir", System.getProperty("user.dir")));
 
@@ -23,7 +26,7 @@
         assertTrue(geronimoDD.exists());
         XmlObject plan = XmlBeansUtil.parse(geronimoDD.toURL());
         GerConnectorDocument connectorDocument = (GerConnectorDocument) plan.changeType(GerConnectorDocument.type);
-        GerConnectorType connector = (GerConnectorType) SchemaConversionUtils.fixGeronimoSchema(connectorDocument,
"connector", GerConnectorType.type);
+        GerConnectorType connector = (GerConnectorType) SchemaConversionUtils.fixGeronimoSchema(connectorDocument,
CONNECTOR_QNAME, GerConnectorType.type);
         SchemaConversionUtils.validateDD(connector);
         assertEquals(1, connectorDocument.getConnector().getResourceadapterArray().length);
     }
@@ -42,7 +45,7 @@
         assertTrue(geronimoDD.exists());
         XmlObject plan = XmlBeansUtil.parse(geronimoDD.toURL());
         GerConnectorDocument connectorDocument = (GerConnectorDocument) plan.changeType(GerConnectorDocument.type);
-        GerConnectorType connector = (GerConnectorType) SchemaConversionUtils.fixGeronimoSchema(connectorDocument,
"connector", GerConnectorType.type);
+        GerConnectorType connector = (GerConnectorType) SchemaConversionUtils.fixGeronimoSchema(connectorDocument,
CONNECTOR_QNAME, GerConnectorType.type);
         assertEquals(1, connector.getResourceadapterArray().length);
     }
 
@@ -108,7 +111,7 @@
         }
         GerConnectorType gerConnector = doc.getConnector();
         ConnectorPlanRectifier.rectifyPlan(gerConnector);
-        gerConnector = (GerConnectorType) SchemaConversionUtils.fixGeronimoSchema(gerConnector,
"connector", GerConnectorType.type);
+        gerConnector = (GerConnectorType) SchemaConversionUtils.fixGeronimoSchema(gerConnector,
CONNECTOR_QNAME, GerConnectorType.type);
     }
 
 }

Modified: geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java?rev=348828&r1=348827&r2=348828&view=diff
==============================================================================
--- geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java
(original)
+++ geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java
Thu Nov 24 14:55:13 2005
@@ -38,6 +38,7 @@
 
 import javax.management.MalformedObjectNameException;
 import javax.management.ObjectName;
+import javax.xml.namespace.QName;
 
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.deployment.ConfigurationBuilder;
@@ -75,6 +76,8 @@
  */
 public class EARConfigBuilder implements ConfigurationBuilder {
 
+    private final static QName APPLICATION_QNAME = GerApplicationDocument.type.getDocumentElementName();
+
     private final Kernel kernel;
     private final Repository repository;
     private final ModuleBuilder ejbConfigBuilder;
@@ -182,14 +185,14 @@
             try {
                 if (planFile != null) {
                     rawPlan = XmlBeansUtil.parse(planFile.toURL());
-                    gerApplication = (GerApplicationType) SchemaConversionUtils.fixGeronimoSchema(rawPlan,
"application", GerApplicationType.type);
+                    gerApplication = (GerApplicationType) SchemaConversionUtils.fixGeronimoSchema(rawPlan,
APPLICATION_QNAME, GerApplicationType.type);
                     if (gerApplication == null) {
                         return null;
                     }
                 } else {
                     URL path = DeploymentUtil.createJarURL(earFile, "META-INF/geronimo-application.xml");
                     rawPlan = XmlBeansUtil.parse(path);
-                    gerApplication = (GerApplicationType) SchemaConversionUtils.fixGeronimoSchema(rawPlan,
"application", GerApplicationType.type);
+                    gerApplication = (GerApplicationType) SchemaConversionUtils.fixGeronimoSchema(rawPlan,
APPLICATION_QNAME, GerApplicationType.type);
                 }
             } catch (IOException e) {
                 //TODO isn't this an error?

Modified: geronimo/trunk/modules/j2ee-schema/src/java/org/apache/geronimo/schema/SchemaConversionUtils.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/j2ee-schema/src/java/org/apache/geronimo/schema/SchemaConversionUtils.java?rev=348828&r1=348827&r2=348828&view=diff
==============================================================================
--- geronimo/trunk/modules/j2ee-schema/src/java/org/apache/geronimo/schema/SchemaConversionUtils.java
(original)
+++ geronimo/trunk/modules/j2ee-schema/src/java/org/apache/geronimo/schema/SchemaConversionUtils.java
Thu Nov 24 14:55:13 2005
@@ -349,7 +349,7 @@
         return false;
     }
 
-    public static XmlObject fixGeronimoSchema(XmlObject rawPlan, String desiredElement, SchemaType
desiredType) throws XmlException {
+    public static XmlObject fixGeronimoSchema(XmlObject rawPlan, QName desiredElement, SchemaType
desiredType) throws XmlException {
         XmlCursor cursor = rawPlan.newCursor();
         try {
             if (findNestedElement(cursor, desiredElement)) {
@@ -372,7 +372,7 @@
         }
     }
 
-    public static XmlObject getNestedObject(XmlObject xmlObject, String desiredElement) {
+    public static XmlObject getNestedObject(XmlObject xmlObject, QName desiredElement) {
         XmlCursor cursor = xmlObject.newCursor();
         try {
             if (findNestedElement(cursor, desiredElement)) {
@@ -386,11 +386,24 @@
         throw new IllegalArgumentException("xmlobject did not have desired element: " + desiredElement
+ "/n" + xmlObject);
     }
 
+    public static boolean findNestedElement(XmlCursor cursor, QName desiredElement) {
+        while (cursor.hasNextToken()) {
+            if (cursor.isStart()) {
+                QName element = cursor.getName();
+                if (element.equals(desiredElement)) {
+                    return true;
+                }
+            }
+            cursor.toNextToken();
+        }
+        return false;
+    }
+
     public static boolean findNestedElement(XmlCursor cursor, String desiredElement) {
         while (cursor.hasNextToken()) {
             if (cursor.isStart()) {
-                String localName = cursor.getName().getLocalPart();
-                if (localName.equals(desiredElement)) {
+                String element = cursor.getName().getLocalPart();
+                if (element.equals(desiredElement)) {
                     return true;
                 }
             }
@@ -399,7 +412,7 @@
         return false;
     }
 
-    public static XmlObject getNestedObjectAsType(XmlObject xmlObject, String desiredElement,
SchemaType type) {
+    public static XmlObject getNestedObjectAsType(XmlObject xmlObject, QName desiredElement,
SchemaType type) {
         XmlCursor cursor = xmlObject.newCursor();
         try {
             if (findNestedElement(cursor, desiredElement)) {

Modified: geronimo/trunk/modules/j2ee-schema/src/test/org/apache/geronimo/schema/SchemaConversionUtilsTest.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/j2ee-schema/src/test/org/apache/geronimo/schema/SchemaConversionUtilsTest.java?rev=348828&r1=348827&r2=348828&view=diff
==============================================================================
--- geronimo/trunk/modules/j2ee-schema/src/test/org/apache/geronimo/schema/SchemaConversionUtilsTest.java
(original)
+++ geronimo/trunk/modules/j2ee-schema/src/test/org/apache/geronimo/schema/SchemaConversionUtilsTest.java
Thu Nov 24 14:55:13 2005
@@ -389,7 +389,7 @@
 //        URL expectedOutputXml = classLoader.getResource("geronimo/ejb-naming-post.xml");
         XmlObject xmlObject = XmlObject.Factory.parse(srcXml);
         //this is not a usable type, we'll see what happens though
-        xmlObject = SchemaConversionUtils.getNestedObjectAsType(xmlObject, "openejb-jar",
EjbJarType.type);
+        xmlObject = SchemaConversionUtils.getNestedObjectAsType(xmlObject, new QName("http://www.openejb.org/xml/ns/openejb-jar-2.0",
"openejb-jar"), EjbJarType.type);
 //	        System.out.println(xmlObject.toString());
     }
 

Modified: geronimo/trunk/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/PlanParsingTest.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/PlanParsingTest.java?rev=348828&r1=348827&r2=348828&view=diff
==============================================================================
--- geronimo/trunk/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/PlanParsingTest.java
(original)
+++ geronimo/trunk/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/PlanParsingTest.java
Thu Nov 24 14:55:13 2005
@@ -8,6 +8,7 @@
 import java.util.List;
 import java.util.jar.JarFile;
 import javax.management.ObjectName;
+import javax.xml.namespace.QName;
 
 import junit.framework.TestCase;
 import org.apache.geronimo.deployment.util.UnpackedJarFile;
@@ -17,6 +18,7 @@
 import org.apache.geronimo.schema.SchemaConversionUtils;
 import org.apache.geronimo.web.deployment.GenericToSpecificPlanConverter;
 import org.apache.geronimo.xbeans.geronimo.naming.GerResourceRefType;
+import org.apache.geronimo.xbeans.geronimo.web.GerWebAppDocument;
 import org.apache.geronimo.xbeans.geronimo.web.jetty.JettyWebAppDocument;
 import org.apache.geronimo.xbeans.geronimo.web.jetty.JettyWebAppType;
 import org.apache.geronimo.xbeans.geronimo.web.jetty.config.GerJettyDocument;
@@ -34,7 +36,6 @@
     ObjectName pojoWebServiceTemplate = null;
     WebServiceBuilder webServiceBuilder = null;
     private JettyModuleBuilder builder;
-    private File basedir = new File(System.getProperty("basedir", "."));
 
     public PlanParsingTest() throws Exception {
         builder = new JettyModuleBuilder(new URI[]{URI.create("defaultParent")}, new Integer(1800),
false, null, jettyContainerObjectName, new HashSet(), new HashSet(), new HashSet(), pojoWebServiceTemplate,
webServiceBuilder, null, null);
@@ -204,7 +205,7 @@
         assertTrue(ConvertedPlan != null);
         XmlObject converted = XmlBeansUtil.parse(ConvertedPlan);
         XmlCursor c = converted.newCursor();
-        SchemaConversionUtils.findNestedElement(c, "web-app");
+        SchemaConversionUtils.findNestedElement(c, JettyWebAppDocument.type.getDocumentElementName());
         c.toFirstChild();
         ArrayList problems = new ArrayList();
         compareXmlObjects(webPlan, c, problems);
@@ -221,10 +222,10 @@
                 problems.add("test longer than expected at element: " + elementCount);
                 return false;
             }
-            String actualChars = test.getName().getLocalPart();
-            String expectedChars = expected.getName().getLocalPart();
-            if (!actualChars.equals(expectedChars)) {
-                problems.add("Different elements at elementCount: " + elementCount + ", test:
" + actualChars + ", expected: " + expectedChars);
+            QName actualName = test.getName();
+            QName expectedName = expected.getName();
+            if (!actualName.equals(expectedName)) {
+                problems.add("Different elements at elementCount: " + elementCount + ", test:
" + actualName + ", expected: " + expectedName);
                 similar = false;
             }
             test.toNextToken();

Modified: geronimo/trunk/modules/service-builder/src/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/service-builder/src/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java?rev=348828&r1=348827&r2=348828&view=diff
==============================================================================
--- geronimo/trunk/modules/service-builder/src/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java
(original)
+++ geronimo/trunk/modules/service-builder/src/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java
Thu Nov 24 14:55:13 2005
@@ -421,7 +421,7 @@
             String type = dep.isSetType() ? dep.getType() : "jar";
             String artifactId = dep.getArtifactId();
             String version = dep.getVersion();
-            String id = groupId + "/" + type + "s/" + artifactId + '-' + version + "." +
type;
+            String id = groupId + "/" + artifactId + "/" + version + "/" + type;
             try {
                 uri = new URI(id);
             } catch (URISyntaxException e) {

Modified: geronimo/trunk/modules/service-builder/src/test/org/apache/geronimo/deployment/service/ParentIDTest.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/service-builder/src/test/org/apache/geronimo/deployment/service/ParentIDTest.java?rev=348828&r1=348827&r2=348828&view=diff
==============================================================================
--- geronimo/trunk/modules/service-builder/src/test/org/apache/geronimo/deployment/service/ParentIDTest.java
(original)
+++ geronimo/trunk/modules/service-builder/src/test/org/apache/geronimo/deployment/service/ParentIDTest.java
Thu Nov 24 14:55:13 2005
@@ -53,7 +53,7 @@
         anImport.setVersion("version");
         List parentId = ServiceConfigBuilder.getParentID(null, new DependencyType[] {anImport});
         assertEquals(1, parentId.size());
-        assertEquals("groupId/types/artifactId-version.type", ((URI)parentId.get(0)).getPath());
+        assertEquals("groupId/artifactId/version/type", ((URI)parentId.get(0)).getPath());
     }
 
     public void testBothParent() throws Exception {

Modified: geronimo/trunk/modules/web-builder/src/test/org/apache/geronimo/web/deployment/GenericToSpecificPlanConverterTest.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/web-builder/src/test/org/apache/geronimo/web/deployment/GenericToSpecificPlanConverterTest.java?rev=348828&r1=348827&r2=348828&view=diff
==============================================================================
--- geronimo/trunk/modules/web-builder/src/test/org/apache/geronimo/web/deployment/GenericToSpecificPlanConverterTest.java
(original)
+++ geronimo/trunk/modules/web-builder/src/test/org/apache/geronimo/web/deployment/GenericToSpecificPlanConverterTest.java
Thu Nov 24 14:55:13 2005
@@ -25,6 +25,7 @@
 import junit.framework.TestCase;
 import org.apache.xmlbeans.XmlObject;
 import org.apache.xmlbeans.XmlCursor;
+import org.apache.geronimo.deployment.xmlbeans.XmlBeansUtil;
 
 /**
  * @version $Rev$ $Date$
@@ -45,7 +46,7 @@
     public void testConvertPlan(String prePlanName) throws Exception {
         URL srcXml = classLoader.getResource(prePlanName);
         URL expectedOutputXml = classLoader.getResource("plans/tomcat-post.xml");
-        XmlObject rawPlan = XmlObject.Factory.parse(srcXml);
+        XmlObject rawPlan = XmlBeansUtil.parse(srcXml);
         XmlObject expected = XmlObject.Factory.parse(expectedOutputXml);
         XmlObject webPlan = new GenericToSpecificPlanConverter("http://geronimo.apache.org/xml/ns/web/tomcat/config-1.0",
                 "http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-1.0", "tomcat").convertToSpecificPlan(rawPlan);



Mime
View raw message