Author: gnodet
Date: Sat Feb 14 19:46:05 2009
New Revision: 744563

URL: http://svn.apache.org/viewvc?rev=744563&view=rev
Log:
Fix SMX4NMR-84, SMX4NMR-88 and SMX4NMR-90, add some integration tests

Added:
    
servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/OsgiMultiParentClassLoader.java
    
servicemix/smx4/nmr/trunk/jbi/itests/src/test/java/org/apache/servicemix/jbi/ManagementTest.java
Modified:
    
servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/ComponentImpl.java
    
servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/Deployer.java
    
servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/SharedLibraryImpl.java
    servicemix/smx4/nmr/trunk/jbi/itests/pom.xml
    
servicemix/smx4/nmr/trunk/jbi/itests/src/test/java/org/apache/servicemix/jbi/IntegrationTest.java
    
servicemix/smx4/nmr/trunk/jbi/itests/src/test/resources/org/apache/servicemix/MANIFEST.MF
    
servicemix/smx4/nmr/trunk/jbi/management/src/main/java/org/apache/servicemix/jbi/management/AbstractInstaller.java
    
servicemix/smx4/nmr/trunk/jbi/management/src/main/java/org/apache/servicemix/jbi/management/AdminCommandsService.java
    
servicemix/smx4/nmr/trunk/jbi/management/src/main/java/org/apache/servicemix/jbi/management/AdminService.java
    
servicemix/smx4/nmr/trunk/jbi/management/src/main/java/org/apache/servicemix/jbi/management/ComponentInstaller.java
    
servicemix/smx4/nmr/trunk/jbi/management/src/main/java/org/apache/servicemix/jbi/management/ManagementSupport.java
    
servicemix/smx4/nmr/trunk/jbi/management/src/main/java/org/apache/servicemix/jbi/management/ServiceAssemblyInstaller.java
    
servicemix/smx4/nmr/trunk/jbi/management/src/main/resources/META-INF/spring/servicemix-jbi-management.xml
    servicemix/smx4/nmr/trunk/pom.xml

Modified: 
servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/ComponentImpl.java
URL: 
http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/ComponentImpl.java?rev=744563&r1=744562&r2=744563&view=diff
==============================================================================
--- 
servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/ComponentImpl.java
 (original)
+++ 
servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/ComponentImpl.java
 Sat Feb 14 19:46:05 2009
@@ -49,9 +49,9 @@
 
     private static final Log LOGGER = LogFactory.getLog(ComponentImpl.class);
 
-    private static final String STATE = "state";
+    public static final String STATE = "state";
 
-    protected enum State {
+    public enum State {
         Unknown,
         Initialized,
         Started,
@@ -75,7 +75,7 @@
         this.componentDesc = componentDesc;
         this.component = new ComponentWrapper(component);
         this.prefs = prefs;
-        this.runningState = State.valueOf(this.prefs.get(STATE, (autoStart ? 
State.Started : State.Initialized).name()));
+        this.runningState = State.valueOf(this.prefs.get(STATE, (autoStart ? 
State.Started : State.Shutdown).name()));
         this.deployer = deployer;
         this.serviceUnits = new ArrayList<ServiceUnitImpl>();
     }
@@ -267,19 +267,30 @@
             ClassLoader cl = Thread.currentThread().getContextClassLoader();
             try {
                 
Thread.currentThread().setContextClassLoader(component.getClass().getClassLoader());
-                lifeCycle.init(context);
-                state = State.Initialized;
-                if (runningState == State.Started) {
-                    start();
-                    state = State.Started;
-                } else if (runningState == State.Stopped) {
-                    start();
-                    state = State.Started;
-                    stop();
-                    state = State.Stopped;
-                } else if (runningState == State.Shutdown) {
-                    shutDown();
-                    state = State.Shutdown;
+                if (runningState != State.Unknown) {
+                    if (runningState == State.Initialized) {
+                        LOGGER.warn("Illegal running state: 'Initialized'.  
Defaulting to 'Shutdown'.");
+                        runningState = State.Shutdown;
+                    }
+                    if (runningState == State.Started) {
+                        lifeCycle.init(context);
+                        state = State.Initialized;
+                        start();
+                        state = State.Started;
+                    } else if (runningState == State.Stopped) {
+                        lifeCycle.init(context);
+                        state = State.Initialized;
+                        start();
+                        state = State.Started;
+                        stop();
+                        state = State.Stopped;
+                    } else if (runningState == State.Shutdown) {
+                        state = State.Shutdown;
+                    }
+                    runningState = State.Unknown;
+                } else {
+                    lifeCycle.init(context);
+                    state = State.Initialized;
                 }
                 deployer.checkPendingBundles();
             } finally {

Modified: 
servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/Deployer.java
URL: 
http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/Deployer.java?rev=744563&r1=744562&r2=744563&view=diff
==============================================================================
--- 
servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/Deployer.java
 (original)
+++ 
servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/Deployer.java
 Sat Feb 14 19:46:05 2009
@@ -22,6 +22,7 @@
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.net.URL;
+import java.net.MalformedURLException;
 import java.util.ArrayList;
 import java.util.Dictionary;
 import java.util.Enumeration;
@@ -51,7 +52,6 @@
 import org.apache.servicemix.jbi.deployer.descriptor.Identification;
 import org.apache.servicemix.jbi.deployer.descriptor.Target;
 import org.apache.servicemix.jbi.runtime.ComponentWrapper;
-import org.apache.xbean.classloader.MultiParentClassLoader;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceRegistration;
@@ -422,6 +422,7 @@
     }
 
     protected void uninstallSharedLibrary(SharedLibraryDesc sharedLibraryDesc, 
Bundle bundle) throws JBIException {
+        
sharedLibraries.remove(sharedLibraryDesc.getIdentification().getName());
     }
 
     protected void maybeWrapComponent(ServiceReference reference, 
javax.jbi.component.Component component) {
@@ -498,14 +499,15 @@
         // Create parents classloaders
         ClassLoader[] parents;
         if (component.getSharedLibraries() != null) {
-            parents = new ClassLoader[component.getSharedLibraries().length + 
1];
+            parents = new ClassLoader[component.getSharedLibraries().length + 
2];
             for (int i = 0; i < component.getSharedLibraries().length; i++) {
-                parents[i + 1] = 
getSharedLibraryClassLoader(component.getSharedLibraries()[i]);
+                parents[i + 2] = 
getSharedLibraryClassLoader(component.getSharedLibraries()[i]);
             }
         } else {
-            parents = new ClassLoader[1];
+            parents = new ClassLoader[2];
         }
-        parents[0] = 
BundleDelegatingClassLoader.createBundleClassLoaderFor(bundle, 
getClass().getClassLoader());
+        parents[0] = 
BundleDelegatingClassLoader.createBundleClassLoaderFor(getBundleContext().getBundle(0));
+        parents[1] = 
BundleDelegatingClassLoader.createBundleClassLoaderFor(bundle, 
getClass().getClassLoader());
 
         // Create urls
         String[] classPathNames = 
component.getComponentClassPath().getPathElements();
@@ -515,10 +517,19 @@
             if (urls[i] == null) {
                 throw new IllegalArgumentException("SharedLibrary classpath 
entry not found: '" +  classPathNames[i] + "'");
             }
+            Enumeration en = bundle.findEntries(classPathNames[i], null, 
false);
+            if (en != null && en.hasMoreElements()) {
+                try {
+                    urls[i] = new URL(urls[i].toString() + "/");
+                } catch (MalformedURLException e) {
+                    // Ignore
+                }
+            }
         }
 
         // Create classloader
-        return new MultiParentClassLoader(
+        return new OsgiMultiParentClassLoader(
+                        bundle,
                         component.getIdentification().getName(),
                         urls,
                         parents,

Added: 
servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/OsgiMultiParentClassLoader.java
URL: 
http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/OsgiMultiParentClassLoader.java?rev=744563&view=auto
==============================================================================
--- 
servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/OsgiMultiParentClassLoader.java
 (added)
+++ 
servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/OsgiMultiParentClassLoader.java
 Sat Feb 14 19:46:05 2009
@@ -0,0 +1,150 @@
+/*
+ * 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.servicemix.jbi.deployer.impl;
+
+import java.net.URL;
+import java.net.URLStreamHandlerFactory;
+import java.util.Collection;
+import java.util.List;
+import java.util.ArrayList;
+import java.io.InputStream;
+import java.io.ByteArrayOutputStream;
+
+import org.apache.xbean.classloader.MultiParentClassLoader;
+import org.osgi.framework.Bundle;
+
+public class OsgiMultiParentClassLoader extends MultiParentClassLoader {
+
+    private Bundle bundle;
+    private URL[] urls;
+
+    public OsgiMultiParentClassLoader(Bundle bundle, String name, URL[] urls) {
+        this(bundle, name, urls, ClassLoader.getSystemClassLoader());
+    }
+
+    public OsgiMultiParentClassLoader(Bundle bundle, String name, URL[] urls, 
ClassLoader parent) {
+        this(bundle, name, urls, new ClassLoader[] {parent});
+    }
+
+    public OsgiMultiParentClassLoader(Bundle bundle, String name, URL[] urls, 
ClassLoader parent, URLStreamHandlerFactory factory) {
+        this(bundle, name, urls, new ClassLoader[] {parent}, factory);
+    }
+
+    public OsgiMultiParentClassLoader(Bundle bundle, String name, URL[] urls, 
ClassLoader[] parents) {
+        this(bundle, name, urls, parents, false, new String[0], new String[0]);
+    }
+
+    public OsgiMultiParentClassLoader(Bundle bundle, String name, URL[] urls, 
ClassLoader parent, boolean inverseClassLoading, String[] hiddenClasses, 
String[] nonOverridableClasses) {
+        this(bundle, name, urls, new ClassLoader[]{parent}, 
inverseClassLoading, hiddenClasses, nonOverridableClasses);
+    }
+
+    public OsgiMultiParentClassLoader(Bundle bundle, String name, URL[] urls, 
ClassLoader[] parents, URLStreamHandlerFactory factory) {
+        super(name, getNonDirUrls(urls), parents, factory);
+        this.bundle = bundle;
+        this.urls = getDirUrls(urls);
+    }
+
+    public OsgiMultiParentClassLoader(Bundle bundle, String name, URL[] urls, 
ClassLoader[] parents, boolean inverseClassLoading, Collection hiddenClasses, 
Collection nonOverridableClasses) {
+        this(bundle, name, urls, parents, inverseClassLoading, (String[]) 
hiddenClasses.toArray(new String[hiddenClasses.size()]), (String[]) 
nonOverridableClasses.toArray(new String[nonOverridableClasses.size()]));
+    }
+
+    public OsgiMultiParentClassLoader(Bundle bundle, String name, URL[] urls, 
ClassLoader[] parents, boolean inverseClassLoading, String[] hiddenClasses, 
String[] nonOverridableClasses) {
+        super(name, getNonDirUrls(urls), parents, inverseClassLoading, 
hiddenClasses, nonOverridableClasses);
+        this.bundle = bundle;
+        this.urls = getDirUrls(urls);
+    }
+
+
+    @Override
+    protected Class<?> findClass(final String name) throws 
ClassNotFoundException {
+        Class clazz = null;
+        // Call parent
+        try {
+            clazz = super.findClass(name);
+        } catch (ClassNotFoundException e) {
+            // Ignore
+        }
+        // Search for class in module.
+        if (clazz == null) {
+            String path = name.replace('.', '/').concat(".class");
+            byte[] bytes = null;
+            for (int i = 0; (bytes == null) && (i < urls.length); i++) {
+                try {
+                    String p = urls[i].getPath() + path;
+                    if (p.startsWith("/")) {
+                        p = p.substring(1);
+                    }
+                    URL url = bundle.getEntry(p);
+                    if (url != null) {
+                        InputStream is = url.openStream();
+                        try {
+                            ByteArrayOutputStream baos = new 
ByteArrayOutputStream();
+                            FileUtil.copyInputStream(is, baos);
+                            bytes = baos.toByteArray();
+                        } finally {
+                            is.close();
+                        }
+                    }
+                } catch (Throwable t) {
+                    // Ignore
+                }
+            }
+            if (bytes != null) {
+                String pkgName = getClassPackage(name);
+                if (pkgName.length() > 0) {
+                    if (getPackage(pkgName) == null) {
+                        definePackage(pkgName, null, null, null, null, null, 
null, null);
+                    }
+                }
+                if (clazz == null) {
+                    clazz = defineClass(name, bytes, 0, bytes.length);
+                }
+            }
+        }
+        if (clazz == null) {
+            throw new ClassNotFoundException(name);
+        }
+        return clazz;
+    }
+
+    public static String getClassPackage(String className) {
+        if (className == null) {
+            className = "";
+        }
+        return (className.lastIndexOf('.') < 0) ? "" : className.substring(0, 
className.lastIndexOf('.'));
+    }
+
+    private static URL[] getDirUrls(URL[] urls) {
+        List<URL> l = new ArrayList<URL>();
+        for (URL u : urls) {
+            if (u.toString().endsWith("/")) {
+                l.add(u);
+            }
+        }
+        return l.toArray(new URL[l.size()]);
+    }
+
+    private static URL[] getNonDirUrls(URL[] urls) {
+        List<URL> l = new ArrayList<URL>();
+        for (URL u : urls) {
+            if (!u.toString().endsWith("/")) {
+                l.add(u);
+            }
+        }
+        return l.toArray(new URL[l.size()]);
+    }
+}

Modified: 
servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/SharedLibraryImpl.java
URL: 
http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/SharedLibraryImpl.java?rev=744563&r1=744562&r2=744563&view=diff
==============================================================================
--- 
servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/SharedLibraryImpl.java
 (original)
+++ 
servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/SharedLibraryImpl.java
 Sat Feb 14 19:46:05 2009
@@ -17,8 +17,10 @@
 package org.apache.servicemix.jbi.deployer.impl;
 
 import java.net.URL;
+import java.net.MalformedURLException;
 import java.util.List;
 import java.util.ArrayList;
+import java.util.Enumeration;
 
 import org.apache.servicemix.jbi.deployer.SharedLibrary;
 import org.apache.servicemix.jbi.deployer.descriptor.ClassPath;
@@ -67,10 +69,19 @@
                     if (url == null) {
                         throw new IllegalArgumentException("SharedLibrary 
classpath entry not found: '" +  classPathNames[i] + "'");
                     }
+                    Enumeration en = bundle.findEntries(classPathNames[i], 
null, false);
+                    if (en != null && en.hasMoreElements()) {
+                        try {
+                            url = new URL(url.toString() + "/");
+                        } catch (MalformedURLException e) {
+                            // Ignore
+                        }
+                    }
                     urls.add(url);
                 }
             }
-            classLoader = new MultiParentClassLoader(
+            classLoader = new OsgiMultiParentClassLoader(
+                            bundle,
                             library.getIdentification().getName(),
                             urls.toArray(new URL[urls.size()]),
                             parent,

Modified: servicemix/smx4/nmr/trunk/jbi/itests/pom.xml
URL: 
http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/itests/pom.xml?rev=744563&r1=744562&r2=744563&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/jbi/itests/pom.xml (original)
+++ servicemix/smx4/nmr/trunk/jbi/itests/pom.xml Sat Feb 14 19:46:05 2009
@@ -101,6 +101,16 @@
             <scope>test</scope>
         </dependency>
         <dependency>
+            <groupId>org.apache.servicemix.jbi</groupId>
+            <artifactId>org.apache.servicemix.jbi.management</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.servicemix.kernel</groupId>
+            <artifactId>org.apache.servicemix.kernel.management</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>org.apache.felix</groupId>
             <artifactId>org.apache.felix.prefs</artifactId>
             <scope>test</scope>

Modified: 
servicemix/smx4/nmr/trunk/jbi/itests/src/test/java/org/apache/servicemix/jbi/IntegrationTest.java
URL: 
http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/itests/src/test/java/org/apache/servicemix/jbi/IntegrationTest.java?rev=744563&r1=744562&r2=744563&view=diff
==============================================================================
--- 
servicemix/smx4/nmr/trunk/jbi/itests/src/test/java/org/apache/servicemix/jbi/IntegrationTest.java
 (original)
+++ 
servicemix/smx4/nmr/trunk/jbi/itests/src/test/java/org/apache/servicemix/jbi/IntegrationTest.java
 Sat Feb 14 19:46:05 2009
@@ -37,8 +37,6 @@
 
 public class IntegrationTest extends AbstractIntegrationTest {
 
-    private Properties dependencies;
-
     /**
         * The manifest to use for the "virtual bundle" created
         * out of the test classes and resources in this project
@@ -82,7 +80,10 @@
             getBundle("org.apache.servicemix.jbi", 
"org.apache.servicemix.jbi.runtime"),
             getBundle("org.apache.servicemix.jbi", 
"org.apache.servicemix.jbi.deployer"),
             getBundle("org.apache.servicemix.jbi", 
"org.apache.servicemix.jbi.osgi"),
+            getBundle("org.apache.servicemix.jbi", 
"org.apache.servicemix.jbi.management"),
             getBundle("org.apache.servicemix.kernel", 
"org.apache.servicemix.kernel.filemonitor"),
+            getBundle("org.apache.servicemix.kernel", 
"org.apache.servicemix.kernel.management"),
+            getBundle("org.apache.servicemix.bundles", 
"org.apache.servicemix.bundles.ant"),
             getBundle("org.apache.servicemix.bundles", 
"org.apache.servicemix.bundles.woodstox"),
             getBundle("org.apache.servicemix.bundles", 
"org.apache.servicemix.bundles.wsdl4j"),
                };

Added: 
servicemix/smx4/nmr/trunk/jbi/itests/src/test/java/org/apache/servicemix/jbi/ManagementTest.java
URL: 
http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/itests/src/test/java/org/apache/servicemix/jbi/ManagementTest.java?rev=744563&view=auto
==============================================================================
--- 
servicemix/smx4/nmr/trunk/jbi/itests/src/test/java/org/apache/servicemix/jbi/ManagementTest.java
 (added)
+++ 
servicemix/smx4/nmr/trunk/jbi/itests/src/test/java/org/apache/servicemix/jbi/ManagementTest.java
 Sat Feb 14 19:46:05 2009
@@ -0,0 +1,166 @@
+/*
+ * 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.servicemix.jbi;
+
+import java.util.Properties;
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.net.URL;
+import java.net.URLConnection;
+import java.io.File;
+
+import javax.jbi.component.Component;
+import javax.jbi.management.DeploymentException;
+
+import org.apache.servicemix.kernel.testing.support.AbstractIntegrationTest;
+import org.apache.servicemix.nmr.api.NMR;
+import org.apache.servicemix.jbi.deployer.ServiceAssembly;
+import org.apache.servicemix.jbi.deployer.handler.JBIDeploymentListener;
+import org.apache.servicemix.jbi.management.AdminCommandsServiceMBean;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleException;
+
+public class ManagementTest extends AbstractIntegrationTest {
+
+    /**
+        * The manifest to use for the "virtual bundle" created
+        * out of the test classes and resources in this project
+        *
+        * This is actually the boilerplate manifest with one additional
+        * import-package added. We should provide a simpler customization
+        * point for such use cases that doesn't require duplication
+        * of the entire manifest...
+        */
+       protected String getManifestLocation() {
+               return "classpath:org/apache/servicemix/MANIFEST.MF";
+       }
+
+       /**
+        * The location of the packaged OSGi bundles to be installed
+        * for this test. Values are Spring resource paths. The bundles
+        * we want to use are part of the same multi-project maven
+        * build as this project is. Hence we use the localMavenArtifact
+        * helper method to find the bundles produced by the package
+        * phase of the maven build (these tests will run after the
+        * packaging phase, in the integration-test phase).
+        *
+        * JUnit, commons-logging, spring-core and the spring OSGi
+        * test bundle are automatically included so do not need
+        * to be specified here.
+        */
+       protected String[] getTestBundlesNames() {
+        return new String[] {
+            getBundle("org.apache.servicemix.specs", 
"org.apache.servicemix.specs.stax-api-1.0"),
+            getBundle("org.apache.servicemix.specs", 
"org.apache.servicemix.specs.jbi-api-1.0"),
+            getBundle("org.apache.servicemix.specs", 
"org.apache.servicemix.specs.activation-api-1.1"),
+            getBundle("org.apache.servicemix.specs", 
"org.apache.servicemix.specs.javamail-api-1.4"),
+            getBundle("org.apache.geronimo.specs", "geronimo-jta_1.1_spec"),
+            getBundle("org.apache.felix", "org.apache.felix.prefs"),
+            getBundle("org.apache.xbean", "xbean-classloader"),
+            getBundle("org.apache.servicemix.nmr", 
"org.apache.servicemix.nmr.api"),
+            getBundle("org.apache.servicemix.nmr", 
"org.apache.servicemix.nmr.core"),
+            getBundle("org.apache.servicemix.nmr", 
"org.apache.servicemix.nmr.spring"),
+            getBundle("org.apache.servicemix.nmr", 
"org.apache.servicemix.nmr.osgi"),
+            getBundle("org.apache.servicemix.document", 
"org.apache.servicemix.document"),
+            getBundle("org.apache.servicemix.jbi", 
"org.apache.servicemix.jbi.runtime"),
+            getBundle("org.apache.servicemix.jbi", 
"org.apache.servicemix.jbi.deployer"),
+            getBundle("org.apache.servicemix.jbi", 
"org.apache.servicemix.jbi.osgi"),
+            getBundle("org.apache.servicemix.jbi", 
"org.apache.servicemix.jbi.management"),
+            getBundle("org.apache.servicemix.kernel", 
"org.apache.servicemix.kernel.filemonitor"),
+            getBundle("org.apache.servicemix.kernel", 
"org.apache.servicemix.kernel.management"),
+            getBundle("org.apache.servicemix.bundles", 
"org.apache.servicemix.bundles.ant"),
+            getBundle("org.apache.servicemix.bundles", 
"org.apache.servicemix.bundles.woodstox"),
+            getBundle("org.apache.servicemix.bundles", 
"org.apache.servicemix.bundles.wsdl4j"),
+               };
+       }
+
+    public void testInstallUninstall() throws Exception {
+        String smxShared = localMavenBundle("org.apache.servicemix", 
"servicemix-shared", getBundleVersion("org.apache.servicemix", 
"servicemix-shared"),
+                                            "installer", "zip").getPath();
+        String smxJsr181 = localMavenBundle("org.apache.servicemix", 
"servicemix-jsr181", getBundleVersion("org.apache.servicemix", 
"servicemix-jsr181"),
+                                            "installer", "zip").getPath();
+        String smxHttp = localMavenBundle("org.apache.servicemix", 
"servicemix-http", getBundleVersion("org.apache.servicemix", "servicemix-http"),
+                                            "installer", "zip").getPath();
+        String wsdlFirst = 
localMavenBundle("org.apache.servicemix.samples.wsdl-first", "wsdl-first-sa",
+                                            
getBundleVersion("org.apache.servicemix.samples.wsdl-first", "wsdl-first-sa"),
+                                            null, "zip").getPath();
+
+        AdminCommandsServiceMBean admin = getAdminCommands();
+
+        try {
+            String res = admin.installComponent(smxJsr181);
+            System.err.println(res);
+            fail("Call should have failed: " + res);
+        } catch (Throwable t) {
+            if (t.getCause() instanceof DeploymentException) {
+                System.err.println(t.getCause().getMessage());
+            } else {
+                t.printStackTrace();
+            }
+        }
+
+        System.err.println(admin.installSharedLibrary(smxShared));
+        System.err.println(admin.installComponent(smxJsr181));
+
+        try {
+            String res = admin.installComponent(smxJsr181);
+            System.err.println(res);
+            fail("Call should have failed: " + res);
+        } catch (Throwable t) {
+            if (t.getCause() instanceof DeploymentException) {
+                System.err.println(t.getCause().getMessage());
+            } else {
+                t.printStackTrace();
+            }
+        }
+
+        System.err.println(admin.uninstallComponent("servicemix-jsr181"));
+
+        System.err.println(admin.installComponent(smxJsr181));
+        System.err.println(admin.installComponent(smxHttp));
+
+        System.err.println(admin.startComponent("servicemix-jsr181"));
+        System.err.println(admin.startComponent("servicemix-http"));
+
+        System.err.println(admin.deployServiceAssembly(wsdlFirst));
+        System.err.println(admin.undeployServiceAssembly("wsdl-first-sa"));
+
+        System.err.println(admin.deployServiceAssembly(wsdlFirst));
+        System.err.println(admin.startServiceAssembly("wsdl-first-sa"));
+        System.err.println(admin.stopServiceAssembly("wsdl-first-sa"));
+        System.err.println(admin.shutdownServiceAssembly("wsdl-first-sa"));
+        System.err.println(admin.undeployServiceAssembly("wsdl-first-sa"));
+
+        System.err.println(admin.stopComponent("servicemix-jsr181"));
+        System.err.println(admin.stopComponent("servicemix-http"));
+
+        System.err.println(admin.shutdownComponent("servicemix-jsr181"));
+        System.err.println(admin.shutdownComponent("servicemix-http"));
+
+        System.err.println(admin.uninstallComponent("servicemix-http"));
+        System.err.println(admin.uninstallComponent("servicemix-jsr181"));
+
+        System.err.println(admin.uninstallSharedLibrary("servicemix-shared"));
+    }
+
+    protected AdminCommandsServiceMBean getAdminCommands() {
+        return getOsgiService(AdminCommandsServiceMBean.class);
+    }
+
+}

Modified: 
servicemix/smx4/nmr/trunk/jbi/itests/src/test/resources/org/apache/servicemix/MANIFEST.MF
URL: 
http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/itests/src/test/resources/org/apache/servicemix/MANIFEST.MF?rev=744563&r1=744562&r2=744563&view=diff
==============================================================================
--- 
servicemix/smx4/nmr/trunk/jbi/itests/src/test/resources/org/apache/servicemix/MANIFEST.MF
 (original)
+++ 
servicemix/smx4/nmr/trunk/jbi/itests/src/test/resources/org/apache/servicemix/MANIFEST.MF
 Sat Feb 14 19:46:05 2009
@@ -29,6 +29,8 @@
  org.apache.servicemix.nmr.core,
  org.apache.servicemix.jbi.deployer,
  org.apache.servicemix.jbi.deployer.handler,
+ org.apache.servicemix.jbi.management,
  org.apache.servicemix.kernel.testing.support,
  org.springframework.osgi.util,
- javax.jbi.component
+ javax.jbi.component,
+ javax.jbi.management

Modified: 
servicemix/smx4/nmr/trunk/jbi/management/src/main/java/org/apache/servicemix/jbi/management/AbstractInstaller.java
URL: 
http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/management/src/main/java/org/apache/servicemix/jbi/management/AbstractInstaller.java?rev=744563&r1=744562&r2=744563&view=diff
==============================================================================
--- 
servicemix/smx4/nmr/trunk/jbi/management/src/main/java/org/apache/servicemix/jbi/management/AbstractInstaller.java
 (original)
+++ 
servicemix/smx4/nmr/trunk/jbi/management/src/main/java/org/apache/servicemix/jbi/management/AbstractInstaller.java
 Sat Feb 14 19:46:05 2009
@@ -197,4 +197,7 @@
                this.bundleContext = bundleContext;             
        }
 
+    public BundleContext getBundleContext() {
+        return bundleContext;
+    }
 }

Modified: 
servicemix/smx4/nmr/trunk/jbi/management/src/main/java/org/apache/servicemix/jbi/management/AdminCommandsService.java
URL: 
http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/management/src/main/java/org/apache/servicemix/jbi/management/AdminCommandsService.java?rev=744563&r1=744562&r2=744563&view=diff
==============================================================================
--- 
servicemix/smx4/nmr/trunk/jbi/management/src/main/java/org/apache/servicemix/jbi/management/AdminCommandsService.java
 (original)
+++ 
servicemix/smx4/nmr/trunk/jbi/management/src/main/java/org/apache/servicemix/jbi/management/AdminCommandsService.java
 Sat Feb 14 19:46:05 2009
@@ -151,34 +151,38 @@
      * @return
      */
     public String uninstallSharedLibrary(String name) throws Exception {
-       //Check that the library is installed
-        boolean isInstalled = 
getAdminService().getDeployer().getInstalledSharedLibararies().contains(name);
-        if (!isInstalled) {
-            throw ManagementSupport.failure("uninstallSharedLibrary", "Shared 
library '" + name + "' is not installed.");
-        }
-        // Check that it is not used by a running component
-        ServiceReference[] refs = 
getAdminService().getComponentServiceReferences(null);
-        
-        
-        for (ServiceReference ref : refs) {
-               ComponentImpl component = (ComponentImpl) 
getBundleContext().getService(ref);
-            if 
(!component.getCurrentState().equalsIgnoreCase(LifeCycleMBean.SHUTDOWN)) {
-                SharedLibraryList[] sls = component.getSharedLibraries();
-                if (sls != null) {
-                    for (int i = 0; i < sls.length; i++) {
-                       if (name.equals(sls[i].getName())) {
-                               throw 
ManagementSupport.failure("uninstallSharedLibrary", "Shared library '" + name
-                                            + "' is used by component '" + 
component.getName() + "'.");
+        try {
+            //Check that the library is installed
+            boolean isInstalled = 
getAdminService().getDeployer().getInstalledSharedLibararies().contains(name);
+            if (!isInstalled) {
+                throw ManagementSupport.failure("uninstallSharedLibrary", 
"Shared library '" + name + "' is not installed.");
+            }
+            // Check that it is not used by a running component
+            ServiceReference[] refs = 
getAdminService().getComponentServiceReferences(null);
+
+
+            for (ServiceReference ref : refs) {
+                ComponentImpl component = (ComponentImpl) 
getBundleContext().getService(ref);
+                if 
(!component.getCurrentState().equalsIgnoreCase(LifeCycleMBean.SHUTDOWN)) {
+                    SharedLibraryList[] sls = component.getSharedLibraries();
+                    if (sls != null) {
+                        for (int i = 0; i < sls.length; i++) {
+                            if (name.equals(sls[i].getName())) {
+                                throw 
ManagementSupport.failure("uninstallSharedLibrary", "Shared library '" + name
+                                                + "' is used by component '" + 
component.getName() + "'.");
+                            }
                         }
                     }
                 }
             }
-        }
-        boolean success = 
getInstallationService().uninstallSharedLibrary(name);
-        if (success) {
-            return 
ManagementSupport.createSuccessMessage("uninstallSharedLibrary", name);
-        } else {
-            throw ManagementSupport.failure("uninstallSharedLibrary", name);
+            boolean success = 
getInstallationService().uninstallSharedLibrary(name);
+            if (success) {
+                return 
ManagementSupport.createSuccessMessage("uninstallSharedLibrary", name);
+            } else {
+                throw ManagementSupport.failure("uninstallSharedLibrary", 
name);
+            }
+        } catch (Throwable e) {
+            throw ManagementSupport.failure("uninstallSharedLibrary", name, e);
         }
     }
 
@@ -196,7 +200,7 @@
                 }
             });
             return ManagementSupport.createSuccessMessage("startComponent", 
name);
-        } catch (Exception e) {
+        } catch (Throwable e) {
             throw ManagementSupport.failure("startComponent", name, e);
         }
     }
@@ -215,7 +219,7 @@
                 }
             });
             return ManagementSupport.createSuccessMessage("stopComponent", 
name);
-        } catch (Exception e) {
+        } catch (Throwable e) {
             throw ManagementSupport.failure("stopComponent", name, e);
         }
     }
@@ -234,7 +238,7 @@
                 }
             });
             return ManagementSupport.createSuccessMessage("shutdownComponent", 
name);
-        } catch (Exception e) {
+        } catch (Throwable e) {
             throw ManagementSupport.failure("shutdownComponent", name, e);
         }
     }
@@ -248,7 +252,7 @@
     public String deployServiceAssembly(String file) throws Exception {
        try {
                return deploymentService.deploy(file);
-       } catch (Exception e) {
+       } catch (Throwable e) {
             throw ManagementSupport.failure("deployServiceAssembly", file, e);
         }
 
@@ -261,7 +265,11 @@
      * @return
      */
     public String undeployServiceAssembly(String name) throws Exception {
-        return getDeploymentService().undeploy(name);
+        try {
+            return getDeploymentService().undeploy(name);
+        } catch (Throwable e) {
+            throw ManagementSupport.failure("undeployServiceAssembly", name, 
e);
+        }
     }
 
     /**
@@ -271,7 +279,11 @@
      * @return
      */
     public String startServiceAssembly(String name) throws Exception {
-        return getDeploymentService().start(name);
+        try {
+            return getDeploymentService().start(name);
+        } catch (Throwable e) {
+            throw ManagementSupport.failure("startServiceAssembly", name, e);
+        }
     }
 
     /**
@@ -281,7 +293,11 @@
      * @return
      */
     public String stopServiceAssembly(String name) throws Exception {
-        return getDeploymentService().stop(name);
+        try {
+            return getDeploymentService().stop(name);
+        } catch (Throwable e) {
+            throw ManagementSupport.failure("stopServiceAssembly", name, e);
+        }
     }
 
     /**
@@ -291,7 +307,11 @@
      * @return
      */
     public String shutdownServiceAssembly(String name) throws Exception {
-        return getDeploymentService().shutDown(name);
+        try {
+            return getDeploymentService().shutDown(name);
+        } catch (Throwable e) {
+            throw ManagementSupport.failure("shutdownServiceAssembly", name, 
e);
+        }
     }
 
     

Modified: 
servicemix/smx4/nmr/trunk/jbi/management/src/main/java/org/apache/servicemix/jbi/management/AdminService.java
URL: 
http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/management/src/main/java/org/apache/servicemix/jbi/management/AdminService.java?rev=744563&r1=744562&r2=744563&view=diff
==============================================================================
--- 
servicemix/smx4/nmr/trunk/jbi/management/src/main/java/org/apache/servicemix/jbi/management/AdminService.java
 (original)
+++ 
servicemix/smx4/nmr/trunk/jbi/management/src/main/java/org/apache/servicemix/jbi/management/AdminService.java
 Sat Feb 14 19:46:05 2009
@@ -66,6 +66,9 @@
        }
 
        protected ObjectName getComponentObjectName(ServiceReference ref) {
+        if (ref == null) {
+            return null;
+        }
         String name = (String) ref.getProperty(Deployer.NAME);
         return namingStrategy.createCustomComponentMBeanName(name, 
"LifeCycle");
     }

Modified: 
servicemix/smx4/nmr/trunk/jbi/management/src/main/java/org/apache/servicemix/jbi/management/ComponentInstaller.java
URL: 
http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/management/src/main/java/org/apache/servicemix/jbi/management/ComponentInstaller.java?rev=744563&r1=744562&r2=744563&view=diff
==============================================================================
--- 
servicemix/smx4/nmr/trunk/jbi/management/src/main/java/org/apache/servicemix/jbi/management/ComponentInstaller.java
 (original)
+++ 
servicemix/smx4/nmr/trunk/jbi/management/src/main/java/org/apache/servicemix/jbi/management/ComponentInstaller.java
 Sat Feb 14 19:46:05 2009
@@ -26,9 +26,14 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.servicemix.jbi.deployer.impl.ComponentImpl;
 import org.osgi.framework.Bundle;
 
 import org.osgi.framework.BundleException;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.prefs.PreferencesService;
+import org.osgi.service.prefs.Preferences;
+import org.osgi.service.prefs.BackingStoreException;
 
 public class ComponentInstaller extends AbstractInstaller 
        implements InstallerMBean {
@@ -81,10 +86,23 @@
                        return null;
             }
                if (f.exists()) {
+                try {
+                    initializePreferences();
+                } catch (BackingStoreException e) {
+                    LOGGER.warn("Error initializing persistent state for 
component: " + context.getComponentName(), e);
+                }
                        deployBundle(f);
             }
                        context.setInstall(false);
                        ObjectName ret = 
this.adminService.getComponentByName(context.getComponentName());
+             if (ret == null) {
+                 // something wrong happened
+                 // TODO: we need to retrieve the correct problem somehow
+                 if (getBundle() != null) {
+                    getBundle().uninstall();
+                 }
+                 throw new Exception("Error installing component");
+             }
                        return ret;
                } catch (Exception e) {
                        LOGGER.error(e.getMessage());
@@ -124,6 +142,11 @@
             else {
                 bundle.stop();
                 bundle.uninstall();
+                try {
+                    deletePreferences();
+                } catch (BackingStoreException e) {
+                    LOGGER.warn("Error cleaning persistent state for 
component: " + componentName, e);
+                }
             }
         } catch (BundleException e) {
                LOGGER.error("failed to uninstall component: " + componentName, 
e);
@@ -153,4 +176,33 @@
         this.objectName = objectName;
     }
 
+    protected void initializePreferences() throws BackingStoreException {
+        PreferencesService preferencesService = getPreferencesService();
+        Preferences prefs = 
preferencesService.getUserPreferences(context.getComponentName());
+        prefs.put(ComponentImpl.STATE, ComponentImpl.State.Shutdown.name());
+        prefs.flush();
+    }
+
+    protected void deletePreferences() throws BackingStoreException {
+        PreferencesService preferencesService = getPreferencesService();
+        Preferences prefs = 
preferencesService.getUserPreferences(context.getComponentName());
+        prefs.clear();
+        prefs.flush();
+    }
+
+    private PreferencesService getPreferencesService() throws 
BackingStoreException {
+        PreferencesService preferencesService = null;
+        for (Bundle bundle : getBundleContext().getBundles()) {
+            if 
("org.apache.servicemix.jbi.deployer".equals(bundle.getSymbolicName())) {
+                ServiceReference ref = 
bundle.getBundleContext().getServiceReference(PreferencesService.class.getName());
+                preferencesService = (PreferencesService) 
bundle.getBundleContext().getService(ref);
+                break;
+            }
+        }
+        if (preferencesService == null) {
+            throw new BackingStoreException("Unable to find bundle 
'org.apache.servicemix.jbi.deployer'");
+        }
+        return preferencesService;
+    }
+
 }

Modified: 
servicemix/smx4/nmr/trunk/jbi/management/src/main/java/org/apache/servicemix/jbi/management/ManagementSupport.java
URL: 
http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/management/src/main/java/org/apache/servicemix/jbi/management/ManagementSupport.java?rev=744563&r1=744562&r2=744563&view=diff
==============================================================================
--- 
servicemix/smx4/nmr/trunk/jbi/management/src/main/java/org/apache/servicemix/jbi/management/ManagementSupport.java
 (original)
+++ 
servicemix/smx4/nmr/trunk/jbi/management/src/main/java/org/apache/servicemix/jbi/management/ManagementSupport.java
 Sat Feb 14 19:46:05 2009
@@ -47,16 +47,16 @@
         private boolean isCauseFramework;
         private String task;
         private String result;
-        private Exception exception;
+        private Throwable exception;
         private String type;
         private String message;
         private String component;
         private String locale;
 
-        public Exception getException() {
+        public Throwable getException() {
             return exception;
         }
-        public void setException(Exception exception) {
+        public void setException(Throwable exception) {
             this.exception = exception;
         }
         public boolean isCauseFramework() {
@@ -111,16 +111,16 @@
         return failure(task, null, null, componentResults);
     }
 
-    public static Exception failure(String task, String info, Exception e) 
throws Exception {
-        return failure(task, info, e, null);
+    public static Exception failure(String task, String info, Throwable t) 
throws Exception {
+        return failure(task, info, t, null);
     }
 
-    public static Exception failure(String task, String info, Exception e, 
List componentResults) throws Exception {
+    public static Exception failure(String task, String info, Throwable t, 
List componentResults) throws Exception {
         ManagementSupport.Message msg = new ManagementSupport.Message();
         msg.setTask(task);
         msg.setResult("FAILED");
         msg.setType("ERROR");
-        msg.setException(e);
+        msg.setException(t);
         msg.setMessage(info);
         return new Exception(ManagementSupport.createFrameworkMessage(msg, 
componentResults));
     }
@@ -263,23 +263,23 @@
         return createComponentMessage(msg);
     }
 
-    public static Element createComponentFailure(String task, String 
component, String info, Exception e) {
+    public static Element createComponentFailure(String task, String 
component, String info, Throwable t) {
         ManagementSupport.Message msg = new ManagementSupport.Message();
         msg.setTask(task);
         msg.setResult("FAILED");
         msg.setType("ERROR");
-        msg.setException(e);
+        msg.setException(t);
         msg.setMessage(info);
         msg.setComponent(component);
         return createComponentMessage(msg);
     }
 
-    public static Element createComponentWarning(String task, String 
component, String info, Exception e) {
+    public static Element createComponentWarning(String task, String 
component, String info, Throwable t) {
         ManagementSupport.Message msg = new ManagementSupport.Message();
         msg.setTask(task);
         msg.setResult("SUCCESS");
         msg.setType("WARNING");
-        msg.setException(e);
+        msg.setException(t);
         msg.setMessage(info);
         msg.setComponent(component);
         return createComponentMessage(msg);

Modified: 
servicemix/smx4/nmr/trunk/jbi/management/src/main/java/org/apache/servicemix/jbi/management/ServiceAssemblyInstaller.java
URL: 
http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/management/src/main/java/org/apache/servicemix/jbi/management/ServiceAssemblyInstaller.java?rev=744563&r1=744562&r2=744563&view=diff
==============================================================================
--- 
servicemix/smx4/nmr/trunk/jbi/management/src/main/java/org/apache/servicemix/jbi/management/ServiceAssemblyInstaller.java
 (original)
+++ 
servicemix/smx4/nmr/trunk/jbi/management/src/main/java/org/apache/servicemix/jbi/management/ServiceAssemblyInstaller.java
 Sat Feb 14 19:46:05 2009
@@ -20,8 +20,13 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.servicemix.jbi.deployer.impl.ComponentImpl;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleException;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.prefs.BackingStoreException;
+import org.osgi.service.prefs.PreferencesService;
+import org.osgi.service.prefs.Preferences;
 
 public class ServiceAssemblyInstaller extends AbstractInstaller {
 
@@ -37,6 +42,11 @@
        }
        
        public void deploy(String filename) {
+        try {
+            initializePreferences();
+        } catch (BackingStoreException e) {
+            LOGGER.warn("Error initializing persistent state for service 
assembly: " + name, e);
+        }
                deployFile(filename);
        }
        
@@ -50,10 +60,45 @@
             else {
                 bundle.stop();
                 bundle.uninstall();
+                try {
+                    deletePreferences();
+                } catch (BackingStoreException e) {
+                    LOGGER.warn("Error cleaning persistent state for service 
assembly: " + name, e);
+                }
             }
         } catch (BundleException e) {
                LOGGER.error("failed to uninstall Service Assembly: " + name, 
e);
                throw new JBIException(e);
                } 
     }
+
+    protected void initializePreferences() throws BackingStoreException {
+        PreferencesService preferencesService = getPreferencesService();
+        Preferences prefs = preferencesService.getUserPreferences(name);
+        prefs.put(ComponentImpl.STATE, ComponentImpl.State.Shutdown.name());
+        prefs.flush();
+    }
+
+    protected void deletePreferences() throws BackingStoreException {
+        PreferencesService preferencesService = getPreferencesService();
+        Preferences prefs = preferencesService.getUserPreferences(name);
+        prefs.clear();
+        prefs.flush();
+    }
+
+    private PreferencesService getPreferencesService() throws 
BackingStoreException {
+        PreferencesService preferencesService = null;
+        for (Bundle bundle : getBundleContext().getBundles()) {
+            if 
("org.apache.servicemix.jbi.deployer".equals(bundle.getSymbolicName())) {
+                ServiceReference ref = 
bundle.getBundleContext().getServiceReference(PreferencesService.class.getName());
+                preferencesService = (PreferencesService) 
bundle.getBundleContext().getService(ref);
+                break;
+            }
+        }
+        if (preferencesService == null) {
+            throw new BackingStoreException("Unable to find bundle 
'org.apache.servicemix.jbi.deployer'");
+        }
+        return preferencesService;
+    }
+
 }

Modified: 
servicemix/smx4/nmr/trunk/jbi/management/src/main/resources/META-INF/spring/servicemix-jbi-management.xml
URL: 
http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/management/src/main/resources/META-INF/spring/servicemix-jbi-management.xml?rev=744563&r1=744562&r2=744563&view=diff
==============================================================================
--- 
servicemix/smx4/nmr/trunk/jbi/management/src/main/resources/META-INF/spring/servicemix-jbi-management.xml
 (original)
+++ 
servicemix/smx4/nmr/trunk/jbi/management/src/main/resources/META-INF/spring/servicemix-jbi-management.xml
 Sat Feb 14 19:46:05 2009
@@ -89,4 +89,7 @@
         <osgi:listener ref="managedJbiRegistry" 
bind-method="registerServiceAssembly" unbind-method="unregisterServiceAssembly" 
/>
     </osgi:list>
 
+    <!-- Expose management service in OSGi -->
+    <osgi:service ref="adminCommandsService" 
interface="org.apache.servicemix.jbi.management.AdminCommandsServiceMBean" />
+
 </beans>

Modified: servicemix/smx4/nmr/trunk/pom.xml
URL: 
http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/pom.xml?rev=744563&r1=744562&r2=744563&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/pom.xml (original)
+++ servicemix/smx4/nmr/trunk/pom.xml Sat Feb 14 19:46:05 2009
@@ -79,7 +79,7 @@
       <geronimo.stax.version>1.0.1</geronimo.stax.version>
       <jencks.version>2.1_1</jencks.version>
       <jline.version>0.9.94</jline.version>
-      <junit.version>3.8.2_1-SNAPSHOT</junit.version>
+      <junit.version>3.8.2_1</junit.version>
       <log4j.version>1.2.14</log4j.version>
       <pax.logging.version>1.1.1</pax.logging.version>
       <servicemix3.version>3.3</servicemix3.version>
@@ -455,6 +455,11 @@
           </exclusions>
       </dependency>
       <dependency>
+          <groupId>org.apache.servicemix.kernel</groupId>
+          <artifactId>org.apache.servicemix.kernel.management</artifactId>
+          <version>${servicemix.kernel.version}</version>
+      </dependency>
+      <dependency>
           <groupId>org.apache.servicemix.kernel.testing</groupId>
           <artifactId>org.apache.servicemix.kernel.testing.support</artifactId>
           <version>${servicemix.kernel.version}</version>


Reply via email to