Return-Path: Delivered-To: apmail-geronimo-scm-archive@www.apache.org Received: (qmail 10103 invoked from network); 2 May 2006 04:09:30 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 2 May 2006 04:09:30 -0000 Received: (qmail 63843 invoked by uid 500); 2 May 2006 04:09:30 -0000 Delivered-To: apmail-geronimo-scm-archive@geronimo.apache.org Received: (qmail 63702 invoked by uid 500); 2 May 2006 04:09:29 -0000 Mailing-List: contact scm-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@geronimo.apache.org List-Id: Delivered-To: mailing list scm@geronimo.apache.org Received: (qmail 63691 invoked by uid 99); 2 May 2006 04:09:29 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 May 2006 21:09:29 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Mon, 01 May 2006 21:09:28 -0700 Received: (qmail 10040 invoked by uid 65534); 2 May 2006 04:09:08 -0000 Message-ID: <20060502040908.10039.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r398798 - in /geronimo/branches/1.1: applications/console-standard/src/java/org/apache/geronimo/console/car/ modules/deploy-tool/src/java/org/apache/geronimo/deployment/cli/ Date: Tue, 02 May 2006 04:09:07 -0000 To: scm@geronimo.apache.org From: ammulder@apache.org X-Mailer: svnmailer-1.0.8 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: ammulder Date: Mon May 1 21:09:04 2006 New Revision: 398798 URL: http://svn.apache.org/viewcvs?rev=398798&view=rev Log: Fixes to plugin handling - better auto-generation for Maven 2 servlet (GERONIMO-1964) - tweaks to command-line installation Modified: geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/car/GeronimoAsMavenServlet.java geronimo/branches/1.1/modules/deploy-tool/src/java/org/apache/geronimo/deployment/cli/CommandInstallCAR.java geronimo/branches/1.1/modules/deploy-tool/src/java/org/apache/geronimo/deployment/cli/CommandListConfigurations.java Modified: geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/car/GeronimoAsMavenServlet.java URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/car/GeronimoAsMavenServlet.java?rev=398798&r1=398797&r2=398798&view=diff ============================================================================== --- geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/car/GeronimoAsMavenServlet.java (original) +++ geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/car/GeronimoAsMavenServlet.java Mon May 1 21:09:04 2006 @@ -59,6 +59,9 @@ import org.apache.geronimo.kernel.repository.Repository; import org.apache.geronimo.kernel.repository.Version; import org.apache.geronimo.system.serverinfo.ServerInfo; +import org.apache.geronimo.system.configuration.ConfigurationInstaller; +import org.apache.geronimo.system.configuration.ConfigurationArchiveData; +import org.apache.geronimo.system.configuration.ConfigurationMetadata; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Text; @@ -202,6 +205,7 @@ ServerInfo serverInfo = helper.getServers(helper.getDomains()[0])[0].getServerInfo(); String version = serverInfo.getVersion(); ConfigurationManager mgr = ConfigurationUtil.getConfigurationManager(kernel); + ConfigurationInstaller installer = getInstaller(kernel); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document doc = builder.newDocument(); @@ -213,28 +217,42 @@ List configs = mgr.listConfigurations(name); for (int j = 0; j < configs.size(); j++) { ConfigurationInfo info = (ConfigurationInfo) configs.get(j); + ConfigurationArchiveData archiveData = installer.getPluginMetadata(info.getConfigID()); + ConfigurationMetadata data = archiveData.getConfiguration(); Element config = doc.createElement("configuration"); root.appendChild(config); - createText(doc, config, "name", info.getConfigID().toString()); - createText(doc, config, "config-id", info.getConfigID().toString()); + createText(doc, config, "name", data.getName()); + createText(doc, config, "config-id", data.getConfigId().toString()); createText(doc, config, "category", "Geronimo Deployments"); - createText(doc, config, "geronimo-version", version); - if(info.getConfigID().toString().indexOf("jetty") > -1) { - writePrerequisite(doc, config, "geronimo/jetty/*/car", "Jetty", "Tomcat"); - createText(doc, config, "prerequisite", "geronimo/jetty/car"); - } else if(info.getConfigID().toString().indexOf("tomcat") > -1) { - createText(doc, config, "prerequisite", "geronimo/tomcat/car"); - writePrerequisite(doc, config, "geronimo/tomcat/*/car", "Tomcat", "Jetty"); + createText(doc, config, "description", data.getCategory().equals("Unknown") ? "Automatically generated plugin metadata" : data.getDescription()); + for (int k = 0; k < data.getLicenses().length; k++) { + ConfigurationMetadata.License license = data.getLicenses()[k]; + Element lic = doc.createElement("license"); + lic.setAttribute("osi-approved", Boolean.toString(license.isOsiApproved())); + createText(doc, lic, license.getName()); + config.appendChild(lic); } - try { - ConfigurationData data = mgr.getStoreForConfiguration(info.getConfigID()).loadConfiguration(info.getConfigID()); - List deps = data.getEnvironment().getDependencies(); - for (int k = 0; k < deps.size(); k++) { - Dependency dep = (Dependency) deps.get(k); - createText(doc, config, "dependency", dep.getArtifact().toString()); - } - } catch (Exception e) { - log.warn("Unable to generate dependencies for configuration "+info.getConfigID(), e); + String[] versions = data.getGeronimoVersions(); + for (int k = 0; k < versions.length; k++) { + String ver = versions[k]; + createText(doc, config, "geronimo-version", ver); + } + versions = data.getJvmVersions(); + for (int k = 0; k < versions.length; k++) { + String ver = versions[k]; + createText(doc, config, "jvm-version", ver); + } + for (int k = 0; k < data.getPrerequisites().length; k++) { + ConfigurationMetadata.Prerequisite prereq = data.getPrerequisites()[k]; + writePrerequisite(doc, config, prereq); + } + for (int k = 0; k < data.getDependencies().length; k++) { + String dep = data.getDependencies()[k]; + createText(doc, config, "dependency", dep); + } + for (int k = 0; k < data.getObsoletes().length; k++) { + String obs = data.getObsoletes()[k]; + createText(doc, config, "obsoletes", obs); } } } @@ -244,6 +262,14 @@ xform.transform(new DOMSource(doc), new StreamResult(out)); } + private ConfigurationInstaller getInstaller(Kernel kernel) { + Set names = kernel.listGBeans(new AbstractNameQuery(ConfigurationInstaller.class.getName())); + if(names.size() == 0) { + return null; + } + return (ConfigurationInstaller) kernel.getProxyManager().createProxy((AbstractName) names.iterator().next(), ConfigurationInstaller.class); + } + private void generateMavenFile(Kernel kernel, PrintWriter writer, String groupId, String artifactId, boolean reply) throws ParserConfigurationException, TransformerException { ConfigurationManager mgr = ConfigurationUtil.getConfigurationManager(kernel); Artifact[] artifacts = mgr.getArtifactResolver().queryArtifacts(new Artifact(groupId, artifactId, (Version)null, null)); @@ -275,15 +301,12 @@ xform.transform(new DOMSource(doc), new StreamResult(writer)); } - private void writePrerequisite(Document doc, Element config, String configId, String server, String notServer) { + private void writePrerequisite(Document doc, Element config, ConfigurationMetadata.Prerequisite req) { Element prereq = doc.createElement("prerequisite"); config.appendChild(prereq); - createText(doc, prereq, "id", configId); - createText(doc, prereq, "description", - "This is a web application or web-related module, configured for the " + - server +" web container. It will not run on "+notServer+" versions of " + - "Geronimo. If you need a "+notServer+" version of this application, " + - "you'll need to get it from another "+notServer+" Geronimo installation."); + createText(doc, prereq, "id", req.getConfigId().toString()); + createText(doc, prereq, "resource-type", req.getResourceType()); + createText(doc, prereq, "description", req.getDescription()); } private void createText(Document doc, Element parent, String name, String text) { @@ -291,5 +314,10 @@ parent.appendChild(child); Text node = doc.createTextNode(text); child.appendChild(node); + } + + private void createText(Document doc, Element parent, String text) { + Text node = doc.createTextNode(text); + parent.appendChild(node); } } Modified: geronimo/branches/1.1/modules/deploy-tool/src/java/org/apache/geronimo/deployment/cli/CommandInstallCAR.java URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/deploy-tool/src/java/org/apache/geronimo/deployment/cli/CommandInstallCAR.java?rev=398798&r1=398797&r2=398798&view=diff ============================================================================== --- geronimo/branches/1.1/modules/deploy-tool/src/java/org/apache/geronimo/deployment/cli/CommandInstallCAR.java (original) +++ geronimo/branches/1.1/modules/deploy-tool/src/java/org/apache/geronimo/deployment/cli/CommandInstallCAR.java Mon May 1 21:09:04 2006 @@ -87,7 +87,7 @@ } } - private DownloadResults showProgress(GeronimoDeploymentManager mgr, Object key) { + static DownloadResults showProgress(GeronimoDeploymentManager mgr, Object key) { System.out.println("Checking for status every 1000ms:"); String last = null, status; while(true) { Modified: geronimo/branches/1.1/modules/deploy-tool/src/java/org/apache/geronimo/deployment/cli/CommandListConfigurations.java URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/deploy-tool/src/java/org/apache/geronimo/deployment/cli/CommandListConfigurations.java?rev=398798&r1=398797&r2=398798&view=diff ============================================================================== --- geronimo/branches/1.1/modules/deploy-tool/src/java/org/apache/geronimo/deployment/cli/CommandListConfigurations.java (original) +++ geronimo/branches/1.1/modules/deploy-tool/src/java/org/apache/geronimo/deployment/cli/CommandListConfigurations.java Mon May 1 21:09:04 2006 @@ -86,8 +86,8 @@ Map.Entry entry = (Map.Entry) it.next(); String category = (String) entry.getKey(); List items = (List) entry.getValue(); - System.out.println(); - System.out.print(DeployUtils.reformat(category, 4, 72)); + out.println(); + out.print(DeployUtils.reformat(category, 4, 72)); for (int i = 0; i < items.size(); i++) { ConfigurationMetadata metadata = (ConfigurationMetadata) items.get(i); String prefix = " "; @@ -99,13 +99,18 @@ } prefix += ": "; } - System.out.print(DeployUtils.reformat(prefix+metadata.getName()+" ("+metadata.getVersion()+")", 8, 72)); - System.out.flush(); + out.print(DeployUtils.reformat(prefix+metadata.getName()+" ("+metadata.getVersion()+")", 8, 72)); + out.flush(); } } - System.out.println(); - System.out.print("Install Service [enter number or 'q' to quit]: "); - System.out.flush(); + if(available.size() == 0) { + out.println(); + out.println("No plugins from this site are eligible for installation."); + return; + } + out.println(); + out.print("Install Service [enter number or 'q' to quit]: "); + out.flush(); try { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String answer = in.readLine(); @@ -116,25 +121,25 @@ ConfigurationMetadata target = ((ConfigurationMetadata) available.get(selection - 1)); long start = System.currentTimeMillis(); Object key = mgr.startInstall(ConfigurationList.createInstallList(data, target.getConfigId()), null, null); - DownloadResults results = showProgress(mgr, key); + DownloadResults results = CommandInstallCAR.showProgress(mgr, key); int time = (int)(System.currentTimeMillis() - start) / 1000; - System.out.println(); + out.println(); if(!results.isFailed()) { - System.out.println(DeployUtils.reformat("**** Installation Complete!", 4, 72)); + out.println(DeployUtils.reformat("**** Installation Complete!", 4, 72)); for (int i = 0; i < results.getDependenciesPresent().length; i++) { Artifact uri = results.getDependenciesPresent()[i]; - System.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]; - System.out.print(DeployUtils.reformat("Installed new: "+uri, 4, 72)); + out.print(DeployUtils.reformat("Installed new: "+uri, 4, 72)); } - System.out.println(); - System.out.println(DeployUtils.reformat("Downloaded "+(results.getTotalDownloadBytes()/1024)+" kB in "+time+"s ("+results.getTotalDownloadBytes()/(1024*time)+" kB/s)", 4, 72)); + out.println(); + out.println(DeployUtils.reformat("Downloaded "+(results.getTotalDownloadBytes()/1024)+" kB in "+time+"s ("+results.getTotalDownloadBytes()/(1024*time)+" kB/s)", 4, 72)); } if(results.isFinished() && !results.isFailed()) { - System.out.print(DeployUtils.reformat("Now starting "+target.getConfigId()+"...", 4, 72)); - System.out.flush(); + out.print(DeployUtils.reformat("Now starting "+target.getConfigId()+"...", 4, 72)); + out.flush(); new CommandStart().execute(out, connection, new String[]{target.getConfigId().toString()}); } } catch (IOException e) { @@ -144,31 +149,6 @@ } } else { throw new DeploymentException("Cannot list repositories when connected to "+connection.getServerURI()); - } - } - - private DownloadResults showProgress(GeronimoDeploymentManager mgr, Object key) { - System.out.println("Checking for status every 1000ms:"); - while(true) { - DownloadResults results = mgr.checkOnInstall(key); - if(results.getCurrentFile() != null) { - if(results.getCurrentFilePercent() > -1) { - System.out.println(results.getCurrentMessage()+" ("+results.getCurrentFilePercent()+"%)"); - } else { - System.out.println(results.getCurrentMessage()); - } - } - if(results.isFinished()) { - if(results.isFailed()) { - System.err.println("Installation FAILED: "+results.getFailure().getMessage()); - } - return results; - } - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - return results; - } } } }