Vinyeh commited on
Commit
cd0ab63
·
verified ·
1 Parent(s): 7f599b6

Add pinned source: camunda-dmn-examples (part 20)

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/.clirr-jenkins-ignore.xml +20 -0
  2. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/.gitignore +20 -0
  3. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/README.md +80 -0
  4. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/bom/pom.xml +91 -0
  5. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/pom.xml +269 -0
  6. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/DataFormats.java +236 -0
  7. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/DeserializationTypeValidator.java +23 -0
  8. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/Spin.java +143 -0
  9. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/SpinCollection.java +28 -0
  10. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/SpinFactory.java +40 -0
  11. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/SpinFileNotFoundException.java +36 -0
  12. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/SpinList.java +25 -0
  13. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/SpinRuntimeException.java +34 -0
  14. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/SpinScriptException.java +33 -0
  15. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/impl/SpinFactoryImpl.java +171 -0
  16. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/impl/SpinListImpl.java +51 -0
  17. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/impl/logging/SpinCoreLogger.java +107 -0
  18. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/impl/logging/SpinLogger.java +31 -0
  19. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/impl/util/RewindableReader.java +131 -0
  20. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/impl/util/SpinIoUtil.java +139 -0
  21. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/impl/util/SpinReflectUtil.java +63 -0
  22. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/json/SpinJsonDataFormatException.java +33 -0
  23. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/json/SpinJsonException.java +35 -0
  24. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/json/SpinJsonNode.java +352 -0
  25. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/json/SpinJsonPathException.java +35 -0
  26. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/json/SpinJsonPathQuery.java +65 -0
  27. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/json/SpinJsonPropertyException.java +33 -0
  28. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/scripting/SpinScriptEnv.java +111 -0
  29. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/spi/DataFormat.java +43 -0
  30. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/spi/DataFormatConfigurator.java +39 -0
  31. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/spi/DataFormatMapper.java +101 -0
  32. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/spi/DataFormatProvider.java +45 -0
  33. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/spi/DataFormatReader.java +57 -0
  34. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/spi/DataFormatWriter.java +39 -0
  35. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/spi/SpinDataFormatException.java +39 -0
  36. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/spi/TextBasedDataFormatReader.java +51 -0
  37. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/spi/TypeDetector.java +29 -0
  38. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/xml/SpinXPathException.java +37 -0
  39. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/xml/SpinXPathQuery.java +93 -0
  40. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/xml/SpinXmlAttribute.java +67 -0
  41. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/xml/SpinXmlAttributeException.java +35 -0
  42. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/xml/SpinXmlDataFormatException.java +37 -0
  43. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/xml/SpinXmlElement.java +323 -0
  44. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/xml/SpinXmlElementException.java +35 -0
  45. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/xml/SpinXmlElementImplementationException.java +35 -0
  46. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/xml/SpinXmlNode.java +87 -0
  47. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/xml/SpinXmlNodeException.java +37 -0
  48. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/resources/script/env/groovy/spin.groovy +21 -0
  49. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/resources/script/env/javascript/spin.js +21 -0
  50. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/resources/script/env/python/spin.py +18 -0
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/.clirr-jenkins-ignore.xml ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <differences>
2
+ <difference>
3
+ <!-- It is okay to add classes to the set of superclasses -->
4
+ <className>**</className>
5
+ <differenceType>5000</differenceType>
6
+ <to>**</to>
7
+ </difference>
8
+ <difference>
9
+ <!-- It is okay to add methods to an interface-->
10
+ <className>**</className>
11
+ <differenceType>7012</differenceType>
12
+ <method>*</method>
13
+ </difference>
14
+ <difference>
15
+ <!-- It is okay to add abstract methods to an abstract class -->
16
+ <className>**</className>
17
+ <differenceType>7013</differenceType>
18
+ <method>*</method>
19
+ </difference>
20
+ </differences>
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/.gitignore ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .idea
2
+ target
3
+ .classpath
4
+ .project
5
+ .settings
6
+ build.properties
7
+ bin
8
+ .metadata
9
+ transaction.log
10
+ nbactions*.xml
11
+ nb-configuration.xml
12
+ /webapps/fox-platform-tasklist/server-work
13
+ dependency-reduced-pom.xml
14
+ faces-config.NavData
15
+ dependency-reduced-pom.xml
16
+ *.iml
17
+ *.sublime-project
18
+ *.sublime-workspace
19
+ *.swp
20
+
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/README.md ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ camunda-spin
2
+ ============
3
+
4
+ <p>
5
+ <a href="https://camunda.com/">Home</a> |
6
+ <a href="https://docs.camunda.org/manual/reference/spin/">Documentation</a> |
7
+ <a href="https://forum.camunda.org/">Forum</a> |
8
+ <a href="https://app.camunda.com/jira/browse/CAM">Issues</a> |
9
+ <a href="../LICENSE">License</a> |
10
+ <a href="../CONTRIBUTING.md">Contribute</a>
11
+ </p>
12
+
13
+ Library for simple XML and JSON processing on the JVM (Java Virtual Machine), targeting Java and
14
+ JVM-based scripting languages such as Groovy, JRuby, Jython, Javascript and Java Expression
15
+ Language.
16
+
17
+ # Why Spin?
18
+
19
+ Spin is useful when you need to work with complex, text-based data formats (such as XML or JSON)
20
+ without mapping to Java Objects.
21
+
22
+ Spin provides a comprehensible fluent API for working with different data formats through
23
+ lightweight wrapper objects:
24
+
25
+ Given the following XML document as `String` or `InputStream`:
26
+
27
+ ```xml
28
+ <?xml version=“1.0“ encoding=“UTF-8“ ?>
29
+ <customers>
30
+ <customer id="0001"><name>Jonny P</name></customer>
31
+ <customer id="0002"><name>Bobby G</name></customer>
32
+ <customer id="0003"><name>Mary T</name></customer>
33
+ </customers>
34
+ ```
35
+
36
+ It can directly be worked on with Spin:
37
+
38
+ ```java
39
+ import static org.camunda.spin.Spin.*;
40
+
41
+ // get id of first customer
42
+ XML( xmlInput ).childElements("customer")
43
+ .get(0)
44
+ .attr("id")
45
+ .value();
46
+
47
+ // create new customer
48
+ SpinXmlTreeElement kate = XML( "<customer />" )
49
+ .attr("id", "0004")
50
+ .append( XML("<name>Kate S</name>") );
51
+
52
+ // append to existing list
53
+ XML( xmlInput ).append(kate);
54
+
55
+ // query by Id:
56
+ XML( xmlInput ).xPath("/customers/customer[@id='0002']").element();
57
+ ```
58
+
59
+
60
+ # FAQ
61
+
62
+ ## Why should I use Spin instead of the Java DOM API?
63
+
64
+ Java provides a built-in Dom API along with a Parser. Spin provides a lightweight Wrapper around
65
+ the Dom API which makes it easier to work with than the Dom API. You can access the underlying Dom object
66
+ at any time by unwrapping it:
67
+
68
+ ```java
69
+ Element e = XML( xmlSource ).childElement("customer").unwrap();
70
+ ```
71
+
72
+
73
+ # Contributing
74
+
75
+ Have a look at our [contribution guide](https://github.com/camunda/camunda-bpm-platform/blob/master/CONTRIBUTING.md) for how to contribute to this repository.
76
+
77
+
78
+ # License:
79
+
80
+ The source files in this repository are made available under the [Apache License Version 2.0](../LICENSE).
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/bom/pom.xml ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <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">
2
+ <modelVersion>4.0.0</modelVersion>
3
+
4
+ <!-- HEADS-UP: Do not use camunda-parent as parent,
5
+ it would introduce a cyclic dependency to this bom -->
6
+ <parent>
7
+ <groupId>org.camunda.bpm</groupId>
8
+ <artifactId>camunda-root</artifactId>
9
+ <version>7.24.0-SNAPSHOT</version>
10
+ <relativePath>../../pom.xml</relativePath>
11
+ </parent>
12
+
13
+ <groupId>org.camunda.spin</groupId>
14
+ <artifactId>camunda-spin-bom</artifactId>
15
+ <name>camunda spin - bom</name>
16
+ <version>7.24.0-SNAPSHOT</version>
17
+ <packaging>pom</packaging>
18
+
19
+ <description>
20
+ Note: 7.24.0 is the last community edition release published on Maven Central. This library will not receive any new versions or releases. However, if you are interested in extended maintenance you could look into our enterprise edition. Get in touch with us: https://camunda.com/contact/
21
+ </description>
22
+
23
+ <dependencyManagement>
24
+ <dependencies>
25
+
26
+ <dependency>
27
+ <groupId>org.camunda.spin</groupId>
28
+ <artifactId>camunda-spin-core</artifactId>
29
+ <version>${project.version}</version>
30
+ </dependency>
31
+
32
+ <dependency>
33
+ <groupId>org.camunda.spin</groupId>
34
+ <artifactId>camunda-spin-core</artifactId>
35
+ <type>test-jar</type>
36
+ <version>${project.version}</version>
37
+ </dependency>
38
+
39
+ <dependency>
40
+ <groupId>org.camunda.spin</groupId>
41
+ <artifactId>camunda-spin-dataformat-all</artifactId>
42
+ <version>${project.version}</version>
43
+ <!-- Excluding dependencies that are shaded in camunda-spin-dataformat-all -->
44
+ <exclusions>
45
+ <exclusion>
46
+ <groupId>org.camunda.spin</groupId>
47
+ <artifactId>camunda-spin-dataformat-json-jackson</artifactId>
48
+ </exclusion>
49
+ <exclusion>
50
+ <groupId>org.camunda.spin</groupId>
51
+ <artifactId>camunda-spin-dataformat-xml-dom</artifactId>
52
+ </exclusion>
53
+ <exclusion>
54
+ <groupId>jakarta.xml.bind</groupId>
55
+ <artifactId>jakarta.xml.bind-api</artifactId>
56
+ </exclusion>
57
+ <exclusion>
58
+ <groupId>com.sun.xml.bind</groupId>
59
+ <artifactId>jaxb-impl</artifactId>
60
+ </exclusion>
61
+ </exclusions>
62
+ </dependency>
63
+
64
+ <dependency>
65
+ <groupId>org.camunda.spin</groupId>
66
+ <artifactId>camunda-spin-dataformat-json-jackson</artifactId>
67
+ <version>${project.version}</version>
68
+ </dependency>
69
+
70
+ <dependency>
71
+ <groupId>org.camunda.spin</groupId>
72
+ <artifactId>camunda-spin-dataformat-xml-dom</artifactId>
73
+ <version>${project.version}</version>
74
+ </dependency>
75
+
76
+ <dependency>
77
+ <groupId>org.camunda.spin</groupId>
78
+ <artifactId>camunda-spin-dataformat-xml-dom-jakarta</artifactId>
79
+ <version>${project.version}</version>
80
+ </dependency>
81
+ </dependencies>
82
+ </dependencyManagement>
83
+
84
+ <scm>
85
+ <url>https://github.com/camunda/camunda-bpm-platform</url>
86
+ <connection>scm:git:git@github.com:camunda/camunda-bpm-platform.git</connection>
87
+ <developerConnection>scm:git:git@github.com:camunda/camunda-bpm-platform.git</developerConnection>
88
+ <tag>HEAD</tag>
89
+ </scm>
90
+
91
+ </project>
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/pom.xml ADDED
@@ -0,0 +1,269 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <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">
2
+ <modelVersion>4.0.0</modelVersion>
3
+
4
+ <description>
5
+ Note: 7.24.0 is the last community edition release published on Maven Central. This library will not receive any new versions or releases. However, if you are interested in extended maintenance you could look into our enterprise edition. Get in touch with us: https://camunda.com/contact/
6
+ </description>
7
+
8
+ <parent>
9
+ <groupId>org.camunda.spin</groupId>
10
+ <artifactId>camunda-spin-root</artifactId>
11
+ <version>7.24.0-SNAPSHOT</version>
12
+ </parent>
13
+
14
+ <artifactId>camunda-spin-core</artifactId>
15
+ <name>camunda Spin - core</name>
16
+
17
+ <dependencies>
18
+
19
+ <dependency>
20
+ <groupId>org.camunda.commons</groupId>
21
+ <artifactId>camunda-commons-logging</artifactId>
22
+ </dependency>
23
+
24
+ <dependency>
25
+ <groupId>org.camunda.commons</groupId>
26
+ <artifactId>camunda-commons-utils</artifactId>
27
+ </dependency>
28
+
29
+ <dependency>
30
+ <groupId>junit</groupId>
31
+ <artifactId>junit</artifactId>
32
+ <scope>provided</scope>
33
+ </dependency>
34
+
35
+ <dependency>
36
+ <groupId>org.assertj</groupId>
37
+ <artifactId>assertj-core</artifactId>
38
+ <scope>test</scope>
39
+ </dependency>
40
+
41
+ <dependency>
42
+ <groupId>org.apache.groovy</groupId>
43
+ <artifactId>groovy-jsr223</artifactId>
44
+ <scope>test</scope>
45
+ </dependency>
46
+
47
+ <dependency>
48
+ <groupId>org.python</groupId>
49
+ <artifactId>jython</artifactId>
50
+ <scope>test</scope>
51
+ </dependency>
52
+
53
+ <dependency>
54
+ <groupId>org.jruby</groupId>
55
+ <artifactId>jruby-complete</artifactId>
56
+ <scope>test</scope>
57
+ </dependency>
58
+
59
+ <dependency>
60
+ <groupId>org.graalvm.js</groupId>
61
+ <artifactId>js</artifactId>
62
+ <scope>test</scope>
63
+ </dependency>
64
+
65
+ <dependency>
66
+ <groupId>org.graalvm.js</groupId>
67
+ <artifactId>js-scriptengine</artifactId>
68
+ <scope>test</scope>
69
+ </dependency>
70
+
71
+
72
+ <dependency>
73
+ <groupId>ch.qos.logback</groupId>
74
+ <artifactId>logback-classic</artifactId>
75
+ <scope>test</scope>
76
+ </dependency>
77
+
78
+ <dependency>
79
+ <groupId>net.javacrumbs.json-unit</groupId>
80
+ <artifactId>json-unit-fluent</artifactId>
81
+ <scope>test</scope>
82
+ </dependency>
83
+
84
+ <dependency>
85
+ <groupId>org.powermock</groupId>
86
+ <artifactId>powermock-module-junit4</artifactId>
87
+ <scope>test</scope>
88
+ </dependency>
89
+ <dependency>
90
+ <groupId>org.powermock</groupId>
91
+ <artifactId>powermock-api-mockito2</artifactId>
92
+ <scope>test</scope>
93
+ </dependency>
94
+
95
+ </dependencies>
96
+
97
+ <profiles>
98
+ <profile>
99
+ <id>disable-javascript-tests</id>
100
+ <activation>
101
+ <jdk>(,1.8)</jdk>
102
+ </activation>
103
+ <build>
104
+ <plugins>
105
+ <plugin>
106
+ <groupId>org.apache.maven.plugins</groupId>
107
+ <artifactId>maven-surefire-plugin</artifactId>
108
+ <configuration>
109
+ <argLine>-XX:PermSize=128m</argLine>
110
+ <excludes>
111
+ <exclude>**/javascript/**</exclude>
112
+ </excludes>
113
+ </configuration>
114
+ </plugin>
115
+ </plugins>
116
+ </build>
117
+ </profile>
118
+ <!-- exclude the DataFormatProviderTest until PowerMock 2.0 is released: https://app.camunda.com/jira/browse/CAM-9309 -->
119
+ <profile>
120
+ <id>jdk-9-and-onwards</id>
121
+ <activation>
122
+ <jdk>[9,)</jdk>
123
+ </activation>
124
+ <build>
125
+ <plugins>
126
+ <plugin>
127
+ <groupId>org.apache.maven.plugins</groupId>
128
+ <artifactId>maven-surefire-plugin</artifactId>
129
+ <configuration>
130
+ <argLine>-XX:PermSize=128m</argLine>
131
+ <excludes>
132
+ <exclude>**/DataFormatLoadingTest.java</exclude>
133
+ </excludes>
134
+ </configuration>
135
+ </plugin>
136
+ </plugins>
137
+ </build>
138
+ </profile>
139
+ <profile>
140
+ <id>jdk-15-and-onwards</id>
141
+ <activation>
142
+ <jdk>[15,)</jdk>
143
+ </activation>
144
+ <build>
145
+ <plugins>
146
+ <plugin>
147
+ <groupId>org.apache.maven.plugins</groupId>
148
+ <artifactId>maven-surefire-plugin</artifactId>
149
+ <configuration>
150
+ <excludes combine.children="append">
151
+ <exclude>**/*NashornTest.java</exclude>
152
+ </excludes>
153
+ </configuration>
154
+ </plugin>
155
+ </plugins>
156
+ </build>
157
+ </profile>
158
+
159
+ <profile>
160
+ <id>jdk-16-and-onwards</id>
161
+ <activation>
162
+ <jdk>[16,)</jdk>
163
+ </activation>
164
+ <build>
165
+ <plugins>
166
+ <plugin>
167
+ <groupId>org.apache.maven.plugins</groupId>
168
+ <artifactId>maven-surefire-plugin</artifactId>
169
+ <configuration>
170
+ <argLine>
171
+ -XX:MetaspaceSize=128m
172
+ </argLine>
173
+ <excludes combine.children="append">
174
+ <exclude>**/*NashornTest.java</exclude>
175
+ </excludes>
176
+ </configuration>
177
+ </plugin>
178
+ </plugins>
179
+ </build>
180
+ </profile>
181
+
182
+ <!-- check for api differences between latest minor release -->
183
+ <profile>
184
+ <id>check-api-compatibility</id>
185
+ <activation>
186
+ <jdk>(,)</jdk>
187
+ </activation>
188
+ <build>
189
+ <plugins>
190
+ <plugin>
191
+ <groupId>org.codehaus.mojo</groupId>
192
+ <artifactId>clirr-maven-plugin</artifactId>
193
+ <version>2.8</version>
194
+ <configuration>
195
+ <comparisonVersion>${spin.version.old}</comparisonVersion>
196
+ <logResults>true</logResults>
197
+ <excludes>
198
+ <exclude>org/camunda/spin/impl/**</exclude>
199
+ </excludes>
200
+ </configuration>
201
+ <executions>
202
+ <execution>
203
+ <id>all</id>
204
+ <phase>verify</phase>
205
+ <goals>
206
+ <goal>check-no-fork</goal>
207
+ </goals>
208
+ <configuration>
209
+ <textOutputFile>${project.build.directory}/clirr-all.txt</textOutputFile>
210
+ <failOnWarning>false</failOnWarning>
211
+ <failOnError>false</failOnError>
212
+ </configuration>
213
+ </execution>
214
+ <execution>
215
+ <id>restrictive</id>
216
+ <phase>verify</phase>
217
+ <goals>
218
+ <goal>check-no-fork</goal>
219
+ </goals>
220
+ <configuration>
221
+ <textOutputFile>${project.build.directory}/clirr-restrictive.txt</textOutputFile>
222
+ <failOnWarning>true</failOnWarning>
223
+ <ignoredDifferencesFile>../.clirr-jenkins-ignore.xml</ignoredDifferencesFile>
224
+ </configuration>
225
+ </execution>
226
+ </executions>
227
+ </plugin>
228
+ </plugins>
229
+ </build>
230
+ </profile>
231
+ </profiles>
232
+
233
+ <build>
234
+ <plugins>
235
+ <plugin>
236
+ <groupId>org.apache.felix</groupId>
237
+ <artifactId>maven-bundle-plugin</artifactId>
238
+ <configuration>
239
+ <instructions>
240
+ <Import-Package>
241
+ org.junit*;resolution:=optional,
242
+ *
243
+ </Import-Package>
244
+ </instructions>
245
+ </configuration>
246
+ <executions>
247
+ <execution>
248
+ <id>bundle-manifest</id>
249
+ <phase>process-classes</phase>
250
+ <goals>
251
+ <goal>manifest</goal>
252
+ </goals>
253
+ </execution>
254
+ </executions>
255
+ </plugin>
256
+ <plugin>
257
+ <groupId>org.apache.maven.plugins</groupId>
258
+ <artifactId>maven-jar-plugin</artifactId>
259
+ <executions>
260
+ <execution>
261
+ <goals>
262
+ <goal>test-jar</goal>
263
+ </goals>
264
+ </execution>
265
+ </executions>
266
+ </plugin>
267
+ </plugins>
268
+ </build>
269
+ </project>
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/DataFormats.java ADDED
@@ -0,0 +1,236 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ package org.camunda.spin;
18
+
19
+ import java.util.Collections;
20
+ import java.util.HashMap;
21
+ import java.util.HashSet;
22
+ import java.util.List;
23
+ import java.util.Map;
24
+ import java.util.ServiceLoader;
25
+ import java.util.Set;
26
+
27
+ import org.camunda.spin.impl.logging.SpinCoreLogger;
28
+ import org.camunda.spin.impl.logging.SpinLogger;
29
+ import org.camunda.spin.json.SpinJsonNode;
30
+ import org.camunda.spin.spi.DataFormat;
31
+ import org.camunda.spin.spi.DataFormatConfigurator;
32
+ import org.camunda.spin.spi.DataFormatProvider;
33
+ import org.camunda.spin.xml.SpinXmlElement;
34
+
35
+ /**
36
+ * Provides access to all builtin data formats.
37
+ *
38
+ * @author Sebastian Menski
39
+ * @author Daniel Meyer
40
+ */
41
+ public class DataFormats {
42
+
43
+ private static SpinCoreLogger LOG = SpinLogger.CORE_LOGGER;
44
+
45
+ public static String JSON_DATAFORMAT_NAME = "application/json";
46
+
47
+ public static String XML_DATAFORMAT_NAME = "application/xml";
48
+
49
+ /** The global instance of the manager */
50
+ static DataFormats INSTANCE = new DataFormats();
51
+
52
+ /**
53
+ * Provides the global instance of the DataFormats manager.
54
+ * @return the global instance.
55
+ */
56
+ public static DataFormats getInstance() {
57
+ return INSTANCE;
58
+ }
59
+
60
+ /**
61
+ * Returns the global xml data format that can be provided with
62
+ * configuration that applies to any Spin xml operation.
63
+ */
64
+ @SuppressWarnings("unchecked")
65
+ public static DataFormat<SpinXmlElement> xml() {
66
+ return (DataFormat<SpinXmlElement>) getDataFormat(XML_DATAFORMAT_NAME);
67
+ }
68
+
69
+ /**
70
+ * Returns the global json data format that can be provided with
71
+ * configuration that applies to any Spin json operation.
72
+ */
73
+ @SuppressWarnings("unchecked")
74
+ public static DataFormat<SpinJsonNode> json() {
75
+ return (DataFormat<SpinJsonNode>) getDataFormat(JSON_DATAFORMAT_NAME);
76
+ }
77
+
78
+ /**
79
+ * Returns the registered data format for the given name.
80
+ *
81
+ * @param dataFormatName the name of the data format
82
+ * @return the data format or null if non is registered for this name
83
+ */
84
+ public static DataFormat<? extends Spin<?>> getDataFormat(String dataFormatName) {
85
+ return INSTANCE.getDataFormatByName(dataFormatName);
86
+ }
87
+
88
+ /**
89
+ * @return a set of all registered data formats
90
+ */
91
+ public static Set<DataFormat<? extends Spin<?>>> getAvailableDataFormats() {
92
+ return INSTANCE.getAllAvailableDataFormats();
93
+ }
94
+
95
+ // instance /////////////////////////////////////////////////////
96
+
97
+ protected Map<String, DataFormat<?>> availableDataFormats;
98
+
99
+ public Set<DataFormat<? extends Spin<?>>> getAllAvailableDataFormats() {
100
+ ensureDataformatsInitialized();
101
+ return new HashSet<>(availableDataFormats.values());
102
+ }
103
+
104
+ public DataFormat<? extends Spin<?>> getDataFormatByName(String name) {
105
+ ensureDataformatsInitialized();
106
+ return availableDataFormats.get(name);
107
+ }
108
+
109
+ /**
110
+ * Detect all available dataformats on the classpath using a {@link ServiceLoader}.
111
+ */
112
+ protected void ensureDataformatsInitialized() {
113
+ if(availableDataFormats == null) {
114
+ synchronized(DataFormats.class) {
115
+ if(availableDataFormats == null) {
116
+ registerDataFormats(null);
117
+ }
118
+ }
119
+ }
120
+ }
121
+
122
+ public void registerDataFormats(ClassLoader classloader) {
123
+ registerDataFormats(classloader, Collections.EMPTY_LIST, Collections.EMPTY_MAP);
124
+ }
125
+
126
+ public void registerDataFormats(ClassLoader classloader,
127
+ List<DataFormatConfigurator> configurators) {
128
+ registerDataFormats(classloader, configurators, Collections.EMPTY_MAP);
129
+ }
130
+ public void registerDataFormats(ClassLoader classloader,
131
+ List<DataFormatConfigurator> configurators,
132
+ Map<String, Object> configurationProperties) {
133
+
134
+ Map<String, DataFormat<?>> dataFormats = new HashMap<>();
135
+
136
+ if(classloader == null) {
137
+ classloader = DataFormats.class.getClassLoader();
138
+ }
139
+
140
+ // discover available custom dataformat providers on the classpath
141
+ registerCustomDataFormats(dataFormats, classloader, configurationProperties);
142
+
143
+ // discover and apply data format configurators on the classpath
144
+ applyConfigurators(dataFormats, classloader, configurators);
145
+
146
+ LOG.logDataFormats(dataFormats.values());
147
+
148
+ this.availableDataFormats = dataFormats;
149
+ }
150
+
151
+ protected void registerCustomDataFormats(Map<String, DataFormat<?>> dataFormats, ClassLoader classloader) {
152
+ registerCustomDataFormats(dataFormats, classloader, Collections.EMPTY_MAP);
153
+ }
154
+
155
+ protected void registerCustomDataFormats(Map<String, DataFormat<?>> dataFormats,
156
+ ClassLoader classloader,
157
+ Map<String, Object> configurationProperties) {
158
+ // use java.util.ServiceLoader to load custom DataFormatProvider instances on the classpath
159
+ ServiceLoader<DataFormatProvider> providerLoader = ServiceLoader.load(DataFormatProvider.class, classloader);
160
+
161
+ for (DataFormatProvider provider : providerLoader) {
162
+ LOG.logDataFormatProvider(provider);
163
+ registerProvider(dataFormats, provider, configurationProperties);
164
+ }
165
+ }
166
+
167
+ protected void registerProvider(Map<String, DataFormat<?>> dataFormats,
168
+ DataFormatProvider provider) {
169
+ registerProvider(dataFormats, provider, Collections.EMPTY_MAP);
170
+ }
171
+
172
+ protected void registerProvider(Map<String, DataFormat<?>> dataFormats,
173
+ DataFormatProvider provider,
174
+ Map<String, Object> configurationProperties) {
175
+
176
+ String dataFormatName = provider.getDataFormatName();
177
+
178
+ if(dataFormats.containsKey(dataFormatName)) {
179
+ throw LOG.multipleProvidersForDataformat(dataFormatName);
180
+ }
181
+ else {
182
+ DataFormat<?> dataFormatInstance = provider.createInstance(configurationProperties);
183
+ dataFormats.put(dataFormatName, dataFormatInstance);
184
+ }
185
+ }
186
+
187
+ @SuppressWarnings("rawtypes")
188
+ protected void applyConfigurators(Map<String, DataFormat<?>> dataFormats, ClassLoader classloader) {
189
+ applyConfigurators(dataFormats, classloader, Collections.EMPTY_LIST);
190
+ }
191
+
192
+ protected void applyConfigurators(Map<String, DataFormat<?>> dataFormats,
193
+ ClassLoader classloader,
194
+ List<DataFormatConfigurator> dataFormatConfigurators) {
195
+
196
+ ServiceLoader<DataFormatConfigurator> configuratorLoader = ServiceLoader.load(DataFormatConfigurator.class, classloader);
197
+
198
+ // apply SPI configurators
199
+ for (DataFormatConfigurator configurator : configuratorLoader) {
200
+ LOG.logDataFormatConfigurator(configurator);
201
+ applyConfigurator(dataFormats, configurator);
202
+ }
203
+
204
+ // apply additional, non-SPI, configurators
205
+ for (DataFormatConfigurator configurator : dataFormatConfigurators) {
206
+ LOG.logDataFormatConfigurator(configurator);
207
+ applyConfigurator(dataFormats, configurator);
208
+ }
209
+ }
210
+
211
+ @SuppressWarnings({ "rawtypes", "unchecked" })
212
+ protected void applyConfigurator(Map<String, DataFormat<?>> dataFormats, DataFormatConfigurator configurator) {
213
+ for (DataFormat<?> dataFormat : dataFormats.values()) {
214
+ if (configurator.getDataFormatClass().isAssignableFrom(dataFormat.getClass())) {
215
+ configurator.configure(dataFormat);
216
+ }
217
+ }
218
+ }
219
+
220
+ public static void loadDataFormats() {
221
+ loadDataFormats(null);
222
+ }
223
+
224
+ public static void loadDataFormats(ClassLoader classloader) {
225
+ INSTANCE.registerDataFormats(classloader);
226
+ }
227
+
228
+ public static void loadDataFormats(ClassLoader classloader, List<DataFormatConfigurator> configurators) {
229
+ INSTANCE.registerDataFormats(classloader, configurators);
230
+ }
231
+
232
+ public static void loadDataFormats(ClassLoader classloader, Map configurationProperties) {
233
+ INSTANCE.registerDataFormats(classloader, Collections.EMPTY_LIST, configurationProperties);
234
+ }
235
+
236
+ }
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/DeserializationTypeValidator.java ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ package org.camunda.spin;
18
+
19
+ public interface DeserializationTypeValidator {
20
+
21
+ boolean validate(String type);
22
+
23
+ }
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/Spin.java ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ package org.camunda.spin;
18
+
19
+ import java.io.Writer;
20
+
21
+ import org.camunda.spin.json.SpinJsonNode;
22
+ import org.camunda.spin.spi.DataFormat;
23
+ import org.camunda.spin.xml.SpinXmlElement;
24
+
25
+ /**
26
+ *
27
+ * @author Sebastian Menski
28
+ * @author Daniel Meyer
29
+ */
30
+ public abstract class Spin<T extends Spin<?>> {
31
+
32
+ /**
33
+ * Creates a spin wrapper for a data input of a given data format.
34
+ *
35
+ * @param input the input to wrap
36
+ * @param format the data format of the input
37
+ * @return the spin wrapper for the input
38
+ *
39
+ * @throws IllegalArgumentException in case an argument of illegal type is provided (such as 'null')
40
+ */
41
+ public static <T extends Spin<?>> T S(Object input, DataFormat<T> format) {
42
+ return SpinFactory.INSTANCE.createSpin(input, format);
43
+ }
44
+
45
+ /**
46
+ * Creates a spin wrapper for a data input of a given data format.
47
+ *
48
+ * @param input the input to wrap
49
+ * @param dataFormatName the data format name of the input
50
+ * @return the spin wrapper for the input
51
+ *
52
+ * @throws IllegalArgumentException in case an argument of illegal type is provided (such as 'null')
53
+ */
54
+ public static <T extends Spin<?>> T S(Object input, String dataFormatName) {
55
+ return SpinFactory.INSTANCE.createSpin(input, dataFormatName);
56
+ }
57
+
58
+ /**
59
+ * Creates a spin wrapper for a data input. The data format of the
60
+ * input is auto detected.
61
+ *
62
+ * @param input the input to wrap
63
+ * @return the spin wrapper for the input
64
+ *
65
+ * @throws IllegalArgumentException in case an argument of illegal type is provided (such as 'null')
66
+ */
67
+ public static <T extends Spin<?>> T S(Object input) {
68
+ return SpinFactory.INSTANCE.createSpin(input);
69
+ }
70
+
71
+ /**
72
+ * Creates a spin wrapper for a data input. The data format of the
73
+ * input is assumed to be XML.
74
+ *
75
+ * @param input the input to wrap
76
+ * @return the spin wrapper for the input
77
+ *
78
+ * @throws IllegalArgumentException in case an argument of illegal type is provided (such as 'null')
79
+ */
80
+ public static SpinXmlElement XML(Object input) {
81
+ return SpinFactory.INSTANCE.createSpin(input, DataFormats.xml());
82
+ }
83
+
84
+ /**
85
+ * Creates a spin wrapper for a data input. The data format of the
86
+ * input is assumed to be JSON.
87
+ *
88
+ * @param input the input to wrap
89
+ * @return the spin wrapper for the input
90
+ *
91
+ * @throws IllegalArgumentException in case an argument of illegal type is provided (such as 'null')
92
+ */
93
+ public static SpinJsonNode JSON(Object input) {
94
+ return SpinFactory.INSTANCE.createSpin(input, DataFormats.json());
95
+ }
96
+
97
+ /**
98
+ * Provides the name of the dataformat used by this spin.
99
+ *
100
+ * @return the name of the dataformat used by this Spin.
101
+ */
102
+ public abstract String getDataFormatName();
103
+
104
+ /**
105
+ * Return the wrapped object. The return type of this method
106
+ * depends on the concrete data format.
107
+ *
108
+ * @return the object wrapped by this wrapper.
109
+ */
110
+ public abstract Object unwrap();
111
+
112
+ /**
113
+ * Returns the wrapped object as string representation.
114
+ *
115
+ * @return the string representation
116
+ */
117
+ public abstract String toString();
118
+
119
+ /**
120
+ * Writes the wrapped object to a existing writer.
121
+ *
122
+ * @param writer the writer to write to
123
+ */
124
+ public abstract void writeToWriter(Writer writer);
125
+
126
+ /**
127
+ * Maps the wrapped object to an instance of a java class.
128
+ *
129
+ * @param type the java class to map to
130
+ * @return the mapped object
131
+ */
132
+ public abstract <C> C mapTo(Class<C> type);
133
+
134
+ /**
135
+ * Maps the wrapped object to a java object.
136
+ * The object is determined based on the configuration string
137
+ * which is data format specific.
138
+ *
139
+ * @param type the class name to map to
140
+ * @return the mapped object
141
+ */
142
+ public abstract <C> C mapTo(String type);
143
+ }
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/SpinCollection.java ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ package org.camunda.spin;
18
+
19
+ import java.util.Collection;
20
+
21
+ /**
22
+ *
23
+ * @author Sebastian Menski
24
+ * @author Daniel Meyer
25
+ */
26
+ public interface SpinCollection<E extends Spin<?>> extends Collection<E> {
27
+
28
+ }
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/SpinFactory.java ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ package org.camunda.spin;
18
+
19
+ import org.camunda.spin.impl.SpinFactoryImpl;
20
+ import org.camunda.spin.spi.DataFormat;
21
+
22
+ /**
23
+ *
24
+ * @author Sebastian Menski
25
+ * @author Daniel Meyer
26
+ */
27
+ public abstract class SpinFactory {
28
+
29
+ /**
30
+ * The singleton instance of the SpinFactory.
31
+ */
32
+ public static SpinFactory INSTANCE = new SpinFactoryImpl();
33
+
34
+ public abstract <T extends Spin<?>> T createSpin(Object parameter);
35
+
36
+ public abstract <T extends Spin<?>> T createSpin(Object parameter, DataFormat<T> format);
37
+
38
+ public abstract <T extends Spin<?>> T createSpin(Object parameter, String dataFormatName);
39
+
40
+ }
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/SpinFileNotFoundException.java ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ package org.camunda.spin;
18
+
19
+ import org.camunda.spin.SpinRuntimeException;
20
+
21
+ /**
22
+ * @author Sebastian Menski
23
+ */
24
+ public class SpinFileNotFoundException extends SpinRuntimeException {
25
+
26
+ private static final long serialVersionUID = 1L;
27
+
28
+ public SpinFileNotFoundException(String message) {
29
+ super(message);
30
+ }
31
+
32
+ public SpinFileNotFoundException(String message, Throwable cause) {
33
+ super(message, cause);
34
+ }
35
+
36
+ }
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/SpinList.java ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ package org.camunda.spin;
18
+
19
+ import java.util.List;
20
+
21
+ /**
22
+ * @author Sebastian Menski
23
+ */
24
+ public interface SpinList<E extends Spin<?>> extends List<E> {
25
+ }
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/SpinRuntimeException.java ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ package org.camunda.spin;
18
+
19
+ /**
20
+ * @author Sebastian Menski
21
+ */
22
+ public class SpinRuntimeException extends RuntimeException {
23
+
24
+ private static final long serialVersionUID = 1L;
25
+
26
+ public SpinRuntimeException(String message) {
27
+ super(message);
28
+ }
29
+
30
+ public SpinRuntimeException(String message, Throwable cause) {
31
+ super(message, cause);
32
+ }
33
+
34
+ }
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/SpinScriptException.java ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ package org.camunda.spin;
18
+
19
+ /**
20
+ * @author Sebastian Menski
21
+ */
22
+ public class SpinScriptException extends SpinRuntimeException {
23
+
24
+ private static final long serialVersionUID = 1L;
25
+
26
+ public SpinScriptException(String message) {
27
+ super(message);
28
+ }
29
+
30
+ public SpinScriptException(String message, Throwable cause) {
31
+ super(message, cause);
32
+ }
33
+ }
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/impl/SpinFactoryImpl.java ADDED
@@ -0,0 +1,171 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ package org.camunda.spin.impl;
18
+
19
+ import static org.camunda.commons.utils.EnsureUtil.ensureNotNull;
20
+
21
+ import java.io.IOException;
22
+ import java.io.Reader;
23
+
24
+ import org.camunda.spin.DataFormats;
25
+ import org.camunda.spin.Spin;
26
+ import org.camunda.spin.SpinFactory;
27
+ import org.camunda.spin.impl.logging.SpinCoreLogger;
28
+ import org.camunda.spin.impl.util.RewindableReader;
29
+ import org.camunda.spin.impl.util.SpinIoUtil;
30
+ import org.camunda.spin.spi.DataFormat;
31
+ import org.camunda.spin.spi.DataFormatMapper;
32
+ import org.camunda.spin.spi.DataFormatReader;
33
+ import org.camunda.spin.spi.SpinDataFormatException;
34
+
35
+ /**
36
+ * @author Daniel Meyer
37
+ * @author Sebastian Menski
38
+ *
39
+ */
40
+ public class SpinFactoryImpl extends SpinFactory {
41
+
42
+ private static final SpinCoreLogger LOG = SpinCoreLogger.CORE_LOGGER;
43
+
44
+ private static final int READ_SIZE = 256;
45
+
46
+ @SuppressWarnings("unchecked")
47
+ public <T extends Spin<?>> T createSpin(Object parameter) {
48
+ ensureNotNull("parameter", parameter);
49
+
50
+ if (parameter instanceof String) {
51
+ return createSpinFromString((String) parameter);
52
+
53
+ } else if (parameter instanceof Reader) {
54
+ return createSpinFromReader((Reader) parameter);
55
+
56
+ } else if (parameter instanceof Spin) {
57
+ return createSpinFromSpin((T) parameter);
58
+
59
+ } else {
60
+ throw LOG.unsupportedInputParameter(parameter.getClass());
61
+ }
62
+ }
63
+
64
+ @SuppressWarnings("unchecked")
65
+ public <T extends Spin<?>> T createSpin(Object parameter, DataFormat<T> format) {
66
+ ensureNotNull("parameter", parameter);
67
+ ensureNotNull("format", format);
68
+
69
+ if (parameter instanceof String) {
70
+ return createSpinFromString((String) parameter, format);
71
+
72
+ } else if (parameter instanceof Reader) {
73
+ return createSpinFromReader((Reader) parameter, format);
74
+
75
+ } else if (parameter instanceof Spin) {
76
+ return createSpinFromSpin((T) parameter, format);
77
+
78
+ } else {
79
+ return createSpinFromObject(parameter, format);
80
+ }
81
+ }
82
+
83
+ @SuppressWarnings("unchecked")
84
+ public <T extends Spin<?>> T createSpin(Object parameter, String dataFormatName) {
85
+ ensureNotNull("dataFormatName", dataFormatName);
86
+
87
+ DataFormat<T> dataFormat = (DataFormat<T>) DataFormats.getDataFormat(dataFormatName);
88
+
89
+ return createSpin(parameter, dataFormat);
90
+ }
91
+
92
+ /**
93
+ *
94
+ * @throws SpinDataFormatException in case the parameter cannot be read using this data format
95
+ * @throws IllegalArgumentException in case the parameter is null or dd:
96
+ */
97
+ public <T extends Spin<?>> T createSpinFromSpin(T parameter) {
98
+ ensureNotNull("parameter", parameter);
99
+
100
+ return parameter;
101
+ }
102
+
103
+ public <T extends Spin<?>> T createSpinFromString(String parameter) {
104
+ ensureNotNull("parameter", parameter);
105
+
106
+ Reader input = SpinIoUtil.stringAsReader(parameter);
107
+ return createSpin(input);
108
+ }
109
+
110
+ @SuppressWarnings("unchecked")
111
+ public <T extends Spin<?>> T createSpinFromReader(Reader parameter) {
112
+ ensureNotNull("parameter", parameter);
113
+
114
+ RewindableReader rewindableReader = new RewindableReader(parameter, READ_SIZE);
115
+
116
+ DataFormat<T> matchingDataFormat = null;
117
+ for (DataFormat<?> format : DataFormats.getAvailableDataFormats()) {
118
+ if (format.getReader().canRead(rewindableReader, rewindableReader.getRewindBufferSize())) {
119
+ matchingDataFormat = (DataFormat<T>) format;
120
+ }
121
+
122
+ try {
123
+ rewindableReader.rewind();
124
+ } catch (IOException e) {
125
+ throw LOG.unableToReadFromReader(e);
126
+ }
127
+
128
+ }
129
+
130
+ if (matchingDataFormat == null) {
131
+ throw LOG.unrecognizableDataFormatException();
132
+ }
133
+
134
+ return createSpin(rewindableReader, matchingDataFormat);
135
+ }
136
+
137
+ /**
138
+ *
139
+ * @throws SpinDataFormatException in case the parameter cannot be read using this data format
140
+ * @throws IllegalArgumentException in case the parameter is null or dd:
141
+ */
142
+ public <T extends Spin<?>> T createSpinFromSpin(T parameter, DataFormat<T> format) {
143
+ ensureNotNull("parameter", parameter);
144
+
145
+ return parameter;
146
+ }
147
+
148
+ public <T extends Spin<?>> T createSpinFromString(String parameter, DataFormat<T> format) {
149
+ ensureNotNull("parameter", parameter);
150
+
151
+ Reader input = SpinIoUtil.stringAsReader(parameter);
152
+ return createSpin(input, format);
153
+ }
154
+
155
+ public <T extends Spin<?>> T createSpinFromReader(Reader parameter, DataFormat<T> format) {
156
+ ensureNotNull("parameter", parameter);
157
+
158
+ DataFormatReader reader = format.getReader();
159
+ Object dataFormatInput = reader.readInput(parameter);
160
+ return format.createWrapperInstance(dataFormatInput);
161
+ }
162
+
163
+ public <T extends Spin<?>> T createSpinFromObject(Object parameter, DataFormat<T> format) {
164
+ ensureNotNull("parameter", parameter);
165
+
166
+ DataFormatMapper mapper = format.getMapper();
167
+ Object dataFormatInput = mapper.mapJavaToInternal(parameter);
168
+
169
+ return format.createWrapperInstance(dataFormatInput);
170
+ }
171
+ }
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/impl/SpinListImpl.java ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ package org.camunda.spin.impl;
18
+
19
+ import org.camunda.spin.Spin;
20
+ import org.camunda.spin.SpinList;
21
+
22
+ import java.util.ArrayList;
23
+ import java.util.Collection;
24
+
25
+ /**
26
+ * @author Sebastian Menski
27
+ */
28
+ public class SpinListImpl<E extends Spin<?>> extends ArrayList<E> implements SpinList<E> {
29
+
30
+ private static final long serialVersionUID = 1L;
31
+
32
+ public SpinListImpl() {
33
+ super();
34
+ }
35
+
36
+ public SpinListImpl(int initialCapacity) {
37
+ super(initialCapacity);
38
+ }
39
+
40
+ public SpinListImpl(Collection<? extends E> c) {
41
+ super(c);
42
+ }
43
+
44
+ public SpinListImpl(Iterable<E> iterable) {
45
+ super();
46
+ for (E e : iterable) {
47
+ add(e);
48
+ }
49
+ }
50
+
51
+ }
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/impl/logging/SpinCoreLogger.java ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ package org.camunda.spin.impl.logging;
18
+
19
+ import java.io.IOException;
20
+ import java.util.Collection;
21
+
22
+ import org.camunda.spin.SpinFileNotFoundException;
23
+ import org.camunda.spin.SpinRuntimeException;
24
+ import org.camunda.spin.SpinScriptException;
25
+ import org.camunda.spin.spi.DataFormat;
26
+ import org.camunda.spin.spi.DataFormatConfigurator;
27
+ import org.camunda.spin.spi.DataFormatProvider;
28
+ import org.camunda.spin.spi.SpinDataFormatException;
29
+
30
+
31
+ /**
32
+ * The Logger for the core api.
33
+ *
34
+ * @author Daniel Meyer
35
+ * @author Sebastian Menski
36
+ *
37
+ */
38
+ public class SpinCoreLogger extends SpinLogger {
39
+
40
+ public IllegalArgumentException unsupportedInputParameter(Class<?> parameterClass) {
41
+ return new IllegalArgumentException(exceptionMessage("001", "Unsupported input of type '{}'", parameterClass.getName()));
42
+ }
43
+
44
+ public SpinFileNotFoundException fileNotFoundException(String filename, Throwable cause) {
45
+ return new SpinFileNotFoundException(exceptionMessage("002", "Unable to find file with path '{}'", filename), cause);
46
+ }
47
+
48
+ public SpinFileNotFoundException fileNotFoundException(String filename) {
49
+ return fileNotFoundException(filename, null);
50
+ }
51
+
52
+ public SpinRuntimeException unableToReadFromReader(Exception e) {
53
+ return new SpinRuntimeException(exceptionMessage("003", "Unable to read from reader"), e);
54
+ }
55
+
56
+ public SpinDataFormatException unrecognizableDataFormatException() {
57
+ return new SpinDataFormatException(exceptionMessage("004", "No matching data format detected"));
58
+ }
59
+
60
+ public SpinScriptException noScriptEnvFoundForLanguage(String scriptLanguage, String path) {
61
+ return new SpinScriptException(exceptionMessage("006", "No script script env found for script language '{}' at path '{}'", scriptLanguage, path));
62
+ }
63
+
64
+ public IOException unableToRewindReader() {
65
+ return new IOException(exceptionMessage("007", "Unable to rewind input stream: rewind buffering limit exceeded"));
66
+ }
67
+
68
+ public SpinDataFormatException multipleProvidersForDataformat(String dataFormatName) {
69
+ return new SpinDataFormatException(exceptionMessage("008", "Multiple providers found for dataformat '{}'", dataFormatName));
70
+ }
71
+
72
+ public void logDataFormats(Collection<DataFormat<?>> formats) {
73
+ if (isInfoEnabled()) {
74
+ for (DataFormat<?> format : formats) {
75
+ logDataFormat(format);
76
+ }
77
+ }
78
+ }
79
+
80
+ protected void logDataFormat(DataFormat<?> dataFormat) {
81
+ logInfo("009", "Discovered Spin data format: {}[name = {}]", dataFormat.getClass().getName(), dataFormat.getName());
82
+ }
83
+
84
+ public void logDataFormatProvider(DataFormatProvider provider) {
85
+ if (isInfoEnabled()) {
86
+ logInfo("010", "Discovered Spin data format provider: {}[name = {}]",
87
+ provider.getClass().getName(), provider.getDataFormatName());
88
+ }
89
+ }
90
+
91
+ @SuppressWarnings("rawtypes")
92
+ public void logDataFormatConfigurator(DataFormatConfigurator configurator) {
93
+ if (isInfoEnabled()) {
94
+ logInfo("011", "Discovered Spin data format configurator: {}[dataformat = {}]",
95
+ configurator.getClass(), configurator.getDataFormatClass().getName());
96
+ }
97
+ }
98
+
99
+
100
+ public SpinDataFormatException classNotFound(String classname, ClassNotFoundException cause) {
101
+ return new SpinDataFormatException(exceptionMessage("012", "Class {} not found ", classname), cause);
102
+ }
103
+
104
+ public void tryLoadingClass(String classname, ClassLoader cl) {
105
+ logDebug("013", "Try loading class '{}' using classloader '{}'.", classname, cl);
106
+ }
107
+ }
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/impl/logging/SpinLogger.java ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ package org.camunda.spin.impl.logging;
18
+
19
+ import org.camunda.commons.logging.BaseLogger;
20
+
21
+ /**
22
+ * @author Daniel Meyer
23
+ *
24
+ */
25
+ public abstract class SpinLogger extends BaseLogger {
26
+
27
+ public static final String PROJECT_CODE = "SPIN";
28
+
29
+ public static final SpinCoreLogger CORE_LOGGER = BaseLogger.createLogger(SpinCoreLogger.class, PROJECT_CODE, "org.camunda.spin", "01");
30
+
31
+ }
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/impl/util/RewindableReader.java ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ package org.camunda.spin.impl.util;
18
+
19
+ import java.io.IOException;
20
+ import java.io.PushbackReader;
21
+ import java.io.Reader;
22
+
23
+ import org.camunda.spin.impl.logging.SpinCoreLogger;
24
+ import org.camunda.spin.impl.logging.SpinLogger;
25
+
26
+ /**
27
+ * Caches the initial characters that are read from the supplied {@link Reader} and
28
+ * allows to rewind these. As soon as more than <code>size</code> characters have been read,
29
+ * rewinding fails.
30
+ *
31
+ * @author Thorben Lindhauer
32
+ */
33
+ public class RewindableReader extends Reader {
34
+
35
+ private static final SpinCoreLogger LOG = SpinLogger.CORE_LOGGER;
36
+
37
+ protected PushbackReader wrappedReader;
38
+
39
+ protected char[] buffer;
40
+ protected int pos;
41
+ protected boolean rewindable;
42
+
43
+ public RewindableReader(Reader input, int size) {
44
+ this.wrappedReader = new PushbackReader(input, size);
45
+ this.buffer = new char[size];
46
+ this.pos = 0;
47
+ this.rewindable = true;
48
+ }
49
+
50
+ public int read(char[] cbuf, int off, int len) throws IOException {
51
+ int charactersRead = wrappedReader.read(cbuf, off, len);
52
+
53
+ if (charactersRead > 0) {
54
+ if (rewindable && pos + charactersRead > buffer.length) {
55
+ rewindable = false;
56
+ }
57
+
58
+ if (pos < buffer.length) {
59
+ int freeBufferSpace = buffer.length - pos;
60
+ int insertableCharacters = Math.min(charactersRead, freeBufferSpace);
61
+ System.arraycopy(cbuf, off, buffer, pos, insertableCharacters);
62
+ pos += insertableCharacters;
63
+ }
64
+ }
65
+
66
+ return charactersRead;
67
+ }
68
+
69
+ public int read() throws IOException {
70
+ int nextCharacter = wrappedReader.read();
71
+
72
+ if (nextCharacter != -1) {
73
+ if (pos < buffer.length) {
74
+ buffer[pos] = (char) nextCharacter;
75
+ pos++;
76
+ } else if (rewindable && pos >= buffer.length) {
77
+ rewindable = false;
78
+ }
79
+ }
80
+
81
+ return nextCharacter;
82
+ }
83
+
84
+ public void close() throws IOException {
85
+ wrappedReader.close();
86
+ }
87
+
88
+ public synchronized void mark(int readlimit) throws IOException {
89
+ wrappedReader.mark(readlimit);
90
+ }
91
+
92
+ public boolean markSupported() {
93
+ return wrappedReader.markSupported();
94
+ }
95
+
96
+ public synchronized void reset() throws IOException {
97
+ wrappedReader.reset();
98
+ }
99
+
100
+ public long skip(long n) throws IOException {
101
+ return wrappedReader.skip(n);
102
+ }
103
+
104
+ /**
105
+ * Rewinds the reader such that the initial characters are returned when invoking read().
106
+ *
107
+ * Throws an exception if more than the buffering limit has already been read.
108
+ * @throws IOException
109
+ */
110
+ public void rewind() throws IOException {
111
+ if (!rewindable) {
112
+ throw LOG.unableToRewindReader();
113
+ }
114
+
115
+ wrappedReader.unread(buffer, 0, pos);
116
+ pos = 0;
117
+ }
118
+
119
+ public int getRewindBufferSize() {
120
+ return buffer.length;
121
+ }
122
+
123
+ /**
124
+ *
125
+ * @return the number of characters that can still be read and rewound.
126
+ */
127
+ public int getCurrentRewindableCapacity() {
128
+ return buffer.length - pos;
129
+ }
130
+
131
+ }
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/impl/util/SpinIoUtil.java ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ package org.camunda.spin.impl.util;
18
+
19
+ import org.camunda.commons.utils.IoUtil;
20
+ import org.camunda.spin.impl.logging.SpinCoreLogger;
21
+ import org.camunda.spin.impl.logging.SpinLogger;
22
+
23
+ import java.io.*;
24
+ import java.nio.charset.Charset;
25
+
26
+ /**
27
+ * @author Daniel Meyer
28
+ *
29
+ */
30
+ public class SpinIoUtil extends IoUtil {
31
+
32
+ public static final Charset ENCODING_CHARSET = Charset.forName("UTF-8");
33
+
34
+ private static final SpinCoreLogger LOG = SpinLogger.CORE_LOGGER;
35
+
36
+ /**
37
+ * Converts a {@link OutputStream} to an {@link InputStream} by coping the data directly.
38
+ * WARNING: Do not use for large data (&gt;100MB). Only for testing purpose.
39
+ *
40
+ * @param outputStream the {@link OutputStream} to convert
41
+ * @return the resulting {@link InputStream}
42
+ */
43
+ public static InputStream convertOutputStreamToInputStream(OutputStream outputStream) {
44
+ byte[] data = ((ByteArrayOutputStream) outputStream).toByteArray();
45
+ return new ByteArrayInputStream(data);
46
+ }
47
+
48
+ /**
49
+ * Convert an {@link InputStream} to a {@link String}
50
+ *
51
+ * @param inputStream the {@link InputStream} to convert
52
+ * @return the resulting {@link String}
53
+ * @throws IOException
54
+ */
55
+ public static String getStringFromInputStream(InputStream inputStream) throws IOException {
56
+ return getStringFromInputStream(inputStream, true);
57
+ }
58
+
59
+ /**
60
+ * Convert an {@link InputStream} to a {@link String}
61
+ *
62
+ * @param inputStream the {@link InputStream} to convert
63
+ * @param trim trigger if whitespaces are trimmed in the output
64
+ * @return the resulting {@link String}
65
+ * @throws IOException
66
+ */
67
+ public static String getStringFromInputStream(InputStream inputStream, boolean trim) throws IOException {
68
+ BufferedReader bufferedReader = null;
69
+ StringBuilder stringBuilder = new StringBuilder();
70
+ try {
71
+ bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
72
+ String line;
73
+ while ((line = bufferedReader.readLine()) != null) {
74
+ if (trim) {
75
+ stringBuilder.append(line.trim());
76
+ } else {
77
+ stringBuilder.append(line).append("\n");
78
+ }
79
+ }
80
+ } finally {
81
+ closeSilently(bufferedReader);
82
+ }
83
+
84
+ return stringBuilder.toString();
85
+ }
86
+
87
+ /**
88
+ * Convert an {@link Reader} to a {@link String}
89
+ *
90
+ * @param reader the {@link Reader} to convert
91
+ * @return the resulting {@link String}
92
+ * @throws IOException
93
+ */
94
+ public static String getStringFromReader(Reader reader) throws IOException {
95
+ return getStringFromReader(reader, true);
96
+ }
97
+
98
+ /**
99
+ * Convert an {@link Reader} to a {@link String}
100
+ *
101
+ * @param reader the {@link Reader} to convert
102
+ * @param trim trigger if whitespaces are trimmed in the output
103
+ * @return the resulting {@link String}
104
+ * @throws IOException
105
+ */
106
+ public static String getStringFromReader(Reader reader, boolean trim) throws IOException {
107
+ BufferedReader bufferedReader = null;
108
+ StringBuilder stringBuilder = new StringBuilder();
109
+ try {
110
+ bufferedReader = new BufferedReader(reader);
111
+ String line;
112
+ while ((line = bufferedReader.readLine()) != null) {
113
+ if (trim) {
114
+ stringBuilder.append(line.trim());
115
+ } else {
116
+ stringBuilder.append(line).append("\n");
117
+ }
118
+ }
119
+ } finally {
120
+ closeSilently(bufferedReader);
121
+ }
122
+
123
+ return stringBuilder.toString();
124
+ }
125
+
126
+ public static Reader classpathResourceAsReader(String fileName) {
127
+ try {
128
+ File classpathFile = getClasspathFile(fileName);
129
+ return new FileReader(classpathFile);
130
+ } catch (FileNotFoundException e) {
131
+ throw LOG.fileNotFoundException(fileName, e);
132
+ }
133
+ }
134
+
135
+ public static Reader stringAsReader(String string) {
136
+ return new StringReader(string);
137
+ }
138
+
139
+ }
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/impl/util/SpinReflectUtil.java ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ package org.camunda.spin.impl.util;
18
+
19
+ import org.camunda.spin.impl.logging.SpinCoreLogger;
20
+ import org.camunda.spin.spi.DataFormat;
21
+
22
+ /**
23
+ * @author Daniel Meyer
24
+ *
25
+ */
26
+ public class SpinReflectUtil {
27
+
28
+ private final static SpinCoreLogger LOG = SpinCoreLogger.CORE_LOGGER;
29
+
30
+ /**
31
+ * Used by dataformats if they need to load a class
32
+ *
33
+ * @param classname the name of the
34
+ * @param dataFormat
35
+ * @return
36
+ */
37
+ public static Class<?> loadClass(String classname, DataFormat<?> dataFormat) {
38
+
39
+ // first try context classoader
40
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
41
+ if(cl != null) {
42
+ LOG.tryLoadingClass(classname, cl);
43
+ try {
44
+ return cl.loadClass(classname);
45
+ }
46
+ catch(Exception e) {
47
+ // ignore
48
+ }
49
+ }
50
+
51
+ // else try the classloader which loaded the dataformat
52
+ cl = dataFormat.getClass().getClassLoader();
53
+ try {
54
+ LOG.tryLoadingClass(classname, cl);
55
+ return cl.loadClass(classname);
56
+ }
57
+ catch (ClassNotFoundException e) {
58
+ throw LOG.classNotFound(classname, e);
59
+ }
60
+
61
+ }
62
+
63
+ }
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/json/SpinJsonDataFormatException.java ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ package org.camunda.spin.json;
18
+
19
+ import org.camunda.spin.spi.SpinDataFormatException;
20
+
21
+ public class SpinJsonDataFormatException extends SpinDataFormatException {
22
+
23
+ public SpinJsonDataFormatException(String message) {
24
+ super(message);
25
+ }
26
+
27
+ public SpinJsonDataFormatException(String message, Throwable cause) {
28
+ super(message, cause);
29
+ }
30
+
31
+ private static final long serialVersionUID = 1L;
32
+
33
+ }
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/json/SpinJsonException.java ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ package org.camunda.spin.json;
18
+
19
+ import org.camunda.spin.SpinRuntimeException;
20
+
21
+ /**
22
+ * @author Stefan Hentschel
23
+ */
24
+ public class SpinJsonException extends SpinRuntimeException {
25
+
26
+ private static final long serialVersionUID = 1L;
27
+
28
+ public SpinJsonException(String message) {
29
+ super(message);
30
+ }
31
+
32
+ public SpinJsonException(String message, Throwable cause) {
33
+ super(message, cause);
34
+ }
35
+ }
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/json/SpinJsonNode.java ADDED
@@ -0,0 +1,352 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ package org.camunda.spin.json;
18
+
19
+ import org.camunda.spin.Spin;
20
+ import org.camunda.spin.SpinList;
21
+ import org.camunda.spin.spi.SpinDataFormatException;
22
+
23
+ import java.util.List;
24
+ import java.util.Map;
25
+
26
+ /**
27
+ * A json node.
28
+ *
29
+ * @author Thorben Lindhauer
30
+ * @author Stefan Hentschel
31
+ */
32
+ public abstract class SpinJsonNode extends Spin<SpinJsonNode> {
33
+
34
+ /**
35
+ * Fetches the first index of the searched object in an array.
36
+ *
37
+ * @param searchObject Object for which the index should be searched.
38
+ * @return {@link Integer} index of searchObject.
39
+ * @throws SpinJsonException if the current node is not an array.
40
+ * @throws SpinJsonPropertyException if object is not found.
41
+ */
42
+ public abstract Integer indexOf(Object searchObject);
43
+
44
+ /**
45
+ * Fetches the last index of the searched object in an array.
46
+ *
47
+ * @param searchObject Object for which the index should be searched.
48
+ * @return {@link Integer} index of searchObject.
49
+ * @throws SpinJsonException if the current node is not an array.
50
+ * @throws SpinJsonPropertyException if object is not found.
51
+ */
52
+ public abstract Integer lastIndexOf(Object searchObject);
53
+
54
+ /**
55
+ * Returns {@code true} if the array contains the specified object.
56
+ *
57
+ * @param searchObject Object for which the array should be searched.
58
+ * @return {@code true} if the array contains the object.
59
+ * @throws SpinJsonException if the current node is not an array.
60
+ */
61
+ public abstract boolean contains(Object searchObject);
62
+
63
+ /**
64
+ * Check if this node is an object node.
65
+ *
66
+ * @return true if the node is an object, false otherwise
67
+ */
68
+ public abstract boolean isObject();
69
+
70
+ /**
71
+ * Check if this node has a property with the given name.
72
+ *
73
+ * @param name the name of the property
74
+ * @return true if this node has a property with this name, false otherwise
75
+ */
76
+ public abstract boolean hasProp(String name);
77
+
78
+ /**
79
+ * Get the property of this node with the given name.
80
+ *
81
+ * @param name the name of the property
82
+ * @return {@link SpinJsonNode} representation of the property
83
+ */
84
+ public abstract SpinJsonNode prop(String name);
85
+
86
+ /**
87
+ * Set a new String property in this node.
88
+ *
89
+ * @param name the name of the new property
90
+ * @param newProperty the new String property
91
+ * @return {@link SpinJsonNode} representation of the current node
92
+ */
93
+ public abstract SpinJsonNode prop(String name, String newProperty);
94
+
95
+ /**
96
+ * Set a new Number property in this node.
97
+ *
98
+ * @param name the name of the new property
99
+ * @param newProperty the new Number property
100
+ * @return {@link SpinJsonNode} representation of the current node
101
+ */
102
+ public abstract SpinJsonNode prop(String name, Number newProperty);
103
+
104
+ /**
105
+ * Set a new int property in this node.
106
+ *
107
+ * @param name the name of the new property
108
+ * @param newProperty the new int property
109
+ * @return {@link SpinJsonNode} representation of the current node
110
+ */
111
+ public abstract SpinJsonNode prop(String name, int newProperty);
112
+
113
+ /**
114
+ * Set a new float property in this node.
115
+ *
116
+ * @param name the name of the new property
117
+ * @param newProperty the new float property
118
+ * @return {@link SpinJsonNode} representation of the current node
119
+ */
120
+ public abstract SpinJsonNode prop(String name, float newProperty);
121
+
122
+ /**
123
+ * Set a new long property in this node.
124
+ *
125
+ * @param name the name of the new property
126
+ * @param newProperty the new long property
127
+ * @return {@link SpinJsonNode} representation of the current node
128
+ */
129
+ public abstract SpinJsonNode prop(String name, long newProperty);
130
+
131
+ /**
132
+ * Set a new boolean property in this node.
133
+ *
134
+ * @param name the name of the new property
135
+ * @param newProperty the new boolean property
136
+ * @return {@link SpinJsonNode} representation of the current node
137
+ */
138
+ public abstract SpinJsonNode prop(String name, boolean newProperty);
139
+
140
+ /**
141
+ * Set a new Boolean property in this node.
142
+ *
143
+ * @param name the name of the new property
144
+ * @param newProperty the new Boolean property
145
+ * @return {@link SpinJsonNode} representation of the current node
146
+ */
147
+ public abstract SpinJsonNode prop(String name, Boolean newProperty);
148
+
149
+ /**
150
+ * Set a new List property in this node.
151
+ *
152
+ * @param name the name of the new property
153
+ * @param newProperty the new List property
154
+ * @return {@link SpinJsonNode} representation of the current node
155
+ */
156
+ public abstract SpinJsonNode prop(String name, List<Object> newProperty);
157
+
158
+ /**
159
+ * Set a new Map property in this node.
160
+ *
161
+ * @param name the name of the new property
162
+ * @param newProperty the new Map property
163
+ * @return {@link SpinJsonNode} representation of the current node
164
+ */
165
+ public abstract SpinJsonNode prop(String name, Map<String, Object> newProperty);
166
+
167
+ /**
168
+ * Set a new SpinJsonNode Object property in this node.
169
+ *
170
+ * @param name the name of the new property
171
+ * @param newProperty the new SpinJsonNode Object property
172
+ * @return {@link SpinJsonNode} representation of the current node
173
+ */
174
+ public abstract SpinJsonNode prop(String name, SpinJsonNode newProperty);
175
+
176
+ /**
177
+ * Remove a property of the given node by name.
178
+ * @param name name of the property
179
+ * @return {@link SpinJsonNode} representation of the current node
180
+ */
181
+ public abstract SpinJsonNode deleteProp(String name);
182
+
183
+ /**
184
+ * Removes a number of properties by a given list of names.
185
+ * @param names list of names
186
+ * @return {@link SpinJsonNode} representation of the current node
187
+ */
188
+ public abstract SpinJsonNode deleteProp(List<String> names);
189
+
190
+ /**
191
+ * Appends a object to the end of the current array node
192
+ * @param property property which should be append
193
+ * @return {@link SpinJsonNode} representation of the current node
194
+ */
195
+ public abstract SpinJsonNode append(Object property);
196
+
197
+ /**
198
+ * Appends an object at a specific point in an array
199
+ *
200
+ * @param index Index in current node where the new property should be appended.
201
+ * @param property Object which should be appended.
202
+ * @return {@link SpinJsonNode} representation of the current node.
203
+ * @throws IllegalArgumentException if index is out of bound.
204
+ */
205
+ public abstract SpinJsonNode insertAt(int index, Object property);
206
+
207
+ /**
208
+ * Inserts an object BEFORE an specific object in an array
209
+ *
210
+ * @param searchObject Object which is searched
211
+ * @param insertObject Object which will be inserted
212
+ * @return {@link SpinJsonNode} representation of the current node
213
+ */
214
+ public abstract SpinJsonNode insertBefore(Object searchObject, Object insertObject);
215
+
216
+ /**
217
+ * Inserts an object AFTER an specific object in an array
218
+ *
219
+ * @param searchObject Object which is searched
220
+ * @param insertObject Object which will be inserted
221
+ * @return {@link SpinJsonNode} representation of the current node
222
+ */
223
+ public abstract SpinJsonNode insertAfter(Object searchObject, Object insertObject);
224
+
225
+ /**
226
+ * Removes the first appearance of an object from the current array
227
+ *
228
+ * @param property object which should be deleted
229
+ * @return {@link SpinJsonNode} representation of the current node
230
+ */
231
+ public abstract SpinJsonNode remove(Object property);
232
+
233
+ /**
234
+ * Removes the last appearance of an object from the current array
235
+ *
236
+ * @param property object which should be deleted
237
+ * @return {@link SpinJsonNode} representation of the current node
238
+ *
239
+ */
240
+ public abstract SpinJsonNode removeLast(Object property);
241
+
242
+ /**
243
+ * removes an object at the specific index of the current array
244
+ *
245
+ * @param index Index of the array
246
+ * @return {@link SpinJsonNode} representation of the current node
247
+ * @throws IllegalArgumentException if index is out of bound.
248
+ */
249
+ public abstract SpinJsonNode removeAt(int index);
250
+
251
+ /**
252
+ * Check if this node is a boolean value.
253
+ *
254
+ * @return true if this node is a boolean value, false otherwise
255
+ */
256
+ public abstract Boolean isBoolean();
257
+
258
+ /**
259
+ * Get this node as a boolean value.
260
+ *
261
+ * @return the boolean value of this node
262
+ * @throws SpinDataFormatException if this node is not a boolean value
263
+ */
264
+ public abstract Boolean boolValue();
265
+
266
+ /**
267
+ * Check if this node is a number value.
268
+ *
269
+ * @return true if this node is a number value, false otherwise
270
+ */
271
+ public abstract Boolean isNumber();
272
+
273
+ /**
274
+ * Get this node as a number value.
275
+ *
276
+ * @return the number value of this node
277
+ * @throws SpinDataFormatException if this node is not a number value
278
+ */
279
+ public abstract Number numberValue();
280
+
281
+ /**
282
+ * Check if this node is a string value.
283
+ *
284
+ * @return true if this node is a string value, false otherwise
285
+ */
286
+ public abstract Boolean isString();
287
+
288
+ /**
289
+ * Get this node as a string value.
290
+ *
291
+ * @return the string value of this node
292
+ * @throws SpinDataFormatException if this node is not a string value
293
+ */
294
+ public abstract String stringValue();
295
+
296
+ /**
297
+ * Check if this node represents a null value.
298
+ *
299
+ * @return true if this node is a null value, false otherwise
300
+ */
301
+ public abstract Boolean isNull();
302
+
303
+ /**
304
+ * Check if this node is a value.
305
+ *
306
+ * @return true if this node is a value, false otherwise
307
+ */
308
+ public abstract Boolean isValue();
309
+
310
+ /**
311
+ * Gets the actual value of the node, in case it is a Boolean/String/Number/Null node.
312
+ * In that case a Java Boolean/String/Number or null is returned.
313
+ *
314
+ * @return the value of this node
315
+ * @throws SpinDataFormatException if this node is not a Boolean/String/Number/Nul value
316
+ */
317
+ public abstract Object value();
318
+
319
+ /**
320
+ * Check if this node is a array value.
321
+ *
322
+ * @return true if this node is a array value, false otherwise
323
+ */
324
+ public abstract Boolean isArray();
325
+
326
+ /**
327
+ * Get this node as list.
328
+ * If the current node is an array, this method returns a {@link SpinList} which contains copies of all
329
+ * JSON nodes contained in the current node. Changes to the the elements in the list will not propagate
330
+ * to the original nodes.
331
+ *
332
+ * @return the list value of this node
333
+ * @throws SpinDataFormatException if this node is not an array
334
+ */
335
+ public abstract SpinList<SpinJsonNode> elements();
336
+
337
+ /**
338
+ * Get the field names of this node (i.e. the property names).
339
+ *
340
+ * @return the list of field names
341
+ * @throws SpinDataFormatException if this node is not a array value
342
+ */
343
+ public abstract List<String> fieldNames();
344
+
345
+ /**
346
+ * Creates a JsonPath query on this element.
347
+ *
348
+ * @param expression the JsonPath expression
349
+ * @return the JsonPath query
350
+ */
351
+ public abstract SpinJsonPathQuery jsonPath(String expression);
352
+ }
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/json/SpinJsonPathException.java ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ package org.camunda.spin.json;
18
+
19
+ import org.camunda.spin.SpinRuntimeException;
20
+
21
+ /**
22
+ * @author Stefan Hentschel
23
+ */
24
+ public class SpinJsonPathException extends SpinRuntimeException {
25
+
26
+ private static final long serialVersionUID = 1L;
27
+
28
+ public SpinJsonPathException(String message) {
29
+ super(message);
30
+ }
31
+
32
+ public SpinJsonPathException(String message, Throwable cause) {
33
+ super(message, cause);
34
+ }
35
+ }
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/json/SpinJsonPathQuery.java ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ package org.camunda.spin.json;
18
+
19
+ import org.camunda.spin.SpinList;
20
+
21
+ /**
22
+ * @author Stefan Hentschel
23
+ */
24
+ public interface SpinJsonPathQuery {
25
+
26
+ /**
27
+ * Fetches the node from the result of JsonPath.
28
+ *
29
+ * @return {@link SpinJsonNode} representation of the found node
30
+ * @throws SpinJsonPathException if node value is not a valid json path expression or the path is not found.
31
+ */
32
+ SpinJsonNode element();
33
+
34
+ /**
35
+ * Fetches the list of nodes from the result of JsonPath.
36
+ *
37
+ * @return {@link SpinList} list of found nodes
38
+ * @throws SpinJsonDataFormatException if node value is not Array.
39
+ */
40
+ SpinList<SpinJsonNode> elementList();
41
+
42
+ /**
43
+ * Fetches the string value from the result of JsonPath.
44
+ *
45
+ * @return String value of found node
46
+ * @throws SpinJsonDataFormatException if node value is not String.
47
+ */
48
+ String stringValue();
49
+
50
+ /**
51
+ * Fetches the number value from the result of JsonPath.
52
+ *
53
+ * @return Number value of found node
54
+ * @throws SpinJsonDataFormatException if node value is not Number.
55
+ */
56
+ Number numberValue();
57
+
58
+ /**
59
+ * Fetches the boolean value from the result of JsonPath.
60
+ *
61
+ * @return Boolean value of found node
62
+ * @throws SpinJsonDataFormatException if node value is not Boolean.
63
+ */
64
+ Boolean boolValue();
65
+ }
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/json/SpinJsonPropertyException.java ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ package org.camunda.spin.json;
18
+
19
+ /**
20
+ * @author Stefan Hentschel
21
+ */
22
+ public class SpinJsonPropertyException extends SpinJsonException {
23
+
24
+ private static final long serialVersionUID = 1L;
25
+
26
+ public SpinJsonPropertyException(String message) {
27
+ super(message);
28
+ }
29
+
30
+ public SpinJsonPropertyException(String message, Throwable cause) {
31
+ super(message, cause);
32
+ }
33
+ }
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/scripting/SpinScriptEnv.java ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ package org.camunda.spin.scripting;
18
+
19
+ import org.camunda.spin.SpinScriptException;
20
+ import org.camunda.spin.impl.logging.SpinCoreLogger;
21
+ import org.camunda.spin.impl.logging.SpinLogger;
22
+ import org.camunda.spin.impl.util.SpinIoUtil;
23
+
24
+ import javax.script.ScriptEngine;
25
+
26
+ import java.io.InputStream;
27
+ import java.util.HashMap;
28
+ import java.util.Map;
29
+
30
+ /**
31
+ * Spin provides a set of environment scripts for known scripting languages.
32
+ * These scripts make it easier to use spin in a scripting language. Users can
33
+ * execute these scripts before they execute their custom scripts.
34
+ *
35
+ * @author Daniel Meyer
36
+ *
37
+ */
38
+ public class SpinScriptEnv {
39
+
40
+ private static final SpinCoreLogger LOG = SpinLogger.CORE_LOGGER;
41
+
42
+ private static final String ENV_PATH_TEMPLATE = "script/env/%s/spin.%s";
43
+
44
+ /**
45
+ * Mapping of known {@link ScriptEngine} language names and
46
+ * file extensions of corresponding script files.
47
+ */
48
+ public static final Map<String,String> extensions = new HashMap<String, String>();
49
+ static {
50
+ extensions.put("python", "py");
51
+ extensions.put("javascript", "js");
52
+ extensions.put("groovy", "groovy");
53
+ extensions.put("ruby", "rb");
54
+ }
55
+
56
+ /**
57
+ * Get file extension for script language.
58
+ *
59
+ * @param language the language name
60
+ * @return the file extension as string or null if the language is not in the set of languages supported by spin
61
+ */
62
+ public static String getExtension(String language) {
63
+ language = language.toLowerCase();
64
+ if("ecmascript".equals(language)) {
65
+ language = "javascript";
66
+ }
67
+ return extensions.get(language);
68
+ }
69
+
70
+ /**
71
+ * Get the spin scripting environment
72
+ *
73
+ * @param language the language name
74
+ * @return the environment script as string or null if the language is
75
+ * not in the set of languages supported by spin.
76
+ */
77
+ public static String get(String language) {
78
+ language = language.toLowerCase();
79
+ if("ecmascript".equals(language)) {
80
+ language = "javascript";
81
+ }
82
+
83
+ String extension = extensions.get(language);
84
+ if(extension == null) {
85
+ return null;
86
+
87
+ } else {
88
+ return loadScriptEnv(language, extension);
89
+
90
+ }
91
+ }
92
+
93
+ protected static String loadScriptEnv(String language, String extension) {
94
+ String scriptEnvPath = String.format(ENV_PATH_TEMPLATE, language, extension);
95
+ InputStream envResource = SpinScriptException.class.getClassLoader().getResourceAsStream(scriptEnvPath);
96
+
97
+ if(envResource == null) {
98
+ throw LOG.noScriptEnvFoundForLanguage(language, scriptEnvPath);
99
+
100
+ } else {
101
+ try {
102
+ return SpinIoUtil.inputStreamAsString(envResource);
103
+
104
+ } finally {
105
+ SpinIoUtil.closeSilently(envResource);
106
+
107
+ }
108
+ }
109
+ }
110
+
111
+ }
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/spi/DataFormat.java ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ package org.camunda.spin.spi;
18
+
19
+ import org.camunda.spin.Spin;
20
+
21
+ /**
22
+ *
23
+ * @author Sebastian Menski
24
+ * @author Daniel Meyer
25
+ */
26
+ public interface DataFormat<T extends Spin<?>> {
27
+
28
+ String getName();
29
+
30
+ Class<? extends T> getWrapperType();
31
+
32
+ T createWrapperInstance(Object parameter);
33
+
34
+ DataFormatReader getReader();
35
+
36
+ DataFormatWriter getWriter();
37
+
38
+ /**
39
+ * @return the DataFormatMapper used by this data format
40
+ */
41
+ DataFormatMapper getMapper();
42
+
43
+ }
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/spi/DataFormatConfigurator.java ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ package org.camunda.spin.spi;
18
+
19
+ /**
20
+ * <p>Can be used to configure data formats of a certain type.
21
+ * An implementation will be supplied with all discovered data formats
22
+ * of the specified class. {@link DataFormat#getName()} may be used to further
23
+ * restrict configuration to data formats with a specific name.</p>
24
+ *
25
+ * @author Thorben Lindhauer
26
+ */
27
+ public interface DataFormatConfigurator<T extends DataFormat<?>> {
28
+
29
+ /**
30
+ * @return the dataformat class this configurator can configure (including subclasses)
31
+ */
32
+ Class<T> getDataFormatClass();
33
+
34
+ /**
35
+ * Applies configuration to the desired format.
36
+ * This method is invoked with all dataformats of the required type.
37
+ */
38
+ void configure(T dataFormat);
39
+ }
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/spi/DataFormatMapper.java ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ package org.camunda.spin.spi;
18
+
19
+ import org.camunda.spin.DeserializationTypeValidator;
20
+
21
+ /**
22
+ * Maps a java object to the data format's internal representation and vice versa.
23
+ *
24
+ * @author Thorben Lindhauer
25
+ */
26
+ public interface DataFormatMapper {
27
+
28
+ /**
29
+ * Returns true if this mapper can map the provided Java Object.
30
+ *
31
+ * @param parameter the java object to check
32
+ * @return true if this object can be mapped.
33
+ */
34
+ public boolean canMap(Object parameter);
35
+
36
+ /**
37
+ * Maps a java object to a data format's internal data representation.
38
+ *
39
+ * @param parameter object that is mapped
40
+ * @return the data format's internal representation of that object
41
+ */
42
+ public Object mapJavaToInternal(Object parameter);
43
+
44
+ /**
45
+ * Maps the internal representation of a data format to a java object of the
46
+ * desired class. The desired class is not validated prior to the mapping.
47
+ *
48
+ * @param parameter the object to be mapped
49
+ * @param type the class to map the object to
50
+ * @return a java object of the specified class that was populated with the input
51
+ * parameter
52
+ */
53
+ public <T> T mapInternalToJava(Object parameter, Class<T> type);
54
+
55
+ /**
56
+ * Maps the internal representation of a data format to a java object of the
57
+ * desired class. The desired class is validated by the <code>validator</code>
58
+ * prior to the mapping.
59
+ *
60
+ * @param parameter the object to be mapped
61
+ * @param type the class to map the object to
62
+ * @param validator the validator for the target class
63
+ * @return a java object of the specified class that was populated with the input
64
+ * parameter
65
+ */
66
+
67
+ public <T> T mapInternalToJava(Object parameter, Class<T> type, DeserializationTypeValidator validator);
68
+
69
+ /**
70
+ * Maps the internal representation of a data format to a java object of the
71
+ * desired class. The type identifier is given in a data format specific format. Its
72
+ * interpretation is data-format-specific. For example, it can be used to express generic
73
+ * type information that cannot be expressed by a {@link Class} object.
74
+ * The desired class is not validated prior to the mapping.
75
+ *
76
+ * @param parameter the object to be mapped
77
+ * @param typeIdentifier a data-format-specific type identifier that describes
78
+ * the class to map to
79
+ * @return a java object of the specified type that was populated with the input
80
+ * parameter
81
+ */
82
+ public <T> T mapInternalToJava(Object parameter, String typeIdentifier);
83
+
84
+ /**
85
+ * Maps the internal representation of a data format to a java object of the
86
+ * desired class. The type identifier is given in a data format specific format. Its
87
+ * interpretation is data-format-specific. For example, it can be used to express generic
88
+ * type information that cannot be expressed by a {@link Class} object.
89
+ * The desired class is validated by the <code>validator</code> prior to the mapping.
90
+ *
91
+ * @param parameter the object to be mapped
92
+ * @param typeIdentifier a data-format-specific type identifier that describes
93
+ * the class to map to
94
+ * @param validator the validator for the target class
95
+ * @return a java object of the specified type that was populated with the input
96
+ * parameter
97
+ */
98
+ public <T> T mapInternalToJava(Object parameter, String typeIdentifier, DeserializationTypeValidator validator);
99
+
100
+ String getCanonicalTypeName(Object object);
101
+ }
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/spi/DataFormatProvider.java ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ package org.camunda.spin.spi;
18
+
19
+ import java.util.Map;
20
+
21
+ /**
22
+ * @author Daniel Meyer
23
+ *
24
+ */
25
+ public interface DataFormatProvider {
26
+
27
+ /**
28
+ * @return the name of the data format provided by the implementation
29
+ */
30
+ String getDataFormatName();
31
+
32
+ /**
33
+ * @return an instance of the data format provided by this implementation
34
+ */
35
+ DataFormat<?> createInstance();
36
+
37
+ /**
38
+ * @return an instance of the data format provided by this implementation configured using the
39
+ * passed configuration properties.
40
+ */
41
+ default DataFormat<?> createInstance(Map<String, Object> configurationProperties) {
42
+ return createInstance();
43
+ };
44
+
45
+ }
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/spi/DataFormatReader.java ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ package org.camunda.spin.spi;
18
+
19
+ import java.io.Reader;
20
+
21
+ import org.camunda.spin.Spin;
22
+
23
+ /**
24
+ * Reads the internal representation of a {@link Spin} object from its serialized representation.
25
+ *
26
+ * @author Daniel Meyer
27
+ * @author Sebastian Menski
28
+ * @author Thorben Lindhauer
29
+ *
30
+ */
31
+ public interface DataFormatReader {
32
+
33
+ /**
34
+ * Returns true if this reader estimates to be able to consume the input data.
35
+ * Implementations may not read more than <code>readLimit</code>
36
+ * bytes from the supplied reader.
37
+ *
38
+ * @param reader reader that can be read from to detect a data format
39
+ * @param readLimit positive number that poses a restriction on how many characters
40
+ * an implementation may read. Reading beyond this limit may lead to incomplete
41
+ * input when the method {@link #readInput(Reader)} is invoked.
42
+ * @return true if this reader is able to consume the input
43
+ */
44
+ boolean canRead(Reader reader, int readLimit);
45
+
46
+ /**
47
+ * Read (or parse) a reader into this data format's input structure.
48
+ * For example, an Xml-Based data format may return an
49
+ * internal tree structure which can be used for traversing the xml tree.
50
+ *
51
+ * @param reader a {@link Reader} providing the data source
52
+ * @return the read or parsed input
53
+ * @throws SpinDataFormatException in case the reader cannot read the input
54
+ */
55
+ Object readInput(Reader reader);
56
+
57
+ }
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/spi/DataFormatWriter.java ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ package org.camunda.spin.spi;
18
+
19
+ import java.io.Writer;
20
+
21
+ /**
22
+ * @author Daniel Meyer
23
+ *
24
+ */
25
+ public interface DataFormatWriter {
26
+
27
+ /**
28
+ * Writes the internal representation, as provided by <code>input</code>
29
+ * to the supplied <code>writer</code> according to the data format
30
+ * that the implementation belongs to.
31
+ * For example, an XML data format writer writes XML.
32
+ *
33
+ * @param writer The writer to write the output to
34
+ * @param input The object to write. Can be safely cast to the internal
35
+ * format of the data format.
36
+ */
37
+ public void writeToWriter(Writer writer, Object input);
38
+
39
+ }
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/spi/SpinDataFormatException.java ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ package org.camunda.spin.spi;
18
+
19
+ import org.camunda.spin.SpinRuntimeException;
20
+
21
+ /**
22
+ * Indicates an error in the underlying DataFormat layer
23
+ *
24
+ * @author Daniel Meyer
25
+ *
26
+ */
27
+ public class SpinDataFormatException extends SpinRuntimeException {
28
+
29
+ private static final long serialVersionUID = 1L;
30
+
31
+ public SpinDataFormatException(String message, Throwable cause) {
32
+ super(message, cause);
33
+ }
34
+
35
+ public SpinDataFormatException(String message) {
36
+ super(message);
37
+ }
38
+
39
+ }
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/spi/TextBasedDataFormatReader.java ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ package org.camunda.spin.spi;
18
+
19
+ import java.io.IOException;
20
+ import java.io.Reader;
21
+ import java.util.regex.Pattern;
22
+
23
+ import org.camunda.spin.impl.logging.SpinCoreLogger;
24
+
25
+ /**
26
+ * Can be used as a base class to determine whether an input reader
27
+ * is readable by applying regular expression matching.
28
+ *
29
+ * @author Lindhauer
30
+ */
31
+ public abstract class TextBasedDataFormatReader implements DataFormatReader {
32
+
33
+ private static final SpinCoreLogger LOG = SpinCoreLogger.CORE_LOGGER;
34
+
35
+ public boolean canRead(Reader input, int readLimit) {
36
+ char[] firstCharacters = new char[readLimit];
37
+
38
+ try {
39
+ input.read(firstCharacters, 0, readLimit);
40
+ } catch (IOException e) {
41
+ throw LOG.unableToReadFromReader(e);
42
+ }
43
+
44
+
45
+ Pattern pattern = getInputDetectionPattern();
46
+
47
+ return pattern.matcher(new String(firstCharacters)).find();
48
+ }
49
+
50
+ protected abstract Pattern getInputDetectionPattern();
51
+ }
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/spi/TypeDetector.java ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ package org.camunda.spin.spi;
18
+
19
+ /**
20
+ * Detects the canonical type string of a supplied object
21
+ *
22
+ * @author Thorben Lindhauer
23
+ */
24
+ public interface TypeDetector {
25
+
26
+ boolean canHandle(Object object);
27
+
28
+ String detectType(Object object);
29
+ }
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/xml/SpinXPathException.java ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ package org.camunda.spin.xml;
18
+
19
+ import org.camunda.spin.SpinRuntimeException;
20
+
21
+ /**
22
+ * Indicates an error during a XPath evaluation.
23
+ *
24
+ * @author Sebastian Menski
25
+ */
26
+ public class SpinXPathException extends SpinRuntimeException {
27
+
28
+ private static final long serialVersionUID = 1L;
29
+
30
+ public SpinXPathException(String message, Throwable cause) {
31
+ super(message, cause);
32
+ }
33
+
34
+ public SpinXPathException(String message) {
35
+ super(message);
36
+ }
37
+ }
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/xml/SpinXPathQuery.java ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ package org.camunda.spin.xml;
18
+
19
+ import org.camunda.spin.SpinList;
20
+
21
+ import java.util.Map;
22
+
23
+ /**
24
+ * @author Sebastian Menski
25
+ */
26
+ public abstract class SpinXPathQuery {
27
+
28
+ /**
29
+ * Returns the XPath query result as element.
30
+ *
31
+ * @return the wrapped XML element
32
+ */
33
+ public abstract SpinXmlElement element();
34
+
35
+ /**
36
+ * Returns the XPath query result as a element list.
37
+ *
38
+ * @return the wrapped XML element list
39
+ */
40
+ public abstract SpinList<SpinXmlElement> elementList();
41
+
42
+ /**
43
+ * Returns the XPath query result as attribute.
44
+ *
45
+ * @return the wrapped XML attribute
46
+ */
47
+ public abstract SpinXmlAttribute attribute();
48
+
49
+ /**
50
+ * Returns the XPath query result as a attribute list.
51
+ *
52
+ * @return the wrapped XML attribute list
53
+ */
54
+ public abstract SpinList<SpinXmlAttribute> attributeList();
55
+
56
+ /**
57
+ * Returns the XPath query result as a string.
58
+ *
59
+ * @return the string result
60
+ */
61
+ public abstract String string();
62
+
63
+ /**
64
+ * Returns the XPath query result as a double.
65
+ *
66
+ * @return the double result
67
+ */
68
+ public abstract Double number();
69
+
70
+ /**
71
+ * Returns the XPath query result as a boolean.
72
+ *
73
+ * @return the boolean result
74
+ */
75
+ public abstract Boolean bool();
76
+
77
+ /**
78
+ * Maps a prefix, uri pair to a namespace.
79
+ *
80
+ * @param prefix prefix for the namespace.
81
+ * @param namespace uri of the namespace
82
+ * @return itself
83
+ */
84
+ public abstract SpinXPathQuery ns(String prefix, String namespace);
85
+
86
+ /**
87
+ * Maps a map of prefix, uri pairs to namespaces
88
+ * @param namespaces Map of the prefix, uri pairs.
89
+ * @return itself
90
+ */
91
+ public abstract SpinXPathQuery ns(Map<String, String> namespaces);
92
+
93
+ }
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/xml/SpinXmlAttribute.java ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ package org.camunda.spin.xml;
18
+
19
+ import java.io.Writer;
20
+
21
+ /**
22
+ * An attribute in a tree-oriented XML data format.
23
+ *
24
+ * @author Sebastian Menski
25
+ * @author Daniel Meyer
26
+ *
27
+ */
28
+ public abstract class SpinXmlAttribute extends SpinXmlNode<SpinXmlAttribute> {
29
+
30
+ /**
31
+ * Returns the value of the attribute as {@link String}.
32
+ *
33
+ * @return the string value of the attribute
34
+ */
35
+ public abstract String value();
36
+
37
+ /**
38
+ * Sets the value of the attribute.
39
+ *
40
+ * @param value the value to set
41
+ * @return the wrapped xml dom attribute
42
+ * @throws SpinXmlNodeException if the value is null
43
+ */
44
+ public abstract SpinXmlAttribute value(String value);
45
+
46
+ /**
47
+ * Removes the attribute.
48
+ *
49
+ * @return the wrapped owner {@link SpinXmlElement tree element}
50
+ */
51
+ public abstract SpinXmlElement remove();
52
+
53
+ /**
54
+ * Returns the wrapped XML attribute value as string representation.
55
+ *
56
+ * @return the string representation
57
+ */
58
+ public abstract String toString();
59
+
60
+ /**
61
+ * Writes the wrapped XML attribute value to an existing writer.
62
+ *
63
+ * @param writer the writer to write to
64
+ */
65
+ public abstract void writeToWriter(Writer writer);
66
+
67
+ }
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/xml/SpinXmlAttributeException.java ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ package org.camunda.spin.xml;
18
+
19
+ /**
20
+ * Indicates an error in the underlying xml tree attribute.
21
+ *
22
+ * @author Sebastian Menski
23
+ */
24
+ public class SpinXmlAttributeException extends SpinXmlNodeException {
25
+
26
+ private static final long serialVersionUID = 1L;
27
+
28
+ public SpinXmlAttributeException(String message) {
29
+ super(message);
30
+ }
31
+
32
+ public SpinXmlAttributeException(String message, Throwable cause) {
33
+ super(message, cause);
34
+ }
35
+ }
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/xml/SpinXmlDataFormatException.java ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ package org.camunda.spin.xml;
18
+
19
+ import org.camunda.spin.spi.SpinDataFormatException;
20
+
21
+ /**
22
+ * @author Daniel Meyer
23
+ *
24
+ */
25
+ public class SpinXmlDataFormatException extends SpinDataFormatException {
26
+
27
+ private static final long serialVersionUID = 1L;
28
+
29
+ public SpinXmlDataFormatException(String message, Throwable cause) {
30
+ super(message, cause);
31
+ }
32
+
33
+ public SpinXmlDataFormatException(String message) {
34
+ super(message);
35
+ }
36
+
37
+ }
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/xml/SpinXmlElement.java ADDED
@@ -0,0 +1,323 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ package org.camunda.spin.xml;
18
+
19
+ import java.io.Writer;
20
+ import java.util.Collection;
21
+ import java.util.List;
22
+
23
+ import org.camunda.spin.SpinList;
24
+
25
+ /**
26
+ * An element in a tree-oriented XML data format.
27
+ *
28
+ * @author Sebastian Menski
29
+ * @author Daniel Meyer
30
+ *
31
+ */
32
+ public abstract class SpinXmlElement extends SpinXmlNode<SpinXmlElement> {
33
+
34
+ /**
35
+ * Checks whether this element has a attribute with an empty namespace and the given name.
36
+ *
37
+ * @param attributeName the name of the attribute
38
+ * @return true if the element has an attribute with this name under the local namespace, false otherwise
39
+ * @throws IllegalArgumentException if the attributeName is null
40
+ */
41
+ public abstract boolean hasAttr(String attributeName);
42
+
43
+ /**
44
+ * Returns the wrapped attribute for an empty namespace and the given name.
45
+ *
46
+ * @param attributeName the name of the attribute
47
+ * @return the wrapped {@link SpinXmlAttribute attribute}
48
+ * @throws IllegalArgumentException if the attributeName is null
49
+ * @throws SpinXmlAttributeException if the attribute is not found
50
+ */
51
+ public abstract SpinXmlAttribute attr(String attributeName);
52
+
53
+ /**
54
+ * Sets the attribute value in the local namespace of this element.
55
+ *
56
+ * @param attributeName the name of the attribute
57
+ * @param value the value to set
58
+ * @return the wrapped {@link SpinXmlElement element}
59
+ * @throws IllegalArgumentException if the attributeName or value is null
60
+ */
61
+ public abstract SpinXmlElement attr(String attributeName, String value);
62
+
63
+ /**
64
+ * Removes the attribute with an empty namespace.
65
+ *
66
+ * @param attributeName the name of the attribute
67
+ * @return the wrapped {@link SpinXmlElement element}
68
+ * @throws IllegalArgumentException if the attributeName is null
69
+ */
70
+ public abstract SpinXmlElement removeAttr(String attributeName);
71
+
72
+ /**
73
+ * Checks whether this element has a attribute with the given namespace and name.
74
+ *
75
+ * @param namespace the namespace of the attribute
76
+ * @param attributeName the name of the attribute
77
+ * @return true if the element has an attribute with this name under given namespace, false otherwise
78
+ * @throws IllegalArgumentException if the attributeName is null
79
+ */
80
+ public abstract boolean hasAttrNs(String namespace, String attributeName);
81
+
82
+ /**
83
+ * Returns the wrapped attribute for the given namespace and name.
84
+ *
85
+ * @param namespace the namespace of the attribute
86
+ * @param attributeName the name of the attribute
87
+ * @return the wrapped {@link SpinXmlAttribute attribute}
88
+ * @throws IllegalArgumentException if attributeName or value is null
89
+ * @throws SpinXmlElementImplementationException if the attribute cannot be set in the underlying implementation
90
+ */
91
+ public abstract SpinXmlAttribute attrNs(String namespace, String attributeName);
92
+
93
+ /**
94
+ * Sets the attribute value in the given namespace.
95
+ *
96
+ * @param namespace the namespace of the attribute
97
+ * @param attributeName the name of the attribute
98
+ * @param value the value to set
99
+ * @return the wrapped {@link SpinXmlElement element}
100
+ * @throws IllegalArgumentException if attributeName or value is null
101
+ * @throws SpinXmlElementImplementationException if the attribute cannot be set in the underlying implementation
102
+ */
103
+ public abstract SpinXmlElement attrNs(String namespace, String attributeName, String value);
104
+
105
+ /**
106
+ * Removes the attribute under the given namespace.
107
+ *
108
+ * @param namespace the namespace of the attribute
109
+ * @param attributeName the name of the attribute
110
+ * @return the wrapped {@link SpinXmlElement element}
111
+ * @throws IllegalArgumentException if the attributeName is null
112
+ */
113
+ public abstract SpinXmlElement removeAttrNs(String namespace, String attributeName);
114
+
115
+ /**
116
+ * Returns all wrapped attributes of this element.
117
+ *
118
+ * @return the wrapped attributes or an empty list of no attributes are found
119
+ */
120
+ public abstract SpinList<SpinXmlAttribute> attrs();
121
+
122
+ /**
123
+ * Returns all wrapped attributes for the given namespace.
124
+ *
125
+ * @param namespace the namespace of the attributes
126
+ * @return the wrapped attributes or an empty list of no attributes are found
127
+ */
128
+ public abstract SpinList<SpinXmlAttribute> attrs(String namespace);
129
+
130
+ /**
131
+ * Returns all names of the attributes of this element.
132
+ *
133
+ * @return the names of the attributes
134
+ */
135
+ public abstract List<String> attrNames();
136
+
137
+ /**
138
+ * Returns all names of the attributes in the given namespace.
139
+ *
140
+ * @return the names of the attributes
141
+ */
142
+ public abstract List<String> attrNames(String namespace);
143
+
144
+ /**
145
+ * Returns the text content of an element.
146
+ *
147
+ * @return the text content or an empty string if non exists
148
+ */
149
+ public abstract String textContent();
150
+
151
+ /**
152
+ * Sets the text content of an element.
153
+ * @param textContent the text content to set
154
+ * @return the wrapped {@link SpinXmlElement element}
155
+ * @throws IllegalArgumentException if the textContent is null
156
+ */
157
+ public abstract SpinXmlElement textContent(String textContent);
158
+
159
+ /**
160
+ * Returns a single wrapped child element for the given name
161
+ * in the local namespace of this element.
162
+ *
163
+ * @param elementName the element name
164
+ * @return the wrapped child {@link SpinXmlElement element}
165
+ * @throws IllegalArgumentException if the elementName is null
166
+ * @throws SpinXmlElementException if none or more than one child element is found
167
+ */
168
+ public abstract SpinXmlElement childElement(String elementName);
169
+
170
+ /**
171
+ * Returns a single wrapped child {@link SpinXmlElement element} for the given namespace
172
+ * and name.
173
+ *
174
+ * @param namespace the namespace of the element
175
+ * @param elementName the element name
176
+ * @return the wrapped child {@link SpinXmlElement element}
177
+ * @throws IllegalArgumentException if the elementName is null
178
+ * @throws SpinXmlElementException if none or more than one child element is found
179
+ */
180
+ public abstract SpinXmlElement childElement(String namespace, String elementName);
181
+
182
+ /**
183
+ * Returns all child elements of this {@link SpinXmlElement elements}.
184
+ *
185
+ * @return list of wrapped child {@link SpinXmlElement elements}
186
+ */
187
+ public abstract SpinList<SpinXmlElement> childElements();
188
+
189
+ /**
190
+ * Returns all child {@link SpinXmlElement elements} with a given name in the local namespace
191
+ * of this element.
192
+ *
193
+ * @param elementName the element name
194
+ * @return a collection of wrapped {@link SpinXmlElement elements}
195
+ * @throws IllegalArgumentException if the element name is null
196
+ * @throws SpinXmlElementException if no child element was found
197
+ */
198
+ public abstract SpinList<SpinXmlElement> childElements(String elementName);
199
+
200
+ /**
201
+ * Returns all child {@link SpinXmlElement elements} with a given namespace and name.
202
+ *
203
+ * @param namespace the namespace of the element
204
+ * @param elementName the element name
205
+ * @return a collection of wrapped {@link SpinXmlElement elements}
206
+ * @throws IllegalArgumentException if the element name is null
207
+ * @throws SpinXmlElementException if no child element was found
208
+ */
209
+ public abstract SpinList<SpinXmlElement> childElements(String namespace, String elementName);
210
+
211
+ /**
212
+ * Appends child elements to this {@link SpinXmlElement element}.
213
+ *
214
+ * @param childElements the child elements to append
215
+ * @return the wrapped {@link SpinXmlElement element}
216
+ * @throws IllegalArgumentException if the childElements is null or one of them
217
+ * @throws SpinXmlElementImplementationException if a child element cannot be appended in the underlying implementation
218
+ */
219
+ public abstract SpinXmlElement append(SpinXmlElement... childElements);
220
+
221
+ /**
222
+ * Appends child elements to this {@link SpinXmlElement element}.
223
+ *
224
+ * @param childElements the child elements to append
225
+ * @return the wrapped {@link SpinXmlElement element}
226
+ * @throws IllegalArgumentException if the childElements is null or one of them
227
+ * @throws SpinXmlElementImplementationException if a child element cannot be appended in the underlying implementation
228
+ */
229
+ public abstract SpinXmlElement append(Collection<SpinXmlElement> childElements);
230
+
231
+ /**
232
+ * Appends a child element to this element before the existing child element.
233
+ *
234
+ * @param childElement the child element to append
235
+ * @param existingChildElement the child element to append before
236
+ * @return the wrapped {@link SpinXmlElement element}
237
+ * @throws IllegalArgumentException if the child element or existing child element is null
238
+ * @throws SpinXmlElementException if the existing child element is not a child of this element
239
+ * @throws SpinXmlElementImplementationException if the new child element cannot be inserted in the underlying implementation
240
+ */
241
+ public abstract SpinXmlElement appendBefore(SpinXmlElement childElement, SpinXmlElement existingChildElement);
242
+
243
+ /**
244
+ * Appends a child element to this {@link SpinXmlElement element} after the existing child {@link SpinXmlElement element}.
245
+ *
246
+ * @param childElement the child element to append
247
+ * @param existingChildElement the child element to append after
248
+ * @return the wrapped {@link SpinXmlElement element}
249
+ * @throws IllegalArgumentException if the child element or existing child element is null
250
+ * @throws SpinXmlElementException if the existing child element is not a child of this element
251
+ * @throws SpinXmlElementImplementationException if the new child element cannot be inserted in the underlying implementation
252
+ */
253
+ public abstract SpinXmlElement appendAfter(SpinXmlElement childElement, SpinXmlElement existingChildElement);
254
+
255
+ /**
256
+ * Removes all child elements from this element.
257
+ *
258
+ * @param childElements the child elements to remove
259
+ * @return the wrapped {@link SpinXmlElement element}
260
+ * @throws IllegalArgumentException if child elements is null or any of them
261
+ * @throws SpinXmlElementException if one of the child elements does not exist
262
+ * @throws SpinXmlElementImplementationException if the child element cannot be removed in the underlying implementation
263
+ */
264
+ public abstract SpinXmlElement remove(SpinXmlElement... childElements);
265
+
266
+ /**
267
+ * Removes all child elements from this element.
268
+ *
269
+ * @param childElements the child elements to remove
270
+ * @return the wrapped {@link SpinXmlElement element}
271
+ * @throws IllegalArgumentException if child elements is null or any of them
272
+ * @throws SpinXmlElementException if one of the child elements does not exist
273
+ * @throws SpinXmlElementImplementationException if the child element cannot be removed in the underlying implementation
274
+ */
275
+ public abstract SpinXmlElement remove(Collection<SpinXmlElement> childElements);
276
+
277
+ /**
278
+ * Replaces this element by an new one.
279
+ *
280
+ * @param newChildElement the new element
281
+ * @return the new wrapped {@link SpinXmlElement element}
282
+ * @throws IllegalArgumentException if the new element is null or has the wrong type
283
+ * @throws SpinXmlElementException if this element has no parent element
284
+ * @throws SpinXmlElementImplementationException if the element cannot be replaced in the underlying implementation
285
+ */
286
+ public abstract SpinXmlElement replace(SpinXmlElement newChildElement);
287
+
288
+ /**
289
+ * Replaces an existing child element with a new one.
290
+ *
291
+ * @param existingChildElement the existing child element to replace
292
+ * @param newChildElement the new child element
293
+ * @return the wrapped {@link SpinXmlElement element}
294
+ * @throws IllegalArgumentException if any of the child elements is null
295
+ * @throws SpinXmlElementException if the existing element is not a child element of this
296
+ * @throws SpinXmlElementImplementationException if the child cannot be replaced in the underlying implementation
297
+ */
298
+ public abstract SpinXmlElement replaceChild(SpinXmlElement existingChildElement, SpinXmlElement newChildElement);
299
+
300
+ /**
301
+ * Creates a XPath query on this element.
302
+ *
303
+ * @param expression the XPath expression
304
+ * @return the XPath query
305
+ */
306
+ public abstract SpinXPathQuery xPath(String expression);
307
+
308
+ /**
309
+ * Returns the wrapped XML element as string representation.
310
+ *
311
+ * @return the string representation
312
+ * @throws SpinXmlElementException if the element cannot be transformed or no new transformer can be created
313
+ */
314
+ public abstract String toString();
315
+
316
+ /**
317
+ * Writes the wrapped XML element to a existing writer.
318
+ *
319
+ * @param writer the writer to write to
320
+ * @throws SpinXmlElementException if the element cannot be transformed or no new transformer can be created
321
+ */
322
+ public abstract void writeToWriter(Writer writer);
323
+ }
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/xml/SpinXmlElementException.java ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ package org.camunda.spin.xml;
18
+
19
+ /**
20
+ * Indicates an error in the underlying xml tree element.
21
+ *
22
+ * @author Sebastian Menski
23
+ */
24
+ public class SpinXmlElementException extends SpinXmlNodeException {
25
+
26
+ private static final long serialVersionUID = 1L;
27
+
28
+ public SpinXmlElementException(String message) {
29
+ super(message);
30
+ }
31
+
32
+ public SpinXmlElementException(String message, Throwable cause) {
33
+ super(message, cause);
34
+ }
35
+ }
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/xml/SpinXmlElementImplementationException.java ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ package org.camunda.spin.xml;
18
+
19
+ /**
20
+ * Indicates an error in the underlying xml tree element implementation.
21
+ *
22
+ * @author Sebastian Menski
23
+ */
24
+ public class SpinXmlElementImplementationException extends SpinXmlElementException {
25
+
26
+ private static final long serialVersionUID = 1L;
27
+
28
+ public SpinXmlElementImplementationException(String message) {
29
+ super(message);
30
+ }
31
+
32
+ public SpinXmlElementImplementationException(String message, Throwable cause) {
33
+ super(message, cause);
34
+ }
35
+ }
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/xml/SpinXmlNode.java ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ package org.camunda.spin.xml;
18
+
19
+ import org.camunda.spin.Spin;
20
+
21
+ /**
22
+ * An element in a tree-oriented XML data format.
23
+ *
24
+ * @author Sebastian Menski
25
+ * @author Daniel Meyer
26
+ *
27
+ */
28
+ public abstract class SpinXmlNode<T extends SpinXmlNode<?>> extends Spin<T> {
29
+
30
+ /**
31
+ * Returns the local name of the node without namespace or prefix.
32
+ *
33
+ * @return the name of the node
34
+ */
35
+ public abstract String name();
36
+
37
+ /**
38
+ * Returns the namespace uri of the node and not the prefix.
39
+ *
40
+ * @return the namespace of the node
41
+ */
42
+ public abstract String namespace();
43
+
44
+ /**
45
+ * Returns the prefix of the node and not the namespace uri.
46
+ *
47
+ * @return the prefix of the node
48
+ */
49
+ public abstract String prefix();
50
+
51
+ /**
52
+ * Checks if the node has a given prefix.
53
+ *
54
+ * @param prefix the prefix to check
55
+ * @return true if the name has the same prefix
56
+ */
57
+ public abstract boolean hasPrefix(String prefix);
58
+
59
+ /**
60
+ * Checks if the node has a given namespace.
61
+ *
62
+ * @param namespace the namespace to check
63
+ * @return true if the node has the same namespace
64
+ */
65
+ public abstract boolean hasNamespace(String namespace);
66
+
67
+ /**
68
+ * Maps XML into specific class
69
+ *
70
+ * @param type Class to which the Xml should be mapped
71
+ * @return mapped Class
72
+ *
73
+ * @throws SpinDataFormatException in case the input cannot be mapped to class for several reasons
74
+ */
75
+ public abstract <C> C mapTo(Class<C> type);
76
+
77
+ /**
78
+ * Maps Xml into specific class
79
+ *
80
+ * @param canonicalName canonical name of the class
81
+ * @return mapped class
82
+ *
83
+ * @throws SpinDataFormatException in case the input cannot be mapped to class for several reasons
84
+ */
85
+ public abstract <C> C mapTo(String canonicalName);
86
+
87
+ }
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/xml/SpinXmlNodeException.java ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ package org.camunda.spin.xml;
18
+
19
+ import org.camunda.spin.SpinRuntimeException;
20
+
21
+ /**
22
+ * Indicates an error in the underlying xml tree node.
23
+ *
24
+ * @author Sebastian Menski
25
+ */
26
+ public class SpinXmlNodeException extends SpinRuntimeException {
27
+
28
+ private static final long serialVersionUID = 1L;
29
+
30
+ public SpinXmlNodeException(String message) {
31
+ super(message);
32
+ }
33
+
34
+ public SpinXmlNodeException(String message, Throwable cause) {
35
+ super(message, cause);
36
+ }
37
+ }
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/resources/script/env/groovy/spin.groovy ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Licensed under the Apache License, Version 2.0 (the "License");
2
+ * you may not use this file except in compliance with the License.
3
+ * You may obtain a copy of the License at
4
+ *
5
+ * http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software
8
+ * distributed under the License is distributed on an "AS IS" BASIS,
9
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ * See the License for the specific language governing permissions and
11
+ * limitations under the License.
12
+ */
13
+
14
+ /*
15
+ * This is the default environment for using camunda Spin in Groovy applications.
16
+ */
17
+
18
+ /*
19
+ * Bind the Spin S(...) function to the variable S.
20
+ */
21
+ S = org.camunda.spin.Spin.&S
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/resources/script/env/javascript/spin.js ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Licensed under the Apache License, Version 2.0 (the "License");
2
+ * you may not use this file except in compliance with the License.
3
+ * You may obtain a copy of the License at
4
+ *
5
+ * http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software
8
+ * distributed under the License is distributed on an "AS IS" BASIS,
9
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ * See the License for the specific language governing permissions and
11
+ * limitations under the License.
12
+ */
13
+
14
+ /**
15
+ * This is the default environment for using camunda Spin in Javascript applications.
16
+ */
17
+
18
+ /**
19
+ * Bind the Spin S function to the variable S.
20
+ */
21
+ var S = Java.type('org.camunda.spin.Spin').S;
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/resources/script/env/python/spin.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Licensed under the Apache License, Version 2.0 (the "License");
3
+ you may not use this file except in compliance with the License.
4
+ You may obtain a copy of the License at
5
+
6
+ http://www.apache.org/licenses/LICENSE-2.0
7
+
8
+ Unless required by applicable law or agreed to in writing, software
9
+ distributed under the License is distributed on an "AS IS" BASIS,
10
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ See the License for the specific language governing permissions and
12
+ limitations under the License.
13
+ """
14
+
15
+ # This is the default environment for using camunda Spin in Python applications.
16
+
17
+ # Import the Spin S(...) function.
18
+ import org.camunda.spin.Spin.S as S