-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c715f2b
commit ca81f79
Showing
241 changed files
with
36,880 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<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> | ||
<groupId>com.didiglobal.sds</groupId> | ||
<artifactId>sds-base</artifactId> | ||
<packaging>pom</packaging> | ||
<version>1.0.1-SNAPSHOT</version> | ||
|
||
<name>SDS</name> | ||
|
||
<modules> | ||
<module>sds-client</module> | ||
<module>sds-web</module> | ||
<module>sds-bootstrap</module> | ||
<module>sds-extends</module> | ||
<module>sds-easy</module> | ||
</modules> | ||
|
||
<properties> | ||
<spring-boot.version>2.1.1.RELEASE</spring-boot.version> | ||
|
||
<!-- Plugin dependency --> | ||
<plugin.spring-boot.version>${spring-boot.version}</plugin.spring-boot.version> | ||
<plugin.exec.version>1.6.0</plugin.exec.version> | ||
</properties> | ||
|
||
<dependencyManagement> | ||
<dependencies> | ||
<dependency> | ||
<groupId>com.didiglobal.sds</groupId> | ||
<artifactId>sds-client</artifactId> | ||
<version>1.0.1-SNAPSHOT</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-dependencies</artifactId> | ||
<version>${spring-boot.version}</version> | ||
<type>pom</type> | ||
<scope>import</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.mybatis.spring.boot</groupId> | ||
<artifactId>mybatis-spring-boot-starter</artifactId> | ||
<version>1.3.1</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.google.guava</groupId> | ||
<artifactId>guava</artifactId> | ||
<version>18.0</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.alibaba</groupId> | ||
<artifactId>fastjson</artifactId> | ||
<version>1.2.60</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.commons</groupId> | ||
<artifactId>commons-lang3</artifactId> | ||
<version>3.4</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>joda-time</groupId> | ||
<artifactId>joda-time</artifactId> | ||
<version>2.8.1</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>commons-collections</groupId> | ||
<artifactId>commons-collections</artifactId> | ||
<version>3.2.2</version> | ||
</dependency> | ||
</dependencies> | ||
</dependencyManagement> | ||
|
||
<build> | ||
<pluginManagement> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.3</version> | ||
<configuration> | ||
<source>1.7</source> | ||
<target>1.7</target> | ||
<encoding>UTF-8</encoding> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-maven-plugin</artifactId> | ||
<version>${plugin.spring-boot.version}</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>build-info</goal> | ||
<goal>repackage</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>exec-maven-plugin</artifactId> | ||
<version>${plugin.exec.version}</version> | ||
</plugin> | ||
</plugins> | ||
</pluginManagement> | ||
</build> | ||
|
||
<profiles> | ||
<profile> | ||
<id>front</id> | ||
<activation> | ||
<activeByDefault>true</activeByDefault> | ||
</activation> | ||
<modules> | ||
<module>sds-front</module> | ||
</modules> | ||
</profile> | ||
<profile> | ||
<id>release</id> | ||
<activation> | ||
<activeByDefault>true</activeByDefault> | ||
</activation> | ||
<distributionManagement> | ||
<repository> | ||
<id>central</id> | ||
<name>artifactory-main-releases</name> | ||
<url>http://artifactory.intra.xiaojukeji.com:80/artifactory/libs-release</url> | ||
</repository> | ||
<snapshotRepository> | ||
<id>snapshots</id> | ||
<name>artifactory-main-snapshots</name> | ||
<url>http://artifactory.intra.xiaojukeji.com:80/artifactory/libs-snapshot</url> | ||
</snapshotRepository> | ||
</distributionManagement> | ||
</profile> | ||
</profiles> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<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"> | ||
|
||
<parent> | ||
<groupId>com.didiglobal.sds</groupId> | ||
<artifactId>sds-base</artifactId> | ||
<version>1.0.1-SNAPSHOT</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
<packaging>jar</packaging> | ||
|
||
<artifactId>sds-bootstrap</artifactId> | ||
<name>sds-bootstrap</name> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.didiglobal.sds</groupId> | ||
<artifactId>sds-client</artifactId> | ||
<version>1.0.1-SNAPSHOT</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.javassist</groupId> | ||
<artifactId>javassist</artifactId> | ||
<version>3.21.0-GA</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<finalName>sds-bootstrap</finalName> | ||
|
||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-jar-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<phase>package</phase> | ||
</execution> | ||
</executions> | ||
<configuration> | ||
<archive> | ||
<manifestEntries> | ||
<Premain-Class>com.didiglobal.sds.bootstrap.SdsBootStrap</Premain-Class> | ||
<Can-Redefine-Classes>true</Can-Redefine-Classes> | ||
<Can-Retransform-Classes>true</Can-Retransform-Classes> | ||
<Pinpoint-Version>${project.version}</Pinpoint-Version> | ||
</manifestEntries> | ||
</archive> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-source-plugin</artifactId> | ||
<version>2.4</version> | ||
<configuration> | ||
<attach>true</attach> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>jar-no-fork</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-source-plugin</artifactId> | ||
<version>2.4</version> | ||
<configuration> | ||
<attach>true</attach> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>jar-no-fork</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-assembly-plugin</artifactId> | ||
<version>3.1.1</version> | ||
<configuration> | ||
<descriptorRefs> | ||
<descriptorRef>jar-with-dependencies</descriptorRef> | ||
</descriptorRefs> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<id>make-assembly</id> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>single</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
65 changes: 65 additions & 0 deletions
65
sds-bootstrap/src/main/java/com/didiglobal/sds/bootstrap/SdsBootStrap.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package com.didiglobal.sds.bootstrap; | ||
|
||
import com.didiglobal.sds.bootstrap.transformer.SdsClassFileTransformer; | ||
import com.didiglobal.sds.client.SdsClient; | ||
import com.didiglobal.sds.client.SdsClientFactory; | ||
import com.didiglobal.sds.client.log.SdsLoggerFactory; | ||
import org.slf4j.Logger; | ||
|
||
import java.lang.instrument.Instrumentation; | ||
|
||
/** | ||
* Created by yizhenqiang on 17/3/26. | ||
*/ | ||
public class SdsBootStrap { | ||
|
||
private static Logger logger = SdsLoggerFactory.getDefaultLogger(); | ||
|
||
private volatile static SdsClient client = null; | ||
|
||
private static final int BOOTSTRAP_PARAM_NUM = 4; | ||
|
||
/** | ||
* VM Options: -javaagent:/Users/manzhizhen/Documents/git/daijia-sds/sds-bootstrap/target/sds-bootstrap.jar=heima, | ||
* mzz-study,url,com.manzhizhen | ||
* | ||
* @param agentArgs | ||
* @param instrumentation | ||
*/ | ||
public static void premain(String agentArgs, Instrumentation instrumentation) { | ||
|
||
if (agentArgs == null) { | ||
agentArgs = ""; | ||
} | ||
|
||
logger.info("Sds agentArgs:" + agentArgs); | ||
|
||
String[] param = agentArgs.split(","); | ||
|
||
/** | ||
* 参数1:应用组名称 | ||
* 参数2:应用名称 | ||
* 参数3:sds服务端url | ||
* 参数4:需要sds扫描的包路径 | ||
*/ | ||
if (param.length != BOOTSTRAP_PARAM_NUM) { | ||
logger.error("Sds agentArgs num not 4:" + agentArgs); | ||
return; | ||
} | ||
|
||
client = SdsClientFactory.getOrCreateSdsClient(param[0], param[1], param[2]); | ||
|
||
logger.info("sdsClient: " + client); | ||
|
||
instrumentation.addTransformer(new SdsClassFileTransformer(param[3])); | ||
|
||
} | ||
|
||
public static SdsClient getClient() { | ||
return client; | ||
} | ||
|
||
private static String getClassPathFromSystemProperty() { | ||
return System.getProperty("java.class.path"); | ||
} | ||
} |
Oops, something went wrong.