当前位置: 首页>>代码示例>>Java>>正文


Java CommandSession.get方法代码示例

本文整理汇总了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;
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:24,代码来源:ArtifactCompleter.java

示例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;
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:23,代码来源:ShowMetricsPatternCompleter.java

示例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;
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:23,代码来源:ResetMetricsPatternCompleter.java

示例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();
    }
}
 
开发者ID:ow2-chameleon,项目名称:everest,代码行数:21,代码来源:EverestGoGoCommand.java

示例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);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:11,代码来源:AbstractCompleter.java

示例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);
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:42,代码来源:ServiceReferenceNameCompleter.java

示例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);
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:45,代码来源:ServiceNameCompleter.java


注:本文中的org.apache.felix.service.command.CommandSession.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。