├── docs ├── arch_design.md ├── imgs │ ├── tac1.png │ ├── pre-test.png │ ├── tac1-en.png │ ├── tac-gitlab1.png │ ├── tac-gitlab2.png │ ├── tac-gitlab3.png │ ├── tac-package.png │ ├── pre-test-custom-datasource.png │ └── sourcestart │ │ ├── 1527213111970-6a1b5031-63ef-4082-b602-4493555a40e8.png │ │ ├── 1527213201547-8d16dd54-d32a-4cd9-927a-4ceb509773a6.png │ │ ├── 1527213265713-e0e7611f-b1c2-43bd-8cf5-31dd0d9e9cc6.png │ │ ├── 1527213324287-63726690-1df1-45fb-afc6-e931784855d1.png │ │ ├── 1527213524357-bae645a8-d865-472d-a89d-c6660aeade07.png │ │ ├── 1527213630237-809d5801-c137-4e53-8709-3d4e772406df.png │ │ ├── 1527213761239-b3548ce2-6f0d-406d-af8b-1efaf688a45d.png │ │ ├── 1527908670979-41bc49e4-bee3-422b-9898-0089dfc9e3b8.png │ │ ├── 1527908958075-f5f22b21-87c0-4850-ac9e-2d48b6f8f4ca.png │ │ ├── 1527909372611-d351cd8b-2429-4d3f-8ea9-e2dd1e172759.png │ │ ├── 1527909790663-00749a83-9d99-43a1-a08c-3e2df8060507.png │ │ ├── 1527909925642-7c07329e-2a63-436e-8403-5a1bc87639a3.png │ │ ├── 1527910365188-43a1a4c3-fb9b-4fa5-bbbb-3f7f514fc1b9.png │ │ └── 1527910444921-c5c32034-e174-431a-b7c8-59077c11577b.png ├── gitlab.md ├── configs.md └── ide_source_start.md ├── tac-console-web ├── static │ ├── .gitkeep │ └── main.css ├── .eslintignore ├── config │ ├── prod.env.js │ ├── dev.env.js │ └── index.js ├── src │ ├── assets │ │ └── logo.png │ ├── components │ │ ├── TacMs.vue │ │ ├── Home.vue │ │ ├── TacInst.vue │ │ ├── TacJSONEditor.vue │ │ ├── Hello.vue │ │ ├── TacConsole.vue │ │ └── TacMsList.vue │ ├── App.vue │ ├── main.js │ └── router │ │ └── index.js ├── .editorconfig ├── .gitignore ├── .postcssrc.js ├── build │ ├── dev-client.js │ ├── vue-loader.conf.js │ ├── build.js │ ├── webpack.dev.conf.js │ ├── check-versions.js │ ├── webpack.base.conf.js │ ├── utils.js │ └── dev-server.js ├── index.html ├── .babelrc ├── .eslintrc.js ├── README.md └── package.json ├── tac-console └── src │ ├── main │ ├── resources │ │ ├── tac-console.properties │ │ ├── static │ │ │ ├── main.css │ │ │ └── js │ │ │ │ └── manifest.58ce01f7a6fd036b4f8d.js │ │ ├── application-admin.properties │ │ ├── application-simple.properties │ │ ├── templates │ │ │ └── index.html │ │ └── application.properties │ └── java │ │ └── com │ │ └── alibaba │ │ └── tac │ │ └── console │ │ ├── error │ │ ├── IErrorCode.java │ │ └── ConsoleError.java │ │ ├── web │ │ ├── ro │ │ │ └── InstTestRO.java │ │ ├── HomeController.java │ │ └── InstFileRO.java │ │ ├── TacApplicationContext.java │ │ ├── ConsoleConstants.java │ │ └── ConsoleBeanConfig.java │ └── test │ └── java │ └── com │ └── alibaba │ └── tac │ └── console │ ├── test │ ├── TacConsoleTest.java │ └── TestApplication.java │ └── MenuOptionHandlerTest.java ├── override.properties ├── tac-engine ├── src │ ├── test │ │ ├── resources │ │ │ └── test.properties │ │ ├── java │ │ │ └── com │ │ │ │ └── alibaba │ │ │ │ └── tac │ │ │ │ ├── test │ │ │ │ ├── redis │ │ │ │ │ ├── TacRedisMessageListener.java │ │ │ │ │ └── RedisConfig.java │ │ │ │ └── http │ │ │ │ │ └── HttpClientTest.java │ │ │ │ └── engine │ │ │ │ ├── test │ │ │ │ ├── TestApplication.java │ │ │ │ └── TacEnginTest.java │ │ │ │ ├── utils │ │ │ │ └── TacFileUtilTest.java │ │ │ │ ├── service │ │ │ │ ├── TacInstanceLoadServiceTest.java │ │ │ │ ├── JdkCompilerTest.java │ │ │ │ └── GitLabFeatureTest.java │ │ │ │ ├── common │ │ │ │ └── redis │ │ │ │ │ └── RedisSequenceCounterTest.java │ │ │ │ ├── inst │ │ │ │ └── service │ │ │ │ │ └── redis │ │ │ │ │ ├── RedisMsInstFileServiceTest.java │ │ │ │ │ └── RedisMsInstServiceTest.java │ │ │ │ └── ms │ │ │ │ └── service │ │ │ │ └── redis │ │ │ │ ├── RedisMsPublisherTest.java │ │ │ │ └── RedisMsServiceTest.java │ │ └── source │ │ │ └── test1 │ │ │ └── com │ │ │ └── alibaba │ │ │ └── tac │ │ │ └── biz │ │ │ └── processor │ │ │ └── HelloTac.java │ └── main │ │ ├── resources │ │ └── META-INF │ │ │ └── spring.factories │ │ └── java │ │ └── com │ │ └── alibaba │ │ └── tac │ │ └── engine │ │ ├── properties │ │ ├── TacGitlabProperties.java │ │ ├── TacMsConstants.java │ │ ├── TacRedisConfigProperties.java │ │ └── TacDataPathProperties.java │ │ ├── util │ │ ├── HConstants.java │ │ ├── IterableUtils.java │ │ ├── ThreadPoolUtils.java │ │ └── TacLogUtils.java │ │ ├── ms │ │ ├── service │ │ │ ├── IMsSubscriber.java │ │ │ ├── AbstractDefaultMsPublisher.java │ │ │ └── IMsService.java │ │ └── domain │ │ │ ├── TacMsStatus.java │ │ │ ├── TacMs.java │ │ │ ├── TacMsDO.java │ │ │ └── TacMsPublishMeta.java │ │ ├── common │ │ ├── TacIDGenerator.java │ │ ├── DefaultTacIDGenerator.java │ │ └── SequenceCounter.java │ │ ├── event │ │ └── domain │ │ │ ├── MsPublishEvent.java │ │ │ ├── GetAllMsEvent.java │ │ │ ├── MsOfflineEvent.java │ │ │ ├── MsReceivePublishEvent.java │ │ │ └── AbstractMsEvent.java │ │ ├── service │ │ ├── TacEngineService.java │ │ └── EngineBeansConfig.java │ │ ├── inst │ │ ├── domain │ │ │ ├── TacInstStatus.java │ │ │ ├── TacInstanceInfo.java │ │ │ └── TacInst.java │ │ └── service │ │ │ └── IMsInstFileService.java │ │ ├── compile │ │ ├── InstCodeInfo.java │ │ ├── TacJavaFileObject.java │ │ ├── JavaSourceCode.java │ │ └── IJdkCompiler.java │ │ ├── autoconfigure │ │ └── TacAutoConfiguration.java │ │ └── code │ │ └── SpringClassLoader.java ├── extendlibs │ ├── gson-2.8.2.jar │ └── tac-dev-source-0.0.1-SNAPSHOT.jar └── pom.xml ├── extendlibs └── tac-custom-datasource-demo-0.0.4-SNAPSHOT.jar ├── tac-sdk └── src │ └── main │ └── java │ └── com │ └── alibaba │ └── tac │ └── sdk │ ├── tangram4tac │ ├── render │ │ └── IRender.java │ ├── lib │ │ ├── FloatContainer.java │ │ ├── ScrollFixContainer.java │ │ ├── StickyContainer.java │ │ ├── FixContainer.java │ │ ├── ScrollFixBannerContainer.java │ │ ├── FlowContainer.java │ │ ├── ScrollContainer.java │ │ ├── WaterFallContainer.java │ │ ├── FiveColumnContainer.java │ │ ├── FourColumnContainer.java │ │ ├── OneColumnContainer.java │ │ ├── OnePlusNContainer.java │ │ ├── OnePlusNStyle.java │ │ ├── TwoColumnContainer.java │ │ ├── BannerContainer.java │ │ ├── ThreeColumnContainer.java │ │ ├── StickyStyle.java │ │ ├── FixStyle.java │ │ ├── WaterFallStyle.java │ │ ├── FlowStyle.java │ │ ├── CellType.java │ │ ├── OneChildContainer.java │ │ └── ScrollStyle.java │ ├── FieldExcluder.java │ ├── FieldNameMapper.java │ ├── utils │ │ └── Pair.java │ └── Cell.java │ ├── handler │ ├── DisposableHandler.java │ ├── InitializingHandler.java │ └── TacHandler.java │ ├── error │ ├── IError.java │ ├── ErrorCode.java │ └── ServiceException.java │ ├── factory │ ├── TacInfrasFactory.java │ └── AbstractServiceFactory.java │ ├── common │ ├── TacThreadLocals.java │ ├── TacContants.java │ └── TacParams.java │ ├── infrastracture │ └── TacLogger.java │ ├── domain │ ├── Context.java │ └── TacRequestContext.java │ └── utils │ └── TacIPUtils.java ├── .gitignore ├── tac-container └── src │ └── main │ ├── resources │ └── application.properties │ └── java │ └── com │ └── alibaba │ └── tac │ └── container │ └── ContainerBeanConfig.java ├── tac-custom-datasource-demo ├── src │ ├── main │ │ └── java │ │ │ └── com │ │ │ └── tmall │ │ │ └── itemcenter │ │ │ ├── TmallItemService.java │ │ │ └── ItemDO.java │ └── test │ │ └── java │ │ └── com │ │ └── alibaba │ │ └── tac │ │ └── AppTest.java └── pom.xml ├── tac-infrastructure └── src │ ├── main │ └── java │ │ └── com │ │ └── alibaba │ │ └── tac │ │ └── infrastracture │ │ └── logger │ │ └── TacLogConsts.java │ └── test │ └── java │ └── com │ └── alibaba │ └── tac │ └── AppTest.java ├── LICENSE └── tac-dev-source-demo ├── src └── main │ └── java │ └── com │ └── alibaba │ └── tac │ └── biz │ └── processor │ └── HelloWorldTac.java └── pom.xml /docs/arch_design.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tac-console-web/static/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tac-console-web/.eslintignore: -------------------------------------------------------------------------------- 1 | build/*.js 2 | config/*.js 3 | -------------------------------------------------------------------------------- /tac-console/src/main/resources/tac-console.properties: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /override.properties: -------------------------------------------------------------------------------- 1 | 2 | 3 | scan.package.name=com.tmall.itemcenter -------------------------------------------------------------------------------- /docs/imgs/tac1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alibaba/tac/HEAD/docs/imgs/tac1.png -------------------------------------------------------------------------------- /tac-console-web/static/main.css: -------------------------------------------------------------------------------- 1 | .spanButton { 2 | margin-left: 10px; 3 | } 4 | -------------------------------------------------------------------------------- /docs/imgs/pre-test.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alibaba/tac/HEAD/docs/imgs/pre-test.png -------------------------------------------------------------------------------- /docs/imgs/tac1-en.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alibaba/tac/HEAD/docs/imgs/tac1-en.png -------------------------------------------------------------------------------- /tac-engine/src/test/resources/test.properties: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | tac.default.store=redis -------------------------------------------------------------------------------- /docs/imgs/tac-gitlab1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alibaba/tac/HEAD/docs/imgs/tac-gitlab1.png -------------------------------------------------------------------------------- /docs/imgs/tac-gitlab2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alibaba/tac/HEAD/docs/imgs/tac-gitlab2.png -------------------------------------------------------------------------------- /docs/imgs/tac-gitlab3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alibaba/tac/HEAD/docs/imgs/tac-gitlab3.png -------------------------------------------------------------------------------- /docs/imgs/tac-package.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alibaba/tac/HEAD/docs/imgs/tac-package.png -------------------------------------------------------------------------------- /tac-console-web/config/prod.env.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | NODE_ENV: '"production"' 3 | } 4 | -------------------------------------------------------------------------------- /tac-console/src/main/resources/static/main.css: -------------------------------------------------------------------------------- 1 | .spanButton { 2 | margin-left: 10px; 3 | } 4 | -------------------------------------------------------------------------------- /tac-console-web/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alibaba/tac/HEAD/tac-console-web/src/assets/logo.png -------------------------------------------------------------------------------- /tac-engine/extendlibs/gson-2.8.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alibaba/tac/HEAD/tac-engine/extendlibs/gson-2.8.2.jar -------------------------------------------------------------------------------- /docs/imgs/pre-test-custom-datasource.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alibaba/tac/HEAD/docs/imgs/pre-test-custom-datasource.png -------------------------------------------------------------------------------- /tac-engine/extendlibs/tac-dev-source-0.0.1-SNAPSHOT.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alibaba/tac/HEAD/tac-engine/extendlibs/tac-dev-source-0.0.1-SNAPSHOT.jar -------------------------------------------------------------------------------- /extendlibs/tac-custom-datasource-demo-0.0.4-SNAPSHOT.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alibaba/tac/HEAD/extendlibs/tac-custom-datasource-demo-0.0.4-SNAPSHOT.jar -------------------------------------------------------------------------------- /tac-console-web/config/dev.env.js: -------------------------------------------------------------------------------- 1 | var merge = require('webpack-merge') 2 | var prodEnv = require('./prod.env') 3 | 4 | module.exports = merge(prodEnv, { 5 | NODE_ENV: '"development"' 6 | }) 7 | -------------------------------------------------------------------------------- /docs/imgs/sourcestart/1527213111970-6a1b5031-63ef-4082-b602-4493555a40e8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alibaba/tac/HEAD/docs/imgs/sourcestart/1527213111970-6a1b5031-63ef-4082-b602-4493555a40e8.png -------------------------------------------------------------------------------- /docs/imgs/sourcestart/1527213201547-8d16dd54-d32a-4cd9-927a-4ceb509773a6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alibaba/tac/HEAD/docs/imgs/sourcestart/1527213201547-8d16dd54-d32a-4cd9-927a-4ceb509773a6.png -------------------------------------------------------------------------------- /docs/imgs/sourcestart/1527213265713-e0e7611f-b1c2-43bd-8cf5-31dd0d9e9cc6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alibaba/tac/HEAD/docs/imgs/sourcestart/1527213265713-e0e7611f-b1c2-43bd-8cf5-31dd0d9e9cc6.png -------------------------------------------------------------------------------- /docs/imgs/sourcestart/1527213324287-63726690-1df1-45fb-afc6-e931784855d1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alibaba/tac/HEAD/docs/imgs/sourcestart/1527213324287-63726690-1df1-45fb-afc6-e931784855d1.png -------------------------------------------------------------------------------- /docs/imgs/sourcestart/1527213524357-bae645a8-d865-472d-a89d-c6660aeade07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alibaba/tac/HEAD/docs/imgs/sourcestart/1527213524357-bae645a8-d865-472d-a89d-c6660aeade07.png -------------------------------------------------------------------------------- /docs/imgs/sourcestart/1527213630237-809d5801-c137-4e53-8709-3d4e772406df.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alibaba/tac/HEAD/docs/imgs/sourcestart/1527213630237-809d5801-c137-4e53-8709-3d4e772406df.png -------------------------------------------------------------------------------- /docs/imgs/sourcestart/1527213761239-b3548ce2-6f0d-406d-af8b-1efaf688a45d.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alibaba/tac/HEAD/docs/imgs/sourcestart/1527213761239-b3548ce2-6f0d-406d-af8b-1efaf688a45d.png -------------------------------------------------------------------------------- /docs/imgs/sourcestart/1527908670979-41bc49e4-bee3-422b-9898-0089dfc9e3b8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alibaba/tac/HEAD/docs/imgs/sourcestart/1527908670979-41bc49e4-bee3-422b-9898-0089dfc9e3b8.png -------------------------------------------------------------------------------- /docs/imgs/sourcestart/1527908958075-f5f22b21-87c0-4850-ac9e-2d48b6f8f4ca.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alibaba/tac/HEAD/docs/imgs/sourcestart/1527908958075-f5f22b21-87c0-4850-ac9e-2d48b6f8f4ca.png -------------------------------------------------------------------------------- /docs/imgs/sourcestart/1527909372611-d351cd8b-2429-4d3f-8ea9-e2dd1e172759.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alibaba/tac/HEAD/docs/imgs/sourcestart/1527909372611-d351cd8b-2429-4d3f-8ea9-e2dd1e172759.png -------------------------------------------------------------------------------- /docs/imgs/sourcestart/1527909790663-00749a83-9d99-43a1-a08c-3e2df8060507.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alibaba/tac/HEAD/docs/imgs/sourcestart/1527909790663-00749a83-9d99-43a1-a08c-3e2df8060507.png -------------------------------------------------------------------------------- /docs/imgs/sourcestart/1527909925642-7c07329e-2a63-436e-8403-5a1bc87639a3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alibaba/tac/HEAD/docs/imgs/sourcestart/1527909925642-7c07329e-2a63-436e-8403-5a1bc87639a3.png -------------------------------------------------------------------------------- /docs/imgs/sourcestart/1527910365188-43a1a4c3-fb9b-4fa5-bbbb-3f7f514fc1b9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alibaba/tac/HEAD/docs/imgs/sourcestart/1527910365188-43a1a4c3-fb9b-4fa5-bbbb-3f7f514fc1b9.png -------------------------------------------------------------------------------- /docs/imgs/sourcestart/1527910444921-c5c32034-e174-431a-b7c8-59077c11577b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alibaba/tac/HEAD/docs/imgs/sourcestart/1527910444921-c5c32034-e174-431a-b7c8-59077c11577b.png -------------------------------------------------------------------------------- /tac-engine/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | # Auto Configure 2 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 3 | com.alibaba.tac.engine.autoconfigure.TacAutoConfiguration 4 | -------------------------------------------------------------------------------- /tac-console-web/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | indent_size = 4 7 | end_of_line = lf 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | -------------------------------------------------------------------------------- /tac-console-web/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/ 3 | dist/ 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Editor directories and files 9 | .idea 10 | *.suo 11 | *.ntvs* 12 | *.njsproj 13 | *.sln 14 | -------------------------------------------------------------------------------- /tac-console/src/main/resources/application-admin.properties: -------------------------------------------------------------------------------- 1 | 2 | # the properites when run in admin model 3 | 4 | 5 | name.simple=tac-admin 6 | 7 | 8 | # the scan packages , don't change it if necessary 9 | tac.app.scan.packages=com.alibaba.tac -------------------------------------------------------------------------------- /tac-console-web/.postcssrc.js: -------------------------------------------------------------------------------- 1 | // https://github.com/michael-ciniawsky/postcss-load-config 2 | 3 | module.exports = { 4 | "plugins": { 5 | // to edit target browsers: use "browserslist" field in package.json 6 | "autoprefixer": {} 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /tac-sdk/src/main/java/com/alibaba/tac/sdk/tangram4tac/render/IRender.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac.sdk.tangram4tac.render; 2 | 3 | /** 4 | * Created by longerian on 2017/11/5. 5 | */ 6 | public interface IRender { 7 | 8 | O renderTo(I input); 9 | 10 | } 11 | -------------------------------------------------------------------------------- /tac-sdk/src/main/java/com/alibaba/tac/sdk/handler/DisposableHandler.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac.sdk.handler; 2 | 3 | /** 4 | * TacHandler destroy 5 | * Created by huchangkun on 2017/5/23. 6 | */ 7 | public interface DisposableHandler { 8 | 9 | void destroy() throws Exception; 10 | 11 | } -------------------------------------------------------------------------------- /tac-sdk/src/main/java/com/alibaba/tac/sdk/handler/InitializingHandler.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac.sdk.handler; 2 | 3 | /** 4 | * TacHandler init 5 | * Created by huchangkun on 2017/5/23. 6 | */ 7 | public interface InitializingHandler { 8 | 9 | void afterPropertiesSet() throws Exception; 10 | } -------------------------------------------------------------------------------- /tac-console/src/main/resources/application-simple.properties: -------------------------------------------------------------------------------- 1 | 2 | 3 | # the properites when run in command model 4 | 5 | name.simple=tac-simple 6 | 7 | 8 | # the scan packages , don't change it if necessary 9 | tac.app.scan.packages=com.alibaba.tac.console.sdk,com.alibaba.tac.engine.code,com.alibaba.tac.engine.compile -------------------------------------------------------------------------------- /tac-console-web/build/dev-client.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | require('eventsource-polyfill') 3 | var hotClient = require('webpack-hot-middleware/client?noInfo=true&reload=true') 4 | 5 | hotClient.subscribe(function (event) { 6 | if (event.action === 'reload') { 7 | window.location.reload() 8 | } 9 | }) 10 | -------------------------------------------------------------------------------- /tac-console-web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | tac-console-web 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | !.mvn/wrapper/maven-wrapper.jar 3 | 4 | ### STS ### 5 | .apt_generated 6 | .classpath 7 | .factorypath 8 | .project 9 | .settings 10 | .springBeans 11 | 12 | ### IntelliJ IDEA ### 13 | .idea 14 | *.iws 15 | *.iml 16 | *.ipr 17 | 18 | ### NetBeans ### 19 | nbproject/private/ 20 | nbbuild/ 21 | dist/ 22 | nbdist/ 23 | 24 | bin/ 25 | -------------------------------------------------------------------------------- /tac-sdk/src/main/java/com/alibaba/tac/sdk/tangram4tac/lib/FloatContainer.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac.sdk.tangram4tac.lib; 2 | 3 | /** 4 | * Created by longerian on 2017/11/5. 5 | */ 6 | public class FloatContainer extends OneChildContainer { 7 | 8 | @Override 9 | public String getType() { 10 | return CellType.TYPE_CONTAINER_FLOAT; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /tac-sdk/src/main/java/com/alibaba/tac/sdk/tangram4tac/lib/ScrollFixContainer.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac.sdk.tangram4tac.lib; 2 | 3 | /** 4 | * Created by longerian on 2017/11/5. 5 | */ 6 | public class ScrollFixContainer extends OneChildContainer { 7 | 8 | @Override 9 | public String getType() { 10 | return CellType.TYPE_CONTAINER_SCROLL_FIX; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /tac-console-web/src/components/TacMs.vue: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 17 | 18 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /tac-sdk/src/main/java/com/alibaba/tac/sdk/error/IError.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac.sdk.error; 2 | 3 | /** 4 | * @author jinshuan.li 2017/12/28 下午3:03 5 | */ 6 | public interface IError { 7 | 8 | /** 9 | * get error code 10 | * @return 11 | */ 12 | int getCode(); 13 | 14 | /** 15 | * get error message 16 | * @return 17 | */ 18 | String getMessage(); 19 | } 20 | -------------------------------------------------------------------------------- /tac-console-web/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["env", { 4 | "modules": false, 5 | "targets": { 6 | "browsers": ["> 1%", "last 2 versions", "not ie <= 8"] 7 | } 8 | }], 9 | "stage-2" 10 | ], 11 | "plugins": ["transform-runtime"], 12 | "env": { 13 | "test": { 14 | "presets": ["env", "stage-2"], 15 | "plugins": ["istanbul"] 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /tac-sdk/src/main/java/com/alibaba/tac/sdk/tangram4tac/lib/StickyContainer.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac.sdk.tangram4tac.lib; 2 | 3 | /** 4 | * Created by longerian on 2017/11/5. 5 | */ 6 | public class StickyContainer extends OneChildContainer { 7 | 8 | public StickyContainer() { 9 | } 10 | 11 | @Override 12 | public String getType() { 13 | return CellType.TYPE_CONTAINER_STICKY; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /tac-container/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | project.name=tac-container 2 | 3 | 4 | # http port 5 | server.port=8001 6 | # endpoint port 7 | management.port=8002 8 | 9 | 10 | 11 | 12 | tac.default.store=redis 13 | 14 | 15 | scan.package.name=com.tmall.tac.test 16 | 17 | 18 | tac.extend.lib=extendlibs 19 | 20 | logging.config=classpath:tac/default-logback-spring.xml 21 | 22 | 23 | tac.container.web.api=http://localhost:8001/api/tac/execute -------------------------------------------------------------------------------- /tac-console-web/src/App.vue: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 13 | 14 | 23 | -------------------------------------------------------------------------------- /tac-sdk/src/main/java/com/alibaba/tac/sdk/tangram4tac/lib/FixContainer.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac.sdk.tangram4tac.lib; 2 | 3 | /** 4 | * Created by longerian on 2017/11/5. 5 | */ 6 | public class FixContainer extends OneChildContainer { 7 | 8 | public FixContainer() { 9 | style = new FixStyle(); 10 | } 11 | 12 | @Override 13 | public String getType() { 14 | return CellType.TYPE_CONTAINER_FIX; 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /tac-sdk/src/main/java/com/alibaba/tac/sdk/tangram4tac/lib/ScrollFixBannerContainer.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac.sdk.tangram4tac.lib; 2 | 3 | import com.alibaba.tac.sdk.tangram4tac.Container; 4 | 5 | /** 6 | * Created by longerian on 2017/11/5. 7 | */ 8 | public class ScrollFixBannerContainer extends Container { 9 | 10 | @Override 11 | public String getType() { 12 | return CellType.TYPE_CONTAINER_SCROLL_FIX_BANNER; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /tac-sdk/src/main/java/com/alibaba/tac/sdk/tangram4tac/lib/FlowContainer.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac.sdk.tangram4tac.lib; 2 | 3 | import com.alibaba.tac.sdk.tangram4tac.Container; 4 | 5 | /** 6 | * Created by longerian on 2017/11/5. 7 | */ 8 | public class FlowContainer extends Container { 9 | 10 | public FlowContainer() { 11 | } 12 | 13 | @Override 14 | public String getType() { 15 | return CellType.TYPE_CONTAINER_FLOW; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /tac-console-web/src/components/Home.vue: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 19 | 20 | 21 | 24 | -------------------------------------------------------------------------------- /tac-sdk/src/main/java/com/alibaba/tac/sdk/tangram4tac/lib/ScrollContainer.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac.sdk.tangram4tac.lib; 2 | 3 | import com.alibaba.tac.sdk.tangram4tac.Container; 4 | 5 | /** 6 | * Created by longerian on 2017/11/5. 7 | */ 8 | public class ScrollContainer extends Container { 9 | 10 | public ScrollContainer() { 11 | } 12 | 13 | @Override 14 | public String getType() { 15 | return CellType.TYPE_CONTAINER_SCROLL; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /tac-sdk/src/main/java/com/alibaba/tac/sdk/tangram4tac/lib/WaterFallContainer.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac.sdk.tangram4tac.lib; 2 | 3 | import com.alibaba.tac.sdk.tangram4tac.Container; 4 | 5 | /** 6 | * Created by longerian on 2017/11/5. 7 | */ 8 | public class WaterFallContainer extends Container { 9 | 10 | public WaterFallContainer() { 11 | } 12 | 13 | @Override 14 | public String getType() { 15 | return CellType.TYPE_CONTAINER_WATERFALL; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /tac-sdk/src/main/java/com/alibaba/tac/sdk/tangram4tac/lib/FiveColumnContainer.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac.sdk.tangram4tac.lib; 2 | 3 | import com.alibaba.tac.sdk.tangram4tac.Container; 4 | 5 | /** 6 | * Created by longerian on 2017/11/5. 7 | */ 8 | public class FiveColumnContainer extends Container { 9 | 10 | public FiveColumnContainer() { 11 | } 12 | 13 | @Override 14 | public String getType() { 15 | return CellType.TYPE_CONTAINER_5C_FLOW; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /tac-sdk/src/main/java/com/alibaba/tac/sdk/tangram4tac/lib/FourColumnContainer.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac.sdk.tangram4tac.lib; 2 | 3 | import com.alibaba.tac.sdk.tangram4tac.Container; 4 | 5 | /** 6 | * Created by longerian on 2017/11/5. 7 | */ 8 | public class FourColumnContainer extends Container { 9 | 10 | public FourColumnContainer() { 11 | } 12 | 13 | @Override 14 | public String getType() { 15 | return CellType.TYPE_CONTAINER_4C_FLOW; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /tac-sdk/src/main/java/com/alibaba/tac/sdk/tangram4tac/lib/OneColumnContainer.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac.sdk.tangram4tac.lib; 2 | 3 | import com.alibaba.tac.sdk.tangram4tac.Container; 4 | 5 | /** 6 | * Created by longerian on 2017/11/5. 7 | */ 8 | public class OneColumnContainer extends Container { 9 | 10 | public OneColumnContainer() { 11 | } 12 | 13 | @Override 14 | public String getType() { 15 | return CellType.TYPE_CONTAINER_1C_FLOW; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /tac-sdk/src/main/java/com/alibaba/tac/sdk/tangram4tac/lib/OnePlusNContainer.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac.sdk.tangram4tac.lib; 2 | 3 | import com.alibaba.tac.sdk.tangram4tac.Container; 4 | 5 | /** 6 | * Created by longerian on 2017/11/5. 7 | */ 8 | public class OnePlusNContainer extends Container { 9 | 10 | public OnePlusNContainer() { 11 | } 12 | 13 | @Override 14 | public String getType() { 15 | return CellType.TYPE_CONTAINER_ON_PLUSN; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /tac-sdk/src/main/java/com/alibaba/tac/sdk/tangram4tac/lib/OnePlusNStyle.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac.sdk.tangram4tac.lib; 2 | 3 | import com.alibaba.tac.sdk.tangram4tac.Style; 4 | 5 | /** 6 | * Created by longerian on 2017/11/18. 7 | */ 8 | public class OnePlusNStyle extends Style { 9 | 10 | protected float[] rows; 11 | 12 | public void setRows(float[] rows) { 13 | this.rows = rows; 14 | } 15 | 16 | public float[] getRows() { 17 | return rows; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /tac-sdk/src/main/java/com/alibaba/tac/sdk/tangram4tac/lib/TwoColumnContainer.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac.sdk.tangram4tac.lib; 2 | 3 | import com.alibaba.tac.sdk.tangram4tac.Container; 4 | 5 | /** 6 | * Created by longerian on 2017/11/5. 7 | */ 8 | public class TwoColumnContainer extends Container { 9 | 10 | public TwoColumnContainer() { 11 | } 12 | 13 | @Override 14 | public String getType() { 15 | return CellType.TYPE_CONTAINER_2C_FLOW; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /tac-sdk/src/main/java/com/alibaba/tac/sdk/tangram4tac/lib/BannerContainer.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac.sdk.tangram4tac.lib; 2 | 3 | import com.alibaba.tac.sdk.tangram4tac.Container; 4 | 5 | /** 6 | * Created by longerian on 2017/11/5. 7 | */ 8 | public class BannerContainer extends Container { 9 | 10 | public BannerContainer() { 11 | } 12 | 13 | @Override 14 | public String getType() { 15 | return CellType.TYPE_CONTAINER_BANNER; 16 | } 17 | 18 | 19 | } 20 | -------------------------------------------------------------------------------- /tac-sdk/src/main/java/com/alibaba/tac/sdk/tangram4tac/lib/ThreeColumnContainer.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac.sdk.tangram4tac.lib; 2 | 3 | import com.alibaba.tac.sdk.tangram4tac.Container; 4 | 5 | /** 6 | * Created by longerian on 2017/11/5. 7 | */ 8 | public class ThreeColumnContainer extends Container { 9 | 10 | public ThreeColumnContainer() { 11 | } 12 | 13 | @Override 14 | public String getType() { 15 | return CellType.TYPE_CONTAINER_3C_FLOW; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /tac-sdk/src/main/java/com/alibaba/tac/sdk/tangram4tac/lib/StickyStyle.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac.sdk.tangram4tac.lib; 2 | 3 | import com.alibaba.tac.sdk.tangram4tac.Style; 4 | 5 | /** 6 | * Created by longerian on 2017/11/14. 7 | */ 8 | public class StickyStyle extends Style { 9 | 10 | protected String sticky; 11 | 12 | public String getSticky() { 13 | return sticky; 14 | } 15 | 16 | public void setSticky(String sticky) { 17 | this.sticky = sticky; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /tac-sdk/src/main/java/com/alibaba/tac/sdk/tangram4tac/FieldExcluder.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac.sdk.tangram4tac; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * Created by longerian on 2017/11/18. 10 | * 11 | * 序列化的时候将排除该注解标记的字段 12 | * 13 | */ 14 | @Retention(RetentionPolicy.RUNTIME) 15 | @Target(ElementType.FIELD) 16 | public @interface FieldExcluder { 17 | } 18 | -------------------------------------------------------------------------------- /tac-console-web/.eslintrc.js: -------------------------------------------------------------------------------- 1 | // http://eslint.org/docs/user-guide/configuring 2 | 3 | module.exports = { 4 | root: true, 5 | parser: 'babel-eslint', 6 | parserOptions: { 7 | sourceType: 'module' 8 | }, 9 | env: { 10 | browser: true, 11 | }, 12 | // required to lint *.vue files 13 | plugins: [ 14 | 'html' 15 | ], 16 | // add your custom rules here 17 | 'rules': { 18 | // allow debugger during development 19 | 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tac-console-web/build/vue-loader.conf.js: -------------------------------------------------------------------------------- 1 | var utils = require('./utils') 2 | var config = require('../config') 3 | var isProduction = process.env.NODE_ENV === 'production' 4 | 5 | module.exports = { 6 | loaders: utils.cssLoaders({ 7 | sourceMap: isProduction 8 | ? config.build.productionSourceMap 9 | : config.dev.cssSourceMap, 10 | extract: isProduction 11 | }), 12 | transformToRequire: { 13 | video: 'src', 14 | source: 'src', 15 | img: 'src', 16 | image: 'xlink:href' 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /tac-console/src/test/java/com/alibaba/tac/console/test/TacConsoleTest.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac.console.test; 2 | 3 | import org.junit.runner.RunWith; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | import org.springframework.test.context.junit4.SpringRunner; 6 | 7 | /** 8 | * @author jinshuan.li 26/02/2018 11:36 9 | */ 10 | @RunWith(SpringRunner.class) 11 | @SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.NONE) 12 | public class TacConsoleTest { 13 | } 14 | -------------------------------------------------------------------------------- /tac-custom-datasource-demo/src/main/java/com/tmall/itemcenter/TmallItemService.java: -------------------------------------------------------------------------------- 1 | package com.tmall.itemcenter; 2 | 3 | import org.springframework.stereotype.Service; 4 | 5 | /** 6 | * @author jinshuan.li 10/03/2018 15:43 7 | */ 8 | @Service 9 | public class TmallItemService { 10 | 11 | /** 12 | * get a item 13 | * 14 | * @param id 15 | * @return 16 | */ 17 | public ItemDO getItem(Long id) { 18 | 19 | // mock data 20 | return new ItemDO(id, "A Song of Ice and Fire", "¥222.00"); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /tac-console/src/test/java/com/alibaba/tac/console/test/TestApplication.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac.console.test; 2 | 3 | import org.springframework.boot.autoconfigure.SpringBootApplication; 4 | import org.springframework.context.annotation.PropertySource; 5 | import org.springframework.context.annotation.PropertySources; 6 | 7 | /** 8 | * @author jinshuan.li 12/02/2018 09:26 9 | */ 10 | @SpringBootApplication(scanBasePackages = {"com.alibaba.tac"}) 11 | //@PropertySources({@PropertySource("classpath:test.properties")}) 12 | public class TestApplication { 13 | } 14 | -------------------------------------------------------------------------------- /tac-sdk/src/main/java/com/alibaba/tac/sdk/tangram4tac/FieldNameMapper.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac.sdk.tangram4tac; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * Created by longerian on 2017/11/18. 10 | * 11 | * 字段序列化后,默认输出到json里的字段名与成员变量名相同,通过该注解可提供一个别名 12 | */ 13 | @Retention(RetentionPolicy.RUNTIME) 14 | @Target(ElementType.FIELD) 15 | public @interface FieldNameMapper { 16 | 17 | String key(); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /tac-sdk/src/main/java/com/alibaba/tac/sdk/handler/TacHandler.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac.sdk.handler; 2 | 3 | import com.alibaba.tac.sdk.common.TacResult; 4 | import com.alibaba.tac.sdk.domain.Context; 5 | 6 | /** 7 | * the core interface in tac ,all the biz code should implements it 8 | * 9 | * @param 10 | */ 11 | public interface TacHandler { 12 | 13 | /** 14 | * execute the biz code 15 | * @param context 16 | * @return 17 | * @throws Exception 18 | */ 19 | TacResult execute(Context context) throws Exception; 20 | 21 | } 22 | -------------------------------------------------------------------------------- /tac-console-web/README.md: -------------------------------------------------------------------------------- 1 | # tac-console-web 2 | 3 | > A Vue.js project 4 | 5 | ## Build Setup 6 | 7 | ``` bash 8 | # install dependencies 9 | npm install 10 | 11 | # serve with hot reload at localhost:8080 12 | npm run dev 13 | 14 | # build for production with minification 15 | npm run build 16 | 17 | # build for production and view the bundle analyzer report 18 | npm run build --report 19 | ``` 20 | 21 | For detailed explanation on how things work, checkout the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader). 22 | -------------------------------------------------------------------------------- /tac-engine/src/test/java/com/alibaba/tac/test/redis/TacRedisMessageListener.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac.test.redis; 2 | 3 | import lombok.extern.slf4j.Slf4j; 4 | import org.springframework.stereotype.Service; 5 | 6 | /** 7 | * @author jinshuan.li 28/02/2018 20:24 8 | */ 9 | @Slf4j 10 | @Service 11 | public class TacRedisMessageListener { 12 | 13 | /** 14 | * 接收消息 15 | * 16 | * @param message 17 | * @param channel 18 | */ 19 | public void receiveMessage(String message, String channel) { 20 | 21 | log.info(message); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tac-sdk/src/main/java/com/alibaba/tac/sdk/factory/TacInfrasFactory.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac.sdk.factory; 2 | 3 | import com.alibaba.tac.sdk.infrastracture.TacLogger; 4 | import org.springframework.stereotype.Service; 5 | 6 | /** 7 | * @author jinshuan.li 12/02/2018 19:04 8 | */ 9 | @Service 10 | public class TacInfrasFactory extends AbstractServiceFactory { 11 | 12 | /** 13 | * The logger Service 14 | * 15 | * @return 16 | */ 17 | public static TacLogger getLogger() { 18 | 19 | return getServiceBean(TacLogger.class); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tac-console/src/main/resources/templates/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | tac-console-web 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /tac-infrastructure/src/main/java/com/alibaba/tac/infrastracture/logger/TacLogConsts.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac.infrastracture.logger; 2 | 3 | /** 4 | * Created by huchangkun on 2018/1/29. 5 | */ 6 | public final class TacLogConsts { 7 | 8 | /** 9 | * the user log tag 10 | */ 11 | public static String TAC_USER_LOG = "TAC-USER-LOG"; 12 | /** 13 | * TT_LOG 14 | */ 15 | public static String TAC_BIZ_TT_LOG = "TAC-BIZ-TT-LOG"; 16 | /** 17 | * executor log 18 | */ 19 | public static String TAC_EXECUTOR_LOG = "TAC-EXECUTOR-LOG"; 20 | 21 | 22 | } 23 | -------------------------------------------------------------------------------- /tac-console/src/test/java/com/alibaba/tac/console/MenuOptionHandlerTest.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac.console; 2 | 3 | import com.alibaba.tac.console.sdk.MenuOptionHandler; 4 | import com.alibaba.tac.console.test.TacConsoleTest; 5 | 6 | import javax.annotation.Resource; 7 | 8 | import java.util.concurrent.CountDownLatch; 9 | 10 | /** 11 | * @author jinshuan.li 28/02/2018 15:20 12 | */ 13 | public class MenuOptionHandlerTest extends TacConsoleTest { 14 | 15 | @Resource 16 | private MenuOptionHandler menuOptionHandler; 17 | 18 | private CountDownLatch countDownLatch=new CountDownLatch(1); 19 | 20 | 21 | } -------------------------------------------------------------------------------- /tac-engine/src/test/source/test1/com/alibaba/tac/biz/processor/HelloTac.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac.biz.processor; 2 | 3 | import com.alibaba.tac.sdk.common.TacResult; 4 | import com.alibaba.tac.sdk.domain.Context; 5 | import com.alibaba.tac.sdk.handler.TacHandler; 6 | 7 | /** 8 | * @author jinshuan.li 12/02/2018 08:47 9 | */ 10 | public class HelloTac implements TacHandler { 11 | @Override 12 | public TacResult execute(Context context) throws Exception { 13 | 14 | System.out.println(context); 15 | System.out.println("hello tac"); 16 | return TacResult.newResult(1); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /tac-custom-datasource-demo/src/main/java/com/tmall/itemcenter/ItemDO.java: -------------------------------------------------------------------------------- 1 | package com.tmall.itemcenter; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * @author jinshuan.li 10/03/2018 15:43 7 | */ 8 | @Data 9 | public class ItemDO { 10 | 11 | /** 12 | * itemID 13 | */ 14 | private Long id; 15 | 16 | /** 17 | * item name 18 | */ 19 | private String name; 20 | 21 | /** 22 | * item price 23 | */ 24 | private String price; 25 | 26 | public ItemDO(Long id, String name, String price) { 27 | 28 | this.id = id; 29 | this.name = name; 30 | this.price = price; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /tac-engine/src/test/java/com/alibaba/tac/engine/test/TestApplication.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac.engine.test; 2 | 3 | import org.springframework.boot.autoconfigure.SpringBootApplication; 4 | import org.springframework.context.annotation.PropertySource; 5 | import org.springframework.context.annotation.PropertySources; 6 | 7 | /** 8 | * @author jinshuan.li 12/02/2018 09:26 9 | */ 10 | @SpringBootApplication( 11 | scanBasePackages = {"com.alibaba.tac.engine", "com.alibaba.tac.infrastracture", "com.alibaba.tac.sdk","com.tmall.tac.test"}) 12 | @PropertySources({@PropertySource("classpath:test.properties")}) 13 | public class TestApplication { 14 | 15 | 16 | } 17 | -------------------------------------------------------------------------------- /tac-sdk/src/main/java/com/alibaba/tac/sdk/common/TacThreadLocals.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac.sdk.common; 2 | 3 | import java.util.Map; 4 | 5 | public class TacThreadLocals { 6 | 7 | /** 8 | * the log data 9 | */ 10 | public static final ThreadLocal TAC_LOG_CONTENT = new ThreadLocal(); 11 | 12 | /** 13 | * the params data 14 | */ 15 | public static final ThreadLocal> TAC_PARAMS = new ThreadLocal>(); 16 | 17 | /** 18 | * clear data in threadlocal 19 | */ 20 | public static void clear() { 21 | TAC_LOG_CONTENT.remove(); 22 | TAC_PARAMS.remove(); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /tac-engine/src/test/java/com/alibaba/tac/engine/utils/TacFileUtilTest.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac.engine.utils; 2 | 3 | import com.alibaba.tac.engine.test.TacEnginTest; 4 | import com.alibaba.tac.engine.code.TacFileService; 5 | import org.junit.Test; 6 | 7 | import javax.annotation.Resource; 8 | 9 | /** 10 | * @author jinshuan.li 27/02/2018 20:29 11 | */ 12 | public class TacFileUtilTest extends TacEnginTest { 13 | 14 | @Resource 15 | private TacFileService tacFileService; 16 | 17 | @Test 18 | public void getClassFileOutputPath() { 19 | 20 | String classFileOutputPath = tacFileService.getClassFileOutputPath(1L); 21 | 22 | System.out.println(classFileOutputPath); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /tac-sdk/src/main/java/com/alibaba/tac/sdk/infrastracture/TacLogger.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac.sdk.infrastracture; 2 | 3 | 4 | /** 5 | * tac log 6 | * 7 | */ 8 | public interface TacLogger { 9 | 10 | public void debug(String log); 11 | 12 | public void info(String log); 13 | 14 | public void rateInfo(String log); 15 | 16 | public void warn(String log); 17 | 18 | public void rateWarn(String log); 19 | 20 | public void error(String log, Throwable t); 21 | 22 | public void ttLog(String log); 23 | 24 | public String getContent(); 25 | 26 | 27 | boolean isDebugEnabled(); 28 | 29 | 30 | boolean isInfoEnabled(); 31 | 32 | boolean isWarnEnabled(); 33 | 34 | boolean isErrorEnabled(); 35 | 36 | } 37 | -------------------------------------------------------------------------------- /tac-console/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | 3 | # the port when use web model 4 | server.port=7001 5 | 6 | 7 | # scan the extend package names 8 | scan.package.name=com.tmall.itemcenter 9 | 10 | # the location of extend jars 11 | tac.extend.lib=extendlibs 12 | 13 | 14 | # the default store , when use "redis" you should install and config redis server , use "zookeeper" you should install and config zookeeper server 15 | tac.default.store=redis 16 | 17 | 18 | # the location of logback config file 19 | logging.config=classpath:tac/default-logback-spring.xml 20 | 21 | 22 | 23 | # the http url prefix when you run the tac-container, the is used to online publish check; 24 | tac.container.web.api=http://localhost:8001/api/tac/execute 25 | 26 | 27 | tac.app.scan.packages=com.alibaba.tac -------------------------------------------------------------------------------- /tac-engine/src/main/java/com/alibaba/tac/engine/properties/TacGitlabProperties.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac.engine.properties; 2 | 3 | import lombok.Data; 4 | import org.springframework.boot.context.properties.ConfigurationProperties; 5 | import org.springframework.stereotype.Component; 6 | 7 | /** 8 | * @author jinshuan.li 06/05/2018 14:30 9 | */ 10 | @Data 11 | @Component 12 | @ConfigurationProperties(prefix = "tac.gitlab.config") 13 | public class TacGitlabProperties { 14 | 15 | private String hostURL = "http://127.0.0.1/"; 16 | 17 | private String token = "t_bj6gJywKH2fCkbWY7k"; 18 | 19 | private String groupName = "tac-admin"; 20 | 21 | private String userName = "tac-admin"; 22 | 23 | private String password = "tac-admin"; 24 | 25 | private String basePath = "/home/admin/tac/git_codes"; 26 | 27 | } 28 | -------------------------------------------------------------------------------- /tac-engine/src/test/java/com/alibaba/tac/engine/test/TacEnginTest.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac.engine.test; 2 | 3 | import com.alibaba.tac.engine.code.CodeLoadService; 4 | import lombok.extern.slf4j.Slf4j; 5 | import org.junit.runner.RunWith; 6 | import org.springframework.boot.test.context.SpringBootTest; 7 | import org.springframework.test.context.junit4.SpringRunner; 8 | 9 | /** 10 | * @author jinshuan.li 26/02/2018 11:36 11 | */ 12 | @Slf4j 13 | @RunWith(SpringRunner.class) 14 | @SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.NONE) 15 | public class TacEnginTest { 16 | 17 | static { 18 | try { 19 | ClassLoader classLoader = CodeLoadService.changeClassLoader(); 20 | } catch (Exception e) { 21 | log.error(e.getMessage(), e); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tac-infrastructure/src/test/java/com/alibaba/tac/AppTest.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac; 2 | 3 | import junit.framework.Test; 4 | import junit.framework.TestCase; 5 | import junit.framework.TestSuite; 6 | 7 | /** 8 | * Unit test for simple App. 9 | */ 10 | public class AppTest 11 | extends TestCase 12 | { 13 | /** 14 | * Create the test case 15 | * 16 | * @param testName name of the test case 17 | */ 18 | public AppTest( String testName ) 19 | { 20 | super( testName ); 21 | } 22 | 23 | /** 24 | * @return the suite of tests being tested 25 | */ 26 | public static Test suite() 27 | { 28 | return new TestSuite( AppTest.class ); 29 | } 30 | 31 | /** 32 | * Rigourous Test :-) 33 | */ 34 | public void testApp() 35 | { 36 | assertTrue( true ); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /tac-custom-datasource-demo/src/test/java/com/alibaba/tac/AppTest.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac; 2 | 3 | import junit.framework.Test; 4 | import junit.framework.TestCase; 5 | import junit.framework.TestSuite; 6 | 7 | /** 8 | * Unit test for simple App. 9 | */ 10 | public class AppTest 11 | extends TestCase 12 | { 13 | /** 14 | * Create the test case 15 | * 16 | * @param testName name of the test case 17 | */ 18 | public AppTest( String testName ) 19 | { 20 | super( testName ); 21 | } 22 | 23 | /** 24 | * @return the suite of tests being tested 25 | */ 26 | public static Test suite() 27 | { 28 | return new TestSuite( AppTest.class ); 29 | } 30 | 31 | /** 32 | * Rigourous Test :-) 33 | */ 34 | public void testApp() 35 | { 36 | assertTrue( true ); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /docs/gitlab.md: -------------------------------------------------------------------------------- 1 | # 与 gitlab 集成 2 | 3 | * 用户可以将 gitlab 与 tac 集成,方便管理微服务; 4 | 5 | ## Step 1 新建帐号 6 | 7 | * tac 使用专门的 gitlab 帐号来管理相关代码;联系对应的 gitlab 服务器管理员,新建名如 tac-admin 的用户,并获取其 api token、userName、password. 8 | 9 | ## Step 2 tac 启动参数配置 10 | 11 | * 在 tac 启动时配置如下参数 12 | 13 | ```properties 14 | # gitlab服务器地址 15 | tac.gitlab.config.hostURL=http://127.0.0.1 16 | 17 | # gitlab帐号token 18 | tac.gitlab.config.token=xxxxx 19 | 20 | # gitlab仓库groupName 21 | tac.gitlab.config.groupName=tac-admin 22 | 23 | 24 | # gitlab仓库帐号名 25 | tac.gitlab.config.userName=tac-admin 26 | 27 | # gitlab仓库帐号密码 28 | tac.gitlab.config.password=tac-admin 29 | 30 | 31 | # gitlab代码下载存储路径 (各微服务代码会下载到这个路径下) 32 | tac.gitlab.config.basePath=/home/admin/tac/git_codes 33 | ``` 34 | 35 | ## Step 3 修改微服务的代码仓库地址 36 | 37 | * 如下图所示,修改该微服务的仓库地址 38 | 39 | ![gitlab_repo](imgs/tac-gitlab1.png) 40 | 41 | ## Step 4 置顶实例分支并发布 42 | 43 | ![gitlab_repo](imgs/tac-gitlab3.png) 44 | -------------------------------------------------------------------------------- /tac-console-web/src/components/TacInst.vue: -------------------------------------------------------------------------------- 1 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | -------------------------------------------------------------------------------- /tac-sdk/src/main/java/com/alibaba/tac/sdk/domain/Context.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac.sdk.domain; 2 | 3 | import java.io.Serializable; 4 | import java.util.Map; 5 | 6 | /** 7 | * @author jinshuan.li 12/02/2018 8 | */ 9 | public interface Context extends Serializable { 10 | 11 | /** 12 | * get the msCode 13 | * 14 | * @return 15 | */ 16 | String getMsCode(); 17 | 18 | /** 19 | * get the instanceId 20 | * 21 | * @return 22 | */ 23 | long getInstId(); 24 | 25 | /** 26 | * get appName 27 | * @return 28 | */ 29 | String getAppName(); 30 | 31 | /** 32 | * get the value in the params map 33 | */ 34 | Object get(String key); 35 | 36 | /** 37 | * 38 | * @param key 39 | * @return 40 | */ 41 | boolean containsKey(String key); 42 | 43 | /** 44 | * 45 | * @return 46 | */ 47 | Map getParams(); 48 | 49 | } 50 | -------------------------------------------------------------------------------- /tac-sdk/src/main/java/com/alibaba/tac/sdk/error/ErrorCode.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac.sdk.error; 2 | 3 | public class ErrorCode { 4 | /** 5 | * ALREADY_EXIST 6 | */ 7 | public static final int ALREADY_EXIST = -102; 8 | /** 9 | * NOT_EXIST 10 | */ 11 | public static final int NOT_EXIST = -103; 12 | /** 13 | * NO_PERMISSION 14 | */ 15 | public static final int NO_PERMISSION = -104; 16 | /** 17 | * NOT_SUPPORTED 18 | */ 19 | public static final int NOT_SUPPORTED = -105; 20 | /** 21 | * 22 | */ 23 | public static final int INCREMENTAL_CATALOGS_CLIENT_DATA_VERSION_ERR = -106; 24 | 25 | /** 26 | * 27 | */ 28 | public static final int ILLEGAL_ARGUMENT = -110; 29 | 30 | /** 31 | * IO Exception 32 | */ 33 | public static final int IO_EXCEPTION = -111; 34 | 35 | /** 36 | * 系统异常 37 | */ 38 | public static final int SYS_EXCEPTION = -500; 39 | 40 | } 41 | -------------------------------------------------------------------------------- /tac-custom-datasource-demo/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | tac 5 | com.alibaba 6 | 0.0.4 7 | 8 | 4.0.0 9 | 10 | 0.0.4-SNAPSHOT 11 | 12 | tac-custom-datasource-demo 13 | jar 14 | 15 | tac-custom-datasource-demo 16 | http://maven.apache.org 17 | 18 | 19 | UTF-8 20 | 21 | 22 | 23 | 24 | com.alibaba 25 | tac-sdk 26 | 0.0.4 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /tac-sdk/src/main/java/com/alibaba/tac/sdk/tangram4tac/lib/FixStyle.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac.sdk.tangram4tac.lib; 2 | 3 | import com.alibaba.tac.sdk.tangram4tac.Style; 4 | 5 | /** 6 | * Created by longerian on 2017/11/14. 7 | */ 8 | public class FixStyle extends Style { 9 | 10 | protected float x; 11 | 12 | protected float y; 13 | 14 | protected String align; 15 | 16 | protected String showType; 17 | 18 | public float getX() { 19 | return x; 20 | } 21 | 22 | public void setX(float x) { 23 | this.x = x; 24 | } 25 | 26 | public float getY() { 27 | return y; 28 | } 29 | 30 | public void setY(float y) { 31 | this.y = y; 32 | } 33 | 34 | public String getAlign() { 35 | return align; 36 | } 37 | 38 | public void setAlign(String align) { 39 | this.align = align; 40 | } 41 | 42 | public String getShowType() { 43 | return showType; 44 | } 45 | 46 | public void setShowType(String showType) { 47 | this.showType = showType; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /tac-sdk/src/main/java/com/alibaba/tac/sdk/tangram4tac/utils/Pair.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac.sdk.tangram4tac.utils; 2 | 3 | /** 4 | * Created by longerian on 2017/10/31. 5 | */ 6 | public class Pair { 7 | public final F first; 8 | public final S second; 9 | 10 | public Pair(F first, S second) { 11 | this.first = first; 12 | this.second = second; 13 | } 14 | 15 | public boolean equals(Object o) { 16 | if(!(o instanceof Pair)) { 17 | return false; 18 | } else { 19 | Pair p = (Pair)o; 20 | return objectsEqual(p.first, this.first) && objectsEqual(p.second, this.second); 21 | } 22 | } 23 | 24 | private static boolean objectsEqual(Object a, Object b) { 25 | return a == b || a != null && a.equals(b); 26 | } 27 | 28 | public int hashCode() { 29 | return (this.first == null?0:this.first.hashCode()) ^ (this.second == null?0:this.second.hashCode()); 30 | } 31 | 32 | public static Pair create(A a, B b) { 33 | return new Pair(a, b); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /tac-console-web/src/main.js: -------------------------------------------------------------------------------- 1 | // The Vue build version to load with the `import` command 2 | // (runtime-only or standalone) has been set in webpack.base.conf with an alias. 3 | import Vue from 'vue'; 4 | import BootstrapVue from 'bootstrap-vue'; 5 | import VueResource from 'vue-resource'; 6 | import Toastr from 'vue-toastr'; 7 | import App from './App'; 8 | import router from './router'; 9 | import 'bootstrap/dist/css/bootstrap.min.css'; 10 | import 'bootstrap-vue/dist/bootstrap-vue.css'; 11 | import 'jsoneditor/dist/jsoneditor.css'; 12 | 13 | import 'vue-toastr/dist/vue-toastr.css'; 14 | 15 | import TacConsole from '@/components/TacConsole'; 16 | import TacJSONEditor from '@/components/TacJSONEditor'; 17 | 18 | import '../static/main.css'; 19 | 20 | Vue.use(Toastr); 21 | Vue.use(BootstrapVue); 22 | Vue.use(VueResource); 23 | 24 | Vue.component('TacConsole', TacConsole); 25 | Vue.component('TacJSONEditor', TacJSONEditor); 26 | 27 | Vue.config.productionTip = false; 28 | 29 | /* eslint-disable no-new */ 30 | new Vue({ 31 | el: '#app', 32 | router, 33 | template: '', 34 | components: { App } 35 | }); 36 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 Alibaba Group 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /tac-sdk/src/main/java/com/alibaba/tac/sdk/tangram4tac/lib/WaterFallStyle.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac.sdk.tangram4tac.lib; 2 | 3 | import com.alibaba.tac.sdk.tangram4tac.Style; 4 | 5 | /** 6 | * Created by longerian on 2017/11/14. 7 | */ 8 | public class WaterFallStyle extends Style { 9 | 10 | protected float vGap; 11 | 12 | protected float hGap; 13 | 14 | protected float gap; 15 | 16 | protected int column; 17 | 18 | public float getvGap() { 19 | return vGap; 20 | } 21 | 22 | public void setvGap(float vGap) { 23 | this.vGap = vGap; 24 | } 25 | 26 | public float gethGap() { 27 | return hGap; 28 | } 29 | 30 | public void sethGap(float hGap) { 31 | this.hGap = hGap; 32 | } 33 | 34 | public float getGap() { 35 | return gap; 36 | } 37 | 38 | public void setGap(float gap) { 39 | this.gap = gap; 40 | this.vGap = gap; 41 | this.hGap = gap; 42 | } 43 | 44 | public int getColumn() { 45 | return column; 46 | } 47 | 48 | public void setColumn(int column) { 49 | this.column = column; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /tac-console-web/src/components/TacJSONEditor.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 50 | 51 | 52 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /tac-console-web/build/build.js: -------------------------------------------------------------------------------- 1 | require('./check-versions')() 2 | 3 | process.env.NODE_ENV = 'production' 4 | 5 | var ora = require('ora') 6 | var rm = require('rimraf') 7 | var path = require('path') 8 | var chalk = require('chalk') 9 | var webpack = require('webpack') 10 | var config = require('../config') 11 | var webpackConfig = require('./webpack.prod.conf') 12 | 13 | var spinner = ora('building for production...') 14 | spinner.start() 15 | 16 | rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => { 17 | if (err) throw err 18 | webpack(webpackConfig, function (err, stats) { 19 | spinner.stop() 20 | if (err) throw err 21 | process.stdout.write(stats.toString({ 22 | colors: true, 23 | modules: false, 24 | children: false, 25 | chunks: false, 26 | chunkModules: false 27 | }) + '\n\n') 28 | 29 | if (stats.hasErrors()) { 30 | console.log(chalk.red(' Build failed with errors.\n')) 31 | process.exit(1) 32 | } 33 | 34 | console.log(chalk.cyan(' Build complete.\n')) 35 | console.log(chalk.yellow( 36 | ' Tip: built files are meant to be served over an HTTP server.\n' + 37 | ' Opening index.html over file:// won\'t work.\n' 38 | )) 39 | }) 40 | }) 41 | -------------------------------------------------------------------------------- /tac-engine/src/test/java/com/alibaba/tac/engine/service/TacInstanceLoadServiceTest.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac.engine.service; 2 | 3 | import com.alibaba.tac.engine.inst.domain.TacInst; 4 | import com.alibaba.tac.engine.inst.domain.TacInstanceInfo; 5 | import com.alibaba.tac.engine.inst.service.IMsInstService; 6 | import com.alibaba.tac.engine.test.TestApplication; 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | import org.springframework.boot.test.context.SpringBootTest; 10 | import org.springframework.test.context.junit4.SpringRunner; 11 | 12 | import javax.annotation.Resource; 13 | 14 | import static org.junit.Assert.*; 15 | 16 | /** 17 | * @author jinshuan.li 12/02/2018 18:24 18 | */ 19 | @RunWith(SpringRunner.class) 20 | @SpringBootTest(classes = TestApplication.class) 21 | public class TacInstanceLoadServiceTest { 22 | 23 | @Resource 24 | private TacInstanceLoadService tacInstanceLoadService; 25 | 26 | @Resource 27 | private IMsInstService iMsInstService; 28 | 29 | @Test 30 | public void loadTacHandler() throws Exception { 31 | TacInst tacMsInst = iMsInstService.getTacMsInst(111L); 32 | TacInstanceInfo tacInstanceInfo = tacInstanceLoadService.loadTacHandler(tacMsInst); 33 | 34 | assertNotNull(tacInstanceInfo); 35 | } 36 | } -------------------------------------------------------------------------------- /tac-sdk/src/main/java/com/alibaba/tac/sdk/tangram4tac/lib/FlowStyle.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac.sdk.tangram4tac.lib; 2 | 3 | import com.alibaba.tac.sdk.tangram4tac.Style; 4 | 5 | /** 6 | * Created by longerian on 2017/11/14. 7 | */ 8 | public class FlowStyle extends Style { 9 | 10 | protected int column; 11 | 12 | protected float vGap; 13 | 14 | protected float hGap; 15 | 16 | protected boolean autoExpand; 17 | 18 | public int getColumn() { 19 | return column; 20 | } 21 | 22 | public void setColumn(int column) { 23 | this.column = column; 24 | } 25 | 26 | public float getvGap() { 27 | return vGap; 28 | } 29 | 30 | public void setvGap(int vGap) { 31 | this.vGap = vGap; 32 | } 33 | 34 | public void setvGap(float vGap) { 35 | this.vGap = vGap; 36 | } 37 | 38 | public float gethGap() { 39 | return hGap; 40 | } 41 | 42 | public void sethGap(int hGap) { 43 | this.hGap = hGap; 44 | } 45 | 46 | public void sethGap(float hGap) { 47 | this.hGap = hGap; 48 | } 49 | 50 | public boolean isAutoExpand() { 51 | return autoExpand; 52 | } 53 | 54 | public void setAutoExpand(boolean autoExpand) { 55 | this.autoExpand = autoExpand; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /tac-engine/src/test/java/com/alibaba/tac/engine/common/redis/RedisSequenceCounterTest.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac.engine.common.redis; 2 | 3 | import com.alibaba.tac.engine.test.TacEnginTest; 4 | import org.junit.Before; 5 | import org.junit.Test; 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.context.annotation.Configuration; 8 | 9 | import javax.annotation.Resource; 10 | 11 | import static org.junit.Assert.*; 12 | 13 | /** 14 | * @author jinshuan.li 01/03/2018 11:01 15 | */ 16 | public class RedisSequenceCounterTest extends TacEnginTest { 17 | 18 | 19 | @Resource 20 | RedisSequenceCounter redisSequenceCounter; 21 | 22 | @Before 23 | public void setUp() throws Exception { 24 | 25 | } 26 | 27 | @Test 28 | public void set() { 29 | 30 | redisSequenceCounter.set(10); 31 | Long data = redisSequenceCounter.get(); 32 | 33 | assertTrue(data.equals(10L)); 34 | } 35 | 36 | @Test 37 | public void get() { 38 | 39 | 40 | } 41 | 42 | @Test 43 | public void incrementAndGet() { 44 | 45 | long data = redisSequenceCounter.incrementAndGet(); 46 | 47 | 48 | Long data2 = redisSequenceCounter.get(); 49 | //assertTrue(data==11); 50 | } 51 | 52 | @Test 53 | public void increBy() { 54 | } 55 | } -------------------------------------------------------------------------------- /tac-sdk/src/main/java/com/alibaba/tac/sdk/common/TacContants.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package com.alibaba.tac.sdk.common; 4 | 5 | /** 6 | * Created by changkun.hck on 2016/12/20. 7 | */ 8 | public final class TacContants { 9 | public static final String USER_ID = "userId"; 10 | public static final String USER_NICK = "userNick"; 11 | public static final String PLATFORM = "platform"; 12 | public static final String VERSION = "version"; 13 | public static final String CHANNEL = "channel"; 14 | public static final String USER_AGENT = "userAgent"; 15 | public static final String IP = "ip"; 16 | public static final String TTID = "ttid"; 17 | public static final String UTDID = "utdid"; 18 | public static final String APP_NAME = "appName"; 19 | public static final String MS_CODE = "msCode"; 20 | public static final String DEBUG = "debug"; 21 | public static final String IMEI = "imei"; 22 | public static final String IMSI = "imsi"; 23 | public static final String DEVICE_ID = "deviceId"; 24 | public static final String DEVICE_MODE = "deviceMode"; 25 | public static final String DEVICE_OS_VERSION = "deviceOsVersion"; 26 | public static final String NETWORK_SCHEMA = "networkSchema"; 27 | public static final String FROM_CONSOLE="fromConsole"; 28 | 29 | public static final String HOTPOINT_KEY = "hotPointKey"; 30 | } 31 | -------------------------------------------------------------------------------- /tac-console-web/build/webpack.dev.conf.js: -------------------------------------------------------------------------------- 1 | var utils = require('./utils') 2 | var webpack = require('webpack') 3 | var config = require('../config') 4 | var merge = require('webpack-merge') 5 | var baseWebpackConfig = require('./webpack.base.conf') 6 | var HtmlWebpackPlugin = require('html-webpack-plugin') 7 | var FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin') 8 | 9 | // add hot-reload related code to entry chunks 10 | Object.keys(baseWebpackConfig.entry).forEach(function (name) { 11 | baseWebpackConfig.entry[name] = ['./build/dev-client'].concat(baseWebpackConfig.entry[name]) 12 | }) 13 | 14 | module.exports = merge(baseWebpackConfig, { 15 | module: { 16 | rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap }) 17 | }, 18 | // cheap-module-eval-source-map is faster for development 19 | devtool: '#cheap-module-eval-source-map', 20 | plugins: [ 21 | new webpack.DefinePlugin({ 22 | 'process.env': config.dev.env 23 | }), 24 | // https://github.com/glenjamin/webpack-hot-middleware#installation--usage 25 | new webpack.HotModuleReplacementPlugin(), 26 | new webpack.NoEmitOnErrorsPlugin(), 27 | // https://github.com/ampedandwired/html-webpack-plugin 28 | new HtmlWebpackPlugin({ 29 | filename: 'index.html', 30 | template: 'index.html', 31 | inject: true 32 | }), 33 | new FriendlyErrorsPlugin() 34 | ] 35 | }) 36 | -------------------------------------------------------------------------------- /tac-console-web/build/check-versions.js: -------------------------------------------------------------------------------- 1 | var chalk = require('chalk') 2 | var semver = require('semver') 3 | var packageConfig = require('../package.json') 4 | var shell = require('shelljs') 5 | function exec (cmd) { 6 | return require('child_process').execSync(cmd).toString().trim() 7 | } 8 | 9 | var versionRequirements = [ 10 | { 11 | name: 'node', 12 | currentVersion: semver.clean(process.version), 13 | versionRequirement: packageConfig.engines.node 14 | } 15 | ] 16 | 17 | if (shell.which('npm')) { 18 | versionRequirements.push({ 19 | name: 'npm', 20 | currentVersion: exec('npm --version'), 21 | versionRequirement: packageConfig.engines.npm 22 | }) 23 | } 24 | 25 | module.exports = function () { 26 | var warnings = [] 27 | for (var i = 0; i < versionRequirements.length; i++) { 28 | var mod = versionRequirements[i] 29 | if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) { 30 | warnings.push(mod.name + ': ' + 31 | chalk.red(mod.currentVersion) + ' should be ' + 32 | chalk.green(mod.versionRequirement) 33 | ) 34 | } 35 | } 36 | 37 | if (warnings.length) { 38 | console.log('') 39 | console.log(chalk.yellow('To use this template, you must update following to modules:')) 40 | console.log() 41 | for (var i = 0; i < warnings.length; i++) { 42 | var warning = warnings[i] 43 | console.log(' ' + warning) 44 | } 45 | console.log() 46 | process.exit(1) 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /tac-sdk/src/main/java/com/alibaba/tac/sdk/common/TacParams.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac.sdk.common; 2 | 3 | import lombok.Data; 4 | import org.apache.commons.lang3.StringUtils; 5 | 6 | import java.io.Serializable; 7 | import java.util.HashMap; 8 | import java.util.Map; 9 | 10 | @Data 11 | public class TacParams implements Serializable { 12 | 13 | private static final long serialVersionUID = 6681979519642226666L; 14 | private String appName; 15 | 16 | /** 17 | * the service codes , required, split with ',' 18 | * 19 | */ 20 | private String msCodes; 21 | 22 | /** 23 | * is batch execute 24 | * 25 | */ 26 | private boolean isBatch = false; 27 | 28 | /** 29 | * the service params, {@link TacContants} 30 | * 31 | */ 32 | private Map paramMap = new HashMap(); 33 | 34 | public TacParams(String appName, String msCodes) { 35 | this.appName = appName; 36 | this.msCodes = msCodes; 37 | } 38 | 39 | public String getParamValue(String paramKey) { 40 | if (StringUtils.isEmpty(paramKey)) { 41 | return StringUtils.EMPTY; 42 | } 43 | if (paramMap.get(paramKey) != null) { 44 | return String.valueOf(paramMap.get(paramKey)); 45 | } else { 46 | return StringUtils.EMPTY; 47 | } 48 | } 49 | 50 | public void addPara(String key, Object value) { 51 | this.paramMap.put(key, value); 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /tac-sdk/src/main/java/com/alibaba/tac/sdk/tangram4tac/Cell.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac.sdk.tangram4tac; 2 | 3 | import com.alibaba.tac.sdk.tangram4tac.render.DefaultRender; 4 | import com.alibaba.tac.sdk.tangram4tac.render.IRender; 5 | 6 | /** 7 | * Created by longerian on 2017/11/5. 8 | */ 9 | public abstract class Cell { 10 | 11 | protected String id; 12 | 13 | protected final String type; 14 | 15 | protected T style; 16 | 17 | protected String reuseId; 18 | 19 | @FieldExcluder 20 | protected IRender mRender; 21 | 22 | public Cell() { 23 | this.type = getType(); 24 | this.mRender = new DefaultRender(); 25 | } 26 | 27 | public void setId(String id) { 28 | this.id = id; 29 | } 30 | 31 | public void setReuseId(String reuseId) { 32 | this.reuseId = reuseId; 33 | } 34 | 35 | public String getId() { 36 | return id; 37 | } 38 | 39 | public void setStyle(T style) { 40 | this.style = style; 41 | } 42 | 43 | public T getStyle() { 44 | return style; 45 | } 46 | 47 | public String getReuseId() { 48 | return reuseId; 49 | } 50 | 51 | public void setRender(IRender mRender) { 52 | this.mRender = mRender; 53 | } 54 | 55 | public abstract String getType(); 56 | 57 | public Object render() { 58 | if (mRender != null) { 59 | return mRender.renderTo(this); 60 | } 61 | return null; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /tac-engine/src/main/java/com/alibaba/tac/engine/util/HConstants.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2010 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | package com.alibaba.tac.engine.util; 21 | 22 | /** 23 | * HConstants holds a bunch of HBase-related constants 24 | */ 25 | public final class HConstants { 26 | 27 | 28 | /** 29 | * An empty instance. 30 | */ 31 | public static final byte [] EMPTY_BYTE_ARRAY = new byte [0]; 32 | 33 | 34 | /** When we encode strings, we always specify UTF8 encoding */ 35 | public static final String UTF8_ENCODING = "UTF-8"; 36 | 37 | private HConstants() { 38 | // Can't be instantiated with this ctor. 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /tac-sdk/src/main/java/com/alibaba/tac/sdk/tangram4tac/lib/CellType.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac.sdk.tangram4tac.lib; 2 | 3 | /** 4 | * Created by longerian on 2017/11/5. 5 | */ 6 | public class CellType { 7 | 8 | public static final String TYPE_CONTAINER_FLOW = "container-flow"; 9 | 10 | public static final String TYPE_CONTAINER_1C_FLOW = "container-oneColumn"; 11 | 12 | public static final String TYPE_CONTAINER_2C_FLOW = "container-twoColumn"; 13 | 14 | public static final String TYPE_CONTAINER_3C_FLOW = "container-threeColumn"; 15 | 16 | public static final String TYPE_CONTAINER_4C_FLOW = "container-fourColumn"; 17 | 18 | public static final String TYPE_CONTAINER_5C_FLOW = "container-fiveColumn"; 19 | 20 | public static final String TYPE_CONTAINER_ON_PLUSN = "container-onePlusN"; 21 | 22 | public static final String TYPE_CONTAINER_FLOAT = "container-float"; 23 | 24 | public static final String TYPE_CONTAINER_BANNER = "container-banner"; 25 | 26 | public static final String TYPE_CONTAINER_SCROLL = "container-scroll"; 27 | 28 | public static final String TYPE_CONTAINER_STICKY = "container-sticky"; 29 | 30 | public static final String TYPE_CONTAINER_WATERFALL = "container-waterfall"; 31 | 32 | public static final String TYPE_CONTAINER_FIX = "container-fix"; 33 | 34 | public static final String TYPE_CONTAINER_SCROLL_FIX = "container-scrollFix"; 35 | 36 | public static final String TYPE_CONTAINER_SCROLL_FIX_BANNER = "container-scrollFixBanner"; 37 | 38 | } 39 | -------------------------------------------------------------------------------- /tac-console/src/main/java/com/alibaba/tac/console/error/IErrorCode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2016 Alibaba Group 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package com.alibaba.tac.console.error; 26 | 27 | /** 28 | * @author jinshuan.li 06/03/2018 12:18 29 | */ 30 | public interface IErrorCode { 31 | 32 | String getCode(); 33 | 34 | String getMessage(); 35 | } 36 | -------------------------------------------------------------------------------- /tac-console/src/main/resources/static/js/manifest.58ce01f7a6fd036b4f8d.js: -------------------------------------------------------------------------------- 1 | !function(e){function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}var r=window.webpackJsonp;window.webpackJsonp=function(t,c,i){for(var u,a,f,s=0,l=[];s EMPTY_LIST = Collections 31 | .unmodifiableList(new ArrayList(0)); 32 | 33 | @SuppressWarnings("unchecked") 34 | public static Iterable nullSafe(Iterable in) { 35 | if (in == null) { 36 | return (List) EMPTY_LIST; 37 | } 38 | return in; 39 | } 40 | 41 | } -------------------------------------------------------------------------------- /tac-engine/src/test/java/com/alibaba/tac/engine/inst/service/redis/RedisMsInstFileServiceTest.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac.engine.inst.service.redis; 2 | 3 | import com.alibaba.tac.engine.inst.domain.TacInst; 4 | import com.alibaba.tac.engine.inst.service.DevMsInstFileService; 5 | import com.alibaba.tac.engine.test.TacEnginTest; 6 | import org.junit.Before; 7 | import org.junit.Test; 8 | 9 | import javax.annotation.Resource; 10 | 11 | import static org.junit.Assert.*; 12 | 13 | /** 14 | * @author jinshuan.li 01/03/2018 13:38 15 | */ 16 | public class RedisMsInstFileServiceTest extends TacEnginTest { 17 | 18 | @Resource 19 | private RedisMsInstFileService redisMsInstFileService; 20 | 21 | @Resource 22 | private DevMsInstFileService devMsInstFileService; 23 | 24 | private TacInst tacInst; 25 | 26 | @Before 27 | public void setUp() throws Exception { 28 | 29 | tacInst = new TacInst(); 30 | tacInst.setJarVersion("abcccc"); 31 | tacInst.setId(111); 32 | tacInst.setMsCode("abc"); 33 | tacInst.setName("abc-test"); 34 | } 35 | 36 | @Test 37 | public void getInstanceFile() { 38 | 39 | byte[] instanceFile = redisMsInstFileService.getInstanceFile(tacInst.getId()); 40 | 41 | assertNotNull(instanceFile); 42 | } 43 | 44 | @Test 45 | public void saveInstanceFile() { 46 | 47 | Boolean aBoolean = redisMsInstFileService.saveInstanceFile(tacInst, 48 | devMsInstFileService.getInstanceFile(tacInst.getMsCode())); 49 | 50 | assertTrue(aBoolean); 51 | } 52 | } -------------------------------------------------------------------------------- /tac-engine/src/main/java/com/alibaba/tac/engine/ms/service/IMsSubscriber.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2016 Alibaba Group 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package com.alibaba.tac.engine.ms.service; 26 | 27 | /** 28 | * @author jinshuan.li 26/02/2018 15:24 29 | */ 30 | public interface IMsSubscriber { 31 | 32 | /** 33 | * begin subscribe event 34 | */ 35 | void subscribe(); 36 | 37 | } 38 | -------------------------------------------------------------------------------- /tac-engine/src/main/java/com/alibaba/tac/engine/common/TacIDGenerator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2016 Alibaba Group 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package com.alibaba.tac.engine.common; 26 | 27 | /** 28 | * @author jinshuan.li 01/03/2018 13:09 29 | */ 30 | public interface TacIDGenerator { 31 | 32 | /** 33 | * get next id 34 | * 35 | * @return 36 | */ 37 | Long getNextId(); 38 | } 39 | -------------------------------------------------------------------------------- /tac-engine/src/test/java/com/alibaba/tac/engine/ms/service/redis/RedisMsPublisherTest.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac.engine.ms.service.redis; 2 | 3 | import com.alibaba.tac.engine.inst.domain.TacInst; 4 | import com.alibaba.tac.engine.inst.service.DevMsInstFileService; 5 | import com.alibaba.tac.engine.inst.service.IMsInstService; 6 | import com.alibaba.tac.engine.test.TacEnginTest; 7 | import org.junit.Test; 8 | 9 | import javax.annotation.Resource; 10 | import java.util.concurrent.CountDownLatch; 11 | 12 | import static org.junit.Assert.*; 13 | 14 | /** 15 | * @author jinshuan.li 01/03/2018 16:22 16 | */ 17 | public class RedisMsPublisherTest extends TacEnginTest { 18 | 19 | @Resource 20 | RedisMsPublisher redisMsPublisher; 21 | 22 | @Resource 23 | IMsInstService iMsInstService; 24 | 25 | @Resource 26 | private DevMsInstFileService devMsInstFileService; 27 | 28 | CountDownLatch countDownLatch = new CountDownLatch(1); 29 | 30 | @Test 31 | public void publish() throws InterruptedException { 32 | 33 | TacInst abc = iMsInstService.getTacMsInst(1L); 34 | byte[] abcs = devMsInstFileService.getInstanceFile("abc"); 35 | Boolean publish = redisMsPublisher.publish(abc, abcs); 36 | 37 | assertTrue(publish); 38 | 39 | countDownLatch.await(); 40 | } 41 | 42 | @Test 43 | public void offline() throws InterruptedException { 44 | TacInst abc = iMsInstService.getTacMsInst(1L); 45 | Boolean offline = redisMsPublisher.offline(abc); 46 | assertTrue(offline); 47 | 48 | countDownLatch.await(); 49 | } 50 | } -------------------------------------------------------------------------------- /tac-console-web/src/components/Hello.vue: -------------------------------------------------------------------------------- 1 | 23 | 24 | 34 | 35 | 36 | 55 | -------------------------------------------------------------------------------- /tac-engine/src/main/java/com/alibaba/tac/engine/event/domain/MsPublishEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2016 Alibaba Group 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package com.alibaba.tac.engine.event.domain; 26 | 27 | import com.alibaba.tac.engine.inst.domain.TacInst; 28 | import lombok.Data; 29 | 30 | /** 31 | * @author jinshuan.li 26/02/2018 15:45 32 | */ 33 | @Data 34 | public class MsPublishEvent extends AbstractMsEvent { 35 | 36 | private TacInst tacInst; 37 | } 38 | -------------------------------------------------------------------------------- /tac-engine/src/test/java/com/alibaba/tac/test/http/HttpClientTest.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac.test.http; 2 | 3 | import com.alibaba.fastjson.JSONObject; 4 | import com.alibaba.tac.sdk.common.TacResult; 5 | import org.asynchttpclient.AsyncHttpClient; 6 | import org.asynchttpclient.ListenableFuture; 7 | import org.asynchttpclient.Response; 8 | import org.asynchttpclient.util.HttpConstants; 9 | import org.junit.Test; 10 | 11 | import java.util.concurrent.ExecutionException; 12 | import java.util.concurrent.TimeUnit; 13 | import java.util.concurrent.TimeoutException; 14 | 15 | import static org.asynchttpclient.Dsl.asyncHttpClient; 16 | 17 | /** 18 | * @author jinshuan.li 07/03/2018 15:41 19 | */ 20 | public class HttpClientTest { 21 | 22 | @Test 23 | public void test() throws InterruptedException, ExecutionException, TimeoutException { 24 | 25 | JSONObject data = new JSONObject(); 26 | data.put("name", "ljinshuan"); 27 | 28 | AsyncHttpClient asyncHttpClient = asyncHttpClient(); 29 | 30 | ListenableFuture execute = asyncHttpClient.preparePost("http://localhost:8001/api/tac/execute/shuan") 31 | .addHeader("Content-Type", "application/json;charset=UTF-8").setBody(data.toJSONString()).execute(); 32 | Response response = execute.get(10, TimeUnit.SECONDS); 33 | 34 | if (response.getStatusCode() == HttpConstants.ResponseStatusCodes.OK_200) { 35 | TacResult tacResult = JSONObject.parseObject(response.getResponseBody(), TacResult.class); 36 | 37 | System.out.println(tacResult); 38 | } 39 | System.out.println(response); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /tac-dev-source-demo/src/main/java/com/alibaba/tac/biz/processor/HelloWorldTac.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac.biz.processor; 2 | 3 | import com.alibaba.tac.sdk.common.TacResult; 4 | import com.alibaba.tac.sdk.domain.Context; 5 | import com.alibaba.tac.sdk.factory.TacInfrasFactory; 6 | import com.alibaba.tac.sdk.handler.TacHandler; 7 | import com.alibaba.tac.sdk.infrastracture.TacLogger; 8 | import com.tmall.itemcenter.ItemDO; 9 | import com.tmall.itemcenter.TmallItemService; 10 | 11 | import java.util.HashMap; 12 | import java.util.Map; 13 | 14 | /** 15 | * @author jinshuan.li 16 | */ 17 | public class HelloWorldTac implements TacHandler { 18 | 19 | /** 20 | * get the logger service 21 | */ 22 | private TacLogger tacLogger = TacInfrasFactory.getLogger(); 23 | 24 | private TmallItemService tmallItemService = TacInfrasFactory.getServiceBean(TmallItemService.class); 25 | 26 | /** 27 | * implement a class which implements TacHandler interface {@link TacHandler} 28 | * 29 | * @param context 30 | * @return 31 | * @throws Exception 32 | */ 33 | 34 | @Override 35 | public TacResult execute(Context context) throws Exception { 36 | 37 | // the code 38 | tacLogger.info("Hello World22"); 39 | 40 | Map data = new HashMap<>(); 41 | data.put("name", "hellotac"); 42 | data.put("platform", "iPhone"); 43 | data.put("clientVersion", "7.0.2"); 44 | data.put("userName", "tac-userName"); 45 | 46 | ItemDO item = tmallItemService.getItem(1L); 47 | data.put("item", item); 48 | return TacResult.newResult(data); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /tac-console/src/main/java/com/alibaba/tac/console/web/ro/InstTestRO.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2016 Alibaba Group 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package com.alibaba.tac.console.web.ro; 26 | 27 | import lombok.Data; 28 | 29 | import java.io.Serializable; 30 | import java.util.Map; 31 | 32 | /** 33 | * @author jinshuan.li 06/03/2018 14:21 34 | */ 35 | 36 | @Data 37 | public class InstTestRO implements Serializable { 38 | 39 | private Long instId; 40 | 41 | private String msCode; 42 | 43 | private Map params; 44 | 45 | } 46 | -------------------------------------------------------------------------------- /tac-engine/src/test/java/com/alibaba/tac/engine/inst/service/redis/RedisMsInstServiceTest.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac.engine.inst.service.redis; 2 | 3 | import com.alibaba.tac.engine.inst.domain.TacInst; 4 | import com.alibaba.tac.engine.test.TacEnginTest; 5 | import org.junit.Before; 6 | import org.junit.Test; 7 | 8 | import javax.annotation.Resource; 9 | import java.util.List; 10 | 11 | import static org.junit.Assert.*; 12 | 13 | /** 14 | * @author jinshuan.li 01/03/2018 14:42 15 | */ 16 | public class RedisMsInstServiceTest extends TacEnginTest { 17 | 18 | 19 | @Resource 20 | private RedisMsInstService redisMsInstService; 21 | 22 | TacInst tacInst = new TacInst(); 23 | 24 | @Before 25 | public void before() { 26 | 27 | tacInst.setJarVersion("xxxxx"); 28 | tacInst.setMsCode("abc"); 29 | tacInst.setName("test"); 30 | } 31 | 32 | @Test 33 | public void getAllTacMsInsts() { 34 | 35 | List allTacMsInsts = redisMsInstService.getAllTacMsInsts(); 36 | 37 | assertNotNull(allTacMsInsts); 38 | } 39 | 40 | @Test 41 | public void getTacMsInst() { 42 | 43 | TacInst tacMsInst = redisMsInstService.getTacMsInst(1L); 44 | assertNotNull(tacMsInst); 45 | } 46 | 47 | @Test 48 | public void createTacMsInst() { 49 | 50 | TacInst tacMsInst = redisMsInstService.createTacMsInst(tacInst); 51 | 52 | assertTrue(tacMsInst.getId() > 0); 53 | } 54 | 55 | @Test 56 | public void removeMsInst() { 57 | Boolean success = redisMsInstService.removeMsInst(1L); 58 | assertTrue(success); 59 | 60 | TacInst tacMsInst = redisMsInstService.getTacMsInst(1L); 61 | 62 | assertNull(tacMsInst); 63 | } 64 | } -------------------------------------------------------------------------------- /tac-sdk/src/main/java/com/alibaba/tac/sdk/tangram4tac/lib/OneChildContainer.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac.sdk.tangram4tac.lib; 2 | 3 | import com.alibaba.tac.sdk.tangram4tac.Cell; 4 | import com.alibaba.tac.sdk.tangram4tac.Container; 5 | import com.alibaba.tac.sdk.tangram4tac.Style; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by longerian on 2017/11/5. 11 | */ 12 | public abstract class OneChildContainer extends Container { 13 | 14 | public void addChild(Cell child) { 15 | addChild(child, -1); 16 | } 17 | 18 | public void addChild(Cell child, int index) { 19 | if (items.isEmpty() && child != null) { 20 | if (index < 0) { 21 | items.add(child); 22 | } else if (index == 0) { 23 | items.add(0, child); 24 | } else if (index > 0 && index < items.size()) { 25 | items.add(index, child); 26 | } 27 | } 28 | } 29 | 30 | public void addChildren(List children) { 31 | addChildren(children, -1); 32 | } 33 | 34 | public void addChildren(List children, int index) { 35 | if (children != null && !children.isEmpty()) { 36 | if (items.isEmpty()) { 37 | if (children.size() > 0) { 38 | Cell child = children.get(0); 39 | if (index < 0) { 40 | items.add(child); 41 | } else if (index == 0) { 42 | items.add(0, child); 43 | } else if (index > 0 && index < items.size()) { 44 | items.add(index, child); 45 | } 46 | } 47 | } 48 | } 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /tac-engine/src/test/java/com/alibaba/tac/engine/service/JdkCompilerTest.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac.engine.service; 2 | 3 | import com.alibaba.tac.engine.code.CodeCompileService; 4 | import com.alibaba.tac.engine.test.TacEnginTest; 5 | import com.alibaba.tac.sdk.common.TacResult; 6 | import com.google.common.collect.Maps; 7 | import org.junit.Before; 8 | import org.junit.Test; 9 | 10 | import javax.annotation.Resource; 11 | import java.io.File; 12 | import java.io.IOException; 13 | 14 | import static org.junit.Assert.assertNotNull; 15 | 16 | /** 17 | * @author jinshuan.li 12/02/2018 08:49 18 | */ 19 | 20 | public class JdkCompilerTest extends TacEnginTest { 21 | 22 | @Resource 23 | private CodeCompileService codeCompileService; 24 | 25 | @Resource 26 | private TacInstRunService tacInstService; 27 | 28 | private String src = "/Users/jinshuan.li/Source/open-tac/tac-dev-source"; 29 | 30 | private String msCode = "abcd"; 31 | 32 | @Before 33 | public void beforeTest() throws Exception { 34 | 35 | } 36 | 37 | @Test 38 | public void testCompiler() throws Exception { 39 | 40 | 41 | codeCompileService.compile(msCode, src); 42 | } 43 | 44 | @Test 45 | public void testPackage() throws IOException { 46 | 47 | byte[] jarFile = codeCompileService.getJarFile(msCode); 48 | 49 | assertNotNull(jarFile); 50 | } 51 | 52 | @Test 53 | public void runCodeTest() throws Exception { 54 | 55 | TacResult tacResult = tacInstService.runWithLoad("msCode", 1024L, Maps.newHashMap()); 56 | 57 | System.out.println(tacResult); 58 | 59 | } 60 | 61 | String getCurrentPath() { 62 | File file = new File(""); 63 | return file.getAbsolutePath(); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /tac-sdk/src/main/java/com/alibaba/tac/sdk/domain/TacRequestContext.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac.sdk.domain; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | 6 | public class TacRequestContext implements Context { 7 | 8 | 9 | private String appName; 10 | 11 | private String msCode; 12 | 13 | private long instId; 14 | 15 | @Override 16 | public String getAppName() { 17 | return appName; 18 | } 19 | 20 | public void setAppName(String appName) { 21 | this.appName = appName; 22 | } 23 | 24 | public void setMsCode(String msCode) { 25 | this.msCode = msCode; 26 | } 27 | 28 | public void setInstId(long instId) { 29 | this.instId = instId; 30 | } 31 | 32 | public void setParamMap(Map paramMap) { 33 | this.paramMap = paramMap; 34 | } 35 | 36 | private Map paramMap = new HashMap(); 37 | 38 | @Override 39 | public String getMsCode() { 40 | return msCode; 41 | } 42 | 43 | @Override 44 | public long getInstId() { 45 | return instId; 46 | } 47 | 48 | @Override 49 | public Object get(String key) { 50 | return paramMap.get(key); 51 | } 52 | 53 | @Override 54 | public boolean containsKey(String key) { 55 | return paramMap.containsKey(key); 56 | } 57 | 58 | @Override 59 | public Map getParams() { 60 | return paramMap; 61 | } 62 | 63 | public Map getParamMap() { 64 | return paramMap; 65 | } 66 | 67 | public void putAll(Map paramMap) { 68 | if (paramMap != null || !paramMap.isEmpty()) { 69 | this.paramMap.putAll(paramMap); 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /tac-engine/src/main/java/com/alibaba/tac/engine/event/domain/GetAllMsEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2016 Alibaba Group 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package com.alibaba.tac.engine.event.domain; 26 | 27 | import lombok.Data; 28 | 29 | import java.util.List; 30 | 31 | /** 32 | * @author jinshuan.li 26/02/2018 15:44 33 | */ 34 | @Data 35 | public class GetAllMsEvent extends AbstractMsEvent { 36 | 37 | private List msCodes; 38 | 39 | 40 | public GetAllMsEvent(){ 41 | 42 | } 43 | 44 | public GetAllMsEvent(List msCodes) { 45 | this.msCodes = msCodes; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /tac-engine/src/main/java/com/alibaba/tac/engine/event/domain/MsOfflineEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2016 Alibaba Group 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package com.alibaba.tac.engine.event.domain; 26 | 27 | import com.alibaba.tac.engine.inst.domain.TacInst; 28 | import lombok.Data; 29 | 30 | /** 31 | * @author jinshuan.li 27/02/2018 12:23 32 | */ 33 | @Data 34 | public class MsOfflineEvent extends AbstractMsEvent { 35 | 36 | private TacInst tacInst; 37 | 38 | public MsOfflineEvent(TacInst tacInst) { 39 | super(tacInst.getMsCode()); 40 | this.tacInst = tacInst; 41 | 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /tac-console/src/main/java/com/alibaba/tac/console/web/HomeController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2016 Alibaba Group 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package com.alibaba.tac.console.web; 26 | 27 | import org.springframework.stereotype.Controller; 28 | import org.springframework.web.bind.annotation.GetMapping; 29 | import org.springframework.web.bind.annotation.RequestMapping; 30 | 31 | /** 32 | * @author jinshuan.li 07/03/2018 17:18 33 | */ 34 | @Controller 35 | @RequestMapping 36 | public class HomeController { 37 | 38 | @GetMapping("/") 39 | public String index() { 40 | 41 | return "index"; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /tac-engine/src/main/java/com/alibaba/tac/engine/event/domain/MsReceivePublishEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2016 Alibaba Group 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package com.alibaba.tac.engine.event.domain; 26 | 27 | import com.alibaba.tac.engine.inst.domain.TacInst; 28 | import lombok.Data; 29 | 30 | /** 31 | * @author jinshuan.li 26/02/2018 20:18 32 | */ 33 | @Data 34 | public class MsReceivePublishEvent extends AbstractMsEvent { 35 | 36 | public MsReceivePublishEvent(TacInst tacInst) { 37 | this.tacInst = tacInst; 38 | } 39 | 40 | /** 41 | * the inst info 42 | */ 43 | private TacInst tacInst; 44 | } 45 | -------------------------------------------------------------------------------- /tac-console/src/main/java/com/alibaba/tac/console/TacApplicationContext.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2016 Alibaba Group 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package com.alibaba.tac.console; 26 | 27 | import lombok.extern.slf4j.Slf4j; 28 | import org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext; 29 | 30 | /** 31 | * @author jinshuan.li 06/03/2018 20:51 32 | */ 33 | @Slf4j 34 | @Deprecated 35 | public class TacApplicationContext extends AnnotationConfigEmbeddedWebApplicationContext { 36 | 37 | public TacApplicationContext() throws Exception { 38 | 39 | super(); 40 | } 41 | 42 | 43 | 44 | } 45 | -------------------------------------------------------------------------------- /tac-console/src/main/java/com/alibaba/tac/console/web/InstFileRO.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2016 Alibaba Group 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package com.alibaba.tac.console.web; 26 | 27 | import lombok.Data; 28 | import org.springframework.web.multipart.MultipartFile; 29 | 30 | import java.io.Serializable; 31 | 32 | /** 33 | * @author jinshuan.li 05/03/2018 20:16 34 | */ 35 | @Data 36 | public class InstFileRO implements Serializable{ 37 | private static final long serialVersionUID = -7650755238417075767L; 38 | 39 | 40 | private String name; 41 | 42 | private MultipartFile file; 43 | 44 | private Integer age; 45 | } 46 | -------------------------------------------------------------------------------- /tac-engine/src/main/java/com/alibaba/tac/engine/common/DefaultTacIDGenerator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2016 Alibaba Group 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package com.alibaba.tac.engine.common; 26 | 27 | import org.springframework.stereotype.Service; 28 | 29 | import javax.annotation.Resource; 30 | 31 | /** 32 | * @author jinshuan.li 01/03/2018 13:10 33 | */ 34 | @Service 35 | public class DefaultTacIDGenerator implements TacIDGenerator { 36 | 37 | @Resource(name = "msInstIdCounter") 38 | private SequenceCounter msInstIdCounter; 39 | 40 | @Override 41 | public Long getNextId() { 42 | return msInstIdCounter.incrementAndGet(); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /tac-engine/src/main/java/com/alibaba/tac/engine/ms/domain/TacMsStatus.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2016 Alibaba Group 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package com.alibaba.tac.engine.ms.domain; 26 | 27 | import lombok.Getter; 28 | 29 | /** 30 | * @author jinshuan.li 28/02/2018 13:27 31 | */ 32 | public enum TacMsStatus { 33 | /** 34 | * invalid 35 | */ 36 | INVALID(-1), 37 | 38 | /** 39 | * normal 40 | */ 41 | NORMAL(0); 42 | 43 | private TacMsStatus(int code) { 44 | this.code = code; 45 | } 46 | 47 | @Getter 48 | private Integer code; 49 | 50 | public Integer code() { 51 | return code; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /tac-engine/src/main/java/com/alibaba/tac/engine/service/TacEngineService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2016 Alibaba Group 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package com.alibaba.tac.engine.service; 26 | 27 | import com.alibaba.tac.sdk.common.TacParams; 28 | import com.alibaba.tac.sdk.common.TacResult; 29 | 30 | import java.util.Map; 31 | 32 | /** 33 | * @author jinshuan.li 12/02/2018 18:44 34 | *

35 | * the engine entrance 36 | */ 37 | public interface TacEngineService { 38 | 39 | /** 40 | * execute msCode 41 | * 42 | * @param params 43 | * @return 44 | */ 45 | TacResult> execute(String msCode, TacParams params); 46 | } 47 | -------------------------------------------------------------------------------- /tac-engine/src/main/java/com/alibaba/tac/engine/inst/domain/TacInstStatus.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2016 Alibaba Group 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package com.alibaba.tac.engine.inst.domain; 26 | 27 | import lombok.Getter; 28 | 29 | /** 30 | * @author jinshuan.li 28/02/2018 13:27 31 | */ 32 | public enum TacInstStatus { 33 | 34 | /** 35 | * invalid 36 | */ 37 | INVALID(-1), 38 | 39 | /** 40 | * normal 41 | */ 42 | NORMAL(0); 43 | 44 | private TacInstStatus(int code) { 45 | this.code = code; 46 | } 47 | 48 | @Getter 49 | private Integer code; 50 | 51 | public Integer code() { 52 | return code; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /tac-sdk/src/main/java/com/alibaba/tac/sdk/factory/AbstractServiceFactory.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac.sdk.factory; 2 | 3 | import org.springframework.beans.BeansException; 4 | import org.springframework.context.ApplicationContext; 5 | import org.springframework.context.ApplicationContextAware; 6 | 7 | /** 8 | * 9 | * the factory class which provide tac engine data source 10 | */ 11 | public abstract class AbstractServiceFactory implements ApplicationContextAware { 12 | 13 | /** 14 | * the Spring contenxt 15 | */ 16 | public static ApplicationContext applicationContext; 17 | 18 | 19 | 20 | @Override 21 | public void setApplicationContext(ApplicationContext ac) throws BeansException { 22 | if (applicationContext != null) { 23 | return; 24 | } 25 | // set the spring context 26 | applicationContext = ac; 27 | } 28 | 29 | /** 30 | * get spring bean with beanId; 31 | * 32 | * @param beanId spring bean id 33 | * @param 34 | * @return 35 | */ 36 | protected static T getServiceBean(String beanId) { 37 | if (applicationContext.getBean(beanId) == null) { 38 | throw new IllegalStateException("bean[" + beanId + "] Incorrectly configured!"); 39 | } 40 | return (T)applicationContext.getBean(beanId); 41 | } 42 | 43 | public static T getServiceBean(Class clazz) { 44 | 45 | T bean = applicationContext.getBean(clazz); 46 | 47 | checkNull(bean, clazz); 48 | 49 | return bean; 50 | } 51 | 52 | private static void checkNull(Object bean, Class clazz) { 53 | 54 | if (bean == null) { 55 | String format = String.format("bean [ %s ] Incorrectly configured!", clazz.getName()); 56 | throw new IllegalStateException(format); 57 | } 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /tac-console-web/config/index.js: -------------------------------------------------------------------------------- 1 | // see http://vuejs-templates.github.io/webpack for documentation. 2 | var path = require('path'); 3 | 4 | module.exports = { 5 | build: { 6 | env: require('./prod.env'), 7 | index: path.resolve(__dirname, '../dist/index.html'), 8 | assetsRoot: path.resolve(__dirname, '../dist'), 9 | assetsSubDirectory: 'static', 10 | assetsPublicPath: '/', 11 | productionSourceMap: true, 12 | // Gzip off by default as many popular static hosts such as 13 | // Surge or Netlify already gzip all static assets for you. 14 | // Before setting to `true`, make sure to: 15 | // npm install --save-dev compression-webpack-plugin 16 | productionGzip: false, 17 | productionGzipExtensions: ['js', 'css'], 18 | // Run the build command with an extra argument to 19 | // View the bundle analyzer report after build finishes: 20 | // `npm run build --report` 21 | // Set to `true` or `false` to always turn it on or off 22 | bundleAnalyzerReport: process.env.npm_config_report 23 | }, 24 | dev: { 25 | env: require('./dev.env'), 26 | port: 8080, 27 | autoOpenBrowser: true, 28 | assetsSubDirectory: 'static', 29 | assetsPublicPath: '/', 30 | proxyTable: { 31 | '/api': { 32 | target: 'http://localhost:7001', 33 | changeOrigin: true 34 | } 35 | }, 36 | // CSS Sourcemaps off by default because relative paths are "buggy" 37 | // with this option, according to the CSS-Loader README 38 | // (https://github.com/webpack/css-loader#sourcemaps) 39 | // In our experience, they generally work as expected, 40 | // just be aware of this issue when enabling this option. 41 | cssSourceMap: false 42 | } 43 | }; 44 | -------------------------------------------------------------------------------- /tac-engine/src/main/java/com/alibaba/tac/engine/inst/service/IMsInstFileService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2016 Alibaba Group 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package com.alibaba.tac.engine.inst.service; 26 | 27 | import com.alibaba.tac.engine.inst.domain.TacInst; 28 | 29 | /** 30 | * @author jinshuan.li 12/02/2018 17:46 31 | */ 32 | public interface IMsInstFileService { 33 | 34 | /** 35 | * get inst file data 36 | * 37 | * @param instId 38 | * @return 39 | */ 40 | byte[] getInstanceFile(long instId); 41 | 42 | /** 43 | * save inst file data 44 | * 45 | * @param tacInst 46 | * @return 47 | */ 48 | Boolean saveInstanceFile(TacInst tacInst, byte[] data); 49 | } 50 | -------------------------------------------------------------------------------- /tac-engine/src/main/java/com/alibaba/tac/engine/properties/TacMsConstants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2016 Alibaba Group 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package com.alibaba.tac.engine.properties; 26 | 27 | /** 28 | * @author jinshuan.li 26/02/2018 12:00 29 | */ 30 | public class TacMsConstants { 31 | 32 | 33 | public static final String DEFAULT_STORE="redis"; 34 | /** 35 | * zookeeper max data size KB 36 | */ 37 | public static Integer ZooKeeperMaxDataSizeKB = 1000; 38 | 39 | /** 40 | * inst status online 41 | */ 42 | public static Integer INST_STATUS_ONLINE = 1; 43 | 44 | /** 45 | * inst status offline 46 | */ 47 | public static Integer INST_STATUS_OFFLINE = -1; 48 | 49 | } 50 | -------------------------------------------------------------------------------- /tac-engine/src/main/java/com/alibaba/tac/engine/common/SequenceCounter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2016 Alibaba Group 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package com.alibaba.tac.engine.common; 26 | 27 | /** 28 | * @author jinshuan.li 2018/2/27 23:37 counter 29 | */ 30 | public interface SequenceCounter { 31 | 32 | /** 33 | * set value 34 | * @param value 35 | */ 36 | void set(long value); 37 | 38 | /** 39 | *get value 40 | * @return 41 | */ 42 | Long get(); 43 | 44 | /** 45 | * 46 | * incr and get 47 | * @return 48 | */ 49 | long incrementAndGet(); 50 | 51 | /** 52 | * 53 | * incr by a value 54 | * @param delta 55 | * @return 56 | */ 57 | long increBy(long delta); 58 | } 59 | -------------------------------------------------------------------------------- /tac-engine/src/main/java/com/alibaba/tac/engine/compile/InstCodeInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2016 Alibaba Group 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package com.alibaba.tac.engine.compile; 26 | 27 | import lombok.Data; 28 | 29 | import java.util.LinkedList; 30 | import java.util.List; 31 | 32 | /** 33 | * java code info 34 | */ 35 | @Data 36 | public class InstCodeInfo { 37 | 38 | /** 39 | * java code list 40 | */ 41 | List javaSourceCodes = new LinkedList(); 42 | 43 | /** 44 | * inst Id 45 | */ 46 | private Long instId; 47 | 48 | /** 49 | * inst Name 50 | */ 51 | private String name; 52 | 53 | /** 54 | * inst ClassName 55 | */ 56 | private String instClassName; 57 | 58 | } 59 | -------------------------------------------------------------------------------- /tac-console/src/main/java/com/alibaba/tac/console/ConsoleConstants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2016 Alibaba Group 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package com.alibaba.tac.console; 26 | 27 | /** 28 | * @author jinshuan.li 27/02/2018 21:00 29 | */ 30 | public class ConsoleConstants { 31 | 32 | public static final String MENU_HELP = "help"; 33 | 34 | public static final String MENU_PACKAGE = "package"; 35 | 36 | public static final String MENU_PUBLISH = "publish"; 37 | 38 | public static final String OPTION_ADMIN = "admin"; 39 | 40 | public static final String ADDDITION_PROFILE_SIMPLE = "simple"; 41 | 42 | public static final String ADDDITION_PROFILE_ADMIN = "admin"; 43 | 44 | public static final String ADDDITION_PROFILE_CONSOLE = "debug"; 45 | 46 | } 47 | -------------------------------------------------------------------------------- /tac-container/src/main/java/com/alibaba/tac/container/ContainerBeanConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2016 Alibaba Group 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package com.alibaba.tac.container; 26 | 27 | import com.alibaba.tac.engine.service.EngineBeansConfig; 28 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; 29 | import org.springframework.context.annotation.ComponentScan; 30 | import org.springframework.context.annotation.Configuration; 31 | import org.springframework.context.annotation.Import; 32 | 33 | /** 34 | * @author jinshuan.li 01/03/2018 17:21 35 | */ 36 | @ConditionalOnProperty(name = "scan.package.name") 37 | @Configuration 38 | @ComponentScan(basePackages = "${scan.package.name}") 39 | @Import(EngineBeansConfig.class) 40 | public class ContainerBeanConfig { 41 | 42 | } 43 | -------------------------------------------------------------------------------- /tac-console/src/main/java/com/alibaba/tac/console/error/ConsoleError.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * MIT License 4 | * 5 | * Copyright (c) 2016 Alibaba Group 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in all 15 | * copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | * SOFTWARE. 24 | */ 25 | 26 | package com.alibaba.tac.console.error; 27 | 28 | /** 29 | * @author jinshuan.li 06/03/2018 12:19 30 | */ 31 | public enum ConsoleError implements IErrorCode { 32 | /** 33 | * system error 34 | */ 35 | SYSTEM_ERROR("SYSTEM_ERROR", "system error"); 36 | 37 | private ConsoleError(String code, String msg) { 38 | 39 | this.code = code; 40 | this.msg = msg; 41 | } 42 | 43 | private String code; 44 | 45 | private String msg; 46 | 47 | @Override 48 | public String getCode() { 49 | return code; 50 | } 51 | 52 | @Override 53 | public String getMessage() { 54 | return msg; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /tac-engine/src/main/java/com/alibaba/tac/engine/compile/TacJavaFileObject.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2016 Alibaba Group 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package com.alibaba.tac.engine.compile; 26 | 27 | import javax.tools.SimpleJavaFileObject; 28 | import java.io.IOException; 29 | import java.net.URI; 30 | 31 | public class TacJavaFileObject extends SimpleJavaFileObject { 32 | 33 | private String javaCode; 34 | 35 | protected TacJavaFileObject(String name, String content) { 36 | super(URI.create("file:///" + name.replace('.', '/') 37 | + Kind.SOURCE.extension), Kind.SOURCE); 38 | this.javaCode = content; 39 | } 40 | 41 | @Override 42 | public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException { 43 | return javaCode; 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /tac-engine/src/main/java/com/alibaba/tac/engine/inst/domain/TacInstanceInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2016 Alibaba Group 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package com.alibaba.tac.engine.inst.domain; 26 | 27 | import com.alibaba.tac.sdk.handler.TacHandler; 28 | import lombok.Data; 29 | 30 | import java.io.Serializable; 31 | 32 | /** 33 | * @author jinshuan.li 12/02/2018 17:28 34 | */ 35 | @Data 36 | public class TacInstanceInfo implements Serializable{ 37 | 38 | private static final long serialVersionUID = 6433864847735515082L; 39 | /** 40 | * instanceId 41 | */ 42 | private long id; 43 | 44 | /** 45 | * intance data sign 46 | * 47 | */ 48 | private String jarVersion; 49 | 50 | /** 51 | * the tac handler class 52 | */ 53 | private TacHandler tacHandler; 54 | } 55 | -------------------------------------------------------------------------------- /docs/configs.md: -------------------------------------------------------------------------------- 1 | # TAC 配置 2 | 3 | * TAC 使用 springboot 构建,可是用 springboot 的标准配置文件来替换其默认配置; 4 | * 如 启动参数 --spring.config.location=file:/override.properties 5 | 6 | ## 通用配置 7 | 8 | ```properties 9 | # http 服务器端口 10 | 11 | server.port=8001 12 | 13 | # endpoint 配置 14 | 15 | management.port=8002 16 | 17 | # 使用的存储 redis 18 | tac.default.store=redis 19 | 20 | # 扩展点扫描的包名 逗号分隔 21 | scan.package.name=com.tmall.tac.test 22 | 23 | # 扩展jar包路径 24 | tac.extend.lib=extendlibs 25 | 26 | # 日志路径 27 | logging.config=classpath:tac/default-logback-spring.xml 28 | 29 | 30 | # 编译相关 31 | 32 | # 参考类 TacDataPathProperties 33 | # 编译结果路径 默认值 不建议修改 34 | tac.data.path.outputPathPrefix=${user.home}/tac/data/classes 35 | 36 | # 运行时加载的类路径 不建议修改 37 | tac.data.path.classLoadPathPrefix=${user.home}/tac/data/ms 38 | 39 | # 编译代码的包名 修改成自定义包名 40 | tac.data.path.pkgPrefix=com.alibaba.tac.biz; 41 | 42 | # redis存储相关配置 参考类 TacRedisConfigProperties 以下配置不建议修改 43 | # msInst元数据路径 44 | tac.redis.config.msInstMetaDataPath=com.alibaba.tac.msInstMetaData 45 | # ms元数据路径 46 | tac.redis.config.msMetaDataPath=com.alibaba.tac.msMetaData 47 | 48 | # 数据路径的前缀 49 | tac.redis.config.dataPathPrefix=msInstFile 50 | 51 | 52 | # 服务列表的路径 53 | tac.redis.config.msListPath=msPublishedList 54 | 55 | # 发布时候订阅的channel 56 | tac.redis.config.publishEventChannel=tac.inst.publish.channel 57 | 58 | 59 | 60 | ``` 61 | 62 | ## tac-console 配置 63 | 64 | ```properties 65 | # tac-container的http接口 在线上验证时使用 66 | tac.container.web.api=http://localhost:8001/api/tac/execute 67 | ``` 68 | 69 | 70 | ## gitlab配置 71 | 72 | ```properties 73 | # gitlab服务器地址 74 | tac.gitlab.config.hostURL=http://127.0.0.1 75 | 76 | # gitlab帐号token 77 | tac.gitlab.config.token=xxxxx 78 | 79 | # gitlab仓库groupName 80 | tac.gitlab.config.groupName=tac-admin 81 | 82 | 83 | # gitlab仓库帐号名 84 | tac.gitlab.config.userName=tac-admin 85 | 86 | # gitlab仓库帐号密码 87 | tac.gitlab.config.password=tac-admin 88 | 89 | 90 | # gitlab代码下载存储路径 (各微服务代码会下载到这个路径下) 91 | tac.gitlab.config.basePath=/home/admin/tac/git_codes 92 | ``` -------------------------------------------------------------------------------- /tac-engine/src/main/java/com/alibaba/tac/engine/autoconfigure/TacAutoConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2016 Alibaba Group 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package com.alibaba.tac.engine.autoconfigure; 26 | 27 | import com.alibaba.tac.engine.properties.TacDataPathProperties; 28 | import org.springframework.boot.context.properties.EnableConfigurationProperties; 29 | import org.springframework.context.annotation.Configuration; 30 | 31 | import javax.annotation.Resource; 32 | 33 | /** 34 | * @author jinshuan.li 2018/3/1 08:17 35 | * 36 | * the tac auto confige class. do nothing in the verion; 37 | */ 38 | 39 | @Configuration 40 | @EnableConfigurationProperties(TacDataPathProperties.class) 41 | public class TacAutoConfiguration { 42 | 43 | @Resource 44 | private TacDataPathProperties tacDataPathProperties; 45 | 46 | } 47 | -------------------------------------------------------------------------------- /tac-console/src/main/java/com/alibaba/tac/console/ConsoleBeanConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2016 Alibaba Group 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package com.alibaba.tac.console; 26 | 27 | import com.alibaba.tac.engine.service.EngineBeansConfig; 28 | import lombok.extern.slf4j.Slf4j; 29 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; 30 | import org.springframework.context.annotation.*; 31 | 32 | /** 33 | * @author jinshuan.li 01/03/2018 17:21 34 | * 35 | * this class is used to scan extend packages you can set the scan.package.name value from properties 36 | */ 37 | @Slf4j 38 | @ConditionalOnProperty(name = "scan.package.name") 39 | @Configuration 40 | @ComponentScan(basePackages = "${scan.package.name}") 41 | @Import(EngineBeansConfig.class) 42 | public class ConsoleBeanConfig { 43 | 44 | 45 | } 46 | -------------------------------------------------------------------------------- /tac-engine/src/main/java/com/alibaba/tac/engine/compile/JavaSourceCode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2016 Alibaba Group 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package com.alibaba.tac.engine.compile; 26 | 27 | import lombok.Data; 28 | 29 | /** 30 | * java source code info 31 | */ 32 | @Data 33 | public class JavaSourceCode { 34 | 35 | /** 36 | * class package name 37 | */ 38 | private String packageName; 39 | /** 40 | * class name without package name 41 | */ 42 | private String className; 43 | /** 44 | * the source content 45 | */ 46 | private String source; 47 | /** 48 | * the source file name 49 | */ 50 | private String fileName; 51 | 52 | public String getFullClassName() { 53 | return this.getPackageName().trim() + "." + this.getClassName(); 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /tac-dev-source-demo/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | tac 5 | com.alibaba 6 | 0.0.4 7 | 8 | 4.0.0 9 | 10 | tac-dev-source 11 | jar 12 | 13 | tac-dev-source-demo 14 | http://maven.apache.org 15 | 16 | 17 | UTF-8 18 | 19 | 20 | 21 | 22 | com.alibaba 23 | tac-sdk 24 | 0.0.4 25 | 26 | 27 | com.alibaba 28 | tac-custom-datasource-demo 29 | 0.0.4-SNAPSHOT 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | org.apache.maven.plugins 39 | maven-compiler-plugin 40 | 41 | ${jdk.version} 42 | ${jdk.version} 43 | UTF-8 44 | 45 | 46 | 47 | org.apache.maven.plugins 48 | maven-resources-plugin 49 | 50 | UTF-8 51 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /tac-engine/src/main/java/com/alibaba/tac/engine/code/SpringClassLoader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2016 Alibaba Group 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package com.alibaba.tac.engine.code; 26 | 27 | import java.net.URL; 28 | import java.net.URLClassLoader; 29 | 30 | /** 31 | * @author jinshuan.li 07/03/2018 10:18 32 | */ 33 | public class SpringClassLoader extends URLClassLoader { 34 | 35 | public SpringClassLoader(URL[] urls, ClassLoader parent) { 36 | super(urls, parent); 37 | } 38 | 39 | @Override 40 | protected Class loadClass(String name, boolean resolve) throws ClassNotFoundException { 41 | try { 42 | return super.loadClass(name, resolve); 43 | } catch (NoClassDefFoundError e) { 44 | // because we change the classloader , we should chaugh all exception here; 45 | return null; 46 | } 47 | 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /tac-console-web/src/router/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue'; 2 | import Router from 'vue-router'; 3 | import TacConsole from '@/components/TacConsole'; 4 | import Home from '@/components/Home'; 5 | import TacMs from '@/components/TacMs'; 6 | import TacMsList from '@/components/TacMsList'; 7 | import TacMsEdit from '@/components/TacMsEdit'; 8 | import TacInst from '@/components/TacInst'; 9 | import TacInstPublish from '@/components/TacInstPublish'; 10 | import TacInstPublishCheck from '@/components/TacInstPublishCheck'; 11 | 12 | Vue.component('Home', Home); 13 | Vue.component('TacMs', TacMs); 14 | 15 | Vue.use(Router); 16 | 17 | export default new Router({ 18 | routes: [ 19 | { path: '/', redirect: '/home' }, 20 | { 21 | path: '/home', 22 | name: 'home', 23 | component: Home 24 | }, 25 | { 26 | path: '/tacMs', 27 | redirect: '/tacMs/list', 28 | component: TacMs, 29 | children: [ 30 | { 31 | path: 'list', 32 | component: TacMsList 33 | }, 34 | { 35 | path: 'new', 36 | name: 'newMs', 37 | component: TacMsEdit 38 | }, 39 | { 40 | path: 'edit/:code', 41 | name: 'editMs', 42 | component: TacMsEdit 43 | } 44 | ] 45 | }, 46 | { 47 | path: '/tacInst', 48 | component: TacInst, 49 | redirect: '/tacMs/list', 50 | children: [ 51 | { 52 | name: 'msInstPublish', 53 | path: 'publish/:msCode', 54 | component: TacInstPublish 55 | }, 56 | { 57 | path: 'publishcheck', 58 | name: 'instTest', 59 | component: TacInstPublishCheck 60 | } 61 | ] 62 | } 63 | ] 64 | }); 65 | -------------------------------------------------------------------------------- /tac-console-web/src/components/TacConsole.vue: -------------------------------------------------------------------------------- 1 | 45 | 46 | 61 | 62 | 63 | 83 | -------------------------------------------------------------------------------- /tac-engine/src/main/java/com/alibaba/tac/engine/ms/domain/TacMs.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2016 Alibaba Group 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package com.alibaba.tac.engine.ms.domain; 26 | 27 | import com.alibaba.tac.engine.inst.domain.TacInst; 28 | import lombok.Data; 29 | 30 | import java.io.Serializable; 31 | import java.util.ArrayList; 32 | import java.util.List; 33 | 34 | /** 35 | * The tac msService calss 36 | */ 37 | @Data 38 | public class TacMs implements Serializable { 39 | 40 | private static final long serialVersionUID = 6396890479297204348L; 41 | /** 42 | * ms id 43 | */ 44 | private long id; 45 | 46 | /** 47 | * mscode 48 | */ 49 | private String code; 50 | /** 51 | * name 52 | */ 53 | private String name; 54 | 55 | 56 | /** 57 | * inst list 58 | */ 59 | private List instList = new ArrayList(); 60 | 61 | } 62 | -------------------------------------------------------------------------------- /tac-console-web/build/webpack.base.conf.js: -------------------------------------------------------------------------------- 1 | var path = require('path') 2 | var utils = require('./utils') 3 | var config = require('../config') 4 | var vueLoaderConfig = require('./vue-loader.conf') 5 | 6 | function resolve (dir) { 7 | return path.join(__dirname, '..', dir) 8 | } 9 | 10 | module.exports = { 11 | entry: { 12 | app: './src/main.js' 13 | }, 14 | output: { 15 | path: config.build.assetsRoot, 16 | filename: '[name].js', 17 | publicPath: process.env.NODE_ENV === 'production' 18 | ? config.build.assetsPublicPath 19 | : config.dev.assetsPublicPath 20 | }, 21 | resolve: { 22 | extensions: ['.js', '.vue', '.json'], 23 | alias: { 24 | 'vue$': 'vue/dist/vue.esm.js', 25 | '@': resolve('src'), 26 | } 27 | }, 28 | module: { 29 | rules: [ 30 | { 31 | test: /\.(js|vue)$/, 32 | loader: 'eslint-loader', 33 | enforce: 'pre', 34 | include: [resolve('src'), resolve('test')], 35 | options: { 36 | formatter: require('eslint-friendly-formatter') 37 | } 38 | }, 39 | { 40 | test: /\.vue$/, 41 | loader: 'vue-loader', 42 | options: vueLoaderConfig 43 | }, 44 | { 45 | test: /\.js$/, 46 | loader: 'babel-loader', 47 | include: [resolve('src'), resolve('test')] 48 | }, 49 | { 50 | test: /\.(png|jpe?g|gif|svg)(\?.*)?$/, 51 | loader: 'url-loader', 52 | options: { 53 | limit: 10000, 54 | name: utils.assetsPath('img/[name].[hash:7].[ext]') 55 | } 56 | }, 57 | { 58 | test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/, 59 | loader: 'url-loader', 60 | options: { 61 | limit: 10000, 62 | name: utils.assetsPath('media/[name].[hash:7].[ext]') 63 | } 64 | }, 65 | { 66 | test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/, 67 | loader: 'url-loader', 68 | options: { 69 | limit: 10000, 70 | name: utils.assetsPath('fonts/[name].[hash:7].[ext]') 71 | } 72 | } 73 | ] 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /tac-engine/src/main/java/com/alibaba/tac/engine/event/domain/AbstractMsEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2016 Alibaba Group 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package com.alibaba.tac.engine.event.domain; 26 | 27 | import lombok.Data; 28 | import org.springframework.context.ApplicationEvent; 29 | 30 | import java.io.Serializable; 31 | 32 | /** 33 | * @author jinshuan.li 26/02/2018 15:38 34 | *

35 | * the base event class 36 | */ 37 | @Data 38 | public abstract class AbstractMsEvent extends ApplicationEvent implements Serializable { 39 | 40 | private static final long serialVersionUID = 3861931814219403935L; 41 | 42 | /** 43 | * msCode 44 | */ 45 | private String msCode; 46 | 47 | public AbstractMsEvent() { 48 | 49 | super(System.currentTimeMillis()); 50 | 51 | } 52 | 53 | public AbstractMsEvent(String msCode) { 54 | super(System.currentTimeMillis()); 55 | this.msCode = msCode; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /tac-sdk/src/main/java/com/alibaba/tac/sdk/tangram4tac/lib/ScrollStyle.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac.sdk.tangram4tac.lib; 2 | 3 | import com.alibaba.tac.sdk.tangram4tac.Style; 4 | 5 | /** 6 | * Created by longerian on 2017/11/15. 7 | */ 8 | public class ScrollStyle extends Style { 9 | 10 | protected float pageWidth; 11 | 12 | protected float pageHeight; 13 | 14 | protected String defaultIndicatorColor; 15 | 16 | protected String indicatorColor; 17 | 18 | protected boolean hasIndicator; 19 | 20 | protected String footerType; 21 | 22 | protected boolean retainScrollState; 23 | 24 | public float getPageWidth() { 25 | return pageWidth; 26 | } 27 | 28 | public void setPageWidth(float pageWidth) { 29 | this.pageWidth = pageWidth; 30 | } 31 | 32 | public float getPageHeight() { 33 | return pageHeight; 34 | } 35 | 36 | public void setPageHeight(float pageHeight) { 37 | this.pageHeight = pageHeight; 38 | } 39 | 40 | public String getDefaultIndicatorColor() { 41 | return defaultIndicatorColor; 42 | } 43 | 44 | public void setDefaultIndicatorColor(String defaultIndicatorColor) { 45 | this.defaultIndicatorColor = defaultIndicatorColor; 46 | } 47 | 48 | public String getIndicatorColor() { 49 | return indicatorColor; 50 | } 51 | 52 | public void setIndicatorColor(String indicatorColor) { 53 | this.indicatorColor = indicatorColor; 54 | } 55 | 56 | public boolean isHasIndicator() { 57 | return hasIndicator; 58 | } 59 | 60 | public void setHasIndicator(boolean hasIndicator) { 61 | this.hasIndicator = hasIndicator; 62 | } 63 | 64 | public String getFooterType() { 65 | return footerType; 66 | } 67 | 68 | public void setFooterType(String footerType) { 69 | this.footerType = footerType; 70 | } 71 | 72 | public boolean isRetainScrollState() { 73 | return retainScrollState; 74 | } 75 | 76 | public void setRetainScrollState(boolean retainScrollState) { 77 | this.retainScrollState = retainScrollState; 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /tac-engine/src/main/java/com/alibaba/tac/engine/service/EngineBeansConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2016 Alibaba Group 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package com.alibaba.tac.engine.service; 26 | 27 | import com.alibaba.tac.engine.compile.IJdkCompiler; 28 | import com.alibaba.tac.engine.compile.JdkCompilerImpl; 29 | import com.alibaba.tac.engine.properties.TacDataPathProperties; 30 | import org.springframework.context.annotation.Bean; 31 | import org.springframework.context.annotation.Configuration; 32 | 33 | import javax.annotation.Resource; 34 | 35 | /** 36 | * @author jinshuan.li 12/02/2018 16:42 37 | *

38 | * the engine beans config class 39 | */ 40 | @Configuration 41 | public class EngineBeansConfig { 42 | 43 | @Resource 44 | private TacDataPathProperties tacDataPathProperties; 45 | 46 | @Bean 47 | public IJdkCompiler jdkCompiler() { 48 | 49 | IJdkCompiler iJdkCompiler = new JdkCompilerImpl(); 50 | 51 | return iJdkCompiler; 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /tac-engine/src/test/java/com/alibaba/tac/test/redis/RedisConfig.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac.test.redis; 2 | 3 | import com.alibaba.tac.engine.common.redis.RedisSequenceCounter; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; 7 | import org.springframework.data.redis.core.RedisTemplate; 8 | import org.springframework.data.redis.listener.ChannelTopic; 9 | import org.springframework.data.redis.listener.RedisMessageListenerContainer; 10 | import org.springframework.data.redis.listener.adapter.MessageListenerAdapter; 11 | 12 | import static com.alibaba.tac.engine.service.RedisBeansConfig.getCounterRedisTemplate; 13 | 14 | /** 15 | * @author jinshuan.li 28/02/2018 19:52 16 | */ 17 | @Configuration("testRedisConfig") 18 | public class RedisConfig { 19 | 20 | @Bean 21 | public RedisMessageListenerContainer redisMessageListenerContainer(JedisConnectionFactory jedisConnectionFactory, 22 | MessageListenerAdapter listenerAdapter) { 23 | 24 | RedisMessageListenerContainer container = new RedisMessageListenerContainer(); 25 | container.setConnectionFactory(jedisConnectionFactory); 26 | container.addMessageListener(listenerAdapter, new ChannelTopic("topicA")); 27 | // 设置线程池 28 | //container.setTaskExecutor(null); 29 | return container; 30 | } 31 | 32 | @Bean 33 | public MessageListenerAdapter listenerAdapter(TacRedisMessageListener messageListener) { 34 | 35 | MessageListenerAdapter adapter = new MessageListenerAdapter(messageListener, "receiveMessage"); 36 | 37 | return adapter; 38 | } 39 | 40 | @Bean(name = "counterRedisTemplate") 41 | public RedisTemplate counterRedisTemplate(JedisConnectionFactory jedisConnectionFactory) { 42 | 43 | return getCounterRedisTemplate(jedisConnectionFactory); 44 | } 45 | 46 | @Bean 47 | public RedisSequenceCounter redisSequenceCounter() { 48 | 49 | return new RedisSequenceCounter("redis.counter"); 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /tac-engine/src/main/java/com/alibaba/tac/engine/ms/domain/TacMsDO.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2016 Alibaba Group 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package com.alibaba.tac.engine.ms.domain; 26 | 27 | import lombok.Data; 28 | 29 | import java.io.Serializable; 30 | 31 | /** 32 | * @author jinshuan.li 28/02/2018 13:25 33 | */ 34 | @Data 35 | public class TacMsDO implements Serializable { 36 | 37 | private static final long serialVersionUID = 6723105954964294367L; 38 | 39 | 40 | /** 41 | * id 42 | */ 43 | private Long id; 44 | 45 | /** 46 | * code 47 | */ 48 | private String code; 49 | /** 50 | * name 51 | */ 52 | private String name; 53 | 54 | /** 55 | * status 56 | */ 57 | private Integer status = TacMsStatus.NORMAL.code(); 58 | 59 | /** 60 | * published inst id 61 | */ 62 | private Long publishedInstId; 63 | 64 | /** 65 | * 66 | */ 67 | private Boolean gitSupport; 68 | 69 | /** 70 | * 71 | */ 72 | private String gitRepo; 73 | } 74 | -------------------------------------------------------------------------------- /tac-engine/src/main/java/com/alibaba/tac/engine/ms/domain/TacMsPublishMeta.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2016 Alibaba Group 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package com.alibaba.tac.engine.ms.domain; 26 | 27 | import com.alibaba.tac.engine.inst.domain.TacInst; 28 | import com.alibaba.tac.engine.properties.TacMsConstants; 29 | import lombok.Data; 30 | 31 | import java.io.Serializable; 32 | 33 | /** 34 | * @author jinshuan.li 27/02/2018 13:28 35 | * 36 | * the publish meta data 37 | */ 38 | @Data 39 | public class TacMsPublishMeta implements Serializable { 40 | private static final long serialVersionUID = 7774540294768819287L; 41 | 42 | private TacInst tacInst; 43 | 44 | private Integer status = TacMsConstants.INST_STATUS_ONLINE; 45 | 46 | public TacMsPublishMeta() { 47 | } 48 | 49 | public TacMsPublishMeta(TacInst tacInst, Integer status) { 50 | this.tacInst = tacInst; 51 | this.status = status; 52 | } 53 | 54 | public TacMsPublishMeta(TacInst tacInst) { 55 | this.tacInst = tacInst; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /tac-console-web/build/utils.js: -------------------------------------------------------------------------------- 1 | var path = require('path') 2 | var config = require('../config') 3 | var ExtractTextPlugin = require('extract-text-webpack-plugin') 4 | 5 | exports.assetsPath = function (_path) { 6 | var assetsSubDirectory = process.env.NODE_ENV === 'production' 7 | ? config.build.assetsSubDirectory 8 | : config.dev.assetsSubDirectory 9 | return path.posix.join(assetsSubDirectory, _path) 10 | } 11 | 12 | exports.cssLoaders = function (options) { 13 | options = options || {} 14 | 15 | var cssLoader = { 16 | loader: 'css-loader', 17 | options: { 18 | minimize: process.env.NODE_ENV === 'production', 19 | sourceMap: options.sourceMap 20 | } 21 | } 22 | 23 | // generate loader string to be used with extract text plugin 24 | function generateLoaders (loader, loaderOptions) { 25 | var loaders = [cssLoader] 26 | if (loader) { 27 | loaders.push({ 28 | loader: loader + '-loader', 29 | options: Object.assign({}, loaderOptions, { 30 | sourceMap: options.sourceMap 31 | }) 32 | }) 33 | } 34 | 35 | // Extract CSS when that option is specified 36 | // (which is the case during production build) 37 | if (options.extract) { 38 | return ExtractTextPlugin.extract({ 39 | use: loaders, 40 | fallback: 'vue-style-loader' 41 | }) 42 | } else { 43 | return ['vue-style-loader'].concat(loaders) 44 | } 45 | } 46 | 47 | // https://vue-loader.vuejs.org/en/configurations/extract-css.html 48 | return { 49 | css: generateLoaders(), 50 | postcss: generateLoaders(), 51 | less: generateLoaders('less'), 52 | sass: generateLoaders('sass', { indentedSyntax: true }), 53 | scss: generateLoaders('sass'), 54 | stylus: generateLoaders('stylus'), 55 | styl: generateLoaders('stylus') 56 | } 57 | } 58 | 59 | // Generate loaders for standalone style files (outside of .vue) 60 | exports.styleLoaders = function (options) { 61 | var output = [] 62 | var loaders = exports.cssLoaders(options) 63 | for (var extension in loaders) { 64 | var loader = loaders[extension] 65 | output.push({ 66 | test: new RegExp('\\.' + extension + '$'), 67 | use: loader 68 | }) 69 | } 70 | return output 71 | } 72 | -------------------------------------------------------------------------------- /tac-engine/src/main/java/com/alibaba/tac/engine/compile/IJdkCompiler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2016 Alibaba Group 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package com.alibaba.tac.engine.compile; 26 | 27 | import java.io.File; 28 | import java.io.StringWriter; 29 | 30 | /** 31 | * @author jinshuan.li 12/02/2018 08:10 32 | */ 33 | public interface IJdkCompiler { 34 | 35 | /** 36 | *compile code , the output name is instId 37 | * @param codeInfo 38 | * @param compileInfo 39 | * @return 40 | * @throws Exception 41 | */ 42 | boolean compile(InstCodeInfo codeInfo, StringWriter compileInfo) throws Exception; 43 | 44 | /** 45 | * compileWithMsCode, the output name is msCode 46 | * 47 | * 48 | * @param codeInfo 49 | * @param compileInfo 50 | * @return 51 | * @throws Exception 52 | */ 53 | boolean compileWithMsCode(InstCodeInfo codeInfo, StringWriter compileInfo) throws Exception; 54 | 55 | /** 56 | * add compile class path 57 | * 58 | * @param file 59 | */ 60 | void addClassPath(File file); 61 | 62 | } 63 | -------------------------------------------------------------------------------- /tac-engine/src/main/java/com/alibaba/tac/engine/util/ThreadPoolUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2016 Alibaba Group 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package com.alibaba.tac.engine.util; 26 | 27 | import java.util.concurrent.*; 28 | import java.util.concurrent.atomic.AtomicInteger; 29 | 30 | /** 31 | * @author jinshuan.li on 2018/8/19 15:47. 32 | */ 33 | public class ThreadPoolUtils { 34 | 35 | /** 36 | * create thrad pool 37 | * @param nThreads 38 | * @param threadName 39 | * @return 40 | */ 41 | public static ExecutorService createThreadPool(int nThreads, String threadName) { 42 | 43 | ExecutorService executorService = new ThreadPoolExecutor(nThreads, 300, 5, TimeUnit.MINUTES, new 44 | LinkedBlockingQueue<>(), new ThreadFactory() { 45 | 46 | private AtomicInteger count = new AtomicInteger(0); 47 | 48 | @Override 49 | public Thread newThread(Runnable r) { 50 | return new Thread(r, threadName + "_" + count.incrementAndGet()); 51 | } 52 | }); 53 | return executorService; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /tac-console-web/src/components/TacMsList.vue: -------------------------------------------------------------------------------- 1 | 23 | 24 | 73 | 74 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /tac-engine/src/main/java/com/alibaba/tac/engine/util/TacLogUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2016 Alibaba Group 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | /** 26 | * 27 | */ 28 | package com.alibaba.tac.engine.util; 29 | 30 | import org.slf4j.Logger; 31 | 32 | /** 33 | * 34 | */ 35 | public class TacLogUtils { 36 | 37 | /** 38 | * 39 | * 40 | * @param logger 41 | * @param format 42 | * @param arguments 43 | */ 44 | public static void infoRate(Logger logger, String format, Object... arguments) { 45 | 46 | logger.info(format, arguments); 47 | 48 | } 49 | 50 | /** 51 | * 52 | * 53 | * @param logger 54 | * @param format 55 | * @param arguments 56 | */ 57 | public static void warnRate(Logger logger, String format, Object... arguments) { 58 | logger.warn(format, arguments); 59 | } 60 | 61 | /** 62 | * 63 | * 64 | * @param logger 65 | * @param format 66 | * @param arguments 67 | */ 68 | public static void traceRate(Logger logger, String format, Object... arguments) { 69 | logger.trace(format, arguments); 70 | } 71 | 72 | } 73 | -------------------------------------------------------------------------------- /tac-engine/src/test/java/com/alibaba/tac/engine/ms/service/redis/RedisMsServiceTest.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac.engine.ms.service.redis; 2 | 3 | import com.alibaba.tac.engine.ms.domain.TacMsDO; 4 | import com.alibaba.tac.engine.ms.domain.TacMsStatus; 5 | import com.alibaba.tac.engine.test.TacEnginTest; 6 | import org.apache.commons.collections4.CollectionUtils; 7 | import org.junit.Before; 8 | import org.junit.Test; 9 | 10 | import javax.annotation.Resource; 11 | import java.util.List; 12 | 13 | import static org.junit.Assert.*; 14 | 15 | /** 16 | * @author jinshuan.li 01/03/2018 14:53 17 | */ 18 | public class RedisMsServiceTest extends TacEnginTest { 19 | 20 | @Resource 21 | private RedisMsService redisMsService; 22 | 23 | TacMsDO tacMsDO = new TacMsDO(); 24 | 25 | @Before 26 | public void setUp() throws Exception { 27 | 28 | tacMsDO.setCode("test"); 29 | tacMsDO.setName("ljinshuan"); 30 | 31 | } 32 | 33 | @Test 34 | public void createMs() { 35 | 36 | redisMsService.createMs(tacMsDO); 37 | 38 | TacMsDO ms = redisMsService.getMs(tacMsDO.getCode()); 39 | 40 | assertNotNull(ms); 41 | } 42 | 43 | @Test 44 | public void removeMs() { 45 | 46 | redisMsService.removeMs(tacMsDO.getCode()); 47 | 48 | TacMsDO ms = redisMsService.getMs(tacMsDO.getCode()); 49 | 50 | assertNull(ms); 51 | } 52 | 53 | @Test 54 | public void invalidMs() { 55 | 56 | redisMsService.invalidMs(tacMsDO.getCode()); 57 | 58 | TacMsDO ms = redisMsService.getMs(tacMsDO.getCode()); 59 | 60 | assertTrue(ms == null || ms.getStatus().equals(TacMsStatus.INVALID.code())); 61 | } 62 | 63 | @Test 64 | public void updateMs() { 65 | tacMsDO.setName("updated"); 66 | 67 | redisMsService.updateMs(tacMsDO.getCode(), tacMsDO); 68 | 69 | TacMsDO ms = redisMsService.getMs(tacMsDO.getCode()); 70 | 71 | assertEquals(ms.getName(), "updated"); 72 | } 73 | 74 | @Test 75 | public void getMs() { 76 | 77 | TacMsDO ms = redisMsService.getMs(tacMsDO.getCode()); 78 | 79 | assertNull(ms); 80 | } 81 | 82 | @Test 83 | public void getAllMs() { 84 | 85 | List allMs = redisMsService.getAllMs(); 86 | 87 | assertTrue(CollectionUtils.isNotEmpty(allMs)); 88 | } 89 | 90 | } -------------------------------------------------------------------------------- /tac-engine/src/main/java/com/alibaba/tac/engine/properties/TacRedisConfigProperties.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2016 Alibaba Group 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package com.alibaba.tac.engine.properties; 26 | 27 | import lombok.Data; 28 | import org.springframework.boot.context.properties.ConfigurationProperties; 29 | import org.springframework.stereotype.Component; 30 | 31 | /** 32 | * @author jinshuan.li 2018/3/1 07:37 33 | */ 34 | 35 | @Data 36 | @Component 37 | @ConfigurationProperties(prefix = "tac.redis.config") 38 | public class TacRedisConfigProperties { 39 | 40 | /** 41 | * msInst meta data path 42 | */ 43 | private String msInstMetaDataPath = "com.alibaba.tac.msInstMetaData"; 44 | 45 | /** 46 | * ms meta data path 47 | */ 48 | private String msMetaDataPath = "com.alibaba.tac.msMetaData"; 49 | 50 | /** 51 | * data path prefix 52 | */ 53 | private String dataPathPrefix = "msInstFile"; 54 | 55 | /** 56 | * ms list path 57 | */ 58 | private String msListPath = "msPublishedList"; 59 | 60 | /** 61 | * the event publish channel 62 | */ 63 | private String publishEventChannel = "tac.inst.publish.channel"; 64 | 65 | } 66 | -------------------------------------------------------------------------------- /tac-console-web/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "tac-console-web", 3 | "version": "1.0.0", 4 | "description": "A Vue.js project", 5 | "author": "jinshuan.li", 6 | "private": true, 7 | "scripts": { 8 | "dev": "node build/dev-server.js", 9 | "start": "node build/dev-server.js", 10 | "build": "node build/build.js", 11 | "lint": "eslint --ext .js,.vue src" 12 | }, 13 | "dependencies": { 14 | "bootstrap": "^4.0.0-beta.2", 15 | "bootstrap-vue": "latest", 16 | "jquery": "^3.3.1", 17 | "jsoneditor": "^5.14.0", 18 | "popper.js": "^1.12.9", 19 | "vue": "^2.5.2", 20 | "vue-resource": "^1.5.0", 21 | "vue-router": "^3.0.1", 22 | "vue-toastr": "^2.0.12" 23 | }, 24 | "devDependencies": { 25 | "autoprefixer": "^7.1.2", 26 | "babel-core": "^6.22.1", 27 | "babel-eslint": "^7.1.1", 28 | "babel-loader": "^7.1.1", 29 | "babel-plugin-transform-runtime": "^6.22.0", 30 | "babel-preset-env": "^1.3.2", 31 | "babel-preset-stage-2": "^6.22.0", 32 | "babel-register": "^6.22.0", 33 | "chalk": "^2.0.1", 34 | "connect-history-api-fallback": "^1.3.0", 35 | "copy-webpack-plugin": "^4.0.1", 36 | "css-loader": "^0.28.0", 37 | "cssnano": "^3.10.0", 38 | "eslint": "^3.19.0", 39 | "eslint-friendly-formatter": "^3.0.0", 40 | "eslint-loader": "^1.7.1", 41 | "eslint-plugin-html": "^3.0.0", 42 | "eventsource-polyfill": "^0.9.6", 43 | "express": "^4.14.1", 44 | "extract-text-webpack-plugin": "^2.0.0", 45 | "file-loader": "^0.11.1", 46 | "friendly-errors-webpack-plugin": "^1.1.3", 47 | "html-webpack-plugin": "^2.28.0", 48 | "http-proxy-middleware": "^0.17.3", 49 | "webpack-bundle-analyzer": "^2.2.1", 50 | "semver": "^5.3.0", 51 | "shelljs": "^0.7.6", 52 | "opn": "^5.1.0", 53 | "optimize-css-assets-webpack-plugin": "^2.0.0", 54 | "ora": "^1.2.0", 55 | "rimraf": "^2.6.0", 56 | "url-loader": "^0.5.8", 57 | "vue-loader": "^13.0.4", 58 | "vue-style-loader": "^3.0.1", 59 | "vue-template-compiler": "^2.4.2", 60 | "webpack": "^2.6.1", 61 | "webpack-dev-middleware": "^1.10.0", 62 | "webpack-hot-middleware": "^2.18.0", 63 | "webpack-merge": "^4.1.0" 64 | }, 65 | "engines": { 66 | "node": ">= 4.0.0", 67 | "npm": ">= 3.0.0" 68 | }, 69 | "browserslist": [ 70 | "> 1%", 71 | "last 2 versions", 72 | "not ie <= 8" 73 | ] 74 | } 75 | -------------------------------------------------------------------------------- /tac-engine/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | tac 5 | com.alibaba 6 | 0.0.4 7 | 8 | 4.0.0 9 | 10 | tac-engine 11 | jar 12 | 13 | tac-engine 14 | http://maven.apache.org 15 | 16 | 17 | UTF-8 18 | 19 | 20 | 21 | 22 | com.alibaba 23 | tac-infrastructure 24 | 25 | 26 | com.alibaba 27 | tac-sdk 28 | 29 | 30 | 31 | junit 32 | junit 33 | 34 | 35 | 36 | org.springframework.boot 37 | spring-boot-loader 38 | 39 | 40 | 41 | commons-io 42 | commons-io 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | org.apache.maven.plugins 52 | maven-compiler-plugin 53 | 54 | ${jdk.version} 55 | ${jdk.version} 56 | UTF-8 57 | 58 | 59 | 60 | org.apache.maven.plugins 61 | maven-resources-plugin 62 | 63 | UTF-8 64 | 65 | 66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /tac-sdk/src/main/java/com/alibaba/tac/sdk/error/ServiceException.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac.sdk.error; 2 | 3 | /** 4 | * the service exception class 5 | */ 6 | public class ServiceException extends Exception { 7 | 8 | private static final long serialVersionUID = 1701785539191674857L; 9 | /** 10 | * errorCode 11 | */ 12 | private int errorCode; 13 | /** 14 | * errorMessage 15 | */ 16 | private String message; 17 | 18 | public ServiceException(int errorCode, String message) { 19 | super(message); 20 | this.errorCode = errorCode; 21 | this.message = message; 22 | } 23 | 24 | public int getErrorCode() { 25 | return errorCode; 26 | } 27 | 28 | public void setErrorCode(int errorCode) { 29 | this.errorCode = errorCode; 30 | } 31 | 32 | @Override 33 | public String getMessage() { 34 | return message; 35 | } 36 | 37 | public void setMessage(String message) { 38 | this.message = message; 39 | } 40 | 41 | /** 42 | * the helper method which throw an exception 43 | * 44 | * @param error 45 | * @return 46 | * @throws ServiceException 47 | */ 48 | public static ServiceException throwException(IError error) throws ServiceException { 49 | 50 | throw new ServiceException(error.getCode(), error.getMessage()); 51 | } 52 | 53 | /** 54 | * 55 | * 56 | * @param errorCode 57 | * @param errorMessage 58 | * @return 59 | * @throws ServiceException 60 | */ 61 | public static ServiceException throwException(Integer errorCode, String errorMessage) throws ServiceException { 62 | 63 | throw new ServiceException(errorCode, errorMessage); 64 | } 65 | 66 | /** 67 | * 68 | * 69 | * @param error 70 | * @param errorMessage 71 | * @return 72 | * @throws ServiceException 73 | */ 74 | public static ServiceException throwException(IError error, String errorMessage) throws ServiceException { 75 | 76 | throw new ServiceException(error.getCode(), errorMessage); 77 | } 78 | 79 | /** 80 | * 81 | * 82 | * @param errorCode 83 | * @param errorMessage 84 | * @return 85 | */ 86 | public static ServiceException newException(Integer errorCode, String errorMessage) { 87 | 88 | return new ServiceException(errorCode, errorMessage); 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /tac-engine/src/main/java/com/alibaba/tac/engine/inst/domain/TacInst.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2016 Alibaba Group 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package com.alibaba.tac.engine.inst.domain; 26 | 27 | import lombok.Data; 28 | 29 | import java.io.Serializable; 30 | 31 | /** 32 | * The tac intance class 33 | */ 34 | @Data 35 | public class TacInst implements Serializable { 36 | 37 | private static final long serialVersionUID = -7830333085387154296L; 38 | 39 | public static final Integer STATUS_NEW = 0; 40 | 41 | public static final Integer STATUS_PRE_PUBLISH = 1; 42 | 43 | public static final Integer STATUS_PUBLISH = 2; 44 | 45 | 46 | /** 47 | * intanceId 48 | */ 49 | private long id; 50 | 51 | /** 52 | * name 53 | */ 54 | private String name; 55 | 56 | /** 57 | * the service code 58 | */ 59 | private String msCode; 60 | 61 | /** 62 | * data sign 63 | */ 64 | private String jarVersion; 65 | 66 | /** 67 | * status 68 | */ 69 | private Integer status; 70 | 71 | /** 72 | * prePublish sign 73 | */ 74 | private String prePublishJarVersion; 75 | 76 | /** 77 | * prePublish status 78 | */ 79 | private Integer prePublishStatus; 80 | 81 | /** 82 | * gitBranch 83 | */ 84 | private String gitBranch; 85 | 86 | } 87 | -------------------------------------------------------------------------------- /tac-engine/src/main/java/com/alibaba/tac/engine/ms/service/AbstractDefaultMsPublisher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2016 Alibaba Group 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package com.alibaba.tac.engine.ms.service; 26 | 27 | import com.alibaba.tac.engine.inst.domain.TacInst; 28 | import com.alibaba.tac.engine.inst.service.DevMsInstFileService; 29 | 30 | import javax.annotation.Resource; 31 | import java.text.MessageFormat; 32 | 33 | /** 34 | * @author jinshuan.li 01/03/2018 15:22 35 | */ 36 | public abstract class AbstractDefaultMsPublisher implements IMsPublisher { 37 | 38 | @Resource 39 | private DevMsInstFileService devMsInstFileService; 40 | 41 | @Override 42 | public Boolean publish(TacInst tacInst) { 43 | 44 | long instId = tacInst.getId(); 45 | 46 | //1.1 get data 47 | byte[] instanceFile = devMsInstFileService.getInstanceFile(instId); 48 | 49 | if (instanceFile == null) { 50 | throw new IllegalArgumentException( 51 | MessageFormat.format("can't find local instance file . instId {0}", instId)); 52 | } 53 | 54 | //1.2 check sign 55 | 56 | checkSign(tacInst, instanceFile); 57 | 58 | return this.publish(tacInst, instanceFile); 59 | } 60 | 61 | @Override 62 | public Boolean prePublish(TacInst tacInst, byte[] data) { 63 | return null; 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /tac-console-web/build/dev-server.js: -------------------------------------------------------------------------------- 1 | require('./check-versions')() 2 | 3 | var config = require('../config') 4 | if (!process.env.NODE_ENV) { 5 | process.env.NODE_ENV = JSON.parse(config.dev.env.NODE_ENV) 6 | } 7 | 8 | var opn = require('opn') 9 | var path = require('path') 10 | var express = require('express') 11 | var webpack = require('webpack') 12 | var proxyMiddleware = require('http-proxy-middleware') 13 | var webpackConfig = require('./webpack.dev.conf') 14 | 15 | // default port where dev server listens for incoming traffic 16 | var port = process.env.PORT || config.dev.port 17 | // automatically open browser, if not set will be false 18 | var autoOpenBrowser = !!config.dev.autoOpenBrowser 19 | // Define HTTP proxies to your custom API backend 20 | // https://github.com/chimurai/http-proxy-middleware 21 | var proxyTable = config.dev.proxyTable 22 | 23 | var app = express() 24 | var compiler = webpack(webpackConfig) 25 | 26 | var devMiddleware = require('webpack-dev-middleware')(compiler, { 27 | publicPath: webpackConfig.output.publicPath, 28 | quiet: true 29 | }) 30 | 31 | var hotMiddleware = require('webpack-hot-middleware')(compiler, { 32 | log: false, 33 | heartbeat: 2000 34 | }) 35 | // force page reload when html-webpack-plugin template changes 36 | compiler.plugin('compilation', function (compilation) { 37 | compilation.plugin('html-webpack-plugin-after-emit', function (data, cb) { 38 | hotMiddleware.publish({ action: 'reload' }) 39 | cb() 40 | }) 41 | }) 42 | 43 | // proxy api requests 44 | Object.keys(proxyTable).forEach(function (context) { 45 | var options = proxyTable[context] 46 | if (typeof options === 'string') { 47 | options = { target: options } 48 | } 49 | app.use(proxyMiddleware(options.filter || context, options)) 50 | }) 51 | 52 | // handle fallback for HTML5 history API 53 | app.use(require('connect-history-api-fallback')()) 54 | 55 | // serve webpack bundle output 56 | app.use(devMiddleware) 57 | 58 | // enable hot-reload and state-preserving 59 | // compilation error display 60 | app.use(hotMiddleware) 61 | 62 | // serve pure static assets 63 | var staticPath = path.posix.join(config.dev.assetsPublicPath, config.dev.assetsSubDirectory) 64 | app.use(staticPath, express.static('./static')) 65 | 66 | var uri = 'http://localhost:' + port 67 | 68 | var _resolve 69 | var readyPromise = new Promise(resolve => { 70 | _resolve = resolve 71 | }) 72 | 73 | console.log('> Starting dev server...') 74 | devMiddleware.waitUntilValid(() => { 75 | console.log('> Listening at ' + uri + '\n') 76 | // when env is testing, don't need open it 77 | if (autoOpenBrowser && process.env.NODE_ENV !== 'testing') { 78 | opn(uri) 79 | } 80 | _resolve() 81 | }) 82 | 83 | var server = app.listen(port) 84 | 85 | module.exports = { 86 | ready: readyPromise, 87 | close: () => { 88 | server.close() 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /tac-engine/src/main/java/com/alibaba/tac/engine/ms/service/IMsService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2016 Alibaba Group 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package com.alibaba.tac.engine.ms.service; 26 | 27 | import com.alibaba.tac.engine.ms.domain.TacMsDO; 28 | import org.apache.commons.lang3.StringUtils; 29 | 30 | import java.util.List; 31 | 32 | /** 33 | * @author jinshuan.li 12/02/2018 17:18 34 | */ 35 | public interface IMsService { 36 | 37 | /** 38 | * create ms 39 | * 40 | * @param tacMsDO 41 | * @return 42 | */ 43 | TacMsDO createMs(TacMsDO tacMsDO); 44 | 45 | /** 46 | * remove ms 47 | * 48 | * @param msCode 49 | * @return 50 | */ 51 | Boolean removeMs(String msCode); 52 | 53 | /** 54 | * invalid ms 55 | * 56 | * @param msCode 57 | * @return 58 | */ 59 | Boolean invalidMs(String msCode); 60 | 61 | /** 62 | * update ms 63 | * 64 | * @param msCode 65 | * @param tacMsDO 66 | * @return 67 | */ 68 | Boolean updateMs(String msCode, TacMsDO tacMsDO); 69 | 70 | /** 71 | * get ms 72 | * 73 | * @param msCode 74 | * @return 75 | */ 76 | TacMsDO getMs(String msCode); 77 | 78 | /** 79 | * get all ms 80 | * 81 | * @return 82 | */ 83 | List getAllMs(); 84 | 85 | default void checkMsDO(TacMsDO tacMsDO) { 86 | 87 | if (tacMsDO == null) { 88 | throw new IllegalArgumentException("tacMsDO is null"); 89 | } 90 | 91 | if (StringUtils.isEmpty(tacMsDO.getCode()) || StringUtils.isEmpty(tacMsDO.getName())) { 92 | throw new IllegalArgumentException("code or name is empty"); 93 | } 94 | 95 | 96 | 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /tac-engine/src/test/java/com/alibaba/tac/engine/service/GitLabFeatureTest.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac.engine.service; 2 | 3 | import com.alibaba.tac.engine.code.CodeCompileService; 4 | import com.alibaba.tac.engine.git.GitRepoService; 5 | import com.alibaba.tac.engine.inst.domain.TacInst; 6 | import com.alibaba.tac.engine.inst.service.IMsInstService; 7 | import com.alibaba.tac.engine.ms.domain.TacMsDO; 8 | import com.alibaba.tac.engine.ms.service.IMsPublisher; 9 | import com.alibaba.tac.engine.ms.service.IMsService; 10 | import com.alibaba.tac.engine.test.TacEnginTest; 11 | import com.alibaba.tac.sdk.error.ServiceException; 12 | import org.junit.Assert; 13 | import org.junit.Test; 14 | 15 | import javax.annotation.Resource; 16 | 17 | import java.io.IOException; 18 | import java.util.List; 19 | 20 | import static org.junit.Assert.*; 21 | 22 | /** 23 | * @author jinshuan.li 08/05/2018 10:32 24 | */ 25 | public class GitLabFeatureTest extends TacEnginTest { 26 | 27 | @Resource 28 | private IMsService msService; 29 | 30 | @Resource 31 | private IMsInstService msInstService; 32 | 33 | @Resource 34 | private GitRepoService gitRepoService; 35 | 36 | @Resource 37 | private CodeCompileService codeCompileService; 38 | 39 | @Resource 40 | private IMsPublisher msPublisher; 41 | 42 | private final String code = "gitlab-test"; 43 | 44 | private final String defaultBranch = "master"; 45 | 46 | @Test 47 | public void createMs() { 48 | 49 | TacMsDO tacMsDO = new TacMsDO(); 50 | tacMsDO.setCode("gitlab-test"); 51 | tacMsDO.setName("gitlab测试"); 52 | tacMsDO.setGitSupport(true); 53 | tacMsDO.setGitRepo("git@127.0.0.1:tac-admin/tac-test01.git"); 54 | 55 | TacMsDO ms = msService.createMs(tacMsDO); 56 | 57 | assertNotNull(ms); 58 | } 59 | 60 | @Test 61 | public void getMs() { 62 | 63 | TacMsDO ms = msService.getMs(code); 64 | 65 | assertNotNull(ms); 66 | } 67 | 68 | @Test 69 | public void createMsInst() { 70 | 71 | TacInst gitTacMsInst = msInstService.createGitTacMsInst(code, code, defaultBranch); 72 | 73 | assertNotNull(gitTacMsInst); 74 | 75 | List msInsts = msInstService.getMsInsts(code); 76 | 77 | assertNotNull(msInsts); 78 | } 79 | 80 | @Test 81 | public void prePublishTest() throws ServiceException, IOException { 82 | 83 | TacMsDO ms = msService.getMs(code); 84 | 85 | List allTacMsInsts = msInstService.getMsInsts(code); 86 | 87 | TacInst tacInst = allTacMsInsts.get(0); 88 | 89 | String sourcePath = gitRepoService.pullInstanceCode(ms.getGitRepo(), ms.getCode(), tacInst.getGitBranch()); 90 | 91 | codeCompileService.compile(tacInst.getId(), sourcePath); 92 | 93 | byte[] jarFile = codeCompileService.getJarFile(tacInst.getId()); 94 | 95 | msPublisher.prePublish(tacInst, jarFile); 96 | 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /tac-sdk/src/main/java/com/alibaba/tac/sdk/utils/TacIPUtils.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.tac.sdk.utils; 2 | 3 | import java.net.*; 4 | import java.util.ArrayList; 5 | import java.util.Collection; 6 | import java.util.Collections; 7 | import java.util.Enumeration; 8 | 9 | /** 10 | * Created by changkun.hck on 2016/12/29. 11 | */ 12 | public class TacIPUtils { 13 | 14 | private static String staticIp; 15 | 16 | private static String staticHost; 17 | 18 | static { 19 | // ip init 20 | try { 21 | if(staticIp == null) { 22 | staticIp = Inet4Address.getLocalHost().getHostAddress(); 23 | } 24 | } catch (UnknownHostException var1) { 25 | var1.printStackTrace(); 26 | } 27 | // host init 28 | try { 29 | if(staticHost == null) { 30 | staticHost = Inet4Address.getLocalHost().getHostName(); 31 | } 32 | } catch (UnknownHostException var1) { 33 | var1.printStackTrace(); 34 | } 35 | } 36 | 37 | public static String getLocalHostName() { 38 | return staticHost; 39 | } 40 | 41 | public static String getLocalIp() { 42 | return staticIp; 43 | } 44 | 45 | 46 | @Deprecated 47 | private static Collection getAllHostAddress() { 48 | try { 49 | Enumeration networkInterfaces = NetworkInterface.getNetworkInterfaces(); 50 | Collection addresses = new ArrayList(); 51 | 52 | while (networkInterfaces.hasMoreElements()) { 53 | NetworkInterface networkInterface = networkInterfaces.nextElement(); 54 | Enumeration inetAddresses = networkInterface.getInetAddresses(); 55 | while (inetAddresses.hasMoreElements()) { 56 | InetAddress inetAddress = inetAddresses.nextElement(); 57 | addresses.add(inetAddress); 58 | } 59 | } 60 | 61 | return addresses; 62 | } catch (SocketException e) { 63 | } 64 | return Collections.emptyList(); 65 | } 66 | 67 | @Deprecated 68 | public static Collection getAllIpv4NoLoopbackAddresses() { 69 | Collection noLoopbackAddresses = new ArrayList(); 70 | Collection allInetAddresses = getAllHostAddress(); 71 | for (InetAddress address : allInetAddresses) { 72 | if (!address.isLoopbackAddress() && address instanceof Inet4Address) { 73 | noLoopbackAddresses.add(address.getHostAddress()); 74 | } 75 | } 76 | return noLoopbackAddresses; 77 | } 78 | @Deprecated 79 | public static String getFirstNoLoopbackAddress() { 80 | Collection allNoLoopbackAddresses = getAllIpv4NoLoopbackAddresses(); 81 | return allNoLoopbackAddresses.iterator().next(); 82 | } 83 | 84 | } 85 | -------------------------------------------------------------------------------- /tac-engine/src/main/java/com/alibaba/tac/engine/properties/TacDataPathProperties.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2016 Alibaba Group 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package com.alibaba.tac.engine.properties; 26 | 27 | import org.springframework.beans.factory.annotation.Value; 28 | import org.springframework.boot.context.properties.ConfigurationProperties; 29 | import org.springframework.stereotype.Component; 30 | 31 | 32 | /** 33 | * @author jinshuan.li 12/02/2018 16:45 34 | */ 35 | @Component 36 | @ConfigurationProperties(prefix = "tac.data.path") 37 | public class TacDataPathProperties { 38 | 39 | private String sourcePathPrefix; 40 | 41 | @Value("${user.home}/tac/data/classes") 42 | private String outputPathPrefix; 43 | @Value("${user.home}/tac/data/ms") 44 | private String classLoadPathPrefix; 45 | 46 | private String pkgPrefix="com.alibaba.tac.biz"; 47 | 48 | public void setSourcePathPrefix(String sourcePathPrefix) { 49 | this.sourcePathPrefix = sourcePathPrefix; 50 | } 51 | 52 | public String getSourcePathPrefix() { 53 | return sourcePathPrefix; 54 | } 55 | 56 | public String getOutputPathPrefix() { 57 | return outputPathPrefix; 58 | } 59 | 60 | public void setOutputPathPrefix(String outputPathPrefix) { 61 | this.outputPathPrefix = outputPathPrefix; 62 | } 63 | 64 | public String getClassLoadPathPrefix() { 65 | return classLoadPathPrefix; 66 | } 67 | 68 | public void setClassLoadPathPrefix(String classLoadPathPrefix) { 69 | this.classLoadPathPrefix = classLoadPathPrefix; 70 | } 71 | 72 | public String getPkgPrefix() { 73 | return pkgPrefix; 74 | } 75 | 76 | public void setPkgPrefix(String pkgPrefix) { 77 | this.pkgPrefix = pkgPrefix; 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /docs/ide_source_start.md: -------------------------------------------------------------------------------- 1 | # 源码启动详细步骤 2 | 3 | * 以下以 idea 为例,描述 tac 源码从 idea 启动步骤 4 | 5 | ### 代码拉取 6 | 7 | ``` 8 | git clone git@github.com:alibaba/tac.git 9 | ``` 10 | 11 | ### 打开工程 12 | 13 | * 项目通过 springboot 编写 依赖 jdk1.8 14 | * 使用了 lombok 包,idea 需要安装 lombok 插件; 15 | 16 | ![undefined](imgs/sourcestart/1527213111970-6a1b5031-63ef-4082-b602-4493555a40e8.png) 17 | 18 | ### 安装并启动 redis (本地默认配置) 19 | 20 | * ip : 127.0.0.1 21 | * port : 6379 22 | 23 | ### 启动 console 24 | 25 | * com.alibaba.tac.console.ConsoleApplication 带上 --admin 参数启动 26 | 27 | ![undefined](imgs/sourcestart/1527213201547-8d16dd54-d32a-4cd9-927a-4ceb509773a6.png) 28 | 29 | * 成功后打开控制台 http://localhost:7001/#/tacMs/list 30 | 31 | ### 新建服务 32 | 33 | ![undefined](imgs/sourcestart/1527213265713-e0e7611f-b1c2-43bd-8cf5-31dd0d9e9cc6.png) 34 | 35 | ### 编写代码 36 | 37 | * 参考 tac-dev-source 38 | 39 | ![undefined](imgs/sourcestart/1527213324287-63726690-1df1-45fb-afc6-e931784855d1.png) 40 | 41 | ```java 42 | package com.alibaba.tac.biz.processor; 43 | 44 | import com.alibaba.tac.sdk.common.TacResult; 45 | import com.alibaba.tac.sdk.domain.Context; 46 | import com.alibaba.tac.sdk.factory.TacInfrasFactory; 47 | import com.alibaba.tac.sdk.handler.TacHandler; 48 | import com.alibaba.tac.sdk.infrastracture.TacLogger; 49 | 50 | import java.util.HashMap; 51 | import java.util.Map; 52 | 53 | /** 54 | * @author jinshuan.li 55 | */ 56 | public class HelloWorldTac implements TacHandler { 57 | 58 | /** 59 | * get the logger service 60 | */ 61 | private TacLogger tacLogger = TacInfrasFactory.getLogger(); 62 | 63 | 64 | /** 65 | * implement a class which implements TacHandler interface 66 | * {@link TacHandler} 67 | * @param context 68 | * @return 69 | * @throws Exception 70 | */ 71 | 72 | @Override 73 | public TacResult execute(Context context) throws Exception { 74 | 75 | // the code 76 | tacLogger.info("Hello World22"); 77 | 78 | Map data = new HashMap<>(); 79 | data.put("name", "hellotac"); 80 | data.put("platform", "iPhone"); 81 | data.put("clientVersion", "7.0.2"); 82 | data.put("userName", "tac-userName"); 83 | 84 | 85 | 86 | return TacResult.newResult(data); 87 | } 88 | } 89 | ``` 90 | 91 | ### 代码打包 92 | 93 | ``` 94 | cd tac-dev-source 95 | mvn clean -Dmaven.test.skip=true package 96 | ``` 97 | 98 | ### 上传 jar 包 99 | 100 | ![undefined](imgs/sourcestart/1527213524357-bae645a8-d865-472d-a89d-c6660aeade07.png) 101 | 102 | ### 预发布 103 | 104 | ### 预发布测试 105 | 106 | ![undefined](imgs/sourcestart/1527213630237-809d5801-c137-4e53-8709-3d4e772406df.png) 107 | 108 | ## 正式发布 109 | 110 | ### 运行 111 | 112 | * com.alibaba.tac.container.ContainerApplication 113 | 114 | ### 控制台操作发布 115 | 116 | ![undefined](imgs/sourcestart/1527213761239-b3548ce2-6f0d-406d-af8b-1efaf688a45d.png) 117 | --------------------------------------------------------------------------------