geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwo...@apache.org
Subject svn commit: r1141015 - in /geronimo/server/trunk/framework: configs/bundle-recorder/ configs/bundle-recorder/src/main/history/ configs/bundle-recorder/src/main/plan/ configs/karaf-framework/src/main/distribution/instance/var/config/ modules/geronimo-bu...
Date Wed, 29 Jun 2011 09:06:29 GMT
Author: rwonly
Date: Wed Jun 29 09:06:28 2011
New Revision: 1141015

URL: http://svn.apache.org/viewvc?rev=1141015&view=rev
Log:
GERONIMO-5764 record the bundles in startup.properties and add "deploy uninstall-bundle" cli

Added:
    geronimo/server/trunk/framework/modules/geronimo-bundle-recorder/src/main/java/org/apache/geronimo/system/bundle/Utils.java   (with props)
    geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/UninstallBundleCommandMetaData.java   (with props)
    geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandUninstallBundle.java   (with props)
Removed:
    geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/instance/var/config/bundle-records.csv
    geronimo/server/trunk/framework/modules/geronimo-bundle-recorder/src/main/java/org/apache/geronimo/system/bundle/CSVFileUtils.java
Modified:
    geronimo/server/trunk/framework/configs/bundle-recorder/pom.xml
    geronimo/server/trunk/framework/configs/bundle-recorder/src/main/history/dependencies.xml
    geronimo/server/trunk/framework/configs/bundle-recorder/src/main/plan/plan.xml
    geronimo/server/trunk/framework/modules/geronimo-bundle-recorder/src/main/java/org/apache/geronimo/system/bundle/BundleRecorder.java
    geronimo/server/trunk/framework/modules/geronimo-bundle-recorder/src/main/java/org/apache/geronimo/system/bundle/BundleRecorderGBean.java
    geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/DeployerCLParser.java
    geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/InstallBundleCommandArgs.java
    geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/InstallBundleCommandArgsImpl.java
    geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/InstallBundleCommandMetaData.java
    geronimo/server/trunk/framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/jmx/ExtendedDeploymentManager.java
    geronimo/server/trunk/framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/jmx/RemoteDeploymentManager.java
    geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandInstallBundle.java
    geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/DeployTool.java

Modified: geronimo/server/trunk/framework/configs/bundle-recorder/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/configs/bundle-recorder/pom.xml?rev=1141015&r1=1141014&r2=1141015&view=diff
==============================================================================
--- geronimo/server/trunk/framework/configs/bundle-recorder/pom.xml (original)
+++ geronimo/server/trunk/framework/configs/bundle-recorder/pom.xml Wed Jun 29 09:06:28 2011
@@ -38,6 +38,13 @@
             <artifactId>geronimo-bundle-recorder</artifactId>
             <version>${project.version}</version>
         </dependency>
+                
+        <dependency>
+            <groupId>org.apache.geronimo.framework</groupId>
+            <artifactId>j2ee-system</artifactId>
+            <version>${project.version}</version>
+            <type>car</type>
+        </dependency>
     </dependencies>
 
     <build>

Modified: geronimo/server/trunk/framework/configs/bundle-recorder/src/main/history/dependencies.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/configs/bundle-recorder/src/main/history/dependencies.xml?rev=1141015&r1=1141014&r2=1141015&view=diff
==============================================================================
--- geronimo/server/trunk/framework/configs/bundle-recorder/src/main/history/dependencies.xml (original)
+++ geronimo/server/trunk/framework/configs/bundle-recorder/src/main/history/dependencies.xml Wed Jun 29 09:06:28 2011
@@ -7,41 +7,6 @@
         <type>car</type>
     </module-id>
     <dependency>
-        <groupId>asm</groupId>
-        <artifactId>asm-all</artifactId>
-        <type>jar</type>
-    </dependency>
-    <dependency>
-        <groupId>commons-cli</groupId>
-        <artifactId>commons-cli</artifactId>
-        <type>jar</type>
-    </dependency>
-    <dependency>
-        <groupId>commons-lang</groupId>
-        <artifactId>commons-lang</artifactId>
-        <type>jar</type>
-    </dependency>
-    <dependency>
-        <groupId>org.apache.felix</groupId>
-        <artifactId>org.apache.felix.bundlerepository</artifactId>
-        <type>jar</type>
-    </dependency>
-    <dependency>
-        <groupId>org.apache.felix</groupId>
-        <artifactId>org.apache.felix.configadmin</artifactId>
-        <type>jar</type>
-    </dependency>
-    <dependency>
-        <groupId>org.apache.geronimo.bundles</groupId>
-        <artifactId>jaxb-impl</artifactId>
-        <type>jar</type>
-    </dependency>
-    <dependency>
-        <groupId>org.apache.geronimo.bundles</groupId>
-        <artifactId>woodstox-core-asl</artifactId>
-        <type>jar</type>
-    </dependency>
-    <dependency>
         <groupId>org.apache.geronimo.framework</groupId>
         <artifactId>geronimo-bundle-recorder</artifactId>
         <type>jar</type>
@@ -53,38 +18,8 @@
     </dependency>
     <dependency>
         <groupId>org.apache.geronimo.framework</groupId>
-        <artifactId>geronimo-common</artifactId>
-        <type>jar</type>
-    </dependency>
-    <dependency>
-        <groupId>org.apache.geronimo.framework</groupId>
-        <artifactId>geronimo-crypto</artifactId>
-        <type>jar</type>
-    </dependency>
-    <dependency>
-        <groupId>org.apache.geronimo.framework</groupId>
-        <artifactId>geronimo-kernel</artifactId>
-        <type>jar</type>
-    </dependency>
-    <dependency>
-        <groupId>org.apache.geronimo.framework</groupId>
-        <artifactId>geronimo-pax-logging</artifactId>
-        <type>jar</type>
-    </dependency>
-    <dependency>
-        <groupId>org.apache.geronimo.framework</groupId>
-        <artifactId>geronimo-system</artifactId>
-        <type>jar</type>
-    </dependency>
-    <dependency>
-        <groupId>org.apache.geronimo.specs</groupId>
-        <artifactId>geronimo-activation_1.1_spec</artifactId>
-        <type>jar</type>
-    </dependency>
-    <dependency>
-        <groupId>org.apache.geronimo.specs</groupId>
-        <artifactId>geronimo-jaxb_2.2_spec</artifactId>
-        <type>jar</type>
+        <artifactId>j2ee-system</artifactId>
+        <type>car</type>
     </dependency>
     <dependency>
         <groupId>org.apache.geronimo.specs</groupId>
@@ -92,31 +27,11 @@
         <type>jar</type>
     </dependency>
     <dependency>
-        <groupId>org.apache.geronimo.specs</groupId>
-        <artifactId>geronimo-stax-api_1.2_spec</artifactId>
-        <type>jar</type>
-    </dependency>
-    <dependency>
-        <groupId>org.apache.servicemix.bundles</groupId>
-        <artifactId>org.apache.servicemix.bundles.cglib</artifactId>
-        <type>jar</type>
-    </dependency>
-    <dependency>
-        <groupId>org.apache.servicemix.bundles</groupId>
-        <artifactId>org.apache.servicemix.bundles.commons-jexl</artifactId>
-        <type>jar</type>
-    </dependency>
-    <dependency>
         <groupId>org.apache.servicemix.bundles</groupId>
         <artifactId>org.apache.servicemix.bundles.xpp3</artifactId>
         <type>jar</type>
     </dependency>
     <dependency>
-        <groupId>org.apache.servicemix.bundles</groupId>
-        <artifactId>org.apache.servicemix.bundles.xstream</artifactId>
-        <type>jar</type>
-    </dependency>
-    <dependency>
         <groupId>org.apache.xbean</groupId>
         <artifactId>xbean-bundleutils</artifactId>
         <type>jar</type>
@@ -131,14 +46,4 @@
         <artifactId>xbean-reflect</artifactId>
         <type>jar</type>
     </dependency>
-    <dependency>
-        <groupId>org.codehaus.woodstox</groupId>
-        <artifactId>stax2-api</artifactId>
-        <type>jar</type>
-    </dependency>
-    <dependency>
-        <groupId>org.ops4j.pax.logging</groupId>
-        <artifactId>pax-logging-api</artifactId>
-        <type>jar</type>
-    </dependency>
 </plugin-artifact>

Modified: geronimo/server/trunk/framework/configs/bundle-recorder/src/main/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/configs/bundle-recorder/src/main/plan/plan.xml?rev=1141015&r1=1141014&r2=1141015&view=diff
==============================================================================
--- geronimo/server/trunk/framework/configs/bundle-recorder/src/main/plan/plan.xml (original)
+++ geronimo/server/trunk/framework/configs/bundle-recorder/src/main/plan/plan.xml Wed Jun 29 09:06:28 2011
@@ -17,11 +17,11 @@
 -->
 
 <module xmlns="http://geronimo.apache.org/xml/ns/deployment-${geronimoSchemaVersion}">
-    <!-- ServerInfo service -->
-    <gbean name="ServerInfo" class="org.apache.geronimo.system.serverinfo.BasicServerInfo"/>
-    
+
     <gbean name="GeronimoBundleRecorder" class="org.apache.geronimo.system.bundle.BundleRecorderGBean">
-        <attribute name="bundleRecordsFile">var/config/bundle-records.csv</attribute>
+        <reference name="Repository">
+            <name>Repository</name>
+        </reference>
         <reference name="ServerInfo">
             <name>ServerInfo</name>
         </reference>

Modified: geronimo/server/trunk/framework/modules/geronimo-bundle-recorder/src/main/java/org/apache/geronimo/system/bundle/BundleRecorder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-bundle-recorder/src/main/java/org/apache/geronimo/system/bundle/BundleRecorder.java?rev=1141015&r1=1141014&r2=1141015&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-bundle-recorder/src/main/java/org/apache/geronimo/system/bundle/BundleRecorder.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-bundle-recorder/src/main/java/org/apache/geronimo/system/bundle/BundleRecorder.java Wed Jun 29 09:06:28 2011
@@ -22,16 +22,22 @@ import java.io.IOException;
 public interface BundleRecorder {
     
     /**
-     * Record the bundle in recorded-bundles.properties and add to the bundleRecords map
+     * Record the bundle in startup.properties
      * @param bundleFile
-     * @param inplace
+     * @param groupId
      * @param startLevel
      * @return the installed bundle id, return -1 if installed failed
      * @throws IOException
      */
-    public long recordInstall(File bundleFile, boolean inplace, int startLevel) throws IOException;
+    public long recordInstall(File bundleFile,  String groupId, int startLevel) throws IOException;
     
     
+    /**
+     * Erase the bundle if it appears in startup.properties
+     * @param bundleId
+     * @throws IOException
+     */
+    public void eraseUninstall(long bundleId) throws IOException;
 }
 
 

Modified: geronimo/server/trunk/framework/modules/geronimo-bundle-recorder/src/main/java/org/apache/geronimo/system/bundle/BundleRecorderGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-bundle-recorder/src/main/java/org/apache/geronimo/system/bundle/BundleRecorderGBean.java?rev=1141015&r1=1141014&r2=1141015&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-bundle-recorder/src/main/java/org/apache/geronimo/system/bundle/BundleRecorderGBean.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-bundle-recorder/src/main/java/org/apache/geronimo/system/bundle/BundleRecorderGBean.java Wed Jun 29 09:06:28 2011
@@ -17,200 +17,60 @@
 package org.apache.geronimo.system.bundle;
 
 import java.io.File;
+import java.io.FileInputStream;
 import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Iterator;
-import java.util.List;
+import java.util.Properties;
+import java.util.jar.JarFile;
+import java.util.jar.Manifest;
 
 import org.apache.geronimo.common.DeploymentException;
-import org.apache.geronimo.gbean.GBeanLifecycle;
 import org.apache.geronimo.gbean.annotation.GBean;
-import org.apache.geronimo.gbean.annotation.ParamAttribute;
 import org.apache.geronimo.gbean.annotation.ParamReference;
 import org.apache.geronimo.gbean.annotation.ParamSpecial;
 import org.apache.geronimo.gbean.annotation.SpecialAttributeType;
 import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.kernel.repository.WritableListableRepository;
 import org.apache.geronimo.kernel.util.FileUtils;
 import org.apache.geronimo.system.serverinfo.ServerInfo;
-import org.apache.xbean.osgi.bundle.util.BundleUtils;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleEvent;
 import org.osgi.framework.BundleException;
 import org.osgi.framework.ServiceReference;
 import org.osgi.service.startlevel.StartLevel;
-import org.osgi.util.tracker.BundleTracker;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 @GBean
-public class BundleRecorderGBean implements BundleRecorder, GBeanLifecycle{
+public class BundleRecorderGBean implements BundleRecorder{
     
     private static final Logger log = LoggerFactory.getLogger(BundleRecorderGBean.class);
-    // A BundleRecord list maintained in runtime
-    private List<BundleRecord> bundleRecords = new ArrayList<BundleRecord>();
-    
+
     private BundleContext bundleContext;
     StartLevel startLevelService;
     int defaultBundleStartLevel;
         
-    private File recordFile;
-    private File recordDir;
-    
-    private BundleTracker uninstallBundleTracker;
+    private final WritableListableRepository writeableRepo;
     
+    private File startupFile;
+
     public BundleRecorderGBean(@ParamSpecial(type = SpecialAttributeType.kernel) Kernel kernel,
                                 @ParamSpecial(type = SpecialAttributeType.bundle) Bundle bundle,
                                 @ParamReference(name = "ServerInfo") final ServerInfo serverInfo,
-                                @ParamAttribute(name = "bundleRecordsFile") String bundleRecordsFile) throws DeploymentException, IOException {
+                                @ParamReference(name = "Repository", namingType = "Repository") WritableListableRepository repository) throws DeploymentException, IOException {
         
         bundleContext = bundle.getBundleContext();
         startLevelService = getStartLevelService(bundleContext);
         defaultBundleStartLevel = startLevelService.getInitialBundleStartLevel();
         
-        recordDir = serverInfo.resolveServer("repository/recorded-bundles/");
-        if (!recordDir.exists() && !recordDir.mkdirs()) {
-            throw new DeploymentException("Could not create directory for Bundle Recorder " + recordDir);
-        }
-        
-        recordFile = serverInfo.resolveServer(bundleRecordsFile);
-        if(!recordFile.exists() || !recordFile.isFile() || !recordFile.canRead()) {
-            throw new IllegalArgumentException("File does not exist or not a normal file or not readable. " + recordFile);
-        }
-        
-        List<String[]> recordsList = CSVFileUtils.loadCSVFile(recordFile);
-        
-        if (recordsList == null || recordsList.isEmpty()){
-            throw new RuntimeException("the record file should at least contains one header line : \"index, Location URI, Start Level\"");
-        }
-        
-        //the first line must be header
-        recordsList.remove(0);
-        
-        for (String[] records : recordsList){
-            // check, user can only add a location uri in record file without specifying a start level
-            if (records.length != 2 && records.length != 1){
-                log.error("Invalid record: " + records);
-            }
-            // get uri
-            URI uri = null;
-            try {
-                uri = new URI(records[0]);
-            } catch (URISyntaxException e) {
-                log.error(e.getMessage());
-                log.error("Invalid URI found in records: " + records);
-                continue;
-            }
-            // get start level
-            int startLevel = defaultBundleStartLevel;
-            if (records.length == 2){
-                int sl = Integer.valueOf(records[1]);
-                if (sl <= 0){
-                    log.warn("Invalid StartLevel found in records: " + records + ", use default bundle start level.");
-                } else {
-                    startLevel = sl;
-                }
-            }
-            
-            bundleRecords.add(new BundleRecord(uri, startLevel));
-        }
-        
-        // Track the uninstalled bundle, if we recorded it, erase the record.
-        uninstallBundleTracker = new BundleTracker(bundleContext, Bundle.UNINSTALLED, null){
-            @Override
-            public Object addingBundle(Bundle bundle, BundleEvent event) {
-                
-                BundleRecord bundleRecord = null;
-                for (Iterator<BundleRecord> it = bundleRecords.iterator(); it.hasNext();){
-                    BundleRecord record = it.next();
-                    if (record.uri.toString().equals(bundle.getLocation())){
-                        bundleRecord = record;
-                        //del from runtime
-                        it.remove();
-                        break;
-                    }
-                }
-                
-                if (bundleRecord != null){
-                    // del from record file
-                    try {
-                        CSVFileUtils.deleteByKeywordInCSVFile(recordFile, bundleRecord.uri.toString());
-                    } catch (IOException e) {
-                        log.error(e.getMessage());
-                    }
-                    
-                    // del file if not inplace (i.e. copied to repository/recorded-bundles folder)
-                    if (!recordDir.toURI().relativize(bundleRecord.uri).equals(bundleRecord.uri)){
-                        new File(bundleRecord.uri).delete();
-                    }
+        writeableRepo = repository;
                 
-                }//else we don't care the bundles not recorded here
-                
-                return bundle;
-            }
-        };
-        
-    }
-    
-    private static class BundleRecord {        
-        private URI uri;
-        private int startLevel;
-        
-        public BundleRecord(URI uri, int startLevel){
-            this.uri = uri;
-            this.startLevel = startLevel;
+        startupFile = serverInfo.resolveServer("etc/startup.properties");
+        if(!startupFile.exists() || !startupFile.isFile() || !startupFile.canRead()) {
+            throw new IllegalArgumentException("startup.properties file does not exist or not a normal file or not readable. " + startupFile);
         }
-
-    }
-    
-    @Override
-    public void doStart() throws Exception {
-        
-        // sort the BundleRecord list according to their start-level
-        Collections.sort(bundleRecords, new Comparator<BundleRecord>(){
-            @Override
-            public int compare(BundleRecord recordA, BundleRecord recordB) {
-                if (recordA == null && recordB ==null) return 0;
-                if (recordA == null) return -1;
-                if (recordB == null) return 1;
-                return recordA.startLevel - recordB.startLevel;
-            }
-        });
         
-        // per the osgi spec, if the bundle has been installed before, 
-        // the installBundle method should return immediately with the installed bundle
-        for (BundleRecord bundleRecord : bundleRecords){
-            // install the record
-            Bundle installedBundle = installBundleRecord(bundleRecord);
-            
-            // start
-            if (installedBundle != null) {
-                if (BundleUtils.canStart(installedBundle)) {
-                    try {
-                        installedBundle.start(Bundle.START_TRANSIENT);
-                    } catch (BundleException e) {
-                        log.error("Bundle starts failed: " + bundleRecord.uri);
-                    }
-                }
-            }
-        }
         
-        // open the bundle tracker
-        uninstallBundleTracker.open();
-    }
-
-    @Override
-    public void doStop() throws Exception {
-        // Do nothing
-    }
-    
-    @Override
-    public void doFail() {
-        // Do nothing
     }
     
     private StartLevel getStartLevelService(BundleContext bundleContext){
@@ -219,21 +79,22 @@ public class BundleRecorderGBean impleme
     }
         
     /**
-     * install the bundle to framework, and record the bundle object in the bundleRecord
-     * @param bundleRecord
+     * install the bundle to framework
+     * @param location
+     * @param startLevel
      * @return the bundle object of the installed bundle. null if install failed.
      */
-    private Bundle installBundleRecord(BundleRecord bundleRecord) {
+    private Bundle installBundleRecord(String location, int startLevel) {
             
         try {
             // install
-            Bundle installedBundle = bundleContext.installBundle(bundleRecord.uri.toString());
+            Bundle installedBundle = bundleContext.installBundle(location);
             // set start level
-            startLevelService.setBundleStartLevel(installedBundle, bundleRecord.startLevel);
+            startLevelService.setBundleStartLevel(installedBundle, startLevel);
             
             return installedBundle;
         } catch (BundleException e) {
-            log.error("Bundle installation failed: " + bundleRecord.uri);
+            log.error("Bundle installation failed: " + location);
         }
 
         
@@ -241,45 +102,143 @@ public class BundleRecorderGBean impleme
     }
     
     @Override
-    public long recordInstall(File bundleFile, boolean inplace, int startLevel) throws IOException{
-        File target = bundleFile;
-        if (!inplace){
-            // cp to repository/recorded-bundles
-            String fileName = bundleFile.getName();
-            target = new File(recordDir, fileName);
-            FileUtils.copyFile(bundleFile, target);
+    public long recordInstall(File bundleFile, String groupId, int startLevel) throws IOException{
+        if (bundleFile == null || bundleFile.isDirectory()) {
+            throw new IllegalArgumentException("The bundle File is not exist "+ bundleFile.getPath());
+        }
+        
+        // 1. copy to repo
+        Artifact artifact = null;
+        JarFile bundleJar = null;
+        try {
+            bundleJar = new JarFile(bundleFile);
+            Manifest mf = bundleJar.getManifest();
+            if (mf != null && mf.getMainAttributes().getValue("Bundle-SymbolicName") != null && mf.getMainAttributes().getValue("Bundle-Version") != null) {
+                
+                groupId = groupId != null ? groupId : Artifact.DEFAULT_GROUP_ID;
+                String artifactId = mf.getMainAttributes().getValue("Bundle-SymbolicName");
+                String version = mf.getMainAttributes().getValue("Bundle-Version");
+                String type = "jar";
+                artifact = new Artifact(groupId, artifactId, version, type);
+                
+                // check if the artifact exists
+                File target = writeableRepo.getLocation(artifact);
+                if (target!=null && target.exists()){
+                    throw new IllegalArgumentException("The target artifact exists in repo: " + artifact);
+                }
+                
+                // copy
+                writeableRepo.copyToRepository(bundleFile, artifact, null);
+
+            } else { // else not a bundle
+                throw new IllegalArgumentException("The file is not an OSGi bundle: " + bundleFile.getPath());
+            }
+        } finally {
+            if (bundleJar != null)
+                bundleJar.close();
         }
+
+        
+        // 2. install the bundle
+        String bundleLocation = getMvnLocationFromArtifact(artifact);
         
         if (startLevel <= 0){
             log.info("Invalid start level or no start level specified, use defalut bundle start level");
             startLevel = defaultBundleStartLevel;
         }
         
-        BundleRecord newRecord = new BundleRecord(target.toURI(),startLevel);
-        Bundle bundle = this.installBundleRecord(newRecord);
-        if (bundle != null) {
-            // check if we have recorded this
-            boolean recordedFlag = false;
-            for (BundleRecord record : bundleRecords){
-                if (record.uri.equals(newRecord.uri)){
-                    recordedFlag = true;
-                    log.warn("This bundle uri has been recorded: "+ newRecord.uri);
-                    break;
-                }
-            }
+        Bundle bundle = this.installBundleRecord(bundleLocation, startLevel);
+        if (bundle == null) return -1;
+
+        
+        // 3. record in startup.properties
+        String recordKey = getRecordKey(artifact);
+        
+        Properties startupBundles = new Properties();
+        startupBundles.load(new FileInputStream(startupFile)); 
+        if (startupBundles.containsKey(recordKey.toString())) { // check if we have recorded this
+            log.warn("This bundle has been recorded in startup.properties: "+ recordKey);
+        } else {
+            // record it
+            Utils.appendLine(startupFile, recordKey+"="+String.valueOf(startLevel));
+        }
             
-            if (!recordedFlag){
-                // reocrd it in runtime
-                bundleRecords.add(newRecord);
-                // record it in file
-                CSVFileUtils.appendToCSVFile(recordFile, new String[]{newRecord.uri.toString(), String.valueOf(newRecord.startLevel)});
-            }
+        return bundle.getBundleId();
+
+    }
+    
+    @Override
+    public void eraseUninstall(long bundleId) throws IOException{
+        
+        // uninstall bundle
+        Bundle bundle = bundleContext.getBundle(bundleId);
+        String bundleLocation = bundle.getLocation();
+        try {
+            bundle.uninstall();
+        } catch (BundleException e) {
+            log.error("Bundle uninstallation failed: " + bundleLocation);
+        }
+        
+        Artifact artifact = getArtifactFromMvnLocation(bundleLocation);
+        if (artifact == null) return;
+        String recordKey = getRecordKey(artifact);
+        if (recordKey == null) return;
+        if (Utils.findLineByKeyword(startupFile, recordKey) != null){
+            // erase from startup.properties
+            Utils.deleteLineByKeyword(startupFile, recordKey);
+            
+            // del the bundle file in repo
+            File target = writeableRepo.getLocation(artifact);
+            File versionFolder = target.getParentFile();
+            File artifactFolder = target.getParentFile().getParentFile();
+            
+            if (target!=null && target.exists())
+                target.delete(); // guarantee the target must be deleted
             
-            return bundle.getBundleId();
-        }else{
-            return -1;
+            FileUtils.recursiveDelete(versionFolder); // try delete the version folder recursively
+            
+            if (artifactFolder.listFiles().length == 0) 
+                artifactFolder.delete(); // delete the artifact folder if it is empty
         }
+                
+    }
+    
+    private String getMvnLocationFromArtifact(Artifact artifact){
+        if (artifact == null) return null;
+        
+        StringBuffer bundleLocation = new StringBuffer();
+        bundleLocation.append("mvn:");
+        bundleLocation.append(artifact.getGroupId()).append('/').append(artifact.getArtifactId()).append('/').append(artifact.getVersion());
+        
+        return bundleLocation.toString();
+    }
 
+    private Artifact getArtifactFromMvnLocation(String mvnLocation) {
+        if (!mvnLocation.startsWith("mvn:")) return null;
+        
+        String artifactString = mvnLocation.substring(4);
+        String[] parts = artifactString.split("/");
+        
+        if (parts==null || parts.length < 3) return null;
+        
+        String groupId = parts[0];
+        String artifactId = parts[1];
+        String version = parts[2];
+        String type = "jar";
+        
+        return new Artifact(groupId, artifactId, version, type);
+        
+    }
+    
+    private String getRecordKey(Artifact artifact) {
+        if (artifact == null) return null;
+        
+        StringBuffer recordKey = new StringBuffer();
+        recordKey.append(artifact.getGroupId().replace(".", "/")).append('/').append(artifact.getArtifactId()).append('/').append(artifact.getVersion());
+        recordKey.append("/");
+        recordKey.append(artifact.getArtifactId() + "-" + artifact.getVersion() + "." + artifact.getType());
+        
+        return recordKey.toString();
     }
     
 }

Added: geronimo/server/trunk/framework/modules/geronimo-bundle-recorder/src/main/java/org/apache/geronimo/system/bundle/Utils.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-bundle-recorder/src/main/java/org/apache/geronimo/system/bundle/Utils.java?rev=1141015&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-bundle-recorder/src/main/java/org/apache/geronimo/system/bundle/Utils.java (added)
+++ geronimo/server/trunk/framework/modules/geronimo-bundle-recorder/src/main/java/org/apache/geronimo/system/bundle/Utils.java Wed Jun 29 09:06:28 2011
@@ -0,0 +1,97 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.bundle;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+
+import org.apache.geronimo.kernel.util.IOUtils;
+
+public class Utils {
+    public static void appendLine(File file, String line) throws IOException {
+        BufferedWriter writer = null;
+        try {
+            writer = new BufferedWriter(new FileWriter(file, true));
+            writer.newLine();
+            writer.append(line);
+            writer.flush();
+        } finally {
+            IOUtils.close(writer);
+        }
+    }
+    
+    public static void deleteLineByKeyword(File file, String keyword) throws IOException{
+        BufferedReader reader = null;
+        BufferedWriter writer = null;
+
+        File tmpFile = new File(file.getAbsolutePath()+".tmpfile");
+        try {
+            reader = new BufferedReader(new FileReader(file));
+            writer = new BufferedWriter(new FileWriter(tmpFile,true));
+            String line = null;
+            while (( line = reader.readLine()) != null){
+                if (line.startsWith("#")) { // comments line
+                    writer.append(line);
+                    writer.newLine();
+                    continue;
+                }
+                                
+                if (line.contains(keyword)) continue;
+                
+                writer.append(line);
+                writer.newLine();
+            }
+            
+        } finally {
+            reader.close();
+            writer.close();
+        }
+        
+        if (file.delete()){
+            tmpFile.renameTo(file);
+        }else{
+            tmpFile.delete();
+            throw new RuntimeException("Can not delete a line in file: " + file.getAbsolutePath());
+        }
+
+    }
+    
+    public static String findLineByKeyword(File file, String keyword) throws IOException{
+        BufferedReader reader = null;
+        try {
+            reader = new BufferedReader(new FileReader(file));
+            String line = null;
+            while (( line = reader.readLine()) != null){
+                if (line.startsWith("#")) continue;
+                
+                if (line.contains(keyword)) return line;
+            }
+            
+        } finally {
+            reader.close();
+        }
+        
+        return null;
+        
+    }
+    
+   
+}

Propchange: geronimo/server/trunk/framework/modules/geronimo-bundle-recorder/src/main/java/org/apache/geronimo/system/bundle/Utils.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/DeployerCLParser.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/DeployerCLParser.java?rev=1141015&r1=1141014&r2=1141015&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/DeployerCLParser.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/DeployerCLParser.java Wed Jun 29 09:06:28 2011
@@ -92,6 +92,7 @@ public class DeployerCLParser extends Ba
         commandMetaData.add(EncryptCommandMetaData.META_DATA);
         commandMetaData.add(UnlockKeystoreCommandMetaData.META_DATA);
         commandMetaData.add(InstallBundleCommandMetaData.META_DATA);
+        commandMetaData.add(UninstallBundleCommandMetaData.META_DATA);
 
         addURI();
         addHost();

Modified: geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/InstallBundleCommandArgs.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/InstallBundleCommandArgs.java?rev=1141015&r1=1141014&r2=1141015&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/InstallBundleCommandArgs.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/InstallBundleCommandArgs.java Wed Jun 29 09:06:28 2011
@@ -18,12 +18,12 @@ package org.apache.geronimo.cli.deployer
 
 public interface InstallBundleCommandArgs  extends CommandArgs {
 
-    boolean isInPlace(); 
-    
     boolean isStart();
     
     int getStartLevel();
     
+    String getGroupId();
+    
     
 
 }

Modified: geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/InstallBundleCommandArgsImpl.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/InstallBundleCommandArgsImpl.java?rev=1141015&r1=1141014&r2=1141015&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/InstallBundleCommandArgsImpl.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/InstallBundleCommandArgsImpl.java Wed Jun 29 09:06:28 2011
@@ -27,8 +27,8 @@ import org.apache.geronimo.cli.CLParserE
 
 public class InstallBundleCommandArgsImpl implements InstallBundleCommandArgs {
 
-    private final static String ARGUMENT_IN_PLACE_SHORTFORM = "i";
-    private final static String ARGUMENT_IN_PLACE = "inPlace";
+    private final static String ARGUMENT_GROUP_ID_SHORTFORM = "g";
+    private final static String ARGUMENT_GROUP_ID = "groupId";
     
     private final static String ARGUMENT_START_SHORTFORM = "s";
     private final static String ARGUMENT_START = "start";
@@ -41,7 +41,7 @@ public class InstallBundleCommandArgsImp
 
     public InstallBundleCommandArgsImpl(String[] args) throws CLParserException {
         options = new Options();
-        addInPlace();
+        addGroupId();
         addStart();
         addStartLevel();
         
@@ -56,14 +56,6 @@ public class InstallBundleCommandArgsImp
             throw new CLParserException("Must specify a bundle location");
         }
     }
-
-    
-    protected void addInPlace() {
-        options.addOption(ARGUMENT_IN_PLACE_SHORTFORM,
-                ARGUMENT_IN_PLACE,
-                false,
-                "If inPlace is provided, the bundle is not copied to the \"repository/recorded-bundles\" directory.");
-    }
     
     protected void addStart() {
         options.addOption(ARGUMENT_START_SHORTFORM,
@@ -78,16 +70,16 @@ public class InstallBundleCommandArgsImp
         optionBuilder = optionBuilder.withDescription("If no start level are provided, will use the framework's initial bundle start level");
         Option option = optionBuilder.create(ARGUMENT_START_LEVEL_SHORTFORM);
         options.addOption(option);
-        
     }
-
-    
     
-    @Override
-    public boolean isInPlace() {
-        return commandLine.hasOption(ARGUMENT_IN_PLACE_SHORTFORM);
+    protected void addGroupId() {
+        OptionBuilder optionBuilder = OptionBuilder.hasArg().withArgName("groupId");
+        optionBuilder = optionBuilder.withLongOpt(ARGUMENT_GROUP_ID);
+        optionBuilder = optionBuilder.withDescription("If gourpId is not provided, will use \"default\" as its group id.");
+        Option option = optionBuilder.create(ARGUMENT_GROUP_ID_SHORTFORM);
+        options.addOption(option);
     }
-    
+
     @Override
     public boolean isStart() {
         return commandLine.hasOption(ARGUMENT_START_SHORTFORM);
@@ -102,7 +94,11 @@ public class InstallBundleCommandArgsImp
         return Integer.valueOf(startLevelStr);
     }
     
-    
+    @Override
+    public String getGroupId(){
+        String groupId = commandLine.getOptionValue(ARGUMENT_GROUP_ID_SHORTFORM);
+        return groupId;
+    }
     
     @Override
     public String[] getArgs() {

Modified: geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/InstallBundleCommandMetaData.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/InstallBundleCommandMetaData.java?rev=1141015&r1=1141014&r2=1141015&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/InstallBundleCommandMetaData.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/InstallBundleCommandMetaData.java Wed Jun 29 09:06:28 2011
@@ -24,7 +24,7 @@ public class InstallBundleCommandMetaDat
     private InstallBundleCommandMetaData() {
         super("install-bundle", 
                 "2. Other Commands", 
-                "[--inPlace] [--startLevel number] [--start] bundleFile",
+                "[--groupId groupId] [--startLevel number] [--start] bundleFile",
                 "Install and record an OSGi bundle file in Geronimo so that it can be automatically started " + 
                 "even after you cleaned the cache directory of the OSGi framework."
                 );

Added: geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/UninstallBundleCommandMetaData.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/UninstallBundleCommandMetaData.java?rev=1141015&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/UninstallBundleCommandMetaData.java (added)
+++ geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/UninstallBundleCommandMetaData.java Wed Jun 29 09:06:28 2011
@@ -0,0 +1,30 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.cli.deployer;
+
+public class UninstallBundleCommandMetaData extends BaseCommandMetaData {
+    public static final CommandMetaData META_DATA = new UninstallBundleCommandMetaData();
+
+    private UninstallBundleCommandMetaData() {
+        super("uninstall-bundle", 
+                "2. Other Commands", 
+                "bundleId",
+                "Uninstall the bundle and erase its record if it appears in startup.properties."
+                );
+    }
+
+}
\ No newline at end of file

Propchange: geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/UninstallBundleCommandMetaData.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: geronimo/server/trunk/framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/jmx/ExtendedDeploymentManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/jmx/ExtendedDeploymentManager.java?rev=1141015&r1=1141014&r2=1141015&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/jmx/ExtendedDeploymentManager.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/jmx/ExtendedDeploymentManager.java Wed Jun 29 09:06:28 2011
@@ -320,14 +320,23 @@ public abstract class ExtendedDeployment
         return getImplementation(BundleRecorder.class);
     }
     
-    public long recordInstall(File bundleFile, boolean inplace, int startLevel) throws IOException {
+    @Override
+    public long recordInstall(File bundleFile, String groupId, int startLevel) throws IOException {
         BundleRecorder recorder = getBundleRecorder();
         try {
-            return recorder.recordInstall(bundleFile, inplace, startLevel);
+            return recorder.recordInstall(bundleFile, groupId, startLevel);
         } finally {
             kernel.getProxyManager().destroyProxy(recorder);
         }
     }
     
-   
+    @Override
+    public void eraseUninstall(long bundleId) throws IOException {
+        BundleRecorder recorder = getBundleRecorder();
+        try {
+            recorder.eraseUninstall(bundleId);
+        } finally {
+            kernel.getProxyManager().destroyProxy(recorder);
+        }
+    }
 }

Modified: geronimo/server/trunk/framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/jmx/RemoteDeploymentManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/jmx/RemoteDeploymentManager.java?rev=1141015&r1=1141014&r2=1141015&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/jmx/RemoteDeploymentManager.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/jmx/RemoteDeploymentManager.java Wed Jun 29 09:06:28 2011
@@ -213,12 +213,12 @@ public class RemoteDeploymentManager ext
     }
     
     @Override
-    public long recordInstall(File bundleFile, boolean inplace, int startLevel) throws IOException {
+    public long recordInstall(File bundleFile, String gourpId, int startLevel) throws IOException {
         if(!isSameMachine) {
             throw new UnsupportedOperationException("recordBundle operation is not supportted from a remote JMX connection.");
         }
         
-        return super.recordInstall(bundleFile, inplace, startLevel);
+        return super.recordInstall(bundleFile, gourpId, startLevel);
     }
     
     public static final GBeanInfo GBEAN_INFO;

Modified: geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandInstallBundle.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandInstallBundle.java?rev=1141015&r1=1141014&r2=1141015&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandInstallBundle.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandInstallBundle.java Wed Jun 29 09:06:28 2011
@@ -49,11 +49,12 @@ public class CommandInstallBundle extend
             DeploymentManager dmgr = connection.getDeploymentManager();
             if(dmgr instanceof GeronimoDeploymentManager) {
                 GeronimoDeploymentManager mgr = (GeronimoDeploymentManager) dmgr;
-                boolean inPlace = recordBundleCommandArgs.isInPlace();
+                
                 boolean start = recordBundleCommandArgs.isStart();
                 int startLevel = recordBundleCommandArgs.getStartLevel();
+                String groupId = recordBundleCommandArgs.getGroupId();
                 try {
-                    long bundleId = mgr.recordInstall(bundleFile, inPlace, startLevel);
+                    long bundleId = mgr.recordInstall(bundleFile, groupId, startLevel);
                     if ( bundleId > 0 ){
                         consoleReader.printString(DeployUtils.reformat("Installed and recorded bundle: " + bundleId, 4, 72));
                         

Added: geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandUninstallBundle.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandUninstallBundle.java?rev=1141015&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandUninstallBundle.java (added)
+++ geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandUninstallBundle.java Wed Jun 29 09:06:28 2011
@@ -0,0 +1,57 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.deployment.cli;
+
+import java.io.IOException;
+
+import javax.enterprise.deploy.spi.DeploymentManager;
+
+import org.apache.geronimo.cli.deployer.CommandArgs;
+import org.apache.geronimo.common.DeploymentException;
+import org.apache.geronimo.deployment.plugin.GeronimoDeploymentManager;
+
+public class CommandUninstallBundle extends AbstractCommand {
+    public void execute(ConsoleReader consoleReader, ServerConnection connection, CommandArgs commandArgs) throws DeploymentException {
+        
+        if (!isOffline(connection)) {
+            
+            long bundleId = Long.parseLong(commandArgs.getArgs()[0]);
+            
+            DeploymentManager dmgr = connection.getDeploymentManager();
+            if(dmgr instanceof GeronimoDeploymentManager) {
+                GeronimoDeploymentManager mgr = (GeronimoDeploymentManager) dmgr;
+                try {
+                    mgr.eraseUninstall(bundleId);
+                    consoleReader.printString(DeployUtils.reformat("Uninstalled and erased bundle: " + bundleId, 4, 72));
+                    
+                } catch (Exception e) {
+                    throw new DeploymentException("Unable to erase bundle: " + bundleId, e);
+                }
+            } else {
+                throw new DeploymentException("Unable to uninstall bundle using " + dmgr.getClass().getName() + " deployment manager");
+            }
+            
+        } else { //offline not supported
+            try {
+                consoleReader.printString(DeployUtils.reformat("Uninstall bundle offline is not supported!", 4, 72));
+            } catch (IOException e) {
+                throw new DeploymentException("Uninstall bundle offline is not supported!");
+            }
+        }
+    }
+    
+}

Propchange: geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandUninstallBundle.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/DeployTool.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/DeployTool.java?rev=1141015&r1=1141014&r2=1141015&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/DeployTool.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/DeployTool.java Wed Jun 29 09:06:28 2011
@@ -46,6 +46,7 @@ import org.apache.geronimo.cli.deployer.
 import org.apache.geronimo.cli.deployer.StartCommandMetaData;
 import org.apache.geronimo.cli.deployer.StopCommandMetaData;
 import org.apache.geronimo.cli.deployer.UndeployCommandMetaData;
+import org.apache.geronimo.cli.deployer.UninstallBundleCommandMetaData;
 import org.apache.geronimo.cli.deployer.UnlockKeystoreCommandMetaData;
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.gbean.GBeanInfo;
@@ -90,6 +91,7 @@ public class DeployTool implements Main 
         commands.put(EncryptCommandMetaData.META_DATA, new CommandEncrypt());
         commands.put(UnlockKeystoreCommandMetaData.META_DATA, new CommandUnlockKeystore());
         commands.put(InstallBundleCommandMetaData.META_DATA, new CommandInstallBundle());
+        commands.put(UninstallBundleCommandMetaData.META_DATA, new CommandUninstallBundle());
     }
 
     private boolean failed = false;



Mime
View raw message