Skip to content

Commit 83048b8

Browse files
authored
Merge pull request #2 from zangyilin/master
升级 使用javasdk
2 parents 7bb7a7a + d4e3f04 commit 83048b8

22 files changed

Lines changed: 388 additions & 623 deletions

.gitignore

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
*.class
2-
*.iml
3-
*.log
4-
.idea
52

63
# Mobile Tools for Java (J2ME)
74
.mtj.tmp/
@@ -13,4 +10,15 @@
1310

1411
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
1512
hs_err_pid*
16-
target/
13+
14+
# Build results
15+
target
16+
17+
# IDEA files
18+
.idea
19+
*.iml
20+
21+
# Eclipse files
22+
.settings
23+
.classpath
24+
.project

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ produce it from the Program, in the form of source code under the
212212
terms of section 4, provided that you also meet all of these conditions:
213213

214214
a) The work must carry prominent notices stating that you modified
215-
it, and giving a relevant date.
215+
it, and giving a relevant from.
216216

217217
b) The work must carry prominent notices stating that it is
218218
released under this License and any conditions added under section

pom.xml

Lines changed: 35 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>com.javabaas</groupId>
88
<artifactId>shell</artifactId>
9-
<version>0.1.2</version>
9+
<version>1.0.0</version>
1010
<packaging>jar</packaging>
1111

1212
<name>BaasShell</name>
@@ -70,7 +70,12 @@
7070
<dependency>
7171
<groupId>com.qiniu</groupId>
7272
<artifactId>qiniu-java-sdk</artifactId>
73-
<version>7.0.4.2</version>
73+
<version>[7.2.0, 7.2.99]</version>
74+
</dependency>
75+
<dependency>
76+
<groupId>com.javabaas</groupId>
77+
<artifactId>javasdk</artifactId>
78+
<version>1.0</version>
7479
</dependency>
7580

7681
</dependencies>
@@ -79,77 +84,43 @@
7984
<plugins>
8085
<plugin>
8186
<groupId>org.apache.maven.plugins</groupId>
82-
<artifactId>maven-compiler-plugin</artifactId>
83-
<configuration>
84-
<source>1.8</source>
85-
<target>1.8</target>
86-
</configuration>
87-
</plugin>
88-
<plugin>
89-
<groupId>org.apache.maven.plugins</groupId>
90-
<artifactId>maven-dependency-plugin</artifactId>
87+
<artifactId>maven-shade-plugin</artifactId>
88+
<version>2.4.3</version>
9189
<executions>
9290
<execution>
93-
<id>copy-dependencies</id>
94-
<phase>prepare-package</phase>
91+
<phase>package</phase>
9592
<goals>
96-
<goal>copy-dependencies</goal>
93+
<goal>shade</goal>
9794
</goals>
9895
<configuration>
99-
<outputDirectory>${project.build.directory}/lib</outputDirectory>
100-
<overWriteReleases>true</overWriteReleases>
101-
<overWriteSnapshots>true</overWriteSnapshots>
102-
<overWriteIfNewer>true</overWriteIfNewer>
96+
<filters>
97+
<filter>
98+
<artifact>*:*</artifact>
99+
<excludes>
100+
<exclude>META-INF/*.SF</exclude>
101+
<exclude>META-INF/*.DSA</exclude>
102+
<exclude>META-INF/*.RSA</exclude>
103+
</excludes>
104+
</filter>
105+
</filters>
106+
<transformers>
107+
<transformer
108+
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
109+
<mainClass>com.javabaas.shell.Main</mainClass>
110+
</transformer>
111+
<transformer
112+
implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
113+
<resource>META-INF/spring.handlers</resource>
114+
</transformer>
115+
<transformer
116+
implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
117+
<resource>META-INF/spring.schemas</resource>
118+
</transformer>
119+
</transformers>
103120
</configuration>
104121
</execution>
105122
</executions>
106123
</plugin>
107-
<plugin>
108-
<groupId>org.apache.maven.plugins</groupId>
109-
<artifactId>maven-jar-plugin</artifactId>
110-
<configuration>
111-
<archive>
112-
<manifest>
113-
<addClasspath>true</addClasspath>
114-
<useUniqueVersions>false</useUniqueVersions>
115-
<classpathPrefix>lib/</classpathPrefix>
116-
<mainClass>${jar.mainclass}</mainClass>
117-
</manifest>
118-
<manifestEntries>
119-
<version>${project.version}</version>
120-
</manifestEntries>
121-
</archive>
122-
</configuration>
123-
</plugin>
124-
<plugin>
125-
<groupId>org.codehaus.mojo</groupId>
126-
<artifactId>appassembler-maven-plugin</artifactId>
127-
<version>1.10</version>
128-
<configuration>
129-
<repositoryLayout>flat</repositoryLayout>
130-
<repositoryName>lib</repositoryName>
131-
<programs>
132-
<program>
133-
<mainClass>com.javabaas.shell.Main</mainClass>
134-
<name>shell</name>
135-
</program>
136-
</programs>
137-
</configuration>
138-
</plugin>
139124
</plugins>
140-
141125
</build>
142-
143-
144-
<repositories>
145-
<repository>
146-
<id>libs-milestone</id>
147-
<url>http://repo.spring.io/libs-milestone/</url>
148-
</repository>
149-
<repository>
150-
<id>libs-release</id>
151-
<url>http://repo.spring.io/libs-release/</url>
152-
</repository>
153-
</repositories>
154-
155126
</project>

src/main/java/com/javabaas/shell/Main.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.javabaas.shell;
22

3+
import com.javabaas.javasdk.JBConfig;
4+
import com.javabaas.shell.util.PropertiesUtil;
35
import org.springframework.shell.Bootstrap;
46

57
import java.io.IOException;
@@ -9,7 +11,10 @@
911
*/
1012
public class Main {
1113

14+
1215
public static void main(String[] args) throws IOException {
16+
PropertiesUtil properties = new PropertiesUtil();
17+
JBConfig.initAdmin(properties.getHost(), properties.getKey());
1318
Bootstrap.main(args);
1419
}
1520

src/main/java/com/javabaas/shell/commands/ApiStatCommands.java

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
package com.javabaas.shell.commands;
22

3+
import com.javabaas.javasdk.JBApp;
34
import com.javabaas.shell.common.CommandContext;
4-
import com.javabaas.shell.util.PropertiesUtil;
55
import org.springframework.beans.factory.annotation.Autowired;
66
import org.springframework.shell.core.CommandMarker;
77
import org.springframework.shell.core.annotation.CliAvailabilityIndicator;
88
import org.springframework.shell.core.annotation.CliCommand;
99
import org.springframework.stereotype.Component;
10-
import org.springframework.web.client.RestTemplate;
1110

12-
import javax.annotation.Resource;
1311
import java.text.SimpleDateFormat;
1412
import java.util.Calendar;
1513
import java.util.Date;
1614
import java.util.GregorianCalendar;
15+
import java.util.List;
1716

1817
/**
1918
* Created by Staryet on 15/8/20.
@@ -25,17 +24,13 @@ public class ApiStatCommands implements CommandMarker {
2524

2625
@Autowired
2726
private CommandContext context;
28-
@Autowired
29-
private PropertiesUtil propertiesUtil;
30-
@Resource(name = "MasterRestTemplate")
31-
private RestTemplate rest;
3227

3328
@CliAvailabilityIndicator({"stat"})
3429
public boolean isAvailable() {
3530
return context.getCurrentApp() != null;
3631
}
3732

38-
@CliCommand(value = "stat", help = "Show ApiStat.")
33+
@CliCommand(value = "stat", help = "Show JBApiStat.")
3934
public String stat() {
4035
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd");
4136
Calendar calendar = new GregorianCalendar();
@@ -45,8 +40,9 @@ public String stat() {
4540
String fromString = simpleDateFormat.format(from);
4641
String toString = simpleDateFormat.format(to);
4742
//显示列表
48-
String result = rest.getForObject(propertiesUtil.getHost() + "master/apiStat?from={from}&to={to}", String.class, fromString, toString);
49-
System.out.println(result);
43+
JBApp.JBApiStat apiStat = new JBApp.JBApiStat(null, null, null, fromString, toString);
44+
List<Long> list = JBApp.getApiStat(apiStat);
45+
System.out.println(list);
5046
return null;
5147
}
5248

0 commit comments

Comments
 (0)