├── .svn
├── format
├── entries
├── wc.db
└── pristine
│ └── 1f
│ └── 1fdfc96a9a9e36369b5aa86db820145500e04379.svn-base
├── README.md
├── jobManager-core
├── .svn
│ ├── entries
│ ├── format
│ ├── wc.db
│ └── pristine
│ │ ├── 50
│ │ └── 5096c57bcc1c112f04fd616820903e9b0090619b.svn-base
│ │ ├── 59
│ │ └── 59bfe67cf59eb806e1a83adc89ac7c5dbd59e423.svn-base
│ │ ├── 63
│ │ └── 639a0c57d90ac3bae8f3db2313fbef989a922ffd.svn-base
│ │ ├── 73
│ │ └── 73d2a9c6e98645eaa65e57a5cb672bcd1c14ee93.svn-base
│ │ ├── fd
│ │ └── fd0c8983a319e9487cf8864f0fc39c37ed611484.svn-base
│ │ ├── b5
│ │ └── b5343da1f11358e4c40633fb88a723aeaeea8da1.svn-base
│ │ ├── 7f
│ │ └── 7fc5cdf245634fc919f3c66c252def14f4e7d719.svn-base
│ │ ├── 2b
│ │ └── 2b0fb822118d590a8b17bd4cd7f3606364d106a6.svn-base
│ │ ├── b1
│ │ └── b1e21ca54d7a8a5666a35e35aaf6bf8d917c0a7c.svn-base
│ │ ├── 00
│ │ └── 008d7529df3da45a3254d6e9ad8e020ed0ffe186.svn-base
│ │ └── ad
│ │ └── ad92a2f826f08cd367350ece5320a670a115ff8d.svn-base
├── src
│ └── main
│ │ ├── pluginLib
│ │ └── mysqlJobManager.jar
│ │ ├── conf
│ │ └── core.json
│ │ └── java
│ │ └── com
│ │ └── cug
│ │ └── intellM
│ │ └── jobManager
│ │ ├── plugin
│ │ ├── Pluginable.java
│ │ ├── JobManager.java
│ │ └── AbstractPlugin.java
│ │ ├── driver
│ │ └── CliDriver.java
│ │ ├── core
│ │ └── PluginLoader.java
│ │ └── util
│ │ ├── PluginUtils.java
│ │ └── Configuration.java
├── jobManager-core.iml
└── pom.xml
├── mongoDBJobManager
├── .svn
│ ├── entries
│ ├── format
│ ├── wc.db
│ └── pristine
│ │ ├── 72
│ │ └── 7226427002af5cc2382c9c3e9f00800a935523b6.svn-base
│ │ ├── 5c
│ │ └── 5ce20d09b5e93ee5f764ec5d7d732256acad5545.svn-base
│ │ └── b5
│ │ └── b53bdd62f819d5499e0f30b9ed4a4e8db054f02b.svn-base
├── src
│ └── main
│ │ └── java
│ │ └── com
│ │ └── cug
│ │ └── intellM
│ │ └── jobManager
│ │ └── mongoDBJobManager
│ │ └── MongoDBJobManager.java
├── pom.xml
└── mongoDBJobManager.iml
├── mysqlJobManager
├── .svn
│ ├── entries
│ ├── format
│ ├── wc.db
│ └── pristine
│ │ ├── 67
│ │ └── 67ada89de2fbe97cce62befdd8a6dca271c52762.svn-base
│ │ ├── 04
│ │ └── 048de174ab400210db3d23a5df26f160d2728cfa.svn-base
│ │ └── 3e
│ │ └── 3e4617707662436bb79f3a58f09768e92012557f.svn-base
├── src
│ └── main
│ │ └── java
│ │ └── com
│ │ └── cug
│ │ └── intellM
│ │ └── jobManager
│ │ └── mysqlJobManager
│ │ └── MysqlJobManager.java
├── pom.xml
└── mysqlJobManager.iml
├── .idea
├── copyright
│ └── profiles_settings.xml
├── vcs.xml
├── libraries
│ ├── Maven__commons_io_commons_io_2_4.xml
│ ├── Maven__com_alibaba_fastjson_1_2_38.xml
│ └── Maven__org_apache_commons_commons_lang3_3_4.xml
├── modules.xml
├── misc.xml
├── compiler.xml
├── uiDesigner.xml
└── workspace.xml
├── .gitattributes
├── pom.xml
├── .gitignore
└── jobManager.iml
/.svn/format:
--------------------------------------------------------------------------------
1 | 12
2 |
--------------------------------------------------------------------------------
/.svn/entries:
--------------------------------------------------------------------------------
1 | 12
2 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | 利用Java反射实现插件框架
2 |
--------------------------------------------------------------------------------
/jobManager-core/.svn/entries:
--------------------------------------------------------------------------------
1 | 12
2 |
--------------------------------------------------------------------------------
/jobManager-core/.svn/format:
--------------------------------------------------------------------------------
1 | 12
2 |
--------------------------------------------------------------------------------
/mongoDBJobManager/.svn/entries:
--------------------------------------------------------------------------------
1 | 12
2 |
--------------------------------------------------------------------------------
/mongoDBJobManager/.svn/format:
--------------------------------------------------------------------------------
1 | 12
2 |
--------------------------------------------------------------------------------
/mysqlJobManager/.svn/entries:
--------------------------------------------------------------------------------
1 | 12
2 |
--------------------------------------------------------------------------------
/mysqlJobManager/.svn/format:
--------------------------------------------------------------------------------
1 | 12
2 |
--------------------------------------------------------------------------------
/.svn/wc.db:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/windwinds/jobManager/HEAD/.svn/wc.db
--------------------------------------------------------------------------------
/jobManager-core/.svn/wc.db:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/windwinds/jobManager/HEAD/jobManager-core/.svn/wc.db
--------------------------------------------------------------------------------
/mysqlJobManager/.svn/wc.db:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/windwinds/jobManager/HEAD/mysqlJobManager/.svn/wc.db
--------------------------------------------------------------------------------
/mongoDBJobManager/.svn/wc.db:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/windwinds/jobManager/HEAD/mongoDBJobManager/.svn/wc.db
--------------------------------------------------------------------------------
/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/jobManager-core/src/main/pluginLib/mysqlJobManager.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/windwinds/jobManager/HEAD/jobManager-core/src/main/pluginLib/mysqlJobManager.jar
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/jobManager-core/.svn/pristine/73/73d2a9c6e98645eaa65e57a5cb672bcd1c14ee93.svn-base:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/windwinds/jobManager/HEAD/jobManager-core/.svn/pristine/73/73d2a9c6e98645eaa65e57a5cb672bcd1c14ee93.svn-base
--------------------------------------------------------------------------------
/jobManager-core/src/main/conf/core.json:
--------------------------------------------------------------------------------
1 | {
2 | "plugins":[
3 | {
4 | "pluginName":"mysqlJobManager",
5 | "pluginClass":"com.cug.intellM.jobManager.mysqlJobManager.MysqlJobManager"
6 | }
7 | ]
8 | }
--------------------------------------------------------------------------------
/jobManager-core/.svn/pristine/fd/fd0c8983a319e9487cf8864f0fc39c37ed611484.svn-base:
--------------------------------------------------------------------------------
1 | {
2 | "plugins":[
3 | {
4 | "pluginName":"mysqlJobManager",
5 | "pluginClass":"com.cug.intellM.jobManager.mysqlJobManager.MysqlJobManager"
6 | }
7 | ]
8 | }
--------------------------------------------------------------------------------
/jobManager-core/src/main/java/com/cug/intellM/jobManager/plugin/Pluginable.java:
--------------------------------------------------------------------------------
1 | package com.cug.intellM.jobManager.plugin;
2 |
3 | /**
4 | * Created by lyc on 2017/9/30.
5 | */
6 | public interface Pluginable {
7 | public String getPluginName();
8 | public void setPluginName(String pluginName);
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/jobManager-core/.svn/pristine/b5/b5343da1f11358e4c40633fb88a723aeaeea8da1.svn-base:
--------------------------------------------------------------------------------
1 | package com.cug.intellM.jobManager.plugin;
2 |
3 | /**
4 | * Created by lyc on 2017/9/30.
5 | */
6 | public interface Pluginable {
7 | public String getPluginName();
8 | public void setPluginName(String pluginName);
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/jobManager-core/.svn/pristine/59/59bfe67cf59eb806e1a83adc89ac7c5dbd59e423.svn-base:
--------------------------------------------------------------------------------
1 | package com.cug.intellM.jobManager.plugin;
2 |
3 | /**
4 | * Created by lyc on 2017/9/30.
5 | */
6 | public abstract class JobManager extends AbstractPlugin{
7 |
8 | public abstract void prepare();
9 |
10 | public abstract void check();
11 |
12 | public abstract void transformRule();
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/jobManager-core/src/main/java/com/cug/intellM/jobManager/plugin/JobManager.java:
--------------------------------------------------------------------------------
1 | package com.cug.intellM.jobManager.plugin;
2 |
3 | /**
4 | * Created by lyc on 2017/9/30.
5 | */
6 | public abstract class JobManager extends AbstractPlugin{
7 |
8 | public abstract void prepare();
9 |
10 | public abstract void check();
11 |
12 | public abstract void transformRule();
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
4 | # Custom for Visual Studio
5 | *.cs diff=csharp
6 |
7 | # Standard to msysgit
8 | *.doc diff=astextplain
9 | *.DOC diff=astextplain
10 | *.docx diff=astextplain
11 | *.DOCX diff=astextplain
12 | *.dot diff=astextplain
13 | *.DOT diff=astextplain
14 | *.pdf diff=astextplain
15 | *.PDF diff=astextplain
16 | *.rtf diff=astextplain
17 | *.RTF diff=astextplain
18 |
--------------------------------------------------------------------------------
/jobManager-core/.svn/pristine/7f/7fc5cdf245634fc919f3c66c252def14f4e7d719.svn-base:
--------------------------------------------------------------------------------
1 | package com.cug.intellM.jobManager.plugin;
2 |
3 | /**
4 | * Created by lyc on 2017/9/30.
5 | */
6 | //抽象类可以有抽象方法,不能被实例化,抽象方法不能有方法体,只能在子类中实现
7 | public abstract class AbstractPlugin implements Pluginable{
8 |
9 | private String pluginName;
10 |
11 | public String getPluginName() {
12 | return pluginName;
13 | }
14 |
15 | public void setPluginName(String pluginName) {
16 | this.pluginName = pluginName;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/jobManager-core/src/main/java/com/cug/intellM/jobManager/plugin/AbstractPlugin.java:
--------------------------------------------------------------------------------
1 | package com.cug.intellM.jobManager.plugin;
2 |
3 | /**
4 | * Created by lyc on 2017/9/30.
5 | */
6 | //抽象类可以有抽象方法,不能被实例化,抽象方法不能有方法体,只能在子类中实现
7 | public abstract class AbstractPlugin implements Pluginable{
8 |
9 | private String pluginName;
10 |
11 | public String getPluginName() {
12 | return pluginName;
13 | }
14 |
15 | public void setPluginName(String pluginName) {
16 | this.pluginName = pluginName;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__commons_io_commons_io_2_4.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__com_alibaba_fastjson_1_2_38.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/mongoDBJobManager/.svn/pristine/72/7226427002af5cc2382c9c3e9f00800a935523b6.svn-base:
--------------------------------------------------------------------------------
1 | package com.cug.intellM.jobManager.mongoDBJobManager;
2 |
3 | import com.cug.intellM.jobManager.plugin.JobManager;
4 |
5 | /**
6 | * Created by lyc on 2017/10/10.
7 | */
8 | public class MongoDBJobManager extends JobManager {
9 |
10 | public void prepare() {
11 | System.out.println("连接MongoDB数据库");
12 | }
13 |
14 | public void check() {
15 | System.out.println("检查MongoDB数据库表、字段,没有则创建");
16 | }
17 |
18 | public void transformRule() {
19 | System.out.println("将清洗条件转换为MongoDB");
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/mongoDBJobManager/src/main/java/com/cug/intellM/jobManager/mongoDBJobManager/MongoDBJobManager.java:
--------------------------------------------------------------------------------
1 | package com.cug.intellM.jobManager.mongoDBJobManager;
2 |
3 | import com.cug.intellM.jobManager.plugin.JobManager;
4 |
5 | /**
6 | * Created by lyc on 2017/10/10.
7 | */
8 | public class MongoDBJobManager extends JobManager {
9 |
10 | public void prepare() {
11 | System.out.println("连接MongoDB数据库");
12 | }
13 |
14 | public void check() {
15 | System.out.println("检查MongoDB数据库表、字段,没有则创建");
16 | }
17 |
18 | public void transformRule() {
19 | System.out.println("将清洗条件转换为MongoDB");
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_apache_commons_commons_lang3_3_4.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/mysqlJobManager/.svn/pristine/04/048de174ab400210db3d23a5df26f160d2728cfa.svn-base:
--------------------------------------------------------------------------------
1 | package com.cug.intellM.jobManager.mysqlJobManager;
2 |
3 | import com.cug.intellM.jobManager.plugin.JobManager;
4 |
5 | /**
6 | * Created by lyc on 2017/9/30.
7 | */
8 |
9 | //包外继承抽象类,抽象类的抽象方法必须声明为public,否则子类无法实现抽象方法
10 | public class MysqlJobManager extends JobManager{
11 |
12 | public void prepare(){
13 | System.out.println("连接Mysql数据库");
14 | }
15 |
16 | public void check(){
17 | System.out.println("检查Mysql数据库表、字段,没有则创建");
18 | }
19 |
20 | public void transformRule(){
21 | System.out.println("将清洗条件转换为sql");
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/mysqlJobManager/src/main/java/com/cug/intellM/jobManager/mysqlJobManager/MysqlJobManager.java:
--------------------------------------------------------------------------------
1 | package com.cug.intellM.jobManager.mysqlJobManager;
2 |
3 | import com.cug.intellM.jobManager.plugin.JobManager;
4 |
5 | /**
6 | * Created by lyc on 2017/9/30.
7 | */
8 |
9 | //包外继承抽象类,抽象类的抽象方法必须声明为public,否则子类无法实现抽象方法
10 | public class MysqlJobManager extends JobManager{
11 |
12 | public void prepare(){
13 | System.out.println("连接Mysql数据库");
14 | }
15 |
16 | public void check(){
17 | System.out.println("检查Mysql数据库表、字段,没有则创建");
18 | }
19 |
20 | public void transformRule(){
21 | System.out.println("将清洗条件转换为sql");
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 | com.cug.intellM.jobManager
8 | jobManager
9 | 1.0-SNAPSHOT
10 |
11 | jobManager-core
12 | mysqlJobManager
13 | mongoDBJobManager
14 |
15 | pom
16 |
17 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/.svn/pristine/1f/1fdfc96a9a9e36369b5aa86db820145500e04379.svn-base:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 | com.cug.intellM.jobManager
8 | jobManager
9 | 1.0-SNAPSHOT
10 |
11 | jobManager-core
12 | mysqlJobManager
13 | mongoDBJobManager
14 |
15 | pom
16 |
17 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Windows image file caches
2 | Thumbs.db
3 | ehthumbs.db
4 |
5 | # Folder config file
6 | Desktop.ini
7 |
8 | # Recycle Bin used on file shares
9 | $RECYCLE.BIN/
10 |
11 | # Windows Installer files
12 | *.cab
13 | *.msi
14 | *.msm
15 | *.msp
16 |
17 | # Windows shortcuts
18 | *.lnk
19 |
20 | # =========================
21 | # Operating System Files
22 | # =========================
23 |
24 | # OSX
25 | # =========================
26 |
27 | .DS_Store
28 | .AppleDouble
29 | .LSOverride
30 |
31 | # Thumbnails
32 | ._*
33 |
34 | # Files that might appear in the root of a volume
35 | .DocumentRevisions-V100
36 | .fseventsd
37 | .Spotlight-V100
38 | .TemporaryItems
39 | .Trashes
40 | .VolumeIcon.icns
41 |
42 | # Directories potentially created on remote AFP share
43 | .AppleDB
44 | .AppleDesktop
45 | Network Trash Folder
46 | Temporary Items
47 | .apdisk
48 |
--------------------------------------------------------------------------------
/mongoDBJobManager/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | jobManager
7 | com.cug.intellM.jobManager
8 | 1.0-SNAPSHOT
9 |
10 | 4.0.0
11 |
12 | mongoDBJobManager
13 |
14 |
15 | com.cug.intellM.jobManager
16 | jobManager-core
17 | 1.0-SNAPSHOT
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/mysqlJobManager/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | jobManager
7 | com.cug.intellM.jobManager
8 | 1.0-SNAPSHOT
9 |
10 | 4.0.0
11 |
12 | mysqlJobManager
13 | jar
14 |
15 |
16 |
17 | com.cug.intellM.jobManager
18 | jobManager-core
19 | ${project.version}
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/jobManager.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/mongoDBJobManager/.svn/pristine/5c/5ce20d09b5e93ee5f764ec5d7d732256acad5545.svn-base:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | jobManager
7 | com.cug.intellM.jobManager
8 | 1.0-SNAPSHOT
9 |
10 | 4.0.0
11 |
12 | mongoDBJobManager
13 |
14 |
15 | com.cug.intellM.jobManager
16 | jobManager-core
17 | 1.0-SNAPSHOT
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/mysqlJobManager/.svn/pristine/67/67ada89de2fbe97cce62befdd8a6dca271c52762.svn-base:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | jobManager
7 | com.cug.intellM.jobManager
8 | 1.0-SNAPSHOT
9 |
10 | 4.0.0
11 |
12 | mysqlJobManager
13 | jar
14 |
15 |
16 |
17 | com.cug.intellM.jobManager
18 | jobManager-core
19 | ${project.version}
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/jobManager-core/src/main/java/com/cug/intellM/jobManager/driver/CliDriver.java:
--------------------------------------------------------------------------------
1 | package com.cug.intellM.jobManager.driver;
2 |
3 | import com.cug.intellM.jobManager.core.PluginLoader;
4 | import com.cug.intellM.jobManager.plugin.JobManager;
5 | import com.cug.intellM.jobManager.util.PluginUtils;
6 |
7 | import java.net.MalformedURLException;
8 |
9 | /**
10 | * Created by lyc on 2017/9/30.
11 | * 程序入口
12 | */
13 | public class CliDriver {
14 |
15 | public static void main(String[] args) throws Exception {
16 |
17 | if (args.length < 1){
18 | System.out.println("缺少参数插件名称");
19 | System.exit(-1);
20 | }
21 |
22 | String pluginName = args[0];
23 | String pluginClassName = PluginLoader.getPluginClassName(pluginName);
24 |
25 | Class> cls = PluginUtils.loadClass(pluginName, pluginClassName);
26 |
27 | JobManager jobManager = (JobManager)cls.newInstance();
28 |
29 | jobManager.prepare();
30 | jobManager.check();
31 | jobManager.transformRule();
32 | }
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/jobManager-core/.svn/pristine/2b/2b0fb822118d590a8b17bd4cd7f3606364d106a6.svn-base:
--------------------------------------------------------------------------------
1 | package com.cug.intellM.jobManager.driver;
2 |
3 | import com.cug.intellM.jobManager.core.PluginLoader;
4 | import com.cug.intellM.jobManager.plugin.JobManager;
5 | import com.cug.intellM.jobManager.util.PluginUtils;
6 |
7 | import java.net.MalformedURLException;
8 |
9 | /**
10 | * Created by lyc on 2017/9/30.
11 | * 程序入口
12 | */
13 | public class CliDriver {
14 |
15 | public static void main(String[] args) throws Exception {
16 |
17 | if (args.length < 1){
18 | System.out.println("缺少参数插件名称");
19 | System.exit(-1);
20 | }
21 |
22 | String pluginName = args[0];
23 | String pluginClassName = PluginLoader.getPluginClassName(pluginName);
24 |
25 | Class> cls = PluginUtils.loadClass(pluginName, pluginClassName);
26 |
27 | JobManager jobManager = (JobManager)cls.newInstance();
28 |
29 | jobManager.prepare();
30 | jobManager.check();
31 | jobManager.transformRule();
32 | }
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/jobManager-core/jobManager-core.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/jobManager-core/.svn/pristine/63/639a0c57d90ac3bae8f3db2313fbef989a922ffd.svn-base:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/mongoDBJobManager/mongoDBJobManager.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/mongoDBJobManager/.svn/pristine/b5/b53bdd62f819d5499e0f30b9ed4a4e8db054f02b.svn-base:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/mysqlJobManager/mysqlJobManager.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/mysqlJobManager/.svn/pristine/3e/3e4617707662436bb79f3a58f09768e92012557f.svn-base:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/jobManager-core/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | jobManager
7 | com.cug.intellM.jobManager
8 | 1.0-SNAPSHOT
9 |
10 | 4.0.0
11 |
12 | jobManager-core
13 |
14 |
15 |
16 | org.apache.commons
17 | commons-lang3
18 | 3.4
19 |
20 |
21 |
22 | commons-io
23 | commons-io
24 | 2.4
25 |
26 |
27 |
28 | com.alibaba
29 | fastjson
30 | 1.2.38
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 | maven-assembly-plugin
39 |
40 |
41 | jar-with-dependencies
42 |
43 |
44 |
45 | com.cug.intellM.jobManager.driver.CliDriver
46 |
47 |
48 |
49 |
50 |
51 | make-assembly
52 | package
53 |
54 | single
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/jobManager-core/.svn/pristine/50/5096c57bcc1c112f04fd616820903e9b0090619b.svn-base:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | jobManager
7 | com.cug.intellM.jobManager
8 | 1.0-SNAPSHOT
9 |
10 | 4.0.0
11 |
12 | jobManager-core
13 |
14 |
15 |
16 | org.apache.commons
17 | commons-lang3
18 | 3.4
19 |
20 |
21 |
22 | commons-io
23 | commons-io
24 | 2.4
25 |
26 |
27 |
28 | com.alibaba
29 | fastjson
30 | 1.2.38
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 | maven-assembly-plugin
39 |
40 |
41 | jar-with-dependencies
42 |
43 |
44 |
45 | com.cug.intellM.jobManager.driver.CliDriver
46 |
47 |
48 |
49 |
50 |
51 | make-assembly
52 | package
53 |
54 | single
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/jobManager-core/.svn/pristine/b1/b1e21ca54d7a8a5666a35e35aaf6bf8d917c0a7c.svn-base:
--------------------------------------------------------------------------------
1 | package com.cug.intellM.jobManager.core;
2 |
3 | import com.alibaba.fastjson.JSONArray;
4 | import com.alibaba.fastjson.JSONObject;
5 | import com.cug.intellM.jobManager.util.Configuration;
6 |
7 | import java.io.File;
8 | import java.io.UnsupportedEncodingException;
9 | import java.net.URLDecoder;
10 | import java.util.HashMap;
11 | import java.util.Map;
12 |
13 | /**
14 | * Created by lyc on 2017/9/30.
15 | */
16 |
17 | //读取配置文件,加载插件配置信息
18 | public class PluginLoader {
19 |
20 | public static final String PLUGIN_JSON = "core.json";
21 | //public static final String FILE_SEPARATOR = File.separator;
22 | private static Map pluginMap;
23 |
24 | public static String getPluginClassName(String name){
25 | if (!pluginMap.containsKey(name)){
26 | throw new RuntimeException("该插件不存在,请仔细核对插件配置文件");
27 | }
28 | return pluginMap.get(name);
29 | }
30 |
31 | static {
32 | pluginMap = new HashMap();
33 | String confPath = getConfPath();
34 | File coreFile = new File(confPath);
35 | Configuration conf = Configuration.from(coreFile);
36 | JSONArray ls = (JSONArray)conf.get("plugins");
37 | //将所有的插件信息存入pluginMap中
38 | for (Object o : ls){
39 | JSONObject json = (JSONObject)o;
40 | String pluginName = json.getString("pluginName");
41 | String pluginClass = json.getString("pluginClass");
42 | pluginMap.put(pluginName, pluginClass);
43 | }
44 | System.out.println(conf.get("plugins"));
45 | }
46 |
47 | //得到插件的配置文件完整的路径
48 | private static String getConfPath(){
49 | String dir = PluginLoader.class.getProtectionDomain().getCodeSource().getLocation().getPath();
50 | try {
51 | dir=URLDecoder.decode(dir,"utf-8");//转化成utf-8编码
52 | } catch (UnsupportedEncodingException e) {
53 | // TODO Auto-generated catch block
54 | e.printStackTrace();
55 | }
56 |
57 | int num;
58 | //通过jar运行时路径的路径处理
59 | if ("jar".equals(dir.substring(dir.length()-3))){
60 | num = 2;
61 | }else{
62 | num = 3;
63 | }
64 | for (int i=0; i < num; i++){
65 | dir = dir.substring(0,dir.lastIndexOf('/'));
66 | }
67 |
68 | System.out.println(dir+"/"+"src"+"/"+"main"+"/"+"conf");
69 | String confDir = dir+"/"+"src/"+"main/"+"conf/" + "/" + PLUGIN_JSON;
70 | return confDir;
71 | }
72 |
73 | }
74 |
--------------------------------------------------------------------------------
/jobManager-core/src/main/java/com/cug/intellM/jobManager/core/PluginLoader.java:
--------------------------------------------------------------------------------
1 | package com.cug.intellM.jobManager.core;
2 |
3 | import com.alibaba.fastjson.JSONArray;
4 | import com.alibaba.fastjson.JSONObject;
5 | import com.cug.intellM.jobManager.util.Configuration;
6 |
7 | import java.io.File;
8 | import java.io.UnsupportedEncodingException;
9 | import java.net.URLDecoder;
10 | import java.util.HashMap;
11 | import java.util.Map;
12 |
13 | /**
14 | * Created by lyc on 2017/9/30.
15 | */
16 |
17 | //读取配置文件,加载插件配置信息
18 | public class PluginLoader {
19 |
20 | public static final String PLUGIN_JSON = "core.json";
21 | //public static final String FILE_SEPARATOR = File.separator;
22 | private static Map pluginMap;
23 |
24 | public static String getPluginClassName(String name){
25 | if (!pluginMap.containsKey(name)){
26 | throw new RuntimeException("该插件不存在,请仔细核对插件配置文件");
27 | }
28 | return pluginMap.get(name);
29 | }
30 |
31 | static {
32 | pluginMap = new HashMap();
33 | String confPath = getConfPath();
34 | File coreFile = new File(confPath);
35 | Configuration conf = Configuration.from(coreFile);
36 | JSONArray ls = (JSONArray)conf.get("plugins");
37 | //将所有的插件信息存入pluginMap中
38 | for (Object o : ls){
39 | JSONObject json = (JSONObject)o;
40 | String pluginName = json.getString("pluginName");
41 | String pluginClass = json.getString("pluginClass");
42 | pluginMap.put(pluginName, pluginClass);
43 | }
44 | System.out.println(conf.get("plugins"));
45 | }
46 |
47 | //得到插件的配置文件完整的路径
48 | private static String getConfPath(){
49 | String dir = PluginLoader.class.getProtectionDomain().getCodeSource().getLocation().getPath();
50 | try {
51 | dir=URLDecoder.decode(dir,"utf-8");//转化成utf-8编码
52 | } catch (UnsupportedEncodingException e) {
53 | // TODO Auto-generated catch block
54 | e.printStackTrace();
55 | }
56 |
57 | int num;
58 | //通过jar运行时路径的路径处理
59 | if ("jar".equals(dir.substring(dir.length()-3))){
60 | num = 2;
61 | }else{
62 | num = 3;
63 | }
64 | for (int i=0; i < num; i++){
65 | dir = dir.substring(0,dir.lastIndexOf('/'));
66 | }
67 |
68 | System.out.println(dir+"/"+"src"+"/"+"main"+"/"+"conf");
69 | String confDir = dir+"/"+"src/"+"main/"+"conf/" + "/" + PLUGIN_JSON;
70 | return confDir;
71 | }
72 |
73 | }
74 |
--------------------------------------------------------------------------------
/jobManager-core/src/main/java/com/cug/intellM/jobManager/util/PluginUtils.java:
--------------------------------------------------------------------------------
1 | package com.cug.intellM.jobManager.util;
2 |
3 | import com.cug.intellM.jobManager.core.PluginLoader;
4 |
5 | import java.io.File;
6 | import java.io.UnsupportedEncodingException;
7 | import java.lang.reflect.Method;
8 | import java.net.URL;
9 | import java.net.URLClassLoader;
10 | import java.net.URLDecoder;
11 | import java.net.MalformedURLException;
12 | import java.util.Map;
13 | import java.util.concurrent.ConcurrentHashMap;
14 |
15 |
16 | /**
17 | * Created by lyc on 2017/9/30.
18 | * 根据插件信息,通过反射得到插件类的对象
19 | */
20 | public class PluginUtils {
21 |
22 | //线程安全的hashMap
23 | private static Map cache = new ConcurrentHashMap();
24 |
25 | //通过插件名称得到该插件的jar的URL
26 | private static URL listFileByPluginName(String pluginName) throws MalformedURLException {
27 |
28 | String dir = PluginLoader.class.getProtectionDomain().getCodeSource().getLocation().getPath();
29 | try {
30 | dir= URLDecoder.decode(dir,"utf-8");//转化成utf-8编码
31 | } catch (UnsupportedEncodingException e) {
32 | // TODO Auto-generated catch block
33 | e.printStackTrace();
34 | }
35 | int num;
36 | //通过jar运行时路径的路径处理
37 | if ("jar".equals(dir.substring(dir.length()-3))){
38 | num = 2;
39 | }else{
40 | num = 3;
41 | }
42 | for (int i=0; i < num; i++){
43 | dir = dir.substring(0,dir.lastIndexOf('/'));
44 | }
45 | String confDir = dir+"/"+"src/"+"main/"+"pluginLib/" + "/" + pluginName + ".jar";
46 | File jar = new File(confDir);
47 | if (!jar.exists()) {
48 | throw new RuntimeException("Plugin not found: " + pluginName);
49 | }
50 | URL url = jar.toURI().toURL();
51 | return url;
52 | }
53 |
54 | //通过插件名称和类名反射得到java类加载器
55 | public static Class> loadClass(String pluginName, String className) throws ClassNotFoundException, MalformedURLException {
56 | URL url = listFileByPluginName(pluginName);
57 | ClassLoader classLoader = cache.get(pluginName);
58 | if (classLoader == null) {
59 | classLoader = new URLClassLoader(new URL[]{url});
60 | cache.put(pluginName, classLoader);
61 | }
62 | return classLoader.loadClass(className);
63 | }
64 |
65 | public static Class> loadClass2(String pluginName, String className) throws Exception {
66 | URL url = listFileByPluginName(pluginName);
67 |
68 | //得到系统类加载器
69 | URLClassLoader urlClassLoader= (URLClassLoader) ClassLoader.getSystemClassLoader();
70 | //因为URLClassLoader中的addURL方法的权限为protected所以只能采用反射的方法调用addURL方法
71 | Method add = URLClassLoader.class.getDeclaredMethod("addURL", new Class[] { URL.class });
72 | add.setAccessible(true);
73 | add.invoke(urlClassLoader, new Object[] {url});
74 | Class c =Class.forName(className);
75 | return c;
76 | }
77 |
78 | public static void main(String [] args)throws ClassNotFoundException, MalformedURLException{
79 | listFileByPluginName("mysqlJobManager");
80 |
81 | }
82 |
83 |
84 | }
85 |
--------------------------------------------------------------------------------
/jobManager-core/.svn/pristine/00/008d7529df3da45a3254d6e9ad8e020ed0ffe186.svn-base:
--------------------------------------------------------------------------------
1 | package com.cug.intellM.jobManager.util;
2 |
3 | import com.cug.intellM.jobManager.core.PluginLoader;
4 |
5 | import java.io.File;
6 | import java.io.UnsupportedEncodingException;
7 | import java.lang.reflect.Method;
8 | import java.net.URL;
9 | import java.net.URLClassLoader;
10 | import java.net.URLDecoder;
11 | import java.net.MalformedURLException;
12 | import java.util.Map;
13 | import java.util.concurrent.ConcurrentHashMap;
14 |
15 |
16 | /**
17 | * Created by lyc on 2017/9/30.
18 | * 根据插件信息,通过反射得到插件类的对象
19 | */
20 | public class PluginUtils {
21 |
22 | //线程安全的hashMap
23 | private static Map cache = new ConcurrentHashMap();
24 |
25 | //通过插件名称得到该插件的jar的URL
26 | private static URL listFileByPluginName(String pluginName) throws MalformedURLException {
27 |
28 | String dir = PluginLoader.class.getProtectionDomain().getCodeSource().getLocation().getPath();
29 | try {
30 | dir= URLDecoder.decode(dir,"utf-8");//转化成utf-8编码
31 | } catch (UnsupportedEncodingException e) {
32 | // TODO Auto-generated catch block
33 | e.printStackTrace();
34 | }
35 | int num;
36 | //通过jar运行时路径的路径处理
37 | if ("jar".equals(dir.substring(dir.length()-3))){
38 | num = 2;
39 | }else{
40 | num = 3;
41 | }
42 | for (int i=0; i < num; i++){
43 | dir = dir.substring(0,dir.lastIndexOf('/'));
44 | }
45 | String confDir = dir+"/"+"src/"+"main/"+"pluginLib/" + "/" + pluginName + ".jar";
46 | File jar = new File(confDir);
47 | if (!jar.exists()) {
48 | throw new RuntimeException("Plugin not found: " + pluginName);
49 | }
50 | URL url = jar.toURI().toURL();
51 | return url;
52 | }
53 |
54 | //通过插件名称和类名反射得到java类加载器
55 | public static Class> loadClass(String pluginName, String className) throws ClassNotFoundException, MalformedURLException {
56 | URL url = listFileByPluginName(pluginName);
57 | ClassLoader classLoader = cache.get(pluginName);
58 | if (classLoader == null) {
59 | classLoader = new URLClassLoader(new URL[]{url});
60 | cache.put(pluginName, classLoader);
61 | }
62 | return classLoader.loadClass(className);
63 | }
64 |
65 | public static Class> loadClass2(String pluginName, String className) throws Exception {
66 | URL url = listFileByPluginName(pluginName);
67 |
68 | //得到系统类加载器
69 | URLClassLoader urlClassLoader= (URLClassLoader) ClassLoader.getSystemClassLoader();
70 | //因为URLClassLoader中的addURL方法的权限为protected所以只能采用反射的方法调用addURL方法
71 | Method add = URLClassLoader.class.getDeclaredMethod("addURL", new Class[] { URL.class });
72 | add.setAccessible(true);
73 | add.invoke(urlClassLoader, new Object[] {url});
74 | Class c =Class.forName(className);
75 | return c;
76 | }
77 |
78 | public static void main(String [] args)throws ClassNotFoundException, MalformedURLException{
79 | listFileByPluginName("mysqlJobManager");
80 |
81 | }
82 |
83 |
84 | }
85 |
--------------------------------------------------------------------------------
/jobManager-core/src/main/java/com/cug/intellM/jobManager/util/Configuration.java:
--------------------------------------------------------------------------------
1 | package com.cug.intellM.jobManager.util;
2 |
3 | import org.apache.commons.lang3.StringUtils;
4 |
5 | import java.io.File;
6 | import java.io.FileInputStream;
7 | import java.io.FileNotFoundException;
8 | import java.io.IOException;
9 | import java.util.Arrays;
10 | import java.util.HashMap;
11 | import java.util.List;
12 | import java.util.Map;
13 | import java.util.regex.Matcher;
14 | import java.util.regex.Pattern;
15 |
16 | import org.apache.commons.io.IOUtils;
17 | import com.alibaba.fastjson.JSON;
18 |
19 | /**
20 | * Created by lyc on 2017/10/9.
21 | *Configuration 提供多级JSON配置信息无损存储
22 | */
23 | public class Configuration {
24 |
25 | private static final Pattern VARIABLE_PATTERN = Pattern
26 | .compile("(\\$)\\{?(\\w+)\\}?");
27 | private Object root = null;
28 |
29 | /**
30 | * 从JSON字符串加载Configuration
31 | */
32 | public static Configuration from(String json) {
33 | json = replaceVariable(json);
34 | checkJSON(json);
35 |
36 | try {
37 | return new Configuration(json);
38 | } catch (Exception e) {
39 | throw new RuntimeException(e);
40 | }
41 |
42 | }
43 |
44 | /**
45 | * 从包括json的File对象加载Configuration
46 | */
47 | public static Configuration from(File file) {
48 | try {
49 | return Configuration.from(IOUtils.toString(new FileInputStream(file)));
50 | } catch (FileNotFoundException e) {
51 | throw new RuntimeException(
52 | String.format("配置信息错误,您提供的配置文件[%s]不存在. 请检查您的配置文件.", file.getAbsolutePath()));
53 | } catch (IOException e) {
54 | throw new RuntimeException(
55 | String.format("配置信息错误. 您提供配置文件[%s]读取失败,错误原因: %s. 请检查您的配置文件的权限设置.",
56 | file.getAbsolutePath(), e));
57 | }
58 | }
59 |
60 | private void checkPath(final String path) {
61 | if (null == path) {
62 | throw new IllegalArgumentException(
63 | "系统编程错误, 该异常代表系统编程错误, 请联系开发团队!.");
64 | }
65 |
66 | for (final String each : StringUtils.split(".")) {
67 | if (StringUtils.isBlank(each)) {
68 | throw new IllegalArgumentException(String.format(
69 | "系统编程错误, 路径[%s]不合法, 路径层次之间不能出现空白字符 .", path));
70 | }
71 | }
72 | }
73 |
74 | private static void checkJSON(final String json) {
75 | if (StringUtils.isBlank(json)) {
76 | throw new RuntimeException(
77 | "配置信息错误. 因为您提供的配置信息不是合法的JSON格式, JSON不能为空白. 请按照标准json格式提供配置信息. ");
78 | }
79 | }
80 |
81 | public static String replaceVariable(final String param) {
82 | Map mapping = new HashMap();
83 |
84 | Matcher matcher = VARIABLE_PATTERN.matcher(param);
85 | while (matcher.find()) {
86 | String variable = matcher.group(2);
87 | String value = System.getProperty(variable);
88 | if (StringUtils.isBlank(value)) {
89 | value = matcher.group();
90 | }
91 | mapping.put(matcher.group(), value);
92 | }
93 |
94 | String retString = param;
95 | for (final String key : mapping.keySet()) {
96 | retString = retString.replace(key, mapping.get(key));
97 | }
98 |
99 | return retString;
100 | }
101 |
102 | private Configuration(final String json) {
103 | try {
104 | this.root = JSON.parse(json);
105 | } catch (Exception e) {
106 | throw new RuntimeException(
107 | String.format("配置信息错误. 您提供的配置信息不是合法的JSON格式: %s . 请按照标准json格式提供配置信息. ", e.getMessage()));
108 | }
109 | }
110 |
111 | /**
112 | * 根据用户提供的json path,寻址具体的对象。
113 | *
114 | *
115 | *
116 | * NOTE: 目前仅支持Map以及List下标寻址, 例如:
117 | *
118 | *
119 | *
120 | * 对于如下JSON
121 | *
122 | * {"a": {"b": {"c": [0,1,2,3]}}}
123 | *
124 | * config.get("") 返回整个Map
125 | * config.get("a") 返回a下属整个Map
126 | * config.get("a.b.c") 返回c对应的数组List
127 | * config.get("a.b.c[0]") 返回数字0
128 | *
129 | * @return Java表示的JSON对象,如果path不存在或者对象不存在,均返回null。
130 | */
131 | public Object get(final String path) {
132 | this.checkPath(path);
133 | try {
134 | return this.findObject(path);
135 | } catch (Exception e) {
136 | return null;
137 | }
138 | }
139 |
140 | private Object findObject(final String path) {
141 | boolean isRootQuery = StringUtils.isBlank(path);
142 | if (isRootQuery) {
143 | return this.root;
144 | }
145 |
146 | Object target = this.root;
147 |
148 | for (final String each : split2List(path)) {
149 | if (isPathMap(each)) {
150 | target = findObjectInMap(target, each);
151 | continue;
152 | } else {
153 | target = findObjectInList(target, each);
154 | continue;
155 | }
156 | }
157 |
158 | return target;
159 | }
160 |
161 | private Object findObjectInMap(final Object target, final String index) {
162 | boolean isMap = (target instanceof Map);
163 | if (!isMap) {
164 | throw new IllegalArgumentException(String.format(
165 | "您提供的配置文件有误. 路径[%s]需要配置Json格式的Map对象,但该节点发现实际类型是[%s]. 请检查您的配置并作出修改.",
166 | index, target.getClass().toString()));
167 | }
168 |
169 | Object result = ((Map) target).get(index);
170 | if (null == result) {
171 | throw new IllegalArgumentException(String.format(
172 | "您提供的配置文件有误. 路径[%s]值为null,datax无法识别该配置. 请检查您的配置并作出修改.", index));
173 | }
174 |
175 | return result;
176 | }
177 |
178 | private Object findObjectInList(final Object target, final String each) {
179 | boolean isList = (target instanceof List);
180 | if (!isList) {
181 | throw new IllegalArgumentException(String.format(
182 | "您提供的配置文件有误. 路径[%s]需要配置Json格式的Map对象,但该节点发现实际类型是[%s]. 请检查您的配置并作出修改.",
183 | each, target.getClass().toString()));
184 | }
185 |
186 | String index = each.replace("[", "").replace("]", "");
187 | if (!StringUtils.isNumeric(index)) {
188 | throw new IllegalArgumentException(
189 | String.format(
190 | "系统编程错误,列表下标必须为数字类型,但该节点发现实际类型是[%s] ,该异常代表系统编程错误, 请联系DataX开发团队 !",
191 | index));
192 | }
193 |
194 | return ((List