zheng-oss不做分布式
This commit is contained in:
parent
73bf1da0c1
commit
3c8bfe3102
|
@ -19,10 +19,7 @@
|
|||
</properties>
|
||||
|
||||
<modules>
|
||||
<module>zheng-oss-common</module>
|
||||
<module>zheng-oss-dao</module>
|
||||
<module>zheng-oss-rpc-api</module>
|
||||
<module>zheng-oss-rpc-service</module>
|
||||
<module>zheng-oss-sdk</module>
|
||||
<module>zheng-oss-web</module>
|
||||
<module>zheng-oss-admin</module>
|
||||
</modules>
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.zheng</groupId>
|
||||
<artifactId>zheng-oss-rpc-api</artifactId>
|
||||
<artifactId>zheng-oss-sdk</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://code.alibabatech.com/schema/dubbo
|
||||
http://code.alibabatech.com/schema/dubbo/dubbo.xsd ">
|
||||
|
||||
<dubbo:application name="zheng-oss-admin"/>
|
||||
|
||||
<dubbo:registry address="zookeeper://127.0.0.1:2181"/>
|
||||
|
||||
<!-- 订阅服务 -->
|
||||
<dubbo:consumer check="false"/>
|
||||
|
||||
<!-- OSS -->
|
||||
<dubbo:reference id="ossApiService" interface="com.zheng.oss.rpc.api.OssApiService" mock="true"/>
|
||||
|
||||
</beans>
|
|
@ -1,68 +0,0 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>com.zheng</groupId>
|
||||
<artifactId>zheng-oss</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>zheng-oss-common</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>zheng-oss-common</name>
|
||||
<url>http://www.zhangshuzheng.cn</url>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.zheng</groupId>
|
||||
<artifactId>zheng-common</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<type>jar</type>
|
||||
</dependency>
|
||||
<!-- 七牛云存储 -->
|
||||
<dependency>
|
||||
<groupId>com.qiniu</groupId>
|
||||
<artifactId>qiniu-java-sdk</artifactId>
|
||||
<version>[7.0.0, 7.1.99]</version>
|
||||
</dependency>
|
||||
<!-- 阿里云OSS -->
|
||||
<dependency>
|
||||
<groupId>com.aliyun.oss</groupId>
|
||||
<artifactId>aliyun-sdk-oss</artifactId>
|
||||
<version>2.5.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>zheng-oss-common</finalName>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/java</directory>
|
||||
<includes>
|
||||
<include>**/*.xml</include>
|
||||
</includes>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.18.1</version>
|
||||
<configuration>
|
||||
<skipTests>true</skipTests>
|
||||
<testFailureIgnore>true</testFailureIgnore>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
|
@ -1,72 +0,0 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>com.zheng</groupId>
|
||||
<artifactId>zheng-oss</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>zheng-oss-dao</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>zheng-oss-dao</name>
|
||||
<url>http://www.zhangshuzheng.cn</url>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.zheng</groupId>
|
||||
<artifactId>zheng-oss-common</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<type>jar</type>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>zheng-oss-dao</finalName>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/java</directory>
|
||||
<includes>
|
||||
<include>**/*.xml</include>
|
||||
</includes>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.mybatis.generator</groupId>
|
||||
<artifactId>mybatis-generator-maven-plugin</artifactId>
|
||||
<version>1.3.2</version>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.zheng</groupId>
|
||||
<artifactId>zheng-common</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<configuration>
|
||||
<verbose>true</verbose>
|
||||
<overwrite>true</overwrite>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.18.1</version>
|
||||
<configuration>
|
||||
<skipTests>true</skipTests>
|
||||
<testFailureIgnore>true</testFailureIgnore>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
|
@ -1,38 +0,0 @@
|
|||
package com.zheng.oss.dao;
|
||||
|
||||
import com.zheng.common.util.MybatisGeneratorUtil;
|
||||
import com.zheng.common.util.PropertiesFileUtil;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 代码生成类
|
||||
* Created by ZhangShuzheng on 2017/4/18.
|
||||
*/
|
||||
public class Generator {
|
||||
|
||||
// 根据命名规范,只修改此常量值即可
|
||||
private static String MODULE = "zheng-oss";
|
||||
private static String DATABASE = "zheng";
|
||||
private static String TABLE_PREFIX = "oss_";
|
||||
private static String PACKAGE_NAME = "com.zheng.oss";
|
||||
private static String JDBC_DRIVER = PropertiesFileUtil.getInstance("generator").get("generator.jdbc.driver");
|
||||
private static String JDBC_URL = PropertiesFileUtil.getInstance("generator").get("generator.jdbc.url");
|
||||
private static String JDBC_USERNAME = PropertiesFileUtil.getInstance("generator").get("generator.jdbc.username");
|
||||
private static String JDBC_PASSWORD = PropertiesFileUtil.getInstance("generator").get("generator.jdbc.password");
|
||||
// 需要insert后返回主键的表配置,key:表名,value:主键名
|
||||
private static Map<String, String> LAST_INSERT_ID_TABLES = new HashMap<>();
|
||||
static {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动代码生成
|
||||
* @param args
|
||||
*/
|
||||
public static void main(String[] args) throws Exception {
|
||||
MybatisGeneratorUtil.generator(JDBC_DRIVER, JDBC_URL, JDBC_USERNAME, JDBC_PASSWORD, MODULE, DATABASE, TABLE_PREFIX, PACKAGE_NAME, LAST_INSERT_ID_TABLES);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
generator.jdbc.driver=com.mysql.jdbc.Driver
|
||||
generator.jdbc.url=jdbc\:mysql\://127.0.0.1\:3306/zheng?useUnicode\=true&characterEncoding\=utf-8&autoReconnect\=true
|
||||
generator.jdbc.username=root
|
||||
generator.jdbc.password=rWd3Hb+AzNg3IXF1b5vD+g==
|
|
@ -1,45 +0,0 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>com.zheng</groupId>
|
||||
<artifactId>zheng-oss</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>zheng-oss-rpc-api</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>zheng-oss-rpc-api</name>
|
||||
<url>http://www.zhangshuzheng.cn</url>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.zheng</groupId>
|
||||
<artifactId>zheng-oss-dao</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<type>jar</type>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>zheng-oss-rpc-api</finalName>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/java</directory>
|
||||
<includes>
|
||||
<include>**/*.xml</include>
|
||||
</includes>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
</project>
|
|
@ -1,33 +0,0 @@
|
|||
package com.zheng.oss.rpc.api;
|
||||
|
||||
import com.aliyun.oss.model.Bucket;
|
||||
import com.aliyun.oss.model.OSSObject;
|
||||
import com.aliyun.oss.model.ObjectMetadata;
|
||||
import com.aliyun.oss.model.PutObjectResult;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* oss系统接口
|
||||
* Created by shuzheng on 2017/4/18.
|
||||
*/
|
||||
public interface OssApiService {
|
||||
|
||||
/**
|
||||
* 上传指定文件到OSS中指定的{@link Bucket}。
|
||||
* @param bucketName Bucket名称。
|
||||
* @param key object的key。
|
||||
* @param file 指定上传文件。
|
||||
* @param metadata object的元信息{@link ObjectMetadata},若该元信息未包含Content-Length,则采用chunked编码传输请求数据。
|
||||
* @return
|
||||
*/
|
||||
PutObjectResult putObject(String bucketName, String key, File file, ObjectMetadata metadata);
|
||||
|
||||
/**
|
||||
* 删除指定的{@link OSSObject}。
|
||||
* @param bucketName Bucket名称。
|
||||
* @param key Object key。
|
||||
*/
|
||||
void deleteObject(String bucketName, String key);
|
||||
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
package com.zheng.oss.rpc.api;
|
||||
|
||||
import com.aliyun.oss.model.ObjectMetadata;
|
||||
import com.aliyun.oss.model.PutObjectResult;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* 降级实现OssApiService接口
|
||||
* Created by shuzheng on 2017/4/18.
|
||||
*/
|
||||
public class OssApiServiceMock implements OssApiService {
|
||||
|
||||
private static Logger _log = LoggerFactory.getLogger(OssApiServiceMock.class);
|
||||
|
||||
@Override
|
||||
public PutObjectResult putObject(String bucketName, String key, File file, ObjectMetadata metadata) {
|
||||
_log.info("OssApiServiceMock => putObject");
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteObject(String bucketName, String key) {
|
||||
_log.info("OssApiServiceMock => deleteObject");
|
||||
}
|
||||
|
||||
}
|
|
@ -1,137 +0,0 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>com.zheng</groupId>
|
||||
<artifactId>zheng-oss</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>zheng-oss-rpc-service</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>zheng-oss-rpc-service</name>
|
||||
<url>http://www.zhangshuzheng.cn</url>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.zheng</groupId>
|
||||
<artifactId>zheng-oss-rpc-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.12</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>dev</id>
|
||||
<properties>
|
||||
<env>dev</env>
|
||||
</properties>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>test</id>
|
||||
<properties>
|
||||
<env>test</env>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>prod</id>
|
||||
<properties>
|
||||
<env>prod</env>
|
||||
</properties>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<build>
|
||||
<finalName>zheng-oss-rpc-service</finalName>
|
||||
<filters>
|
||||
<filter>src/main/resources/profiles/${env}.properties</filter>
|
||||
</filters>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>src/main/java</directory>
|
||||
<includes>
|
||||
<include>**/*.xml</include>
|
||||
<include>**/*.properties</include>
|
||||
</includes>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>2.4</version>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.4</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<configuration>
|
||||
<descriptor>src/main/assembly/assembly.xml</descriptor>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>make-assembly</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<configuration>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
<encoding>UTF-8</encoding>
|
||||
</configuration>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-compiler-javac</artifactId>
|
||||
<version>1.8.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>2.6</version>
|
||||
<configuration>
|
||||
<encoding>UTF-8</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.10</version>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
<testFailureIgnore>true</testFailureIgnore>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
|
@ -1,20 +0,0 @@
|
|||
<assembly>
|
||||
<id>assembly</id>
|
||||
<formats>
|
||||
<format>tar.gz</format>
|
||||
</formats>
|
||||
<includeBaseDirectory>true</includeBaseDirectory>
|
||||
<fileSets>
|
||||
<fileSet>
|
||||
<directory>src/main/assembly/bin</directory>
|
||||
<outputDirectory>bin</outputDirectory>
|
||||
<fileMode>0755</fileMode>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
<dependencySets>
|
||||
<dependencySet>
|
||||
<outputDirectory>lib</outputDirectory>
|
||||
<scope>runtime</scope>
|
||||
</dependencySet>
|
||||
</dependencySets>
|
||||
</assembly>
|
|
@ -1,94 +0,0 @@
|
|||
#!/bin/bash
|
||||
cd `dirname $0`
|
||||
BIN_DIR=`pwd`
|
||||
cd ..
|
||||
DEPLOY_DIR=`pwd`
|
||||
CONF_DIR=$DEPLOY_DIR/conf
|
||||
|
||||
SERVER_NAME=`sed '/dubbo.application.name/!d;s/.*=//' conf/dubbo.properties | tr -d '\r'`
|
||||
LOGS_FILE=`sed '/dubbo.log4j.file/!d;s/.*=//' conf/dubbo.properties | tr -d '\r'`
|
||||
|
||||
if [ -z "$SERVER_NAME" ]; then
|
||||
SERVER_NAME=`hostname`
|
||||
fi
|
||||
|
||||
PIDS=`ps -f | grep java | grep "$CONF_DIR" |awk '{print $2}'`
|
||||
if [ -z "$PIDS" ]; then
|
||||
echo "ERROR: The $SERVER_NAME does not started!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
LOGS_DIR=""
|
||||
if [ -n "$LOGS_FILE" ]; then
|
||||
LOGS_DIR=`dirname $LOGS_FILE`
|
||||
else
|
||||
LOGS_DIR=$DEPLOY_DIR/logs
|
||||
fi
|
||||
if [ ! -d $LOGS_DIR ]; then
|
||||
mkdir $LOGS_DIR
|
||||
fi
|
||||
DUMP_DIR=$LOGS_DIR/dump
|
||||
if [ ! -d $DUMP_DIR ]; then
|
||||
mkdir $DUMP_DIR
|
||||
fi
|
||||
DUMP_DATE=`date +%Y%m%d%H%M%S`
|
||||
DATE_DIR=$DUMP_DIR/$DUMP_DATE
|
||||
if [ ! -d $DATE_DIR ]; then
|
||||
mkdir $DATE_DIR
|
||||
fi
|
||||
|
||||
echo -e "Dumping the $SERVER_NAME ...\c"
|
||||
for PID in $PIDS ; do
|
||||
jstack $PID > $DATE_DIR/jstack-$PID.dump 2>&1
|
||||
echo -e ".\c"
|
||||
jinfo $PID > $DATE_DIR/jinfo-$PID.dump 2>&1
|
||||
echo -e ".\c"
|
||||
jstat -gcutil $PID > $DATE_DIR/jstat-gcutil-$PID.dump 2>&1
|
||||
echo -e ".\c"
|
||||
jstat -gccapacity $PID > $DATE_DIR/jstat-gccapacity-$PID.dump 2>&1
|
||||
echo -e ".\c"
|
||||
jmap $PID > $DATE_DIR/jmap-$PID.dump 2>&1
|
||||
echo -e ".\c"
|
||||
jmap -heap $PID > $DATE_DIR/jmap-heap-$PID.dump 2>&1
|
||||
echo -e ".\c"
|
||||
jmap -histo $PID > $DATE_DIR/jmap-histo-$PID.dump 2>&1
|
||||
echo -e ".\c"
|
||||
if [ -r /usr/sbin/lsof ]; then
|
||||
/usr/sbin/lsof -p $PID > $DATE_DIR/lsof-$PID.dump
|
||||
echo -e ".\c"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -r /bin/netstat ]; then
|
||||
/bin/netstat -an > $DATE_DIR/netstat.dump 2>&1
|
||||
echo -e ".\c"
|
||||
fi
|
||||
if [ -r /usr/bin/iostat ]; then
|
||||
/usr/bin/iostat > $DATE_DIR/iostat.dump 2>&1
|
||||
echo -e ".\c"
|
||||
fi
|
||||
if [ -r /usr/bin/mpstat ]; then
|
||||
/usr/bin/mpstat > $DATE_DIR/mpstat.dump 2>&1
|
||||
echo -e ".\c"
|
||||
fi
|
||||
if [ -r /usr/bin/vmstat ]; then
|
||||
/usr/bin/vmstat > $DATE_DIR/vmstat.dump 2>&1
|
||||
echo -e ".\c"
|
||||
fi
|
||||
if [ -r /usr/bin/free ]; then
|
||||
/usr/bin/free -t > $DATE_DIR/free.dump 2>&1
|
||||
echo -e ".\c"
|
||||
fi
|
||||
if [ -r /usr/bin/sar ]; then
|
||||
/usr/bin/sar > $DATE_DIR/sar.dump 2>&1
|
||||
echo -e ".\c"
|
||||
fi
|
||||
if [ -r /usr/bin/uptime ]; then
|
||||
/usr/bin/uptime > $DATE_DIR/uptime.dump 2>&1
|
||||
echo -e ".\c"
|
||||
fi
|
||||
|
||||
echo "OK!"
|
||||
echo "DUMP: $DATE_DIR"
|
||||
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
#!/bin/bash
|
||||
cd `dirname $0`
|
||||
./stop.sh
|
||||
./start.sh
|
|
@ -1,24 +0,0 @@
|
|||
#!/bin/bash
|
||||
cd `dirname $0`
|
||||
if [ "$1" = "start" ]; then
|
||||
./start.sh
|
||||
else
|
||||
if [ "$1" = "stop" ]; then
|
||||
./stop.sh
|
||||
else
|
||||
if [ "$1" = "debug" ]; then
|
||||
./start.sh debug
|
||||
else
|
||||
if [ "$1" = "restart" ]; then
|
||||
./restart.sh
|
||||
else
|
||||
if [ "$1" = "dump" ]; then
|
||||
./dump.sh
|
||||
else
|
||||
echo "ERROR: Please input argument: start or stop or debug or restart or dump"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
|
@ -1,22 +0,0 @@
|
|||
@echo off & setlocal enabledelayedexpansion
|
||||
|
||||
set LIB_JARS=""
|
||||
cd ..\lib
|
||||
for %%i in (*) do set LIB_JARS=!LIB_JARS!;..\lib\%%i
|
||||
cd ..\bin
|
||||
|
||||
if ""%1"" == ""debug"" goto debug
|
||||
if ""%1"" == ""jmx"" goto jmx
|
||||
|
||||
java -Xms64m -Xmx1024m -XX:MaxPermSize=64M -classpath ..\conf;%LIB_JARS% com.alibaba.dubbo.container.Main
|
||||
goto end
|
||||
|
||||
:debug
|
||||
java -Xms64m -Xmx1024m -XX:MaxPermSize=64M -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n -classpath ..\conf;%LIB_JARS% com.alibaba.dubbo.container.Main
|
||||
goto end
|
||||
|
||||
:jmx
|
||||
java -Xms64m -Xmx1024m -XX:MaxPermSize=64M -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -classpath ..\conf;%LIB_JARS% com.alibaba.dubbo.container.Main
|
||||
|
||||
:end
|
||||
pause
|
|
@ -1,89 +0,0 @@
|
|||
#!/bin/bash
|
||||
cd `dirname $0`
|
||||
BIN_DIR=`pwd`
|
||||
cd ..
|
||||
DEPLOY_DIR=`pwd`
|
||||
CONF_DIR=$DEPLOY_DIR/conf
|
||||
|
||||
|
||||
SERVER_NAME=`sed '/dubbo.application.name/!d;s/.*=//' conf/dubbo.properties | tr -d '\r'`
|
||||
SERVER_PROTOCOL=`sed '/dubbo.protocol.name/!d;s/.*=//' conf/dubbo.properties | tr -d '\r'`
|
||||
SERVER_PORT=`sed '/dubbo.protocol.port/!d;s/.*=//' conf/dubbo.properties | tr -d '\r'`
|
||||
LOGS_FILE=`sed '/dubbo.log4j.file/!d;s/.*=//' conf/dubbo.properties | tr -d '\r'`
|
||||
|
||||
if [ -z "$SERVER_NAME" ]; then
|
||||
SERVER_NAME=`hostname`
|
||||
fi
|
||||
|
||||
PIDS=`ps -f | grep java | grep "$CONF_DIR" |awk '{print $2}'`
|
||||
if [ -n "$PIDS" ]; then
|
||||
echo "ERROR: The $SERVER_NAME already started!"
|
||||
echo "PID: $PIDS"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -n "$SERVER_PORT" ]; then
|
||||
SERVER_PORT_COUNT=`netstat -tln | grep $SERVER_PORT | wc -l`
|
||||
if [ $SERVER_PORT_COUNT -gt 0 ]; then
|
||||
echo "ERROR: The $SERVER_NAME port $SERVER_PORT already used!"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
LOGS_DIR=""
|
||||
if [ -n "$LOGS_FILE" ]; then
|
||||
LOGS_DIR=`dirname $LOGS_FILE`
|
||||
else
|
||||
LOGS_DIR=$DEPLOY_DIR/logs
|
||||
fi
|
||||
if [ ! -d $LOGS_DIR ]; then
|
||||
mkdir $LOGS_DIR
|
||||
fi
|
||||
STDOUT_FILE=$LOGS_DIR/stdout.log
|
||||
|
||||
LIB_DIR=$DEPLOY_DIR/lib
|
||||
LIB_JARS=`ls $LIB_DIR|grep .jar|awk '{print "'$LIB_DIR'/"$0}'|tr "\n" ":"`
|
||||
|
||||
LOCK_ZOOKEEPER_FILE="$LOGS_DIR/`echo $PWD|awk -F/ '{print $NF}'`.properties"
|
||||
JAVA_OPTS=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Ddubbo.registry.file=$LOCK_ZOOKEEPER_FILE"
|
||||
JAVA_DEBUG_OPTS=""
|
||||
if [ "$1" = "debug" ]; then
|
||||
JAVA_DEBUG_OPTS=" -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n "
|
||||
fi
|
||||
JAVA_JMX_OPTS=""
|
||||
if [ "$1" = "jmx" ]; then
|
||||
JAVA_JMX_OPTS=" -Djava.rmi.server.hostname=172.21.32.38 -Dcom.sun.management.jmxremote.port=1088 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false "
|
||||
fi
|
||||
JAVA_MEM_OPTS=""
|
||||
BITS=`java -version 2>&1 | grep -i 64-bit`
|
||||
if [ -n "$BITS" ]; then
|
||||
JAVA_MEM_OPTS=" -server -Xmx2g -Xms2g -Xmn256m -XX:PermSize=128m -Xss256k -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseCMSCompactAtFullCollection -XX:LargePageSizeInBytes=128m -XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70 "
|
||||
else
|
||||
JAVA_MEM_OPTS=" -server -Xms1g -Xmx1g -XX:PermSize=128m -XX:SurvivorRatio=2 -XX:+UseParallelGC "
|
||||
fi
|
||||
|
||||
echo -e "Starting the $SERVER_NAME ...\c"
|
||||
nohup java $JAVA_OPTS $JAVA_MEM_OPTS $JAVA_DEBUG_OPTS $JAVA_JMX_OPTS -classpath $CONF_DIR:$LIB_JARS com.alibaba.dubbo.container.Main > $STDOUT_FILE 2>&1 &
|
||||
|
||||
COUNT=0
|
||||
while [ $COUNT -lt 1 ]; do
|
||||
echo -e ".\c"
|
||||
sleep 1
|
||||
if [ -n "$SERVER_PORT" ]; then
|
||||
if [ "$SERVER_PROTOCOL" == "dubbo" ]; then
|
||||
COUNT=`echo status | nc -i 1 172.21.32.38 $SERVER_PORT | grep -c OK`
|
||||
else
|
||||
COUNT=`netstat -an | grep $SERVER_PORT | wc -l`
|
||||
fi
|
||||
else
|
||||
COUNT=`ps -f | grep java | grep "$DEPLOY_DIR" | awk '{print $2}' | wc -l`
|
||||
fi
|
||||
if [ $COUNT -gt 0 ]; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
echo "OK!"
|
||||
PIDS=`ps -f | grep java | grep "$DEPLOY_DIR" | awk '{print $2}'`
|
||||
echo "PID: $PIDS"
|
||||
echo "STDOUT: $STDOUT_FILE"
|
|
@ -1,44 +0,0 @@
|
|||
#!/bin/bash
|
||||
cd `dirname $0`
|
||||
BIN_DIR=`pwd`
|
||||
cd ..
|
||||
DEPLOY_DIR=`pwd`
|
||||
CONF_DIR=$DEPLOY_DIR/conf
|
||||
|
||||
SERVER_NAME=`sed '/dubbo.application.name/!d;s/.*=//' conf/dubbo.properties | tr -d '\r'`
|
||||
|
||||
if [ -z "$SERVER_NAME" ]; then
|
||||
SERVER_NAME=`hostname`
|
||||
fi
|
||||
|
||||
PIDS=`ps -ef | grep java | grep "$CONF_DIR" |awk '{print $2}'`
|
||||
if [ -z "$PIDS" ]; then
|
||||
echo "ERROR: The $SERVER_NAME does not started!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$1" != "skip" ]; then
|
||||
$BIN_DIR/dump.sh
|
||||
fi
|
||||
|
||||
echo -e "Stopping the $SERVER_NAME ...\c"
|
||||
for PID in $PIDS ; do
|
||||
kill $PID > /dev/null 2>&1
|
||||
done
|
||||
|
||||
COUNT=0
|
||||
while [ $COUNT -lt 1 ]; do
|
||||
echo -e ".\c"
|
||||
sleep 1
|
||||
COUNT=1
|
||||
for PID in $PIDS ; do
|
||||
PID_EXIST=`ps -f -p $PID | grep java`
|
||||
if [ -n "$PID_EXIST" ]; then
|
||||
COUNT=0
|
||||
break
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
echo "OK!"
|
||||
echo "PID: $PIDS"
|
|
@ -1,21 +0,0 @@
|
|||
package com.zheng.oss.rpc;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
|
||||
/**
|
||||
* 服务启动类
|
||||
* Created by ZhangShuzheng on 2017/4/18.
|
||||
*/
|
||||
public class ZhengOssRpcServiceApplication {
|
||||
|
||||
private static Logger _log = LoggerFactory.getLogger(ZhengOssRpcServiceApplication.class);
|
||||
|
||||
public static void main(String[] args) {
|
||||
_log.info(">>>>> zheng-oss-rpc-service 正在启动 <<<<<");
|
||||
new ClassPathXmlApplicationContext("classpath:META-INF/spring/*.xml");
|
||||
_log.info(">>>>> zheng-oss-rpc-service 启动完成 <<<<<");
|
||||
}
|
||||
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
package com.zheng.oss.rpc.service.impl;
|
||||
|
||||
import com.aliyun.oss.model.ObjectMetadata;
|
||||
import com.aliyun.oss.model.PutObjectResult;
|
||||
import com.zheng.oss.rpc.api.OssApiService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* OssApiService实现
|
||||
* Created by shuzheng on 2017/4/18.
|
||||
*/
|
||||
@Service
|
||||
@Transactional
|
||||
public class OssApiServiceImpl implements OssApiService {
|
||||
|
||||
private static Logger _log = LoggerFactory.getLogger(OssApiServiceImpl.class);
|
||||
|
||||
|
||||
@Override
|
||||
public PutObjectResult putObject(String bucketName, String key, File file, ObjectMetadata metadata) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteObject(String bucketName, String key) {
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://code.alibabatech.com/schema/dubbo
|
||||
http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
|
||||
|
||||
<dubbo:application name="zheng-oss-rpc-service"/>
|
||||
|
||||
<dubbo:registry address="zookeeper://127.0.0.1:2181"/>
|
||||
|
||||
<dubbo:protocol name="dubbo" port="20884"/>
|
||||
|
||||
<!-- OSS -->
|
||||
<bean id="ossApiService" class="com.zheng.oss.rpc.service.impl.OssApiServiceImpl"/>
|
||||
<dubbo:service interface="com.zheng.oss.rpc.api.OssApiService" ref="ossApiService"/>
|
||||
|
||||
</beans>
|
|
@ -1,25 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:cache="http://www.springframework.org/schema/cache"
|
||||
xsi:schemaLocation="
|
||||
http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/cache
|
||||
http://www.springframework.org/schema/cache/spring-cache.xsd">
|
||||
|
||||
<!-- 支持缓存注解 -->
|
||||
<cache:annotation-driven cache-manager="cacheManager" />
|
||||
|
||||
<!-- 默认是cacheManager -->
|
||||
<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager">
|
||||
<property name="cacheManager" ref="cacheManagerFactory"/>
|
||||
</bean>
|
||||
|
||||
<!-- cache管理器配置 -->
|
||||
<bean id="cacheManagerFactory" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
|
||||
<property name="configLocation" value="classpath:ehcache.xml"/>
|
||||
<property name="shared" value="true" />
|
||||
</bean>
|
||||
|
||||
</beans>
|
|
@ -1,114 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:aop="http://www.springframework.org/schema/aop"
|
||||
xmlns:tx="http://www.springframework.org/schema/tx"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xsi:schemaLocation="
|
||||
http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/tx
|
||||
http://www.springframework.org/schema/tx/spring-tx.xsd
|
||||
http://www.springframework.org/schema/context
|
||||
http://www.springframework.org/schema/context/spring-context.xsd
|
||||
http://www.springframework.org/schema/aop
|
||||
http://www.springframework.org/schema/aop/spring-aop.xsd">
|
||||
|
||||
<!-- 引入jdbc配置文件 -->
|
||||
<!--<context:property-placeholder location="classpath:jdbc.properties" />-->
|
||||
<!-- 配置进行解密 -->
|
||||
<bean id="propertyConfigurer" class="com.zheng.common.plugin.EncryptPropertyPlaceholderConfigurer">
|
||||
<property name="locations">
|
||||
<list>
|
||||
<value>classpath:jdbc.properties</value>
|
||||
<value>classpath:redis.properties</value>
|
||||
</list>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<!-- 主库数据源 -->
|
||||
<bean id="masterDataSource" class="com.alibaba.druid.pool.DruidDataSource" init-method="init"
|
||||
destroy-method="close">
|
||||
<!-- 基本属性 url、user、password -->
|
||||
<property name="driverClassName" value="${master.jdbc.driver}"/>
|
||||
<property name="url" value="${master.jdbc.url}"/>
|
||||
<property name="username" value="${master.jdbc.username}"/>
|
||||
<property name="password" value="${master.jdbc.password}"/>
|
||||
<!-- 配置初始化大小、最小、最大 -->
|
||||
<property name="initialSize" value="1"/>
|
||||
<property name="minIdle" value="1"/>
|
||||
<property name="maxActive" value="20"/>
|
||||
<!-- 配置获取连接等待超时的时间 -->
|
||||
<property name="maxWait" value="60000"/>
|
||||
<!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 -->
|
||||
<property name="timeBetweenEvictionRunsMillis" value="60000"/>
|
||||
<!-- 配置一个连接在池中最小生存的时间,单位是毫秒 -->
|
||||
<property name="minEvictableIdleTimeMillis" value="300000"/>
|
||||
<!-- 校验语句 -->
|
||||
<property name="validationQuery" value="SELECT 1"/>
|
||||
<property name="testWhileIdle" value="true"/>
|
||||
<property name="testOnBorrow" value="false"/>
|
||||
<property name="testOnReturn" value="false"/>
|
||||
<!-- 配置监控统计拦截的filters -->
|
||||
<property name="filters" value="stat"/>
|
||||
</bean>
|
||||
|
||||
<!-- 从库数据源 -->
|
||||
<bean id="slaveDataSource" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close">
|
||||
<!-- 基本属性 url、user、password -->
|
||||
<property name="driverClassName" value="${slave.jdbc.driver}"/>
|
||||
<property name="url" value="${slave.jdbc.url}"/>
|
||||
<property name="username" value="${slave.jdbc.username}"/>
|
||||
<property name="password" value="${slave.jdbc.password}"/>
|
||||
<!-- 配置初始化大小、最小、最大 -->
|
||||
<property name="initialSize" value="1"/>
|
||||
<property name="minIdle" value="1"/>
|
||||
<property name="maxActive" value="20"/>
|
||||
<!-- 配置获取连接等待超时的时间 -->
|
||||
<property name="maxWait" value="60000"/>
|
||||
<!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 -->
|
||||
<property name="timeBetweenEvictionRunsMillis" value="60000"/>
|
||||
<!-- 配置一个连接在池中最小生存的时间,单位是毫秒 -->
|
||||
<property name="minEvictableIdleTimeMillis" value="300000"/>
|
||||
<!-- 校验语句 -->
|
||||
<property name="validationQuery" value="SELECT 1"/>
|
||||
<property name="testWhileIdle" value="true"/>
|
||||
<property name="testOnBorrow" value="false"/>
|
||||
<property name="testOnReturn" value="false"/>
|
||||
<!-- 配置监控统计拦截的filters -->
|
||||
<property name="filters" value="stat"/>
|
||||
</bean>
|
||||
|
||||
<!-- 动态数据源 -->
|
||||
<bean id="dataSource" class="com.zheng.common.db.DynamicDataSource">
|
||||
<property name="targetDataSources">
|
||||
<map key-type="java.lang.String">
|
||||
<!-- 可配置多个数据源 -->
|
||||
<entry value-ref="masterDataSource" key="masterDataSource"></entry>
|
||||
<entry value-ref="slaveDataSource" key="slaveDataSource"></entry>
|
||||
</map>
|
||||
</property>
|
||||
<property name="defaultTargetDataSource" ref="masterDataSource"></property>
|
||||
</bean>
|
||||
|
||||
<!-- 为Mybatis创建SqlSessionFactory,同时指定数据源 -->
|
||||
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
|
||||
<property name="dataSource" ref="dataSource"/>
|
||||
<property name="configLocation" value="classpath:mybatis-config.xml"/>
|
||||
<property name="mapperLocations" value="classpath*:com/zheng/oss/dao/mapper/*Mapper.xml"/>
|
||||
</bean>
|
||||
<!-- Mapper接口所在包名,Spring会自动查找其下的Mapper -->
|
||||
<bean id="mapperScannerConfigurer" class="org.mybatis.spring.mapper.MapperScannerConfigurer">
|
||||
<property name="basePackage" value="**.mapper"/>
|
||||
<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"/>
|
||||
</bean>
|
||||
|
||||
<!-- 事务管理器 -->
|
||||
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
|
||||
<property name="dataSource" ref="dataSource"/>
|
||||
</bean>
|
||||
|
||||
<!-- 启动注解事务 -->
|
||||
<tx:annotation-driven transaction-manager="transactionManager"/>
|
||||
|
||||
</beans>
|
|
@ -1,11 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="
|
||||
http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||
|
||||
<!-- Spring容器初始化完成监听器 -->
|
||||
<bean class="com.zheng.common.listener.ApplicationContextListener" lazy-init="false"></bean>
|
||||
|
||||
</beans>
|
|
@ -1,10 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||
|
||||
<!-- ApplicationContext -->
|
||||
<bean id="springContextUtil" class="com.zheng.common.util.SpringContextUtil"></bean>
|
||||
|
||||
</beans>
|
|
@ -1,2 +0,0 @@
|
|||
app.name=${app.name}
|
||||
env=${profile.env}
|
|
@ -1,25 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ehcache>
|
||||
<diskStore path="java.io.tmpdir/zheng-oss-rpc-service/ehcache"/>
|
||||
<defaultCache
|
||||
maxElementsInMemory="10000"
|
||||
eternal="false"
|
||||
timeToIdleSeconds="120"
|
||||
timeToLiveSeconds="120"
|
||||
maxElementsOnDisk="10000000"
|
||||
diskExpiryThreadIntervalSeconds="120"
|
||||
memoryStoreEvictionPolicy="LRU">
|
||||
<persistence strategy="localTempSwap"/>
|
||||
</defaultCache>
|
||||
<cache
|
||||
name="zheng-oss-rpc-service-ehcache"
|
||||
eternal="false"
|
||||
timeToIdleSeconds="120"
|
||||
timeToLiveSeconds="300"
|
||||
maxEntriesLocalHeap="10000"
|
||||
maxEntriesLocalDisk="10000000"
|
||||
diskExpiryThreadIntervalSeconds="120"
|
||||
memoryStoreEvictionPolicy="LRU">
|
||||
<persistence strategy="localTempSwap"/>
|
||||
</cache>
|
||||
</ehcache>
|
|
@ -1,9 +0,0 @@
|
|||
master.jdbc.driver=com.mysql.jdbc.Driver
|
||||
master.jdbc.url=jdbc\:mysql\://127.0.0.1\:3306/zheng?useUnicode\=true&characterEncoding\=utf-8&autoReconnect\=true
|
||||
master.jdbc.username=root
|
||||
master.jdbc.password=rWd3Hb+AzNg3IXF1b5vD+g==
|
||||
|
||||
slave.jdbc.driver=com.mysql.jdbc.Driver
|
||||
slave.jdbc.url=jdbc\:mysql\://127.0.0.1\:3306/zheng?useUnicode\=true&characterEncoding\=utf-8&autoReconnect\=true
|
||||
slave.jdbc.username=root
|
||||
slave.jdbc.password=rWd3Hb+AzNg3IXF1b5vD+g==
|
|
@ -1,40 +0,0 @@
|
|||
#off/fatal/error/warn/info/debug/all
|
||||
log4j.debug=false
|
||||
log4j.rootLogger=info,stdout,log,errorlog
|
||||
|
||||
# Console
|
||||
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.stdout.Target = System.out
|
||||
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.stdout.layout.ConversionPattern=%d [%t] %-5p [%c] - %m%n
|
||||
|
||||
### Log ###
|
||||
log4j.appender.log = org.apache.log4j.DailyRollingFileAppender
|
||||
log4j.appender.log.File = ../logs/zheng-oss-rpc-service.log
|
||||
log4j.appender.log.Append = true
|
||||
log4j.appender.log.Threshold = DEBUG
|
||||
log4j.appender.log.DatePattern='.'yyyy-MM-dd
|
||||
log4j.appender.log.layout = org.apache.log4j.PatternLayout
|
||||
log4j.appender.log.layout.ConversionPattern = %-d{yyyy-MM-dd HH:mm:ss} [ %p ] [ %C{1}.java :%L(%M)] %m%n
|
||||
|
||||
### Error ###
|
||||
log4j.appender.errorlog = org.apache.log4j.DailyRollingFileAppender
|
||||
log4j.appender.errorlog.File = ../logs/zheng-oss-rpc-service.error.log
|
||||
log4j.appender.errorlog.Append = true
|
||||
log4j.appender.errorlog.Threshold = ERROR
|
||||
log4j.appender.errorlog.DatePattern='.'yyyy-MM-dd
|
||||
log4j.appender.errorlog.layout = org.apache.log4j.PatternLayout
|
||||
log4j.appender.errorlog.layout.ConversionPattern =%-d{yyyy-MM-dd HH:mm:ss} [ %p ] [ %C{1}.java :%L(%M)] %m%n
|
||||
|
||||
#Spring logging configuration
|
||||
log4j.category.org.springframework = warn
|
||||
|
||||
#Druid logging configuration
|
||||
log4j.logger.druid.sql=warn,stdout,log,errorlog
|
||||
log4j.logger.druid.sql.DataSource=warn,stdout,log,errorlog
|
||||
log4j.logger.druid.sql.Connection=warn,stdout,log,errorlog
|
||||
log4j.logger.druid.sql.Statement=warn,stdout,log,errorlog
|
||||
log4j.logger.druid.sql.ResultSet=warn,stdout,log,errorlog
|
||||
|
||||
# MyBatis logging configuration
|
||||
log4j.logger.com.zheng.oss.dao.mapper=debug
|
|
@ -1,2 +0,0 @@
|
|||
app.name=zheng-oss-rpc-service
|
||||
profile.env=dev
|
|
@ -1,2 +0,0 @@
|
|||
app.name=zheng-oss-rpc-service
|
||||
profile.env=pre
|
|
@ -1,2 +0,0 @@
|
|||
app.name=zheng-oss-rpc-service
|
||||
profile.env=prod
|
|
@ -1,2 +0,0 @@
|
|||
app.name=zheng-oss-rpc-service
|
||||
profile.env=test
|
|
@ -1,7 +0,0 @@
|
|||
master.redis.ip=127.0.0.1
|
||||
master.redis.port=6379
|
||||
master.redis.password=FNFl9F2O2Skb8yoKM0jhHA==
|
||||
master.redis.max_active=500
|
||||
master.redis.max_idle=5
|
||||
master.redis.max_wait=10000
|
||||
master.redis.timeout=10000
|
|
@ -1,38 +0,0 @@
|
|||
package com.zheng;
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestCase;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
/**
|
||||
* Unit test for simple App.
|
||||
*/
|
||||
public class AppTest
|
||||
extends TestCase
|
||||
{
|
||||
/**
|
||||
* Create the test case
|
||||
*
|
||||
* @param testName name of the test case
|
||||
*/
|
||||
public AppTest( String testName )
|
||||
{
|
||||
super( testName );
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the suite of tests being tested
|
||||
*/
|
||||
public static Test suite()
|
||||
{
|
||||
return new TestSuite( AppTest.class );
|
||||
}
|
||||
|
||||
/**
|
||||
* Rigourous Test :-)
|
||||
*/
|
||||
public void testApp()
|
||||
{
|
||||
assertTrue( true );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>com.zheng</groupId>
|
||||
<artifactId>zheng-oss</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>zheng-oss-sdk</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>zheng-oss-sdk</name>
|
||||
<url>http://www.zhangshuzheng.cn</url>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.zheng</groupId>
|
||||
<artifactId>zheng-common</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<type>jar</type>
|
||||
</dependency>
|
||||
<!-- 七牛云存储 -->
|
||||
<dependency>
|
||||
<groupId>com.qiniu</groupId>
|
||||
<artifactId>qiniu-java-sdk</artifactId>
|
||||
<version>[7.0.0, 7.1.99]</version>
|
||||
</dependency>
|
||||
<!-- 阿里云OSS -->
|
||||
<dependency>
|
||||
<groupId>com.aliyun.oss</groupId>
|
||||
<artifactId>aliyun-sdk-oss</artifactId>
|
||||
<version>2.5.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>zheng-oss-sdk</finalName>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/java</directory>
|
||||
<includes>
|
||||
<include>**/*.xml</include>
|
||||
</includes>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.18.1</version>
|
||||
<configuration>
|
||||
<skipTests>true</skipTests>
|
||||
<testFailureIgnore>true</testFailureIgnore>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
|
||||
|
||||
<bean id="zhengAdminUtil" class="com.zheng.common.util.ZhengAdminUtil"></bean>
|
||||
|
||||
</beans>
|
|
@ -36,7 +36,7 @@
|
|||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.zheng</groupId>
|
||||
<artifactId>zheng-oss-rpc-api</artifactId>
|
||||
<artifactId>zheng-oss-sdk</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package com.zheng.oss.web.controller;
|
||||
|
||||
import com.aliyun.oss.OSSClient;
|
||||
import com.zheng.oss.rpc.api.OssApiService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
|
@ -18,9 +17,6 @@ import java.io.ByteArrayInputStream;
|
|||
@RequestMapping("/demo")
|
||||
public class DemoController {
|
||||
|
||||
@Autowired
|
||||
private OssApiService ossApiService;
|
||||
|
||||
@RequestMapping(value = "/index", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public String index(ModelMap modelMap) {
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://code.alibabatech.com/schema/dubbo
|
||||
http://code.alibabatech.com/schema/dubbo/dubbo.xsd ">
|
||||
|
||||
<dubbo:application name="zheng-oss-web"/>
|
||||
|
||||
<dubbo:registry address="zookeeper://127.0.0.1:2181"/>
|
||||
|
||||
<!-- 订阅服务 -->
|
||||
<dubbo:consumer check="false"/>
|
||||
|
||||
<!-- OSS -->
|
||||
<dubbo:reference id="ossApiService" interface="com.zheng.oss.rpc.api.OssApiService" mock="true"/>
|
||||
|
||||
</beans>
|
Loading…
Reference in New Issue