本文整理汇总了Java中org.apache.felix.service.command.CommandSession.get方法的典型用法代码示例。如果您正苦于以下问题:Java CommandSession.get方法的具体用法?Java CommandSession.get怎么用?Java CommandSession.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.felix.service.command.CommandSession
的用法示例。
在下文中一共展示了CommandSession.get方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getType
import org.apache.felix.service.command.CommandSession; //导入方法依赖的package包/类
private UsesArtifactCommand.SearchType getType() {
final CommandSession session = CommandSessionHolder.getSession();
if (session == null) {
return null;
}
final ArgumentCompleter.ArgumentList argList = (ArgumentCompleter.ArgumentList) session
.get(ArgumentCompleter.ARGUMENTS_LIST);
if (argList == null || argList.getArguments() == null || argList.getArguments().length == 0) {
return null;
}
final List<String> arguments = Arrays.asList(argList.getArguments());
int argumentOffset = 1; // command is first argument
for (int index = 0, count = arguments.size(); index < count; ++index) {
if (arguments.get(index).startsWith("-")) {
argumentOffset = index;
}
}
// XXX: assuming the last option does not accept a value here
if (argumentOffset < arguments.size()) {
return UsesArtifactCommand.SearchType.valueOf(arguments.get(argumentOffset));
}
return null;
}
示例2: getType
import org.apache.felix.service.command.CommandSession; //导入方法依赖的package包/类
private ShowMetricsCommand.SearchType getType() {
final CommandSession session = CommandSessionHolder.getSession();
if (session == null) {
return null;
}
final ArgumentCompleter.ArgumentList argList = (ArgumentCompleter.ArgumentList) session
.get(ArgumentCompleter.ARGUMENTS_LIST);
if (argList == null || argList.getArguments() == null || argList.getArguments().length == 0) {
return null;
}
final List<String> arguments = Arrays.asList(argList.getArguments());
int argumentOffset = 1; // command is first argument
for (int index = 0, count = arguments.size(); index < count; ++index) {
if (arguments.get(index).startsWith("-")) {
argumentOffset = index;
}
}
if (argumentOffset < arguments.size()) {
return ShowMetricsCommand.SearchType.valueOf(arguments.get(argumentOffset));
}
return null;
}
示例3: getType
import org.apache.felix.service.command.CommandSession; //导入方法依赖的package包/类
private ResetMetricsCommand.SearchType getType() {
final CommandSession session = CommandSessionHolder.getSession();
if (session == null) {
return null;
}
final ArgumentCompleter.ArgumentList argList = (ArgumentCompleter.ArgumentList) session
.get(ArgumentCompleter.ARGUMENTS_LIST);
if (argList == null || argList.getArguments() == null || argList.getArguments().length == 0) {
return null;
}
final List<String> arguments = Arrays.asList(argList.getArguments());
int argumentOffset = 1; // command is first argument
for (int index = 0, count = arguments.size(); index < count; ++index) {
if (arguments.get(index).startsWith("-")) {
argumentOffset = index;
}
}
if (argumentOffset < arguments.size()) {
return ResetMetricsCommand.SearchType.valueOf(arguments.get(argumentOffset));
}
return null;
}
示例4: filter
import org.apache.felix.service.command.CommandSession; //导入方法依赖的package包/类
@Descriptor("Apply a filter on a set of Resource")
public void filter(@Descriptor("automatically supplied shell session") CommandSession session,
@Descriptor("request for the filter creation") String request
) {
System.out.println("Request " + request);
ListResourceContainer listResourceContainer = (ListResourceContainer) session.get(LISTRESOURCE);
if ( listResourceContainer == null){
System.out.println(" NO ENTRY TO FILTER ");
return;
}
try{
QueryFilter parserQuery = new QueryFilter(request,m_everestClient.getM_everest());
ResourceFilter resourceFilter = parserQuery.input();
ListResourceContainer filterResourceList = listResourceContainer.filter(resourceFilter);
printResource(filterResourceList);
session.put(LISTRESOURCE,filterResourceList);
}catch (Exception e){
e.printStackTrace();
}
}
示例5: getArgumentList
import org.apache.felix.service.command.CommandSession; //导入方法依赖的package包/类
/**
* Returns the argument list.
*
* @return argument list
*/
protected ArgumentCompleter.ArgumentList getArgumentList() {
CommandSession session = CommandSessionHolder.getSession();
return (ArgumentCompleter.ArgumentList)
session.get(ArgumentCompleter.ARGUMENTS_LIST);
}
示例6: getApplicationNamePattern
import org.apache.felix.service.command.CommandSession; //导入方法依赖的package包/类
private Pattern getApplicationNamePattern() {
final CommandSession session = CommandSessionHolder.getSession();
if (session == null) {
return compilePattern(null, false);
}
final ArgumentCompleter.ArgumentList argList = (ArgumentCompleter.ArgumentList) session
.get(ArgumentCompleter.ARGUMENTS_LIST);
if (argList == null || argList.getArguments() == null || argList.getArguments().length == 0) {
return compilePattern(null, false);
}
final List<String> arguments = Arrays.asList(argList.getArguments());
boolean isRegex = arguments.indexOf("--regex") > 0;
if (_applicationArgumentIndex == null) {
if (_applicationOptions == null || _applicationOptions.length == 0) {
return compilePattern(null, false);
}
for (String option : _applicationOptions) {
final int index = arguments.indexOf(option);
if (index >= 0) {
if (arguments.size() - 1 > index) {
// XXX: do we need to worry about commas delimiting a
// list?
return compilePattern(Collections.singletonList(arguments.get(index + 1)), isRegex);
}
}
}
} else {
int argumentOffset = 1; // command is first argument
for (int index = 0, count = arguments.size(); index < count; ++index) {
if (arguments.get(index).startsWith("-")) {
argumentOffset = index;
}
}
// XXX: assuming the last option does not accept a value here
if (_applicationArgumentIndex + argumentOffset < arguments.size()) {
return compilePattern(
Collections.singletonList(arguments.get(_applicationArgumentIndex + argumentOffset)), isRegex);
}
}
return compilePattern(null, false);
}
示例7: getApplicationNamePattern
import org.apache.felix.service.command.CommandSession; //导入方法依赖的package包/类
private Pattern getApplicationNamePattern() {
final CommandSession session = CommandSessionHolder.getSession();
if (session == null) {
return compilePattern(null, false);
}
final ArgumentCompleter.ArgumentList argList = (ArgumentCompleter.ArgumentList) session
.get(ArgumentCompleter.ARGUMENTS_LIST);
if (argList == null || argList.getArguments() == null || argList.getArguments().length == 0) {
return compilePattern(null, false);
}
final List<String> arguments = Arrays.asList(argList.getArguments());
boolean isRegex = arguments.indexOf("--regex") > 0;
if (_applicationArgumentIndex == null) {
if (_applicationOptions == null || _applicationOptions.length == 0) {
return compilePattern(null, false);
}
for (String option : _applicationOptions) {
final int index = arguments.indexOf(option);
if (index >= 0) {
if (arguments.size() - 1 > index) {
// XXX: do we need to worry about commas delimiting a
// list?
return compilePattern(Collections.singletonList(arguments.get(index + 1)), isRegex);
}
}
}
} else {
int argumentOffset = 1; // command is first argument
for (int index = 0, count = arguments.size(); index < count; ++index) {
if (arguments.get(index).startsWith("-")) {
argumentOffset = index;
if (_optionsWithParameters.contains(arguments.get(index))) {
++argumentOffset;
}
}
}
// XXX: assuming the last option does not accept a value here
if (_applicationArgumentIndex + argumentOffset < arguments.size()) {
return compilePattern(
Collections.singletonList(arguments.get(_applicationArgumentIndex + argumentOffset)), isRegex);
}
}
return compilePattern(null, false);
}