Fixed CDI
This commit is contained in:
parent
9a974b0e01
commit
62269f6a69
|
@ -15,11 +15,13 @@
|
|||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="test" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="test" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||
|
|
|
@ -5,4 +5,5 @@ org.eclipse.jdt.core.compiler.compliance=1.8
|
|||
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.release=disabled
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
|
|
106
pom.xml
106
pom.xml
|
@ -1,4 +1,5 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
<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>
|
||||
|
@ -11,7 +12,7 @@
|
|||
<version>2.0.6-SNAPSHOT</version>
|
||||
<packaging>war</packaging>
|
||||
<name>DataTransferService</name>
|
||||
|
||||
|
||||
|
||||
<properties>
|
||||
<webappDirectory>${project.basedir}/src/main/webapp/WEB-INF</webappDirectory>
|
||||
|
@ -23,8 +24,8 @@
|
|||
</properties>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<scm>
|
||||
<connection>scm:git:${gitBaseUrl}/${project.artifactId}.git</connection>
|
||||
<developerConnection>scm:git:${gitBaseUrl}/${project.artifactId}.git</developerConnection>
|
||||
|
@ -32,12 +33,12 @@
|
|||
</scm>
|
||||
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.gcube.distribution</groupId>
|
||||
<artifactId>gcube-smartgears-bom</artifactId>
|
||||
<version>1.2.0</version>
|
||||
<version>1.1.0</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
|
@ -47,11 +48,11 @@
|
|||
<version>1.4.0</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<dependencies>
|
||||
|
@ -68,13 +69,7 @@
|
|||
<artifactId>decompress-archive-plugin</artifactId>
|
||||
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
</dependency>
|
||||
<!-- SMARTGEARS -->
|
||||
<dependency>
|
||||
<groupId>org.gcube.core</groupId>
|
||||
|
@ -85,6 +80,16 @@
|
|||
<artifactId>common-smartgears</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
|
@ -93,100 +98,53 @@
|
|||
|
||||
|
||||
<!-- jersey -->
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
<version>3.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.ws.rs</groupId>
|
||||
<artifactId>javax.ws.rs-api</artifactId>
|
||||
<!-- <version>2.0</version> -->
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.containers</groupId>
|
||||
<artifactId>jersey-container-servlet</artifactId>
|
||||
<!-- <version>${jersey-version}</version> -->
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.containers.glassfish</groupId>
|
||||
<artifactId>jersey-gf-cdi</artifactId>
|
||||
<version>${jersey-cdi-version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.transaction</groupId>
|
||||
<artifactId>javax.transaction-api</artifactId>
|
||||
<version>1.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
<version>3.0.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- <dependency> -->
|
||||
<!-- <groupId>org.glassfish.jersey.media</groupId> -->
|
||||
<!-- <artifactId>jersey-media-json-jackson</artifactId> -->
|
||||
<!-- -->
|
||||
<!-- <exclusions> -->
|
||||
<!-- <exclusion> -->
|
||||
<!-- <artifactId>jackson-annotations</artifactId> -->
|
||||
<!-- <groupId>com.fasterxml.jackson.core</groupId> -->
|
||||
<!-- </exclusion> -->
|
||||
<!-- </exclusions> -->
|
||||
<!-- </dependency> -->
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.media</groupId>
|
||||
<artifactId>jersey-media-moxy</artifactId>
|
||||
<groupId>org.glassfish.jersey.media</groupId>
|
||||
<artifactId>jersey-media-moxy</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.media</groupId>
|
||||
<artifactId>jersey-media-multipart</artifactId>
|
||||
<!-- <version>${jersey-version}</version> -->
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.bundles</groupId>
|
||||
<artifactId>jaxrs-ri</artifactId>
|
||||
<!-- <version>${jersey-version}</version> -->
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.core</groupId>
|
||||
<artifactId>jersey-common</artifactId>
|
||||
<!-- <version>${jersey-version}</version> -->
|
||||
</dependency>
|
||||
|
||||
<!-- weld -->
|
||||
<dependency>
|
||||
<groupId>javax.enterprise</groupId>
|
||||
<artifactId>cdi-api</artifactId>
|
||||
<version>1.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.weld.servlet</groupId>
|
||||
<artifactId>weld-servlet</artifactId>
|
||||
<version>${weld-version}</version> <!-- 2.0.4 doesn't find implementations. 2.2.4 doesn't find CDI... -->
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss</groupId>
|
||||
<artifactId>jandex</artifactId>
|
||||
<version>1.2.2.Final</version>
|
||||
</dependency>
|
||||
|
||||
<!-- test -->
|
||||
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
<!-- <version>1.0.13</version> -->
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.test-framework.providers</groupId>
|
||||
<artifactId>jersey-test-framework-provider-simple</artifactId>
|
||||
<!-- <version>${jersey-version}</version> -->
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
@ -201,7 +159,7 @@
|
|||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
</build>
|
||||
|
||||
<description>Service used to receive data from other hosting nodes</description>
|
||||
|
|
|
@ -13,44 +13,61 @@ import org.gcube.data.transfer.service.transfers.engine.PersistenceProvider;
|
|||
import org.gcube.data.transfer.service.transfers.engine.PluginManager;
|
||||
import org.gcube.data.transfer.service.transfers.engine.RequestManager;
|
||||
import org.gcube.data.transfer.service.transfers.engine.TicketManager;
|
||||
import org.gcube.data.transfer.service.transfers.engine.impl.AccountingManagerImpl;
|
||||
import org.gcube.data.transfer.service.transfers.engine.impl.CapabilitiesProviderImpl;
|
||||
import org.gcube.data.transfer.service.transfers.engine.impl.PersistenceProviderImpl;
|
||||
import org.gcube.data.transfer.service.transfers.engine.impl.PluginManagerImpl;
|
||||
import org.gcube.data.transfer.service.transfers.engine.impl.RequestManagerImpl;
|
||||
import org.gcube.data.transfer.service.transfers.engine.impl.TransferTicketManagerImpl;
|
||||
import org.gcube.data.transfer.service.transfers.engine.factories.AccountingManagerFactory;
|
||||
import org.gcube.data.transfer.service.transfers.engine.factories.CapabilitiesProviderFactory;
|
||||
import org.gcube.data.transfer.service.transfers.engine.factories.PersistenceProviderFactory;
|
||||
import org.gcube.data.transfer.service.transfers.engine.factories.PluginManagerFactory;
|
||||
import org.gcube.data.transfer.service.transfers.engine.factories.RequestManagerFactory;
|
||||
import org.gcube.data.transfer.service.transfers.engine.factories.TicketManagerFactory;
|
||||
import org.glassfish.hk2.utilities.binding.AbstractBinder;
|
||||
import org.glassfish.jersey.media.multipart.MultiPartFeature;
|
||||
import org.glassfish.jersey.server.ResourceConfig;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
@ApplicationPath(ServiceConstants.APPLICATION_PATH)
|
||||
public class DTService extends ResourceConfig{
|
||||
|
||||
public DTService() {
|
||||
super();
|
||||
|
||||
AbstractBinder binder = new AbstractBinder() {
|
||||
@Override
|
||||
protected void configure() {
|
||||
bind(AccountingManagerImpl.class).to(AccountingManager.class);
|
||||
bind(CapabilitiesProviderImpl.class).to(CapabilitiesProvider.class);
|
||||
bind(PersistenceProviderImpl.class).to(PersistenceProvider.class);
|
||||
bind(PluginManagerImpl.class).to(PluginManager.class);
|
||||
bind(RequestManagerImpl.class).to(RequestManager.class);
|
||||
bind(TransferTicketManagerImpl.class).to(TicketManager.class);
|
||||
}
|
||||
};
|
||||
register(binder);
|
||||
|
||||
register(Capabilities.class);
|
||||
register(Requests.class);
|
||||
register(REST.class);
|
||||
register(TransferStatus.class);
|
||||
// packages("org.gcube.data.transfer.service.transfers");
|
||||
packages("org.glassfish.jersey.media.multipart");
|
||||
packages("org.glassfish.jersey.media.multipart.internal");
|
||||
// register(ProviderLoggingListener.class);
|
||||
register(MultiPartFeature.class);
|
||||
log.warn("Going to define Binder ");
|
||||
try {
|
||||
AbstractBinder binder = new AbstractBinder() {
|
||||
@Override
|
||||
protected void configure() {
|
||||
bindFactory(AccountingManagerFactory.class).to(AccountingManager.class);
|
||||
bindFactory(CapabilitiesProviderFactory.class).to(CapabilitiesProvider.class);
|
||||
bindFactory(PersistenceProviderFactory.class).to(PersistenceProvider.class);
|
||||
bindFactory(PluginManagerFactory.class).to(PluginManager.class);
|
||||
bindFactory(RequestManagerFactory.class).to(RequestManager.class);
|
||||
bindFactory(TicketManagerFactory.class).to(TicketManager.class);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
register(binder);
|
||||
|
||||
registerClasses(Capabilities.class);
|
||||
registerClasses(Requests.class);
|
||||
registerClasses(REST.class);
|
||||
registerClasses(TransferStatus.class);
|
||||
// ApplicationContext ctx = ContextProvider.get();
|
||||
|
||||
// ctx.application().addListener(Listener.class.getName());
|
||||
|
||||
|
||||
packages("org.gcube.data.transfer.service.transfers");
|
||||
packages("org.glassfish.jersey.media.multipart");
|
||||
packages("org.glassfish.jersey.media.multipart.internal");
|
||||
// register(ProviderLoggingListener.class);
|
||||
register(MultiPartFeature.class);
|
||||
}catch(Throwable t) {
|
||||
log.error("Init error ",t );
|
||||
throw t;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
package org.gcube.data.transfer.service;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import org.gcube.data.transfer.service.transfers.engine.CapabilitiesProvider;
|
||||
import org.gcube.smartgears.handlers.application.ApplicationLifecycleEvent.Start;
|
||||
import org.gcube.smartgears.handlers.application.ApplicationLifecycleEvent.Stop;
|
||||
import org.gcube.smartgears.handlers.application.ApplicationLifecycleHandler;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@XmlRootElement(name = "data-transfer-lifecycle")
|
||||
@Slf4j
|
||||
public class DTServiceLifecycleMAnager extends ApplicationLifecycleHandler{
|
||||
|
||||
@Inject
|
||||
CapabilitiesProvider capabilities;
|
||||
|
||||
|
||||
@Override
|
||||
public void onStart(Start e) {
|
||||
|
||||
super.onStart(e);
|
||||
log.info("Capabilities : "+capabilities.get());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onStop(Stop e) {
|
||||
// TODO Auto-generated method stub
|
||||
super.onStop(e);
|
||||
}
|
||||
}
|
|
@ -36,10 +36,13 @@ import org.gcube.data.transfer.model.options.HttpDownloadOptions;
|
|||
import org.gcube.data.transfer.model.options.TransferOptions.TransferMethod;
|
||||
import org.gcube.data.transfer.model.settings.FileUploadSettings;
|
||||
import org.gcube.data.transfer.model.settings.HttpDownloadSettings;
|
||||
import org.gcube.data.transfer.service.DTServiceAppManager;
|
||||
import org.gcube.data.transfer.service.transfers.engine.AccountingManager;
|
||||
import org.gcube.data.transfer.service.transfers.engine.PersistenceProvider;
|
||||
import org.gcube.data.transfer.service.transfers.engine.RequestManager;
|
||||
import org.gcube.data.transfer.service.transfers.engine.faults.DestinationAccessException;
|
||||
import org.gcube.data.transfer.service.transfers.engine.impl.AccountingManagerImpl;
|
||||
import org.gcube.smartgears.annotations.ManagedBy;
|
||||
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
|
||||
import org.glassfish.jersey.media.multipart.FormDataParam;
|
||||
|
||||
|
@ -47,6 +50,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||
|
||||
@Path(ServiceConstants.REST_SERVLET_NAME+"/{destinationId}/{subPath : \\S*}")
|
||||
@Slf4j
|
||||
@ManagedBy(DTServiceAppManager.class)
|
||||
public class REST {
|
||||
|
||||
|
||||
|
@ -234,7 +238,7 @@ public class REST {
|
|||
|
||||
|
||||
private static void account(boolean read,long volume,boolean success,String path,String mimetype) {
|
||||
AccountingManager manager=AccountingManager.get();
|
||||
AccountingManager manager=AccountingManagerImpl.get();
|
||||
String id=manager.createNewRecord();
|
||||
if(read) manager.setRead(id);
|
||||
else manager.setDelete(id);
|
||||
|
|
|
@ -11,13 +11,16 @@ import javax.ws.rs.core.MediaType;
|
|||
import org.gcube.data.transfer.model.ServiceConstants;
|
||||
import org.gcube.data.transfer.model.TransferRequest;
|
||||
import org.gcube.data.transfer.model.TransferTicket;
|
||||
import org.gcube.data.transfer.service.DTServiceAppManager;
|
||||
import org.gcube.data.transfer.service.transfers.engine.RequestManager;
|
||||
import org.gcube.smartgears.annotations.ManagedBy;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
|
||||
@Path(ServiceConstants.REQUESTS_SERVLET_NAME)
|
||||
@Slf4j
|
||||
@ManagedBy(DTServiceAppManager.class)
|
||||
public class Requests {
|
||||
|
||||
@Inject
|
||||
|
|
|
@ -14,11 +14,14 @@ import lombok.extern.slf4j.Slf4j;
|
|||
|
||||
import org.gcube.data.transfer.model.ServiceConstants;
|
||||
import org.gcube.data.transfer.model.TransferTicket;
|
||||
import org.gcube.data.transfer.service.DTServiceAppManager;
|
||||
import org.gcube.data.transfer.service.transfers.engine.TicketManager;
|
||||
import org.gcube.data.transfer.service.transfers.engine.faults.TicketNotFoundException;
|
||||
import org.gcube.smartgears.annotations.ManagedBy;
|
||||
|
||||
@Path(ServiceConstants.STATUS_SERVLET_NAME)
|
||||
@Slf4j
|
||||
@ManagedBy(DTServiceAppManager.class)
|
||||
public class TransferStatus {
|
||||
|
||||
@Inject
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
package org.gcube.data.transfer.service.transfers.engine;
|
||||
|
||||
import org.gcube.data.transfer.service.transfers.engine.impl.AccountingManagerImpl;
|
||||
|
||||
public interface AccountingManager {
|
||||
|
||||
public String createNewRecord();
|
||||
// public StorageUsageRecord getById(String id);
|
||||
public void account(String toAccountRecordId);
|
||||
|
||||
|
||||
|
@ -20,13 +17,5 @@ public interface AccountingManager {
|
|||
|
||||
|
||||
|
||||
// usageRecord.setOperationResult(TEST_OPERATION_RESULT);
|
||||
// usageRecord.setResourceURI(new URI(TEST_RESOURCE_URI));
|
||||
// usageRecord.setOperationType(AbstractStorageUsageRecord.OperationType.READ);
|
||||
// usageRecord.setDataVolume(generateRandomLong(MIN_DATA_VOLUME, MAX_DATA_VOLUME));
|
||||
// usageRecord.setQualifier("image/png");
|
||||
|
||||
public static AccountingManager get() {
|
||||
return AccountingManagerImpl.get();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
package org.gcube.data.transfer.service.transfers.engine.factories;
|
||||
|
||||
import org.gcube.data.transfer.service.transfers.engine.AccountingManager;
|
||||
import org.gcube.data.transfer.service.transfers.engine.impl.AccountingManagerImpl;
|
||||
import org.glassfish.hk2.api.Factory;
|
||||
|
||||
public class AccountingManagerFactory implements Factory<AccountingManager>{
|
||||
|
||||
@Override
|
||||
public void dispose(AccountingManager instance) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public AccountingManager provide() {
|
||||
return AccountingManagerImpl.get();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package org.gcube.data.transfer.service.transfers.engine.factories;
|
||||
|
||||
import org.gcube.data.transfer.service.transfers.engine.CapabilitiesProvider;
|
||||
import org.gcube.data.transfer.service.transfers.engine.impl.CapabilitiesProviderImpl;
|
||||
import org.glassfish.hk2.api.Factory;
|
||||
|
||||
public class CapabilitiesProviderFactory implements Factory<CapabilitiesProvider>{
|
||||
|
||||
@Override
|
||||
public void dispose(CapabilitiesProvider instance) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public CapabilitiesProvider provide() {
|
||||
return new CapabilitiesProviderImpl(new PersistenceProviderFactory().provide());
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package org.gcube.data.transfer.service.transfers.engine.factories;
|
||||
|
||||
import org.gcube.data.transfer.service.transfers.engine.PersistenceProvider;
|
||||
import org.gcube.data.transfer.service.transfers.engine.impl.PersistenceProviderImpl;
|
||||
import org.glassfish.hk2.api.Factory;
|
||||
|
||||
public class PersistenceProviderFactory implements Factory<PersistenceProvider>{
|
||||
|
||||
|
||||
public void dispose(PersistenceProvider instance) {};
|
||||
|
||||
@Override
|
||||
public PersistenceProvider provide() {
|
||||
return new PersistenceProviderImpl();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package org.gcube.data.transfer.service.transfers.engine.factories;
|
||||
|
||||
import org.gcube.data.transfer.service.transfers.engine.PluginManager;
|
||||
import org.gcube.data.transfer.service.transfers.engine.impl.PluginManagerImpl;
|
||||
import org.glassfish.hk2.api.Factory;
|
||||
|
||||
public class PluginManagerFactory implements Factory<PluginManager>{
|
||||
|
||||
|
||||
@Override
|
||||
public void dispose(PluginManager instance) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public PluginManager provide() {
|
||||
return new PluginManagerImpl();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package org.gcube.data.transfer.service.transfers.engine.factories;
|
||||
|
||||
import org.gcube.data.transfer.service.transfers.engine.RequestManager;
|
||||
import org.gcube.data.transfer.service.transfers.engine.impl.RequestManagerImpl;
|
||||
import org.glassfish.hk2.api.Factory;
|
||||
|
||||
public class RequestManagerFactory implements Factory<RequestManager>{
|
||||
|
||||
|
||||
@Override
|
||||
public void dispose(RequestManager instance) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public RequestManager provide() {
|
||||
return new RequestManagerImpl(new TicketManagerFactory().provide(),
|
||||
new PersistenceProviderFactory().provide());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package org.gcube.data.transfer.service.transfers.engine.factories;
|
||||
|
||||
import org.gcube.data.transfer.service.transfers.engine.TicketManager;
|
||||
import org.gcube.data.transfer.service.transfers.engine.impl.TransferTicketManagerImpl;
|
||||
import org.glassfish.hk2.api.Factory;
|
||||
|
||||
public class TicketManagerFactory implements Factory<TicketManager>{
|
||||
|
||||
@Override
|
||||
public void dispose(TicketManager instance) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public TicketManager provide() {
|
||||
return new TransferTicketManagerImpl();
|
||||
}
|
||||
|
||||
}
|
|
@ -270,7 +270,7 @@ public abstract class AbstractTicketHandler {
|
|||
|
||||
|
||||
private void account(AccountingDetails toAccount) {
|
||||
AccountingManager manager=AccountingManager.get();
|
||||
AccountingManager manager=AccountingManagerImpl.get();
|
||||
String accountingId=toAccount.getAccountingId();
|
||||
manager.setMimeType(accountingId, toAccount.getMimeType());
|
||||
manager.setResourceURI(accountingId, toAccount.getUri());
|
||||
|
|
|
@ -3,7 +3,6 @@ package org.gcube.data.transfer.service.transfers.engine.impl;
|
|||
import java.util.Properties;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
@ -60,7 +59,7 @@ public class RequestManagerImpl implements RequestManager{
|
|||
this.persistenceProvider=persistenceProvider;
|
||||
this.pluginManager=PluginManager.get();
|
||||
this.ticketManager=ticketManager;
|
||||
this.accounting=AccountingManager.get();
|
||||
this.accounting=AccountingManagerImpl.get();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Context path="/JavaServletWeld">
|
||||
|
||||
<Resource name="BeanManager"
|
||||
auth="Container"
|
||||
type="javax.enterprise.inject.spi.BeanManager"
|
||||
factory="org.jboss.weld.resources.ManagerObjectFactory" />
|
||||
|
||||
</Context>
|
|
@ -0,0 +1 @@
|
|||
org.gcube.data.transfer.service.DTServiceLifecycleMAnager
|
|
@ -2,12 +2,13 @@ package org.gcube.data.transfer.service;
|
|||
|
||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||
import org.gcube.data.transfer.service.transfers.engine.AccountingManager;
|
||||
import org.gcube.data.transfer.service.transfers.engine.impl.AccountingManagerImpl;
|
||||
|
||||
public class Accountingtests {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SecurityTokenProvider.instance.set("feda0617-cd9d-4841-b6f0-e047da5d32ed-98187548");
|
||||
AccountingManager manager=AccountingManager.get();
|
||||
AccountingManager manager=AccountingManagerImpl.get();
|
||||
String id=manager.createNewRecord();
|
||||
manager.setSuccessful(id, true);
|
||||
System.out.println("DONE");
|
||||
|
|
Loading…
Reference in New Issue