diff --git a/components/org.wso2.carbon.business.rules.core/pom.xml b/components/org.wso2.carbon.business.rules.core/pom.xml index d0bf09beed6..20c26cdf77d 100644 --- a/components/org.wso2.carbon.business.rules.core/pom.xml +++ b/components/org.wso2.carbon.business.rules.core/pom.xml @@ -172,6 +172,10 @@ io.github.openfeign feign-slf4j + + org.openjdk.nashorn + nashorn-core + @@ -235,8 +239,8 @@ maven-checkstyle-plugin - org.codehaus.mojo - findbugs-maven-plugin + com.github.spotbugs + spotbugs-maven-plugin diff --git a/components/org.wso2.carbon.business.rules.core/src/main/java/org/wso2/carbon/business/rules/core/util/TemplateManagerHelper.java b/components/org.wso2.carbon.business.rules.core/src/main/java/org/wso2/carbon/business/rules/core/util/TemplateManagerHelper.java index 31a3bcd6df3..9faffc9d2ae 100644 --- a/components/org.wso2.carbon.business.rules.core/src/main/java/org/wso2/carbon/business/rules/core/util/TemplateManagerHelper.java +++ b/components/org.wso2.carbon.business.rules.core/src/main/java/org/wso2/carbon/business/rules/core/util/TemplateManagerHelper.java @@ -23,6 +23,7 @@ import com.google.gson.JsonObject; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.text.StrSubstitutor; +import org.openjdk.nashorn.api.scripting.NashornScriptEngineFactory; import org.wso2.carbon.business.rules.core.bean.RuleTemplate; import org.wso2.carbon.business.rules.core.bean.RuleTemplateProperty; import org.wso2.carbon.business.rules.core.bean.Template; @@ -466,8 +467,8 @@ public static String replaceRegex(String templateString, String regexPatternStri * @throws TemplateManagerHelperException */ public static Map getScriptGeneratedVariables(String script) throws RuleTemplateScriptException { - ScriptEngineManager manager = new ScriptEngineManager(); - ScriptEngine engine = manager.getEngineByName("JavaScript"); + NashornScriptEngineFactory factory = new NashornScriptEngineFactory(); + ScriptEngine engine = factory.getScriptEngine(); ScriptContext scriptContext = new SimpleScriptContext(); scriptContext.setBindings(engine.createBindings(), ScriptContext.ENGINE_SCOPE); try { diff --git a/components/org.wso2.carbon.business.rules.web/pom.xml b/components/org.wso2.carbon.business.rules.web/pom.xml index 5e32f17cd2b..e6dae54541a 100644 --- a/components/org.wso2.carbon.business.rules.web/pom.xml +++ b/components/org.wso2.carbon.business.rules.web/pom.xml @@ -102,6 +102,10 @@ + + org.apache.maven.plugins + maven-jar-plugin + diff --git a/components/org.wso2.carbon.data.provider/pom.xml b/components/org.wso2.carbon.data.provider/pom.xml index b16c45975d3..50ecd3ad6f1 100644 --- a/components/org.wso2.carbon.data.provider/pom.xml +++ b/components/org.wso2.carbon.data.provider/pom.xml @@ -188,8 +188,8 @@ jacoco-maven-plugin - org.codehaus.mojo - findbugs-maven-plugin + com.github.spotbugs + spotbugs-maven-plugin org.apache.maven.plugins diff --git a/components/org.wso2.carbon.health.check.core/pom.xml b/components/org.wso2.carbon.health.check.core/pom.xml index fd641252000..9ac632ce8d3 100644 --- a/components/org.wso2.carbon.health.check.core/pom.xml +++ b/components/org.wso2.carbon.health.check.core/pom.xml @@ -121,8 +121,8 @@ maven-checkstyle-plugin - org.codehaus.mojo - findbugs-maven-plugin + com.github.spotbugs + spotbugs-maven-plugin diff --git a/components/org.wso2.carbon.siddhi.extensions.installer.cli/pom.xml b/components/org.wso2.carbon.siddhi.extensions.installer.cli/pom.xml index 2c118517907..76cc31834ea 100644 --- a/components/org.wso2.carbon.siddhi.extensions.installer.cli/pom.xml +++ b/components/org.wso2.carbon.siddhi.extensions.installer.cli/pom.xml @@ -60,6 +60,10 @@ org.apache.maven.plugins maven-compiler-plugin + + org.apache.maven.plugins + maven-jar-plugin + org.codehaus.mojo appassembler-maven-plugin diff --git a/components/org.wso2.carbon.siddhi.store.api.rest/pom.xml b/components/org.wso2.carbon.siddhi.store.api.rest/pom.xml index 1c15ad6adbd..a5dba131c09 100644 --- a/components/org.wso2.carbon.siddhi.store.api.rest/pom.xml +++ b/components/org.wso2.carbon.siddhi.store.api.rest/pom.xml @@ -175,8 +175,8 @@ maven-checkstyle-plugin - org.codehaus.mojo - findbugs-maven-plugin + com.github.spotbugs + spotbugs-maven-plugin diff --git a/components/org.wso2.carbon.streaming.integrator.core/src/test/java/org/wso2/carbon/streaming/integrator/core/DBPersistenceStoreTest.java b/components/org.wso2.carbon.streaming.integrator.core/src/test/java/org/wso2/carbon/streaming/integrator/core/DBPersistenceStoreTest.java index 24cf75811b5..1c4cfe41cbd 100644 --- a/components/org.wso2.carbon.streaming.integrator.core/src/test/java/org/wso2/carbon/streaming/integrator/core/DBPersistenceStoreTest.java +++ b/components/org.wso2.carbon.streaming.integrator.core/src/test/java/org/wso2/carbon/streaming/integrator/core/DBPersistenceStoreTest.java @@ -41,6 +41,7 @@ import static org.powermock.api.mockito.PowerMockito.mockStatic; import static org.powermock.api.mockito.PowerMockito.when; +@PowerMockIgnore("jdk.internal.reflect.*") @PrepareForTest(StreamProcessorDataHolder.class) public class DBPersistenceStoreTest extends PowerMockTestCase { diff --git a/components/si-distribution/pom.xml b/components/si-distribution/pom.xml index 780e61d0d26..94ad34a1c6a 100644 --- a/components/si-distribution/pom.xml +++ b/components/si-distribution/pom.xml @@ -415,6 +415,32 @@ org.wso2.carbon.maven carbon-feature-plugin ${carbon.feature.plugin.version} + + + com.sun.xml.bind + jaxb-core + ${com.sun.xml.bind.version} + jar + + + com.sun.xml.bind + jaxb-impl + ${com.sun.xml.bind.version} + jar + + + org.wso2.orbit.javax.xml.bind + jaxb-api + ${org.wso2.orbit.javax.xml.bind.version} + jar + + + com.sun.activation + javax.activation + ${com.sun.activation.javax.activation.version} + jar + + p2-repo-generation diff --git a/components/si-tooling-distribution/pom.xml b/components/si-tooling-distribution/pom.xml index b8f329caf0b..e288259d211 100644 --- a/components/si-tooling-distribution/pom.xml +++ b/components/si-tooling-distribution/pom.xml @@ -441,6 +441,32 @@ org.wso2.carbon.maven carbon-feature-plugin ${carbon.feature.plugin.version} + + + com.sun.xml.bind + jaxb-core + ${com.sun.xml.bind.version} + jar + + + com.sun.xml.bind + jaxb-impl + ${com.sun.xml.bind.version} + jar + + + org.wso2.orbit.javax.xml.bind + jaxb-api + ${org.wso2.orbit.javax.xml.bind.version} + jar + + + com.sun.activation + javax.activation + ${com.sun.activation.javax.activation.version} + jar + + p2-repo-generation diff --git a/features/org.wso2.carbon.business.rules.core.feature/src/main/resources/p2.inf b/features/org.wso2.carbon.business.rules.core.feature/src/main/resources/p2.inf index 868e74b74d4..79e20b6dc93 100644 --- a/features/org.wso2.carbon.business.rules.core.feature/src/main/resources/p2.inf +++ b/features/org.wso2.carbon.business.rules.core.feature/src/main/resources/p2.inf @@ -2,4 +2,3 @@ instructions.configure = \ org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/resources/);\ org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/resources/businessRules/);\ org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/resources/businessRules/templates/);\ -org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../lib/features/org.wso2.carbon.business.rules.core_${feature.version}/templates/,target:${installFolder}/resources/businessRules/templates/,overwrite:true);\ \ No newline at end of file diff --git a/features/org.wso2.carbon.business.rules.core.feature/src/main/resources/templates/stock-exchange.json b/features/org.wso2.carbon.business.rules.core.feature/src/main/resources/templates/stock-exchange.json deleted file mode 100644 index 3fefa37151d..00000000000 --- a/features/org.wso2.carbon.business.rules.core.feature/src/main/resources/templates/stock-exchange.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "templateGroup": { - "uuid": "stock-exchange", - "name": "Stock Exchange", - "description": "Domain for stock exchange analytics", - "ruleTemplates": [ - { - "uuid": "stock-exchange-input", - "name": "Stock Exchange Input", - "description": "configured http source to receive stock exchange updates", - "type": "input", - "instanceCount": "many", - "script": "", - "templates": [ - { - "type": "siddhiApp", - "content": "@App:name('appName1')\n@Source(type = 'http', receiver.url='${receiverUrl}', basic.auth.enabled='false',\n@map(type='text'))\ndefine stream StockInputStream(symbol string, price float, volume long, name string);", - "exposedStreamDefinition": "define stream StockInputStream(symbol string, price float, volume long, name string);" - } - ], - "properties": { - "receiverUrl": { - "fieldName": "Receiver URL", - "description": "Enter the URL of the http receiver for text messages. One URL can only be used once", - "defaultValue": "https://localhost:8005/stockInputStream" - } - } - }, - { - "uuid": "stock-exchange-output", - "name": "Stock Exchange Output", - "description": "configured output to log the filtered stock exchange data", - "type": "output", - "instanceCount": "many", - "script": "", - "templates": [ - { - "type": "siddhiApp", - "content": "@App:name('appName2')\n\ndefine stream StockOutputStream(companyName string, companySymbol string, sellingPrice float);\n\nfrom StockOutputStream#log('${logMessage} :')\ninsert into outputStream;", - "exposedStreamDefinition": "define stream StockOutputStream(companyName string, companySymbol string, sellingPrice float);" - } - ], - "properties": { - "logMessage": { - "fieldName": "Logging Message", - "description": "Enter the message, that should be displayed while logging", - "defaultValue": "Filtered Stock data" - } - } - } - ] - } -} \ No newline at end of file diff --git a/features/org.wso2.carbon.business.rules.core.feature/src/main/resources/templates/sweet-factory .json b/features/org.wso2.carbon.business.rules.core.feature/src/main/resources/templates/sweet-factory .json deleted file mode 100644 index 7ac8df3de12..00000000000 --- a/features/org.wso2.carbon.business.rules.core.feature/src/main/resources/templates/sweet-factory .json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "templateGroup": { - "uuid": "3432442", - "name": "Sweet Factory", - "description": "Configure Sweet Factory Rules", - "ruleTemplates": [ - { - "uuid": "identifying-continuous-production-decrease", - "name": "Identify Continuous Production Decrease", - "description": "Alert factory managers if rate of production continuously decreases for `X` time period", - "type": "template", - "instanceCount": "many", - "script": "var timeRange = validateTimeRange(${timeRangeInput});\nvar username = getUsername('${email}');\n\n// Validates the input provided for time range\nfunction validateTimeRange(number) {\n\tif (!isNaN(number) && (number > 0)) {\n\t\treturn number;\n\t} else {\n\t\tthrow 'A positive number expected for time range';\n\t}\n}\n\n// Gets the username from provided email\nfunction getUsername(email) {\n\tif (email.match(/\\S+@\\S+/g)) {\n\t\tif (email.match(/\\S+@\\S+/g)[0] === email) {\n\t\t\treturn email.split('@')[0];\n\t\t}\n\t\tthrow 'Invalid email address provided';\n\t}\n\tthrow 'Invalid email address provided';\n}", - "templates": [ - { - "type": "siddhiApp", - "content": "@App:name('SweetFactory-TrendAnalysis')\n\n@source(type='http', @map(type='json'))\ndefine stream SweetProductionStream (name string, amount double, factoryId int);\n\n@sink(type='log', @map(type='text', @payload(\"\"\"\nHi ${username},\nProduction at Factory {{factoryId}} has gone\nfrom {{initalamout}} to {{finalAmount}} in ${timeInterval} seconds!\"\"\")))\ndefine stream ContinousProdReductionStream (factoryId int, initaltime long, finalTime long, initalamout double, finalAmount double);\n\nfrom SweetProductionStream#window.timeBatch(${timeInterval} sec)\nselect factoryId, sum(amount) as amount, currentTimeMillis() as ts\ninsert into ProdRateStream;\n\npartition with ( factoryId of ProdRateStream )\nbegin\n from every e1=ProdRateStream,\n e2=ProdRateStream[ts - e1.ts <= ${timeRange} and e1.amount > amount ]*,\n e3=ProdRateStream[ts - e1.ts >= ${timeRange} and e1.amount > amount ]\n select e1.factoryId, e1.ts as initaltime, e3.ts as finalTime, e1.amount as initalamout, e3.amount as finalAmount\n insert into ContinousProdReductionStream;\nend;" - } - ], - "properties": { - "timeInterval": { - "fieldName": "Time Interval (in seconds)", - "description": "Production amounts are considered per time interval", - "defaultValue": "6" - }, - "timeRangeInput": { - "fieldName": "Time Range (in milliseconds)", - "description": "Time period in which, product amounts are analyzed for decrease", - "defaultValue": "5" - }, - "email": { - "fieldName": "Manager Email ID", - "description": "Email address to show in greeting", - "defaultValue": "example@email.com" - } - } - } - ] - } -} \ No newline at end of file diff --git a/findbugs-exclude.xml b/findbugs-exclude.xml index 7dc401e2daa..c9ddcc2f82f 100644 --- a/findbugs-exclude.xml +++ b/findbugs-exclude.xml @@ -85,6 +85,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pom.xml b/pom.xml index af90add3809..c8fcbb362d8 100644 --- a/pom.xml +++ b/pom.xml @@ -20,7 +20,7 @@ org.wso2 wso2 - 5.1 + 5.3 4.0.0 @@ -100,14 +100,14 @@ ${maven.src.version} - org.codehaus.mojo - findbugs-maven-plugin + com.github.spotbugs + spotbugs-maven-plugin Max Low true - ${project.build.directory}/findbugs - + ${project.build.directory}/findbugs + ${maven.findbugsplugin.version.exclude} @@ -190,9 +190,9 @@ - org.codehaus.mojo - findbugs-maven-plugin - ${maven.findbugsplugin.version} + com.github.spotbugs + spotbugs-maven-plugin + ${maven.spotbugsplugin.version} Max Medium @@ -1623,6 +1623,11 @@ log4j-core ${log4j.version} + + org.openjdk.nashorn + nashorn-core + ${openjdk.nashorn.version} + @@ -1699,9 +1704,7 @@ 1.9.1 1.5.4 - - - 3.1.3 + 3.1.5 6.9.4 4.7.2 @@ -1902,5 +1905,7 @@ 2.12.2 3.1.10 + 15.2 + 3.2.2