private void handleOperation(String capabilityName, Map<String, List<String>> parameters) { AttributesImpl attributes = new AttributesImpl(); attributes.addAttribute(null, "name", "name", null, capabilityName); start("ows:Operation", attributes); start("ows:DCP"); start("ows:HTTP"); attributes = new AttributesImpl(); attributes.addAttribute("", "xlink:href", "xlink:href", "", url); element("ows:Get", null, attributes); end("ows:HTTP"); end("ows:DCP"); start("ows:DCP"); start("ows:HTTP"); element("ows:Post", null, attributes); end("ows:HTTP"); end("ows:DCP"); attributes = new AttributesImpl(); attributes.addAttribute("", "name", "name", "", param.getKey()); start("ows:Parameter", attributes); start("ows:AllowedValues"); for (String value : param.getValue()) { element("ows:Value", value); end("ows:AllowedValues"); end("ows:Parameter"); end("ows:Operation");
attributes.addAttribute( "", "updateSequence", "updateSequence", "", String.valueOf(updateSequence)); start("wcs:Capabilities", attributes); handleServiceIdentification(); if (allSections || sections.contains("ServiceProvider")) handleServiceProvider(); if (allSections || sections.contains("OperationsMetadata")) handleOperationsMetadata(); if (allSections || sections.contains("Contents")) handleContents(); end("wcs:Capabilities");
attributes.addAttribute("", "updateSequence", "updateSequence", "", String .valueOf(updateSequence)); start("wcs:Capabilities", attributes); handleServiceIdentification(); if (allSections || sections.contains("ServiceProvider")) handleServiceProvider(); if (allSections || sections.contains("OperationsMetadata")) handleOperationsMetadata(); if (allSections || sections.contains("Contents")) handleContents(); end("wcs:Capabilities");
AttributesImpl attributes = new AttributesImpl(); attributes.addAttribute(null, "name", "name", null, capabilityName); start("ows:Operation", attributes); start("ows:DCP"); start("ows:HTTP"); attributes = new AttributesImpl(); attributes.addAttribute("", "xlink:href", "xlink:href", "", url); element("ows:Get", null, attributes); end("ows:HTTP"); end("ows:DCP"); start("ows:DCP"); start("ows:HTTP"); element("ows:Post", null, attributes); end("ows:HTTP"); end("ows:DCP"); attributes = new AttributesImpl(); attributes.addAttribute("", "name", "name", "", param.getKey()); start("ows:Parameter", attributes); start("ows:AllowedValues"); for (String value : param.getValue()) { element("ows:Value", value); end("ows:AllowedValues"); end("ows:Parameter"); end("ows:Operation");
start("ows:ServiceContact"); elementIfNotEmpty("ows:IndividualName", gs.getContactPerson()); elementIfNotEmpty("ows:PositionName", gs.getContactPosition()); start("ows:ContactInfo"); start("ows:Phone"); elementIfNotEmpty("ows:Voice", gs.getContactVoice()); elementIfNotEmpty("ows:Facsimile", gs.getContactFacsimile()); end("ows:Phone"); start("ows:Address"); elementIfNotEmpty("ows:DeliveryPoint", gs.getAddress()); elementIfNotEmpty("ows:City", gs.getAddressCity()); elementIfNotEmpty("ows:AdministrativeArea", gs.getAddressState()); elementIfNotEmpty("ows:PostalCode", gs.getAddressPostalCode()); elementIfNotEmpty("ows:Country", gs.getAddressCountry()); elementIfNotEmpty("ows:ElectronicMailAddress", gs.getContactEmail()); end("ows:Address"); AttributesImpl attributes = new AttributesImpl(); attributes.addAttribute("", "xlink:href", "xlink:href", "", or); start("ows:OnlineResource", attributes); end("OnlineResource"); end("ows:ContactInfo"); end("ows:ServiceContact");
/** * Handles the OperationMetadata portion of the document, printing out * the operations and where to bind to them. * * @param config * The global wms. * * @throws SAXException * For any problems. */ private void handleOperationsMetadata() { start("ows:OperationsMetadata"); handleOperation("GetCapabilities", null); handleOperation("DescribeCoverage", null); handleOperation("GetCoverage", new HashMap<String, List<String>>() { { put("store", Arrays.asList("True", "False")); } }); // specify that we do support xml post encoding, clause 8.3.2.2 of // the WCS 1.1.1 spec AttributesImpl attributes = new AttributesImpl(); attributes.addAttribute(null, "name", "name", null, "PostEncoding"); start("ows:Constraint", attributes); start("ows:AllowedValues"); element("ows:Value", "XML"); end("ows:AllowedValues"); end("ows:Constraint"); end("ows:OperationsMetadata"); }
/** * Handles the OperationMetadata portion of the document, printing out the operations and * where to bind to them. * * @param config The global wms. * @throws SAXException For any problems. */ protected void handleOperationsMetadata() { start("ows:OperationsMetadata"); handleOperation("GetCapabilities", null); handleOperation("DescribeCoverage", null); handleOperation( "GetCoverage", new HashMap<String, List<String>>() { { put("store", Arrays.asList("True", "False")); } }); // specify that we do support xml post encoding, clause 8.3.2.2 of // the WCS 1.1.1 spec AttributesImpl attributes = new AttributesImpl(); attributes.addAttribute(null, "name", "name", null, "PostEncoding"); start("ows:Constraint", attributes); start("ows:AllowedValues"); element("ows:Value", "XML"); end("ows:AllowedValues"); end("ows:Constraint"); end("ows:OperationsMetadata"); }
start("ows:ServiceContact"); elementIfNotEmpty("ows:IndividualName", contact.getContactPerson()); elementIfNotEmpty("ows:PositionName", contact.getContactPosition()); start("ows:ContactInfo"); start("ows:Phone"); elementIfNotEmpty("ows:Voice", contact.getContactVoice()); elementIfNotEmpty("ows:Facsimile", contact.getContactFacsimile()); end("ows:Phone"); start("ows:Address"); elementIfNotEmpty("ows:DeliveryPoint", contact.getAddress()); elementIfNotEmpty("ows:City", contact.getAddressCity()); elementIfNotEmpty("ows:AdministrativeArea", contact.getAddressState()); elementIfNotEmpty("ows:PostalCode", contact.getAddressPostalCode()); elementIfNotEmpty("ows:Country", contact.getAddressCountry()); elementIfNotEmpty("ows:ElectronicMailAddress", contact.getContactEmail()); end("ows:Address"); AttributesImpl attributes = new AttributesImpl(); attributes.addAttribute("", "xlink:href", "xlink:href", "", or); start("ows:OnlineResource", attributes); end("OnlineResource"); end("ows:ContactInfo"); end("ows:ServiceContact");
/** * Handles the service identification of the capabilities document. * * @param config The OGC service to transform. * @throws SAXException For any errors. */ protected void handleServiceIdentification() { start("ows:ServiceIdentification"); element("ows:Title", wcs.getTitle()); element("ows:Abstract", wcs.getAbstract()); handleKeywords(wcs.getKeywords()); element("ows:ServiceType", "WCS"); element("ows:ServiceTypeVersion", "1.1.0"); element("ows:ServiceTypeVersion", "1.1.1"); String fees = wcs.getFees(); if ((fees == null) || "".equals(fees)) { fees = "NONE"; } element("ows:Fees", fees); String accessConstraints = wcs.getAccessConstraints(); if ((accessConstraints == null) || "".equals(accessConstraints)) { accessConstraints = "NONE"; } element("ows:AccessConstraints", accessConstraints); end("ows:ServiceIdentification"); }
/** * Handles the service identification of the capabilities document. * * @param config * The OGC service to transform. * * @throws SAXException * For any errors. */ private void handleServiceIdentification() { start("ows:ServiceIdentification"); element("ows:Title", wcs.getTitle()); element("ows:Abstract", wcs.getAbstract()); handleKeywords(wcs.getKeywords()); element("ows:ServiceType", "WCS"); element("ows:ServiceTypeVersion", "1.1.0"); element("ows:ServiceTypeVersion", "1.1.1"); String fees = wcs.getFees(); if ((fees == null) || "".equals(fees)) { fees = "NONE"; } element("ows:Fees", fees); String accessConstraints = wcs.getAccessConstraints(); if ((accessConstraints == null) || "".equals(accessConstraints)) { accessConstraints = "NONE"; } element("ows:AccessConstraints", accessConstraints); end("ows:ServiceIdentification"); }
/** * Handles the service provider of the capabilities document. * * @param config The OGC service to transform. * @throws SAXException For any errors. */ protected void handleServiceProvider() { start("ows:ServiceProvider"); SettingsInfo settings = wcs.getGeoServer().getSettings(); element("ows:ProviderName", settings.getContact().getContactOrganization()); AttributesImpl attributes = new AttributesImpl(); attributes.addAttribute( "", "xlink:href", "xlink:href", "", settings.getOnlineResource() != null ? settings.getOnlineResource() : ""); element("ows:ProviderSite", null, attributes); handleContact(); end("ows:ServiceProvider"); }
protected void handleMetadataLink(MetadataLinkInfo mdl, String linkType) { AttributesImpl attributes = new AttributesImpl(); if ((mdl.getAbout() != null) && (mdl.getAbout() != "")) { attributes.addAttribute("", "about", "about", "", mdl.getAbout()); } if ((linkType != null) && (linkType != "")) { attributes.addAttribute("", "xlink:type", "xlink:type", "", linkType); } if ((mdl.getContent() != null) && (mdl.getContent() != "")) { attributes.addAttribute( "", "xlink:href", "xlink:href", "", ResponseUtils.proxifyMetadataLink(mdl, request.getBaseUrl())); element("ows:Metadata", null, attributes); } }
/** * DOCUMENT ME! * * @param kwords * DOCUMENT ME! * * @throws SAXException * DOCUMENT ME! */ private void handleKeywords(List kwords) { start("ows:Keywords"); if (kwords != null) { for (Iterator it = kwords.iterator(); it.hasNext();) { element("ows:Keyword", it.next().toString()); } } end("ows:Keywords"); }
/** * Handles the service provider of the capabilities document. * * @param config * The OGC service to transform. * * @throws SAXException * For any errors. */ private void handleServiceProvider() { start("ows:ServiceProvider"); element("ows:ProviderName", wcs.getGeoServer().getContactOrganization()); AttributesImpl attributes = new AttributesImpl(); attributes.addAttribute("", "xlink:href", "xlink:href", "", wcs.getGeoServer() .getOnlineResource()); element("ows:ProviderSite", null, attributes); handleContact(); end("ows:ServiceProvider"); }
/** * DOCUMENT ME! * * @param kwords DOCUMENT ME! * @throws SAXException DOCUMENT ME! */ protected void handleKeywords(List kwords) { if (kwords != null && kwords.size() > 0) { start("ows:Keywords"); if (kwords != null) { for (Iterator it = kwords.iterator(); it.hasNext(); ) { element("ows:Keyword", it.next().toString()); } } end("ows:Keywords"); } }
protected void handleEnvelope(ReferencedEnvelope envelope) { start("ows:WGS84BoundingBox"); element( "ows:LowerCorner", new StringBuffer(Double.toString(envelope.getLowerCorner().getOrdinate(0))) .append(" ") .append(envelope.getLowerCorner().getOrdinate(1)) .toString()); element( "ows:UpperCorner", new StringBuffer(Double.toString(envelope.getUpperCorner().getOrdinate(0))) .append(" ") .append(envelope.getUpperCorner().getOrdinate(1)) .toString()); end("ows:WGS84BoundingBox"); }
public Translator createTranslator(ContentHandler handler) { return new WCS111CapsTranslator(handler); }
private void handleMetadataLink(MetaDataLink mdl, String linkType) { if (mdl != null) { AttributesImpl attributes = new AttributesImpl(); if ((mdl.getAbout() != null) && (mdl.getAbout() != "")) { attributes.addAttribute("", "about", "about", "", mdl.getAbout()); } if ((mdl.getMetadataType() != null) && (mdl.getMetadataType() != "")) { attributes.addAttribute("", "xlink:type", "xlink:type", "", linkType); } if (attributes.getLength() > 0) { element("ows:Metadata", null, attributes); } } }
/** * Writes the element if and only if the content is not null and not empty * * @param elementName * @param content */ protected void elementIfNotEmpty(String elementName, String content) { if (content != null && !"".equals(content.trim())) element(elementName, content); } }