This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 62e83cf0b659c6bd870e311e0dbc23569707ed9b
Author: Marat Gubaidullin <marat.gubaidul...@gmail.com>
AuthorDate: Wed Apr 1 15:44:28 2020 -0400

    CAMEL-14808. Fixed stylecheck errors
---
 .../services/org/apache/camel/component.properties |  4 +-
 .../apache/camel/component/djl/DJLComponent.java   | 21 ++++++++-
 .../apache/camel/component/djl/DJLEndpoint.java    | 18 +++++++-
 .../apache/camel/component/djl/DJLProducer.java    | 19 +++++++-
 .../component/djl/model/AbstractPredictor.java     | 17 ++++++++
 .../model/CustomImageClassificationPredictor.java  | 44 ++++++++++++-------
 .../djl/model/CustomObjectDetectionPredictor.java  | 44 +++++++++++++------
 .../djl/model/ModelPredictorProducer.java          | 31 +++++++++++---
 .../djl/model/ZooImageClassificationPredictor.java | 50 ++++++++++++++--------
 .../djl/model/ZooObjectDetectionPredictor.java     | 43 ++++++++++++-------
 .../djl/ImageClassificationLocalTest.java          | 30 ++++++++++---
 .../component/djl/ImageClassificationTest.java     | 17 ++++++++
 .../camel/component/djl/ObjectDetectionTest.java   | 17 ++++++++
 .../component/djl/training/MnistTraining.java      | 29 +++++++++++--
 .../camel-djl/src/test/resources/log4j2.properties | 16 +++++++
 15 files changed, 317 insertions(+), 83 deletions(-)

diff --git 
a/components/camel-djl/src/generated/resources/META-INF/services/org/apache/camel/component.properties
 
b/components/camel-djl/src/generated/resources/META-INF/services/org/apache/camel/component.properties
index 4846236..171a75f 100644
--- 
a/components/camel-djl/src/generated/resources/META-INF/services/org/apache/camel/component.properties
+++ 
b/components/camel-djl/src/generated/resources/META-INF/services/org/apache/camel/component.properties
@@ -3,5 +3,5 @@ components=djl
 groupId=org.apache.camel
 artifactId=camel-djl
 version=3.2.0-SNAPSHOT
-projectName=Camel Deep Java Library Component
-projectDescription=Camel Components
+projectName=Camel :: Deep Java Library
+projectDescription=Camel Deep Java Library support
diff --git 
a/components/camel-djl/src/main/java/org/apache/camel/component/djl/DJLComponent.java
 
b/components/camel-djl/src/main/java/org/apache/camel/component/djl/DJLComponent.java
index 3273c93..9bb20f6 100644
--- 
a/components/camel-djl/src/main/java/org/apache/camel/component/djl/DJLComponent.java
+++ 
b/components/camel-djl/src/main/java/org/apache/camel/component/djl/DJLComponent.java
@@ -1,9 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.apache.camel.component.djl;
 
 import java.util.Map;
 
 import org.apache.camel.Endpoint;
-
 import org.apache.camel.spi.annotations.Component;
 import org.apache.camel.support.DefaultComponent;
 import org.apache.camel.util.ObjectHelper;
@@ -11,9 +27,10 @@ import org.apache.camel.util.ObjectHelper;
 /**
  * Represents the component that manages {@link DJLEndpoint}.
  */
+
 @Component("djl")
 public class DJLComponent extends DefaultComponent {
-    
+
     protected Endpoint createEndpoint(String uri, String remaining, 
Map<String, Object> parameters) throws Exception {
         if (ObjectHelper.isEmpty(remaining)) {
             throw new IllegalArgumentException("Application must be configured 
on endpoint using syntax djl:application");
diff --git 
a/components/camel-djl/src/main/java/org/apache/camel/component/djl/DJLEndpoint.java
 
b/components/camel-djl/src/main/java/org/apache/camel/component/djl/DJLEndpoint.java
index e905936..10cb642 100644
--- 
a/components/camel-djl/src/main/java/org/apache/camel/component/djl/DJLEndpoint.java
+++ 
b/components/camel-djl/src/main/java/org/apache/camel/component/djl/DJLEndpoint.java
@@ -1,6 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.apache.camel.component.djl;
 
-import ai.djl.Application;
 import org.apache.camel.Consumer;
 import org.apache.camel.Processor;
 import org.apache.camel.Producer;
diff --git 
a/components/camel-djl/src/main/java/org/apache/camel/component/djl/DJLProducer.java
 
b/components/camel-djl/src/main/java/org/apache/camel/component/djl/DJLProducer.java
index fec3523..84877ce 100644
--- 
a/components/camel-djl/src/main/java/org/apache/camel/component/djl/DJLProducer.java
+++ 
b/components/camel-djl/src/main/java/org/apache/camel/component/djl/DJLProducer.java
@@ -1,3 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.apache.camel.component.djl;
 
 import org.apache.camel.Exchange;
@@ -18,7 +35,7 @@ public class DJLProducer extends DefaultProducer {
     public DJLProducer(DJLEndpoint endpoint) throws Exception {
         super(endpoint);
         this.endpoint = endpoint;
-        if (endpoint.getArtifactId() !=null) {
+        if (endpoint.getArtifactId() != null) {
             this.abstractPredictor = 
ModelPredictorProducer.getZooPredictor(endpoint.getApplication(), 
endpoint.getArtifactId());
         } else {
             this.abstractPredictor = 
ModelPredictorProducer.getCustomPredictor(endpoint.getApplication(), 
endpoint.getModel(), endpoint.getTranslator());
diff --git 
a/components/camel-djl/src/main/java/org/apache/camel/component/djl/model/AbstractPredictor.java
 
b/components/camel-djl/src/main/java/org/apache/camel/component/djl/model/AbstractPredictor.java
index 9d2b2b5..6e54e57 100644
--- 
a/components/camel-djl/src/main/java/org/apache/camel/component/djl/model/AbstractPredictor.java
+++ 
b/components/camel-djl/src/main/java/org/apache/camel/component/djl/model/AbstractPredictor.java
@@ -1,3 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.apache.camel.component.djl.model;
 
 import org.apache.camel.Exchange;
diff --git 
a/components/camel-djl/src/main/java/org/apache/camel/component/djl/model/CustomImageClassificationPredictor.java
 
b/components/camel-djl/src/main/java/org/apache/camel/component/djl/model/CustomImageClassificationPredictor.java
index 56cc9d9..2e7717b 100644
--- 
a/components/camel-djl/src/main/java/org/apache/camel/component/djl/model/CustomImageClassificationPredictor.java
+++ 
b/components/camel-djl/src/main/java/org/apache/camel/component/djl/model/CustomImageClassificationPredictor.java
@@ -1,15 +1,22 @@
-package org.apache.camel.component.djl.model;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
-import ai.djl.Model;
-import ai.djl.inference.Predictor;
-import ai.djl.modality.Classifications;
-import ai.djl.translate.TranslateException;
-import ai.djl.translate.Translator;
-import org.apache.camel.Exchange;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+package org.apache.camel.component.djl.model;
 
-import javax.imageio.ImageIO;
 import java.awt.image.BufferedImage;
 import java.io.ByteArrayInputStream;
 import java.io.File;
@@ -19,6 +26,17 @@ import java.util.List;
 import java.util.Map;
 import java.util.stream.Collectors;
 
+import javax.imageio.ImageIO;
+
+import ai.djl.Model;
+import ai.djl.inference.Predictor;
+import ai.djl.modality.Classifications;
+import ai.djl.translate.TranslateException;
+import ai.djl.translate.Translator;
+import org.apache.camel.Exchange;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 public class CustomImageClassificationPredictor extends AbstractPredictor {
     private static final Logger LOG = 
LoggerFactory.getLogger(CustomImageClassificationPredictor.class);
 
@@ -70,11 +88,7 @@ public class CustomImageClassificationPredictor extends 
AbstractPredictor {
         try (Predictor<BufferedImage, Classifications> predictor = 
model.newPredictor(translator)) {
             Classifications classifications = predictor.predict(input);
             List<Classifications.Classification> list = 
classifications.items();
-            return list.stream()
-                    .collect(
-                            Collectors.toMap(
-                                    
Classifications.Classification::getClassName,
-                                    x -> (float) x.getProbability()));
+            return 
list.stream().collect(Collectors.toMap(Classifications.Classification::getClassName,
 x -> (float) x.getProbability()));
         } catch (TranslateException e) {
             throw new Exception("Failed to process output", e);
         }
diff --git 
a/components/camel-djl/src/main/java/org/apache/camel/component/djl/model/CustomObjectDetectionPredictor.java
 
b/components/camel-djl/src/main/java/org/apache/camel/component/djl/model/CustomObjectDetectionPredictor.java
index 392d208..050e898 100644
--- 
a/components/camel-djl/src/main/java/org/apache/camel/component/djl/model/CustomObjectDetectionPredictor.java
+++ 
b/components/camel-djl/src/main/java/org/apache/camel/component/djl/model/CustomObjectDetectionPredictor.java
@@ -1,5 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.apache.camel.component.djl.model;
 
+import java.awt.image.BufferedImage;
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.imageio.ImageIO;
+
 import ai.djl.Model;
 import ai.djl.inference.Predictor;
 import ai.djl.modality.cv.output.DetectedObjects;
@@ -9,13 +34,6 @@ import org.apache.camel.Exchange;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.imageio.ImageIO;
-import java.awt.image.BufferedImage;
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-
 public class CustomObjectDetectionPredictor extends AbstractPredictor {
 
     private static final Logger LOG = 
LoggerFactory.getLogger(CustomObjectDetectionPredictor.class);
@@ -33,20 +51,20 @@ public class CustomObjectDetectionPredictor extends 
AbstractPredictor {
         Model model = 
exchange.getContext().getRegistry().lookupByNameAndType(modelName, Model.class);
         Translator translator = 
exchange.getContext().getRegistry().lookupByNameAndType(translatorName, 
Translator.class);
 
-        if (exchange.getIn().getBody() instanceof byte[]){
+        if (exchange.getIn().getBody() instanceof byte[]) {
             byte[] bytes = exchange.getIn().getBody(byte[].class);
             DetectedObjects result = classify(model, translator, new 
ByteArrayInputStream(bytes));
             exchange.getIn().setBody(result);
-        } else if (exchange.getIn().getBody() instanceof File){
+        } else if (exchange.getIn().getBody() instanceof File) {
             DetectedObjects result = classify(model, translator, 
exchange.getIn().getBody(File.class));
             exchange.getIn().setBody(result);
-        } else if (exchange.getIn().getBody() instanceof InputStream){
+        } else if (exchange.getIn().getBody() instanceof InputStream) {
             DetectedObjects result = classify(model, translator, 
exchange.getIn().getBody(InputStream.class));
             exchange.getIn().setBody(result);
         }
     }
 
-    public DetectedObjects classify(Model model, Translator 
translator,BufferedImage input) throws Exception {
+    public DetectedObjects classify(Model model, Translator translator, 
BufferedImage input) throws Exception {
         try (Predictor<BufferedImage, DetectedObjects> predictor = 
model.newPredictor(translator)) {
             DetectedObjects detectedObjects = predictor.predict(input);
             return detectedObjects;
@@ -55,7 +73,7 @@ public class CustomObjectDetectionPredictor extends 
AbstractPredictor {
         }
     }
 
-    public DetectedObjects classify(Model model, Translator translator,File 
input) throws Exception {
+    public DetectedObjects classify(Model model, Translator translator, File 
input) throws Exception {
         try {
             return classify(model, translator, ImageIO.read(input));
         } catch (IOException e) {
@@ -64,7 +82,7 @@ public class CustomObjectDetectionPredictor extends 
AbstractPredictor {
         }
     }
 
-    public DetectedObjects classify(Model model, Translator 
translator,InputStream input) throws Exception {
+    public DetectedObjects classify(Model model, Translator translator, 
InputStream input) throws Exception {
         try {
             return classify(model, translator, ImageIO.read(input));
         } catch (IOException e) {
diff --git 
a/components/camel-djl/src/main/java/org/apache/camel/component/djl/model/ModelPredictorProducer.java
 
b/components/camel-djl/src/main/java/org/apache/camel/component/djl/model/ModelPredictorProducer.java
index 61849b0..ba1815c 100644
--- 
a/components/camel-djl/src/main/java/org/apache/camel/component/djl/model/ModelPredictorProducer.java
+++ 
b/components/camel-djl/src/main/java/org/apache/camel/component/djl/model/ModelPredictorProducer.java
@@ -1,14 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.apache.camel.component.djl.model;
 
 import static ai.djl.Application.CV.IMAGE_CLASSIFICATION;
 import static ai.djl.Application.CV.OBJECT_DETECTION;
 
-public class ModelPredictorProducer {
+public final class ModelPredictorProducer {
+
+    private ModelPredictorProducer() {
+        // No-op; won't be called
+    }
 
     public static AbstractPredictor getZooPredictor(String applicationPath, 
String artifactId) throws Exception {
-        if (applicationPath.equals(IMAGE_CLASSIFICATION.getPath())){
+        if (applicationPath.equals(IMAGE_CLASSIFICATION.getPath())) {
             return new ZooImageClassificationPredictor(artifactId);
-        } else if (applicationPath.equals(OBJECT_DETECTION.getPath())){
+        } else if (applicationPath.equals(OBJECT_DETECTION.getPath())) {
             return new ZooObjectDetectionPredictor(artifactId);
         } else {
             throw new RuntimeException("Application not supported ");
@@ -16,9 +37,9 @@ public class ModelPredictorProducer {
     }
 
     public static AbstractPredictor getCustomPredictor(String applicationPath, 
String model, String translator) {
-        if (applicationPath.equals(IMAGE_CLASSIFICATION.getPath())){
+        if (applicationPath.equals(IMAGE_CLASSIFICATION.getPath())) {
             return new CustomImageClassificationPredictor(model, translator);
-        } else if (applicationPath.equals(OBJECT_DETECTION.getPath())){
+        } else if (applicationPath.equals(OBJECT_DETECTION.getPath())) {
             return new CustomObjectDetectionPredictor(model, translator);
         } else {
             throw new RuntimeException("Application not supported ");
diff --git 
a/components/camel-djl/src/main/java/org/apache/camel/component/djl/model/ZooImageClassificationPredictor.java
 
b/components/camel-djl/src/main/java/org/apache/camel/component/djl/model/ZooImageClassificationPredictor.java
index 3d4d789..bc9a004 100644
--- 
a/components/camel-djl/src/main/java/org/apache/camel/component/djl/model/ZooImageClassificationPredictor.java
+++ 
b/components/camel-djl/src/main/java/org/apache/camel/component/djl/model/ZooImageClassificationPredictor.java
@@ -1,5 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.apache.camel.component.djl.model;
 
+import java.awt.image.BufferedImage;
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import javax.imageio.ImageIO;
+
 import ai.djl.Application;
 import ai.djl.inference.Predictor;
 import ai.djl.modality.Classifications;
@@ -12,16 +40,6 @@ import org.apache.camel.Exchange;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.imageio.ImageIO;
-import java.awt.image.BufferedImage;
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-
 public class ZooImageClassificationPredictor extends AbstractPredictor {
     private static final Logger LOG = 
LoggerFactory.getLogger(ZooImageClassificationPredictor.class);
 
@@ -40,14 +58,14 @@ public class ZooImageClassificationPredictor extends 
AbstractPredictor {
 
     @Override
     public void process(Exchange exchange) throws Exception {
-        if (exchange.getIn().getBody() instanceof byte[]){
+        if (exchange.getIn().getBody() instanceof byte[]) {
             byte[] bytes = exchange.getIn().getBody(byte[].class);
             Map<String, Float> result = classify(new 
ByteArrayInputStream(bytes));
             exchange.getIn().setBody(result);
-        } else if (exchange.getIn().getBody() instanceof File){
+        } else if (exchange.getIn().getBody() instanceof File) {
             Map<String, Float> result = 
classify(exchange.getIn().getBody(File.class));
             exchange.getIn().setBody(result);
-        } else if (exchange.getIn().getBody() instanceof InputStream){
+        } else if (exchange.getIn().getBody() instanceof InputStream) {
             Map<String, Float> result = 
classify(exchange.getIn().getBody(InputStream.class));
             exchange.getIn().setBody(result);
         }
@@ -75,11 +93,7 @@ public class ZooImageClassificationPredictor extends 
AbstractPredictor {
         try (Predictor<BufferedImage, Classifications> predictor = 
model.newPredictor()) {
             Classifications classifications = predictor.predict(input);
             List<Classifications.Classification> list = 
classifications.items();
-            return list.stream()
-                    .collect(
-                            Collectors.toMap(
-                                    
Classifications.Classification::getClassName,
-                                    x -> (float) x.getProbability()));
+            return 
list.stream().collect(Collectors.toMap(Classifications.Classification::getClassName,
 x -> (float) x.getProbability()));
         } catch (TranslateException e) {
             throw new Exception("Failed to process output", e);
         }
diff --git 
a/components/camel-djl/src/main/java/org/apache/camel/component/djl/model/ZooObjectDetectionPredictor.java
 
b/components/camel-djl/src/main/java/org/apache/camel/component/djl/model/ZooObjectDetectionPredictor.java
index 5772cea..ca44d06 100644
--- 
a/components/camel-djl/src/main/java/org/apache/camel/component/djl/model/ZooObjectDetectionPredictor.java
+++ 
b/components/camel-djl/src/main/java/org/apache/camel/component/djl/model/ZooObjectDetectionPredictor.java
@@ -1,8 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.apache.camel.component.djl.model;
 
+import java.awt.image.BufferedImage;
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.imageio.ImageIO;
+
 import ai.djl.Application;
 import ai.djl.inference.Predictor;
-import ai.djl.modality.cv.ImageVisualization;
 import ai.djl.modality.cv.output.DetectedObjects;
 import ai.djl.repository.zoo.Criteria;
 import ai.djl.repository.zoo.ModelZoo;
@@ -13,17 +37,6 @@ import org.apache.camel.Exchange;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.imageio.ImageIO;
-import java.awt.*;
-import java.awt.image.BufferedImage;
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-
 public class ZooObjectDetectionPredictor extends AbstractPredictor {
 
     private static final Logger LOG = 
LoggerFactory.getLogger(ZooObjectDetectionPredictor.class);
@@ -43,14 +56,14 @@ public class ZooObjectDetectionPredictor extends 
AbstractPredictor {
 
     @Override
     public void process(Exchange exchange) throws Exception {
-        if (exchange.getIn().getBody() instanceof byte[]){
+        if (exchange.getIn().getBody() instanceof byte[]) {
             byte[] bytes = exchange.getIn().getBody(byte[].class);
             DetectedObjects result = classify(new ByteArrayInputStream(bytes));
             exchange.getIn().setBody(result);
-        } else if (exchange.getIn().getBody() instanceof File){
+        } else if (exchange.getIn().getBody() instanceof File) {
             DetectedObjects result = 
classify(exchange.getIn().getBody(File.class));
             exchange.getIn().setBody(result);
-        } else if (exchange.getIn().getBody() instanceof InputStream){
+        } else if (exchange.getIn().getBody() instanceof InputStream) {
             DetectedObjects result = 
classify(exchange.getIn().getBody(InputStream.class));
             exchange.getIn().setBody(result);
         }
diff --git 
a/components/camel-djl/src/test/java/org/apache/camel/component/djl/ImageClassificationLocalTest.java
 
b/components/camel-djl/src/test/java/org/apache/camel/component/djl/ImageClassificationLocalTest.java
index a4dc21c..e66e9b6 100644
--- 
a/components/camel-djl/src/test/java/org/apache/camel/component/djl/ImageClassificationLocalTest.java
+++ 
b/components/camel-djl/src/test/java/org/apache/camel/component/djl/ImageClassificationLocalTest.java
@@ -1,5 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.apache.camel.component.djl;
 
+import java.io.IOException;
+import java.nio.file.Paths;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Map;
+
 import ai.djl.MalformedModelException;
 import ai.djl.Model;
 import ai.djl.basicmodelzoo.basic.Mlp;
@@ -7,7 +30,6 @@ import ai.djl.modality.cv.transform.ToTensor;
 import ai.djl.modality.cv.translator.ImageClassificationTranslator;
 import ai.djl.translate.Pipeline;
 import ai.djl.translate.TranslateException;
-import ai.djl.translate.Translator;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.test.junit4.CamelTestSupport;
@@ -15,12 +37,6 @@ import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.io.IOException;
-import java.nio.file.Paths;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Map;
-
 public class ImageClassificationLocalTest extends CamelTestSupport {
     private static final Logger LOG = 
LoggerFactory.getLogger(ImageClassificationLocalTest.class);
 
diff --git 
a/components/camel-djl/src/test/java/org/apache/camel/component/djl/ImageClassificationTest.java
 
b/components/camel-djl/src/test/java/org/apache/camel/component/djl/ImageClassificationTest.java
index fd6b3f3..2391adf 100644
--- 
a/components/camel-djl/src/test/java/org/apache/camel/component/djl/ImageClassificationTest.java
+++ 
b/components/camel-djl/src/test/java/org/apache/camel/component/djl/ImageClassificationTest.java
@@ -1,3 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.apache.camel.component.djl;
 
 import org.apache.camel.builder.RouteBuilder;
diff --git 
a/components/camel-djl/src/test/java/org/apache/camel/component/djl/ObjectDetectionTest.java
 
b/components/camel-djl/src/test/java/org/apache/camel/component/djl/ObjectDetectionTest.java
index 752a3fa..d1a26c1 100644
--- 
a/components/camel-djl/src/test/java/org/apache/camel/component/djl/ObjectDetectionTest.java
+++ 
b/components/camel-djl/src/test/java/org/apache/camel/component/djl/ObjectDetectionTest.java
@@ -1,3 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.apache.camel.component.djl;
 
 import org.apache.camel.builder.RouteBuilder;
diff --git 
a/components/camel-djl/src/test/java/org/apache/camel/component/djl/training/MnistTraining.java
 
b/components/camel-djl/src/test/java/org/apache/camel/component/djl/training/MnistTraining.java
index 9e8d2eb..7b1c9a6 100644
--- 
a/components/camel-djl/src/test/java/org/apache/camel/component/djl/training/MnistTraining.java
+++ 
b/components/camel-djl/src/test/java/org/apache/camel/component/djl/training/MnistTraining.java
@@ -1,5 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.apache.camel.component.djl.training;
 
+import java.io.IOException;
+import java.nio.file.Paths;
+
 import ai.djl.Device;
 import ai.djl.Model;
 import ai.djl.basicdataset.Mnist;
@@ -19,16 +39,17 @@ import ai.djl.training.util.ProgressBar;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.io.IOException;
-import java.nio.file.Paths;
-
 // Helper to train mnist model for tests
-public class MnistTraining {
+public final class MnistTraining {
     private static final Logger LOG = 
LoggerFactory.getLogger(MnistTraining.class);
 
     private static final String MODEL_DIR = "src/test/resources/models/mnist";
     private static final String MODEL_NAME = "mlp";
 
+    private MnistTraining() {
+        // No-op; won't be called
+    }
+
 
     public static void main(String[] args) throws IOException {
         // Construct neural network
diff --git a/components/camel-djl/src/test/resources/log4j2.properties 
b/components/camel-djl/src/test/resources/log4j2.properties
index 328db35..d9f0508 100644
--- a/components/camel-djl/src/test/resources/log4j2.properties
+++ b/components/camel-djl/src/test/resources/log4j2.properties
@@ -1,3 +1,19 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License.  You may obtain a copy of the License at
+##
+##      http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
 
 appender.out.type = Console
 appender.out.name = out

Reply via email to