You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by Cassie <do...@google.com> on 2008/07/23 21:32:28 UTC
Re: svn commit: r679109 - in /incubator/shindig/trunk:
java/social-api/src/main/java/org/apache/shindig/social/ java/social-api/src/main/java/org/apache/shindig/social/core/config/
java/social-api/src/main/java/org/apache/shindig/social/core/model/ j
On Wed, Jul 23, 2008 at 8:19 AM, <ie...@apache.org> wrote:
> Author: ieb
> Date: Wed Jul 23 08:19:10 2008
> New Revision: 679109
>
> URL: http://svn.apache.org/viewvc?rev=679109&view=rev
> Log:
> Style and documentation cleanup based on the CheckStyle reports.
>
> Modified:
> incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/ResponseItem.java
> incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/config/SocialApiGuiceModule.java
> incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/IdSpec.java
> incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/UrlImpl.java
> incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/oauth/AuthenticationServletFilter.java
> incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/BeanJsonConverter.java
> incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/BeanJsonLibConverter.java
> incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/BeanXmlConverter.java
> incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/EnumUtil.java
> incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/JsonLibConverterUtils.java
> incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/JsonObjectToMapMorpher.java
> incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/Address.java
> incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/BodyType.java
> incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/Enum.java
> incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/Message.java
> incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/Organization.java
> incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/Person.java
> incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/Phone.java
> incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/oauth/OAuthTokenPrincipalMapper.java
> incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/ActivityHandler.java
> incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/DataServiceServlet.java
> incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/PersonHandler.java
> incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/RequestItem.java
> incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/ActivityService.java
> incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/AppDataService.java
> incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/GroupId.java
> incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/PersonService.java
> incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/RestfulCollection.java
> incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/UserId.java
> incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/sample/container/SampleContainerHandler.java
> incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/sample/container/SampleContainerHandlerProvider.java
> incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/sample/service/JsonDbOpensocialService.java
> incubator/shindig/trunk/site/checkstyle.xml
>
> Modified: incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/ResponseItem.java
> URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/ResponseItem.java?rev=679109&r1=679108&r2=679109&view=diff
> ==============================================================================
> --- incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/ResponseItem.java (original)
> +++ incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/ResponseItem.java Wed Jul 23 08:19:10 2008
> @@ -19,7 +19,7 @@
>
> /**
> * Represents the response items that get handed back as json within the
> - * DataResponse
> + * DataResponse.
> */
> public class ResponseItem<T> {
> private ResponseError error;
> @@ -62,4 +62,4 @@
> public void setResponse(T response) {
> this.response = response;
> }
> -}
> \ No newline at end of file
> +}
>
> Modified: incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/config/SocialApiGuiceModule.java
> URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/config/SocialApiGuiceModule.java?rev=679109&r1=679108&r2=679109&view=diff
> ==============================================================================
> --- incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/config/SocialApiGuiceModule.java (original)
> +++ incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/config/SocialApiGuiceModule.java Wed Jul 23 08:19:10 2008
> @@ -40,7 +40,7 @@
> import net.oauth.SimpleOAuthValidator;
>
> /**
> - * Provides social api component injection
> + * Provides social api component injection.
> */
> public class SocialApiGuiceModule extends AbstractModule {
>
> @@ -68,8 +68,10 @@
> .to(BasicOAuthConsumerStore.class).in(Scopes.SINGLETON);
> bind(OAuthTokenPrincipalMapper.class)
> .to(BasicOAuthTokenPrincipalMapper.class).in(Scopes.SINGLETON);
> - bind(BeanConverter.class).annotatedWith(Names.named("bean.converter.xml")).to(BeanXmlConverter.class);
> - bind(BeanConverter.class).annotatedWith(Names.named("bean.converter.json")).to(BeanJsonConverter.class);
> + bind(BeanConverter.class).annotatedWith(Names.named("bean.converter.xml")).to(
> + BeanXmlConverter.class);
> + bind(BeanConverter.class).annotatedWith(Names.named("bean.converter.json")).to(
> + BeanJsonConverter.class);
> }
>
> }
>
> Modified: incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/IdSpec.java
> URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/IdSpec.java?rev=679109&r1=679108&r2=679109&view=diff
> ==============================================================================
> --- incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/IdSpec.java (original)
> +++ incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/IdSpec.java Wed Jul 23 08:19:10 2008
> @@ -28,8 +28,8 @@
> VIEWER, OWNER, VIEWER_FRIENDS, OWNER_FRIENDS, USER_IDS
> }
>
> - String jsonSpec;
> - Type type;
> + private String jsonSpec;
> + private Type type;
>
> public IdSpec(String jsonSpec, Type type) {
> this.jsonSpec = jsonSpec;
> @@ -49,7 +49,7 @@
> }
>
> /**
> - * Only valid for IdSpecs of type USER_IDS
> + * Only valid for IdSpecs of type USER_IDS.
> * @return A list of the user ids in the id spec
> *
> * @throws JSONException If the id spec isn't a valid json String array
>
> Modified: incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/UrlImpl.java
> URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/UrlImpl.java?rev=679109&r1=679108&r2=679109&view=diff
> ==============================================================================
> --- incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/UrlImpl.java (original)
> +++ incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/UrlImpl.java Wed Jul 23 08:19:10 2008
> @@ -31,7 +31,7 @@
>
> public UrlImpl() {
> }
> -
> +
> public UrlImpl(String address, String linkText, String type) {
> this.address = address;
> this.linkText = linkText;
>
> Modified: incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/oauth/AuthenticationServletFilter.java
> URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/oauth/AuthenticationServletFilter.java?rev=679109&r1=679108&r2=679109&view=diff
> ==============================================================================
> --- incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/oauth/AuthenticationServletFilter.java (original)
> +++ incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/oauth/AuthenticationServletFilter.java Wed Jul 23 08:19:10 2008
> @@ -131,7 +131,7 @@
> // in the case of two-legged OAuth in the absence of a gadget security token
> protected static final String REQUESTOR_ID_PARAM = "xoauth_requestor_id";
>
> - private static final Logger log =
> + private static final Logger LOG =
> Logger.getLogger(AuthenticationServletFilter.class.getName());
>
> /*
> @@ -168,8 +168,8 @@
> context.getAttribute(GuiceServletContextListener.INJECTOR_ATTRIBUTE);
> if (injector == null) {
> throw new UnavailableException(
> - "Guice Injector not found! Make sure you registered " +
> - GuiceServletContextListener.class.getName() + " as a listener");
> + "Guice Injector not found! Make sure you registered "
> + + GuiceServletContextListener.class.getName() + " as a listener");
> }
> injector.injectMembers(this);
> }
> @@ -204,18 +204,18 @@
> public void doFilter(ServletRequest request, ServletResponse response,
> FilterChain chain) throws IOException, ServletException {
>
> - if (! ((request instanceof HttpServletRequest)
> + if ( !((request instanceof HttpServletRequest)
> && (response instanceof HttpServletResponse))) {
> throw new ServletException("Auth filter can only handle HTTP");
> }
>
> - HttpServletRequest req = (HttpServletRequest)request;
> - HttpServletResponse resp = (HttpServletResponse)response;
> + HttpServletRequest req = (HttpServletRequest) request;
> + HttpServletResponse resp = (HttpServletResponse) response;
>
> try {
> HttpServletRequest wrappedRequest = handleRequest(req);
> chain.doFilter(wrappedRequest, response);
> - } catch(OAuthProblemException e) {
> + } catch (OAuthProblemException e) {
> if (allowUnauthenticated) {
> chain.doFilter(request, response);
> } else {
> @@ -360,7 +360,7 @@
> .append("(treating it as not present). token is: ")
> .append(token)
> .toString();
> - log.log(Level.WARNING, message, e);
> + LOG.log(Level.WARNING, message, e);
> return null;
> }
> }
> @@ -438,7 +438,7 @@
> if (e instanceof OAuthProblemException) {
> // this one we'll just re-throw since the caller knows how to handle it
> // (this includes the case where the signature doesn't verify)
> - throw (OAuthProblemException)e;
> + throw (OAuthProblemException) e;
> } else {
> throw new ServletException(e);
> }
> @@ -452,7 +452,8 @@
> * @throws IOException
> * @throws OAuthProblemException
> */
> - protected void requireOAuth(OAuthMessage requestMessage) throws OAuthProblemException, IOException {
> + protected void requireOAuth(OAuthMessage requestMessage)
> + throws OAuthProblemException, IOException {
> requestMessage.requireParameters(OAuth.OAUTH_CONSUMER_KEY, OAuth.OAUTH_SIGNATURE);
> }
>
>
> Modified: incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/BeanJsonConverter.java
> URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/BeanJsonConverter.java?rev=679109&r1=679108&r2=679109&view=diff
> ==============================================================================
> --- incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/BeanJsonConverter.java (original)
> +++ incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/BeanJsonConverter.java Wed Jul 23 08:19:10 2008
> @@ -44,7 +44,7 @@
> import java.util.regex.Pattern;
>
> /**
> - * Converts pojos to json objects
> + * Converts pojos to json objects.
> * TODO: Replace with standard library
> */
> public class BeanJsonConverter implements BeanConverter {
> @@ -61,7 +61,7 @@
> }
>
> /**
> - * Convert the passed in object to a string
> + * Convert the passed in object to a string.
> *
> * @param pojo The object to convert
> * @return An object whos toString method will return json
> @@ -71,7 +71,7 @@
> }
>
> /**
> - * Convert the passed in object to a json object
> + * Convert the passed in object to a json object.
> *
> * @param pojo The object to convert
> * @return An object whos toString method will return json
> @@ -136,8 +136,8 @@
>
> JSONObject toReturn = new JSONObject();
> for (MethodPair getter : availableGetters) {
> - String errorMessage = "Could not encode the " + getter.method + " method on " +
> - pojo.getClass().getName();
> + String errorMessage = "Could not encode the " + getter.method + " method on "
> + + pojo.getClass().getName();
> try {
> Object val = getter.method.invoke(pojo, EMPTY_OBJECT);
> if (val != null) {
> @@ -227,8 +227,8 @@
>
> } else if (pojo instanceof List) {
> // TODO: process as a JSONArray
> - throw new UnsupportedOperationException("We don't support lists as a " +
> - "base json type yet. You can put it inside a pojo for now.");
> + throw new UnsupportedOperationException("We don't support lists as a "
> + + "base json type yet. You can put it inside a pojo for now.");
>
> } else {
> JSONObject jsonObject = new JSONObject(json);
> @@ -313,8 +313,8 @@
> }
> if (value == null) {
> throw new IllegalArgumentException(
> - "No enum value '" + jsonObject.getString(fieldName) +
> - "' in " + expectedType.getName());
> + "No enum value '" + jsonObject.getString(fieldName)
> + + "' in " + expectedType.getName());
> }
> }
> } else if (expectedType.equals(String.class)) {
> @@ -340,4 +340,4 @@
> method.invoke(pojo, value);
> }
> }
> -}
> \ No newline at end of file
> +}
>
> Modified: incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/BeanJsonLibConverter.java
> URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/BeanJsonLibConverter.java?rev=679109&r1=679108&r2=679109&view=diff
> ==============================================================================
> --- incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/BeanJsonLibConverter.java (original)
> +++ incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/BeanJsonLibConverter.java Wed Jul 23 08:19:10 2008
> @@ -46,19 +46,29 @@
> import org.apache.shindig.social.opensocial.model.Phone;
> import org.apache.shindig.social.opensocial.model.Url;
>
> -
> import com.google.inject.Inject;
> import com.google.inject.Injector;
>
> /**
> - *
> + * BeanConverter implementation us the net.sf.json-lib json library.
> */
> public class BeanJsonLibConverter implements BeanConverter {
>
> - protected static final Log log = LogFactory
> - .getLog(BeanJsonLibConverter.class);
> + /**
> + * The Logger
> + */
> + protected static final Log LOG = LogFactory.getLog(BeanJsonLibConverter.class);
> + /**
> + * The Guice injector used to create beans
> + */
> private Injector injector;
> + /**
> + * Json Config object used by each instance.
> + */
> private JsonConfig jsonConfig;
> + /**
> + * in IDE debug flag
> + */
> private boolean debugMode = false;
>
> /*
> @@ -74,8 +84,7 @@
> morpherRegistry.registerMorpher(new EnumMorpher(Enum.Drinker.class));
> morpherRegistry.registerMorpher(new EnumMorpher(Enum.Field.class));
> morpherRegistry.registerMorpher(new EnumMorpher(Enum.Gender.class));
> - morpherRegistry
> - .registerMorpher(new EnumMorpher(Enum.NetworkPresence.class));
> + morpherRegistry.registerMorpher(new EnumMorpher(Enum.NetworkPresence.class));
> morpherRegistry.registerMorpher(new EnumMorpher(Enum.Smoker.class));
>
> morpherRegistry.registerMorpher(new JsonObjectToMapMorpher());
> @@ -90,7 +99,7 @@
> @SuppressWarnings("unchecked")
> public <T> T convertToObject(String string, final Class<T> rootBeanClass) {
>
> - if ( "".equals(string) ) {
> + if ("".equals(string)) {
> string = "{}";
> }
> if (string.startsWith("[")) {
> @@ -144,13 +153,12 @@
> @SuppressWarnings("unchecked")
> @Override
> public Object newInstance(Class beanClass, JSONObject jsonObject)
> - throws InstantiationException, IllegalAccessException,
> - SecurityException, NoSuchMethodException, InvocationTargetException {
> + throws InstantiationException, IllegalAccessException, NoSuchMethodException,
> + InvocationTargetException {
> if (beanClass != null) {
> Object o = BeanJsonLibConverter.this.injector.getInstance(beanClass);
> if (debugMode) {
> - log.info("Created Object " + o + " for " + beanClass + " with ["
> - + jsonObject + "]");
> + LOG.info("Created Object " + o + " for " + beanClass + " with [" + jsonObject + "]");
> }
> return o;
> }
> @@ -162,28 +170,27 @@
> /*
> * We are expecting null for nulls
> */
> - jsonConfig.registerDefaultValueProcessor(String.class,
> - new DefaultValueProcessor() {
> - @SuppressWarnings("unchecked")
> - public Object getDefaultValue(Class target) {
> - return null;
> - }
> - });
> -
> + jsonConfig.registerDefaultValueProcessor(String.class, new DefaultValueProcessor() {
> + @SuppressWarnings("unchecked")
> + public Object getDefaultValue(Class target) {
> + return null;
> + }
> + });
> +
> jsonConfig.setJsonPropertyFilter(new PropertyFilter() {
>
> public boolean apply(Object source, String name, Object value) {
> return filterProperty(source, name, value);
> }
> -
> +
> });
> -
> +
> jsonConfig.setJavaPropertyFilter(new PropertyFilter() {
>
> public boolean apply(Object source, String name, Object value) {
> - return filterProperty(source,name,value);
> + return filterProperty(source, name, value);
> }
> -
> +
> });
>
> // the classMap deals with the basic json string to bean conversion
> @@ -197,7 +204,7 @@
> * there is a map could be selected on the basis of the root object. It
> * would be better to do this with generics, but this is good enough and
> * compact enough for the moment.
> - *
> + *
> */
> //
> // activity
> @@ -227,47 +234,53 @@
> }
>
> /**
> - * @param source
> - * @param name
> - * @param value
> - * @return
> + * Filter the output of a property, if it should be emitted return false.
> + * @param source The object containing the value
> + * @param name the name of the key in the output structure
> + * @param value the value of the object
> + * @return true if the property should be filtered, false if not.
> */
> protected boolean filterProperty(Object source, String name, Object value) {
> - if ( value == null ) {
> + if (value == null) {
> return true;
> }
> - if ( value instanceof JSONArray ) {
> + if (value instanceof JSONArray) {
> JSONArray array = (JSONArray) value;
> - if ( array.size() == 0 ) {
> + if (array.size() == 0) {
> return true;
> }
> }
> - if ( value instanceof JSONObject ) {
> + if (value instanceof JSONObject) {
> JSONObject object = (JSONObject) value;
> - if ( object.isNullObject() || object.isEmpty() ) {
> + if (object.isNullObject() || object.isEmpty()) {
> return true;
> }
> }
> - if ( value instanceof Collection) {
> + if (value instanceof Collection) {
> Collection<?> collection = (Collection<?>) value;
> - if ( collection.size() == 0 ) {
> + if (collection.size() == 0) {
> return true;
> }
> }
> - if ( value instanceof Object[] ) {
> + if (value instanceof Object[]) {
> Object[] oarray = (Object[]) value;
> - if ( oarray.length == 0 ) {
> + if (oarray.length == 0) {
> return true;
> }
> }
> return false;
> }
>
> + /**
> + * Convert the pojo to a json string representation.
> + * @param pojo the pojo to convert
> + * @return the json string representation of the pojo.
> + */
> public String convertToString(Object pojo) {
> - if ( "".equals(pojo) ) {
> + if ("".equals(pojo)) {
> return "{}";
> }
> -
> +
> try {
> JSONObject jsonObject = JSONObject.fromObject(pojo, jsonConfig);
> return jsonObject.toString();
> @@ -283,8 +296,9 @@
> }
>
> /**
> - * @param string
> - * @param class1
> + * Add a mapping to the json -> pojo conversion map.
> + * @param key the name of the json key to bind to
> + * @param class1 the class that should be used to represent that key
> */
> @SuppressWarnings("unchecked")
> public void addMapping(String key, Class<?> class1) {
>
> Modified: incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/BeanXmlConverter.java
> URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/BeanXmlConverter.java?rev=679109&r1=679108&r2=679109&view=diff
> ==============================================================================
> --- incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/BeanXmlConverter.java (original)
> +++ incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/BeanXmlConverter.java Wed Jul 23 08:19:10 2008
> @@ -61,8 +61,8 @@
> } finally {
> try {
> writer.close();
> - } catch(IOException e) {
> - // ignore this exception. it won't matter
> + } catch (IOException e) {
> + logger.log(Level.FINEST, e.getMessage(), e);
> }
> }
>
>
> Modified: incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/EnumUtil.java
> URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/EnumUtil.java?rev=679109&r1=679108&r2=679109&view=diff
> ==============================================================================
> --- incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/EnumUtil.java (original)
> +++ incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/EnumUtil.java Wed Jul 23 08:19:10 2008
> @@ -24,11 +24,17 @@
> import java.util.Set;
>
> /**
> - * Utility class for OpenSocial enums
> + * Utility class for OpenSocial enums.
> */
> -public class EnumUtil {
> +public final class EnumUtil {
>
> /**
> + * This is a utility class and can't be constructed.
> + */
> + private EnumUtil() {
> +
> + }
> + /**
> * @param vals array of enums
> * @return a set of the names for a list of Enum values defined by toString
> */
>
> Modified: incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/JsonLibConverterUtils.java
> URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/JsonLibConverterUtils.java?rev=679109&r1=679108&r2=679109&view=diff
> ==============================================================================
> --- incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/JsonLibConverterUtils.java (original)
> +++ incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/JsonLibConverterUtils.java Wed Jul 23 08:19:10 2008
> @@ -24,48 +24,58 @@
> import net.sf.json.JSONObject;
>
> /**
> - *
> + * Some utility functions to simpilfy handling SF json-lib objects.
> */
> public class JsonLibConverterUtils {
> - protected static final Log log = LogFactory
> - .getLog(JsonLibConverterUtils.class);
> + /**
> + * This class is a utility class and can't be constructed.
> + */
> + private JsonLibConverterUtils() {
> + }
> +
> + protected static final Log LOG = LogFactory.getLog(JsonLibConverterUtils.class);
>
> -
> /**
> + * Dumps a JSON Object out to the log at info level.
> + *
> * @param jsonObject
> + * The object to dump
> + * @param indent
> + * the indent to be used per object nesting.
> */
> public static final void dumpJsonObject(JSONObject jsonObject, String indent) {
> for (Object key : jsonObject.keySet()) {
> Object value = jsonObject.get(key);
> if (value instanceof JSONObject) {
> - log.info(indent + key + ":JSONObject");
> + LOG.info(indent + key + ":JSONObject");
> dumpJsonObject((JSONObject) value, indent + " ");
> } else if (value instanceof JSONArray) {
> - log.info(indent + key + ":JSONArray " + ((JSONArray) value).size());
> + LOG.info(indent + key + ":JSONArray " + ((JSONArray) value).size());
> dumpJsonArray((JSONArray) value, indent + " ");
> } else {
> - log.info(indent + key + ":" + value + ":"
> - + (value == null ? "na" : value.getClass()));
> + if (value == null) {
> + LOG.info(indent + key + ":" + value + ":" + "na");
> + } else {
> + LOG.info(indent + key + ":" + value + ":" + value.getClass());
> + }
> }
> }
> }
>
> -
> /**
> * @param value
> * @param string
> */
> - static void dumpJsonArray(JSONArray array, String indent) {
> + public static void dumpJsonArray(JSONArray array, String indent) {
> for (Object value : array) {
> if (value instanceof JSONObject) {
> - log.info(indent + ":JSONObject");
> + LOG.info(indent + ":JSONObject");
> dumpJsonObject((JSONObject) value, indent + " ");
> } else if (value instanceof JSONArray) {
> - log.info(indent + ":JSONArray " + ((JSONArray) value).size());
> + LOG.info(indent + ":JSONArray " + ((JSONArray) value).size());
> dumpJsonArray((JSONArray) value, indent + " ");
> } else {
> - log.info(indent + ":" + value + ":"
> - + (value == null ? "na" : value.getClass()));
> + LOG.info(indent + ":" + value + ":" + (value == null ? "na" : value.getClass()));
> }
> }
> }
>
> Modified: incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/JsonObjectToMapMorpher.java
> URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/JsonObjectToMapMorpher.java?rev=679109&r1=679108&r2=679109&view=diff
> ==============================================================================
> --- incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/JsonObjectToMapMorpher.java (original)
> +++ incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/JsonObjectToMapMorpher.java Wed Jul 23 08:19:10 2008
> @@ -34,15 +34,15 @@
> }
>
> @SuppressWarnings("unchecked")
> - public boolean supports(Class clazz) {
> + public boolean supports(Class clazz) {
> return (JSONObject.class.equals(clazz));
> }
>
> public Object morph(Object bean) {
> Map<Object, Object> result = new HashMap<Object, Object>();
> JSONObject jsonObject = (JSONObject) bean;
> - for ( Object key : jsonObject.keySet()) {
> - result.put(key,jsonObject.get(key));
> + for (Object key : jsonObject.keySet()) {
> + result.put(key, jsonObject.get(key));
> }
> return result;
> }
>
> Modified: incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/Address.java
> URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/Address.java?rev=679109&r1=679108&r2=679109&view=diff
> ==============================================================================
> --- incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/Address.java (original)
> +++ incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/Address.java Wed Jul 23 08:19:10 2008
> @@ -54,7 +54,7 @@
> return this.jsonString;
> }
> }
> -
> +
> String getCountry();
>
> void setCountry(String country);
>
> Modified: incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/BodyType.java
> URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/BodyType.java?rev=679109&r1=679108&r2=679109&view=diff
> ==============================================================================
> --- incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/BodyType.java (original)
> +++ incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/BodyType.java Wed Jul 23 08:19:10 2008
> @@ -43,7 +43,7 @@
> return this.jsonString;
> }
> }
> -
> +
> String getBuild();
>
> void setBuild(String build);
>
> Modified: incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/Enum.java
> URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/Enum.java?rev=679109&r1=679108&r2=679109&view=diff
> ==============================================================================
> --- incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/Enum.java (original)
> +++ incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/Enum.java Wed Jul 23 08:19:10 2008
> @@ -52,7 +52,7 @@
> }
>
> /**
> - * public java.lang.Enum for opensocial.Enum.Drinker
> + * public java.lang.Enum for opensocial.Enum.Drinker.
> */
> public enum Drinker implements EnumKey {
> HEAVILY("HEAVILY", "Heavily"),
> @@ -83,7 +83,7 @@
> }
>
> /**
> - * public java.lang.Enum for opensocial.Enum.Gender
> + * public java.lang.Enum for opensocial.Enum.Gender.
> */
> public enum Gender implements EnumKey {
> FEMALE("FEMALE", "Female"),
> @@ -108,7 +108,7 @@
> }
>
> /**
> - * public java.lang.Enum for opensocial.Enum.Smoker
> + * public java.lang.Enum for opensocial.Enum.Smoker.
> */
> public enum Smoker implements EnumKey {
> HEAVILY("HEAVILY", "Heavily"),
> @@ -139,7 +139,7 @@
> }
>
> /**
> - * public java.lang.Enum for opensocial.Enum.NetworkPresence
> + * public java.lang.Enum for opensocial.Enum.NetworkPresence.
> */
> public enum NetworkPresence implements EnumKey {
> ONLINE("ONLINE", "Online"),
>
> Modified: incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/Message.java
> URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/Message.java?rev=679109&r1=679108&r2=679109&view=diff
> ==============================================================================
> --- incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/Message.java (original)
> +++ incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/Message.java Wed Jul 23 08:19:10 2008
> @@ -87,20 +87,20 @@
> void setBody(String newBody);
>
> /**
> - * Gets the title of the message
> + * Gets the title of the message.
> * @return the title of the message
> */
> String getTitle();
>
> /**
> - * Sets the title of the message
> + * Sets the title of the message.
> * HTML attributes are allowed and are sanitized by the container.
> * @param newTitle the title of the message
> */
> void setTitle(String newTitle);
>
> /**
> - * Gets the type of the message, as specified by opensocial.Message.Type
> + * Gets the type of the message, as specified by opensocial.Message.Type.
> * @return the type of message (enum Message.Type)
> */
> Type getType();
>
> Modified: incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/Organization.java
> URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/Organization.java?rev=679109&r1=679108&r2=679109&view=diff
> ==============================================================================
> --- incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/Organization.java (original)
> +++ incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/Organization.java Wed Jul 23 08:19:10 2008
> @@ -31,7 +31,7 @@
> @ImplementedBy(OrganizationImpl.class)
>
> public interface Organization {
> -
> +
> public static enum Field {
> ADDRESS("address"),
> DESCRIPTION("description"),
>
> Modified: incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/Person.java
> URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/Person.java?rev=679109&r1=679108&r2=679109&view=diff
> ==============================================================================
> --- incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/Person.java (original)
> +++ incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/Person.java Wed Jul 23 08:19:10 2008
> @@ -30,7 +30,7 @@
> * see
> * http://code.google.com/apis/opensocial/docs/0.8/reference/#opensocial.Person.Field
> * for all field meanings. All fields are represented in the js api at this time except for
> - * lastUpdated. This field is currently only in the RESTful spec.
> + * lastUpdated. This field is currently only in the RESTful spec.
> *
> */
>
> @@ -64,7 +64,7 @@
> JOB_INTERESTS("jobInterests"),
> JOBS("jobs"),
> LANGUAGES_SPOKEN("languagesSpoken"),
> - LAST_UPDATED("updated"), /** Needed to support the RESTful api **/
> + LAST_UPDATED("updated"), /** Needed to support the RESTful api. **/
> LIVING_ARRANGEMENT("livingArrangement"),
> LOOKING_FOR("lookingFor"),
> MOVIES("movies"),
>
> Modified: incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/Phone.java
> URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/Phone.java?rev=679109&r1=679108&r2=679109&view=diff
> ==============================================================================
> --- incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/Phone.java (original)
> +++ incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/Phone.java Wed Jul 23 08:19:10 2008
> @@ -46,7 +46,7 @@
> return this.jsonString;
> }
> }
> -
> +
> String getNumber();
>
> void setNumber(String number);
>
> Modified: incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/oauth/OAuthTokenPrincipalMapper.java
> URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/oauth/OAuthTokenPrincipalMapper.java?rev=679109&r1=679108&r2=679109&view=diff
> ==============================================================================
> --- incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/oauth/OAuthTokenPrincipalMapper.java (original)
> +++ incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/oauth/OAuthTokenPrincipalMapper.java Wed Jul 23 08:19:10 2008
> @@ -22,7 +22,7 @@
> import net.oauth.OAuthProblemException;
>
> /**
> - * Interface describing a service that can be used to look up
> + * Interface describing a service that can be used to look up
> * {@link DelegatedPrincipal}s associated with OAuth tokens.
> */
> public interface OAuthTokenPrincipalMapper {
>
> Modified: incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/ActivityHandler.java
> URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/ActivityHandler.java?rev=679109&r1=679108&r2=679109&view=diff
> ==============================================================================
> --- incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/ActivityHandler.java (original)
> +++ incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/ActivityHandler.java Wed Jul 23 08:19:10 2008
> @@ -30,7 +30,8 @@
>
> // TODO: The appId should come from the url. The spec needs to be fixed!
> private static final String ACTIVITY_ID_PATH = "/activities/{userId}/{groupId}/{activityId}";
> - private static final String GROUP_PATH = "/activities/{userId}/{groupId}/{appId}"; // Note: not what the spec says
> + // Note: not what the spec says
> + private static final String GROUP_PATH = "/activities/{userId}/{groupId}/{appId}";
>
> @Inject
> public ActivityHandler(ActivityService service) {
>
> Modified: incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/DataServiceServlet.java
> URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/DataServiceServlet.java?rev=679109&r1=679108&r2=679109&view=diff
> ==============================================================================
> --- incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/DataServiceServlet.java (original)
> +++ incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/DataServiceServlet.java Wed Jul 23 08:19:10 2008
> @@ -80,7 +80,8 @@
> }
>
> @Inject
> - public void setBeanConverters(@Named("bean.converter.json") BeanConverter jsonConverter, @Named("bean.converter.xml") BeanConverter xmlConverter) {
> + public void setBeanConverters(@Named("bean.converter.json") BeanConverter jsonConverter,
> + @Named("bean.converter.xml") BeanConverter xmlConverter) {
> this.jsonConverter = jsonConverter;
> this.xmlConverter = xmlConverter;
> }
> @@ -252,9 +253,10 @@
> String getRouteFromParameter(String pathInfo) {
> pathInfo = pathInfo.substring(1);
> int indexOfNextPathSeparator = pathInfo.indexOf('/');
> - return indexOfNextPathSeparator != -1 ?
> - pathInfo.substring(0, indexOfNextPathSeparator) :
> - pathInfo;
> + if ( indexOfNextPathSeparator != -1 ) {
> + return pathInfo.substring(0, indexOfNextPathSeparator);
> + }
> + return pathInfo;
> }
>
> boolean isBatchUrl(HttpServletRequest servletRequest) {
>
> Modified: incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/PersonHandler.java
> URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/PersonHandler.java?rev=679109&r1=679108&r2=679109&view=diff
> ==============================================================================
> --- incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/PersonHandler.java (original)
> +++ incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/PersonHandler.java Wed Jul 23 08:19:10 2008
> @@ -23,7 +23,6 @@
> import org.apache.shindig.social.opensocial.spi.GroupId;
> import org.apache.shindig.social.opensocial.spi.PersonService;
> import org.apache.shindig.social.opensocial.spi.UserId;
> -import org.apache.shindig.social.opensocial.spi.GroupId.Type;
> import org.apache.shindig.common.util.ImmediateFuture;
>
> import com.google.common.collect.Sets;
>
> Modified: incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/RequestItem.java
> URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/RequestItem.java?rev=679109&r1=679108&r2=679109&view=diff
> ==============================================================================
> --- incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/RequestItem.java (original)
> +++ incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/RequestItem.java Wed Jul 23 08:19:10 2008
> @@ -22,8 +22,6 @@
> import org.apache.shindig.social.opensocial.spi.GroupId;
> import org.apache.shindig.social.opensocial.spi.PersonService;
> import org.apache.shindig.social.opensocial.spi.UserId;
> -import org.apache.shindig.social.opensocial.spi.PersonService.FilterType;
> -import org.apache.shindig.social.opensocial.spi.PersonService.SortOrder;
>
> import com.google.common.collect.Maps;
> import com.google.common.collect.Sets;
> @@ -114,7 +112,11 @@
> String queryParams = fullUrl.substring(queryParamIndex + 1);
> for (String param : queryParams.split("&")) {
> String[] paramPieces = param.split("=", 2);
> - this.params.put(paramPieces[0], paramPieces.length == 2 ? paramPieces[1] : "");
> + if (paramPieces.length == 2) {
> + this.params.put(paramPieces[0], paramPieces[1]);
> + } else {
> + this.params.put(paramPieces[0], "");
> + }
> }
> }
> }
> @@ -246,4 +248,4 @@
> public void setConverter(BeanConverter converter) {
> this.converter = converter;
> }
> -}
> \ No newline at end of file
> +}
>
> Modified: incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/ActivityService.java
> URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/ActivityService.java?rev=679109&r1=679108&r2=679109&view=diff
> ==============================================================================
> --- incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/ActivityService.java (original)
> +++ incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/ActivityService.java Wed Jul 23 08:19:10 2008
> @@ -27,8 +27,11 @@
> import java.util.Set;
> import java.util.concurrent.Future;
>
> +/**
> + * The ActivityService interface defines the service provider interface to
> + * retrieve activities from the underlying SNS.
> + */
> @ImplementedBy(JsonDbOpensocialService.class)
> -
> public interface ActivityService {
>
> /**
> @@ -41,7 +44,7 @@
> * @param token A valid SecurityToken
> * @return a response item with the list of activities.
> */
> - public Future<ResponseItem<RestfulCollection<Activity>>> getActivities(UserId userId,
> + Future<ResponseItem<RestfulCollection<Activity>>> getActivities(UserId userId,
> GroupId groupId, String appId, Set<String> fields, SecurityToken token);
>
> /**
> @@ -56,7 +59,7 @@
> * @param token A valid SecurityToken
> * @return a response item with the list of activities.
> */
> - public Future<ResponseItem<Activity>> getActivity(UserId userId, GroupId groupId, String appId,
> + Future<ResponseItem<Activity>> getActivity(UserId userId, GroupId groupId, String appId,
> Set<String> fields, String activityId, SecurityToken token);
>
> /**
> @@ -70,7 +73,7 @@
> * @param token A valid SecurityToken.
> * @return a response item containing any errors
> */
> - public Future<ResponseItem<Object>> deleteActivity(UserId userId, GroupId groupId, String appId,
> + Future<ResponseItem<Object>> deleteActivity(UserId userId, GroupId groupId, String appId,
> String activityId, SecurityToken token);
>
> /**
> @@ -85,6 +88,6 @@
> * @param token A valid SecurityToken
> * @return a response item containing any errors
> */
> - public Future<ResponseItem<Object>> createActivity(UserId userId, GroupId groupId, String appId,
> + Future<ResponseItem<Object>> createActivity(UserId userId, GroupId groupId, String appId,
> Set<String> fields, Activity activity, SecurityToken token);
> }
>
> Modified: incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/AppDataService.java
> URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/AppDataService.java?rev=679109&r1=679108&r2=679109&view=diff
> ==============================================================================
> --- incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/AppDataService.java (original)
> +++ incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/AppDataService.java Wed Jul 23 08:19:10 2008
> @@ -27,47 +27,66 @@
> import java.util.Set;
> import java.util.concurrent.Future;
>
> +/**
> + * Data Service SPI interface. This interface represents is used to retrieve
> + * information bound to a person, there are methods to update and delete data.
> + */
> @ImplementedBy(JsonDbOpensocialService.class)
> public interface AppDataService {
>
> /**
> * Retrives app data for the specified user and group.
> - * @param userId The user
> - * @param groupId The group
> - * @param appId The app
> - * @param fields The fields to filter the data by.
> - * @param token The security token
> + *
> + * @param userId
> + * The user
> + * @param groupId
> + * The group
> + * @param appId
> + * The app
> + * @param fields
> + * The fields to filter the data by.
> + * @param token
> + * The security token
> * @return The data fetched
> */
> - public Future<ResponseItem<DataCollection>> getPersonData(UserId userId, GroupId groupId,
> - String appId, Set<String> fields, SecurityToken token);
> + Future<ResponseItem<DataCollection>> getPersonData(UserId userId, GroupId groupId, String appId,
> + Set<String> fields, SecurityToken token);
>
> /**
> * Deletes data for the specified user and group.
> *
> - * @param userId The user
> - * @param groupId The group
> - * @param appId The app
> - * @param fields The fields to delete.
> - * @param token The security token
> + * @param userId
> + * The user
> + * @param groupId
> + * The group
> + * @param appId
> + * The app
> + * @param fields
> + * The fields to delete.
> + * @param token
> + * The security token
> * @return an error if one occurs
> */
> - public Future<ResponseItem<Object>> deletePersonData(UserId userId, GroupId groupId, String appId,
> - Set<String> fields, SecurityToken token);
> + Future<ResponseItem<Object>> deletePersonData(UserId userId, GroupId groupId,
> + String appId, Set<String> fields, SecurityToken token);
>
> /**
> * Updates app data for the specified user and group with the new values.
> *
> - * @param userId The user
> - * @param groupId The group
> - * @param appId The app
> - * @param fields The fields to filter the data by.
> - * @param values The values to set
> - * @param token The security token
> + * @param userId
> + * The user
These are all wrong. It should be the previous all one line javadoc.
This happened in several places.
> + * @param groupId
> + * The group
> + * @param appId
> + * The app
> + * @param fields
> + * The fields to filter the data by.
> + * @param values
> + * The values to set
> + * @param token
> + * The security token
> * @return an error if one occurs
> */
> - public Future<ResponseItem<Object>> updatePersonData(UserId userId, GroupId groupId, String appId,
> - Set<String> fields, Map<String, String> values, SecurityToken token);
> + Future<ResponseItem<Object>> updatePersonData(UserId userId, GroupId groupId,
> + String appId, Set<String> fields, Map<String, String> values, SecurityToken token);
> }
> -
> -
>
> Modified: incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/GroupId.java
> URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/GroupId.java?rev=679109&r1=679108&r2=679109&view=diff
> ==============================================================================
> --- incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/GroupId.java (original)
> +++ incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/GroupId.java Wed Jul 23 08:19:10 2008
> @@ -24,8 +24,8 @@
> all, friends, self, groupId
> }
>
> - Type type;
> - String groupId;
> + private Type type;
> + private String groupId;
>
> public GroupId(Type type, String groupId) {
> this.groupId = groupId;
> @@ -64,7 +64,10 @@
>
> @Override
> public int hashCode() {
> - int groupHashCode = this.groupId == null ? 0 : this.groupId.hashCode();
> + int groupHashCode = 0;
> + if (this.groupId != null) {
> + groupHashCode = this.groupId.hashCode();
> + }
> return this.type.hashCode() + groupHashCode;
> }
> }
>
> Modified: incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/PersonService.java
> URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/PersonService.java?rev=679109&r1=679108&r2=679109&view=diff
> ==============================================================================
> --- incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/PersonService.java (original)
> +++ incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/PersonService.java Wed Jul 23 08:19:10 2008
> @@ -52,7 +52,7 @@
> * @param token The gadget token
> * @return a list of people.
> */
> - public Future<ResponseItem<RestfulCollection<Person>>> getPeople(UserId userId, GroupId groupId,
> + Future<ResponseItem<RestfulCollection<Person>>> getPeople(UserId userId, GroupId groupId,
> SortOrder sortOrder, FilterType filter, int first, int max,
> Set<String> fields, SecurityToken token);
>
> @@ -64,5 +64,5 @@
> * @param token The gadget token
> * @return a list of people.
> */
> - public Future<ResponseItem<Person>> getPerson(UserId id, Set<String> fields, SecurityToken token);
> + Future<ResponseItem<Person>> getPerson(UserId id, Set<String> fields, SecurityToken token);
> }
>
> Modified: incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/RestfulCollection.java
> URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/RestfulCollection.java?rev=679109&r1=679108&r2=679109&view=diff
> ==============================================================================
> --- incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/RestfulCollection.java (original)
> +++ incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/RestfulCollection.java Wed Jul 23 08:19:10 2008
> @@ -57,4 +57,4 @@
> public void setTotalResults(int totalResults) {
> this.totalResults = totalResults;
> }
> -}
> \ No newline at end of file
> +}
>
> Modified: incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/UserId.java
> URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/UserId.java?rev=679109&r1=679108&r2=679109&view=diff
> ==============================================================================
> --- incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/UserId.java (original)
> +++ incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/UserId.java Wed Jul 23 08:19:10 2008
> @@ -26,8 +26,8 @@
> viewer, owner, userId
> }
>
> - Type type;
> - String userId;
> + private Type type;
> + private String userId;
>
> public UserId(Type type, String userId) {
> this.type = type;
>
> Modified: incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/sample/container/SampleContainerHandler.java
> URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/sample/container/SampleContainerHandler.java?rev=679109&r1=679108&r2=679109&view=diff
> ==============================================================================
> --- incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/sample/container/SampleContainerHandler.java (original)
> +++ incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/sample/container/SampleContainerHandler.java Wed Jul 23 08:19:10 2008
> @@ -45,21 +45,21 @@
> }
>
> /**
> - * We don't support any delete methods right now
> + * We don't support any delete methods right now.
> */
> protected Future<? extends ResponseItem> handleDelete(RequestItem request) {
> throw new UnsupportedOperationException();
> }
>
> /**
> - * We don't distinguish between put and post for these urls
> + * We don't distinguish between put and post for these urls.
> */
> protected Future<? extends ResponseItem> handlePut(RequestItem request) {
> return handlePost(request);
> }
>
> /**
> - * Handles /samplecontainer/setstate and /samplecontainer/setevilness/{doevil}
> + * Handles /samplecontainer/setstate and /samplecontainer/setevilness/{doevil}.
> * TODO(doll): These urls aren't very resty. Consider changing the samplecontainer.html calls
> * post.
> */
> @@ -110,4 +110,4 @@
> jsonState.releaseConnection();
> }
> }
> -}
> \ No newline at end of file
> +}
>
> Modified: incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/sample/container/SampleContainerHandlerProvider.java
> URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/sample/container/SampleContainerHandlerProvider.java?rev=679109&r1=679108&r2=679109&view=diff
> ==============================================================================
> --- incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/sample/container/SampleContainerHandlerProvider.java (original)
> +++ incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/sample/container/SampleContainerHandlerProvider.java Wed Jul 23 08:19:10 2008
> @@ -38,4 +38,4 @@
> public Map<String, Class<? extends DataRequestHandler>> get() {
> return handlers;
> }
> -}
> \ No newline at end of file
> +}
>
> Modified: incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/sample/service/JsonDbOpensocialService.java
> URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/sample/service/JsonDbOpensocialService.java?rev=679109&r1=679108&r2=679109&view=diff
> ==============================================================================
> --- incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/sample/service/JsonDbOpensocialService.java (original)
> +++ incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/sample/service/JsonDbOpensocialService.java Wed Jul 23 08:19:10 2008
> @@ -54,7 +54,7 @@
> import java.util.concurrent.Future;
>
> /**
> - * Implementation of supported services backed by a JSON DB
> + * Implementation of supported services backed by a JSON DB.
> */
> @Singleton
> public class JsonDbOpensocialService implements ActivityService, PersonService, AppDataService {
> @@ -147,8 +147,8 @@
> JSONArray activities = db.getJSONObject(ACTIVITIES_TABLE).getJSONArray(user);
> for (int i = 0; i < activities.length(); i++) {
> JSONObject activity = activities.getJSONObject(i);
> - if (activity.get(Activity.Field.USER_ID.toString()).equals(user) &&
> - activity.get(Activity.Field.ID.toString()).equals(activityId)) {
> + if (activity.get(Activity.Field.USER_ID.toString()).equals(user)
> + && activity.get(Activity.Field.ID.toString()).equals(activityId)) {
> return ImmediateFuture.newInstance(new ResponseItem<Activity>(
> convertToActivity(activity, fields)));
> }
> @@ -199,7 +199,8 @@
> if (!jsonObject.has(Activity.Field.ID.toString())) {
> jsonObject.put(Activity.Field.ID.toString(), System.currentTimeMillis());
> }
> - JSONArray jsonArray = db.getJSONObject(ACTIVITIES_TABLE).getJSONArray(userId.getUserId(token));
> + JSONArray jsonArray = db.getJSONObject(ACTIVITIES_TABLE)
> + .getJSONArray(userId.getUserId(token));
> if (jsonArray == null) {
> jsonArray = new JSONArray();
> db.getJSONObject(ACTIVITIES_TABLE).put(userId.getUserId(token), jsonArray);
> @@ -378,12 +379,11 @@
> }
> for (int i = 0; i < key.length(); ++i) {
> char c = key.charAt(i);
> - if ((c >= 'a' && c <= 'z') ||
> - (c >= 'A' && c <= 'Z') ||
> - (c >= '0' && c <= '9') ||
> - (c == '-') ||
> - (c == '_') ||
> - (c == '.')) {
> + if ((c >= 'a' && c <= 'z')
> + || (c >= 'A' && c <= 'Z')
> + || (c >= '0' && c <= '9')
> + || (c == '-')
> + || (c == '_') || (c == '.')) {
> continue;
> }
> return false;
> @@ -392,7 +392,7 @@
> }
>
> /**
> - * Get the set of user id's from a user and group
> + * Get the set of user id's from a user and group.
> */
> private Set<String> getIdSet(UserId user, GroupId group, SecurityToken token)
> throws JSONException {
> @@ -442,4 +442,4 @@
> }
> return converter.convertToObject(object.toString(), Person.class);
> }
> -}
> \ No newline at end of file
> +}
>
> Modified: incubator/shindig/trunk/site/checkstyle.xml
> URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/site/checkstyle.xml?rev=679109&r1=679108&r2=679109&view=diff
> ==============================================================================
> --- incubator/shindig/trunk/site/checkstyle.xml (original)
> +++ incubator/shindig/trunk/site/checkstyle.xml Wed Jul 23 08:19:10 2008
> @@ -167,7 +167,7 @@
> <module name="TabCharacter"/>
> <module name="WhitespaceAfter"/>
> <module name="WhitespaceAround">
> - <property name="tokens" value="ASSIGN, BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN, EQUAL, GE, GT, LAND, LCURLY, LE, LITERAL_ASSERT, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_RETURN, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, LOR, LT, MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN, NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION, RCURLY, SL, SLIST, SL_ASSIGN, SR, SR_ASSIGN, STAR, STAR_ASSIGN, TYPE_EXTENSION_AND, WILDCARD_TYPE"/>
> + <property name="tokens" value="ASSIGN, BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN, EQUAL, GE, GT, LAND, LCURLY, LE, LITERAL_ASSERT, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_RETURN, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, LOR, LT, MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN, NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION, RCURLY, SL, SLIST, SL_ASSIGN, SR, SR_ASSIGN, STAR, STAR_ASSIGN, TYPE_EXTENSION_AND"/>
> </module>
>
>
> @@ -253,7 +253,12 @@
> <property name="format" value="\s+$"/>
> <property name="message" value="Line has trailing spaces."/>
> </module>
> - <module name="TodoComment"/>
> +<!--
> + <module name="TodoComment">
> + <property name="severity" value="info"/>
> + </module>
> +-->
why add this commented out portion?
> +
> <module name="UpperEll"/>
>
> </module>
>
>
>
Re: svn commit: r679109 - in /incubator/shindig/trunk:
java/social-api/src/main/java/org/apache/shindig/social/ java/social-api/src/main/java/org/apache/shindig/social/core/config/
java/social-api/src/main/java/org/apache/shindig/social/core/model/ j
Posted by Cassie <do...@google.com>.
Oh I see, the standard place definitely seems right then.
On Wed, Jul 23, 2008 at 12:49 PM, Ian Boston <ie...@tfd.co.uk> wrote:
> There are 2 places the TODO's can be recorded
> either in the CheckStyle report, or in the Tags report.
>
> The Tags report is a more standard place to record TODO ( and other things
> like FIXME), as they tend to get lots where there are a log of check style
> issues.
>
> So, I wasnt certain if we want to record TODO's as a style issue or not ?
>
> (I am being confusing towards the end of the day here :), if it makes no
> sense just ask me to remove it, and I will.)
>
> Ian
>
> On 23 Jul 2008, at 20:42, Cassie wrote:
>
> Sorry for my slowness but I'm slightly confused by your question.
>> We should probably check the TODO style, is that what you are asking?
>>
>> - Cassie
>>
>>
>> On Wed, Jul 23, 2008 at 12:39 PM, Ian Boston <ie...@tfd.co.uk> wrote:
>>
>> Do we want the TODO's in check style or in the list of Tags ?
>>>
>>> I wasn't certain, so I left it there commented out.
>>>
>>> Happy to remove.
>>>
>>> Ian
>>>
>>> On 23 Jul 2008, at 20:32, Cassie wrote:
>>>
>>> - <module name="TodoComment"/>
>>>
>>>> +<!--
>>>>> + <module name="TodoComment">
>>>>> + <property name="severity" value="info"/>
>>>>> + </module>
>>>>> +-->
>>>>>
>>>>>
>>>> why add this commented out portion?
>>>>
>>>>
>>>
>>>
>
Re: svn commit: r679109 - in /incubator/shindig/trunk: java/social-api/src/main/java/org/apache/shindig/social/ java/social-api/src/main/java/org/apache/shindig/social/core/config/ java/social-api/src/main/java/org/apache/shindig/social/core/model/ j
Posted by Ian Boston <ie...@tfd.co.uk>.
There are 2 places the TODO's can be recorded
either in the CheckStyle report, or in the Tags report.
The Tags report is a more standard place to record TODO ( and other
things like FIXME), as they tend to get lots where there are a log of
check style issues.
So, I wasnt certain if we want to record TODO's as a style issue or
not ?
(I am being confusing towards the end of the day here :), if it makes
no sense just ask me to remove it, and I will.)
Ian
On 23 Jul 2008, at 20:42, Cassie wrote:
> Sorry for my slowness but I'm slightly confused by your question.
> We should probably check the TODO style, is that what you are asking?
>
> - Cassie
>
>
> On Wed, Jul 23, 2008 at 12:39 PM, Ian Boston <ie...@tfd.co.uk> wrote:
>
>> Do we want the TODO's in check style or in the list of Tags ?
>>
>> I wasn't certain, so I left it there commented out.
>>
>> Happy to remove.
>>
>> Ian
>>
>> On 23 Jul 2008, at 20:32, Cassie wrote:
>>
>> - <module name="TodoComment"/>
>>>> +<!--
>>>> + <module name="TodoComment">
>>>> + <property name="severity" value="info"/>
>>>> + </module>
>>>> +-->
>>>>
>>>
>>> why add this commented out portion?
>>>
>>
>>
Re: svn commit: r679109 - in /incubator/shindig/trunk: java/social-api/src/main/java/org/apache/shindig/social/ java/social-api/src/main/java/org/apache/shindig/social/core/config/ java/social-api/src/main/java/org/apache/shindig/social/core/model/ j
Posted by Ian Boston <ie...@tfd.co.uk>.
Oh and BTW, sorry for the deluge of commits, there wont be any more
today unless I have need to fix things that I have broken. I thought
it was a quiet opportunity after the refractor. I have nothing
pending here.
Ian
On 23 Jul 2008, at 20:42, Cassie wrote:
> Sorry for my slowness but I'm slightly confused by your question.
> We should probably check the TODO style, is that what you are asking?
>
> - Cassie
>
>
> On Wed, Jul 23, 2008 at 12:39 PM, Ian Boston <ie...@tfd.co.uk> wrote:
>
>> Do we want the TODO's in check style or in the list of Tags ?
>>
>> I wasn't certain, so I left it there commented out.
>>
>> Happy to remove.
>>
>> Ian
>>
>> On 23 Jul 2008, at 20:32, Cassie wrote:
>>
>> - <module name="TodoComment"/>
>>>> +<!--
>>>> + <module name="TodoComment">
>>>> + <property name="severity" value="info"/>
>>>> + </module>
>>>> +-->
>>>>
>>>
>>> why add this commented out portion?
>>>
>>
>>
Re: svn commit: r679109 - in /incubator/shindig/trunk:
java/social-api/src/main/java/org/apache/shindig/social/ java/social-api/src/main/java/org/apache/shindig/social/core/config/
java/social-api/src/main/java/org/apache/shindig/social/core/model/ j
Posted by Cassie <do...@google.com>.
Sorry for my slowness but I'm slightly confused by your question.
We should probably check the TODO style, is that what you are asking?
- Cassie
On Wed, Jul 23, 2008 at 12:39 PM, Ian Boston <ie...@tfd.co.uk> wrote:
> Do we want the TODO's in check style or in the list of Tags ?
>
> I wasn't certain, so I left it there commented out.
>
> Happy to remove.
>
> Ian
>
> On 23 Jul 2008, at 20:32, Cassie wrote:
>
> - <module name="TodoComment"/>
>>> +<!--
>>> + <module name="TodoComment">
>>> + <property name="severity" value="info"/>
>>> + </module>
>>> +-->
>>>
>>
>> why add this commented out portion?
>>
>
>
Re: svn commit: r679109 - in /incubator/shindig/trunk: java/social-api/src/main/java/org/apache/shindig/social/ java/social-api/src/main/java/org/apache/shindig/social/core/config/ java/social-api/src/main/java/org/apache/shindig/social/core/model/ j
Posted by Ian Boston <ie...@tfd.co.uk>.
Do we want the TODO's in check style or in the list of Tags ?
I wasn't certain, so I left it there commented out.
Happy to remove.
Ian
On 23 Jul 2008, at 20:32, Cassie wrote:
>> - <module name="TodoComment"/>
>> +<!--
>> + <module name="TodoComment">
>> + <property name="severity" value="info"/>
>> + </module>
>> +-->
>
> why add this commented out portion?