Skip to content

Commit 68d808a

Browse files
committed
work in progress
1 parent 25fb543 commit 68d808a

8 files changed

Lines changed: 149 additions & 202 deletions

File tree

.classpath

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,21 @@
66
<attribute name="maven.pomderived" value="true"/>
77
</attributes>
88
</classpathentry>
9-
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
10-
<attributes>
11-
<attribute name="maven.pomderived" value="true"/>
12-
</attributes>
13-
</classpathentry>
149
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
1510
<attributes>
1611
<attribute name="optional" value="true"/>
1712
<attribute name="maven.pomderived" value="true"/>
1813
</attributes>
1914
</classpathentry>
20-
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
21-
<attributes>
22-
<attribute name="maven.pomderived" value="true"/>
23-
</attributes>
24-
</classpathentry>
25-
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5">
26-
<attributes>
27-
<attribute name="maven.pomderived" value="true"/>
28-
</attributes>
29-
</classpathentry>
3015
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
3116
<attributes>
3217
<attribute name="maven.pomderived" value="true"/>
3318
</attributes>
19+
<accessrules>
20+
<accessrule kind="nonaccessible" pattern="**/repackaged/**"/>
21+
</accessrules>
3422
</classpathentry>
23+
<classpathentry kind="var" path="ECLIPSE_HOME"/>
24+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
3525
<classpathentry kind="output" path="target/classes"/>
3626
</classpath>

.project

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,18 @@
1010
<arguments>
1111
</arguments>
1212
</buildCommand>
13+
<buildCommand>
14+
<name>net.sf.eclipsecs.core.CheckstyleBuilder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
1318
<buildCommand>
1419
<name>org.eclipse.m2e.core.maven2Builder</name>
1520
<arguments>
1621
</arguments>
1722
</buildCommand>
1823
<buildCommand>
19-
<name>net.sf.eclipsecs.core.CheckstyleBuilder</name>
24+
<name>edu.umd.cs.findbugs.plugin.eclipse.findbugsBuilder</name>
2025
<arguments>
2126
</arguments>
2227
</buildCommand>
@@ -25,5 +30,6 @@
2530
<nature>org.eclipse.jdt.core.javanature</nature>
2631
<nature>org.eclipse.m2e.core.maven2Nature</nature>
2732
<nature>net.sf.eclipsecs.core.CheckstyleNature</nature>
33+
<nature>edu.umd.cs.findbugs.plugin.eclipse.findbugsNature</nature>
2834
</natures>
2935
</projectDescription>
Lines changed: 90 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,95 @@
11
eclipse.preferences.version=1
2+
org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
3+
org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
4+
org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
5+
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
6+
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
7+
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
28
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3-
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
4-
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
5-
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
6-
org.eclipse.jdt.core.compiler.compliance=1.5
7-
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
8-
org.eclipse.jdt.core.compiler.debug.localVariable=generate
9-
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
10+
org.eclipse.jdt.core.compiler.compliance=1.7
11+
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
1012
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
13+
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
14+
org.eclipse.jdt.core.compiler.problem.comparingIdentical=error
15+
org.eclipse.jdt.core.compiler.problem.deadCode=warning
16+
org.eclipse.jdt.core.compiler.problem.deprecation=warning
17+
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
18+
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
19+
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
20+
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
1121
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
22+
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning
23+
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
24+
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
25+
org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
26+
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
27+
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
1228
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
13-
org.eclipse.jdt.core.compiler.source=1.5
29+
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
30+
org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
31+
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
32+
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
33+
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
34+
org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
35+
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
36+
org.eclipse.jdt.core.compiler.problem.missingDefaultCase=warning
37+
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
38+
org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
39+
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning
40+
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
41+
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
42+
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
43+
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning
44+
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error
45+
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=error
46+
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
47+
org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
48+
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
49+
org.eclipse.jdt.core.compiler.problem.nullReference=warning
50+
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
51+
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
52+
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
53+
org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning
54+
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
55+
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
56+
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
57+
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
58+
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
59+
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
60+
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
61+
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning
62+
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
63+
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
64+
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
65+
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
66+
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
67+
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
68+
org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
69+
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
70+
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
71+
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled
72+
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
73+
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
74+
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
75+
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
76+
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
77+
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
78+
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
79+
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
80+
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
81+
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
82+
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
83+
org.eclipse.jdt.core.compiler.problem.unusedImport=warning
84+
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
85+
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
86+
org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=warning
87+
org.eclipse.jdt.core.compiler.problem.unusedParameter=warning
88+
org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
89+
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
90+
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
91+
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
92+
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=warning
93+
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
94+
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
95+
org.eclipse.jdt.core.compiler.source=1.7

pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,10 @@
1414
<artifactId>google-oauth-client</artifactId>
1515
<version>1.18.0-rc</version>
1616
</dependency>
17+
<dependency>
18+
<groupId>com.google.guava</groupId>
19+
<artifactId>guava</artifactId>
20+
<version>RELEASE</version>
21+
</dependency>
1722
</dependencies>
1823
</project>
Lines changed: 18 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,116 +1,50 @@
11
package com.google.gcloud;
22

3-
import java.util.Arrays;
4-
import java.util.List;
5-
63
import com.google.api.client.auth.oauth2.Credential;
7-
import com.google.api.client.http.HttpRequestInitializer;
8-
import com.google.api.client.http.HttpTransport;
4+
import com.google.common.base.MoreObjects;
95

10-
public class ServiceOptions {
6+
public abstract class ServiceOptions {
117

12-
private final String host;
138
private static final String DEFAULT_HOST = "https://www.googleapis.com";
14-
private final HttpRequestInitializer initializer;
15-
private final Credential credential;
16-
private final HttpTransport transport;
179

18-
public static final List<String> SCOPES = Arrays.asList(
19-
"https://www.googleapis.com/auth/datastore",
20-
"https://www.googleapis.com/auth/userinfo.email");
10+
private final String host;
11+
private final Credential credential;
2112

22-
ServiceOptions(Builder b) {
23-
this.dataset = b.dataset;
24-
this.host = b.host != null ? b.host : DEFAULT_HOST;
25-
this.initializer = b.initializer;
26-
this.credential = b.credential;
27-
this.transport = b.transport;
13+
protected ServiceOptions(Builder builder) {
14+
host = MoreObjects.firstNonNull(builder.host, DEFAULT_HOST);
15+
credential = builder.credential;
2816
}
2917

30-
/**
31-
* Builder for {@link ServiceOptions}.
32-
*/
33-
protected static class Builder {
34-
private String dataset;
18+
protected abstract static class Builder {
19+
3520
private String host;
36-
private HttpRequestInitializer initializer;
3721
private Credential credential;
38-
private HttpTransport transport;
3922

40-
public Builder() { }
23+
public Builder() {}
4124

4225
public Builder(ServiceOptions options) {
43-
this.dataset = options.dataset;
44-
this.host = options.host;
45-
this.initializer = options.initializer;
46-
this.credential = options.credential;
47-
this.transport = options.transport;
26+
host = options.host;
27+
credential = options.credential;
4828
}
4929

50-
public ServiceOptions build() {
51-
return new ServiceOptions(this);
52-
}
53-
54-
/**
55-
* Sets the dataset used to access the datastore.
56-
*/
57-
public Builder dataset(String newDataset) {
58-
dataset = newDataset;
59-
return this;
60-
}
30+
protected abstract ServiceOptions build();
6131

62-
/**
63-
* Sets the host used to access the datastore.
64-
*/
65-
public Builder host(String newHost) {
66-
host = newHost;
32+
public Builder setHost(String host) {
33+
this.host = host;
6734
return this;
6835
}
6936

70-
/**
71-
* Sets the (optional) initializer to run on HTTP requests to the API.
72-
*/
73-
public Builder initializer(HttpRequestInitializer newInitializer) {
74-
initializer = newInitializer;
75-
return this;
76-
}
77-
78-
/**
79-
* Sets the Google APIs credentials used to access the API.
80-
*/
81-
public Builder credential(Credential newCredential) {
82-
credential = newCredential;
83-
return this;
84-
}
85-
86-
/**
87-
* Sets the transport used to access the API.
88-
*/
89-
public Builder transport(HttpTransport transport) {
90-
this.transport = transport;
37+
public Builder setCredential(Credential credential) {
38+
this.credential = credential;
9139
return this;
9240
}
9341
}
9442

95-
// === getters ===
96-
97-
public String getDataset() {
98-
return dataset;
99-
}
100-
10143
public String getHost() {
10244
return host;
10345
}
10446

105-
public HttpRequestInitializer getInitializer() {
106-
return initializer;
107-
}
108-
10947
public Credential getCredential() {
11048
return credential;
11149
}
112-
113-
public HttpTransport getTransport() {
114-
return transport;
115-
}
116-
}
50+
}

src/main/java/com/google/gcloud/datastore/DatastoreService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
public interface DatastoreService {
44

5-
String get(String key)
5+
String get(String key);
66

77
}
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
package com.google.gcloud.datastore;
22

33

4-
public interface DatastoreServiceFactory {
4+
public class DatastoreServiceFactory {
55

6-
DatastoreService getDatastoreService(DatastoreServiceOptions options);
6+
public DatastoreService getDatastoreService(DatastoreServiceOptions options) {
7+
return new DatastoreServiceImpl(options);
8+
}
79
}

0 commit comments

Comments
 (0)