You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2016/04/09 07:47:41 UTC
[2/4] camel git commit: CAMEL-9600 update fop from 1.1 to 2.1
CAMEL-9600 update fop from 1.1 to 2.1
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/69aea912
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/69aea912
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/69aea912
Branch: refs/heads/master
Commit: 69aea912f411c6609a7512da2de14e47d1796886
Parents: 8537bdd
Author: syakimovich <s0...@gmail.com>
Authored: Thu Apr 7 23:10:12 2016 +0300
Committer: Claus Ibsen <da...@apache.org>
Committed: Sat Apr 9 07:43:40 2016 +0200
----------------------------------------------------------------------
.../camel/component/fop/FopConfigException.java | 34 ++++++++++++++++++++
.../apache/camel/component/fop/FopEndpoint.java | 19 +++++------
parent/pom.xml | 2 +-
3 files changed, 43 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/69aea912/components/camel-fop/src/main/java/org/apache/camel/component/fop/FopConfigException.java
----------------------------------------------------------------------
diff --git a/components/camel-fop/src/main/java/org/apache/camel/component/fop/FopConfigException.java b/components/camel-fop/src/main/java/org/apache/camel/component/fop/FopConfigException.java
new file mode 100644
index 0000000..dc5343a
--- /dev/null
+++ b/components/camel-fop/src/main/java/org/apache/camel/component/fop/FopConfigException.java
@@ -0,0 +1,34 @@
+/**
+ * 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.fop;
+
+import org.apache.camel.RuntimeCamelException;
+
+/**
+ * Fop configuration exception.
+ */
+public class FopConfigException extends RuntimeCamelException {
+ private static final long serialVersionUID = 1L;
+
+ public FopConfigException(Throwable e) {
+ super(e);
+ }
+
+ public FopConfigException(String message) {
+ super(message);
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/69aea912/components/camel-fop/src/main/java/org/apache/camel/component/fop/FopEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-fop/src/main/java/org/apache/camel/component/fop/FopEndpoint.java b/components/camel-fop/src/main/java/org/apache/camel/component/fop/FopEndpoint.java
index 42df6ef..5ba7fcc 100644
--- a/components/camel-fop/src/main/java/org/apache/camel/component/fop/FopEndpoint.java
+++ b/components/camel-fop/src/main/java/org/apache/camel/component/fop/FopEndpoint.java
@@ -17,6 +17,7 @@
package org.apache.camel.component.fop;
import java.io.InputStream;
+import java.net.URI;
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder;
@@ -94,23 +95,19 @@ public class FopEndpoint extends DefaultEndpoint {
this.fopFactory = fopFactory;
}
- private static void updateConfigurations(InputStream is, FopFactory fopFactory) throws Exception {
- DefaultConfigurationBuilder cfgBuilder = new DefaultConfigurationBuilder();
- Configuration cfg = cfgBuilder.build(is);
- fopFactory.setUserConfig(cfg);
- }
@Override
protected void doStart() throws Exception {
super.doStart();
- if (fopFactory == null) {
- fopFactory = FopFactory.newInstance();
- }
-
- if (userConfigURL != null) {
+ if (fopFactory == null && userConfigURL == null) {
+ fopFactory = FopFactory.newInstance(new URI("./"));
+ } else if (fopFactory != null && userConfigURL != null) {
+ throw new FopConfigException("More than one configuration. " +
+ "You can configure fop either by config file or by supplying FopFactory but not both.");
+ } else if (fopFactory == null && userConfigURL != null) {
InputStream is = ResourceHelper.resolveMandatoryResourceAsInputStream(getCamelContext(), userConfigURL);
- updateConfigurations(is, fopFactory);
+ fopFactory = FopFactory.newInstance(new URI(userConfigURL), is);
}
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/69aea912/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index 4dbd4ab..72ff50f 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -174,7 +174,7 @@
<findbugs-maven-plugin-version>2.5.2</findbugs-maven-plugin-version>
<flatpack-version>3.4.3</flatpack-version>
<fop-bundle-version>1.1_1</fop-bundle-version>
- <fop-version>1.1</fop-version>
+ <fop-version>2.1</fop-version>
<ftpserver-version>1.0.6</ftpserver-version>
<freemarker-bundle-version>2.3.23_1</freemarker-bundle-version>
<freemarker-version>2.3.23</freemarker-version>