Search in sources :

Example 1 with InstanceServiceImpl

use of org.apache.karaf.instance.core.internal.InstanceServiceImpl in project karaf by apache.

the class Activator method doStart.

@Override
protected void doStart() throws Exception {
    InstanceService instanceService = new InstanceServiceImpl();
    register(InstanceService.class, instanceService);
    RegexCommandLoggingFilter filter = new RegexCommandLoggingFilter();
    filter.addCommandOption("--password", "connect");
    filter.addCommandOption("-p", "connect");
    register(CommandLoggingFilter.class, filter);
    InstancesMBeanImpl mbean = new InstancesMBeanImpl(instanceService);
    registerMBean(mbean, "type=instance");
}
Also used : InstanceServiceImpl(org.apache.karaf.instance.core.internal.InstanceServiceImpl) InstancesMBeanImpl(org.apache.karaf.instance.core.internal.InstancesMBeanImpl) RegexCommandLoggingFilter(org.apache.karaf.shell.support.RegexCommandLoggingFilter) InstanceService(org.apache.karaf.instance.core.InstanceService)

Example 2 with InstanceServiceImpl

use of org.apache.karaf.instance.core.internal.InstanceServiceImpl in project karaf by apache.

the class Execute method execute.

static void execute(InstanceCommandSupport command, File storageFile, String[] args) throws Exception {
    DefaultActionPreparator dap = new DefaultActionPreparator();
    List<Object> params = new ArrayList<>(Arrays.asList(args));
    // this is the actual command name
    params.remove(0);
    if (!dap.prepare(command, null, params)) {
        return;
    }
    InstanceServiceImpl instanceService = new InstanceServiceImpl();
    instanceService.setStorageLocation(storageFile);
    command.setInstanceService(instanceService);
    command.execute();
}
Also used : InstanceServiceImpl(org.apache.karaf.instance.core.internal.InstanceServiceImpl) DefaultActionPreparator(org.apache.karaf.shell.impl.action.command.DefaultActionPreparator) ArrayList(java.util.ArrayList)

Aggregations

InstanceServiceImpl (org.apache.karaf.instance.core.internal.InstanceServiceImpl)2 ArrayList (java.util.ArrayList)1 InstanceService (org.apache.karaf.instance.core.InstanceService)1 InstancesMBeanImpl (org.apache.karaf.instance.core.internal.InstancesMBeanImpl)1 DefaultActionPreparator (org.apache.karaf.shell.impl.action.command.DefaultActionPreparator)1 RegexCommandLoggingFilter (org.apache.karaf.shell.support.RegexCommandLoggingFilter)1