Lock down the public api of com.google.gwt.requestfactory.server, in
anticipation of most of it being killed in 2.1.1
Review at http://gwt-code-reviews.appspot.com/1051801
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@9140 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/requestfactory/server/DefaultSecurityProvider.java b/user/src/com/google/gwt/requestfactory/server/DefaultSecurityProvider.java
index 36ac70a..cdcb90f 100644
--- a/user/src/com/google/gwt/requestfactory/server/DefaultSecurityProvider.java
+++ b/user/src/com/google/gwt/requestfactory/server/DefaultSecurityProvider.java
@@ -22,7 +22,7 @@
* A security provider that enforces
* {@link com.google.gwt.requestfactory.shared.Service} annotations.
*/
-public class DefaultSecurityProvider implements RequestSecurityProvider {
+class DefaultSecurityProvider implements RequestSecurityProvider {
public void checkClass(Class<?> clazz) throws SecurityException {
Service service = clazz.getAnnotation(Service.class);
diff --git a/user/src/com/google/gwt/requestfactory/server/JsonRequestProcessor.java b/user/src/com/google/gwt/requestfactory/server/JsonRequestProcessor.java
index 27e8e93..ea7fb51 100644
--- a/user/src/com/google/gwt/requestfactory/server/JsonRequestProcessor.java
+++ b/user/src/com/google/gwt/requestfactory/server/JsonRequestProcessor.java
@@ -61,7 +61,7 @@
/**
* An implementation of RequestProcessor for JSON encoded payloads.
*/
-public class JsonRequestProcessor implements RequestProcessor<String> {
+class JsonRequestProcessor implements RequestProcessor<String> {
// TODO should we consume String, InputStream, or JSONObject?
private class DvsData {
@@ -243,7 +243,6 @@
private Map<EntityKey, EntityData> afterDvsDataMap = new HashMap<EntityKey, EntityData>();
// TODO - document
- @SuppressWarnings("rawtypes")
public Collection<Property<?>> allProperties(
Class<? extends EntityProxy> clazz) throws IllegalArgumentException {
return getPropertiesFromRecordProxyType(clazz).values();
@@ -759,7 +758,6 @@
/**
* Returns the property fields (name => type) for a record.
*/
- @SuppressWarnings("unchecked")
public Map<String, Property<?>> getPropertiesFromRecordProxyType(
Class<? extends EntityProxy> record) throws SecurityException {
if (!EntityProxy.class.isAssignableFrom(record)) {
@@ -771,7 +769,7 @@
for (Method method : methods) {
String methodName = method.getName();
String propertyName = null;
- Property newProperty = null;
+ Property<?> newProperty = null;
if (methodName.startsWith("get")) {
propertyName = Introspector.decapitalize(methodName.substring(3));
if (propertyName.length() == 0) {
@@ -792,7 +790,7 @@
if (newProperty == null) {
continue;
}
- Property existing = properties.put(propertyName, newProperty);
+ Property<?> existing = properties.put(propertyName, newProperty);
if (existing != null && !existing.equals(newProperty)) {
throw new IllegalStateException(String.format(
"In %s, mismatched getter and setter types for property %s, "
@@ -803,8 +801,8 @@
return properties;
}
- @SuppressWarnings("unchecked")
- public Property getPropertyFromGenericType(String propertyName, Type type) {
+ @SuppressWarnings({"unchecked", "rawtypes"})
+ public Property<?> getPropertyFromGenericType(String propertyName, Type type) {
if (type instanceof ParameterizedType) {
ParameterizedType pType = (ParameterizedType) type;
Class<?> rawType = (Class<Object>) pType.getRawType();
@@ -814,7 +812,7 @@
Type leafType = typeArgs[0];
if (leafType instanceof Class) {
return new CollectionProperty(propertyName, rawType,
- (Class) leafType);
+ (Class<?>) leafType);
}
}
}
diff --git a/user/src/com/google/gwt/requestfactory/server/OperationRegistry.java b/user/src/com/google/gwt/requestfactory/server/OperationRegistry.java
index d21e1a2..014d7e3 100644
--- a/user/src/com/google/gwt/requestfactory/server/OperationRegistry.java
+++ b/user/src/com/google/gwt/requestfactory/server/OperationRegistry.java
@@ -18,7 +18,7 @@
/**
* Maps operation name to {RequestDefinition}.
*/
-public interface OperationRegistry {
+interface OperationRegistry {
/**
* Returns the {@link RequestDefinition} associated with the given operation.
diff --git a/user/src/com/google/gwt/requestfactory/server/ReflectionBasedOperationRegistry.java b/user/src/com/google/gwt/requestfactory/server/ReflectionBasedOperationRegistry.java
index 29daac2..1ee6f8f 100644
--- a/user/src/com/google/gwt/requestfactory/server/ReflectionBasedOperationRegistry.java
+++ b/user/src/com/google/gwt/requestfactory/server/ReflectionBasedOperationRegistry.java
@@ -35,7 +35,7 @@
* reflection to a method on a class, and returns an appropriate
* {@link com.google.gwt.requestfactory.server.RequestDefinition}.
*/
-public class ReflectionBasedOperationRegistry implements OperationRegistry {
+class ReflectionBasedOperationRegistry implements OperationRegistry {
class ReflectiveRequestDefinition implements RequestDefinition {
diff --git a/user/src/com/google/gwt/requestfactory/server/RequestDefinition.java b/user/src/com/google/gwt/requestfactory/server/RequestDefinition.java
index 9929659..896d88b 100644
--- a/user/src/com/google/gwt/requestfactory/server/RequestDefinition.java
+++ b/user/src/com/google/gwt/requestfactory/server/RequestDefinition.java
@@ -22,7 +22,7 @@
* Implemented by enums that define the mapping between request objects and
* service methods.
*/
-public interface RequestDefinition {
+interface RequestDefinition {
/**
* Returns the name of the (domain) class that contains the method to be
* invoked on the server.
diff --git a/user/src/com/google/gwt/requestfactory/server/RequestProcessingException.java b/user/src/com/google/gwt/requestfactory/server/RequestProcessingException.java
index e90b70c..4c216bd 100644
--- a/user/src/com/google/gwt/requestfactory/server/RequestProcessingException.java
+++ b/user/src/com/google/gwt/requestfactory/server/RequestProcessingException.java
@@ -20,7 +20,7 @@
* an unexpected exception is caught. Includes an appropriate
* response of T to send to the client.
*/
-public class RequestProcessingException extends Exception {
+class RequestProcessingException extends Exception {
private final Object response;
/**
diff --git a/user/src/com/google/gwt/requestfactory/server/RequestProcessor.java b/user/src/com/google/gwt/requestfactory/server/RequestProcessor.java
index 42d53a1..0e5718a 100644
--- a/user/src/com/google/gwt/requestfactory/server/RequestProcessor.java
+++ b/user/src/com/google/gwt/requestfactory/server/RequestProcessor.java
@@ -21,7 +21,7 @@
* requests, and a serialized return value of the same type is returned.
* @param <T> the type of encoding used to serialize the request (e.g. String)
*/
-public interface RequestProcessor<T> {
+interface RequestProcessor<T> {
/**
* Decodes request, invokes methods, and re-encoded resulting return values.
*
diff --git a/user/src/com/google/gwt/requestfactory/server/RequestProperty.java b/user/src/com/google/gwt/requestfactory/server/RequestProperty.java
index c2c1d6f..10ae950 100644
--- a/user/src/com/google/gwt/requestfactory/server/RequestProperty.java
+++ b/user/src/com/google/gwt/requestfactory/server/RequestProperty.java
@@ -23,7 +23,7 @@
/**
* Represents one piece in a property reference sequence.
*/
-public class RequestProperty implements Iterable<RequestProperty> {
+class RequestProperty implements Iterable<RequestProperty> {
/**
* Merge two property chains.
diff --git a/user/src/com/google/gwt/requestfactory/server/RequestSecurityProvider.java b/user/src/com/google/gwt/requestfactory/server/RequestSecurityProvider.java
index 55352b4..8ff9ae8 100644
--- a/user/src/com/google/gwt/requestfactory/server/RequestSecurityProvider.java
+++ b/user/src/com/google/gwt/requestfactory/server/RequestSecurityProvider.java
@@ -19,7 +19,7 @@
* Enforces security policy for operations and classes, as well as permitting
* request obfuscation.
*/
-public interface RequestSecurityProvider {
+interface RequestSecurityProvider {
/**
* Throws exception if argument is not accessible via remote requests.
diff --git a/user/src/com/google/gwt/requestfactory/server/SampleDataPopulator.java b/user/src/com/google/gwt/requestfactory/server/SampleDataPopulator.java
deleted file mode 100644
index ec075c2..0000000
--- a/user/src/com/google/gwt/requestfactory/server/SampleDataPopulator.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * Copyright 2010 Google Inc.
- *
- * 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.gwt.requestfactory.server;
-
-import com.google.gwt.requestfactory.client.DefaultRequestTransport;
-import com.google.gwt.requestfactory.shared.impl.Constants;
-
-import org.apache.http.HttpEntity;
-import org.apache.http.HttpResponse;
-import org.apache.http.HttpStatus;
-import org.apache.http.client.HttpClient;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.entity.StringEntity;
-import org.apache.http.impl.client.DefaultHttpClient;
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-
-/**
- * Class to populate the datastore with sample data in a JSON file.
- */
-public class SampleDataPopulator {
-
- /**
- * Run the sample data populator.
- *
- * @param args command-line arguments
- */
- public static void main(String args[]) {
- // TODO: cleanup argument processing and error reporting.
- if (args.length < 2) {
- printHelp();
- System.exit(-1);
- }
- try {
- if (!args[0].endsWith(DefaultRequestTransport.URL)) {
- System.err.println("Please check your URL string " + args[0]
- + ", it should end with " + DefaultRequestTransport.URL + ", exiting");
- System.exit(-1);
- }
- SampleDataPopulator populator = new SampleDataPopulator(args[0], args[1]);
- populator.populate();
- } catch (Exception ex) {
- ex.printStackTrace();
- printHelp();
- }
- }
-
- private static void printHelp() {
- StringBuffer sb = new StringBuffer();
- sb.append("\n");
- sb.append("Requires two arguments: the URL to post the JSON data and the path to the JSON data file.");
- System.err.println(sb.toString());
- }
-
- private final String url;
-
- private final String filePathName;
-
- SampleDataPopulator(String url, String filePathName) {
- this.url = url;
- this.filePathName = filePathName;
- }
-
- /**
- * Populate the datastore and port the resulting JSON file.
- *
- * @throws JSONException if the input contains bad JSON
- * @throws IOException if an error occurs during file I/O
- */
- public void populate() throws JSONException, IOException {
- JSONObject jsonObject = readAsJsonObject(readFileAsString(filePathName));
- postJsonFile(jsonObject);
- }
-
- private void postJsonFile(JSONObject contentData) throws IOException,
- JSONException {
- HttpPost post = new HttpPost(url);
- JSONObject request = new JSONObject();
- request.put(Constants.OPERATION_TOKEN, "DOESNT_WORK");
- request.put(Constants.CONTENT_TOKEN, contentData);
- StringEntity reqEntity = new StringEntity(request.toString());
- post.setEntity(reqEntity);
- HttpClient client = new DefaultHttpClient();
- HttpResponse response = client.execute(post);
- HttpEntity resEntity = response.getEntity();
- if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
- System.out.println("SUCCESS: Put " + resEntity.getContentLength()
- + " records in the datastore!");
- return;
- }
- System.err.println("POST failed: Status line " + response.getStatusLine()
- + ", please check your URL");
- }
-
- private JSONObject readAsJsonObject(String string) throws JSONException {
- JSONObject jsonObject = new JSONObject(string);
- return jsonObject;
- }
-
- // ugly method, refactor later when cleaning up this class.
- private byte[] readFileAsBytes(String filePathName) {
- File file = new File(filePathName);
- FileInputStream fileInputStream = null;
- byte bytes[] = null;
- try {
- fileInputStream = new FileInputStream(file);
- int byteLength = (int) file.length();
- bytes = new byte[byteLength];
- int byteOffset = 0;
- while (byteOffset < byteLength) {
- int bytesReadCount = fileInputStream.read(bytes, byteOffset, byteLength
- - byteOffset);
- if (bytesReadCount == -1) {
- return null;
- }
- byteOffset += bytesReadCount;
- }
- } catch (IOException e) {
- // Ignored.
- } finally {
- try {
- if (fileInputStream != null) {
- fileInputStream.close();
- }
- } catch (IOException e) {
- // ignored
- }
- }
- return bytes;
- }
-
- private String readFileAsString(String filePathName) {
- byte bytes[] = readFileAsBytes(filePathName);
- if (bytes != null) {
- try {
- return new String(bytes, "UTF-8");
- } catch (UnsupportedEncodingException e) {
- // Ignored.
- }
- return null;
- }
- return null;
- }
-
-}
diff --git a/user/src/com/google/gwt/requestfactory/shared/impl/CollectionProperty.java b/user/src/com/google/gwt/requestfactory/shared/impl/CollectionProperty.java
index 69ca68b..7c2ff23 100644
--- a/user/src/com/google/gwt/requestfactory/shared/impl/CollectionProperty.java
+++ b/user/src/com/google/gwt/requestfactory/shared/impl/CollectionProperty.java
@@ -18,11 +18,6 @@
import java.util.Collection;
/**
- * <p> <span style="color:red">Experimental API: This class is still under rapid
- * development, and is very likely to be deleted. Use it at your own risk.
- * </span> </p> Defines a property of a {@link com.google.gwt.requestfactory.shared.EntityProxy} that contains a
- * one-to-many set of related values.
- *
* @param <C> the type of the Container, must be List or Set
* @param <E> the type of the element the container contains
*/
diff --git a/user/src/com/google/gwt/requestfactory/shared/impl/EnumProperty.java b/user/src/com/google/gwt/requestfactory/shared/impl/EnumProperty.java
index 7a0e743..842d745 100644
--- a/user/src/com/google/gwt/requestfactory/shared/impl/EnumProperty.java
+++ b/user/src/com/google/gwt/requestfactory/shared/impl/EnumProperty.java
@@ -16,11 +16,6 @@
package com.google.gwt.requestfactory.shared.impl;
/**
- * <p>
- * <span style="color:red">Experimental API: This class is still under rapid
- * development, and is very likely to be deleted. Use it at your own risk.
- * </span>
- * </p>
* Defines a property of a {@link com.google.gwt.requestfactory.shared.EntityProxy}.
*
* @param <V> the type of the property's value
diff --git a/user/src/com/google/gwt/requestfactory/shared/impl/Property.java b/user/src/com/google/gwt/requestfactory/shared/impl/Property.java
index 06bd8ba..15e8b84 100644
--- a/user/src/com/google/gwt/requestfactory/shared/impl/Property.java
+++ b/user/src/com/google/gwt/requestfactory/shared/impl/Property.java
@@ -16,11 +16,6 @@
package com.google.gwt.requestfactory.shared.impl;
/**
- * <p>
- * <span style="color:red">Experimental API: This class is still under rapid
- * development, and is very likely to be deleted. Use it at your own risk.
- * </span>
- * </p>
* Defines a property of an {@link EntityProxy}.
*
* @param <V> the type of the property's value
diff --git a/user/src/com/google/gwt/requestfactory/shared/impl/TypeLibrary.java b/user/src/com/google/gwt/requestfactory/shared/impl/TypeLibrary.java
index 6431b51..7234528 100644
--- a/user/src/com/google/gwt/requestfactory/shared/impl/TypeLibrary.java
+++ b/user/src/com/google/gwt/requestfactory/shared/impl/TypeLibrary.java
@@ -25,9 +25,6 @@
import java.util.Set;
/**
- * <p> <span style="color:red">Experimental API: This class is still under rapid
- * development, and is very likely to be deleted. Use it at your own risk.
- * </span> </p>
* Utility methods for querying, encoding, and decoding typed
* payload data.
*/