jboynes 2004/01/21 12:37:29
Added: modules/deployment/src/test/org/apache/geronimo/deployment/plugin Application.java ApplicationRoot.java DeploymentConfigurationTest.java modules/deployment/src/java/org/apache/geronimo/deployment/plugin/client ClientConfigBean.java modules/deployment/src/test/org/apache/geronimo/deployment/tools ClientDeployableTest.java DDBeanRootTest.java WebDeployableTest.java modules/deployment/src/java/org/apache/geronimo/deployment/plugin DConfigBeanSupport.java DeploymentConfigurationImpl.java DeploymentManagerImpl.java modules/deployment/src/java/org/apache/geronimo/deployment/tools DDBeanImpl.java DDBeanRootImpl.java modules/deployment/src/java/org/apache/geronimo/deployment/plugin/factories DeploymentFactoryImpl.java modules/deployment/src/java/org/apache/geronimo/deployment/plugin/application EARConfigBean.java modules/deployment/src/java/org/apache/geronimo/deployment/plugin/j2ee EJBRefConfigBean.java modules/deployment/src/java/org/apache/geronimo/deployment/util XMLUtil.java Log: Start of JSR88 provider and a simple tool to test it Revision Changes Path 1.1 incubator-geronimo/modules/deployment/src/test/org/apache/geronimo/deployment/plugin/Application.java Index: Application.java =================================================================== /* ==================================================================== * The Apache Software License, Version 1.1 * * Copyright (c) 2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Apache" and "Apache Software Foundation" and * "Apache Geronimo" must not be used to endorse or promote products * derived from this software without prior written permission. For * written permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache", * "Apache Geronimo", nor may "Apache" appear in their name, without * prior written permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. * * ==================================================================== */ package org.apache.geronimo.deployment.plugin; import java.util.Enumeration; import java.io.FileNotFoundException; import java.io.InputStream; import javax.enterprise.deploy.model.J2eeApplicationObject; import javax.enterprise.deploy.model.DDBeanRoot; import javax.enterprise.deploy.model.XpathListener; import javax.enterprise.deploy.model.DDBean; import javax.enterprise.deploy.model.DeployableObject; import javax.enterprise.deploy.model.exceptions.DDBeanCreateException; import javax.enterprise.deploy.shared.ModuleType; /** * * * @version $Revision: 1.1 $ $Date: 2004/01/21 20:37:28 $ */ public class Application implements J2eeApplicationObject { private final DDBeanRoot root; public Application(DDBeanRoot root) { this.root = root; } public void addXpathListener(ModuleType type, String xpath, XpathListener xpl) { throw new UnsupportedOperationException(); } public Enumeration entries() { throw new UnsupportedOperationException(); } public DDBean[] getChildBean(ModuleType type, String xpath) { throw new UnsupportedOperationException(); } public DDBean[] getChildBean(String xpath) { throw new UnsupportedOperationException(); } public Class getClassFromScope(String className) { throw new UnsupportedOperationException(); } public DDBeanRoot getDDBeanRoot() { return root; } public DDBeanRoot getDDBeanRoot(String filename) throws FileNotFoundException, DDBeanCreateException { throw new UnsupportedOperationException(); } public DeployableObject getDeployableObject(String uri) { throw new UnsupportedOperationException(); } public DeployableObject[] getDeployableObjects() { throw new UnsupportedOperationException(); } public DeployableObject[] getDeployableObjects(ModuleType type) { throw new UnsupportedOperationException(); } public InputStream getEntry(String name) { throw new UnsupportedOperationException(); } public String getModuleDTDVersion() { throw new UnsupportedOperationException(); } public String[] getModuleUris() { throw new UnsupportedOperationException(); } public String[] getModuleUris(ModuleType type) { throw new UnsupportedOperationException(); } public String[] getText(ModuleType type, String xpath) { throw new UnsupportedOperationException(); } public String[] getText(String xpath) { throw new UnsupportedOperationException(); } public ModuleType getType() { throw new UnsupportedOperationException(); } public void removeXpathListener(ModuleType type, String xpath, XpathListener xpl) { throw new UnsupportedOperationException(); } } 1.1 incubator-geronimo/modules/deployment/src/test/org/apache/geronimo/deployment/plugin/ApplicationRoot.java Index: ApplicationRoot.java =================================================================== /* ==================================================================== * The Apache Software License, Version 1.1 * * Copyright (c) 2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Apache" and "Apache Software Foundation" and * "Apache Geronimo" must not be used to endorse or promote products * derived from this software without prior written permission. For * written permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache", * "Apache Geronimo", nor may "Apache" appear in their name, without * prior written permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. * * ==================================================================== */ package org.apache.geronimo.deployment.plugin; import javax.enterprise.deploy.model.DDBeanRoot; import javax.enterprise.deploy.model.XpathListener; import javax.enterprise.deploy.model.DDBean; import javax.enterprise.deploy.model.DeployableObject; import javax.enterprise.deploy.shared.ModuleType; /** * * * @version $Revision: 1.1 $ $Date: 2004/01/21 20:37:28 $ */ public class ApplicationRoot implements DDBeanRoot { public void addXpathListener(String xpath, XpathListener xpl) { throw new UnsupportedOperationException(); } public String[] getAttributeNames() { throw new UnsupportedOperationException(); } public String getAttributeValue(String attrName) { throw new UnsupportedOperationException(); } public DDBean[] getChildBean(String xpath) { throw new UnsupportedOperationException(); } public String getDDBeanRootVersion() { throw new UnsupportedOperationException(); } public DeployableObject getDeployableObject() { throw new UnsupportedOperationException(); } public String getFilename() { throw new UnsupportedOperationException(); } public String getId() { throw new UnsupportedOperationException(); } public String getModuleDTDVersion() { throw new UnsupportedOperationException(); } public DDBeanRoot getRoot() { throw new UnsupportedOperationException(); } public String getText() { throw new UnsupportedOperationException(); } public String[] getText(String xpath) { throw new UnsupportedOperationException(); } public ModuleType getType() { throw new UnsupportedOperationException(); } public String getXpath() { throw new UnsupportedOperationException(); } public void removeXpathListener(String xpath, XpathListener xpl) { throw new UnsupportedOperationException(); } } 1.1 incubator-geronimo/modules/deployment/src/test/org/apache/geronimo/deployment/plugin/DeploymentConfigurationTest.java Index: DeploymentConfigurationTest.java =================================================================== /* ==================================================================== * The Apache Software License, Version 1.1 * * Copyright (c) 2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Apache" and "Apache Software Foundation" and * "Apache Geronimo" must not be used to endorse or promote products * derived from this software without prior written permission. For * written permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache", * "Apache Geronimo", nor may "Apache" appear in their name, without * prior written permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. * * ==================================================================== */ package org.apache.geronimo.deployment.plugin; import javax.enterprise.deploy.spi.factories.DeploymentFactory; import javax.enterprise.deploy.spi.DeploymentManager; import javax.enterprise.deploy.spi.DeploymentConfiguration; import javax.enterprise.deploy.model.DDBeanRoot; import org.apache.geronimo.deployment.plugin.factories.DeploymentFactoryImpl; import junit.framework.TestCase; /** * * * @version $Revision: 1.1 $ $Date: 2004/01/21 20:37:28 $ */ public class DeploymentConfigurationTest extends TestCase { private DeploymentFactory factory; private DDBeanRoot root; private Application deployable; public void testInit() throws Exception { DeploymentManager manager = factory.getDisconnectedDeploymentManager("deployer:geronimo:test"); DeploymentConfiguration config = manager.createConfiguration(deployable); assertEquals(deployable, config.getDeployableObject()); assertNull(config.getDConfigBeanRoot(root)); } protected void setUp() throws Exception { factory = new DeploymentFactoryImpl(); root = new ApplicationRoot(); deployable = new Application(root); } } 1.1 incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/client/ClientConfigBean.java Index: ClientConfigBean.java =================================================================== /* ==================================================================== * The Apache Software License, Version 1.1 * * Copyright (c) 2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Apache" and "Apache Software Foundation" and * "Apache Geronimo" must not be used to endorse or promote products * derived from this software without prior written permission. For * written permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache", * "Apache Geronimo", nor may "Apache" appear in their name, without * prior written permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. * * ==================================================================== */ package org.apache.geronimo.deployment.plugin.client; import javax.enterprise.deploy.model.DDBean; import javax.enterprise.deploy.spi.DConfigBean; import javax.enterprise.deploy.spi.exceptions.ConfigurationException; import javax.enterprise.deploy.spi.exceptions.BeanNotFoundException; import org.apache.geronimo.deployment.plugin.DConfigBeanSupport; /** * * * @version $Revision: 1.1 $ $Date: 2004/01/21 20:37:28 $ */ public class ClientConfigBean extends DConfigBeanSupport { private static final String[] XPATHS = { "ejb-ref/jndi-name", "resource-ref/jmx-name" }; public ClientConfigBean(DDBean ddBean) { super(ddBean); } public String[] getXpaths() { return XPATHS; } public DConfigBean getDConfigBean(DDBean bean) throws ConfigurationException { return null; } public void removeDConfigBean(DConfigBean bean) throws BeanNotFoundException { } } 1.1 incubator-geronimo/modules/deployment/src/test/org/apache/geronimo/deployment/tools/ClientDeployableTest.java Index: ClientDeployableTest.java =================================================================== /* ==================================================================== * The Apache Software License, Version 1.1 * * Copyright (c) 2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Apache" and "Apache Software Foundation" and * "Apache Geronimo" must not be used to endorse or promote products * derived from this software without prior written permission. For * written permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache", * "Apache Geronimo", nor may "Apache" appear in their name, without * prior written permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. * * ==================================================================== */ package org.apache.geronimo.deployment.tools; import java.net.URL; import java.util.Collections; import java.util.HashSet; import java.util.Set; import java.io.InputStream; import javax.enterprise.deploy.shared.ModuleType; import javax.enterprise.deploy.model.DDBeanRoot; import org.apache.geronimo.deployment.tools.loader.ClientDeployable; import junit.framework.TestCase; /** * * * @version $Revision: 1.1 $ $Date: 2004/01/21 20:37:28 $ */ public class ClientDeployableTest extends TestCase { private ClassLoader classLoader; public void testLoadClient() throws Exception { URL resource = classLoader.getResource("deployables/app-client1.jar"); ClientDeployable deployable = new ClientDeployable(resource); assertEquals(ModuleType.CAR, deployable.getType()); Set entrySet = new HashSet(Collections.list(deployable.entries())); Set resultSet = new HashSet(); resultSet.add("META-INF/"); resultSet.add("META-INF/MANIFEST.MF"); resultSet.add("META-INF/application-client.xml"); resultSet.add("Main.java"); resultSet.add("Main.class"); assertEquals(resultSet, entrySet); InputStream entry = deployable.getEntry("META-INF/application-client.xml"); assertNotNull(entry); entry.close(); Class main = deployable.getClassFromScope("Main"); assertEquals("Main", main.getName()); DDBeanRoot root = deployable.getDDBeanRoot(); assertNotNull(root); assertEquals(ModuleType.CAR, root.getType()); assertEquals(deployable, root.getDeployableObject()); } protected void setUp() throws Exception { classLoader = Thread.currentThread().getContextClassLoader(); } } 1.1 incubator-geronimo/modules/deployment/src/test/org/apache/geronimo/deployment/tools/DDBeanRootTest.java Index: DDBeanRootTest.java =================================================================== /* ==================================================================== * The Apache Software License, Version 1.1 * * Copyright (c) 2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Apache" and "Apache Software Foundation" and * "Apache Geronimo" must not be used to endorse or promote products * derived from this software without prior written permission. For * written permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache", * "Apache Geronimo", nor may "Apache" appear in their name, without * prior written permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. * * ==================================================================== */ package org.apache.geronimo.deployment.tools; import java.net.URL; import java.util.Arrays; import java.util.Enumeration; import java.io.FileNotFoundException; import java.io.InputStream; import javax.enterprise.deploy.model.DDBean; import javax.enterprise.deploy.model.DDBeanRoot; import javax.enterprise.deploy.model.DeployableObject; import javax.enterprise.deploy.model.exceptions.DDBeanCreateException; import javax.enterprise.deploy.shared.ModuleType; import junit.framework.TestCase; /** * * * @version $Revision: 1.1 $ $Date: 2004/01/21 20:37:28 $ */ public class DDBeanRootTest extends TestCase { private DDBeanRoot root; private ClassLoader classLoader; public void testRoot() throws Exception { DeployableObject deployable = new MockDeployable(); URL descriptor = classLoader.getResource("descriptors/app-client1.xml"); root = new DDBeanRootImpl(deployable, descriptor); assertEquals("1.4", root.getDDBeanRootVersion()); assertEquals(deployable, root.getDeployableObject()); assertEquals(ModuleType.CAR, root.getType()); assertEquals("/", root.getXpath()); assertNull(root.getAttributeNames()); assertNull(root.getText("foo")); assertTrue(Arrays.equals(new String[] {"Test DD for app-client1"}, root.getText("application-client/description"))); assertTrue(Arrays.equals(new String[] {"http://localhost"}, root.getText("application-client/env-entry/env-entry-value"))); assertTrue(Arrays.equals(new String[] {"url/test1", "url/test2"}, root.getText("application-client/env-entry/env-entry-name"))); DDBean description = root.getChildBean("application-client/description")[0]; assertEquals("Test DD for app-client1", description.getText()); assertEquals("/application-client/description", description.getXpath()); assertEquals(description, description.getChildBean("/application-client/description")[0]); } protected void setUp() throws Exception { classLoader = Thread.currentThread().getContextClassLoader(); } private class MockDeployable implements DeployableObject { public Enumeration entries() { fail(); throw new AssertionError(); } public DDBean[] getChildBean(String xpath) { fail(); throw new AssertionError(); } public Class getClassFromScope(String className) { fail(); throw new AssertionError(); } public DDBeanRoot getDDBeanRoot() { fail(); throw new AssertionError(); } public DDBeanRoot getDDBeanRoot(String filename) throws FileNotFoundException, DDBeanCreateException { fail(); throw new AssertionError(); } public InputStream getEntry(String name) { fail(); throw new AssertionError(); } public String getModuleDTDVersion() { fail(); throw new AssertionError(); } public String[] getText(String xpath) { fail(); throw new AssertionError(); } public ModuleType getType() { return ModuleType.CAR; } } } 1.1 incubator-geronimo/modules/deployment/src/test/org/apache/geronimo/deployment/tools/WebDeployableTest.java Index: WebDeployableTest.java =================================================================== /* ==================================================================== * The Apache Software License, Version 1.1 * * Copyright (c) 2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Apache" and "Apache Software Foundation" and * "Apache Geronimo" must not be used to endorse or promote products * derived from this software without prior written permission. For * written permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache", * "Apache Geronimo", nor may "Apache" appear in their name, without * prior written permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. * * ==================================================================== */ package org.apache.geronimo.deployment.tools; import java.net.URL; import org.apache.geronimo.deployment.tools.loader.WebDeployable; import junit.framework.TestCase; /** * * * @version $Revision: 1.1 $ $Date: 2004/01/21 20:37:28 $ */ public class WebDeployableTest extends TestCase { private ClassLoader classLoader; public void testWebClasspath() throws Exception { URL resource = classLoader.getResource("deployables/war1.war"); WebDeployable deployable = new WebDeployable(resource); } protected void setUp() throws Exception { classLoader = Thread.currentThread().getContextClassLoader(); } } 1.1 incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/DConfigBeanSupport.java Index: DConfigBeanSupport.java =================================================================== /* ==================================================================== * The Apache Software License, Version 1.1 * * Copyright (c) 2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Apache" and "Apache Software Foundation" and * "Apache Geronimo" must not be used to endorse or promote products * derived from this software without prior written permission. For * written permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache", * "Apache Geronimo", nor may "Apache" appear in their name, without * prior written permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. * * ==================================================================== */ package org.apache.geronimo.deployment.plugin; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; import javax.enterprise.deploy.spi.DConfigBean; import javax.enterprise.deploy.spi.exceptions.ConfigurationException; import javax.enterprise.deploy.model.DDBean; import javax.enterprise.deploy.model.XpathEvent; /** * * * @version $Revision: 1.1 $ $Date: 2004/01/21 20:37:29 $ */ public abstract class DConfigBeanSupport implements DConfigBean { private final DDBean ddBean; private final PropertyChangeSupport pcs = new PropertyChangeSupport(this); public DConfigBeanSupport(DDBean ddBean) { this.ddBean = ddBean; } public DDBean getDDBean() { return ddBean; } public void notifyDDChange(XpathEvent event) { } public void addPropertyChangeListener(PropertyChangeListener pcl) { pcs.addPropertyChangeListener(pcl); } public void removePropertyChangeListener(PropertyChangeListener pcl) { pcs.removePropertyChangeListener(pcl); } } 1.1 incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/DeploymentConfigurationImpl.java Index: DeploymentConfigurationImpl.java =================================================================== /* ==================================================================== * The Apache Software License, Version 1.1 * * Copyright (c) 2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Apache" and "Apache Software Foundation" and * "Apache Geronimo" must not be used to endorse or promote products * derived from this software without prior written permission. For * written permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache", * "Apache Geronimo", nor may "Apache" appear in their name, without * prior written permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. * * ==================================================================== */ package org.apache.geronimo.deployment.plugin; import java.io.OutputStream; import java.io.InputStream; import javax.enterprise.deploy.spi.DeploymentConfiguration; import javax.enterprise.deploy.spi.DConfigBeanRoot; import javax.enterprise.deploy.spi.exceptions.ConfigurationException; import javax.enterprise.deploy.spi.exceptions.BeanNotFoundException; import javax.enterprise.deploy.model.DeployableObject; import javax.enterprise.deploy.model.DDBeanRoot; /** * * * @version $Revision: 1.1 $ $Date: 2004/01/21 20:37:29 $ */ public class DeploymentConfigurationImpl implements DeploymentConfiguration { private final DeployableObject deployable; public DeploymentConfigurationImpl(DeployableObject deployable) { this.deployable = deployable; } public DeployableObject getDeployableObject() { return deployable; } public DConfigBeanRoot getDConfigBeanRoot(DDBeanRoot bean) throws ConfigurationException { return null; } public void removeDConfigBean(DConfigBeanRoot bean) throws BeanNotFoundException { } public void save(OutputStream outputArchive) throws ConfigurationException { } public void restore(InputStream inputArchive) throws ConfigurationException { } public void saveDConfigBean(OutputStream outputArchive, DConfigBeanRoot bean) throws ConfigurationException { } public DConfigBeanRoot restoreDConfigBean(InputStream inputArchive, DDBeanRoot bean) throws ConfigurationException { return null; } } 1.1 incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/DeploymentManagerImpl.java Index: DeploymentManagerImpl.java =================================================================== /* ==================================================================== * The Apache Software License, Version 1.1 * * Copyright (c) 2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Apache" and "Apache Software Foundation" and * "Apache Geronimo" must not be used to endorse or promote products * derived from this software without prior written permission. For * written permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache", * "Apache Geronimo", nor may "Apache" appear in their name, without * prior written permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. * * ==================================================================== */ package org.apache.geronimo.deployment.plugin; import java.io.File; import java.io.InputStream; import java.util.Locale; import javax.enterprise.deploy.model.DeployableObject; import javax.enterprise.deploy.shared.DConfigBeanVersionType; import javax.enterprise.deploy.shared.ModuleType; import javax.enterprise.deploy.spi.DeploymentConfiguration; import javax.enterprise.deploy.spi.DeploymentManager; import javax.enterprise.deploy.spi.Target; import javax.enterprise.deploy.spi.TargetModuleID; import javax.enterprise.deploy.spi.exceptions.DConfigBeanVersionUnsupportedException; import javax.enterprise.deploy.spi.exceptions.InvalidModuleException; import javax.enterprise.deploy.spi.exceptions.TargetException; import javax.enterprise.deploy.spi.status.ProgressObject; /** * * * @version $Revision: 1.1 $ $Date: 2004/01/21 20:37:29 $ */ public class DeploymentManagerImpl implements DeploymentManager { private boolean connected; public DeploymentManagerImpl() { connected = false; } public DeploymentConfiguration createConfiguration(DeployableObject dObj) throws InvalidModuleException { return new DeploymentConfigurationImpl(dObj); } public DConfigBeanVersionType getDConfigBeanVersion() { return DConfigBeanVersionType.V1_4; } public void setDConfigBeanVersion(DConfigBeanVersionType version) throws DConfigBeanVersionUnsupportedException { if (!isDConfigBeanVersionSupported(version)) { throw new DConfigBeanVersionUnsupportedException("Version not supported " + version); } } public boolean isDConfigBeanVersionSupported(DConfigBeanVersionType version) { return DConfigBeanVersionType.V1_4.equals(version); } public Locale getDefaultLocale() { return Locale.getDefault(); } public Locale[] getSupportedLocales() { return new Locale[] { getDefaultLocale() }; } public Locale getCurrentLocale() { return getDefaultLocale(); } public void setLocale(Locale locale) throws UnsupportedOperationException { throw new UnsupportedOperationException("Cannot set Locale"); } public boolean isLocaleSupported(Locale locale) { return getDefaultLocale().equals(locale); } public void release() { } public Target[] getTargets() throws IllegalStateException { if (!connected) { throw new IllegalStateException("Disconnected"); } throw new UnsupportedOperationException(); } public TargetModuleID[] getRunningModules(ModuleType moduleType, Target[] targetList) throws TargetException, IllegalStateException { if (!connected) { throw new IllegalStateException("Disconnected"); } throw new UnsupportedOperationException(); } public TargetModuleID[] getNonRunningModules(ModuleType moduleType, Target[] targetList) throws TargetException, IllegalStateException { if (!connected) { throw new IllegalStateException("Disconnected"); } throw new UnsupportedOperationException(); } public TargetModuleID[] getAvailableModules(ModuleType moduleType, Target[] targetList) throws TargetException, IllegalStateException { if (!connected) { throw new IllegalStateException("Disconnected"); } throw new UnsupportedOperationException(); } public ProgressObject distribute(Target[] targetList, File moduleArchive, File deploymentPlan) throws IllegalStateException { if (!connected) { throw new IllegalStateException("Disconnected"); } throw new UnsupportedOperationException(); } public ProgressObject distribute(Target[] targetList, InputStream moduleArchive, InputStream deploymentPlan) throws IllegalStateException { if (!connected) { throw new IllegalStateException("Disconnected"); } throw new UnsupportedOperationException(); } public ProgressObject start(TargetModuleID[] moduleIDList) throws IllegalStateException { if (!connected) { throw new IllegalStateException("Disconnected"); } throw new UnsupportedOperationException(); } public ProgressObject stop(TargetModuleID[] moduleIDList) throws IllegalStateException { if (!connected) { throw new IllegalStateException("Disconnected"); } throw new UnsupportedOperationException(); } public ProgressObject undeploy(TargetModuleID[] moduleIDList) throws IllegalStateException { if (!connected) { throw new IllegalStateException("Disconnected"); } throw new UnsupportedOperationException(); } public boolean isRedeploySupported() { return true; } public ProgressObject redeploy(TargetModuleID[] moduleIDList, File moduleArchive, File deploymentPlan) throws UnsupportedOperationException, IllegalStateException { if (!connected) { throw new IllegalStateException("Disconnected"); } throw new UnsupportedOperationException(); } public ProgressObject redeploy(TargetModuleID[] moduleIDList, InputStream moduleArchive, InputStream deploymentPlan) throws UnsupportedOperationException, IllegalStateException { if (!connected) { throw new IllegalStateException("Disconnected"); } throw new UnsupportedOperationException(); } } 1.1 incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/tools/DDBeanImpl.java Index: DDBeanImpl.java =================================================================== /* ==================================================================== * The Apache Software License, Version 1.1 * * Copyright (c) 2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Apache" and "Apache Software Foundation" and * "Apache Geronimo" must not be used to endorse or promote products * derived from this software without prior written permission. For * written permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache", * "Apache Geronimo", nor may "Apache" appear in their name, without * prior written permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. * * ==================================================================== */ package org.apache.geronimo.deployment.tools; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import javax.enterprise.deploy.model.DDBean; import javax.enterprise.deploy.model.DDBeanRoot; import javax.enterprise.deploy.model.XpathListener; import org.apache.geronimo.deployment.util.XMLUtil; import org.w3c.dom.Attr; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; /** * * * @version $Revision: 1.1 $ $Date: 2004/01/21 20:37:29 $ */ public class DDBeanImpl implements DDBean { protected final DDBeanRoot root; protected final Element element; protected final String xpath; protected final Map children; public DDBeanImpl(DDBeanRoot root, String xpath, Element element) { this.root = root; this.xpath = xpath; this.element = element; this.children = new HashMap(); for (Node node = element.getFirstChild(); node != null; node = node.getNextSibling()) { if (node instanceof Element) { Element child = (Element) node; List childs = (List) children.get(child.getNodeName()); if (childs == null) { childs = new ArrayList(); children.put(child.getNodeName(), childs); } childs.add(new DDBeanImpl(root, xpath + "/" + child.getNodeName(), child)); } } } public DDBeanRoot getRoot() { return root; } public String getXpath() { return xpath; } public String getText() { return (String) XMLUtil.getContent(element); } public String getId() { return getAttributeValue("ID"); } public String getAttributeValue(String attrName) { String value = element.getAttribute(attrName).trim(); if (value.length() == 0) { value = null; } return value; } public String[] getText(String xpath) { DDBean[] beans = getChildBean(xpath); if (beans == null) { return null; } String[] text = new String[beans.length]; for (int i = 0; i < beans.length; i++) { text[i] = beans[i].getText(); } return text; } public DDBean[] getChildBean(String xpath) { if (xpath.startsWith("/")) { return getRoot().getChildBean(xpath.substring(1)); } int index = xpath.indexOf('/'); if (index == -1) { List beans = (List) children.get(xpath); if (beans == null) { return null; } return (DDBean[]) beans.toArray(new DDBean[beans.size()]); } else { List childBeans = (List) children.get(xpath.substring(0, index)); String path = xpath.substring(index + 1); List beans = new ArrayList(); for (Iterator i = childBeans.iterator(); i.hasNext();) { DDBean bean = (DDBean) i.next(); DDBean[] childs = bean.getChildBean(path); if (childs != null) { for (int j = 0; j < childs.length; j++) { beans.add(childs[j]); } } } return beans.size() > 0 ? (DDBean[]) beans.toArray(new DDBean[beans.size()]) : null; } } public String[] getAttributeNames() { NamedNodeMap attrs = element.getAttributes(); String[] attrNames = new String[attrs.getLength()]; for (int i = 0; i < attrNames.length; i++) { Attr node = (Attr) attrs.item(i); attrNames[i] = node.getName(); } return attrNames; } public void addXpathListener(String xpath, XpathListener xpl) { } public void removeXpathListener(String xpath, XpathListener xpl) { } } 1.1 incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/tools/DDBeanRootImpl.java Index: DDBeanRootImpl.java =================================================================== /* ==================================================================== * The Apache Software License, Version 1.1 * * Copyright (c) 2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Apache" and "Apache Software Foundation" and * "Apache Geronimo" must not be used to endorse or promote products * derived from this software without prior written permission. For * written permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache", * "Apache Geronimo", nor may "Apache" appear in their name, without * prior written permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. * * ==================================================================== */ package org.apache.geronimo.deployment.tools; import java.io.IOException; import java.io.InputStream; import java.net.URL; import javax.enterprise.deploy.model.DDBean; import javax.enterprise.deploy.model.DDBeanRoot; import javax.enterprise.deploy.model.DeployableObject; import javax.enterprise.deploy.model.XpathListener; import javax.enterprise.deploy.model.exceptions.DDBeanCreateException; import javax.enterprise.deploy.shared.ModuleType; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.w3c.dom.Document; /** * * * @version $Revision: 1.1 $ $Date: 2004/01/21 20:37:29 $ */ public class DDBeanRootImpl implements DDBeanRoot { private final DeployableObject deployable; private final Document doc; private final DDBean docBean; public DDBeanRootImpl(DeployableObject deployable, URL descriptor) throws DDBeanCreateException { this.deployable = deployable; DocumentBuilder parser = null; try { parser = DocumentBuilderFactory.newInstance().newDocumentBuilder(); } catch (ParserConfigurationException e) { throw (DDBeanCreateException) new DDBeanCreateException("Unable to load parser").initCause(e); } InputStream is = null; try { is = descriptor.openStream(); doc = parser.parse(is); } catch (Exception e) { throw (DDBeanCreateException) new DDBeanCreateException("Unable to parse descriptor").initCause(e); } finally { if (is != null) { try { is.close(); } catch (IOException e) { // ignore } } } docBean = new DDBeanImpl(this, "/"+ doc.getDocumentElement().getNodeName(), doc.getDocumentElement()); } public DDBeanRoot getRoot() { return this; } public String getXpath() { return "/"; } public String getDDBeanRootVersion() { return doc.getDocumentElement().getAttribute("version"); } public DeployableObject getDeployableObject() { return deployable; } public String getFilename() { throw new UnsupportedOperationException(); } public String getModuleDTDVersion() { throw new UnsupportedOperationException(); } public ModuleType getType() { return deployable.getType(); } public String getId() { return null; } public String getText() { return null; } public String[] getAttributeNames() { return null; } public String getAttributeValue(String attrName) { return null; } public DDBean[] getChildBean(String xpath) { if (xpath.startsWith("/")) { xpath = xpath.substring(1); } int index = xpath.indexOf('/'); String childName = (index == -1) ? xpath : xpath.substring(0, index); if (childName.equals(doc.getDocumentElement().getNodeName())) { if (index == -1) { return new DDBean[] {docBean }; } else { return docBean.getChildBean(xpath.substring(index+1)); } } else { return null; } } public String[] getText(String xpath) { DDBean[] beans = getChildBean(xpath); if (beans == null) { return null; } String[] text = new String[beans.length]; for (int i = 0; i < beans.length; i++) { text[i] = beans[i].getText(); } return text; } public void addXpathListener(String xpath, XpathListener xpl) { throw new UnsupportedOperationException(); } public void removeXpathListener(String xpath, XpathListener xpl) { throw new UnsupportedOperationException(); } } 1.1 incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/factories/DeploymentFactoryImpl.java Index: DeploymentFactoryImpl.java =================================================================== /* ==================================================================== * The Apache Software License, Version 1.1 * * Copyright (c) 2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Apache" and "Apache Software Foundation" and * "Apache Geronimo" must not be used to endorse or promote products * derived from this software without prior written permission. For * written permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache", * "Apache Geronimo", nor may "Apache" appear in their name, without * prior written permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. * * ==================================================================== */ package org.apache.geronimo.deployment.plugin.factories; import java.net.URI; import java.net.URISyntaxException; import javax.enterprise.deploy.spi.factories.DeploymentFactory; import javax.enterprise.deploy.spi.DeploymentManager; import javax.enterprise.deploy.spi.exceptions.DeploymentManagerCreationException; import org.apache.geronimo.deployment.plugin.DeploymentManagerImpl; /** * * * @version $Revision: 1.1 $ $Date: 2004/01/21 20:37:29 $ */ public class DeploymentFactoryImpl implements DeploymentFactory { public static final String URI_PREFIX = "deployer:geronimo:"; public String getDisplayName() { return "Geronimo"; } public String getProductVersion() { return "0.1"; } public boolean handlesURI(String uri) { return uri.startsWith(URI_PREFIX); } public DeploymentManager getDisconnectedDeploymentManager(String uri) throws DeploymentManagerCreationException { if (!handlesURI(uri)) { return null; } URI configURI; try { configURI = new URI(uri.substring(9)); } catch (URISyntaxException e) { throw (DeploymentManagerCreationException) new DeploymentManagerCreationException("Unable to parse URI "+uri).initCause(e); } assert "geronimo".equals(configURI.getScheme()); String subURI = configURI.getSchemeSpecificPart(); if (subURI.startsWith("//")) { throw new AssertionError(); } else { configURI = URI.create(subURI); } return new DeploymentManagerImpl(); } public DeploymentManager getDeploymentManager(String uri, String username, String password) throws DeploymentManagerCreationException { return null; } } 1.1 incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/application/EARConfigBean.java Index: EARConfigBean.java =================================================================== /* ==================================================================== * The Apache Software License, Version 1.1 * * Copyright (c) 2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Apache" and "Apache Software Foundation" and * "Apache Geronimo" must not be used to endorse or promote products * derived from this software without prior written permission. For * written permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache", * "Apache Geronimo", nor may "Apache" appear in their name, without * prior written permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. * * ==================================================================== */ package org.apache.geronimo.deployment.plugin.application; import javax.enterprise.deploy.model.DDBean; import javax.enterprise.deploy.spi.DConfigBean; import javax.enterprise.deploy.spi.exceptions.BeanNotFoundException; import javax.enterprise.deploy.spi.exceptions.ConfigurationException; import org.apache.geronimo.deployment.plugin.DConfigBeanSupport; /** * * * @version $Revision: 1.1 $ $Date: 2004/01/21 20:37:29 $ */ public class EARConfigBean extends DConfigBeanSupport { public EARConfigBean(DDBean ddBean) { super(ddBean); } public String[] getXpaths() { return null; } public DConfigBean getDConfigBean(DDBean bean) throws ConfigurationException { throw new ConfigurationException(); } public void removeDConfigBean(DConfigBean bean) throws BeanNotFoundException { throw new BeanNotFoundException("No children"); } } 1.1 incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/j2ee/EJBRefConfigBean.java Index: EJBRefConfigBean.java =================================================================== /* ==================================================================== * The Apache Software License, Version 1.1 * * Copyright (c) 2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Apache" and "Apache Software Foundation" and * "Apache Geronimo" must not be used to endorse or promote products * derived from this software without prior written permission. For * written permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache", * "Apache Geronimo", nor may "Apache" appear in their name, without * prior written permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. * * ==================================================================== */ package org.apache.geronimo.deployment.plugin.j2ee; import javax.enterprise.deploy.model.DDBean; import javax.enterprise.deploy.spi.DConfigBean; import javax.enterprise.deploy.spi.exceptions.ConfigurationException; import javax.enterprise.deploy.spi.exceptions.BeanNotFoundException; import org.apache.geronimo.deployment.plugin.DConfigBeanSupport; /** * * * @version $Revision: 1.1 $ $Date: 2004/01/21 20:37:29 $ */ public class EJBRefConfigBean extends DConfigBeanSupport { private static final String[] XPATHS = { "jndi-name" }; public EJBRefConfigBean(DDBean ddBean) { super(ddBean); } public String[] getXpaths() { return XPATHS; } public DConfigBean getDConfigBean(DDBean bean) throws ConfigurationException { return null; } public void removeDConfigBean(DConfigBean bean) throws BeanNotFoundException { } } 1.1 incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/util/XMLUtil.java Index: XMLUtil.java =================================================================== /* ==================================================================== * The Apache Software License, Version 1.1 * * Copyright (c) 2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Apache" and "Apache Software Foundation" and * "Apache Geronimo" must not be used to endorse or promote products * derived from this software without prior written permission. For * written permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache", * "Apache Geronimo", nor may "Apache" appear in their name, without * prior written permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. * * ==================================================================== */ package org.apache.geronimo.deployment.util; import org.w3c.dom.Element; import org.w3c.dom.NodeList; import org.w3c.dom.Node; /** * * * @version $Revision: 1.1 $ $Date: 2004/01/21 20:37:29 $ */ public class XMLUtil { public static Object getContent(Element element) { NodeList nl = element.getChildNodes(); StringBuffer content = new StringBuffer(); for (int i = 0; i < nl.getLength(); i++) { Node node = nl.item(i); switch (node.getNodeType()) { case Node.ELEMENT_NODE: return node; case Node.CDATA_SECTION_NODE: case Node.TEXT_NODE: content.append(node.getNodeValue()); break; } } return content.toString().trim(); } }