You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sn...@apache.org on 2014/08/26 14:28:18 UTC

[04/26] Add the old 0.0.6 Java SDK code because the Android SDK needs it.

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/c08a2791/sdks/usergrid-java-sdk-0.0.6/src/main/java/org/usergrid/java/client/response/AggregateCounter.java
----------------------------------------------------------------------
diff --git a/sdks/usergrid-java-sdk-0.0.6/src/main/java/org/usergrid/java/client/response/AggregateCounter.java b/sdks/usergrid-java-sdk-0.0.6/src/main/java/org/usergrid/java/client/response/AggregateCounter.java
new file mode 100644
index 0000000..4453e72
--- /dev/null
+++ b/sdks/usergrid-java-sdk-0.0.6/src/main/java/org/usergrid/java/client/response/AggregateCounter.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 org.usergrid.java.client.response;
+
+import static org.usergrid.java.client.utils.JsonUtils.toJsonString;
+
+public class AggregateCounter {
+
+	private long timestamp;
+	private long value;
+
+	public AggregateCounter(long timestamp, long value) {
+		this.timestamp = timestamp;
+		this.value = value;
+	}
+
+	public long getTimestamp() {
+		return timestamp;
+	}
+
+	public void setTimestamp(long timestamp) {
+		this.timestamp = timestamp;
+	}
+
+	public long getValue() {
+		return value;
+	}
+
+	public void setValue(long value) {
+		this.value = value;
+	}
+
+	@Override
+	public String toString() {
+		return toJsonString(this);
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/c08a2791/sdks/usergrid-java-sdk-0.0.6/src/main/java/org/usergrid/java/client/response/AggregateCounterSet.java
----------------------------------------------------------------------
diff --git a/sdks/usergrid-java-sdk-0.0.6/src/main/java/org/usergrid/java/client/response/AggregateCounterSet.java b/sdks/usergrid-java-sdk-0.0.6/src/main/java/org/usergrid/java/client/response/AggregateCounterSet.java
new file mode 100644
index 0000000..6dd0596
--- /dev/null
+++ b/sdks/usergrid-java-sdk-0.0.6/src/main/java/org/usergrid/java/client/response/AggregateCounterSet.java
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 org.usergrid.java.client.response;
+
+import static org.usergrid.java.client.utils.JsonUtils.toJsonString;
+
+import java.util.List;
+import java.util.UUID;
+
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize.Inclusion;
+
+public class AggregateCounterSet {
+	private String name;
+	private UUID user;
+	private UUID group;
+	private UUID queue;
+	private String category;
+	private List<AggregateCounter> values;
+
+	public AggregateCounterSet(String name, UUID user, UUID group,
+			String category, List<AggregateCounter> values) {
+		this.name = name;
+		this.user = user;
+		this.group = group;
+		this.category = category;
+		this.values = values;
+	}
+
+	public AggregateCounterSet(String name, UUID queue, String category,
+			List<AggregateCounter> values) {
+		this.name = name;
+		setQueue(queue);
+		this.category = category;
+		this.values = values;
+	}
+
+	@JsonSerialize(include = Inclusion.NON_NULL)
+	public UUID getUser() {
+		return user;
+	}
+
+	public void setUser(UUID user) {
+		this.user = user;
+	}
+
+	@JsonSerialize(include = Inclusion.NON_NULL)
+	public UUID getGroup() {
+		return group;
+	}
+
+	public void setGroup(UUID group) {
+		this.group = group;
+	}
+
+	@JsonSerialize(include = Inclusion.NON_NULL)
+	public String getCategory() {
+		return category;
+	}
+
+	public void setCategory(String category) {
+		this.category = category;
+	}
+
+	@JsonSerialize(include = Inclusion.NON_NULL)
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	@JsonSerialize(include = Inclusion.NON_NULL)
+	public List<AggregateCounter> getValues() {
+		return values;
+	}
+
+	public void setValues(List<AggregateCounter> values) {
+		this.values = values;
+	}
+
+	@JsonSerialize(include = Inclusion.NON_NULL)
+	public UUID getQueue() {
+		return queue;
+	}
+
+	public void setQueue(UUID queue) {
+		this.queue = queue;
+	}
+
+	@Override
+	public String toString() {
+		return toJsonString(this);
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/c08a2791/sdks/usergrid-java-sdk-0.0.6/src/main/java/org/usergrid/java/client/response/ApiResponse.java
----------------------------------------------------------------------
diff --git a/sdks/usergrid-java-sdk-0.0.6/src/main/java/org/usergrid/java/client/response/ApiResponse.java b/sdks/usergrid-java-sdk-0.0.6/src/main/java/org/usergrid/java/client/response/ApiResponse.java
new file mode 100644
index 0000000..33247d1
--- /dev/null
+++ b/sdks/usergrid-java-sdk-0.0.6/src/main/java/org/usergrid/java/client/response/ApiResponse.java
@@ -0,0 +1,421 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 org.usergrid.java.client.response;
+
+import static org.usergrid.java.client.utils.JsonUtils.toJsonString;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize.Inclusion;
+import org.usergrid.java.client.entities.Entity;
+import org.usergrid.java.client.entities.Message;
+import org.usergrid.java.client.entities.User;
+
+public class ApiResponse {
+
+	private String accessToken;
+
+	private String error;
+	private String errorDescription;
+	private String errorUri;
+	private String exception;
+
+	private String path;
+	private String uri;
+	private String status;
+	private long timestamp;
+	private UUID application;
+	private List<Entity> entities;
+	private UUID next;
+	private String cursor;
+	private String action;
+	private List<Object> list;
+	private Object data;
+	private Map<String, UUID> applications;
+	private Map<String, JsonNode> metadata;
+	private Map<String, List<String>> params;
+	private List<AggregateCounterSet> counters;
+	private ClientCredentialsInfo credentials;
+
+	private List<Message> messages;
+	private List<QueueInfo> queues;
+	private UUID last;
+	private UUID queue;
+	private UUID consumer;
+
+	private User user;
+
+	private final Map<String, JsonNode> properties = new HashMap<String, JsonNode>();
+
+	public ApiResponse() {
+	}
+
+	@JsonAnyGetter
+	public Map<String, JsonNode> getProperties() {
+		return properties;
+	}
+
+	@JsonAnySetter
+	public void setProperty(String key, JsonNode value) {
+		properties.put(key, value);
+	}
+
+	@JsonProperty("access_token")
+	@JsonSerialize(include = Inclusion.NON_NULL)
+	public String getAccessToken() {
+		return accessToken;
+	}
+
+	@JsonProperty("access_token")
+	public void setAccessToken(String accessToken) {
+		this.accessToken = accessToken;
+	}
+
+	@JsonSerialize(include = Inclusion.NON_NULL)
+	public String getError() {
+		return error;
+	}
+
+	public void setError(String error) {
+		this.error = error;
+	}
+
+	@JsonSerialize(include = Inclusion.NON_NULL)
+	@JsonProperty("error_description")
+	public String getErrorDescription() {
+		return errorDescription;
+	}
+
+	@JsonProperty("error_description")
+	public void setErrorDescription(String errorDescription) {
+		this.errorDescription = errorDescription;
+	}
+
+	@JsonSerialize(include = Inclusion.NON_NULL)
+	@JsonProperty("error_uri")
+	public String getErrorUri() {
+		return errorUri;
+	}
+
+	@JsonProperty("error_uri")
+	public void setErrorUri(String errorUri) {
+		this.errorUri = errorUri;
+	}
+
+	@JsonSerialize(include = Inclusion.NON_NULL)
+	public String getException() {
+		return exception;
+	}
+
+	public void setException(String exception) {
+		this.exception = exception;
+	}
+
+	@JsonSerialize(include = Inclusion.NON_NULL)
+	public String getPath() {
+		return path;
+	}
+
+	public void setPath(String path) {
+		this.path = path;
+	}
+
+	@JsonSerialize(include = Inclusion.NON_NULL)
+	public String getUri() {
+		return uri;
+	}
+
+	public void setUri(String uri) {
+		this.uri = uri;
+	}
+
+	@JsonSerialize(include = Inclusion.NON_NULL)
+	public String getStatus() {
+		return status;
+	}
+
+	public void setStatus(String status) {
+		this.status = status;
+	}
+
+	public long getTimestamp() {
+		return timestamp;
+	}
+
+	public void setTimestamp(long timestamp) {
+		this.timestamp = timestamp;
+	}
+
+	@JsonSerialize(include = Inclusion.NON_NULL)
+	public UUID getApplication() {
+		return application;
+	}
+
+	public void setApplication(UUID application) {
+		this.application = application;
+	}
+
+	@JsonSerialize(include = Inclusion.NON_NULL)
+	public List<Entity> getEntities() {
+		return entities;
+	}
+
+	public void setEntities(List<Entity> entities) {
+		this.entities = entities;
+	}
+
+	public int getEntityCount() {
+		if (entities == null) {
+			return 0;
+		}
+		return entities.size();
+	}
+
+	public Entity getFirstEntity() {
+		if ((entities != null) && (entities.size() > 0)) {
+			return entities.get(0);
+		}
+		return null;
+	}
+
+	public <T extends Entity> T getFirstEntity(Class<T> t) {
+		return Entity.toType(getFirstEntity(), t);
+	}
+
+	public Entity getLastEntity() {
+		if ((entities != null) && (entities.size() > 0)) {
+			return entities.get(entities.size() - 1);
+		}
+		return null;
+	}
+
+	public <T extends Entity> T getLastEntity(Class<T> t) {
+		return Entity.toType(getLastEntity(), t);
+	}
+
+	public <T extends Entity> List<T> getEntities(Class<T> t) {
+		return Entity.toType(entities, t);
+	}
+
+	@JsonSerialize(include = Inclusion.NON_NULL)
+	public UUID getNext() {
+		return next;
+	}
+
+	public void setNext(UUID next) {
+		this.next = next;
+	}
+
+	@JsonSerialize(include = Inclusion.NON_NULL)
+	public String getCursor() {
+		return cursor;
+	}
+
+	public void setCursor(String cursor) {
+		this.cursor = cursor;
+	}
+
+	@JsonSerialize(include = Inclusion.NON_NULL)
+	public String getAction() {
+		return action;
+	}
+
+	public void setAction(String action) {
+		this.action = action;
+	}
+
+	@JsonSerialize(include = Inclusion.NON_NULL)
+	public List<Object> getList() {
+		return list;
+	}
+
+	public void setList(List<Object> list) {
+		this.list = list;
+	}
+
+	@JsonSerialize(include = Inclusion.NON_NULL)
+	public Object getData() {
+		return data;
+	}
+
+	public void setData(Object data) {
+		this.data = data;
+	}
+
+	@JsonSerialize(include = Inclusion.NON_NULL)
+	public Map<String, UUID> getApplications() {
+		return applications;
+	}
+
+	public void setApplications(Map<String, UUID> applications) {
+		this.applications = applications;
+	}
+
+	@JsonSerialize(include = Inclusion.NON_NULL)
+	public Map<String, JsonNode> getMetadata() {
+		return metadata;
+	}
+
+	public void setMetadata(Map<String, JsonNode> metadata) {
+		this.metadata = metadata;
+	}
+
+	@JsonSerialize(include = Inclusion.NON_NULL)
+	public Map<String, List<String>> getParams() {
+		return params;
+	}
+
+	public void setParams(Map<String, List<String>> params) {
+		this.params = params;
+	}
+
+	@JsonSerialize(include = Inclusion.NON_NULL)
+	public List<AggregateCounterSet> getCounters() {
+		return counters;
+	}
+
+	public void setCounters(List<AggregateCounterSet> counters) {
+		this.counters = counters;
+	}
+
+	@JsonSerialize(include = Inclusion.NON_NULL)
+	public ClientCredentialsInfo getCredentials() {
+		return credentials;
+	}
+
+	public void setCredentials(ClientCredentialsInfo credentials) {
+		this.credentials = credentials;
+	}
+
+	@JsonSerialize(include = Inclusion.NON_NULL)
+	public User getUser() {
+		return user;
+	}
+
+	public void setUser(User user) {
+		this.user = user;
+	}
+
+	@Override
+	public String toString() {
+		return toJsonString(this);
+	}
+
+	@JsonSerialize(include = Inclusion.NON_NULL)
+	public List<Message> getMessages() {
+		return messages;
+	}
+
+	public void setMessages(List<Message> messages) {
+		this.messages = messages;
+	}
+
+	@JsonIgnore
+	public int getMessageCount() {
+		if (messages == null) {
+			return 0;
+		}
+		return messages.size();
+	}
+
+	@JsonIgnore
+	public Message getFirstMessage() {
+		if ((messages != null) && (messages.size() > 0)) {
+			return messages.get(0);
+		}
+		return null;
+	}
+
+	@JsonIgnore
+	public Entity getLastMessage() {
+		if ((messages != null) && (messages.size() > 0)) {
+			return messages.get(messages.size() - 1);
+		}
+		return null;
+	}
+
+	@JsonSerialize(include = Inclusion.NON_NULL)
+	public UUID getLast() {
+		return last;
+	}
+
+	public void setLast(UUID last) {
+		this.last = last;
+	}
+
+	@JsonSerialize(include = Inclusion.NON_NULL)
+	public List<QueueInfo> getQueues() {
+		return queues;
+	}
+
+	public void setQueues(List<QueueInfo> queues) {
+		this.queues = queues;
+	}
+
+	@JsonIgnore
+	public QueueInfo getFirstQueue() {
+		if ((queues != null) && (queues.size() > 0)) {
+			return queues.get(0);
+		}
+		return null;
+	}
+
+	@JsonIgnore
+	public QueueInfo getLastQueue() {
+		if ((queues != null) && (queues.size() > 0)) {
+			return queues.get(queues.size() - 1);
+		}
+		return null;
+	}
+
+	@JsonIgnore
+	public UUID getLastQueueId() {
+		QueueInfo q = getLastQueue();
+		if (q != null) {
+			return q.getQueue();
+		}
+		return null;
+	}
+
+	@JsonSerialize(include = Inclusion.NON_NULL)
+	public UUID getQueue() {
+		return queue;
+	}
+
+	public void setQueue(UUID queue) {
+		this.queue = queue;
+	}
+
+	@JsonSerialize(include = Inclusion.NON_NULL)
+	public UUID getConsumer() {
+		return consumer;
+	}
+
+	public void setConsumer(UUID consumer) {
+		this.consumer = consumer;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/c08a2791/sdks/usergrid-java-sdk-0.0.6/src/main/java/org/usergrid/java/client/response/ClientCredentialsInfo.java
----------------------------------------------------------------------
diff --git a/sdks/usergrid-java-sdk-0.0.6/src/main/java/org/usergrid/java/client/response/ClientCredentialsInfo.java b/sdks/usergrid-java-sdk-0.0.6/src/main/java/org/usergrid/java/client/response/ClientCredentialsInfo.java
new file mode 100644
index 0000000..475f653
--- /dev/null
+++ b/sdks/usergrid-java-sdk-0.0.6/src/main/java/org/usergrid/java/client/response/ClientCredentialsInfo.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 org.usergrid.java.client.response;
+
+import static org.usergrid.java.client.utils.JsonUtils.toJsonString;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class ClientCredentialsInfo {
+
+	private String id;
+	private String secret;
+
+	public ClientCredentialsInfo(String id, String secret) {
+		this.id = id;
+		this.secret = secret;
+	}
+
+	@JsonProperty("client_id")
+	public String getId() {
+		return id;
+	}
+
+	@JsonProperty("client_id")
+	public void setId(String id) {
+		this.id = id;
+	}
+
+	@JsonProperty("client_secret")
+	public String getSecret() {
+		return secret;
+	}
+
+	@JsonProperty("client_secret")
+	public void setSecret(String secret) {
+		this.secret = secret;
+	}
+
+	@Override
+	public String toString() {
+		return toJsonString(this);
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/c08a2791/sdks/usergrid-java-sdk-0.0.6/src/main/java/org/usergrid/java/client/response/QueueInfo.java
----------------------------------------------------------------------
diff --git a/sdks/usergrid-java-sdk-0.0.6/src/main/java/org/usergrid/java/client/response/QueueInfo.java b/sdks/usergrid-java-sdk-0.0.6/src/main/java/org/usergrid/java/client/response/QueueInfo.java
new file mode 100644
index 0000000..572cff9
--- /dev/null
+++ b/sdks/usergrid-java-sdk-0.0.6/src/main/java/org/usergrid/java/client/response/QueueInfo.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 org.usergrid.java.client.response;
+
+import java.util.UUID;
+
+public class QueueInfo {
+
+	String path;
+	UUID queue;
+
+	public QueueInfo() {
+	}
+
+	public String getPath() {
+		return path;
+	}
+
+	public void setPath(String path) {
+		this.path = path;
+	}
+
+	public UUID getQueue() {
+		return queue;
+	}
+
+	public void setQueue(UUID queue) {
+		this.queue = queue;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/c08a2791/sdks/usergrid-java-sdk-0.0.6/src/main/java/org/usergrid/java/client/utils/JsonUtils.java
----------------------------------------------------------------------
diff --git a/sdks/usergrid-java-sdk-0.0.6/src/main/java/org/usergrid/java/client/utils/JsonUtils.java b/sdks/usergrid-java-sdk-0.0.6/src/main/java/org/usergrid/java/client/utils/JsonUtils.java
new file mode 100644
index 0000000..dc14251
--- /dev/null
+++ b/sdks/usergrid-java-sdk-0.0.6/src/main/java/org/usergrid/java/client/utils/JsonUtils.java
@@ -0,0 +1,182 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 org.usergrid.java.client.utils;
+
+import java.io.IOException;
+import java.util.Map;
+import java.util.UUID;
+
+import com.fasterxml.jackson.core.JsonGenerationException;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.JsonNodeFactory;
+import org.usergrid.java.client.exception.ClientException;
+
+public class JsonUtils {
+
+
+	static ObjectMapper mapper = new ObjectMapper();
+
+	public static String getStringProperty(Map<String, JsonNode> properties,
+			String name) {
+		JsonNode value = properties.get(name);
+		if (value != null) {
+			return value.asText();
+		}
+		return null;
+	}
+
+	public static void setStringProperty(Map<String, JsonNode> properties,
+			String name, String value) {
+		if (value == null) {
+			properties.remove(name);
+		} else {
+			properties.put(name, JsonNodeFactory.instance.textNode(value));
+		}
+	}
+
+	public static Long getLongProperty(Map<String, JsonNode> properties,
+			String name) {
+		JsonNode value = properties.get(name);
+		if (value != null) {
+			return value.asLong(0);
+		}
+		return null;
+	}
+
+	public static void setLongProperty(Map<String, JsonNode> properties,
+			String name, Long value) {
+		if (value == null) {
+			properties.remove(name);
+		} else {
+			properties.put(name, JsonNodeFactory.instance.numberNode(value));
+		}
+	}
+
+	public static void setFloatProperty(Map<String, JsonNode> properties, String name, Float value){
+	    if(value == null){
+	        properties.remove(name);
+	    }else{
+	        properties.put(name, JsonNodeFactory.instance.numberNode(value));
+	    }
+	}
+	
+	public static Boolean getBooleanProperty(Map<String, JsonNode> properties,
+			String name) {
+		JsonNode value = properties.get(name);
+		if (value != null) {
+			return value.asBoolean();
+		}
+		return false;
+	}
+
+	public static void setBooleanProperty(Map<String, JsonNode> properties,
+			String name, Boolean value) {
+		if (value == null) {
+			properties.remove(name);
+		} else {
+			properties.put(name, JsonNodeFactory.instance.booleanNode(value));
+		}
+	}
+
+	public static UUID getUUIDProperty(Map<String, JsonNode> properties,
+			String name) {
+		JsonNode value = properties.get(name);
+		if (value != null) {
+			UUID uuid = null;
+			try {
+				uuid = UUID.fromString(value.asText());
+			} catch (Exception e) {
+			}
+			return uuid;
+		}
+		return null;
+	}
+
+	public static void setUUIDProperty(Map<String, JsonNode> properties,
+			String name, UUID value) {
+		if (value == null) {
+			properties.remove(name);
+		} else {
+			properties.put(name,
+					JsonNodeFactory.instance.textNode(value.toString()));
+		}
+	}
+
+	public static String toJsonString(Object obj) {
+		try {
+			return mapper.writeValueAsString(obj);
+		} catch (JsonGenerationException e) {
+			throw new ClientException("Unable to generate json", e);
+		} catch (JsonMappingException e) {
+		    throw new ClientException("Unable to map json", e);
+		} catch (IOException e) {
+		    throw new ClientException("IO error", e);
+		}
+	}
+
+	public static <T> T parse(String json, Class<T> c) {
+		try {
+			return mapper.readValue(json, c);
+		} catch (JsonGenerationException e) {
+            throw new ClientException("Unable to generate json", e);
+        } catch (JsonMappingException e) {
+            throw new ClientException("Unable to map json", e);
+        } catch (IOException e) {
+            throw new ClientException("IO error", e);
+        }
+	}
+
+	public static JsonNode toJsonNode(Object obj) {
+		return mapper.convertValue(obj, JsonNode.class);
+	}
+
+	public static <T> T fromJsonNode(JsonNode json, Class<T> c) {
+		try {
+			JsonParser jp = json.traverse();
+			return mapper.readValue(jp, c);
+		} catch (JsonGenerationException e) {
+            throw new ClientException("Unable to generate json", e);
+        } catch (JsonMappingException e) {
+            throw new ClientException("Unable to map json", e);
+        } catch (IOException e) {
+            throw new ClientException("IO error", e);
+        }
+	}
+
+	public static <T> T getObjectProperty(Map<String, JsonNode> properties,
+			String name, Class<T> c) {
+		JsonNode value = properties.get(name);
+		if (value != null) {
+			return fromJsonNode(value, c);
+		}
+		return null;
+	}
+
+	public static void setObjectProperty(Map<String, JsonNode> properties,
+			String name, Object value) {
+		if (value == null) {
+			properties.remove(name);
+		} else {
+			properties.put(name,
+					JsonNodeFactory.instance.textNode(value.toString()));
+		}
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/c08a2791/sdks/usergrid-java-sdk-0.0.6/src/main/java/org/usergrid/java/client/utils/MapUtils.java
----------------------------------------------------------------------
diff --git a/sdks/usergrid-java-sdk-0.0.6/src/main/java/org/usergrid/java/client/utils/MapUtils.java b/sdks/usergrid-java-sdk-0.0.6/src/main/java/org/usergrid/java/client/utils/MapUtils.java
new file mode 100644
index 0000000..3b647e5
--- /dev/null
+++ b/sdks/usergrid-java-sdk-0.0.6/src/main/java/org/usergrid/java/client/utils/MapUtils.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 org.usergrid.java.client.utils;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class MapUtils {
+
+	public static <T> Map<String, T> newMapWithoutKeys(Map<String, T> map,
+			List<String> keys) {
+		Map<String, T> newMap = null;
+		if (map != null) {
+			newMap = new HashMap<String, T>(map);
+		} else {
+			newMap = new HashMap<String, T>();
+		}
+		for (String key : keys) {
+			newMap.remove(key);
+		}
+		return newMap;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/c08a2791/sdks/usergrid-java-sdk-0.0.6/src/main/java/org/usergrid/java/client/utils/ObjectUtils.java
----------------------------------------------------------------------
diff --git a/sdks/usergrid-java-sdk-0.0.6/src/main/java/org/usergrid/java/client/utils/ObjectUtils.java b/sdks/usergrid-java-sdk-0.0.6/src/main/java/org/usergrid/java/client/utils/ObjectUtils.java
new file mode 100644
index 0000000..e011f8c
--- /dev/null
+++ b/sdks/usergrid-java-sdk-0.0.6/src/main/java/org/usergrid/java/client/utils/ObjectUtils.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 org.usergrid.java.client.utils;
+
+import java.util.Map;
+
+public class ObjectUtils {
+
+	public static boolean isEmpty(Object s) {
+		if (s == null) {
+			return true;
+		}
+		if ((s instanceof String) && (((String) s).trim().length() == 0)) {
+			return true;
+		}
+		if (s instanceof Map) {
+			return ((Map<?, ?>) s).isEmpty();
+		}
+		return false;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/c08a2791/sdks/usergrid-java-sdk-0.0.6/src/main/java/org/usergrid/java/client/utils/UrlUtils.java
----------------------------------------------------------------------
diff --git a/sdks/usergrid-java-sdk-0.0.6/src/main/java/org/usergrid/java/client/utils/UrlUtils.java b/sdks/usergrid-java-sdk-0.0.6/src/main/java/org/usergrid/java/client/utils/UrlUtils.java
new file mode 100644
index 0000000..0b2fd62
--- /dev/null
+++ b/sdks/usergrid-java-sdk-0.0.6/src/main/java/org/usergrid/java/client/utils/UrlUtils.java
@@ -0,0 +1,124 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 org.usergrid.java.client.utils;
+
+import static java.net.URLEncoder.encode;
+import static org.usergrid.java.client.utils.ObjectUtils.isEmpty;
+
+import java.io.UnsupportedEncodingException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.usergrid.java.client.exception.ClientException;
+
+public class UrlUtils {
+
+   
+    public static URL url(String s) {
+        try {
+            return new URL(s);
+        } catch (MalformedURLException e) {
+            throw new ClientException("Incorrect URL format", e);
+        }
+    }
+
+    public static URL url(URL u, String s) {
+        try {
+            return new URL(u, s);
+        } catch (MalformedURLException e) {
+            throw new ClientException("Incorrect URL format", e);
+        }
+    }
+
+    public static String path(Object... segments) {
+        String path = "";
+        boolean first = true;
+        for (Object segment : segments) {
+            if (segment instanceof Object[]) {
+                segment = path((Object[]) segment);
+            }
+            if (!isEmpty(segment)) {
+                if (first) {
+                    path = segment.toString();
+                    first = false;
+                } else {
+                    if (!path.endsWith("/")) {
+                        path += "/";
+                    }
+                    path += segment.toString();
+                }
+            }
+        }
+        return path;
+    }
+
+    @SuppressWarnings("rawtypes")
+    public static String encodeParams(Map<String, Object> params) {
+        if (params == null) {
+            return "";
+        }
+        boolean first = true;
+        StringBuilder results = new StringBuilder();
+        for (Entry<String, Object> entry : params.entrySet()) {
+            if (entry.getValue() instanceof List) {
+                for (Object o : (List) entry.getValue()) {
+                    if (!isEmpty(o)) {
+                        if (!first) {
+                            results.append('&');
+                        }
+                        first = false;
+                        results.append(entry.getKey());
+                        results.append("=");
+                        try {
+                            results.append(encode(o.toString(), "UTF-8"));
+                        } catch (UnsupportedEncodingException e) {
+                            throw new ClientException("Unknown encoding", e);
+                        }
+                    }
+                }
+            } else if (!isEmpty(entry.getValue())) {
+                if (!first) {
+                    results.append('&');
+                }
+                first = false;
+                results.append(entry.getKey());
+                results.append("=");
+                try {
+                    results.append(encode(entry.getValue().toString(), "UTF-8"));
+                } catch (UnsupportedEncodingException e) {
+                    throw new ClientException("Unsupported string encoding", e);
+                }
+            }
+        }
+        return results.toString();
+    }
+
+    public static String addQueryParams(String url, Map<String, Object> params) {
+        if (params == null) {
+            return url;
+        }
+        if (!url.contains("?")) {
+            url += "?";
+        }
+        url += encodeParams(params);
+        return url;
+    }
+
+}