refs #166: Create accouting-analytics library
https://support.d4science.org/issues/166 Implementing Library git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/accounting-analytics@117239 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
bd9e7b0665
commit
158914c5b4
10
.classpath
10
.classpath
|
@ -22,5 +22,15 @@
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
|
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
<classpathentry kind="output" path="target/classes"/>
|
<classpathentry kind="output" path="target/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
11
pom.xml
11
pom.xml
|
@ -42,11 +42,22 @@
|
||||||
<artifactId>accounting-lib</artifactId>
|
<artifactId>accounting-lib</artifactId>
|
||||||
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.resources.discovery</groupId>
|
||||||
|
<artifactId>ic-client</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.reflections</groupId>
|
<groupId>org.reflections</groupId>
|
||||||
<artifactId>reflections</artifactId>
|
<artifactId>reflections</artifactId>
|
||||||
<version>LATEST</version>
|
<version>LATEST</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.json</groupId>
|
||||||
|
<artifactId>json</artifactId>
|
||||||
|
<version>20090211</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
|
|
|
@ -3,21 +3,62 @@
|
||||||
*/
|
*/
|
||||||
package org.gcube.accounting.analytics;
|
package org.gcube.accounting.analytics;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Calendar;
|
||||||
|
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
|
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface Info {
|
public class Info {
|
||||||
|
|
||||||
public long getDate();
|
protected Calendar date;
|
||||||
|
protected JSONObject value;
|
||||||
|
|
||||||
public Number getInfo();
|
/**
|
||||||
|
* @param calendar
|
||||||
/*
|
* @param value
|
||||||
public String getUnity(); // Number of Occurrences, Kb,
|
*/
|
||||||
|
public Info(Calendar date, JSONObject value) {
|
||||||
public String getUnityDescription(); // Total Kb accumulated, Single Operation Kb
|
super();
|
||||||
*/
|
this.date = date;
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the calendar
|
||||||
|
*/
|
||||||
|
public Calendar getDate() {
|
||||||
|
return date;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param calendar the calendar to set
|
||||||
|
*/
|
||||||
|
public void setDate(Calendar calendar) {
|
||||||
|
this.date = calendar;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the value
|
||||||
|
*/
|
||||||
|
public JSONObject getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param value the value to set
|
||||||
|
*/
|
||||||
|
public void setValue(JSONObject value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString(){
|
||||||
|
SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SS z");
|
||||||
|
return String.format("Date : %s, Value : %s", dateFormatter.format(date.getTime()), value.toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ package org.gcube.accounting.analytics;
|
||||||
public class TemporalConstraint {
|
public class TemporalConstraint {
|
||||||
|
|
||||||
public enum AggregationMode {
|
public enum AggregationMode {
|
||||||
HOURLY, DAILY, WEEKLY, MONTHLY, YEARLY
|
YEARLY, MONTHLY, DAILY, HOURLY, MINUTELY, SECONDLY, MILLISECONDLY
|
||||||
}
|
}
|
||||||
|
|
||||||
protected long startTime;
|
protected long startTime;
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package org.gcube.accounting.analytics.persistence;
|
package org.gcube.accounting.analytics.persistence;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
|
||||||
import org.gcube.accounting.persistence.AccountingPersistenceConfiguration;
|
import org.gcube.accounting.persistence.AccountingPersistenceConfiguration;
|
||||||
|
import org.gcube.common.resources.gcore.ServiceEndpoint;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
|
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
|
||||||
|
@ -13,8 +11,6 @@ import org.gcube.accounting.persistence.AccountingPersistenceConfiguration;
|
||||||
*/
|
*/
|
||||||
public class AccountingPersistenceQueryConfiguration extends AccountingPersistenceConfiguration {
|
public class AccountingPersistenceQueryConfiguration extends AccountingPersistenceConfiguration {
|
||||||
|
|
||||||
protected final String SERVICE_ENDPOINT_NAME = "PersistenceQuery";
|
|
||||||
|
|
||||||
public AccountingPersistenceQueryConfiguration(){
|
public AccountingPersistenceQueryConfiguration(){
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
@ -24,6 +20,8 @@ public class AccountingPersistenceQueryConfiguration extends AccountingPersisten
|
||||||
}
|
}
|
||||||
|
|
||||||
public AccountingPersistenceQueryConfiguration(String persistenceClassName) throws Exception{
|
public AccountingPersistenceQueryConfiguration(String persistenceClassName) throws Exception{
|
||||||
super(persistenceClassName);
|
super.init();
|
||||||
|
ServiceEndpoint serviceEndpoint = getServiceEndpoint(SERVICE_ENDPOINT_CATEGORY, SERVICE_ENDPOINT_NAME, persistenceClassName);
|
||||||
|
setValues(serviceEndpoint, persistenceClassName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue