New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DROOLS-4249: Implement client-side marshalling #1306
Changes from 11 commits
9198e24
fdf5512
02d3980
b9e6f43
cc8de57
b0928a6
49dd842
c8943b1
b08fad3
86bfbb2
42a68df
903b8b2
8ec1e84
4fdc2e0
cad4a3d
378f83f
49f5b4f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/target | ||
/local | ||
|
||
# Eclipse, Netbeans and IntelliJ files | ||
/.* | ||
/**/.* | ||
!.gitignore | ||
/nbproject | ||
*.ipr | ||
*.iws | ||
*.iml | ||
|
||
# Repository wide ignore mac DS_Store files | ||
.DS_Store | ||
*.log | ||
/src/main/java/org/ | ||
/src/main/resources/org/drools/workbench/scenariosimulation/kogito/marshaller/js/SCESIM.js | ||
/src/main/resources/org/drools/workbench/scenariosimulation/kogito/marshaller/js/Jsonix-all.js |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
Kogito SCESIM Marshaller | ||
========================== | ||
This module manages **marshalling** (i.e. converting from a XML file to a JSInterop file) | ||
and **unmarshalling** (i.e. converting from JSInterop file to a XML file) operation for Scenario Simulation | ||
Kogito project. | ||
|
||
Basically, the module uses jaxb _maven-jaxb2-plugin_ plugin and its sub plugin _gwt-jsonix-schema-compiler_ | ||
to generate all required classes to support the marshall and unmarshall processes. The inputs of the process are | ||
_bindings.xjb_ and _scesim.xsd_ files, which represent the schema of a current *.scesim | ||
|
||
In details, the modules provides: | ||
|
||
Under **java** package | ||
|
||
* **Model JSInterp classes**: The model JSInterop classes a for a which are automatically generated by | ||
_maven-jaxb2-plugin_ plugin in _js/model_ package | ||
* **Callbacks**: Callbacks to be called during a marshall/unmarshall call. automatically generated by | ||
_maven-jaxb2-plugin_ plugin in _js/callbacks_ package | ||
* **SCESIMMainJS**: JSInterop adapter to use for marshalling/unmarshalling, which refer to _SCESIMMainJS.js_ | ||
its javascript representation. Thus u | ||
* **Mapper**: It contains automatically generated Utils classes _JsUtils_ and _JSIName_ | ||
|
||
Under **resources** package | ||
|
||
* **Jsonix-all.js** automatically generated JS file which represents Jsonix engine. Do not contains specific | ||
SCESIM files. Required to be imported in the HTML page which wants to use this marshaller. | ||
* **SCESIM.js** automatically generated JS file which represents the SCESIM "schema" in JSON format. | ||
* **SCESIMMainJs.js** It wraps the Jsonix engine into SCESIM context. | ||
Required to be imported in the HTML page which wants to use this marshaller. | ||
* **jre folder**: It's a container for GWT "super source" files where GWT does not provide an emulation of JRE classes. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,214 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>org.drools</groupId> | ||
<artifactId>drools-wb-scenario-simulation-editor</artifactId> | ||
<version>7.34.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>drools-wb-scenario-simulation-editor-kogito-marshaller</artifactId> | ||
<packaging>jar</packaging> | ||
|
||
<name>Drools Workbench - Scenario Simulation Editor - Kogito - Marshaller</name> | ||
<description>Drools Workbench - Scenario Simulation Editor - Kogito - Marshaller</description> | ||
|
||
<properties> | ||
<jsinterop-annotations.version>1.0.2</jsinterop-annotations.version> | ||
<jsinterop-base-version>1.0.0-beta-1</jsinterop-base-version> | ||
<jsonix-scripts.version>3.0.0</jsonix-scripts.version> | ||
<js.destination>${project.basedir}/src/main/resources/org/drools/workbench/scenariosimulation/kogito/marshaller/js</js.destination> | ||
<gwt-jsonix-schema-compiler.version>1.1.0</gwt-jsonix-schema-compiler.version> | ||
<gwt-interop-utils.version>0.3.0</gwt-interop-utils.version> | ||
<maven-jaxb2-plugin.version>0.14.0</maven-jaxb2-plugin.version> | ||
</properties> | ||
Comment on lines
+19
to
+27
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, I reported https://issues.redhat.com/browse/DROOLS-5057 for DMN There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
It seems that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IDK if they're required.. It could be they're dead baggage that can be tidied up (when @jomarko looks at the JIRA he reported). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @manstis Thank you! @jomarko probably another "cleanup" change required in DMN is the one spotted by @danielezonca: remove |
||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.google.gwt</groupId> | ||
<artifactId>gwt-user</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.google.jsinterop</groupId> | ||
<artifactId>base</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.google.jsinterop</groupId> | ||
<artifactId>jsinterop-annotations</artifactId> | ||
</dependency> | ||
</dependencies> | ||
|
||
<dependencyManagement> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.kogito</groupId> | ||
<artifactId>gwt-jsonix-schema-compiler</artifactId> | ||
<version>${gwt-jsonix-schema-compiler.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.google.jsinterop</groupId> | ||
<artifactId>jsinterop-annotations</artifactId> | ||
<version>${jsinterop-annotations.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.google.jsinterop</groupId> | ||
<artifactId>base</artifactId> | ||
<version>${jsinterop-base-version}</version> | ||
</dependency> | ||
</dependencies> | ||
</dependencyManagement> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-clean-plugin</artifactId> | ||
<configuration> | ||
<failOnError>false</failOnError> | ||
<filesets> | ||
<fileset> | ||
<directory>src/main/java/org/drools/workbench/scenariosimulation/kogito/marshaller/js</directory> | ||
<includes> | ||
<include>**</include> | ||
</includes> | ||
</fileset> | ||
<fileset> | ||
<directory>src/main/java/org/drools/workbench/scenariosimulation/kogito/marshaller/mapper</directory> | ||
<includes> | ||
<include>JsUtils.java</include> | ||
<include>JSIName.java</include> | ||
</includes> | ||
</fileset> | ||
<fileset> | ||
<directory>${js.destination}</directory> | ||
<includes> | ||
<include>SCESIM.js</include> | ||
<include>Jsonix-all.js</include> | ||
</includes> | ||
</fileset> | ||
</filesets> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.jvnet.jaxb2.maven2</groupId> | ||
<artifactId>maven-jaxb2-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>generate-javascript</id> | ||
<phase>generate-sources</phase> | ||
<goals> | ||
<goal>generate</goal> | ||
</goals> | ||
<configuration> | ||
<extension>true</extension> | ||
<addCompileSourceRoot>false</addCompileSourceRoot> | ||
<debug>false</debug> | ||
<verbose>false</verbose> | ||
<args> | ||
<arg>-Xgwtjsonix</arg> | ||
<arg>-Xinheritance</arg> | ||
<arg>-jsid=${project.build.sourceDirectory}</arg> | ||
<arg>-jsmpkg=org.drools.workbench.scenariosimulation.kogito.marshaller.mapper</arg> | ||
<arg>-jsmn=SCESIMMainJs</arg> | ||
</args> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.kogito</groupId> | ||
<artifactId>gwt-jsonix-schema-compiler</artifactId> | ||
</plugin> | ||
</plugins> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-dependency-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>copy-javascript</id> | ||
<phase>generate-sources</phase> | ||
<goals> | ||
<goal>copy</goal> | ||
</goals> | ||
<configuration> | ||
<artifactItems> | ||
<artifactItem> | ||
<groupId>org.hisrc.jsonix</groupId> | ||
<artifactId>jsonix-scripts</artifactId> | ||
<version>${jsonix-scripts.version}</version> | ||
<type>js</type> | ||
<classifier>all</classifier> | ||
<outputDirectory>${js.destination}</outputDirectory> | ||
<destFileName>Jsonix-all.js</destFileName> | ||
</artifactItem> | ||
</artifactItems> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-antrun-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>move-generated-sources</id> | ||
<phase>process-sources</phase> | ||
<configuration> | ||
<target> | ||
<copy file="${project.build.directory}/generated-sources/xjc/SCESIM.js" tofile="${js.destination}/SCESIM.js"/> | ||
</target> | ||
</configuration> | ||
<goals> | ||
<goal>run</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<!-- GWT Maven Plugin--> | ||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>gwt-maven-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>compile</goal> | ||
<goal>generateAsync</goal> | ||
<goal>test</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
<configuration> | ||
<module>org.drools.workbench.scenariosimulation.kogito.marshaller.ScesimMarshaller</module> | ||
<style>PRETTY</style> | ||
<compileReport>true</compileReport> | ||
<soycDetailed>true</soycDetailed> | ||
<logLevel>TRACE</logLevel> | ||
<noServer>false</noServer> | ||
</configuration> | ||
</plugin> | ||
<!-- DISABLE CHECKSTYLE --> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-checkstyle-plugin</artifactId> | ||
<configuration> | ||
<skip>true</skip> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. shouldn't be disabled just for special folders? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jomarko good point, done! |
||
</configuration> | ||
</plugin> | ||
</plugins> | ||
|
||
<pluginManagement> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.jvnet.jaxb2.maven2</groupId> | ||
<artifactId>maven-jaxb2-plugin</artifactId> | ||
<version>${maven-jaxb2-plugin.version}</version> | ||
</plugin> | ||
</plugins> | ||
</pluginManagement> | ||
|
||
</build> | ||
|
||
</project> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Ignore everything in this directory, it will contain auto-generated files | ||
* | ||
# Except this file | ||
!.gitignore |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
<jaxb:bindings | ||
version="2.1" | ||
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" | ||
xmlns:jsonix="http://jsonix.highsource.org/customizations" | ||
xmlns:xs="http://www.w3.org/2001/XMLSchema" | ||
|
||
jaxb:extensionBindingPrefixes="jsonix"> | ||
|
||
<jaxb:bindings schemaLocation="scesim.xsd" node="/xs:schema"> | ||
<jaxb:schemaBindings> | ||
<jaxb:package name="org.drools.workbench.scenariosimulation.kogito.marshaller.js.model"/> | ||
</jaxb:schemaBindings> | ||
|
||
<jsonix:packageMapping | ||
packageName="org.drools.workbench.scenariosimulation.kogito.marshaller.js.model" | ||
spaceName="SCESIM"/> | ||
</jaxb:bindings> | ||
|
||
</jaxb:bindings> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
When updating your version of GWT, you should also update this DTD reference, | ||
so that your app can take advantage of the latest GWT module capabilities. | ||
--> | ||
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.8.2//EN" | ||
"http://gwtproject.org/doctype/2.8.2/gwt-module.dtd"> | ||
<module> | ||
|
||
<inherits name="jsinterop.base.Base" /> | ||
|
||
<!-- We don't need to support IE10 or older --> | ||
<!-- There is no "ie11" permutation. IE11 uses the Firefox one (gecko1_8) --> | ||
<set-property name="user.agent" value="gecko1_8,safari"/> | ||
|
||
<!-- Specify the paths for translatable code --> | ||
<source path="js"/> | ||
<source path="mapper"/> | ||
|
||
<super-source path="jre"/> | ||
|
||
</module> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* Copyright 2019 Red Hat, Inc. and/or its affiliates. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package javax.xml; | ||
|
||
import jsinterop.annotations.JsPackage; | ||
import jsinterop.annotations.JsType; | ||
|
||
/** | ||
* GWT Super-source version of javax.xml.XMLConstants. | ||
*/ | ||
@SuppressWarnings("unused") | ||
@JsType(namespace = JsPackage.GLOBAL) | ||
public final class XMLConstants { | ||
|
||
public static final String NULL_NS_URI = ""; | ||
|
||
public static final String DEFAULT_NS_PREFIX = ""; | ||
|
||
public static final String XML_NS_URI = "http://www.w3.org/XML/1998/namespace"; | ||
|
||
public static final String XML_NS_PREFIX = "xml"; | ||
|
||
public static final String XMLNS_ATTRIBUTE_NS_URI = "http://www.w3.org/2000/xmlns/"; | ||
|
||
public static final String XMLNS_ATTRIBUTE = "xmlns"; | ||
|
||
public static final String W3C_XML_SCHEMA_NS_URI = "http://www.w3.org/2001/XMLSchema"; | ||
|
||
public static final String W3C_XML_SCHEMA_INSTANCE_NS_URI = "http://www.w3.org/2001/XMLSchema-instance"; | ||
|
||
public static final String W3C_XPATH_DATATYPE_NS_URI = "http://www.w3.org/2003/11/xpath-datatypes"; | ||
|
||
public static final String XML_DTD_NS_URI = "http://www.w3.org/TR/REC-xml"; | ||
|
||
public static final String RELAXNG_NS_URI = "http://relaxng.org/ns/structure/1.0"; | ||
|
||
public static final String FEATURE_SECURE_PROCESSING = "http://javax.xml.XMLConstants/feature/secure-processing"; | ||
|
||
public static final String ACCESS_EXTERNAL_DTD = "http://javax.xml.XMLConstants/property/accessExternalDTD"; | ||
|
||
public static final String ACCESS_EXTERNAL_SCHEMA = "http://javax.xml.XMLConstants/property/accessExternalSchema"; | ||
|
||
public static final String ACCESS_EXTERNAL_STYLESHEET = "http://javax.xml.XMLConstants/property/accessExternalStylesheet"; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thus u?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jomarko Completed.