本文整理汇总了Java中org.apache.karaf.shell.support.completers.StringsCompleter类的典型用法代码示例。如果您正苦于以下问题:Java StringsCompleter类的具体用法?Java StringsCompleter怎么用?Java StringsCompleter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StringsCompleter类属于org.apache.karaf.shell.support.completers包,在下文中一共展示了StringsCompleter类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: complete
import org.apache.karaf.shell.support.completers.StringsCompleter; //导入依赖的package包/类
public int complete(Session session, CommandLine commandLine,
List<String> candidates) {
StringsCompleter delegate = new StringsCompleter();
com.datastax.driver.core.Session cassandraSession = (com.datastax.driver.core.Session) session
.get(SessionParameter.CASSANDRA_SESSION);
if (cassandraSession == null) {
System.err
.println("No active session found--run the connect command first");
return 0;
// return delegate.complete(session, commandLine, candidates);
}
CompleterCommons.completeKeySpace(delegate, cassandraSession);
return delegate.complete(session, commandLine, candidates);
}
示例2: complete
import org.apache.karaf.shell.support.completers.StringsCompleter; //导入依赖的package包/类
@Override
public int complete( Session session, CommandLine commandLine, List<String> candidates ) {
// Scoped instance path should be the third argument, preceded by an application name.
String applicationName = null;
int position = commandLine.getCursorArgumentIndex();
if( position > 0 )
applicationName = commandLine.getArguments()[ position - 1 ];
// Find the instances...
StringsCompleter delegate = new StringsCompleter( false );
ManagedApplication ma;
if( ! Utils.isEmptyOrWhitespaces( applicationName )
&& ( ma = this.manager.applicationMngr().findManagedApplicationByName( applicationName )) != null ) {
for( Instance inst : InstanceHelpers.findAllScopedInstances( ma.getApplication()))
delegate.getStrings().add( InstanceHelpers.computeInstancePath( inst ));
}
return delegate.complete( session, commandLine, candidates );
}
示例3: complete
import org.apache.karaf.shell.support.completers.StringsCompleter; //导入依赖的package包/类
@Override
public int complete(Session session, CommandLine commandLine, List<String> candidates) {
StringsCompleter delegate = new StringsCompleter();
for (String entry : enums) {
delegate.getStrings().add(entry);
}
return delegate.complete(session, commandLine, candidates);
}
示例4: complete
import org.apache.karaf.shell.support.completers.StringsCompleter; //导入依赖的package包/类
@Override
public int complete(Session session, CommandLine commandLine, List<String> candidates) {
StringsCompleter delegate = new StringsCompleter();
for (String s : getEnums()) {
delegate.getStrings().add(s);
}
return delegate.complete(session, commandLine, candidates);
}
示例5: complete
import org.apache.karaf.shell.support.completers.StringsCompleter; //导入依赖的package包/类
@Override
public int complete(final Session session, final CommandLine commandLine, final List<String> candidates) {
final String[] algorithms = Arrays.stream(Security.getProviders()).flatMap(p -> p.getServices().stream())
.filter(s -> credentialStoreType.equals(s.getType())).map(Service::getAlgorithm).toArray(String[]::new);
return new StringsCompleter(algorithms).complete(session, commandLine, candidates);
}
示例6: complete
import org.apache.karaf.shell.support.completers.StringsCompleter; //导入依赖的package包/类
@Override
public int complete(final Session session, final CommandLine commandLine, final List<String> candidates) {
final String[] providerNames = Arrays.stream(Security.getProviders()).map(Provider::getName)
.toArray(String[]::new);
return new StringsCompleter(providerNames).complete(session, commandLine, candidates);
}
示例7: complete
import org.apache.karaf.shell.support.completers.StringsCompleter; //导入依赖的package包/类
@Override
public int complete(Session session, CommandLine commandLine, List<String> candidates) {
StringsCompleter delegate = new StringsCompleter();
for (String name : _db.listDbNames()) {
delegate.getStrings().add(name);
}
return delegate.complete(session, commandLine, candidates);
}
示例8: completeKeySpace
import org.apache.karaf.shell.support.completers.StringsCompleter; //导入依赖的package包/类
public static void completeKeySpace(StringsCompleter delegate,
com.datastax.driver.core.Session cassandraSession) {
try {
ResultSet execute = cassandraSession
.execute("SELECT keyspace_name FROM system_schema.keyspaces;");
for (Row row : execute) {
String keySpace = row.getString("keyspace_name");
delegate.getStrings().add(keySpace);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
示例9: complete
import org.apache.karaf.shell.support.completers.StringsCompleter; //导入依赖的package包/类
@Override
public int complete( Session session, CommandLine commandLine, List<String> candidates ) {
StringsCompleter delegate = new StringsCompleter( false );
for( ManagedApplication ma : this.manager.applicationMngr().getManagedApplications())
delegate.getStrings().add( ma.getName());
return delegate.complete( session, commandLine, candidates );
}
示例10: complete
import org.apache.karaf.shell.support.completers.StringsCompleter; //导入依赖的package包/类
@Override
public int complete( Session session, CommandLine commandLine, List<String> candidates ) {
StringsCompleter delegate = new StringsCompleter( false );
for( Level level : LEVELS )
delegate.getStrings().add( level.toString());
return delegate.complete( session, commandLine, candidates );
}
示例11: complete
import org.apache.karaf.shell.support.completers.StringsCompleter; //导入依赖的package包/类
@Override
public int complete( Session session, CommandLine commandLine, List<String> candidates ) {
StringsCompleter delegate = new StringsCompleter( false );
delegate.getStrings().addAll( SupportedTarget.allString());
return delegate.complete( session, commandLine, candidates );
}
示例12: complete
import org.apache.karaf.shell.support.completers.StringsCompleter; //导入依赖的package包/类
@Override
public int complete( Session session, CommandLine commandLine, List<String> candidates ) {
StringsCompleter delegate = new StringsCompleter( false );
delegate.getStrings().addAll( SupportedPlugin.allString());
return delegate.complete( session, commandLine, candidates );
}
示例13: complete
import org.apache.karaf.shell.support.completers.StringsCompleter; //导入依赖的package包/类
@Override
public int complete(final Session session, final CommandLine commandLine, final List<String> candidates) {
return new StringsCompleter(logManager.getLoggers().keySet()).complete(session, commandLine, candidates);
}