geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r572395 [9/11] - in /geronimo/server/trunk: ./ applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/car/ applications/console/geronimo-console-standard/src/main/webapp/WEB-INF/view/car/ applications/geron...
Date Mon, 03 Sep 2007 17:39:06 GMT
Modified: geronimo/server/trunk/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/jmx/RemoteDeploymentManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/jmx/RemoteDeploymentManager.java?rev=572395&r1=572394&r2=572395&view=diff
==============================================================================
--- geronimo/server/trunk/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/jmx/RemoteDeploymentManager.java
(original)
+++ geronimo/server/trunk/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/jmx/RemoteDeploymentManager.java
Mon Sep  3 10:38:54 2007
@@ -53,14 +53,16 @@
 import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.kernel.config.ConfigurationManager;
+import org.apache.geronimo.kernel.config.NoSuchStoreException;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.system.jmx.KernelDelegate;
 import org.apache.geronimo.system.plugin.DownloadPoller;
 import org.apache.geronimo.system.plugin.DownloadResults;
 import org.apache.geronimo.system.plugin.PluginInstaller;
-import org.apache.geronimo.system.plugin.PluginList;
-import org.apache.geronimo.system.plugin.PluginMetadata;
 import org.apache.geronimo.system.plugin.PluginRepositoryList;
+import org.apache.geronimo.system.plugin.model.PluginListType;
+import org.apache.geronimo.system.plugin.model.PluginType;
 
 /**
  * Connects to a Kernel in a remote VM (may or many not be on the same machine).
@@ -83,32 +85,34 @@
         initialize(new KernelDelegate(mbServerConnection));
         checkSameMachine(hostname);
     }
-    
+
     public boolean isSameMachine() {
         return isSameMachine;
     }
 
     private void checkSameMachine(String hostname) {
         isSameMachine = false;
-        if(hostname.equals("localhost") || hostname.equals("127.0.0.1")) {
+        if (hostname.equals("localhost") || hostname.equals("127.0.0.1")) {
             isSameMachine = true;
             return;
         }
         try {
             InetAddress dest = InetAddress.getByName(hostname);
             Enumeration en = NetworkInterface.getNetworkInterfaces();
-            while(en.hasMoreElements()) {
+            while (en.hasMoreElements()) {
                 NetworkInterface iface = (NetworkInterface) en.nextElement();
                 Enumeration ine = iface.getInetAddresses();
                 while (ine.hasMoreElements()) {
                     InetAddress address = (InetAddress) ine.nextElement();
-                    if(address.equals(dest)) {
+                    if (address.equals(dest)) {
                         isSameMachine = true;
                     }
                 }
             }
         } catch (Exception e) {
-            log.error("Unable to look up host name '"+hostname+"'; assuming it is a different
machine, but this may not get very far.", e);
+            log.error(
+                    "Unable to look up host name '" + hostname + "'; assuming it is a different
machine, but this may not get very far.",
+                    e);
         }
     }
 
@@ -123,88 +127,82 @@
     }
 
     protected DistributeCommand createDistributeCommand(Target[] targetList, File moduleArchive,
File deploymentPlan) {
-        if(isSameMachine) {
+        if (isSameMachine) {
             return super.createDistributeCommand(targetList, moduleArchive, deploymentPlan);
         } else {
-            return new org.apache.geronimo.deployment.plugin.remote.DistributeCommand(kernel,
targetList, moduleArchive, deploymentPlan);
+            return new org.apache.geronimo.deployment.plugin.remote.DistributeCommand(kernel,
targetList, moduleArchive,
+                    deploymentPlan);
         }
     }
 
     protected DistributeCommand createDistributeCommand(Target[] targetList, ModuleType moduleType,
InputStream moduleArchive, InputStream deploymentPlan) {
-        if(isSameMachine) {
+        if (isSameMachine) {
             return super.createDistributeCommand(targetList, moduleType, moduleArchive, deploymentPlan);
         } else {
-            return new org.apache.geronimo.deployment.plugin.remote.DistributeCommand(kernel,
targetList, moduleType, moduleArchive, deploymentPlan);
+            return new org.apache.geronimo.deployment.plugin.remote.DistributeCommand(kernel,
targetList, moduleType,
+                    moduleArchive, deploymentPlan);
         }
     }
 
     protected RedeployCommand createRedeployCommand(TargetModuleID[] moduleIDList, File moduleArchive,
File deploymentPlan) {
-        if(isSameMachine) {
+        if (isSameMachine) {
             return super.createRedeployCommand(moduleIDList, moduleArchive, deploymentPlan);
         } else {
-            return new org.apache.geronimo.deployment.plugin.remote.RedeployCommand(kernel,
moduleIDList, moduleArchive, deploymentPlan);
+            return new org.apache.geronimo.deployment.plugin.remote.RedeployCommand(kernel,
moduleIDList, moduleArchive,
+                    deploymentPlan);
         }
     }
 
     protected RedeployCommand createRedeployCommand(TargetModuleID[] moduleIDList, InputStream
moduleArchive, InputStream deploymentPlan) {
-        if(isSameMachine) {
+        if (isSameMachine) {
             return super.createRedeployCommand(moduleIDList, moduleArchive, deploymentPlan);
         } else {
-            return new org.apache.geronimo.deployment.plugin.remote.RedeployCommand(kernel,
moduleIDList, moduleArchive, deploymentPlan);
+            return new org.apache.geronimo.deployment.plugin.remote.RedeployCommand(kernel,
moduleIDList, moduleArchive,
+                    deploymentPlan);
         }
     }
 
-    public PluginList listPlugins(URL mavenRepository, String username, String password)
throws FailedLoginException, IOException {
-        Set set = kernel.listGBeans(new AbstractNameQuery(PluginInstaller.class.getName()));
-        for (Iterator it = set.iterator(); it.hasNext();) {
-            AbstractName name = (AbstractName) it.next();
-            PluginInstaller installer = (PluginInstaller) kernel.getProxyManager().createProxy(name,
PluginInstaller.class);
-            PluginList results = installer.listPlugins(mavenRepository, username, password);
+    public PluginListType listPlugins(URL mavenRepository, String username, String password)
throws FailedLoginException, IOException {
+        PluginInstaller installer = getPluginInstaller();
+        try {
+            return installer.listPlugins(mavenRepository, username, password);
+        } finally {
             kernel.getProxyManager().destroyProxy(installer);
-            return results;
         }
-        return null;
     }
 
-    public DownloadResults install(PluginList installList, String username, String password)
{
-        Set set = kernel.listGBeans(new AbstractNameQuery(PluginInstaller.class.getName()));
-        for (Iterator it = set.iterator(); it.hasNext();) {
-            AbstractName name = (AbstractName) it.next();
-            PluginInstaller installer = (PluginInstaller) kernel.getProxyManager().createProxy(name,
PluginInstaller.class);
-            DownloadResults results = installer.install(installList, username, password);
+    public DownloadResults install(PluginListType configsToInstall, String username, String
password) {
+        PluginInstaller installer = getPluginInstaller();
+        try {
+            return installer.install(configsToInstall, username, password);
+        } finally {
             kernel.getProxyManager().destroyProxy(installer);
-            return results;
         }
-        return null;
     }
 
-    public void install(PluginList configsToInstall, String username, String password, DownloadPoller
poller) {
-        Set set = kernel.listGBeans(new AbstractNameQuery(PluginInstaller.class.getName()));
-        for (Iterator it = set.iterator(); it.hasNext();) {
-            AbstractName name = (AbstractName) it.next();
-            PluginInstaller installer = (PluginInstaller) kernel.getProxyManager().createProxy(name,
PluginInstaller.class);
+    public void install(PluginListType configsToInstall, String username, String password,
DownloadPoller poller) {
+        PluginInstaller installer = getPluginInstaller();
+        try {
             installer.install(configsToInstall, username, password, poller);
+        } finally {
             kernel.getProxyManager().destroyProxy(installer);
-            return;
         }
     }
 
-    public Object startInstall(PluginList configsToInstall, String username, String password)
{
-        Set set = kernel.listGBeans(new AbstractNameQuery(PluginInstaller.class.getName()));
-        for (Iterator it = set.iterator(); it.hasNext();) {
-            AbstractName name = (AbstractName) it.next();
-            PluginInstaller installer = (PluginInstaller) kernel.getProxyManager().createProxy(name,
PluginInstaller.class);
-            Object result = installer.startInstall(configsToInstall, username, password);
+    public Object startInstall(PluginListType configsToInstall, String username, String password)
{
+        PluginInstaller installer = getPluginInstaller();
+        try {
+            return installer.startInstall(configsToInstall, username, password);
+        } finally {
             kernel.getProxyManager().destroyProxy(installer);
-            return result;
         }
-        return null;
     }
 
     public Object startInstall(File carFile, String username, String password) {
         File[] args = new File[]{carFile};
-        if(!isSameMachine) {
-            AbstractDeployCommand progress = new AbstractDeployCommand(CommandType.DISTRIBUTE,
kernel, null, null, null, null, null, false) {
+        if (!isSameMachine) {
+            AbstractDeployCommand progress = new AbstractDeployCommand(CommandType.DISTRIBUTE,
kernel, null, null, null,
+                    null, null, false) {
                 public void run() {
                 }
             };
@@ -215,86 +213,92 @@
             });
             RemoteDeployUtil.uploadFilesToServer(args, progress);
         }
-        Set set = kernel.listGBeans(new AbstractNameQuery(PluginInstaller.class.getName()));
-        for (Iterator it = set.iterator(); it.hasNext();) {
-            AbstractName name = (AbstractName) it.next();
-            PluginInstaller installer = (PluginInstaller) kernel.getProxyManager().createProxy(name,
PluginInstaller.class);
-            Object result = installer.startInstall(carFile, username, password);
+        PluginInstaller installer = getPluginInstaller();
+        try {
+            return installer.startInstall(carFile, username, password);
+        } finally {
             kernel.getProxyManager().destroyProxy(installer);
-            return result;
         }
-        return null;
     }
 
     public DownloadResults checkOnInstall(Object key) {
-        Set set = kernel.listGBeans(new AbstractNameQuery(PluginInstaller.class.getName()));
-        for (Iterator it = set.iterator(); it.hasNext();) {
-            AbstractName name = (AbstractName) it.next();
-            PluginInstaller installer = (PluginInstaller) kernel.getProxyManager().createProxy(name,
PluginInstaller.class);
-            DownloadResults result = installer.checkOnInstall(key);
+        PluginInstaller installer = getPluginInstaller();
+        try {
+            return installer.checkOnInstall(key);
+        } finally {
+            kernel.getProxyManager().destroyProxy(installer);
+        }
+    }
+
+    private PluginInstaller getPluginInstaller() {
+        Set<AbstractName> set = kernel.listGBeans(new AbstractNameQuery(PluginInstaller.class.getName()));
+        for (AbstractName name : set) {
+            return (PluginInstaller) kernel.getProxyManager().createProxy(name, PluginInstaller.class);
+        }
+        throw new IllegalStateException("No plugin installer found");
+
+    }
+
+    //not likely to be useful remotely
+    public PluginListType createPluginListForRepositories(ConfigurationManager mgr, String
repo) throws NoSuchStoreException {
+        PluginInstaller installer = getPluginInstaller();
+        try {
+            return installer.createPluginListForRepositories(mgr, repo);
+        } finally {
             kernel.getProxyManager().destroyProxy(installer);
-            return result;
         }
-        return null;
     }
 
     public Map getInstalledPlugins() {
-        Set set = kernel.listGBeans(new AbstractNameQuery(PluginInstaller.class.getName()));
-        for (Iterator it = set.iterator(); it.hasNext();) {
-            AbstractName name = (AbstractName) it.next();
-            PluginInstaller installer = (PluginInstaller) kernel.getProxyManager().createProxy(name,
PluginInstaller.class);
-            Map result = installer.getInstalledPlugins();
+        PluginInstaller installer = getPluginInstaller();
+        try {
+            return installer.getInstalledPlugins();
+        } finally {
             kernel.getProxyManager().destroyProxy(installer);
-            return result;
         }
-        return null;
     }
 
-    public PluginMetadata getPluginMetadata(Artifact configId) {
-        Set set = kernel.listGBeans(new AbstractNameQuery(PluginInstaller.class.getName()));
-        for (Iterator it = set.iterator(); it.hasNext();) {
-            AbstractName name = (AbstractName) it.next();
-            PluginInstaller installer = (PluginInstaller) kernel.getProxyManager().createProxy(name,
PluginInstaller.class);
-            PluginMetadata result = installer.getPluginMetadata(configId);
+    public PluginType getPluginMetadata(Artifact configId) {
+        PluginInstaller installer = getPluginInstaller();
+        try {
+            return installer.getPluginMetadata(configId);
+        } finally {
             kernel.getProxyManager().destroyProxy(installer);
-            return result;
         }
-        return null;
     }
 
-    public void updatePluginMetadata(PluginMetadata metadata) {
-        Set set = kernel.listGBeans(new AbstractNameQuery(PluginInstaller.class.getName()));
-        for (Iterator it = set.iterator(); it.hasNext();) {
-            AbstractName name = (AbstractName) it.next();
-            PluginInstaller installer = (PluginInstaller) kernel.getProxyManager().createProxy(name,
PluginInstaller.class);
+    public void updatePluginMetadata(PluginType metadata) {
+        PluginInstaller installer = getPluginInstaller();
+        try {
             installer.updatePluginMetadata(metadata);
+        } finally {
             kernel.getProxyManager().destroyProxy(installer);
-            return;
         }
     }
 
     public URL[] getRepositories() {
-        List list = new ArrayList();
-        Set set = kernel.listGBeans(new AbstractNameQuery(PluginRepositoryList.class.getName()));
-        for (Iterator it = set.iterator(); it.hasNext();) {
-            AbstractName name = (AbstractName) it.next();
-            PluginRepositoryList repo = (PluginRepositoryList) kernel.getProxyManager().createProxy(name,
PluginRepositoryList.class);
+        List<URL> list = new ArrayList<URL>();
+        Set<AbstractName> set = kernel.listGBeans(new AbstractNameQuery(PluginRepositoryList.class.getName()));
+        for (AbstractName name : set) {
+            PluginRepositoryList repo = (PluginRepositoryList) kernel.getProxyManager().createProxy(name,
+                    PluginRepositoryList.class);
             list.addAll(Arrays.asList(repo.getRepositories()));
             kernel.getProxyManager().destroyProxy(repo);
         }
-        return (URL[]) list.toArray(new URL[list.size()]);
+        return list.toArray(new URL[list.size()]);
     }
-    
+
     public static final GBeanInfo GBEAN_INFO;
     public static final String GBEAN_REF_MODULE_CONFIGURERS = "ModuleConfigurers";
-    
+
     static {
-        GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(RemoteDeploymentManager.class,
"RemoteDeploymentManager");
+        GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(RemoteDeploymentManager.class,
+                "RemoteDeploymentManager");
         infoFactory.addInterface(GeronimoDeploymentManager.class);
         infoFactory.addReference(GBEAN_REF_MODULE_CONFIGURERS, ModuleConfigurer.class);
 
-        infoFactory.setConstructor(new String[] {GBEAN_REF_MODULE_CONFIGURERS});
-        
+        infoFactory.setConstructor(new String[]{GBEAN_REF_MODULE_CONFIGURERS});
+
         GBEAN_INFO = infoFactory.getBeanInfo();
     }
 

Modified: geronimo/server/trunk/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandListConfigurations.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandListConfigurations.java?rev=572395&r1=572394&r2=572395&view=diff
==============================================================================
--- geronimo/server/trunk/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandListConfigurations.java
(original)
+++ geronimo/server/trunk/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandListConfigurations.java
Mon Sep  3 10:38:54 2007
@@ -23,7 +23,6 @@
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
@@ -36,8 +35,10 @@
 import org.apache.geronimo.deployment.plugin.GeronimoDeploymentManager;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.system.plugin.DownloadResults;
-import org.apache.geronimo.system.plugin.PluginList;
-import org.apache.geronimo.system.plugin.PluginMetadata;
+import org.apache.geronimo.system.plugin.PluginInstallerGBean;
+import org.apache.geronimo.system.plugin.model.PluginArtifactType;
+import org.apache.geronimo.system.plugin.model.PluginListType;
+import org.apache.geronimo.system.plugin.model.PluginType;
 
 /**
  * The CLI deployer logic to start.
@@ -50,16 +51,16 @@
 
     public void execute(PrintWriter out, ServerConnection connection, CommandArgs commandArgs)
throws DeploymentException {
         DeploymentManager dmgr = connection.getDeploymentManager();
-        if(dmgr instanceof GeronimoDeploymentManager) {
+        if (dmgr instanceof GeronimoDeploymentManager) {
             GeronimoDeploymentManager mgr = (GeronimoDeploymentManager) dmgr;
             try {
-                String repo = null;
-                if(commandArgs.getArgs().length == 1) {
+                String repo;
+                if (commandArgs.getArgs().length == 1) {
                     repo = commandArgs.getArgs()[0];
                 } else {
                     repo = getRepository(out, new BufferedReader(new InputStreamReader(System.in)),
mgr);
                 }
-                PluginList data;
+                PluginListType data;
                 URL repository;
                 try {
                     repository = new URL(repo);
@@ -67,46 +68,48 @@
                 } catch (IOException e) {
                     throw new DeploymentException("Unable to list configurations", e);
                 } catch (FailedLoginException e) {
-                    throw new DeploymentException("Invalid login for Maven repository '"+repo+"'",
e);
+                    throw new DeploymentException("Invalid login for Maven repository '"
+ repo + "'", e);
                 }
                 if (data == null) {
                     out.println();
                     out.println("No plugins were returned from this site.");
                     return;
                 }
-                Map categories = new HashMap();
-                List available = new ArrayList();
-                for (int i = 0; i < data.getPlugins().length; i++) {
-                    PluginMetadata metadata = data.getPlugins()[i];
-                    List list = (List) categories.get(metadata.getCategory());
-                    if(list == null) {
-                        list = new ArrayList();
+                Map<String, List<PluginType>> categories = new HashMap<String,
List<PluginType>>();
+                for (PluginType metadata : data.getPlugin()) {
+                    List<PluginType> list = categories.get(metadata.getCategory());
+                    if (list == null) {
+                        list = new ArrayList<PluginType>();
                         categories.put(metadata.getCategory(), list);
                     }
                     list.add(metadata);
                 }
-                for (Iterator it = categories.entrySet().iterator(); it.hasNext();) {
-                    Map.Entry entry = (Map.Entry) it.next();
-                    String category = (String) entry.getKey();
-                    List items = (List) entry.getValue();
+                List<PluginType> available = new ArrayList<PluginType>();
+                for (Map.Entry<String, List<PluginType>> entry : categories.entrySet())
{
+                    String category = entry.getKey();
+                    List<PluginType> items = entry.getValue();
                     out.println();
                     out.print(DeployUtils.reformat(category, 4, 72));
-                    for (int i = 0; i < items.size(); i++) {
-                        PluginMetadata metadata = (PluginMetadata) items.get(i);
-                        String prefix = "    ";
-                        if(!metadata.isInstalled() && metadata.isEligible()) {
-                            available.add(metadata);
-                            prefix = Integer.toString(available.size());
-                            if(available.size() < 10) {
-                                prefix += " ";
-                            }
-                            prefix += ": ";
+                    for (PluginType metadata : items) {
+                        out.println("  " + metadata.getName());
+                        for (PluginArtifactType instance : metadata.getPluginArtifact())
{
+                            String prefix;
+//                            if (!instance.isInstalled() && instance.isEligible())
{
+                            PluginType copy = PluginInstallerGBean.copy(metadata, instance);
+                                available.add(copy);
+                                prefix = Integer.toString(available.size());
+                                if (available.size() < 10) {
+                                    prefix += " ";
+                                }
+                                prefix += ": ";
+//                            }
+                            out.print(DeployUtils.reformat(
+                                    prefix + " (" + instance.getModuleId().getVersion() +
")", 8, 72));
+                            out.flush();
                         }
-                        out.print(DeployUtils.reformat(prefix+metadata.getName()+" ("+metadata.getVersion()+")",
8, 72));
-                        out.flush();
                     }
                 }
-                if(available.size() == 0) {
+                if (available.size() == 0) {
                     out.println();
                     out.println("No plugins from this site are eligible for installation.");
                     return;
@@ -116,47 +119,54 @@
                 out.flush();
                 BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
                 String answer = in.readLine();
-                if(answer.equalsIgnoreCase("q")) {
+                if (answer.equalsIgnoreCase("q")) {
                     return;
                 }
                 int selection = Integer.parseInt(answer);
-                PluginMetadata target = ((PluginMetadata) available.get(selection - 1));
+                PluginType target = available.get(selection - 1);
+                PluginArtifactType targetInstance = target.getPluginArtifact().get(0);
+                PluginListType list = new PluginListType();
+                list.getPlugin().add(target);
+                list.getDefaultRepository().add(repo);
                 long start = System.currentTimeMillis();
-                Object key = mgr.startInstall(PluginList.createInstallList(data, target.getModuleId()),
null, null);
+                Object key = mgr.startInstall(list, null, null);
                 DownloadResults results = CommandInstallCAR.showProgress(mgr, key);
-                int time = (int)(System.currentTimeMillis() - start) / 1000;
+                int time = (int) (System.currentTimeMillis() - start) / 1000;
                 out.println();
-                if(!results.isFailed()) {
+                if (!results.isFailed()) {
                     out.print(DeployUtils.reformat("**** Installation Complete!", 4, 72));
                     for (int i = 0; i < results.getDependenciesPresent().length; i++)
{
                         Artifact uri = results.getDependenciesPresent()[i];
-                        out.print(DeployUtils.reformat("Used existing: "+uri, 4, 72));
+                        out.print(DeployUtils.reformat("Used existing: " + uri, 4, 72));
                     }
                     for (int i = 0; i < results.getDependenciesInstalled().length; i++)
{
                         Artifact uri = results.getDependenciesInstalled()[i];
-                        out.print(DeployUtils.reformat("Installed new: "+uri, 4, 72));
+                        out.print(DeployUtils.reformat("Installed new: " + uri, 4, 72));
                     }
                     out.println();
-                    out.print(DeployUtils.reformat("Downloaded "+(results.getTotalDownloadBytes()/1024)+"
kB in "+time+"s ("+results.getTotalDownloadBytes()/(1024*time)+" kB/s)", 4, 72));
+                    out.print(DeployUtils.reformat(
+                            "Downloaded " + (results.getTotalDownloadBytes() / 1024) + "
kB in " + time + "s (" + results.getTotalDownloadBytes() / (1024 * time) + " kB/s)",
+                            4, 72));
                 }
-                if(results.isFinished() && !results.isFailed()) {
-                    out.print(DeployUtils.reformat("Now starting "+target.getModuleId()+"...",
4, 72));
+                if (results.isFinished() && !results.isFailed()) {
+                    out.print(DeployUtils.reformat("Now starting " + PluginInstallerGBean.toArtifact(targetInstance.getModuleId())
+ "...", 4, 72));
                     out.flush();
-                    new CommandStart().execute(out, connection, new BaseCommandArgs(new String[]{target.getModuleId().toString()}));
+                    new CommandStart().execute(out, connection,
+                            new BaseCommandArgs(new String[]{PluginInstallerGBean.toArtifact(targetInstance.getModuleId()).toString()}));
                 }
             } catch (IOException e) {
                 throw new DeploymentException("Unable to install configuration", e);
-            } catch(NumberFormatException e) {
+            } catch (NumberFormatException e) {
                 throw new DeploymentException("Invalid response");
             }
         } else {
-            throw new DeploymentException("Cannot list repositories when connected to "+connection.getServerURI());
+            throw new DeploymentException("Cannot list repositories when connected to " +
connection.getServerURI());
         }
     }
 
     private String getRepository(PrintWriter out, BufferedReader in, GeronimoDeploymentManager
mgr) throws IOException, DeploymentException {
         URL[] all = mgr.getRepositories();
-        if(all.length == 0) {
+        if (all.length == 0) {
             throw new DeploymentException("No default repositories available.  Please either
specify the repository " +
                     "URL on the command line, or go into the console Plugin page and update
the list of available " +
                     "repositories.");
@@ -165,13 +175,13 @@
         out.println("Select repository:");
         for (int i = 0; i < all.length; i++) {
             URL url = all[i];
-            out.println("  "+(i+1)+". "+url);
+            out.println("  " + (i + 1) + ". " + url);
         }
         out.println();
         out.print("Enter Repository Number: ");
         out.flush();
         String entry = in.readLine().trim();
         int index = Integer.parseInt(entry);
-        return all[index-1].toString();
+        return all[index - 1].toString();
     }
 }

Modified: geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/ImportType.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/ImportType.java?rev=572395&r1=572394&r2=572395&view=diff
==============================================================================
--- geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/ImportType.java
(original)
+++ geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/ImportType.java
Mon Sep  3 10:38:54 2007
@@ -33,8 +33,8 @@
     public static final ImportType CLASSES = new ImportType("CLASSES");
     public static final ImportType SERVICES = new ImportType("SERVICES");
 
-    public static Object getByName(String name) {
-        ImportType type = (ImportType) typesByName.get(name);
+    public static ImportType getByName(String name) {
+        ImportType type = (ImportType) typesByName.get(name.toUpperCase());
         if (type == null) throw new IllegalStateException("Unknown import type: " + name);
         return type;
     }

Modified: geronimo/server/trunk/modules/geronimo-system/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-system/pom.xml?rev=572395&r1=572394&r2=572395&view=diff
==============================================================================
--- geronimo/server/trunk/modules/geronimo-system/pom.xml (original)
+++ geronimo/server/trunk/modules/geronimo-system/pom.xml Mon Sep  3 10:38:54 2007
@@ -31,7 +31,7 @@
 
     <artifactId>geronimo-system</artifactId>
     <name>Geronimo :: System</name>
-    
+
     <dependencies>
         <dependency>
             <groupId>org.apache.geronimo.modules</groupId>
@@ -69,13 +69,33 @@
             <groupId>commons-jexl</groupId>
             <artifactId>commons-jexl</artifactId>
         </dependency>
-        
+
         <dependency>
             <groupId>ognl</groupId>
             <artifactId>ognl</artifactId>
         </dependency>
+
+        <!-- plugin management -->
+        <dependency>
+            <groupId>javax.xml.bind</groupId>
+            <artifactId>jaxb-api</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.sun.xml.bind</groupId>
+            <artifactId>jaxb-impl</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-stax-api_1.0_spec</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>woodstox</groupId>
+            <artifactId>wstx-asl</artifactId>
+        </dependency>
+
     </dependencies>
-    
+
     <build>
         <plugins>
             <plugin>
@@ -93,13 +113,13 @@
                                 <tstamp>
                                     <format property="build.year" pattern="yyyy"/>
                                 </tstamp>
-                                
+
                                 <mkdir dir="${project.build.outputDirectory}/org/apache/geronimo/system/serverinfo"/>
-                                
+
                                 <propertyfile
-                                    file="${project.build.outputDirectory}/org/apache/geronimo/system/serverinfo/geronimo-version.properties"
-                                    comment="Geronimo version information (generated, do
not modify)">
-                                    
+                                        file="${project.build.outputDirectory}/org/apache/geronimo/system/serverinfo/geronimo-version.properties"
+                                        comment="Geronimo version information (generated,
do not modify)">
+
                                     <entry key="version" value="${version}"/>
                                     <entry key="build.date" type="date" value="now" pattern="yyyy.MM.dd"/>
                                     <entry key="build.time" type="date" value="now" pattern="HH:mm:ss.SSSZ"/>
@@ -109,7 +129,7 @@
                         </configuration>
                     </execution>
                 </executions>
-                
+
                 <dependencies>
                     <dependency>
                         <groupId>ant</groupId>
@@ -118,8 +138,23 @@
                     </dependency>
                 </dependencies>
             </plugin>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>jaxb2-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>xjc</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    <packageName>org.apache.geronimo.system.plugin.model</packageName>
+                    <extension>true</extension>
+                </configuration>
+            </plugin>
         </plugins>
     </build>
-    
+
 </project>
 

Modified: geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/plugin/PluginInstaller.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/plugin/PluginInstaller.java?rev=572395&r1=572394&r2=572395&view=diff
==============================================================================
--- geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/plugin/PluginInstaller.java
(original)
+++ geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/plugin/PluginInstaller.java
Mon Sep  3 10:38:54 2007
@@ -22,6 +22,10 @@
 import java.util.Map;
 import javax.security.auth.login.FailedLoginException;
 import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.kernel.config.ConfigurationManager;
+import org.apache.geronimo.kernel.config.NoSuchStoreException;
+import org.apache.geronimo.system.plugin.model.PluginListType;
+import org.apache.geronimo.system.plugin.model.PluginType;
 
 /**
  * Knows how to import and export configurations
@@ -39,7 +43,7 @@
      * @param password Optional password, if the maven repo uses HTTP Basic authentication.
      *                 Set this to null if no authentication is required.
      */
-    public PluginList listPlugins(URL mavenRepository, String username, String password)
throws IOException, FailedLoginException;
+    public PluginListType listPlugins(URL mavenRepository, String username, String password)
throws IOException, FailedLoginException;
 
     /**
      * Lists the plugins installed in the local Geronimo server, by name and
@@ -59,7 +63,7 @@
      *                 configuration currently installed in the local server.
      *                 The configId must be fully resolved (isResolved() == true)
      */
-    public PluginMetadata getPluginMetadata(Artifact moduleId);
+    public PluginType getPluginMetadata(Artifact moduleId);
 
     /**
      * Saves a ConfigurationMetadata for a particular plugin, if the server is
@@ -71,7 +75,7 @@
      *                 be fully resolved) identifies the configuration to save
      *                 this for.
      */
-    public void updatePluginMetadata(PluginMetadata metadata);
+    public void updatePluginMetadata(PluginType metadata);
 
     /**
      * Installs a configuration from a remote repository into the local Geronimo server,
@@ -85,7 +89,7 @@
      *                         Set this to null if no authentication is required.
      * @param pluginsToInstall The list of configurations to install
      */
-    public DownloadResults install(PluginList pluginsToInstall, String username, String password);
+    public DownloadResults install(PluginListType pluginsToInstall, String username, String
password);
 
     /**
      * Installs a configuration from a remote repository into the local Geronimo server,
@@ -103,7 +107,7 @@
      *                         Set this to null if no authentication is required.
      * @param poller           Will be notified with status updates as the download proceeds
      */
-    public void install(PluginList pluginsToInstall, String username, String password, DownloadPoller
poller);
+    public void install(PluginListType pluginsToInstall, String username, String password,
DownloadPoller poller);
 
     /**
      * Installs a configuration from a remote repository into the local Geronimo server,
@@ -120,7 +124,7 @@
      *
      * @return A key that can be passed to checkOnInstall
      */
-    public Object startInstall(PluginList pluginsToInstall, String username, String password);
+    public Object startInstall(PluginListType pluginsToInstall, String username, String password);
 
     /**
      * Installs a configuration downloaded from a remote repository into the local Geronimo
@@ -153,4 +157,6 @@
      * @param key Identifies the operation to check on
      */
     public DownloadResults checkOnInstall(Object key);
+
+    PluginListType createPluginListForRepositories(ConfigurationManager mgr, String repo)
throws NoSuchStoreException;
 }



Mime
View raw message