You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streams.apache.org by sb...@apache.org on 2022/09/14 15:22:15 UTC
[streams] 01/02: resolves STREAMS-683: upgrade jsonschema2pojo usage to modern version
This is an automated email from the ASF dual-hosted git repository.
sblackmon pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/streams.git
commit 91667b1a59f26fc0bb017b2246e14c3867781805
Author: sblackmon <sb...@apache.org>
AuthorDate: Sun Aug 28 13:27:25 2022 -0500
resolves STREAMS-683: upgrade jsonschema2pojo usage to modern version
because there were syntax changes in the new version, had to tweak a lot of json schema files and some utility classes
---
pom.xml | 2 +-
.../ActivityConverterProcessorConfiguration.json | 4 +-
...ivityObjectConverterProcessorConfiguration.json | 4 +-
.../ElasticsearchReaderConfiguration.json | 2 +-
.../streams/graph/GraphReaderConfiguration.json | 4 +-
.../serializer/util/InstagramActivityUtil.java | 39 +++++-------
.../streams/instagram/api/CommentsResponse.json | 4 +-
.../streams/instagram/api/MediaResponse.json | 4 +-
.../streams/instagram/api/RecentMediaResponse.json | 4 +-
.../streams/instagram/api/SearchMediaResponse.json | 4 +-
.../streams/instagram/api/SearchUsersResponse.json | 4 +-
.../streams/instagram/api/UserInfoResponse.json | 4 +-
.../streams/instagram/api/UsersInfoResponse.json | 4 +-
.../org/apache/streams/instagram/pojo/Media.json | 24 ++------
.../apache/streams/instagram/pojo/MediaItem.json | 23 +++++++
streams-contrib/streams-provider-linkedin/pom.xml | 30 ----------
.../jsonschema/ElasticsearchHdfsConfiguration.json | 12 +++-
.../jsonschema/HdfsElasticsearchConfiguration.json | 12 +++-
.../ElasticsearchReindexConfiguration.json | 12 +++-
.../MongoElasticsearchSyncConfiguration.json | 12 +++-
.../TwitterFollowNeo4jConfiguration.json | 12 +++-
.../TwitterHistoryElasticsearchConfiguration.json | 12 +++-
...witterUserstreamElasticsearchConfiguration.json | 12 +++-
.../plugins/StreamsPojoGenerationConfig.java | 8 +--
.../streams/plugins/StreamsPojoRuleLogger.java | 70 ++++++++++++++++++++++
.../plugins/StreamsPojoSourceGenerator.java | 22 ++++---
.../plugins/StreamsPojoSourceGeneratorMojo.java | 3 +-
.../test/StreamsPojoSourceGeneratorTest.java | 2 +-
.../java/org/apache/streams/util/PropertyUtil.java | 2 +-
.../streams/util/schema/SchemaStoreImpl.java | 5 +-
30 files changed, 234 insertions(+), 122 deletions(-)
diff --git a/pom.xml b/pom.xml
index 4cb83da891..f70b1b942f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -380,7 +380,7 @@
<json-path.version>2.4.0</json-path.version>
<json-schema-validator.version>0.1.10</json-schema-validator.version>
<juneau.version>7.2.1</juneau.version>
- <jsonschema2pojo.version>0.4.10</jsonschema2pojo.version>
+ <jsonschema2pojo.version>1.1.2</jsonschema2pojo.version>
<jaxb2.version>0.14.0</jaxb2.version>
<jaxb2-basics.version>0.11.1</jaxb2-basics.version>
<jaxbutil.version>1.3.0</jaxbutil.version>
diff --git a/streams-components/streams-converters/src/main/jsonschema/org/apache/streams/converter/ActivityConverterProcessorConfiguration.json b/streams-components/streams-converters/src/main/jsonschema/org/apache/streams/converter/ActivityConverterProcessorConfiguration.json
index f535b5ab3e..feb1b130cd 100644
--- a/streams-components/streams-converters/src/main/jsonschema/org/apache/streams/converter/ActivityConverterProcessorConfiguration.json
+++ b/streams-components/streams-converters/src/main/jsonschema/org/apache/streams/converter/ActivityConverterProcessorConfiguration.json
@@ -11,14 +11,14 @@
"classifiers": {
"type": "array",
"items": {
- "javaType": "org.apache.streams.data.DocumentClassifier",
+ "existingJavaType": "org.apache.streams.data.DocumentClassifier",
"type": "object"
}
},
"converters": {
"type": "array",
"items": {
- "javaType": "org.apache.streams.data.ActivityConverter",
+ "existingJavaType": "org.apache.streams.data.ActivityConverter",
"type": "object"
}
}
diff --git a/streams-components/streams-converters/src/main/jsonschema/org/apache/streams/converter/ActivityObjectConverterProcessorConfiguration.json b/streams-components/streams-converters/src/main/jsonschema/org/apache/streams/converter/ActivityObjectConverterProcessorConfiguration.json
index 7eacacbd2d..cd4dddbbd3 100644
--- a/streams-components/streams-converters/src/main/jsonschema/org/apache/streams/converter/ActivityObjectConverterProcessorConfiguration.json
+++ b/streams-components/streams-converters/src/main/jsonschema/org/apache/streams/converter/ActivityObjectConverterProcessorConfiguration.json
@@ -12,14 +12,14 @@
"type": "array",
"items": {
"type": "object",
- "javaType": "org.apache.streams.data.DocumentClassifier"
+ "existingJavaType": "org.apache.streams.data.DocumentClassifier"
}
},
"converters": {
"type": "array",
"items": {
"type": "object",
- "javaType": "org.apache.streams.data.ActivityObjectConverter"
+ "existingJavaType": "org.apache.streams.data.ActivityObjectConverter"
}
}
}
diff --git a/streams-contrib/streams-persist-elasticsearch/src/main/jsonschema/org/apache/streams/elasticsearch/ElasticsearchReaderConfiguration.json b/streams-contrib/streams-persist-elasticsearch/src/main/jsonschema/org/apache/streams/elasticsearch/ElasticsearchReaderConfiguration.json
index 30d1d98e2b..ecfbfaa7f0 100644
--- a/streams-contrib/streams-persist-elasticsearch/src/main/jsonschema/org/apache/streams/elasticsearch/ElasticsearchReaderConfiguration.json
+++ b/streams-contrib/streams-persist-elasticsearch/src/main/jsonschema/org/apache/streams/elasticsearch/ElasticsearchReaderConfiguration.json
@@ -29,7 +29,7 @@
},
"_search": {
"type": "object",
- "javaType" : "java.util.Map",
+ "existingJavaType" : "java.util.Map",
"description": "Search definition"
}
}
diff --git a/streams-contrib/streams-persist-graph/src/main/jsonschema/org/apache/streams/graph/GraphReaderConfiguration.json b/streams-contrib/streams-persist-graph/src/main/jsonschema/org/apache/streams/graph/GraphReaderConfiguration.json
index 6cffba01bd..83c3f2eb2f 100644
--- a/streams-contrib/streams-persist-graph/src/main/jsonschema/org/apache/streams/graph/GraphReaderConfiguration.json
+++ b/streams-contrib/streams-persist-graph/src/main/jsonschema/org/apache/streams/graph/GraphReaderConfiguration.json
@@ -6,7 +6,9 @@
],
"id": "#",
"javaType" : "org.apache.streams.graph.GraphReaderConfiguration",
- "extends" : {"$ref":"GraphHttpConfiguration.json"},
+ "extends" : {
+ "existingJavaType":"org.apache.streams.components.http.HttpConfiguration"
+ },
"javaInterfaces": ["java.io.Serializable"],
"properties": {
"query": {
diff --git a/streams-contrib/streams-provider-instagram/src/main/java/org/apache/streams/instagram/serializer/util/InstagramActivityUtil.java b/streams-contrib/streams-provider-instagram/src/main/java/org/apache/streams/instagram/serializer/util/InstagramActivityUtil.java
index 147a6e19c0..7320648d01 100644
--- a/streams-contrib/streams-provider-instagram/src/main/java/org/apache/streams/instagram/serializer/util/InstagramActivityUtil.java
+++ b/streams-contrib/streams-provider-instagram/src/main/java/org/apache/streams/instagram/serializer/util/InstagramActivityUtil.java
@@ -21,18 +21,11 @@ package org.apache.streams.instagram.serializer.util;
import org.apache.streams.exceptions.ActivityConversionException;
import org.apache.streams.exceptions.ActivitySerializerException;
-import org.apache.streams.instagram.pojo.Comment;
-import org.apache.streams.instagram.pojo.Comments;
-import org.apache.streams.instagram.pojo.Images;
-import org.apache.streams.instagram.pojo.Media;
-import org.apache.streams.instagram.pojo.UserInfo;
-import org.apache.streams.instagram.pojo.UserInfoCounts;
-import org.apache.streams.instagram.pojo.Videos;
+import org.apache.streams.instagram.pojo.*;
import org.apache.streams.pojo.extensions.ExtensionUtil;
import org.apache.streams.pojo.json.Activity;
import org.apache.streams.pojo.json.ActivityObject;
import org.apache.streams.pojo.json.Image;
-import org.apache.streams.pojo.json.ImageParent;
import org.apache.streams.pojo.json.Provider;
import org.joda.time.DateTime;
@@ -174,14 +167,14 @@ public class InstagramActivityUtil {
Image standardResolution = new Image();
if (item.getType().equals("image") && item.getImages() != null) {
- ImageParent standardResolutionData = item.getImages().getStandardResolution();
- standardResolution.setHeight((long) standardResolutionData.getHeight());
- standardResolution.setWidth((long) standardResolutionData.getWidth());
+ MediaItem standardResolutionData = item.getImages().getStandardResolution();
+ standardResolution.setHeight(standardResolutionData.getHeight().longValue());
+ standardResolution.setWidth(standardResolutionData.getWidth().longValue());
standardResolution.setUrl(standardResolutionData.getUrl());
} else if (item.getType().equals("video") && item.getVideos() != null) {
- ImageParent standardResolutionData = item.getVideos().getStandardResolution();
- standardResolution.setHeight((long) standardResolutionData.getHeight());
- standardResolution.setWidth((long) standardResolutionData.getWidth());
+ MediaItem standardResolutionData = item.getVideos().getStandardResolution();
+ standardResolution.setHeight(standardResolutionData.getHeight().longValue());
+ standardResolution.setWidth(standardResolutionData.getWidth().longValue());
standardResolution.setUrl(standardResolutionData.getUrl());
}
@@ -215,22 +208,22 @@ public class InstagramActivityUtil {
if (images != null) {
try {
- ImageParent thumbnail = images.getThumbnail();
- ImageParent lowResolution = images.getLowResolution();
+ MediaItem thumbnail = images.getThumbnail();
+ MediaItem lowResolution = images.getLowResolution();
ActivityObject thumbnailObject = new ActivityObject();
Image thumbnailImage = new Image();
thumbnailImage.setUrl(thumbnail.getUrl());
- thumbnailImage.setHeight((long) thumbnail.getHeight());
- thumbnailImage.setWidth((long) thumbnail.getWidth());
+ thumbnailImage.setHeight(thumbnail.getHeight().longValue());
+ thumbnailImage.setWidth(thumbnail.getWidth().longValue());
thumbnailObject.setImage(thumbnailImage);
thumbnailObject.setObjectType("image");
ActivityObject lowResolutionObject = new ActivityObject();
Image lowResolutionImage = new Image();
lowResolutionImage.setUrl(lowResolution.getUrl());
- lowResolutionImage.setHeight((long) lowResolution.getHeight());
- lowResolutionImage.setWidth((long) lowResolution.getWidth());
+ lowResolutionImage.setHeight(lowResolution.getHeight().longValue());
+ lowResolutionImage.setWidth(lowResolution.getWidth().longValue());
lowResolutionObject.setImage(lowResolutionImage);
lowResolutionObject.setObjectType("image");
@@ -252,13 +245,13 @@ public class InstagramActivityUtil {
if (videos != null) {
try {
- ImageParent lowResolutionVideo = videos.getLowResolution();
+ MediaItem lowResolutionVideo = videos.getLowResolution();
ActivityObject lowResolutionVideoObject = new ActivityObject();
Image lowResolutionVideoImage = new Image();
lowResolutionVideoImage.setUrl(lowResolutionVideo.getUrl());
- lowResolutionVideoImage.setHeight((long) lowResolutionVideo.getHeight());
- lowResolutionVideoImage.setWidth((long) lowResolutionVideo.getWidth());
+ lowResolutionVideoImage.setHeight(lowResolutionVideo.getHeight().longValue());
+ lowResolutionVideoImage.setWidth(lowResolutionVideo.getWidth().longValue());
lowResolutionVideoObject.setImage(lowResolutionVideoImage);
lowResolutionVideoObject.setObjectType("video");
diff --git a/streams-contrib/streams-provider-instagram/src/main/jsonschema/org/apache/streams/instagram/api/CommentsResponse.json b/streams-contrib/streams-provider-instagram/src/main/jsonschema/org/apache/streams/instagram/api/CommentsResponse.json
index e315871843..b2778d7a71 100644
--- a/streams-contrib/streams-provider-instagram/src/main/jsonschema/org/apache/streams/instagram/api/CommentsResponse.json
+++ b/streams-contrib/streams-provider-instagram/src/main/jsonschema/org/apache/streams/instagram/api/CommentsResponse.json
@@ -17,10 +17,10 @@
}
},
"meta": {
- "javaType": "org.apache.streams.instagram.api.Meta"
+ "$ref": "Meta.json"
},
"pagination": {
- "javaType": "org.apache.streams.instagram.api.Pagination"
+ "$ref": "Pagination.json"
}
}
}
\ No newline at end of file
diff --git a/streams-contrib/streams-provider-instagram/src/main/jsonschema/org/apache/streams/instagram/api/MediaResponse.json b/streams-contrib/streams-provider-instagram/src/main/jsonschema/org/apache/streams/instagram/api/MediaResponse.json
index cbf4ebc8ed..5b30eabd04 100644
--- a/streams-contrib/streams-provider-instagram/src/main/jsonschema/org/apache/streams/instagram/api/MediaResponse.json
+++ b/streams-contrib/streams-provider-instagram/src/main/jsonschema/org/apache/streams/instagram/api/MediaResponse.json
@@ -14,10 +14,10 @@
"$ref": "../pojo/Media.json"
},
"meta": {
- "javaType": "org.apache.streams.instagram.api.Meta"
+ "$ref": "Meta.json"
},
"pagination": {
- "javaType": "org.apache.streams.instagram.api.Pagination"
+ "$ref": "Pagination.json"
}
}
}
\ No newline at end of file
diff --git a/streams-contrib/streams-provider-instagram/src/main/jsonschema/org/apache/streams/instagram/api/RecentMediaResponse.json b/streams-contrib/streams-provider-instagram/src/main/jsonschema/org/apache/streams/instagram/api/RecentMediaResponse.json
index 4dc61db0fd..de51fcbdb2 100644
--- a/streams-contrib/streams-provider-instagram/src/main/jsonschema/org/apache/streams/instagram/api/RecentMediaResponse.json
+++ b/streams-contrib/streams-provider-instagram/src/main/jsonschema/org/apache/streams/instagram/api/RecentMediaResponse.json
@@ -17,10 +17,10 @@
}
},
"meta": {
- "javaType": "org.apache.streams.instagram.api.Meta"
+ "$ref": "Meta.json"
},
"pagination": {
- "javaType": "org.apache.streams.instagram.api.Pagination"
+ "$ref": "Pagination.json"
}
}
}
\ No newline at end of file
diff --git a/streams-contrib/streams-provider-instagram/src/main/jsonschema/org/apache/streams/instagram/api/SearchMediaResponse.json b/streams-contrib/streams-provider-instagram/src/main/jsonschema/org/apache/streams/instagram/api/SearchMediaResponse.json
index a95e3c2b4a..eee5d6fa24 100644
--- a/streams-contrib/streams-provider-instagram/src/main/jsonschema/org/apache/streams/instagram/api/SearchMediaResponse.json
+++ b/streams-contrib/streams-provider-instagram/src/main/jsonschema/org/apache/streams/instagram/api/SearchMediaResponse.json
@@ -17,10 +17,10 @@
}
},
"meta": {
- "javaType": "org.apache.streams.instagram.api.Meta"
+ "$ref": "Meta.json"
},
"pagination": {
- "javaType": "org.apache.streams.instagram.api.Pagination"
+ "$ref": "Pagination.json"
}
}
}
\ No newline at end of file
diff --git a/streams-contrib/streams-provider-instagram/src/main/jsonschema/org/apache/streams/instagram/api/SearchUsersResponse.json b/streams-contrib/streams-provider-instagram/src/main/jsonschema/org/apache/streams/instagram/api/SearchUsersResponse.json
index 28a5a562f3..2be17719fc 100644
--- a/streams-contrib/streams-provider-instagram/src/main/jsonschema/org/apache/streams/instagram/api/SearchUsersResponse.json
+++ b/streams-contrib/streams-provider-instagram/src/main/jsonschema/org/apache/streams/instagram/api/SearchUsersResponse.json
@@ -17,10 +17,10 @@
}
},
"meta": {
- "javaType": "org.apache.streams.instagram.api.Meta"
+ "$ref": "Meta.json"
},
"pagination": {
- "javaType": "org.apache.streams.instagram.api.Pagination"
+ "$ref": "Pagination.json"
}
}
}
\ No newline at end of file
diff --git a/streams-contrib/streams-provider-instagram/src/main/jsonschema/org/apache/streams/instagram/api/UserInfoResponse.json b/streams-contrib/streams-provider-instagram/src/main/jsonschema/org/apache/streams/instagram/api/UserInfoResponse.json
index cc38cfd684..9de13fa142 100644
--- a/streams-contrib/streams-provider-instagram/src/main/jsonschema/org/apache/streams/instagram/api/UserInfoResponse.json
+++ b/streams-contrib/streams-provider-instagram/src/main/jsonschema/org/apache/streams/instagram/api/UserInfoResponse.json
@@ -14,10 +14,10 @@
"$ref": "../pojo/UserInfo.json"
},
"meta": {
- "javaType": "org.apache.streams.instagram.api.Meta"
+ "$ref": "Meta.json"
},
"pagination": {
- "javaType": "org.apache.streams.instagram.api.Pagination"
+ "$ref": "Pagination.json"
}
}
}
\ No newline at end of file
diff --git a/streams-contrib/streams-provider-instagram/src/main/jsonschema/org/apache/streams/instagram/api/UsersInfoResponse.json b/streams-contrib/streams-provider-instagram/src/main/jsonschema/org/apache/streams/instagram/api/UsersInfoResponse.json
index 95c468d591..53a1b397f5 100644
--- a/streams-contrib/streams-provider-instagram/src/main/jsonschema/org/apache/streams/instagram/api/UsersInfoResponse.json
+++ b/streams-contrib/streams-provider-instagram/src/main/jsonschema/org/apache/streams/instagram/api/UsersInfoResponse.json
@@ -17,10 +17,10 @@
}
},
"meta": {
- "javaType": "org.apache.streams.instagram.api.Meta"
+ "$ref": "Meta.json"
},
"pagination": {
- "javaType": "org.apache.streams.instagram.api.Pagination"
+ "$ref": "Pagination.json"
}
}
}
\ No newline at end of file
diff --git a/streams-contrib/streams-provider-instagram/src/main/jsonschema/org/apache/streams/instagram/pojo/Media.json b/streams-contrib/streams-provider-instagram/src/main/jsonschema/org/apache/streams/instagram/pojo/Media.json
index 5256e3af2e..f527488ec8 100644
--- a/streams-contrib/streams-provider-instagram/src/main/jsonschema/org/apache/streams/instagram/pojo/Media.json
+++ b/streams-contrib/streams-provider-instagram/src/main/jsonschema/org/apache/streams/instagram/pojo/Media.json
@@ -56,19 +56,13 @@
"type": "object",
"properties": {
"low_resolution": {
- "description": "this should be org.apache.streams.pojo.json.MediaLink, ../../../../../../../../../../streams-schemas/streams-schema-activitystreams/src/main/jsonschema/media_link.json",
- "type": "object",
- "javaType": "org.apache.streams.pojo.json.ImageParent"
+ "$ref": "./MediaItem.json"
},
"standard_resolution": {
- "description": "this should be org.apache.streams.pojo.json.MediaLink, ../../../../../../../../../../streams-schemas/streams-schema-activitystreams/src/main/jsonschema/media_link.json",
- "type": "object",
- "javaType": "org.apache.streams.pojo.json.ImageParent"
+ "$ref": "./MediaItem.json"
},
"thumbnail": {
- "description": "this should be org.apache.streams.pojo.json.MediaLink, ../../../../../../../../../../streams-schemas/streams-schema-activitystreams/src/main/jsonschema/media_link.json",
- "type": "object",
- "javaType": "org.apache.streams.pojo.json.ImageParent"
+ "$ref": "./MediaItem.json"
}
}
},
@@ -121,19 +115,13 @@
"type": "object",
"properties": {
"low_resolution": {
- "description": "this should be org.apache.streams.pojo.json.MediaLink, ../../../../../../../../../../streams-schemas/streams-schema-activitystreams/src/main/jsonschema/media_link.json",
- "type": "object",
- "javaType": "org.apache.streams.pojo.json.ImageParent"
+ "$ref": "./MediaItem.json"
},
"standard_resolution": {
- "description": "this should be org.apache.streams.pojo.json.MediaLink, ../../../../../../../../../../streams-schemas/streams-schema-activitystreams/src/main/jsonschema/media_link.json",
- "type": "object",
- "javaType": "org.apache.streams.pojo.json.ImageParent"
+ "$ref": "./MediaItem.json"
},
"thumbnail": {
- "description": "this should be org.apache.streams.pojo.json.MediaLink, ../../../../../../../../../../streams-schemas/streams-schema-activitystreams/src/main/jsonschema/media_link.json",
- "type": "object",
- "javaType": "org.apache.streams.pojo.json.ImageParent"
+ "$ref": "./MediaItem.json"
}
}
},
diff --git a/streams-contrib/streams-provider-instagram/src/main/jsonschema/org/apache/streams/instagram/pojo/MediaItem.json b/streams-contrib/streams-provider-instagram/src/main/jsonschema/org/apache/streams/instagram/pojo/MediaItem.json
new file mode 100644
index 0000000000..37d32ae6fe
--- /dev/null
+++ b/streams-contrib/streams-provider-instagram/src/main/jsonschema/org/apache/streams/instagram/pojo/MediaItem.json
@@ -0,0 +1,23 @@
+{
+ "type": "object",
+ "$schema": "http://json-schema.org/draft-03/schema",
+ "$license": [
+ "http://www.apache.org/licenses/LICENSE-2.0"
+ ],
+ "id": "#",
+ "javaType": "org.apache.streams.instagram.pojo.MediaItem",
+ "javaInterfaces": [
+ "java.io.Serializable"
+ ],
+ "properties": {
+ "height": {
+ "type": "number"
+ },
+ "width": {
+ "type": "number"
+ },
+ "url": {
+ "type": "string"
+ }
+ }
+}
\ No newline at end of file
diff --git a/streams-contrib/streams-provider-linkedin/pom.xml b/streams-contrib/streams-provider-linkedin/pom.xml
index 5f2f77608f..52e10ed0d1 100644
--- a/streams-contrib/streams-provider-linkedin/pom.xml
+++ b/streams-contrib/streams-provider-linkedin/pom.xml
@@ -138,36 +138,6 @@
</testResource>
</testResources>
<plugins>
- <plugin>
- <groupId>org.apache.streams.plugins</groupId>
- <artifactId>streams-plugin-pojo</artifactId>
- <version>${project.version}</version>
- <configuration>
- <sourcePaths>
- <sourcePath>${project.basedir}/src/main/jsonschema</sourcePath>
- </sourcePaths>
- <targetDirectory>${project.basedir}/target/generated-sources/pojo</targetDirectory>
- <targetPackage>org.apache.streams.linkedin.pojo</targetPackage>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>add-source</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>add-source</goal>
- </goals>
- <configuration>
- <sources>
- <source>target/generated-sources/pojo</source>
- </sources>
- </configuration>
- </execution>
- </executions>
- </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
diff --git a/streams-examples/streams-examples-local/elasticsearch-hdfs/src/main/jsonschema/ElasticsearchHdfsConfiguration.json b/streams-examples/streams-examples-local/elasticsearch-hdfs/src/main/jsonschema/ElasticsearchHdfsConfiguration.json
index 68f74483ab..443ec906bf 100644
--- a/streams-examples/streams-examples-local/elasticsearch-hdfs/src/main/jsonschema/ElasticsearchHdfsConfiguration.json
+++ b/streams-examples/streams-examples-local/elasticsearch-hdfs/src/main/jsonschema/ElasticsearchHdfsConfiguration.json
@@ -12,7 +12,15 @@
},
"additionalProperties": false,
"properties": {
- "source": { "javaType": "org.apache.streams.elasticsearch.ElasticsearchReaderConfiguration", "type": "object", "required": true },
- "destination": { "javaType": "org.apache.streams.hdfs.HdfsWriterConfiguration", "type": "object", "required": true }
+ "source": {
+ "existingJavaType": "org.apache.streams.elasticsearch.ElasticsearchReaderConfiguration",
+ "type": "object",
+ "required": true
+ },
+ "destination": {
+ "existingJavaType": "org.apache.streams.hdfs.HdfsWriterConfiguration",
+ "type": "object",
+ "required": true
+ }
}
}
\ No newline at end of file
diff --git a/streams-examples/streams-examples-local/elasticsearch-hdfs/src/main/jsonschema/HdfsElasticsearchConfiguration.json b/streams-examples/streams-examples-local/elasticsearch-hdfs/src/main/jsonschema/HdfsElasticsearchConfiguration.json
index 3a864ed059..71bb0440f5 100644
--- a/streams-examples/streams-examples-local/elasticsearch-hdfs/src/main/jsonschema/HdfsElasticsearchConfiguration.json
+++ b/streams-examples/streams-examples-local/elasticsearch-hdfs/src/main/jsonschema/HdfsElasticsearchConfiguration.json
@@ -12,7 +12,15 @@
},
"additionalProperties": false,
"properties": {
- "source": { "javaType": "org.apache.streams.hdfs.HdfsReaderConfiguration", "type": "object", "required": true },
- "destination": { "javaType": "org.apache.streams.elasticsearch.ElasticsearchWriterConfiguration", "type": "object", "required": true }
+ "source": {
+ "existingJavaType": "org.apache.streams.hdfs.HdfsReaderConfiguration",
+ "type": "object",
+ "required": true
+ },
+ "destination": {
+ "existingJavaType": "org.apache.streams.elasticsearch.ElasticsearchWriterConfiguration",
+ "type": "object",
+ "required": true
+ }
}
}
\ No newline at end of file
diff --git a/streams-examples/streams-examples-local/elasticsearch-reindex/src/main/jsonschema/ElasticsearchReindexConfiguration.json b/streams-examples/streams-examples-local/elasticsearch-reindex/src/main/jsonschema/ElasticsearchReindexConfiguration.json
index 07d2fb7e06..654d66d704 100644
--- a/streams-examples/streams-examples-local/elasticsearch-reindex/src/main/jsonschema/ElasticsearchReindexConfiguration.json
+++ b/streams-examples/streams-examples-local/elasticsearch-reindex/src/main/jsonschema/ElasticsearchReindexConfiguration.json
@@ -12,7 +12,15 @@
},
"additionalProperties": false,
"properties": {
- "source": { "javaType": "org.apache.streams.elasticsearch.ElasticsearchReaderConfiguration", "type": "object", "required": true },
- "destination": { "javaType": "org.apache.streams.elasticsearch.ElasticsearchWriterConfiguration", "type": "object", "required": true }
+ "source": {
+ "existingJavaType": "org.apache.streams.elasticsearch.ElasticsearchReaderConfiguration",
+ "type": "object",
+ "required": true
+ },
+ "destination": {
+ "existingJavaType": "org.apache.streams.elasticsearch.ElasticsearchWriterConfiguration",
+ "type": "object",
+ "required": true
+ }
}
}
\ No newline at end of file
diff --git a/streams-examples/streams-examples-local/mongo-elasticsearch-sync/src/main/jsonschema/MongoElasticsearchSyncConfiguration.json b/streams-examples/streams-examples-local/mongo-elasticsearch-sync/src/main/jsonschema/MongoElasticsearchSyncConfiguration.json
index 02b9c83342..5ff6347778 100644
--- a/streams-examples/streams-examples-local/mongo-elasticsearch-sync/src/main/jsonschema/MongoElasticsearchSyncConfiguration.json
+++ b/streams-examples/streams-examples-local/mongo-elasticsearch-sync/src/main/jsonschema/MongoElasticsearchSyncConfiguration.json
@@ -12,7 +12,15 @@
},
"additionalProperties": false,
"properties": {
- "source": { "javaType": "org.apache.streams.mongo.MongoConfiguration", "type": "object", "required": true },
- "destination": { "javaType": "org.apache.streams.elasticsearch.ElasticsearchWriterConfiguration", "type": "object", "required": true }
+ "source": {
+ "existingJavaType": "org.apache.streams.mongo.MongoConfiguration",
+ "type": "object",
+ "required": true
+ },
+ "destination": {
+ "existingJavaType": "org.apache.streams.elasticsearch.ElasticsearchWriterConfiguration",
+ "type": "object",
+ "required": true
+ }
}
}
\ No newline at end of file
diff --git a/streams-examples/streams-examples-local/twitter-follow-neo4j/src/main/jsonschema/TwitterFollowNeo4jConfiguration.json b/streams-examples/streams-examples-local/twitter-follow-neo4j/src/main/jsonschema/TwitterFollowNeo4jConfiguration.json
index 23deacc1e1..b97a69c21f 100644
--- a/streams-examples/streams-examples-local/twitter-follow-neo4j/src/main/jsonschema/TwitterFollowNeo4jConfiguration.json
+++ b/streams-examples/streams-examples-local/twitter-follow-neo4j/src/main/jsonschema/TwitterFollowNeo4jConfiguration.json
@@ -12,7 +12,15 @@
},
"additionalProperties": false,
"properties": {
- "twitter": { "javaType": "org.apache.streams.twitter.config.TwitterFollowingConfiguration", "type": "object", "required": true },
- "neo4j": { "javaType": "org.apache.streams.neo4j.Neo4jConfiguration", "type": "object", "required": true }
+ "twitter": {
+ "existingJavaType": "org.apache.streams.twitter.config.TwitterFollowingConfiguration",
+ "type": "object",
+ "required": true
+ },
+ "neo4j": {
+ "existingJavaType": "org.apache.streams.neo4j.Neo4jConfiguration",
+ "type": "object",
+ "required": true
+ }
}
}
\ No newline at end of file
diff --git a/streams-examples/streams-examples-local/twitter-history-elasticsearch/src/main/jsonschema/TwitterHistoryElasticsearchConfiguration.json b/streams-examples/streams-examples-local/twitter-history-elasticsearch/src/main/jsonschema/TwitterHistoryElasticsearchConfiguration.json
index 7320bb8cc4..d93e3fd340 100644
--- a/streams-examples/streams-examples-local/twitter-history-elasticsearch/src/main/jsonschema/TwitterHistoryElasticsearchConfiguration.json
+++ b/streams-examples/streams-examples-local/twitter-history-elasticsearch/src/main/jsonschema/TwitterHistoryElasticsearchConfiguration.json
@@ -12,7 +12,15 @@
},
"additionalProperties": false,
"properties": {
- "twitter": { "javaType": "org.apache.streams.twitter.config.TwitterTimelineProviderConfiguration", "type": "object", "required": true },
- "elasticsearch": { "javaType": "org.apache.streams.elasticsearch.ElasticsearchWriterConfiguration", "type": "object", "required": true }
+ "twitter": {
+ "existingJavaType": "org.apache.streams.twitter.config.TwitterTimelineProviderConfiguration",
+ "type": "object",
+ "required": true
+ },
+ "elasticsearch": {
+ "existingJavaType": "org.apache.streams.elasticsearch.ElasticsearchWriterConfiguration",
+ "type": "object",
+ "required": true
+ }
}
}
diff --git a/streams-examples/streams-examples-local/twitter-userstream-elasticsearch/src/main/jsonschema/TwitterUserstreamElasticsearchConfiguration.json b/streams-examples/streams-examples-local/twitter-userstream-elasticsearch/src/main/jsonschema/TwitterUserstreamElasticsearchConfiguration.json
index 636a560bd9..0ed08c4fea 100644
--- a/streams-examples/streams-examples-local/twitter-userstream-elasticsearch/src/main/jsonschema/TwitterUserstreamElasticsearchConfiguration.json
+++ b/streams-examples/streams-examples-local/twitter-userstream-elasticsearch/src/main/jsonschema/TwitterUserstreamElasticsearchConfiguration.json
@@ -12,7 +12,15 @@
},
"additionalProperties": false,
"properties": {
- "twitter": { "javaType": "org.apache.streams.twitter.config.TwitterStreamConfiguration", "type": "object", "required": true },
- "elasticsearch": { "javaType": "org.apache.streams.elasticsearch.ElasticsearchWriterConfiguration", "type": "object", "required": true }
+ "twitter": {
+ "existingJavaType": "org.apache.streams.twitter.config.TwitterStreamConfiguration",
+ "type": "object",
+ "required": true
+ },
+ "elasticsearch": {
+ "existingJavaType": "org.apache.streams.elasticsearch.ElasticsearchWriterConfiguration",
+ "type": "object",
+ "required": true
+ }
}
}
\ No newline at end of file
diff --git a/streams-plugins/streams-plugin-pojo/src/main/java/org/apache/streams/plugins/StreamsPojoGenerationConfig.java b/streams-plugins/streams-plugin-pojo/src/main/java/org/apache/streams/plugins/StreamsPojoGenerationConfig.java
index 4378b70972..ab5cbbb9ea 100644
--- a/streams-plugins/streams-plugin-pojo/src/main/java/org/apache/streams/plugins/StreamsPojoGenerationConfig.java
+++ b/streams-plugins/streams-plugin-pojo/src/main/java/org/apache/streams/plugins/StreamsPojoGenerationConfig.java
@@ -106,10 +106,10 @@ public class StreamsPojoGenerationConfig extends DefaultGenerationConfig {
return true;
}
- @Override
- public boolean isUseCommonsLang3() {
- return true;
- }
+// @Override
+// public boolean isUseCommonsLang3() {
+// return true;
+// }
// @Override
// public boolean isIncludeAdditionalProperties() {
diff --git a/streams-plugins/streams-plugin-pojo/src/main/java/org/apache/streams/plugins/StreamsPojoRuleLogger.java b/streams-plugins/streams-plugin-pojo/src/main/java/org/apache/streams/plugins/StreamsPojoRuleLogger.java
new file mode 100644
index 0000000000..31316ddbf9
--- /dev/null
+++ b/streams-plugins/streams-plugin-pojo/src/main/java/org/apache/streams/plugins/StreamsPojoRuleLogger.java
@@ -0,0 +1,70 @@
+package org.apache.streams.plugins;
+
+import org.jsonschema2pojo.RuleLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class StreamsPojoRuleLogger implements RuleLogger {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(StreamsPojoRuleLogger.class);
+
+ @Override
+ public void debug(String s) {
+ LOGGER.debug(s);
+ }
+
+ @Override
+ public void error(String s) {
+ LOGGER.error(s);
+ }
+
+ @Override
+ public void error(String s, Throwable throwable) {
+ LOGGER.error(s, throwable);
+ }
+
+ @Override
+ public void info(String s) {
+ LOGGER.info(s);
+ }
+
+ @Override
+ public boolean isDebugEnabled() {
+ return true;
+ }
+
+ @Override
+ public boolean isErrorEnabled() {
+ return true;
+ }
+
+ @Override
+ public boolean isInfoEnabled() {
+ return true;
+ }
+
+ @Override
+ public boolean isTraceEnabled() {
+ return true;
+ }
+
+ @Override
+ public boolean isWarnEnabled() {
+ return true;
+ }
+
+ @Override
+ public void trace(String s) {
+ LOGGER.trace(s);
+ }
+
+ @Override
+ public void warn(String s, Throwable throwable) {
+ LOGGER.warn(s, throwable);
+ }
+
+ @Override
+ public void warn(String s) {
+ LOGGER.warn(s);
+ }
+}
diff --git a/streams-plugins/streams-plugin-pojo/src/main/java/org/apache/streams/plugins/StreamsPojoSourceGenerator.java b/streams-plugins/streams-plugin-pojo/src/main/java/org/apache/streams/plugins/StreamsPojoSourceGenerator.java
index a8048faff8..3b30577492 100644
--- a/streams-plugins/streams-plugin-pojo/src/main/java/org/apache/streams/plugins/StreamsPojoSourceGenerator.java
+++ b/streams-plugins/streams-plugin-pojo/src/main/java/org/apache/streams/plugins/StreamsPojoSourceGenerator.java
@@ -19,11 +19,15 @@
package org.apache.streams.plugins;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.jsonschema2pojo.GenerationConfig;
import org.jsonschema2pojo.Jsonschema2Pojo;
+import org.jsonschema2pojo.RuleLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
+import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
@@ -40,13 +44,14 @@ import java.util.Objects;
* generator.run();
*
*/
-public class StreamsPojoSourceGenerator implements Runnable {
+public class StreamsPojoSourceGenerator {
private static final Logger LOGGER = LoggerFactory.getLogger(StreamsPojoSourceGenerator.class);
private static final String LS = System.getProperty("line.separator");
private StreamsPojoGenerationConfig config;
+ private RuleLogger ruleLogger;
/**
* Run from CLI without Maven
@@ -56,7 +61,7 @@ public class StreamsPojoSourceGenerator implements Runnable {
*
* @param args [sourceDirectory, targetDirectory, targetPackage]
* */
- public static void main(String[] args) {
+ public static void main(String[] args) throws Exception {
StreamsPojoGenerationConfig config = new StreamsPojoGenerationConfig();
String sourceDirectory = "src/main/jsonschema";
@@ -78,22 +83,25 @@ public class StreamsPojoSourceGenerator implements Runnable {
config.setTargetDirectory(targetDirectory);
StreamsPojoSourceGenerator streamsPojoSourceGenerator = new StreamsPojoSourceGenerator(config);
- streamsPojoSourceGenerator.run();
+ streamsPojoSourceGenerator.execute();
}
public StreamsPojoSourceGenerator(StreamsPojoGenerationConfig config) {
this.config = config;
}
- @Override
- public void run() {
+ public void execute() throws MojoExecutionException {
Objects.requireNonNull(config);
+ GenerationConfig generationConfig = (GenerationConfig) config;
+
+ ruleLogger = new StreamsPojoRuleLogger();
try {
- Jsonschema2Pojo.generate(config);
- } catch (Throwable ex) {
+ Jsonschema2Pojo.generate(generationConfig, ruleLogger);
+ } catch (IOException ex) {
LOGGER.error("{} {}", ex.getClass(), ex.getMessage());
+ throw new MojoExecutionException(ex.getMessage(), ex);
}
}
diff --git a/streams-plugins/streams-plugin-pojo/src/main/java/org/apache/streams/plugins/StreamsPojoSourceGeneratorMojo.java b/streams-plugins/streams-plugin-pojo/src/main/java/org/apache/streams/plugins/StreamsPojoSourceGeneratorMojo.java
index 7585e7b07a..3927c6d244 100644
--- a/streams-plugins/streams-plugin-pojo/src/main/java/org/apache/streams/plugins/StreamsPojoSourceGeneratorMojo.java
+++ b/streams-plugins/streams-plugin-pojo/src/main/java/org/apache/streams/plugins/StreamsPojoSourceGeneratorMojo.java
@@ -88,7 +88,8 @@ public class StreamsPojoSourceGeneratorMojo extends AbstractMojo {
config.setTargetDirectory(targetDirectory);
StreamsPojoSourceGenerator streamsPojoSourceGenerator = new StreamsPojoSourceGenerator(config);
- streamsPojoSourceGenerator.run();
+
+ streamsPojoSourceGenerator.execute();
}
diff --git a/streams-plugins/streams-plugin-pojo/src/test/java/org/apache/streams/plugins/test/StreamsPojoSourceGeneratorTest.java b/streams-plugins/streams-plugin-pojo/src/test/java/org/apache/streams/plugins/test/StreamsPojoSourceGeneratorTest.java
index f7d8eabe23..34b1593da2 100644
--- a/streams-plugins/streams-plugin-pojo/src/test/java/org/apache/streams/plugins/test/StreamsPojoSourceGeneratorTest.java
+++ b/streams-plugins/streams-plugin-pojo/src/test/java/org/apache/streams/plugins/test/StreamsPojoSourceGeneratorTest.java
@@ -63,7 +63,7 @@ public class StreamsPojoSourceGeneratorTest {
config.setTargetDirectory("target/generated-sources/pojo");
StreamsPojoSourceGenerator streamsPojoSourceGenerator = new StreamsPojoSourceGenerator(config);
- streamsPojoSourceGenerator.run();
+ streamsPojoSourceGenerator.execute();
Assert.assertNotNull(config.getTargetDirectory());
Assert.assertTrue(config.getTargetDirectory().exists());
diff --git a/streams-util/src/main/java/org/apache/streams/util/PropertyUtil.java b/streams-util/src/main/java/org/apache/streams/util/PropertyUtil.java
index 4ea46fd049..da041c5f8e 100644
--- a/streams-util/src/main/java/org/apache/streams/util/PropertyUtil.java
+++ b/streams-util/src/main/java/org/apache/streams/util/PropertyUtil.java
@@ -27,7 +27,7 @@ import com.fasterxml.jackson.databind.node.ValueNode;
import com.github.wnameless.json.flattener.JsonFlattener;
import com.github.wnameless.json.unflattener.JsonUnflattener;
import org.apache.commons.lang3.StringUtils;
-import org.codehaus.jackson.JsonFactory;
+import com.fasterxml.jackson.core.JsonFactory;
import java.util.ArrayList;
import java.util.Arrays;
diff --git a/streams-util/src/main/java/org/apache/streams/util/schema/SchemaStoreImpl.java b/streams-util/src/main/java/org/apache/streams/util/schema/SchemaStoreImpl.java
index 808c3b5ae5..46d743bd9b 100644
--- a/streams-util/src/main/java/org/apache/streams/util/schema/SchemaStoreImpl.java
+++ b/streams-util/src/main/java/org/apache/streams/util/schema/SchemaStoreImpl.java
@@ -63,7 +63,7 @@ public class SchemaStoreImpl extends Ordering<Schema> implements SchemaStore {
if (uri.toString().contains("#") && !uri.toString().endsWith("#")) {
Schema newSchema = new Schema(baseUri, baseNode, null, true);
this.schemas.put(baseUri, newSchema);
- JsonNode childContent = this.fragmentResolver.resolve(baseNode, '#' + StringUtils.substringAfter(uri.toString(), "#"));
+ JsonNode childContent = this.fragmentResolver.resolve(baseNode, '#' + StringUtils.substringAfter(uri.toString(), "#"), "#");
this.schemas.put(uri, new Schema(uri, childContent, newSchema, false));
} else {
if ( baseNode.has("extends") && baseNode.get("extends").isObject()) {
@@ -120,7 +120,8 @@ public class SchemaStoreImpl extends Ordering<Schema> implements SchemaStore {
? parent.getId().resolve(path)
: URI.create(path);
if (this.selfReferenceWithoutParentFile(parent, path)) {
- this.schemas.put(id, new Schema(id, this.fragmentResolver.resolve(parent.getParentContent(), path), parent, false));
+ Schema newSchema = new Schema(id, this.fragmentResolver.resolve(parent.getParentContent(), path, "#"), parent, false);
+ this.schemas.put(id, newSchema);
return this.schemas.get(id);
} else {
return this.create(id);