You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by dj...@apache.org on 2011/04/27 01:15:33 UTC
svn commit: r1096945 [1/4] - in /geronimo/server/trunk:
framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/
framework/configs/client-system/src/main/plan/
framework/configs/j2ee-system/ framework/configs/j2ee-sys...
Author: djencks
Date: Tue Apr 26 23:15:32 2011
New Revision: 1096945
URL: http://svn.apache.org/viewvc?rev=1096945&view=rev
Log:
GERONIMO-4761 apply Ivan's patch
Added:
geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/ConfigurationExtender.java (with props)
Modified:
geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/AbstractCarMojo.java
geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/ArchiveCarMojo.java
geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/Dependency.java
geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PackageMojo.java
geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PluginBootstrap2.java
geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PluginMetadataGeneratorMojo.java
geronimo/server/trunk/framework/configs/client-system/src/main/plan/plan.xml
geronimo/server/trunk/framework/configs/j2ee-system/pom.xml
geronimo/server/trunk/framework/configs/j2ee-system/src/main/plan/plan.xml
geronimo/server/trunk/framework/configs/online-deployer/src/main/plan/plan.xml
geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeploymentConfigurationManager.java
geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeploymentContext.java
geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/SingleFileHotDeployer.java
geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/Configuration.java
geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationData.java
geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationManager.java
geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationSource.java
geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationUtil.java
geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/DependencyNodeUtil.java
geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/KernelConfigurationManager.java
geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java
geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/osgi/ConfigurationActivator.java
geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/osgi/KernelActivator.java
geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/ImportType.java
geronimo/server/trunk/framework/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/ConfigTest.java
geronimo/server/trunk/framework/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/SimpleGBeanTest.java
geronimo/server/trunk/framework/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/config/ConfigurationManagerTest.java
geronimo/server/trunk/framework/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/mock/MockConfigurationManager.java
geronimo/server/trunk/framework/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/osgi/MockBundleContext.java
geronimo/server/trunk/framework/modules/geronimo-naming/src/test/java/org/apache/geronimo/gjndi/JavaCompGBeanTest.java
geronimo/server/trunk/framework/modules/geronimo-naming/src/test/java/org/apache/geronimo/gjndi/KernelContextGBeanTest.java
geronimo/server/trunk/framework/modules/geronimo-naming/src/test/java/org/apache/geronimo/gjndi/binding/GBeanBindingTest.java
geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/DependencyManager.java
geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java
geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/osgi/BootActivator.java
geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/plugin/model/DependencyType.java
geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/test/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java
geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/configmanager/ConfigManagerPortlet.java
geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/BundleDeploymentContext.java
geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/test/java/org/apache/geronimo/web25/deployment/WebFragmentTest.java
geronimo/server/trunk/plugins/wab/geronimo-web-extender/src/main/java/org/apache/geronimo/osgi/web/extender/WebApplication.java
Modified: geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/AbstractCarMojo.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/AbstractCarMojo.java?rev=1096945&r1=1096944&r2=1096945&view=diff
==============================================================================
--- geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/AbstractCarMojo.java (original)
+++ geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/AbstractCarMojo.java Tue Apr 26 23:15:32 2011
@@ -390,7 +390,6 @@ public abstract class AbstractCarMojo
explicitDependencyMap.put(getKey(dependency), dependency);
}
-
getDependencies(project, useMavenDependencies.isUseTransitiveDependencies());
for (Artifact entry : localDependencies) {
dependencies.add(toDependencyType(entry, explicitDependencyMap, useMavenDependencies.isIncludeVersion(), includeImport));
@@ -429,6 +428,7 @@ public abstract class AbstractCarMojo
}
if (explicitDependency != null) {
dependency.setStart(explicitDependency.isStart());
+ dependency.setEagerStart(explicitDependency.isEagerStart());
}
return dependency;
}
@@ -881,7 +881,6 @@ public abstract class AbstractCarMojo
"org.apache.geronimo.system.properties," +
"org.apache.geronimo.system.repository," +
"org.apache.geronimo.system.resolver," +
- "org.apache.geronimo.system.serverinfo," +
"org.apache.geronimo.system.threads," +
"org.apache.geronimo.system.util," +
"org.apache.geronimo.transformer," +
@@ -890,7 +889,9 @@ public abstract class AbstractCarMojo
"org.apache.karaf.jaas.boot;version=\"2.2.1.SNAPSHOT\"," +
"org.apache.yoko," +
"org.apache.yoko.osgi," +
- "org.apache.yoko.rmispec.util"
+ "org.apache.yoko.rmispec.util," +
+ "org.apache.xbean.osgi.bundle.util;version=\"3.8.0.SNAPSHOT\"," +
+ "org.apache.xbean.osgi.bundle.util.jar;version=\"3.8.0.SNAPSHOT\""
);
/*
Modified: geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/ArchiveCarMojo.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/ArchiveCarMojo.java?rev=1096945&r1=1096944&r2=1096945&view=diff
==============================================================================
--- geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/ArchiveCarMojo.java (original)
+++ geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/ArchiveCarMojo.java Tue Apr 26 23:15:32 2011
@@ -29,7 +29,6 @@ import java.util.Map;
import java.util.jar.JarFile;
import java.util.zip.ZipEntry;
-import org.apache.geronimo.kernel.osgi.ConfigurationActivator;
import org.apache.geronimo.system.osgi.BootActivator;
import org.apache.maven.archiver.MavenArchiveConfiguration;
import org.apache.maven.archiver.MavenArchiver;
@@ -75,7 +74,7 @@ public class ArchiveCarMojo
* @readonly
*/
private JarArchiver jarArchiver = null;
-
+
/**
* The Jar archiver.
*
@@ -175,7 +174,7 @@ public class ArchiveCarMojo
* @parameter
*/
private Map instructions;
-
+
/**
* An {@link Dependency} to include as a module of the CAR. we need this here to determine
* if the included module is a EBA application.
@@ -183,8 +182,8 @@ public class ArchiveCarMojo
* @parameter
*/
private Dependency module = null;
-
-
+
+
//
// Mojo
@@ -203,20 +202,20 @@ public class ArchiveCarMojo
//
// HACK: Generate the filename in the repo... really should delegate this to the repo impl
//
-
+
String groupId=project.getGroupId().replace('.', '/');
String artifactId=project.getArtifactId();
String version=project.getVersion();
String type="car";
-
+
if (module != null && module.getType() != null && module.getType().equals("eba")) {
groupId = org.apache.geronimo.kernel.util.BundleUtil.EBA_GROUP_ID;
artifactId = module.getArtifactId();
version = module.getVersion();
type = "eba";
}
-
-
+
+
File dir = new File(targetRepository,groupId );
dir = new File(dir, artifactId);
dir = new File(dir, version);
@@ -224,7 +223,7 @@ public class ArchiveCarMojo
return dir;
}
-
+
/**
@@ -275,9 +274,9 @@ public class ArchiveCarMojo
//For no plan car, do nothing
if (artifactDirectory.exists()) {
-
+
JarFile includedJarFile = new JarFile(artifactDirectory) ;
-
+
if (includedJarFile.getEntry("META-INF/MANIFEST.MF") != null) {
FilesetManifestConfig mergeFilesetManifestConfig = new FilesetManifestConfig();
mergeFilesetManifestConfig.setValue("merge");
@@ -286,12 +285,12 @@ public class ArchiveCarMojo
//File configFile = new File(new File(getArtifactInRepositoryDir(), "META-INF"), "imports.txt");
ZipEntry importTxtEntry = includedJarFile.getEntry("META-INF/imports.txt");
if (importTxtEntry != null) {
- StringBuilder imports = new StringBuilder("org.apache.geronimo.kernel.osgi,");
+ StringBuilder imports = new StringBuilder();
if (boot) {
archive.addManifestEntry(Constants.BUNDLE_ACTIVATOR, BootActivator.class.getName());
imports.append("org.apache.geronimo.system.osgi,");
} else {
- archive.addManifestEntry(Constants.BUNDLE_ACTIVATOR, ConfigurationActivator.class.getName());
+ //archive.addManifestEntry(Constants.BUNDLE_ACTIVATOR, ConfigurationActivator.class.getName());
}
archive.addManifestEntry(Constants.BUNDLE_NAME, project.getName());
archive.addManifestEntry(Constants.BUNDLE_VENDOR, project.getOrganization().getName());
@@ -348,16 +347,16 @@ public class ArchiveCarMojo
archiver.cleanup();
}
}
-
+
private static class GeronimoArchiver extends MavenArchiver {
-
+
private ArchiverManager archiverManager;
private List<File> tmpDirs = new ArrayList<File>();
-
+
public GeronimoArchiver(ArchiverManager archiverManager) {
this.archiverManager = archiverManager;
}
-
+
public void addArchivedFileSet(File archiveFile) throws ArchiverException {
UnArchiver unArchiver;
try {
@@ -372,8 +371,8 @@ public class ArchiveCarMojo
tempDir.mkdirs();
- tmpDirs.add(tempDir);
-
+ tmpDirs.add(tempDir);
+
unArchiver.setSourceFile(archiveFile);
unArchiver.setDestDirectory(tempDir);
@@ -386,7 +385,7 @@ public class ArchiveCarMojo
getArchiver().addDirectory(tempDir, null, null, null);
}
-
+
public void cleanup() {
for (File dir : tmpDirs) {
try {
@@ -395,9 +394,9 @@ public class ArchiveCarMojo
e.printStackTrace();
}
}
- tmpDirs.clear();
+ tmpDirs.clear();
}
-
+
}
-
+
}
\ No newline at end of file
Modified: geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/Dependency.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/Dependency.java?rev=1096945&r1=1096944&r2=1096945&view=diff
==============================================================================
--- geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/Dependency.java (original)
+++ geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/Dependency.java Tue Apr 26 23:15:32 2011
@@ -34,6 +34,11 @@ public class Dependency extends ModuleId
*/
private Boolean start;
+ /**
+ * @parameter
+ */
+ private Boolean eagerStart;
+
public Boolean isStart() {
if (start == null) {
return Boolean.TRUE;
@@ -45,6 +50,17 @@ public class Dependency extends ModuleId
this.start = start;
}
+ public Boolean isEagerStart() {
+ if (eagerStart == null) {
+ return Boolean.FALSE;
+ }
+ return eagerStart;
+ }
+
+ public void setEagerStart(Boolean eagerStart) {
+ this.eagerStart = eagerStart;
+ }
+
public DependencyType toDependencyType() {
DependencyType dependency = new DependencyType();
dependency.setGroupId(groupId);
@@ -52,6 +68,7 @@ public class Dependency extends ModuleId
dependency.setVersion(version);
dependency.setType(type);
dependency.setStart(start);
+ dependency.setEagerStart(eagerStart);
dependency.setImport(getImport() == null? org.apache.geronimo.system.plugin.model.ImportType.ALL:
org.apache.geronimo.system.plugin.model.ImportType.fromValue(getImport()));
Modified: geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PackageMojo.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PackageMojo.java?rev=1096945&r1=1096944&r2=1096945&view=diff
==============================================================================
--- geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PackageMojo.java (original)
+++ geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PackageMojo.java Tue Apr 26 23:15:32 2011
@@ -22,16 +22,12 @@ package org.apache.geronimo.mavenplugins
import java.io.File;
import java.net.URI;
import java.util.Arrays;
-import java.util.HashMap;
+import java.util.Dictionary;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
-import java.util.Map;
import java.util.Set;
-import java.util.Collections;
-import java.util.Dictionary;
-import org.apache.geronimo.mavenplugins.car.PluginBootstrap2;
import org.apache.geronimo.gbean.AbstractName;
import org.apache.geronimo.gbean.AbstractNameQuery;
import org.apache.geronimo.gbean.GBeanData;
@@ -39,7 +35,6 @@ import org.apache.geronimo.gbean.GBeanIn
import org.apache.geronimo.gbean.ReferencePatterns;
import org.apache.geronimo.kernel.Kernel;
import org.apache.geronimo.kernel.KernelFactory;
-import org.apache.geronimo.kernel.KernelRegistry;
import org.apache.geronimo.kernel.Naming;
import org.apache.geronimo.kernel.config.ConfigurationData;
import org.apache.geronimo.kernel.config.ConfigurationManager;
@@ -47,10 +42,10 @@ import org.apache.geronimo.kernel.config
import org.apache.geronimo.kernel.config.KernelConfigurationManager;
import org.apache.geronimo.kernel.config.LifecycleException;
import org.apache.geronimo.kernel.config.RecordingLifecycleMonitor;
-import org.apache.geronimo.system.configuration.DependencyManager;
import org.apache.geronimo.kernel.management.State;
import org.apache.geronimo.kernel.repository.DefaultArtifactManager;
-import org.apache.geronimo.kernel.repository.Repository;
+import org.apache.geronimo.system.configuration.ConfigurationExtender;
+import org.apache.geronimo.system.configuration.DependencyManager;
import org.apache.geronimo.system.configuration.RepositoryConfigurationStore;
import org.apache.geronimo.system.repository.Maven2Repository;
import org.apache.geronimo.system.resolver.ExplicitDefaultArtifactResolver;
@@ -311,6 +306,12 @@ public class PackageMojo extends Abstrac
// start the Configuration we're going to use for this deployment
ConfigurationManager configurationManager = ConfigurationUtil.getConfigurationManager(kernel);
+
+ DependencyManager dependencyManager = kernel.getGBean(DependencyManager.class);
+ //Register ConfigurationExtender Listener
+ ConfigurationExtender configurationExtender = new ConfigurationExtender(configurationManager, dependencyManager, bundleContext);
+ configurationExtender.doStart();
+
try {
for (String artifactName : deploymentConfigs) {
org.apache.geronimo.kernel.repository.Artifact configName = org.apache.geronimo.kernel.repository.Artifact.create(artifactName);
@@ -339,6 +340,7 @@ public class PackageMojo extends Abstrac
AbstractName deployer = locateDeployer(kernel);
invokeDeployer(kernel, deployer, targetConfigStoreAName.toString());
//use a fresh kernel for each module
+ configurationExtender.doStop();
kernel.shutdown();
kernel = null;
bundleContext.getBundle().stop();
Modified: geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PluginBootstrap2.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PluginBootstrap2.java?rev=1096945&r1=1096944&r2=1096945&view=diff
==============================================================================
--- geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PluginBootstrap2.java (original)
+++ geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PluginBootstrap2.java Tue Apr 26 23:15:32 2011
@@ -21,6 +21,7 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Collections;
+import java.util.Hashtable;
import java.util.jar.JarOutputStream;
import org.apache.geronimo.deployment.DeploymentContext;
@@ -85,7 +86,8 @@ public class PluginBootstrap2 {
// ModuleType config = ModuleDocument.Factory.parse(plan).getModule();
Maven2Repository repository = new Maven2Repository(localRepo);
- new DependencyManager(bundleContext, Collections.<Repository>singleton(repository), null);
+ DependencyManager dependencyManager = new DependencyManager(bundleContext, Collections.<Repository>singleton(repository), null);
+ bundleContext.registerService(DependencyManager.class.getName(), dependencyManager, new Hashtable());
GBeanBuilder gBeanBuilder = new GBeanBuilder(null, null);
ServiceConfigBuilder builder = new ServiceConfigBuilder(null, Collections.<Repository>singleton(repository), Collections.<NamespaceDrivenBuilder>singleton(gBeanBuilder), new Jsr77Naming(), bundleContext);
Modified: geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PluginMetadataGeneratorMojo.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PluginMetadataGeneratorMojo.java?rev=1096945&r1=1096944&r2=1096945&view=diff
==============================================================================
--- geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PluginMetadataGeneratorMojo.java (original)
+++ geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PluginMetadataGeneratorMojo.java Tue Apr 26 23:15:32 2011
@@ -24,15 +24,12 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.StringReader;
-import java.net.URI;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.LinkedHashSet;
import java.util.Set;
-import javax.xml.bind.JAXBException;
-
import org.apache.geronimo.kernel.config.InvalidConfigException;
import org.apache.geronimo.kernel.config.NoSuchConfigException;
import org.apache.geronimo.kernel.repository.Artifact;
@@ -120,7 +117,7 @@ public class PluginMetadataGeneratorMojo
* @parameter
*/
private String category;
-
+
/**
* Whether the geronimo plugin is a geronimo plugin group.
*
@@ -134,10 +131,10 @@ public class PluginMetadataGeneratorMojo
* @parameter
*/
private List<Dependency> dependencies = Collections.emptyList();
-
-
+
+
/**
- * An {@link Dependency} to include as a module of the CAR. we need to exclude this
+ * An {@link Dependency} to include as a module of the CAR. we need to exclude this
* from the dependencies since we've included its content in the car directly.
*
* @parameter
@@ -260,12 +257,12 @@ public class PluginMetadataGeneratorMojo
}
instance.setModuleId(artifactType);
addDependencies(instance);
-
+
// this module is embeded into the car, we don't want to install it as a dependency again.
if (module != null) {
removeIncludedModule(instance.getDependency(), module);
}
-
+
targetDir.mkdirs();
File targetFile = new File(targetDir.toURI().resolve(pluginMetadataFileName));
targetFile.getParentFile().mkdirs();
@@ -287,7 +284,7 @@ public class PluginMetadataGeneratorMojo
}
try {
-//generate obr repository.xml
+ //generate obr repository.xml
File obr = new File(targetDir.toURI().resolve(obrFileName));
obr.getParentFile().mkdirs();
Set<Artifact> artifacts = new HashSet<Artifact>();
@@ -302,21 +299,21 @@ public class PluginMetadataGeneratorMojo
}
private void addDependencies(PluginArtifactType instance) throws InvalidConfigException, IOException, NoSuchConfigException, InvalidDependencyVersionException, ArtifactResolutionException, ProjectBuildingException, MojoExecutionException {
- LinkedHashSet<DependencyType> resolvedDependencies = toDependencies(dependencies, useMavenDependencies, false);
- instance.getDependency().addAll(resolvedDependencies);
+ LinkedHashSet<DependencyType> resolvedDependencies = toDependencies(dependencies, useMavenDependencies, true);
+ instance.getDependency().addAll(resolvedDependencies);
}
-
+
private void removeIncludedModule(List<DependencyType> sourceList, Dependency removeTarget) {
-
+
for (DependencyType dependencyType : sourceList) {
-
+
if (dependencyType.toArtifact().equals(removeTarget.toArtifactType().toArtifact())){
-
+
sourceList.remove(dependencyType);
}
-
+
break;
-
+
}
}
Modified: geronimo/server/trunk/framework/configs/client-system/src/main/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/configs/client-system/src/main/plan/plan.xml?rev=1096945&r1=1096944&r2=1096945&view=diff
==============================================================================
--- geronimo/server/trunk/framework/configs/client-system/src/main/plan/plan.xml (original)
+++ geronimo/server/trunk/framework/configs/client-system/src/main/plan/plan.xml Tue Apr 26 23:15:32 2011
@@ -83,6 +83,15 @@
</reference>
</gbean>
+ <gbean name="ConfigurationExtender" class="org.apache.geronimo.system.configuration.ConfigurationExtender">
+ <reference name="ConfigurationManager">
+ <name>ConfigurationManager</name>
+ </reference>
+ <reference name="DependencyManager">
+ <name>DependencyManager</name>
+ </reference>
+ </gbean>
+
<gbean name="DependencyManager" class="org.apache.geronimo.system.configuration.DependencyManager">
<reference name="Repositories"></reference>
<reference name="ArtifactResolver">
Modified: geronimo/server/trunk/framework/configs/j2ee-system/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/configs/j2ee-system/pom.xml?rev=1096945&r1=1096944&r2=1096945&view=diff
==============================================================================
--- geronimo/server/trunk/framework/configs/j2ee-system/pom.xml (original)
+++ geronimo/server/trunk/framework/configs/j2ee-system/pom.xml Tue Apr 26 23:15:32 2011
@@ -178,6 +178,48 @@
</deploymentConfigs>
<deployerName>org.apache.geronimo.framework/geronimo-gbean-deployer-bootstrap/${geronimoVersion}/car?j2eeType=Deployer,name=Deployer</deployerName>
<boot>true</boot>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jaxb_2.2_spec</artifactId>
+ <type>jar</type>
+ <eagerStart>true</eagerStart>
+ <start>false</start>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-activation_1.1_spec</artifactId>
+ <type>jar</type>
+ <eagerStart>true</eagerStart>
+ <start>false</start>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.bundles</groupId>
+ <artifactId>jaxb-impl</artifactId>
+ <type>jar</type>
+ <eagerStart>true</eagerStart>
+ <start>false</start>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-stax-api_1.2_spec</artifactId>
+ <type>jar</type>
+ <eagerStart>true</eagerStart>
+ <start>false</start>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.bundles</groupId>
+ <artifactId>woodstox</artifactId>
+ <type>jar</type>
+ <eagerStart>true</eagerStart>
+ <start>false</start>
+ </dependency>
+ </dependencies>
<!--<archive>-->
<!--<manifestEntries>-->
<!--<Endorsed-Dirs>lib/endorsed</Endorsed-Dirs>-->
Modified: geronimo/server/trunk/framework/configs/j2ee-system/src/main/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/configs/j2ee-system/src/main/plan/plan.xml?rev=1096945&r1=1096944&r2=1096945&view=diff
==============================================================================
--- geronimo/server/trunk/framework/configs/j2ee-system/src/main/plan/plan.xml (original)
+++ geronimo/server/trunk/framework/configs/j2ee-system/src/main/plan/plan.xml Tue Apr 26 23:15:32 2011
@@ -84,7 +84,7 @@ specific services - those should be prov
<reference name="ConfigurationManagers">
<name>ConfigurationManager</name>
</reference>
- </gbean>
+ </gbean>
<!--Configuration Manager service-->
<gbean name="ConfigurationManager" class="org.apache.geronimo.kernel.config.EditableKernelConfigurationManager">
@@ -107,6 +107,15 @@ specific services - those should be prov
<name>ArtifactResolver</name>
</reference>
</gbean>
+
+ <gbean name="ConfigurationExtender" class="org.apache.geronimo.system.configuration.ConfigurationExtender">
+ <reference name="ConfigurationManager">
+ <name>ConfigurationManager</name>
+ </reference>
+ <reference name="DependencyManager">
+ <name>DependencyManager</name>
+ </reference>
+ </gbean>
<gbean name="DependencyManager" class="org.apache.geronimo.system.configuration.DependencyManager">
<reference name="Repositories"></reference>
Modified: geronimo/server/trunk/framework/configs/online-deployer/src/main/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/configs/online-deployer/src/main/plan/plan.xml?rev=1096945&r1=1096944&r2=1096945&view=diff
==============================================================================
--- geronimo/server/trunk/framework/configs/online-deployer/src/main/plan/plan.xml (original)
+++ geronimo/server/trunk/framework/configs/online-deployer/src/main/plan/plan.xml Tue Apr 26 23:15:32 2011
@@ -103,6 +103,15 @@
</attribute>
</gbean>
+ <gbean name="ConfigurationExtender" class="org.apache.geronimo.system.configuration.ConfigurationExtender">
+ <reference name="ConfigurationManager">
+ <name>ConfigurationManager</name>
+ </reference>
+ <reference name="DependencyManager">
+ <name>DependencyManager</name>
+ </reference>
+ </gbean>
+
<gbean name="DependencyManager" class="org.apache.geronimo.system.configuration.DependencyManager">
<reference name="Repositories"></reference>
</gbean>
Modified: geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeploymentConfigurationManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeploymentConfigurationManager.java?rev=1096945&r1=1096944&r2=1096945&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeploymentConfigurationManager.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeploymentConfigurationManager.java Tue Apr 26 23:15:32 2011
@@ -20,10 +20,7 @@ import java.io.IOException;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
-import java.util.LinkedHashSet;
import java.util.List;
-import java.util.Map;
-
import org.apache.geronimo.gbean.AbstractName;
import org.apache.geronimo.kernel.config.Configuration;
import org.apache.geronimo.kernel.config.ConfigurationData;
@@ -31,8 +28,8 @@ import org.apache.geronimo.kernel.config
import org.apache.geronimo.kernel.config.ConfigurationManager;
import org.apache.geronimo.kernel.config.ConfigurationModel;
import org.apache.geronimo.kernel.config.ConfigurationStore;
+import org.apache.geronimo.kernel.config.DependencyNode;
import org.apache.geronimo.kernel.config.DeploymentWatcher;
-import org.apache.geronimo.kernel.config.InvalidConfigException;
import org.apache.geronimo.kernel.config.LifecycleException;
import org.apache.geronimo.kernel.config.LifecycleMonitor;
import org.apache.geronimo.kernel.config.LifecycleResults;
@@ -40,7 +37,7 @@ import org.apache.geronimo.kernel.config
import org.apache.geronimo.kernel.config.NoSuchStoreException;
import org.apache.geronimo.kernel.config.SimpleConfigurationManager;
import org.apache.geronimo.kernel.repository.Artifact;
-import org.apache.geronimo.kernel.repository.ArtifactResolver;
+import org.apache.geronimo.kernel.repository.MissingDependencyException;
import org.apache.geronimo.kernel.repository.Repository;
import org.apache.geronimo.kernel.repository.Version;
import org.osgi.framework.Bundle;
@@ -68,10 +65,6 @@ public class DeploymentConfigurationMana
// GENERAL DATA
//
- public synchronized boolean isInstalled(Artifact configId) {
- return super.isInstalled(configId);
- }
-
public synchronized boolean isLoaded(Artifact configId) {
return configurationManager.isLoaded(configId) || super.isLoaded(configId);
}
@@ -101,8 +94,10 @@ public class DeploymentConfigurationMana
return bundle;
}
- public ArtifactResolver getArtifactResolver() {
- return super.getArtifactResolver();
+ @Override
+ public synchronized ConfigurationData getLoadedConfigurationData(Artifact configurationId) {
+ ConfigurationData configurationData = configurationManager.getLoadedConfigurationData(configurationId);
+ return configurationData == null ? super.getLoadedConfigurationData(configurationId) : configurationData;
}
/**
@@ -116,78 +111,39 @@ public class DeploymentConfigurationMana
public void setOnline(boolean online) {
}
- //
- // LOAD
- //
-
- public synchronized LifecycleResults loadConfiguration(Artifact configurationId) throws NoSuchConfigException, LifecycleException {
- return super.loadConfiguration(configurationId);
- }
-
- public synchronized LifecycleResults loadConfiguration(Artifact configurationId, LifecycleMonitor monitor) throws NoSuchConfigException, LifecycleException {
- return super.loadConfiguration(configurationId, monitor);
- }
-
- public synchronized LifecycleResults loadConfiguration(ConfigurationData configurationData) throws NoSuchConfigException, LifecycleException {
- return super.loadConfiguration(configurationData);
- }
-
- public synchronized LifecycleResults loadConfiguration(ConfigurationData configurationData, LifecycleMonitor monitor) throws NoSuchConfigException, LifecycleException {
- return super.loadConfiguration(configurationData, monitor);
- }
-
- protected Configuration load(ConfigurationData configurationData, LinkedHashSet<Artifact> resolvedParentIds, Map<Artifact, Configuration> loadedConfigurations) throws InvalidConfigException {
- return super.load(configurationData, resolvedParentIds, loadedConfigurations);
- }
-
- protected void load(Artifact configurationId) throws NoSuchConfigException {
- if (configurationModel.containsConfiguration(configurationId)) {
- super.load(configurationId);
- }
- }
-
- protected void addNewConfigurationToModel(Configuration configuration) throws NoSuchConfigException {
- LinkedHashSet<Configuration> loadParents = getLoadParents(configuration);
- for (Configuration loadParent : loadParents) {
- if (!configurationModel.containsConfiguration(loadParent.getId())) {
- configurationModel.addConfiguration(loadParent.getId(), Collections.<Artifact>emptySet(), Collections.<Artifact>emptySet());
- configurationModel.load(loadParent.getId());
+ @Override
+ protected void addConfigurationModel(Artifact id) throws NoSuchConfigException, MissingDependencyException {
+ ConfigurationData configurationData = getLoadedConfigurationData(id);
+ if (configurationData == null) {
+ throw new NoSuchConfigException(id, "Should be load the configurationData first");
+ }
+ DependencyNode node = buildDependencyNode(configurationData);
+ for (Artifact classParentId : node.getClassParents()) {
+ if (!configurationModel.containsConfiguration(classParentId)) {
+ configurationModel.addConfiguration(classParentId, Collections.<Artifact> emptySet(), Collections.<Artifact> emptySet());
+ configurationModel.load(classParentId);
}
}
- LinkedHashSet<Configuration> startParents = getStartParents(configuration);
- for (Configuration startParent : startParents) {
- if (!configurationModel.containsConfiguration(startParent.getId())) {
- configurationModel.addConfiguration(startParent.getId(), Collections.<Artifact>emptySet(), Collections.<Artifact>emptySet());
- configurationModel.load(startParent.getId());
+ for (Artifact serviceParentId : node.getServiceParents()) {
+ if (!configurationModel.containsConfiguration(serviceParentId)) {
+ configurationModel.addConfiguration(serviceParentId, Collections.<Artifact> emptySet(), Collections.<Artifact> emptySet());
+ configurationModel.load(serviceParentId);
}
}
- super.addNewConfigurationToModel(configuration);
- }
-
- //
- // UNLOAD
- //
-
- public synchronized LifecycleResults unloadConfiguration(Artifact id) throws NoSuchConfigException, LifecycleException {
- return super.unloadConfiguration(id);
+ configurationModel.addConfiguration(id, node.getClassParents(), node.getServiceParents());
}
- public synchronized LifecycleResults unloadConfiguration(Artifact id, LifecycleMonitor monitor) throws NoSuchConfigException, LifecycleException {
- return super.unloadConfiguration(id, monitor);
- }
-
- protected void unload(Configuration configuration) {
- super.unload(configuration);
+ @Override
+ protected void loadConfigurationModel(Artifact configurationId) throws NoSuchConfigException {
+ if (configurationModel.containsConfiguration(configurationId)) {
+ super.loadConfigurationModel(configurationId);
+ }
}
- //
- // STOP.. used by unload
- //
- protected void stop(Configuration configuration) {
- super.stop(configuration);
+ @Override
+ protected void startInternal(Configuration configuration) throws Exception {
}
-
//
// UNSUPPORTED
//
@@ -212,7 +168,7 @@ public class DeploymentConfigurationMana
throw new UnsupportedOperationException();
}
- public List listConfigurations() {
+ public List<ConfigurationInfo> listConfigurations() {
throw new UnsupportedOperationException();
}
@@ -224,17 +180,13 @@ public class DeploymentConfigurationMana
throw new UnsupportedOperationException();
}
- public synchronized LifecycleResults startConfiguration(Artifact id) throws NoSuchConfigException, LifecycleException {
+ /*public synchronized LifecycleResults startConfiguration(Artifact id) throws NoSuchConfigException, LifecycleException {
throw new UnsupportedOperationException();
}
public synchronized LifecycleResults startConfiguration(Artifact id, LifecycleMonitor monitor) throws NoSuchConfigException, LifecycleException {
throw new UnsupportedOperationException();
- }
-
- protected void start(Configuration configuration) throws Exception {
- throw new UnsupportedOperationException();
- }
+ }*/
public synchronized LifecycleResults stopConfiguration(Artifact id) throws NoSuchConfigException {
throw new UnsupportedOperationException();
Modified: geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeploymentContext.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeploymentContext.java?rev=1096945&r1=1096944&r2=1096945&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeploymentContext.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeploymentContext.java Tue Apr 26 23:15:32 2011
@@ -44,8 +44,8 @@ import javax.xml.stream.XMLStreamExcepti
import org.apache.geronimo.common.DeploymentException;
import org.apache.geronimo.common.IllegalConfigurationException;
-import org.apache.geronimo.deployment.util.osgi.DummyExportPackagesSelector;
import org.apache.geronimo.deployment.util.osgi.OSGiMetaDataBuilder;
+import org.apache.geronimo.deployment.util.osgi.DummyExportPackagesSelector;
import org.apache.geronimo.gbean.AbstractName;
import org.apache.geronimo.gbean.AbstractNameQuery;
import org.apache.geronimo.gbean.GAttributeInfo;
@@ -63,7 +63,6 @@ import org.apache.geronimo.kernel.config
import org.apache.geronimo.kernel.config.ConfigurationModuleType;
import org.apache.geronimo.kernel.config.Manifest;
import org.apache.geronimo.kernel.config.ManifestException;
-import org.apache.geronimo.kernel.osgi.ConfigurationActivator;
import org.apache.geronimo.kernel.repository.Artifact;
import org.apache.geronimo.kernel.repository.Dependency;
import org.apache.geronimo.kernel.repository.Environment;
@@ -78,7 +77,6 @@ import org.apache.geronimo.system.plugin
import org.apache.xbean.osgi.bundle.util.BundleUtils;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -146,7 +144,7 @@ public class DeploymentContext {
this.naming = naming;
this.moduleType = moduleType;
this.environment = environment;
- this.configurationManager = configurationManager;
+ this.configurationManager = createConfigurationManager(configurationManager, Collections.<Repository> emptyList(), bundleContext);
this.bundleContext = bundleContext;
if (null == inPlaceConfigurationDir) {
@@ -175,12 +173,16 @@ public class DeploymentContext {
this.naming = naming;
this.moduleType = moduleType;
this.environment = environment;
- this.configurationManager = configurationManager;
+ this.configurationManager = createConfigurationManager(configurationManager, Collections.<Repository> emptyList(), bundleContext);
this.resourceContext = resourceContext;
this.bundleContext = bundleContext;
}
private static ConfigurationManager createConfigurationManager(ConfigurationManager configurationManager, Collection<Repository> repositories, BundleContext bundleContext) {
+ //TODO Hack for KernelConfigurationManager, while creating temp configuration, we have to start the configuration, but do not want to start those sub gbeans.
+ if (configurationManager instanceof DeploymentConfigurationManager) {
+ return configurationManager;
+ }
return new DeploymentConfigurationManager(configurationManager, repositories, bundleContext);
}
@@ -205,8 +207,9 @@ public class DeploymentContext {
if (BundleUtils.canStart(tempBundle)) {
tempBundle.start(Bundle.START_TRANSIENT);
}
- configurationData.setBundleContext(tempBundle.getBundleContext());
+ configurationData.setBundle(tempBundle);
configurationManager.loadConfiguration(configurationData);
+ configurationManager.startConfiguration(environment.getConfigId());
return configurationManager.getConfiguration(environment.getConfigId());
} catch (Exception e) {
throw new DeploymentException("Unable to create configuration for deployment: dependencies: " + resolvedParentIds, e);
@@ -511,10 +514,10 @@ public class DeploymentContext {
} catch (Exception ignored) {
}
}
- if (tempBundle != null) {
+ if (tempBundle != null && BundleUtils.canUninstall(tempBundle)) {
try {
tempBundle.uninstall();
- } catch (BundleException e) {
+ } catch (Exception e) {
}
}
if (tempBundleFile != null) {
@@ -547,11 +550,7 @@ public class DeploymentContext {
// TODO OSGI figure out exports
environment.addToBundleClassPath(bundleClassPath);
- // TODO OSGI leave out if we use a extender mechanism
- if (environment.getBundleActivator() == null) {
- environment.setBundleActivator(ConfigurationActivator.class.getName());
- environment.addImportPackage(getImportPackageName(ConfigurationActivator.class.getName()));
- }
+
List<GBeanData> gbeans = new ArrayList<GBeanData>(configuration.getGBeans().values());
Collections.sort(gbeans, new GBeanData.PriorityComparator());
@@ -565,7 +564,6 @@ public class DeploymentContext {
}
} else {
LinkedHashSet<String> imports = getImports(gbeans);
- addImport(imports, environment.getBundleActivator());
environment.addImportPackages(imports);
environment.addDynamicImportPackage("*");
osgiMetaDataBuilder = new OSGiMetaDataBuilder(bundleContext, new DummyExportPackagesSelector());
Modified: geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/SingleFileHotDeployer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/SingleFileHotDeployer.java?rev=1096945&r1=1096944&r2=1096945&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/SingleFileHotDeployer.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/SingleFileHotDeployer.java Tue Apr 26 23:15:32 2011
@@ -93,9 +93,9 @@ public class SingleFileHotDeployer {
// get the existing inplace configuration if there is one
ConfigurationInfo existingConfiguration = null;
- List list = configurationManager.listConfigurations();
- for (Iterator iterator = list.iterator(); iterator.hasNext();) {
- ConfigurationInfo configurationInfo = (ConfigurationInfo) iterator.next();
+ List<ConfigurationInfo> list = configurationManager.listConfigurations();
+ for (Iterator<ConfigurationInfo> iterator = list.iterator(); iterator.hasNext();) {
+ ConfigurationInfo configurationInfo = iterator.next();
if (dir.equals(configurationInfo.getInPlaceLocation())) {
existingConfiguration = configurationInfo;
}
@@ -224,12 +224,12 @@ public class SingleFileHotDeployer {
return new Artifact(group, artifactId, version, type);
}
- private List deployConfiguration(ConfigurationBuilder builder, ConfigurationStore store, Artifact configurationId, Object plan, JarFile module, Collection stores, ArtifactResolver artifactResolver) throws DeploymentException {
+ private List<String> deployConfiguration(ConfigurationBuilder builder, ConfigurationStore store, Artifact configurationId, Object plan, JarFile module, Collection stores, ArtifactResolver artifactResolver) throws DeploymentException {
try {
// It's our responsibility to close this context, once we're done with it...
DeploymentContext context = builder.buildConfiguration(true, configurationId, plan, module, stores, artifactResolver, store);
context.initializeConfiguration();
- List configurations = new ArrayList();
+ List<ConfigurationData> configurations = new ArrayList<ConfigurationData>();
try {
configurations.add(context.getConfigurationData());
configurations.addAll(context.getAdditionalDeployment());
@@ -237,9 +237,9 @@ public class SingleFileHotDeployer {
if (configurations.isEmpty()) {
throw new DeploymentException("Deployer did not create any configurations");
}
- List deployedURIs = new ArrayList();
- for (Iterator iterator = configurations.iterator(); iterator.hasNext();) {
- ConfigurationData configurationData = (ConfigurationData) iterator.next();
+ List<String> deployedURIs = new ArrayList<String>();
+ for (Iterator<ConfigurationData> iterator = configurations.iterator(); iterator.hasNext();) {
+ ConfigurationData configurationData = iterator.next();
configurationData.setAutoStart(false);
store.install(configurationData);
deployedURIs.add(configurationData.getId().toString());
@@ -273,10 +273,10 @@ public class SingleFileHotDeployer {
}
}
- private void cleanupConfigurations(List configurations) {
- LinkedList cannotBeDeletedList = new LinkedList();
- for (Iterator iterator = configurations.iterator(); iterator.hasNext();) {
- ConfigurationData configurationData = (ConfigurationData) iterator.next();
+ private void cleanupConfigurations(List<ConfigurationData> configurations) {
+ LinkedList<String> cannotBeDeletedList = new LinkedList<String>();
+ for (Iterator<ConfigurationData> iterator = configurations.iterator(); iterator.hasNext();) {
+ ConfigurationData configurationData = iterator.next();
File dir = configurationData.getConfigurationDir();
cannotBeDeletedList.clear();
if (!FileUtils.recursiveDelete(dir,cannotBeDeletedList)) {
Modified: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/Configuration.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/Configuration.java?rev=1096945&r1=1096944&r2=1096945&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/Configuration.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/Configuration.java Tue Apr 26 23:15:32 2011
@@ -166,7 +166,7 @@ public class Configuration implements GB
* Manageable Attribute Store containing overrides to this configuration.
*/
private ManageableAttributeStore attributeStore = null;
-
+
private Bundle bundle;
/**
@@ -198,17 +198,17 @@ public class Configuration implements GB
this.allServiceParents = allServiceParents;
this.configurationResolver = configurationResolver;
this.abstractName = getConfigurationAbstractName(dependencyNode.getId());
- this.bundle = configurationData.getBundleContext().getBundle();
-
+ this.bundle = configurationData.getBundle();
+
if (configurationData.isUseEnvironment() && configurationManager != null) {
try {
- List<Bundle> bundles = getParentBundles(configurationData, configurationResolver, configurationManager);
+ List<Bundle> bundles = getParentBundles(configurationData, configurationResolver, configurationManager);
this.bundle = new DelegatingBundle(bundles);
} catch (Exception e) {
log.debug("Failed to identify bundle parents for " + configurationData.getId(), e);
}
}
-
+
try {
// Deserialize the GBeans in the configurationData
Collection<GBeanData> gbeans = configurationData.getGBeans(bundle);
@@ -233,20 +233,20 @@ public class Configuration implements GB
private List<Bundle> getParentBundles(ConfigurationData configurationData,
ConfigurationResolver configurationResolver,
- ConfigurationManager configurationManager)
+ ConfigurationManager configurationManager)
throws MissingDependencyException, InvalidConfigException {
List<Bundle> bundles = new ArrayList<Bundle>();
- bundles.add(configurationData.getBundleContext().getBundle());
-
+ bundles.add(configurationData.getBundle());
+
LinkedHashSet<Artifact> parents = configurationManager.resolveParentIds(configurationData);
for (Artifact parent : parents) {
String location = getBundleLocation(configurationResolver, parent);
- Bundle bundle = getBundleByLocation(configurationData.getBundleContext(), location);
+ Bundle bundle = getBundleByLocation(configurationData.getBundle().getBundleContext(), location);
if (bundle != null) {
bundles.add(bundle);
}
}
-
+
return bundles;
}
@@ -264,7 +264,7 @@ public class Configuration implements GB
return null;
}
}
-
+
private static Bundle getBundleByLocation(BundleContext bundleContext, String location) {
for (Bundle bundle: bundleContext.getBundles()) {
if (location.equals(bundle.getLocation())) {
@@ -273,7 +273,7 @@ public class Configuration implements GB
}
return null;
}
-
+
/**
* Add a contained configuration, such as for a war inside an ear
* @param child contained configuration
Modified: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationData.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationData.java?rev=1096945&r1=1096944&r2=1096945&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationData.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationData.java Tue Apr 26 23:15:32 2011
@@ -32,7 +32,6 @@ import org.apache.geronimo.kernel.Naming
import org.apache.geronimo.kernel.repository.Artifact;
import org.apache.geronimo.kernel.repository.Environment;
import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
/**
* @version $Rev$ $Date$
@@ -105,8 +104,8 @@ public class ConfigurationData implement
*/
private transient ConfigurationDataTransformer configurationDataTransformer;
- private transient BundleContext bundleContext;
-
+ private transient Bundle bundle;
+
private transient boolean useEnvironment;
public ConfigurationData(Artifact configId, Naming naming, GBeanState gbeanState) {
@@ -213,15 +212,19 @@ public class ConfigurationData implement
return gbeanState;
}
- public BundleContext getBundleContext() {
+ /*public BundleContext getBundleContext() {
if (bundleContext == null) {
throw new NullPointerException("bundleContext is null in configurationData: " + getId());
}
return bundleContext;
+ }*/
+
+ public void setBundle(Bundle bundle) {
+ this.bundle = bundle;
}
- public void setBundleContext(BundleContext bundleContext) {
- this.bundleContext = bundleContext;
+ public Bundle getBundle() {
+ return bundle;
}
/**
@@ -305,7 +308,7 @@ public class ConfigurationData implement
public void setConfigurationDataTransformer(ConfigurationDataTransformer configurationDataTransformer) {
this.configurationDataTransformer = configurationDataTransformer;
}
-
+
public boolean isUseEnvironment() {
return useEnvironment;
}
Modified: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationManager.java?rev=1096945&r1=1096944&r2=1096945&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationManager.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationManager.java Tue Apr 26 23:15:32 2011
@@ -139,7 +139,7 @@ public interface ConfigurationManager ex
* This includes all configurations installed, regardless of whether they are
* currently loaded or running.
*/
- List listConfigurations();
+ List<ConfigurationInfo> listConfigurations();
/**
* Return a list of the stores this manager knows about.
@@ -503,6 +503,7 @@ public interface ConfigurationManager ex
* @return online status of ConfigurationManager
*/
boolean isOnline();
+
void setOnline(boolean online);
Collection<? extends Repository> getRepositories();
@@ -514,4 +515,6 @@ public interface ConfigurationManager ex
LinkedHashSet<Artifact> resolveParentIds(ConfigurationData configurationData) throws MissingDependencyException, InvalidConfigException;
Bundle getBundle(Artifact id);
+
+ ConfigurationData getLoadedConfigurationData(Artifact configurationId);
}
Modified: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationSource.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationSource.java?rev=1096945&r1=1096944&r2=1096945&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationSource.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationSource.java Tue Apr 26 23:15:32 2011
@@ -28,7 +28,7 @@ import org.apache.geronimo.kernel.reposi
public interface ConfigurationSource {
/**
- * Gets a loaded Configuration (does not see unloaded configurations).
+ * Gets a loaded Configuration (does not see unstarted configurations).
*
* @param configurationId the unique ID of the configuration to get, which
* must be fully resolved (isResolved() == true)
Modified: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationUtil.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationUtil.java?rev=1096945&r1=1096944&r2=1096945&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationUtil.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationUtil.java Tue Apr 26 23:15:32 2011
@@ -176,7 +176,7 @@ public final class ConfigurationUtil {
if (configurationData == null) throw new NullPointerException("configurationData is null");
if (bundleContext == null) throw new NullPointerException("bundle is null");
- configurationData.setBundleContext(bundleContext);
+ configurationData.setBundle(bundleContext.getBundle());
// build the gbean data
Artifact configId = configurationData.getId();
Modified: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/DependencyNodeUtil.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/DependencyNodeUtil.java?rev=1096945&r1=1096944&r2=1096945&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/DependencyNodeUtil.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/DependencyNodeUtil.java Tue Apr 26 23:15:32 2011
@@ -21,6 +21,7 @@
package org.apache.geronimo.kernel.config;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import java.util.ArrayList;
import java.util.HashSet;
@@ -78,6 +79,26 @@ public class DependencyNodeUtil {
}
}
+ /**
+ * This method will check all its sub configurations, and add those class and service parents into the target DependencyNode
+ * @param configurationData
+ * @param artifactResolver
+ * @param configurationFilter
+ * @return
+ * @throws MissingDependencyException
+ */
+ public static DependencyNode toDependencyNode(ConfigurationData configurationData, ArtifactResolver artifactResolver, ConfigurationManager configurationFilter) throws MissingDependencyException {
+ DependencyNode dependencyNode = toDependencyNode(configurationData.getEnvironment(), artifactResolver, configurationFilter);
+ for(Map.Entry<String, ConfigurationData> entry : configurationData.getChildConfigurations().entrySet()) {
+ DependencyNode childDependencyNode = toDependencyNode(entry.getValue(), artifactResolver, configurationFilter);
+ childDependencyNode.getClassParents().remove(configurationData.getId());
+ childDependencyNode.getServiceParents().remove(configurationData.getId());
+ dependencyNode.getClassParents().addAll(childDependencyNode.getClassParents());
+ dependencyNode.getServiceParents().addAll(childDependencyNode.getServiceParents());
+ }
+ return dependencyNode;
+ }
+
public static DependencyNode toDependencyNode(Environment environment, ArtifactResolver artifactResolver, ConfigurationManager configurationFilter) throws MissingDependencyException {
Artifact id = environment.getConfigId();
LinkedHashSet<Artifact> classParents = new LinkedHashSet<Artifact>();
@@ -104,4 +125,5 @@ public class DependencyNodeUtil {
return new DependencyNode(id, classParents, serviceParents);
}
+
}
Modified: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/KernelConfigurationManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/KernelConfigurationManager.java?rev=1096945&r1=1096944&r2=1096945&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/KernelConfigurationManager.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/KernelConfigurationManager.java Tue Apr 26 23:15:32 2011
@@ -28,8 +28,6 @@ import java.util.Set;
import org.apache.geronimo.gbean.AbstractName;
import org.apache.geronimo.gbean.AbstractNameQuery;
import org.apache.geronimo.gbean.GBeanData;
-import org.apache.geronimo.gbean.GBeanInfo;
-import org.apache.geronimo.gbean.GBeanInfoBuilder;
import org.apache.geronimo.gbean.GBeanLifecycle;
import org.apache.geronimo.gbean.InvalidConfigurationException;
import org.apache.geronimo.gbean.annotation.OsgiService;
@@ -48,8 +46,6 @@ import org.apache.geronimo.kernel.reposi
import org.apache.geronimo.kernel.repository.DefaultArtifactResolver;
import org.apache.geronimo.kernel.repository.ListableRepository;
import org.apache.geronimo.kernel.repository.MissingDependencyException;
-import org.apache.geronimo.kernel.repository.Repository;
-import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -103,6 +99,7 @@ public class KernelConfigurationManager
return new DefaultArtifactResolver(artifactManager, repositories, null, Collections.<ConfigurationManager>emptyList());
}
+ @Override
public synchronized LifecycleResults loadConfiguration(Artifact configurationId) throws NoSuchConfigException, LifecycleException {
// todo hack for bootstrap deploy
AbstractName abstractName = null;
@@ -114,25 +111,33 @@ public class KernelConfigurationManager
if (getConfiguration(configurationId) == null && kernel.isLoaded(abstractName)) {
try {
Configuration configuration = (Configuration) kernel.getGBean(abstractName);
- addNewConfigurationToModel(configuration);
+ //TODO someone loads the configuration by kernel directly ???
+ if (!loadedConfigurationData.containsKey(configurationId)) {
+ loadedConfigurationData.put(configurationId, configuration.getConfigurationData());
+ addConfigurationModel(configurationId);
+ }
+ configurations.put(configurationId, configuration);
configurationModel.load(configurationId);
configurationModel.start(configurationId);
return new LifecycleResults();
} catch (GBeanNotFoundException e) {
// configuration was unloaded, just continue as normal
+ } catch (MissingDependencyException e) {
}
}
return super.loadConfiguration(configurationId);
}
- protected void load(Artifact configurationId) throws NoSuchConfigException {
- super.load(configurationId);
+ @Override
+ protected void loadConfigurationModel(Artifact configurationId) throws NoSuchConfigException {
+ super.loadConfigurationModel(configurationId);
if (configurationList != null) {
configurationList.addConfiguration(configurationId);
}
}
+ @Override
protected void migrateConfiguration(Artifact oldName, Artifact newName, Configuration configuration, boolean running) throws NoSuchConfigException {
super.migrateConfiguration(oldName, newName, configuration, running);
if (configurationList != null) {
@@ -143,7 +148,8 @@ public class KernelConfigurationManager
}
}
- protected Configuration load(ConfigurationData configurationData, LinkedHashSet<Artifact> resolvedParentIds, Map<Artifact, Configuration> loadedConfigurations) throws InvalidConfigException {
+ @Override
+ protected Configuration start(ConfigurationData configurationData, Set<Artifact> resolvedParentIds, Map<Artifact, Configuration> loadedConfigurations) throws InvalidConfigException {
Artifact configurationId = configurationData.getId();
AbstractName configurationName = Configuration.getConfigurationAbstractName(configurationId);
GBeanData gbeanData = new GBeanData(configurationName, Configuration.class);
@@ -153,24 +159,19 @@ public class KernelConfigurationManager
gbeanData.setAttribute("configurationResolver", configurationResolver);
try {
dependencyNode = buildDependencyNode(configurationData);
-
gbeanData.setAttribute("dependencyNode", dependencyNode);
-// gbeanData.setAttribute("classLoaderHolder", classLoaderHolder);
gbeanData.setAttribute("allServiceParents", buildAllServiceParents(loadedConfigurations, dependencyNode));
} catch (MissingDependencyException e) {
throw new InvalidConfigException(e);
-// } catch (MalformedURLException e) {
-// throw new InvalidConfigException(e);
-// } catch (NoSuchConfigException e) {
-// throw new InvalidConfigException(e);
}
gbeanData.setAttribute("configurationManager", this);
//TODO is this dangerous? should really add dependency on attribute store name
gbeanData.setAttribute("attributeStore", attributeStore);
// add parents to the parents reference collection
+ //TODO Only add those service parents as dependencies, all the class parents should be only required resolved
LinkedHashSet<AbstractName> parentNames = new LinkedHashSet<AbstractName>();
- for (Artifact resolvedParentId : resolvedParentIds) {
+ for (Artifact resolvedParentId : dependencyNode.getServiceParents()) {
if (isConfiguration(resolvedParentId)) {
AbstractName parentName = Configuration.getConfigurationAbstractName(resolvedParentId);
parentNames.add(parentName);
@@ -206,13 +207,13 @@ public class KernelConfigurationManager
moreLoadedConfigurations.put(dependencyNode.getId(), configuration);
for (Map.Entry<String, ConfigurationData> childEntry : configurationData.getChildConfigurations().entrySet()) {
ConfigurationResolver childResolver = configurationResolver.createChildResolver(childEntry.getKey());
- Configuration child = doLoad(childEntry.getValue(), resolvedParentIds, moreLoadedConfigurations, childResolver);
+ Configuration child = doStart(childEntry.getValue(), resolvedParentIds, moreLoadedConfigurations, childResolver);
configuration.addChild(child);
}
log.debug("Loaded Configuration {}", configurationName);
} catch (Exception e) {
- unload(configurationId);
+ unloadInternal(configurationId);
if (e instanceof InvalidConfigException) {
throw (InvalidConfigException) e;
}
@@ -221,7 +222,8 @@ public class KernelConfigurationManager
return configuration;
}
- public void start(Configuration configuration) throws InvalidConfigException {
+ @Override
+ protected void startInternal(Configuration configuration) throws InvalidConfigException {
if (online) {
ConfigurationUtil.startConfigurationGBeans(configuration.getAbstractName(), configuration, kernel);
}
@@ -231,15 +233,18 @@ public class KernelConfigurationManager
}
}
+ @Override
public boolean isOnline() {
return online;
}
+ @Override
public void setOnline(boolean online) {
this.online = online;
}
- protected void stop(Configuration configuration) {
+ @Override
+ protected void stopInternal(Configuration configuration) {
stopRecursive(configuration);
if (configurationList != null) {
configurationList.stopConfiguration(configuration.getId());
@@ -248,17 +253,13 @@ public class KernelConfigurationManager
private void stopRecursive(Configuration configuration) {
// stop all of the child configurations first
- for (Iterator iterator = configuration.getChildren().iterator(); iterator.hasNext();) {
- Configuration childConfiguration = (Configuration) iterator.next();
+ for (Configuration childConfiguration : configuration.getChildren()) {
stopRecursive(childConfiguration);
}
- Collection gbeans = configuration.getGBeans().values();
-
// stop the gbeans
- for (Iterator iterator = gbeans.iterator(); iterator.hasNext();) {
- GBeanData gbeanData = (GBeanData) iterator.next();
- AbstractName gbeanName = gbeanData.getAbstractName();
+ for (Map.Entry<AbstractName, GBeanData> entry : configuration.getGBeans().entrySet()) {
+ AbstractName gbeanName = entry.getValue().getAbstractName();
try {
kernel.stopGBean(gbeanName);
} catch (GBeanNotFoundException ignored) {
@@ -269,9 +270,8 @@ public class KernelConfigurationManager
}
// unload the gbeans
- for (Iterator iterator = gbeans.iterator(); iterator.hasNext();) {
- GBeanData gbeanData = (GBeanData) iterator.next();
- AbstractName gbeanName = gbeanData.getAbstractName();
+ for (Map.Entry<AbstractName, GBeanData> entry : configuration.getGBeans().entrySet()) {
+ AbstractName gbeanName = entry.getValue().getAbstractName();
try {
kernel.unloadGBean(gbeanName);
} catch (GBeanNotFoundException ignored) {
@@ -280,23 +280,11 @@ public class KernelConfigurationManager
log.debug("Error cleaning up after failed start of configuration " + configuration.getId() + " gbean " + gbeanName, kernelException);
}
}
- }
- protected void unload(Configuration configuration) {
- Artifact configurationId = configuration.getId();
- unload(configurationId);
- }
-
- private void unload(Artifact configurationId) {
- AbstractName configurationName;
- try {
- configurationName = Configuration.getConfigurationAbstractName(configurationId);
- } catch (InvalidConfigException e) {
- throw new AssertionError(e);
- }
+ AbstractName configurationName = configuration.getAbstractName();
if (artifactManager != null) {
- artifactManager.unloadAllArtifacts(configurationId);
+ artifactManager.unloadAllArtifacts(configuration.getId());
}
// unload this configuration
@@ -305,7 +293,7 @@ public class KernelConfigurationManager
} catch (GBeanNotFoundException ignored) {
// Good
} catch (Exception stopException) {
- log.warn("Unable to stop failed configuration: " + configurationId, stopException);
+ log.warn("Unable to stop failed configuration: " + configuration.getId(), stopException);
}
try {
@@ -313,24 +301,28 @@ public class KernelConfigurationManager
} catch (GBeanNotFoundException ignored) {
// Good
} catch (Exception unloadException) {
- log.warn("Unable to unload failed configuration: " + configurationId, unloadException);
+ log.warn("Unable to unload failed configuration: " + configuration.getId(), unloadException);
}
}
- protected void uninstall(Artifact configurationId) {
+ @Override
+ protected void uninstallInternal(Artifact configurationId) {
if (configurationList != null) {
configurationList.removeConfiguration(configurationId);
}
}
+ @Override
public void doStart() {
kernel.registerShutdownHook(shutdownHook);
}
+ @Override
public void doStop() {
kernel.unregisterShutdownHook(shutdownHook);
}
+ @Override
public void doFail() {
log.error("Cofiguration manager failed");
}
@@ -345,6 +337,7 @@ public class KernelConfigurationManager
this.configurationModel = configurationModel;
}
+ @Override
public void run() {
while (true) {
Set configs = kernel.listGBeans(new AbstractNameQuery(Configuration.class.getName()));