net.hasor.rsf.tconsole.DetailRsfInstruct Maven / Gradle / Ivy
/*
* Copyright 2008-2009 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.hasor.rsf.tconsole;
import net.hasor.core.AppContext;
import net.hasor.rsf.InterAddress;
import net.hasor.rsf.RsfBindInfo;
import net.hasor.rsf.RsfContext;
import net.hasor.rsf.RsfUpdater;
import net.hasor.tconsole.TelCommand;
import net.hasor.tconsole.TelExecutor;
import javax.inject.Inject;
import javax.inject.Singleton;
import java.io.StringWriter;
import java.util.List;
/**
* 查看服务详细信息
* @version : 2016年4月3日
* @author 赵永春 ([email protected])
*/
@Singleton
public class DetailRsfInstruct implements TelExecutor {
@Inject
private AppContext appContext;
@Override
public String helpInfo() {
return "show service info.\r\n"//
+ " - detail (show help info.)\r\n"//
+ " - detail -h (show help info.)\r\n"//
+ " - detail xxxx (show service info of XXXX.)\r\n"//
+ " - detail -a xxxx (show service info of XXXX. if service is Consumer then show Providers)";
}
@Override
public String doCommand(TelCommand telCommand) throws Throwable {
StringWriter sw = new StringWriter();
String[] args = telCommand.getCommandArgs();
// .help
if (args == null || args.length == 0 || "-h".equalsIgnoreCase(args[0])) {
//
sw.write(">>>>>>>>>>>>>>>>>>>>>>>> " + telCommand.getCommandName() + " <<<<<<<<<<<<<<<<<<<<<<<<\r\n");
sw.write(helpInfo());
return sw.toString();
}
//
// .准备参数
String serviceID = args[args.length - 1].trim();
RsfContext rsfContext = appContext.getInstance(RsfContext.class);
RsfBindInfo