Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
*.class
*.iml
*.log
.idea

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

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
target/

# Build results
target

# IDEA files
.idea
*.iml

# Eclipse files
.settings
.classpath
.project
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:

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

b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
Expand Down
99 changes: 35 additions & 64 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.javabaas</groupId>
<artifactId>shell</artifactId>
<version>0.1.2</version>
<version>1.0.0</version>
<packaging>jar</packaging>

<name>BaasShell</name>
Expand Down Expand Up @@ -70,7 +70,12 @@
<dependency>
<groupId>com.qiniu</groupId>
<artifactId>qiniu-java-sdk</artifactId>
<version>7.0.4.2</version>
<version>[7.2.0, 7.2.99]</version>
</dependency>
<dependency>
<groupId>com.javabaas</groupId>
<artifactId>javasdk</artifactId>
<version>1.0</version>
</dependency>

</dependencies>
Expand All @@ -79,77 +84,43 @@
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.3</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>prepare-package</phase>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
<goal>shade</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
<overWriteReleases>true</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.javabaas.shell.Main</mainClass>
</transformer>
<transformer
implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/spring.handlers</resource>
</transformer>
<transformer
implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/spring.schemas</resource>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<useUniqueVersions>false</useUniqueVersions>
<classpathPrefix>lib/</classpathPrefix>
<mainClass>${jar.mainclass}</mainClass>
</manifest>
<manifestEntries>
<version>${project.version}</version>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>appassembler-maven-plugin</artifactId>
<version>1.10</version>
<configuration>
<repositoryLayout>flat</repositoryLayout>
<repositoryName>lib</repositoryName>
<programs>
<program>
<mainClass>com.javabaas.shell.Main</mainClass>
<name>shell</name>
</program>
</programs>
</configuration>
</plugin>
</plugins>

</build>


<repositories>
<repository>
<id>libs-milestone</id>
<url>http://repo.spring.io/libs-milestone/</url>
</repository>
<repository>
<id>libs-release</id>
<url>http://repo.spring.io/libs-release/</url>
</repository>
</repositories>

</project>
5 changes: 5 additions & 0 deletions src/main/java/com/javabaas/shell/Main.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.javabaas.shell;

import com.javabaas.javasdk.JBConfig;
import com.javabaas.shell.util.PropertiesUtil;
import org.springframework.shell.Bootstrap;

import java.io.IOException;
Expand All @@ -9,7 +11,10 @@
*/
public class Main {


public static void main(String[] args) throws IOException {
PropertiesUtil properties = new PropertiesUtil();
JBConfig.initAdmin(properties.getHost(), properties.getKey());
Bootstrap.main(args);
}

Expand Down
16 changes: 6 additions & 10 deletions src/main/java/com/javabaas/shell/commands/ApiStatCommands.java
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
package com.javabaas.shell.commands;

import com.javabaas.javasdk.JBApp;
import com.javabaas.shell.common.CommandContext;
import com.javabaas.shell.util.PropertiesUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.shell.core.CommandMarker;
import org.springframework.shell.core.annotation.CliAvailabilityIndicator;
import org.springframework.shell.core.annotation.CliCommand;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;

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

@Autowired
private CommandContext context;
@Autowired
private PropertiesUtil propertiesUtil;
@Resource(name = "MasterRestTemplate")
private RestTemplate rest;

@CliAvailabilityIndicator({"stat"})
public boolean isAvailable() {
return context.getCurrentApp() != null;
}

@CliCommand(value = "stat", help = "Show ApiStat.")
@CliCommand(value = "stat", help = "Show JBApiStat.")
public String stat() {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd");
Calendar calendar = new GregorianCalendar();
Expand All @@ -45,8 +40,9 @@ public String stat() {
String fromString = simpleDateFormat.format(from);
String toString = simpleDateFormat.format(to);
//显示列表
String result = rest.getForObject(propertiesUtil.getHost() + "master/apiStat?from={from}&to={to}", String.class, fromString, toString);
System.out.println(result);
JBApp.JBApiStat apiStat = new JBApp.JBApiStat(null, null, null, fromString, toString);
List<Long> list = JBApp.getApiStat(apiStat);
System.out.println(list);
return null;
}

Expand Down
Loading