本文整理汇总了Java中act.cli.Command类的典型用法代码示例。如果您正苦于以下问题:Java Command类的具体用法?Java Command怎么用?Java Command使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Command类属于act.cli包,在下文中一共展示了Command类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: status
import act.cli.Command; //导入依赖的package包/类
@Command(name = "act.daemon.status", help = "Report app daemon status")
public void status(
@Required("specify daemon id") String id,
CliContext context,
@Provided JodaDateTimeCodec fmt
) {
Daemon daemon = get(id, context);
Daemon.State state = daemon.state();
DateTime ts = daemon.timestamp();
Exception lastError = daemon.lastError();
context.println("Daemon[%s]: %s at %s", id, state, fmt.toString(ts));
if (null != lastError) {
DateTime errTs = daemon.errorTimestamp();
if (null != errTs) {
context.println("Last error: %s at %s", E.stackTrace(lastError), fmt.toString(errTs));
} else {
context.println("Last error: %s", E.stackTrace(lastError));
}
}
Map<String, Object> attributes = daemon.getAttributes();
if (!attributes.isEmpty()) {
context.println("Attributes: %s", attributes);
}
}
示例2: listSObjectFields
import act.cli.Command; //导入依赖的package包/类
@Command(value = "act.ss.list, act.ss.print", help = "List all storage field info")
@PropertySpec("className,fieldName,updatePolicy,serviceId,contextPath")
public Collection<FieldServiceInfo> listSObjectFields() {
Set<String> fields = ssm.storageFields();
C.List<FieldServiceInfo> l = C.newList();
for (String s : fields) {
l.add(new FieldServiceInfo(s));
}
return l.sorted();
}
示例3: getFoo
import act.cli.Command; //导入依赖的package包/类
@Command("foo.show")
@GetAction("/foo/{id}")
@PropertySpec(Foo.DETAIL_VIEW)
@TableView
public Foo getFoo(int id) {
return dispatch(id, $.F.<Foo>identity());
}
示例4: list
import act.cli.Command; //导入依赖的package包/类
@Command(value = "st.list", help = "list all students")
@GetAction
@TableView
//@PropertySpec(http = "-x", cli = Student.TABLE_VIEW)
public List<Student> list() {
return studentManager.findAll();
}
示例5: show
import act.cli.Command; //导入依赖的package包/类
@Command(name = "st.show", help = "show information about a student")
@GetAction("/{id}")
@JsonView
public Student show(String id) {
Student student = studentManager.findById(id);
notFoundIfNull(student);
return student;
}
示例6: send
import act.cli.Command; //导入依赖的package包/类
@Command(name = "send", help = "Send message to websocket server")
public void send(@Required("specify the message to be sent") String message, CliContext context) {
WebSocket ws = context.session().attribute("ws");
if (null == ws) {
open(context);
send(message, context);
} else {
ws.send(message);
}
}
示例7: testAsncCommand
import act.cli.Command; //导入依赖的package包/类
@Async
@Command("countdown.async")
public void testAsncCommand(
@Required("specify the number") int num,
ProgressGauge progressGauge
) throws Exception {
progressGauge.updateMaxHint(num);
for (int i = 0; i < num; ++i) {
progressGauge.step();
Thread.sleep(500);
}
}
示例8: countDown
import act.cli.Command; //导入依赖的package包/类
@Async
@ReportProgress(type = ReportProgress.Type.TEXT)
@Command("countdown")
public void countDown(
@Required("specify the number") int num,
ProgressGauge progressGauge
) throws Exception {
progressGauge.updateMaxHint(num);
for (int i = 0; i < num; ++i) {
progressGauge.step();
Thread.sleep(500);
}
}
示例9: countdown
import act.cli.Command; //导入依赖的package包/类
@Async
@Command(name = "countdown", help = "countdown the number in background")
public void countdown(
@Required("specify the number") int number,
ProgressGauge progressGauge
) throws Exception {
progressGauge.updateMaxHint(number);
for (int i = 0; i < number; ++i) {
progressGauge.step();
Thread.sleep(500);
}
}
示例10: countdownAndReportProgress
import act.cli.Command; //导入依赖的package包/类
@Async
@ReportProgress
@Command(name = "countdown.track", help = "countdown the number and track")
public void countdownAndReportProgress(
@Required("specify the number") int number,
ProgressGauge progressGauge
) throws Exception {
progressGauge.updateMaxHint(number);
for (int i = 0; i < number; ++i) {
progressGauge.step();
Thread.sleep(200);
}
}
示例11: logs
import act.cli.Command; //导入依赖的package包/类
@Command(name = "log.list", help = "List job logs")
@PropertySpec("this as log")
@GetAction("/log")
public static List<String> logs(
@Optional(help = "limit the lines returned") Integer limit
) {
if (null != limit && limit > 0) {
return logs.take(limit);
} else {
return C.list(logs);
}
}
示例12: testReadContentMercy
import act.cli.Command; //导入依赖的package包/类
@PostAction("read")
@Command("misc.cat")
public String testReadContentMercy(
@ReadContent(mercy = true) String content
) {
return content;
}
示例13: testReadLinesMercy
import act.cli.Command; //导入依赖的package包/类
@PostAction("readLine")
@Command("misc.catLine")
public Collection<String> testReadLinesMercy(
@ReadContent(mercy = true) @Named("files") Collection<String> lines
) {
return lines;
}
示例14: testReadContent
import act.cli.Command; //导入依赖的package包/类
@PostAction("hardRead")
@Command("misc.cat.hard")
public String testReadContent(
@ReadContent String content
) {
return content;
}
示例15: testReadLines
import act.cli.Command; //导入依赖的package包/类
@PostAction("hardReadLine")
@Command("misc.catLine.hard")
public List<String> testReadLines(
@ReadContent List<String> lines
) {
return lines;
}