1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.springframework.roo.addon.surf.site;
20
21 import org.springframework.roo.shell.CliAvailabilityIndicator;
22 import org.springframework.roo.shell.CliCommand;
23 import org.springframework.roo.shell.CliOption;
24 import org.springframework.roo.shell.CommandMarker;
25 import org.springframework.roo.support.lifecycle.ScopeDevelopmentShell;
26 import org.springframework.roo.support.util.Assert;
27
28
29
30
31
32
33
34 @ScopeDevelopmentShell
35 public class SiteCommands implements CommandMarker {
36
37 private SiteOperations siteOperations;
38
39
40
41
42 public SiteCommands(SiteOperations siteOperations) {
43 Assert.notNull(siteOperations, "SiteOperations instance required");
44 this.siteOperations = siteOperations;
45 }
46
47
48
49
50
51 @CliAvailabilityIndicator({"surf site create"})
52 public boolean isSiteOperationAvailable() {
53 return siteOperations.isSiteOperationAvailable();
54 }
55
56
57
58
59
60
61 @CliCommand(value="surf site create", help="Creates a new Surf site configuration.")
62 public void listSurfSiteRegions(
63 @CliOption(key={"name",""}, mandatory=false, help="Specifies name of the Surf site.") String siteName,
64 @CliOption(key={"rootPageId",""}, mandatory=true, help="Specifies root page id of the Surf site.") String rootPageId
65 ) {
66 siteOperations.newSite(siteName,rootPageId);
67 }
68
69 }