public class ScrCommand extends java.lang.Object implements ScrInfo
ScrCommand
class provides the implementations for the
Apache Felix Gogo and legacy Apache Felix Shell commands. The
#register(BundleContext, ScrService, ScrConfiguration)
method
instantiates and registers the Gogo and Shell commands as possible.Modifier and Type | Class and Description |
---|---|
private static class |
ScrCommand.Result |
Modifier and Type | Field and Description |
---|---|
private org.osgi.framework.BundleContext |
bundleContext |
private static java.util.Comparator<org.osgi.service.component.runtime.dto.ComponentConfigurationDTO> |
CONFIGURATION_COMP |
private static java.util.Comparator<org.osgi.service.component.runtime.dto.ComponentDescriptionDTO> |
DESCRIPTION_COMP |
private org.osgi.framework.ServiceRegistration<?> |
gogoReg |
private org.osgi.framework.ServiceRegistration<ScrInfo> |
reg |
private ScrConfigurationImpl |
scrConfiguration |
private org.osgi.service.component.runtime.ServiceComponentRuntime |
scrService |
private org.osgi.framework.ServiceRegistration<?> |
shellReg |
Modifier | Constructor and Description |
---|---|
protected |
ScrCommand(org.osgi.framework.BundleContext bundleContext,
org.osgi.service.component.runtime.ServiceComponentRuntime scrService,
ScrConfigurationImpl scrConfiguration) |
Modifier and Type | Method and Description |
---|---|
(package private) void |
change(java.lang.String componentIdentifier,
java.io.PrintWriter out,
boolean enable) |
void |
config(java.io.PrintWriter out)
List in text the current SCR configuration
|
private ScrCommand.Result |
getComponentsFromArg(java.lang.String componentIdentifier,
boolean nameMatch) |
private void |
info(org.osgi.service.component.runtime.dto.ComponentConfigurationDTO cc,
java.io.PrintWriter out) |
void |
info(java.lang.String componentId,
java.io.PrintWriter out)
List in text detailed information about the specified components.
|
private static boolean |
isBundleActive(org.osgi.framework.Bundle bundle)
Returns
true if the bundle is to be considered
active from the perspective of declarative services. |
void |
list(java.lang.String bundleIdentifier,
java.io.PrintWriter out)
List in text the components for the bundle specified, or all components if null, sorted by component ID
|
(package private) void |
propertyInfo(java.util.Map<java.lang.String,java.lang.Object> props,
java.io.PrintWriter out,
java.lang.String prefix,
java.lang.String label) |
(package private) static ScrCommand |
register(org.osgi.framework.BundleContext bundleContext,
org.osgi.service.component.runtime.ServiceComponentRuntime scrService,
ScrConfigurationImpl scrConfiguration) |
private void |
registerCommands(org.osgi.framework.BundleContext bundleContext,
org.osgi.service.component.runtime.ServiceComponentRuntime scrService) |
private java.lang.String |
toStateString(int state) |
(package private) void |
unregister() |
void |
update(boolean infoAsService) |
private static final java.util.Comparator<org.osgi.service.component.runtime.dto.ComponentDescriptionDTO> DESCRIPTION_COMP
private static final java.util.Comparator<org.osgi.service.component.runtime.dto.ComponentConfigurationDTO> CONFIGURATION_COMP
private final org.osgi.framework.BundleContext bundleContext
private final org.osgi.service.component.runtime.ServiceComponentRuntime scrService
private final ScrConfigurationImpl scrConfiguration
private org.osgi.framework.ServiceRegistration<ScrInfo> reg
private org.osgi.framework.ServiceRegistration<?> gogoReg
private org.osgi.framework.ServiceRegistration<?> shellReg
protected ScrCommand(org.osgi.framework.BundleContext bundleContext, org.osgi.service.component.runtime.ServiceComponentRuntime scrService, ScrConfigurationImpl scrConfiguration)
static ScrCommand register(org.osgi.framework.BundleContext bundleContext, org.osgi.service.component.runtime.ServiceComponentRuntime scrService, ScrConfigurationImpl scrConfiguration)
private void registerCommands(org.osgi.framework.BundleContext bundleContext, org.osgi.service.component.runtime.ServiceComponentRuntime scrService)
void unregister()
public void update(boolean infoAsService)
private static boolean isBundleActive(org.osgi.framework.Bundle bundle)
true
if the bundle
is to be considered
active from the perspective of declarative services.
As of R4.1 a bundle may have lazy activation policy which means a bundle remains in the STARTING state until a class is loaded from that bundle (unless that class is declared to not cause the bundle to start). And thus for DS 1.1 this means components are to be loaded for lazily started bundles being in the STARTING state (after the LAZY_ACTIVATION event) has been sent. Hence DS must consider a bundle active when it is really active and when it is a lazily activated bundle in the STARTING state.
bundle
- The bundle checktrue
if bundle
is not null
and the bundle is either active or has lazy activation policy
and is in the starting state.public void list(java.lang.String bundleIdentifier, java.io.PrintWriter out)
ScrInfo
public void info(java.lang.String componentId, java.io.PrintWriter out)
ScrInfo
void propertyInfo(java.util.Map<java.lang.String,java.lang.Object> props, java.io.PrintWriter out, java.lang.String prefix, java.lang.String label)
private void info(org.osgi.service.component.runtime.dto.ComponentConfigurationDTO cc, java.io.PrintWriter out)
void change(java.lang.String componentIdentifier, java.io.PrintWriter out, boolean enable)
public void config(java.io.PrintWriter out)
ScrInfo
private java.lang.String toStateString(int state)
private ScrCommand.Result getComponentsFromArg(java.lang.String componentIdentifier, boolean nameMatch)