From: <aft...@us...> - 2007-07-02 09:24:46
|
Revision: 4516 http://svn.sourceforge.net/smartfrog/?rev=4516&view=rev Author: aftereight Date: 2007-07-02 02:24:42 -0700 (Mon, 02 Jul 2007) Log Message: ----------- Rename: ComponentFactory -> PrimFactory Modified Paths: -------------- branches/core-branch-osgi/components/anubisdeployer/src/org/smartfrog/services/anubisdeployer/ClusterDeployerImpl.java branches/core-branch-osgi/components/asyndeployer/src/org/smartfrog/services/asyndeployer/AsynPrimDeployerImpl.java branches/core-branch-osgi/extras/osgi/daemon-bundle/src/org/smartfrog/osgi/OSGiBundleCompound.java branches/core-branch-osgi/extras/osgi/daemon-bundle/src/org/smartfrog/osgi/components.sf branches/core-branch-osgi/smartfrog/src/org/smartfrog/sfcore/common/SmartFrogCoreKeys.java branches/core-branch-osgi/smartfrog/src/org/smartfrog/sfcore/deployer/ComponentDeployer.java branches/core-branch-osgi/smartfrog/src/org/smartfrog/sfcore/deployer/FrameworkClassLoadingEnvironmentImpl.java branches/core-branch-osgi/smartfrog/src/org/smartfrog/sfcore/deployer/SFDeployer.java branches/core-branch-osgi/smartfrog/src/org/smartfrog/sfcore/prim/PrimDeployerImpl.java Added Paths: ----------- branches/core-branch-osgi/extras/osgi/daemon-bundle/src/org/smartfrog/osgi/BundlePrimFactoryImpl.java branches/core-branch-osgi/extras/osgi/daemon-bundle/src/org/smartfrog/osgi/ServicePrimFactoryImpl.java branches/core-branch-osgi/smartfrog/src/org/smartfrog/sfcore/deployer/AbstractPrimFactoryUsingClassLoader.java branches/core-branch-osgi/smartfrog/src/org/smartfrog/sfcore/deployer/OldAlgorithmPrimFactory.java branches/core-branch-osgi/smartfrog/src/org/smartfrog/sfcore/deployer/PrimFactory.java Removed Paths: ------------- branches/core-branch-osgi/extras/osgi/daemon-bundle/src/org/smartfrog/osgi/BundleClassLoadingEnvironmentImpl.java branches/core-branch-osgi/extras/osgi/daemon-bundle/src/org/smartfrog/osgi/ServiceComponentFactoryImpl.java branches/core-branch-osgi/smartfrog/src/org/smartfrog/sfcore/deployer/AbstractComponentFactoryUsingClassLoader.java branches/core-branch-osgi/smartfrog/src/org/smartfrog/sfcore/deployer/ComponentFactory.java branches/core-branch-osgi/smartfrog/src/org/smartfrog/sfcore/deployer/OldAlgorithmComponentFactory.java Modified: branches/core-branch-osgi/components/anubisdeployer/src/org/smartfrog/services/anubisdeployer/ClusterDeployerImpl.java =================================================================== --- branches/core-branch-osgi/components/anubisdeployer/src/org/smartfrog/services/anubisdeployer/ClusterDeployerImpl.java 2007-06-29 18:50:13 UTC (rev 4515) +++ branches/core-branch-osgi/components/anubisdeployer/src/org/smartfrog/services/anubisdeployer/ClusterDeployerImpl.java 2007-07-02 09:24:42 UTC (rev 4516) @@ -38,7 +38,7 @@ import org.smartfrog.sfcore.reference.Reference; import org.smartfrog.sfcore.reference.ReferencePart; import org.smartfrog.sfcore.processcompound.SFProcess; -import org.smartfrog.sfcore.deployer.ComponentFactory; +import org.smartfrog.sfcore.deployer.PrimFactory; /** * @@ -64,7 +64,7 @@ * * @param descr target to operate on */ - public ClusterDeployerImpl(ComponentDescription descr, ComponentFactory factory) { + public ClusterDeployerImpl(ComponentDescription descr, PrimFactory factory) { super(descr); } Modified: branches/core-branch-osgi/components/asyndeployer/src/org/smartfrog/services/asyndeployer/AsynPrimDeployerImpl.java =================================================================== --- branches/core-branch-osgi/components/asyndeployer/src/org/smartfrog/services/asyndeployer/AsynPrimDeployerImpl.java 2007-06-29 18:50:13 UTC (rev 4515) +++ branches/core-branch-osgi/components/asyndeployer/src/org/smartfrog/services/asyndeployer/AsynPrimDeployerImpl.java 2007-07-02 09:24:42 UTC (rev 4516) @@ -26,7 +26,7 @@ import org.smartfrog.sfcore.common.SmartFrogDeploymentException; import org.smartfrog.sfcore.common.SmartFrogCoreKeys; import org.smartfrog.sfcore.deployer.ComponentDeployer; -import org.smartfrog.sfcore.deployer.ComponentFactory; +import org.smartfrog.sfcore.deployer.PrimFactory; import org.smartfrog.sfcore.componentdescription.ComponentDescription; import org.smartfrog.sfcore.prim.PrimDeployerImpl; import org.smartfrog.sfcore.prim.Prim; @@ -57,14 +57,14 @@ super(descr); } - public void setComponentFactory(ComponentFactory componentFactory) { + public void setComponentFactory(PrimFactory primFactory) { // Discard the component factory from above and use ours. - // Temporary fix: the real fix would be switching to a proper ComponentFactory, + // Temporary fix: the real fix would be switching to a proper PrimFactory, // declared by the sfMeta:sfFactory attribute. - super.setComponentFactory(new ProActiveComponentFactory()); + super.setComponentFactory(new ProActivePrimFactory()); } - private class ProActiveComponentFactory implements ComponentFactory { + private class ProActivePrimFactory implements PrimFactory { /** * Deleted: branches/core-branch-osgi/extras/osgi/daemon-bundle/src/org/smartfrog/osgi/BundleClassLoadingEnvironmentImpl.java =================================================================== --- branches/core-branch-osgi/extras/osgi/daemon-bundle/src/org/smartfrog/osgi/BundleClassLoadingEnvironmentImpl.java 2007-06-29 18:50:13 UTC (rev 4515) +++ branches/core-branch-osgi/extras/osgi/daemon-bundle/src/org/smartfrog/osgi/BundleClassLoadingEnvironmentImpl.java 2007-07-02 09:24:42 UTC (rev 4516) @@ -1,71 +0,0 @@ -package org.smartfrog.osgi; - -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.osgi.framework.BundleException; -import org.smartfrog.sfcore.common.SmartFrogCoreKeys; -import org.smartfrog.sfcore.common.SmartFrogException; -import org.smartfrog.sfcore.common.SmartFrogResolutionException; -import org.smartfrog.sfcore.componentdescription.ComponentDescription; -import org.smartfrog.sfcore.deployer.AbstractComponentFactoryUsingClassLoader; -import org.smartfrog.sfcore.prim.Prim; -import org.smartfrog.sfcore.prim.TerminationRecord; - -import java.io.IOException; -import java.net.URL; -import java.rmi.RemoteException; -import java.util.Enumeration; - - -public class BundleClassLoadingEnvironmentImpl extends AbstractComponentFactoryUsingClassLoader { - public static final String LOCATION_ATTRIBUTE = "location"; - private Bundle hostBundle = null; - - public BundleClassLoadingEnvironmentImpl() throws RemoteException {} - - public synchronized void sfDeploy() throws SmartFrogException, RemoteException { - super.sfDeploy(); - - BundleContext daemonBundleContext = OSGiUtilities.getDaemonBundleContext(this); - String location = (String) sfResolve(LOCATION_ATTRIBUTE); - - try { - hostBundle = daemonBundleContext.installBundle(location); - } catch (BundleException e) { - throw SmartFrogException.forward( - "Error when installing bundle from location: " + location, e); - } - } - - public synchronized void sfStart() throws SmartFrogException, RemoteException { - super.sfStart(); - - if (OSGiUtilities.isNotFragment(hostBundle)) { - try { - hostBundle.start(); - } catch (BundleException e) { - SmartFrogException.forward("Error when starting bundle", e); - } - } - } - - public void sfTerminateWith(TerminationRecord status) { - try { - hostBundle.uninstall(); - } catch (BundleException e) { - sfLog().error("Error when uninstalling bundle", e); - } - - super.sfTerminate(status); - } - - protected Prim getComponentImpl(ComponentDescription askedFor) - throws ClassNotFoundException, InstantiationException, IllegalAccessException, - SmartFrogResolutionException - { - String sfClass = (String) askedFor.sfResolveHere(SmartFrogCoreKeys.SF_CLASS); - Class primClass = hostBundle.loadClass(sfClass); - return (Prim) primClass.newInstance(); - } - -} Copied: branches/core-branch-osgi/extras/osgi/daemon-bundle/src/org/smartfrog/osgi/BundlePrimFactoryImpl.java (from rev 4511, branches/core-branch-osgi/extras/osgi/daemon-bundle/src/org/smartfrog/osgi/BundleClassLoadingEnvironmentImpl.java) =================================================================== --- branches/core-branch-osgi/extras/osgi/daemon-bundle/src/org/smartfrog/osgi/BundlePrimFactoryImpl.java (rev 0) +++ branches/core-branch-osgi/extras/osgi/daemon-bundle/src/org/smartfrog/osgi/BundlePrimFactoryImpl.java 2007-07-02 09:24:42 UTC (rev 4516) @@ -0,0 +1,68 @@ +package org.smartfrog.osgi; + +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.BundleException; +import org.smartfrog.sfcore.common.SmartFrogCoreKeys; +import org.smartfrog.sfcore.common.SmartFrogException; +import org.smartfrog.sfcore.common.SmartFrogResolutionException; +import org.smartfrog.sfcore.componentdescription.ComponentDescription; +import org.smartfrog.sfcore.deployer.AbstractPrimFactoryUsingClassLoader; +import org.smartfrog.sfcore.prim.Prim; +import org.smartfrog.sfcore.prim.TerminationRecord; + +import java.rmi.RemoteException; + + +public class BundlePrimFactoryImpl extends AbstractPrimFactoryUsingClassLoader { + public static final String LOCATION_ATTRIBUTE = "location"; + private Bundle hostBundle = null; + + public BundlePrimFactoryImpl() throws RemoteException {} + + public synchronized void sfDeploy() throws SmartFrogException, RemoteException { + super.sfDeploy(); + + BundleContext daemonBundleContext = OSGiUtilities.getDaemonBundleContext(this); + String location = (String) sfResolve(LOCATION_ATTRIBUTE); + + try { + hostBundle = daemonBundleContext.installBundle(location); + } catch (BundleException e) { + throw SmartFrogException.forward( + "Error when installing bundle from location: " + location, e); + } + } + + public synchronized void sfStart() throws SmartFrogException, RemoteException { + super.sfStart(); + + if (OSGiUtilities.isNotFragment(hostBundle)) { + try { + hostBundle.start(); + } catch (BundleException e) { + SmartFrogException.forward("Error when starting bundle", e); + } + } + } + + public void sfTerminateWith(TerminationRecord status) { + try { + hostBundle.uninstall(); + } catch (BundleException e) { + sfLog().error("Error when uninstalling bundle", e); + } + + super.sfTerminate(status); + } + + protected Prim getComponentImpl(ComponentDescription askedFor) + throws ClassNotFoundException, InstantiationException, IllegalAccessException, + SmartFrogResolutionException + { + String sfClass = (String) askedFor.sfResolveHere(SmartFrogCoreKeys.SF_CLASS); + Class primClass = hostBundle.loadClass(sfClass); + return (Prim) primClass.newInstance(); + } + +} Modified: branches/core-branch-osgi/extras/osgi/daemon-bundle/src/org/smartfrog/osgi/OSGiBundleCompound.java =================================================================== --- branches/core-branch-osgi/extras/osgi/daemon-bundle/src/org/smartfrog/osgi/OSGiBundleCompound.java 2007-06-29 18:50:13 UTC (rev 4515) +++ branches/core-branch-osgi/extras/osgi/daemon-bundle/src/org/smartfrog/osgi/OSGiBundleCompound.java 2007-07-02 09:24:42 UTC (rev 4516) @@ -19,7 +19,7 @@ import java.util.Enumeration; /** - * @deprecated Use BundleClassLoadingEnvironmentImpl instead. + * @deprecated Use BundlePrimFactoryImpl instead. */ public class OSGiBundleCompound extends CompoundImpl implements Compound { private static final String BUNDLE_URL = "bundleURL"; Deleted: branches/core-branch-osgi/extras/osgi/daemon-bundle/src/org/smartfrog/osgi/ServiceComponentFactoryImpl.java =================================================================== --- branches/core-branch-osgi/extras/osgi/daemon-bundle/src/org/smartfrog/osgi/ServiceComponentFactoryImpl.java 2007-06-29 18:50:13 UTC (rev 4515) +++ branches/core-branch-osgi/extras/osgi/daemon-bundle/src/org/smartfrog/osgi/ServiceComponentFactoryImpl.java 2007-07-02 09:24:42 UTC (rev 4516) @@ -1,156 +0,0 @@ -package org.smartfrog.osgi; - -import org.osgi.framework.*; -import org.smartfrog.sfcore.common.SmartFrogDeploymentException; -import org.smartfrog.sfcore.common.SmartFrogResolutionException; -import org.smartfrog.sfcore.common.MessageUtil; -import org.smartfrog.sfcore.common.SmartFrogCoreKeys; -import org.smartfrog.sfcore.componentdescription.ComponentDescription; -import org.smartfrog.sfcore.deployer.ComponentFactory; -import org.smartfrog.sfcore.prim.Prim; -import org.smartfrog.sfcore.prim.PrimImpl; -import org.smartfrog.sfcore.prim.TerminationRecord; - -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.Method; -import java.lang.reflect.Proxy; -import java.rmi.RemoteException; - -/** - * A {@link ComponentFactory} implementation that gets components instances from the OSGi service registry. - * As OSGi services can come and go, this factory creates dynamic proxies that track the requested service. - * When it becomes unavailable, any invocation of its method will throw Exception. - * - * For now, we suppose that the interface name we get from the component description is the name of - * an interface that extends Prim. In the case of user error, nasty ClassCastExceptions will pop up. - */ -public class ServiceComponentFactoryImpl extends PrimImpl implements ComponentFactory { - - private BundleContext daemonBundleContext = null; - private final Method sfTerminateMethod; - - /** - * Attribute name for the name of the interface whose implementation will be used as a SmartFrog component. - */ - public static final String INTERFACE_NAME_ATTRIBUTE = "serviceInterface"; - - /** - * Creates the component factory. - * @throws RemoteException If PrimImpl constructor fails with this exception. - * @throws NoSuchMethodException Should not happen (except in case of programmer error). - */ - public ServiceComponentFactoryImpl() throws RemoteException, NoSuchMethodException { - sfTerminateMethod = Prim.class.getMethod("sfTerminate", new Class[]{ TerminationRecord.class }); - } - - /** - * Deploys the factory. The only thing to do here is to get the bundle context from where it's kept. - * @throws SmartFrogResolutionException - * @throws RemoteException - */ - public void sfDeploy() throws SmartFrogResolutionException, RemoteException { - daemonBundleContext = OSGiUtilities.getDaemonBundleContext(this); - } - - /** - * - * @param askedFor The contents of the sfMeta attribute of the Prim we're deploying. - * @return The newly created Prim instance. - * @throws SmartFrogResolutionException If resolution of the interface name attribute fails. - * @throws SmartFrogDeploymentException Should not happen (except in case of programmer error). - */ - public Prim getComponent(ComponentDescription askedFor) - throws SmartFrogDeploymentException - { - - String interfaceName; - try { - interfaceName = (String) askedFor.sfResolveHere(INTERFACE_NAME_ATTRIBUTE); - } catch (SmartFrogResolutionException e) { - throw new SmartFrogDeploymentException( - MessageUtil.formatMessage(MSG_UNRESOLVED_REFERENCE, INTERFACE_NAME_ATTRIBUTE), - e, - this, - askedFor.sfContext() - ); - } - - final UnregisterOnTerminateInvocationHandler invocationHandler = - new UnregisterOnTerminateInvocationHandler(interfaceName); - - // We pass our classloader: the newly created proxy class will - // be defined by our classloader. - return (Prim) Proxy.newProxyInstance( - getClass().getClassLoader(), - new Class[] {Prim.class}, - invocationHandler); - } - - private class UnregisterOnTerminateInvocationHandler implements InvocationHandler, ServiceListener { - private final String targetInterface; - private ServiceReference targetReference; - private Prim target; - - private UnregisterOnTerminateInvocationHandler(String targetInterface) - throws SmartFrogDeploymentException - { - this.targetInterface = targetInterface; - - targetReference = daemonBundleContext.getServiceReference(targetInterface); - - if (targetReference == null) { - sfLog().warn("Service not available at component creation: " + targetInterface); - target = null; - } else - target = (Prim) daemonBundleContext.getService(targetReference); - - try { - // We'll only be notified of events for services implementing the interface interfaceName. - daemonBundleContext.addServiceListener( - // Need to check whether leaking "this" is dangerous here or not. I suspect it is... - this, - "(" + Constants.OBJECTCLASS + "=" + targetInterface + ")" - ); - } catch (InvalidSyntaxException e) { - // This really oughts to be a RuntimeException. Dammit! - throw new SmartFrogDeploymentException - ("Programming error when registering an OSGi service listener", e); - } - } - - public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { - // Throwing RemoteExceptions because all methods in Prim do throw it (since it's a remote interface). - // If I threw SmartFrogRuntimeExceptions instead, an used could get UndeclaredThrowableExceptions that he's - // not going to handle. And the semantics of RemoteExceptions are reasonably similar to this... - // Anyway, checked exceptions stink. - if (target == null) - throw new RemoteException - ("The OSGi service implementing this component is not available. Target interface: " + targetInterface); - - Object returnValue = method.invoke(target, args); - - if (method.equals(sfTerminateMethod)) - unregisterService(); - - return returnValue; - } - - private void unregisterService() { - daemonBundleContext.ungetService(targetReference); - } - - public void serviceChanged(ServiceEvent serviceEvent) { - if (serviceEvent.getServiceReference().equals(targetReference) - && serviceEvent.getType() == ServiceEvent.UNREGISTERING - && target != null) - { - daemonBundleContext.ungetService(targetReference); - target = null; - } else if (serviceEvent.getType() == ServiceEvent.REGISTERED && target == null) { - targetReference = serviceEvent.getServiceReference(); - target = (Prim) daemonBundleContext.getService(targetReference); - } - - } - } -} Copied: branches/core-branch-osgi/extras/osgi/daemon-bundle/src/org/smartfrog/osgi/ServicePrimFactoryImpl.java (from rev 4498, branches/core-branch-osgi/extras/osgi/daemon-bundle/src/org/smartfrog/osgi/ServiceComponentFactoryImpl.java) =================================================================== --- branches/core-branch-osgi/extras/osgi/daemon-bundle/src/org/smartfrog/osgi/ServicePrimFactoryImpl.java (rev 0) +++ branches/core-branch-osgi/extras/osgi/daemon-bundle/src/org/smartfrog/osgi/ServicePrimFactoryImpl.java 2007-07-02 09:24:42 UTC (rev 4516) @@ -0,0 +1,155 @@ +package org.smartfrog.osgi; + +import org.osgi.framework.*; +import org.smartfrog.sfcore.common.SmartFrogDeploymentException; +import org.smartfrog.sfcore.common.SmartFrogResolutionException; +import org.smartfrog.sfcore.common.MessageUtil; +import org.smartfrog.sfcore.componentdescription.ComponentDescription; +import org.smartfrog.sfcore.deployer.PrimFactory; +import org.smartfrog.sfcore.prim.Prim; +import org.smartfrog.sfcore.prim.PrimImpl; +import org.smartfrog.sfcore.prim.TerminationRecord; + +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.Method; +import java.lang.reflect.Proxy; +import java.rmi.RemoteException; + +/** + * A {@link PrimFactory} implementation that gets components instances from the OSGi service registry. + * As OSGi services can come and go, this factory creates dynamic proxies that track the requested service. + * When it becomes unavailable, any invocation of its method will throw Exception. + * + * For now, we suppose that the interface name we get from the component description is the name of + * an interface that extends Prim. In the case of user error, nasty ClassCastExceptions will pop up. + */ +public class ServicePrimFactoryImpl extends PrimImpl implements PrimFactory { + + private BundleContext daemonBundleContext = null; + private final Method sfTerminateMethod; + + /** + * Attribute name for the name of the interface whose implementation will be used as a SmartFrog component. + */ + public static final String INTERFACE_NAME_ATTRIBUTE = "serviceInterface"; + + /** + * Creates the component factory. + * @throws RemoteException If PrimImpl constructor fails with this exception. + * @throws NoSuchMethodException Should not happen (except in case of programmer error). + */ + public ServicePrimFactoryImpl() throws RemoteException, NoSuchMethodException { + sfTerminateMethod = Prim.class.getMethod("sfTerminate", new Class[]{ TerminationRecord.class }); + } + + /** + * Deploys the factory. The only thing to do here is to get the bundle context from where it's kept. + * @throws SmartFrogResolutionException + * @throws RemoteException + */ + public void sfDeploy() throws SmartFrogResolutionException, RemoteException { + daemonBundleContext = OSGiUtilities.getDaemonBundleContext(this); + } + + /** + * + * @param askedFor The contents of the sfMeta attribute of the Prim we're deploying. + * @return The newly created Prim instance. + * @throws SmartFrogResolutionException If resolution of the interface name attribute fails. + * @throws SmartFrogDeploymentException Should not happen (except in case of programmer error). + */ + public Prim getComponent(ComponentDescription askedFor) + throws SmartFrogDeploymentException + { + + String interfaceName; + try { + interfaceName = (String) askedFor.sfResolveHere(INTERFACE_NAME_ATTRIBUTE); + } catch (SmartFrogResolutionException e) { + throw new SmartFrogDeploymentException( + MessageUtil.formatMessage(MSG_UNRESOLVED_REFERENCE, INTERFACE_NAME_ATTRIBUTE), + e, + this, + askedFor.sfContext() + ); + } + + final UnregisterOnTerminateInvocationHandler invocationHandler = + new UnregisterOnTerminateInvocationHandler(interfaceName); + + // We pass our classloader: the newly created proxy class will + // be defined by our classloader. + return (Prim) Proxy.newProxyInstance( + getClass().getClassLoader(), + new Class[] {Prim.class}, + invocationHandler); + } + + private class UnregisterOnTerminateInvocationHandler implements InvocationHandler, ServiceListener { + private final String targetInterface; + private ServiceReference targetReference; + private Prim target; + + private UnregisterOnTerminateInvocationHandler(String targetInterface) + throws SmartFrogDeploymentException + { + this.targetInterface = targetInterface; + + targetReference = daemonBundleContext.getServiceReference(targetInterface); + + if (targetReference == null) { + sfLog().warn("Service not available at component creation: " + targetInterface); + target = null; + } else + target = (Prim) daemonBundleContext.getService(targetReference); + + try { + // We'll only be notified of events for services implementing the interface interfaceName. + daemonBundleContext.addServiceListener( + // Need to check whether leaking "this" is dangerous here or not. I suspect it is... + this, + "(" + Constants.OBJECTCLASS + "=" + targetInterface + ")" + ); + } catch (InvalidSyntaxException e) { + // This really oughts to be a RuntimeException. Dammit! + throw new SmartFrogDeploymentException + ("Programming error when registering an OSGi service listener", e); + } + } + + public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { + // Throwing RemoteExceptions because all methods in Prim do throw it (since it's a remote interface). + // If I threw SmartFrogRuntimeExceptions instead, an used could get UndeclaredThrowableExceptions that he's + // not going to handle. And the semantics of RemoteExceptions are reasonably similar to this... + // Anyway, checked exceptions stink. + if (target == null) + throw new RemoteException + ("The OSGi service implementing this component is not available. Target interface: " + targetInterface); + + Object returnValue = method.invoke(target, args); + + if (method.equals(sfTerminateMethod)) + unregisterService(); + + return returnValue; + } + + private void unregisterService() { + daemonBundleContext.ungetService(targetReference); + } + + public void serviceChanged(ServiceEvent serviceEvent) { + if (serviceEvent.getServiceReference().equals(targetReference) + && serviceEvent.getType() == ServiceEvent.UNREGISTERING + && target != null) + { + daemonBundleContext.ungetService(targetReference); + target = null; + } else if (serviceEvent.getType() == ServiceEvent.REGISTERED && target == null) { + targetReference = serviceEvent.getServiceReference(); + target = (Prim) daemonBundleContext.getService(targetReference); + } + + } + } +} Modified: branches/core-branch-osgi/extras/osgi/daemon-bundle/src/org/smartfrog/osgi/components.sf =================================================================== --- branches/core-branch-osgi/extras/osgi/daemon-bundle/src/org/smartfrog/osgi/components.sf 2007-06-29 18:50:13 UTC (rev 4515) +++ branches/core-branch-osgi/extras/osgi/daemon-bundle/src/org/smartfrog/osgi/components.sf 2007-07-02 09:24:42 UTC (rev 4516) @@ -6,7 +6,7 @@ } OSGiBundle extends Prim { - sfClass "org.smartfrog.osgi.BundleClassLoadingEnvironmentImpl"; + sfClass "org.smartfrog.osgi.BundlePrimFactoryImpl"; location extends String; } \ No newline at end of file Modified: branches/core-branch-osgi/smartfrog/src/org/smartfrog/sfcore/common/SmartFrogCoreKeys.java =================================================================== --- branches/core-branch-osgi/smartfrog/src/org/smartfrog/sfcore/common/SmartFrogCoreKeys.java 2007-06-29 18:50:13 UTC (rev 4515) +++ branches/core-branch-osgi/smartfrog/src/org/smartfrog/sfcore/common/SmartFrogCoreKeys.java 2007-07-02 09:24:42 UTC (rev 4516) @@ -330,7 +330,7 @@ public static final String SF_FINAL= "sfFinal"; /** - * Attribute inside SF_METADATA used to select the ComponentFactory + * Attribute inside SF_METADATA used to select the PrimFactory * component used to create a component instance. */ public static final String SF_FACTORY = "sfFactory"; Deleted: branches/core-branch-osgi/smartfrog/src/org/smartfrog/sfcore/deployer/AbstractComponentFactoryUsingClassLoader.java =================================================================== --- branches/core-branch-osgi/smartfrog/src/org/smartfrog/sfcore/deployer/AbstractComponentFactoryUsingClassLoader.java 2007-06-29 18:50:13 UTC (rev 4515) +++ branches/core-branch-osgi/smartfrog/src/org/smartfrog/sfcore/deployer/AbstractComponentFactoryUsingClassLoader.java 2007-07-02 09:24:42 UTC (rev 4516) @@ -1,48 +0,0 @@ -package org.smartfrog.sfcore.deployer; - -import org.smartfrog.sfcore.prim.PrimImpl; -import org.smartfrog.sfcore.prim.Prim; -import org.smartfrog.sfcore.componentdescription.ComponentDescription; -import org.smartfrog.sfcore.common.SmartFrogResolutionException; -import org.smartfrog.sfcore.common.SmartFrogDeploymentException; -import org.smartfrog.sfcore.common.MessageUtil; -import org.smartfrog.sfcore.common.SmartFrogCoreKeys; - -public abstract class AbstractComponentFactoryUsingClassLoader extends PrimImpl implements ComponentFactory { - - protected AbstractComponentFactoryUsingClassLoader() {} - - - public Prim getComponent(ComponentDescription askedFor) throws SmartFrogDeploymentException { - String className = null; - try { - // Not pretty - but needed to have a proper error message, and pass tests. - className = (String) askedFor.sfResolveHere(SmartFrogCoreKeys.SF_CLASS); - - return getComponentImpl(askedFor); - } catch (ClassNotFoundException e) { - throw deploymentException(MessageUtil.formatMessage( - MSG_CLASS_NOT_FOUND, className), e, askedFor); - } catch (InstantiationException instexcp) { - throw deploymentException(MessageUtil.formatMessage( - MSG_INSTANTIATION_ERROR, "Prim"), instexcp, askedFor); - } catch (IllegalAccessException illaexcp) { - throw deploymentException(MessageUtil.formatMessage( - MSG_ILLEGAL_ACCESS, "Prim", "newInstance()"), illaexcp, - askedFor); - } catch (SmartFrogResolutionException e) { - throw deploymentException(MessageUtil.formatMessage( - MSG_UNRESOLVED_REFERENCE, SmartFrogCoreKeys.SF_CLASS), e, - askedFor); - } - } - - private SmartFrogDeploymentException deploymentException(String message, Exception e, ComponentDescription askedFor) { - return new SmartFrogDeploymentException(message, e, this, askedFor.sfContext()); - } - - protected abstract Prim getComponentImpl(ComponentDescription askedFor) - throws ClassNotFoundException, InstantiationException, - IllegalAccessException, SmartFrogResolutionException, SmartFrogDeploymentException; - -} Copied: branches/core-branch-osgi/smartfrog/src/org/smartfrog/sfcore/deployer/AbstractPrimFactoryUsingClassLoader.java (from rev 4511, branches/core-branch-osgi/smartfrog/src/org/smartfrog/sfcore/deployer/AbstractComponentFactoryUsingClassLoader.java) =================================================================== --- branches/core-branch-osgi/smartfrog/src/org/smartfrog/sfcore/deployer/AbstractPrimFactoryUsingClassLoader.java (rev 0) +++ branches/core-branch-osgi/smartfrog/src/org/smartfrog/sfcore/deployer/AbstractPrimFactoryUsingClassLoader.java 2007-07-02 09:24:42 UTC (rev 4516) @@ -0,0 +1,48 @@ +package org.smartfrog.sfcore.deployer; + +import org.smartfrog.sfcore.prim.PrimImpl; +import org.smartfrog.sfcore.prim.Prim; +import org.smartfrog.sfcore.componentdescription.ComponentDescription; +import org.smartfrog.sfcore.common.SmartFrogResolutionException; +import org.smartfrog.sfcore.common.SmartFrogDeploymentException; +import org.smartfrog.sfcore.common.MessageUtil; +import org.smartfrog.sfcore.common.SmartFrogCoreKeys; + +public abstract class AbstractPrimFactoryUsingClassLoader extends PrimImpl implements PrimFactory { + + protected AbstractPrimFactoryUsingClassLoader() {} + + + public Prim getComponent(ComponentDescription askedFor) throws SmartFrogDeploymentException { + String className = null; + try { + // Not pretty - but needed to have a proper error message, and pass tests. + className = (String) askedFor.sfResolveHere(SmartFrogCoreKeys.SF_CLASS); + + return getComponentImpl(askedFor); + } catch (ClassNotFoundException e) { + throw deploymentException(MessageUtil.formatMessage( + MSG_CLASS_NOT_FOUND, className), e, askedFor); + } catch (InstantiationException instexcp) { + throw deploymentException(MessageUtil.formatMessage( + MSG_INSTANTIATION_ERROR, "Prim"), instexcp, askedFor); + } catch (IllegalAccessException illaexcp) { + throw deploymentException(MessageUtil.formatMessage( + MSG_ILLEGAL_ACCESS, "Prim", "newInstance()"), illaexcp, + askedFor); + } catch (SmartFrogResolutionException e) { + throw deploymentException(MessageUtil.formatMessage( + MSG_UNRESOLVED_REFERENCE, SmartFrogCoreKeys.SF_CLASS), e, + askedFor); + } + } + + private SmartFrogDeploymentException deploymentException(String message, Exception e, ComponentDescription askedFor) { + return new SmartFrogDeploymentException(message, e, this, askedFor.sfContext()); + } + + protected abstract Prim getComponentImpl(ComponentDescription askedFor) + throws ClassNotFoundException, InstantiationException, + IllegalAccessException, SmartFrogResolutionException, SmartFrogDeploymentException; + +} Modified: branches/core-branch-osgi/smartfrog/src/org/smartfrog/sfcore/deployer/ComponentDeployer.java =================================================================== --- branches/core-branch-osgi/smartfrog/src/org/smartfrog/sfcore/deployer/ComponentDeployer.java 2007-06-29 18:50:13 UTC (rev 4515) +++ branches/core-branch-osgi/smartfrog/src/org/smartfrog/sfcore/deployer/ComponentDeployer.java 2007-07-02 09:24:42 UTC (rev 4516) @@ -26,7 +26,7 @@ import org.smartfrog.sfcore.reference.Reference; /** - * Deploys a new {@link Prim} in the component hierarchy, delegating object creation to a {@link ComponentFactory}. + * Deploys a new {@link Prim} in the component hierarchy, delegating object creation to a {@link PrimFactory}. * Implementations are used to deploy a single Prim, and are discarded afterwards. * Thus they must have a public, one-argument constructor that takes the Prim's {@link org.smartfrog.sfcore.componentdescription.ComponentDescription}. */ @@ -48,7 +48,7 @@ /** * Sets the factory to be used. Always called before {@link this.deploy()}. - * @param componentFactory The factory to be used to create component instances. + * @param primFactory The factory to be used to create component instances. */ - void setComponentFactory(ComponentFactory componentFactory); + void setComponentFactory(PrimFactory primFactory); } Deleted: branches/core-branch-osgi/smartfrog/src/org/smartfrog/sfcore/deployer/ComponentFactory.java =================================================================== --- branches/core-branch-osgi/smartfrog/src/org/smartfrog/sfcore/deployer/ComponentFactory.java 2007-06-29 18:50:13 UTC (rev 4515) +++ branches/core-branch-osgi/smartfrog/src/org/smartfrog/sfcore/deployer/ComponentFactory.java 2007-07-02 09:24:42 UTC (rev 4516) @@ -1,26 +0,0 @@ -package org.smartfrog.sfcore.deployer; - -import org.smartfrog.sfcore.common.SmartFrogDeploymentException; -import org.smartfrog.sfcore.componentdescription.ComponentDescription; -import org.smartfrog.sfcore.prim.Prim; - -import java.rmi.Remote; -import java.rmi.RemoteException; - -public interface ComponentFactory extends Remote { - /** - * Creates the component instance from a given description. It is not mandatory that the given description - * be that of the whole component: it can be a sub-attribute of the component description for example. - * This is left for implementations to decide. - * - * This method throws loads of exceptions so that implementations don't have to do exception wrapping themselves. - * We probably want to change that. - * - * @param askedFor The ComponentDescription to work off. - * @return The newly created component instance. - * @throws RemoteException - * @throws SmartFrogDeploymentException - */ - Prim getComponent(ComponentDescription askedFor) - throws RemoteException, SmartFrogDeploymentException; -} Modified: branches/core-branch-osgi/smartfrog/src/org/smartfrog/sfcore/deployer/FrameworkClassLoadingEnvironmentImpl.java =================================================================== --- branches/core-branch-osgi/smartfrog/src/org/smartfrog/sfcore/deployer/FrameworkClassLoadingEnvironmentImpl.java 2007-06-29 18:50:13 UTC (rev 4515) +++ branches/core-branch-osgi/smartfrog/src/org/smartfrog/sfcore/deployer/FrameworkClassLoadingEnvironmentImpl.java 2007-07-02 09:24:42 UTC (rev 4516) @@ -9,7 +9,7 @@ * The component factory that should be used for framework components. * Those come from the same classloader as this class. */ -public class FrameworkClassLoadingEnvironmentImpl extends AbstractComponentFactoryUsingClassLoader { +public class FrameworkClassLoadingEnvironmentImpl extends AbstractPrimFactoryUsingClassLoader { public FrameworkClassLoadingEnvironmentImpl() {} Deleted: branches/core-branch-osgi/smartfrog/src/org/smartfrog/sfcore/deployer/OldAlgorithmComponentFactory.java =================================================================== --- branches/core-branch-osgi/smartfrog/src/org/smartfrog/sfcore/deployer/OldAlgorithmComponentFactory.java 2007-06-29 18:50:13 UTC (rev 4515) +++ branches/core-branch-osgi/smartfrog/src/org/smartfrog/sfcore/deployer/OldAlgorithmComponentFactory.java 2007-07-02 09:24:42 UTC (rev 4516) @@ -1,109 +0,0 @@ -package org.smartfrog.sfcore.deployer; - -import org.smartfrog.sfcore.prim.Prim; -import org.smartfrog.sfcore.componentdescription.ComponentDescription; -import org.smartfrog.sfcore.componentdescription.ComponentDescriptionImpl; -import org.smartfrog.sfcore.common.*; -import org.smartfrog.sfcore.security.SFClassLoader; -import org.smartfrog.sfcore.logging.LogSF; -import org.smartfrog.sfcore.logging.LogFactory; -import org.smartfrog.sfcore.reference.Reference; - -/** - * Implements the sfCodebase-aware component creation, as currently documented. - * The code was originally in PrimImpl. - */ -public class OldAlgorithmComponentFactory extends AbstractComponentFactoryUsingClassLoader { - - private LogSF sfLog = LogFactory.sfGetProcessLog(); - - /** - * Efficiency holder of sfClass reference. - */ - private static final Reference refClass = new Reference( - SmartFrogCoreKeys.SF_CLASS); - - /** - * Efficiency holder of sfCodeBase reference. - */ - private static final Reference refCodeBase = new Reference( - SmartFrogCoreKeys.SF_CODE_BASE); - - - protected Prim getComponentImpl(ComponentDescription askedFor) - throws ClassNotFoundException, InstantiationException, - IllegalAccessException, SmartFrogResolutionException, - SmartFrogDeploymentException - { - return (Prim) getPrimClass(askedFor).newInstance(); - } - - - /** - * Get the class for the primitive to be deployed. This is where the - * sfClass attribute is looked up, using the classloader returned by - * getPrimClassLoader - * - * @return class for target - * @throws Exception failed to load class - */ - private Class getPrimClass(ComponentDescription target) throws SmartFrogResolutionException, SmartFrogDeploymentException { - String targetCodeBase = null; - String targetClassName; - Object obj = null; - try { - - targetCodeBase = getSfCodeBase(target); - targetClassName = (String) target.sfResolve(refClass); - - // 3rd parameter = true: We look in the default code base if everything else fails. - return SFClassLoader.forName(targetClassName, targetCodeBase, true); - - } catch (SmartFrogResolutionException resex) { - resex.put(SmartFrogRuntimeException.SOURCE, target.sfCompleteName()); - resex.fillInStackTrace(); - - throw resex; - } catch (ClassCastException ccex) { - Object name = null; - if (target.sfContext().containsKey(SmartFrogCoreKeys.SF_PROCESS_COMPONENT_NAME)) { - name = target.sfResolveHere(SmartFrogCoreKeys.SF_PROCESS_COMPONENT_NAME, false); - } - throw new SmartFrogDeploymentException(refClass, null, name, target, - null, "Wrong class when resolving '" + refClass + "': '" - + obj + "' (" + obj.getClass().getName() + ")", ccex, targetCodeBase); - } catch (ClassNotFoundException cnfex) { - Object name = null; - if (target.sfContext().containsKey(SmartFrogCoreKeys.SF_PROCESS_COMPONENT_NAME)) { - name = target.sfResolveHere(SmartFrogCoreKeys.SF_PROCESS_COMPONENT_NAME, false); - } - ComponentDescription cdInfo = new ComponentDescriptionImpl(null, new ContextImpl(), false); - try { - if (targetCodeBase != null) cdInfo.sfAddAttribute(SmartFrogCoreKeys.SF_CODE_BASE, - targetCodeBase); - cdInfo.sfAddAttribute("java.class.path", System.getProperty("java.class.path")); - cdInfo.sfAddAttribute("org.smartfrog.sfcore.processcompound.sfProcessName", - System.getProperty("org.smartfrog.sfcore.processcompound.sfProcessName")); - } catch (SmartFrogException sfex) { - if (sfLog.isDebugEnabled()) sfLog.debug("", sfex); - } - throw new SmartFrogDeploymentException(refClass, null, name, target, null, "Class not found", cnfex, cdInfo); - } - } - - /** - * Gets the class code base by resolving the sfCodeBase attribute in the - * given description. - * - * @param desc Description in which we resolve the code base. - * @return class code base for that description. - */ - private String getSfCodeBase(ComponentDescription desc) { - try { - return (String) desc.sfResolve(refCodeBase); - } catch (Exception e) { - return null; - } - } - -} Copied: branches/core-branch-osgi/smartfrog/src/org/smartfrog/sfcore/deployer/OldAlgorithmPrimFactory.java (from rev 4511, branches/core-branch-osgi/smartfrog/src/org/smartfrog/sfcore/deployer/OldAlgorithmComponentFactory.java) =================================================================== --- branches/core-branch-osgi/smartfrog/src/org/smartfrog/sfcore/deployer/OldAlgorithmPrimFactory.java (rev 0) +++ branches/core-branch-osgi/smartfrog/src/org/smartfrog/sfcore/deployer/OldAlgorithmPrimFactory.java 2007-07-02 09:24:42 UTC (rev 4516) @@ -0,0 +1,109 @@ +package org.smartfrog.sfcore.deployer; + +import org.smartfrog.sfcore.prim.Prim; +import org.smartfrog.sfcore.componentdescription.ComponentDescription; +import org.smartfrog.sfcore.componentdescription.ComponentDescriptionImpl; +import org.smartfrog.sfcore.common.*; +import org.smartfrog.sfcore.security.SFClassLoader; +import org.smartfrog.sfcore.logging.LogSF; +import org.smartfrog.sfcore.logging.LogFactory; +import org.smartfrog.sfcore.reference.Reference; + +/** + * Implements the sfCodebase-aware component creation, as currently documented. + * The code was originally in PrimImpl. + */ +public class OldAlgorithmPrimFactory extends AbstractPrimFactoryUsingClassLoader { + + private LogSF sfLog = LogFactory.sfGetProcessLog(); + + /** + * Efficiency holder of sfClass reference. + */ + private static final Reference refClass = new Reference( + SmartFrogCoreKeys.SF_CLASS); + + /** + * Efficiency holder of sfCodeBase reference. + */ + private static final Reference refCodeBase = new Reference( + SmartFrogCoreKeys.SF_CODE_BASE); + + + protected Prim getComponentImpl(ComponentDescription askedFor) + throws ClassNotFoundException, InstantiationException, + IllegalAccessException, SmartFrogResolutionException, + SmartFrogDeploymentException + { + return (Prim) getPrimClass(askedFor).newInstance(); + } + + + /** + * Get the class for the primitive to be deployed. This is where the + * sfClass attribute is looked up, using the classloader returned by + * getPrimClassLoader + * + * @return class for target + * @throws Exception failed to load class + */ + private Class getPrimClass(ComponentDescription target) throws SmartFrogResolutionException, SmartFrogDeploymentException { + String targetCodeBase = null; + String targetClassName; + Object obj = null; + try { + + targetCodeBase = getSfCodeBase(target); + targetClassName = (String) target.sfResolve(refClass); + + // 3rd parameter = true: We look in the default code base if everything else fails. + return SFClassLoader.forName(targetClassName, targetCodeBase, true); + + } catch (SmartFrogResolutionException resex) { + resex.put(SmartFrogRuntimeException.SOURCE, target.sfCompleteName()); + resex.fillInStackTrace(); + + throw resex; + } catch (ClassCastException ccex) { + Object name = null; + if (target.sfContext().containsKey(SmartFrogCoreKeys.SF_PROCESS_COMPONENT_NAME)) { + name = target.sfResolveHere(SmartFrogCoreKeys.SF_PROCESS_COMPONENT_NAME, false); + } + throw new SmartFrogDeploymentException(refClass, null, name, target, + null, "Wrong class when resolving '" + refClass + "': '" + + obj + "' (" + obj.getClass().getName() + ")", ccex, targetCodeBase); + } catch (ClassNotFoundException cnfex) { + Object name = null; + if (target.sfContext().containsKey(SmartFrogCoreKeys.SF_PROCESS_COMPONENT_NAME)) { + name = target.sfResolveHere(SmartFrogCoreKeys.SF_PROCESS_COMPONENT_NAME, false); + } + ComponentDescription cdInfo = new ComponentDescriptionImpl(null, new ContextImpl(), false); + try { + if (targetCodeBase != null) cdInfo.sfAddAttribute(SmartFrogCoreKeys.SF_CODE_BASE, + targetCodeBase); + cdInfo.sfAddAttribute("java.class.path", System.getProperty("java.class.path")); + cdInfo.sfAddAttribute("org.smartfrog.sfcore.processcompound.sfProcessName", + System.getProperty("org.smartfrog.sfcore.processcompound.sfProcessName")); + } catch (SmartFrogException sfex) { + if (sfLog.isDebugEnabled()) sfLog.debug("", sfex); + } + throw new SmartFrogDeploymentException(refClass, null, name, target, null, "Class not found", cnfex, cdInfo); + } + } + + /** + * Gets the class code base by resolving the sfCodeBase attribute in the + * given description. + * + * @param desc Description in which we resolve the code base. + * @return class code base for that description. + */ + private String getSfCodeBase(ComponentDescription desc) { + try { + return (String) desc.sfResolve(refCodeBase); + } catch (Exception e) { + return null; + } + } + +} Copied: branches/core-branch-osgi/smartfrog/src/org/smartfrog/sfcore/deployer/PrimFactory.java (from rev 4497, branches/core-branch-osgi/smartfrog/src/org/smartfrog/sfcore/deployer/ComponentFactory.java) =================================================================== --- branches/core-branch-osgi/smartfrog/src/org/smartfrog/sfcore/deployer/PrimFactory.java (rev 0) +++ branches/core-branch-osgi/smartfrog/src/org/smartfrog/sfcore/deployer/PrimFactory.java 2007-07-02 09:24:42 UTC (rev 4516) @@ -0,0 +1,26 @@ +package org.smartfrog.sfcore.deployer; + +import org.smartfrog.sfcore.common.SmartFrogDeploymentException; +import org.smartfrog.sfcore.componentdescription.ComponentDescription; +import org.smartfrog.sfcore.prim.Prim; + +import java.rmi.Remote; +import java.rmi.RemoteException; + +public interface PrimFactory extends Remote { + /** + * Creates the component instance from a given description. It is not mandatory that the given description + * be that of the whole component: it can be a sub-attribute of the component description for example. + * This is left for implementations to decide. + * + * This method throws loads of exceptions so that implementations don't have to do exception wrapping themselves. + * We probably want to change that. + * + * @param askedFor The ComponentDescription to work off. + * @return The newly created component instance. + * @throws RemoteException + * @throws SmartFrogDeploymentException + */ + Prim getComponent(ComponentDescription askedFor) + throws RemoteException, SmartFrogDeploymentException; +} Modified: branches/core-branch-osgi/smartfrog/src/org/smartfrog/sfcore/deployer/SFDeployer.java =================================================================== --- branches/core-branch-osgi/smartfrog/src/org/smartfrog/sfcore/deployer/SFDeployer.java 2007-06-29 18:50:13 UTC (rev 4515) +++ branches/core-branch-osgi/smartfrog/src/org/smartfrog/sfcore/deployer/SFDeployer.java 2007-07-02 09:24:42 UTC (rev 4516) @@ -135,7 +135,7 @@ } } - private static ComponentFactory getComponentFactory(ComponentDescription component) + private static PrimFactory getComponentFactory(ComponentDescription component) throws SmartFrogResolutionException { ComponentDescription metadata = null; @@ -150,14 +150,14 @@ // The sfFactory attribute needs to be resolved in those two steps because sfMeta is declared as such: // sfMeta extends DATA { ... sfFactory LAZY xxx; } Reference factoryRef = (Reference) metadata.sfResolveHere(SmartFrogCoreKeys.SF_FACTORY); - return (ComponentFactory) metadata.sfResolve(factoryRef); + return (PrimFactory) metadata.sfResolve(factoryRef); } else { // Component using the old sfClass-only syntax return defaultFactory(); } } - private static ComponentFactory defaultFactory() { - return new OldAlgorithmComponentFactory(); + private static PrimFactory defaultFactory() { + return new OldAlgorithmPrimFactory(); } } Modified: branches/core-branch-osgi/smartfrog/src/org/smartfrog/sfcore/prim/PrimDeployerImpl.java =================================================================== --- branches/core-branch-osgi/smartfrog/src/org/smartfrog/sfcore/prim/PrimDeployerImpl.java 2007-06-29 18:50:13 UTC (rev 4515) +++ branches/core-branch-osgi/smartfrog/src/org/smartfrog/sfcore/prim/PrimDeployerImpl.java 2007-07-02 09:24:42 UTC (rev 4516) @@ -24,7 +24,7 @@ import org.smartfrog.sfcore.componentdescription.ComponentDescription; import org.smartfrog.sfcore.componentdescription.ComponentDescriptionImpl; import org.smartfrog.sfcore.deployer.ComponentDeployer; -import org.smartfrog.sfcore.deployer.ComponentFactory; +import org.smartfrog.sfcore.deployer.PrimFactory; import org.smartfrog.sfcore.reference.Reference; import org.smartfrog.sfcore.security.SFClassLoader; import org.smartfrog.sfcore.logging.LogSF; @@ -46,7 +46,7 @@ protected ComponentDescription target; /** The factory used to get the component instance. */ - private ComponentFactory componentFactory; + private PrimFactory primFactory; /** * Constructs a component deployer for given description. @@ -57,8 +57,8 @@ target = descr; } - public void setComponentFactory(ComponentFactory componentFactory) { - this.componentFactory = componentFactory; + public void setComponentFactory(PrimFactory primFactory) { + this.primFactory = primFactory; } /** @@ -78,7 +78,7 @@ try { // create instance - Prim dComponent = componentFactory.getComponent(target); + Prim dComponent = primFactory.getComponent(target); // deploy component after wiping out the parentage of any // descriptions in the context. Prim is not a valid parent, so @@ -140,7 +140,7 @@ } // BEGIN LEGACY CODE ////////////// - // This is now in OldAlgorithmComponentFactory, but DNSComponentDeployerImpl needs it here. + // This is now in OldAlgorithmPrimFactory, but DNSComponentDeployerImpl needs it here. // Should be removed very soon. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |