You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@servicemix.apache.org by Freeman Fang <fr...@gmail.com> on 2010/07/07 04:10:32 UTC

Re: svn commit: r961034 - in /servicemix/smx4/nmr/trunk: ./ assembly/ jbi/deployer/ jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/artifacts/ jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/ jbi/deployer/src/main/resources...

Hi Guillaume,

Seems this commit miss Storage.java and SimpleStorage.java, I get  
build failure now.

Best Regards
Freeman
On 2010-7-7, at 上午6:20, gnodet@apache.org wrote:

> Author: gnodet
> Date: Tue Jul  6 22:20:13 2010
> New Revision: 961034
>
> URL: http://svn.apache.org/viewvc?rev=961034&view=rev
> Log:
> SMX4NMR-209: Remove dependencies on the preference service
>
> Modified:
>    servicemix/smx4/nmr/trunk/assembly/pom.xml
>    servicemix/smx4/nmr/trunk/jbi/deployer/pom.xml
>    servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/ 
> servicemix/jbi/deployer/artifacts/AbstractLifecycleJbiArtifact.java
>    servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/ 
> servicemix/jbi/deployer/artifacts/ComponentImpl.java
>    servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/ 
> servicemix/jbi/deployer/artifacts/ServiceAssemblyImpl.java
>    servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/ 
> servicemix/jbi/deployer/impl/AbstractInstaller.java
>    servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/ 
> servicemix/jbi/deployer/impl/ComponentInstaller.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/ServiceAssemblyInstaller.java
>    servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/ 
> servicemix/jbi/deployer/impl/SharedLibraryInstaller.java
>    servicemix/smx4/nmr/trunk/jbi/deployer/src/main/resources/OSGI- 
> INF/blueprint/servicemix-jbi-deployer.xml
>    servicemix/smx4/nmr/trunk/jbi/deployer/src/test/java/org/apache/ 
> servicemix/jbi/deployer/artifacts/AssemblyReferencesListenerTest.java
>    servicemix/smx4/nmr/trunk/jbi/deployer/src/test/java/org/apache/ 
> servicemix/jbi/deployer/artifacts/ServiceAssemblyImplTest.java
>    servicemix/smx4/nmr/trunk/jbi/itests/pom.xml
>    servicemix/smx4/nmr/trunk/jbi/itests/src/test/java/org/apache/ 
> servicemix/jbi/itests/IntegrationTest.java
>    servicemix/smx4/nmr/trunk/jbi/itests/src/test/java/org/apache/ 
> servicemix/jbi/itests/ManagementTest.java
>    servicemix/smx4/nmr/trunk/pom.xml
>
> Modified: servicemix/smx4/nmr/trunk/assembly/pom.xml
> URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/assembly/pom.xml?rev=961034&r1=961033&r2=961034&view=diff
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- servicemix/smx4/nmr/trunk/assembly/pom.xml (original)
> +++ servicemix/smx4/nmr/trunk/assembly/pom.xml Tue Jul  6 22:20:13  
> 2010
> @@ -154,10 +154,6 @@
>             <artifactId>org.apache.servicemix.transaction</artifactId>
>         </dependency>
>         <dependency>
> -            <groupId>org.apache.felix</groupId>
> -            <artifactId>org.apache.felix.prefs</artifactId>
> -        </dependency>
> -        <dependency>
>             <groupId>org.apache.servicemix.specs</groupId>
>             <artifactId>org.apache.servicemix.specs.activation- 
> api-1.1</artifactId>
>         </dependency>
>
> Modified: servicemix/smx4/nmr/trunk/jbi/deployer/pom.xml
> URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/deployer/pom.xml?rev=961034&r1=961033&r2=961034&view=diff
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- servicemix/smx4/nmr/trunk/jbi/deployer/pom.xml (original)
> +++ servicemix/smx4/nmr/trunk/jbi/deployer/pom.xml Tue Jul  6  
> 22:20:13 2010
> @@ -50,10 +50,6 @@
>             <scope>provided</scope>
>         </dependency>
>         <dependency>
> -            <groupId>org.apache.felix</groupId>
> -            <artifactId>org.apache.felix.prefs</artifactId>
> -        </dependency>
> -        <dependency>
>             <groupId>org.osgi</groupId>
>             <artifactId>org.osgi.core</artifactId>
>             <scope>provided</scope>
>
> Modified: servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/ 
> apache/servicemix/jbi/deployer/artifacts/ 
> AbstractLifecycleJbiArtifact.java
> URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/artifacts/AbstractLifecycleJbiArtifact.java?rev=961034&r1=961033&r2=961034&view=diff
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/ 
> servicemix/jbi/deployer/artifacts/AbstractLifecycleJbiArtifact.java  
> (original)
> +++ servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/ 
> servicemix/jbi/deployer/artifacts/AbstractLifecycleJbiArtifact.java  
> Tue Jul  6 22:20:13 2010
> @@ -16,16 +16,16 @@
>  */
> package org.apache.servicemix.jbi.deployer.artifacts;
>
> +import java.io.IOException;
> import javax.jbi.management.LifeCycleMBean;
> import javax.jbi.JBIException;
>
> import org.apache.commons.logging.Log;
> import org.apache.commons.logging.LogFactory;
> +import org.apache.servicemix.jbi.deployer.impl.Storage;
> import org.apache.servicemix.nmr.api.event.ListenerRegistry;
> import org.apache.servicemix.jbi.deployer.events.LifeCycleEvent;
> import org.apache.servicemix.jbi.deployer.events.LifeCycleListener;
> -import org.osgi.service.prefs.BackingStoreException;
> -import org.osgi.service.prefs.Preferences;
>
> public abstract class AbstractLifecycleJbiArtifact implements  
> LifeCycleMBean {
>
> @@ -41,7 +41,7 @@ public abstract class AbstractLifecycleJ
>     protected final Log LOGGER = LogFactory.getLog(getClass());
>
>     protected State state = State.Unknown;
> -    protected Preferences prefs;
> +    protected Storage storage;
>     protected State runningState;
>     protected ListenerRegistry listenerRegistry;
>
> @@ -75,14 +75,14 @@ public abstract class AbstractLifecycleJ
>     }
>
>     protected State loadState(State def) {
> -        return State.valueOf(this.prefs.get(STATE, def.name()));
> +        return State.valueOf(this.storage.get(STATE, def.name()));
>     }
>
>     protected void saveState() {
> -        this.prefs.put(STATE, state.name());
> +        this.storage.put(STATE, state.name());
>         try {
> -            this.prefs.flush();
> -        } catch (BackingStoreException e) {
> +            this.storage.save();
> +        } catch (IOException e) {
>             LOGGER.warn("Unable to persist state", e);
>         }
>         this.runningState = state;
>
> Modified: servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/ 
> apache/servicemix/jbi/deployer/artifacts/ComponentImpl.java
> URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/artifacts/ComponentImpl.java?rev=961034&r1=961033&r2=961034&view=diff
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/ 
> servicemix/jbi/deployer/artifacts/ComponentImpl.java (original)
> +++ servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/ 
> servicemix/jbi/deployer/artifacts/ComponentImpl.java Tue Jul  6  
> 22:20:13 2010
> @@ -19,7 +19,6 @@ package org.apache.servicemix.jbi.deploy
> import java.net.URL;
> import java.util.HashSet;
> import java.util.Set;
> -
> import javax.jbi.JBIException;
> import javax.jbi.component.ComponentContext;
> import javax.jbi.component.ComponentLifeCycle;
> @@ -28,19 +27,18 @@ import javax.jbi.messaging.MessageExchan
> import javax.jbi.servicedesc.ServiceEndpoint;
> import javax.management.ObjectName;
>
> -import org.w3c.dom.Document;
> -import org.w3c.dom.DocumentFragment;
> -
> import org.apache.servicemix.jbi.deployer.Component;
> import org.apache.servicemix.jbi.deployer.ServiceUnit;
> import org.apache.servicemix.jbi.deployer.SharedLibrary;
> -import org.apache.servicemix.jbi.deployer.events.LifeCycleEvent;
> import org.apache.servicemix.jbi.deployer.descriptor.ComponentDesc;
> import  
> org.apache.servicemix.jbi.deployer.descriptor.DescriptorFactory;
> +import org.apache.servicemix.jbi.deployer.events.LifeCycleEvent;
> +import org.apache.servicemix.jbi.deployer.impl.Storage;
> import org.apache.servicemix.jbi.runtime.ComponentWrapper;
> import org.apache.servicemix.nmr.management.Nameable;
> import org.osgi.framework.Bundle;
> -import org.osgi.service.prefs.Preferences;
> +import org.w3c.dom.Document;
> +import org.w3c.dom.DocumentFragment;
>
> /**
>  */
> @@ -57,13 +55,13 @@ public class ComponentImpl extends Abstr
>     public ComponentImpl(Bundle bundle,
>                          ComponentDesc componentDesc,
>                          javax.jbi.component.Component component,
> -                         Preferences prefs,
> +                         Storage storage,
>                          boolean autoStart,
>                          SharedLibrary[] sharedLibraries) {
>         this.bundle = bundle;
>         this.componentDesc = componentDesc;
>         this.component = new ComponentWrapper(component);
> -        this.prefs = prefs;
> +        this.storage = storage;
>         this.runningState = loadState(autoStart ? State.Started :  
> State.Shutdown);
>         this.serviceUnits = new HashSet<ServiceUnitImpl>();
>         this.sharedLibraries = sharedLibraries;
>
> Modified: servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/ 
> apache/servicemix/jbi/deployer/artifacts/ServiceAssemblyImpl.java
> URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/artifacts/ServiceAssemblyImpl.java?rev=961034&r1=961033&r2=961034&view=diff
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/ 
> servicemix/jbi/deployer/artifacts/ServiceAssemblyImpl.java (original)
> +++ servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/ 
> servicemix/jbi/deployer/artifacts/ServiceAssemblyImpl.java Tue Jul   
> 6 22:20:13 2010
> @@ -25,23 +25,21 @@ import java.util.Map;
> import java.util.Set;
> import java.util.concurrent.Semaphore;
> import java.util.concurrent.TimeUnit;
> -
> import javax.jbi.JBIException;
> import javax.jbi.management.LifeCycleMBean;
>
> -import org.apache.servicemix.jbi.deployer.Component;
> import org.apache.servicemix.jbi.deployer.ServiceAssembly;
> import org.apache.servicemix.jbi.deployer.ServiceUnit;
> import org.apache.servicemix.jbi.deployer.descriptor.Connection;
> import  
> org.apache.servicemix.jbi.deployer.descriptor.DescriptorFactory;
> import  
> org.apache.servicemix.jbi.deployer.descriptor.ServiceAssemblyDesc;
> import org.apache.servicemix.jbi.deployer.events.LifeCycleEvent;
> +import org.apache.servicemix.jbi.deployer.impl.Storage;
> import org.apache.servicemix.nmr.api.Wire;
> import org.apache.servicemix.nmr.core.util.MapToDictionary;
> import org.apache.servicemix.nmr.management.Nameable;
> import org.osgi.framework.Bundle;
> import org.osgi.framework.ServiceRegistration;
> -import org.osgi.service.prefs.Preferences;
>
> /**
>  * ServiceAssembly object
> @@ -86,13 +84,13 @@ public class ServiceAssemblyImpl extends
>     public ServiceAssemblyImpl(Bundle bundle,
>                                ServiceAssemblyDesc  
> serviceAssemblyDesc,
>                                List<ServiceUnitImpl> serviceUnits,
> -                               Preferences prefs,
> +                               Storage storage,
>                                AssemblyReferencesListener listener,
>                                boolean autoStart) {
>         this.bundle = bundle;
>         this.serviceAssemblyDesc = serviceAssemblyDesc;
>         this.serviceUnits = serviceUnits;
> -        this.prefs = prefs;
> +        this.storage = storage;
>         this.listener = listener;
>         this.runningState = loadState(autoStart ? State.Started :  
> State.Shutdown);
>         for (ServiceUnitImpl su : serviceUnits) {
>
> Modified: servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/ 
> apache/servicemix/jbi/deployer/impl/AbstractInstaller.java
> URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/AbstractInstaller.java?rev=961034&r1=961033&r2=961034&view=diff
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/ 
> servicemix/jbi/deployer/impl/AbstractInstaller.java (original)
> +++ servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/ 
> servicemix/jbi/deployer/impl/AbstractInstaller.java Tue Jul  6  
> 22:20:13 2010
> @@ -24,7 +24,6 @@ import java.io.IOException;
> import java.io.InputStream;
> import java.io.OutputStream;
> import java.util.Enumeration;
> -
> import javax.jbi.JBIException;
> import javax.management.ObjectName;
>
> @@ -37,8 +36,6 @@ import org.apache.servicemix.jbi.deploye
> import org.osgi.framework.Bundle;
> import org.osgi.framework.BundleContext;
> import org.osgi.framework.BundleException;
> -import org.osgi.service.prefs.BackingStoreException;
> -import org.osgi.service.prefs.Preferences;
>
> /**
>  * Installers are used to controll the installation / deployment  
> process of JBI artifacts
> @@ -84,23 +81,23 @@ public abstract class AbstractInstaller
>     public abstract String getName();
>
>     public void init() throws Exception {
> -        Preferences prefs = getPreferences();
> -        long lastInstall = prefs.getLong(LAST_INSTALL, 0);
> +        Storage storage = getStorage();
> +        long lastInstall = Long.parseLong(storage.get(LAST_INSTALL,  
> "0"));
>         isFirstInstall = lastInstall == 0;
>         isModified = lastInstall == 0 ||  
> getBundle().getLastModified() > lastInstall;
>         if (isModified && installRoot != null) {
>             extractBundle(installRoot, getBundle(), "/");
>             lastInstall = getBundle().getLastModified();
> -            prefs.put(AbstractLifecycleJbiArtifact.STATE,  
> isAutoStart()
> +            storage.put(AbstractLifecycleJbiArtifact.STATE,  
> isAutoStart()
>                             ?  
> AbstractLifecycleJbiArtifact.State.Started.name()
>                             :  
> AbstractLifecycleJbiArtifact.State.Shutdown.name());
>         }
>     }
>
>     protected void postInstall() throws Exception {
> -        Preferences prefs = getPreferences();
> -        prefs.putLong(LAST_INSTALL, getBundle().getLastModified());
> -        prefs.flush();
> +        Storage prefs = getStorage();
> +        prefs.put(LAST_INSTALL,  
> Long.toString(getBundle().getLastModified()));
> +        prefs.save();
>     }
>
>     public abstract ObjectName install() throws JBIException;
> @@ -150,14 +147,14 @@ public abstract class AbstractInstaller
>         return new File(base, "data/generated-bundles");
>     }
>
> -    protected Preferences getPreferences() {
> -        return  
> deployer.getPreferencesService().getUserPreferences(getName());
> +    protected Storage getStorage() {
> +        return deployer.getStorage(getName());
>     }
>
> -    protected void deletePreferences() throws BackingStoreException {
> -        Preferences prefs = getPreferences();
> -        prefs.clear();
> -        prefs.flush();
> +    protected void deleteStorage() throws IOException {
> +        Storage storage = getStorage();
> +        storage.clear();
> +        storage.save();
>     }
>
>     public boolean isAutoStart() {
>
> Modified: servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/ 
> apache/servicemix/jbi/deployer/impl/ComponentInstaller.java
> URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/ComponentInstaller.java?rev=961034&r1=961033&r2=961034&view=diff
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/ 
> servicemix/jbi/deployer/impl/ComponentInstaller.java (original)
> +++ servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/ 
> servicemix/jbi/deployer/impl/ComponentInstaller.java Tue Jul  6  
> 22:20:13 2010
> @@ -45,7 +45,6 @@ import org.apache.servicemix.jbi.deploye
> import org.apache.xbean.classloader.MultiParentClassLoader;
> import org.apache.servicemix.nmr.management.Nameable;
> import org.osgi.framework.Bundle;
> -import org.osgi.service.prefs.BackingStoreException;
>
> public class ComponentInstaller extends AbstractInstaller implements  
> InstallerMBean, Nameable {
>
> @@ -231,8 +230,8 @@ public class ComponentInstaller extends
>         deployer.unregisterComponent(comp);
>         // Remove preferences
>         try {
> -            deletePreferences();
> -        } catch (BackingStoreException e) {
> +            deleteStorage();
> +        } catch (IOException e) {
>             LOGGER.warn("Error cleaning persistent state for  
> component: " + getName(), e);
>         }
>         // Uninstall bundle
>
> 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=961034&r1=961033&r2=961034&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 Tue Jul  6 22:20:13 2010
> @@ -17,6 +17,7 @@
> package org.apache.servicemix.jbi.deployer.impl;
>
> import java.io.File;
> +import java.io.IOException;
> import java.net.URL;
> import java.util.ArrayList;
> import java.util.Dictionary;
> @@ -102,8 +103,6 @@ public class Deployer implements Synchro
>
>     private File jbiRootDir;
>
> -    private PreferencesService preferencesService;
> -
>     private boolean autoStart = true;
>
>     private ServiceTracker deployedComponentsTracker;
> @@ -122,6 +121,8 @@ public class Deployer implements Synchro
>
>     private MBeanServer mbeanServer;
>
> +    private Storage storage;
> +
>     public Deployer() throws JBIException {
>         // TODO: control that using properties
>         jbiRootDir = new File(System.getProperty("karaf.base"),  
> "data/jbi");
> @@ -139,14 +140,6 @@ public class Deployer implements Synchro
>         this.bundleContext = bundleContext;
>     }
>
> -    public PreferencesService getPreferencesService() {
> -        return preferencesService;
> -    }
> -
> -    public void setPreferencesService(PreferencesService  
> preferencesService) {
> -        this.preferencesService = preferencesService;
> -    }
> -
>     public boolean isAutoStart() {
>         return autoStart;
>     }
> @@ -228,6 +221,14 @@ public class Deployer implements Synchro
>     }
>
>     public void init() throws Exception {
> +        // Init storage
> +        SimpleStorage s = new  
> SimpleStorage(bundleContext.getDataFile("storage.properties"));
> +        try {
> +            s.load();
> +        } catch (IOException e) {
> +            LOGGER.warn("Error loading JBI artifacts state", e);
> +        }
> +        this.storage = s;
>         // Track bundles
>         bundleContext.addBundleListener(this);
>         for (Bundle bundle : bundleContext.getBundles()) {
> @@ -421,8 +422,7 @@ public class Deployer implements Synchro
>
>     public ComponentImpl registerComponent(Bundle bundle,  
> ComponentDesc componentDesc, javax.jbi.component.Component  
> innerComponent, SharedLibrary[] sharedLibraries) throws Exception {
>         String name = componentDesc.getIdentification().getName();
> -        Preferences prefs =  
> preferencesService.getUserPreferences(name);
> -        ComponentImpl component = new ComponentImpl(bundle,  
> componentDesc, innerComponent, prefs, autoStart, sharedLibraries);
> +        ComponentImpl component = new ComponentImpl(bundle,  
> componentDesc, innerComponent, storage.getStorage(name), autoStart,  
> sharedLibraries);
>         component.setListenerRegistry(listenerRegistry);
>         // populate props from the component meta-data
>         Dictionary<String, String> props = new Hashtable<String,  
> String>();
> @@ -448,8 +448,9 @@ public class Deployer implements Synchro
>
>     public ServiceAssemblyImpl registerServiceAssembly(Bundle  
> bundle, ServiceAssemblyDesc serviceAssemblyDesc,  
> List<ServiceUnitImpl> sus) throws Exception {
>         // Now create the SA and initialize it
> -        Preferences prefs =  
> preferencesService 
> .getUserPreferences 
> (serviceAssemblyDesc.getIdentification().getName());
> -        ServiceAssemblyImpl sa = new ServiceAssemblyImpl(bundle,  
> serviceAssemblyDesc, sus, prefs, endpointListener, autoStart);
> +        ServiceAssemblyImpl sa = new ServiceAssemblyImpl(bundle,  
> serviceAssemblyDesc, sus,
> +                                                          
> storage.getStorage(serviceAssemblyDesc.getIdentification().getName()),
> +                                                          
> endpointListener, autoStart);
>         sa.setShutdownTimeout(shutdownTimeout);
>         sa.setListenerRegistry(listenerRegistry);
>         sa.init();
> @@ -553,6 +554,11 @@ public class Deployer implements Synchro
>         return null;
>     }
>
> +    public Storage getStorage(String name) {
> +        return storage.getStorage(name);
> +    }
> +
> +
>     // 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
>     //
>     //   Pending artifacts support
>
> Modified: servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/ 
> apache/servicemix/jbi/deployer/impl/ServiceAssemblyInstaller.java
> URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/ServiceAssemblyInstaller.java?rev=961034&r1=961033&r2=961034&view=diff
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/ 
> servicemix/jbi/deployer/impl/ServiceAssemblyInstaller.java (original)
> +++ servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/ 
> servicemix/jbi/deployer/impl/ServiceAssemblyInstaller.java Tue Jul   
> 6 22:20:13 2010
> @@ -17,6 +17,7 @@
> package org.apache.servicemix.jbi.deployer.impl;
>
> import java.io.File;
> +import java.io.IOException;
> import java.net.URL;
> import java.util.ArrayList;
> import java.util.List;
> @@ -37,7 +38,6 @@ import org.apache.servicemix.jbi.deploye
> import org.apache.servicemix.jbi.deployer.utils.ManagementSupport;
> import org.osgi.framework.Bundle;
> import org.osgi.framework.BundleException;
> -import org.osgi.service.prefs.BackingStoreException;
>
> public class ServiceAssemblyInstaller extends AbstractInstaller {
>
> @@ -151,8 +151,8 @@ public class ServiceAssemblyInstaller ex
>         }
>         // Remove preferences
>         try {
> -            deletePreferences();
> -        } catch (BackingStoreException e) {
> +            deleteStorage();
> +        } catch (IOException e) {
>             LOGGER.warn("Error cleaning persistent state for  
> component: " + getName(), e);
>         }
>         // Uninstall bundle
> @@ -239,8 +239,8 @@ public class ServiceAssemblyInstaller ex
>                 bundle.stop();
>                 bundle.uninstall();
>                 try {
> -                    deletePreferences();
> -                } catch (BackingStoreException e) {
> +                    deleteStorage();
> +                } catch (IOException e) {
>                     LOGGER.warn("Error cleaning persistent state for  
> service assembly: " + getName(), e);
>                 }
>             }
>
> Modified: servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/ 
> apache/servicemix/jbi/deployer/impl/SharedLibraryInstaller.java
> URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/SharedLibraryInstaller.java?rev=961034&r1=961033&r2=961034&view=diff
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/ 
> servicemix/jbi/deployer/impl/SharedLibraryInstaller.java (original)
> +++ servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/ 
> servicemix/jbi/deployer/impl/SharedLibraryInstaller.java Tue Jul  6  
> 22:20:13 2010
> @@ -34,7 +34,6 @@ import org.apache.servicemix.jbi.deploye
> import org.apache.servicemix.jbi.deployer.utils.FileUtil;
> import org.apache.servicemix.jbi.deployer.utils.ManagementSupport;
> import org.apache.xbean.classloader.MultiParentClassLoader;
> -import org.osgi.service.prefs.BackingStoreException;
>
> public class SharedLibraryInstaller extends AbstractInstaller {
>
> @@ -95,8 +94,8 @@ public class SharedLibraryInstaller exte
>         deployer.unregisterSharedLibrary(library);
>         // Remove preferences
>         try {
> -            deletePreferences();
> -        } catch (BackingStoreException e) {
> +            deleteStorage();
> +        } catch (IOException e) {
>             LOGGER.warn("Error cleaning persistent state for  
> component: " + getName(), e);
>         }
>         // Uninstall bundle
>
> Modified: servicemix/smx4/nmr/trunk/jbi/deployer/src/main/resources/ 
> OSGI-INF/blueprint/servicemix-jbi-deployer.xml
> URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/deployer/src/main/resources/OSGI-INF/blueprint/servicemix-jbi-deployer.xml?rev=961034&r1=961033&r2=961034&view=diff
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- servicemix/smx4/nmr/trunk/jbi/deployer/src/main/resources/OSGI- 
> INF/blueprint/servicemix-jbi-deployer.xml (original)
> +++ servicemix/smx4/nmr/trunk/jbi/deployer/src/main/resources/OSGI- 
> INF/blueprint/servicemix-jbi-deployer.xml Tue Jul  6 22:20:13 2010
> @@ -28,7 +28,6 @@
>         <property name="environment" ref="environment" />
>         <property name="managementStrategy"  
> ref="managementStrategy" />
>         <property name="mbeanServer" ref="mbeanServer" />
> -        <property name="preferencesService"  
> ref="preferencesService" />
>         <property name="shutdownTimeout" value="${shutdownTimeout}" />
>         <property name="bundleContext" ref="blueprintBundleContext"/>
>     </bean>
> @@ -104,10 +103,6 @@
>                interface="javax.management.MBeanServer"
>                availability="mandatory" />
>
> -    <!-- Preferences Service -->
> -    <reference id="preferencesService"
> -                
> interface="org.osgi.service.prefs.PreferencesService" />
> -
>     <cm:property-placeholder persistent- 
> id="org.apache.servicemix.jbi">
>         <cm:default-properties>
>             <cm:property name="shutdownTimeout" value="0"/>
>
> Modified: servicemix/smx4/nmr/trunk/jbi/deployer/src/test/java/org/ 
> apache/servicemix/jbi/deployer/artifacts/ 
> AssemblyReferencesListenerTest.java
> URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/deployer/src/test/java/org/apache/servicemix/jbi/deployer/artifacts/AssemblyReferencesListenerTest.java?rev=961034&r1=961033&r2=961034&view=diff
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- servicemix/smx4/nmr/trunk/jbi/deployer/src/test/java/org/apache/ 
> servicemix/jbi/deployer/artifacts/ 
> AssemblyReferencesListenerTest.java (original)
> +++ servicemix/smx4/nmr/trunk/jbi/deployer/src/test/java/org/apache/ 
> servicemix/jbi/deployer/artifacts/ 
> AssemblyReferencesListenerTest.java Tue Jul  6 22:20:13 2010
> @@ -24,6 +24,7 @@ import junit.framework.TestCase;
> import  
> org 
> .apache 
> .servicemix.jbi.deployer.artifacts.AbstractLifecycleJbiArtifact.State;
> import  
> org.apache.servicemix.jbi.deployer.descriptor.DescriptorFactory;
> import  
> org.apache.servicemix.jbi.deployer.descriptor.ServiceAssemblyDesc;
> +import org.apache.servicemix.jbi.deployer.impl.Storage;
> import org.apache.servicemix.jbi.runtime.impl.DeliveryChannelImpl;
> import org.apache.servicemix.jbi.runtime.impl.EndpointImpl;
> import org.apache.servicemix.nmr.api.Endpoint;
> @@ -131,15 +132,15 @@ public class AssemblyReferencesListenerT
>
>     private ServiceAssemblyImpl createServiceAssembly() {
>         ServiceAssemblyDesc descriptor =  
> DescriptorFactory 
> .buildDescriptor 
> (DescriptorFactory 
> .class.getResource("serviceAssembly.xml")).getServiceAssembly();
> -        final Preferences prefs = createMock(Preferences.class);
> -        expect(prefs.get("state",  
> State.Shutdown.name())).andReturn(State.Shutdown.name()).anyTimes();
> -        replay(prefs);
> +        final Storage storage = createMock(Storage.class);
> +        expect(storage.get("state",  
> State.Shutdown.name())).andReturn(State.Shutdown.name()).anyTimes();
> +        replay(storage);
>         final Component component = createMock(Component.class);
>         replay(component);
>
> -        ComponentImpl comp = new ComponentImpl(null, null,  
> component, prefs, false, null);
> +        ComponentImpl comp = new ComponentImpl(null, null,  
> component, storage, false, null);
>         ServiceUnitImpl su = new  
> ServiceUnitImpl(descriptor.getServiceUnits()[0], null, comp);
> -        ServiceAssemblyImpl sa = new ServiceAssemblyImpl(null,  
> descriptor, Collections.singletonList(su), prefs, new  
> AssemblyReferencesListener(), false);
> +        ServiceAssemblyImpl sa = new ServiceAssemblyImpl(null,  
> descriptor, Collections.singletonList(su), storage, new  
> AssemblyReferencesListener(), false);
>         return sa;
>     }
> }
>
> Modified: servicemix/smx4/nmr/trunk/jbi/deployer/src/test/java/org/ 
> apache/servicemix/jbi/deployer/artifacts/ServiceAssemblyImplTest.java
> URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/deployer/src/test/java/org/apache/servicemix/jbi/deployer/artifacts/ServiceAssemblyImplTest.java?rev=961034&r1=961033&r2=961034&view=diff
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- servicemix/smx4/nmr/trunk/jbi/deployer/src/test/java/org/apache/ 
> servicemix/jbi/deployer/artifacts/ServiceAssemblyImplTest.java  
> (original)
> +++ servicemix/smx4/nmr/trunk/jbi/deployer/src/test/java/org/apache/ 
> servicemix/jbi/deployer/artifacts/ServiceAssemblyImplTest.java Tue  
> Jul  6 22:20:13 2010
> @@ -29,6 +29,7 @@ import org.apache.servicemix.jbi.deploye
> import  
> org 
> .apache 
> .servicemix.jbi.deployer.artifacts.AbstractLifecycleJbiArtifact.State;
> import  
> org.apache.servicemix.jbi.deployer.descriptor.DescriptorFactory;
> import  
> org.apache.servicemix.jbi.deployer.descriptor.ServiceAssemblyDesc;
> +import org.apache.servicemix.jbi.deployer.impl.Storage;
> import org.apache.servicemix.nmr.api.Wire;
> import static org.easymock.EasyMock.createMock;
> import static org.easymock.EasyMock.expect;
> @@ -43,16 +44,16 @@ public class ServiceAssemblyImplTest ext
>
>     public void testStartAssemblyWithStoppedComponents() throws  
> Exception {
>         ServiceAssemblyDesc descriptor =  
> DescriptorFactory 
> .buildDescriptor 
> (DescriptorFactory 
> .class.getResource("serviceAssembly.xml")).getServiceAssembly();
> -        final Preferences prefs = createMock(Preferences.class);
> -        expect(prefs.get("state",  
> State.Shutdown.name())).andReturn(State.Shutdown.name()).anyTimes();
> -        replay(prefs);
> +        final Storage storage = createMock(Storage.class);
> +        expect(storage.get("state",  
> State.Shutdown.name())).andReturn(State.Shutdown.name()).anyTimes();
> +        replay(storage);
>         final Component component = createMock(Component.class);
>         replay(component);
>
> -        ComponentImpl comp = new ComponentImpl(null, null,  
> component, prefs, false, null);
> +        ComponentImpl comp = new ComponentImpl(null, null,  
> component, storage, false, null);
>         comp.state = State.Shutdown;
>         ServiceUnitImpl su = new  
> ServiceUnitImpl(descriptor.getServiceUnits()[0], null, comp);
> -        ServiceAssemblyImpl sa = new ServiceAssemblyImpl(null,  
> descriptor, Collections.singletonList(su), prefs, new  
> AssemblyReferencesListener(), false);
> +        ServiceAssemblyImpl sa = new ServiceAssemblyImpl(null,  
> descriptor, Collections.singletonList(su), storage, new  
> AssemblyReferencesListener(), false);
>         sa.state = State.Shutdown;
>
>         try {
> @@ -65,16 +66,16 @@ public class ServiceAssemblyImplTest ext
>
>     public void testWiringOnServiceAssemblyConnections() throws  
> Exception {
>         ServiceAssemblyDesc descriptor =  
> DescriptorFactory 
> .buildDescriptor 
> (DescriptorFactory 
> .class.getResource("serviceAssembly.xml")).getServiceAssembly();
> -        final Preferences prefs = createMock(Preferences.class);
> -        expect(prefs.get("state",  
> State.Shutdown.name())).andReturn(State.Shutdown.name());
> -        prefs.put("state", State.Started.name());
> -        prefs.flush();
> -        prefs.put("state", State.Stopped.name());
> -        prefs.flush();
> -        replay(prefs);
> +        final Storage storage = createMock(Storage.class);
> +        expect(storage.get("state",  
> State.Shutdown.name())).andReturn(State.Shutdown.name());
> +        storage.put("state", State.Started.name());
> +        storage.save();
> +        storage.put("state", State.Stopped.name());
> +        storage.save();
> +        replay(storage);
>
>         final List<ServiceRegistration> wires = new  
> LinkedList<ServiceRegistration>();
> -        ServiceAssembly sa = new ServiceAssemblyImpl(null,  
> descriptor, new ArrayList<ServiceUnitImpl>(), prefs, new  
> AssemblyReferencesListener(), false) {
> +        ServiceAssembly sa = new ServiceAssemblyImpl(null,  
> descriptor, new ArrayList<ServiceUnitImpl>(), storage, new  
> AssemblyReferencesListener(), false) {
>             @Override
>             protected ServiceRegistration registerWire(Wire wire) {
>                 ServiceRegistration registration =  
> createMock(ServiceRegistration.class);
>
> Modified: servicemix/smx4/nmr/trunk/jbi/itests/pom.xml
> URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/itests/pom.xml?rev=961034&r1=961033&r2=961034&view=diff
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- servicemix/smx4/nmr/trunk/jbi/itests/pom.xml (original)
> +++ servicemix/smx4/nmr/trunk/jbi/itests/pom.xml Tue Jul  6 22:20:13  
> 2010
> @@ -163,11 +163,6 @@
>             <scope>test</scope>
>         </dependency>
>         <dependency>
> -            <groupId>org.apache.felix</groupId>
> -            <artifactId>org.apache.felix.prefs</artifactId>
> -            <scope>test</scope>
> -        </dependency>
> -        <dependency>
>             <groupId>org.apache.xbean</groupId>
>             <artifactId>xbean-classloader</artifactId>
>             <scope>test</scope>
>
> Modified: servicemix/smx4/nmr/trunk/jbi/itests/src/test/java/org/ 
> apache/servicemix/jbi/itests/IntegrationTest.java
> URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/itests/src/test/java/org/apache/servicemix/jbi/itests/IntegrationTest.java?rev=961034&r1=961033&r2=961034&view=diff
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- servicemix/smx4/nmr/trunk/jbi/itests/src/test/java/org/apache/ 
> servicemix/jbi/itests/IntegrationTest.java (original)
> +++ servicemix/smx4/nmr/trunk/jbi/itests/src/test/java/org/apache/ 
> servicemix/jbi/itests/IntegrationTest.java Tue Jul  6 22:20:13 2010
> @@ -291,7 +291,7 @@ public class IntegrationTest extends Abs
>             mavenBundle("org.apache.xbean", "xbean-naming"),
>             mavenBundle("org.apache.servicemix.naming",  
> "org.apache.servicemix.naming"),
>             mavenBundle("org.apache.servicemix.bundles",  
> "org.apache.servicemix.bundles.ant"),
> -			   mavenBundle("javax.mail", "mail"),
> +		    mavenBundle("javax.mail", "mail"),
>             mavenBundle("org.codehaus.woodstox", "stax2-api"),
>             mavenBundle("org.codehaus.woodstox", "woodstox-core-asl"),
>             mavenBundle("org.apache.servicemix.bundles",  
> "org.apache.servicemix.bundles.wsdl4j"),
> @@ -299,7 +299,6 @@ public class IntegrationTest extends Abs
>             mavenBundle("org.apache.servicemix.specs",  
> "org.apache.servicemix.specs.jbi-api-1.0"),
>             mavenBundle("org.apache.servicemix.specs",  
> "org.apache.servicemix.specs.activation-api-1.1"),
>             mavenBundle("org.apache.geronimo.specs", "geronimo- 
> jta_1.1_spec"),
> -            mavenBundle("org.apache.felix",  
> "org.apache.felix.prefs"),
>             mavenBundle("org.apache.xbean", "xbean-classloader"),
>             mavenBundle("org.apache.felix",  
> "org.apache.felix.fileinstall"),
>             mavenBundle("org.apache.servicemix", "servicemix-utils"),
>
> Modified: servicemix/smx4/nmr/trunk/jbi/itests/src/test/java/org/ 
> apache/servicemix/jbi/itests/ManagementTest.java
> URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/itests/src/test/java/org/apache/servicemix/jbi/itests/ManagementTest.java?rev=961034&r1=961033&r2=961034&view=diff
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- servicemix/smx4/nmr/trunk/jbi/itests/src/test/java/org/apache/ 
> servicemix/jbi/itests/ManagementTest.java (original)
> +++ servicemix/smx4/nmr/trunk/jbi/itests/src/test/java/org/apache/ 
> servicemix/jbi/itests/ManagementTest.java Tue Jul  6 22:20:13 2010
> @@ -317,7 +317,6 @@ public class ManagementTest extends Abst
>             mavenBundle("org.apache.servicemix.specs",  
> "org.apache.servicemix.specs.jbi-api-1.0"),
>             mavenBundle("org.apache.servicemix.specs",  
> "org.apache.servicemix.specs.activation-api-1.1"),
>             mavenBundle("org.apache.geronimo.specs", "geronimo- 
> jta_1.1_spec"),
> -            mavenBundle("org.apache.felix",  
> "org.apache.felix.prefs"),
>             mavenBundle("org.apache.xbean", "xbean-classloader"),
>             mavenBundle("org.apache.felix",  
> "org.apache.felix.fileinstall"),
>             mavenBundle("org.apache.servicemix", "servicemix-utils"),
>
> Modified: servicemix/smx4/nmr/trunk/pom.xml
> URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/pom.xml?rev=961034&r1=961033&r2=961034&view=diff
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- servicemix/smx4/nmr/trunk/pom.xml (original)
> +++ servicemix/smx4/nmr/trunk/pom.xml Tue Jul  6 22:20:13 2010
> @@ -94,7 +94,6 @@
>       <felix.plugin.version>2.1.0</felix.plugin.version>
>       <felix.framework.version>3.0.1</felix.framework.version>
>       <felix.bundlerepository.version>1.6.4</ 
> felix.bundlerepository.version>
> -      <felix.prefs.version>1.0.4</felix.prefs.version>
>       <karaf.version>1.99.0-SNAPSHOT</karaf.version>
>       <felix.fileinstall.version>3.0.0</felix.fileinstall.version>
>       <felix.gogo.version>0.4.0</felix.gogo.version>
> @@ -430,21 +429,6 @@
>       </dependency>
>       <dependency>
>           <groupId>org.apache.felix</groupId>
> -          <artifactId>org.apache.felix.prefs</artifactId>
> -          <version>${felix.prefs.version}</version>
> -          <exclusions>
> -              <exclusion>
> -                  <groupId>org.apache.felix</groupId>
> -                  <artifactId>org.osgi.core</artifactId>
> -              </exclusion>
> -              <exclusion>
> -                  <groupId>org.apache.felix</groupId>
> -                  <artifactId>org.osgi.compendium</artifactId>
> -              </exclusion>
> -          </exclusions>
> -      </dependency>
> -      <dependency>
> -          <groupId>org.apache.felix</groupId>
>           <artifactId>org.apache.felix.configadmin</artifactId>
>           <version>${felix.configadmin.version}</version>
>       </dependency>
>
>


-- 
Freeman Fang

------------------------
Open Source SOA: http://fusesource.com
Apache Servicemix:http://servicemix.apache.org
Apache Cxf: http://cxf.apache.org
Apache Karaf: http://karaf.apache.org
Apache Felix: http://felix.apache.org