use of org.n52.shetland.ogc.ows.OwsServiceProvider in project arctic-sea by 52North.
the class OwsEncoderv110 method encodeServiceProvider.
private ServiceProvider encodeServiceProvider(OwsServiceProvider osp) {
/* TODO check for required fields and fail on missing ones */
ServiceProvider serviceProvider = ServiceProvider.Factory.newInstance();
serviceProvider.setProviderName(osp.getProviderName());
osp.getProviderSite().ifPresent(x -> encodeOnlineResource(x, serviceProvider.addNewProviderSite()));
encodeOwsResponsibleParty(osp.getServiceContact(), serviceProvider.addNewServiceContact());
return serviceProvider;
}
use of org.n52.shetland.ogc.ows.OwsServiceProvider in project arctic-sea by 52North.
the class AbstractGetCapabilitiesHandler method createCapabilities.
private OwsCapabilities createCapabilities(GetCapabilitiesRequest request, String service, String version) throws OwsExceptionReport {
Set<CapabilitiesSection> sections = getRequestedSections(request);
Locale requestedLocale = getRequestedLocale(request);
String updateSequence = null;
OwsServiceIdentification serviceIdentification = null;
if (sections.contains(CapabilitiesSection.ServiceIdentification)) {
serviceIdentification = getServiceIdentification(service, requestedLocale);
}
OwsServiceProvider serviceProvider = null;
if (sections.contains(CapabilitiesSection.ServiceProvider)) {
serviceProvider = getServiceProvider(service, requestedLocale);
}
OwsOperationsMetadata operationsMetadata = null;
if (sections.contains(CapabilitiesSection.OperationsMetadata)) {
operationsMetadata = getOperations(service, version);
}
Set<String> languages = null;
if (sections.contains(CapabilitiesSection.Languages)) {
languages = getLanguages();
}
T contents = null;
if (sections.contains(CapabilitiesSection.Contents)) {
contents = createContents(service, version);
}
Collection<OwsCapabilitiesExtension> extensions = getExtensions(request, service, version);
OwsCapabilities capabilities = new OwsCapabilities(service, version, updateSequence, serviceIdentification, serviceProvider, operationsMetadata, languages, extensions);
return createCapabilities(capabilities, contents);
}
use of org.n52.shetland.ogc.ows.OwsServiceProvider in project arctic-sea by 52North.
the class OwsServiceProviderFactory method create.
@Override
protected OwsServiceProvider create(Locale language) throws ConfigurationError {
// TODO organisation name is missing
String organisationName = null;
OwsOnlineResource onlineResource = null;
if (site != null) {
onlineResource = new OwsOnlineResource(site);
}
OwsCode roleCode = null;
if (role != null) {
roleCode = new OwsCode(role, roleCodespace);
}
OwsOnlineResource providerSite = null;
if (onlineResoureHref != null) {
providerSite = new OwsOnlineResource(onlineResoureHref, onlineResoureTitle);
}
OwsAddress address = null;
if (anyNonNull(deliveryPoint, city, administrativeArea, postalCode, country, electronicMailAddress)) {
address = new OwsAddress(deliveryPoint, city, administrativeArea, postalCode, country, electronicMailAddress);
}
OwsPhone owsPhone = null;
if (anyNonNull(phone, facsimile)) {
owsPhone = new OwsPhone(phone, facsimile);
}
OwsContact contactInfo = null;
if (anyNonNull(owsPhone, address, onlineResource, hoursOfService, contactInstructions)) {
contactInfo = new OwsContact(owsPhone, address, onlineResource, hoursOfService, contactInstructions);
}
OwsResponsibleParty serviceContact = new OwsResponsibleParty(individualName, organisationName, positionName, contactInfo, roleCode);
return new OwsServiceProvider(name, providerSite, serviceContact);
}
use of org.n52.shetland.ogc.ows.OwsServiceProvider in project arctic-sea by 52North.
the class OwsEncoderv110 method encode.
@Override
public XmlObject encode(Object element, EncodingContext additionalValues) throws EncodingException {
if (element instanceof OwsServiceIdentification) {
return encodeServiceIdentification((OwsServiceIdentification) element);
} else if (element instanceof OwsServiceProvider) {
return encodeServiceProvider((OwsServiceProvider) element);
} else if (element instanceof OwsOperationsMetadata) {
return encodeOperationsMetadata((OwsOperationsMetadata) element);
} else if (element instanceof OwsExceptionReport) {
if (isEncodeExceptionsOnly(additionalValues) && !((OwsExceptionReport) element).getExceptions().isEmpty()) {
return encodeOwsException(((OwsExceptionReport) element).getExceptions().get(0));
}
return encodeOwsExceptionReport((OwsExceptionReport) element);
} else if (element instanceof OwsMetadata) {
MetadataType metadataType = MetadataType.Factory.newInstance(getXmlOptions());
encodeOwsMetadata((OwsMetadata) element, metadataType);
return metadataType;
} else if (element instanceof OwsDomain) {
DomainType domainType = DomainType.Factory.newInstance(getXmlOptions());
encodeOwsDomain((OwsDomain) element, domainType);
return domainType;
} else if (element instanceof OwsAcceptVersions) {
return encodeAcceptVersions((OwsAcceptVersions) element);
} else if (element instanceof OwsSections) {
return encodeSections((OwsSections) element);
}
throw new UnsupportedEncoderInputException(this, element);
}
use of org.n52.shetland.ogc.ows.OwsServiceProvider in project arctic-sea by 52North.
the class AbstractCapabilitiesBaseTypeDecoder method parseServiceProvider.
private OwsServiceProvider parseServiceProvider(ServiceProvider serviceProvider) {
if (serviceProvider == null) {
return null;
}
OwsOnlineResource providerSite = parseOnlineResource(serviceProvider.getProviderSite());
OwsResponsibleParty serviceContact = parseResponsibleParty(serviceProvider.getServiceContact());
String providerName = serviceProvider.getProviderName();
return new OwsServiceProvider(providerName, providerSite, serviceContact);
}
Aggregations