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


Java CommandProcessor类代码示例

本文整理汇总了Java中org.apache.felix.service.command.CommandProcessor的典型用法代码示例。如果您正苦于以下问题:Java CommandProcessor类的具体用法?Java CommandProcessor怎么用?Java CommandProcessor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CommandProcessor类属于org.apache.felix.service.command包,在下文中一共展示了CommandProcessor类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testLogicalRouterConfigureCheckInterface

import org.apache.felix.service.command.CommandProcessor; //导入依赖的package包/类
public boolean testLogicalRouterConfigureCheckInterface(CommandProcessor commandprocessor, String inter, String port, String Ip, String mask,
		String resourceFriendlyID) throws Exception {
	// ipv4:setIP fe-0/0/1.1 192.168.1.2 255.255.255.0
	List<String> response = executeCommand(
			"ipv4:setIP " + resourceFriendlyID + " " + inter + "." + port + " " + Ip + " " + mask);

	if (inter.startsWith("lo"))
		Assert.assertTrue(response.get(1).contains("[ERROR] Configuration for Loopback interface not allowed"));

	return response.get(1).isEmpty() || !response.get(1).contains("ERROR");

	// check that command fails if interface doesn't exist
	// check updated interface if exists
	// if (!isMock)
	// return CheckHelper.checkInterface(inter, port, Ip, mask, model);
	// else
	// return true;
	// restore configuration
}
 
开发者ID:dana-i2cat,项目名称:opennaas-routing-nfv,代码行数:20,代码来源:ChassisKarafCommandsTests.java

示例2: setCommandProcessor

import org.apache.felix.service.command.CommandProcessor; //导入依赖的package包/类
@Reference
void setCommandProcessor(CommandProcessor cp){
	output = new ByteArrayOutputStream();
	error = new ByteArrayOutputStream();

	outputStream= new PrintStream(output);
	errorStream = new PrintStream(error);
	this.session = cp.createSession(System.in, outputStream, errorStream);
}
 
开发者ID:ibcn-cloudlet,项目名称:dianne,代码行数:10,代码来源:DianneConsole.java

示例3: WisitSession

import org.apache.felix.service.command.CommandProcessor; //导入依赖的package包/类
/**
 * Create a new WisitSession.
 * @param processor The CommandProcessor used in order to create the commandSession.
 * @param publisher The websocket publisher on which the asynchronous commandResult will be broadcast.
 * @param topic The websocket topic.
 */
public WisitSession(final CommandProcessor processor,final Publisher publisher,final String topic) {
    WisitOutputStream resultStream = new WisitOutputStream(publisher,topic);
    WisitOutputStream errorStream = new WisitOutputStream(publisher,topic, ERR);

    shellSession = processor.createSession(null, new PrintStream(resultStream,true),
                                                 new PrintStream(errorStream,true));
}
 
开发者ID:wisdom-framework,项目名称:wisdom,代码行数:14,代码来源:WisitSession.java

示例4: KarafManagerImpl

import org.apache.felix.service.command.CommandProcessor; //导入依赖的package包/类
public KarafManagerImpl( final CommandProcessor commandProcessor )
{
    Preconditions.checkNotNull( commandProcessor );

    this.commandProcessor = commandProcessor;
}
 
开发者ID:subutai-io,项目名称:base,代码行数:7,代码来源:KarafManagerImpl.java

示例5: executeCommand

import org.apache.felix.service.command.CommandProcessor; //导入依赖的package包/类
protected List<String> executeCommand(String command, CommandProcessor cp) throws Exception
{
	boolean notfound;
	int notfoundCounter = 0;

	// Run some commands to make sure they are installed properly
	ByteArrayOutputStream outputError = new ByteArrayOutputStream();
	PrintStream psE = new PrintStream(outputError);
	ByteArrayOutputStream output = new ByteArrayOutputStream();
	PrintStream ps = new PrintStream(output);

	CommandSession cs = cp.createSession(System.in, ps, psE);

	ArrayList<String> outputs = new ArrayList<String>();

	do {
		try {
			cs.execute(command);
			outputs.add(output.toString());
			outputs.add(outputError.toString());
			cs.close();
			notfound = false;
		} catch (CommandNotFoundException nfe) {
			notfound = true;
			notfoundCounter++;
			if (notfoundCounter > 50) {
				throw nfe;
			}
			Thread.sleep(200);
		} catch (IllegalArgumentException e) {
			// throw new IllegalArgumentException("Action should have thrown an exception because: " + e.toString());
			notfound = true;
			notfoundCounter++;
			if (notfoundCounter > 50) {
				throw e;
			}
			Thread.sleep(200);
		} catch (NoSuchMethodException a) {
			// log.error("Method for command not found: " + a.getLocalizedMessage());
			throw new NoSuchMethodException("Method for command not found.");
		}
	} while (notfound);

	return outputs;
}
 
开发者ID:dana-i2cat,项目名称:opennaas-routing-nfv,代码行数:46,代码来源:AbstractKarafCommandTest.java


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