You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by da...@apache.org on 2006/02/18 01:57:33 UTC
svn commit: r378670 - in /geronimo/branches/configid:
applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/handlers/
modules/axis-builder/src/test/org/apache/geronimo/axis/builder/
modules/deployment/src/java/org/apache/geronim...
Author: dain
Date: Fri Feb 17 16:57:30 2006
New Revision: 378670
URL: http://svn.apache.org/viewcvs?rev=378670&view=rev
Log:
Initial integration of artifact resolution
Added:
geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/repository/DefaultArtifactManager.java
Modified:
geronimo/branches/configid/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/handlers/CreateDestinationHandler.java
geronimo/branches/configid/modules/axis-builder/src/test/org/apache/geronimo/axis/builder/ServiceReferenceTest.java
geronimo/branches/configid/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentContext.java
geronimo/branches/configid/modules/deployment/src/test/org/apache/geronimo/deployment/DeploymentContextTest.java
geronimo/branches/configid/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/EARConfigBuilderTest.java
geronimo/branches/configid/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockNamingContext.java
geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java
geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/repository/Artifact.java
geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/repository/ArtifactManager.java
geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/repository/ArtifactResolver.java
geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/repository/DefaultArtifactResolver.java
geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/repository/ListableRepository.java
geronimo/branches/configid/modules/kernel/src/test/org/apache/geronimo/kernel/ConfigTest.java
geronimo/branches/configid/modules/kernel/src/test/org/apache/geronimo/kernel/config/MultiParentClassLoaderTest.java
geronimo/branches/configid/modules/naming-builder/src/test/org/apache/geronimo/naming/deployment/MessageDestinationTest.java
geronimo/branches/configid/modules/service-builder/src/java/org/apache/geronimo/deployment/service/EnvironmentBuilder.java
geronimo/branches/configid/modules/system/src/java/org/apache/geronimo/system/repository/AbstractRepository.java
geronimo/branches/configid/modules/system/src/java/org/apache/geronimo/system/repository/Maven1Repository.java
geronimo/branches/configid/modules/system/src/java/org/apache/geronimo/system/repository/Maven2Repository.java
geronimo/branches/configid/modules/system/src/test/org/apache/geronimo/system/configuration/LocalConfigStoreTest.java
geronimo/branches/configid/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PlanProcessor.java
Modified: geronimo/branches/configid/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/handlers/CreateDestinationHandler.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/handlers/CreateDestinationHandler.java?rev=378670&r1=378669&r2=378670&view=diff
==============================================================================
--- geronimo/branches/configid/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/handlers/CreateDestinationHandler.java (original)
+++ geronimo/branches/configid/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/handlers/CreateDestinationHandler.java Fri Feb 17 16:57:30 2006
@@ -34,7 +34,6 @@
import org.apache.geronimo.kernel.config.ConfigurationModuleType;
import org.apache.geronimo.kernel.config.ConfigurationUtil;
import org.apache.geronimo.kernel.repository.Artifact;
-import org.apache.geronimo.kernel.repository.Version;
import org.apache.geronimo.kernel.repository.Environment;
import javax.jms.Queue;
@@ -107,11 +106,7 @@
adminObjectData.setAttribute("PhysicalName",
destinationPhysicalName);
- Artifact configId = new Artifact();
- configId.setGroupId(Artifact.DEFAULT_GROUP_ID);
- configId.setArtifactId(BASE_CONFIG_URI + destinationName);
- configId.setVersion(new Version("0"));
- configId.setType("car");
+ Artifact configId = new Artifact(Artifact.DEFAULT_GROUP_ID, BASE_CONFIG_URI + destinationName, "0", "car");
ConfigurationManager configurationManager = ConfigurationUtil
.getConfigurationManager(kernel);
Modified: geronimo/branches/configid/modules/axis-builder/src/test/org/apache/geronimo/axis/builder/ServiceReferenceTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/axis-builder/src/test/org/apache/geronimo/axis/builder/ServiceReferenceTest.java?rev=378670&r1=378669&r2=378670&view=diff
==============================================================================
--- geronimo/branches/configid/modules/axis-builder/src/test/org/apache/geronimo/axis/builder/ServiceReferenceTest.java (original)
+++ geronimo/branches/configid/modules/axis-builder/src/test/org/apache/geronimo/axis/builder/ServiceReferenceTest.java Fri Feb 17 16:57:30 2006
@@ -86,7 +86,7 @@
public final static String NAMESPACE = "http://geronimo.apache.org/axis/mock";
private File tmpbasedir;
private Environment environment = new Environment();
- private Artifact configID = new Artifact("group", "test", "1", "car", true);
+ private Artifact configID = new Artifact("group", "test", "1", "car");
private DeploymentContext context;
private ClassLoader isolatedCl = new URLClassLoader(new URL[0], this.getClass().getClassLoader());
private final String operationName = "doMockOperation";
Modified: geronimo/branches/configid/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentContext.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentContext.java?rev=378670&r1=378669&r2=378670&view=diff
==============================================================================
--- geronimo/branches/configid/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentContext.java (original)
+++ geronimo/branches/configid/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentContext.java Fri Feb 17 16:57:30 2006
@@ -593,7 +593,9 @@
public URL resolve(Artifact configId, URI uri) throws MalformedURLException {
return new File(baseDir, uri.toString()).toURL();
}
- });
+ },
+ null,
+ null);
return configuration.getConfigurationClassLoader();
} catch (Exception e) {
throw new DeploymentException("Could not construct configuration classloader for deployment context", e);
Modified: geronimo/branches/configid/modules/deployment/src/test/org/apache/geronimo/deployment/DeploymentContextTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/deployment/src/test/org/apache/geronimo/deployment/DeploymentContextTest.java?rev=378670&r1=378669&r2=378670&view=diff
==============================================================================
--- geronimo/branches/configid/modules/deployment/src/test/org/apache/geronimo/deployment/DeploymentContextTest.java (original)
+++ geronimo/branches/configid/modules/deployment/src/test/org/apache/geronimo/deployment/DeploymentContextTest.java Fri Feb 17 16:57:30 2006
@@ -46,7 +46,7 @@
try {
basedir.deleteOnExit();
Environment environment = new Environment();
- environment.setConfigId(new Artifact("foo", "artifact", "1", "car", true));
+ environment.setConfigId(new Artifact("foo", "artifact", "1", "car"));
Map nameKeys = new HashMap();
nameKeys.put("domain", "d");
environment.setProperties(nameKeys);
Modified: geronimo/branches/configid/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/EARConfigBuilderTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/EARConfigBuilderTest.java?rev=378670&r1=378669&r2=378670&view=diff
==============================================================================
--- geronimo/branches/configid/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/EARConfigBuilderTest.java (original)
+++ geronimo/branches/configid/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/EARConfigBuilderTest.java Fri Feb 17 16:57:30 2006
@@ -50,7 +50,6 @@
import java.net.URL;
import java.net.MalformedURLException;
import java.util.Collections;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.jar.JarFile;
@@ -87,7 +86,7 @@
protected void setUp() throws Exception {
defaultParentId = new Environment();
- defaultParentId.getImports().add(new Artifact("geronimo", "test", "1", "car", true));
+ defaultParentId.getImports().add(new Artifact("geronimo", "test", "1", "car"));
defaultParentId.getProperties().put(NameFactory.JSR77_BASE_NAME_PROPERTY, "geronimo.test:J2EEServer=geronimo");
}
Modified: geronimo/branches/configid/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockNamingContext.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockNamingContext.java?rev=378670&r1=378669&r2=378670&view=diff
==============================================================================
--- geronimo/branches/configid/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockNamingContext.java (original)
+++ geronimo/branches/configid/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockNamingContext.java Fri Feb 17 16:57:30 2006
@@ -17,7 +17,6 @@
package org.apache.geronimo.j2ee.deployment;
import java.util.Set;
-import java.net.URI;
import javax.management.ObjectName;
@@ -60,6 +59,6 @@
}
public Artifact getConfigID() {
- return new Artifact("groupId", "MockNamingContextID", "1", "car", true);
+ return new Artifact("groupId", "MockNamingContextID", "1", "car");
}
}
Modified: geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java?rev=378670&r1=378669&r2=378670&view=diff
==============================================================================
--- geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java (original)
+++ geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java Fri Feb 17 16:57:30 2006
@@ -35,6 +35,9 @@
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.ArtifactResolver;
+import org.apache.geronimo.kernel.repository.DefaultArtifactResolver;
+import org.apache.geronimo.kernel.repository.ArtifactManager;
import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
@@ -120,16 +123,19 @@
}
/**
- * The kernel in which this configuration is registered
+ * The kernel in which this configuration is registered.
*/
private final Kernel kernel;
/**
- * The registered objectName for this configuraion
+ * The registered objectName for this configuraion.
*/
private final String objectNameString;
private final ObjectName objectName;
+ /**
+ * Defines the environment requred for this configuration.
+ */
private final Environment environment;
/**
@@ -142,6 +148,9 @@
*/
private final List parents;
+ /**
+ * The paths within the this configuration artifact that should be added to the class loader.
+ */
private final List classPath;
/**
@@ -172,6 +181,11 @@
private final Collection repositories;
/**
+ * The artifact manager in which loaded artifacts are registered.
+ */
+ private final ArtifactManager artifactManager;
+
+ /**
* Only used to allow declaration as a reference.
*/
public Configuration() {
@@ -186,6 +200,7 @@
classPath = null;
baseURL = null;
repositories = null;
+ artifactManager = null;
}
/**
@@ -206,8 +221,9 @@
List classPath,
byte[] gbeanState,
Collection repositories,
- ConfigurationStore configurationStore) throws Exception {
-
+ ConfigurationStore configurationStore,
+ ArtifactManager artifactManager,
+ ArtifactResolver artifactResolver) throws Exception {
this.kernel = kernel;
this.environment = environment;
this.objectNameString = objectName;
@@ -222,15 +238,35 @@
this.classPath = Collections.EMPTY_LIST;
}
- // get proxies to my parent configurations
- parents = new ArrayList();
+ this.artifactManager = artifactManager;
+
+ if (artifactResolver == null) {
+ artifactResolver = new DefaultArtifactResolver(artifactManager, repositories);
+ }
+
+ // resolve imports artifacts
LinkedHashSet imports = environment.getImports();
+ imports = artifactResolver.resolve(imports);
+ environment.setImports(imports);
+
+ // get proxies to my parent configurations (now that the imports have been resolved)
+ parents = new ArrayList();
for (Iterator iterator = imports.iterator(); iterator.hasNext();) {
Artifact artifact = (Artifact) iterator.next();
ObjectName parentName = getConfigurationObjectName(artifact);
parents.add(kernel.getProxyManager().createProxy(parentName, Configuration.class));
}
+ // resolve dependencies
+ LinkedHashSet dependencies = environment.getDependencies();
+ dependencies = artifactResolver.resolve(parents, dependencies);
+ environment.setDependencies(dependencies);
+
+ // resolve references
+ LinkedHashSet references = environment.getReferences();
+ references = artifactResolver.resolve(parents, references);
+ environment.setReferences(references);
+
// build configurationClassLoader
URL[] urls = buildClassPath(configurationStore);
log.debug("ClassPath for " + environment.getConfigId() + " resolved to " + Arrays.asList(urls));
@@ -241,7 +277,12 @@
// which is normally the system class loader but not always, so be safe
configurationClassLoader = new MultiParentClassLoader(environment.getConfigId(), urls, getClass().getClassLoader());
} else {
- configurationClassLoader = new MultiParentClassLoader(environment.getConfigId(), urls, getParentClassLoaders());
+ ClassLoader[] parentClassLoaders = new ClassLoader[parents.size()];
+ for (ListIterator iterator = parents.listIterator(); iterator.hasNext();) {
+ Configuration configuration = (Configuration) iterator.next();
+ parentClassLoaders[iterator.previousIndex()] = configuration.getConfigurationClassLoader();
+ }
+ configurationClassLoader = new MultiParentClassLoader(environment.getConfigId(), urls, parentClassLoaders);
}
}
@@ -303,15 +344,6 @@
}
}
- private ClassLoader[] getParentClassLoaders() throws Exception {
- ClassLoader[] classLoaders = new ClassLoader[parents.size()];
- for (ListIterator iterator = parents.listIterator(); iterator.hasNext();) {
- Configuration configuration = (Configuration) iterator.next();
- classLoaders[iterator.previousIndex()] = configuration.getConfigurationClassLoader();
- }
- return classLoaders;
- }
-
private URL[] buildClassPath(ConfigurationStore configurationStore) throws MalformedURLException, MissingDependencyException, NoSuchConfigException {
LinkedHashSet dependencies = environment.getDependencies();
List urls = new ArrayList(dependencies.size() + classPath.size());
@@ -352,7 +384,8 @@
public void doStart() throws Exception {
assert objectName != null;
- // declare imports on parents
+
+ // declare dependencies on parents
Set parentNames = new HashSet();
for (Iterator iterator = parents.iterator(); iterator.hasNext();) {
Configuration configuration = (Configuration) iterator.next();
@@ -362,6 +395,14 @@
DependencyManager dependencyManager = this.kernel.getDependencyManager();
dependencyManager.addDependencies(this.objectName, parentNames);
+ // declare the artifacts as loaded
+ LinkedHashSet artifacts = new LinkedHashSet();
+ artifacts.addAll(environment.getDependencies());
+ artifacts.addAll(environment.getReferences());
+ if (artifactManager != null) {
+ artifactManager.loadArtifacts(environment.getConfigId(), artifacts);
+ }
+
log.debug("Started configuration " + environment.getConfigId());
}
@@ -399,6 +440,11 @@
configurationClassLoader.destroy();
configurationClassLoader = null;
}
+
+ // declare all artifacts as unloaded
+ if (artifactManager != null) {
+ artifactManager.unloadAllArtifacts(environment.getConfigId());
+ }
}
/**
@@ -601,6 +647,8 @@
infoFactory.addReference("Repositories", Repository.class, "GBean");
infoFactory.addReference("ConfigurationStore", ConfigurationStore.class, "GBean");
+ infoFactory.addReference("ArtifactManager", ArtifactManager.class);
+ infoFactory.addReference("ArtifactResolver", ArtifactResolver.class);
infoFactory.addOperation("addGBean", new Class[]{GBeanData.class, boolean.class});
infoFactory.addOperation("removeGBean", new Class[]{ObjectName.class});
@@ -620,7 +668,9 @@
"classPath",
"gBeanState",
"Repositories",
- "ConfigurationStore"
+ "ConfigurationStore",
+ "ArtifactManager",
+ "ArtifactResolver"
});
GBEAN_INFO = infoFactory.getBeanInfo();
Modified: geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/repository/Artifact.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/repository/Artifact.java?rev=378670&r1=378669&r2=378670&view=diff
==============================================================================
--- geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/repository/Artifact.java (original)
+++ geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/repository/Artifact.java Fri Feb 17 16:57:30 2006
@@ -20,31 +20,31 @@
import java.net.URI;
import java.net.URISyntaxException;
import java.io.Serializable;
-import java.util.regex.Pattern;
-import java.util.regex.Matcher;
-import java.util.List;
-import java.util.ArrayList;
/**
* @version $Rev:$ $Date:$
*/
public class Artifact implements Comparable, Serializable {
+ private static final long serialVersionUID = -3459638899709893444L;
public static final String DEFAULT_GROUP_ID = "Unspecified";
- private String groupId;
- private String artifactId;
- private Version version;
- private String type;
- private boolean resolved;
- public Artifact() {
+ private final String groupId;
+ private final String artifactId;
+ private final Version version;
+ private final String type;
+ private final boolean resolved;
+
+ public Artifact(String groupId, String artifactId, String version, String type) {
+ this(groupId, artifactId, new Version(version), type);
}
- public Artifact(String groupId, String artifactId, String version, String type, boolean resolved) {
+ public Artifact(String groupId, String artifactId, Version version, String type) {
+ if (artifactId == null) throw new NullPointerException("artifactId is null");
this.groupId = groupId;
this.artifactId = artifactId;
- this.version = new Version(version);
+ this.version = version;
this.type = type;
- this.resolved = resolved;
+ this.resolved = groupId != null && artifactId != null && version != null && type != null;
}
public static Artifact create(String id) {
@@ -52,49 +52,29 @@
if (parts.length != 4) {
throw new IllegalArgumentException("Invalid id: " + id);
}
- return new Artifact(parts[0], parts[1], parts[2], parts[3], true);
+ return new Artifact(parts[0], parts[1], parts[2], parts[3]);
}
public String getGroupId() {
return groupId;
}
- public void setGroupId(String groupId) {
- this.groupId = groupId;
- }
-
public String getArtifactId() {
return artifactId;
}
- public void setArtifactId(String artifactId) {
- this.artifactId = artifactId;
- }
-
public Version getVersion() {
return version;
}
- public void setVersion(Version version) {
- this.version = version;
- }
-
public String getType() {
return type;
}
- public void setType(String type) {
- this.type = type;
- }
-
public boolean isResolved() {
return resolved;
}
- public void setResolved(boolean resolved) {
- this.resolved = resolved;
- }
-
public int compareTo(Object object) {
Artifact artifact = (Artifact) object;
@@ -120,6 +100,40 @@
}
if (right == null) return GREATER;
return left.compareTo(right);
+ }
+
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ final Artifact artifact = (Artifact) o;
+
+ if (!artifactId.equals(artifact.artifactId)) {
+ return false;
+ }
+
+ if (groupId != null ? !groupId.equals(artifact.groupId) : artifact.groupId != null) {
+ return false;
+ }
+
+ if (type != null ? !type.equals(artifact.type) : artifact.type != null) {
+ return false;
+ }
+
+ if (version != null ? !version.equals(artifact.version) : artifact.version != null) {
+ return false;
+ }
+
+ return true;
+ }
+
+ public int hashCode() {
+ int result;
+ result = (groupId != null ? groupId.hashCode() : 0);
+ result = 29 * result + artifactId.hashCode();
+ result = 29 * result + (version != null ? version.hashCode() : 0);
+ result = 29 * result + (type != null ? type.hashCode() : 0);
+ return result;
}
/**
Modified: geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/repository/ArtifactManager.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/repository/ArtifactManager.java?rev=378670&r1=378669&r2=378670&view=diff
==============================================================================
--- geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/repository/ArtifactManager.java (original)
+++ geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/repository/ArtifactManager.java Fri Feb 17 16:57:30 2006
@@ -16,13 +16,14 @@
*/
package org.apache.geronimo.kernel.repository;
-import java.util.List;
+import java.util.Set;
+import java.util.SortedSet;
/**
* @version $Rev$ $Date$
*/
public interface ArtifactManager {
- void loadArtifacts(List artifacts);
- void unloadArtifacts(List artifacts);
- List getLoadedArtifacts(String groupId, String artifactId, String type);
+ void loadArtifacts(Artifact artifact, Set artifacts);
+ void unloadAllArtifacts(Artifact artifact);
+ SortedSet getLoadedArtifacts(String groupId, String artifactId, String type);
}
Modified: geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/repository/ArtifactResolver.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/repository/ArtifactResolver.java?rev=378670&r1=378669&r2=378670&view=diff
==============================================================================
--- geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/repository/ArtifactResolver.java (original)
+++ geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/repository/ArtifactResolver.java Fri Feb 17 16:57:30 2006
@@ -17,10 +17,13 @@
package org.apache.geronimo.kernel.repository;
import java.util.Collection;
+import java.util.LinkedHashSet;
/**
* @version $Rev$ $Date$
*/
public interface ArtifactResolver {
- void resolve(Collection parentConfigurations, Collection artifacts) throws MissingDependencyException;
+ LinkedHashSet resolve(LinkedHashSet artifacts) throws MissingDependencyException;
+
+ LinkedHashSet resolve(Collection parentConfigurations, LinkedHashSet artifacts) throws MissingDependencyException;
}
Added: geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/repository/DefaultArtifactManager.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/repository/DefaultArtifactManager.java?rev=378670&view=auto
==============================================================================
--- geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/repository/DefaultArtifactManager.java (added)
+++ geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/repository/DefaultArtifactManager.java Fri Feb 17 16:57:30 2006
@@ -0,0 +1,115 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.kernel.repository;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class DefaultArtifactManager implements ArtifactManager {
+ private final Map artifactsByLoader = new HashMap();
+ private final Map artifactsByTemplate = new HashMap();
+
+ public void loadArtifacts(Artifact loader, Set artifacts) {
+ if (!loader.isResolved()) throw new IllegalArgumentException("loader is not a resolved artifact: " + loader);
+ for (Iterator iterator = artifacts.iterator(); iterator.hasNext();) {
+ Artifact artifact = (Artifact) iterator.next();
+ if (!artifact.isResolved()) {
+ throw new IllegalArgumentException("artifact is not a resolved artifact: " + artifact);
+ }
+ }
+
+ synchronized (this) {
+ if (artifactsByLoader.containsKey(loader)) throw new IllegalArgumentException("loader has already declared artifacts: "+ loader);
+ artifactsByLoader.put(loader, artifacts);
+ addArtifactByTempate(loader);
+
+ for (Iterator iterator = artifacts.iterator(); iterator.hasNext();) {
+ Artifact artifact = (Artifact) iterator.next();
+ addArtifactByTempate(artifact);
+ }
+ }
+ }
+
+ private void addArtifactByTempate(Artifact artifact) {
+ Artifact template = new Artifact(artifact.getGroupId(),artifact.getArtifactId(), (Version) null, artifact.getType());
+ List versions = (List) artifactsByTemplate.get(template);
+ if (versions == null) {
+ versions = new ArrayList();
+ artifactsByTemplate.put(template, versions);
+ }
+ versions.add(artifact);
+ }
+
+ public synchronized void unloadAllArtifacts(Artifact loader) {
+ removeArtifactByTempate(loader);
+
+ Collection artifacts = (Collection) artifactsByLoader.remove(loader);
+ if (artifacts == null) {
+ return;
+ }
+
+ for (Iterator iterator = artifacts.iterator(); iterator.hasNext();) {
+ Artifact artifact = (Artifact) iterator.next();
+ removeArtifactByTempate(artifact);
+ }
+ }
+
+ private void removeArtifactByTempate(Artifact artifact) {
+ Artifact template = new Artifact(artifact.getGroupId(),artifact.getArtifactId(), (Version) null, artifact.getType());
+ List versions = (List) artifactsByTemplate.get(template);
+ if (versions != null) {
+ versions.remove(artifact);
+ if (versions.isEmpty()) {
+ artifactsByTemplate.remove(template);
+ }
+ }
+ }
+
+ public SortedSet getLoadedArtifacts(String groupId, String artifactId, String type) {
+ Artifact template = new Artifact(groupId, artifactId, (Version) null, type);
+ List versions = (List) artifactsByTemplate.get(template);
+ if (versions != null) {
+ return new TreeSet(versions);
+ }
+ return new TreeSet();
+ }
+
+ public static final GBeanInfo GBEAN_INFO;
+
+ static {
+ GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(DefaultArtifactManager.class);
+ infoFactory.addInterface(ArtifactManager.class);
+ GBEAN_INFO = infoFactory.getBeanInfo();
+ }
+
+ public static GBeanInfo getGBeanInfo() {
+ return GBEAN_INFO;
+ }
+}
Modified: geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/repository/DefaultArtifactResolver.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/repository/DefaultArtifactResolver.java?rev=378670&r1=378669&r2=378670&view=diff
==============================================================================
--- geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/repository/DefaultArtifactResolver.java (original)
+++ geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/repository/DefaultArtifactResolver.java Fri Feb 17 16:57:30 2006
@@ -16,12 +16,16 @@
*/
package org.apache.geronimo.kernel.repository;
+import java.util.ArrayList;
import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
import java.util.Collections;
+import java.util.Iterator;
import java.util.LinkedHashSet;
+import java.util.SortedSet;
+import java.util.TreeSet;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
import org.apache.geronimo.kernel.config.Configuration;
/**
@@ -29,56 +33,74 @@
*/
public class DefaultArtifactResolver implements ArtifactResolver {
private final ArtifactManager artifactManager;
- private final ListableRepository repository;
+ private final Collection repositories;
- public DefaultArtifactResolver(ArtifactManager artifactManager, ListableRepository repository) {
+ public DefaultArtifactResolver(ArtifactManager artifactManager, Collection repositories) {
this.artifactManager = artifactManager;
- this.repository = repository;
+ this.repositories = repositories;
+ }
+
+ public LinkedHashSet resolve(LinkedHashSet artifacts) throws MissingDependencyException {
+ return this.resolve(Collections.EMPTY_SET, artifacts);
}
- public void resolve(Collection parentConfigurations, Collection artifacts) throws MissingDependencyException {
+ public LinkedHashSet resolve(Collection parentConfigurations, LinkedHashSet artifacts) throws MissingDependencyException {
+ LinkedHashSet resolvedArtifacts = new LinkedHashSet();
for (Iterator iterator = artifacts.iterator(); iterator.hasNext();) {
Artifact artifact = (Artifact) iterator.next();
if (!artifact.isResolved()) {
- resolveArtifact(parentConfigurations, artifact);
+ artifact = resolveArtifact(parentConfigurations, artifact);
}
+ resolvedArtifacts.add(artifact);
}
+ return resolvedArtifacts;
}
- private void resolveArtifact(Collection parentConfigurations, Artifact artifact) throws MissingDependencyException {
- if (artifact.getArtifactId() == null) {
- throw new IllegalArgumentException("ArtifactId not set " + artifact);
+ private Artifact resolveArtifact(Collection parentConfigurations, Artifact artifact) throws MissingDependencyException {
+ if (artifact.getType() == null) {
+ throw new IllegalArgumentException("Type not set " + artifact);
}
- if (artifact.getGroupId() == null) {
- artifact.setGroupId(Artifact.DEFAULT_GROUP_ID);
+ String groupId = artifact.getGroupId();
+ if (groupId == null) {
+ groupId = Artifact.DEFAULT_GROUP_ID;
}
- if (artifact.getVersion() == null) {
+ Version version = artifact.getVersion();
+ if (version == null) {
// check if we have any existing artifacts loaded
- Version version = resolveVersion(parentConfigurations, artifact.getGroupId(), artifact.getArtifactId(), artifact.getType());
+ version = resolveVersion(parentConfigurations, groupId, artifact.getArtifactId(), artifact.getType());
if (version == null) {
throw new MissingDependencyException("Unable to resolve dependency " + artifact);
}
- artifact.setVersion(version);
}
+
+ return new Artifact(groupId, artifact.getArtifactId(), version, artifact.getType());
}
private Version resolveVersion(Collection parentConfigurations, String groupId, String artifactId, String type) {
- List existingArtifacts = artifactManager.getLoadedArtifacts(groupId, artifactId, type);
+ SortedSet existingArtifacts;
+ if (artifactManager != null) {
+ existingArtifacts = artifactManager.getLoadedArtifacts(groupId, artifactId, type);
+ } else {
+ existingArtifacts = new TreeSet();
+ }
// if we have exactally one artifact loaded use it's version
if (existingArtifacts.size() == 1) {
- Artifact existingArtifact = ((Artifact) existingArtifacts.get(0));
+ Artifact existingArtifact = (Artifact) existingArtifacts.first();
return existingArtifact.getVersion();
}
// if we have no existing loaded artifacts grab the highest version from the repository
if (existingArtifacts.size() == 0) {
- List list = repository.list(groupId, artifactId, type);
- Collections.sort(list);
+ SortedSet list = (SortedSet) new ArrayList();
+ for (Iterator iterator = repositories.iterator(); iterator.hasNext();) {
+ ListableRepository repository = (ListableRepository) iterator.next();
+ list.addAll(repository.list(groupId, artifactId, type));
+ }
- Artifact repositoryArtifact = (Artifact) list.get(list.size() -1);
+ Artifact repositoryArtifact = (Artifact) list.last();
return repositoryArtifact.getVersion();
}
@@ -91,8 +113,7 @@
}
// it wasn't declared by the parent so just use the highest verstion already loaded
- Collections.sort(existingArtifacts);
- Artifact repositoryArtifact = (Artifact) existingArtifacts.get(existingArtifacts.size() -1);
+ Artifact repositoryArtifact = (Artifact) existingArtifacts.last();
return repositoryArtifact.getVersion();
}
@@ -145,4 +166,24 @@
return null;
}
+ public static final GBeanInfo GBEAN_INFO;
+
+ static {
+ GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(DefaultArtifactResolver.class);
+ infoFactory.addReference("ArtifactManager", ArtifactManager.class);
+ infoFactory.addReference("Repositories", Repository.class, "GBean");
+
+ infoFactory.setConstructor(new String[]{
+ "ArtifactManager",
+ "Repositories",
+ });
+
+ infoFactory.addInterface(ArtifactResolver.class);
+
+ GBEAN_INFO = infoFactory.getBeanInfo();
+ }
+
+ public static GBeanInfo getGBeanInfo() {
+ return GBEAN_INFO;
+ }
}
Modified: geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/repository/ListableRepository.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/repository/ListableRepository.java?rev=378670&r1=378669&r2=378670&view=diff
==============================================================================
--- geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/repository/ListableRepository.java (original)
+++ geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/repository/ListableRepository.java Fri Feb 17 16:57:30 2006
@@ -16,7 +16,7 @@
*/
package org.apache.geronimo.kernel.repository;
-import java.util.List;
+import java.util.SortedSet;
/**
* For repositories that can provide a list of their contents.
@@ -29,7 +29,7 @@
/**
* Gets a list of all the items available in the repository.
*/
- public List list();
+ public SortedSet list();
- public List list(String groupId, String artifactId, String type);
+ public SortedSet list(String groupId, String artifactId, String type);
}
Modified: geronimo/branches/configid/modules/kernel/src/test/org/apache/geronimo/kernel/ConfigTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/kernel/src/test/org/apache/geronimo/kernel/ConfigTest.java?rev=378670&r1=378669&r2=378670&view=diff
==============================================================================
--- geronimo/branches/configid/modules/kernel/src/test/org/apache/geronimo/kernel/ConfigTest.java (original)
+++ geronimo/branches/configid/modules/kernel/src/test/org/apache/geronimo/kernel/ConfigTest.java Fri Feb 17 16:57:30 2006
@@ -17,6 +17,9 @@
package org.apache.geronimo.kernel;
+import java.util.Collections;
+import javax.management.ObjectName;
+
import junit.framework.TestCase;
import org.apache.geronimo.gbean.GBeanData;
import org.apache.geronimo.kernel.config.Configuration;
@@ -24,11 +27,9 @@
import org.apache.geronimo.kernel.config.ManageableAttributeStore;
import org.apache.geronimo.kernel.management.State;
import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.kernel.repository.DefaultArtifactManager;
import org.apache.geronimo.kernel.repository.Environment;
-import javax.management.ObjectName;
-import java.util.Collections;
-
/**
* @version $Rev$ $Date$
*/
@@ -43,6 +44,8 @@
// load and start the config
kernel.loadGBean(config, this.getClass().getClassLoader());
kernel.startGBean(config.getName());
+ assertEquals(State.RUNNING_INDEX, kernel.getGBeanState(config.getName()));
+
kernel.invoke(config.getName(), "loadGBeans", new Object[] {null}, new String[] {ManageableAttributeStore.class.getName()});
kernel.invoke(config.getName(), "startRecursiveGBeans");
@@ -89,6 +92,8 @@
// load and start the config
kernel.loadGBean(config, this.getClass().getClassLoader());
kernel.startGBean(config.getName());
+ assertEquals(State.RUNNING_INDEX, kernel.getGBeanState(config.getName()));
+
kernel.invoke(config.getName(), "loadGBeans", new Object[] {null}, new String[] {ManageableAttributeStore.class.getName()});
kernel.invoke(config.getName(), "startRecursiveGBeans");
@@ -116,6 +121,7 @@
}
protected void setUp() throws Exception {
+ super.setUp();
kernel = KernelFactory.newInstance().createKernel("test");
kernel.boot();
@@ -124,6 +130,12 @@
kernel.loadGBean(configurationManagerData, getClass().getClassLoader());
kernel.startGBean(configurationManagerName);
+ ObjectName artifactManagerName = new ObjectName(":j2eeType=ArtifactManager");
+ GBeanData artifactManagerData = new GBeanData(artifactManagerName, DefaultArtifactManager.GBEAN_INFO);
+ kernel.loadGBean(artifactManagerData, getClass().getClassLoader());
+ kernel.startGBean(artifactManagerName);
+ assertEquals(State.RUNNING_INDEX, kernel.getGBeanState(artifactManagerName));
+
gbeanName1 = new ObjectName("geronimo.test:name=MyMockGMBean1");
GBeanData mockBean1 = new GBeanData(gbeanName1, MockGBean.getGBeanInfo());
mockBean1.setAttribute("value", "1234");
@@ -138,9 +150,9 @@
mockBean2.setReferencePatterns("MockEndpoint", Collections.singleton(gbeanName1));
mockBean2.setReferencePatterns("EndpointCollection", Collections.singleton(gbeanName1));
- byte[] state = Configuration.storeGBeans(new GBeanData[] {mockBean1, mockBean2});
+ byte[] state = Configuration.storeGBeans(new GBeanData[]{mockBean1, mockBean2});
- Artifact id = new Artifact("geronimo", "test", "1", "car", true);
+ Artifact id = new Artifact("geronimo", "test", "1", "car");
ObjectName configName = Configuration.getConfigurationObjectName(id);
// create the config gbean data
@@ -150,9 +162,11 @@
config.setAttribute("environment", environment);
config.setAttribute("gBeanState", state);
config.setName(configName);
+ config.setReferencePattern("ArtifactManager", artifactManagerName);
}
protected void tearDown() throws Exception {
kernel.shutdown();
+ super.tearDown();
}
}
Modified: geronimo/branches/configid/modules/kernel/src/test/org/apache/geronimo/kernel/config/MultiParentClassLoaderTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/kernel/src/test/org/apache/geronimo/kernel/config/MultiParentClassLoaderTest.java?rev=378670&r1=378669&r2=378670&view=diff
==============================================================================
--- geronimo/branches/configid/modules/kernel/src/test/org/apache/geronimo/kernel/config/MultiParentClassLoaderTest.java (original)
+++ geronimo/branches/configid/modules/kernel/src/test/org/apache/geronimo/kernel/config/MultiParentClassLoaderTest.java Fri Feb 17 16:57:30 2006
@@ -23,7 +23,6 @@
import java.io.FileOutputStream;
import java.net.URLClassLoader;
import java.net.URL;
-import java.net.URI;
import java.util.jar.JarFile;
import java.util.jar.JarOutputStream;
import java.util.jar.JarEntry;
@@ -36,7 +35,6 @@
import net.sf.cglib.core.Predicate;
import net.sf.cglib.core.DefaultGeneratorStrategy;
import org.apache.geronimo.kernel.repository.Artifact;
-import org.apache.geronimo.kernel.repository.Version;
/**
* @version $Rev$ $Date$
@@ -51,7 +49,7 @@
private URLClassLoader[] parents;
private File myFile;
private MultiParentClassLoader classLoader;
- private static final Artifact NAME = new Artifact("test", "fake", "1.0", "car", true);
+ private static final Artifact NAME = new Artifact("test", "fake", "1.0", "car");
/**
* Verify that the test jars are valid
Modified: geronimo/branches/configid/modules/naming-builder/src/test/org/apache/geronimo/naming/deployment/MessageDestinationTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/naming-builder/src/test/org/apache/geronimo/naming/deployment/MessageDestinationTest.java?rev=378670&r1=378669&r2=378670&view=diff
==============================================================================
--- geronimo/branches/configid/modules/naming-builder/src/test/org/apache/geronimo/naming/deployment/MessageDestinationTest.java (original)
+++ geronimo/branches/configid/modules/naming-builder/src/test/org/apache/geronimo/naming/deployment/MessageDestinationTest.java Fri Feb 17 16:57:30 2006
@@ -208,7 +208,7 @@
}
public Artifact getConfigID() {
- return new Artifact("groupId", "MockNamingContextID", "1", "car", true);
+ return new Artifact("groupId", "MockNamingContextID", "1", "car");
}
}
Modified: geronimo/branches/configid/modules/service-builder/src/java/org/apache/geronimo/deployment/service/EnvironmentBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/service-builder/src/java/org/apache/geronimo/deployment/service/EnvironmentBuilder.java?rev=378670&r1=378669&r2=378670&view=diff
==============================================================================
--- geronimo/branches/configid/modules/service-builder/src/java/org/apache/geronimo/deployment/service/EnvironmentBuilder.java (original)
+++ geronimo/branches/configid/modules/service-builder/src/java/org/apache/geronimo/deployment/service/EnvironmentBuilder.java Fri Feb 17 16:57:30 2006
@@ -75,9 +75,6 @@
for (int i = 0; i < dependencyArray.length; i++) {
ArtifactType artifactType = dependencyArray[i];
Artifact artifact = toArtifact(artifactType);
- if (artifact.getType() == null) {
- artifact.setType("jar");
- }
String type = artifact.getType();
if (type.equals("jar")) {
dependencies.add(artifact);
@@ -226,7 +223,7 @@
String type = artifactType.isSetType() ? artifactType.getType().trim() : "jar";
String artifactId = artifactType.getArtifactId().trim();
String version = artifactType.isSetVersion() ? artifactType.getVersion().trim() : null;
- return new Artifact(groupId, artifactId, version, type, false);
+ return new Artifact(groupId, artifactId, version, type);
}
Modified: geronimo/branches/configid/modules/system/src/java/org/apache/geronimo/system/repository/AbstractRepository.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/system/src/java/org/apache/geronimo/system/repository/AbstractRepository.java?rev=378670&r1=378669&r2=378670&view=diff
==============================================================================
--- geronimo/branches/configid/modules/system/src/java/org/apache/geronimo/system/repository/AbstractRepository.java (original)
+++ geronimo/branches/configid/modules/system/src/java/org/apache/geronimo/system/repository/AbstractRepository.java Fri Feb 17 16:57:30 2006
@@ -25,14 +25,12 @@
import java.io.InputStream;
import java.net.URI;
import java.net.URISyntaxException;
-import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.geronimo.kernel.repository.Artifact;
import org.apache.geronimo.kernel.repository.FileWriteMonitor;
import org.apache.geronimo.kernel.repository.WriteableRepository;
-import org.apache.geronimo.kernel.repository.ListableRepository;
import org.apache.geronimo.system.serverinfo.ServerInfo;
/**
@@ -90,10 +88,6 @@
File location = getLocation(artifact);
return location.isFile() && location.canRead();
}
-
- public abstract File getLocation(Artifact artifact);
-
- public abstract List list();
public void copyToRepository(File source, Artifact destination, FileWriteMonitor monitor) throws IOException {
if (!source.exists() || !source.canRead() || source.isDirectory()) {
Modified: geronimo/branches/configid/modules/system/src/java/org/apache/geronimo/system/repository/Maven1Repository.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/system/src/java/org/apache/geronimo/system/repository/Maven1Repository.java?rev=378670&r1=378669&r2=378670&view=diff
==============================================================================
--- geronimo/branches/configid/modules/system/src/java/org/apache/geronimo/system/repository/Maven1Repository.java (original)
+++ geronimo/branches/configid/modules/system/src/java/org/apache/geronimo/system/repository/Maven1Repository.java Fri Feb 17 16:57:30 2006
@@ -21,6 +21,8 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+import java.util.SortedSet;
+import java.util.TreeSet;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -50,8 +52,8 @@
return path;
}
- public List list(String groupId, String artifactId, String type) {
- List artifacts = new ArrayList();
+ public SortedSet list(String groupId, String artifactId, String type) {
+ SortedSet artifacts = new TreeSet();
File path = new File(rootFile, groupId);
path = new File(path, type + "s");
@@ -63,7 +65,7 @@
if (fileName.startsWith(artifactId + "-") && fileName.endsWith("." + type)) {
String version = fileName.substring(artifactId.length() + 1);
version = version.substring(0, version.length() - 1 - type.length());
- artifacts.add(new Artifact(groupId, artifactId, version, type, true));
+ artifacts.add(new Artifact(groupId, artifactId, version, type));
}
}
return artifacts;
@@ -72,9 +74,9 @@
//thanks to Brett Porter for this regex lifted from a maven1-2 porting tool
private static final Pattern MAVEN_1_PATTERN = Pattern.compile("(.+)/(.+)s/(.+)-([0-9].+)\\.([^0-9]+)");
- public List list() {
+ public SortedSet list() {
+ SortedSet artifacts = new TreeSet();
String[] names = getFiles(rootFile, "");
- List results = new ArrayList(names.length);
Matcher matcher = MAVEN_1_PATTERN.matcher("");
for (int i = 0; i < names.length; i++) {
matcher.reset(names[i]);
@@ -83,7 +85,7 @@
String artifactId = matcher.group(3);
String version = matcher.group(4);
String type = matcher.group(5);
- results.add(new Artifact(groupId, artifactId, version, type, true));
+ artifacts.add(new Artifact(groupId, artifactId, version, type));
} else {
log.warn("could not resolve URI for malformed repository entry: " + names[i] +
" - the filename should look like: <groupId>/<type>s/<artifactId>-<version>.<type> "+
@@ -91,7 +93,7 @@
}
}
- return results;
+ return artifacts;
}
public String[] getFiles(File base, String prefix) {
Modified: geronimo/branches/configid/modules/system/src/java/org/apache/geronimo/system/repository/Maven2Repository.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/system/src/java/org/apache/geronimo/system/repository/Maven2Repository.java?rev=378670&r1=378669&r2=378670&view=diff
==============================================================================
--- geronimo/branches/configid/modules/system/src/java/org/apache/geronimo/system/repository/Maven2Repository.java (original)
+++ geronimo/branches/configid/modules/system/src/java/org/apache/geronimo/system/repository/Maven2Repository.java Fri Feb 17 16:57:30 2006
@@ -20,6 +20,8 @@
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
+import java.util.SortedSet;
+import java.util.TreeSet;
import org.apache.geronimo.gbean.GBeanInfo;
import org.apache.geronimo.gbean.GBeanInfoBuilder;
@@ -48,8 +50,8 @@
return path;
}
- public List list() {
- List artifacts = new ArrayList();
+ public SortedSet list() {
+ SortedSet artifacts = new TreeSet();
File[] groupIds = rootFile.listFiles();
for (int i = 0; i < groupIds.length; i++) {
File groupId = groupIds[i];
@@ -66,11 +68,11 @@
return artifacts;
}
- public List list(String groupId, String artifactId, String type) {
+ public SortedSet list(String groupId, String artifactId, String type) {
File path = new File(rootFile, groupId.replace('.', File.separatorChar));
path = new File(path, artifactId);
- List artifacts = new ArrayList();
+ SortedSet artifacts = new TreeSet();
File[] versionDirs = path.listFiles();
for (int i = 0; i < versionDirs.length; i++) {
@@ -83,8 +85,8 @@
artifacts.add(new Artifact(groupId,
artifactId,
version,
- type,
- true));
+ type
+ ));
}
}
}
@@ -123,8 +125,8 @@
artifacts.add(new Artifact(groupId,
artifactId,
version,
- type,
- true));
+ type
+ ));
}
}
}
Modified: geronimo/branches/configid/modules/system/src/test/org/apache/geronimo/system/configuration/LocalConfigStoreTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/system/src/test/org/apache/geronimo/system/configuration/LocalConfigStoreTest.java?rev=378670&r1=378669&r2=378670&view=diff
==============================================================================
--- geronimo/branches/configid/modules/system/src/test/org/apache/geronimo/system/configuration/LocalConfigStoreTest.java (original)
+++ geronimo/branches/configid/modules/system/src/test/org/apache/geronimo/system/configuration/LocalConfigStoreTest.java Fri Feb 17 16:57:30 2006
@@ -105,7 +105,7 @@
kernel.startGBean(configurationManagerName);
configurationManager = (ConfigurationManager) kernel.getProxyManager().createProxy(configurationManagerName, ConfigurationManager.class);
- artifact = new Artifact("group", "test", "1", "car", true);
+ artifact = new Artifact("group", "test", "1", "car");
GBeanData gbean = new GBeanData(Configuration.getConfigurationObjectName(artifact), Configuration.GBEAN_INFO);
gbean.setAttribute("id", artifact);
gbean.setAttribute("gBeanState", state);
Modified: geronimo/branches/configid/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PlanProcessor.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PlanProcessor.java?rev=378670&r1=378669&r2=378670&view=diff
==============================================================================
--- geronimo/branches/configid/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PlanProcessor.java (original)
+++ geronimo/branches/configid/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PlanProcessor.java Fri Feb 17 16:57:30 2006
@@ -182,7 +182,7 @@
}
}
- org.apache.geronimo.kernel.repository.Artifact configId = new org.apache.geronimo.kernel.repository.Artifact(groupId, artifactId, version, "car", true);
+ org.apache.geronimo.kernel.repository.Artifact configId = new org.apache.geronimo.kernel.repository.Artifact(groupId, artifactId, version, "car");
Collection imports = toArtifacts(IMPORT_PROPERTY);
// Collection includes = toArtifacts(INCLUDE_PROPERTY);
@@ -240,7 +240,7 @@
if (type == null) {
type = "jar";
}
- artifactList.add(new org.apache.geronimo.kernel.repository.Artifact(groupId, artifactId, version, type, false));
+ artifactList.add(new org.apache.geronimo.kernel.repository.Artifact(groupId, artifactId, version, type));
}
}
return artifactList;