geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r377617 [1/2] - in /geronimo/branches/configid: applications/console-standard/src/java/org/apache/geronimo/console/configmanager/ applications/console-standard/src/java/org/apache/geronimo/console/databasemanager/wizard/ applications/consol...
Date Tue, 14 Feb 2006 04:51:03 GMT
Author: dain
Date: Mon Feb 13 20:50:59 2006
New Revision: 377617

URL: http://svn.apache.org/viewcvs?rev=377617&view=rev
Log:
Integrated new repository interface
Replaced all old repository implementations with either Maven1Repository or Maven2Repository

Added:
    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
Removed:
    geronimo/branches/configid/modules/system/src/java/org/apache/geronimo/system/repository/FileSystemRepository.java
    geronimo/branches/configid/modules/system/src/java/org/apache/geronimo/system/repository/ReadOnlyRepository.java
    geronimo/branches/configid/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenRepository.java
Modified:
    geronimo/branches/configid/applications/console-standard/src/java/org/apache/geronimo/console/configmanager/ConfigManagerPortlet.java
    geronimo/branches/configid/applications/console-standard/src/java/org/apache/geronimo/console/configmanager/DeploymentPortlet.java
    geronimo/branches/configid/applications/console-standard/src/java/org/apache/geronimo/console/databasemanager/wizard/DatabasePoolPortlet.java
    geronimo/branches/configid/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/activemqCF/ActiveMQConnectorHelper.java
    geronimo/branches/configid/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/handlers/CreateDestinationHandler.java
    geronimo/branches/configid/applications/console-standard/src/java/org/apache/geronimo/console/securitymanager/realm/SecurityRealmPortlet.java
    geronimo/branches/configid/configs/client-system/src/plan/plan.xml
    geronimo/branches/configid/configs/j2ee-system/src/plan/plan.xml
    geronimo/branches/configid/modules/client-builder/src/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java
    geronimo/branches/configid/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java
    geronimo/branches/configid/modules/deploy-tool/src/java/org/apache/geronimo/deployment/PluginBootstrap.java
    geronimo/branches/configid/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentContext.java
    geronimo/branches/configid/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java
    geronimo/branches/configid/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.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/ListableRepository.java
    geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/repository/Repository.java
    geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/repository/WriteableRepository.java
    geronimo/branches/configid/modules/service-builder/src/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java
    geronimo/branches/configid/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigurationDump.java
    geronimo/branches/configid/modules/system/src/java/org/apache/geronimo/system/repository/Maven2Repository.java
    geronimo/branches/configid/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
    geronimo/branches/configid/plugins/geronimo-assembly-plugin/src/java/org/apache/geronimo/plugin/assembly/BaseConfigInstaller.java
    geronimo/branches/configid/plugins/geronimo-assembly-plugin/src/java/org/apache/geronimo/plugin/assembly/LocalConfigInstaller.java
    geronimo/branches/configid/plugins/geronimo-assembly-plugin/src/java/org/apache/geronimo/plugin/assembly/RepoConfigInstaller.java
    geronimo/branches/configid/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenConfigStore.java
    geronimo/branches/configid/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilderShell.java

Modified: geronimo/branches/configid/applications/console-standard/src/java/org/apache/geronimo/console/configmanager/ConfigManagerPortlet.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/applications/console-standard/src/java/org/apache/geronimo/console/configmanager/ConfigManagerPortlet.java?rev=377617&r1=377616&r2=377617&view=diff
==============================================================================
--- geronimo/branches/configid/applications/console-standard/src/java/org/apache/geronimo/console/configmanager/ConfigManagerPortlet.java (original)
+++ geronimo/branches/configid/applications/console-standard/src/java/org/apache/geronimo/console/configmanager/ConfigManagerPortlet.java Mon Feb 13 20:50:59 2006
@@ -21,6 +21,7 @@
 import org.apache.geronimo.console.util.SecurityConstants;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.KernelRegistry;
+import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.config.Configuration;
 import org.apache.geronimo.kernel.config.ConfigurationInfo;
 import org.apache.geronimo.kernel.config.ConfigurationManager;
@@ -41,11 +42,11 @@
 import javax.portlet.WindowState;
 import java.io.IOException;
 import java.net.URI;
+import java.net.URISyntaxException;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Arrays;
 import java.util.Comparator;
 import java.util.Collections;
 
@@ -97,14 +98,14 @@
             ConfigurationManager configurationManager = ConfigurationUtil
                     .getConfigurationManager(kernel);
             String config = getConfigID(actionRequest);
-            URI configID = URI.create(config);
+            Artifact configID = Artifact.create(config);
 
             if (START_ACTION.equals(action)) {
-                List list = configurationManager.loadRecursive(configID);
-                for (Iterator it = list.iterator(); it.hasNext();) {
-                    URI uri = (URI) it.next();
-                    configurationManager.loadGBeans(uri);
-                    configurationManager.start(uri);
+                List ancestors = configurationManager.loadRecursive(configID);
+                for (Iterator it = ancestors.iterator(); it.hasNext();) {
+                    Artifact ancestor = (Artifact) it.next();
+                    configurationManager.loadGBeans(ancestor);
+                    configurationManager.start(ancestor);
                 }
                 messageStatus = "Started application<br /><br />";
             } else if (STOP_ACTION.equals(action)) {
@@ -147,13 +148,13 @@
         List configStores = configManager.listStores();
         int size = configStores.size();
         String configID = getConfigID(actionRequest);
-        URI configURI = URI.create(configID);
+        Artifact configURI = Artifact.create(configID);
         for (int i = 0; i < size; i++) {
             ObjectName configStore = (ObjectName) configStores.get(i);
             Boolean result = (Boolean) kernel.invoke(configStore,
                     CONTAINSCONFIG_METHOD,
                     new Object[]{configURI}, CONTAINSCONFIG_SIG);
-            if (result.booleanValue() == true) {
+            if (result.booleanValue()) {
                 // stop config if running
                 if (configManager.isLoaded(configURI)) {
                     int state = kernel.getGBeanState(Configuration.getConfigurationObjectName(configURI));
@@ -224,6 +225,8 @@
             } catch (NoSuchStoreException e) {
                 // we just got this list so this should not happen
                 // in the unlikely event it does, just continue
+            } catch (URISyntaxException e) {
+                throw new AssertionError(e);
             }
         }
         Collections.sort(configInfo, new Comparator() {

Modified: geronimo/branches/configid/applications/console-standard/src/java/org/apache/geronimo/console/configmanager/DeploymentPortlet.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/applications/console-standard/src/java/org/apache/geronimo/console/configmanager/DeploymentPortlet.java?rev=377617&r1=377616&r2=377617&view=diff
==============================================================================
--- geronimo/branches/configid/applications/console-standard/src/java/org/apache/geronimo/console/configmanager/DeploymentPortlet.java (original)
+++ geronimo/branches/configid/applications/console-standard/src/java/org/apache/geronimo/console/configmanager/DeploymentPortlet.java Mon Feb 13 20:50:59 2006
@@ -19,7 +19,6 @@
 
 import java.io.File;
 import java.io.IOException;
-import java.net.URI;
 import java.util.Iterator;
 import java.util.List;
 import javax.portlet.ActionRequest;
@@ -39,6 +38,7 @@
 import org.apache.geronimo.console.util.ObjectNameConstants;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.KernelRegistry;
+import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.config.ConfigurationManager;
 import org.apache.geronimo.kernel.config.ConfigurationUtil;
 
@@ -118,7 +118,7 @@
                 ConfigurationManager configurationManager = ConfigurationUtil
                         .getConfigurationManager(kernel);
                 for (Iterator iterator = list.iterator(); iterator.hasNext();) {
-                    URI configID = URI.create((String)iterator.next());
+                    Artifact configID = Artifact.create((String)iterator.next());
                     if (!configurationManager.isLoaded(configID)) {
                         configurationManager.load(configID);
                     }

Modified: geronimo/branches/configid/applications/console-standard/src/java/org/apache/geronimo/console/databasemanager/wizard/DatabasePoolPortlet.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/applications/console-standard/src/java/org/apache/geronimo/console/databasemanager/wizard/DatabasePoolPortlet.java?rev=377617&r1=377616&r2=377617&view=diff
==============================================================================
--- geronimo/branches/configid/applications/console-standard/src/java/org/apache/geronimo/console/databasemanager/wizard/DatabasePoolPortlet.java (original)
+++ geronimo/branches/configid/applications/console-standard/src/java/org/apache/geronimo/console/databasemanager/wizard/DatabasePoolPortlet.java Mon Feb 13 20:50:59 2006
@@ -75,6 +75,8 @@
 import org.apache.geronimo.kernel.management.State;
 import org.apache.geronimo.kernel.proxy.GeronimoManagedBean;
 import org.apache.geronimo.deployment.tools.loader.ConnectorDeployable;
+import org.apache.geronimo.deployment.xbeans.EnvironmentType;
+import org.apache.geronimo.deployment.xbeans.ArtifactType;
 import org.apache.geronimo.connector.deployment.jsr88.Connector15DCBRoot;
 import org.apache.geronimo.connector.deployment.jsr88.ConnectorDCB;
 import org.apache.geronimo.connector.deployment.jsr88.Artifact;
@@ -743,26 +745,22 @@
         ListableRepository[] repos = PortletManager.getListableRepositories(renderRequest);
         for (int i = 0; i < repos.length; i++) {
             ListableRepository repo = repos[i];
-            try {
-                final URI[] uris = repo.listURIs();
-                outer:
-                for (int j = 0; j < uris.length; j++) {
-                    if(uris[j] == null) {
-                        continue; // probably a JAR lacks a version number in the name, etc.
-                    }
-                    String test = uris[j].toString();
-                    for (int k = 0; k < SKIP_ENTRIES_WITH.length; k++) {
-                        String skip = SKIP_ENTRIES_WITH[k];
-                        if(test.indexOf(skip) > -1) {
-                            continue outer;
-                        }
+
+            List artifacts = repo.list();
+            outer:
+            for (Iterator iterator = artifacts.iterator(); iterator.hasNext();) {
+                Artifact artifact = (Artifact) iterator.next();
+                String test = artifact.toString();
+                // todo should only test groupId and should check for long (org.apache.geronimo) and short form
+                for (int k = 0; k < SKIP_ENTRIES_WITH.length; k++) {
+                    String skip = SKIP_ENTRIES_WITH[k];
+                    if(test.indexOf(skip) > -1) {
+                        continue outer;
                     }
-                    list.add(test);
                 }
-            } catch (URISyntaxException e) {
-                e.printStackTrace();
+                list.add(test);
             }
-        }
+    }
         Collections.sort(list);
         renderRequest.setAttribute("jars", list);
     }

Modified: geronimo/branches/configid/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/activemqCF/ActiveMQConnectorHelper.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/activemqCF/ActiveMQConnectorHelper.java?rev=377617&r1=377616&r2=377617&view=diff
==============================================================================
--- geronimo/branches/configid/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/activemqCF/ActiveMQConnectorHelper.java (original)
+++ geronimo/branches/configid/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/activemqCF/ActiveMQConnectorHelper.java Mon Feb 13 20:50:59 2006
@@ -17,30 +17,30 @@
 
 package org.apache.geronimo.console.jmsmanager.activemqCF;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.geronimo.common.DeploymentException;
-import org.apache.geronimo.console.util.ObjectNameConstants;
-import org.apache.geronimo.console.util.PortletManager;
-import org.apache.geronimo.kernel.Kernel;
-import org.apache.geronimo.kernel.KernelRegistry;
-import org.apache.geronimo.kernel.config.ConfigurationManager;
-import org.apache.geronimo.kernel.config.ConfigurationUtil;
-import org.apache.geronimo.kernel.repository.ListableRepository;
-
-import javax.portlet.PortletRequest;
 import java.io.BufferedWriter;
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.OutputStreamWriter;
 import java.io.Writer;
-import java.net.URI;
 import java.net.URISyntaxException;
 import java.text.MessageFormat;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
+import javax.portlet.PortletRequest;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.common.DeploymentException;
+import org.apache.geronimo.console.util.ObjectNameConstants;
+import org.apache.geronimo.console.util.PortletManager;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.KernelRegistry;
+import org.apache.geronimo.kernel.config.ConfigurationManager;
+import org.apache.geronimo.kernel.config.ConfigurationUtil;
+import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.kernel.repository.ListableRepository;
 
 public class ActiveMQConnectorHelper {
     //todo: this class is horrible and needs to be burned!
@@ -149,7 +149,7 @@
             ConfigurationManager configurationManager = ConfigurationUtil
                     .getConfigurationManager(kernel);
             for (Iterator iterator = list.iterator(); iterator.hasNext();) {
-                URI configID = URI.create((String)iterator.next());
+                Artifact configID = Artifact.create((String)iterator.next());
                 if (!configurationManager.isLoaded(configID)) {
                     configurationManager.load(configID);
                 }
@@ -184,14 +184,10 @@
         List dependencies = new ArrayList();
         for (int i = 0; i < repo.length; i++) {
             ListableRepository repository = repo[i];
-            try {
-                URI[] uris = repository.listURIs();
-                for (int j = 0; j < uris.length; j++) {
-                    URI uri = uris[j];
-                    dependencies.add(uri.toString());
-                }
-            } catch (URISyntaxException e) {
-                e.printStackTrace();
+            List artifacts = repository.list();
+            for (Iterator iterator = artifacts.iterator(); iterator.hasNext();) {
+                Artifact artifact = (Artifact) iterator.next();
+                dependencies.add(artifact.toString());
             }
         }
 

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=377617&r1=377616&r2=377617&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 Mon Feb 13 20:50:59 2006
@@ -33,6 +33,8 @@
 import org.apache.geronimo.kernel.config.ConfigurationManager;
 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 javax.jms.Queue;
 import javax.jms.Topic;
@@ -101,7 +103,11 @@
             adminObjectData.setAttribute("PhysicalName",
                     destinationPhysicalName);
 
-            URI configId = new URI(BASE_CONFIG_URI + destinationName);
+            Artifact configId = new Artifact();
+            configId.setGroupId(Artifact.DEFAULT_GROUP_ID);
+            configId.setArtifactId(BASE_CONFIG_URI + destinationName);
+            configId.setVersion(new Version("0"));
+            configId.setType("car");
 
             ConfigurationManager configurationManager = ConfigurationUtil
                     .getConfigurationManager(kernel);

Modified: geronimo/branches/configid/applications/console-standard/src/java/org/apache/geronimo/console/securitymanager/realm/SecurityRealmPortlet.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/applications/console-standard/src/java/org/apache/geronimo/console/securitymanager/realm/SecurityRealmPortlet.java?rev=377617&r1=377616&r2=377617&view=diff
==============================================================================
--- geronimo/branches/configid/applications/console-standard/src/java/org/apache/geronimo/console/securitymanager/realm/SecurityRealmPortlet.java (original)
+++ geronimo/branches/configid/applications/console-standard/src/java/org/apache/geronimo/console/securitymanager/realm/SecurityRealmPortlet.java Mon Feb 13 20:50:59 2006
@@ -16,21 +16,20 @@
  */
 package org.apache.geronimo.console.securitymanager.realm;
 
+import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileWriter;
 import java.io.IOException;
 import java.io.PrintWriter;
 import java.io.Serializable;
+import java.io.StringReader;
 import java.io.StringWriter;
 import java.io.Writer;
-import java.io.BufferedReader;
-import java.io.StringReader;
 import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URISyntaxException;
 import java.net.URL;
 import java.net.URLClassLoader;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -39,7 +38,6 @@
 import java.util.Map;
 import java.util.Properties;
 import java.util.Set;
-import java.util.Arrays;
 import javax.enterprise.deploy.spi.DeploymentManager;
 import javax.enterprise.deploy.spi.Target;
 import javax.enterprise.deploy.spi.TargetModuleID;
@@ -58,33 +56,37 @@
 import javax.portlet.WindowState;
 import javax.security.auth.Subject;
 import javax.security.auth.spi.LoginModule;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.geronimo.console.BasePortlet;
 import org.apache.geronimo.console.util.PortletManager;
+import org.apache.geronimo.deployment.xbeans.ArtifactType;
 import org.apache.geronimo.deployment.xbeans.AttributeType;
+import org.apache.geronimo.deployment.xbeans.ClassloaderType;
 import org.apache.geronimo.deployment.xbeans.ConfigurationDocument;
 import org.apache.geronimo.deployment.xbeans.ConfigurationType;
-import org.apache.geronimo.deployment.xbeans.DependencyType;
+import org.apache.geronimo.deployment.xbeans.EnvironmentType;
 import org.apache.geronimo.deployment.xbeans.GbeanType;
 import org.apache.geronimo.deployment.xbeans.ReferenceType;
 import org.apache.geronimo.deployment.xbeans.XmlAttributeType;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.kernel.management.State;
 import org.apache.geronimo.kernel.proxy.GeronimoManagedBean;
+import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.ListableRepository;
+import org.apache.geronimo.management.geronimo.JCAManagedConnectionFactory;
+import org.apache.geronimo.security.jaas.JaasLoginModuleChain;
+import org.apache.geronimo.security.jaas.LoginModuleSettings;
 import org.apache.geronimo.security.realm.SecurityRealm;
 import org.apache.geronimo.security.realm.providers.FileAuditLoginModule;
 import org.apache.geronimo.security.realm.providers.GeronimoPasswordCredentialLoginModule;
 import org.apache.geronimo.security.realm.providers.RepeatedFailureLockoutLoginModule;
-import org.apache.geronimo.security.jaas.JaasLoginModuleChain;
-import org.apache.geronimo.security.jaas.LoginModuleSettings;
 import org.apache.geronimo.xbeans.geronimo.loginconfig.GerControlFlagType;
 import org.apache.geronimo.xbeans.geronimo.loginconfig.GerLoginConfigDocument;
 import org.apache.geronimo.xbeans.geronimo.loginconfig.GerLoginConfigType;
 import org.apache.geronimo.xbeans.geronimo.loginconfig.GerLoginModuleType;
 import org.apache.geronimo.xbeans.geronimo.loginconfig.GerOptionType;
-import org.apache.geronimo.management.geronimo.JCAManagedConnectionFactory;
 import org.apache.xmlbeans.XmlCursor;
 import org.apache.xmlbeans.XmlObject;
 import org.apache.xmlbeans.XmlOptions;
@@ -271,18 +273,16 @@
         ClassLoader loader = getClass().getClassLoader();
         if(data.jar != null && !data.jar.equals("")) {
             try {
-                URI one = new URI(data.getJar());
+                Artifact one = Artifact.create(data.getJar());
                 ListableRepository[] repos = PortletManager.getListableRepositories(request);
                 for (int i = 0; i < repos.length; i++) {
                     ListableRepository repo = repos[i];
-                    URL url = repo.getURL(one);
-                    if(url != null) {
-                        loader = new URLClassLoader(new URL[]{url}, loader);
+                    File file = repo.getLocation(one);
+                    if(file != null) {
+                        loader = new URLClassLoader(new URL[]{file.toURL()}, loader);
                         break;
                     }
                 }
-            } catch (URISyntaxException e) {
-                log.warn("Unable to construct JAR file reference", e);
             } catch (MalformedURLException e) {
                 log.warn("Repository unable to look up JAR file", e);
             }
@@ -317,12 +317,21 @@
         normalize(data);
         ConfigurationDocument doc = ConfigurationDocument.Factory.newInstance();
         ConfigurationType root = doc.addNewConfiguration();
-        root.setConfigId("SecurityRealm-"+data.getName());
+        EnvironmentType environment = root.addNewEnvironment();
+        ArtifactType configId = environment.addNewConfigId();
+        configId.setGroupId(Artifact.DEFAULT_GROUP_ID);
+        configId.setArtifactId(data.getName());
+
         // Use a parentId of null to pick up the default
         // Dependencies
         if(data.getJar() != null) {
-            DependencyType jar = root.addNewDependency();
-            jar.setUri(data.getJar());
+            ClassloaderType classloaderType = environment.addNewClassloader();
+            ArtifactType artifactType = classloaderType.addNewDependency();
+            Artifact artifact = Artifact.create(data.getJar());
+            artifactType.setGroupId(artifact.getGroupId());
+            artifactType.setArtifactId(artifact.getArtifactId());
+            artifactType.setVersion(artifact.getVersion().toString());
+            artifactType.setType(artifact.getType());
         }
         // Build the realm GBean
         GbeanType realm = root.addNewGbean();
@@ -378,8 +387,20 @@
                             final String testApp = objectName.getKeyProperty(NameFactory.J2EE_APPLICATION);
                             if(testName.equals(poolName) && testApp.equals(appName)) {
                                 String moduleName = objectName.getKeyProperty(NameFactory.JCA_RESOURCE);
-                                DependencyType imp = root.addNewImport();
-                                imp.setUri(moduleName);
+
+                                ClassloaderType classloader;
+                                if (environment.isSetClassloader()) {
+                                    classloader = environment.getClassloader();
+                                } else {
+                                    classloader = environment.addNewClassloader();
+                                }
+
+                                ArtifactType artifactType = classloader.addNewImport();
+                                Artifact artifact = Artifact.create(moduleName);
+                                artifactType.setGroupId(artifact.getGroupId());
+                                artifactType.setArtifactId(artifact.getArtifactId());
+                                artifactType.setVersion(artifact.getVersion().toString());
+                                artifactType.setType(artifact.getType());
                                 break;
                             }
                         } catch (MalformedObjectNameException e) {
@@ -603,24 +624,20 @@
         ListableRepository[] repos = PortletManager.getListableRepositories(renderRequest);
         for (int i = 0; i < repos.length; i++) {
             ListableRepository repo = repos[i];
-            try {
-                final URI[] uris = repo.listURIs();
-                outer:
-                for (int j = 0; j < uris.length; j++) {
-                    if(uris[j] == null) {
-                        continue; // probably a JAR lacks a version number in the name, etc.
-                    }
-                    String test = uris[j].toString();
-                    for (int k = 0; k < SKIP_ENTRIES_WITH.length; k++) {
-                        String skip = SKIP_ENTRIES_WITH[k];
-                        if(test.indexOf(skip) > -1) {
-                            continue outer;
-                        }
+
+            List artifacts = repo.list();
+            outer:
+            for (Iterator iterator = artifacts.iterator(); iterator.hasNext();) {
+                Artifact artifact = (Artifact) iterator.next();
+                String test = artifact.toString();
+                // todo should only test groupId and should check for long (org.apache.geronimo) and short form
+                for (int k = 0; k < SKIP_ENTRIES_WITH.length; k++) {
+                    String skip = SKIP_ENTRIES_WITH[k];
+                    if(test.indexOf(skip) > -1) {
+                        continue outer;
                     }
-                    list.add(test);
                 }
-            } catch (URISyntaxException e) {
-                e.printStackTrace();
+                list.add(test);
             }
         }
         Collections.sort(list);

Modified: geronimo/branches/configid/configs/client-system/src/plan/plan.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/configs/client-system/src/plan/plan.xml?rev=377617&r1=377616&r2=377617&view=diff
==============================================================================
--- geronimo/branches/configid/configs/client-system/src/plan/plan.xml (original)
+++ geronimo/branches/configid/configs/client-system/src/plan/plan.xml Mon Feb 13 20:50:59 2006
@@ -69,7 +69,7 @@
     </gbean>
 
     <!-- Repository -->
-    <gbean name="Repository" class="org.apache.geronimo.system.repository.ReadOnlyRepository">
+    <gbean name="Repository" class="org.apache.geronimo.system.repository.Maven2Repository">
         <attribute name="root">repository/</attribute>
         <reference name="ServerInfo">
             <name>ServerInfo</name>

Modified: geronimo/branches/configid/configs/j2ee-system/src/plan/plan.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/configs/j2ee-system/src/plan/plan.xml?rev=377617&r1=377616&r2=377617&view=diff
==============================================================================
--- geronimo/branches/configid/configs/j2ee-system/src/plan/plan.xml (original)
+++ geronimo/branches/configid/configs/j2ee-system/src/plan/plan.xml Mon Feb 13 20:50:59 2006
@@ -67,7 +67,7 @@
     </gbean>
 
     <!-- Repository -->
-    <gbean name="Repository" class="org.apache.geronimo.system.repository.FileSystemRepository">
+    <gbean name="Repository" class="org.apache.geronimo.system.repository.Maven2Repository">
         <attribute name="root">repository/</attribute>
         <reference name="ServerInfo">
             <name>ServerInfo</name>

Modified: geronimo/branches/configid/modules/client-builder/src/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/client-builder/src/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java?rev=377617&r1=377616&r2=377617&view=diff
==============================================================================
--- geronimo/branches/configid/modules/client-builder/src/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java (original)
+++ geronimo/branches/configid/modules/client-builder/src/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java Mon Feb 13 20:50:59 2006
@@ -18,11 +18,9 @@
 
 import java.io.File;
 import java.io.IOException;
-import java.net.MalformedURLException;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.net.URL;
-import java.net.URLDecoder;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -36,19 +34,18 @@
 import javax.management.MalformedObjectNameException;
 import javax.management.ObjectName;
 
-
 import org.apache.geronimo.client.AppClientContainer;
 import org.apache.geronimo.client.StaticJndiContextPlugin;
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.deployment.DeploymentContext;
 import org.apache.geronimo.deployment.Environment;
-import org.apache.geronimo.deployment.xmlbeans.XmlBeansUtil;
-import org.apache.geronimo.deployment.service.ServiceConfigBuilder;
 import org.apache.geronimo.deployment.service.EnvironmentBuilder;
+import org.apache.geronimo.deployment.service.ServiceConfigBuilder;
 import org.apache.geronimo.deployment.util.DeploymentUtil;
 import org.apache.geronimo.deployment.util.NestedJarFile;
-import org.apache.geronimo.deployment.xbeans.GbeanType;
 import org.apache.geronimo.deployment.xbeans.EnvironmentType;
+import org.apache.geronimo.deployment.xbeans.GbeanType;
+import org.apache.geronimo.deployment.xmlbeans.XmlBeansUtil;
 import org.apache.geronimo.gbean.GBeanData;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
@@ -68,8 +65,8 @@
 import org.apache.geronimo.kernel.config.ConfigurationData;
 import org.apache.geronimo.kernel.config.ConfigurationModuleType;
 import org.apache.geronimo.kernel.config.ConfigurationStore;
-import org.apache.geronimo.kernel.repository.Repository;
 import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.kernel.repository.Repository;
 import org.apache.geronimo.naming.deployment.ENCConfigBuilder;
 import org.apache.geronimo.schema.SchemaConversionUtils;
 import org.apache.geronimo.security.deploy.DefaultPrincipal;
@@ -118,7 +115,7 @@
                                   ServiceReferenceBuilder serviceReferenceBuilder,
                                   ConfigurationStore store,
                                   Repository repository,
-                                  Kernel kernel) throws DeploymentException {
+                                  Kernel kernel) {
         this.defaultClientEnvironment = defaultClientEnvironment;
         this.defaultServerEnvironment = defaultServerEnvironment;
         this.corbaGBeanObjectName = corbaGBeanObjectName;
@@ -377,23 +374,13 @@
                             JarFile connectorFile;
                             if (resource.isSetExternalRar()) {
                                 path = resource.getExternalRar().trim();
-                                URI pathURI = null;
-                                try {
-                                    pathURI = new URI(path);
-                                } catch (URISyntaxException e) {
-                                    throw new DeploymentException("Bad path to external rar", e);
-                                }
-                                if (!repository.hasURI(pathURI)) {
+                                Artifact artifact = Artifact.create(path);
+                                if (!repository.contains(artifact)) {
                                     throw new DeploymentException("Missing rar in repository: " + path);
                                 }
-                                URL pathURL = null;
-                                try {
-                                    pathURL = repository.getURL(pathURI);
-                                } catch (MalformedURLException e) {
-                                    throw new DeploymentException("Could not locate external rar in repository", e);
-                                }
+                                File file = repository.getLocation(artifact);
                                 try {
-                                    connectorFile = new JarFile(URLDecoder.decode(pathURL.getFile(), "UTF-8"));
+                                    connectorFile = new JarFile(file);
                                 } catch (IOException e) {
                                     throw new DeploymentException("Could not access rar contents", e);
                                 }

Modified: geronimo/branches/configid/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java?rev=377617&r1=377616&r2=377617&view=diff
==============================================================================
--- geronimo/branches/configid/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java (original)
+++ geronimo/branches/configid/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java Mon Feb 13 20:50:59 2006
@@ -92,12 +92,11 @@
     private int defaultidleTimeoutMinutes = 15;
     private Environment defaultEnvironment;
     private Repository repository = new Repository() {
-
-        public boolean hasURI(URI uri) {
+        public boolean contains(Artifact artifact) {
             return false;
         }
 
-        public URL getURL(URI uri) {
+        public File getLocation(Artifact artifact) {
             return null;
         }
     };

Modified: geronimo/branches/configid/modules/deploy-tool/src/java/org/apache/geronimo/deployment/PluginBootstrap.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/deploy-tool/src/java/org/apache/geronimo/deployment/PluginBootstrap.java?rev=377617&r1=377616&r2=377617&view=diff
==============================================================================
--- geronimo/branches/configid/modules/deploy-tool/src/java/org/apache/geronimo/deployment/PluginBootstrap.java (original)
+++ geronimo/branches/configid/modules/deploy-tool/src/java/org/apache/geronimo/deployment/PluginBootstrap.java Mon Feb 13 20:50:59 2006
@@ -25,7 +25,7 @@
 import org.apache.geronimo.deployment.xbeans.ConfigurationType;
 import org.apache.geronimo.kernel.config.ConfigurationData;
 import org.apache.geronimo.system.configuration.ExecutableConfigurationUtil;
-import org.apache.geronimo.system.repository.ReadOnlyRepository;
+import org.apache.geronimo.system.repository.Maven1Repository;
 
 /**
  * @version $Rev$ $Date$
@@ -55,7 +55,7 @@
     public void bootstrap() throws Exception {
         ConfigurationType config = ConfigurationDocument.Factory.parse(plan).getConfiguration();
 
-        ReadOnlyRepository repository = new ReadOnlyRepository(localRepo);
+        Maven1Repository repository = new Maven1Repository(localRepo);
         ServiceConfigBuilder builder = new ServiceConfigBuilder(null, repository);
         ConfigurationData configurationData = builder.buildConfiguration(config, null, buildDir);
 

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=377617&r1=377616&r2=377617&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 Mon Feb 13 20:50:59 2006
@@ -608,8 +608,8 @@
         try {
             int index = 0;
             for (Iterator iterator = dependencies.iterator(); iterator.hasNext();) {
-                URI uri = (URI) iterator.next();
-                urls[index++] = repository.getURL(uri);
+                Artifact artifact = (Artifact) iterator.next();
+                urls[index++] = repository.getLocation(artifact).toURL();
             }
 
             for (Iterator i = classPath.iterator(); i.hasNext();) {

Modified: geronimo/branches/configid/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java?rev=377617&r1=377616&r2=377617&view=diff
==============================================================================
--- geronimo/branches/configid/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java (original)
+++ geronimo/branches/configid/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java Mon Feb 13 20:50:59 2006
@@ -22,8 +22,6 @@
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.net.URL;
-import java.net.URLDecoder;
-import java.util.Arrays;
 import java.util.Collections;
 import java.util.Enumeration;
 import java.util.HashMap;
@@ -34,7 +32,6 @@
 import java.util.Set;
 import java.util.jar.JarFile;
 import java.util.zip.ZipEntry;
-
 import javax.management.MalformedObjectNameException;
 import javax.management.ObjectName;
 import javax.xml.namespace.QName;
@@ -42,13 +39,13 @@
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.deployment.ConfigurationBuilder;
 import org.apache.geronimo.deployment.Environment;
-import org.apache.geronimo.deployment.service.ServiceConfigBuilder;
 import org.apache.geronimo.deployment.service.EnvironmentBuilder;
+import org.apache.geronimo.deployment.service.ServiceConfigBuilder;
 import org.apache.geronimo.deployment.util.DeploymentUtil;
 import org.apache.geronimo.deployment.util.NestedJarFile;
 import org.apache.geronimo.deployment.xbeans.ArtifactType;
-import org.apache.geronimo.deployment.xbeans.GbeanType;
 import org.apache.geronimo.deployment.xbeans.EnvironmentType;
+import org.apache.geronimo.deployment.xbeans.GbeanType;
 import org.apache.geronimo.deployment.xmlbeans.XmlBeansUtil;
 import org.apache.geronimo.gbean.GBeanData;
 import org.apache.geronimo.gbean.GBeanInfo;
@@ -59,8 +56,8 @@
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.config.ConfigurationData;
 import org.apache.geronimo.kernel.config.ConfigurationModuleType;
-import org.apache.geronimo.kernel.repository.Repository;
 import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.kernel.repository.Repository;
 import org.apache.geronimo.schema.SchemaConversionUtils;
 import org.apache.geronimo.security.deployment.SecurityBuilder;
 import org.apache.geronimo.security.deployment.SecurityConfiguration;
@@ -600,23 +597,13 @@
                     }
                 } else {
                     String path = gerExtModule.getExternalPath().trim();
-                    URI pathURI = null;
-                    try {
-                        pathURI = new URI(path);
-                    } catch (URISyntaxException e) {
-                        throw new DeploymentException("Bad path to external module, " + moduleTypeName, e);
-                    }
-                    if (!repository.hasURI(pathURI)) {
+                    Artifact artifact = Artifact.create(path);
+                    if (!repository.contains(artifact)) {
                         throw new DeploymentException(moduleTypeName + " is missing in repository: " + path);
                     }
-                    URL pathURL = null;
-                    try {
-                        pathURL = repository.getURL(pathURI);
-                    } catch (MalformedURLException e) {
-                        throw new DeploymentException("Could not locate " + moduleTypeName + " in repository", e);
-                    }
+                    File location = repository.getLocation(artifact);
                     try {
-                        moduleFile = new JarFile(URLDecoder.decode(pathURL.getFile(), "UTF-8"));
+                        moduleFile = new JarFile(location);
                     } catch (IOException e) {
                         throw new DeploymentException("Could not access contents of " + moduleTypeName, e);
                     }

Modified: geronimo/branches/configid/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java?rev=377617&r1=377616&r2=377617&view=diff
==============================================================================
--- geronimo/branches/configid/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java (original)
+++ geronimo/branches/configid/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java Mon Feb 13 20:50:59 2006
@@ -17,18 +17,50 @@
 
 package org.apache.geronimo.jetty.deployment;
 
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.security.Permission;
+import java.security.PermissionCollection;
+import java.security.Permissions;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
+import java.util.jar.JarFile;
+import java.util.zip.ZipEntry;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import javax.security.jacc.WebResourcePermission;
+import javax.security.jacc.WebRoleRefPermission;
+import javax.security.jacc.WebUserDataPermission;
+import javax.servlet.Servlet;
+import javax.transaction.UserTransaction;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.geronimo.common.DeploymentException;
-import org.apache.geronimo.deployment.service.ServiceConfigBuilder;
+import org.apache.geronimo.deployment.Environment;
 import org.apache.geronimo.deployment.service.EnvironmentBuilder;
+import org.apache.geronimo.deployment.service.ServiceConfigBuilder;
 import org.apache.geronimo.deployment.util.DeploymentUtil;
-import org.apache.geronimo.deployment.xbeans.ClassFilterType;
-import org.apache.geronimo.deployment.xbeans.GbeanType;
-import org.apache.geronimo.deployment.xbeans.EnvironmentType;
 import org.apache.geronimo.deployment.xbeans.ArtifactType;
+import org.apache.geronimo.deployment.xbeans.EnvironmentType;
+import org.apache.geronimo.deployment.xbeans.GbeanType;
 import org.apache.geronimo.deployment.xmlbeans.XmlBeansUtil;
-import org.apache.geronimo.deployment.Environment;
 import org.apache.geronimo.gbean.GBeanData;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
@@ -48,7 +80,6 @@
 import org.apache.geronimo.kernel.GBeanNotFoundException;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.repository.Repository;
-import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.naming.deployment.ENCConfigBuilder;
 import org.apache.geronimo.naming.deployment.GBeanResourceEnvironmentBuilder;
 import org.apache.geronimo.schema.SchemaConversionUtils;
@@ -96,40 +127,6 @@
 import org.mortbay.http.ClientCertAuthenticator;
 import org.mortbay.http.DigestAuthenticator;
 import org.mortbay.jetty.servlet.FormAuthenticator;
-
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-import javax.security.jacc.WebResourcePermission;
-import javax.security.jacc.WebRoleRefPermission;
-import javax.security.jacc.WebUserDataPermission;
-import javax.servlet.Servlet;
-import javax.transaction.UserTransaction;
-import java.io.File;
-import java.io.FileFilter;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.security.Permission;
-import java.security.PermissionCollection;
-import java.security.Permissions;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
-import java.util.jar.JarFile;
-import java.util.zip.ZipEntry;
 
 
 /**

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=377617&r1=377616&r2=377617&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 Mon Feb 13 20:50:59 2006
@@ -23,6 +23,7 @@
 import java.io.IOException;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
+import java.io.File;
 import java.net.MalformedURLException;
 import java.net.URI;
 import java.net.URISyntaxException;
@@ -374,19 +375,19 @@
         URL[] urls = new URL[dependencies.size() + classPath.size()];
         int idx = 0;
         for (Iterator i = dependencies.iterator(); i.hasNext();) {
-            URI uri = (URI) i.next();
-            URL url = null;
+            Artifact artifact = (Artifact) i.next();
+            File file = null;
             for (Iterator j = repositories.iterator(); j.hasNext();) {
                 Repository repository = (Repository) j.next();
-                if (repository.hasURI(uri)) {
-                    url = repository.getURL(uri);
+                if (repository.contains(artifact)) {
+                    file = repository.getLocation(artifact);
                     break;
                 }
             }
-            if (url == null) {
-                throw new MissingDependencyException("Unable to resolve dependency " + uri);
+            if (file == null) {
+                throw new MissingDependencyException("Unable to resolve dependency " + artifact);
             }
-            urls[idx++] = url;
+            urls[idx++] = file.toURL();
         }
         for (Iterator i = classPath.iterator(); i.hasNext();) {
             URI uri = (URI) i.next();

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=377617&r1=377616&r2=377617&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 Mon Feb 13 20:50:59 2006
@@ -20,11 +20,16 @@
 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 {
+    public static final String DEFAULT_GROUP_ID = "Unspecified";
     private String groupId;
     private String artifactId;
     private Version version;
@@ -129,5 +134,5 @@
     public String toString() {
         return groupId + "/" + artifactId + "/" + version + "/" + type;
     }
-    
+
 }

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=377617&r1=377616&r2=377617&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 Mon Feb 13 20:50:59 2006
@@ -16,8 +16,7 @@
  */
 package org.apache.geronimo.kernel.repository;
 
-import java.net.URI;
-import java.net.URISyntaxException;
+import java.util.List;
 
 /**
  * For repositories that can provide a list of their contents.
@@ -29,6 +28,6 @@
 public interface ListableRepository extends Repository {
     /**
      * Gets a list of all the items available in the repository.
-     */ 
-    public URI[] listURIs() throws URISyntaxException;
+     */
+    public List list();
 }

Modified: geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/repository/Repository.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/repository/Repository.java?rev=377617&r1=377616&r2=377617&view=diff
==============================================================================
--- geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/repository/Repository.java (original)
+++ geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/repository/Repository.java Mon Feb 13 20:50:59 2006
@@ -20,6 +20,7 @@
 import java.net.MalformedURLException;
 import java.net.URI;
 import java.net.URL;
+import java.io.File;
 
 /**
  * Provides access to things like JARs via a standard API.  Generally
@@ -31,7 +32,7 @@
  * @version $Rev$ $Date$
  */
 public interface Repository {
-    boolean hasURI(URI uri);
+    boolean contains(Artifact artifact);
 
-    URL getURL(URI uri) throws MalformedURLException;
+    File getLocation(Artifact artifact);
 }

Modified: geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/repository/WriteableRepository.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/repository/WriteableRepository.java?rev=377617&r1=377616&r2=377617&view=diff
==============================================================================
--- geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/repository/WriteableRepository.java (original)
+++ geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/repository/WriteableRepository.java Mon Feb 13 20:50:59 2006
@@ -26,7 +26,7 @@
  *
  * @version $Rev$ $Date$
  */
-public interface WriteableRepository {
+public interface WriteableRepository extends Repository {
     /**
      * Copies a file from the server's filesystem into the repository.
      * Obviously to use this remotely, you must have some other way
@@ -34,7 +34,7 @@
      * the server is just going to turn around and upload it to some
      * other remote location.
      */
-    public void copyToRepository(File source, URI destination, FileWriteMonitor monitor) throws IOException;
+    public void copyToRepository(File source, Artifact destination, FileWriteMonitor monitor) throws IOException;
 
     /**
      * Copies the contents of an arbitrary stream into the repository.
@@ -43,5 +43,5 @@
      * is just going to turn around and upload it to some other remote
      * location.  The source will be closed when the write completes.
      */
-    public void copyToRepository(InputStream source, URI destination, FileWriteMonitor monitor) throws IOException;
+    public void copyToRepository(InputStream source, Artifact destination, FileWriteMonitor monitor) throws IOException;
 }

Modified: geronimo/branches/configid/modules/service-builder/src/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/service-builder/src/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java?rev=377617&r1=377616&r2=377617&view=diff
==============================================================================
--- geronimo/branches/configid/modules/service-builder/src/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java (original)
+++ geronimo/branches/configid/modules/service-builder/src/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java Mon Feb 13 20:50:59 2006
@@ -62,9 +62,7 @@
 import java.net.URL;
 import java.net.URLClassLoader;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.jar.JarFile;
@@ -191,19 +189,19 @@
     public static void addIncludes(DeploymentContext context, ArtifactType[] includes, Repository repository) throws DeploymentException {
         for (int i = 0; i < includes.length; i++) {
             ArtifactType include = includes[i];
-            URI uri = getDependencyURI(include, repository);
+            Artifact artifact = getDependencyURI(include, repository);
             String name = getDependencyFileName(include);
             URI path;
             try {
                 path = new URI(name);
             } catch (URISyntaxException e) {
-                throw new DeploymentException("Unable to generate path for include: " + uri, e);
+                throw new DeploymentException("Unable to generate path for include: " + artifact, e);
             }
             try {
-                URL url = repository.getURL(uri);
-                context.addInclude(path, url);
+                File file = repository.getLocation(artifact);
+                context.addInclude(path, file.toURL());
             } catch (IOException e) {
-                throw new DeploymentException("Unable to add include: " + uri, e);
+                throw new DeploymentException("Unable to add include: " + artifact, e);
             }
         }
     }
@@ -211,14 +209,15 @@
     //TODO this is part of Environment resolution
     public static void addDependencies(DeploymentContext context, ArtifactType[] deps, Repository repository) throws DeploymentException {
         for (int i = 0; i < deps.length; i++) {
-            URI dependencyURI = getDependencyURI(deps[i], repository);
+            Artifact artifact = getDependencyURI(deps[i], repository);
 //            context.addDependency(dependencyURI);
 
             URL url;
             try {
-                url = repository.getURL(dependencyURI);
+                File location = repository.getLocation(artifact);
+                url = location.toURL();
             } catch (MalformedURLException e) {
-                throw new DeploymentException("Unable to get URL for dependency " + dependencyURI, e);
+                throw new DeploymentException("Unable to get URL for dependency " + artifact, e);
             }
             ClassLoader depCL = new URLClassLoader(new URL[]{url}, ClassLoader.getSystemClassLoader());
             InputStream is = depCL.getResourceAsStream("META-INF/geronimo-service.xml");
@@ -334,26 +333,19 @@
         return objectName;
     }
 
-    private static URI getDependencyURI(ArtifactType dep, Repository repository) throws DeploymentException {
-        URI uri = null;
-        try {
-            uri = EnvironmentBuilder.toArtifact(dep).toURI();
-        } catch (URISyntaxException e) {
-            throw new DeploymentException(e);
-        }
-        if (!repository.hasURI(uri)) {
-            throw new DeploymentException(new MissingDependencyException("uri " + uri + " not found in repository"));
-        }
-        return uri;
+    private static Artifact getDependencyURI(ArtifactType dep, Repository repository) throws DeploymentException {
+        Artifact artifact = EnvironmentBuilder.toArtifact(dep);
+        if (!repository.contains(artifact)) {
+            throw new DeploymentException(new MissingDependencyException("Artifact " + artifact + " not found in repository"));
+        }
+        return artifact;
     }
 
-    private static String getDependencyFileName(ArtifactType dep) throws DeploymentException {
-        String name;
-            String groupId = dep.getGroupId().trim();
-            String type = dep.isSetType() ? dep.getType().trim() : "jar";
-            String artifactId = dep.getArtifactId().trim();
-            String version = dep.getVersion().trim();
-            name = artifactId + "-" + version + "." + type;
+    private static String getDependencyFileName(ArtifactType dep) {
+        String type = dep.isSetType() ? dep.getType().trim() : "jar";
+        String artifactId = dep.getArtifactId().trim();
+        String version = dep.getVersion().trim();
+        String name = artifactId + "-" + version + "." + type;
         return name;
     }
 

Modified: geronimo/branches/configid/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigurationDump.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigurationDump.java?rev=377617&r1=377616&r2=377617&view=diff
==============================================================================
--- geronimo/branches/configid/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigurationDump.java (original)
+++ geronimo/branches/configid/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigurationDump.java Mon Feb 13 20:50:59 2006
@@ -28,30 +28,28 @@
 import javax.management.MalformedObjectNameException;
 import javax.management.ObjectName;
 
-import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.geronimo.gbean.GBeanData;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.KernelFactory;
-import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.config.Configuration;
 import org.apache.geronimo.kernel.config.ConfigurationInfo;
 import org.apache.geronimo.kernel.config.ConfigurationModuleType;
 import org.apache.geronimo.kernel.config.ConfigurationStore;
 import org.apache.geronimo.kernel.log.GeronimoLogging;
 import org.apache.geronimo.kernel.management.State;
-import org.apache.geronimo.system.repository.ReadOnlyRepository;
+import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.system.repository.Maven2Repository;
 import org.apache.geronimo.system.serverinfo.BasicServerInfo;
 
 /**
  * @version $Rev$ $Date$
  */
 public class ConfigurationDump {
-    private static Log log;
     static {
         // This MUST be done before the first log is acquired
         GeronimoLogging.initialize(GeronimoLogging.WARN);
-        log = LogFactory.getLog(ConfigurationDump.class.getName());
+        LogFactory.getLog(ConfigurationDump.class.getName());
     }
     private static ClassLoader classLoader = ConfigurationDump.class.getClassLoader();
 
@@ -71,7 +69,7 @@
 
             // add the repositories
             ObjectName geronimoRepositoryName = new ObjectName("configdump:name=Repository,type=Geronimo");
-            GBeanData geronimoRepositoryData = new GBeanData(geronimoRepositoryName, ReadOnlyRepository.GBEAN_INFO);
+            GBeanData geronimoRepositoryData = new GBeanData(geronimoRepositoryName, Maven2Repository.GBEAN_INFO);
             geronimoRepositoryData.setAttribute("root", URI.create("repository"));
             geronimoRepositoryData.setReferencePattern("ServerInfo", serverInfoName);
             startGBean(kernel, geronimoRepositoryData);
@@ -86,7 +84,7 @@
             }
             if (mavenRepositoryDir.isDirectory()) {
                 ObjectName mavenRepositoryName = new ObjectName("configdump:name=Repository,type=Maven");
-                GBeanData mavenRepositoryData = new GBeanData(mavenRepositoryName, ReadOnlyRepository.GBEAN_INFO);
+                GBeanData mavenRepositoryData = new GBeanData(mavenRepositoryName, Maven2Repository.GBEAN_INFO);
                 mavenRepositoryData.setAttribute("root", mavenRepositoryDir.getAbsoluteFile().toURI());
                 mavenRepositoryData.setReferencePattern("ServerInfo", serverInfoName);
                 startGBean(kernel, mavenRepositoryData);

Added: 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=377617&view=auto
==============================================================================
--- geronimo/branches/configid/modules/system/src/java/org/apache/geronimo/system/repository/AbstractRepository.java (added)
+++ geronimo/branches/configid/modules/system/src/java/org/apache/geronimo/system/repository/AbstractRepository.java Mon Feb 13 20:50:59 2006
@@ -0,0 +1,149 @@
+/**
+ *
+ * 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.system.repository;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+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.system.serverinfo.ServerInfo;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public abstract class AbstractRepository implements WriteableRepository {
+    protected static final Log log = LogFactory.getLog(AbstractRepository.class);
+    private final static int TRANSFER_NOTIFICATION_SIZE = 10240;  // announce every this many bytes
+    private final static int TRANSFER_BUF_SIZE = 10240;  // try this many bytes at a time
+    protected final File rootFile;
+
+    public AbstractRepository(URI root, ServerInfo serverInfo) {
+        this(resolveRoot(root, serverInfo));
+    }
+
+    public AbstractRepository(File rootFile) {
+        if (rootFile == null) throw new NullPointerException("root is null");
+
+        if (!rootFile.exists() || !rootFile.isDirectory() || !rootFile.canRead()) {
+            throw new IllegalStateException("Maven2Repository must have a root that's a valid readable directory (not " + rootFile.getAbsolutePath() + ")");
+        }
+
+        this.rootFile = rootFile;
+        log.debug("Repository root is " + rootFile.getAbsolutePath());
+    }
+
+    private static File resolveRoot(URI root, ServerInfo serverInfo) {
+        if (root == null) throw new NullPointerException("root is null");
+        if (serverInfo == null) throw new NullPointerException("serverInfo is null");
+
+        if (!root.toString().endsWith("/")) {
+            try {
+                root = new URI(root.toString() + "/");
+            } catch (URISyntaxException e) {
+                throw new RuntimeException("Invalid repository root (does not end with / ) and can't add myself", e);
+            }
+        }
+
+        URI resolvedUri = serverInfo.resolve(root);
+
+        if (!resolvedUri.getScheme().equals("file")) {
+            throw new IllegalStateException("FileSystemRepository must have a root that's a local directory (not " + resolvedUri + ")");
+        }
+
+        File rootFile = new File(resolvedUri);
+        return rootFile;
+    }
+
+    public boolean contains(Artifact artifact) {
+        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()) {
+            throw new IllegalArgumentException("Cannot read source file at " + source.getAbsolutePath());
+        }
+        copyToRepository(new FileInputStream(source), destination, monitor);
+    }
+
+    public void copyToRepository(InputStream source, Artifact destination, FileWriteMonitor monitor) throws IOException {
+        // is this a wrtiable repository
+        if (!rootFile.canWrite()) {
+            throw new IllegalStateException("This repository is not writable: " + rootFile.getAbsolutePath() + ")");
+        }
+
+        // where are we going to install the file
+        File location = getLocation(destination);
+
+        // assure that there isn't already a file installed at the specified location
+        if (location.exists()) {
+            throw new IllegalArgumentException("Destination " + location.getAbsolutePath() + " already exists!");
+        }
+
+        // assure that the target directory exists
+        File parent = location.getParentFile();
+        if (!parent.exists() && !parent.mkdirs()) {
+            throw new RuntimeException("Unable to create directories from " + rootFile.getAbsolutePath() + " to " + parent.getAbsolutePath());
+        }
+
+        // copy it
+        if (monitor != null) {
+            monitor.writeStarted(destination.toString());
+        }
+        int total = 0;
+        try {
+            int threshold = TRANSFER_NOTIFICATION_SIZE;
+            BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(location));
+            BufferedInputStream in = new BufferedInputStream(source);
+            byte[] buf = new byte[TRANSFER_BUF_SIZE];
+            int count;
+            while ((count = in.read(buf)) > -1) {
+                out.write(buf, 0, count);
+                if (monitor != null) {
+                    total += count;
+                    if (total > threshold) {
+                        threshold += TRANSFER_NOTIFICATION_SIZE;
+                        monitor.writeProgress(total);
+                    }
+                }
+            }
+            out.flush();
+            out.close();
+            in.close();
+        } finally {
+            if (monitor != null) {
+                monitor.writeComplete(total);
+            }
+        }
+    }
+}

Added: 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=377617&view=auto
==============================================================================
--- geronimo/branches/configid/modules/system/src/java/org/apache/geronimo/system/repository/Maven1Repository.java (added)
+++ geronimo/branches/configid/modules/system/src/java/org/apache/geronimo/system/repository/Maven1Repository.java Mon Feb 13 20:50:59 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.system.repository;
+
+import java.io.File;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.system.serverinfo.ServerInfo;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class Maven1Repository extends AbstractRepository {
+    public Maven1Repository(URI root, ServerInfo serverInfo) {
+        super(root, serverInfo);
+    }
+
+    public Maven1Repository(File rootFile) {
+        super(rootFile);
+    }
+
+    public File getLocation(Artifact artifact) {
+        File path = new File(rootFile, artifact.getGroupId().replace('.', File.separatorChar));
+        path = new File(path, artifact.getType() + "s");
+        path = new File(path, artifact.getArtifactId() + "-" + artifact.getVersion() + "." + artifact.getType());
+
+        return path;
+    }
+
+    //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() {
+        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]);
+            if (matcher.matches()) {
+                String groupId = matcher.group(1);
+                String artifactId = matcher.group(3);
+                String version = matcher.group(4);
+                String type = matcher.group(5);
+                results.add(new Artifact(groupId, artifactId, version, type, true));
+            } else {
+            	log.warn("could not resolve URI for malformed repository entry: " + names[i] +
+            	" - the filename should look like: <groupId>/<type>s/<artifactId>-<version>.<type>   "+
+                "Perhaps you put in a file without a version number in the name?");
+            }
+
+        }
+       	return results;
+    }
+
+    public String[] getFiles(File base, String prefix) {
+        if (!base.canRead() || !base.isDirectory()) {
+            throw new IllegalArgumentException(base.getAbsolutePath());
+        }
+        List list = new ArrayList();
+        File[] hits = base.listFiles();
+        for (int i = 0; i < hits.length; i++) {
+            File hit = hits[i];
+            if (hit.canRead()) {
+                if (hit.isDirectory()) {
+                    list.addAll(Arrays.asList(getFiles(hit, prefix.equals("") ? hit.getName() : prefix + "/" + hit.getName())));
+                } else {
+                    list.add(prefix.equals("") ? hit.getName() : prefix + "/" + hit.getName());
+                }
+            }
+        }
+        return (String[]) list.toArray(new String[list.size()]);
+    }
+
+    public static final GBeanInfo GBEAN_INFO;
+
+    static {
+        GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(Maven1Repository.class);
+
+        infoFactory.addAttribute("root", URI.class, true);
+
+        infoFactory.addReference("ServerInfo", ServerInfo.class, "GBean");
+
+        infoFactory.addInterface(Maven1Repository.class);
+
+        infoFactory.setConstructor(new String[]{"root", "ServerInfo"});
+
+        GBEAN_INFO = infoFactory.getBeanInfo();
+    }
+
+    public static GBeanInfo getGBeanInfo() {
+        return GBEAN_INFO;
+    }
+}

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=377617&r1=377616&r2=377617&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 Mon Feb 13 20:50:59 2006
@@ -16,75 +16,26 @@
  */
 package org.apache.geronimo.system.repository;
 
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
 import java.net.URI;
-import java.net.URISyntaxException;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.kernel.repository.Artifact;
-import org.apache.geronimo.kernel.repository.FileWriteMonitor;
 import org.apache.geronimo.system.serverinfo.ServerInfo;
 
 /**
  * @version $Rev$ $Date$
  */
-public class Maven2Repository {
-    private static final Log log = LogFactory.getLog(FileSystemRepository.class);
-    private final static int TRANSFER_NOTIFICATION_SIZE = 10240;  // announce every this many bytes
-    private final static int TRANSFER_BUF_SIZE = 10240;  // try this many bytes at a time
-    private File rootFile;
-
+public class Maven2Repository extends AbstractRepository {
     public Maven2Repository(URI root, ServerInfo serverInfo) {
-        this(resolveRoot(root, serverInfo));
-    }
-
-    private static File resolveRoot(URI root, ServerInfo serverInfo) {
-        if (root == null) throw new NullPointerException("root is null");
-        if (serverInfo == null) throw new NullPointerException("serverInfo is null");
-
-        if (!root.toString().endsWith("/")) {
-            try {
-                root = new URI(root.toString() + "/");
-            } catch (URISyntaxException e) {
-                throw new RuntimeException("Invalid repository root (does not end with / ) and can't add myself", e);
-            }
-        }
-
-        URI resolvedUri = serverInfo.resolve(root);
-
-        if (!resolvedUri.getScheme().equals("file")) {
-            throw new IllegalStateException("FileSystemRepository must have a root that's a local directory (not " + resolvedUri + ")");
-        }
-
-        File rootFile = new File(resolvedUri);
-        return rootFile;
+        super(root, serverInfo);
     }
 
     public Maven2Repository(File rootFile) {
-        if (rootFile == null) throw new NullPointerException("root is null");
-
-        if (!rootFile.exists() || !rootFile.isDirectory() || !rootFile.canRead()) {
-            throw new IllegalStateException("Maven2Repository must have a root that's a valid readable directory (not " + rootFile.getAbsolutePath() + ")");
-        }
-
-        this.rootFile = rootFile;
-        log.debug("Repository root is " + rootFile.getAbsolutePath());
-    }
-
-    public boolean contains(Artifact artifact) {
-        File location = getLocation(artifact);
-        return location.isFile() && location.canRead();
+        super(rootFile);
     }
 
     public File getLocation(Artifact artifact) {
@@ -157,68 +108,10 @@
     }
 
 
-    public void install(File source, Artifact destination, FileWriteMonitor monitor) throws IOException {
-        if (!source.exists() || !source.canRead() || source.isDirectory()) {
-            throw new IllegalArgumentException("Cannot read source file at " + source.getAbsolutePath());
-        }
-        copyToRepository(new FileInputStream(source), destination, monitor);
-    }
-
-    public void copyToRepository(InputStream source, Artifact destination, FileWriteMonitor monitor) throws IOException {
-        // is this a wrtiable repository
-        if (!rootFile.canWrite()) {
-            throw new IllegalStateException("This repository is not writable: " + rootFile.getAbsolutePath() + ")");
-        }
-
-        // where are we going to install the file
-        File location = getLocation(destination);
-
-        // assure that there isn't already a file installed at the specified location
-        if (location.exists()) {
-            throw new IllegalArgumentException("Destination " + location.getAbsolutePath() + " already exists!");
-        }
-
-        // assure that the target directory exists
-        File parent = location.getParentFile();
-        if (!parent.exists() && !parent.mkdirs()) {
-            throw new RuntimeException("Unable to create directories from " + rootFile.getAbsolutePath() + " to " + parent.getAbsolutePath());
-        }
-
-        // copy it
-        if (monitor != null) {
-            monitor.writeStarted(destination.toString());
-        }
-        int total = 0;
-        try {
-            int threshold = TRANSFER_NOTIFICATION_SIZE;
-            BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(location));
-            BufferedInputStream in = new BufferedInputStream(source);
-            byte[] buf = new byte[TRANSFER_BUF_SIZE];
-            int count;
-            while ((count = in.read(buf)) > -1) {
-                out.write(buf, 0, count);
-                if (monitor != null) {
-                    total += count;
-                    if (total > threshold) {
-                        threshold += TRANSFER_NOTIFICATION_SIZE;
-                        monitor.writeProgress(total);
-                    }
-                }
-            }
-            out.flush();
-            out.close();
-            in.close();
-        } finally {
-            if (monitor != null) {
-                monitor.writeComplete(total);
-            }
-        }
-    }
-
     public static final GBeanInfo GBEAN_INFO;
 
     static {
-        GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(FileSystemRepository.class);
+        GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(Maven2Repository.class);
 
         infoFactory.addAttribute("root", URI.class, true);
 

Modified: geronimo/branches/configid/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java?rev=377617&r1=377616&r2=377617&view=diff
==============================================================================
--- geronimo/branches/configid/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java (original)
+++ geronimo/branches/configid/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java Mon Feb 13 20:50:59 2006
@@ -28,14 +28,11 @@
 import java.security.Permission;
 import java.security.PermissionCollection;
 import java.security.Permissions;
-import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collections;
 import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
-import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.jar.JarFile;
@@ -50,14 +47,14 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.geronimo.common.DeploymentException;
-import org.apache.geronimo.deployment.service.ServiceConfigBuilder;
+import org.apache.geronimo.deployment.Environment;
 import org.apache.geronimo.deployment.service.EnvironmentBuilder;
+import org.apache.geronimo.deployment.service.ServiceConfigBuilder;
 import org.apache.geronimo.deployment.util.DeploymentUtil;
-import org.apache.geronimo.deployment.xmlbeans.XmlBeansUtil;
-import org.apache.geronimo.deployment.xbeans.GbeanType;
-import org.apache.geronimo.deployment.xbeans.EnvironmentType;
 import org.apache.geronimo.deployment.xbeans.ArtifactType;
-import org.apache.geronimo.deployment.Environment;
+import org.apache.geronimo.deployment.xbeans.EnvironmentType;
+import org.apache.geronimo.deployment.xbeans.GbeanType;
+import org.apache.geronimo.deployment.xmlbeans.XmlBeansUtil;
 import org.apache.geronimo.gbean.GBeanData;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
@@ -87,8 +84,8 @@
 import org.apache.geronimo.tomcat.cluster.CatalinaClusterGBean;
 import org.apache.geronimo.tomcat.util.SecurityHolder;
 import org.apache.geronimo.transaction.context.OnlineUserTransaction;
-import org.apache.geronimo.web.deployment.GenericToSpecificPlanConverter;
 import org.apache.geronimo.web.deployment.AbstractWebModuleBuilder;
+import org.apache.geronimo.web.deployment.GenericToSpecificPlanConverter;
 import org.apache.geronimo.xbeans.geronimo.naming.GerMessageDestinationType;
 import org.apache.geronimo.xbeans.geronimo.web.tomcat.TomcatWebAppDocument;
 import org.apache.geronimo.xbeans.geronimo.web.tomcat.TomcatWebAppType;



Mime
View raw message