Created fake accounting-lib
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/private/luca.frosini/fake-accounting-lib@160561 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
commit
729dfde0b7
|
@ -0,0 +1,36 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/classes" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</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"/>
|
||||
</classpath>
|
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>accounting-lib-trunk_ultimo</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -0,0 +1,4 @@
|
|||
gCube System - License
|
||||
------------------------------------------------------------
|
||||
|
||||
${gcube.license}
|
|
@ -0,0 +1,67 @@
|
|||
The gCube System - ${name}
|
||||
--------------------------------------------------
|
||||
|
||||
${description}
|
||||
|
||||
|
||||
${gcube.description}
|
||||
|
||||
${gcube.funding}
|
||||
|
||||
|
||||
Version
|
||||
--------------------------------------------------
|
||||
|
||||
${version} (${buildDate})
|
||||
|
||||
Please see the file named "changelog.xml" in this directory for the release notes.
|
||||
|
||||
|
||||
Authors
|
||||
--------------------------------------------------
|
||||
|
||||
* Luca Frosini (luca.frosini-AT-isti.cnr.it), Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo" - CNR, Pisa (Italy).
|
||||
* Alessandro Pieve (alessandro.pieve-AT-isti.cnr.it), Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo" - CNR, Pisa (Italy).
|
||||
|
||||
|
||||
Maintainers
|
||||
-----------
|
||||
|
||||
* Luca Frosini (luca.frosini-AT-isti.cnr.it), Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo" - CNR, Pisa (Italy).
|
||||
|
||||
|
||||
Download information
|
||||
--------------------------------------------------
|
||||
|
||||
Source code is available from SVN:
|
||||
${scm.url}
|
||||
|
||||
Binaries can be downloaded from the gCube website:
|
||||
${gcube.website}
|
||||
|
||||
|
||||
Installation
|
||||
--------------------------------------------------
|
||||
|
||||
Installation documentation is available on-line in the gCube Wiki:
|
||||
${gcube.wikiRoot}/Accounting_Lib
|
||||
|
||||
|
||||
Documentation
|
||||
--------------------------------------------------
|
||||
|
||||
Documentation is available on-line in the gCube Wiki:
|
||||
${gcube.wikiRoot}/Accounting_Lib
|
||||
|
||||
|
||||
Support
|
||||
--------------------------------------------------
|
||||
|
||||
Bugs and support requests can be reported in the gCube issue tracking tool:
|
||||
${gcube.issueTracking}
|
||||
|
||||
|
||||
Licensing
|
||||
--------------------------------------------------
|
||||
|
||||
This software is licensed under the terms you may find in the file named "LICENSE" in this directory.
|
|
@ -0,0 +1,45 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE xml>
|
||||
<ReleaseNotes>
|
||||
<Changeset component="org.gcube.accounting.accounting-lib.3-2-0" date="${buildDate}">
|
||||
<Change>Changed pom.xml to use new make-servicearchive directive #10142</Change>
|
||||
<Change>Added the possibility to rewrite the calledMethod which match a regular expression #10646</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.accounting.accounting-lib.3-1-0" date="2017-10-09">
|
||||
<Change>Refined Jackson support #9617</Change>
|
||||
<Change>Changed JobUsageRecord Model #9646</Change>
|
||||
<Change>Removed TaskUsageRecord #9647</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.accounting.accounting-lib.3-0-0" date="2017-06-07">
|
||||
<Change>Added Jackson support on Usage Record model to allow to use it for marshalling and unmarshalling</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.accounting.accounting-lib.2-4-1" date="2017-05-02">
|
||||
<Change>Added shutdown() method to pass to document store lib</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.accounting.accounting-lib.2-4-0" date="2017-03-16">
|
||||
<Change>Added new Usage Record (StorageStatusRecord)</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.accounting.accounting-lib.2-3-0" date="2016-11-07">
|
||||
<Change>Added callerQualifier field to ServiceUsageRecord #4949</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.accounting.accounting-lib.2-2-0" date="2016-05-18">
|
||||
<Change>Removed dependency over reflection library (refs #2358)</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.accounting.accounting-lib.2-1-0" date="2016-04-08">
|
||||
<Change>Ready for ScopeProvider Removal #2194</Change>
|
||||
<Change>Fixed Bug on StorageUsageRecord aggregation #2316</Change>
|
||||
<Change>Fixed Bug on recovery of UsageRecords accounted on Fallback</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.accounting.accounting-lib.2-0-0" date="2016-02-08">
|
||||
<Change>Separated Accounting Model and generalize solution. the library now depends from document-store-lib #1746</Change>
|
||||
<Change>Managed UsageRecords discovered dinamically on classpath #1295</Change>
|
||||
<Change>Persistence is re-checked every 10 min when Fallback is used #1349</Change>
|
||||
<Change>Repetitive thread retry to persist UsageRecords accounted on Fallback #1352</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.accounting.accounting-lib.1-1-0" date="2015-12-09">
|
||||
<Change>Changed Single and Aggregated classes names to avoid mistakes for the developers.</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.accounting.accounting-lib.1-0-0" date="2015-05-27">
|
||||
<Change>First Release</Change>
|
||||
</Changeset>
|
||||
</ReleaseNotes>
|
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE xml>
|
||||
<Resource>
|
||||
<ID />
|
||||
<Type>Service</Type>
|
||||
<Profile>
|
||||
<Description>${description}</Description>
|
||||
<Class>${serviceClass}</Class>
|
||||
<Name>${artifactId}</Name>
|
||||
<Version>1.0.0</Version>
|
||||
<Packages>
|
||||
<Software>
|
||||
<Description>${description}</Description>
|
||||
<Name>${artifactId}</Name>
|
||||
<Version>${version}</Version>
|
||||
<MavenCoordinates>
|
||||
<groupId>${groupId}</groupId>
|
||||
<artifactId>${artifactId}</artifactId>
|
||||
<version>${version}</version>
|
||||
</MavenCoordinates>
|
||||
<Type>Library</Type>
|
||||
<Files>
|
||||
<File>${build.finalName}.${project.packaging}</File>
|
||||
</Files>
|
||||
</Software>
|
||||
</Packages>
|
||||
</Profile>
|
||||
</Resource>
|
|
@ -0,0 +1,43 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.gcube.tools</groupId>
|
||||
<artifactId>maven-parent</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
|
||||
<groupId>org.gcube.accounting</groupId>
|
||||
<artifactId>accounting-lib</artifactId>
|
||||
<version>3.2.0-SNAPSHOT</version>
|
||||
<name>Accounting Library</name>
|
||||
<description>Accounting Library</description>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<distroDirectory>${project.basedir}/distro</distroDirectory>
|
||||
<serviceClass>Accounting</serviceClass>
|
||||
</properties>
|
||||
|
||||
<scm>
|
||||
<connection>scm:https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/${project.artifactId}</connection>
|
||||
<developerConnection>scm:https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/${project.artifactId}</developerConnection>
|
||||
<url>https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/${project.artifactId}</url>
|
||||
</scm>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>make-servicearchive</id>
|
||||
<phase>package</phase>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
|
@ -0,0 +1,84 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.accounting.datamodel;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.documentstore.exception.InvalidValueException;
|
||||
import org.gcube.documentstore.records.implementation.AbstractRecord;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
*/
|
||||
public abstract class BasicUsageRecord extends AbstractRecord implements UsageRecord {
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -8414241700150395605L;
|
||||
|
||||
public BasicUsageRecord() {
|
||||
}
|
||||
|
||||
public BasicUsageRecord(Map<String, ? extends Serializable> properties) throws InvalidValueException {
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getConsumerId() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void setConsumerId(String consumerId) throws InvalidValueException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecordType() {
|
||||
return BasicUsageRecord.class.getSimpleName();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getScope() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void setScope(String scope) throws InvalidValueException {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public OperationResult getOperationResult() {
|
||||
return OperationResult.SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @throws InvalidValueException
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void setOperationResult(OperationResult operationResult) throws InvalidValueException {
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
package org.gcube.accounting.datamodel;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.gcube.documentstore.exception.InvalidValueException;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
*/
|
||||
public interface UsageRecord {
|
||||
|
||||
public enum OperationResult implements Serializable, Comparable<OperationResult> {
|
||||
SUCCESS, FAILED
|
||||
}
|
||||
|
||||
/**
|
||||
* KEY for : The Operation Result of the accounted operation.
|
||||
* The value is expressed as OperationResult
|
||||
*/
|
||||
public static final String OPERATION_RESULT = "operationResult";
|
||||
|
||||
/**
|
||||
* KEY for : The user (or the Consumer Identity, that in the S2S
|
||||
* communication is another service).
|
||||
*/
|
||||
public static final String CONSUMER_ID = "consumerId";
|
||||
|
||||
/**
|
||||
* KEY for : The scope
|
||||
*/
|
||||
public static final String SCOPE = "scope";
|
||||
|
||||
/**
|
||||
* @return the Operation Result of the accounted operation.
|
||||
*/
|
||||
public OperationResult getOperationResult();
|
||||
|
||||
/**
|
||||
* Set the Operation Result related to the accounted Usage Record
|
||||
* @param operationResult the Operation Result to set
|
||||
* @throws InvalidValueException
|
||||
*/
|
||||
public void setOperationResult(OperationResult operationResult) throws InvalidValueException;
|
||||
|
||||
/**
|
||||
* Return the user (or the Consumer Identity, that in the S2S
|
||||
* communication is another service)
|
||||
* @return Consumer ID
|
||||
*/
|
||||
public String getConsumerId();
|
||||
|
||||
/**
|
||||
* Set the user (or the Consumer Identity, that in the S2S
|
||||
* communication is another service)
|
||||
* @param consumerId Consumer ID
|
||||
* @throws InvalidValueException
|
||||
*/
|
||||
public void setConsumerId(String consumerId) throws InvalidValueException;
|
||||
|
||||
/**
|
||||
* Return the scope of this {#UsageRecord}
|
||||
* @return The scope of this {#UsageRecord}
|
||||
*/
|
||||
public String getScope();
|
||||
|
||||
/**
|
||||
* Set the scope of the {#UsageRecord}
|
||||
* @param scope the scope of the {#UsageRecord}
|
||||
* @throws InvalidValueException
|
||||
*/
|
||||
public void setScope(String scope) throws InvalidValueException;
|
||||
|
||||
}
|
|
@ -0,0 +1,85 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.accounting.datamodel.basetypes;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.accounting.datamodel.BasicUsageRecord;
|
||||
import org.gcube.documentstore.exception.InvalidValueException;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
*/
|
||||
public abstract class AbstractJobUsageRecord extends BasicUsageRecord {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 2361524354045135160L;
|
||||
|
||||
public AbstractJobUsageRecord() {
|
||||
|
||||
}
|
||||
|
||||
public AbstractJobUsageRecord(Map<String,? extends Serializable> properties) throws InvalidValueException {
|
||||
|
||||
}
|
||||
|
||||
private static final String ABSTRACT_TO_REPLACE = "Abstract";
|
||||
|
||||
@Override
|
||||
public String getRecordType() {
|
||||
return AbstractJobUsageRecord.class.getSimpleName().replace(ABSTRACT_TO_REPLACE, "");
|
||||
}
|
||||
|
||||
public String getJobName() {
|
||||
return (String) null;
|
||||
}
|
||||
|
||||
public void setJobName(String jobName) throws InvalidValueException {
|
||||
|
||||
}
|
||||
|
||||
public String getHost() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setHost(String host) throws InvalidValueException {
|
||||
|
||||
}
|
||||
|
||||
public String getServiceClass() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setServiceClass(String serviceClass) throws InvalidValueException {
|
||||
|
||||
}
|
||||
|
||||
public String getServiceName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setServiceName(String serviceName) throws InvalidValueException {
|
||||
|
||||
}
|
||||
|
||||
public Long getDuration() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setDuration(Long duration) throws InvalidValueException {
|
||||
|
||||
}
|
||||
|
||||
public String getCallerQualifier() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setCallerQualifier(String callerQualifier) throws InvalidValueException {
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.accounting.datamodel.basetypes;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.accounting.datamodel.BasicUsageRecord;
|
||||
import org.gcube.documentstore.exception.InvalidValueException;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
*/
|
||||
public abstract class AbstractPortletUsageRecord extends BasicUsageRecord {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -6521755521955331201L;
|
||||
|
||||
public AbstractPortletUsageRecord() {
|
||||
|
||||
}
|
||||
|
||||
public AbstractPortletUsageRecord(Map<String,? extends Serializable> properties) throws InvalidValueException {
|
||||
|
||||
}
|
||||
|
||||
private static final String ABSTRACT_TO_REPLACE = "Abstract";
|
||||
|
||||
@Override
|
||||
public String getRecordType() {
|
||||
return AbstractPortletUsageRecord.class.getSimpleName().replace(ABSTRACT_TO_REPLACE, "");
|
||||
}
|
||||
|
||||
public String getPortletId() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setPortletId(String portletId) throws InvalidValueException {
|
||||
|
||||
}
|
||||
|
||||
public String getOperationId() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setOperationId(String operationId) throws InvalidValueException {
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setMessage(String message) throws InvalidValueException {
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,89 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.accounting.datamodel.basetypes;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.accounting.datamodel.BasicUsageRecord;
|
||||
import org.gcube.documentstore.exception.InvalidValueException;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
*/
|
||||
public abstract class AbstractServiceUsageRecord extends BasicUsageRecord {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -8015539265774575233L;
|
||||
|
||||
public AbstractServiceUsageRecord() {
|
||||
|
||||
}
|
||||
|
||||
public AbstractServiceUsageRecord(Map<String,? extends Serializable> properties) throws InvalidValueException {
|
||||
|
||||
}
|
||||
|
||||
private static final String ABSTRACT_TO_REPLACE = "Abstract";
|
||||
|
||||
@Override
|
||||
public String getRecordType() {
|
||||
return AbstractServiceUsageRecord.class.getSimpleName().replace(ABSTRACT_TO_REPLACE, "");
|
||||
|
||||
}
|
||||
|
||||
public String getCallerHost() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setCallerHost(String callerHost) throws InvalidValueException {
|
||||
|
||||
}
|
||||
|
||||
public String getHost() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setHost(String host) throws InvalidValueException {
|
||||
|
||||
}
|
||||
|
||||
public String getServiceClass() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setServiceClass(String serviceClass) throws InvalidValueException {
|
||||
}
|
||||
|
||||
public String getServiceName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setServiceName(String serviceName) throws InvalidValueException {
|
||||
}
|
||||
|
||||
public String getCalledMethod() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setCalledMethod(String calledMethod) throws InvalidValueException {
|
||||
}
|
||||
|
||||
public Long getDuration() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setDuration(Long duration) throws InvalidValueException {
|
||||
}
|
||||
|
||||
public String getCallerQualifier() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setCallerQualifier(String callerQualifier) throws InvalidValueException {
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,90 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.accounting.datamodel.basetypes;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.net.URI;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.accounting.datamodel.BasicUsageRecord;
|
||||
import org.gcube.documentstore.exception.InvalidValueException;
|
||||
|
||||
public abstract class AbstractStorageStatusRecord extends BasicUsageRecord {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -8414496937550686240L;
|
||||
|
||||
public enum DataType {
|
||||
STORAGE, TREE, GEO, DATABASE, OTHER
|
||||
}
|
||||
|
||||
public AbstractStorageStatusRecord() {
|
||||
}
|
||||
|
||||
public AbstractStorageStatusRecord(Map<String,? extends Serializable> properties) throws InvalidValueException {
|
||||
}
|
||||
|
||||
private static final String ABSTRACT_TO_REPLACE = "Abstract";
|
||||
|
||||
@Override
|
||||
public String getRecordType() {
|
||||
return AbstractStorageStatusRecord.class.getSimpleName().replace(ABSTRACT_TO_REPLACE, "");
|
||||
}
|
||||
|
||||
public long getDataVolume() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public void setDataVolume(long dataVolume) throws InvalidValueException {
|
||||
|
||||
}
|
||||
|
||||
public DataType getDataType() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setDataType(DataType dataType) throws InvalidValueException {
|
||||
|
||||
}
|
||||
|
||||
public long getDataCount() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public void setDataCount(long dataCount) throws InvalidValueException {
|
||||
|
||||
}
|
||||
|
||||
public String getDataServiceClass() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setDataServiceClass(String dataServiceClass) throws InvalidValueException {
|
||||
}
|
||||
|
||||
public String getDataServiceName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setDataServiceName(String dataServiceName) throws InvalidValueException {
|
||||
|
||||
}
|
||||
|
||||
public String getDataServiceId() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setDataServiceId(String dataServiceId) throws InvalidValueException {
|
||||
}
|
||||
|
||||
public URI getProviderId() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setProviderId(URI provideId) throws InvalidValueException {
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,104 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.accounting.datamodel.basetypes;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.net.URI;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.accounting.datamodel.BasicUsageRecord;
|
||||
import org.gcube.documentstore.exception.InvalidValueException;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
*/
|
||||
public abstract class AbstractStorageUsageRecord extends BasicUsageRecord {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -4538851408789372335L;
|
||||
|
||||
public enum OperationType {
|
||||
CREATE, READ, UPDATE, DELETE
|
||||
}
|
||||
|
||||
public enum DataType {
|
||||
STORAGE, TREE, GEO, DATABASE, OTHER
|
||||
}
|
||||
|
||||
public AbstractStorageUsageRecord() {
|
||||
}
|
||||
|
||||
public AbstractStorageUsageRecord(Map<String,? extends Serializable> properties) throws InvalidValueException {
|
||||
}
|
||||
|
||||
private static final String ABSTRACT_TO_REPLACE = "Abstract";
|
||||
|
||||
@Override
|
||||
public String getRecordType() {
|
||||
return AbstractStorageUsageRecord.class.getSimpleName().replace(ABSTRACT_TO_REPLACE, "");
|
||||
}
|
||||
|
||||
public String getResourceOwner() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setResourceOwner(String owner) throws InvalidValueException {
|
||||
}
|
||||
|
||||
public String getResourceScope() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setResourceScope(String scope) throws InvalidValueException {
|
||||
|
||||
}
|
||||
|
||||
public URI getProviderURI() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setProviderURI(URI providerURI) throws InvalidValueException {
|
||||
|
||||
}
|
||||
|
||||
public URI getResourceURI() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setResourceURI(URI resourceURI) throws InvalidValueException {
|
||||
|
||||
}
|
||||
|
||||
public OperationType getOperationType() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setOperationType(OperationType operationType) throws InvalidValueException {
|
||||
}
|
||||
|
||||
public DataType getDataType() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setDataType(DataType dataType) throws InvalidValueException {
|
||||
}
|
||||
|
||||
public long getDataVolume() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public void setDataVolume(long dataVolume) throws InvalidValueException {
|
||||
|
||||
}
|
||||
|
||||
public String getQualifier() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setQualifier(String qualifier) throws InvalidValueException {
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package org.gcube.accounting.datamodel.usagerecords;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.accounting.datamodel.basetypes.AbstractJobUsageRecord;
|
||||
import org.gcube.documentstore.exception.InvalidValueException;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
*/
|
||||
public class JobUsageRecord extends AbstractJobUsageRecord {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -2409704377456095140L;
|
||||
|
||||
public JobUsageRecord() {
|
||||
super();
|
||||
}
|
||||
|
||||
public JobUsageRecord(Map<String,? extends Serializable> properties) throws InvalidValueException {
|
||||
super(properties);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package org.gcube.accounting.datamodel.usagerecords;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.accounting.datamodel.basetypes.AbstractPortletUsageRecord;
|
||||
import org.gcube.documentstore.exception.InvalidValueException;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
*/
|
||||
public class PortletUsageRecord extends AbstractPortletUsageRecord {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 236711996072341709L;
|
||||
|
||||
public PortletUsageRecord() {
|
||||
super();
|
||||
}
|
||||
|
||||
public PortletUsageRecord(Map<String,? extends Serializable> properties) throws InvalidValueException {
|
||||
super(properties);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package org.gcube.accounting.datamodel.usagerecords;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.accounting.datamodel.basetypes.AbstractServiceUsageRecord;
|
||||
import org.gcube.documentstore.exception.InvalidValueException;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
*/
|
||||
public class ServiceUsageRecord extends AbstractServiceUsageRecord {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -8611860162342017139L;
|
||||
|
||||
public ServiceUsageRecord() {
|
||||
super();
|
||||
}
|
||||
|
||||
public ServiceUsageRecord(Map<String,? extends Serializable> properties) throws InvalidValueException {
|
||||
super(properties);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package org.gcube.accounting.datamodel.usagerecords;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.accounting.datamodel.basetypes.AbstractStorageStatusRecord;
|
||||
import org.gcube.documentstore.exception.InvalidValueException;
|
||||
|
||||
/**
|
||||
* @author Alessandro Pieve (ISTI - CNR) alessandro.pieve@isti.cnr.it
|
||||
*
|
||||
*/
|
||||
public class StorageStatusRecord extends AbstractStorageStatusRecord {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 7281637553846301944L;
|
||||
|
||||
public StorageStatusRecord() {
|
||||
super();
|
||||
}
|
||||
|
||||
public StorageStatusRecord(Map<String,? extends Serializable> properties) throws InvalidValueException {
|
||||
super(properties);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package org.gcube.accounting.datamodel.usagerecords;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.accounting.datamodel.basetypes.AbstractStorageUsageRecord;
|
||||
import org.gcube.documentstore.exception.InvalidValueException;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
*/
|
||||
public class StorageUsageRecord extends AbstractStorageUsageRecord {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 5487568054203888507L;
|
||||
|
||||
public StorageUsageRecord() {
|
||||
super();
|
||||
}
|
||||
|
||||
public StorageUsageRecord(Map<String,? extends Serializable> properties) throws InvalidValueException {
|
||||
super(properties);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.accounting.persistence;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.gcube.documentstore.exception.InvalidValueException;
|
||||
import org.gcube.documentstore.records.Record;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
*/
|
||||
public class AccountingPersistence {
|
||||
|
||||
protected AccountingPersistence(String context){
|
||||
|
||||
}
|
||||
|
||||
protected AccountingPersistence(){
|
||||
|
||||
}
|
||||
|
||||
public void account(final Record record) throws InvalidValueException {
|
||||
|
||||
}
|
||||
|
||||
public void flush() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Used {@link AccountingPersistence#flush() instead}
|
||||
* @param timeout
|
||||
* @param timeUnit
|
||||
* @throws Exception
|
||||
*/
|
||||
@Deprecated
|
||||
public void flush(long timeout, TimeUnit timeUnit) throws Exception {
|
||||
this.flush();
|
||||
}
|
||||
|
||||
public void close() throws Exception{
|
||||
|
||||
}
|
||||
|
||||
public boolean isConnectionActive() throws Exception {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.accounting.persistence;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
*/
|
||||
public class AccountingPersistenceFactory {
|
||||
|
||||
private AccountingPersistenceFactory(){}
|
||||
|
||||
|
||||
|
||||
public static void setFallbackLocation(String path){
|
||||
|
||||
}
|
||||
|
||||
public synchronized static AccountingPersistence getPersistence() {
|
||||
AccountingPersistence accountingPersistence = new AccountingPersistence();
|
||||
return accountingPersistence;
|
||||
}
|
||||
|
||||
public static void flushAll(){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Use {@link AccountingPersistenceFactory#flushAll() instead}
|
||||
* @param timeout
|
||||
* @param timeUnit
|
||||
*/
|
||||
@Deprecated
|
||||
public static void flushAll(long timeout, TimeUnit timeUnit){
|
||||
AccountingPersistenceFactory.flushAll();
|
||||
}
|
||||
|
||||
public static void shutDown(){
|
||||
//flush all and shutdown connection and thread
|
||||
|
||||
}
|
||||
|
||||
public static void shutDown(long timeout, TimeUnit timeUnit){
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
org.gcube.accounting.persistence.AccountingPersistenceConfiguration
|
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE xml>
|
||||
<configuration>
|
||||
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{0}: %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
|
||||
<logger name="org.gcube" level="TRACE" />
|
||||
|
||||
<root level="WARN">
|
||||
<appender-ref ref="STDOUT" />
|
||||
</root>
|
||||
|
||||
</configuration>
|
|
@ -0,0 +1 @@
|
|||
{"recordType":"SingleTaskUsageRecord","ESEMpio":"PLUTO","creationTime":1503928807106,"refHostingNodeId":"4f96f787-44b4-46f7-9d85-359e57313840","consumerId":"name.surname","wallDuration":1200000,"taskStartTime":1503928207106,"scope":"/gcube/devNext","host":"localhost","id":"ab97bb13-ca9a-4b01-bd4c-564da3f27759","taskId":"6776f112-4f62-4d13-ad33-d0cab5a98c76","finalState":"DONE","operationResult":"SUCCESS","taskEndTime":1503929407106}
|
Loading…
Reference in New Issue