diff --git a/src/main/java/org/gcube/accounting/analytics/Info.java b/src/main/java/org/gcube/accounting/analytics/Info.java
index 5f28f85..eaf5241 100644
--- a/src/main/java/org/gcube/accounting/analytics/Info.java
+++ b/src/main/java/org/gcube/accounting/analytics/Info.java
@@ -19,7 +19,7 @@ public class Info {
protected JSONObject value;
/**
- * @param date the date
+ * @param calendar the date
* @param value the JSON value
*/
public Info(Calendar calendar, JSONObject value) {
@@ -36,7 +36,7 @@ public class Info {
}
/**
- * @param date the date to set
+ * @param calendar the date to set
*/
public void setCalendar(Calendar calendar) {
this.calendar = calendar;
diff --git a/src/main/java/org/gcube/accounting/analytics/exception/NoAvailableScopeException.java b/src/main/java/org/gcube/accounting/analytics/exception/NoAvailableScopeException.java
index 11780c4..bf58ff1 100644
--- a/src/main/java/org/gcube/accounting/analytics/exception/NoAvailableScopeException.java
+++ b/src/main/java/org/gcube/accounting/analytics/exception/NoAvailableScopeException.java
@@ -14,7 +14,11 @@ public class NoAvailableScopeException extends Exception {
*/
private static final long serialVersionUID = -327144230654860518L;
-
+ /**
+ * Constructs a new exception with {@code null} as its detail message.
+ * The cause is not initialized, and may subsequently be initialized by a
+ * call to {@link #initCause}.
+ */
public NoAvailableScopeException() {
super();
}
@@ -30,10 +34,36 @@ public class NoAvailableScopeException extends Exception {
super(message);
}
+ /**
+ * Constructs a new exception with the specified cause and a detail
+ * message of (cause==null ? null : cause.toString()) (which
+ * typically contains the class and detail message of cause).
+ * This constructor is useful for exceptions that are little more than
+ * wrappers for other throwables (for example, {@link
+ * java.security.PrivilegedActionException}).
+ *
+ * @param cause the cause (which is saved for later retrieval by the
+ * {@link #getCause()} method). (A null value is
+ * permitted, and indicates that the cause is nonexistent or
+ * unknown.)
+ */
public NoAvailableScopeException(Throwable cause) {
super(cause);
}
+ /**
+ * Constructs a new exception with the specified detail message and
+ * cause. Note that the detail message associated with
+ * {@code cause} is not automatically incorporated in
+ * this exception's detail message.
+ *
+ * @param message the detail message (which is saved for later retrieval
+ * by the {@link #getMessage()} method).
+ * @param cause the cause (which is saved for later retrieval by the
+ * {@link #getCause()} method). (A null value is
+ * permitted, and indicates that the cause is nonexistent or
+ * unknown.)
+ */
public NoAvailableScopeException(String message, Throwable cause) {
super(message, cause);
}
diff --git a/src/main/java/org/gcube/accounting/analytics/exception/NoUsableAccountingPersistenceQueryFound.java b/src/main/java/org/gcube/accounting/analytics/exception/NoUsableAccountingPersistenceQueryFound.java
index 1a37fb6..5381cab 100644
--- a/src/main/java/org/gcube/accounting/analytics/exception/NoUsableAccountingPersistenceQueryFound.java
+++ b/src/main/java/org/gcube/accounting/analytics/exception/NoUsableAccountingPersistenceQueryFound.java
@@ -14,18 +14,57 @@ public class NoUsableAccountingPersistenceQueryFound extends Exception {
*/
private static final long serialVersionUID = -327144230654860518L;
+ /**
+ * Constructs a new exception with {@code null} as its detail message.
+ * The cause is not initialized, and may subsequently be initialized by a
+ * call to {@link #initCause}.
+ */
public NoUsableAccountingPersistenceQueryFound() {
super();
}
+ /**
+ * Constructs a new exception with the specified detail message. The
+ * cause is not initialized, and may subsequently be initialized by
+ * a call to {@link #initCause}.
+ *
+ * @param message the detail message. The detail message is saved for
+ * later retrieval by the {@link #getMessage()} method.
+ */
public NoUsableAccountingPersistenceQueryFound(String message) {
super(message);
}
+ /**
+ * Constructs a new exception with the specified cause and a detail
+ * message of (cause==null ? null : cause.toString()) (which
+ * typically contains the class and detail message of cause).
+ * This constructor is useful for exceptions that are little more than
+ * wrappers for other throwables (for example, {@link
+ * java.security.PrivilegedActionException}).
+ *
+ * @param cause the cause (which is saved for later retrieval by the
+ * {@link #getCause()} method). (A null value is
+ * permitted, and indicates that the cause is nonexistent or
+ * unknown.)
+ */
public NoUsableAccountingPersistenceQueryFound(Throwable cause) {
super(cause);
}
+ /**
+ * Constructs a new exception with the specified detail message and
+ * cause.
Note that the detail message associated with
+ * {@code cause} is not automatically incorporated in
+ * this exception's detail message.
+ *
+ * @param message the detail message (which is saved for later retrieval
+ * by the {@link #getMessage()} method).
+ * @param cause the cause (which is saved for later retrieval by the
+ * {@link #getCause()} method). (A null value is
+ * permitted, and indicates that the cause is nonexistent or
+ * unknown.)
+ */
public NoUsableAccountingPersistenceQueryFound(String message, Throwable cause) {
super(message, cause);
}
diff --git a/src/main/java/org/gcube/accounting/analytics/persistence/AccountingPersistenceQuery.java b/src/main/java/org/gcube/accounting/analytics/persistence/AccountingPersistenceQuery.java
index 42c6484..08cd31f 100644
--- a/src/main/java/org/gcube/accounting/analytics/persistence/AccountingPersistenceQuery.java
+++ b/src/main/java/org/gcube/accounting/analytics/persistence/AccountingPersistenceQuery.java
@@ -57,5 +57,9 @@ public abstract class AccountingPersistenceQuery {
*/
public abstract Set getKeys(@SuppressWarnings("rawtypes") Class extends AggregatedUsageRecord> usageRecordType) throws Exception;
+ /**
+ * Close the connection to persistence
+ * @throws Exception if the close fails
+ */
public abstract void close() throws Exception;
}
diff --git a/src/main/java/org/gcube/accounting/analytics/persistence/AccountingPersistenceQueryConfiguration.java b/src/main/java/org/gcube/accounting/analytics/persistence/AccountingPersistenceQueryConfiguration.java
index ccb6489..5cc05ad 100644
--- a/src/main/java/org/gcube/accounting/analytics/persistence/AccountingPersistenceQueryConfiguration.java
+++ b/src/main/java/org/gcube/accounting/analytics/persistence/AccountingPersistenceQueryConfiguration.java
@@ -11,14 +11,26 @@ import org.gcube.common.resources.gcore.ServiceEndpoint;
*/
public class AccountingPersistenceQueryConfiguration extends AccountingPersistenceConfiguration {
+ /**
+ * Default Constructor
+ */
public AccountingPersistenceQueryConfiguration(){
super();
}
+ /**
+ * @param uri the URI of the persistence
+ * @param username the username to connect to persistence
+ * @param password the password to connect to persistence
+ */
public AccountingPersistenceQueryConfiguration(URI uri, String username, String password){
super(uri, username, password);
}
+ /**
+ * @param persistenceClassName The classname of the persistence to instantiate
+ * @throws Exception if fails
+ */
public AccountingPersistenceQueryConfiguration(String persistenceClassName) throws Exception{
super.init();
ServiceEndpoint serviceEndpoint = getServiceEndpoint(SERVICE_ENDPOINT_CATEGORY, SERVICE_ENDPOINT_NAME, persistenceClassName);
diff --git a/src/main/java/org/gcube/accounting/analytics/persistence/AccountingPersistenceQueryFactory.java b/src/main/java/org/gcube/accounting/analytics/persistence/AccountingPersistenceQueryFactory.java
index 8508f2e..1f7301f 100644
--- a/src/main/java/org/gcube/accounting/analytics/persistence/AccountingPersistenceQueryFactory.java
+++ b/src/main/java/org/gcube/accounting/analytics/persistence/AccountingPersistenceQueryFactory.java
@@ -26,10 +26,17 @@ public abstract class AccountingPersistenceQueryFactory {
accountingPersistenceQueries = new HashMap();
}
+ /**
+ * @return AccountingPersistenceQuery instance
+ * @throws NoAvailableScopeException if no configuration is found on IS for
+ * the current scope
+ * @throws NoUsableAccountingPersistenceQueryFound if fails to instantiate
+ * the #AccountingPersistenceQuery
+ */
public synchronized static AccountingPersistenceQuery getInstance() throws NoAvailableScopeException, NoUsableAccountingPersistenceQueryFound {
String scope = ScopeProvider.instance.get();
if(scope==null){
- new NoAvailableScopeException();
+ throw new NoAvailableScopeException();
}
AccountingPersistenceQuery accountingPersistenceQuery = accountingPersistenceQueries.get(scope);