FELIX-3888 Expose the internals of ScrCommand as an (optional) service. Also some cleanup and add aries version-checker
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1442007 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/scr/pom.xml b/scr/pom.xml
index 409e52c..b95a5a9 100644
--- a/scr/pom.xml
+++ b/scr/pom.xml
@@ -223,6 +223,7 @@
${project.artifactId}
</Bundle-SymbolicName>
<Bundle-Vendor>The Apache Software Foundation</Bundle-Vendor>
+ <Bundle-Version>1.7</Bundle-Version>
<Bundle-DocURL>
http://felix.apache.org/site/apache-felix-service-component-runtime.html
</Bundle-DocURL>
@@ -230,7 +231,7 @@
org.apache.felix.scr.impl.Activator
</Bundle-Activator>
<Export-Package>
- org.apache.felix.scr;version=1.7,
+ org.apache.felix.scr;version=1.8,
org.apache.felix.scr.component;version=1.0;
mandatory:="status"; status="provisional",
org.osgi.service.component
@@ -393,6 +394,23 @@
<excludePackageNames>*.impl</excludePackageNames>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.apache.aries.versioning</groupId>
+ <artifactId>org.apache.aries.versioning.plugin</artifactId>
+ <version>0.1.0</version>
+ <executions>
+ <execution>
+ <id>default-verify</id>
+ <phase>verify</phase>
+ <goals>
+ <goal>version-check</goal>
+ </goals>
+ <configuration>
+ <oldArtifact>org.apache.felix:org.apache.felix.scr:1.6.2</oldArtifact>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
diff --git a/scr/src/main/java/org/apache/felix/scr/Reference.java b/scr/src/main/java/org/apache/felix/scr/Reference.java
index e5518bf..1c485ae 100644
--- a/scr/src/main/java/org/apache/felix/scr/Reference.java
+++ b/scr/src/main/java/org/apache/felix/scr/Reference.java
@@ -50,7 +50,13 @@
*/
ServiceReference[] getServiceReferences();
-
+ /**
+ * added by mistake. Use getServiceReferences();
+ * @return
+ */
+ @Deprecated
+ ServiceReference[] getBoundServiceReferences();
+
/**
* Returns whether this reference is satisified. A {@link #isOptional() optional}
* component is always satsified. Otherwise <code>true</code> is only
diff --git a/scr/src/main/java/org/apache/felix/scr/ScrInfo.java b/scr/src/main/java/org/apache/felix/scr/ScrInfo.java
new file mode 100644
index 0000000..a26fea8
--- /dev/null
+++ b/scr/src/main/java/org/apache/felix/scr/ScrInfo.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.scr;
+
+import java.io.PrintStream;
+
+/**
+ * Abstraction of command interface.
+ *
+ * @Since 1.6.4
+ */
+public interface ScrInfo
+{
+
+ /**
+ * List in text the components for the bundle specified, or all components if null, sorted by component ID
+ * @param bundleIdentifier bundle the components are in or null for all components
+ * @param out PrintStream for normal output
+ * @param err PrintStream for errors.
+ */
+ void list(String bundleIdentifier, PrintStream out, PrintStream err);
+
+ /**
+ * List in text detailed information about the specified components. Components can be specified by
+ * numeric componentId, component name, a regexp to match for component name, or null for all components.
+ * @param componentId specifier for desired components
+ * @param out PrintStream for normal output
+ * @param err PrintStream for errors.
+ */
+ void info(String componentId, PrintStream out, PrintStream err);
+
+ /**
+ * List in text the current SCR configuration
+ * @param out PrintStream for output.
+ */
+ void config(PrintStream out);
+
+}
\ No newline at end of file
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/Activator.java b/scr/src/main/java/org/apache/felix/scr/impl/Activator.java
index fa8c87e..c477b31 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/Activator.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/Activator.java
@@ -108,7 +108,8 @@
loadAllComponents( context );
// register the Gogo and old Shell commands
- ScrCommand.register(context, m_componentRegistry, m_configuration);
+ ScrCommand scrCommand = ScrCommand.register(context, m_componentRegistry, m_configuration);
+ m_configuration.setScrCommand( scrCommand );
}
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/ComponentRegistry.java b/scr/src/main/java/org/apache/felix/scr/impl/ComponentRegistry.java
index 9887559..5e1f65b 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/ComponentRegistry.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/ComponentRegistry.java
@@ -69,11 +69,11 @@
/**
* The map of known components indexed by component name. The values are
- * either the component names (for name reservations) or implementations
+ * either null (for name reservations) or implementations
* of the {@link ComponentHolder} interface.
* <p>
* The {@link #checkComponentName(String)} will first add an entry to this
- * map being the name of the component to reserve the name. After setting up
+ * map with null value to reserve the name. After setting up
* the component, the {@link #registerComponentHolder(String, ComponentHolder)}
* method replaces the value of the named entry with the actual
* {@link ComponentHolder}.
@@ -111,7 +111,7 @@
* @see #registerComponentId(AbstractComponentManager)
* @see #unregisterComponentId(long)
*/
- private final Map<Long, AbstractComponentManager> m_componentsById;
+ private final Map<Long, AbstractComponentManager<?>> m_componentsById;
/**
* Counter to setup the component IDs as issued by the
@@ -135,9 +135,9 @@
protected ComponentRegistry( BundleContext context )
{
m_bundleContext = context;
- m_componentHoldersByName = new HashMap /* <ComponentRegistryKey, Object> */ ();
- m_componentHoldersByPid = new HashMap();
- m_componentsById = new HashMap();
+ m_componentHoldersByName = new HashMap<ComponentRegistryKey, ComponentHolder>();
+ m_componentHoldersByPid = new HashMap<String, Set<ComponentHolder>>();
+ m_componentsById = new HashMap<Long, AbstractComponentManager<?>>();
m_componentCounter = -1;
// keep me informed on ConfigurationAdmin state changes
@@ -188,16 +188,16 @@
public Component[] getComponents()
{
- Object[] holders = getComponentHolders();
- ArrayList list = new ArrayList();
- for ( int i = 0; i < holders.length; i++ )
+ ComponentHolder[] holders = getComponentHolders();
+ ArrayList<Component> list = new ArrayList<Component>();
+ for ( ComponentHolder holder: holders )
{
- if ( holders[i] instanceof ComponentHolder )
+ if ( holders != null )
{
- Component[] components = ( ( ComponentHolder ) holders[i] ).getComponents();
- for ( int j = 0; j < components.length; j++ )
+ Component[] components = holder.getComponents();
+ for ( Component component: components )
{
- list.add( components[j] );
+ list.add( component );
}
}
}
@@ -214,20 +214,19 @@
public Component[] getComponents( Bundle bundle )
{
- Object[] holders = getComponentHolders();
- ArrayList list = new ArrayList();
- for ( int i = 0; i < holders.length; i++ )
+ ComponentHolder[] holders = getComponentHolders();
+ ArrayList<Component> list = new ArrayList<Component>();
+ for ( ComponentHolder holder: holders )
{
- if ( holders[i] instanceof ComponentHolder )
+ if ( holder != null )
{
- ComponentHolder holder = ( ComponentHolder ) holders[i];
BundleComponentActivator activator = holder.getActivator();
if ( activator != null && activator.getBundleContext().getBundle() == bundle )
{
Component[] components = holder.getComponents();
- for ( int j = 0; j < components.length; j++ )
+ for ( Component component: components )
{
- list.add( components[j] );
+ list.add( component );
}
}
}
@@ -239,7 +238,7 @@
return null;
}
- return ( Component[] ) list.toArray( new Component[list.size()] );
+ return list.toArray( new Component[list.size()] );
}
@@ -247,27 +246,26 @@
{
synchronized ( m_componentsById )
{
- return ( Component ) m_componentsById.get( new Long( componentId ) );
+ return m_componentsById.get( new Long( componentId ) );
}
}
public Component[] getComponents( String componentName )
{
- List /* <ComponentHolder */list = new ArrayList/* <ComponentHolder> */();
+ List<Component> list = new ArrayList<Component>();
synchronized ( m_componentHoldersByName )
{
- for ( Iterator ci = m_componentHoldersByName.values().iterator(); ci.hasNext(); )
+ for ( ComponentHolder c: m_componentHoldersByName.values() )
{
- ComponentHolder c = ( ComponentHolder ) ci.next();
- if ( componentName.equals( c.getComponentMetadata().getName() ) )
+ if ( c.getComponentMetadata().getName().equals( componentName ) )
{
- list.addAll( Arrays.asList( c.getComponents() ) );
+ list.addAll( Arrays.<Component>asList( c.getComponents() ) );
}
}
}
- return ( list.isEmpty() ) ? null : ( Component[] ) list.toArray( new Component[list.size()] );
+ return ( list.isEmpty() ) ? null : list.toArray( new Component[list.size()] );
}
@@ -282,7 +280,7 @@
*
* @return the assigned component ID
*/
- final long registerComponentId( final AbstractComponentManager componentManager )
+ final long registerComponentId( final AbstractComponentManager<?> componentManager )
{
long componentId;
synchronized ( m_componentsById )
@@ -309,7 +307,7 @@
{
synchronized ( m_componentsById )
{
- m_componentsById.remove( new Long( componentId ) );
+ m_componentsById.remove( componentId );
}
}
@@ -534,7 +532,7 @@
if (metadata.isFactory())
{
// 112.2.4 SCR must register a Component Factory
- // service on behalf ot the component
+ // service on behalf of the component
// as soon as the component factory is satisfied
if ( !activator.getConfiguration().isFactoryEnabled() )
{
@@ -683,7 +681,7 @@
}
}
- public synchronized void registerMissingDependency( DependencyManager dependencyManager, ServiceReference serviceReference, int trackingCount )
+ public synchronized void registerMissingDependency( DependencyManager<?,?> dependencyManager, ServiceReference serviceReference, int trackingCount )
{
//check that the service reference is from scr
if ( serviceReference.getProperty( ComponentConstants.COMPONENT_NAME ) == null || serviceReference.getProperty( ComponentConstants.COMPONENT_ID ) == null )
@@ -701,16 +699,16 @@
private static class Entry
{
- private final DependencyManager dm;
+ private final DependencyManager<?,?> dm;
private final int trackingCount;
- private Entry( DependencyManager dm, int trackingCount )
+ private Entry( DependencyManager<?,?> dm, int trackingCount )
{
this.dm = dm;
this.trackingCount = trackingCount;
}
- public DependencyManager getDm()
+ public DependencyManager<?,?> getDm()
{
return dm;
}
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/ScrCommand.java b/scr/src/main/java/org/apache/felix/scr/impl/ScrCommand.java
index 929de79..7dde985 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/ScrCommand.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/ScrCommand.java
@@ -20,21 +20,26 @@
import java.io.PrintStream;
import java.lang.reflect.Constructor;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
+import java.util.Comparator;
import java.util.Dictionary;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.TreeSet;
+import java.util.regex.Pattern;
import org.apache.felix.scr.Component;
import org.apache.felix.scr.Reference;
+import org.apache.felix.scr.ScrInfo;
import org.apache.felix.scr.ScrService;
import org.apache.felix.scr.impl.config.ScrConfiguration;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
import org.osgi.framework.ServiceReference;
+import org.osgi.framework.ServiceRegistration;
/**
* The <code>ScrCommand</code> class provides the implementations for the
@@ -42,14 +47,16 @@
* {@link #register(BundleContext, ScrService, ScrConfiguration)} method
* instantiates and registers the Gogo and Shell commands as possible.
*/
-class ScrCommand
+public class ScrCommand implements ScrInfo
{
private final BundleContext bundleContext;
private final ScrService scrService;
private final ScrConfiguration scrConfiguration;
+
+ private ServiceRegistration reg;
- static void register(BundleContext bundleContext, ScrService scrService, ScrConfiguration scrConfiguration)
+ static ScrCommand register(BundleContext bundleContext, ScrService scrService, ScrConfiguration scrConfiguration)
{
final ScrCommand cmd = new ScrCommand(bundleContext, scrService, scrConfiguration);
@@ -99,6 +106,7 @@
{
// Ignore.
}
+ return cmd;
}
private ScrCommand(BundleContext bundleContext, ScrService scrService, ScrConfiguration scrConfiguration)
@@ -110,7 +118,33 @@
// ---------- Actual implementation
- void list(final String bundleIdentifier, final PrintStream out, final PrintStream err)
+
+ public void update( boolean infoAsService )
+ {
+ if (infoAsService)
+ {
+ if ( reg == null )
+ {
+ final Hashtable props = new Hashtable();
+ props.put(Constants.SERVICE_DESCRIPTION, "SCR Info service");
+ props.put(Constants.SERVICE_VENDOR, "The Apache Software Foundation");
+ reg = bundleContext.registerService( ScrInfo.class, this, props );
+ }
+ }
+ else
+ {
+ if ( reg != null )
+ {
+ reg.unregister();
+ reg = null;
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.felix.scr.impl.ScrInfo#list(java.lang.String, java.io.PrintStream, java.io.PrintStream)
+ */
+ public void list(final String bundleIdentifier, final PrintStream out, final PrintStream err)
{
Component[] components;
@@ -166,20 +200,27 @@
}
}
- out.println(" Id State Name");
+ Arrays.sort( components, new Comparator<Component>()
+ {
+
+ public int compare(Component c1, Component c2)
+ {
+ return Long.signum(c1.getId() - c2.getId());
+ }
+
+ });
+
+ out.println(" Id State BundleId Name");
for ( Component component : components )
{
- out.print( '[' );
- out.print( pad( String.valueOf( component.getId() ), -4 ) );
- out.print( "] [" );
- out.print( pad( toStateString( component.getState() ), 13 ) );
- out.print( "] " );
- out.print( component.getName() );
- out.println();
+ out.println( String.format( "[%1$4d] [%2$s] [%3$4d] %4$s", component.getId(), toStateString( component.getState() ), component.getBundle().getBundleId(), component.getName() ) );
}
}
- void info(final String componentId, PrintStream out, PrintStream err)
+ /* (non-Javadoc)
+ * @see org.apache.felix.scr.impl.ScrInfo#info(java.lang.String, java.io.PrintStream, java.io.PrintStream)
+ */
+ public void info(final String componentId, PrintStream out, PrintStream err)
{
Component[] components = getComponentFromArg(componentId, err);
if (components == null)
@@ -187,8 +228,40 @@
return;
}
+ Arrays.sort( components, new Comparator<Component>()
+ {
+
+ public int compare(Component c1, Component c2)
+ {
+ long bundleId1 = c1.getBundle().getBundleId();
+ long bundleId2 = c2.getBundle().getBundleId();
+ int result = Long.signum(bundleId1 - bundleId2);
+ if (result == 0) {
+ result = Long.signum(c1.getId() - c2.getId());
+ }
+ return result;
+ }
+
+ });
+
+ long bundleId = -1;
+
for ( Component component : components )
{
+ if (components.length > 1)
+ {
+ if ( component.getBundle().getBundleId() != bundleId )
+ {
+ if ( bundleId != -1 )
+ {
+ out.println();
+ out.println();
+ }
+ bundleId = component.getBundle().getBundleId();
+ out.println(String.format("*** Bundle: %1$s (%2$d)", component.getBundle().getSymbolicName(), bundleId));
+ }
+ out.println();
+ }
out.print( "ID: " );
out.println( component.getId() );
out.print( "Name: " );
@@ -292,6 +365,10 @@
out.println( serviceRefs[k] );
}
}
+ else
+ {
+ out.println( " (unbound)" );
+ }
}
}
@@ -360,7 +437,10 @@
}
}
- void config(PrintStream out)
+ /* (non-Javadoc)
+ * @see org.apache.felix.scr.impl.ScrInfo#config(java.io.PrintStream)
+ */
+ public void config(PrintStream out)
{
out.print("Log Level: ");
out.println(scrConfiguration.getLogLevel());
@@ -368,58 +448,36 @@
out.println(scrConfiguration.isFactoryEnabled() ? "Supported" : "Unsupported");
}
- private String pad(String value, int size)
- {
- boolean right = size < 0;
- size = right ? -size : size;
-
- if (value.length() >= size)
- {
- return value;
- }
-
- char[] buf = new char[size];
- int padLen = size - value.length();
- int valOff = right ? padLen : 0;
- int padOff = right ? 0 : value.length();
-
- value.getChars(0, value.length(), buf, valOff);
- Arrays.fill(buf, padOff, padOff + padLen, ' ');
-
- return new String(buf);
- }
-
private String toStateString(int state)
{
- switch (state)
- {
- case Component.STATE_DISABLED:
- return "disabled";
- case Component.STATE_UNSATISFIED:
- return "unsatisfied";
- case Component.STATE_ACTIVE:
- return "active";
- case Component.STATE_REGISTERED:
- return "registered";
- case Component.STATE_FACTORY:
- return "factory";
- case Component.STATE_DISPOSED:
- return "disposed";
+ switch (state) {
- case Component.STATE_ENABLING:
- return "enabling";
- case Component.STATE_ENABLED:
- return "enabled";
- case Component.STATE_ACTIVATING:
- return "activating";
- case Component.STATE_DEACTIVATING:
- return "deactivating";
- case Component.STATE_DISABLING:
- return "disabling";
- case Component.STATE_DISPOSING:
- return "disposing";
- default:
- return String.valueOf(state);
+ case (Component.STATE_DISABLED):
+ return "disabled ";
+ case (Component.STATE_ENABLING):
+ return "enabling ";
+ case (Component.STATE_ENABLED):
+ return "enabled ";
+ case (Component.STATE_UNSATISFIED):
+ return "unsatisfied ";
+ case (Component.STATE_ACTIVATING):
+ return "activating ";
+ case (Component.STATE_ACTIVE):
+ return "active ";
+ case (Component.STATE_REGISTERED):
+ return "registered ";
+ case (Component.STATE_FACTORY):
+ return "factory ";
+ case (Component.STATE_DEACTIVATING):
+ return "deactivating";
+ case (Component.STATE_DISABLING):
+ return "disabling ";
+ case (Component.STATE_DISPOSING):
+ return "disposing ";
+ case (Component.STATE_DISPOSED):
+ return "disposed ";
+ default:
+ return "unkown: " + state;
}
}
@@ -438,12 +496,13 @@
}
else
{
- components = new Component[]
+ return new Component[]
{ component };
}
}
catch (NumberFormatException nfe)
{
+
// check whether it is a component name
components = scrService.getComponents(componentIdentifier);
if (components == null)
@@ -452,10 +511,22 @@
}
}
}
- else
+ if ( components == null)
{
-
- err.println("Component ID required");
+ components = scrService.getComponents();
+ if (componentIdentifier != null)
+ {
+ ArrayList<Component> cs = new ArrayList<Component>(components.length);
+ Pattern p = Pattern.compile(componentIdentifier);
+ for (Component component: components)
+ {
+ if ( p.matcher( component.getName()).matches() )
+ {
+ cs.add( component );
+ }
+ }
+ components = cs.toArray( new Component[cs.size()] );
+ }
}
return components;
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/config/ScrConfiguration.java b/scr/src/main/java/org/apache/felix/scr/impl/config/ScrConfiguration.java
index 8a67c01..e8526ab 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/config/ScrConfiguration.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/config/ScrConfiguration.java
@@ -22,6 +22,7 @@
import java.util.Dictionary;
import java.util.Hashtable;
+import org.apache.felix.scr.impl.ScrCommand;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
import org.osgi.framework.ServiceRegistration;
@@ -61,6 +62,8 @@
public static final String PROP_DELAYED_KEEP_INSTANCES = "ds.delayed.keepInstances";
+ public static final String PROP_INFO_SERVICE = "ds.info.service";
+
public static final String PROP_LOGLEVEL = "ds.loglevel";
private static final String LOG_LEVEL_DEBUG = "debug";
@@ -80,10 +83,14 @@
private boolean factoryEnabled;
private boolean keepInstances;
+
+ private boolean infoAsService;
private BundleContext bundleContext;
private ServiceRegistration managedService;
+
+ private ScrCommand scrCommand;
public ScrConfiguration( )
{
@@ -114,6 +121,12 @@
this.bundleContext = null;
}
+
+ public void setScrCommand(ScrCommand scrCommand)
+ {
+ this.scrCommand = scrCommand;
+ scrCommand.update(infoAsService());
+ }
// Called from the ScrManagedService.updated method to reconfigure
void configure( Dictionary config )
@@ -125,12 +138,14 @@
logLevel = LogService.LOG_ERROR;
factoryEnabled = false;
keepInstances = false;
+ infoAsService = false;
}
else
{
logLevel = getDefaultLogLevel();
factoryEnabled = getDefaultFactoryEnabled();
keepInstances = getDefaultKeepInstances();
+ infoAsService = getDefaultInfoAsService();
}
}
else
@@ -138,6 +153,11 @@
logLevel = getLogLevel( config.get( PROP_LOGLEVEL ) );
factoryEnabled = VALUE_TRUE.equalsIgnoreCase( String.valueOf( config.get( PROP_FACTORY_ENABLED ) ) );
keepInstances = VALUE_TRUE.equalsIgnoreCase( String.valueOf( config.get( PROP_DELAYED_KEEP_INSTANCES ) ) );
+ infoAsService = VALUE_TRUE.equalsIgnoreCase( String.valueOf( config.get( PROP_INFO_SERVICE) ) );
+ }
+ if ( scrCommand != null )
+ {
+ scrCommand.update( infoAsService() );
}
}
@@ -161,6 +181,11 @@
{
return keepInstances;
}
+
+ public boolean infoAsService()
+ {
+ return infoAsService;
+ }
private boolean getDefaultFactoryEnabled()
@@ -179,6 +204,11 @@
{
return getLogLevel( bundleContext.getProperty( PROP_LOGLEVEL ) );
}
+
+ private boolean getDefaultInfoAsService()
+ {
+ return VALUE_TRUE.equalsIgnoreCase( bundleContext.getProperty( PROP_INFO_SERVICE) );
+ }
private int getLogLevel( final Object levelObject )
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/config/ScrManagedServiceMetaTypeProvider.java b/scr/src/main/java/org/apache/felix/scr/impl/config/ScrManagedServiceMetaTypeProvider.java
index 84e9480..5e638cb 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/config/ScrManagedServiceMetaTypeProvider.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/config/ScrManagedServiceMetaTypeProvider.java
@@ -72,7 +72,7 @@
return null;
}
- final ArrayList adList = new ArrayList();
+ final ArrayList<AttributeDefinition> adList = new ArrayList<AttributeDefinition>();
adList.add(new AttributeDefinitionImpl(ScrConfiguration.PROP_LOGLEVEL, "SCR Log Level",
"Allows limiting the amount of logging information sent to the OSGi LogService."
@@ -93,19 +93,25 @@
.getScrConfiguration().isFactoryEnabled()));
adList.add( new AttributeDefinitionImpl(
- ScrConfiguration.PROP_DELAYED_KEEP_INSTANCES,
- "Keep Component Instances",
- "Whether or not to keep instances of delayed components once they are not referred to any more. The "
- + "Declarative Services specifications suggests that instances of delayed components are disposed off "
- + "if there is not used any longer. Setting this flag causes the components to not be disposed off "
- + "and thus prevent them from being constantly recreated if often used. Examples of such components "
- + "may be EventHandler services. The default is to dispose off unused components.", this
- .getScrConfiguration().keepInstances() ) );
+ ScrConfiguration.PROP_DELAYED_KEEP_INSTANCES,
+ "Keep Component Instances",
+ "Whether or not to keep instances of delayed components once they are not referred to any more. The "
+ + "Declarative Services specifications suggests that instances of delayed components are disposed off "
+ + "if there is not used any longer. Setting this flag causes the components to not be disposed off "
+ + "and thus prevent them from being constantly recreated if often used. Examples of such components "
+ + "may be EventHandler services. The default is to dispose off unused components.", this
+ .getScrConfiguration().keepInstances() ) );
+
+ adList.add( new AttributeDefinitionImpl(
+ ScrConfiguration.PROP_INFO_SERVICE,
+ "Bind Info Service",
+ "Whether to bind a service backing the console commands providing info on components ",
+ this.getScrConfiguration().infoAsService() ) );
return new ObjectClassDefinition()
{
- private final AttributeDefinition[] attrs = (AttributeDefinition[]) adList
+ private final AttributeDefinition[] attrs = adList
.toArray(new AttributeDefinition[adList.size()]);
public String getName()
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/manager/DependencyManager.java b/scr/src/main/java/org/apache/felix/scr/impl/manager/DependencyManager.java
index b405c50..5ad25ed 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/manager/DependencyManager.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/manager/DependencyManager.java
@@ -1133,7 +1133,15 @@
return result;
}
-
+ /**
+ * a mistake, use getServiceReferences instead
+ */
+ @Deprecated
+ public ServiceReference[] getBoundServiceReferences()
+ {
+ return getServiceReferences();
+ }
+
/**
* Returns the RefPair containing the given service reference and the bound service
* or <code>null</code> if this is instance is not currently bound to that