Return-Path: Delivered-To: apmail-geronimo-scm-archive@www.apache.org Received: (qmail 59697 invoked from network); 10 Mar 2006 03:02:53 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 10 Mar 2006 03:02:52 -0000 Received: (qmail 33168 invoked by uid 500); 10 Mar 2006 03:02:45 -0000 Delivered-To: apmail-geronimo-scm-archive@geronimo.apache.org Received: (qmail 33008 invoked by uid 500); 10 Mar 2006 03:02:44 -0000 Mailing-List: contact scm-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@geronimo.apache.org List-Id: Delivered-To: mailing list scm@geronimo.apache.org Received: (qmail 32987 invoked by uid 99); 10 Mar 2006 03:02:44 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Mar 2006 19:02:44 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Thu, 09 Mar 2006 19:02:40 -0800 Received: (qmail 59487 invoked by uid 65534); 10 Mar 2006 03:02:18 -0000 Message-ID: <20060310030218.59477.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r384686 [1/3] - in /geronimo/branches/1.1: applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/handlers/ configs/geronimo-gbean-deployer/src/plan/ configs/j2ee-deployer/ configs/j2ee-deployer/src/plan/ configs/jett... Date: Fri, 10 Mar 2006 02:57:39 -0000 To: scm@geronimo.apache.org From: dain@apache.org X-Mailer: svnmailer-1.0.7 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: dain Date: Thu Mar 9 18:57:07 2006 New Revision: 384686 URL: http://svn.apache.org/viewcvs?rev=384686&view=rev Log: All configuration lifecycle code has been centeralized in configuration manager. ConfigurationManager uses reference counting on starts and loads of a configuration. Configuration load, start, stop, and unload operations are all recursive. Introcuded Dependency type which hold an Artifact and an ImportType (enum of ALL, CLASSES or SERVICES). Environiment only holds a single collection of Dependency types, instead of three collections (import, classes, and references). The only import style artifact has been replaced with import type ALL, and the actual determination of an artifacts ability to contain services is delayed until start time. Added: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/repository/Dependency.java geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/repository/ImportType.java Modified: geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/handlers/CreateDestinationHandler.java geronimo/branches/1.1/configs/geronimo-gbean-deployer/src/plan/plan.xml geronimo/branches/1.1/configs/j2ee-deployer/project.xml geronimo/branches/1.1/configs/j2ee-deployer/src/plan/plan.xml geronimo/branches/1.1/configs/jetty-deployer/project.xml geronimo/branches/1.1/configs/tomcat-deployer/project.xml geronimo/branches/1.1/modules/axis-builder/src/test/org/apache/geronimo/axis/builder/ServiceReferenceTest.java geronimo/branches/1.1/modules/client-builder/src/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java geronimo/branches/1.1/modules/client-builder/src/test/org/apache/geronimo/client/builder/PlanParsingTest.java geronimo/branches/1.1/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java geronimo/branches/1.1/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentContext.java geronimo/branches/1.1/modules/deployment/src/test/org/apache/geronimo/deployment/DeploymentContextTest.java geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARContext.java geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/ModuleBuilder.java geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/SwitchingModuleBuilder.java geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/EARConfigBuilderTest.java geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockConnectorConfigBuilder.java geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockEJBConfigBuilder.java geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockWARConfigBuilder.java geronimo/branches/1.1/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java geronimo/branches/1.1/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/JettyModuleBuilderTest.java geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/GBeanData.java geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/ReferencePatterns.java geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManager.java geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManagerImpl.java geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/EditableConfigurationManagerImpl.java geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/repository/ArtifactResolver.java geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/repository/DefaultArtifactResolver.java geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/repository/Environment.java geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/ConfigTest.java geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/config/ConfigurationManagerTest.java geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/repository/ArtifactResolverTest.java geronimo/branches/1.1/modules/service-builder/src/java/org/apache/geronimo/deployment/service/EnvironmentBuilder.java geronimo/branches/1.1/modules/service-builder/src/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java geronimo/branches/1.1/modules/service-builder/src/test/org/apache/geronimo/deployment/service/ServiceConfigBuilderTest.java geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/RepositoryConfigurationStore.java geronimo/branches/1.1/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java geronimo/branches/1.1/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java geronimo/branches/1.1/modules/web-builder/src/java/org/apache/geronimo/web/deployment/AbstractWebModuleBuilder.java geronimo/branches/1.1/plugins/geronimo-assembly-plugin/src/java/org/apache/geronimo/plugin/assembly/BaseConfigInstaller.java geronimo/branches/1.1/plugins/geronimo-assembly-plugin/src/java/org/apache/geronimo/plugin/assembly/LocalConfigInstaller.java geronimo/branches/1.1/plugins/geronimo-assembly-plugin/src/java/org/apache/geronimo/plugin/assembly/RepoConfigInstaller.java geronimo/branches/1.1/plugins/geronimo-assembly-plugin/src/java/org/apache/geronimo/plugin/assembly/RepoCopier.java geronimo/branches/1.1/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenConfigStore.java geronimo/branches/1.1/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilder.java geronimo/branches/1.1/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilderShell.java geronimo/branches/1.1/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PlanProcessor.java Modified: geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/handlers/CreateDestinationHandler.java URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/handlers/CreateDestinationHandler.java?rev=384686&r1=384685&r2=384686&view=diff ============================================================================== --- geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/handlers/CreateDestinationHandler.java (original) +++ geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/handlers/CreateDestinationHandler.java Thu Mar 9 18:57:07 2006 @@ -35,6 +35,7 @@ import org.apache.geronimo.kernel.config.ConfigurationUtil; import org.apache.geronimo.kernel.repository.Artifact; import org.apache.geronimo.kernel.repository.Environment; +import org.apache.geronimo.kernel.repository.ImportType; import javax.jms.Queue; import javax.jms.Topic; @@ -44,9 +45,7 @@ import javax.portlet.PortletException; import java.io.File; import java.io.IOException; -import java.net.URI; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collections; import java.util.LinkedHashSet; import java.util.List; @@ -55,7 +54,7 @@ protected static Log log = LogFactory .getLog(CreateDestinationHandler.class); - private static final List parentId = Arrays.asList(new URI[] {URI.create("geronimo/activemq-broker/" + GeronimoVersion.GERONIMO_VERSION + "/car")}); + private static final Artifact parentId = new Artifact("geronimo", "activemq-broker", GeronimoVersion.GERONIMO_VERSION, "car"); static final GBeanInfo QUEUE_INFO; @@ -118,7 +117,7 @@ "createNewConfigurationDir"); Environment environment = new Environment(); environment.setConfigId(configId); - environment.setImports(parentId); + environment.addDependency(parentId, ImportType.ALL); List gbeans = new ArrayList(); gbeans.add(adminObjectData); // If we are adding a topic we have to add a browser so we can view Modified: geronimo/branches/1.1/configs/geronimo-gbean-deployer/src/plan/plan.xml URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/configs/geronimo-gbean-deployer/src/plan/plan.xml?rev=384686&r1=384685&r2=384686&view=diff ============================================================================== --- geronimo/branches/1.1/configs/geronimo-gbean-deployer/src/plan/plan.xml (original) +++ geronimo/branches/1.1/configs/geronimo-gbean-deployer/src/plan/plan.xml Thu Mar 9 18:57:07 2006 @@ -30,12 +30,10 @@ - - geronimo.maven:name=MavenConfigStore,j2eeType=ConfigurationStore - geronimo.server:j2eeType=ConfigurationStore,name=Local + *:j2eeType=ConfigurationStore,* - geronimo.maven:j2eeType=ConfigBuilder,* + *:j2eeType=ConfigBuilder,* Modified: geronimo/branches/1.1/configs/j2ee-deployer/project.xml URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/configs/j2ee-deployer/project.xml?rev=384686&r1=384685&r2=384686&view=diff ============================================================================== --- geronimo/branches/1.1/configs/j2ee-deployer/project.xml (original) +++ geronimo/branches/1.1/configs/j2ee-deployer/project.xml Thu Mar 9 18:57:07 2006 @@ -48,7 +48,7 @@ j2ee-server ${pom.currentVersion} - true + true Modified: geronimo/branches/1.1/configs/j2ee-deployer/src/plan/plan.xml URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/configs/j2ee-deployer/src/plan/plan.xml?rev=384686&r1=384685&r2=384686&view=diff ============================================================================== --- geronimo/branches/1.1/configs/j2ee-deployer/src/plan/plan.xml (original) +++ geronimo/branches/1.1/configs/j2ee-deployer/src/plan/plan.xml Thu Mar 9 18:57:07 2006 @@ -116,9 +116,6 @@ 15 true false - - *:name=Repository,* - @@ -150,9 +147,6 @@ WebServiceBuilder - - - *:name=Repository,* Modified: geronimo/branches/1.1/configs/jetty-deployer/project.xml URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/configs/jetty-deployer/project.xml?rev=384686&r1=384685&r2=384686&view=diff ============================================================================== --- geronimo/branches/1.1/configs/jetty-deployer/project.xml (original) +++ geronimo/branches/1.1/configs/jetty-deployer/project.xml Thu Mar 9 18:57:07 2006 @@ -55,7 +55,7 @@ ${geronimo_version} car - true + true @@ -64,7 +64,7 @@ geronimo-jetty-builder ${geronimo_version} - true + true Modified: geronimo/branches/1.1/configs/tomcat-deployer/project.xml URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/configs/tomcat-deployer/project.xml?rev=384686&r1=384685&r2=384686&view=diff ============================================================================== --- geronimo/branches/1.1/configs/tomcat-deployer/project.xml (original) +++ geronimo/branches/1.1/configs/tomcat-deployer/project.xml Thu Mar 9 18:57:07 2006 @@ -55,7 +55,7 @@ ${geronimo_version} car - true + true @@ -65,7 +65,7 @@ geronimo-tomcat-builder ${geronimo_version} - true + true Modified: geronimo/branches/1.1/modules/axis-builder/src/test/org/apache/geronimo/axis/builder/ServiceReferenceTest.java URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/axis-builder/src/test/org/apache/geronimo/axis/builder/ServiceReferenceTest.java?rev=384686&r1=384685&r2=384686&view=diff ============================================================================== --- geronimo/branches/1.1/modules/axis-builder/src/test/org/apache/geronimo/axis/builder/ServiceReferenceTest.java (original) +++ geronimo/branches/1.1/modules/axis-builder/src/test/org/apache/geronimo/axis/builder/ServiceReferenceTest.java Thu Mar 9 18:57:07 2006 @@ -107,7 +107,7 @@ Map nameKeys = new HashMap(); nameKeys.put("domain", "geronimo"); environment.setProperties(nameKeys); - context = new DeploymentContext(tmpbasedir, environment, ConfigurationModuleType.CAR, null); + context = new DeploymentContext(tmpbasedir, environment, ConfigurationModuleType.CAR, null, null); File moduleLocation = new File(tmpbasedir, "ejb"); moduleLocation.mkdirs(); @@ -224,7 +224,7 @@ //ejb is from the EJBModule "ejb" targetPath. context.addFile(new URI("ejb/META-INF/wsdl/interop.wsdl"), wsdlFile); context.addFile(new URI("ejb/META-INF/wsdl/interop-jaxrpcmapping.xml"), new File(wsdlDir, "interop-jaxrpcmapping.xml")); - ClassLoader cl = context.getClassLoader(null); + ClassLoader cl = context.getClassLoader(); //new URLClassLoader(new URL[]{wsdldir.toURL()}, isolatedCl); URI wsdlURI = new URI("META-INF/wsdl/interop.wsdl"); URI jaxrpcmappingURI = new URI("META-INF/wsdl/interop-jaxrpcmapping.xml"); @@ -233,7 +233,7 @@ Map portComponentRefMap = null; List handlers = null; DeserializingReference reference = (DeserializingReference) builder.createService(InteropLab.class, wsdlURI, jaxrpcmappingURI, serviceQName, portComponentRefMap, handlers, gerServiceRefType, context, module, cl); - ClassLoader contextCl = context.getClassLoader(null); + ClassLoader contextCl = context.getClassLoader(); reference.setClassLoader(contextCl); Object proxy = reference.getContent(); assertNotNull(proxy); Modified: geronimo/branches/1.1/modules/client-builder/src/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/client-builder/src/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java?rev=384686&r1=384685&r2=384686&view=diff ============================================================================== --- geronimo/branches/1.1/modules/client-builder/src/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java (original) +++ geronimo/branches/1.1/modules/client-builder/src/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java Thu Mar 9 18:57:07 2006 @@ -93,7 +93,6 @@ private final Environment defaultServerEnvironment; private final ObjectName corbaGBeanObjectName; private final Kernel kernel; - private final Repository repository; private final String clientApplicationName = "client-application"; private final ObjectName transactionContextManagerObjectName; @@ -105,21 +104,19 @@ private static final String GERAPPCLIENT_NAMESPACE = GerApplicationClientDocument.type.getDocumentElementName().getNamespaceURI(); public AppClientModuleBuilder(Environment defaultClientEnvironment, - Environment defaultServerEnvironment, - ObjectName transactionContextManagerObjectName, - ObjectName connectionTrackerObjectName, - ObjectName corbaGBeanObjectName, - EJBReferenceBuilder ejbReferenceBuilder, - ModuleBuilder connectorModuleBuilder, - ResourceReferenceBuilder resourceReferenceBuilder, - ServiceReferenceBuilder serviceReferenceBuilder, - Repository repository, - Kernel kernel) { + Environment defaultServerEnvironment, + ObjectName transactionContextManagerObjectName, + ObjectName connectionTrackerObjectName, + ObjectName corbaGBeanObjectName, + EJBReferenceBuilder ejbReferenceBuilder, + ModuleBuilder connectorModuleBuilder, + ResourceReferenceBuilder resourceReferenceBuilder, + ServiceReferenceBuilder serviceReferenceBuilder, + Kernel kernel) { this.defaultClientEnvironment = defaultClientEnvironment; this.defaultServerEnvironment = defaultServerEnvironment; this.corbaGBeanObjectName = corbaGBeanObjectName; this.kernel = kernel; - this.repository = repository; this.transactionContextManagerObjectName = transactionContextManagerObjectName; this.connectionTrackerObjectName = connectionTrackerObjectName; this.ejbReferenceBuilder = ejbReferenceBuilder; @@ -245,7 +242,7 @@ return geronimoAppClient; } - public void installModule(JarFile earFile, EARContext earContext, Module module, ConfigurationStore configurationStore) throws DeploymentException { + public void installModule(JarFile earFile, EARContext earContext, Module module, ConfigurationStore configurationStore, Repository repository) throws DeploymentException { // extract the app client jar file into a standalone packed jar file and add the contents to the output JarFile moduleFile = module.getModuleFile(); try { @@ -275,6 +272,7 @@ EARContext appClientDeploymentContext = new EARContext(appClientDir, clientEnvironment, ConfigurationModuleType.CAR, + Collections.singleton(repository), kernel, clientApplicationName, transactionContextManagerObjectName, @@ -369,7 +367,7 @@ addManifestClassPath(appClientDeploymentContext, appClientModule.getEarFile(), moduleFile, moduleBase); // get the classloader - ClassLoader appClientClassLoader = appClientDeploymentContext.getClassLoader(this.repository); + ClassLoader appClientClassLoader = appClientDeploymentContext.getClassLoader(); // pop in all the gbeans declared in the geronimo app client file if (geronimoAppClient != null) { @@ -386,10 +384,10 @@ if (resource.isSetExternalRar()) { path = resource.getExternalRar().trim(); Artifact artifact = Artifact.create(path); - if (!this.repository.contains(artifact)) { + if (!repository.contains(artifact)) { throw new DeploymentException("Missing rar in repository: " + path); } - File file = this.repository.getLocation(artifact); + File file = repository.getLocation(artifact); try { connectorFile = new JarFile(file); } catch (IOException e) { @@ -407,10 +405,10 @@ Module connectorModule = connectorModuleBuilder.createModule(connectorPlan, connectorFile, path, null, null, null); resourceModules.add(connectorModule); //TODO configStore == null is fishy, consider moving these stages for connectors into the corresponding stages for this module. - connectorModuleBuilder.installModule(connectorFile, appClientDeploymentContext, connectorModule, null); + connectorModuleBuilder.installModule(connectorFile, appClientDeploymentContext, connectorModule, null, repository); } //the install step could have added more dependencies... we need a new cl. - appClientClassLoader = appClientDeploymentContext.getClassLoader(this.repository); + appClientClassLoader = appClientDeploymentContext.getClassLoader(); for (Iterator iterator = resourceModules.iterator(); iterator.hasNext();) { Module connectorModule = (Module) iterator.next(); connectorModuleBuilder.initContext(appClientDeploymentContext, connectorModule, appClientClassLoader); @@ -601,7 +599,6 @@ infoBuilder.addReference("ConnectorModuleBuilder", ModuleBuilder.class, NameFactory.MODULE_BUILDER); infoBuilder.addReference("ResourceReferenceBuilder", ResourceReferenceBuilder.class, NameFactory.MODULE_BUILDER); infoBuilder.addReference("ServiceReferenceBuilder", ServiceReferenceBuilder.class, NameFactory.MODULE_BUILDER); - infoBuilder.addReference("Repository", Repository.class, NameFactory.GERONIMO_SERVICE); infoBuilder.addAttribute("kernel", Kernel.class, false); @@ -616,7 +613,6 @@ "ConnectorModuleBuilder", "ResourceReferenceBuilder", "ServiceReferenceBuilder", - "Repository", "kernel"}); GBEAN_INFO = infoBuilder.getBeanInfo(); } Modified: geronimo/branches/1.1/modules/client-builder/src/test/org/apache/geronimo/client/builder/PlanParsingTest.java URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/client-builder/src/test/org/apache/geronimo/client/builder/PlanParsingTest.java?rev=384686&r1=384685&r2=384686&view=diff ============================================================================== --- geronimo/branches/1.1/modules/client-builder/src/test/org/apache/geronimo/client/builder/PlanParsingTest.java (original) +++ geronimo/branches/1.1/modules/client-builder/src/test/org/apache/geronimo/client/builder/PlanParsingTest.java Thu Mar 9 18:57:07 2006 @@ -19,7 +19,7 @@ File basedir = new File(System.getProperty("basedir", ".")); protected void setUp() throws Exception { - builder = new AppClientModuleBuilder(new Environment(), null, null, null, null, null, null, null, null, null, null); + builder = new AppClientModuleBuilder(new Environment(), null, null, null, null, null, null, null, null, null); } public void testResourceRef() throws Exception { Modified: geronimo/branches/1.1/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java?rev=384686&r1=384685&r2=384686&view=diff ============================================================================== --- geronimo/branches/1.1/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java (original) +++ geronimo/branches/1.1/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java Thu Mar 9 18:57:07 2006 @@ -122,21 +122,18 @@ private final boolean defaultXATransactionCaching; private final boolean defaultXAThreadCaching; private final Environment defaultEnvironment; - private final Repository repository; private final Kernel kernel; private static QName CONNECTOR_QNAME = GerConnectorDocument.type.getDocumentElementName(); static final String GERCONNECTOR_NAMESPACE = CONNECTOR_QNAME.getNamespaceURI(); public ConnectorModuleBuilder(Environment defaultEnvironment, - int defaultMaxSize, - int defaultMinSize, - int defaultBlockingTimeoutMilliseconds, - int defaultIdleTimeoutMinutes, - boolean defaultXATransactionCaching, - boolean defaultXAThreadCaching, - Repository repository, - Kernel kernel) { - assert repository != null; + int defaultMaxSize, + int defaultMinSize, + int defaultBlockingTimeoutMilliseconds, + int defaultIdleTimeoutMinutes, + boolean defaultXATransactionCaching, + boolean defaultXAThreadCaching, + Kernel kernel) { this.defaultEnvironment = defaultEnvironment; this.defaultMaxSize = defaultMaxSize; @@ -145,7 +142,6 @@ this.defaultIdleTimeoutMinutes = defaultIdleTimeoutMinutes; this.defaultXATransactionCaching = defaultXATransactionCaching; this.defaultXAThreadCaching = defaultXAThreadCaching; - this.repository = repository; this.kernel = kernel; } @@ -235,7 +231,7 @@ return new ConnectorModule(standAlone, environment, moduleFile, targetPath, connector, gerConnector, specDD); } - public void installModule(JarFile earFile, EARContext earContext, Module module, ConfigurationStore configurationStore) throws DeploymentException { + public void installModule(JarFile earFile, EARContext earContext, Module module, ConfigurationStore configurationStore, Repository repository) throws DeploymentException { GerConnectorType vendorConnector = (GerConnectorType) module.getVendorDD(); try { JarFile moduleFile = module.getModuleFile(); @@ -867,7 +863,6 @@ infoBuilder.addAttribute("defaultXATransactionCaching", boolean.class, true, true); infoBuilder.addAttribute("defaultXAThreadCaching", boolean.class, true, true); - infoBuilder.addReference("Repository", Repository.class, NameFactory.GERONIMO_SERVICE); infoBuilder.addAttribute("kernel", Kernel.class, false); infoBuilder.addInterface(ModuleBuilder.class); @@ -880,7 +875,6 @@ "defaultIdleTimeoutMinutes", "defaultXATransactionCaching", "defaultXAThreadCaching", - "Repository", "kernel"}); GBEAN_INFO = infoBuilder.getBeanInfo(); } Modified: geronimo/branches/1.1/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java?rev=384686&r1=384685&r2=384686&view=diff ============================================================================== --- geronimo/branches/1.1/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java (original) +++ geronimo/branches/1.1/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java Thu Mar 9 18:57:07 2006 @@ -54,6 +54,8 @@ import org.apache.geronimo.kernel.repository.DefaultArtifactResolver; import org.apache.geronimo.kernel.repository.Environment; import org.apache.geronimo.kernel.repository.Repository; +import org.apache.geronimo.kernel.repository.ImportType; +import org.apache.geronimo.kernel.repository.Dependency; import org.apache.geronimo.system.serverinfo.BasicServerInfo; import org.tranql.sql.jdbc.JDBCUtil; @@ -189,7 +191,7 @@ kernel.startGBean(configurationManagerName); rarFile = DeploymentUtil.createJarFile(new File(basedir, "target/test-ear-noger.ear")); - EARConfigBuilder configBuilder = new EARConfigBuilder(defaultEnvironment, null, connectionTrackerName, null, null, null, null, null, ejbReferenceBuilder, null, new ConnectorModuleBuilder(defaultEnvironment, defaultMaxSize, defaultMinSize, defaultBlockingTimeoutMilliseconds, defaultidleTimeoutMinutes, defaultXATransactionCaching, defaultXAThreadCaching, repository, kernel), resourceReferenceBuilder, null, serviceReferenceBuilder, kernel); + EARConfigBuilder configBuilder = new EARConfigBuilder(defaultEnvironment, null, connectionTrackerName, null, null, null, null, null, ejbReferenceBuilder, null, new ConnectorModuleBuilder(defaultEnvironment, defaultMaxSize, defaultMinSize, defaultBlockingTimeoutMilliseconds, defaultidleTimeoutMinutes, defaultXATransactionCaching, defaultXAThreadCaching, kernel), resourceReferenceBuilder, null, serviceReferenceBuilder, kernel); ConfigurationData configData = null; try { File planFile = new File(basedir, "src/test-data/data/external-application-plan.xml"); @@ -332,7 +334,7 @@ kernel.loadGBean(configurationManagerData, getClass().getClassLoader()); kernel.startGBean(configurationManagerName); - ConnectorModuleBuilder moduleBuilder = new ConnectorModuleBuilder(defaultEnvironment, defaultMaxSize, defaultMinSize, defaultBlockingTimeoutMilliseconds, defaultidleTimeoutMinutes, defaultXATransactionCaching, defaultXAThreadCaching, repository, kernel); + ConnectorModuleBuilder moduleBuilder = new ConnectorModuleBuilder(defaultEnvironment, defaultMaxSize, defaultMinSize, defaultBlockingTimeoutMilliseconds, defaultidleTimeoutMinutes, defaultXATransactionCaching, defaultXAThreadCaching, kernel); File rarFile = action.getRARFile(); ClassLoader oldCl = Thread.currentThread().getContextClassLoader(); @@ -353,6 +355,7 @@ EARContext earContext = new EARContext(tempDir, module.getEnvironment(), module.getType(), + Collections.singleton(repository), kernel, j2eeContext.getJ2eeApplicationName(), null, @@ -364,7 +367,7 @@ serviceReferenceBuilder, kernel)); action.install(moduleBuilder, earContext, module, configurationStore); - earContext.getClassLoader(null); + earContext.getClassLoader(); moduleBuilder.initContext(earContext, module, cl); moduleBuilder.addGBeans(earContext, module, cl, repository); earContext.close(); @@ -407,7 +410,7 @@ kernel.startGBean(configurationManagerName); ConfigurationManager configurationManager = (ConfigurationManager) kernel.getProxyManager().createProxy(configurationManagerName, ConfigurationManager.class); - Artifact parentID = (Artifact) defaultEnvironment.getImports().iterator().next(); + Artifact parentID = ((Dependency) defaultEnvironment.getDependencies().iterator().next()).getArtifact(); configurationManager.loadConfiguration(parentID); configurationManager.startConfiguration(parentID); @@ -569,7 +572,7 @@ protected void setUp() throws Exception { configurationManagerName = new ObjectName(":j2eeType=ConfigurationManager,name=Basic"); defaultEnvironment = new Environment(); - defaultEnvironment.getImports().add(Artifact.create("org/apache/geronimo/Server")); + defaultEnvironment.addDependency(Artifact.create("org/apache/geronimo/Server"), ImportType.ALL); defaultEnvironment.getProperties().put(NameFactory.JSR77_BASE_NAME_PROPERTY, "geronimo.test:J2EEServer=geronimo"); } @@ -585,7 +588,7 @@ public abstract File getRARFile(); public void install(ModuleBuilder moduleBuilder, EARContext earContext, Module module, ConfigurationStore configurationStore) throws Exception { - moduleBuilder.installModule(module.getModuleFile(), earContext, module, configurationStore); + moduleBuilder.installModule(module.getModuleFile(), earContext, module, configurationStore, repository); } } Modified: geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentContext.java URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentContext.java?rev=384686&r1=384685&r2=384686&view=diff ============================================================================== --- geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentContext.java (original) +++ geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentContext.java Thu Mar 9 18:57:07 2006 @@ -31,13 +31,10 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; import java.util.Iterator; -import java.util.LinkedHashMap; import java.util.LinkedHashSet; import java.util.List; -import java.util.Map; +import java.util.ListIterator; import java.util.Set; import java.util.StringTokenizer; import java.util.jar.Attributes; @@ -63,9 +60,9 @@ import org.apache.geronimo.kernel.repository.Artifact; import org.apache.geronimo.kernel.repository.ArtifactResolver; import org.apache.geronimo.kernel.repository.DefaultArtifactResolver; +import org.apache.geronimo.kernel.repository.Dependency; import org.apache.geronimo.kernel.repository.Environment; -import org.apache.geronimo.kernel.repository.MissingDependencyException; -import org.apache.geronimo.kernel.repository.Repository; +import org.apache.geronimo.kernel.repository.ImportType; /** * @version $Rev$ $Date$ @@ -75,6 +72,7 @@ private final Environment environment; private final ConfigurationModuleType moduleType; private final LinkedHashSet classpath = new LinkedHashSet(); + private final Collection repositories; private final Kernel kernel; private final GBeanDataRegistry gbeans = new GBeanDataRegistry(); private final File baseDir; @@ -82,15 +80,18 @@ private final byte[] buffer = new byte[4096]; private final List loadedConfigurations = new ArrayList(); private final List childConfigurationDatas = new ArrayList(); + private ConfigurationManager configurationManager; + private final ArtifactResolver artifactResolver; - public DeploymentContext(File baseDir, Environment environment, ConfigurationModuleType type, Kernel kernel) throws DeploymentException { + public DeploymentContext(File baseDir, Environment environment, ConfigurationModuleType type, Collection repositories, Kernel kernel) throws DeploymentException { assert baseDir != null: "baseDir is null"; assert environment != null: "environment is null"; assert type != null: "type is null"; this.environment = environment; this.moduleType = type; + this.repositories = repositories; this.kernel = kernel; if (!baseDir.exists()) { @@ -102,6 +103,11 @@ this.baseDir = baseDir; this.baseUri = baseDir.toURI(); + if (kernel != null) { + configurationManager = ConfigurationUtil.getConfigurationManager(kernel); + } + artifactResolver = new DefaultArtifactResolver(null, repositories); + determineNaming(); setupParents(); } @@ -110,19 +116,32 @@ if (environment.getProperties() != null && !environment.getProperties().isEmpty()) { return; } - Collection parentId = environment.getImports(); - if (kernel == null || parentId == null || parentId.isEmpty()) { - throw new DeploymentException("neither domain and server nor any way to determine them was provided for configuration " + environment.getConfigId()); + Collection dependencies = environment.getDependencies(); + if (kernel == null || dependencies.isEmpty()) { + throw new DeploymentException("Neither domain and server nor any way to determine them was provided for configuration " + environment.getConfigId()); } - Artifact parent = (Artifact) parentId.iterator().next(); ConfigurationManager configurationManager = ConfigurationUtil.getConfigurationManager(kernel); try { boolean loaded = false; - if (!configurationManager.isLoaded(parent)) { - configurationManager.loadConfiguration(parent); - loaded = true; + + Artifact parent = null; + for (Iterator iterator = dependencies.iterator(); iterator.hasNext();) { + Dependency dependency = (Dependency) iterator.next(); + Artifact artifact = dependency.getArtifact(); + if (configurationManager.isConfiguration(artifact)) { + if (!configurationManager.isLoaded(artifact)) { + configurationManager.loadConfiguration(artifact); + loaded = true; + } + parent = artifact; + break; + } + } + if (parent == null) { + throw new DeploymentException("Neither domain and server nor any way to determine them was provided for configuration " + environment.getConfigId()); } + try { ObjectName parentName = Configuration.getConfigurationObjectName(parent); Environment environment = (Environment) kernel.getAttribute(parentName, "environment"); @@ -143,7 +162,7 @@ //check that domain and server are now known if (environment.getProperties() == null || environment.getProperties().isEmpty()) { - throw new IllegalStateException("Properties not be determined from explicit args or parent configuration. ParentID: " + parentId); + throw new IllegalStateException("Properties not be determined from explicit args or parent configuration. ParentID: " + dependencies); } } @@ -381,108 +400,111 @@ return new File(baseUri.resolve(targetPath)); } - static interface ParentSource { - Collection getParents(Artifact point) throws DeploymentException; - } - - List getExtremalSet(Collection points, ParentSource parentSource) throws DeploymentException { - LinkedHashMap pointToEnvelopeMap = new LinkedHashMap(); - for (Iterator iterator = points.iterator(); iterator.hasNext();) { - Artifact newPoint = (Artifact) iterator.next(); - Set newEnvelope = new HashSet(); - getEnvelope(newPoint, parentSource, newEnvelope); - boolean useMe = true; - for (Iterator iterator1 = pointToEnvelopeMap.entrySet().iterator(); iterator1.hasNext();) { - Map.Entry entry = (Map.Entry) iterator1.next(); - Set existingEnvelope = (Set) entry.getValue(); - if (existingEnvelope.contains(newPoint)) { - useMe = false; - } else if (newEnvelope.contains(entry.getKey())) { - iterator1.remove(); - } - } - if (useMe) { - pointToEnvelopeMap.put(newPoint, newEnvelope); - } - } - return new ArrayList(pointToEnvelopeMap.keySet()); - } - - private void getEnvelope(Artifact point, ParentSource parentSource, Set envelope) throws DeploymentException { - Collection newPoints = parentSource.getParents(point); - envelope.addAll(newPoints); - for (Iterator iterator = newPoints.iterator(); iterator.hasNext();) { - Artifact newPoint = (Artifact) iterator.next(); - getEnvelope(newPoint, parentSource, envelope); - } - } - - static class ConfigurationParentSource implements ParentSource { - - private final Kernel kernel; - - public ConfigurationParentSource(Kernel kernel) { - this.kernel = kernel; - } - - public Collection getParents(Artifact configID) throws DeploymentException { - ObjectName configName; - try { - configName = Configuration.getConfigurationObjectName(configID); - } catch (InvalidConfigException e) { - throw new DeploymentException("Cannot convert ID to ObjectName: ", e); - } - try { - Environment environment = (Environment) kernel.getAttribute(configName, "environment"); - return environment.getImports(); - } catch (Exception e) { - throw new DeploymentException("Cannot find parents of alleged config: ", e); - } - } - - } +// static interface ParentSource { +// Collection getParents(Artifact point) throws DeploymentException; +// } +// +// List getExtremalSet(Collection points, ParentSource parentSource) throws DeploymentException { +// LinkedHashMap pointToEnvelopeMap = new LinkedHashMap(); +// for (Iterator iterator = points.iterator(); iterator.hasNext();) { +// Artifact newPoint = (Artifact) iterator.next(); +// Set newEnvelope = new HashSet(); +// getEnvelope(newPoint, parentSource, newEnvelope); +// boolean useMe = true; +// for (Iterator iterator1 = pointToEnvelopeMap.entrySet().iterator(); iterator1.hasNext();) { +// Map.Entry entry = (Map.Entry) iterator1.next(); +// Set existingEnvelope = (Set) entry.getValue(); +// if (existingEnvelope.contains(newPoint)) { +// useMe = false; +// } else if (newEnvelope.contains(entry.getKey())) { +// iterator1.remove(); +// } +// } +// if (useMe) { +// pointToEnvelopeMap.put(newPoint, newEnvelope); +// } +// } +// return new ArrayList(pointToEnvelopeMap.keySet()); +// } +// +// private void getEnvelope(Artifact point, ParentSource parentSource, Set envelope) throws DeploymentException { +// Collection newPoints = parentSource.getParents(point); +// envelope.addAll(newPoints); +// for (Iterator iterator = newPoints.iterator(); iterator.hasNext();) { +// Artifact newPoint = (Artifact) iterator.next(); +// getEnvelope(newPoint, parentSource, envelope); +// } +// } +// +// static class ConfigurationParentSource implements ParentSource { +// +// private final Kernel kernel; +// +// public ConfigurationParentSource(Kernel kernel) { +// this.kernel = kernel; +// } +// +// public Collection getParents(Artifact configID) throws DeploymentException { +// ObjectName configName; +// try { +// configName = Configuration.getConfigurationObjectName(configID); +// } catch (InvalidConfigException e) { +// throw new DeploymentException("Cannot convert ID to ObjectName: ", e); +// } +// try { +// Environment environment = (Environment) kernel.getAttribute(configName, "environment"); +// return environment.getImports(); +// } catch (Exception e) { +// throw new DeploymentException("Cannot find parents of alleged config: ", e); +// } +// } +// +// } private void setupParents() throws DeploymentException { - Collection parentId = environment.getImports(); - if (kernel != null && parentId != null && parentId.size() > 0) { - ConfigurationManager configurationManager = ConfigurationUtil.getConfigurationManager(kernel); - try { - loadConfigurations(parentId, configurationManager); - } finally { - ConfigurationUtil.releaseConfigurationManager(kernel, configurationManager); - } - } - } - - private void loadConfigurations(Collection configurations, ConfigurationManager configurationManager) throws DeploymentException { - if (configurationManager != null && configurations != null) { + if (kernel != null) { try { - for (Iterator iterator = configurations.iterator(); iterator.hasNext();) { - Artifact artifact = (Artifact) iterator.next(); - configurationManager.loadConfiguration(artifact); - loadedConfigurations.add(artifact); + List dependencies = new ArrayList(environment.getDependencies()); + for (ListIterator iterator = dependencies.listIterator(); iterator.hasNext();) { + Dependency dependency = (Dependency) iterator.next(); + Artifact resolvedArtifact = artifactResolver.resolve(dependency.getArtifact()); + if (configurationManager != null && configurationManager.isConfiguration(resolvedArtifact)) { + configurationManager.loadConfiguration(resolvedArtifact); + + // update the dependency list to contain the resolved artifact + dependency = new Dependency(resolvedArtifact, dependency.getImportType()); + iterator.set(dependency); + } else if (dependency.getImportType() == ImportType.SERVICES) { + // Service depdendencies require that the depdencency be a configuration + if (configurationManager == null) throw new NullPointerException("configurationManager is null"); + throw new DeploymentException("Dependency does not have services: " + resolvedArtifact); + } } + environment.setDependencies(dependencies); + } catch (DeploymentException e) { + throw e; } catch (Exception e) { throw new DeploymentException("Unable to load parents", e); } } } - public ClassLoader getClassLoader(Repository repository) throws DeploymentException { - return getClassLoader(repository, null); + public ClassLoader getClassLoader() throws DeploymentException { + return getConfiguration(null).getConfigurationClassLoader(); } - public ClassLoader getClassLoader(Repository repository, Configuration knownParent) throws DeploymentException { - return getConfiguration(repository, knownParent).getConfigurationClassLoader(); + public ClassLoader getClassLoader(Configuration knownParent) throws DeploymentException { + return getConfiguration(knownParent).getConfigurationClassLoader(); } - public Configuration getConfiguration(Repository repository, Configuration knownParent) throws DeploymentException { + public Configuration getConfiguration(Configuration knownParent) throws DeploymentException { Environment environmentCopy = new Environment(environment); - Set repositories = Collections.singleton(repository); + if (knownParent != null) { + environmentCopy.addDependency(knownParent.getId(), ImportType.ALL); + } try { - List parents = createParentProxies(repositories, knownParent); + List parents = createParentProxies(environmentCopy, knownParent); Configuration configuration = new Configuration(parents, - kernel, Configuration.getConfigurationObjectName(environmentCopy.getConfigId()).getCanonicalName(), moduleType, environmentCopy, @@ -529,26 +551,49 @@ } } - private List createParentProxies(Set repositories, Configuration knownParent) throws MissingDependencyException, InvalidConfigException { - ArtifactResolver artifactResolver = new DefaultArtifactResolver(null, repositories); - LinkedHashSet imports = environment.getImports(); - imports = artifactResolver.resolve(imports); - environment.setImports(imports); - - // get proxies to my parent configurations (now that the imports have been resolved) - ArrayList parents = new ArrayList(); - for (Iterator iterator = imports.iterator(); iterator.hasNext();) { - Artifact artifact = (Artifact) iterator.next(); - Configuration parent; - if (knownParent != null && artifact.equals(knownParent.getId())) { - parent = knownParent; - } else { - ObjectName parentName = Configuration.getConfigurationObjectName(artifact); - parent = (Configuration) kernel.getProxyManager().createProxy(parentName, Configuration.class); + private List createParentProxies(Environment environment, Configuration existingConfiguration) throws InvalidConfigException { + List parents = new ArrayList(); + try { + List dependencies = new ArrayList(environment.getDependencies()); + for (ListIterator iterator = dependencies.listIterator(); iterator.hasNext();) { + Dependency dependency = (Dependency) iterator.next(); + Artifact resolvedArtifact = artifactResolver.resolve(dependency.getArtifact()); + if (configurationManager != null && isConfiguration(resolvedArtifact, existingConfiguration)) { + // add the parent configuration to the parents collection + Configuration parent = getLoadedConfiguration(resolvedArtifact, existingConfiguration); + parents.add(parent); + + // update the dependency list to contain the resolved artifact + dependency = new Dependency(resolvedArtifact, dependency.getImportType()); + iterator.set(dependency); + } else if (dependency.getImportType() == ImportType.SERVICES) { + // Service depdendencies require that the depdencency be a configuration + if (configurationManager == null) throw new NullPointerException("configurationManager is null"); + throw new InvalidConfigException("Dependency does not have services: " + resolvedArtifact); + } } - parents.add(parent); + environment.setDependencies(dependencies); + } catch (InvalidConfigException e) { + throw e; + } catch (Exception e) { + throw new InvalidConfigException("Unable to load parents", e); } return parents; + } + + private boolean isConfiguration(Artifact artifact, Configuration existingConfiguration) { + if (configurationManager.isConfiguration(artifact)) { + return true; + } + return existingConfiguration != null && artifact.equals(existingConfiguration.getId()); + } + + private Configuration getLoadedConfiguration(Artifact artifact, Configuration existingConfiguration) { + if (existingConfiguration != null && artifact.equals(existingConfiguration.getId())) { + return existingConfiguration; + } else { + return configurationManager.getConfiguration(artifact); + } } public void close() throws IOException, DeploymentException { Modified: geronimo/branches/1.1/modules/deployment/src/test/org/apache/geronimo/deployment/DeploymentContextTest.java URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/deployment/src/test/org/apache/geronimo/deployment/DeploymentContextTest.java?rev=384686&r1=384685&r2=384686&view=diff ============================================================================== --- geronimo/branches/1.1/modules/deployment/src/test/org/apache/geronimo/deployment/DeploymentContextTest.java (original) +++ geronimo/branches/1.1/modules/deployment/src/test/org/apache/geronimo/deployment/DeploymentContextTest.java Thu Mar 9 18:57:07 2006 @@ -49,7 +49,7 @@ Map nameKeys = new HashMap(); nameKeys.put("domain", "d"); environment.setProperties(nameKeys); - DeploymentContext context = new DeploymentContext(basedir, environment, ConfigurationModuleType.CAR, null); + DeploymentContext context = new DeploymentContext(basedir, environment, ConfigurationModuleType.CAR, null, null); Enhancer enhancer = new Enhancer(); enhancer.setInterfaces(new Class[]{DataSource.class}); enhancer.setCallbackType(MethodInterceptor.class); @@ -63,7 +63,7 @@ Class type = enhancer.createClass(); URI location = new URI("cglib/"); context.addClass(location, type.getName(), classBytes); - ClassLoader cl = context.getClassLoader(null); + ClassLoader cl = context.getClassLoader(); Class loadedType = cl.loadClass(type.getName()); assertTrue(DataSource.class.isAssignableFrom(loadedType)); assertTrue(type != loadedType); Modified: geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java?rev=384686&r1=384685&r2=384686&view=diff ============================================================================== --- geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java (original) +++ geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java Thu Mar 9 18:57:07 2006 @@ -305,6 +305,7 @@ earContext = new EARContext(configurationDir, applicationInfo.getEnvironment(), applicationType, + Collections.singleton(repository), kernel, applicationInfo.getApplicationName(), transactionContextManagerObjectName, @@ -334,11 +335,11 @@ Set modules = applicationInfo.getModules(); for (Iterator iterator = modules.iterator(); iterator.hasNext();) { Module module = (Module) iterator.next(); - getBuilder(module).installModule(earFile, earContext, module, configurationStore); + getBuilder(module).installModule(earFile, earContext, module, configurationStore, repository); } // give each module a chance to populate the earContext now that a classloader is available - ClassLoader cl = earContext.getClassLoader(repository); + ClassLoader cl = earContext.getClassLoader(); for (Iterator iterator = modules.iterator(); iterator.hasNext();) { Module module = (Module) iterator.next(); getBuilder(module).initContext(earContext, module, cl); Modified: geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARContext.java URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARContext.java?rev=384686&r1=384685&r2=384686&view=diff ============================================================================== --- geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARContext.java (original) +++ geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARContext.java Thu Mar 9 18:57:07 2006 @@ -16,20 +16,20 @@ */ package org.apache.geronimo.j2ee.deployment; +import java.io.File; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; +import javax.management.MalformedObjectNameException; + import org.apache.geronimo.common.DeploymentException; import org.apache.geronimo.deployment.DeploymentContext; -import org.apache.geronimo.kernel.repository.Environment; +import org.apache.geronimo.gbean.AbstractName; import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory; import org.apache.geronimo.kernel.Kernel; import org.apache.geronimo.kernel.config.ConfigurationModuleType; +import org.apache.geronimo.kernel.repository.Environment; import org.apache.geronimo.security.deployment.SecurityConfiguration; -import org.apache.geronimo.gbean.AbstractName; - -import javax.management.MalformedObjectNameException; -import javax.management.ObjectName; -import java.io.File; -import java.util.HashMap; -import java.util.Map; /** * @version $Rev$ $Date$ @@ -54,8 +54,8 @@ private AbstractName jaccManagerName; private SecurityConfiguration securityConfiguration; - public EARContext(File baseDir, Environment environment, ConfigurationModuleType moduleType, Kernel kernel, String j2eeApplicationName, AbstractName transactionContextManagerObjectName, AbstractName connectionTrackerObjectName, AbstractName transactedTimerName, AbstractName nonTransactedTimerName, AbstractName corbaGBeanObjectName, RefContext refContext) throws MalformedObjectNameException, DeploymentException { - super(baseDir, environment, moduleType, kernel); + public EARContext(File baseDir, Environment environment, ConfigurationModuleType moduleType, Collection repositories, Kernel kernel, String j2eeApplicationName, AbstractName transactionContextManagerObjectName, AbstractName connectionTrackerObjectName, AbstractName transactedTimerName, AbstractName nonTransactedTimerName, AbstractName corbaGBeanObjectName, RefContext refContext) throws MalformedObjectNameException, DeploymentException { + super(baseDir, environment, moduleType, repositories, kernel); if (moduleType.equals(ConfigurationModuleType.EAR)) { moduleName = NameFactory.buildApplicationName(environment.getProperties(), environment.getConfigId()); applicationName = moduleName; Modified: geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/ModuleBuilder.java URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/ModuleBuilder.java?rev=384686&r1=384685&r2=384686&view=diff ============================================================================== --- geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/ModuleBuilder.java (original) +++ geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/ModuleBuilder.java Thu Mar 9 18:57:07 2006 @@ -33,7 +33,7 @@ Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, Environment environment, Object moduleContextInfo) throws DeploymentException; - void installModule(JarFile earFile, EARContext earContext, Module module, ConfigurationStore configurationStore) throws DeploymentException; + void installModule(JarFile earFile, EARContext earContext, Module module, ConfigurationStore configurationStore, Repository repository) throws DeploymentException; void initContext(EARContext earContext, Module module, ClassLoader cl) throws DeploymentException; Modified: geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/SwitchingModuleBuilder.java URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/SwitchingModuleBuilder.java?rev=384686&r1=384685&r2=384686&view=diff ============================================================================== --- geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/SwitchingModuleBuilder.java (original) +++ geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/SwitchingModuleBuilder.java Thu Mar 9 18:57:07 2006 @@ -144,10 +144,10 @@ } } - public void installModule(JarFile earFile, EARContext earContext, Module module, ConfigurationStore configurationStore) throws DeploymentException { + public void installModule(JarFile earFile, EARContext earContext, Module module, ConfigurationStore configurationStore, Repository repository) throws DeploymentException { String namespace = module.getNamespace(); ModuleBuilder builder = getBuilderFromNamespace(namespace); - builder.installModule(earFile, earContext, module, configurationStore); + builder.installModule(earFile, earContext, module, configurationStore, repository); } public void initContext(EARContext earContext, Module module, ClassLoader cl) throws DeploymentException { Modified: geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/EARConfigBuilderTest.java URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/EARConfigBuilderTest.java?rev=384686&r1=384685&r2=384686&view=diff ============================================================================== --- geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/EARConfigBuilderTest.java (original) +++ geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/EARConfigBuilderTest.java Thu Mar 9 18:57:07 2006 @@ -39,6 +39,7 @@ import org.apache.geronimo.kernel.jmx.JMXUtil; import org.apache.geronimo.kernel.repository.Artifact; import org.apache.geronimo.kernel.repository.Environment; +import org.apache.geronimo.kernel.repository.ImportType; import javax.management.ObjectName; import javax.xml.namespace.QName; @@ -63,7 +64,7 @@ private static String WEB_NAMESPACE="foo"; private static JarFile earFile; - private static MockConfigStore configStore = new MockConfigStore(null); + private static MockConfigStore configStore = new MockConfigStore(); private static MockEJBConfigBuilder ejbConfigBuilder = new MockEJBConfigBuilder(); private static MockWARConfigBuilder webConfigBuilder = new MockWARConfigBuilder(); private static MockConnectorConfigBuilder connectorConfigBuilder = new MockConnectorConfigBuilder(); @@ -87,8 +88,9 @@ private static final Map portMap = null; protected void setUp() throws Exception { + super.setUp(); defaultParentId = new Environment(); - defaultParentId.getImports().add(new Artifact("geronimo", "test", "1", "car")); + defaultParentId.addDependency(new Artifact("geronimo", "test", "1", "car"), ImportType.ALL); defaultParentId.getProperties().put(NameFactory.JSR77_BASE_NAME_PROPERTY, "geronimo.test:J2EEServer=geronimo"); } @@ -396,13 +398,8 @@ } } public static class MockConfigStore implements ConfigurationStore { - private final Kernel kernel; private final Map locations = new HashMap(); - public MockConfigStore(Kernel kernel) { - this.kernel = kernel; - } - public void install(ConfigurationData configurationData) throws IOException, InvalidConfigException { } @@ -458,8 +455,6 @@ static { GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(MockConfigStore.class, NameFactory.CONFIGURATION_STORE); infoBuilder.addInterface(ConfigurationStore.class); - infoBuilder.addAttribute("kernel", Kernel.class, false); - infoBuilder.setConstructor(new String[] {"kernel"}); GBEAN_INFO = infoBuilder.getBeanInfo(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); Modified: geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockConnectorConfigBuilder.java URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockConnectorConfigBuilder.java?rev=384686&r1=384685&r2=384686&view=diff ============================================================================== --- geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockConnectorConfigBuilder.java (original) +++ geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockConnectorConfigBuilder.java Thu Mar 9 18:57:07 2006 @@ -45,7 +45,7 @@ return new ConnectorModule(false, null, moduleFile, targetPath, null, null, null); } - public void installModule(JarFile earFile, EARContext earContext, Module connectorModule, ConfigurationStore configurationStore) { + public void installModule(JarFile earFile, EARContext earContext, Module connectorModule, ConfigurationStore configurationStore, Repository repository) { assertNotNull(earFile); assertNotNull(earContext); this.earContext = earContext; Modified: geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockEJBConfigBuilder.java URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockEJBConfigBuilder.java?rev=384686&r1=384685&r2=384686&view=diff ============================================================================== --- geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockEJBConfigBuilder.java (original) +++ geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockEJBConfigBuilder.java Thu Mar 9 18:57:07 2006 @@ -47,7 +47,7 @@ return new EJBModule(false, null, moduleFile, targetPath, null, null, null); } - public void installModule(JarFile earFile, EARContext earContext, Module ejbModule, ConfigurationStore configurationStore) { + public void installModule(JarFile earFile, EARContext earContext, Module ejbModule, ConfigurationStore configurationStore, Repository repository) { assertNotNull(earFile); assertNotNull(earContext); this.earContext = earContext; Modified: geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockWARConfigBuilder.java URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockWARConfigBuilder.java?rev=384686&r1=384685&r2=384686&view=diff ============================================================================== --- geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockWARConfigBuilder.java (original) +++ geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockWARConfigBuilder.java Thu Mar 9 18:57:07 2006 @@ -46,7 +46,7 @@ return new WebModule(false, null, moduleFile, targetPath, null, null, null, contextRoot, portMap, namespace); } - public void installModule(JarFile earFile, EARContext earContext, Module webModule, ConfigurationStore configurationStore) throws DeploymentException { + public void installModule(JarFile earFile, EARContext earContext, Module webModule, ConfigurationStore configurationStore, Repository repository) throws DeploymentException { assertNotNull(earFile); assertNotNull(earContext); this.earContext = earContext; Modified: geronimo/branches/1.1/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java?rev=384686&r1=384685&r2=384686&view=diff ============================================================================== --- geronimo/branches/1.1/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java (original) +++ geronimo/branches/1.1/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java Thu Mar 9 18:57:07 2006 @@ -315,9 +315,9 @@ EARContext moduleContext = module.getEarContext(); Configuration knownParent = null; if (!module.isStandAlone()) { - knownParent = earContext.getConfiguration(repository, null); + knownParent = earContext.getConfiguration(null); } - ClassLoader moduleClassLoader = moduleContext.getClassLoader(repository, knownParent); + ClassLoader moduleClassLoader = moduleContext.getClassLoader(knownParent); J2eeContext earJ2eeContext = moduleContext.getModuleName(); J2eeContext moduleJ2eeContext = J2eeContextImpl.newModuleContextFromApplication(earJ2eeContext, NameFactory.WEB_MODULE, module.getName()); WebModule webModule = (WebModule) module; Modified: geronimo/branches/1.1/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/JettyModuleBuilderTest.java URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/JettyModuleBuilderTest.java?rev=384686&r1=384685&r2=384686&view=diff ============================================================================== --- geronimo/branches/1.1/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/JettyModuleBuilderTest.java (original) +++ geronimo/branches/1.1/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/JettyModuleBuilderTest.java Thu Mar 9 18:57:07 2006 @@ -75,6 +75,7 @@ import org.apache.geronimo.kernel.repository.DefaultArtifactManager; import org.apache.geronimo.kernel.repository.DefaultArtifactResolver; import org.apache.geronimo.kernel.repository.Environment; +import org.apache.geronimo.kernel.repository.ImportType; import org.apache.geronimo.security.SecurityServiceImpl; import org.apache.geronimo.system.serverinfo.BasicServerInfo; import org.apache.geronimo.transaction.context.TransactionContextManagerGBean; @@ -109,7 +110,7 @@ private File basedir = new File(System.getProperty("basedir", ".")); private String PARENT_ARTIFACT_ID = "geronimo/Foo/1/car"; private String ARTIFACT_ID = "foo/bar/1/car"; - private List parentId = Arrays.asList(new Artifact[] {Artifact.create(PARENT_ARTIFACT_ID)}); + private Artifact parentId = Artifact.create(PARENT_ARTIFACT_ID); private Environment defaultEnvironment = new Environment(); private ConfigurationManager configurationManager; @@ -159,6 +160,7 @@ EARContext earContext = new EARContext(outputPath, environment, ConfigurationModuleType.WAR, + null, kernel, moduleContext.getJ2eeApplicationName(), tcmName, @@ -279,8 +281,8 @@ kernel.startGBean(configurationManagerName); configurationManager = (ConfigurationManager) kernel.getProxyManager().createProxy(configurationManagerName, ConfigurationManager.class); - configurationManager.loadConfiguration((Artifact) parentId.get(0)); - configurationManager.startConfiguration((Artifact) parentId.get(0)); + configurationManager.loadConfiguration(parentId); + configurationManager.startConfiguration(parentId); Collection defaultServlets = new HashSet(); Collection defaultFilters = new HashSet(); @@ -301,7 +303,7 @@ securityServiceGBean.setAttribute("policyProvider", "org.apache.geronimo.security.jacc.GeronimoPolicy"); start(securityServiceGBean); - defaultEnvironment.addImports(parentId); + defaultEnvironment.addDependency(parentId, ImportType.ALL); Artifact artifact = Artifact.create("foo/bar/1/car"); defaultEnvironment.setConfigId(artifact); builder = new JettyModuleBuilder(defaultEnvironment, new Integer(1800), false, Collections.EMPTY_LIST, containerName, defaultServlets, defaultFilters, defaultFilterMappings, pojoWebServiceTemplate, webServiceBuilder, kernel); Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/GBeanData.java URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/GBeanData.java?rev=384686&r1=384685&r2=384686&view=diff ============================================================================== --- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/GBeanData.java (original) +++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/GBeanData.java Thu Mar 9 18:57:07 2006 @@ -138,15 +138,18 @@ public void addDependencies(Set dependencies) { for (Iterator iterator = dependencies.iterator(); iterator.hasNext();) { - Object o = iterator.next(); - if (o instanceof ReferencePatterns) { - this.dependencies.add(o); - } else if (o instanceof AbstractName) { - this.dependencies.add(new ReferencePatterns((AbstractName) o)); - } else if (o instanceof AbstractNameQuery) { - this.dependencies.add(new ReferencePatterns((AbstractNameQuery) o)); + Object dependency = iterator.next(); + if (dependency instanceof AbstractName) { + AbstractName name = (AbstractName) dependency; + addDependency(name); + } else if (dependency instanceof AbstractNameQuery) { + AbstractNameQuery nameQuery = (AbstractNameQuery) dependency; + addDependency(nameQuery); + } else if (dependency instanceof ReferencePatterns) { + ReferencePatterns referencePatterns = (ReferencePatterns) dependency; + addDependency(referencePatterns); } else { - throw new IllegalArgumentException("Dependency specification is not a ReferencePatterns, AbstractName, nor AbstractNameQuery: " + o); + throw new IllegalArgumentException("Unknown dependency type: " + dependency); } } } Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/ReferencePatterns.java URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/ReferencePatterns.java?rev=384686&r1=384685&r2=384686&view=diff ============================================================================== --- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/ReferencePatterns.java (original) +++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/ReferencePatterns.java Thu Mar 9 18:57:07 2006 @@ -18,27 +18,39 @@ package org.apache.geronimo.gbean; import java.util.Set; -import java.util.Collections; import java.util.Iterator; +import java.util.LinkedHashSet; +import java.util.Collections; import java.io.Serializable; +import javax.management.ObjectName; /** * @version $Rev:$ $Date:$ */ public class ReferencePatterns implements Serializable { + private static final long serialVersionUID = 1888371271299507818L; private final Set patterns; private final AbstractName abstractName; public ReferencePatterns(Set patterns) { - this.patterns = patterns; - this.abstractName = null; + this.patterns = new LinkedHashSet(); for (Iterator iterator = patterns.iterator(); iterator.hasNext();) { - Object o = iterator.next(); - if (!(o instanceof AbstractNameQuery)) { - throw new IllegalArgumentException("Item is not an AbstractNameQuery: " + o); + Object pattern = iterator.next(); + if (pattern instanceof AbstractName) { + AbstractName name = (AbstractName) pattern; + this.patterns.add(new AbstractNameQuery(name)); + } else if (pattern instanceof AbstractNameQuery) { + AbstractNameQuery nameQuery = (AbstractNameQuery) pattern; + this.patterns.add(nameQuery); + } else if (pattern instanceof ObjectName) { + ObjectName objectName = (ObjectName) pattern; + this.patterns.add(objectName); + } else { + throw new IllegalArgumentException("Unknown pattern type: " + pattern); } } + this.abstractName = null; } public ReferencePatterns(AbstractNameQuery abstractNameQuery) {