Search in sources :

Example 1 with Command

use of org.apache.felix.shell.Command in project felix by apache.

the class Activator method start.

public void start(BundleContext context) {
    m_context = context;
    // Register impl service implementation.
    String[] classes = { org.apache.felix.shell.ShellService.class.getName(), org.ungoverned.osgi.service.shell.ShellService.class.getName() };
    context.registerService(classes, m_shell = new ShellServiceImpl(), null);
    // Create a service tracker to listen for command services.
    String filter = "(|(objectClass=" + org.apache.felix.shell.Command.class.getName() + ")(objectClass=" + org.ungoverned.osgi.service.shell.Command.class.getName() + "))";
    try {
        m_tracker = new ServiceTracker(context, FrameworkUtil.createFilter(filter), m_tracker);
    } catch (InvalidSyntaxException ex) {
    // This should never happen.
    }
    m_tracker.open();
    // Register "bundlelevel" command service.
    context.registerService(org.apache.felix.shell.Command.class.getName(), new BundleLevelCommandImpl(m_context), null);
    // Register "cd" command service.
    classes = new String[2];
    classes[0] = org.apache.felix.shell.Command.class.getName();
    classes[1] = org.apache.felix.shell.CdCommand.class.getName();
    context.registerService(classes, new CdCommandImpl(m_context), null);
    // Register "find" command service.
    context.registerService(org.apache.felix.shell.Command.class.getName(), new FindCommandImpl(m_context), null);
    // Register "headers" command service.
    context.registerService(org.apache.felix.shell.Command.class.getName(), new HeadersCommandImpl(m_context), null);
    // Register "help" command service.
    context.registerService(org.apache.felix.shell.Command.class.getName(), new HelpCommandImpl(m_context), null);
    // Register "inspect" command service.
    context.registerService(org.apache.felix.shell.Command.class.getName(), new InspectCommandImpl(m_context), null);
    // Register "install" command service.
    context.registerService(org.apache.felix.shell.Command.class.getName(), new InstallCommandImpl(m_context), null);
    // Register "log" command service.
    context.registerService(org.apache.felix.shell.Command.class.getName(), new LogCommandImpl(m_context), null);
    // Register "ps" command service.
    context.registerService(org.apache.felix.shell.Command.class.getName(), new PsCommandImpl(m_context), null);
    // Register "refresh" command service.
    context.registerService(org.apache.felix.shell.Command.class.getName(), new RefreshCommandImpl(m_context), null);
    // Register "resolve" command service.
    context.registerService(org.apache.felix.shell.Command.class.getName(), new ResolveCommandImpl(m_context), null);
    // Register "startlevel" command service.
    context.registerService(org.apache.felix.shell.Command.class.getName(), new StartLevelCommandImpl(m_context), null);
    // Register "shutdown" command service.
    context.registerService(org.apache.felix.shell.Command.class.getName(), new ShutdownCommandImpl(m_context), null);
    // Register "start" command service.
    context.registerService(org.apache.felix.shell.Command.class.getName(), new StartCommandImpl(m_context), null);
    // Register "stop" command service.
    context.registerService(org.apache.felix.shell.Command.class.getName(), new StopCommandImpl(m_context), null);
    // Register "sysprop" command service.
    context.registerService(org.apache.felix.shell.Command.class.getName(), new SystemPropertiesCommandImpl(), null);
    // Register "uninstall" command service.
    context.registerService(org.apache.felix.shell.Command.class.getName(), new UninstallCommandImpl(m_context), null);
    // Register "update" command service.
    context.registerService(org.apache.felix.shell.Command.class.getName(), new UpdateCommandImpl(m_context), null);
    // Register "version" command service.
    context.registerService(org.apache.felix.shell.Command.class.getName(), new VersionCommandImpl(m_context), null);
}
Also used : ServiceTracker(org.osgi.util.tracker.ServiceTracker) Command(org.apache.felix.shell.Command)

Example 2 with Command

use of org.apache.felix.shell.Command in project felix-dev by apache.

the class Activator method start.

public void start(BundleContext context) {
    m_context = context;
    // Register impl service implementation.
    String[] classes = { org.apache.felix.shell.ShellService.class.getName(), org.ungoverned.osgi.service.shell.ShellService.class.getName() };
    context.registerService(classes, m_shell = new ShellServiceImpl(), null);
    // Create a service tracker to listen for command services.
    String filter = "(|(objectClass=" + org.apache.felix.shell.Command.class.getName() + ")(objectClass=" + org.ungoverned.osgi.service.shell.Command.class.getName() + "))";
    try {
        m_tracker = new ServiceTracker(context, FrameworkUtil.createFilter(filter), m_tracker);
    } catch (InvalidSyntaxException ex) {
    // This should never happen.
    }
    m_tracker.open();
    // Register "bundlelevel" command service.
    context.registerService(org.apache.felix.shell.Command.class.getName(), new BundleLevelCommandImpl(m_context), null);
    // Register "cd" command service.
    classes = new String[2];
    classes[0] = org.apache.felix.shell.Command.class.getName();
    classes[1] = org.apache.felix.shell.CdCommand.class.getName();
    context.registerService(classes, new CdCommandImpl(m_context), null);
    // Register "find" command service.
    context.registerService(org.apache.felix.shell.Command.class.getName(), new FindCommandImpl(m_context), null);
    // Register "headers" command service.
    context.registerService(org.apache.felix.shell.Command.class.getName(), new HeadersCommandImpl(m_context), null);
    // Register "help" command service.
    context.registerService(org.apache.felix.shell.Command.class.getName(), new HelpCommandImpl(m_context), null);
    // Register "inspect" command service.
    context.registerService(org.apache.felix.shell.Command.class.getName(), new InspectCommandImpl(m_context), null);
    // Register "install" command service.
    context.registerService(org.apache.felix.shell.Command.class.getName(), new InstallCommandImpl(m_context), null);
    // Register "log" command service.
    context.registerService(org.apache.felix.shell.Command.class.getName(), new LogCommandImpl(m_context), null);
    // Register "ps" command service.
    context.registerService(org.apache.felix.shell.Command.class.getName(), new PsCommandImpl(m_context), null);
    // Register "refresh" command service.
    context.registerService(org.apache.felix.shell.Command.class.getName(), new RefreshCommandImpl(m_context), null);
    // Register "resolve" command service.
    context.registerService(org.apache.felix.shell.Command.class.getName(), new ResolveCommandImpl(m_context), null);
    // Register "startlevel" command service.
    context.registerService(org.apache.felix.shell.Command.class.getName(), new StartLevelCommandImpl(m_context), null);
    // Register "shutdown" command service.
    context.registerService(org.apache.felix.shell.Command.class.getName(), new ShutdownCommandImpl(m_context), null);
    // Register "start" command service.
    context.registerService(org.apache.felix.shell.Command.class.getName(), new StartCommandImpl(m_context), null);
    // Register "stop" command service.
    context.registerService(org.apache.felix.shell.Command.class.getName(), new StopCommandImpl(m_context), null);
    // Register "sysprop" command service.
    context.registerService(org.apache.felix.shell.Command.class.getName(), new SystemPropertiesCommandImpl(), null);
    // Register "uninstall" command service.
    context.registerService(org.apache.felix.shell.Command.class.getName(), new UninstallCommandImpl(m_context), null);
    // Register "update" command service.
    context.registerService(org.apache.felix.shell.Command.class.getName(), new UpdateCommandImpl(m_context), null);
    // Register "version" command service.
    context.registerService(org.apache.felix.shell.Command.class.getName(), new VersionCommandImpl(m_context), null);
}
Also used : ServiceTracker(org.osgi.util.tracker.ServiceTracker) Command(org.apache.felix.shell.Command)

Aggregations

Command (org.apache.felix.shell.Command)2 ServiceTracker (org.osgi.util.tracker.ServiceTracker)2