git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/resource-management/quota-library@142593 82a268e6-3cf1-43bd-a215-b396298e98cf
commit
c51998445f
@ -0,0 +1,31 @@
|
||||
<?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 excluding="**" kind="src" output="target/classes" path="src/main/resources">
|
||||
<attributes>
|
||||
<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.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<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.7">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>quota-library</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.common.project.facet.core.builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.validation.validationbuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
|
||||
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
|
||||
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src/main/webapp"/>
|
||||
<classpathentry kind="src" path="target/m2e-wtp/web-resources"/>
|
||||
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
|
||||
<attributes>
|
||||
<attribute name="hide" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
|
||||
<classpathentry kind="output" path=""/>
|
||||
</classpath>
|
@ -0,0 +1,5 @@
|
||||
eclipse.preferences.version=1
|
||||
encoding//src/main/java=UTF-8
|
||||
encoding//src/main/resources=UTF-8
|
||||
encoding//src/test/java=UTF-8
|
||||
encoding/<project>=UTF-8
|
@ -0,0 +1,8 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
||||
org.eclipse.jdt.core.compiler.compliance=1.7
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||
org.eclipse.jdt.core.compiler.source=1.7
|
@ -0,0 +1,4 @@
|
||||
activeProfiles=
|
||||
eclipse.preferences.version=1
|
||||
resolveWorkspaceProjects=true
|
||||
version=1
|
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
||||
<wb-module deploy-name="quota-service">
|
||||
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
||||
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
||||
<property name="context-root" value="quota-service"/>
|
||||
<property name="java-output-path" value="/quota-service/target/classes"/>
|
||||
</wb-module>
|
||||
</project-modules>
|
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<faceted-project>
|
||||
<fixed facet="wst.jsdt.web"/>
|
||||
<installed facet="jst.web" version="2.3"/>
|
||||
<installed facet="wst.jsdt.web" version="1.0"/>
|
||||
<installed facet="java" version="1.7"/>
|
||||
</faceted-project>
|
@ -0,0 +1 @@
|
||||
org.eclipse.wst.jsdt.launching.baseBrowserLibrary
|
@ -0,0 +1 @@
|
||||
Window
|
@ -0,0 +1,2 @@
|
||||
disabled=06target
|
||||
eclipse.preferences.version=1
|
@ -0,0 +1 @@
|
||||
|
@ -0,0 +1,6 @@
|
||||
gCube System - License
|
||||
------------------------------------------------------------
|
||||
|
||||
The gCube/gCore software is licensed as Free Open Source software conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
|
||||
The software and documentation is provided by its authors/distributors "as is" and no expressed or
|
||||
implied warranty is given for its use, quality or fitness for a particular case.
|
@ -0,0 +1 @@
|
||||
*Alessandro Pieve (alessandro.pieve@isti.cnr.it), CNR, Italy
|
@ -0,0 +1,38 @@
|
||||
The gCube System - ${name}
|
||||
----------------------
|
||||
|
||||
This work has been partially supported by the following European projects: DILIGENT (FP6-2003-IST-2), D4Science (FP7-INFRA-2007-1.2.2),
|
||||
D4Science-II (FP7-INFRA-2008-1.2.2), iMarine (FP7-INFRASTRUCTURES-2011-2), and EUBrazilOpenBio (FP7-ICT-2011-EU-Brazil).
|
||||
|
||||
Authors
|
||||
-------
|
||||
|
||||
* Alessandro Pieve (alessandro.pieve@isti.cnr.it), CNR, Italy
|
||||
|
||||
Version and Release Date
|
||||
------------------------
|
||||
${version}
|
||||
|
||||
Description
|
||||
-----------
|
||||
${description}
|
||||
|
||||
Download information
|
||||
--------------------
|
||||
|
||||
Source code is available from SVN:
|
||||
${scm.url}
|
||||
|
||||
Binaries can be downloaded from:
|
||||
|
||||
|
||||
Documentation
|
||||
-------------
|
||||
Documentation is available on-line from the Projects Documentation Wiki:
|
||||
https://gcube.wiki.gcube-system.org/gcube/index.php/....
|
||||
|
||||
|
||||
Licensing
|
||||
---------
|
||||
|
||||
This software is licensed under the terms you may find in the file named "LICENSE" in this directory.
|
@ -0,0 +1,5 @@
|
||||
<ReleaseNotes>
|
||||
<Changeset component="quota-library-1.0.0" date="2016-10-15">
|
||||
<Change>First Release</Change>
|
||||
</Changeset>
|
||||
</ReleaseNotes>
|
@ -0,0 +1,42 @@
|
||||
<assembly
|
||||
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
|
||||
<id>servicearchive</id>
|
||||
<formats>
|
||||
<format>tar.gz</format>
|
||||
</formats>
|
||||
<baseDirectory>/</baseDirectory>
|
||||
<fileSets>
|
||||
<fileSet>
|
||||
<directory>${distroDirectory}</directory>
|
||||
<outputDirectory>/</outputDirectory>
|
||||
<useDefaultExcludes>true</useDefaultExcludes>
|
||||
<includes>
|
||||
<include>README</include>
|
||||
<include>LICENSE</include>
|
||||
<include>INSTALL</include>
|
||||
<include>MAINTAINERS</include>
|
||||
<include>changelog.xml</include>
|
||||
</includes>
|
||||
<fileMode>755</fileMode>
|
||||
<filtered>true</filtered>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
<files>
|
||||
<file>
|
||||
<source>${distroDirectory}/profile.xml</source>
|
||||
<outputDirectory>/</outputDirectory>
|
||||
<filtered>true</filtered>
|
||||
</file>
|
||||
<file>
|
||||
<source>target/${build.finalName}.jar</source>
|
||||
<outputDirectory>/${artifactId}</outputDirectory>
|
||||
</file>
|
||||
<file>
|
||||
<source>${distroDirectory}/svnpath.txt</source>
|
||||
<outputDirectory>/${artifactId}</outputDirectory>
|
||||
<filtered>true</filtered>
|
||||
</file>
|
||||
</files>
|
||||
</assembly>
|
@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<ID />
|
||||
<Type>Service</Type>
|
||||
<Profile>
|
||||
<Description>${description}</Description>
|
||||
<Class>Common</Class>
|
||||
<Name>${artifactId}</Name>
|
||||
<Version>1.0.0</Version>
|
||||
<Packages>
|
||||
<Software>
|
||||
<Name>${artifactId}</Name>
|
||||
<Version>${version}</Version>
|
||||
<MavenCoordinates>
|
||||
<groupId>${groupId}</groupId>
|
||||
<artifactId>${artifactId}</artifactId>
|
||||
<version>${version}</version>
|
||||
</MavenCoordinates>
|
||||
<Files>
|
||||
<File>${build.finalName}.jar</File>
|
||||
</Files>
|
||||
</Software>
|
||||
</Packages>
|
||||
</Profile>
|
||||
</Resource>
|
||||
|
@ -0,0 +1 @@
|
||||
${scm.url}
|
@ -0,0 +1,94 @@
|
||||
<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/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.gcube.resource.management</groupId>
|
||||
<artifactId>quota-library</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<name>quota-service Maven Webapp</name>
|
||||
<parent>
|
||||
<artifactId>maven-parent</artifactId>
|
||||
<groupId>org.gcube.tools</groupId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
<properties>
|
||||
<distroDirectory>distro</distroDirectory>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.9</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
<version>1.0.13</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.accounting</groupId>
|
||||
<artifactId>accounting-analytics</artifactId>
|
||||
<version>[2.0.0-SNAPSHOT,3.0.0-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.accounting</groupId>
|
||||
<artifactId>accounting-lib</artifactId>
|
||||
<version>[2.0.0-SNAPSHOT,3.0.0-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>2.5</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-profile</id>
|
||||
<phase>install</phase>
|
||||
<goals>
|
||||
<goal>copy-resources</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>target</outputDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>${distroDirectory}</directory>
|
||||
<filtering>true</filtering>
|
||||
<includes>
|
||||
<include>profile.xml</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>${distroDirectory}/descriptor.xml</descriptor>
|
||||
</descriptors>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>servicearchive</id>
|
||||
<phase>install</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
@ -0,0 +1,33 @@
|
||||
package org.gcube.resource.management.quota.library;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import org.gcube.resource.management.quota.library.quotalist.Quota;
|
||||
|
||||
@XmlRootElement(name = "quote")
|
||||
@XmlAccessorType (XmlAccessType.FIELD)
|
||||
|
||||
public class QuotaList
|
||||
{
|
||||
|
||||
@XmlElement(name = "quota")
|
||||
private List<Quota> quotaList;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private QuotaList(){}
|
||||
|
||||
public QuotaList(List<Quota> quotaList) {
|
||||
super();
|
||||
this.quotaList = quotaList;
|
||||
}
|
||||
|
||||
public List<Quota> getQuotaList() {
|
||||
return quotaList;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package org.gcube.resource.management.quota.library;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import org.gcube.resource.management.quota.library.quotalist.ServicePackage;
|
||||
|
||||
|
||||
@XmlRootElement(name = "servicepackages")
|
||||
@XmlAccessorType (XmlAccessType.FIELD)
|
||||
public class ServicePackages {
|
||||
|
||||
@XmlElement(name = "servicepackage")
|
||||
private List<ServicePackage> servicePackages;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private ServicePackages(){}
|
||||
|
||||
public ServicePackages(List<ServicePackage> servicePackages) {
|
||||
super();
|
||||
this.servicePackages = servicePackages;
|
||||
}
|
||||
|
||||
public List<ServicePackage> getPackages() {
|
||||
return servicePackages;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package org.gcube.resource.management.quota.library.quotalist;
|
||||
|
||||
public enum AccessType {
|
||||
ALL(0),
|
||||
ACCESS(1),
|
||||
DELETE(2),
|
||||
EXECUTE(3),
|
||||
WRITE(4);
|
||||
@SuppressWarnings("unused")
|
||||
private int value;
|
||||
private AccessType(int value){
|
||||
this.value=value;
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
package org.gcube.resource.management.quota.library.quotalist;
|
||||
public enum CallerType {
|
||||
USER(1),
|
||||
ROLE(2),
|
||||
SERVICE(3);
|
||||
@SuppressWarnings("unused")
|
||||
private int value;
|
||||
private CallerType(int value){
|
||||
this.value=value;
|
||||
}
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package org.gcube.resource.management.quota.library.quotalist;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlSeeAlso;
|
||||
|
||||
|
||||
@XmlRootElement(name = "quota")
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlSeeAlso({ServiceQuota.class, StorageQuota.class})
|
||||
|
||||
public abstract class Quota {
|
||||
|
||||
protected long id;
|
||||
|
||||
protected Quota() {}
|
||||
|
||||
public abstract QuotaType getQuotaType();
|
||||
|
||||
public abstract String getQuotaAsString();
|
||||
|
||||
public abstract String getIdentifier();
|
||||
|
||||
public abstract String getContext();
|
||||
|
||||
public abstract CallerType getCallerType();
|
||||
|
||||
public abstract TimeInterval getTimeInterval();
|
||||
|
||||
public abstract Double getQuotaValue();
|
||||
|
||||
public abstract Calendar getCreationTime();
|
||||
|
||||
public abstract Calendar getLastUpdateTime();
|
||||
|
||||
public abstract void setCreationTime(Calendar creationTime);
|
||||
|
||||
public abstract void setLastUpdateTime(Calendar lastUpdateTime);
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package org.gcube.resource.management.quota.library.quotalist;
|
||||
|
||||
import org.gcube.accounting.datamodel.AggregatedUsageRecord;
|
||||
import org.gcube.accounting.datamodel.aggregation.AggregatedServiceUsageRecord;
|
||||
import org.gcube.accounting.datamodel.aggregation.AggregatedStorageStatusRecord;
|
||||
|
||||
public enum QuotaType {
|
||||
|
||||
//STORAGE(0,AggregatedStorageUsageRecord.class,"dataVolume"),
|
||||
STORAGE(0,AggregatedStorageStatusRecord.class,"dataVolume"),
|
||||
SERVICE(1,AggregatedServiceUsageRecord.class,"operationCount");
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private int value;
|
||||
private Class<? extends AggregatedUsageRecord<?,?>> typeclz;
|
||||
private String checkManager;
|
||||
private QuotaType(int value,Class<? extends AggregatedUsageRecord<?,?>> clz,String checkManager){
|
||||
this.value=value;
|
||||
this.typeclz=clz;
|
||||
this.checkManager=checkManager;
|
||||
}
|
||||
public Class<? extends AggregatedUsageRecord<?, ?>> getQuotaTypeClass(){
|
||||
return typeclz;
|
||||
}
|
||||
public String getCheckManager(){
|
||||
return checkManager;
|
||||
}
|
||||
}
|
@ -0,0 +1,96 @@
|
||||
package org.gcube.resource.management.quota.library.quotalist;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
@XmlRootElement(name = "servicepackage")
|
||||
@XmlAccessorType (XmlAccessType.FIELD)
|
||||
public class ServicePackage {
|
||||
|
||||
protected long id;
|
||||
protected String name;
|
||||
protected List<ServicePackageDetail> servicesPackagesDetail;
|
||||
|
||||
public ServicePackage() {}
|
||||
|
||||
public ServicePackage(String name,List<ServicePackageDetail> servicesPackagesDetail) {
|
||||
super();
|
||||
this.name = name;
|
||||
this.servicesPackagesDetail = servicesPackagesDetail;
|
||||
}
|
||||
|
||||
|
||||
public String getServicePackagesAsString() {
|
||||
return this.name+","+this.servicesPackagesDetail;
|
||||
}
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public List<ServicePackageDetail> getServicesPackageDetail() {
|
||||
return servicesPackagesDetail;
|
||||
}
|
||||
|
||||
public void setPackageDetail(List<ServicePackageDetail> servicesPackagesDetail) {
|
||||
this.servicesPackagesDetail = servicesPackagesDetail;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ServicePackage [id=" + id + ", name=" + name + ", packageDetail="
|
||||
+ servicesPackagesDetail + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + (int) (id ^ (id >>> 32));
|
||||
result = prime * result + ((name == null) ? 0 : name.hashCode());
|
||||
result = prime * result
|
||||
+ ((servicesPackagesDetail == null) ? 0 : servicesPackagesDetail.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
ServicePackage other = (ServicePackage) obj;
|
||||
if (id != other.id)
|
||||
return false;
|
||||
if (name == null) {
|
||||
if (other.name != null)
|
||||
return false;
|
||||
} else if (!name.equals(other.name))
|
||||
return false;
|
||||
if (servicesPackagesDetail == null) {
|
||||
if (other.servicesPackagesDetail != null)
|
||||
return false;
|
||||
} else if (!servicesPackagesDetail.equals(other.servicesPackagesDetail))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,85 @@
|
||||
package org.gcube.resource.management.quota.library.quotalist;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
@XmlRootElement(name = "servicepackagedetail")
|
||||
@XmlAccessorType (XmlAccessType.FIELD)
|
||||
public class ServicePackageDetail {
|
||||
|
||||
protected long id;
|
||||
protected long idServicesPackage;
|
||||
protected String content;
|
||||
|
||||
public ServicePackageDetail() {}
|
||||
|
||||
public ServicePackageDetail(long idServicesPackage,String content) {
|
||||
super();
|
||||
this.idServicesPackage = idServicesPackage;
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public long getIdServicePackage() {
|
||||
return idServicesPackage;
|
||||
}
|
||||
|
||||
public void setIdServicesPackage(long idServicesPackage) {
|
||||
this.idServicesPackage = idServicesPackage;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((content == null) ? 0 : content.hashCode());
|
||||
result = prime * result + (int) (id ^ (id >>> 32));
|
||||
result = prime * result + (int) (idServicesPackage ^ (idServicesPackage >>> 32));
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
ServicePackageDetail other = (ServicePackageDetail) obj;
|
||||
if (content == null) {
|
||||
if (other.content != null)
|
||||
return false;
|
||||
} else if (!content.equals(other.content))
|
||||
return false;
|
||||
if (id != other.id)
|
||||
return false;
|
||||
if (idServicesPackage != other.idServicesPackage)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ServicePackageDetail [id=" + id + ", idPackage=" + idServicesPackage
|
||||
+ ", content=" + content + "]";
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,213 @@
|
||||
package org.gcube.resource.management.quota.library.quotalist;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
@XmlRootElement
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class ServiceQuota extends Quota {
|
||||
|
||||
private String context;
|
||||
private String identifier;
|
||||
private CallerType callerType;
|
||||
private TimeInterval timeInterval;
|
||||
private Double quotaValue;
|
||||
/*
|
||||
private Long servicePackageId;
|
||||
*/
|
||||
private String serviceId;
|
||||
private AccessType accessType;
|
||||
|
||||
private Calendar lastUpdateTime;
|
||||
private Calendar creationTime;
|
||||
|
||||
|
||||
protected ServiceQuota(){}
|
||||
|
||||
public ServiceQuota(String context,String identifier,CallerType callerType,TimeInterval timeInterval,Double quotaValue,AccessType accessType) {
|
||||
super();
|
||||
this.context = context;
|
||||
this.identifier = identifier;
|
||||
this.callerType=callerType;
|
||||
this.timeInterval = timeInterval;
|
||||
this.quotaValue = quotaValue;
|
||||
this.accessType=accessType;
|
||||
}
|
||||
|
||||
public ServiceQuota(String context,String identifier,CallerType callerType, String serviceId,TimeInterval timeInterval,Double quotaValue,AccessType accessType) {
|
||||
super();
|
||||
this.context = context;
|
||||
this.identifier = identifier;
|
||||
this.callerType=callerType;
|
||||
this.serviceId=serviceId;
|
||||
this.timeInterval = timeInterval;
|
||||
this.quotaValue = quotaValue;
|
||||
this.accessType= accessType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public QuotaType getQuotaType() {
|
||||
return QuotaType.SERVICE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQuotaAsString() {
|
||||
return this.context+","+this.identifier+","+this.callerType+","+this.serviceId+","+this.timeInterval.toString()+","+this.quotaValue+","+this.accessType;
|
||||
|
||||
}
|
||||
|
||||
public String getContext() {
|
||||
return context;
|
||||
}
|
||||
public String getIdentifier() {
|
||||
return identifier;
|
||||
}
|
||||
public void setIdentifier(String identifier) {
|
||||
this.identifier = identifier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CallerType getCallerType() {
|
||||
return callerType;
|
||||
}
|
||||
|
||||
public void setCallerType(CallerType callerType) {
|
||||
this.callerType = callerType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TimeInterval getTimeInterval() {
|
||||
return timeInterval;
|
||||
}
|
||||
public void setTimeInterval(TimeInterval timeInterval) {
|
||||
this.timeInterval = timeInterval;
|
||||
}
|
||||
|
||||
public Double getQuotaValue() {
|
||||
return quotaValue;
|
||||
}
|
||||
public void setQuotaValue(Double quotaValue) {
|
||||
this.quotaValue = quotaValue;
|
||||
}
|
||||
|
||||
public Calendar getLastUpdateTime() {
|
||||
return lastUpdateTime;
|
||||
}
|
||||
|
||||
public Calendar getCreationTime() {
|
||||
return creationTime;
|
||||
}
|
||||
|
||||
public void setLastUpdateTime(Calendar lastUpdateTime) {
|
||||
this.lastUpdateTime = lastUpdateTime;
|
||||
}
|
||||
|
||||
public void setCreationTime(Calendar creationTime) {
|
||||
this.creationTime = creationTime;
|
||||
}
|
||||
|
||||
public String getServiceId() {
|
||||
return serviceId;
|
||||
}
|
||||
public void setServiceId(String serviceId) {
|
||||
this.serviceId = serviceId;
|
||||
}
|
||||
|
||||
public AccessType getAccessType() {
|
||||
return accessType;
|
||||
}
|
||||
|
||||
public void setAccessType(AccessType accessType) {
|
||||
this.accessType = accessType;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ServiceQuota [context=" + context + ", identifier="
|
||||
+ identifier + ", callerType=" + callerType + ", timeInterval="
|
||||
+ timeInterval + ", quotaValue=" + quotaValue + ", serviceId="
|
||||
+ serviceId + ", accessType=" + accessType
|
||||
+ ", lastUpdateTime=" + lastUpdateTime + ", creationTime="
|
||||
+ creationTime + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result
|
||||
+ ((accessType == null) ? 0 : accessType.hashCode());
|
||||
result = prime * result
|
||||
+ ((callerType == null) ? 0 : callerType.hashCode());
|
||||
result = prime * result + ((context == null) ? 0 : context.hashCode());
|
||||
result = prime * result
|
||||
+ ((creationTime == null) ? 0 : creationTime.hashCode());
|
||||
result = prime * result
|
||||
+ ((identifier == null) ? 0 : identifier.hashCode());
|
||||
result = prime * result
|
||||
+ ((lastUpdateTime == null) ? 0 : lastUpdateTime.hashCode());
|
||||
result = prime * result
|
||||
+ ((quotaValue == null) ? 0 : quotaValue.hashCode());
|
||||
result = prime * result
|
||||
+ ((serviceId == null) ? 0 : serviceId.hashCode());
|
||||
result = prime * result
|
||||
+ ((timeInterval == null) ? 0 : timeInterval.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
ServiceQuota other = (ServiceQuota) obj;
|
||||
if (accessType != other.accessType)
|
||||
return false;
|
||||
if (callerType != other.callerType)
|
||||
return false;
|
||||
if (context == null) {
|
||||
if (other.context != null)
|
||||
return false;
|
||||
} else if (!context.equals(other.context))
|
||||
return false;
|
||||
if (creationTime == null) {
|
||||
if (other.creationTime != null)
|
||||
return false;
|
||||
} else if (!creationTime.equals(other.creationTime))
|
||||
return false;
|
||||
if (identifier == null) {
|
||||
if (other.identifier != null)
|
||||
return false;
|
||||
} else if (!identifier.equals(other.identifier))
|
||||
return false;
|
||||
if (lastUpdateTime == null) {
|
||||
if (other.lastUpdateTime != null)
|
||||
return false;
|
||||
} else if (!lastUpdateTime.equals(other.lastUpdateTime))
|
||||
return false;
|
||||
if (quotaValue == null) {
|
||||
if (other.quotaValue != null)
|
||||
return false;
|
||||
} else if (!quotaValue.equals(other.quotaValue))
|
||||
return false;
|
||||
if (serviceId == null) {
|
||||
if (other.serviceId != null)
|
||||
return false;
|
||||
} else if (!serviceId.equals(other.serviceId))
|
||||
return false;
|
||||
if (timeInterval != other.timeInterval)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,167 @@
|
||||
package org.gcube.resource.management.quota.library.quotalist;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
|
||||
|
||||
@XmlRootElement
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class StorageQuota extends Quota {
|
||||
private String context;
|
||||
private String identifier;
|
||||
private CallerType callerType;
|
||||
private TimeInterval timeInterval;
|
||||
private Double quotaValue;
|
||||
|
||||
|
||||
private Calendar lastUpdateTime;
|
||||
private Calendar creationTime;
|
||||
|
||||
|
||||
protected StorageQuota(){}
|
||||
|
||||
public StorageQuota(String context,String identifier,CallerType callerType, TimeInterval timeInterval,Double quotaValue) {
|
||||
super();
|
||||
this.context = context;
|
||||
this.identifier = identifier;
|
||||
this.callerType=callerType;
|
||||
this.timeInterval = timeInterval;
|
||||
this.quotaValue = quotaValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public QuotaType getQuotaType() {
|
||||
return QuotaType.STORAGE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQuotaAsString() {
|
||||
return this.context+","+this.identifier+","+this.callerType+","+this.timeInterval.toString()+","+quotaValue;
|
||||
|
||||
}
|
||||
|
||||
public String getContext() {
|
||||
return context;
|
||||
}
|
||||
public String getIdentifier() {
|
||||
return identifier;
|
||||
}
|
||||
public void setIdentifier(String identifier) {
|
||||
this.identifier = identifier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CallerType getCallerType() {
|
||||
return callerType;
|
||||
}
|
||||
|
||||
public void setCallerType(CallerType callerType) {
|
||||
this.callerType = callerType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TimeInterval getTimeInterval() {
|
||||
return timeInterval;
|
||||
}
|
||||
public void setTimeInterval(TimeInterval timeInterval) {
|
||||
this.timeInterval = timeInterval;
|
||||
}
|
||||
|
||||
public Double getQuotaValue() {
|
||||
return quotaValue;
|
||||
}
|
||||
public void setQuotaValue(Double quotaValue) {
|
||||
this.quotaValue = quotaValue;
|
||||
}
|
||||
|
||||
public Calendar getLastUpdateTime() {
|
||||
return lastUpdateTime;
|
||||
}
|
||||
|
||||
public Calendar getCreationTime() {
|
||||
return creationTime;
|
||||
}
|
||||
|
||||
public void setLastUpdateTime(Calendar lastUpdateTime) {
|
||||
this.lastUpdateTime = lastUpdateTime;
|
||||
}
|
||||
|
||||
public void setCreationTime(Calendar creationTime) {
|
||||
this.creationTime = creationTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "StorageQuota [context=" + context + ", identifier="
|
||||
+ identifier + ", callerType=" + callerType + ", timeInterval=" + timeInterval
|
||||
+ ", quotaValue=" + quotaValue + ", lastUpdateTime="
|
||||
+ lastUpdateTime + ", creationTime=" + creationTime + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result
|
||||
+ ((callerType == null) ? 0 : callerType.hashCode());
|
||||
result = prime * result + ((context == null) ? 0 : context.hashCode());
|
||||
result = prime * result
|
||||
+ ((creationTime == null) ? 0 : creationTime.hashCode());
|
||||
result = prime * result
|
||||
+ ((identifier == null) ? 0 : identifier.hashCode());
|
||||
result = prime * result
|
||||
+ ((lastUpdateTime == null) ? 0 : lastUpdateTime.hashCode());
|
||||
result = prime * result
|
||||
+ ((quotaValue == null) ? 0 : quotaValue.hashCode());
|
||||
result = prime * result
|
||||
+ ((timeInterval == null) ? 0 : timeInterval.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
StorageQuota other = (StorageQuota) obj;
|
||||
if (callerType != other.callerType)
|
||||
return false;
|
||||
if (context == null) {
|
||||
if (other.context != null)
|
||||
return false;
|
||||
} else if (!context.equals(other.context))
|
||||
return false;
|
||||
if (creationTime == null) {
|
||||
if (other.creationTime != null)
|
||||
return false;
|
||||
} else if (!creationTime.equals(other.creationTime))
|
||||
return false;
|
||||
if (identifier == null) {
|
||||
if (other.identifier != null)
|
||||
return false;
|
||||
} else if (!identifier.equals(other.identifier))
|
||||
return false;
|
||||
if (lastUpdateTime == null) {
|
||||
if (other.lastUpdateTime != null)
|
||||
return false;
|
||||
} else if (!lastUpdateTime.equals(other.lastUpdateTime))
|
||||
return false;
|
||||
if (quotaValue == null) {
|
||||
if (other.quotaValue != null)
|
||||
return false;
|
||||
} else if (!quotaValue.equals(other.quotaValue))
|
||||
return false;
|
||||
if (timeInterval != other.timeInterval)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package org.gcube.resource.management.quota.library.quotalist;
|
||||
|
||||
import org.gcube.accounting.analytics.TemporalConstraint.AggregationMode;
|
||||
|
||||
|
||||
public enum TimeInterval {
|
||||
DAILY(1, AggregationMode.DAILY),
|
||||
MONTHLY(31,AggregationMode.MONTHLY),
|
||||
YEARLY(365,AggregationMode.YEARLY),
|
||||
FOREVER(0,null);
|
||||
private int value;
|
||||
private AggregationMode mode;
|
||||
private TimeInterval(int value,AggregationMode mode){
|
||||
this.value=value;
|
||||
this.mode=mode;
|
||||
}
|
||||
|
||||
public int getValue(){
|
||||
return this.value;
|
||||
}
|
||||
public AggregationMode getAggregationMode(){
|
||||
return this.mode;
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package org.gcube.resource.management.quota.library.quotedefault;
|
||||
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlSeeAlso;
|
||||
|
||||
import org.gcube.resource.management.quota.library.quotalist.CallerType;
|
||||
import org.gcube.resource.management.quota.library.quotalist.QuotaType;
|
||||
import org.gcube.resource.management.quota.library.quotalist.TimeInterval;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Alessandro Pieve at ISTI-CNR
|
||||
* (alessandro.pieve@isti.cnr.it)
|
||||
* ex:
|
||||
*<StorageQuotaDefault>
|
||||
* <callerType>USER</callerType>
|
||||
* <quotaValue>1.5</quotaValue>
|
||||
* <timeInterval>DAILY</timeInterval>
|
||||
*</StorageQuotaDefault>
|
||||
*/
|
||||
|
||||
@XmlRootElement(name = "QuotaDefault")
|
||||
@XmlSeeAlso({ServiceQuotaDefault.class, StorageQuotaDefault.class})
|
||||
public abstract class QuotaDefault {
|
||||
|
||||
protected QuotaDefault() {}
|
||||
|
||||
public abstract QuotaType getQuotaType();
|
||||
|
||||
public abstract String getQuotaAsString();
|
||||
|
||||
public abstract CallerType getCallerType();
|
||||
|
||||
public abstract TimeInterval getTimeInterval();
|
||||
|
||||
public abstract Double getQuotaValue();
|
||||
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package org.gcube.resource.management.quota.library.quotedefault;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlElementRef;
|
||||
import javax.xml.bind.annotation.XmlElementRefs;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
@XmlRootElement(name = "QuotaList")
|
||||
@XmlAccessorType (XmlAccessType.FIELD)
|
||||
public class QuotaDefaultList
|
||||
{
|
||||
@XmlElementRefs({
|
||||
@XmlElementRef(type = StorageQuotaDefault.class),
|
||||
@XmlElementRef(type = ServiceQuotaDefault.class)
|
||||
})
|
||||
private List<QuotaDefault> quotaList= null;
|
||||
|
||||
public List<QuotaDefault> getQuotaDefaultList() {
|
||||
return quotaList;
|
||||
}
|
||||
public void setQuotaDefaultList(List<QuotaDefault> quotaList) {
|
||||
this.quotaList = quotaList;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,142 @@
|
||||
package org.gcube.resource.management.quota.library.quotedefault;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import org.gcube.resource.management.quota.library.quotalist.AccessType;
|
||||
import org.gcube.resource.management.quota.library.quotalist.CallerType;
|
||||
import org.gcube.resource.management.quota.library.quotalist.QuotaType;
|
||||
import org.gcube.resource.management.quota.library.quotalist.TimeInterval;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Alessandro Pieve (alessandro.pieve@isti.cnr.it)
|
||||
* ex:
|
||||
* <ServiceQuotaDefault>
|
||||
* <callerType>USER</callerType>
|
||||
* <timeInterval>DAILY</timeInterval>
|
||||
* <serviceId>a:b:c</serviceId>
|
||||
* <accessType>ALL</accessType>
|
||||
* <quotaValue>1.5</quotaValue>
|
||||
* </ServiceQuotaDefault>
|
||||
*/
|
||||
|
||||
@XmlRootElement(name = "ServiceQuotaDefault")
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class ServiceQuotaDefault extends QuotaDefault {
|
||||
|
||||
private CallerType callerType;
|
||||
private TimeInterval timeInterval;
|
||||
private String serviceId;
|
||||
private AccessType accessType;
|
||||
private Double quotaValue;
|
||||
|
||||
protected ServiceQuotaDefault(){}
|
||||
|
||||
@Override
|
||||
public QuotaType getQuotaType() {
|
||||
return QuotaType.SERVICE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQuotaAsString() {
|
||||
return this.callerType+","+this.serviceId+","+this.timeInterval.toString()+","+this.quotaValue+","+this.accessType;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public CallerType getCallerType() {
|
||||
return callerType;
|
||||
}
|
||||
|
||||
public void setCallerType(CallerType callerType) {
|
||||
this.callerType = callerType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TimeInterval getTimeInterval() {
|
||||
return timeInterval;
|
||||
}
|
||||
public void setTimeInterval(TimeInterval timeInterval) {
|
||||
this.timeInterval = timeInterval;
|
||||
}
|
||||
|
||||
public Double getQuotaValue() {
|
||||
return quotaValue;
|
||||
}
|
||||
public void setQuotaValue(Double quotaValue) {
|
||||
this.quotaValue = quotaValue;
|
||||
}
|
||||
|
||||
public String getServiceId() {
|
||||
return serviceId;
|
||||
}
|
||||
public void setServiceId(String serviceId) {
|
||||
this.serviceId = serviceId;
|
||||
}
|
||||
|
||||
public AccessType getAccessType() {
|
||||
return accessType;
|
||||
}
|
||||
public void setAccessType(AccessType accessType) {
|
||||
this.accessType = accessType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ServiceQuotaDefault [callerType=" + callerType
|
||||
+ ", timeInterval=" + timeInterval + ", quotaValue="
|
||||
+ quotaValue + ", serviceId=" + serviceId + ", accessType="
|
||||
+ accessType + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result
|
||||
+ ((accessType == null) ? 0 : accessType.hashCode());
|
||||
result = prime * result
|
||||
+ ((callerType == null) ? 0 : callerType.hashCode());
|
||||
result = prime * result
|
||||
+ ((quotaValue == null) ? 0 : quotaValue.hashCode());
|
||||
result = prime * result
|
||||
+ ((serviceId == null) ? 0 : serviceId.hashCode());
|
||||
result = prime * result
|
||||
+ ((timeInterval == null) ? 0 : timeInterval.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
ServiceQuotaDefault other = (ServiceQuotaDefault) obj;
|
||||
if (accessType != other.accessType)
|
||||
return false;
|
||||
if (callerType != other.callerType)
|
||||
return false;
|
||||
if (quotaValue == null) {
|
||||
if (other.quotaValue != null)
|
||||
return false;
|
||||
} else if (!quotaValue.equals(other.quotaValue))
|
||||
return false;
|
||||
if (serviceId == null) {
|
||||
if (other.serviceId != null)
|
||||
return false;
|
||||
} else if (!serviceId.equals(other.serviceId))
|
||||
return false;
|
||||
if (timeInterval != other.timeInterval)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,121 @@
|
||||
package org.gcube.resource.management.quota.library.quotedefault;
|
||||
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import org.gcube.resource.management.quota.library.quotalist.CallerType;
|
||||
import org.gcube.resource.management.quota.library.quotalist.QuotaType;
|
||||
import org.gcube.resource.management.quota.library.quotalist.TimeInterval;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Alessandro Pieve (alessandro.pieve@isti.cnr.it)
|
||||
* ex:
|
||||
* <StorageQuotaDefault>
|
||||
* <callerType>USER</callerType>
|
||||
* <timeInterval>DAILY</timeInterval>
|
||||
* <quotaValue>1.5</quotaValue>
|
||||
* </StorageQuotaDefault>
|
||||
*/
|
||||
|
||||
|
||||
@XmlRootElement(name = "StorageQuotaDefault")
|
||||
public class StorageQuotaDefault extends QuotaDefault {
|
||||
|
||||
private CallerType callerType;
|
||||
private TimeInterval timeInterval;
|
||||
private Double quotaValue;
|
||||
|
||||
protected StorageQuotaDefault(){}
|
||||
|
||||
|
||||
public StorageQuotaDefault(CallerType callerType,TimeInterval timeInterval,Double quotaValue){
|
||||
this.callerType=callerType;
|
||||
this.timeInterval=timeInterval;
|
||||
this.quotaValue=quotaValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public QuotaType getQuotaType() {
|
||||
return QuotaType.STORAGE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQuotaAsString() {
|
||||
return this.callerType+","+this.timeInterval.toString()+","+quotaValue;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public CallerType getCallerType() {
|
||||
return callerType;
|
||||
}
|
||||
|
||||
public void setCallerType(CallerType callerType) {
|
||||
this.callerType = callerType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TimeInterval getTimeInterval() {
|
||||
return timeInterval;
|
||||
}
|
||||
public void setTimeInterval(TimeInterval timeInterval) {
|
||||
this.timeInterval = timeInterval;
|
||||
}
|
||||
|
||||
public Double getQuotaValue() {
|
||||
return quotaValue;
|
||||
}
|
||||
public void setQuotaValue(Double quotaValue) {
|
||||
this.quotaValue = quotaValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "StorageQuotaDefault [callerType=" + callerType
|
||||
+ ", timeInterval=" + timeInterval + ", quotaValue="
|
||||
+ quotaValue + "]";
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result
|
||||
+ ((callerType == null) ? 0 : callerType.hashCode());
|
||||
result = prime * result
|
||||
+ ((quotaValue == null) ? 0 : quotaValue.hashCode());
|
||||
result = prime * result
|
||||
+ ((timeInterval == null) ? 0 : timeInterval.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
StorageQuotaDefault other = (StorageQuotaDefault) obj;
|
||||
if (callerType != other.callerType)
|
||||
return false;
|
||||
if (quotaValue == null) {
|
||||
if (other.quotaValue != null)
|
||||
return false;
|
||||
} else if (!quotaValue.equals(other.quotaValue))
|
||||
return false;
|
||||
if (timeInterval != other.timeInterval)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
package org.gcube.resource.management.quota.library.status;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import org.gcube.resource.management.quota.library.quotalist.AccessType;
|
||||
import org.gcube.resource.management.quota.library.quotalist.CallerType;
|
||||
import org.gcube.resource.management.quota.library.quotalist.TimeInterval;
|
||||
|
||||
|
||||
@XmlRootElement(name = "quotaStatus")
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
|
||||
public class QuotaStorageStatus {
|
||||
|
||||
protected QuotaStorageStatus(){}
|
||||
|
||||
|
||||
public QuotaStorageStatus(String identifier,TimeInterval timeInterval,Double quotaValue,Double quotaUsage) {
|
||||
super();
|
||||
this.identifier = identifier;
|
||||
this.timeInterval = timeInterval;
|
||||
this.quotaValue = quotaValue;
|
||||
this.quotaUsage=quotaUsage;
|
||||
}
|
||||
|
||||
private String identifier;
|
||||
private TimeInterval timeInterval;
|
||||
private Double quotaValue;
|
||||
private Double quotaUsage;
|
||||
public String getIdentifier() {
|
||||
return identifier;
|
||||
}
|
||||
|
||||
|
||||
public void setIdentifier(String identifier) {
|
||||
this.identifier = identifier;
|
||||
}
|
||||
public TimeInterval getTimeInterval() {
|
||||
return timeInterval;
|
||||
}
|
||||
public void setTimeInterval(TimeInterval timeInterval) {
|
||||
this.timeInterval = timeInterval;
|
||||
}
|
||||
public Double getQuotaValue() {
|
||||
return quotaValue;
|
||||
}
|
||||
public void setQuotaValue(Double quotaValue) {
|
||||
this.quotaValue = quotaValue;
|
||||
}
|
||||
public Double getQuotaUsage() {
|
||||
return quotaUsage;
|
||||
}
|
||||
public void setQuotaUsage(Double quotaUsage) {
|
||||
this.quotaUsage = quotaUsage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "QuotaStorageStatus [identifier=" + identifier
|
||||
+ ", timeInterval=" + timeInterval + ", quotaValue="
|
||||
+ quotaValue + ", quotaUsage=" + quotaUsage + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
<!DOCTYPE web-app PUBLIC
|
||||
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
|
||||
"http://java.sun.com/dtd/web-app_2_3.dtd" >
|
||||
|
||||
<web-app>
|
||||
<display-name>Archetype Created Web Application</display-name>
|
||||
</web-app>
|
@ -0,0 +1,67 @@
|
||||
package org.gcube.resource.management.quota.library.quote;
|
||||
|
||||
import java.io.StringReader;
|
||||
import java.io.StringWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.JAXBContext;
|
||||
|
||||
import org.gcube.resource.management.quota.library.quotalist.CallerType;
|
||||
import org.gcube.resource.management.quota.library.quotalist.Quota;
|
||||
import org.gcube.resource.management.quota.library.quotalist.ServicePackage;
|
||||
import org.gcube.resource.management.quota.library.quotalist.ServicePackageDetail;
|
||||
import org.gcube.resource.management.quota.library.quotalist.StorageQuota;
|
||||
import org.gcube.resource.management.quota.library.quotalist.TimeInterval;
|
||||
import org.junit.Assert;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
public class SerializationTest {
|
||||
|
||||
static JAXBContext context;
|
||||
|
||||
@BeforeClass
|
||||
public static void before() throws Exception{
|
||||
// context = JAXBContext.newInstance(Quota.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void serializeQuota() throws Exception{
|
||||
context = JAXBContext.newInstance(Quota.class);
|
||||
String currentContext="/gcube";
|
||||
String identifier="alessandro.pieve";
|
||||
//ManagerType managerType=ManagerType.STORAGE;
|
||||
TimeInterval timeInterval=TimeInterval.DAILY;
|
||||
Double quotaValue=1000.0;
|
||||
Quota qu= new StorageQuota(currentContext,identifier,CallerType.USER,timeInterval,quotaValue);
|
||||
StringWriter sw = new StringWriter();
|
||||
context.createMarshaller().marshal(qu, sw);
|
||||
Quota quCopy= (Quota)context.createUnmarshaller().unmarshal(new StringReader(sw.toString()));
|
||||
System.out.println(quCopy.getQuotaAsString());
|
||||
System.out.println(qu.getQuotaAsString());
|
||||
Assert.assertEquals(qu, quCopy);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void serializeServicesPackage() throws Exception{
|
||||
context = JAXBContext.newInstance(ServicePackage.class);
|
||||
long idServicesPackage=1;
|
||||
String content="InformationSystem:IColllector";
|
||||
ServicePackageDetail servicePackagesDetail =new ServicePackageDetail(idServicesPackage,content);
|
||||
List<ServicePackageDetail> listServicePackagesDetail =new ArrayList<ServicePackageDetail>();
|
||||
listServicePackagesDetail.add(servicePackagesDetail);
|
||||
ServicePackage servicePackages= new ServicePackage("pacchetto Test",listServicePackagesDetail);
|
||||
|
||||
|
||||
|
||||
StringWriter sw = new StringWriter();
|
||||
context.createMarshaller().marshal(servicePackages, sw);
|
||||
ServicePackage servicePackagesCopy= (ServicePackage)context.createUnmarshaller().unmarshal(new StringReader(sw.toString()));
|
||||
System.out.println(servicePackages.getServicePackagesAsString());
|
||||
System.out.println(servicePackagesCopy.getServicePackagesAsString());
|
||||
Assert.assertEquals(servicePackages, servicePackagesCopy);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue