Hi, Just wanted to query the hardcoded ? version adding in the ConfigMap - am I missing some generation for those strings or can it otherwise be coded to pick up the current Qpid version from the build system ?
Marnie On Fri, May 7, 2010 at 4:13 PM, <ritch...@apache.org> wrote: > Author: ritchiem > Date: Fri May 7 15:13:44 2010 > New Revision: 942114 > > URL: http://svn.apache.org/viewvc?rev=942114&view=rev > Log: > QPID-2585 : Upgrade to Felix 2.0.5 > > Added: > qpid/trunk/qpid/java/lib/org.apache.felix.framework-2.0.5.jar > Removed: > qpid/trunk/qpid/java/lib/org.apache.felix.framework-1.0.0.jar > Modified: > qpid/trunk/qpid/java/broker/etc/config.xml > > > qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/plugins/PluginManager.java > qpid/trunk/qpid/java/build.deps > > Modified: qpid/trunk/qpid/java/broker/etc/config.xml > URL: > http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker/etc/config.xml?rev=942114&r1=942113&r2=942114&view=diff > > ============================================================================== > --- qpid/trunk/qpid/java/broker/etc/config.xml (original) > +++ qpid/trunk/qpid/java/broker/etc/config.xml Fri May 7 15:13:44 2010 > @@ -23,6 +23,8 @@ > <prefix>${QPID_HOME}</prefix> > <work>${QPID_WORK}</work> > <conf>${prefix}/etc</conf> > + > + <plugin-directory>${QPID_HOME}/lib/plugins</plugin-directory> > > <connector> > <!-- To enable SSL edit the keystorePath and keystorePassword > > Modified: > qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/plugins/PluginManager.java > URL: > http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/plugins/PluginManager.java?rev=942114&r1=942113&r2=942114&view=diff > > ============================================================================== > --- > qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/plugins/PluginManager.java > (original) > +++ > qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/plugins/PluginManager.java > Fri May 7 15:13:44 2010 > @@ -19,16 +19,12 @@ > > package org.apache.qpid.server.plugins; > > -import java.io.File; > -import java.util.ArrayList; > -import java.util.HashMap; > -import java.util.List; > -import java.util.Map; > - > +import org.apache.commons.configuration.ConfigurationException; > import org.apache.felix.framework.Felix; > import org.apache.felix.framework.cache.BundleCache; > import org.apache.felix.framework.util.FelixConstants; > import org.apache.felix.framework.util.StringMap; > +import > org.apache.qpid.server.configuration.plugin.ConfigurationPluginFactory; > import org.apache.qpid.server.exchange.ExchangeType; > import org.apache.qpid.server.security.access.ACLPlugin; > import org.apache.qpid.server.security.access.ACLPluginFactory; > @@ -37,155 +33,266 @@ import org.apache.qpid.server.security.a > import org.apache.qpid.server.security.access.plugins.LegacyAccessPlugin; > import org.apache.qpid.server.security.access.plugins.SimpleXML; > import > org.apache.qpid.server.security.access.plugins.network.FirewallPlugin; > +import org.apache.qpid.server.virtualhost.plugin.VirtualHostPluginFactory; > import org.osgi.framework.BundleActivator; > import org.osgi.framework.BundleException; > import org.osgi.util.tracker.ServiceTracker; > > +import java.io.File; > +import java.util.ArrayList; > +import java.util.HashMap; > +import java.util.List; > +import java.util.Map; > + > /** > - * > * @author aidan > - * > - * Provides access to pluggable elements, such as exchanges > + * > + * Provides access to pluggable elements, such as exchanges > */ > > public class PluginManager > { > - private Felix _felix = null; > private ServiceTracker _exchangeTracker = null; > private ServiceTracker _securityTracker = null; > - private Activator _activator = null; > - private boolean _empty; > + private ServiceTracker _configTracker = null; > + private ServiceTracker _virtualHostTracker = null; > + > + private Felix _felix; > + > + Activator _activator; > + > private Map<String, ACLPluginFactory> _securityPlugins; > + private static final int FELIX_STOP_TIMEOUT = 30000; > > public PluginManager(String plugindir) throws Exception > { > StringMap configMap = new StringMap(false); > > - // Tell felix it's being embedded > - configMap.put(FelixConstants.EMBEDDED_EXECUTION_PROP, "true"); > // Add the bundle provided service interface package and the core > OSGi > // packages to be exported from the class path via the system > bundle. > - configMap.put(FelixConstants.FRAMEWORK_SYSTEMPACKAGES, > "org.osgi.framework; version=1.3.0," > - + "org.osgi.service.packageadmin; version=1.2.0," + > - "org.osgi.service.startlevel; version=1.0.0," + > - "org.osgi.service.url; version=1.0.0," + > - "org.osgi.util.tracker; version=1.0.0,"+ > - "org.apache.qpid.junit.extensions.util; version=0.7," + > - "org.apache.qpid; version=0.7," + > - "org.apache.qpid.framing; version=0.7," + > - "org.apache.qpid.protocol; version=0.7," + > - "org.apache.qpid.server.exchange; version=0.7," + > - "org.apache.qpid.server.management; version=0.7,"+ > - "org.apache.qpid.server.protocol; version=0.7,"+ > - "org.apache.qpid.server.virtualhost; version=0.7," + > - "org.apache.qpid.server.registry; version=0.7," + > - "org.apache.qpid.server.queue; version=0.7," + > - "org.apache.qpid.server.binding; version=0.7," + > - "org.apache.qpid.server.configuration; version=0.7," + > - "org.apache.qpid.server.configuration.management; > version=0.7," + > - "org.apache.qpid.server.persistent; version=0.7," + > - "org.apache.qpid.server.plugins; version=0.7," + > - "org.apache.qpid.server.queue; version=0.7," + > - "org.apache.qpid.server.security; version=0.7," + > - "org.apache.qpid.framing.AMQShortString; version=0.7," + > - "org.apache.qpid.server.queue.AMQQueue; version=0.7," + > - "org.apache.qpid.server.security.access; version=0.7,"+ > - "org.apache.commons.configuration; version=0.7," + > - "javax.management.openmbean; version=1.0.0,"+ > - "javax.management; version=1.0.0," > - ); > - > + configMap.put(FelixConstants.FRAMEWORK_SYSTEMPACKAGES, > + "org.osgi.framework; version=1.3.0," + > + "org.osgi.service.packageadmin; version=1.2.0," + > + "org.osgi.service.startlevel; version=1.0.0," + > + "org.osgi.service.url; version=1.0.0," + > + "org.osgi.util.tracker; version=1.0.0," + > + "org.apache.qpid.junit.extensions.util; > version=0.7," + > + "org.apache.qpid; version=0.7," + > + "org.apache.qpid.framing; version=0.7," + > + "org.apache.qpid.protocol; version=0.7," + > + "org.apache.qpid.server.exchange; version=0.7," + > + "org.apache.qpid.server.management; version=0.7," + > + "org.apache.qpid.server.protocol; version=0.7," + > + "org.apache.qpid.server.virtualhost; version=0.7," + > + "org.apache.qpid.server.virtualhost.plugin; > version=0.7," + > + "org.apache.qpid.server.registry; version=0.7," + > + "org.apache.qpid.server.queue; version=0.7," + > + "org.apache.qpid.server.binding; version=0.7," + > + "org.apache.qpid.server.configuration; version=0.7," > + > + "org.apache.qpid.server.configuration.plugin; > version=0.7," + > + "org.apache.qpid.server.configuration.management; > version=0.7," + > + "org.apache.qpid.server.persistent; version=0.7," + > + "org.apache.qpid.server.plugins; version=0.7," + > + "org.apache.qpid.server.queue; version=0.7," + > + "org.apache.qpid.server.security; version=0.7," + > + "org.apache.qpid.framing.AMQShortString; > version=0.7," + > + "org.apache.qpid.server.queue.AMQQueue; > version=0.7," + > + "org.apache.qpid.server.security.access; > version=0.7," + > + "org.apache.commons.configuration; version=0.7," + > + "org.apache.log4j; version=1.2.12," + > + "javax.management.openmbean; version=1.0.0," + > + "javax.management; version=1.0.0," > + ); > + > if (plugindir == null) > { > - _empty = true; > return; > } > - > + > // Set the list of bundles to load > File dir = new File(plugindir); > if (!dir.exists()) > - { > - _empty = true; > + { > return; > - } > - > + } > + > StringBuffer pluginJars = new StringBuffer(); > - > + > if (dir.isDirectory()) > { > for (String child : dir.list()) > { > if (child.endsWith("jar")) > { > - pluginJars.append(String.format(" file:%s%s%s", > plugindir,File.separator,child)); > + pluginJars.append(String.format(" file:%s%s%s", > plugindir, File.separator, child)); > } > } > } > - > + > if (pluginJars.length() == 0) > { > - _empty = true; > return; > } > - > - configMap.put(FelixConstants.AUTO_START_PROP + ".1", > pluginJars.toString()); > - configMap.put(BundleCache.CACHE_PROFILE_DIR_PROP, plugindir); > - > + > +// configMap.put(FelixConstants.AUTO_START_PROP + ".1", > pluginJars.toString()); > +// configMap.put(BundleCache.CACHE_PROFILE_DIR_PROP, plugindir); > + > + configMap.put("felix.auto.start.1", pluginJars.toString()); > + configMap.put("felix.shutdown.hook","false"); > + configMap.put(FelixConstants.FRAMEWORK_STORAGE, plugindir); > + > + > List<BundleActivator> activators = new > ArrayList<BundleActivator>(); > _activator = new Activator(); > activators.add(_activator); > + configMap.put(FelixConstants.SYSTEMBUNDLE_ACTIVATORS_PROP, > activators); > > - _felix = new Felix(configMap, activators); > + _felix = new Felix(configMap); > try > { > + System.out.println("Starting Plugin manager"); > + > _felix.start(); > - > + > + System.out.println("Started Plugin manager"); > + > _exchangeTracker = new ServiceTracker(_activator.getContext(), > ExchangeType.class.getName(), null); > _exchangeTracker.open(); > - > + > _securityTracker = new ServiceTracker(_activator.getContext(), > ACLPlugin.class.getName(), null); > _securityTracker.open(); > - > + > + _configTracker = new ServiceTracker(_activator.getContext(), > ConfigurationPluginFactory.class.getName(), null); > + _configTracker.open(); > + > + _virtualHostTracker = new > ServiceTracker(_activator.getContext(), > VirtualHostPluginFactory.class.getName(), null); > + _virtualHostTracker.open(); > + > } > catch (BundleException e) > { > - throw new Exception("Could not create bundle"); > + throw new ConfigurationException("Could not start > PluginManager:" + e.getMessage(), e); > } > } > > private <T> Map<String, T> getServices(ServiceTracker tracker) > - { > - Map<String, T>services = new HashMap<String, T>(); > - > + { > + Map<String, T> services = new HashMap<String, T>(); > + > if ((tracker != null) && (tracker.getServices() != null)) > { > for (Object service : tracker.getServices()) > { > - services.put(service.getClass().getName(), (T) service); > + if (service instanceof PluginFactory) > + { > + services.put(((PluginFactory) > service).getPluginName(), (T) service); > + } > + else > + { > + services.put(service.getClass().getName(), (T) > service); > + } > } > - } > - > + } > + > return services; > } > - > + > public Map<String, ExchangeType<?>> getExchanges() > { > return getServices(_exchangeTracker); > } > - > + > public Map<String, ACLPluginFactory> getSecurityPlugins() > { > - if (_securityPlugins == null) > + _securityPlugins = getServices(_securityTracker); > + // A little gross that we have to add them here, but not all the > plugins are OSGIfied > + _securityPlugins.put(SimpleXML.class.getName(), > SimpleXML.FACTORY); > + _securityPlugins.put(AllowAll.class.getName(), AllowAll.FACTORY); > + _securityPlugins.put(DenyAll.class.getName(), DenyAll.FACTORY); > + _securityPlugins.put(LegacyAccessPlugin.class.getName(), > LegacyAccessPlugin.FACTORY); > + _securityPlugins.put(FirewallPlugin.class.getName(), > FirewallPlugin.FACTORY); > + > + return _securityPlugins; > + } > + > + public Map<String, ConfigurationPluginFactory> > getConfigurationPlugins() > + { > + Map<String, ConfigurationPluginFactory> services = new > HashMap<String, ConfigurationPluginFactory>(); > + > + if ((_configTracker != null) && (_configTracker.getServices() != > null)) > { > - _securityPlugins = getServices(_securityTracker); > - // A little gross that we have to add them here, but not all > the plugins are OSGIfied > - _securityPlugins.put(SimpleXML.class.getName(), > SimpleXML.FACTORY); > - _securityPlugins.put(AllowAll.class.getName(), > AllowAll.FACTORY); > - _securityPlugins.put(DenyAll.class.getName(), > DenyAll.FACTORY); > - _securityPlugins.put(LegacyAccessPlugin.class.getName(), > LegacyAccessPlugin.FACTORY); > - _securityPlugins.put(FirewallPlugin.class.getName(), > FirewallPlugin.FACTORY); > + for (Object service : _configTracker.getServices()) > + { > + for (String parent : ((ConfigurationPluginFactory) > service).getParentPaths()) > + { > + services.put(parent, ((ConfigurationPluginFactory) > service)); > + } > + } > + } > + > + return services; > + > + } > + > + public Map<String, VirtualHostPluginFactory> getVirtualHostPlugins() > + { > + return getServices(_virtualHostTracker); > + } > + > + public <P extends PluginFactory> Map<String, P> getPlugins(Class<P> > plugin) > + { > + ServiceTracker tracker = new > ServiceTracker(_activator.getContext(), plugin.getName(), null); > + tracker.open(); > + > + try > + { > + return getServices(tracker); > + } > + finally > + { > + tracker.close(); > + } > + } > + > + public void close() > + { > + if (_felix != null) > + { > + try > + { > + _exchangeTracker.close(); > + > + _securityTracker.close(); > + > + _configTracker.close(); > + > + _virtualHostTracker.close(); > + } > + finally > + { > + System.out.println("Stopping Plugin manager"); > + //fixme should be stopAndWait() but hangs VM, need upgrade > in felix > + try > + { > + _felix.stop(); > + } > + catch (BundleException e) > + { > + //ignore > + } > + > + try > + { > + _felix.waitForStop(FELIX_STOP_TIMEOUT); > + } > + catch (InterruptedException e) > + { > + //ignore > + } > + > + System.out.println("Stopped Plugin manager"); > + } > } > - return _securityPlugins; > } > > } > > Modified: qpid/trunk/qpid/java/build.deps > URL: > http://svn.apache.org/viewvc/qpid/trunk/qpid/java/build.deps?rev=942114&r1=942113&r2=942114&view=diff > > ============================================================================== > --- qpid/trunk/qpid/java/build.deps (original) > +++ qpid/trunk/qpid/java/build.deps Fri May 7 15:13:44 2010 > @@ -68,7 +68,7 @@ ${muse-wsx-api} ${muse-wsx-impl} ${wsdl4 > jsp.libs = ${jsp-api} ${jsp-impl} ${core-lib} > > osgi-core=lib/org.osgi.core-1.0.0.jar > -felix-framework=lib/org.apache.felix.framework-1.0.0.jar > +felix-framework=lib/org.apache.felix.framework-2.0.5.jar > > geronimo-servlet=lib/geronimo-servlet_2.5_spec-1.2.jar > felix.libs=${osgi-core} ${felix-framework} > > Added: qpid/trunk/qpid/java/lib/org.apache.felix.framework-2.0.5.jar > URL: > http://svn.apache.org/viewvc/qpid/trunk/qpid/java/lib/org.apache.felix.framework-2.0.5.jar?rev=942114&view=auto > > ============================================================================== > Files qpid/trunk/qpid/java/lib/org.apache.felix.framework-2.0.5.jar (added) > and qpid/trunk/qpid/java/lib/org.apache.felix.framework-2.0.5.jar Fri May 7 > 15:13:44 2010 differ > > > > --------------------------------------------------------------------- > Apache Qpid - AMQP Messaging Implementation > Project: http://qpid.apache.org > Use/Interact: mailto:commits-subscr...@qpid.apache.org > >