35
35
public class DatastoreOptions extends ServiceOptions <DatastoreRpc , DatastoreOptions > {
36
36
37
37
private static final long serialVersionUID = -8636602944160689193L ;
38
- private static final String DATASET_ENV_NAME = "DATASTORE_DATASET" ;
39
- private static final String HOST_ENV_NAME = "DATASTORE_HOST" ;
40
38
private static final String DATASTORE_SCOPE = "https://www.googleapis.com/auth/datastore" ;
41
39
private static final String USERINFO_SCOPE = "https://www.googleapis.com/auth/userinfo.email" ;
42
40
private static final Set <String > SCOPES = ImmutableSet .of (DATASTORE_SCOPE , USERINFO_SCOPE );
43
41
44
42
private final String namespace ;
45
- private final boolean force ;
46
43
private final boolean normalizeDataset ;
47
44
private transient DatastoreRpc datastoreRpc ;
48
45
49
46
public static class Builder extends
50
47
ServiceOptions .Builder <DatastoreRpc , DatastoreOptions , Builder > {
51
48
52
49
private String namespace ;
53
- private boolean force ;
54
50
private boolean normalizeDataset = true ;
55
51
56
52
private Builder () {
57
53
}
58
54
59
55
private Builder (DatastoreOptions options ) {
60
56
super (options );
61
- force = options .force ;
62
57
namespace = options .namespace ;
63
58
normalizeDataset = options .normalizeDataset ;
64
59
}
@@ -74,11 +69,6 @@ public Builder namespace(String namespace) {
74
69
return this ;
75
70
}
76
71
77
- public Builder force (boolean force ) {
78
- this .force = force ;
79
- return this ;
80
- }
81
-
82
72
Builder normalizeDataset (boolean normalizeDataset ) {
83
73
this .normalizeDataset = normalizeDataset ;
84
74
return this ;
@@ -89,7 +79,6 @@ private DatastoreOptions(Builder builder) {
89
79
super (builder );
90
80
normalizeDataset = builder .normalizeDataset ;
91
81
namespace = builder .namespace != null ? builder .namespace : defaultNamespace ();
92
- force = builder .force ;
93
82
}
94
83
95
84
private DatastoreOptions normalize () {
@@ -126,13 +115,17 @@ private DatastoreOptions normalize() {
126
115
127
116
@ Override
128
117
protected String defaultHost () {
129
- String host = System .getProperty (HOST_ENV_NAME , System .getenv (HOST_ENV_NAME ));
118
+ String host = System .getProperty (
119
+ com .google .datastore .v1beta3 .client .DatastoreHelper .LOCAL_HOST_ENV_VAR ,
120
+ System .getenv (com .google .datastore .v1beta3 .client .DatastoreHelper .LOCAL_HOST_ENV_VAR ));
130
121
return host != null ? host : super .defaultHost ();
131
122
}
132
123
133
124
@ Override
134
125
protected String defaultProject () {
135
- String projectId = System .getProperty (DATASET_ENV_NAME , System .getenv (DATASET_ENV_NAME ));
126
+ String projectId = System .getProperty (
127
+ com .google .datastore .v1beta3 .client .DatastoreHelper .PROJECT_ID_ENV_VAR ,
128
+ System .getenv (com .google .datastore .v1beta3 .client .DatastoreHelper .PROJECT_ID_ENV_VAR ));
136
129
if (projectId == null ) {
137
130
projectId = appEngineAppId ();
138
131
}
@@ -157,10 +150,6 @@ private static String defaultNamespace() {
157
150
}
158
151
}
159
152
160
- public boolean force () {
161
- return force ;
162
- }
163
-
164
153
@ Override
165
154
protected Set <String > scopes () {
166
155
return SCOPES ;
@@ -173,7 +162,7 @@ public Builder toBuilder() {
173
162
174
163
@ Override
175
164
public int hashCode () {
176
- return baseHashCode () ^ Objects .hash (namespace , force , normalizeDataset );
165
+ return baseHashCode () ^ Objects .hash (namespace , normalizeDataset );
177
166
}
178
167
179
168
@ Override
@@ -183,7 +172,6 @@ public boolean equals(Object obj) {
183
172
}
184
173
DatastoreOptions other = (DatastoreOptions ) obj ;
185
174
return baseEquals (other ) && Objects .equals (namespace , other .namespace )
186
- && Objects .equals (force , other .force )
187
175
&& Objects .equals (normalizeDataset , other .normalizeDataset );
188
176
}
189
177
0 commit comments