public static CodeType code(String value) { CodeType code = f.createCodeType(); code.setValue(value); return code; }
public static DomainMetadataType type(String name) { DomainMetadataType type = f.createDomainMetadataType(); type.setValue(name); return type; }
public static LanguageStringType languageString(String value) { LanguageStringType ls = f.createLanguageStringType(); ls.setValue(value); return ls; }
public static CRSEnvelope bbox2bbox(BoundingBoxType bbox) { return new CRSEnvelope( bbox.getCrs(), (Double) bbox.getLowerCorner().get(0), (Double) bbox.getLowerCorner().get(1), (Double) bbox.getUpperCorner().get(0), (Double) bbox.getUpperCorner().get(1)); } }
public static ExceptionReportType exceptionReport( ServiceException exception, boolean verboseExceptions, String version) { ExceptionType e = f.createExceptionType(); if (exception.getCode() != null) { e.setExceptionCode(exception.getCode()); } else { // set a default e.setExceptionCode("NoApplicableCode"); } e.setLocator(exception.getLocator()); // add the message StringBuffer sb = new StringBuffer(); OwsUtils.dumpExceptionMessages(exception, sb, true); e.getExceptionText().add(sb.toString()); e.getExceptionText().addAll(exception.getExceptionText()); if (verboseExceptions) { // add the entire stack trace // exception. e.getExceptionText().add("Details:"); ByteArrayOutputStream trace = new ByteArrayOutputStream(); exception.printStackTrace(new PrintStream(trace)); e.getExceptionText().add(new String(trace.toByteArray())); } ExceptionReportType report = f.createExceptionReportType(); version = version != null ? version : "1.1.0"; report.setVersion(version); report.getException().add(e); return report; }
public static DCPType dcp(String service, EObject request) { String baseUrl = (String) EMFUtils.get(request, "baseUrl"); if (baseUrl == null) { throw new IllegalArgumentException( "Request object" + request + " has no 'baseUrl' property."); } String href = ResponseUtils.buildURL( baseUrl, service, new HashMap<String, String>(), URLType.SERVICE); DCPType dcp = f.createDCPType(); dcp.setHTTP(f.createHTTPType()); RequestMethodType get = f.createRequestMethodType(); get.setHref(href); dcp.getHTTP().getGet().add(get); RequestMethodType post = f.createRequestMethodType(); post.setHref(href); dcp.getHTTP().getPost().add(post); return dcp; } }
public static Name name(CodeType code) { // mushy translation, code type seems to never have a code space in practice if (code.getCodeSpace() != null) { return new NameImpl(code.getCodeSpace(), code.getValue()); } else { return name(code.getValue()); } }
public Object parse(String value) throws Exception { List<String> versions = KvpUtils.readFlat(value); for (String version : versions) { RequestUtils.checkVersionNumber(version, "AcceptVersions"); } AcceptVersionsType accepts = Ows11Factory.eINSTANCE.createAcceptVersionsType(); accepts.getVersion().addAll(versions); return accepts; } }
@SuppressWarnings("unchecked") protected Set<String> findParameters( final OperationType operationMetadata, final String parameterName) { Set<String> outputFormats = new HashSet<String>(); List<DomainType> parameters = operationMetadata.getParameter(); for (DomainType param : parameters) { String paramName = param.getName(); if (parameterName.equals(paramName)) { for (ValueType value : (List<ValueType>) param.getAllowedValues().getValue()) { outputFormats.add(value.getValue()); } } } return outputFormats; }
public static CodeType code(CodeType value) { return code(value.getValue()); }
/** * Maps to the capabilities' service identification keywords list * * @see ServiceInfo#getDescription() */ public Set<String> getKeywords() { Set<String> kws = new HashSet<String>(); ServiceIdentificationType serviceIdentification = capabilities.getServiceIdentification(); if (serviceIdentification != null) { @SuppressWarnings("unchecked") List<KeywordsType> keywords = serviceIdentification.getKeywords(); if (keywords != null) { for (KeywordsType k : keywords) { for (LanguageStringType s : (List<LanguageStringType>) k.getKeyword()) { kws.add(s.getValue()); } } kws.remove(null); } } return kws; }
/** @see ServiceInfo#getTitle() */ public String getTitle() { ServiceIdentificationType serviceIdentification = capabilities.getServiceIdentification(); if (serviceIdentification == null || serviceIdentification.getTitle() == null || serviceIdentification.getTitle().isEmpty()) { return null; } return ((LanguageStringType) serviceIdentification.getTitle().get(0)).getValue(); }
/** * Maps to the capabilities' service identification abstract * * @see ServiceInfo#getDescription() */ public String getDescription() { ServiceIdentificationType serviceIdentification = capabilities.getServiceIdentification(); if (serviceIdentification == null) { return null; } // The Abstract is of Type LanguageStringType, not String. StringBuilder sb = new StringBuilder(); for (Object line : serviceIdentification.getAbstract()) { if (line instanceof LanguageStringType) { sb.append(((LanguageStringType) line).getValue()); } else { sb.append(line); } } // end of for return sb.toString(); }
public static KeywordsType keywords(List<String> keywords) { if (keywords == null || keywords.size() == 0) { return null; } KeywordsType kw = f.createKeywordsType(); for (String keyword : keywords) { kw.getKeyword().add(languageString(keyword)); } return kw; }
/** @see ServiceInfo#getPublisher() */ public URI getPublisher() { ServiceProviderType serviceProvider = capabilities.getServiceProvider(); if (null == serviceProvider) { return null; } OnlineResourceType providerSite = serviceProvider.getProviderSite(); if (null == providerSite) { return null; } String href = providerSite.getHref(); try { return href == null ? null : new URI(href); } catch (URISyntaxException e) { return null; } }
/** * * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated modifiable */ public Object parse(InstanceComponent instance, Object value) throws Exception { Object result = null; if (value != null) { result = RangeClosureType.get(value.toString()); } return result; }
@Override public String encode(Object object, String value) throws Exception { return ((RangeClosureType) object).getLiteral(); } }
@Override public Object parse(String value) throws Exception { CodeType result = Ows11Factory.eINSTANCE.createCodeType(); result.setValue(value); return result; } }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public RangeClosureType createRangeClosureTypeFromString(EDataType eDataType, String initialValue) { RangeClosureType result = RangeClosureType.get(initialValue); if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); return result; }
public static CodeType code(Name name) { CodeType code = f.createCodeType(); // code.setCodeSpace(name.getNamespaceURI()); // code.setValue(name.getLocalPart()); code.setValue(name.getURI()); return code; }