You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
2.1 KiB
Java
52 lines
2.1 KiB
Java
package org.gcube.spatial.data.sdi.engine.impl.metadata.templates;
|
|
|
|
import org.gcube.spatial.data.sdi.engine.impl.metadata.MetadataHandler;
|
|
import org.gcube.spatial.data.sdi.engine.impl.metadata.MetadataUtils;
|
|
import org.gcube.spatial.data.sdi.engine.impl.metadata.MetadataUtils.Position;
|
|
import org.gcube.spatial.data.sdi.engine.impl.metadata.templates.ThreddsOnlineTemplate.ThreddsOnlineRequest;
|
|
import org.gcube.spatial.data.sdi.model.metadata.TemplateDescriptor;
|
|
import org.gcube.spatial.data.sdi.model.metadata.TemplateInvocation;
|
|
import org.gcube.spatial.data.sdi.model.metadata.ThreddsOnlineTemplateInvocation;
|
|
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.Getter;
|
|
import lombok.ToString;
|
|
|
|
public class ThreddsOnlineTemplate extends AbstractTemplate<ThreddsOnlineRequest> {
|
|
|
|
private static String TEMPLATE_ID="THREDDS-ONLINE";
|
|
private static String TEMPLATE_NAME="Thredds Online Resources";
|
|
private static String FILENAME="ThreddsOnlineResources.ftlx";
|
|
private static InsertionPoint INSERTION=new InsertionPoint(Position.sibling_after, "");
|
|
private static TemplateDescriptor DESCRIPTOR=new TemplateDescriptor(TEMPLATE_ID, TEMPLATE_NAME, "Template for online resources exposed by thredds.", "http://sdi-d4s.d4science.org");
|
|
|
|
|
|
public ThreddsOnlineTemplate() {
|
|
super(FILENAME, INSERTION, DESCRIPTOR);
|
|
}
|
|
|
|
|
|
@Getter
|
|
@AllArgsConstructor
|
|
@ToString
|
|
public static class ThreddsOnlineRequest{
|
|
private String hostname;
|
|
private String catalog;
|
|
private String filename;
|
|
private String gisViewerLink;
|
|
}
|
|
|
|
@Override
|
|
public ThreddsOnlineRequest getInstantiationRequest(MetadataHandler handler, TemplateInvocation invocation) throws InvalidTemplateInvocationException,Exception{
|
|
try{
|
|
ThreddsOnlineTemplateInvocation threddsInvocation=(ThreddsOnlineTemplateInvocation) invocation;
|
|
String uuid=handler.getUUID();
|
|
String gisLink=MetadataUtils.getGisLinkByUUID(uuid);
|
|
return new ThreddsOnlineRequest(threddsInvocation.getHostname(), threddsInvocation.getCatalog(), threddsInvocation.getFilename(), gisLink);
|
|
}catch(ClassCastException e){
|
|
throw new InvalidTemplateInvocationException("Invalid invocation type : "+invocation.getClass());
|
|
}
|
|
}
|
|
|
|
}
|