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 2017/02/14 19:12:12 UTC
[1/3] camel git commit: CAMEL-10828: camel-catalog-nexus - Initial
work
Repository: camel
Updated Branches:
refs/heads/master 795ac6677 -> a118fa9ab
CAMEL-10828: camel-catalog-nexus - Initial work
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/c871ca96
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/c871ca96
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/c871ca96
Branch: refs/heads/master
Commit: c871ca96dfba65a7b9e52e68e8589b1f651b8cb8
Parents: 795ac66
Author: Claus Ibsen <da...@apache.org>
Authored: Tue Feb 14 19:31:26 2017 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Feb 14 19:31:26 2017 +0100
----------------------------------------------------------------------
platforms/dummy-component/pom.xml | 71 +++++++
.../apache/camel/component/dummy/Drinks.java | 22 ++
.../camel/component/dummy/DummyComponent.java | 40 ++++
.../camel/component/dummy/DummyEndpoint.java | 92 +++++++++
.../camel/component/dummy/DummyProducer.java | 45 ++++
.../src/main/resources/META-INF/LICENSE.txt | 203 +++++++++++++++++++
.../src/main/resources/META-INF/NOTICE.txt | 11 +
.../services/org/apache/camel/component/dummy | 18 ++
platforms/pom.xml | 2 +
9 files changed, 504 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/c871ca96/platforms/dummy-component/pom.xml
----------------------------------------------------------------------
diff --git a/platforms/dummy-component/pom.xml b/platforms/dummy-component/pom.xml
new file mode 100644
index 0000000..31a91d8
--- /dev/null
+++ b/platforms/dummy-component/pom.xml
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<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/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>platforms</artifactId>
+ <version>2.19.0-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+
+ <artifactId>dummy-component</artifactId>
+ <name>Camel :: Platforms :: Dummy Component</name>
+ <description>Camel Dummy Component</description>
+ <packaging>jar</packaging>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <!-- use the Camel apt compiler plugin -->
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>apt</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <!-- use Camel plugins to generate component details -->
+ <plugin>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-package-maven-plugin</artifactId>
+ <version>${project.version}</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate-components-list</goal>
+ </goals>
+ <phase>generate-resources</phase>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
http://git-wip-us.apache.org/repos/asf/camel/blob/c871ca96/platforms/dummy-component/src/main/java/org/apache/camel/component/dummy/Drinks.java
----------------------------------------------------------------------
diff --git a/platforms/dummy-component/src/main/java/org/apache/camel/component/dummy/Drinks.java b/platforms/dummy-component/src/main/java/org/apache/camel/component/dummy/Drinks.java
new file mode 100644
index 0000000..98f8f30
--- /dev/null
+++ b/platforms/dummy-component/src/main/java/org/apache/camel/component/dummy/Drinks.java
@@ -0,0 +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.dummy;
+
+public enum Drinks {
+
+ Beer, GinTonic, Wine
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/c871ca96/platforms/dummy-component/src/main/java/org/apache/camel/component/dummy/DummyComponent.java
----------------------------------------------------------------------
diff --git a/platforms/dummy-component/src/main/java/org/apache/camel/component/dummy/DummyComponent.java b/platforms/dummy-component/src/main/java/org/apache/camel/component/dummy/DummyComponent.java
new file mode 100644
index 0000000..66dfe94
--- /dev/null
+++ b/platforms/dummy-component/src/main/java/org/apache/camel/component/dummy/DummyComponent.java
@@ -0,0 +1,40 @@
+/**
+ * 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.dummy;
+
+import java.util.Map;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.impl.UriEndpointComponent;
+
+public class DummyComponent extends UriEndpointComponent {
+
+ public DummyComponent() {
+ super(DummyEndpoint.class);
+ }
+
+ @Override
+ protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
+ DummyEndpoint answer = new DummyEndpoint(uri, this);
+
+ Drinks drink = getCamelContext().getTypeConverter().mandatoryConvertTo(Drinks.class, remaining);
+ answer.setDrink(drink);
+
+ setProperties(answer, parameters);
+ return answer;
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/c871ca96/platforms/dummy-component/src/main/java/org/apache/camel/component/dummy/DummyEndpoint.java
----------------------------------------------------------------------
diff --git a/platforms/dummy-component/src/main/java/org/apache/camel/component/dummy/DummyEndpoint.java b/platforms/dummy-component/src/main/java/org/apache/camel/component/dummy/DummyEndpoint.java
new file mode 100644
index 0000000..ff2f24d
--- /dev/null
+++ b/platforms/dummy-component/src/main/java/org/apache/camel/component/dummy/DummyEndpoint.java
@@ -0,0 +1,92 @@
+/**
+ * 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.dummy;
+
+import org.apache.camel.Component;
+import org.apache.camel.Consumer;
+import org.apache.camel.Processor;
+import org.apache.camel.Producer;
+import org.apache.camel.impl.DefaultEndpoint;
+import org.apache.camel.spi.Metadata;
+import org.apache.camel.spi.UriEndpoint;
+import org.apache.camel.spi.UriParam;
+import org.apache.camel.spi.UriPath;
+
+@UriEndpoint(scheme = "dummy", syntax = "dummy:drink", title = "Dummy", label = "bar", producerOnly = true)
+public class DummyEndpoint extends DefaultEndpoint {
+
+ @UriPath @Metadata(required = "true")
+ private Drinks drink;
+
+ @UriParam(defaultValue = "1")
+ private int amount = 1;
+
+ @UriParam
+ private boolean celebrity;
+
+ public DummyEndpoint(String endpointUri, Component component) {
+ super(endpointUri, component);
+ }
+
+ @Override
+ public Producer createProducer() throws Exception {
+ return new DummyProducer(this, drink, amount, celebrity);
+ }
+
+ @Override
+ public Consumer createConsumer(Processor processor) throws Exception {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public boolean isSingleton() {
+ return true;
+ }
+
+ public Drinks getDrink() {
+ return drink;
+ }
+
+ /**
+ * What drink to order
+ */
+ public void setDrink(Drinks drink) {
+ this.drink = drink;
+ }
+
+ public int getAmount() {
+ return amount;
+ }
+
+ /**
+ * Number of drinks in the order
+ */
+ public void setAmount(int amount) {
+ this.amount = amount;
+ }
+
+ public boolean isCelebrity() {
+ return celebrity;
+ }
+
+ /**
+ * Is this a famous person ordering
+ */
+ public void setCelebrity(boolean celebrity) {
+ this.celebrity = celebrity;
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/c871ca96/platforms/dummy-component/src/main/java/org/apache/camel/component/dummy/DummyProducer.java
----------------------------------------------------------------------
diff --git a/platforms/dummy-component/src/main/java/org/apache/camel/component/dummy/DummyProducer.java b/platforms/dummy-component/src/main/java/org/apache/camel/component/dummy/DummyProducer.java
new file mode 100644
index 0000000..077c78b
--- /dev/null
+++ b/platforms/dummy-component/src/main/java/org/apache/camel/component/dummy/DummyProducer.java
@@ -0,0 +1,45 @@
+/**
+ * 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.dummy;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.Exchange;
+import org.apache.camel.impl.DefaultProducer;
+
+public class DummyProducer extends DefaultProducer {
+
+ private final Drinks drink;
+ private final int amount;
+ private final boolean celebrity;
+
+ private transient int total;
+
+ public DummyProducer(Endpoint endpoint, Drinks drink, int amount, boolean celebrity) {
+ super(endpoint);
+ this.drink = drink;
+ this.amount = amount;
+ this.celebrity = celebrity;
+ }
+
+ @Override
+ public void process(Exchange exchange) throws Exception {
+ total += amount;
+
+ exchange.getIn().setBody("total " + total + " of " + drink.name().toLowerCase() + " ordered"
+ + (celebrity ? " from famous person" : ""));
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/c871ca96/platforms/dummy-component/src/main/resources/META-INF/LICENSE.txt
----------------------------------------------------------------------
diff --git a/platforms/dummy-component/src/main/resources/META-INF/LICENSE.txt b/platforms/dummy-component/src/main/resources/META-INF/LICENSE.txt
new file mode 100755
index 0000000..6b0b127
--- /dev/null
+++ b/platforms/dummy-component/src/main/resources/META-INF/LICENSE.txt
@@ -0,0 +1,203 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
http://git-wip-us.apache.org/repos/asf/camel/blob/c871ca96/platforms/dummy-component/src/main/resources/META-INF/NOTICE.txt
----------------------------------------------------------------------
diff --git a/platforms/dummy-component/src/main/resources/META-INF/NOTICE.txt b/platforms/dummy-component/src/main/resources/META-INF/NOTICE.txt
new file mode 100755
index 0000000..2e215bf
--- /dev/null
+++ b/platforms/dummy-component/src/main/resources/META-INF/NOTICE.txt
@@ -0,0 +1,11 @@
+ =========================================================================
+ == NOTICE file corresponding to the section 4 d of ==
+ == the Apache License, Version 2.0, ==
+ == in this case for the Apache Camel distribution. ==
+ =========================================================================
+
+ This product includes software developed by
+ The Apache Software Foundation (http://www.apache.org/).
+
+ Please read the different LICENSE files present in the licenses directory of
+ this distribution.
http://git-wip-us.apache.org/repos/asf/camel/blob/c871ca96/platforms/dummy-component/src/main/resources/META-INF/services/org/apache/camel/component/dummy
----------------------------------------------------------------------
diff --git a/platforms/dummy-component/src/main/resources/META-INF/services/org/apache/camel/component/dummy b/platforms/dummy-component/src/main/resources/META-INF/services/org/apache/camel/component/dummy
new file mode 100644
index 0000000..3d4ead4
--- /dev/null
+++ b/platforms/dummy-component/src/main/resources/META-INF/services/org/apache/camel/component/dummy
@@ -0,0 +1,18 @@
+#
+# 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.
+#
+
+class=org.apache.camel.component.dummy.DummyComponent
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/c871ca96/platforms/pom.xml
----------------------------------------------------------------------
diff --git a/platforms/pom.xml b/platforms/pom.xml
index 61d5b05..7aa34b9 100644
--- a/platforms/pom.xml
+++ b/platforms/pom.xml
@@ -35,6 +35,8 @@
<module>commands</module>
<module>karaf</module>
<module>spring-boot</module>
+ <!-- dummy used for testing catalog -->
+ <module>dummy-component</module>
<!-- run catalog last -->
<module>catalog</module>
<module>catalog-provider-karaf</module>
[3/3] camel git commit: CAMEL-10828: camel-catalog-nexus - Initial
work
Posted by da...@apache.org.
CAMEL-10828: camel-catalog-nexus - Initial work
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/a118fa9a
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/a118fa9a
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/a118fa9a
Branch: refs/heads/master
Commit: a118fa9ab2a87dbb088e222c8e3810d89e32b0e7
Parents: 8dfed85
Author: Claus Ibsen <da...@apache.org>
Authored: Tue Feb 14 20:12:01 2017 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Feb 14 20:12:07 2017 +0100
----------------------------------------------------------------------
platforms/catalog-nexus/pom.xml | 14 ++++++++++-
.../catalog/nexus/ComponentNexusRepository.java | 3 ++-
.../catalog/nexus/LocalFileNexusRepository.java | 23 +++++++++++++++++-
.../catalog/nexus/LocalNexusRepositoryTest.java | 25 ++++++++++----------
.../src/test/resources/nexus-sample-result.xml | 8 +++----
5 files changed, 54 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/a118fa9a/platforms/catalog-nexus/pom.xml
----------------------------------------------------------------------
diff --git a/platforms/catalog-nexus/pom.xml b/platforms/catalog-nexus/pom.xml
index e0fbc32..a3653bf 100644
--- a/platforms/catalog-nexus/pom.xml
+++ b/platforms/catalog-nexus/pom.xml
@@ -77,8 +77,20 @@
</dependencies>
<build>
- <plugins>
+ <defaultGoal>install</defaultGoal>
+
+ <resources>
+ <resource>
+ <targetPath>${project.build.directory}/test-classes</targetPath>
+ <directory>src/test/resources</directory>
+ <includes>
+ <include>*.xml</include>
+ </includes>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
+ <plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
http://git-wip-us.apache.org/repos/asf/camel/blob/a118fa9a/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/ComponentNexusRepository.java
----------------------------------------------------------------------
diff --git a/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/ComponentNexusRepository.java b/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/ComponentNexusRepository.java
index d1663ca..2fb15c3 100644
--- a/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/ComponentNexusRepository.java
+++ b/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/ComponentNexusRepository.java
@@ -41,10 +41,11 @@ public class ComponentNexusRepository extends BaseNexusRepository {
// now download the new artifact JARs and look inside to find more details
for (NexusArtifactDto dto : newArtifacts) {
try {
+ log.debug("Processing new artifact: {}:{}:{}", dto.getGroupId(), dto.getArtifactId(), dto.getVersion());
String url = createArtifactURL(dto);
URL jarUrl = new URL(url);
addCustomCamelComponentsFromArtifact(dto, jarUrl);
- } catch (Exception e) {
+ } catch (Throwable e) {
log.warn("Error downloading component JAR " + dto.getArtifactLink() + ". This exception is ignored. " + e.getMessage());
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/a118fa9a/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalFileNexusRepository.java
----------------------------------------------------------------------
diff --git a/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalFileNexusRepository.java b/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalFileNexusRepository.java
index f3c3327..3a05b5f 100644
--- a/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalFileNexusRepository.java
+++ b/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalFileNexusRepository.java
@@ -20,11 +20,23 @@ import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
+import org.apache.camel.catalog.CamelCatalog;
+
public class LocalFileNexusRepository extends ComponentNexusRepository {
+ private Runnable onAddComponent;
+
+ public Runnable getOnAddComponent() {
+ return onAddComponent;
+ }
+
+ public void setOnAddComponent(Runnable onAddComponent) {
+ this.onAddComponent = onAddComponent;
+ }
+
@Override
protected URL createNexusUrl() throws MalformedURLException {
- File file = new File("src/test/resources/nexus-sample-result.xml");
+ File file = new File("target/test-classes/nexus-sample-result.xml");
return new URL("file:" + file.getAbsolutePath());
}
@@ -33,4 +45,13 @@ public class LocalFileNexusRepository extends ComponentNexusRepository {
// load from local file instead
return "file:target/localrepo/" + dto.getArtifactId() + "-" + dto.getVersion() + ".jar";
}
+
+ @Override
+ protected void addComponent(NexusArtifactDto dto, CamelCatalog camelCatalog, String scheme, String javaType, String json) {
+ super.addComponent(dto, camelCatalog, scheme, javaType, json);
+
+ if (onAddComponent != null) {
+ onAddComponent.run();
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/camel/blob/a118fa9a/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalNexusRepositoryTest.java
----------------------------------------------------------------------
diff --git a/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalNexusRepositoryTest.java b/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalNexusRepositoryTest.java
index 5382b41..4c8a8c0 100644
--- a/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalNexusRepositoryTest.java
+++ b/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalNexusRepositoryTest.java
@@ -16,6 +16,9 @@
*/
package org.apache.camel.catalog.nexus;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
import junit.framework.TestCase;
import org.apache.camel.catalog.CamelCatalog;
import org.apache.camel.catalog.DefaultCamelCatalog;
@@ -23,26 +26,24 @@ import org.junit.Test;
public class LocalNexusRepositoryTest extends TestCase {
- private LocalFileNexusRepository repo = new LocalFileNexusRepository();
- private CamelCatalog catalog = new DefaultCamelCatalog();
+ private final CamelCatalog catalog = new DefaultCamelCatalog();
- @Override
- protected void setUp() throws Exception {
- super.setUp();
+ @Test
+ public void testLocalNexus() throws Exception {
+ int before = catalog.findComponentNames().size();
+ LocalFileNexusRepository repo = new LocalFileNexusRepository();
repo.setCamelCatalog(catalog);
- repo.setInitialDelay(1);
+ repo.setInitialDelay(2);
+ repo.setDelay(3);
repo.setNexusUrl("dummy");
- }
- @Test
- public void testLocalNexus() throws Exception {
- int before = catalog.findComponentNames().size();
+ final CountDownLatch latch = new CountDownLatch(1);
+ repo.setOnAddComponent(latch::countDown);
repo.start();
- // TODO only wait as long until a new component is added
- Thread.sleep(5000);
+ assertTrue("Should have found component", latch.await(10, TimeUnit.SECONDS));
repo.stop();
http://git-wip-us.apache.org/repos/asf/camel/blob/a118fa9a/platforms/catalog-nexus/src/test/resources/nexus-sample-result.xml
----------------------------------------------------------------------
diff --git a/platforms/catalog-nexus/src/test/resources/nexus-sample-result.xml b/platforms/catalog-nexus/src/test/resources/nexus-sample-result.xml
index 8357e21..aae70b6 100644
--- a/platforms/catalog-nexus/src/test/resources/nexus-sample-result.xml
+++ b/platforms/catalog-nexus/src/test/resources/nexus-sample-result.xml
@@ -21,16 +21,16 @@
<tooManyResults>false</tooManyResults>
<data>
<artifact>
- <resourceURI>http://nexus.dummy/service/local/repositories/staging/content/org/apache/camel/dummy-component/2.19.0/dummy-component-2.19.0.jar</resourceURI>
+ <resourceURI>http://nexus.dummy/service/local/repositories/staging/content/org/apache/camel/dummy-component/${project.version}/dummy-component-${project.version}.jar</resourceURI>
<groupId>org.apache.camel</groupId>
<artifactId>dummy-component</artifactId>
- <version>2.19.0</version>
+ <version>${project.version}</version>
<packaging>jar</packaging>
<extension>jar</extension>
<repoId>staging</repoId>
<contextId>Staging</contextId>
- <pomLink>http://nexus.dummy/service/local/artifact/maven/redirect?r=staging&g=org.apache.camel&a=dummy-component&v=2.19.0&e=pom</pomLink>
- <artifactLink>http://nexus.dummy/service/local/artifact/maven/redirect?r=staging&g=org.apache.camel&a=dummy-component&v=2.19.0&e=jar</artifactLink>
+ <pomLink>http://nexus.dummy/service/local/artifact/maven/redirect?r=staging&g=org.apache.camel&a=dummy-component&v=${project.version}&e=pom</pomLink>
+ <artifactLink>http://nexus.dummy/service/local/artifact/maven/redirect?r=staging&g=org.apache.camel&a=dummy-component&v=${project.version}&e=jar</artifactLink>
<highlightedFragment><blockquote>Artifact ID<UL><LI>dummy-<B>component</B></LI></UL></blockquote></highlightedFragment>
</artifact>
</data>
[2/3] camel git commit: CAMEL-10828: camel-catalog-nexus - Initial
work
Posted by da...@apache.org.
CAMEL-10828: camel-catalog-nexus - Initial work
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/8dfed853
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/8dfed853
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/8dfed853
Branch: refs/heads/master
Commit: 8dfed853caa1c357c71276736ab84d037cd12492
Parents: c871ca9
Author: Claus Ibsen <da...@apache.org>
Authored: Tue Feb 14 19:42:16 2017 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Feb 14 19:42:16 2017 +0100
----------------------------------------------------------------------
platforms/catalog-nexus/pom.xml | 27 +++++++++++++++++++-
.../catalog/nexus/LocalFileNexusRepository.java | 4 +--
.../catalog/nexus/LocalNexusRepositoryTest.java | 5 +---
.../src/test/resources/nexus-sample-result.xml | 12 ++++-----
4 files changed, 35 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/8dfed853/platforms/catalog-nexus/pom.xml
----------------------------------------------------------------------
diff --git a/platforms/catalog-nexus/pom.xml b/platforms/catalog-nexus/pom.xml
index e3bfe15..e0fbc32 100644
--- a/platforms/catalog-nexus/pom.xml
+++ b/platforms/catalog-nexus/pom.xml
@@ -42,7 +42,6 @@
<groupId>org.apache.camel</groupId>
<artifactId>camel-catalog</artifactId>
</dependency>
-
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
@@ -81,6 +80,32 @@
<plugins>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-resources-plugin</artifactId>
+ <version>${maven-resources-plugin-version}</version>
+ <executions>
+ <execution>
+ <id>copy-dummy-component</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${project.build.directory}/localrepo</outputDirectory>
+ <resources>
+ <resource>
+ <directory>../dummy-component/target</directory>
+ <includes>
+ <include>*.jar</include>
+ </includes>
+ </resource>
+ </resources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
http://git-wip-us.apache.org/repos/asf/camel/blob/8dfed853/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalFileNexusRepository.java
----------------------------------------------------------------------
diff --git a/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalFileNexusRepository.java b/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalFileNexusRepository.java
index 1d341d3..f3c3327 100644
--- a/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalFileNexusRepository.java
+++ b/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalFileNexusRepository.java
@@ -30,7 +30,7 @@ public class LocalFileNexusRepository extends ComponentNexusRepository {
@Override
protected String createArtifactURL(NexusArtifactDto dto) {
- // load from file instead
- return "file:target/" + dto.getArtifactId() + "-" + dto.getVersion() + ".jar";
+ // load from local file instead
+ return "file:target/localrepo/" + dto.getArtifactId() + "-" + dto.getVersion() + ".jar";
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/8dfed853/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalNexusRepositoryTest.java
----------------------------------------------------------------------
diff --git a/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalNexusRepositoryTest.java b/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalNexusRepositoryTest.java
index 9f9d7ec..5382b41 100644
--- a/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalNexusRepositoryTest.java
+++ b/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalNexusRepositoryTest.java
@@ -19,7 +19,6 @@ package org.apache.camel.catalog.nexus;
import junit.framework.TestCase;
import org.apache.camel.catalog.CamelCatalog;
import org.apache.camel.catalog.DefaultCamelCatalog;
-import org.junit.Ignore;
import org.junit.Test;
public class LocalNexusRepositoryTest extends TestCase {
@@ -37,14 +36,12 @@ public class LocalNexusRepositoryTest extends TestCase {
}
@Test
- @Ignore("Work in progress")
public void testLocalNexus() throws Exception {
int before = catalog.findComponentNames().size();
repo.start();
- // TODO: create custom component we can use for testing here
- // and only wait as long until a new component is added
+ // TODO only wait as long until a new component is added
Thread.sleep(5000);
repo.stop();
http://git-wip-us.apache.org/repos/asf/camel/blob/8dfed853/platforms/catalog-nexus/src/test/resources/nexus-sample-result.xml
----------------------------------------------------------------------
diff --git a/platforms/catalog-nexus/src/test/resources/nexus-sample-result.xml b/platforms/catalog-nexus/src/test/resources/nexus-sample-result.xml
index 16b60b0..8357e21 100644
--- a/platforms/catalog-nexus/src/test/resources/nexus-sample-result.xml
+++ b/platforms/catalog-nexus/src/test/resources/nexus-sample-result.xml
@@ -21,17 +21,17 @@
<tooManyResults>false</tooManyResults>
<data>
<artifact>
- <resourceURI>http://nexus.dummy/service/local/repositories/staging/content/org/foo/beverage-component/2.19.0/beverage-component-2.19.0.jar</resourceURI>
- <groupId>org.foo</groupId>
- <artifactId>beverage-component</artifactId>
+ <resourceURI>http://nexus.dummy/service/local/repositories/staging/content/org/apache/camel/dummy-component/2.19.0/dummy-component-2.19.0.jar</resourceURI>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>dummy-component</artifactId>
<version>2.19.0</version>
<packaging>jar</packaging>
<extension>jar</extension>
<repoId>staging</repoId>
<contextId>Staging</contextId>
- <pomLink>http://nexus.dummy/service/local/artifact/maven/redirect?r=staging&g=org.foo&a=beverage-component&v=2.19.0&e=pom</pomLink>
- <artifactLink>http://nexus.dummy/service/local/artifact/maven/redirect?r=staging&g=org.foo&a=beverage-component&v=2.19.0&e=jar</artifactLink>
- <highlightedFragment><blockquote>Artifact ID<UL><LI>beverage-<B>component</B></LI></UL></blockquote></highlightedFragment>
+ <pomLink>http://nexus.dummy/service/local/artifact/maven/redirect?r=staging&g=org.apache.camel&a=dummy-component&v=2.19.0&e=pom</pomLink>
+ <artifactLink>http://nexus.dummy/service/local/artifact/maven/redirect?r=staging&g=org.apache.camel&a=dummy-component&v=2.19.0&e=jar</artifactLink>
+ <highlightedFragment><blockquote>Artifact ID<UL><LI>dummy-<B>component</B></LI></UL></blockquote></highlightedFragment>
</artifact>
</data>
</search-results>
\ No newline at end of file