Applied patch for NUVEM-19.
git-svn-id: https://svn.apache.org/repos/asf/incubator/nuvem/trunk@1324604 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/nuvem-api/src/main/java/org/apache/nuvem/cloud/data/NotFoundException.java b/nuvem-api/src/main/java/org/apache/nuvem/cloud/data/NotFoundException.java
index 1fa2093..283453e 100644
--- a/nuvem-api/src/main/java/org/apache/nuvem/cloud/data/NotFoundException.java
+++ b/nuvem-api/src/main/java/org/apache/nuvem/cloud/data/NotFoundException.java
@@ -19,20 +19,42 @@
package org.apache.nuvem.cloud.data;
+/**
+ * The Class NotFoundException.
+ */
public class NotFoundException extends Exception {
private static final long serialVersionUID = 6792367409396084646L;
+ /**
+ * Instantiates a new Not Found Exception.
+ */
public NotFoundException() {
}
+ /**
+ * Instantiates a new Not Found Exception.
+ *
+ * @param message the message
+ */
public NotFoundException(String message) {
super(message);
}
+ /**
+ * Instantiates a new Not Found Exception.
+ *
+ * @param cause the cause
+ */
public NotFoundException(Throwable cause) {
super(cause);
}
+ /**
+ * Instantiates a new Not Found Exception.
+ *
+ * @param message the message
+ * @param cause the cause
+ */
public NotFoundException(String message, Throwable cause) {
super(message, cause);
}
diff --git a/nuvem-api/src/main/java/org/apache/nuvem/cloud/dataService/DataServiceUtil.java b/nuvem-api/src/main/java/org/apache/nuvem/cloud/dataService/DataServiceUtil.java
index 3f56b4d..dcdc0d2 100644
--- a/nuvem-api/src/main/java/org/apache/nuvem/cloud/dataService/DataServiceUtil.java
+++ b/nuvem-api/src/main/java/org/apache/nuvem/cloud/dataService/DataServiceUtil.java
@@ -20,10 +20,23 @@
public class DataServiceUtil {
+ /**
+ * Create the key.
+ *
+ * @param kind the kind
+ * @param id the id
+ * @return the created key
+ */
public static String createKey(String kind, String id) {
return kind.concat("(").concat(id).concat(")");
}
+ /**
+ * Get the kind.
+ *
+ * @param key the key
+ * @return the kind
+ */
public static String getKind(String key) {
if (key != null) {
return key.substring(0, key.indexOf("("));
@@ -31,6 +44,12 @@
return null;
}
+ /**
+ * Get the id.
+ *
+ * @param keythe key
+ * @return the id.
+ */
public static String getId(String key) {
if (key != null) {
return key.substring(key.indexOf("(") + 1, key.indexOf(")"));
diff --git a/nuvem-api/src/main/java/org/apache/nuvem/cloud/user/User.java b/nuvem-api/src/main/java/org/apache/nuvem/cloud/user/User.java
index 187a5f3..6e2322f 100644
--- a/nuvem-api/src/main/java/org/apache/nuvem/cloud/user/User.java
+++ b/nuvem-api/src/main/java/org/apache/nuvem/cloud/user/User.java
@@ -21,6 +21,9 @@
import java.io.Serializable;
+/**
+ * The Class User.
+ */
public class User implements Serializable {
private static final long serialVersionUID = -503746790472903416L;
@@ -35,24 +38,49 @@
/** Represents a dummy user for usage instead of nulls **/
public static final User DUMMY_USER = new User("dummyid", "dummy name", "dummy@email.com");
+ /**
+ * Constructs a new User.
+ */
public User() {
}
+ /**
+ * Constructs a new User.
+ *
+ * @param userId the userId
+ * @param nickeName the nickeName
+ * @param email the email
+ */
public User(String userId, String nickName, String email) {
this.userId = userId;
this.nickName = nickName;
this.email = email;
}
+ /**
+ * Returns the user id of the User.
+ *
+ * @return the user id
+ */
public String getUserId() {
return this.userId;
}
+ /**
+ * Returns the nick name of the User.
+ *
+ * @return the nick name.
+ */
public String getNickname() {
return this.nickName;
}
+ /**
+ * Returns the email of the User.
+ *
+ * @return the email.
+ */
public String getEmail() {
return this.email;
}
@@ -60,6 +88,9 @@
/**
* Checks only for the user ID as it is supposed to be a unique identifier
* for the user.
+ *
+ * @param o the o
+ * @return true, if successful
*/
@Override
public boolean equals(Object o) {
@@ -76,6 +107,8 @@
/**
* Considers only the hashcode of the userid as userid is the unique id of
* the user.
+ *
+ * @return the hashcode of the user id.
*/
@Override
public int hashCode() {
diff --git a/nuvem-api/src/main/java/org/apache/nuvem/cloud/user/UserContext.java b/nuvem-api/src/main/java/org/apache/nuvem/cloud/user/UserContext.java
index 41a8529..a8c11c7 100644
--- a/nuvem-api/src/main/java/org/apache/nuvem/cloud/user/UserContext.java
+++ b/nuvem-api/src/main/java/org/apache/nuvem/cloud/user/UserContext.java
@@ -19,6 +19,9 @@
package org.apache.nuvem.cloud.user;
+/**
+ * The Class UserContex.
+ */
public class UserContext extends User {
private static final long serialVersionUID = 1339319191804052423L;
@@ -26,10 +29,23 @@
protected String logoutUrl;
protected boolean isUserLoggedIn;
+ /**
+ * Constructs a new User Context.
+ */
public UserContext() {
super();
}
+ /**
+ * Constructs a new User Context.
+ *
+ * @param userId the userId
+ * @param nickName the nickName
+ * @param email the email
+ * @param isUserLoggedIn the isUserLoggedIn
+ * @param loginUrl the loginUrl
+ * @param logoutUrl the logoutUrl
+ */
public UserContext(String userId,
String nickName,
String email,
@@ -42,6 +58,14 @@
this.logoutUrl = logoutUrl;
}
+ /**
+ * Constructs a new User Context.
+ *
+ * @param user the user
+ * @param isUserLoggedIn the isUserLoggedIn
+ * @param loginUrl the loginUrl
+ * @param logoutUrl the logoutUrl
+ */
public UserContext(User user, boolean isUserLoggedIn, String loginUrl, String logoutUrl) {
super(user.getUserId(), user.getNickname(), user.getEmail());
this.isUserLoggedIn = isUserLoggedIn;
@@ -49,14 +73,29 @@
this.logoutUrl = logoutUrl;
}
+ /**
+ * Return the isUserLoggedIn.
+ *
+ * @return the isUserLoggedIn
+ */
public boolean isUserLoggedIn() {
return this.isUserLoggedIn;
}
+ /**
+ * Return the getLoginUrl.
+ *
+ * @return the loginUrl
+ */
public String getLoginUrl() {
return this.loginUrl;
}
+ /**
+ * Return the logoutUrl.
+ *
+ * @return the logoutUrl
+ */
public String getLogoutUrl() {
return this.logoutUrl;
}
diff --git a/nuvem-api/src/main/java/org/apache/nuvem/cloud/user/UserService.java b/nuvem-api/src/main/java/org/apache/nuvem/cloud/user/UserService.java
index 25d9ca1..fdce87a 100644
--- a/nuvem-api/src/main/java/org/apache/nuvem/cloud/user/UserService.java
+++ b/nuvem-api/src/main/java/org/apache/nuvem/cloud/user/UserService.java
@@ -21,19 +21,62 @@
import org.oasisopen.sca.annotation.Remotable;
+/**
+ * The Interface UserService defines services provide by Nuvem key-value
+ * data-store component also act as abreaction layer for cloud platform specific
+ * data services. Element is the basic persistent unit and may contains number
+ * of Features that associate with the Element. DataService interface facilitate
+ * to create, update , read and delete Elements.
+ */
@Remotable
public interface UserService {
+ /**
+ * Get the current User.
+ *
+ * @return the User
+ */
public User getCurrentUser();
+ /**
+ * Check if the User is Admin.
+ *
+ * @return the boolean
+ */
public boolean isUserAdmin();
+ /**
+ * Check if the User is Loggein.
+ *
+ * @return the boolean
+ */
public boolean isUserLoggedIn();
+ /**
+ * Get the User Context.
+ *
+ * @param destinationURL the destinationURL
+ * @param authDomain the authDomain
+ * @return the UserContext
+ */
public UserContext getUserContext(String destinationURL, String authDomain);
+ /**
+ * Create a Login URL.
+ *
+ * @param destinationURL the destinationURL
+ * @param authDomain the authDomain
+ * @return the Create Login URL
+ */
public String createLoginURL(String destinationURL, String authDomain);
+ /**
+ * Create a Logout URL.
+ *
+ * @param destinationURL the destinationURL
+ * @param authDomain the authDomain
+ * @return the Create Logout URL
+ */
public String createLogoutURL(String destinationURL, String authDomain);
}