2021-09-20 16:47:35 +02:00
|
|
|
package org.gcube.application.geoportal.client;
|
|
|
|
|
|
|
|
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-02-04 17:45:47 +01:00
|
|
|
import org.gcube.application.geoportal.common.model.document.ProfiledDocument;
|
2021-09-20 16:47:35 +02:00
|
|
|
import org.gcube.application.geoportal.common.rest.ConcessioniI;
|
|
|
|
import org.gcube.application.geoportal.common.rest.InterfaceConstants;
|
|
|
|
import org.gcube.application.geoportal.common.rest.MongoConcessioni;
|
2022-02-02 18:34:32 +01:00
|
|
|
import org.gcube.application.geoportal.common.rest.ProfiledDocumentsI;
|
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-02-02 18:34:32 +01:00
|
|
|
|
2022-02-04 17:45:47 +01:00
|
|
|
|
|
|
|
public static ProxyBuilder<ProfiledDocumentsI<ProfiledDocument>> profiledDocuments(String profileID) {
|
|
|
|
ProjectsInterfacePlugin plugin=new ProjectsInterfacePlugin(profileID);
|
|
|
|
return new ProxyBuilderImpl<WebTarget, ProfiledDocumentsI<ProfiledDocument>>(plugin);
|
2022-02-02 18:34:32 +01:00
|
|
|
}
|
|
|
|
|
2022-02-04 17:45:47 +01:00
|
|
|
public static <C extends ProfiledDocumentsI<ProfiledDocument>> ProxyBuilder<C> profiledDocuments(String profileID, Class<C> customClient) {
|
|
|
|
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-02-04 17:45:47 +01:00
|
|
|
public static <P extends ProfiledDocument> ProxyBuilder<ProfiledDocumentsI<P>>
|
|
|
|
profiledModel(String profileID, Class<P> customModel ) {
|
|
|
|
ProjectsInterfacePlugin plugin=new ProjectsInterfacePlugin(profileID);
|
|
|
|
plugin.setProfiledModel(customModel);
|
|
|
|
return new ProxyBuilderImpl<WebTarget, ProfiledDocumentsI<P>>(plugin);
|
2021-09-20 16:47:35 +02:00
|
|
|
}
|
2022-02-04 17:45:47 +01:00
|
|
|
|
|
|
|
public static <P extends ProfiledDocument,C extends ProfiledDocumentsI<P>> ProxyBuilder<C>
|
|
|
|
profiledModel(String profileID, Class<P> customModel ,Class<C> customClient) {
|
|
|
|
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
|
|
|
}
|