當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。