[JBoss JIRA] (RTGOV-644) Enable MVELExpressionEvaluator to evaluate more complex scripts (with Variables)
by Gary Brown (JIRA)
[ https://issues.jboss.org/browse/RTGOV-644?page=com.atlassian.jira.plugin.... ]
Gary Brown updated RTGOV-644:
-----------------------------
Git Pull Request: https://github.com/Governance/rtgov/pull/273
> Enable MVELExpressionEvaluator to evaluate more complex scripts (with Variables)
> --------------------------------------------------------------------------------
>
> Key: RTGOV-644
> URL: https://issues.jboss.org/browse/RTGOV-644
> Project: RTGov (Run Time Governance)
> Issue Type: Feature Request
> Components: Information Processor
> Affects Versions: 1.0.0.M1
> Reporter: ivan mckinley
> Assignee: Gary Brown
> Fix For: 2.1.0.Beta2
>
>
> if a user wishes to execute more complex mvel scripts with variables during information processing then MVEL fails with exception, {1}.
> The following test case,2, demonstrates this behaviour in action.
> Recommendation is to update line 44
> https://github.com/Governance/rtgov/blob/master/modules/activity-manageme...
> Object result=MVEL.executeExpression(_compiledExpression, information, new HashMap());
> {1}Exception
> activity event: org.mvel2.ScriptRuntimeException: cannot assign variables; no variable resolver factory available.
> at org.mvel2.integration.impl.ImmutableDefaultFactory.throwError(ImmutableDefaultFactory.java:32)
> at org.mvel2.integration.impl.ImmutableDefaultFactory.createVariable(ImmutableDefaultFactory.java:36)
> at org.mvel2.integration.impl.ClassImportResolverFactory.createVariable(ClassImportResolverFactory.java:61)
> at org.mvel2.ast.TypedVarNode.getReducedValueAccelerated(TypedVarNode.java:70)
> at org.mvel2.MVELRuntime.execute(MVELRuntime.java:86)
> at org.mvel2.compiler.CompiledExpression.getDirectValue(CompiledExpression.java:123)
> at org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:119)
> at org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:113)
> at org.mvel2.MVEL.executeExpression(MVEL.java:954)
> at org.overlord.rtgov.activity.processor.mvel.MVELExpressionEvaluator.evaluate(MVELExpressionEvaluator.java:44)
> at org.overlord.rtgov.activity.processor.TypeProcessor$PropertyEvaluator.process(TypeProcessor.java:310)
> at org.overlord.rtgov.activity.processor.TypeProcessor.process(TypeProcessor.java:166)
> at org.overlord.rtgov.activity.processor.InformationProcessor.process(InformationProcessor.java:137)
> at org.overlord.rtgov.activity.processor.AbstractInformationProcessorManager.process(AbstractInformationProcessorManager.ja
> {2} Test Case
> @Test
> public void testTransformDOM2() {
> org.w3c.dom.Document doc=null;
> try {
> doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
> org.w3c.dom.Element elem=doc.createElement("test");
> doc.appendChild(elem);
> elem.appendChild(doc.createTextNode("This is a test"));
> } catch (Exception e) {
> fail("Failed to build DOM: "+e);
> }
> String expression = "import javax.xml.transform.TransformerFactory; import javax.xml.transform.Transformer; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import java.io.ByteArrayOutputStream; ByteArrayOutputStream out = new ByteArrayOutputStream(); DOMSource source = new DOMSource(this); StreamResult result = new StreamResult(out); TransformerFactory transFactory = TransformerFactory.newInstance(); Transformer transformer = transFactory.newTransformer(); transformer.transform(source, result); out.close(); return new String(out.toByteArray());";
> Object _compiledExpression=null;
> _compiledExpression = MVEL.compileExpression(expression);
> Object result=MVEL.executeExpression(_compiledExpression, doc);
> if (result == null) {
> fail("Failed to parse");
> }
> System.out.println(result);
--
This message was sent by Atlassian JIRA
(v6.3.11#6341)
9 years, 10 months
[JBoss JIRA] (RTGOV-644) Enable MVELExpressionEvaluator to evaluate more complex scripts (with Variables)
by Gary Brown (JIRA)
[ https://issues.jboss.org/browse/RTGOV-644?page=com.atlassian.jira.plugin.... ]
Gary Brown resolved RTGOV-644.
------------------------------
Fix Version/s: 2.1.0.Beta2
Resolution: Done
Thanks Ivan for the fix.
> Enable MVELExpressionEvaluator to evaluate more complex scripts (with Variables)
> --------------------------------------------------------------------------------
>
> Key: RTGOV-644
> URL: https://issues.jboss.org/browse/RTGOV-644
> Project: RTGov (Run Time Governance)
> Issue Type: Feature Request
> Components: Information Processor
> Affects Versions: 1.0.0.M1
> Reporter: ivan mckinley
> Assignee: Gary Brown
> Fix For: 2.1.0.Beta2
>
>
> if a user wishes to execute more complex mvel scripts with variables during information processing then MVEL fails with exception, {1}.
> The following test case,2, demonstrates this behaviour in action.
> Recommendation is to update line 44
> https://github.com/Governance/rtgov/blob/master/modules/activity-manageme...
> Object result=MVEL.executeExpression(_compiledExpression, information, new HashMap());
> {1}Exception
> activity event: org.mvel2.ScriptRuntimeException: cannot assign variables; no variable resolver factory available.
> at org.mvel2.integration.impl.ImmutableDefaultFactory.throwError(ImmutableDefaultFactory.java:32)
> at org.mvel2.integration.impl.ImmutableDefaultFactory.createVariable(ImmutableDefaultFactory.java:36)
> at org.mvel2.integration.impl.ClassImportResolverFactory.createVariable(ClassImportResolverFactory.java:61)
> at org.mvel2.ast.TypedVarNode.getReducedValueAccelerated(TypedVarNode.java:70)
> at org.mvel2.MVELRuntime.execute(MVELRuntime.java:86)
> at org.mvel2.compiler.CompiledExpression.getDirectValue(CompiledExpression.java:123)
> at org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:119)
> at org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:113)
> at org.mvel2.MVEL.executeExpression(MVEL.java:954)
> at org.overlord.rtgov.activity.processor.mvel.MVELExpressionEvaluator.evaluate(MVELExpressionEvaluator.java:44)
> at org.overlord.rtgov.activity.processor.TypeProcessor$PropertyEvaluator.process(TypeProcessor.java:310)
> at org.overlord.rtgov.activity.processor.TypeProcessor.process(TypeProcessor.java:166)
> at org.overlord.rtgov.activity.processor.InformationProcessor.process(InformationProcessor.java:137)
> at org.overlord.rtgov.activity.processor.AbstractInformationProcessorManager.process(AbstractInformationProcessorManager.ja
> {2} Test Case
> @Test
> public void testTransformDOM2() {
> org.w3c.dom.Document doc=null;
> try {
> doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
> org.w3c.dom.Element elem=doc.createElement("test");
> doc.appendChild(elem);
> elem.appendChild(doc.createTextNode("This is a test"));
> } catch (Exception e) {
> fail("Failed to build DOM: "+e);
> }
> String expression = "import javax.xml.transform.TransformerFactory; import javax.xml.transform.Transformer; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import java.io.ByteArrayOutputStream; ByteArrayOutputStream out = new ByteArrayOutputStream(); DOMSource source = new DOMSource(this); StreamResult result = new StreamResult(out); TransformerFactory transFactory = TransformerFactory.newInstance(); Transformer transformer = transFactory.newTransformer(); transformer.transform(source, result); out.close(); return new String(out.toByteArray());";
> Object _compiledExpression=null;
> _compiledExpression = MVEL.compileExpression(expression);
> Object result=MVEL.executeExpression(_compiledExpression, doc);
> if (result == null) {
> fail("Failed to parse");
> }
> System.out.println(result);
--
This message was sent by Atlassian JIRA
(v6.3.11#6341)
9 years, 10 months
[JBoss JIRA] (ARTIF-655) Allow users to provide their own query indexes
by Brett Meyer (JIRA)
[ https://issues.jboss.org/browse/ARTIF-655?page=com.atlassian.jira.plugin.... ]
Brett Meyer updated ARTIF-655:
------------------------------
Description:
Through ModeShape's Workspace#getIndexManager(), allow users to provide their own query indexes during startup/runtime. If they know specific queries they may frequently run, this could be a helpful optimization.
In addition, attempt to automatically create indexes for StoredQueries when they're first added. Logic would need to pull out the artifact type, column, etc.
Note that the MS local index currently supports single-column indexes only.
was:
If it's possible to configure the ModeShape query indexes during startup or runtime, allow users to provide their own. If they know specific queries they may frequently run, this could be a helpful optimization.
In addition, attempt to automatically create indexes for StoredQueries when they're first added. Logic would need to pull out the artifact type, column, etc.
Note that the MS local index currently supports single-column indexes only.
> Allow users to provide their own query indexes
> ----------------------------------------------
>
> Key: ARTIF-655
> URL: https://issues.jboss.org/browse/ARTIF-655
> Project: Artificer
> Issue Type: Feature Request
> Reporter: Brett Meyer
> Assignee: Brett Meyer
>
> Through ModeShape's Workspace#getIndexManager(), allow users to provide their own query indexes during startup/runtime. If they know specific queries they may frequently run, this could be a helpful optimization.
> In addition, attempt to automatically create indexes for StoredQueries when they're first added. Logic would need to pull out the artifact type, column, etc.
> Note that the MS local index currently supports single-column indexes only.
--
This message was sent by Atlassian JIRA
(v6.3.11#6341)
9 years, 10 months
[JBoss JIRA] (ARTIF-655) Allow users to provide their own query indexes
by Brett Meyer (JIRA)
Brett Meyer created ARTIF-655:
---------------------------------
Summary: Allow users to provide their own query indexes
Key: ARTIF-655
URL: https://issues.jboss.org/browse/ARTIF-655
Project: Artificer
Issue Type: Feature Request
Reporter: Brett Meyer
Assignee: Brett Meyer
If it's possible to configure the ModeShape query indexes during startup or runtime, allow users to provide their own. If they know specific queries they may frequently run, this could be a helpful optimization.
In addition, attempt to automatically create indexes for StoredQueries when they're first added. Logic would need to pull out the artifact type, column, etc.
Note that the MS local index currently supports single-column indexes only.
--
This message was sent by Atlassian JIRA
(v6.3.11#6341)
9 years, 10 months