Skip to content

Commit 22a307f

Browse files
committed
Merge pull request #74 from aozarov/temp
Convert to multi-module project
2 parents a43992a + dba8816 commit 22a307f

File tree

149 files changed

+1413
-155
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

149 files changed

+1413
-155
lines changed

RobustaSettings.xml

-2
This file was deleted.

gcloud-java-core/README.md

+55

gcloud-java-core/pom.xml

+94
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
<?xml version="1.0"?>
2+
<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">
3+
<modelVersion>4.0.0</modelVersion>
4+
<groupId>com.google.gcloud</groupId>
5+
<artifactId>gcloud-java-core</artifactId>
6+
<packaging>jar</packaging>
7+
<name>GCloud Java core</name>
8+
<url>https://github.com/GoogleCloudPlatform/gcloud-java</url>
9+
<description>
10+
Core module for the gcloud-java.
11+
</description>
12+
<parent>
13+
<groupId>com.google.gcloud</groupId>
14+
<artifactId>gcloud-java-pom</artifactId>
15+
<version>0.0.5</version>
16+
</parent>
17+
<dependencies>
18+
<dependency>
19+
<groupId>com.google.auth</groupId>
20+
<artifactId>google-auth-library-credentials</artifactId>
21+
<version>0.1.0</version>
22+
</dependency>
23+
<dependency>
24+
<groupId>com.google.auth</groupId>
25+
<artifactId>google-auth-library-oauth2-http</artifactId>
26+
<version>0.1.0</version>
27+
</dependency>
28+
<dependency>
29+
<groupId>com.google.http-client</groupId>
30+
<artifactId>google-http-client</artifactId>
31+
<version>1.19.0</version>
32+
<scope>compile</scope>
33+
</dependency>
34+
<dependency>
35+
<groupId>com.google.oauth-client</groupId>
36+
<artifactId>google-oauth-client</artifactId>
37+
<version>1.19.0</version>
38+
<scope>compile</scope>
39+
</dependency>
40+
<dependency>
41+
<groupId>com.google.guava</groupId>
42+
<artifactId>guava</artifactId>
43+
<version>18.0</version>
44+
</dependency>
45+
<dependency>
46+
<groupId>com.google.api-client</groupId>
47+
<artifactId>google-api-client-appengine</artifactId>
48+
<version>1.20.0</version>
49+
<scope>compile</scope>
50+
<exclusions>
51+
<exclusion>
52+
<artifactId>guava-jdk5</artifactId>
53+
<groupId>com.google.guava</groupId>
54+
</exclusion>
55+
</exclusions>
56+
</dependency>
57+
<dependency>
58+
<groupId>com.google.http-client</groupId>
59+
<artifactId>google-http-client-jackson</artifactId>
60+
<version>1.20.0</version>
61+
<scope>compile</scope>
62+
<exclusions>
63+
<exclusion>
64+
<artifactId>guava-jdk5</artifactId>
65+
<groupId>com.google.guava</groupId>
66+
</exclusion>
67+
</exclusions>
68+
</dependency>
69+
<dependency>
70+
<groupId>junit</groupId>
71+
<artifactId>junit</artifactId>
72+
<version>4.12</version>
73+
<scope>test</scope>
74+
</dependency>
75+
<dependency>
76+
<groupId>joda-time</groupId>
77+
<artifactId>joda-time</artifactId>
78+
<version>RELEASE</version>
79+
<scope>compile</scope>
80+
</dependency>
81+
<dependency>
82+
<groupId>org.json</groupId>
83+
<artifactId>json</artifactId>
84+
<version>20090211</version>
85+
<scope>compile</scope>
86+
</dependency>
87+
<dependency>
88+
<groupId>org.easymock</groupId>
89+
<artifactId>easymock</artifactId>
90+
<version>3.3</version>
91+
<scope>test</scope>
92+
</dependency>
93+
</dependencies>
94+
</project>

src/main/java/com/google/gcloud/ServiceOptions.java renamed to gcloud-java-core/src/main/java/com/google/gcloud/ServiceOptions.java

+11
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import com.google.api.client.http.HttpRequestInitializer;
2626
import com.google.api.client.http.HttpTransport;
2727
import com.google.api.client.http.javanet.NetHttpTransport;
28+
import com.google.common.collect.Iterables;
2829
import com.google.gcloud.spi.ServiceRpcFactory;
2930

3031
import java.io.BufferedReader;
@@ -39,6 +40,7 @@
3940
import java.net.URL;
4041
import java.util.Locale;
4142
import java.util.Objects;
43+
import java.util.ServiceLoader;
4244
import java.util.Set;
4345
import java.util.regex.Matcher;
4446
import java.util.regex.Pattern;
@@ -311,4 +313,13 @@ protected boolean isEquals(ServiceOptions other) {
311313
}
312314

313315
public abstract Builder<R, O, ?> toBuilder();
316+
317+
/**
318+
* Creates a service RPC using a factory loaded by {@link ServiceLoader}.
319+
*/
320+
protected static <R, O extends ServiceOptions<R, O>> R createRpc(O options,
321+
Class<? extends ServiceRpcFactory<R, O>> factoryClass) {
322+
ServiceRpcFactory<R, O> factory = Iterables.getFirst(ServiceLoader.load(factoryClass), null);
323+
return factory == null ? null : factory.create(options);
324+
}
314325
}

src/main/java/com/google/gcloud/spi/ServiceRpcFactory.java renamed to gcloud-java-core/src/main/java/com/google/gcloud/spi/ServiceRpcFactory.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
/* * Copyright 2015 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */package com.google.gcloud.spi;import com.google.gcloud.ServiceOptions;import java.io.Serializable;public interface ServiceRpcFactory<S, O extends ServiceOptions> extends Serializable { S create(O options);}
1+
/* * Copyright 2015 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */package com.google.gcloud.spi;import com.google.gcloud.ServiceOptions;import java.io.Serializable;/** * A base interface for all service RPC factories. * Loading of a factory implementation is done via {@link java.util.ServiceLoader}. */public interface ServiceRpcFactory<S, O extends ServiceOptions> extends Serializable { S create(O options);}

gcloud-java-datastore/README.md

+106

gcloud-java-datastore/pom.xml

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?xml version="1.0"?>
2+
<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">
3+
<modelVersion>4.0.0</modelVersion>
4+
<groupId>com.google.gcloud</groupId>
5+
<artifactId>gcloud-java-datastore</artifactId>
6+
<packaging>jar</packaging>
7+
<name>GCloud Java datastore</name>
8+
<url>https://github.com/GoogleCloudPlatform/gcloud-java</url>
9+
<description>
10+
Java idiomatic client for Google Cloud Datastore.
11+
</description>
12+
<parent>
13+
<groupId>com.google.gcloud</groupId>
14+
<artifactId>gcloud-java-pom</artifactId>
15+
<version>0.0.5</version>
16+
</parent>
17+
<dependencies>
18+
<dependency>
19+
<groupId>${project.groupId}</groupId>
20+
<artifactId>gcloud-java-core</artifactId>
21+
<version>${project.version}</version>
22+
</dependency>
23+
<dependency>
24+
<groupId>com.google.apis</groupId>
25+
<artifactId>google-api-services-datastore-protobuf</artifactId>
26+
<version>v1beta2-rev1-2.1.2</version>
27+
<scope>compile</scope>
28+
</dependency>
29+
<dependency>
30+
<groupId>com.google.apis</groupId>
31+
<artifactId>google-api-services-datastore</artifactId>
32+
<version>v1beta2-rev23-1.19.0</version>
33+
</dependency>
34+
<dependency>
35+
<groupId>junit</groupId>
36+
<artifactId>junit</artifactId>
37+
<version>4.12</version>
38+
<scope>test</scope>
39+
</dependency>
40+
<dependency>
41+
<groupId>org.easymock</groupId>
42+
<artifactId>easymock</artifactId>
43+
<version>3.3</version>
44+
<scope>test</scope>
45+
</dependency>
46+
</dependencies>
47+
</project>

src/main/java/com/google/gcloud/datastore/DatastoreServiceOptions.java renamed to gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/DatastoreServiceOptions.java

+6-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
import com.google.gcloud.ServiceOptions;
2727
import com.google.gcloud.spi.DatastoreRpc;
2828
import com.google.gcloud.spi.DatastoreRpc.DatastoreRpcException;
29-
import com.google.gcloud.spi.ServiceRpcProvider;
29+
import com.google.gcloud.spi.DatastoreRpcFactory;
30+
import com.google.gcloud.spi.DefaultDatastoreRpc;
3031

3132
import java.lang.reflect.Method;
3233
import java.util.Iterator;
@@ -185,7 +186,10 @@ DatastoreRpc datastoreRpc() {
185186
if (serviceRpcFactory() != null) {
186187
datastoreRpc = serviceRpcFactory().create(this);
187188
} else {
188-
datastoreRpc = ServiceRpcProvider.datastore(this);
189+
datastoreRpc = createRpc(this, DatastoreRpcFactory.class);
190+
if (datastoreRpc == null) {
191+
datastoreRpc = new DefaultDatastoreRpc(this);
192+
}
189193
}
190194
return datastoreRpc;
191195
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
* Copyright 2015 Google Inc. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.google.gcloud.spi;
18+
19+
import com.google.gcloud.datastore.DatastoreServiceOptions;
20+
21+
/**
22+
* An interface for Datastore RPC factory.
23+
* Implementation will be loaded via {@link java.util.ServiceLoader}.
24+
*/
25+
public interface DatastoreRpcFactory extends
26+
ServiceRpcFactory<DatastoreRpc, DatastoreServiceOptions> {
27+
}
28+

0 commit comments

Comments
 (0)