Skip to content

Commit

Permalink
Google Storage support apache#2421
Browse files Browse the repository at this point in the history
  • Loading branch information
JiriOndrusek committed Apr 22, 2021
1 parent b0ad46a commit 6b4636a
Show file tree
Hide file tree
Showing 19 changed files with 1,057 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/modules/ROOT/nav.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@
*** xref:reference/extensions/google-mail.adoc[Google Mail]
*** xref:reference/extensions/google-pubsub.adoc[Google Pubsub]
*** xref:reference/extensions/google-sheets.adoc[Google Sheets]
*** xref:reference/extensions/google-storage.adoc[Google Storage]
*** xref:reference/extensions/graphql.adoc[GraphQL]
*** xref:reference/extensions/grok.adoc[Grok]
*** xref:reference/extensions/groovy.adoc[Groovy]
Expand Down
45 changes: 45 additions & 0 deletions docs/modules/ROOT/pages/reference/extensions/google-storage.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Do not edit directly!
// This file was generated by camel-quarkus-maven-plugin:update-extension-doc-page
= Google Storage
:linkattrs:
:cq-artifact-id: camel-quarkus-google-storage
:cq-native-supported: true
:cq-status: Stable
:cq-status-deprecation: Stable
:cq-description: Store and retrieve objects from Google Cloud Storage Service using the google-cloud-storage library.
:cq-deprecated: false
:cq-jvm-since: 1.9.0
:cq-native-since: 1.9.0

[.badges]
[.badge-key]##JVM since##[.badge-supported]##1.9.0## [.badge-key]##Native since##[.badge-supported]##1.9.0##

Store and retrieve objects from Google Cloud Storage Service using the google-cloud-storage library.

== What's inside

* xref:{cq-camel-components}::google-storage-component.adoc[Google Storage component], URI syntax: `google-storage:bucketName`

Please refer to the above link for usage and configuration details.

== Maven coordinates

https://code.quarkus.io/?extension-search=camel-quarkus-google-storage[Create a new project with this extension on code.quarkus.io, window="_blank"]

Or add the coordinates to your existing project:

[source,xml]
----
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-google-storage</artifactId>
</dependency>
----

Check the xref:user-guide/index.adoc[User guide] for more information about writing Camel Quarkus applications.

== SSL in native mode

This extension auto-enables SSL support in native mode. Hence you do not need to add
`quarkus.ssl.native=true` to your `application.properties` yourself. See also
https://quarkus.io/guides/native-and-ssl[Quarkus SSL guide].
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
// Empty partial for a Camel bit unsupported by Camel Quarkus to avoid warnings when this file is included from a Camel page
// Do not edit directly!
// This file was generated by camel-quarkus-maven-plugin:update-extension-doc-page
:cq-artifact-id: camel-quarkus-google-storage
:cq-artifact-id-base: google-storage
:cq-native-supported: true
:cq-status: Stable
:cq-deprecated: false
:cq-jvm-since: 1.9.0
:cq-native-since: 1.9.0
:cq-camel-part-name: google-storage
:cq-camel-part-title: Google Storage
:cq-camel-part-description: Store and retrieve objects from Google Cloud Storage Service using the google-cloud-storage library.
:cq-extension-page-title: Google Storage
63 changes: 63 additions & 0 deletions extensions/google-storage/deployment/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-google-storage-parent</artifactId>
<version>1.9.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>camel-quarkus-google-storage-deployment</artifactId>
<name>Camel Quarkus :: Google Storage :: Deployment</name>

<dependencies>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-core-deployment</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-google-storage</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-extension-processor</artifactId>
<version>${quarkus.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/*
* 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.quarkus.component.google.storage.deployment;

import com.google.api.client.googleapis.json.GoogleJsonError;
import com.google.api.client.http.HttpHeaders;
import com.google.api.client.json.GenericJson;
import com.google.api.client.json.webtoken.JsonWebSignature;
import com.google.api.client.json.webtoken.JsonWebToken;
import com.google.api.client.util.GenericData;
import com.google.api.services.storage.Storage;
import com.google.api.services.storage.StorageRequest;
import com.google.cloud.storage.Bucket;
import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.builditem.CombinedIndexBuildItem;
import io.quarkus.deployment.builditem.ExtensionSslNativeSupportBuildItem;
import io.quarkus.deployment.builditem.FeatureBuildItem;
import io.quarkus.deployment.builditem.IndexDependencyBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
import org.jboss.jandex.DotName;
import org.jboss.jandex.IndexView;

class GoogleStorageProcessor {

private static final String FEATURE = "camel-google-storage";

@BuildStep
FeatureBuildItem feature() {
return new FeatureBuildItem(FEATURE);
}

@BuildStep
ExtensionSslNativeSupportBuildItem activateSslNativeSupport() {
return new ExtensionSslNativeSupportBuildItem(FEATURE);
}

@BuildStep
void registerForReflection(CombinedIndexBuildItem combinedIndex,
BuildProducer<ReflectiveClassBuildItem> reflectiveClasses) {
IndexView index = combinedIndex.getIndex();

reflectiveClasses.produce(new ReflectiveClassBuildItem(false, true, Bucket.class.getName(),
Storage.Objects.Insert.class.getName(),
StorageRequest.class.getName(), GenericJson.class.getName(), GenericData.class.getName(),
GoogleJsonError.class.getName(), HttpHeaders.class.getName(), JsonWebToken.Payload.class.getName(),
JsonWebSignature.Header.class.getName(), GoogleJsonError.ErrorInfo.class.getName(), byte[].class.getName()));

String[] dtos = index.getAllKnownSubclasses(DotName.createSimple(StorageRequest.class.getName())).stream()
.map(ci -> ci.name().toString())
.toArray(String[]::new);

reflectiveClasses.produce(new ReflectiveClassBuildItem(false, true, dtos));

dtos = index.getAllKnownSubclasses(DotName.createSimple(GenericJson.class.getName())).stream()
.map(ci -> ci.name().toString())
.toArray(String[]::new);

reflectiveClasses.produce(new ReflectiveClassBuildItem(false, true, dtos));
}

@BuildStep
IndexDependencyBuildItem registerDependencyForIndex() {
return new IndexDependencyBuildItem("com.google.apis", "google-api-services-storage");
}

}
39 changes: 39 additions & 0 deletions extensions/google-storage/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-build-parent</artifactId>
<version>1.9.0-SNAPSHOT</version>
<relativePath>../../poms/build-parent/pom.xml</relativePath>
</parent>

<artifactId>camel-quarkus-google-storage-parent</artifactId>
<name>Camel Quarkus :: Google Storage</name>
<packaging>pom</packaging>

<modules>
<module>deployment</module>
<module>runtime</module>
</modules>
</project>
132 changes: 132 additions & 0 deletions extensions/google-storage/runtime/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
<?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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-google-storage-parent</artifactId>
<version>1.9.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>camel-quarkus-google-storage</artifactId>
<name>Camel Quarkus :: Google Storage :: Runtime</name>
<description>Store and retrieve objects from Google Cloud Storage Service using the google-cloud-storage library.</description>

<properties>
<camel.quarkus.jvmSince>1.9.0</camel.quarkus.jvmSince>
<camel.quarkus.nativeSince>1.9.0</camel.quarkus.nativeSince>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-bom</artifactId>
<version>${project.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-google-storage</artifactId>
<!-- <exclusions>-->
<!-- <exclusion>-->
<!-- <artifactId>google-http-client-appengine</artifactId>-->
<!-- <groupId>com.google.http-client</groupId>-->
<!-- </exclusion>-->
<!-- </exclusions>-->
</dependency>
<dependency>
<groupId>org.graalvm.nativeimage</groupId>
<artifactId>svm</artifactId>
<scope>provided</scope>
</dependency>
<!-- <dependency>-->
<!-- <artifactId>google-http-client-appengine</artifactId>-->
<!-- <groupId>com.google.http-client</groupId>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>com.google.appengine</groupId>-->
<!-- <artifactId>appengine-api-1.0-sdk</artifactId>-->
<!-- </dependency>-->
</dependencies>

<build>
<plugins>
<plugin>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-bootstrap-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-extension-processor</artifactId>
<version>${quarkus.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</build>


<profiles>
<profile>
<id>full</id>
<activation>
<property>
<name>!quickly</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-maven-plugin</artifactId>
<executions>
<execution>
<id>update-extension-doc-page</id>
<goals>
<goal>update-extension-doc-page</goal>
</goals>
<phase>process-classes</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

0 comments on commit 6b4636a

Please sign in to comment.