Search in sources :

Example 1 with RegexCommandLoggingFilter

use of org.apache.karaf.shell.support.RegexCommandLoggingFilter 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 RegexCommandLoggingFilter

use of org.apache.karaf.shell.support.RegexCommandLoggingFilter in project karaf by apache.

the class Activator method doStart.

@Override
protected void doStart() throws Exception {
    JmsServiceImpl service = new JmsServiceImpl();
    service.setBundleContext(bundleContext);
    register(JmsService.class, service);
    JmsMBeanImpl mbean = new JmsMBeanImpl();
    mbean.setJmsService(service);
    registerMBean(mbean, "type=jms");
    RegexCommandLoggingFilter filter = new RegexCommandLoggingFilter();
    filter.addRegEx("create +.*?--password ([^ ]+)", 2);
    filter.addRegEx("create +.*?-p ([^ ]+)", 2);
    register(CommandLoggingFilter.class, filter);
}
Also used : JmsServiceImpl(org.apache.karaf.jms.internal.JmsServiceImpl) RegexCommandLoggingFilter(org.apache.karaf.shell.support.RegexCommandLoggingFilter) JmsMBeanImpl(org.apache.karaf.jms.internal.JmsMBeanImpl)

Example 3 with RegexCommandLoggingFilter

use of org.apache.karaf.shell.support.RegexCommandLoggingFilter in project karaf by apache.

the class Activator method doStart.

@Override
protected void doStart() throws Exception {
    SessionFactory sf = getTrackedService(SessionFactory.class);
    if (sf == null) {
        return;
    }
    RegexCommandLoggingFilter filter = new RegexCommandLoggingFilter();
    filter.setPattern("ssh (.*?)-P +([^ ]+)");
    filter.setGroup(2);
    register(CommandLoggingFilter.class, filter);
    filter = new RegexCommandLoggingFilter();
    filter.setPattern("ssh (.*?)--password +([^ ]+)");
    filter.setGroup(2);
    register(CommandLoggingFilter.class, filter);
    sessionFactory = sf;
    sessionFactory.getRegistry().getService(Manager.class).register(SshAction.class);
    if (Boolean.parseBoolean(bundleContext.getProperty("karaf.startRemoteShell"))) {
        server = createSshServer(sessionFactory);
        this.bundleContext.registerService(SshServer.class, server, null);
        if (server == null) {
            // can result from bad specification.
            return;
        }
        try {
            server.start();
        } catch (IOException e) {
            LOGGER.warn("Exception caught while starting SSH server", e);
        }
    }
}
Also used : SessionFactory(org.apache.karaf.shell.api.console.SessionFactory) RegexCommandLoggingFilter(org.apache.karaf.shell.support.RegexCommandLoggingFilter) IOException(java.io.IOException) Manager(org.apache.karaf.shell.api.action.lifecycle.Manager)

Aggregations

RegexCommandLoggingFilter (org.apache.karaf.shell.support.RegexCommandLoggingFilter)3 IOException (java.io.IOException)1 InstanceService (org.apache.karaf.instance.core.InstanceService)1 InstanceServiceImpl (org.apache.karaf.instance.core.internal.InstanceServiceImpl)1 InstancesMBeanImpl (org.apache.karaf.instance.core.internal.InstancesMBeanImpl)1 JmsMBeanImpl (org.apache.karaf.jms.internal.JmsMBeanImpl)1 JmsServiceImpl (org.apache.karaf.jms.internal.JmsServiceImpl)1 Manager (org.apache.karaf.shell.api.action.lifecycle.Manager)1 SessionFactory (org.apache.karaf.shell.api.console.SessionFactory)1