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


Java Command类代码示例

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

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

示例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());
}
 
开发者ID:actframework,项目名称:act-demo-apps,代码行数:8,代码来源:AutoObjectApp.java

示例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();
}
 
开发者ID:actframework,项目名称:act-demo-apps,代码行数:8,代码来源:StudentApi.java

示例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;
}
 
开发者ID:actframework,项目名称:act-demo-apps,代码行数:9,代码来源:StudentApi.java

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

示例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);
    }
}
 
开发者ID:actframework,项目名称:act-demo-apps,代码行数:13,代码来源:GH266.java

示例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);
    }
}
 
开发者ID:actframework,项目名称:act-demo-apps,代码行数:14,代码来源:GH266.java

示例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);
    }
}
 
开发者ID:actframework,项目名称:act-demo-apps,代码行数:13,代码来源:Application.java

示例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);
    }
}
 
开发者ID:actframework,项目名称:act-demo-apps,代码行数:14,代码来源:Application.java

示例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);
    }
}
 
开发者ID:actframework,项目名称:act-demo-apps,代码行数:13,代码来源:JobLog.java

示例12: testReadContentMercy

import act.cli.Command; //导入依赖的package包/类
@PostAction("read")
@Command("misc.cat")
public String testReadContentMercy(
        @ReadContent(mercy = true) String content
) {
    return content;
}
 
开发者ID:actframework,项目名称:actframework,代码行数:8,代码来源:MiscsTestBed.java

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

示例14: testReadContent

import act.cli.Command; //导入依赖的package包/类
@PostAction("hardRead")
@Command("misc.cat.hard")
public String testReadContent(
        @ReadContent String content
) {
    return content;
}
 
开发者ID:actframework,项目名称:actframework,代码行数:8,代码来源:MiscsTestBed.java

示例15: testReadLines

import act.cli.Command; //导入依赖的package包/类
@PostAction("hardReadLine")
@Command("misc.catLine.hard")
public List<String> testReadLines(
        @ReadContent List<String> lines
) {
    return lines;
}
 
开发者ID:actframework,项目名称:actframework,代码行数:8,代码来源:MiscsTestBed.java


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