├── majordodo-core ├── test │ └── current │ │ ├── 0.log │ │ ├── lastId │ │ └── VERSION ├── src │ ├── main │ │ ├── resources │ │ │ └── majordodo │ │ │ │ └── version │ │ │ │ └── version.properties │ │ └── java │ │ │ └── majordodo │ │ │ ├── utils │ │ │ ├── Version.java │ │ │ ├── IntCounter.java │ │ │ ├── ErrorUtils.java │ │ │ ├── TestUtils.java │ │ │ ├── FileUtils.java │ │ │ └── DiscardingBoundedPriorityQueue.java │ │ │ ├── clientfacade │ │ │ ├── UserRole.java │ │ │ ├── AuthenticationManager.java │ │ │ ├── CreateCodePoolResult.java │ │ │ ├── SlotsStatusView.java │ │ │ ├── CreateCodePoolRequest.java │ │ │ ├── AuthenticatedUser.java │ │ │ ├── TransactionsStatusView.java │ │ │ ├── SubmitTaskResult.java │ │ │ ├── ResourceStatusView.java │ │ │ ├── CodePoolView.java │ │ │ └── AddTaskRequest.java │ │ │ ├── worker │ │ │ ├── WorkerSideConnection.java │ │ │ ├── ConnectionDeniedException.java │ │ │ ├── TaskExecutorStatus.java │ │ │ ├── WorkerStatusListener.java │ │ │ ├── KillWorkerHandler.java │ │ │ ├── FinishedTaskNotification.java │ │ │ ├── JVMWorkersRegistry.java │ │ │ └── WorkerStatusView.java │ │ │ ├── task │ │ │ ├── BrokerFailureListener.java │ │ │ ├── IllegalActionException.java │ │ │ ├── SlotStatus.java │ │ │ ├── InvalidActionException.java │ │ │ ├── AddTaskResult.java │ │ │ ├── LogNotAvailableException.java │ │ │ ├── NoLimitsGlobalResourceLimitsConfiguration.java │ │ │ ├── SimpleCallback.java │ │ │ ├── TaskFinishedData.java │ │ │ ├── GlobalResourceLimitsConfiguration.java │ │ │ ├── TaskPropertiesMapperFunction.java │ │ │ ├── TaskProperties.java │ │ │ ├── ActionResult.java │ │ │ ├── LogSequenceNumber.java │ │ │ ├── SlotsManager.java │ │ │ ├── SingleUserAuthenticationManager.java │ │ │ ├── MapGlobalResourceLimitsConfiguration.java │ │ │ ├── TaskQueue.java │ │ │ └── AssignedTask.java │ │ │ ├── replication │ │ │ ├── LeaderShipChangeListener.java │ │ │ └── LedgerMetadataUtils.java │ │ │ └── codepools │ │ │ └── CodePool.java │ └── test │ │ ├── resources │ │ ├── examplesnap.json.gz │ │ ├── majordodo │ │ │ └── task │ │ │ │ └── logversion │ │ │ │ ├── v10 │ │ │ │ └── 0000000000000001.txlog │ │ │ │ └── v20 │ │ │ │ └── 0000000000000001.txlog │ │ ├── test_jaas.conf │ │ └── test_jaas_md5.conf │ │ └── java │ │ └── majordodo │ │ └── task │ │ ├── JVMWorkerTest.java │ │ ├── RemoteWorkerTest.java │ │ └── RemoteWorkerSslTest.java ├── nbactions.xml ├── licenseheader.txt ├── nb-configuration.xml └── dodo-core.iml ├── majordodo-web-ui ├── src │ └── main │ │ └── webapp │ │ ├── angular │ │ ├── version.txt │ │ ├── version.json │ │ ├── angular-csp.css │ │ ├── angular-cookies.min.js │ │ ├── angular-loader.min.js │ │ ├── angular-cookies.min.js.map │ │ └── i18n │ │ │ ├── angular-locale_ms-bn.js │ │ │ └── angular-locale_ms.js │ │ ├── bootstrap │ │ └── fonts │ │ │ ├── glyphicons-halflings-regular.eot │ │ │ ├── glyphicons-halflings-regular.ttf │ │ │ ├── glyphicons-halflings-regular.woff │ │ │ └── glyphicons-halflings-regular.woff2 │ │ ├── pages │ │ └── resources.html │ │ └── index.html ├── nb-configuration.xml └── pom.xml ├── docs ├── bookkeeper.png ├── Diennea_Olivelli_ApacheCon16.pdf └── Diennea_Olivelli_ApacheCon16.pptx ├── majordodo-services ├── src │ ├── main │ │ ├── resources │ │ │ ├── extra │ │ │ │ └── README.txt │ │ │ ├── logback.xml │ │ │ ├── conf │ │ │ │ ├── logging.properties │ │ │ │ ├── jaas.conf │ │ │ │ └── worker.properties │ │ │ └── bin │ │ │ │ ├── setenv.sh │ │ │ │ ├── tools │ │ │ │ └── java-utils.sh │ │ └── java │ │ │ └── majordodo │ │ │ └── broker │ │ │ ├── DefaultTaskPropertiesMapperFunction.java │ │ │ └── StandaloneHttpAPIServlet.java │ └── test │ │ ├── resources │ │ ├── cert1.p12 │ │ ├── conf │ │ │ ├── logging.properties │ │ │ ├── worker.properties │ │ │ └── broker.properties │ │ ├── cert1.pem │ │ └── cert1.key │ │ └── java │ │ └── majordodo │ │ └── broker │ │ └── MyExecutor.java ├── shell.sh ├── runbroker.sh ├── runworker.sh ├── dependency_check_exclusions.xml ├── nbactions.xml ├── licenseheader.txt └── nb-configuration.xml ├── majordodo-embedded ├── src │ ├── test │ │ └── resources │ │ │ ├── cert1.p12 │ │ │ ├── cert1.pem │ │ │ └── cert1.key │ └── main │ │ └── java │ │ └── majordodo │ │ └── embedded │ │ ├── EmbeddedWorkerConfiguration.java │ │ ├── EmbeddedWorkerAPIServlet.java │ │ └── EmbeddedBrokerAPIServlet.java ├── licenseheader.txt └── nb-configuration.xml ├── majordodo-site-skin ├── src │ └── main │ │ └── resources │ │ └── media │ │ ├── hero.jpg │ │ ├── diennea.png │ │ ├── favicon.ico │ │ ├── Sora-Bold.ttf │ │ ├── Sora-Light.ttf │ │ ├── Sora-Medium.ttf │ │ ├── Sora-Thin.ttf │ │ ├── engineering.jpg │ │ ├── separator.png │ │ ├── Sora-Regular.ttf │ │ ├── Sora-SemiBold.ttf │ │ ├── Sora-ExtraBold.ttf │ │ └── Sora-ExtraLight.ttf └── pom.xml ├── licences ├── bookkeeper.NOTICE.txt └── zookeeper.NOTICE.txt ├── .gitignore ├── NOTICE ├── nbactions.xml ├── majordodo-website ├── nbactions.xml ├── pom.xml └── src │ └── site │ ├── markdown │ └── index.md │ └── site.xml ├── licenseheader.txt ├── majordodo-client ├── licenseheader.txt ├── nb-configuration.xml └── src │ ├── main │ └── java │ │ └── majordodo │ │ └── client │ │ ├── CreateCodePoolResult.java │ │ ├── BrokerDiscoveryService.java │ │ ├── ClientException.java │ │ ├── CodePoolStatus.java │ │ ├── SubmitTaskResponse.java │ │ ├── discovery │ │ └── StaticBrokerDiscoveryService.java │ │ └── CreateCodePoolRequest.java │ └── test │ └── java │ └── majordodo │ └── testclients │ └── ExampleExecutor.java ├── majordodo-net ├── licenseheader.txt ├── src │ └── main │ │ └── java │ │ └── majordodo │ │ ├── network │ │ ├── netty │ │ │ ├── Session.java │ │ │ ├── MessageDecoder.java │ │ │ ├── NettyBrokerLocator.java │ │ │ ├── DodoMessageDecoder.java │ │ │ ├── DodoMessageEncoder.java │ │ │ ├── InboundMessageHandler.java │ │ │ └── NetworkUtils.java │ │ ├── ServerSideConnection.java │ │ ├── SendResultCallback.java │ │ ├── ReplyCallback.java │ │ ├── jvm │ │ │ ├── JVMBrokerSupportInterface.java │ │ │ └── JVMBrokersRegistry.java │ │ ├── ServerSideConnectionAcceptor.java │ │ ├── BrokerNotAvailableException.java │ │ ├── BrokerRejectedConnectionException.java │ │ ├── BrokerLocator.java │ │ ├── ChannelEventListener.java │ │ └── ConnectionRequestInfo.java │ │ └── security │ │ └── sasl │ │ └── SaslUtils.java ├── nb-configuration.xml └── dodo-net.iml ├── majordodo-worker ├── licenseheader.txt ├── nb-configuration.xml └── src │ └── main │ └── java │ └── majordodo │ └── executors │ ├── TaskExecutorFactory.java │ ├── TaskExecutorFactoryImplementation.java │ └── TaskExecutor.java ├── .github ├── pull_request_template.md ├── issue_template.md └── workflows │ └── pr-validation.yml ├── nb-configuration.xml ├── majordodo-test-clients └── src │ └── main │ └── java │ └── majordodo │ └── testclients │ └── SimpleExecutor.java └── README.md /majordodo-core/test/current/0.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /majordodo-core/test/current/lastId: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /majordodo-web-ui/src/main/webapp/angular/version.txt: -------------------------------------------------------------------------------- 1 | 1.2.19 -------------------------------------------------------------------------------- /docs/bookkeeper.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diennea/majordodo/HEAD/docs/bookkeeper.png -------------------------------------------------------------------------------- /majordodo-core/src/main/resources/majordodo/version/version.properties: -------------------------------------------------------------------------------- 1 | version=${project.version} 2 | -------------------------------------------------------------------------------- /majordodo-services/src/main/resources/extra/README.txt: -------------------------------------------------------------------------------- 1 | 2 | Put here your JAR files which contains implementations of tasks -------------------------------------------------------------------------------- /docs/Diennea_Olivelli_ApacheCon16.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diennea/majordodo/HEAD/docs/Diennea_Olivelli_ApacheCon16.pdf -------------------------------------------------------------------------------- /docs/Diennea_Olivelli_ApacheCon16.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diennea/majordodo/HEAD/docs/Diennea_Olivelli_ApacheCon16.pptx -------------------------------------------------------------------------------- /majordodo-embedded/src/test/resources/cert1.p12: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diennea/majordodo/HEAD/majordodo-embedded/src/test/resources/cert1.p12 -------------------------------------------------------------------------------- /majordodo-services/src/test/resources/cert1.p12: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diennea/majordodo/HEAD/majordodo-services/src/test/resources/cert1.p12 -------------------------------------------------------------------------------- /majordodo-core/src/test/resources/examplesnap.json.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diennea/majordodo/HEAD/majordodo-core/src/test/resources/examplesnap.json.gz -------------------------------------------------------------------------------- /majordodo-site-skin/src/main/resources/media/hero.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diennea/majordodo/HEAD/majordodo-site-skin/src/main/resources/media/hero.jpg -------------------------------------------------------------------------------- /majordodo-site-skin/src/main/resources/media/diennea.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diennea/majordodo/HEAD/majordodo-site-skin/src/main/resources/media/diennea.png -------------------------------------------------------------------------------- /majordodo-site-skin/src/main/resources/media/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diennea/majordodo/HEAD/majordodo-site-skin/src/main/resources/media/favicon.ico -------------------------------------------------------------------------------- /majordodo-site-skin/src/main/resources/media/Sora-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diennea/majordodo/HEAD/majordodo-site-skin/src/main/resources/media/Sora-Bold.ttf -------------------------------------------------------------------------------- /majordodo-site-skin/src/main/resources/media/Sora-Light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diennea/majordodo/HEAD/majordodo-site-skin/src/main/resources/media/Sora-Light.ttf -------------------------------------------------------------------------------- /majordodo-site-skin/src/main/resources/media/Sora-Medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diennea/majordodo/HEAD/majordodo-site-skin/src/main/resources/media/Sora-Medium.ttf -------------------------------------------------------------------------------- /majordodo-site-skin/src/main/resources/media/Sora-Thin.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diennea/majordodo/HEAD/majordodo-site-skin/src/main/resources/media/Sora-Thin.ttf -------------------------------------------------------------------------------- /majordodo-site-skin/src/main/resources/media/engineering.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diennea/majordodo/HEAD/majordodo-site-skin/src/main/resources/media/engineering.jpg -------------------------------------------------------------------------------- /majordodo-site-skin/src/main/resources/media/separator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diennea/majordodo/HEAD/majordodo-site-skin/src/main/resources/media/separator.png -------------------------------------------------------------------------------- /majordodo-site-skin/src/main/resources/media/Sora-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diennea/majordodo/HEAD/majordodo-site-skin/src/main/resources/media/Sora-Regular.ttf -------------------------------------------------------------------------------- /majordodo-site-skin/src/main/resources/media/Sora-SemiBold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diennea/majordodo/HEAD/majordodo-site-skin/src/main/resources/media/Sora-SemiBold.ttf -------------------------------------------------------------------------------- /majordodo-services/shell.sh: -------------------------------------------------------------------------------- 1 | #/bin/bash 2 | /usr/java/jdk1.8.0/bin/java -cp target/dodo-client-1.0.jar:target/dodo-client-1.0-jar-with-dependencies.jar dodo.client.DodoShellMain $@ 3 | -------------------------------------------------------------------------------- /majordodo-site-skin/src/main/resources/media/Sora-ExtraBold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diennea/majordodo/HEAD/majordodo-site-skin/src/main/resources/media/Sora-ExtraBold.ttf -------------------------------------------------------------------------------- /majordodo-site-skin/src/main/resources/media/Sora-ExtraLight.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diennea/majordodo/HEAD/majordodo-site-skin/src/main/resources/media/Sora-ExtraLight.ttf -------------------------------------------------------------------------------- /majordodo-core/test/current/VERSION: -------------------------------------------------------------------------------- 1 | 4 2 | bookieHost: "dna101pc193.diennea.lan:5621" 3 | journalDir: "/tmp/bk-txn" 4 | ledgerDirs: "1\ttest" 5 | instanceId: "b610a979-6fbe-46c5-8217-31fc6dd1dbd3" 6 | -------------------------------------------------------------------------------- /majordodo-web-ui/src/main/webapp/bootstrap/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diennea/majordodo/HEAD/majordodo-web-ui/src/main/webapp/bootstrap/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /majordodo-web-ui/src/main/webapp/bootstrap/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diennea/majordodo/HEAD/majordodo-web-ui/src/main/webapp/bootstrap/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /majordodo-web-ui/src/main/webapp/bootstrap/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diennea/majordodo/HEAD/majordodo-web-ui/src/main/webapp/bootstrap/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /licences/bookkeeper.NOTICE.txt: -------------------------------------------------------------------------------- 1 | Apache BookKeeper 2 | Copyright 2011 The Apache Software Foundation 3 | 4 | This product includes software developed at 5 | The Apache Software Foundation (http://www.apache.org/). 6 | 7 | -------------------------------------------------------------------------------- /licences/zookeeper.NOTICE.txt: -------------------------------------------------------------------------------- 1 | Apache ZooKeeper 2 | Copyright 2009-2014 The Apache Software Foundation 3 | 4 | This product includes software developed at 5 | The Apache Software Foundation (http://www.apache.org/). 6 | -------------------------------------------------------------------------------- /majordodo-services/runbroker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | /usr/java/jdk1.8.0/bin/java -cp "target/*:target/dependency/*" -Djava.util.logging.config.file=src/main/resources/conf/logging.properties majordodo.broker.BrokerMain $@ 3 | -------------------------------------------------------------------------------- /majordodo-services/runworker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | /usr/java/jdk1.8.0/bin/java -cp "target/*:target/dependency/*" -Djava.util.logging.config.file=src/main/resources/conf/logging.properties majordodo.worker.WorkerMain $@ 3 | -------------------------------------------------------------------------------- /majordodo-web-ui/src/main/webapp/bootstrap/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diennea/majordodo/HEAD/majordodo-web-ui/src/main/webapp/bootstrap/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /majordodo-core/src/test/resources/majordodo/task/logversion/v10/0000000000000001.txlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diennea/majordodo/HEAD/majordodo-core/src/test/resources/majordodo/task/logversion/v10/0000000000000001.txlog -------------------------------------------------------------------------------- /majordodo-core/src/test/resources/majordodo/task/logversion/v20/0000000000000001.txlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diennea/majordodo/HEAD/majordodo-core/src/test/resources/majordodo/task/logversion/v20/0000000000000001.txlog -------------------------------------------------------------------------------- /majordodo-services/dependency_check_exclusions.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | pom.xml.tag 3 | pom.xml.releaseBackup 4 | pom.xml.versionsBackup 5 | pom.xml.next 6 | release.properties 7 | .settings 8 | /majordodo-core/nbproject/ 9 | **/.DS_Store 10 | .idea/ 11 | **/*.iml 12 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | Majordodo 2 | Copyright 2015 Diennea S.r.l. 3 | 4 | This product includes software developed at 5 | Diennea S.r.l. (http://www.diennea.com/) inside the MagNews Project (http://www.magnews.com) 6 | 7 | This product includes software developed at 8 | The Apache Software Foundation (http://www.apache.org/). -------------------------------------------------------------------------------- /majordodo-core/src/test/resources/test_jaas.conf: -------------------------------------------------------------------------------- 1 | Server { 2 | org.apache.zookeeper.server.auth.DigestLoginModule required 3 | user_md="testpwd"; 4 | }; 5 | 6 | Client { 7 | org.apache.zookeeper.server.auth.DigestLoginModule required 8 | username="md" 9 | password="testpwd"; 10 | }; -------------------------------------------------------------------------------- /nbactions.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CUSTOM-deploy 5 | deploy 6 | 7 | deploy 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /majordodo-web-ui/src/main/webapp/angular/version.json: -------------------------------------------------------------------------------- 1 | {"raw":"v1.2.19","major":1,"minor":2,"patch":19,"prerelease":[],"build":[],"version":"1.2.19","codeName":"precognitive-flashbacks","full":"1.2.19","cdn":{"raw":"v1.2.18","major":1,"minor":2,"patch":18,"prerelease":[],"build":[],"version":"1.2.18","isStable":true,"docsUrl":"http://code.angularjs.org/1.2.18/docs"}} -------------------------------------------------------------------------------- /majordodo-services/nbactions.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CUSTOM-dependency:tree 5 | dependency:tree 6 | 7 | dependency:tree 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /majordodo-website/nbactions.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CUSTOM-site 5 | site 6 | 7 | clean 8 | site 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /majordodo-services/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /majordodo-services/src/main/resources/conf/logging.properties: -------------------------------------------------------------------------------- 1 | handlers= java.util.logging.ConsoleHandler 2 | # Default global logging level. 3 | # livello per tutti gli Handler 4 | .level= INFO 5 | ############################################################ 6 | # Handler specific properties. 7 | # Describes specific configuration info for Handlers. 8 | ############################################################ 9 | java.util.logging.ConsoleHandler.level = FINEST 10 | java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter 11 | -------------------------------------------------------------------------------- /majordodo-services/src/test/resources/conf/logging.properties: -------------------------------------------------------------------------------- 1 | handlers= java.util.logging.ConsoleHandler 2 | # Default global logging level. 3 | # livello per tutti gli Handler 4 | .level= INFO 5 | ############################################################ 6 | # Handler specific properties. 7 | # Describes specific configuration info for Handlers. 8 | ############################################################ 9 | java.util.logging.ConsoleHandler.level = FINEST 10 | java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter 11 | -------------------------------------------------------------------------------- /majordodo-services/src/main/resources/conf/jaas.conf: -------------------------------------------------------------------------------- 1 | 2 | MajordodoServer { 3 | org.apache.zookeeper.server.auth.DigestLoginModule required 4 | user_majordodo="testpwd"; 5 | }; 6 | 7 | 8 | MajordodoClient { 9 | org.apache.zookeeper.server.auth.DigestLoginModule required 10 | username="majordodo" 11 | password="testpwd"; 12 | }; 13 | 14 | /* 15 | ZooKeeper client example 16 | Client { 17 | org.apache.zookeeper.server.auth.DigestLoginModule required 18 | username="majordodo" 19 | password="testpwd"; 20 | }; 21 | */ -------------------------------------------------------------------------------- /majordodo-core/src/test/resources/test_jaas_md5.conf: -------------------------------------------------------------------------------- 1 | MajordodoServer { 2 | org.apache.zookeeper.server.auth.DigestLoginModule required 3 | user_hd="testpwd"; 4 | }; 5 | 6 | Server { 7 | org.apache.zookeeper.server.auth.DigestLoginModule required 8 | user_zhd="testpwd"; 9 | }; 10 | 11 | MajordodoClient { 12 | org.apache.zookeeper.server.auth.DigestLoginModule required 13 | username="hd" 14 | password="testpwd"; 15 | }; 16 | 17 | 18 | Client { 19 | org.apache.zookeeper.server.auth.DigestLoginModule required 20 | username="zhd" 21 | password="testpwd"; 22 | }; -------------------------------------------------------------------------------- /majordodo-services/src/main/resources/bin/setenv.sh: -------------------------------------------------------------------------------- 1 | # Basic Environment and Java variables 2 | 3 | #JAVA_HOME= 4 | JAVA_OPTS="-Xmx1g -Xms1g -XX:+UseParallelGC -Djava.net.preferIPv4Stack=true -XX:MaxDirectMemorySize=1g -Djava.security.auth.login.config=conf/jaas.conf " 5 | 6 | 7 | if [ -z "$JAVA_HOME" ]; then 8 | JAVA_PATH=`which java 2>/dev/null` 9 | if [ "x$JAVA_PATH" != "x" ]; then 10 | JAVA_BIN=`dirname $JAVA_PATH 2>/dev/null` 11 | JAVA_HOME=`dirname $JAVA_BIN 2>/dev/null` 12 | fi 13 | if [ -z "$JAVA_HOME" ]; then 14 | echo "JAVA_HOME environment variable is not defined and is needed to run this program" 15 | exit 1 16 | fi 17 | fi 18 | -------------------------------------------------------------------------------- /majordodo-web-ui/src/main/webapp/angular/angular-csp.css: -------------------------------------------------------------------------------- 1 | /* Include this file in your html if you are using the CSP mode. */ 2 | 3 | @charset "UTF-8"; 4 | 5 | [ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], 6 | .ng-cloak, .x-ng-cloak, 7 | .ng-hide { 8 | display: none !important; 9 | } 10 | 11 | ng\:form { 12 | display: block; 13 | } 14 | 15 | .ng-animate-block-transitions { 16 | transition:0s all!important; 17 | -webkit-transition:0s all!important; 18 | } 19 | 20 | /* show the element during a show/hide animation when the 21 | * animation is ongoing, but the .ng-hide class is active */ 22 | .ng-hide-add-active, .ng-hide-remove { 23 | display: block!important; 24 | } 25 | -------------------------------------------------------------------------------- /majordodo-core/nbactions.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CUSTOM-clean install findbugs:check 5 | clean install findbugs:check 6 | 7 | clean 8 | install 9 | findbugs:check 10 | 11 | 12 | 13 | CUSTOM-dependency:tree 14 | dependency:tree 15 | 16 | dependency:tree 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /licenseheader.txt: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ -------------------------------------------------------------------------------- /majordodo-client/licenseheader.txt: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ -------------------------------------------------------------------------------- /majordodo-core/licenseheader.txt: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ -------------------------------------------------------------------------------- /majordodo-net/licenseheader.txt: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ -------------------------------------------------------------------------------- /majordodo-worker/licenseheader.txt: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ -------------------------------------------------------------------------------- /majordodo-embedded/licenseheader.txt: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ -------------------------------------------------------------------------------- /majordodo-services/licenseheader.txt: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ -------------------------------------------------------------------------------- /majordodo-web-ui/src/main/webapp/angular/angular-cookies.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | AngularJS v1.2.19 3 | (c) 2010-2014 Google, Inc. http://angularjs.org 4 | License: MIT 5 | */ 6 | (function(p,f,n){'use strict';f.module("ngCookies",["ng"]).factory("$cookies",["$rootScope","$browser",function(e,b){var c={},g={},h,k=!1,l=f.copy,m=f.isUndefined;b.addPollFn(function(){var a=b.cookies();h!=a&&(h=a,l(a,g),l(a,c),k&&e.$apply())})();k=!0;e.$watch(function(){var a,d,e;for(a in g)m(c[a])&&b.cookies(a,n);for(a in c)d=c[a],f.isString(d)||(d=""+d,c[a]=d),d!==g[a]&&(b.cookies(a,d),e=!0);if(e)for(a in d=b.cookies(),c)c[a]!==d[a]&&(m(d[a])?delete c[a]:c[a]=d[a])});return c}]).factory("$cookieStore", 7 | ["$cookies",function(e){return{get:function(b){return(b=e[b])?f.fromJson(b):b},put:function(b,c){e[b]=f.toJson(c)},remove:function(b){delete e[b]}}}])})(window,window.angular); 8 | //# sourceMappingURL=angular-cookies.min.js.map 9 | -------------------------------------------------------------------------------- /majordodo-core/src/main/java/majordodo/utils/Version.java: -------------------------------------------------------------------------------- 1 | package majordodo.utils; 2 | 3 | import java.io.IOException; 4 | import java.io.InputStream; 5 | import java.util.Properties; 6 | 7 | /** 8 | * Versioning Utils 9 | * 10 | * @author enrico.olivelli 11 | */ 12 | public abstract class Version { 13 | 14 | private static final String VERSION; 15 | 16 | private Version() { 17 | } 18 | 19 | static { 20 | Properties pluginProperties = new Properties(); 21 | try (InputStream in = Version.class.getResourceAsStream("/majordodo/version/version.properties")) { 22 | pluginProperties.load(in); 23 | VERSION = (String) pluginProperties.get("version"); 24 | } catch (IOException err) { 25 | throw new RuntimeException(err); 26 | } 27 | } 28 | 29 | public static String getVersion() { 30 | return VERSION; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /majordodo-website/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | 5 | org.majordodo 6 | majordodo-parent 7 | 0.21.0-SNAPSHOT 8 | 9 | majordodo-website 10 | jar 11 | Majordodo Website 12 | 13 | 14 | 15 | org.apache.maven.plugins 16 | maven-site-plugin 17 | 3.7.1 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | Following this checklist to help us incorporate your 2 | contribution quickly and easily: 3 | 4 | - [ ] Each commit in the pull request should have a meaningful subject line and body. 5 | - [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. 6 | - [ ] Rember to add the correct license header to new files. 7 | - [ ] Run `mvn clean verify` to make sure basic checks pass. A more thorough check will 8 | be performed on your pull request automatically. 9 | 10 | To make clear that you license your contribution under 11 | the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0) 12 | you have to acknowledge this by using the following check-box. 13 | 14 | - [ ] I hereby declare this contribution to be licenced under the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0) 15 | -------------------------------------------------------------------------------- /majordodo-net/src/main/java/majordodo/network/netty/Session.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.network.netty; 21 | 22 | /** 23 | * 24 | * @author enrico.olivelli 25 | */ 26 | public class Session { 27 | 28 | } 29 | -------------------------------------------------------------------------------- /majordodo-net/src/main/java/majordodo/network/netty/MessageDecoder.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.network.netty; 21 | 22 | /** 23 | * 24 | * @author enrico.olivelli 25 | */ 26 | public class MessageDecoder { 27 | 28 | } 29 | -------------------------------------------------------------------------------- /majordodo-site-skin/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | org.majordodo 5 | majordodo-parent 6 | 0.21.0-SNAPSHOT 7 | 8 | majordodo-site-skin 9 | jar 10 | Majordodo Site skin 11 | 12 | 13 | 14 | src/main/resources/ 15 | 16 | 17 | src/main/resources/ 18 | 19 | META-INF/maven/* 20 | 21 | true 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /majordodo-core/src/main/java/majordodo/clientfacade/UserRole.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.clientfacade; 21 | 22 | /** 23 | * Role for an user 24 | * 25 | * @author enrico.olivelli 26 | */ 27 | public enum UserRole { 28 | 29 | USER, 30 | ADMINISTRATOR 31 | } 32 | -------------------------------------------------------------------------------- /majordodo-core/src/main/java/majordodo/worker/WorkerSideConnection.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.worker; 21 | 22 | /** 23 | * Connection to the broker 24 | * @author enrico.olivelli 25 | */ 26 | public class WorkerSideConnection { 27 | 28 | } 29 | -------------------------------------------------------------------------------- /majordodo-core/src/test/java/majordodo/task/JVMWorkerTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.task; 21 | 22 | /** 23 | * Simple tests 24 | * 25 | * @author enrico.olivelli 26 | */ 27 | public class JVMWorkerTest extends SimpleBrokerSuite { 28 | 29 | 30 | } 31 | -------------------------------------------------------------------------------- /majordodo-embedded/nb-configuration.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 16 | ${project.basedir}/licenseheader.txt 17 | 18 | 19 | -------------------------------------------------------------------------------- /majordodo-worker/nb-configuration.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 16 | ${project.basedir}/licenseheader.txt 17 | 18 | 19 | -------------------------------------------------------------------------------- /majordodo-net/src/main/java/majordodo/network/ServerSideConnection.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.network; 21 | 22 | /** 23 | * A Connection registered on the broker 24 | * 25 | * @author enrico.olivelli 26 | */ 27 | public interface ServerSideConnection { 28 | 29 | public long getConnectionId(); 30 | } 31 | -------------------------------------------------------------------------------- /majordodo-core/src/main/java/majordodo/clientfacade/AuthenticationManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.clientfacade; 21 | 22 | /** 23 | * Authentication 24 | * 25 | * @author enrico.olivelli 26 | */ 27 | public abstract class AuthenticationManager { 28 | 29 | public abstract AuthenticatedUser login(String username, String password); 30 | } 31 | -------------------------------------------------------------------------------- /.github/issue_template.md: -------------------------------------------------------------------------------- 1 | Is this a question, a feature request or a bug report? 2 | 3 | 4 | **QUESTION** 5 | 6 | Have you checked our documentation at https://majordodo.readme.io/? 7 | If you could not find an answer there, please consider asking your question on our mailing list at majordodo-users@lists.majordodo.org. 8 | 9 | 10 | **FEATURE REQUEST** 11 | 12 | 1. Please describe the feature you are requesting. 13 | 14 | 2. Indicate the importance of this issue to you (blocker, must-have, should-have, nice-to-have). Are you currently using any workarounds to address this issue? 15 | 16 | 3. Provide any additional detail on your proposed use case for this feature. 17 | 18 | 4. If there are some sub-tasks using -[] for each subtask and create a corresponding issue to map to the sub task: 19 | - [ ] [sub-task1-issue-number](example_sub_issue1_link_here): sub-task1 discription here, 20 | - [ ] [sub-task2-issue-number](example_sub_issue2_link_here): sub-task2 discription here, 21 | - ... 22 | 23 | 24 | **BUG REPORT** 25 | 26 | 1. Please describe the issue you observed: 27 | 28 | - What did you do? 29 | 30 | - What did you expect to see? 31 | 32 | - What did you see instead? 33 | -------------------------------------------------------------------------------- /majordodo-net/src/main/java/majordodo/network/SendResultCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.network; 21 | 22 | /** 23 | * Callback for async calls 24 | * 25 | * @author enrico.olivelli 26 | */ 27 | public interface SendResultCallback { 28 | 29 | public void messageSent(Message originalMessage, Throwable error); 30 | } 31 | -------------------------------------------------------------------------------- /majordodo-services/src/test/resources/conf/worker.properties: -------------------------------------------------------------------------------- 1 | # id of this worker (leave empty in order to use InetAddress.getLocalHost().getCanonicalHostName()) 2 | worker.id= 3 | 4 | # groups, in order of priority 5 | # 0=any group, usually it is put at the end of the list 6 | worker.groups=0 7 | #worker.groups=1,2,3,0 8 | 9 | # executor factory, this class will "implement" the code of tasks 10 | worker.executorfactory=majordodo.worker.DefaultExecutorFactory 11 | 12 | # maximum number of active threads 13 | worker.maxthreads=100 14 | 15 | # for each task type you can define the maximum number of active threads 16 | # the worker will "ask" only for this taskstypes 17 | # the special id 'any' means that the worker will accept tasks of any type 18 | tasktype.any.maxthreads=100 19 | tasktype.tasktype1.maxthreads=40 20 | tasktype.tasktype2.maxthreads=80 21 | 22 | # singleserver|clustered 23 | clustering.mode=singleserver 24 | 25 | # for clustering.mode=singleserver 26 | broker.host=localhost 27 | broker.port=7363 28 | 29 | # for clustering.mode=clustered 30 | zk.address=localhost:1281 31 | zk.sessiontimeout=40000 32 | zk.path=/majordodo 33 | 34 | 35 | codepools.enabled=true 36 | 37 | -------------------------------------------------------------------------------- /majordodo-net/src/main/java/majordodo/network/ReplyCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.network; 21 | 22 | /** 23 | * Callback for async calls 24 | * 25 | * @author enrico.olivelli 26 | */ 27 | public interface ReplyCallback { 28 | 29 | public void replyReceived(Message originalMessage, Message message, Throwable error); 30 | } 31 | -------------------------------------------------------------------------------- /majordodo-core/src/main/java/majordodo/task/BrokerFailureListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.task; 21 | 22 | /** 23 | * Listener for events which indicate a global failure of the broker 24 | * 25 | * @author enrico.olivelli 26 | */ 27 | public interface BrokerFailureListener { 28 | 29 | public default void brokerFailed(Throwable error) { 30 | } 31 | ; 32 | } 33 | -------------------------------------------------------------------------------- /nb-configuration.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 16 | ${project.basedir}/licenseheader.txt 17 | none 18 | 19 | 20 | -------------------------------------------------------------------------------- /majordodo-client/nb-configuration.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 16 | ${project.basedir}/licenseheader.txt 17 | none 18 | 19 | 20 | -------------------------------------------------------------------------------- /majordodo-core/src/main/java/majordodo/task/IllegalActionException.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.task; 21 | 22 | /** 23 | * error upon an invalid action requested to the broker 24 | * @author enrico.olivelli 25 | */ 26 | public class IllegalActionException extends Exception { 27 | 28 | public IllegalActionException(String message) { 29 | super(message); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /majordodo-services/nb-configuration.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 16 | none 17 | ${project.basedir}/licenseheader.txt 18 | 19 | 20 | -------------------------------------------------------------------------------- /majordodo-core/nb-configuration.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 16 | ${project.basedir}/licenseheader.txt 17 | none 18 | 19 | 20 | -------------------------------------------------------------------------------- /majordodo-core/src/main/java/majordodo/replication/LeaderShipChangeListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.replication; 21 | 22 | /** 23 | * Listener for leadership changes 24 | * 25 | * @author enrico.olivelli 26 | */ 27 | public class LeaderShipChangeListener { 28 | 29 | public void leadershipAcquired() { 30 | } 31 | 32 | public void leadershipLost(String reason) { 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /majordodo-net/nb-configuration.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 16 | ${project.basedir}/licenseheader.txt 17 | none 18 | 19 | 20 | -------------------------------------------------------------------------------- /majordodo-services/src/test/resources/conf/broker.properties: -------------------------------------------------------------------------------- 1 | # singleserver|clustered 2 | clustering.mode=singleserver 3 | 4 | # listering endpoint for worker-connection 5 | broker.host=localhost 6 | broker.port=7363 7 | 8 | 9 | # for clustering.mode=clustered 10 | zk.address=localhost:1281 11 | zk.sessiontimeout=40000 12 | zk.path=/majordodo 13 | 14 | 15 | # http interface / Client API 16 | broker.http.host=127.0.0.1 17 | broker.http.port=7364 18 | 19 | #size of the tasks heap (maximum number of waiting tasks) 20 | broker.tasksheap.size=1000000 21 | 22 | # code which will map userid to 'groups' 23 | #tasks.groupmapper= 24 | 25 | # transaction logs, only for clustering.mode=singleserver, in clustering.mode=clustered we are going to use Apache BookKeeper 26 | logs.dir=target/txlog 27 | # maximum file size for transaction log files, in bytes 28 | logs.maxfilesize=1024 29 | 30 | # data (both for clustering.mode=singleserver and clustering.mode=clustered) 31 | data.dir=target/data 32 | 33 | 34 | maxWorkerIdleTime=30000 35 | checkpointTime=30000 36 | finishedTasksRetention=3600000 37 | recomputeGroupsPeriod=0 38 | finishedTasksPurgeSchedulerPeriod=900000 39 | maxExpiredTasksPerCycle=1000 40 | transactionsTtl=300000 41 | 42 | 43 | -------------------------------------------------------------------------------- /majordodo-core/src/main/java/majordodo/task/SlotStatus.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.task; 21 | 22 | /** 23 | * Status of a slot 24 | * @author enrico.olivelli 25 | */ 26 | public class SlotStatus { 27 | private String slot; 28 | 29 | public String getSlot() { 30 | return slot; 31 | } 32 | 33 | public void setSlot(String slot) { 34 | this.slot = slot; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /majordodo-core/src/main/java/majordodo/worker/ConnectionDeniedException.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.worker; 21 | 22 | /** 23 | * Broker refused the connection 24 | * 25 | * @author enrico.olivelli 26 | */ 27 | public class ConnectionDeniedException extends Exception { 28 | 29 | public ConnectionDeniedException(String message) { 30 | super(message); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /majordodo-core/src/main/java/majordodo/task/InvalidActionException.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.task; 21 | 22 | /** 23 | * An invalid action has been request, nothing will be done 24 | * 25 | * @author enrico.olivelli 26 | */ 27 | public class InvalidActionException extends Exception { 28 | 29 | public InvalidActionException(String message) { 30 | super(message); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /majordodo-core/src/main/java/majordodo/task/AddTaskResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.task; 21 | 22 | /** 23 | * Result of AddTask 24 | * 25 | * @author enrico.olivelli 26 | */ 27 | public class AddTaskResult { 28 | 29 | public final long taskId; 30 | public final String error; 31 | 32 | public AddTaskResult(long taskId, String error) { 33 | this.taskId = taskId; 34 | this.error = error; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /majordodo-net/src/main/java/majordodo/network/jvm/JVMBrokerSupportInterface.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.network.jvm; 21 | 22 | import majordodo.network.ServerSideConnectionAcceptor; 23 | 24 | /** 25 | * Abstraction for the JVM Channel 26 | * 27 | * @author enrico.olivelli 28 | */ 29 | public interface JVMBrokerSupportInterface { 30 | 31 | public boolean isRunning(); 32 | 33 | public ServerSideConnectionAcceptor getAcceptor(); 34 | 35 | } 36 | -------------------------------------------------------------------------------- /majordodo-client/src/main/java/majordodo/client/CreateCodePoolResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.client; 21 | 22 | /** 23 | * Result of the creation of a CodePool 24 | * 25 | * @author enrico.olivelli 26 | */ 27 | public class CreateCodePoolResult { 28 | 29 | private boolean ok; 30 | 31 | public boolean isOk() { 32 | return ok; 33 | } 34 | 35 | public void setOk(boolean ok) { 36 | this.ok = ok; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /majordodo-net/src/main/java/majordodo/network/ServerSideConnectionAcceptor.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.network; 21 | 22 | /** 23 | * Interface implemented by the broker in order to accept/register incoming 24 | * connections 25 | * 26 | * @author enrico.olivelli 27 | */ 28 | public interface ServerSideConnectionAcceptor { 29 | 30 | public T createConnection(Channel channel); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /majordodo-core/src/main/java/majordodo/clientfacade/CreateCodePoolResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.clientfacade; 21 | 22 | /** 23 | * Result of CodePool creation 24 | * 25 | * @author enrico.olivelli 26 | */ 27 | public class CreateCodePoolResult { 28 | 29 | public final boolean ok; 30 | public final String outcome; 31 | 32 | public CreateCodePoolResult(boolean ok, String outcome) { 33 | this.ok = ok; 34 | this.outcome = outcome; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /majordodo-net/src/main/java/majordodo/network/BrokerNotAvailableException.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.network; 21 | 22 | /** 23 | * No Broker is avilable 24 | * 25 | * @author enrico.olivelli 26 | */ 27 | public class BrokerNotAvailableException extends Exception { 28 | 29 | public BrokerNotAvailableException() { 30 | } 31 | 32 | public BrokerNotAvailableException(Throwable cause) { 33 | super(cause); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /majordodo-web-ui/src/main/webapp/pages/resources.html: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 |
5 |
6 |

Resources

7 |
8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |
IDRunning tasksGlobal limit
{{res.id}}{{res.runningTasks}}{{res.actualLimit}}
25 |
26 |
27 | 28 |
29 |
30 |
31 | 32 | -------------------------------------------------------------------------------- /majordodo-services/src/main/resources/bin/tools: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Licensed to Diennea S.r.l. under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. Diennea S.r.l. licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # 20 | # majordodo tools script 21 | # 22 | 23 | BASE_DIR= 24 | RUN_AS_USER= 25 | MAINCLASS=majordodo.tools.Tools 26 | 27 | 28 | ### BASE_DIR discovery 29 | if [ -z "$BASE_DIR" ]; then 30 | BASE_DIR="`dirname \"$0\"`" 31 | BASE_DIR="`( cd \"$BASE_DIR\" && pwd )`" 32 | fi 33 | BASE_DIR=$BASE_DIR/.. 34 | BASE_DIR="`( cd \"$BASE_DIR\" && pwd )`" 35 | 36 | $BASE_DIR/bin/java-utils.sh tools $MAINCLASS $BASE_DIR/conf/broker.properties $@ 37 | -------------------------------------------------------------------------------- /majordodo-net/dodo-net.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /majordodo-client/src/main/java/majordodo/client/BrokerDiscoveryService.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.client; 21 | 22 | import java.util.List; 23 | 24 | /** 25 | * Utilty di discover available brokers on the network 26 | * 27 | * @author enrico.olivelli 28 | */ 29 | public interface BrokerDiscoveryService { 30 | 31 | public BrokerAddress getLeaderBroker(); 32 | 33 | public List discoverBrokers(); 34 | 35 | public default void brokerFailed(BrokerAddress address) { 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /majordodo-core/src/main/java/majordodo/utils/IntCounter.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.utils; 21 | 22 | /** 23 | * A simple wrapper for an integer. 24 | * 25 | * @author enrico.olivelli 26 | */ 27 | public class IntCounter { 28 | 29 | public IntCounter() { 30 | } 31 | 32 | public IntCounter(int count) { 33 | this.count = count; 34 | } 35 | 36 | public int count; 37 | 38 | @Override 39 | public String toString() { 40 | return Integer.toString(count); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /majordodo-test-clients/src/main/java/majordodo/testclients/SimpleExecutor.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.testclients; 21 | 22 | import java.util.Map; 23 | import majordodo.executors.TaskExecutor; 24 | 25 | /** 26 | * Simple executor for tests 27 | * 28 | * @author enrico.olivelli 29 | */ 30 | public class SimpleExecutor extends TaskExecutor { 31 | 32 | @Override 33 | public String executeTask(Map parameters) throws Exception { 34 | return "SimpleExecutor run!"; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /majordodo-worker/src/main/java/majordodo/executors/TaskExecutorFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.executors; 21 | 22 | import java.util.Arrays; 23 | import java.util.HashSet; 24 | import java.util.Map; 25 | import java.util.Set; 26 | 27 | /** 28 | * Factory for task executors 29 | * 30 | * @author enrico.olivelli 31 | */ 32 | public interface TaskExecutorFactory { 33 | 34 | public TaskExecutor createTaskExecutor(String taskType, Map parameters); 35 | 36 | } 37 | -------------------------------------------------------------------------------- /majordodo-core/src/main/java/majordodo/task/LogNotAvailableException.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.task; 21 | 22 | /** 23 | * Log is not available, please retry 24 | * 25 | * @author enrico.olivelli 26 | */ 27 | public class LogNotAvailableException extends Exception { 28 | 29 | public LogNotAvailableException(Throwable cause) { 30 | super(cause); 31 | } 32 | 33 | public LogNotAvailableException(String message) { 34 | super(message); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /majordodo-core/src/main/java/majordodo/utils/ErrorUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.utils; 21 | 22 | import java.io.PrintWriter; 23 | import java.io.StringWriter; 24 | 25 | /** 26 | * Utility 27 | * 28 | * @author enrico.olivelli 29 | */ 30 | public class ErrorUtils { 31 | 32 | public static String stacktrace(Throwable error) { 33 | StringWriter r = new StringWriter(); 34 | PrintWriter t = new PrintWriter(r); 35 | error.printStackTrace(t); 36 | return r.toString(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /majordodo-core/src/main/java/majordodo/worker/TaskExecutorStatus.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.worker; 21 | 22 | /** 23 | * Status of the task (worker-side) 24 | * 25 | * @author enrico.olivelli 26 | */ 27 | public class TaskExecutorStatus { 28 | 29 | public static final String FINISHED = "finished"; 30 | public static final String NEEDS_RECOVERY = "needs_recovery"; 31 | public static final String ERROR = "error"; 32 | public static final String RUNNING = "running"; 33 | } 34 | -------------------------------------------------------------------------------- /majordodo-services/src/test/java/majordodo/broker/MyExecutor.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.broker; 21 | 22 | import java.io.Serializable; 23 | import java.util.Map; 24 | import majordodo.executors.TaskExecutor; 25 | 26 | /** 27 | * Mock executor 28 | * 29 | * @author enrico.olivelli 30 | */ 31 | public class MyExecutor extends TaskExecutor implements Serializable { 32 | 33 | @Override 34 | public String executeTask(Map parameters) throws Exception { 35 | return "OK!"; 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /majordodo-web-ui/nb-configuration.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 16 | 1.7-web 17 | Tomcat 18 | 19 | 20 | -------------------------------------------------------------------------------- /majordodo-core/src/main/java/majordodo/task/NoLimitsGlobalResourceLimitsConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.task; 21 | 22 | import java.util.Collections; 23 | import java.util.Map; 24 | 25 | /** 26 | * Simple no-limit configuration 27 | * @author enrico.olivelli 28 | */ 29 | public class NoLimitsGlobalResourceLimitsConfiguration implements GlobalResourceLimitsConfiguration { 30 | 31 | @Override 32 | public Map getGlobalResourceLimits() { 33 | return Collections.emptyMap(); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /majordodo-core/src/main/java/majordodo/clientfacade/SlotsStatusView.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.clientfacade; 21 | 22 | import java.util.Map; 23 | 24 | /** 25 | * Status of busy slots 26 | * 27 | * @author enrico.olivelli 28 | */ 29 | public class SlotsStatusView { 30 | 31 | private Map busySlots; 32 | 33 | public Map getBusySlots() { 34 | return busySlots; 35 | } 36 | 37 | public void setBusySlots(Map busySlots) { 38 | this.busySlots = busySlots; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /majordodo-core/src/main/java/majordodo/task/SimpleCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.task; 21 | 22 | /** 23 | * Generic callback 24 | * 25 | * @author enrico.olivelli 26 | */ 27 | public interface SimpleCallback { 28 | 29 | /** 30 | * If an error occurred than the error parameter will be not null, otherwise 31 | * the result parameter will be the result of the action 32 | * 33 | * @param result 34 | * @param error 35 | */ 36 | public void onResult(T result, Throwable error); 37 | } 38 | -------------------------------------------------------------------------------- /majordodo-core/dodo-core.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /majordodo-core/src/main/java/majordodo/task/TaskFinishedData.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.task; 21 | 22 | /** 23 | * Holder for task finished nofitication data 24 | * 25 | * @author enrico.olivelli 26 | */ 27 | public class TaskFinishedData { 28 | 29 | public final long taskid; 30 | public final String result; 31 | public final int finalStatus; 32 | 33 | public TaskFinishedData(long taskid, String result, int finalStatus) { 34 | this.taskid = taskid; 35 | this.result = result; 36 | this.finalStatus = finalStatus; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /majordodo-embedded/src/test/resources/cert1.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDjzCCAnegAwIBAgIUS+LYo9jX3CikUuDdNUUAh7nICXIwDQYJKoZIhvcNAQEL 3 | BQAwVjELMAkGA1UEBhMCSVQxCzAJBgNVBAgMAlJBMRAwDgYDVQQKDAdEaWVubmVh 4 | MRAwDgYDVQQLDAdEaWVubmVhMRYwFAYDVQQDDA1tYWpvcmRvZG9jZXJ0MCAXDTI1 5 | MDMxNDA5NTYwMloYDzIxMjUwMjE4MDk1NjAyWjBWMQswCQYDVQQGEwJJVDELMAkG 6 | A1UECAwCUkExEDAOBgNVBAoMB0RpZW5uZWExEDAOBgNVBAsMB0RpZW5uZWExFjAU 7 | BgNVBAMMDW1ham9yZG9kb2NlcnQwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK 8 | AoIBAQDJRdsdWn26VBcFafo1DrbrYQk+PfIkytjgPjzKkmHkK3rS12RVOe1szcZT 9 | 6qhj8FjHLKNlTYS3HPsPe6iBKs+wc1P3LvnK+wYlG06r8fw0W2tyzvAe5X8b22Xb 10 | 3B7Yt0cq1WwpnIHSetINhK/BE8h4256Yf35GBVBtKfdXO6LBM6Dung2CjPTrdOFX 11 | QmSKLEgEN4S9XkGQ0L8gtPK4xFCVKYmaetp6v5LC46oQekhuFmqXnVm2QAEXlIKF 12 | 0nTTtjSTqcpRM69fTqmVC7kerRpv0OUsGuupFdktx1rf33/NJVr9qipxJ7tNarJH 13 | EUMqTVaQVqcXaHvj+lLSk1wc8wMnAgMBAAGjUzBRMB0GA1UdDgQWBBRVQXZgramU 14 | qJAw/tNeRDGOBXxDEjAfBgNVHSMEGDAWgBRVQXZgramUqJAw/tNeRDGOBXxDEjAP 15 | BgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQALoXrN1IQiQ7irFKPu 16 | YLmkzMJry3ikFwZCp4oEtLmXRGKlTQner36p32EpbAQiiX7Vffhvoyi3LdrY6kRL 17 | 5y92O0uzO6PKR5rhaPlbt4+h98wVQxPPb8sXgehm4YIXDpmuXGStJ2jdEVSiQZjQ 18 | +uMhXGFo83OCPRAdIp2Ry4I59b9ljFI331c6SjDZ9gEXe5Kwpdo8+Ossyb5YurtW 19 | EhdNdwwckRP7qgCok1m5QGtbv8ckdJR1ddNbsQj9VycYKq3R4U9ahSp28/DAwEwI 20 | 6mxigcDGmI3uOIJaJlUgLzL++EPo+mj1wTNBFe5wzzAizBoAqCEu1lq3eR6g4uw+ 21 | 5+n7 22 | -----END CERTIFICATE----- 23 | -------------------------------------------------------------------------------- /majordodo-net/src/main/java/majordodo/network/BrokerRejectedConnectionException.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.network; 21 | 22 | /** 23 | * Broker rejected connection attempt 24 | * 25 | * @author enrico.olivelli 26 | */ 27 | public class BrokerRejectedConnectionException extends Exception { 28 | 29 | public BrokerRejectedConnectionException(String message) { 30 | super(message); 31 | } 32 | 33 | public BrokerRejectedConnectionException(String message, Throwable cause) { 34 | super(message, cause); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /majordodo-services/src/test/resources/cert1.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDjzCCAnegAwIBAgIUS+LYo9jX3CikUuDdNUUAh7nICXIwDQYJKoZIhvcNAQEL 3 | BQAwVjELMAkGA1UEBhMCSVQxCzAJBgNVBAgMAlJBMRAwDgYDVQQKDAdEaWVubmVh 4 | MRAwDgYDVQQLDAdEaWVubmVhMRYwFAYDVQQDDA1tYWpvcmRvZG9jZXJ0MCAXDTI1 5 | MDMxNDA5NTYwMloYDzIxMjUwMjE4MDk1NjAyWjBWMQswCQYDVQQGEwJJVDELMAkG 6 | A1UECAwCUkExEDAOBgNVBAoMB0RpZW5uZWExEDAOBgNVBAsMB0RpZW5uZWExFjAU 7 | BgNVBAMMDW1ham9yZG9kb2NlcnQwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK 8 | AoIBAQDJRdsdWn26VBcFafo1DrbrYQk+PfIkytjgPjzKkmHkK3rS12RVOe1szcZT 9 | 6qhj8FjHLKNlTYS3HPsPe6iBKs+wc1P3LvnK+wYlG06r8fw0W2tyzvAe5X8b22Xb 10 | 3B7Yt0cq1WwpnIHSetINhK/BE8h4256Yf35GBVBtKfdXO6LBM6Dung2CjPTrdOFX 11 | QmSKLEgEN4S9XkGQ0L8gtPK4xFCVKYmaetp6v5LC46oQekhuFmqXnVm2QAEXlIKF 12 | 0nTTtjSTqcpRM69fTqmVC7kerRpv0OUsGuupFdktx1rf33/NJVr9qipxJ7tNarJH 13 | EUMqTVaQVqcXaHvj+lLSk1wc8wMnAgMBAAGjUzBRMB0GA1UdDgQWBBRVQXZgramU 14 | qJAw/tNeRDGOBXxDEjAfBgNVHSMEGDAWgBRVQXZgramUqJAw/tNeRDGOBXxDEjAP 15 | BgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQALoXrN1IQiQ7irFKPu 16 | YLmkzMJry3ikFwZCp4oEtLmXRGKlTQner36p32EpbAQiiX7Vffhvoyi3LdrY6kRL 17 | 5y92O0uzO6PKR5rhaPlbt4+h98wVQxPPb8sXgehm4YIXDpmuXGStJ2jdEVSiQZjQ 18 | +uMhXGFo83OCPRAdIp2Ry4I59b9ljFI331c6SjDZ9gEXe5Kwpdo8+Ossyb5YurtW 19 | EhdNdwwckRP7qgCok1m5QGtbv8ckdJR1ddNbsQj9VycYKq3R4U9ahSp28/DAwEwI 20 | 6mxigcDGmI3uOIJaJlUgLzL++EPo+mj1wTNBFe5wzzAizBoAqCEu1lq3eR6g4uw+ 21 | 5+n7 22 | -----END CERTIFICATE----- 23 | -------------------------------------------------------------------------------- /majordodo-website/src/site/markdown/index.md: -------------------------------------------------------------------------------- 1 |

2 | Majordodo is a replicated service to build complex multi-tenant computing grids. 3 | You can view it as a distributed threadpool where tasks are submitted by users and a network of brokers schedules execution on a large set of machines, caring about failures, recovery and priority-based resources assignment.

Tasks are implemented in Java and can be submitted and monitored using a simple HTTP REST JSON API. 4 |

5 | 6 |

Multi-tenancy

7 | Majordodo manages resources for each tenant and guarantees resource access isolation and fair scheduling. Users' execution priorities are dynamic and can be modified at runtime for each and every task, even ones that have already been submitted to the scheduler. 8 | 9 |

Resiliency

10 | Majordodo leverages Apache Zookeeper and Apache Bookkeeper to build a fully replicated, shared-nothing, broker architecture without any single point of failure. Workers can be run on commodity-hardware, virtual machines or dynamically provisioned cloud resources which may fail at any time without service interruption. 11 | 12 |

Scalability

13 | Majordodo is designed to manage tasks for thousands of hosts. It is simple to add and remove hosts and resources with dynamic reconfiguration and adaptive tasks scheduling. 14 | -------------------------------------------------------------------------------- /majordodo-net/src/main/java/majordodo/network/BrokerLocator.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.network; 21 | 22 | /** 23 | * Locates the current broker 24 | * 25 | * @author enrico.olivelli 26 | */ 27 | public interface BrokerLocator extends AutoCloseable { 28 | 29 | public Channel connect(ChannelEventListener messageReceiver, ConnectionRequestInfo workerInfo) throws InterruptedException, BrokerNotAvailableException, BrokerRejectedConnectionException; 30 | 31 | public void brokerDisconnected(); 32 | 33 | @Override 34 | public default void close() { 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /majordodo-embedded/src/main/java/majordodo/embedded/EmbeddedWorkerConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.embedded; 21 | 22 | /** 23 | * Configuration for worker configuration 24 | * 25 | * @author enrico.olivelli 26 | */ 27 | public class EmbeddedWorkerConfiguration extends AbstractEmbeddedServiceConfiguration { 28 | 29 | public static final String KEY_HOST = "worker.broker.host"; 30 | public static final String KEY_PORT = "worker.broker.port"; 31 | public static final String KEY_SSL = "worker.broker.ssl"; 32 | 33 | public static final String KEY_SSL_UNSECURE = "worker.broker.ssl.unsecure"; 34 | } 35 | -------------------------------------------------------------------------------- /majordodo-client/src/main/java/majordodo/client/ClientException.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.client; 21 | 22 | /** 23 | * An generic error occurred on client API 24 | * @author enrico.olivelli 25 | */ 26 | public class ClientException extends Exception { 27 | 28 | public ClientException() { 29 | } 30 | 31 | public ClientException(String message) { 32 | super(message); 33 | } 34 | 35 | public ClientException(String message, Throwable cause) { 36 | super(message, cause); 37 | } 38 | 39 | public ClientException(Throwable cause) { 40 | super(cause); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /majordodo-worker/src/main/java/majordodo/executors/TaskExecutorFactoryImplementation.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.executors; 21 | 22 | import java.lang.annotation.Documented; 23 | import java.lang.annotation.ElementType; 24 | import java.lang.annotation.Retention; 25 | import java.lang.annotation.RetentionPolicy; 26 | import java.lang.annotation.Target; 27 | 28 | /** 29 | * Annotation used for automatic discovery of TaskExecutionFactory 30 | * 31 | * @author enrico.olivelli 32 | */ 33 | @Retention(RetentionPolicy.RUNTIME) 34 | @Documented 35 | @Target(ElementType.TYPE) 36 | public @interface TaskExecutorFactoryImplementation { 37 | 38 | } 39 | -------------------------------------------------------------------------------- /majordodo-website/src/site/site.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Majordodo - Diennea 5 | 6 | 7 | 8 | Documentation 9 | https://majordodo.readme.io/ 10 | 11 | 12 | Community 13 | http://lists.majordodo.org/mailman/listinfo 14 | 15 | 16 | GitHub 17 | https://github.com/diennea/majordodo 18 | 19 | 20 | Download 21 | https://github.com/diennea/majordodo/releases 22 | 23 | 24 | 25 | 26 | 27 | Majordodo 28 | A distributed resource manager 29 | Diennea engineering 30 | 31 | 32 | 33 | 34 | 35 | ${project.groupId} 36 | majordodo-site-skin 37 | ${project.version} 38 | 39 | 40 | -------------------------------------------------------------------------------- /majordodo-net/src/main/java/majordodo/network/ChannelEventListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.network; 21 | 22 | /** 23 | * Receives inbound messages from the channel 24 | * 25 | * @author enrico.olivelli 26 | */ 27 | public interface ChannelEventListener { 28 | 29 | /** 30 | * Called for each message which is not a direct reply to another message. 31 | * Any unchecked Exception thrown by this method will cause the channel to 32 | * be closed 33 | * 34 | * @param message 35 | */ 36 | public void messageReceived(Message message); 37 | 38 | public void channelClosed(); 39 | 40 | } 41 | -------------------------------------------------------------------------------- /majordodo-web-ui/src/main/webapp/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | Majordodo 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | -------------------------------------------------------------------------------- /majordodo-web-ui/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | 5 | majordodo-parent 6 | org.majordodo 7 | 0.21.0-SNAPSHOT 8 | 9 | 10 | majordodo-web-ui 11 | war 12 | 13 | Majordodo Web UI 14 | 15 | 16 | UTF-8 17 | 18 | 19 | 20 | 21 | javax 22 | javaee-web-api 23 | 7.0 24 | provided 25 | 26 | 27 | 28 | 29 | 30 | 31 | org.apache.maven.plugins 32 | maven-war-plugin 33 | 3.3.1 34 | 35 | false 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /majordodo-client/src/main/java/majordodo/client/CodePoolStatus.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.client; 21 | 22 | /** 23 | * Status of a CodePool 24 | * 25 | * @author enrico.olivelli 26 | */ 27 | public class CodePoolStatus { 28 | 29 | private String id; 30 | private long creationTimestamp; 31 | 32 | public String getId() { 33 | return id; 34 | } 35 | 36 | public void setId(String id) { 37 | this.id = id; 38 | } 39 | 40 | public long getCreationTimestamp() { 41 | return creationTimestamp; 42 | } 43 | 44 | public void setCreationTimestamp(long creationTimestamp) { 45 | this.creationTimestamp = creationTimestamp; 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /majordodo-core/src/main/java/majordodo/task/GlobalResourceLimitsConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.task; 21 | 22 | import java.util.Map; 23 | 24 | /** 25 | * Defines a global resource usage limits, to be applied to the whole system. As 26 | * resource is for instance a DBMS and you want to limit the overall number of 27 | * active connections to it 28 | * 29 | * @author enrico.olivelli 30 | */ 31 | public interface GlobalResourceLimitsConfiguration { 32 | 33 | /** 34 | * Define for each resource the actual maximunm number of task which use 35 | * that resource and is running (ASSIGNED to a worker) 36 | * 37 | * @return 38 | */ 39 | public Map getGlobalResourceLimits(); 40 | } 41 | -------------------------------------------------------------------------------- /majordodo-web-ui/src/main/webapp/angular/angular-loader.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | AngularJS v1.2.19 3 | (c) 2010-2014 Google, Inc. http://angularjs.org 4 | License: MIT 5 | */ 6 | (function(){'use strict';function d(a){return function(){var c=arguments[0],b,c="["+(a?a+":":"")+c+"] http://errors.angularjs.org/1.2.19/"+(a?a+"/":"")+c;for(b=1;b transactions; 37 | 38 | public List getTransactions() { 39 | return transactions; 40 | } 41 | 42 | public void setTransactions(List transactions) { 43 | this.transactions = transactions; 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /majordodo-core/src/main/java/majordodo/worker/WorkerStatusListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.worker; 21 | 22 | import java.util.List; 23 | 24 | /** 25 | * Receives notifications about the status of the worker. 26 | * 27 | * @author enrico.olivelli 28 | */ 29 | public interface WorkerStatusListener { 30 | 31 | public static final String EVENT_CONNECTED = "connected"; 32 | public static final String EVENT_CONNECTION_ERROR = "connection_error"; 33 | public static final String EVENT_DISCONNECTED = "disconnected"; 34 | 35 | public default void connectionEvent(String event, WorkerCore core) { 36 | } 37 | 38 | public default void beforeNotifyTasksFinished(List notifications, WorkerCore core) { 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /majordodo-core/src/main/java/majordodo/task/TaskPropertiesMapperFunction.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.task; 21 | 22 | /** 23 | * Function which maps a task to a group of user and a set of resources which will be used by the task. This function must be very 24 | * fast, usually the implementation will be a HashMap lookup. This function must 25 | * be trehead safe must it should never impose any lock. 26 | * Beware that the set of resources used by a task is dynamic and can change within the interval of time from the submission of the task, the first execution and further executions. 27 | * 28 | * @author enrico.olivelli 29 | */ 30 | @FunctionalInterface 31 | public interface TaskPropertiesMapperFunction { 32 | 33 | public TaskProperties getTaskProperties(long taskid, String taskType, String userid); 34 | } 35 | -------------------------------------------------------------------------------- /majordodo-core/src/main/java/majordodo/clientfacade/SubmitTaskResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.clientfacade; 21 | 22 | /** 23 | * REsult of an AddTask for the client 24 | * 25 | * @author enrico.olivelli 26 | */ 27 | public class SubmitTaskResult { 28 | 29 | private final long taskId; 30 | private final String outcome; 31 | 32 | public SubmitTaskResult(long taskId, String outcome) { 33 | this.taskId = taskId; 34 | this.outcome = outcome; 35 | } 36 | 37 | public long getTaskId() { 38 | return taskId; 39 | } 40 | 41 | public String getOutcome() { 42 | return outcome; 43 | } 44 | 45 | @Override 46 | public String toString() { 47 | return "SubmitTaskResult{" + "taskId=" + taskId + ", outcome=" + outcome + '}'; 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /majordodo-net/src/main/java/majordodo/network/netty/NettyBrokerLocator.java: -------------------------------------------------------------------------------- 1 | package majordodo.network.netty; 2 | 3 | import java.net.InetSocketAddress; 4 | import java.util.ArrayList; 5 | import java.util.Arrays; 6 | import java.util.HashMap; 7 | import java.util.List; 8 | 9 | import java.util.concurrent.atomic.AtomicInteger; 10 | import majordodo.network.BrokerHostData; 11 | 12 | /** 13 | * Created by enrico.olivelli on 24/03/2015. 14 | */ 15 | public class NettyBrokerLocator extends GenericNettyBrokerLocator { 16 | 17 | private final List servers = new ArrayList<>(); 18 | private final AtomicInteger index = new AtomicInteger(); 19 | 20 | public NettyBrokerLocator(String host, int port, boolean ssl) { 21 | this.servers.add(new BrokerHostData(host, port, "", ssl, new HashMap())); 22 | } 23 | 24 | public NettyBrokerLocator(final List servers, boolean ssl) { 25 | servers.forEach(s -> { 26 | this.servers.add(new BrokerHostData(s.getHostName(), s.getPort(), "", ssl, new HashMap<>())); 27 | }); 28 | 29 | } 30 | 31 | public NettyBrokerLocator(String host, int port, String host2, int port2) { 32 | this(Arrays.asList(new InetSocketAddress(host, port), new InetSocketAddress(host2, port2)), false); 33 | } 34 | 35 | @Override 36 | protected BrokerHostData getServer() { 37 | return servers.get(index.get() % servers.size()); 38 | } 39 | 40 | @Override 41 | public void brokerDisconnected() { 42 | index.incrementAndGet(); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /majordodo-core/src/main/java/majordodo/task/TaskProperties.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.task; 21 | 22 | import java.util.Arrays; 23 | 24 | /** 25 | * Describes runtime properties of a Task, such as "group" and the usage of resources 26 | * 27 | * @author enrico.olivelli 28 | */ 29 | public final class TaskProperties { 30 | 31 | public final int groupId; 32 | public final String[] resources; 33 | 34 | @edu.umd.cs.findbugs.annotations.SuppressWarnings(value = "EI_EXPOSE_REP2") 35 | public TaskProperties(int groupId, String[] resources) { 36 | this.groupId = groupId; 37 | this.resources = resources; 38 | } 39 | 40 | @Override 41 | public String toString() { 42 | return "TaskProperties{" + "groupId=" + groupId + ", resources=" + Arrays.toString(resources) + '}'; 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /majordodo-services/src/main/java/majordodo/broker/DefaultTaskPropertiesMapperFunction.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.broker; 21 | 22 | import majordodo.task.TaskPropertiesMapperFunction; 23 | import majordodo.task.TaskProperties; 24 | 25 | /** 26 | * Default group mapper function 27 | * 28 | * @author enrico.olivelli 29 | */ 30 | public class DefaultTaskPropertiesMapperFunction implements TaskPropertiesMapperFunction { 31 | 32 | @Override 33 | public TaskProperties getTaskProperties(long taskid, String taskType, String userid) { 34 | int groupId = 1; 35 | if (userid != null && !userid.isEmpty()) { 36 | try { 37 | groupId = Integer.parseInt(userid); 38 | } catch (NumberFormatException err) { 39 | } 40 | } 41 | return new TaskProperties(groupId, null); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /majordodo-net/src/main/java/majordodo/network/netty/DodoMessageDecoder.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.network.netty; 21 | 22 | import io.netty.buffer.ByteBuf; 23 | import io.netty.channel.ChannelHandlerContext; 24 | import io.netty.channel.ChannelInboundHandlerAdapter; 25 | import io.netty.util.ReferenceCountUtil; 26 | 27 | /** 28 | * Decodes bytes to messages 29 | * 30 | * @author enrico.olivelli 31 | */ 32 | public class DodoMessageDecoder extends ChannelInboundHandlerAdapter { 33 | 34 | @Override 35 | public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { 36 | ByteBuf in = (ByteBuf) msg; 37 | try { 38 | ctx.fireChannelRead(DodoMessageUtils.decodeMessage(in)); 39 | } finally { 40 | ReferenceCountUtil.release(msg); 41 | } 42 | 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /majordodo-core/src/main/java/majordodo/worker/KillWorkerHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.worker; 21 | 22 | /** 23 | * Handler for the kill worker event 24 | * 25 | * @author enrico.olivelli 26 | */ 27 | public class KillWorkerHandler { 28 | 29 | public static final KillWorkerHandler SHUTDOWN_JVM = new KillWorkerHandler() { 30 | 31 | @Override 32 | @edu.umd.cs.findbugs.annotations.SuppressWarnings(value = "DM_EXIT") 33 | public void killWorker(WorkerCore core) { 34 | System.exit(0); 35 | } 36 | 37 | }; 38 | 39 | public static final KillWorkerHandler GRACEFULL_STOP = new KillWorkerHandler() { 40 | 41 | @Override 42 | public void killWorker(WorkerCore core) { 43 | core.stop(); 44 | } 45 | 46 | }; 47 | 48 | public void killWorker(WorkerCore core) { 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /majordodo-core/src/main/java/majordodo/clientfacade/ResourceStatusView.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.clientfacade; 21 | 22 | /** 23 | * View on the global status of a resource 24 | * 25 | * @author enrico.olivelli 26 | */ 27 | public class ResourceStatusView { 28 | 29 | private String id; 30 | private int runningTasks; 31 | private int actualLimit; 32 | 33 | public String getId() { 34 | return id; 35 | } 36 | 37 | public void setId(String id) { 38 | this.id = id; 39 | } 40 | 41 | public int getRunningTasks() { 42 | return runningTasks; 43 | } 44 | 45 | public void setRunningTasks(int runningTasks) { 46 | this.runningTasks = runningTasks; 47 | } 48 | 49 | public int getActualLimit() { 50 | return actualLimit; 51 | } 52 | 53 | public void setActualLimit(int actualLimit) { 54 | this.actualLimit = actualLimit; 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /majordodo-services/src/main/java/majordodo/broker/StandaloneHttpAPIServlet.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.broker; 21 | 22 | import java.io.IOException; 23 | import javax.servlet.ServletException; 24 | import javax.servlet.http.HttpServlet; 25 | import javax.servlet.http.HttpServletRequest; 26 | import javax.servlet.http.HttpServletResponse; 27 | 28 | /** 29 | * Standard HTTP API 30 | * 31 | * @author enrico.olivelli 32 | */ 33 | public class StandaloneHttpAPIServlet extends HttpServlet { 34 | @Override 35 | protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { 36 | majordodo.clientfacade.HttpAPIImplementation.doGet(req, resp); 37 | } 38 | 39 | @Override 40 | protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { 41 | majordodo.clientfacade.HttpAPIImplementation.doPost(req, resp); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /majordodo-embedded/src/main/java/majordodo/embedded/EmbeddedBrokerAPIServlet.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.embedded; 21 | 22 | import java.io.IOException; 23 | import javax.servlet.ServletException; 24 | import javax.servlet.http.HttpServlet; 25 | import javax.servlet.http.HttpServletRequest; 26 | import javax.servlet.http.HttpServletResponse; 27 | 28 | /** 29 | * Servlet API Client Majordodo Broker 30 | * 31 | * @author enrico.olivelli 32 | */ 33 | public class EmbeddedBrokerAPIServlet extends HttpServlet { 34 | 35 | @Override 36 | protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { 37 | majordodo.clientfacade.HttpAPIImplementation.doGet(req, resp); 38 | } 39 | 40 | @Override 41 | protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { 42 | majordodo.clientfacade.HttpAPIImplementation.doPost(req, resp); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /majordodo-client/src/test/java/majordodo/testclients/ExampleExecutor.java: -------------------------------------------------------------------------------- 1 | package majordodo.testclients; 2 | 3 | /* 4 | Licensed to Diennea S.r.l. under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. Diennea S.r.l. 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, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | 21 | */ 22 | import java.io.Serializable; 23 | import java.net.InetAddress; 24 | import java.util.Map; 25 | import majordodo.executors.TaskExecutor; 26 | 27 | /** 28 | * Example executor 29 | * 30 | * @author enrico.olivelli 31 | */ 32 | public class ExampleExecutor extends TaskExecutor implements Serializable { 33 | 34 | @Override 35 | public String executeTask(Map parameters) throws Exception { 36 | String userId = (String) parameters.get(PARAMETER_USERID); 37 | long taskId = (Long) parameters.get(PARAMETER_TASKID); 38 | int attempt = (Integer) parameters.get(PARAMETER_ATTEMPT); 39 | String tasktype = (String) parameters.get(PARAMETER_TASKTYPE); 40 | String here = InetAddress.getLocalHost().getHostName(); 41 | return "Code executed on " + here + " for user " + userId + " (parameters=" + parameters + ")"; 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /majordodo-client/src/main/java/majordodo/client/SubmitTaskResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.client; 21 | 22 | /** 23 | * Response to the submission of a task 24 | * 25 | * @author enrico.olivelli 26 | */ 27 | public class SubmitTaskResponse { 28 | 29 | private String outcome; 30 | 31 | public String getOutcome() { 32 | return outcome; 33 | } 34 | 35 | public void setOutcome(String outcome) { 36 | this.outcome = outcome; 37 | } 38 | 39 | 40 | private String taskId; 41 | 42 | /** 43 | * Task ID maybe null in case of task not accepted due to "busy-slot" 44 | * 45 | * @return 46 | */ 47 | public String getTaskId() { 48 | return taskId; 49 | } 50 | 51 | public void setTaskId(String taskId) { 52 | this.taskId = taskId; 53 | } 54 | 55 | @Override 56 | public String toString() { 57 | return "SubmitTaskResponse{" + "outcome=" + outcome + ", taskId=" + taskId + '}'; 58 | } 59 | 60 | 61 | 62 | } 63 | -------------------------------------------------------------------------------- /majordodo-client/src/main/java/majordodo/client/discovery/StaticBrokerDiscoveryService.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.client.discovery; 21 | 22 | import java.util.Arrays; 23 | import java.util.Collections; 24 | import java.util.List; 25 | import majordodo.client.BrokerAddress; 26 | import majordodo.client.BrokerDiscoveryService; 27 | 28 | /** 29 | * Static, single broker 30 | * 31 | * @author enrico.olivelli 32 | */ 33 | public class StaticBrokerDiscoveryService implements BrokerDiscoveryService { 34 | 35 | private final BrokerAddress address; 36 | 37 | public StaticBrokerDiscoveryService(BrokerAddress address) { 38 | this.address = address; 39 | } 40 | 41 | @Override 42 | public BrokerAddress getLeaderBroker() { 43 | return address; 44 | } 45 | 46 | @Override 47 | public List discoverBrokers() { 48 | if (address == null) { 49 | return Collections.emptyList(); 50 | } 51 | return Arrays.asList(address); 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /majordodo-core/src/main/java/majordodo/worker/FinishedTaskNotification.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.worker; 21 | 22 | import java.util.Map; 23 | 24 | /** 25 | * Notification for the finish of a task. Notifications MUST be enqueued in case 26 | * of the broker is done 27 | * 28 | * @author enrico.olivelli 29 | */ 30 | public class FinishedTaskNotification { 31 | 32 | public final long taskId; 33 | public final String finalStatus; 34 | public final String results; 35 | public final Throwable error; 36 | 37 | public FinishedTaskNotification(long taskId, String finalStatus, String results, Throwable error) { 38 | this.taskId = taskId; 39 | this.finalStatus = finalStatus; 40 | this.results = results; 41 | this.error = error; 42 | } 43 | 44 | @Override 45 | public String toString() { 46 | return "FinishedTaskNotification{" + "taskId=" + taskId + ", finalStatus=" + finalStatus + ", results=" + results + ", error=" + error + '}'; 47 | } 48 | 49 | 50 | } 51 | -------------------------------------------------------------------------------- /majordodo-core/src/main/java/majordodo/task/ActionResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.task; 21 | 22 | import majordodo.task.WorkerManager; 23 | 24 | /** 25 | * Result of an action 26 | * 27 | * @author enrico.olivelli 28 | */ 29 | public class ActionResult { 30 | 31 | public final long taskId; 32 | public final Throwable error; 33 | 34 | @Override 35 | public String toString() { 36 | return "{" + "taskId=" + taskId + ", error=" + error + '}'; 37 | } 38 | 39 | private ActionResult(long taskId, Throwable error) { 40 | this.taskId = taskId; 41 | this.error = error; 42 | } 43 | 44 | public static ActionResult ERROR(Throwable error) { 45 | return new ActionResult(0, error); 46 | } 47 | 48 | public static ActionResult TASKID(long taskId) { 49 | return new ActionResult(taskId, null); 50 | } 51 | 52 | public static ActionResult OK() { 53 | return new ActionResult(0, null); 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /majordodo-net/src/main/java/majordodo/security/sasl/SaslUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.security.sasl; 21 | 22 | import java.util.Base64; 23 | import java.util.HashMap; 24 | import java.util.Map; 25 | import javax.security.sasl.Sasl; 26 | 27 | /** 28 | * Sasl Utility 29 | * 30 | * @author enrico.olivelli 31 | */ 32 | public class SaslUtils { 33 | 34 | public static final String AUTH_DIGEST_MD5 = "DIGEST-MD5"; 35 | public static final String DEFAULT_REALM = "default"; 36 | 37 | static Map getSaslProps() { 38 | Map props = new HashMap(); 39 | props.put(Sasl.POLICY_NOPLAINTEXT, "true"); 40 | return props; 41 | } 42 | 43 | /** 44 | * Encode a password as a base64-encoded char[] array. 45 | * 46 | * @param password as a byte array. 47 | * @return password as a char array. 48 | */ 49 | static char[] encodePassword(byte[] password) { 50 | return Base64.getEncoder().encodeToString(password).toCharArray(); 51 | } 52 | 53 | 54 | 55 | } 56 | -------------------------------------------------------------------------------- /majordodo-core/src/main/java/majordodo/utils/TestUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.utils; 21 | 22 | import java.util.concurrent.Callable; 23 | 24 | /** 25 | * Testing utility 26 | * 27 | * @author enrico.olivelli 28 | */ 29 | public class TestUtils { 30 | 31 | public static void waitForCondition(Callable condition, Callable callback, int seconds) throws Exception { 32 | try { 33 | while (seconds-- > 0) { 34 | if (condition.call()) { 35 | return; 36 | } 37 | if (callback != null) { 38 | callback.call(); 39 | } 40 | Thread.sleep(500); 41 | } 42 | } catch (InterruptedException ee) { 43 | ee.printStackTrace(); 44 | throw ee; 45 | } catch (Exception ee) { 46 | throw ee; 47 | } 48 | 49 | throw new Exception( 50 | "condition not met in time!"); 51 | } 52 | 53 | public static Callable NOOP = () -> null; 54 | } 55 | -------------------------------------------------------------------------------- /majordodo-core/src/main/java/majordodo/task/LogSequenceNumber.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.task; 21 | 22 | /** 23 | * Sequence number 24 | * 25 | * @author enrico.olivelli 26 | */ 27 | public final class LogSequenceNumber { 28 | 29 | public final long ledgerId; 30 | public final long sequenceNumber; 31 | 32 | @Override 33 | public String toString() { 34 | return ledgerId + "," + sequenceNumber; 35 | } 36 | 37 | public LogSequenceNumber(long ledgerId, long sequenceNumber) { 38 | this.ledgerId = ledgerId; 39 | this.sequenceNumber = sequenceNumber; 40 | } 41 | 42 | public boolean after(LogSequenceNumber snapshotSequenceNumber) { 43 | if (this.ledgerId < snapshotSequenceNumber.ledgerId) { 44 | return false; 45 | } else if (this.ledgerId == snapshotSequenceNumber.ledgerId) { 46 | return this.sequenceNumber > snapshotSequenceNumber.sequenceNumber; 47 | } else { 48 | return true; 49 | } 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /majordodo-client/src/main/java/majordodo/client/CreateCodePoolRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.client; 21 | 22 | /** 23 | * Request to create a new CodePool. Each CodePool has an unique ID. A CodePool 24 | * is immutable, you cannot update a CodePool once created 25 | * 26 | * @author enrico.olivelli 27 | */ 28 | public class CreateCodePoolRequest { 29 | 30 | private String codePoolID; 31 | private long ttl; 32 | private String codePoolData; 33 | 34 | public CreateCodePoolRequest() { 35 | } 36 | 37 | public String getCodePoolID() { 38 | return codePoolID; 39 | } 40 | 41 | public void setCodePoolID(String codePoolID) { 42 | this.codePoolID = codePoolID; 43 | } 44 | 45 | public long getTtl() { 46 | return ttl; 47 | } 48 | 49 | public void setTtl(long ttl) { 50 | this.ttl = ttl; 51 | } 52 | 53 | public String getCodePoolData() { 54 | return codePoolData; 55 | } 56 | 57 | public void setCodePoolData(String codePoolData) { 58 | this.codePoolData = codePoolData; 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /majordodo-core/src/main/java/majordodo/task/SlotsManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.task; 21 | 22 | import java.util.HashSet; 23 | import java.util.Map; 24 | import java.util.Set; 25 | import java.util.concurrent.ConcurrentHashMap; 26 | 27 | /** 28 | * Managers execution slots 29 | * 30 | * @author enrico.olivelli 31 | */ 32 | class SlotsManager { 33 | 34 | private final ConcurrentHashMap actualSlots = new ConcurrentHashMap<>(); 35 | 36 | public Set getBusySlots() { 37 | return new HashSet<>(actualSlots.keySet()); 38 | } 39 | 40 | public ConcurrentHashMap getActualSlots() { 41 | return actualSlots; 42 | } 43 | 44 | public boolean assignSlot(String slot, Long taskId) { 45 | return actualSlots.putIfAbsent(slot, taskId) == null; 46 | } 47 | 48 | public void releaseSlot(String slot, Long taskId) { 49 | actualSlots.remove(slot, taskId); 50 | } 51 | 52 | void loadBusySlots(Map busySlots) { 53 | actualSlots.clear(); 54 | actualSlots.putAll(busySlots); 55 | 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /majordodo-net/src/main/java/majordodo/network/netty/DodoMessageEncoder.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.network.netty; 21 | 22 | import majordodo.network.Message; 23 | import io.netty.buffer.ByteBuf; 24 | import io.netty.channel.ChannelHandlerContext; 25 | import io.netty.channel.ChannelOutboundHandlerAdapter; 26 | import io.netty.channel.ChannelPromise; 27 | import java.nio.charset.StandardCharsets; 28 | 29 | /** 30 | * Encodes messages to bytes 31 | * 32 | * @author enrico.olivelli 33 | */ 34 | public class DodoMessageEncoder extends ChannelOutboundHandlerAdapter { 35 | 36 | @Override 37 | public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) { 38 | Message m = (Message) msg; 39 | ByteBuf encoded = ctx.alloc().buffer(); 40 | DodoMessageUtils.encodeMessage(encoded, m); 41 | ctx.writeAndFlush(encoded, promise); 42 | } 43 | 44 | @Override 45 | public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { 46 | cause.printStackTrace(); 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /majordodo-core/src/main/java/majordodo/task/SingleUserAuthenticationManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.task; 21 | 22 | import majordodo.clientfacade.AuthenticatedUser; 23 | import majordodo.clientfacade.AuthenticationManager; 24 | import majordodo.clientfacade.UserRole; 25 | 26 | /** 27 | * Simple Authentication Manager, only one user, which is an administrator 28 | * 29 | * @author enrico.olivelli 30 | */ 31 | public class SingleUserAuthenticationManager extends AuthenticationManager { 32 | 33 | private final String adminUsername; 34 | private final String adminPassword; 35 | 36 | public SingleUserAuthenticationManager(String adminUsername, String adminPassword) { 37 | this.adminUsername = adminUsername; 38 | this.adminPassword = adminPassword; 39 | } 40 | 41 | @Override 42 | public AuthenticatedUser login(String username, String password) { 43 | if (adminUsername.equalsIgnoreCase(username) && adminPassword.equals(password)) { 44 | return new AuthenticatedUser(username, UserRole.ADMINISTRATOR); 45 | } 46 | return null; 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /majordodo-core/src/main/java/majordodo/task/MapGlobalResourceLimitsConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.task; 21 | 22 | import java.util.Collections; 23 | import java.util.Map; 24 | 25 | /** 26 | * Simple configuration based on a Map 27 | * 28 | * @author enrico.olivelli 29 | */ 30 | public class MapGlobalResourceLimitsConfiguration implements GlobalResourceLimitsConfiguration { 31 | 32 | private Map map; 33 | 34 | public MapGlobalResourceLimitsConfiguration(Map map) { 35 | this.map = map != null ? Collections.unmodifiableMap(map) : Collections.emptyMap(); 36 | } 37 | 38 | public MapGlobalResourceLimitsConfiguration() { 39 | map = Collections.emptyMap(); 40 | } 41 | 42 | public Map getConfiguration() { 43 | return map; 44 | } 45 | 46 | public void setConfiguration(Map map) { 47 | this.map = map != null ? Collections.unmodifiableMap(map) : Collections.emptyMap(); 48 | } 49 | 50 | @Override 51 | public Map getGlobalResourceLimits() { 52 | return map; 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /.github/workflows/pr-validation.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more contributor 3 | # license agreements. See the NOTICE file distributed with this work for additional 4 | # information regarding copyright ownership. The ASF licenses this file to you 5 | # under the Apache License, Version 2.0 (the # "License"); you may not use this 6 | # file except in compliance with the License. You may obtain a copy of the License 7 | # at: 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software distributed 12 | # under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | # CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | # specific language governing permissions and limitations under the License. 15 | # 16 | name: Java CI - Code validation and tests 17 | on: [pull_request] 18 | env: 19 | MAVEN_OPTS: -Dmaven.artifact.threads=4 -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -Dmaven.wagon.httpconnectionManager.ttlSeconds=25 -Dmaven.wagon.http.retryHandler.count=3 20 | jobs: 21 | build: 22 | runs-on: ubuntu-latest 23 | steps: 24 | - name: Cancel Previous Runs 25 | uses: styfle/cancel-workflow-action@0.6.0 26 | with: 27 | access_token: ${{ github.token }} 28 | - uses: actions/checkout@v2 29 | - name: 'Set up JDK 17' 30 | uses: actions/setup-java@v1 31 | with: 32 | java-version: '17' 33 | - name: 'Cache Maven packages' 34 | uses: actions/cache@v4 35 | with: 36 | path: ~/.m2 37 | key: 'cache' 38 | restore-keys: 'cache' 39 | - name: 'Build with Maven' 40 | run: mvn -B verify -Dmaven.test.redirectTestOutputToFile=true --file pom.xml 41 | - name: 'Remove Snapshots Before Caching' 42 | run: find ~/.m2 -name '*SNAPSHOT' | xargs rm -Rf 43 | -------------------------------------------------------------------------------- /majordodo-core/src/main/java/majordodo/clientfacade/CodePoolView.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.clientfacade; 21 | 22 | /** 23 | * View of a codepool from the client 24 | * 25 | * @author enrico.olivelli 26 | */ 27 | public class CodePoolView { 28 | 29 | private String codePoolId; 30 | private long creationTimestamp; 31 | private long ttl; 32 | 33 | public String getCodePoolId() { 34 | return codePoolId; 35 | } 36 | 37 | public void setCodePoolId(String codePoolId) { 38 | this.codePoolId = codePoolId; 39 | } 40 | 41 | public long getCreationTimestamp() { 42 | return creationTimestamp; 43 | } 44 | 45 | public void setCreationTimestamp(long creationTimestamp) { 46 | this.creationTimestamp = creationTimestamp; 47 | } 48 | 49 | public long getTtl() { 50 | return ttl; 51 | } 52 | 53 | public void setTtl(long ttl) { 54 | this.ttl = ttl; 55 | } 56 | 57 | @Override 58 | public String toString() { 59 | return "CodePoolView{" + "codePoolId=" + codePoolId + ", creationTimestamp=" + creationTimestamp + ", ttl=" + ttl + '}'; 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /majordodo-core/src/test/java/majordodo/task/RemoteWorkerTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.task; 21 | 22 | import majordodo.network.BrokerLocator; 23 | import majordodo.network.jvm.JVMBrokerLocator; 24 | import majordodo.network.netty.NettyBrokerLocator; 25 | import majordodo.network.netty.NettyChannelAcceptor; 26 | import org.junit.After; 27 | import org.junit.Before; 28 | 29 | /** 30 | * simple tests using real network connector 31 | * 32 | * @author enrico.olivelli 33 | */ 34 | public class RemoteWorkerTest extends SimpleBrokerSuite { 35 | 36 | NettyChannelAcceptor server; 37 | 38 | @Override 39 | protected BrokerLocator createBrokerLocator() { 40 | return new NettyBrokerLocator(server.getHost(), server.getPort(),server.isSsl()); 41 | } 42 | 43 | @Before 44 | public void startServer() throws Exception { 45 | server = new NettyChannelAcceptor(broker.getAcceptor()); 46 | server.start(); 47 | } 48 | 49 | @After 50 | public void stopServer() throws Exception { 51 | if (server != null) { 52 | server.close(); 53 | } 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /majordodo-embedded/src/test/resources/cert1.key: -------------------------------------------------------------------------------- 1 | -----BEGIN ENCRYPTED PRIVATE KEY----- 2 | MIIFLTBXBgkqhkiG9w0BBQ0wSjApBgkqhkiG9w0BBQwwHAQI1ofJy+GMFgICAggA 3 | MAwGCCqGSIb3DQIJBQAwHQYJYIZIAWUDBAEqBBArj+pigV5TL2LE5k2vq3VlBIIE 4 | 0EJJczihn21DIifO1JlsoNbdmv9r73D/vR0daOsTFmcwXlQ5pa/KORKwaKGwG5DK 5 | Fv/X7kNHaAACRepG6/cnih2XmNNHhB4C/fGoweiCeXfbPlq2ZqaM/LickrfSYwVD 6 | cJ+pQF4ESncfDJGXH2yTBL3e/9m/mSTPnlauLfVx8Ni3YWPpntbuf/n7TokE6/nD 7 | tnbNbA3QxjULjIHbeobcnaTTUuSOJ+LaB5MWD7EpObApQfpZn7SJ+LJOJL0aJlkt 8 | 1Qy4k7i2s7UwclsuV9NMj8JP9IKRNevO9R9sYpKOLpdizB5fjmC9PjGnURrE8OT1 9 | kfnXEaCyeYR4eH5XKsIxKXiY7hNVGMqajQCo9z4hGVI2xPd0JhlR3GR7u6KmwguK 10 | 5kq/8rnCBVXKZgX+IX80LO+k8Yc7hWToCTA4PXfGikzDcEkoCyVD9Z9nqzzgs8EH 11 | f6r/O5cX7Va2FoUqQMNw/ciEA7y5oL/zAzUG53RKyLsgr3xFAFuFVnKAUD891tbo 12 | /fNoMxcyz0gHurqY8UfE+xgEPJTdPlAv4i7/WY/JdUAeNjGrbb2QjNkQS0A7kAOm 13 | 1b6GvqIsiNjDOm3n0IHm4hO91hCV8eNRphFoSbbe3miRsAlytmQFGWvOxbVqlY3a 14 | GbTcpwAuaRX/eSQ7+1sJY4hm/Gv+qmRf7u75hNh7GgUH0WUZhr09fFMl6rduI7T3 15 | CSPhSJkYMlmxmmqx2JGEAt/frxtt8sLGCO/w6pkBye9SCG1VSaDGjv6clzVdP3mb 16 | fyERtUjURxplqAVWxvMgxLd7dApJB9l7lGz/vtc3oULbubXm0pHHPmY+0vTcWGL0 17 | aOFQG9g8YF+SjufjJC6WFodREHFvQo9XyH5pgBCzWv+/OiBJgdiYQLQozeieVI9L 18 | 9Zdeg9nstQm9htPvVgKAk9QZCDwcb8/LZl/KEq7A7tgWB4+KLkdzEMZubC6Vk1K7 19 | /2xk9e/hKpMpjRzFWjAIC8IVwt4Z3+9OmmEyPebDqD3ntz3+YkeYZZomwN4wRpf0 20 | pWBNGSe+GnHlnV26ydmZBw4oKkR/DiV97j2yKM4wJ12eythCWgZUQxE1sbNHr7xS 21 | n+RLgFjxUo0JOtbag257YLGzeOyUOhPbWyo5fVH+ugAw56gZ8FDiE6rC63NpNA/i 22 | SU7aHp4c/VTTaiwIgnQWVCiyBSP7btG/Id55U9fY1Zebo4CvmCSxqDxhLX3EaId3 23 | c/VxynU6VL25lCPv0bikn4YfVT0S6Ufs4E+PaD4qDKnKqLwZZ6sYoop1XhgH48mT 24 | bphlq1hm75EKcwdWE6eTvtwZLMV3NBaR2/hLC65Um7w2eY/+EUaz7LUKvnRd/Bma 25 | qHAivUNPTj9+5VeCCrptNel+VKMh0OM5fPTvNEEEk3xBjrUiNADtc5XmSodSwMkZ 26 | gaM/H1qp/pE+pqBGIpuoJR8Dd6+Nn920TVCF6UnQxy22gEErcHUM53Ycg4CHFpTB 27 | SmfH3mOysjRDhd/wVl87QHahkI4fZMxn6KiiFmUopNUBkbW/dVST709S0zjv5iiU 28 | 6K/+KF9SZ72806zPp/EuVfYsPr/sxjjTtNxSjmYLQdgSsQ8+17Ce4bwp01BbIFPa 29 | TrPckpQXn1UsiOUORlBZyjiONI559GjXx4DaGeWS0cyr 30 | -----END ENCRYPTED PRIVATE KEY----- 31 | -------------------------------------------------------------------------------- /majordodo-services/src/test/resources/cert1.key: -------------------------------------------------------------------------------- 1 | -----BEGIN ENCRYPTED PRIVATE KEY----- 2 | MIIFLTBXBgkqhkiG9w0BBQ0wSjApBgkqhkiG9w0BBQwwHAQI1ofJy+GMFgICAggA 3 | MAwGCCqGSIb3DQIJBQAwHQYJYIZIAWUDBAEqBBArj+pigV5TL2LE5k2vq3VlBIIE 4 | 0EJJczihn21DIifO1JlsoNbdmv9r73D/vR0daOsTFmcwXlQ5pa/KORKwaKGwG5DK 5 | Fv/X7kNHaAACRepG6/cnih2XmNNHhB4C/fGoweiCeXfbPlq2ZqaM/LickrfSYwVD 6 | cJ+pQF4ESncfDJGXH2yTBL3e/9m/mSTPnlauLfVx8Ni3YWPpntbuf/n7TokE6/nD 7 | tnbNbA3QxjULjIHbeobcnaTTUuSOJ+LaB5MWD7EpObApQfpZn7SJ+LJOJL0aJlkt 8 | 1Qy4k7i2s7UwclsuV9NMj8JP9IKRNevO9R9sYpKOLpdizB5fjmC9PjGnURrE8OT1 9 | kfnXEaCyeYR4eH5XKsIxKXiY7hNVGMqajQCo9z4hGVI2xPd0JhlR3GR7u6KmwguK 10 | 5kq/8rnCBVXKZgX+IX80LO+k8Yc7hWToCTA4PXfGikzDcEkoCyVD9Z9nqzzgs8EH 11 | f6r/O5cX7Va2FoUqQMNw/ciEA7y5oL/zAzUG53RKyLsgr3xFAFuFVnKAUD891tbo 12 | /fNoMxcyz0gHurqY8UfE+xgEPJTdPlAv4i7/WY/JdUAeNjGrbb2QjNkQS0A7kAOm 13 | 1b6GvqIsiNjDOm3n0IHm4hO91hCV8eNRphFoSbbe3miRsAlytmQFGWvOxbVqlY3a 14 | GbTcpwAuaRX/eSQ7+1sJY4hm/Gv+qmRf7u75hNh7GgUH0WUZhr09fFMl6rduI7T3 15 | CSPhSJkYMlmxmmqx2JGEAt/frxtt8sLGCO/w6pkBye9SCG1VSaDGjv6clzVdP3mb 16 | fyERtUjURxplqAVWxvMgxLd7dApJB9l7lGz/vtc3oULbubXm0pHHPmY+0vTcWGL0 17 | aOFQG9g8YF+SjufjJC6WFodREHFvQo9XyH5pgBCzWv+/OiBJgdiYQLQozeieVI9L 18 | 9Zdeg9nstQm9htPvVgKAk9QZCDwcb8/LZl/KEq7A7tgWB4+KLkdzEMZubC6Vk1K7 19 | /2xk9e/hKpMpjRzFWjAIC8IVwt4Z3+9OmmEyPebDqD3ntz3+YkeYZZomwN4wRpf0 20 | pWBNGSe+GnHlnV26ydmZBw4oKkR/DiV97j2yKM4wJ12eythCWgZUQxE1sbNHr7xS 21 | n+RLgFjxUo0JOtbag257YLGzeOyUOhPbWyo5fVH+ugAw56gZ8FDiE6rC63NpNA/i 22 | SU7aHp4c/VTTaiwIgnQWVCiyBSP7btG/Id55U9fY1Zebo4CvmCSxqDxhLX3EaId3 23 | c/VxynU6VL25lCPv0bikn4YfVT0S6Ufs4E+PaD4qDKnKqLwZZ6sYoop1XhgH48mT 24 | bphlq1hm75EKcwdWE6eTvtwZLMV3NBaR2/hLC65Um7w2eY/+EUaz7LUKvnRd/Bma 25 | qHAivUNPTj9+5VeCCrptNel+VKMh0OM5fPTvNEEEk3xBjrUiNADtc5XmSodSwMkZ 26 | gaM/H1qp/pE+pqBGIpuoJR8Dd6+Nn920TVCF6UnQxy22gEErcHUM53Ycg4CHFpTB 27 | SmfH3mOysjRDhd/wVl87QHahkI4fZMxn6KiiFmUopNUBkbW/dVST709S0zjv5iiU 28 | 6K/+KF9SZ72806zPp/EuVfYsPr/sxjjTtNxSjmYLQdgSsQ8+17Ce4bwp01BbIFPa 29 | TrPckpQXn1UsiOUORlBZyjiONI559GjXx4DaGeWS0cyr 30 | -----END ENCRYPTED PRIVATE KEY----- 31 | -------------------------------------------------------------------------------- /majordodo-core/src/main/java/majordodo/utils/FileUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.utils; 21 | 22 | import java.io.IOException; 23 | import java.nio.file.FileVisitResult; 24 | import java.nio.file.Files; 25 | import java.nio.file.Path; 26 | import java.nio.file.SimpleFileVisitor; 27 | import java.nio.file.attribute.BasicFileAttributes; 28 | 29 | /** 30 | * Utilities 31 | * @author enrico.olivelli 32 | */ 33 | public class FileUtils { 34 | 35 | public static void cleanDirectory(Path directory) throws IOException { 36 | if (!Files.isDirectory(directory)) { 37 | return; 38 | } 39 | Files.walkFileTree(directory, new SimpleFileVisitor() { 40 | @Override 41 | public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { 42 | Files.delete(file); 43 | return FileVisitResult.CONTINUE; 44 | } 45 | 46 | @Override 47 | public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException { 48 | Files.delete(dir); 49 | return FileVisitResult.CONTINUE; 50 | } 51 | 52 | }); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /majordodo-core/src/main/java/majordodo/codepools/CodePool.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.codepools; 21 | 22 | /** 23 | * A pool of Code (JAR files/Java Classes) used for the implementation of Tasks. 24 | * Code pools are immutable 25 | * 26 | * @author enrico.olivelli 27 | */ 28 | public class CodePool { 29 | 30 | private final String id; 31 | private final long creationTimestamp; 32 | private final byte[] codePoolData; 33 | private final long ttl; 34 | 35 | @edu.umd.cs.findbugs.annotations.SuppressWarnings(value = "EI_EXPOSE_REP2") 36 | public CodePool(String id, long creationTimestamp, byte[] codePoolData, long ttl) { 37 | this.id = id; 38 | this.creationTimestamp = creationTimestamp; 39 | this.codePoolData = codePoolData; 40 | this.ttl = ttl; 41 | } 42 | 43 | public String getId() { 44 | return id; 45 | } 46 | 47 | public long getCreationTimestamp() { 48 | return creationTimestamp; 49 | } 50 | 51 | @edu.umd.cs.findbugs.annotations.SuppressWarnings(value = "EI_EXPOSE_REP") 52 | public byte[] getCodePoolData() { 53 | return codePoolData; 54 | } 55 | 56 | public long getTtl() { 57 | return ttl; 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /majordodo-net/src/main/java/majordodo/network/netty/InboundMessageHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.network.netty; 21 | 22 | import majordodo.network.Message; 23 | import io.netty.channel.ChannelHandlerContext; 24 | import io.netty.channel.ChannelInboundHandlerAdapter; 25 | 26 | /** 27 | * Handles messages 28 | * 29 | * @author enrico.olivelli 30 | */ 31 | public class InboundMessageHandler extends ChannelInboundHandlerAdapter { 32 | 33 | NettyChannel session; 34 | 35 | public InboundMessageHandler(NettyChannel session) { 36 | this.session = session; 37 | } 38 | 39 | @Override 40 | public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { 41 | cause.printStackTrace(); 42 | ctx.close(); 43 | session.exceptionCaught(cause); 44 | } 45 | 46 | @Override 47 | public void channelUnregistered(ChannelHandlerContext ctx) throws Exception { 48 | session.channelClosed(); 49 | } 50 | 51 | @Override 52 | public void channelRead(ChannelHandlerContext ctx, Object msg) { 53 | Message message = (Message) msg; 54 | session.messageReceived(message); 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /majordodo-services/src/main/resources/bin/java-utils.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Licensed to Diennea S.r.l. under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. Diennea S.r.l. licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | 20 | if [ $# -lt 1 ]; 21 | then 22 | echo "USAGE: $0 [-daemon] SERVICETYPE [jvmargs]" 23 | exit 1 24 | fi 25 | 26 | 27 | if [ -z "$BASE_DIR" ]; 28 | then 29 | BASE_DIR="`dirname \"$0\"`" 30 | BASE_DIR="`( cd \"$BASE_DIR/..\" && pwd )`" 31 | fi 32 | 33 | cd $BASE_DIR 34 | . $BASE_DIR/bin/setenv.sh 35 | 36 | 37 | CLASSPATH= 38 | 39 | for file in $BASE_DIR/lib/*.jar; 40 | do 41 | CLASSPATH=$CLASSPATH:$file 42 | done 43 | 44 | for file in $BASE_DIR/extra/*.jar; 45 | do 46 | CLASSPATH=$CLASSPATH:$file 47 | done 48 | 49 | 50 | if [ -z "$JAVA_OPTS" ]; then 51 | JAVA_OPTS="" 52 | fi 53 | 54 | JAVA="$JAVA_HOME/bin/java" 55 | 56 | while [ $# -gt 0 ]; do 57 | COMMAND=$1 58 | case $COMMAND in 59 | -daemon) 60 | DAEMON_MODE="true" 61 | shift 62 | ;; 63 | *) 64 | break 65 | ;; 66 | esac 67 | done 68 | 69 | SERVICE=$1 70 | shift 71 | 72 | if [ "x$DAEMON_MODE" = "xtrue" ]; then 73 | CONSOLE_OUTPUT_FILE=$SERVICE.service.log 74 | nohup $JAVA -cp $CLASSPATH $JAVA_OPTS "$@" > "$CONSOLE_OUTPUT_FILE" 2>&1 < /dev/null & 75 | RETVAL=$? 76 | else 77 | exec $JAVA -cp $CLASSPATH $JAVA_OPTS "$@" 78 | RETVAL=$? 79 | fi 80 | -------------------------------------------------------------------------------- /majordodo-core/src/main/java/majordodo/replication/LedgerMetadataUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.replication; 21 | 22 | import com.google.common.collect.ImmutableMap; 23 | import java.nio.charset.StandardCharsets; 24 | import java.util.Map; 25 | 26 | /** 27 | * 28 | * @author dennis.mercuriali 29 | */ 30 | public class LedgerMetadataUtils { 31 | 32 | private static final String APPLICATION_METADATA = "application"; 33 | private static final byte[] APPLICATION_METADATA_VALUE = "majordodo".getBytes(StandardCharsets.UTF_8); 34 | 35 | private static final String COMPONENT_METADATA = "component"; 36 | private static final byte[] COMPONENT_METADATA_VALUE = "broker".getBytes(StandardCharsets.UTF_8); 37 | 38 | private static final String CREATED_BY_METADATA = "broker-id"; 39 | 40 | public static Map buildBrokerLedgerMetadata(String brokerId) { 41 | String createdByValue = brokerId == null ? "" : brokerId; 42 | 43 | return ImmutableMap.of( 44 | APPLICATION_METADATA, APPLICATION_METADATA_VALUE, 45 | COMPONENT_METADATA, COMPONENT_METADATA_VALUE, 46 | CREATED_BY_METADATA, createdByValue.getBytes(StandardCharsets.UTF_8) 47 | ); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # [Majordodo](http://majordodo.org/) 2 | 3 | Majordodo is a Distributed Resource Manager, essentially consisting of brokers which coordinate a pool of workers. Users (clients) submit tasks to be executed using a simple HTTP JSON based API 4 | 5 | There is no single point of failure, brokers replicate state using Apache BookKeeper. Workers are handled in a very elastic way: you can add and remove workers at runtime, they can crash at any time and the system will continue to be available. You can also add workers to distinct groups to handle different type of works or priorities. 6 | 7 | The basic concept of Majordodo is the Task. A Task is an operation which is to be executed by the system. Once a client submits an execution request to Majordodo, a broker will gather the requested resources in the cluster and schedule the effective execution to a worker. The task status is tracked by the broker and if the worker crashes the execution is transparently routed to another worker. The priorities of the single tasks can be modified at runtime. 8 | 9 | You can also assign a task to a slot. A Slot is like a task with a shared lock: when a client submit a task and request it to be assigned to a defined slot then the system will accept the request only if there isn't another tasks in waiting or running status for that slot. This can be usefull to implement simple distributed locks without the need of expensive distributed lock algorithms. 10 | 11 | In the first release tasks are executed by Java-based workers: the implementation of the actual work is to be coded using Java or any other language which can be run on a JVM (such as Scala, Groovy, JRuby, ...). 12 | 13 | Client API supports transactions, batching of requests and http keep-alive connections in order to reduce all the network related overheadd 14 | 15 | ## Getting Involved 16 | 17 | See our [docs](https://majordodo.readme.io) 18 | 19 | Join the [mailing list](http://lists.majordodo.org/mailman/listinfo) 20 | 21 | ## License 22 | 23 | Majordodo is under [Apache 2 license](http://www.apache.org/licenses/LICENSE-2.0.html). 24 | -------------------------------------------------------------------------------- /majordodo-core/src/main/java/majordodo/worker/JVMWorkersRegistry.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.worker; 21 | 22 | import java.util.concurrent.ConcurrentHashMap; 23 | 24 | import org.slf4j.Logger; 25 | import org.slf4j.LoggerFactory; 26 | 27 | /** 28 | * JVM classloader based registry for Workers 29 | * 30 | * @author enrico.olivelli 31 | */ 32 | public class JVMWorkersRegistry { 33 | 34 | private static final ConcurrentHashMap workers = new ConcurrentHashMap<>(); 35 | private static final Logger LOGGER = LoggerFactory.getLogger(JVMWorkersRegistry.class); 36 | private static String lastRegisteredWorker = ""; 37 | 38 | public static void registerWorker(String id, WorkerCore worker) { 39 | workers.put(id, worker); 40 | lastRegisteredWorker = id; 41 | } 42 | 43 | public static T lookupBroker(String id) { 44 | return (T) workers.get(id); 45 | } 46 | 47 | public static T getLocalWorker() { 48 | return (T) workers.get(lastRegisteredWorker); 49 | } 50 | 51 | public static void clear() { 52 | workers.clear(); 53 | } 54 | 55 | public static void unregisterWorker(String brokerId) { 56 | workers.remove(brokerId); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /majordodo-core/src/test/java/majordodo/task/RemoteWorkerSslTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.task; 21 | 22 | import majordodo.network.BrokerLocator; 23 | import majordodo.network.jvm.JVMBrokerLocator; 24 | import majordodo.network.netty.NettyBrokerLocator; 25 | import majordodo.network.netty.NettyChannelAcceptor; 26 | import org.junit.After; 27 | import org.junit.Before; 28 | 29 | /** 30 | * simple tests using real network connector 31 | * 32 | * @author enrico.olivelli 33 | */ 34 | public class RemoteWorkerSslTest extends SimpleBrokerSuite { 35 | 36 | NettyChannelAcceptor server; 37 | 38 | @Override 39 | protected BrokerLocator createBrokerLocator() { 40 | NettyBrokerLocator nb = new NettyBrokerLocator(server.getHost(), server.getPort(), true); 41 | nb.setSslUnsecure(true); 42 | return nb; 43 | } 44 | 45 | @Before 46 | public void startServer() throws Exception { 47 | server = new NettyChannelAcceptor(broker.getAcceptor()); 48 | server.setSsl(true); 49 | server.start(); 50 | } 51 | 52 | @After 53 | public void stopServer() throws Exception { 54 | if (server != null) { 55 | server.close(); 56 | } 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /majordodo-net/src/main/java/majordodo/network/ConnectionRequestInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.network; 21 | 22 | import java.util.List; 23 | import java.util.Map; 24 | import java.util.Set; 25 | 26 | /** 27 | * Information for the current worker process 28 | * 29 | * @author enrico.olivelli 30 | */ 31 | public interface ConnectionRequestInfo { 32 | 33 | /** 34 | * Connection will be used by a worker 35 | */ 36 | public static final String CLIENT_TYPE_WORKER = "worker"; 37 | 38 | /** 39 | * Connection will be used by a broker 40 | */ 41 | public static final String CLIENT_TYPE_BROKER = "broker"; 42 | 43 | Set getRunningTaskIds(); 44 | 45 | String getWorkerId(); 46 | 47 | String getProcessId(); 48 | 49 | String getLocation(); 50 | 51 | String getSharedSecret(); 52 | 53 | public int getMaxThreads(); 54 | 55 | public Map getMaxThreadsByTaskType(); 56 | 57 | public List getGroups(); 58 | 59 | public Set getExcludedGroups(); 60 | 61 | public Map getResourceLimits(); 62 | 63 | public String getClientType(); 64 | 65 | public int getMaxThreadPerUserPerTaskTypePercent(); 66 | } 67 | -------------------------------------------------------------------------------- /majordodo-core/src/main/java/majordodo/clientfacade/AddTaskRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.clientfacade; 21 | 22 | /** 23 | * Task submission 24 | * 25 | * @author enrico.olivelli 26 | */ 27 | public class AddTaskRequest { 28 | 29 | public final long transaction; 30 | public final String taskType; 31 | public final String userId; 32 | public final String data; 33 | public final int maxattempts; 34 | public final int attempt; 35 | public final long requestedStartTime; 36 | public final long deadline; 37 | public final String slot; 38 | public final String codepool; 39 | public final String mode; 40 | 41 | public AddTaskRequest(long transaction, String taskType, String userId, String parameter, int maxattemps, long requestedStartTime, long deadline, String slot, int attempts, String codepool, String mode) { 42 | this.transaction = transaction; 43 | this.attempt = attempts; 44 | this.taskType = taskType; 45 | this.userId = userId; 46 | this.data = parameter; 47 | this.maxattempts = maxattemps; 48 | this.requestedStartTime = requestedStartTime; 49 | this.deadline = deadline; 50 | this.slot = slot; 51 | this.codepool=codepool; 52 | this.mode=mode; 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /majordodo-core/src/main/java/majordodo/task/TaskQueue.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.task; 21 | 22 | import java.util.ArrayDeque; 23 | import java.util.Queue; 24 | 25 | /** 26 | * A queue of tasks 27 | * 28 | * @author enrico.olivelli 29 | */ 30 | public class TaskQueue { 31 | 32 | public static final String DEFAULT_TAG = "default"; 33 | 34 | private final Queue tasks = new ArrayDeque<>(); 35 | private final String tag; 36 | private final String name; 37 | 38 | @Override 39 | public String toString() { 40 | return "TaskQueue{" + "tag=" + tag + ", name=" + name + '}'; 41 | } 42 | 43 | public TaskQueue(String tag, String name) { 44 | this.tag = tag; 45 | this.name = name; 46 | } 47 | 48 | public String getTag() { 49 | return tag; 50 | } 51 | 52 | void addNewTask(Task task) { 53 | tasks.add(task); 54 | } 55 | 56 | public Task peekNext() { 57 | return tasks.peek(); 58 | } 59 | 60 | public Task removeNext(long expectedTaskId) { 61 | Task t = tasks.poll(); 62 | if (t == null || t.getTaskId() != expectedTaskId) { 63 | throw new RuntimeException(); 64 | } 65 | return t; 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /majordodo-core/src/main/java/majordodo/worker/WorkerStatusView.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.worker; 21 | 22 | /** 23 | * View of the actual status of the worker 24 | * 25 | * @author enrico.olivelli 26 | */ 27 | public class WorkerStatusView { 28 | 29 | private int runningTasks; 30 | private int finishedTasksPendingNotification; 31 | private String status; 32 | private String connectionInfo; 33 | 34 | public int getRunningTasks() { 35 | return runningTasks; 36 | } 37 | 38 | public void setRunningTasks(int runningTasks) { 39 | this.runningTasks = runningTasks; 40 | } 41 | 42 | public int getFinishedTasksPendingNotification() { 43 | return finishedTasksPendingNotification; 44 | } 45 | 46 | public void setFinishedTasksPendingNotification(int finishedTasksPendingNotification) { 47 | this.finishedTasksPendingNotification = finishedTasksPendingNotification; 48 | } 49 | 50 | public String getStatus() { 51 | return status; 52 | } 53 | 54 | public void setStatus(String status) { 55 | this.status = status; 56 | } 57 | 58 | public String getConnectionInfo() { 59 | return connectionInfo; 60 | } 61 | 62 | public void setConnectionInfo(String connectionInfo) { 63 | this.connectionInfo = connectionInfo; 64 | } 65 | 66 | 67 | 68 | } 69 | -------------------------------------------------------------------------------- /majordodo-net/src/main/java/majordodo/network/jvm/JVMBrokersRegistry.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.network.jvm; 21 | 22 | import java.util.concurrent.ConcurrentHashMap; 23 | 24 | import org.slf4j.Logger; 25 | import org.slf4j.LoggerFactory; 26 | 27 | /** 28 | * JVM classloader based registry for Brokers 29 | * 30 | * @author enrico.olivelli 31 | */ 32 | public class JVMBrokersRegistry { 33 | 34 | private static final ConcurrentHashMap brokers = new ConcurrentHashMap<>(); 35 | private static final Logger LOGGER = LoggerFactory.getLogger(JVMBrokersRegistry.class); 36 | private static String lastRegisteredBroker = ""; 37 | 38 | public static void registerBroker(String id, JVMBrokerSupportInterface broker) { 39 | LOGGER.debug("registerBroker {}", id); 40 | brokers.put(id, broker); 41 | lastRegisteredBroker = id; 42 | } 43 | 44 | public static T lookupBroker(String id) { 45 | return (T) brokers.get(id); 46 | } 47 | 48 | public static T getDefaultBroker() { 49 | return (T) brokers.get(lastRegisteredBroker); 50 | } 51 | 52 | public static void clear() { 53 | brokers.clear(); 54 | } 55 | 56 | public static void unregisterBroker(String brokerId) { 57 | brokers.remove(brokerId); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /majordodo-net/src/main/java/majordodo/network/netty/NetworkUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.network.netty; 21 | 22 | import io.netty.handler.ssl.OpenSsl; 23 | 24 | import org.slf4j.Logger; 25 | import org.slf4j.LoggerFactory; 26 | 27 | public class NetworkUtils { 28 | 29 | private static final boolean ENABLE_EPOLL_NATIVE = System.getProperty("os.name").equalsIgnoreCase("linux") 30 | && !Boolean.getBoolean("majordodo.network.disablenativeepoll"); 31 | 32 | private static final boolean ENABLE_OPENSSL 33 | = !Boolean.getBoolean("majordodo.network.disableopenssl"); 34 | 35 | public static boolean isEnableEpollNative() { 36 | return ENABLE_EPOLL_NATIVE; 37 | } 38 | 39 | private static Boolean openSslAvailable; 40 | private static final Logger LOG = LoggerFactory.getLogger(NetworkUtils.class); 41 | 42 | public static boolean isOpenSslAvailable() { 43 | if (openSslAvailable != null) { 44 | return openSslAvailable; 45 | } 46 | if (ENABLE_OPENSSL && OpenSsl.isAvailable()) { 47 | OpenSsl.ensureAvailability(); 48 | openSslAvailable = true; 49 | } else { 50 | Throwable cause = OpenSsl.unavailabilityCause(); 51 | LOG.info("Native OpenSSL support is not available on this platform: {}", cause); 52 | openSslAvailable = false; 53 | } 54 | return openSslAvailable; 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /majordodo-core/src/main/java/majordodo/utils/DiscardingBoundedPriorityQueue.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.utils; 21 | 22 | import java.util.PriorityQueue; 23 | 24 | /** 25 | * Priority queue bonded. 26 | * 27 | * This queue will not grow more than configured max size: if added more than 28 | * max size elements only bigger ones will be retained, other data will 29 | * be discarded silently. 30 | * 31 | * @author diego.salvi 32 | */ 33 | public final class DiscardingBoundedPriorityQueue> extends PriorityQueue 34 | { 35 | 36 | /** Default Serial Version UID */ 37 | private static final long serialVersionUID = 1L; 38 | 39 | /** Bounding size */ 40 | private final int maxSize; 41 | 42 | /** 43 | * Create a new {@link DiscardingBoundedPriorityQueue}. 44 | * 45 | * @param size maximum queue size 46 | */ 47 | public DiscardingBoundedPriorityQueue(int size) 48 | { 49 | super(size); 50 | 51 | this.maxSize = size; 52 | } 53 | 54 | /** 55 | * {@inheritDoc} 56 | *

57 | * Will discard smalled elements if needed (invoked from 58 | * {@link #add(Object)} too). 59 | *

60 | */ 61 | @Override 62 | public boolean offer(E e) 63 | { 64 | 65 | if ( this.size() < maxSize ) 66 | return super.offer(e); 67 | 68 | if ( e.compareTo(this.peek()) > 0 ) 69 | { 70 | this.remove(); 71 | 72 | return super.offer(e); 73 | } 74 | 75 | return false; 76 | 77 | } 78 | 79 | } -------------------------------------------------------------------------------- /majordodo-web-ui/src/main/webapp/angular/angular-cookies.min.js.map: -------------------------------------------------------------------------------- 1 | { 2 | "version":3, 3 | "file":"angular-cookies.min.js", 4 | "lineCount":7, 5 | "mappings":"A;;;;;aAKC,SAAQ,CAACA,CAAD,CAASC,CAAT,CAAkBC,CAAlB,CAA6B,CAmBtCD,CAAAE,OAAA,CAAe,WAAf,CAA4B,CAAC,IAAD,CAA5B,CAAAC,QAAA,CAyBW,UAzBX,CAyBuB,CAAC,YAAD,CAAe,UAAf,CAA2B,QAAS,CAACC,CAAD,CAAaC,CAAb,CAAuB,CAAA,IACxEC,EAAU,EAD8D,CAExEC,EAAc,EAF0D,CAGxEC,CAHwE,CAIxEC,EAAU,CAAA,CAJ8D,CAKxEC,EAAOV,CAAAU,KALiE,CAMxEC,EAAcX,CAAAW,YAGlBN,EAAAO,UAAA,CAAmB,QAAQ,EAAG,CAC5B,IAAIC,EAAiBR,CAAAC,QAAA,EACjBE,EAAJ,EAA0BK,CAA1B,GACEL,CAGA,CAHqBK,CAGrB,CAFAH,CAAA,CAAKG,CAAL,CAAqBN,CAArB,CAEA,CADAG,CAAA,CAAKG,CAAL,CAAqBP,CAArB,CACA,CAAIG,CAAJ,EAAaL,CAAAU,OAAA,EAJf,CAF4B,CAA9B,CAAA,EAUAL,EAAA,CAAU,CAAA,CAKVL,EAAAW,OAAA,CASAC,QAAa,EAAG,CAAA,IACVC,CADU,CAEVC,CAFU,CAIVC,CAGJ,KAAKF,CAAL,GAAaV,EAAb,CACMI,CAAA,CAAYL,CAAA,CAAQW,CAAR,CAAZ,CAAJ,EACEZ,CAAAC,QAAA,CAAiBW,CAAjB,CAAuBhB,CAAvB,CAKJ,KAAIgB,CAAJ,GAAYX,EAAZ,CACEY,CAKA,CALQZ,CAAA,CAAQW,CAAR,CAKR,CAJKjB,CAAAoB,SAAA,CAAiBF,CAAjB,CAIL,GAHEA,CACA,CADQ,EACR,CADaA,CACb,CAAAZ,CAAA,CAAQW,CAAR,CAAA,CAAgBC,CAElB,EAAIA,CAAJ,GAAcX,CAAA,CAAYU,CAAZ,CAAd,GACEZ,CAAAC,QAAA,CAAiBW,CAAjB,CAAuBC,CAAvB,CACA,CAAAC,CAAA,CAAU,CAAA,CAFZ,CAOF,IAAIA,CAAJ,CAIE,IAAKF,CAAL,GAFAI,EAEaf,CAFID,CAAAC,QAAA,EAEJA,CAAAA,CAAb,CACMA,CAAA,CAAQW,CAAR,CAAJ,GAAsBI,CAAA,CAAeJ,CAAf,CAAtB,GAEMN,CAAA,CAAYU,CAAA,CAAeJ,CAAf,CAAZ,CAAJ,CACE,OAAOX,CAAA,CAAQW,CAAR,CADT,CAGEX,CAAA,CAAQW,CAAR,CAHF,CAGkBI,CAAA,CAAeJ,CAAf,CALpB,CAhCU,CAThB,CAEA,OAAOX,EA1BqE,CAA3D,CAzBvB,CAAAH,QAAA,CAkIW,cAlIX;AAkI2B,CAAC,UAAD,CAAa,QAAQ,CAACmB,CAAD,CAAW,CAErD,MAAO,KAWAC,QAAQ,CAACC,CAAD,CAAM,CAEjB,MAAO,CADHN,CACG,CADKI,CAAA,CAASE,CAAT,CACL,EAAQxB,CAAAyB,SAAA,CAAiBP,CAAjB,CAAR,CAAkCA,CAFxB,CAXd,KA0BAQ,QAAQ,CAACF,CAAD,CAAMN,CAAN,CAAa,CACxBI,CAAA,CAASE,CAAT,CAAA,CAAgBxB,CAAA2B,OAAA,CAAeT,CAAf,CADQ,CA1BrB,QAuCGU,QAAQ,CAACJ,CAAD,CAAM,CACpB,OAAOF,CAAA,CAASE,CAAT,CADa,CAvCjB,CAF8C,CAAhC,CAlI3B,CAnBsC,CAArC,CAAA,CAsMEzB,MAtMF,CAsMUA,MAAAC,QAtMV;", 6 | "sources":["angular-cookies.js"], 7 | "names":["window","angular","undefined","module","factory","$rootScope","$browser","cookies","lastCookies","lastBrowserCookies","runEval","copy","isUndefined","addPollFn","currentCookies","$apply","$watch","push","name","value","updated","isString","browserCookies","$cookies","get","key","fromJson","put","toJson","remove"] 8 | } 9 | -------------------------------------------------------------------------------- /majordodo-worker/src/main/java/majordodo/executors/TaskExecutor.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.executors; 21 | 22 | import java.util.Map; 23 | 24 | /** 25 | * Implementation of the execution of a task 26 | * 27 | * @author enrico.olivelli 28 | */ 29 | public class TaskExecutor { 30 | 31 | public static final String PARAMETER_CODEPOOL = "codepool"; 32 | public static final String PARAMETER_MODE = "mode"; 33 | public static final String PARAMETER_TASKTYPE = "tasktype"; 34 | public static final String PARAMETER_USERID = "userid"; 35 | public static final String PARAMETER_ATTEMPT = "attempt"; 36 | public static final String PARAMETER_DATA = "parameter"; 37 | public static final String PARAMETER_TASKID = "taskid"; 38 | 39 | /** 40 | * Implement the task. Any Exception thrown but this method will be treated as "errors" and Task will be re-submitted for recovery 41 | * @param parameters 42 | * @return 43 | * @throws Exception 44 | * @see #PARAMETER_ATTEMPT 45 | * @see #PARAMETER_CODEPOOL 46 | * @see #PARAMETER_DATA 47 | * @see #PARAMETER_MODE 48 | * @see #PARAMETER_TASKID 49 | * @see #PARAMETER_TASKTYPE 50 | * @see #PARAMETER_USERID 51 | */ 52 | public String executeTask(Map parameters) throws Exception { 53 | throw new UnsupportedOperationException("task execution not implemented for this tasktype, parameters:" + parameters); 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /majordodo-web-ui/src/main/webapp/angular/i18n/angular-locale_ms-bn.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | angular.module("ngLocale", [], ["$provide", function($provide) { 3 | var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"}; 4 | $provide.value("$locale", { 5 | "DATETIME_FORMATS": { 6 | "AMPMS": [ 7 | "PG", 8 | "PTG" 9 | ], 10 | "DAY": [ 11 | "Ahad", 12 | "Isnin", 13 | "Selasa", 14 | "Rabu", 15 | "Khamis", 16 | "Jumaat", 17 | "Sabtu" 18 | ], 19 | "MONTH": [ 20 | "Januari", 21 | "Februari", 22 | "Mac", 23 | "April", 24 | "Mei", 25 | "Jun", 26 | "Julai", 27 | "Ogos", 28 | "September", 29 | "Oktober", 30 | "November", 31 | "Disember" 32 | ], 33 | "SHORTDAY": [ 34 | "Ahd", 35 | "Isn", 36 | "Sel", 37 | "Rab", 38 | "Kha", 39 | "Jum", 40 | "Sab" 41 | ], 42 | "SHORTMONTH": [ 43 | "Jan", 44 | "Feb", 45 | "Mac", 46 | "Apr", 47 | "Mei", 48 | "Jun", 49 | "Jul", 50 | "Ogos", 51 | "Sep", 52 | "Okt", 53 | "Nov", 54 | "Dis" 55 | ], 56 | "fullDate": "dd MMMM y", 57 | "longDate": "d MMMM y", 58 | "medium": "dd/MM/yyyy h:mm:ss a", 59 | "mediumDate": "dd/MM/yyyy", 60 | "mediumTime": "h:mm:ss a", 61 | "short": "d/MM/yy h:mm a", 62 | "shortDate": "d/MM/yy", 63 | "shortTime": "h:mm a" 64 | }, 65 | "NUMBER_FORMATS": { 66 | "CURRENCY_SYM": "RM", 67 | "DECIMAL_SEP": ".", 68 | "GROUP_SEP": ",", 69 | "PATTERNS": [ 70 | { 71 | "gSize": 3, 72 | "lgSize": 3, 73 | "macFrac": 0, 74 | "maxFrac": 3, 75 | "minFrac": 0, 76 | "minInt": 1, 77 | "negPre": "-", 78 | "negSuf": "", 79 | "posPre": "", 80 | "posSuf": "" 81 | }, 82 | { 83 | "gSize": 3, 84 | "lgSize": 3, 85 | "macFrac": 0, 86 | "maxFrac": 2, 87 | "minFrac": 2, 88 | "minInt": 1, 89 | "negPre": "(\u00a4", 90 | "negSuf": ")", 91 | "posPre": "\u00a4", 92 | "posSuf": "" 93 | } 94 | ] 95 | }, 96 | "id": "ms-bn", 97 | "pluralCat": function (n) { return PLURAL_CATEGORY.OTHER;} 98 | }); 99 | }]); -------------------------------------------------------------------------------- /majordodo-web-ui/src/main/webapp/angular/i18n/angular-locale_ms.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | angular.module("ngLocale", [], ["$provide", function($provide) { 3 | var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"}; 4 | $provide.value("$locale", { 5 | "DATETIME_FORMATS": { 6 | "AMPMS": [ 7 | "PG", 8 | "PTG" 9 | ], 10 | "DAY": [ 11 | "Ahad", 12 | "Isnin", 13 | "Selasa", 14 | "Rabu", 15 | "Khamis", 16 | "Jumaat", 17 | "Sabtu" 18 | ], 19 | "MONTH": [ 20 | "Januari", 21 | "Februari", 22 | "Mac", 23 | "April", 24 | "Mei", 25 | "Jun", 26 | "Julai", 27 | "Ogos", 28 | "September", 29 | "Oktober", 30 | "November", 31 | "Disember" 32 | ], 33 | "SHORTDAY": [ 34 | "Ahd", 35 | "Isn", 36 | "Sel", 37 | "Rab", 38 | "Kha", 39 | "Jum", 40 | "Sab" 41 | ], 42 | "SHORTMONTH": [ 43 | "Jan", 44 | "Feb", 45 | "Mac", 46 | "Apr", 47 | "Mei", 48 | "Jun", 49 | "Jul", 50 | "Ogos", 51 | "Sep", 52 | "Okt", 53 | "Nov", 54 | "Dis" 55 | ], 56 | "fullDate": "EEEE, d MMMM y", 57 | "longDate": "d MMMM y", 58 | "medium": "dd/MM/yyyy h:mm:ss a", 59 | "mediumDate": "dd/MM/yyyy", 60 | "mediumTime": "h:mm:ss a", 61 | "short": "d/MM/yy h:mm a", 62 | "shortDate": "d/MM/yy", 63 | "shortTime": "h:mm a" 64 | }, 65 | "NUMBER_FORMATS": { 66 | "CURRENCY_SYM": "RM", 67 | "DECIMAL_SEP": ".", 68 | "GROUP_SEP": ",", 69 | "PATTERNS": [ 70 | { 71 | "gSize": 3, 72 | "lgSize": 3, 73 | "macFrac": 0, 74 | "maxFrac": 3, 75 | "minFrac": 0, 76 | "minInt": 1, 77 | "negPre": "-", 78 | "negSuf": "", 79 | "posPre": "", 80 | "posSuf": "" 81 | }, 82 | { 83 | "gSize": 3, 84 | "lgSize": 3, 85 | "macFrac": 0, 86 | "maxFrac": 2, 87 | "minFrac": 2, 88 | "minInt": 1, 89 | "negPre": "(\u00a4", 90 | "negSuf": ")", 91 | "posPre": "\u00a4", 92 | "posSuf": "" 93 | } 94 | ] 95 | }, 96 | "id": "ms", 97 | "pluralCat": function (n) { return PLURAL_CATEGORY.OTHER;} 98 | }); 99 | }]); -------------------------------------------------------------------------------- /majordodo-core/src/main/java/majordodo/task/AssignedTask.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to Diennea S.r.l. under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. Diennea S.r.l. licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | 19 | */ 20 | package majordodo.task; 21 | 22 | /** 23 | * Information about a Task which is running (assigned) 24 | * 25 | * @author enrico.olivelli 26 | */ 27 | public final class AssignedTask { 28 | 29 | public final long taskid; 30 | public final String[] resourceIds; 31 | public final String resources; 32 | 33 | @edu.umd.cs.findbugs.annotations.SuppressWarnings(value = "EI_EXPOSE_REP2") 34 | public AssignedTask(long taskid, String[] resourceIds, String resources) { 35 | this.taskid = taskid; 36 | this.resourceIds = resourceIds; 37 | this.resources = resources; 38 | } 39 | 40 | @Override 41 | public String toString() { 42 | return "{" + "taskid=" + taskid + ", resources=" + resources + '}'; 43 | } 44 | 45 | @Override 46 | public int hashCode() { 47 | int hash = 7; 48 | hash = 31 * hash + (int) (this.taskid ^ (this.taskid >>> 32)); 49 | return hash; 50 | } 51 | 52 | @Override 53 | public boolean equals(Object obj) { 54 | if (this == obj) { 55 | return true; 56 | } 57 | if (obj == null) { 58 | return false; 59 | } 60 | if (getClass() != obj.getClass()) { 61 | return false; 62 | } 63 | final AssignedTask other = (AssignedTask) obj; 64 | if (this.taskid != other.taskid) { 65 | return false; 66 | } 67 | return true; 68 | } 69 | 70 | } 71 | --------------------------------------------------------------------------------