2022-03-07 13:59:24 +01:00
|
|
|
package org.gcube.application.geoportal.client.plugins;
|
2021-09-20 16:47:35 +02:00
|
|
|
|
|
|
|
import javax.ws.rs.client.WebTarget;
|
|
|
|
|
|
|
|
import org.gcube.application.geoportal.client.legacy.ConcessioniManagerI;
|
|
|
|
import org.gcube.application.geoportal.client.legacy.ConcessioniPlugin;
|
|
|
|
import org.gcube.application.geoportal.client.legacy.MongoConcessioniPlugin;
|
|
|
|
import org.gcube.application.geoportal.client.legacy.StatefulMongoConcessioniPlugin;
|
2022-03-04 14:23:20 +01:00
|
|
|
import org.gcube.application.geoportal.common.model.document.Project;
|
2022-03-07 13:59:24 +01:00
|
|
|
import org.gcube.application.geoportal.common.rest.*;
|
2021-09-20 16:47:35 +02:00
|
|
|
import org.gcube.common.clients.Plugin;
|
|
|
|
import org.gcube.common.clients.ProxyBuilder;
|
|
|
|
import org.gcube.common.clients.ProxyBuilderImpl;
|
|
|
|
import org.gcube.common.clients.config.ProxyConfig;
|
|
|
|
|
|
|
|
import lombok.AllArgsConstructor;
|
|
|
|
|
|
|
|
@AllArgsConstructor
|
|
|
|
public abstract class GeoportalAbstractPlugin <S, P> implements Plugin<S, P>{
|
|
|
|
|
|
|
|
|
2022-03-07 13:59:24 +01:00
|
|
|
public static ProxyBuilder<UseCaseDescriptorsI> useCaseDescriptors() {
|
|
|
|
return new ProxyBuilderImpl<WebTarget, UseCaseDescriptorsI>(new UCDPlugin());
|
|
|
|
}
|
2022-02-02 18:34:32 +01:00
|
|
|
|
2022-02-04 17:45:47 +01:00
|
|
|
|
2022-03-07 13:59:24 +01:00
|
|
|
public static ProxyBuilder<Projects<Project>> projects(String profileID) {
|
2022-02-04 17:45:47 +01:00
|
|
|
ProjectsInterfacePlugin plugin=new ProjectsInterfacePlugin(profileID);
|
2022-03-04 14:23:20 +01:00
|
|
|
return new ProxyBuilderImpl<WebTarget, Projects<Project>>(plugin);
|
2022-02-02 18:34:32 +01:00
|
|
|
}
|
|
|
|
|
2022-03-07 13:59:24 +01:00
|
|
|
public static <C extends Projects<Project>> ProxyBuilder<C> projects(String profileID, Class<C> customClient) {
|
2022-02-04 17:45:47 +01:00
|
|
|
ProjectsInterfacePlugin plugin=new ProjectsInterfacePlugin(profileID);
|
2022-02-02 18:34:32 +01:00
|
|
|
plugin.setCustomClientImplementation(customClient);
|
2022-02-04 17:45:47 +01:00
|
|
|
return new ProxyBuilderImpl<WebTarget, C>(plugin);
|
2022-02-02 18:34:32 +01:00
|
|
|
}
|
|
|
|
|
2022-03-04 14:23:20 +01:00
|
|
|
public static <P extends Project> ProxyBuilder<Projects<P>>
|
2022-03-07 13:59:24 +01:00
|
|
|
customModel(String profileID, Class<P> customModel ) {
|
2022-02-04 17:45:47 +01:00
|
|
|
ProjectsInterfacePlugin plugin=new ProjectsInterfacePlugin(profileID);
|
|
|
|
plugin.setProfiledModel(customModel);
|
2022-03-04 14:23:20 +01:00
|
|
|
return new ProxyBuilderImpl<WebTarget, Projects<P>>(plugin);
|
2021-09-20 16:47:35 +02:00
|
|
|
}
|
2022-02-04 17:45:47 +01:00
|
|
|
|
2022-03-04 14:23:20 +01:00
|
|
|
public static <P extends Project,C extends Projects<P>> ProxyBuilder<C>
|
2022-03-07 13:59:24 +01:00
|
|
|
customModel(String profileID, Class<P> customModel , Class<C> customClient) {
|
2022-02-04 17:45:47 +01:00
|
|
|
ProjectsInterfacePlugin plugin=new ProjectsInterfacePlugin(profileID);
|
|
|
|
plugin.setProfiledModel(customModel);
|
|
|
|
plugin.setCustomClientImplementation(customClient);
|
|
|
|
return new ProxyBuilderImpl<WebTarget, C>(plugin);
|
2021-09-20 16:47:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public Exception convert(Exception fault, ProxyConfig<?, ?> config) {
|
|
|
|
return fault;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String name() {
|
|
|
|
return InterfaceConstants.APPLICATION_BASE_PATH+InterfaceConstants.APPLICATION_PATH;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String namespace() {
|
|
|
|
return InterfaceConstants.NAMESPACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String serviceClass() {
|
|
|
|
return InterfaceConstants.SERVICE_CLASS;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String serviceName() {
|
|
|
|
return InterfaceConstants.SERVICE_NAME;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-02-04 17:45:47 +01:00
|
|
|
|
|
|
|
|
|
|
|
//******** LEGACY
|
|
|
|
public static ProxyBuilder<ConcessioniI> concessioni() {
|
|
|
|
return new ProxyBuilderImpl<WebTarget,ConcessioniI>(concessioni_plugin);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static ProxyBuilder<MongoConcessioni> mongoConcessioni(){
|
|
|
|
return new ProxyBuilderImpl<WebTarget, MongoConcessioni>(mongo_concessioni_plugin);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static ProxyBuilder<ConcessioniManagerI> statefulMongoConcessioni(){
|
|
|
|
return new ProxyBuilderImpl<WebTarget, ConcessioniManagerI>(stateful_mongo_concessioni_plugin);
|
|
|
|
}
|
|
|
|
|
|
|
|
//** LEGACY
|
|
|
|
|
|
|
|
@Deprecated
|
|
|
|
private static ConcessioniPlugin concessioni_plugin=new ConcessioniPlugin();
|
|
|
|
@Deprecated
|
|
|
|
private static MongoConcessioniPlugin mongo_concessioni_plugin=new MongoConcessioniPlugin();
|
|
|
|
@Deprecated
|
|
|
|
private static StatefulMongoConcessioniPlugin stateful_mongo_concessioni_plugin=new StatefulMongoConcessioniPlugin();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-09-20 16:47:35 +02:00
|
|
|
}
|