CAMEL-9778: Remove deprecated GAE component and dependencies
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/8f0bcd80 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/8f0bcd80 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/8f0bcd80 Branch: refs/heads/master Commit: 8f0bcd803e689cf797c75599513e817f964501b5 Parents: aa3d9e4 Author: jpoth <jp...@redhat.com> Authored: Wed Mar 30 18:32:23 2016 +0200 Committer: Claus Ibsen <davscl...@apache.org> Committed: Wed Mar 30 19:45:46 2016 +0200 ---------------------------------------------------------------------- README.md | 1 - apache-camel/pom.xml | 4 - .../src/main/descriptors/common-bin.xml | 1 - apache-camel/src/main/release/README.txt | 1 - components/camel-gae/pom.xml | 211 -------------- components/camel-gae/src/main/docs/gae.adoc | 207 -------------- .../gae/auth/GAuthAuthorizeBinding.java | 95 ------- .../component/gae/auth/GAuthComponent.java | 114 -------- .../camel/component/gae/auth/GAuthEndpoint.java | 278 ------------------- .../component/gae/auth/GAuthException.java | 38 --- .../component/gae/auth/GAuthJksLoader.java | 109 -------- .../component/gae/auth/GAuthKeyLoader.java | 37 --- .../component/gae/auth/GAuthPk8Loader.java | 82 ------ .../camel/component/gae/auth/GAuthProducer.java | 63 ----- .../camel/component/gae/auth/GAuthService.java | 42 --- .../component/gae/auth/GAuthServiceImpl.java | 40 --- .../component/gae/auth/GAuthTokenSecret.java | 80 ------ .../component/gae/auth/GAuthUpgradeBinding.java | 103 ------- .../gae/bind/HttpBindingInvocationHandler.java | 59 ---- .../component/gae/bind/InboundBinding.java | 56 ---- .../gae/bind/InboundBindingSupport.java | 34 --- .../component/gae/bind/OutboundBinding.java | 56 ---- .../gae/bind/OutboundBindingSupport.java | 34 --- .../gae/context/GaeDefaultCamelContext.java | 30 -- .../camel/component/gae/http/GHttpBinding.java | 190 ------------- .../component/gae/http/GHttpComponent.java | 72 ----- .../camel/component/gae/http/GHttpEndpoint.java | 149 ---------- .../component/gae/http/GHttpException.java | 53 ---- .../camel/component/gae/http/GHttpProducer.java | 61 ---- .../component/gae/login/GLoginBinding.java | 102 ------- .../component/gae/login/GLoginComponent.java | 79 ------ .../camel/component/gae/login/GLoginData.java | 125 --------- .../component/gae/login/GLoginEndpoint.java | 216 -------------- .../component/gae/login/GLoginProducer.java | 57 ---- .../component/gae/login/GLoginService.java | 41 --- .../component/gae/login/GLoginServiceImpl.java | 117 -------- .../camel/component/gae/mail/GMailBinding.java | 133 --------- .../component/gae/mail/GMailComponent.java | 48 ---- .../camel/component/gae/mail/GMailEndpoint.java | 132 --------- .../camel/component/gae/mail/GMailProducer.java | 55 ---- .../camel/component/gae/task/GTaskBinding.java | 157 ----------- .../component/gae/task/GTaskComponent.java | 85 ------ .../camel/component/gae/task/GTaskEndpoint.java | 155 ----------- .../component/gae/task/GTaskEndpointInfo.java | 61 ---- .../camel/component/gae/task/GTaskProducer.java | 54 ---- .../src/main/resources/META-INF/LICENSE.txt | 203 -------------- .../src/main/resources/META-INF/NOTICE.txt | 11 - .../services/org/apache/camel/component/gauth | 18 -- .../services/org/apache/camel/component/ghttp | 18 -- .../services/org/apache/camel/component/ghttps | 18 -- .../services/org/apache/camel/component/glogin | 18 -- .../services/org/apache/camel/component/gmail | 18 -- .../services/org/apache/camel/component/gtask | 18 -- .../apache/camel/component/gae/TestConfig.java | 36 --- .../gae/auth/GAuthAuthorizeBindingTest.java | 91 ------ .../component/gae/auth/GAuthEndpointTest.java | 111 -------- .../component/gae/auth/GAuthJksLoaderTest.java | 52 ---- .../component/gae/auth/GAuthPk8LoaderTest.java | 48 ---- .../component/gae/auth/GAuthRouteBuilder.java | 42 --- .../gae/auth/GAuthRouteBuilderTest.java | 106 ------- .../component/gae/auth/GAuthServiceMock.java | 33 --- .../component/gae/auth/GAuthTestUtils.java | 47 ---- .../gae/auth/GAuthTokenSecretTest.java | 60 ---- .../gae/auth/GAuthUpgradeBindingTest.java | 93 ------- .../component/gae/http/GHttpBindingTest.java | 193 ------------- .../gae/http/GHttpCombinedRouteBuilder.java | 37 --- .../gae/http/GHttpCombinedRouteBuilderTest.java | 104 ------- .../component/gae/http/GHttpEndpointTest.java | 65 ----- .../gae/http/GHttpInboundRouteBuilder.java | 33 --- .../gae/http/GHttpInboundRouteBuilderTest.java | 63 ----- .../gae/http/GHttpOutboundRouteBuilder.java | 32 --- .../gae/http/GHttpOutboundRouteBuilderTest.java | 97 ------- .../component/gae/http/GHttpTestServlet.java | 69 ----- .../component/gae/http/GHttpTestUtils.java | 71 ----- .../component/gae/login/GLoginBindingTest.java | 86 ------ .../component/gae/login/GLoginEndpointTest.java | 56 ---- .../component/gae/login/GLoginRouteBuilder.java | 32 --- .../gae/login/GLoginRouteBuilderTest.java | 47 ---- .../component/gae/login/GLoginServiceMock.java | 29 -- .../component/gae/login/GLoginTestUtils.java | 52 ---- .../component/gae/mail/GMailBindingTest.java | 143 ---------- .../component/gae/mail/GMailEndpointTest.java | 48 ---- .../gae/mail/GMailOutboundRouteBuilder.java | 31 --- .../gae/mail/GMailOutboundRouteBuilderTest.java | 98 ------- .../component/gae/mail/GMailTestUtils.java | 52 ---- .../gae/support/ServletTestSupport.java | 64 ----- .../component/gae/task/GTaskBindingTest.java | 149 ---------- .../gae/task/GTaskCombinedRouteBuilder.java | 29 -- .../gae/task/GTaskCombinedRouteBuilderTest.java | 91 ------ .../component/gae/task/GTaskEndpointTest.java | 55 ---- .../component/gae/task/GTaskTestUtils.java | 110 -------- .../src/test/resources/log4j.properties | 36 --- .../apache/camel/component/gae/auth/context.xml | 53 ---- .../apache/camel/component/gae/auth/test1.jks | Bin 1200 -> 0 bytes .../apache/camel/component/gae/auth/test2.pk8 | 16 -- .../component/gae/http/context-combined.xml | 34 --- .../component/gae/http/context-inbound.xml | 34 --- .../component/gae/http/context-outbound.xml | 34 --- .../camel/component/gae/http/web-combined.xml | 43 --- .../camel/component/gae/http/web-inbound.xml | 43 --- .../camel/component/gae/login/context.xml | 36 --- .../component/gae/mail/context-outbound.xml | 34 --- .../component/gae/task/context-combined.xml | 34 --- .../camel/component/gae/task/web-combined.xml | 44 --- components/pom.xml | 1 - docs/user-manual/en/SUMMARY.md | 1 - examples/README.md | 2 - examples/camel-example-gae/README.md | 16 -- examples/camel-example-gae/pom.xml | 60 ---- .../apache/camel/example/gae/ReportData.java | 85 ------ .../camel/example/gae/ReportGenerator.java | 57 ---- .../camel/example/gae/RequestProcessor.java | 43 --- .../camel/example/gae/ResponseProcessor.java | 39 --- .../camel/example/gae/TutorialRouteBuilder.java | 84 ------ .../src/main/resources/META-INF/LICENSE.txt | 203 -------------- .../src/main/resources/META-INF/NOTICE.txt | 11 - .../src/main/resources/context.xml | 35 --- .../src/main/webapp/WEB-INF/appengine-web.xml | 32 --- .../src/main/webapp/WEB-INF/logging.properties | 32 --- .../src/main/webapp/WEB-INF/web.xml | 68 ----- .../src/main/webapp/index.html | 61 ---- examples/camel-example-gauth/README.md | 15 - examples/camel-example-gauth/pom.xml | 112 -------- .../camel/example/gauth/TutorialController.java | 101 ------- .../example/gauth/TutorialRouteBuilder.java | 63 ----- .../camel/example/gauth/TutorialService.java | 79 ------ .../example/gauth/TutorialTokenProcessor.java | 70 ----- .../src/main/resources/META-INF/LICENSE.txt | 203 -------------- .../src/main/resources/META-INF/NOTICE.txt | 11 - .../src/main/resources/appengine-web.xml | 28 -- .../src/main/resources/context-camel.xml | 47 ---- .../src/main/resources/context-web.xml | 37 --- .../src/main/resources/context.properties | 20 -- .../src/main/resources/log4j.properties | 36 --- .../src/main/webapp/WEB-INF/jsp/authorize.jsp | 22 -- .../src/main/webapp/WEB-INF/jsp/bottom.jsp | 26 -- .../src/main/webapp/WEB-INF/jsp/calendar.jsp | 26 -- .../src/main/webapp/WEB-INF/jsp/top.jsp | 30 -- .../src/main/webapp/WEB-INF/logging.properties | 36 --- .../src/main/webapp/WEB-INF/web.xml | 55 ---- .../src/main/webapp/images/camel.png | Bin 131396 -> 0 bytes .../src/main/webapp/index.html | 28 -- examples/pom.xml | 2 - parent/pom.xml | 9 - .../features/src/main/resources/features.xml | 7 - 145 files changed, 9228 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/8f0bcd80/README.md ---------------------------------------------------------------------- diff --git a/README.md b/README.md index e8c805d..11fe26b 100755 --- a/README.md +++ b/README.md @@ -113,7 +113,6 @@ software: * **camel-crypto** can be used for secure communications * **camel-cxf** can be configured for secure communications * **camel-ftp** can be configured for secure communications -* **camel-gae** can be configured for secure communications * **camel-http** can be configured to use https * **camel-http4** can be configured to use https * **camel-infinispan** can be configured for secure communications http://git-wip-us.apache.org/repos/asf/camel/blob/8f0bcd80/apache-camel/pom.xml ---------------------------------------------------------------------- diff --git a/apache-camel/pom.xml b/apache-camel/pom.xml index 454232c..34d0f8e 100644 --- a/apache-camel/pom.xml +++ b/apache-camel/pom.xml @@ -257,10 +257,6 @@ </dependency> <dependency> <groupId>org.apache.camel</groupId> - <artifactId>camel-gae</artifactId> - </dependency> - <dependency> - <groupId>org.apache.camel</groupId> <artifactId>camel-ganglia</artifactId> </dependency> <dependency> http://git-wip-us.apache.org/repos/asf/camel/blob/8f0bcd80/apache-camel/src/main/descriptors/common-bin.xml ---------------------------------------------------------------------- diff --git a/apache-camel/src/main/descriptors/common-bin.xml b/apache-camel/src/main/descriptors/common-bin.xml index a70adc6..40bff7c 100644 --- a/apache-camel/src/main/descriptors/common-bin.xml +++ b/apache-camel/src/main/descriptors/common-bin.xml @@ -77,7 +77,6 @@ <include>org.apache.camel:camel-fop</include> <include>org.apache.camel:camel-freemarker</include> <include>org.apache.camel:camel-ftp</include> - <include>org.apache.camel:camel-gae</include> <include>org.apache.camel:camel-ganglia</include> <include>org.apache.camel:camel-geocoder</include> <include>org.apache.camel:camel-git</include> http://git-wip-us.apache.org/repos/asf/camel/blob/8f0bcd80/apache-camel/src/main/release/README.txt ---------------------------------------------------------------------- diff --git a/apache-camel/src/main/release/README.txt b/apache-camel/src/main/release/README.txt index 04d3015..843dabf 100755 --- a/apache-camel/src/main/release/README.txt +++ b/apache-camel/src/main/release/README.txt @@ -96,7 +96,6 @@ software: * camel-crypto can be used for secure communications * camel-cxf can be configured for secure communications * camel-ftp can be configured for secure communications - * camel-gae can be configured for secure communications * camel-http can be configured to use https * camel-http4 can be configured to use https * camel-jasypt can be used for secure communications http://git-wip-us.apache.org/repos/asf/camel/blob/8f0bcd80/components/camel-gae/pom.xml ---------------------------------------------------------------------- diff --git a/components/camel-gae/pom.xml b/components/camel-gae/pom.xml deleted file mode 100644 index b6099be..0000000 --- a/components/camel-gae/pom.xml +++ /dev/null @@ -1,211 +0,0 @@ -<?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>components</artifactId> - <version>2.18-SNAPSHOT</version> - </parent> - - <artifactId>camel-gae</artifactId> - <packaging>bundle</packaging> - <name>Camel :: GAE</name> - <description>Camel GAE support (deprecated)</description> - - <properties> - <camel.osgi.import.before.defaults> - javax.servlet.*;version="${servlet-version-range}" - </camel.osgi.import.before.defaults> - <camel.osgi.export.pkg>org.apache.camel.component.gae.*</camel.osgi.export.pkg> - <camel.osgi.export.service> - org.apache.camel.spi.ComponentResolver;component=gauth, - org.apache.camel.spi.ComponentResolver;component=ghttp, - org.apache.camel.spi.ComponentResolver;component=ghttps, - org.apache.camel.spi.ComponentResolver;component=glogin, - org.apache.camel.spi.ComponentResolver;component=gmail, - org.apache.camel.spi.ComponentResolver;component=gtask - </camel.osgi.export.service> - </properties> - - <dependencies> - - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-servlet</artifactId> - </dependency> - <dependency> - <groupId>javax.servlet</groupId> - <artifactId>javax.servlet-api</artifactId> - <scope>provided</scope> - </dependency> - - <dependency> - <groupId>com.google.appengine</groupId> - <artifactId>appengine-api-1.0-sdk</artifactId> - <version>${google-app-engine-version}</version> - </dependency> - <dependency> - <groupId>com.google.appengine</groupId> - <artifactId>appengine-api-labs</artifactId> - <version>${google-app-engine-version}</version> - </dependency> - <dependency> - <groupId>com.google.gdata</groupId> - <artifactId>core</artifactId> - <version>1.47.1</version> - </dependency> - - <!-- need to exclude dependencies as they are not in maven central --> - <dependency> - <groupId>org.openengsb.wrapped</groupId> - <artifactId>com.google.gdata</artifactId> - <version>${google-gdata-version}</version> - <exclusions> - <exclusion> - <groupId>com.google.gdata</groupId> - <artifactId>gdata-contacts-3.0</artifactId> - </exclusion> - <exclusion> - <groupId>com.google.gdata</groupId> - <artifactId>gdata-calendar-2.0</artifactId> - </exclusion> - <exclusion> - <groupId>com.google.gdata</groupId> - <artifactId>gdata-client-1.0</artifactId> - </exclusion> - <exclusion> - <groupId>com.google.gdata</groupId> - <artifactId>gdata-core-1.0</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.openengsb.wrapped</groupId> - <artifactId>com.google.gdata-contacts</artifactId> - <version>${google-gdata-version}</version> - <exclusions> - <exclusion> - <groupId>com.google.gdata</groupId> - <artifactId>gdata-contacts-3.0</artifactId> - </exclusion> - <exclusion> - <groupId>com.google.gdata</groupId> - <artifactId>gdata-client-1.0</artifactId> - </exclusion> - <exclusion> - <groupId>com.google.gdata</groupId> - <artifactId>gdata-core-1.0</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.openengsb.wrapped</groupId> - <artifactId>com.google.gdata-calendar</artifactId> - <version>${google-gdata-version}</version> - <exclusions> - <exclusion> - <groupId>com.google.gdata</groupId> - <artifactId>gdata-client-1.0</artifactId> - </exclusion> - <exclusion> - <groupId>com.google.gdata</groupId> - <artifactId>gdata-calendar-2.0</artifactId> - </exclusion> - <exclusion> - <groupId>com.google.gdata</groupId> - <artifactId>gdata-core-1.0</artifactId> - </exclusion> - </exclusions> - </dependency> - - <!-- testing --> - <dependency> - <groupId>com.google.appengine</groupId> - <artifactId>appengine-api-stubs</artifactId> - <version>${google-app-engine-version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>com.google.appengine</groupId> - <artifactId>appengine-testing</artifactId> - <version>${google-app-engine-version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.eclipse.jetty</groupId> - <artifactId>jetty-server</artifactId> - <version>${jetty-version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.eclipse.jetty</groupId> - <artifactId>jetty-servlet</artifactId> - <version>${jetty-version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-test</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-test</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-spring</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-web</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>httpunit</groupId> - <artifactId>httpunit</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-log4j12</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - </dependencies> - - <build> - <plugins> - <plugin> - <artifactId>maven-surefire-plugin</artifactId> - <configuration> - <forkCount>1</forkCount> - <reuseForks>false</reuseForks> - </configuration> - </plugin> - </plugins> - </build> -</project> http://git-wip-us.apache.org/repos/asf/camel/blob/8f0bcd80/components/camel-gae/src/main/docs/gae.adoc ---------------------------------------------------------------------- diff --git a/components/camel-gae/src/main/docs/gae.adoc b/components/camel-gae/src/main/docs/gae.adoc deleted file mode 100644 index 148169c..0000000 --- a/components/camel-gae/src/main/docs/gae.adoc +++ /dev/null @@ -1,207 +0,0 @@ -[[GAE-CamelComponentsforGoogleAppEngine]] -Camel Components for Google App Engine (Deprecated) -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -*Tutorials* - -* A good starting point for using Camel on GAE is the -link:tutorial-for-camel-on-google-app-engine.html[Tutorial for Camel on -Google App Engine] -* The link:tutorial-oauth.html[OAuth tutorial] demonstrates how to -implement http://oauth.net/[OAuth] in web applications. - -The Camel components for http://code.google.com/appengine/[Google App -Engine] (GAE) are part of the `camel-gae` project and provide -connectivity to GAE's -http://code.google.com/appengine/docs/java/apis.html[cloud computing -services]. They make the GAE cloud computing environment accessible to -applications via Camel interfaces. Following this pattern for other -cloud computing environments could make it easier to port Camel -applications from one cloud computing provider to another. The following -table lists the cloud computing services provided by Google and the -supporting Camel components. The documentation of each component can be -found by following the link in the _Camel Component_ column. - -[width="100%",cols="10%,10%,80%",options="header",] -|======================================================================= -|GAE service |Camel component |Component description - -|http://code.google.com/appengine/docs/java/urlfetch/[URL fetch service] |link:ghttp.html[ghttp] |Provides connectivity to the GAE URL fetch service but can also be used -to receive messages from servlets. - -|http://code.google.com/appengine/docs/java/taskqueue/[Task queueing -service] |link:gtask.html[gtask] |Supports asynchronous message processing on GAE by using the task -queueing service as message queue. - -|http://code.google.com/appengine/docs/java/mail/[Mail service] |link:gmail.html[gmail] |Supports sending of emails via the GAE mail service. Receiving mails is -not supported yet but will be added later. - -|http://code.google.com/appengine/docs/java/memcache/[Memcache service] | | Not supported yet. - -|http://code.google.com/appengine/docs/java/xmpp/[XMPP service] | | Not supported yet. - -|http://code.google.com/appengine/docs/java/images/[Images service] | | Not supported yet. - -|http://code.google.com/appengine/docs/java/datastore/[Datastore service] | | Not supported yet. - -|http://code.google.com/apis/accounts/[Accounts service] |link:gauth.html[gauth] - link:glogin.html[glogin] | -|======================================================================= - -These components interact with the Google Accounts API for -authentication and authorization. Google Accounts is not specific to -Google App Engine but is often used by GAE applications for implementing -security. The link:gauth.html[gauth] component is used by web -applications to implement a -http://code.google.com/apis/accounts/docs/OAuth.html[Google-specific -OAuth] consumer. This component can also be used to OAuth-enable non-GAE -web applications. The link:glogin.html[glogin] component is used by Java -clients (outside GAE) for programmatic login to GAE applications. For -instructions how to protect GAE applications against unauthorized access -refer to the link:gsec.html[Security for Camel GAE applications] page. - -[[GAE-Camelcontext]] -Camel context -^^^^^^^^^^^^^ - -Setting up a `SpringCamelContext` on Google App Engine differs between -Camel 2.1 and higher versions. The problem is that usage of the -Camel-specific Spring configuration XML schema from the -`http://camel.apache.org/schema/spring` namespace requires JAXB and -Camel 2.1 depends on a Google App Engine SDK version that doesn't -support JAXB yet. This limitation has been removed since Camel 2.2. - -JMX must be disabled in any case because the `javax.management` package -isn't on the App Engine JRE whitelist. - -[[GAE-Camel2.1]] -Camel 2.1 -+++++++++ - -`camel-gae` 2.1 comes with the following `CamelContext` implementations. - -* `org.apache.camel.component.gae.context.GaeDefaultCamelContext` -(extends `org.apache.camel.impl.DefaultCamelContext`) -* `org.apache.camel.component.gae.context.GaeSpringCamelContext` -(extends `org.apache.camel.spring.SpringCamelContext`) - -Both disable JMX before startup. The `GaeSpringCamelContext` -additionally provides setter methods adding route builders as shown in -the next example. - -*appctx.xml* - -[source,xml] ------------------------------------------------------------------------------ -<beans xmlns="http://www.springframework.org/schema/beans" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation=" -http://www.springframework.org/schema/beans -http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"> - - <bean id="camelContext" - class="org.apache.camel.component.gae.context.GaeSpringCamelContext"> - <property name="routeBuilder" ref="myRouteBuilder" /> - </bean> - - <bean id="myRouteBuilder" - class="org.example.MyRouteBuilder"> - </bean> - -</beans> ------------------------------------------------------------------------------ - -Alternatively, use the `routeBuilders` property of the -`GaeSpringCamelContext` for setting a list of route builders. Using this -approach, a `SpringCamelContext` can be configured on GAE without the -need for JAXB. - -[[GAE-Camel2.2orhigher]] -Camel 2.2 or higher -+++++++++++++++++++ - -With Camel 2.2 or higher, applications can use the -`http://camel.apache.org/schema/spring` namespace for configuring a -`SpringCamelContext` but still need to disable JMX. Here's an example. - -*appctx.xml* - -[source,xml] ----------------------------------------------------------------- -<beans xmlns="http://www.springframework.org/schema/beans" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:camel="http://camel.apache.org/schema/spring" - xsi:schemaLocation=" -http://www.springframework.org/schema/beans -http://www.springframework.org/schema/beans/spring-beans-2.5.xsd -http://camel.apache.org/schema/spring -http://camel.apache.org/schema/spring/camel-spring.xsd"> - - <camel:camelContext id="camelContext"> - <camel:jmxAgent id="agent" disabled="true" /> - <camel:routeBuilder ref="myRouteBuilder"/> - </camel:camelContext> - - <bean id="myRouteBuilder" - class="org.example.MyRouteBuilder"> - </bean> - -</beans> ----------------------------------------------------------------- - -[[GAE-Theweb.xml]] -The web.xml -^^^^^^^^^^^ - -Running Camel on GAE requires usage of the `CamelHttpTransportServlet` -from `camel-servlet`. The following example shows how to configure this -servlet together with a Spring application context XML file. - -*web.xml* - -[source,xml] ---------------------------------------------------------------------------------------------------- -<web-app -xmlns="http://java.sun.com/xml/ns/javaee" -xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" -xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" -xsi:schemaLocation=" -http://java.sun.com/xml/ns/javaee -http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5"> - - <servlet> - <servlet-name>CamelServlet</servlet-name> - <servlet-class>org.apache.camel.component.servlet.CamelHttpTransportServlet</servlet-class> - <init-param> - <param-name>contextConfigLocation</param-name> - <param-value>appctx.xml</param-value> - </init-param> - </servlet> - - <!-- - Mapping used for external requests - --> - <servlet-mapping> - <servlet-name>CamelServlet</servlet-name> - <url-pattern>/camel/*</url-pattern> - </servlet-mapping> - - <!-- - Mapping used for web hooks accessed by task queueing service. - --> - <servlet-mapping> - <servlet-name>CamelServlet</servlet-name> - <url-pattern>/worker/*</url-pattern> - </servlet-mapping> - -</web-app> ---------------------------------------------------------------------------------------------------- - -The location of the Spring application context XML file is given by the -`contextConfigLocation` init parameter. The `appctx.xml` file must be on -the classpath. The servlet mapping makes the Camel application -accessible under `http://<appname>.appspot.com/camel/...` when deployed -to Google App Engine where `<appname>` must be replaced by a real GAE -application name. The second servlet mapping is used internally by the -task queueing service for background processing via -http://www.webhooks.org/[web hooks]. This mapping is relevant for the -link:gtask.html[gtask] component and is explained there in more detail. http://git-wip-us.apache.org/repos/asf/camel/blob/8f0bcd80/components/camel-gae/src/main/java/org/apache/camel/component/gae/auth/GAuthAuthorizeBinding.java ---------------------------------------------------------------------- diff --git a/components/camel-gae/src/main/java/org/apache/camel/component/gae/auth/GAuthAuthorizeBinding.java b/components/camel-gae/src/main/java/org/apache/camel/component/gae/auth/GAuthAuthorizeBinding.java deleted file mode 100644 index 147d7b4..0000000 --- a/components/camel-gae/src/main/java/org/apache/camel/component/gae/auth/GAuthAuthorizeBinding.java +++ /dev/null @@ -1,95 +0,0 @@ -/** - * 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.gae.auth; - -import com.google.gdata.client.authn.oauth.GoogleOAuthParameters; - -import org.apache.camel.Exchange; -import org.apache.camel.component.gae.bind.OutboundBinding; - -/** - * Binds {@link GoogleOAuthParameters} to a Camel {@link Exchange}. This binding - * is used by <code>gauth:authorize</code> endpoints by default. - */ -public class GAuthAuthorizeBinding implements OutboundBinding<GAuthEndpoint, GoogleOAuthParameters, GoogleOAuthParameters> { - - /** - * Name of the Camel header defining the access scope. Overrides the scope - * parameter defined in a <code>gauth:authorize</code> endpoint URI. - */ - public static final String GAUTH_SCOPE = "CamelGauthScope"; - - /** - * Name of the Camel header containing a callback URL. Overrides the - * callback parameter defined in a <code>gauth:authorize</code> endpoint - * URI. - */ - public static final String GAUTH_CALLBACK = "CamelGauthCallback"; - - /** - * Creates a {@link GoogleOAuthParameters} object from endpoint and - * <code>exchange.getIn()</code> data. The created parameter object is - * used to fetch an unauthorized request token from Google. - * - * @param endpoint - * @param exchange - * @param request - * ignored. - * @return - */ - public GoogleOAuthParameters writeRequest(GAuthEndpoint endpoint, Exchange exchange, GoogleOAuthParameters request) { - String callback = exchange.getIn().getHeader(GAUTH_CALLBACK, String.class); - if (callback == null) { - callback = endpoint.getCallback(); - } - String scope = exchange.getIn().getHeader(GAUTH_SCOPE, String.class); - if (scope == null) { - scope = endpoint.getScope(); - } - request = new GoogleOAuthParameters(); - request.setOAuthConsumerKey(endpoint.getConsumerKey()); - request.setOAuthConsumerSecret(endpoint.getConsumerSecret()); - request.setOAuthCallback(callback); - request.setScope(scope); - return request; - } - - /** - * Creates an <code>exchange.getOut()</code> message that represents an HTTP - * redirect to Google's OAuth confirmation page. Additionally, if the - * {@link GAuthComponent} is configured to use the HMAC_SHA1 signature - * method, a cookie is created containing the request token secret. It is - * needed later to upgrade an authorized request token to an access token. - */ - public Exchange readResponse(GAuthEndpoint endpoint, Exchange exchange, GoogleOAuthParameters response) throws Exception { - String authrUrl = endpoint.newOAuthHelper().createUserAuthorizationUrl(response); - exchange.getOut().setHeaders(exchange.getIn().getHeaders()); - exchange.getOut().setHeader(Exchange.HTTP_RESPONSE_CODE, 302); - exchange.getOut().setHeader("Location", authrUrl); - - if (endpoint.getComponent().getKeyLoader() == null) { - // HMAC_SHA1 signature is used and this requires a - // token secret. Add it to a cookie because it is - // later needed for getting an access token. - String secret = response.getOAuthTokenSecret(); - String cookie = new GAuthTokenSecret(secret).toCookie(); - exchange.getOut().setHeader("Set-Cookie", cookie); - } - return exchange; - } - -} http://git-wip-us.apache.org/repos/asf/camel/blob/8f0bcd80/components/camel-gae/src/main/java/org/apache/camel/component/gae/auth/GAuthComponent.java ---------------------------------------------------------------------- diff --git a/components/camel-gae/src/main/java/org/apache/camel/component/gae/auth/GAuthComponent.java b/components/camel-gae/src/main/java/org/apache/camel/component/gae/auth/GAuthComponent.java deleted file mode 100644 index 90b6280..0000000 --- a/components/camel-gae/src/main/java/org/apache/camel/component/gae/auth/GAuthComponent.java +++ /dev/null @@ -1,114 +0,0 @@ -/** - * 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.gae.auth; - -import java.util.Map; - -import com.google.gdata.client.authn.oauth.GoogleOAuthParameters; -import org.apache.camel.CamelContext; -import org.apache.camel.Endpoint; -import org.apache.camel.component.gae.bind.OutboundBinding; -import org.apache.camel.impl.UriEndpointComponent; - -/** - * The <a href="http://camel.apache.org/gauth.html">GAuth Component</a> - * implements a Google-specific OAuth comsumer. This component supports OAuth - * 1.0a. For background information refer to <a - * href="http://code.google.com/apis/accounts/docs/OAuth.html">OAuth for Web - * Applications</a> and the <a - * href="http://code.google.com/apis/gdata/docs/auth/oauth.html">GData developer - * guide for OAuth.</a>. - */ -public class GAuthComponent extends UriEndpointComponent { - - private String consumerKey; - private String consumerSecret; - private GAuthKeyLoader keyLoader; - - public GAuthComponent() { - super(GAuthEndpoint.class); - } - - public GAuthComponent(CamelContext context) { - super(context, GAuthEndpoint.class); - } - - public String getConsumerKey() { - return consumerKey; - } - - /** - * Domain identifying the web application. This is the domain used when registering the application with Google. - * Example: camelcloud.appspot.com. For a non-registered application use anonymous. - */ - public void setConsumerKey(String consumerKey) { - this.consumerKey = consumerKey; - } - - public String getConsumerSecret() { - return consumerSecret; - } - - /** - * Consumer secret of the web application. The consumer secret is generated when when registering the application with Google. - * It is needed if the HMAC-SHA1 signature method shall be used. For a non-registered application use anonymous. - */ - public void setConsumerSecret(String consumerSecret) { - this.consumerSecret = consumerSecret; - } - - public GAuthKeyLoader getKeyLoader() { - return keyLoader; - } - - /** - * To configure a key loader to use. - * Part of camel-gae are two key loaders: GAuthPk8Loader for loading a private key from a PKCS#8 file and GAuthJksLoader to load a private key from a Java key store. - * It is needed if the RSA-SHA1 signature method shall be used. These classes are defined in the org.apache.camel.component.gae.auth package. - */ - public void setKeyLoader(GAuthKeyLoader keyLoader) { - this.keyLoader = keyLoader; - } - - @Override - public GAuthEndpoint createEndpoint(String uri) throws Exception { - return (GAuthEndpoint)super.createEndpoint(uri); - } - - @Override - protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception { - GAuthEndpoint endpoint = new GAuthEndpoint(uri, this, remaining); - OutboundBinding<GAuthEndpoint, GoogleOAuthParameters, GoogleOAuthParameters> authorizeBinding = resolveAndRemoveReferenceParameter( - parameters, "authorizeBindingRef", GAuthAuthorizeBinding.class, new GAuthAuthorizeBinding()); - OutboundBinding<GAuthEndpoint, GoogleOAuthParameters, GoogleOAuthParameters> upgradeBinding = resolveAndRemoveReferenceParameter( - parameters, "upgradeBindingRef", GAuthUpgradeBinding.class, new GAuthUpgradeBinding()); - GAuthService service = resolveAndRemoveReferenceParameter( - parameters, "serviceRef", GAuthService.class, new GAuthServiceImpl(endpoint)); - GAuthKeyLoader keyLoader = resolveAndRemoveReferenceParameter( - parameters, "keyLoaderRef", GAuthKeyLoader.class); - endpoint.setAuthorizeBinding(authorizeBinding); - endpoint.setUpgradeBinding(upgradeBinding); - endpoint.setService(service); - // ensure to inject CamelContext to key loader - if (keyLoader != null) { - keyLoader.setCamelContext(getCamelContext()); - } - endpoint.setKeyLoader(keyLoader); - return endpoint; - } - -} http://git-wip-us.apache.org/repos/asf/camel/blob/8f0bcd80/components/camel-gae/src/main/java/org/apache/camel/component/gae/auth/GAuthEndpoint.java ---------------------------------------------------------------------- diff --git a/components/camel-gae/src/main/java/org/apache/camel/component/gae/auth/GAuthEndpoint.java b/components/camel-gae/src/main/java/org/apache/camel/component/gae/auth/GAuthEndpoint.java deleted file mode 100644 index 6ae5d7f..0000000 --- a/components/camel-gae/src/main/java/org/apache/camel/component/gae/auth/GAuthEndpoint.java +++ /dev/null @@ -1,278 +0,0 @@ -/** - * 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.gae.auth; - -import java.security.PrivateKey; - -import com.google.gdata.client.authn.oauth.GoogleOAuthHelper; -import com.google.gdata.client.authn.oauth.GoogleOAuthParameters; -import com.google.gdata.client.authn.oauth.OAuthHelper; -import com.google.gdata.client.authn.oauth.OAuthHmacSha1Signer; -import com.google.gdata.client.authn.oauth.OAuthRsaSha1Signer; -import com.google.gdata.client.authn.oauth.OAuthSigner; - -import org.apache.camel.Component; -import org.apache.camel.Consumer; -import org.apache.camel.Processor; -import org.apache.camel.Producer; -import org.apache.camel.component.gae.bind.OutboundBinding; -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; - -/** - * The gauth component is used by web applications to implement a Google-specific OAuth consumer. - * - * Represents a <a href="http://camel.apache.org/gauth.html">GAuth Endpoint</a>. - * Instances can have one of two names, either <code>authorize</code> for - * requesting an unauthorized request token or <code>upgrade</code> for - * upgrading an authorized request token to an access token. The corresponding - * endpoint URIs are <code>gauth:authorize</code> and <code>gauth:upgrade</code> - * , respectively. - */ -@UriEndpoint(scheme = "gauth", title = "Google GAuth", syntax = "gauth:name", producerOnly = true, label = "cloud,paas", excludeProperties = "httpUri") -public class GAuthEndpoint extends DefaultEndpoint { - - public static enum Name { - - /** - * Name of the endpoint for requesting an unauthorized request token. - */ - AUTHORIZE, - - /** - * Name of the endpoint for upgrading an authorized request token to an - * access token. - */ - UPGRADE - - } - - private OutboundBinding<GAuthEndpoint, GoogleOAuthParameters, GoogleOAuthParameters> authorizeBinding; - private OutboundBinding<GAuthEndpoint, GoogleOAuthParameters, GoogleOAuthParameters> upgradeBinding; - @UriPath @Metadata(required = "true") - private Name name; - @UriParam - private String callback; - @UriParam - private String scope; - @UriParam - private String consumerKey; - @UriParam - private String consumerSecret; - private GAuthKeyLoader keyLoader; - private GAuthService service; - private PrivateKey cachedKey; - - public GAuthEndpoint(String endpointUri, Component component, String name) { - super(endpointUri, component); - this.name = Name.valueOf(name.toUpperCase()); - this.service = new GAuthServiceImpl(this); - } - - public OutboundBinding<GAuthEndpoint, GoogleOAuthParameters, GoogleOAuthParameters> getAuthorizeBinding() { - return authorizeBinding; - } - - /** - * Sets the binding for <code>gauth:authorize</code> endpoints. - */ - public void setAuthorizeBinding(OutboundBinding<GAuthEndpoint, GoogleOAuthParameters, GoogleOAuthParameters> authorizeBinding) { - this.authorizeBinding = authorizeBinding; - } - - public OutboundBinding<GAuthEndpoint, GoogleOAuthParameters, GoogleOAuthParameters> getUpgradeBinding() { - return upgradeBinding; - } - - /** - * Sets the binding for <code>gauth:upgrade</code> endpoints. - */ - public void setUpgradeBinding(OutboundBinding<GAuthEndpoint, GoogleOAuthParameters, GoogleOAuthParameters> upgradeBinding) { - this.upgradeBinding = upgradeBinding; - } - - /** - * Returns the component instance that created this endpoint. - */ - public GAuthComponent getComponent() { - return (GAuthComponent)super.getComponent(); - } - - /** - * Returns the endpoint name. - */ - public Name getName() { - return name; - } - - /** - * Returns the value of callback query parameter in the - * <code>gauth:authorize</code> endpoint URI. - */ - public String getCallback() { - return callback; - } - - public void setCallback(String callback) { - this.callback = callback; - } - - /** - * Returns the value of the scope query parameter in - * <code>gauth:authorize</code> endpoint URI. This can be a single scope or - * a comma-separated list of scopes. - */ - public String getScope() { - return scope; - } - - public void setScope(String services) { - this.scope = services; - } - - /** - * Returns the value of the scope query parameter as array. - * @see #getScope() - */ - public String[] getScopeArray() { - return getScope().split(","); - } - - /** - * Returns the consumer key. If this endpoint's consumer key is - * <code>null</code> then {@link GAuthComponent#getConsumerKey()} is - * returned. - */ - public String getConsumerKey() { - if (consumerKey == null) { - return getComponent().getConsumerKey(); - } - return consumerKey; - } - - /** - * Sets the consumer key. This key is generated when a web application is - * registered at Google. - * - * @param consumerKey - * consumer key to set. - */ - public void setConsumerKey(String consumerKey) { - this.consumerKey = consumerKey; - } - - /** - * Returns the consumer secret. If this endpoint's consumer secret is - * <code>null</code> then {@link GAuthComponent#getConsumerSecret()} is - * returned. - */ - public String getConsumerSecret() { - if (consumerSecret == null) { - return getComponent().getConsumerSecret(); - } - return consumerSecret; - } - - /** - * Sets the consumer secret. This secret is generated when a web application - * is registered at Google. Only set the consumer secret if the HMAC-SHA1 - * signature method shall be used. - */ - public void setConsumerSecret(String consumerSecret) { - this.consumerSecret = consumerSecret; - } - - /** - * Returns the key loader. If this endpoint's key loader is - * <code>null</code> then {@link GAuthComponent#getKeyLoader()} is - * returned. - */ - public GAuthKeyLoader getKeyLoader() { - if (keyLoader == null) { - return getComponent().getKeyLoader(); - } - return keyLoader; - } - - /** - * Sets a key loader for loading a private key. A private key is required - * when the RSA-SHA1 signature method shall be used. - */ - public void setKeyLoader(GAuthKeyLoader keyLoader) { - this.keyLoader = keyLoader; - } - - public GAuthService getService() { - return service; - } - - /** - * Sets the service that makes the remote calls to Google services. Testing - * code should inject a mock service here (using serviceRef in endpoint - * URI). - */ - public void setService(GAuthService service) { - this.service = service; - } - - /** - * @throws UnsupportedOperationException - */ - public Consumer createConsumer(Processor processor) throws Exception { - throw new UnsupportedOperationException("consumption from gauth endpoint not supported"); - } - - /** - * Returns a {@link GAuthProducer} - */ - public Producer createProducer() throws Exception { - return new GAuthProducer(this); - } - - /** - * Returns <code>true</code>. - */ - public boolean isSingleton() { - return true; - } - - /** - * Creates an {@link OAuthHelper} configured with either an - * {@link OAuthHmacSha1Signer} or an {@link OAuthRsaSha1Signer}, depending - * on this endpoint's properties. - */ - OAuthHelper newOAuthHelper() throws Exception { - OAuthSigner signer = null; - if (getKeyLoader() == null) { - signer = new OAuthHmacSha1Signer(); - } else { - signer = new OAuthRsaSha1Signer(getPrivateKey()); - } - return new GoogleOAuthHelper(signer); - } - - private synchronized PrivateKey getPrivateKey() throws Exception { - if (cachedKey == null) { - cachedKey = getKeyLoader().loadPrivateKey(); - } - return cachedKey; - } - -} http://git-wip-us.apache.org/repos/asf/camel/blob/8f0bcd80/components/camel-gae/src/main/java/org/apache/camel/component/gae/auth/GAuthException.java ---------------------------------------------------------------------- diff --git a/components/camel-gae/src/main/java/org/apache/camel/component/gae/auth/GAuthException.java b/components/camel-gae/src/main/java/org/apache/camel/component/gae/auth/GAuthException.java deleted file mode 100644 index 0b5820a..0000000 --- a/components/camel-gae/src/main/java/org/apache/camel/component/gae/auth/GAuthException.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * 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.gae.auth; - -public class GAuthException extends RuntimeException { - - private static final long serialVersionUID = 1L; - - public GAuthException() { - } - - public GAuthException(String message) { - super(message); - } - - public GAuthException(String message, Throwable cause) { - super(message, cause); - } - - public GAuthException(Throwable cause) { - super(cause); - } - -} http://git-wip-us.apache.org/repos/asf/camel/blob/8f0bcd80/components/camel-gae/src/main/java/org/apache/camel/component/gae/auth/GAuthJksLoader.java ---------------------------------------------------------------------- diff --git a/components/camel-gae/src/main/java/org/apache/camel/component/gae/auth/GAuthJksLoader.java b/components/camel-gae/src/main/java/org/apache/camel/component/gae/auth/GAuthJksLoader.java deleted file mode 100644 index 8531bf0..0000000 --- a/components/camel-gae/src/main/java/org/apache/camel/component/gae/auth/GAuthJksLoader.java +++ /dev/null @@ -1,109 +0,0 @@ -/** - * 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.gae.auth; - -import java.io.InputStream; -import java.security.KeyStore; -import java.security.KeyStore.PasswordProtection; -import java.security.KeyStore.PrivateKeyEntry; -import java.security.PrivateKey; - -import org.apache.camel.CamelContext; -import org.apache.camel.util.IOHelper; -import org.apache.camel.util.ResourceHelper; - -/** - * A Java keystore specific key loader. - */ -public class GAuthJksLoader implements GAuthKeyLoader { - - private CamelContext camelContext; - private String keyStoreLocation; - private String storePass; - private String keyPass; - private String keyAlias; - - public GAuthJksLoader() { - this(null, null, null, null); - } - - public GAuthJksLoader(String keyStoreLocation, String storePass, String keyPass, String keyAlias) { - this.keyStoreLocation = keyStoreLocation; - this.storePass = storePass; - this.keyPass = keyPass; - this.keyAlias = keyAlias; - } - - public CamelContext getCamelContext() { - return camelContext; - } - - public void setCamelContext(CamelContext camelContext) { - this.camelContext = camelContext; - } - - /** - * Set the location of the Java keystore. - */ - public void setKeyStoreLocation(String keyStoreLocation) { - this.keyStoreLocation = keyStoreLocation; - } - - /** - * Sets the password used to open the key store. - */ - public void setStorePass(String storePass) { - this.storePass = storePass; - } - - /** - * Sets the password used to get access to a specific key. - */ - public void setKeyPass(String keyPass) { - this.keyPass = keyPass; - } - - /** - * Sets the alias of the key to be loaded. - */ - public void setKeyAlias(String keyAlias) { - this.keyAlias = keyAlias; - } - - /** - * Loads a private key from a Java keystore depending on this loader's properties. - */ - public PrivateKey loadPrivateKey() throws Exception { - InputStream input = ResourceHelper.resolveMandatoryResourceAsInputStream(getCamelContext(), keyStoreLocation); - try { - return loadPrivateKey(input); - } finally { - IOHelper.close(input); - } - } - - private PrivateKey loadPrivateKey(InputStream input) throws Exception { - // Load keystore - KeyStore keystore = KeyStore.getInstance(KeyStore.getDefaultType()); - keystore.load(input, storePass.toCharArray()); - - // Retrieve private key - PrivateKeyEntry entry = (PrivateKeyEntry)keystore.getEntry(keyAlias, new PasswordProtection(keyPass.toCharArray())); - return entry.getPrivateKey(); - } - -} http://git-wip-us.apache.org/repos/asf/camel/blob/8f0bcd80/components/camel-gae/src/main/java/org/apache/camel/component/gae/auth/GAuthKeyLoader.java ---------------------------------------------------------------------- diff --git a/components/camel-gae/src/main/java/org/apache/camel/component/gae/auth/GAuthKeyLoader.java b/components/camel-gae/src/main/java/org/apache/camel/component/gae/auth/GAuthKeyLoader.java deleted file mode 100644 index 31bf09c..0000000 --- a/components/camel-gae/src/main/java/org/apache/camel/component/gae/auth/GAuthKeyLoader.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * 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.gae.auth; - -import java.security.PrivateKey; - -import org.apache.camel.CamelContextAware; - -/** - * Interface used by {@link GAuthComponent} for loading private keys. The private - * key is needed for RSA-SHA1 signatures. - */ -public interface GAuthKeyLoader extends CamelContextAware { - - /** - * Loads a private key. - * - * @return the loaded private key. - * @throws Exception if key loading failed. - */ - PrivateKey loadPrivateKey() throws Exception; - -} http://git-wip-us.apache.org/repos/asf/camel/blob/8f0bcd80/components/camel-gae/src/main/java/org/apache/camel/component/gae/auth/GAuthPk8Loader.java ---------------------------------------------------------------------- diff --git a/components/camel-gae/src/main/java/org/apache/camel/component/gae/auth/GAuthPk8Loader.java b/components/camel-gae/src/main/java/org/apache/camel/component/gae/auth/GAuthPk8Loader.java deleted file mode 100644 index 4068189..0000000 --- a/components/camel-gae/src/main/java/org/apache/camel/component/gae/auth/GAuthPk8Loader.java +++ /dev/null @@ -1,82 +0,0 @@ -/** - * 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.gae.auth; - -import java.io.InputStream; -import java.security.KeyFactory; -import java.security.PrivateKey; -import java.security.spec.PKCS8EncodedKeySpec; - -import com.google.gdata.util.common.util.Base64; -import org.apache.camel.CamelContext; -import org.apache.camel.util.IOHelper; -import org.apache.camel.util.ResourceHelper; - -/** - * A Java PKCS#8-specific key loader. - */ -public class GAuthPk8Loader implements GAuthKeyLoader { - - private static final String BEGIN = "-----BEGIN PRIVATE KEY-----"; - private static final String END = "-----END PRIVATE KEY-----"; - - private CamelContext camelContext; - private String keyLocation; - - public CamelContext getCamelContext() { - return camelContext; - } - - public void setCamelContext(CamelContext camelContext) { - this.camelContext = camelContext; - } - - /** - * Sets the location of the PKCS#8 file that contains a private key. - */ - public void setKeyLocation(String keyLocation) { - this.keyLocation = keyLocation; - } - - /** - * Loads a private key from a PKCS#8 file. - */ - public PrivateKey loadPrivateKey() throws Exception { - InputStream is = ResourceHelper.resolveMandatoryResourceAsInputStream(getCamelContext(), keyLocation); - String str; - try { - str = getCamelContext().getTypeConverter().mandatoryConvertTo(String.class, is); - } finally { - IOHelper.close(is); - } - - // replace line feeds from windows to unix style - if (!System.lineSeparator().equals("\n")) { - str = str.replaceAll(System.lineSeparator(), "\n"); - } - - if (str.contains(BEGIN) && str.contains(END)) { - str = str.substring(BEGIN.length(), str.lastIndexOf(END)); - } - - byte[] decoded = Base64.decode(str); - - KeyFactory factory = KeyFactory.getInstance("RSA"); - return factory.generatePrivate(new PKCS8EncodedKeySpec(decoded)); - } - -} http://git-wip-us.apache.org/repos/asf/camel/blob/8f0bcd80/components/camel-gae/src/main/java/org/apache/camel/component/gae/auth/GAuthProducer.java ---------------------------------------------------------------------- diff --git a/components/camel-gae/src/main/java/org/apache/camel/component/gae/auth/GAuthProducer.java b/components/camel-gae/src/main/java/org/apache/camel/component/gae/auth/GAuthProducer.java deleted file mode 100644 index 8ff4b2a..0000000 --- a/components/camel-gae/src/main/java/org/apache/camel/component/gae/auth/GAuthProducer.java +++ /dev/null @@ -1,63 +0,0 @@ -/** - * 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.gae.auth; - -import com.google.gdata.client.authn.oauth.GoogleOAuthParameters; - -import org.apache.camel.Exchange; -import org.apache.camel.component.gae.bind.OutboundBinding; -import org.apache.camel.impl.DefaultProducer; - -import static org.apache.camel.component.gae.auth.GAuthEndpoint.Name.AUTHORIZE; - -public class GAuthProducer extends DefaultProducer { - - public GAuthProducer(GAuthEndpoint endpoint) { - super(endpoint); - } - - @Override - public GAuthEndpoint getEndpoint() { - return (GAuthEndpoint)super.getEndpoint(); - } - - public OutboundBinding<GAuthEndpoint, GoogleOAuthParameters, GoogleOAuthParameters> getAuthorizeBinding() { - return getEndpoint().getAuthorizeBinding(); - } - - public OutboundBinding<GAuthEndpoint, GoogleOAuthParameters, GoogleOAuthParameters> getUpgradeBinding() { - return getEndpoint().getUpgradeBinding(); - } - - /** - * Depending on the {@link GAuthEndpoint.Name}, this method either fetches - * an unauthorized request token and creates a redirect response, or - * upgrades an authorized request token to an access token. - */ - public void process(Exchange exchange) throws Exception { - if (getEndpoint().getName() == AUTHORIZE) { - GoogleOAuthParameters params = getAuthorizeBinding().writeRequest(getEndpoint(), exchange, null); - getEndpoint().getService().getUnauthorizedRequestToken(params); - getAuthorizeBinding().readResponse(getEndpoint(), exchange, params); - } else { - GoogleOAuthParameters params = getUpgradeBinding().writeRequest(getEndpoint(), exchange, null); - getEndpoint().getService().getAccessToken(params); - getUpgradeBinding().readResponse(getEndpoint(), exchange, params); - } - } - -} http://git-wip-us.apache.org/repos/asf/camel/blob/8f0bcd80/components/camel-gae/src/main/java/org/apache/camel/component/gae/auth/GAuthService.java ---------------------------------------------------------------------- diff --git a/components/camel-gae/src/main/java/org/apache/camel/component/gae/auth/GAuthService.java b/components/camel-gae/src/main/java/org/apache/camel/component/gae/auth/GAuthService.java deleted file mode 100644 index 8fe5b4c..0000000 --- a/components/camel-gae/src/main/java/org/apache/camel/component/gae/auth/GAuthService.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * 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.gae.auth; - -import com.google.gdata.client.authn.oauth.OAuthParameters; - -/** - * Interface to Google's OAuth services. - */ -public interface GAuthService { - - /** - * Gets an unauthorized request token from Google. - * - * @param oauthParameters value object for providing input data and storing result data - * (unauthorized request token). - */ - void getUnauthorizedRequestToken(OAuthParameters oauthParameters) throws Exception; - - /** - * Gets an access token from Google. - * - * @param oauthParameters value object for providing input data (authorized request token) - * and storing result data (access token). - */ - void getAccessToken(OAuthParameters oauthParameters) throws Exception; - -} http://git-wip-us.apache.org/repos/asf/camel/blob/8f0bcd80/components/camel-gae/src/main/java/org/apache/camel/component/gae/auth/GAuthServiceImpl.java ---------------------------------------------------------------------- diff --git a/components/camel-gae/src/main/java/org/apache/camel/component/gae/auth/GAuthServiceImpl.java b/components/camel-gae/src/main/java/org/apache/camel/component/gae/auth/GAuthServiceImpl.java deleted file mode 100644 index a0e0664..0000000 --- a/components/camel-gae/src/main/java/org/apache/camel/component/gae/auth/GAuthServiceImpl.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * 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.gae.auth; - -import com.google.gdata.client.authn.oauth.OAuthParameters; - -/** - * Implements the remote interaction to Google's OAuth services. - */ -class GAuthServiceImpl implements GAuthService { - - private GAuthEndpoint endpoint; - - public GAuthServiceImpl(GAuthEndpoint endpoint) { - this.endpoint = endpoint; - } - - public void getUnauthorizedRequestToken(OAuthParameters oauthParameters) throws Exception { - endpoint.newOAuthHelper().getUnauthorizedRequestToken(oauthParameters); - } - - public void getAccessToken(OAuthParameters oauthParameters) throws Exception { - endpoint.newOAuthHelper().getAccessToken(oauthParameters); - } - -} http://git-wip-us.apache.org/repos/asf/camel/blob/8f0bcd80/components/camel-gae/src/main/java/org/apache/camel/component/gae/auth/GAuthTokenSecret.java ---------------------------------------------------------------------- diff --git a/components/camel-gae/src/main/java/org/apache/camel/component/gae/auth/GAuthTokenSecret.java b/components/camel-gae/src/main/java/org/apache/camel/component/gae/auth/GAuthTokenSecret.java deleted file mode 100644 index d9adb1b..0000000 --- a/components/camel-gae/src/main/java/org/apache/camel/component/gae/auth/GAuthTokenSecret.java +++ /dev/null @@ -1,80 +0,0 @@ -/** - * 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.gae.auth; - -/** - * A request token secret container with marshalling/unmarshalling methods to - * and from a cookie. - * - * @see GAuthAuthorizeBinding - * @see GAuthUpgradeBinding - */ -public class GAuthTokenSecret { - - /** - * Name of the request token secret cookie. - */ - public static final String COOKIE_NAME = "gauth-token-secret"; - - private String value; - - /** - * Creates a new {@link GAuthTokenSecret} - * - * @param value - * request token secret. - */ - public GAuthTokenSecret(String value) { - this.value = value; - } - - /** - * Returns the request token secret. - */ - public String getValue() { - return value; - } - - /** - * Creates a cookie from this {@link GAuthTokenSecret}. - */ - public String toCookie() { - return COOKIE_NAME + "=" + value; - } - - /** - * Create a {@link GAuthTokenSecret} from a cookies string. - * - * @param cookies cookies string. - * @return either an {@link GAuthTokenSecret} instance or <code>null</code> - * if there's no cookie with name {@link #COOKIE_NAME}. - */ - public static GAuthTokenSecret fromCookie(String cookies) { - if (cookies == null) { - return null; - } - for (String cookie : cookies.split(";")) { - String[] pair = cookie.split("="); - if (pair[0].trim().equals(COOKIE_NAME)) { - return new GAuthTokenSecret(pair[1].trim()); - } - } - return null; - } - -} - http://git-wip-us.apache.org/repos/asf/camel/blob/8f0bcd80/components/camel-gae/src/main/java/org/apache/camel/component/gae/auth/GAuthUpgradeBinding.java ---------------------------------------------------------------------- diff --git a/components/camel-gae/src/main/java/org/apache/camel/component/gae/auth/GAuthUpgradeBinding.java b/components/camel-gae/src/main/java/org/apache/camel/component/gae/auth/GAuthUpgradeBinding.java deleted file mode 100644 index 0f90852..0000000 --- a/components/camel-gae/src/main/java/org/apache/camel/component/gae/auth/GAuthUpgradeBinding.java +++ /dev/null @@ -1,103 +0,0 @@ -/** - * 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.gae.auth; - -import java.io.IOException; - -import com.google.gdata.client.authn.oauth.GoogleOAuthParameters; - -import org.apache.camel.Exchange; -import org.apache.camel.component.gae.bind.OutboundBinding; - -/** - * Binds {@link GoogleOAuthParameters} to a Camel {@link Exchange}. This binding - * is used by <code>gauth:upgrade</code> endpoints by default. - */ -public class GAuthUpgradeBinding implements OutboundBinding<GAuthEndpoint, GoogleOAuthParameters, GoogleOAuthParameters> { - - /** - * Name of the Camel header containing an access token. - */ - public static final String GAUTH_ACCESS_TOKEN = "CamelGauthAccessToken"; - - /** - * Name of the Camel header containing an access token secret. - */ - public static final String GAUTH_ACCESS_TOKEN_SECRET = "CamelGauthAccessTokenSecret"; - - /** - * Default value for access token and access token secret in GoogleOAuthParameters - */ - private static final String EMPTY_TOKEN = ""; - - /** - * Creates a {@link GoogleOAuthParameters} object from endpoint and - * <code>exchange.getIn()</code> data. The created parameter object is used - * to upgrade an authorized request token to an access token. If the - * {@link GAuthComponent} is configured to use the HMAC_SHA1 signature - * method, a request token secret is obtained from a - * {@link GAuthTokenSecret#COOKIE_NAME} cookie. - * - * @throws GAuthException if the {@link GAuthComponent} is configured to use the - * HMAC_SHA1 signature method but there's no cookie with the - * request token secret. - */ - public GoogleOAuthParameters writeRequest(GAuthEndpoint endpoint, Exchange exchange, GoogleOAuthParameters request) throws Exception { - request = new GoogleOAuthParameters(); - request.setOAuthConsumerKey(endpoint.getConsumerKey()); - request.setOAuthConsumerSecret(endpoint.getConsumerSecret()); - request.setOAuthToken(exchange.getIn().getHeader("oauth_token", String.class)); - request.setOAuthVerifier(exchange.getIn().getHeader("oauth_verifier", String.class)); - - if (endpoint.getComponent().getKeyLoader() == null) { - // HMAC_SHA signature is used for getting an access token. - // The required token secret has been previously stored as cookie. - String cookie = exchange.getIn().getHeader("Cookie", String.class); - GAuthTokenSecret tokenSecret = GAuthTokenSecret.fromCookie(cookie); - if (tokenSecret == null) { - throw new GAuthException(GAuthTokenSecret.COOKIE_NAME + " cookie doesn't exist"); - } - request.setOAuthTokenSecret(tokenSecret.getValue()); - } - return request; - } - - /** - * Creates an <code>exchange.getOut()</code> message that containing the - * access token and the access token secret in the message header. - * - * @see #GAUTH_ACCESS_TOKEN - * @see #GAUTH_ACCESS_TOKEN_SECRET - */ - public Exchange readResponse(GAuthEndpoint endpoint, Exchange exchange, GoogleOAuthParameters response) throws IOException { - exchange.getOut().setHeaders(exchange.getIn().getHeaders()); - exchange.getOut().setHeader(GAUTH_ACCESS_TOKEN, canonicalizeToken(response.getOAuthToken())); - exchange.getOut().setHeader(GAUTH_ACCESS_TOKEN_SECRET, canonicalizeToken(response.getOAuthTokenSecret())); - return exchange; - } - - private static String canonicalizeToken(String token) { - if (token == null) { - return null; - } else if (EMPTY_TOKEN.equals(token)) { - return null; - } else { - return token; - } - } - -} http://git-wip-us.apache.org/repos/asf/camel/blob/8f0bcd80/components/camel-gae/src/main/java/org/apache/camel/component/gae/bind/HttpBindingInvocationHandler.java ---------------------------------------------------------------------- diff --git a/components/camel-gae/src/main/java/org/apache/camel/component/gae/bind/HttpBindingInvocationHandler.java b/components/camel-gae/src/main/java/org/apache/camel/component/gae/bind/HttpBindingInvocationHandler.java deleted file mode 100644 index e2229ea..0000000 --- a/components/camel-gae/src/main/java/org/apache/camel/component/gae/bind/HttpBindingInvocationHandler.java +++ /dev/null @@ -1,59 +0,0 @@ -/** - * 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.gae.bind; - -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.Method; - -import org.apache.camel.Endpoint; -import org.apache.camel.Exchange; -import org.apache.camel.http.common.HttpBinding; -import org.apache.camel.http.common.HttpMessage; - -/** - * Post-processes {@link HttpBinding} invocations by delegating to an - * endpoint's {@link InboundBinding}. - */ -public class HttpBindingInvocationHandler<E extends Endpoint, S, T> implements InvocationHandler { - - private E endpoint; - private HttpBinding httpBinding; - private InboundBinding<E, S, T> inboundBinding; - - public HttpBindingInvocationHandler(E endpoint, HttpBinding httpBinding, InboundBinding<E, S, T> inboundBinding) { - this.endpoint = endpoint; - this.httpBinding = httpBinding; - this.inboundBinding = inboundBinding; - } - - @SuppressWarnings("unchecked") - public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { - Object result = method.invoke(httpBinding, args); // updates args - if (method.getName().equals("readRequest") && (args.length == 2)) { - HttpMessage message = (HttpMessage)args[1]; - // prepare exchange for further inbound binding operations - message.getExchange().setIn(message); - // delegate further request binding operations to inbound binding - inboundBinding.readRequest(endpoint, message.getExchange(), (S)args[0]); - } else if (method.getName().equals("writeResponse") && (args.length == 2)) { - // delegate further response binding operations to inbound binding - inboundBinding.writeResponse(endpoint, (Exchange)args[0], (T)args[1]); - } - return result; - } - -} http://git-wip-us.apache.org/repos/asf/camel/blob/8f0bcd80/components/camel-gae/src/main/java/org/apache/camel/component/gae/bind/InboundBinding.java ---------------------------------------------------------------------- diff --git a/components/camel-gae/src/main/java/org/apache/camel/component/gae/bind/InboundBinding.java b/components/camel-gae/src/main/java/org/apache/camel/component/gae/bind/InboundBinding.java deleted file mode 100644 index 8f807a6..0000000 --- a/components/camel-gae/src/main/java/org/apache/camel/component/gae/bind/InboundBinding.java +++ /dev/null @@ -1,56 +0,0 @@ -/** - * 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.gae.bind; - -import org.apache.camel.Consumer; -import org.apache.camel.Endpoint; -import org.apache.camel.Exchange; - -/** - * Represents the binding of request and response types to an {@link Exchange}. - * The request and response types are defined via the type parameters - * <code>S</code> and <code>T</code>, respectively. The InboundBinding is used - * by {@link Consumer} implementations or their clients to translate between - * protocol-specific or services-specific messages and {@link Exchange} objects. - * - * @param S request type. - * @param T response type. - * @param E endpoint type. - */ -public interface InboundBinding<E extends Endpoint, S, T> { - - /** - * Populates an {@link Exchange} from request data and endpoint configuration data. - * - * @param endpoint endpoint providing binding-relevant information. - * @param exchange exchange to be populated or created (if <code>null</code>) from request data. - * @param request request to read data from. - * @return the populated exchange. - */ - Exchange readRequest(E endpoint, Exchange exchange, S request) throws Exception; - - /** - * Creates or populates a response object from {@link Exchange} and endpoint configuration data. - * - * @param endpoint endpoint providing binding-relevant information. - * @param exchange exchange to read data from. - * @param response to be populated or created (if <code>null</code>) from exchange data. - * @return the populated response. - */ - T writeResponse(E endpoint, Exchange exchange, T response) throws Exception; - -} http://git-wip-us.apache.org/repos/asf/camel/blob/8f0bcd80/components/camel-gae/src/main/java/org/apache/camel/component/gae/bind/InboundBindingSupport.java ---------------------------------------------------------------------- diff --git a/components/camel-gae/src/main/java/org/apache/camel/component/gae/bind/InboundBindingSupport.java b/components/camel-gae/src/main/java/org/apache/camel/component/gae/bind/InboundBindingSupport.java deleted file mode 100644 index f31e210..0000000 --- a/components/camel-gae/src/main/java/org/apache/camel/component/gae/bind/InboundBindingSupport.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * 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.gae.bind; - -import org.apache.camel.Consumer; -import org.apache.camel.Endpoint; - -/** - * Implemented by {@link Endpoint}s that provide an {@link InboundBinding} to - * {@link Consumer}s. - * - * @see InboundBinding - */ -public interface InboundBindingSupport<E extends Endpoint, S, T> { - - InboundBinding<E, S, T> getInboundBinding(); - - void setInboundBinding(InboundBinding<E, S, T> inboundBinding); - -} http://git-wip-us.apache.org/repos/asf/camel/blob/8f0bcd80/components/camel-gae/src/main/java/org/apache/camel/component/gae/bind/OutboundBinding.java ---------------------------------------------------------------------- diff --git a/components/camel-gae/src/main/java/org/apache/camel/component/gae/bind/OutboundBinding.java b/components/camel-gae/src/main/java/org/apache/camel/component/gae/bind/OutboundBinding.java deleted file mode 100644 index 9a8f328..0000000 --- a/components/camel-gae/src/main/java/org/apache/camel/component/gae/bind/OutboundBinding.java +++ /dev/null @@ -1,56 +0,0 @@ -/** - * 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.gae.bind; - -import org.apache.camel.Endpoint; -import org.apache.camel.Exchange; -import org.apache.camel.Producer; - -/** - * Represents the binding of request and response types to an {@link Exchange}. - * The request and response types are defined via the type parameters - * <code>S</code> and <code>T</code>, respectively. The OutboundBinding is used - * by {@link Producer} implementations to translate between {@link Exchange} - * objects and protocol-specific or services-specific messages. - * - * @param S request type. - * @param T response type. - * @param E endpoint type. - */ -public interface OutboundBinding<E extends Endpoint, S, T> { - - /** - * Creates or populates a request object from {@link Exchange} and endpoint configuration data. - * - * @param endpoint endpoint providing binding-relevant information. - * @param exchange exchange to read data from. - * @param request request to be populated or created (if <code>null</code>) from exchange data. - * @return the populated response. - */ - S writeRequest(E endpoint, Exchange exchange, S request) throws Exception; - - /** - * Populates an {@link Exchange} from response data and endpoint configuration data. - * - * @param endpoint endpoint providing binding-relevant information. - * @param exchange exchange to be populated or created (if <code>null</code>) from response data. - * @param response response to read data from. - * @return the populated exchange. - */ - Exchange readResponse(E endpoint, Exchange exchange, T response) throws Exception; - -}