📄 capabilitiestransformer.java
字号:
end("Request");
end("Capability");
}
/**
* Encodes the wfs:GetCapabilities elemnt.
* <p>
*
* <pre>
* <xsd:complexType name="GetCapabilitiesType">
* <xsd:sequence>
* <xsd:element name="DCPType" type="wfs:DCPTypeType" maxOccurs="unbounded"/>
* </xsd:sequence>
* </xsd:complexType>
* </pre>
*
* </p>
*/
private void handleGetCapabilities() {
String capName = "GetCapabilities";
start(capName);
handleDcpType(capName, HTTP_GET);
handleDcpType(capName, HTTP_POST);
end(capName);
}
/**
* Encodes the wfs:DescribeFeatureType element.
* <p>
* <pre>
* <xsd:complexType name="DescribeFeatureTypeType">
* <xsd:sequence>
* <xsd:element name="SchemaDescriptionLanguage"
* type="wfs:SchemaDescriptionLanguageType"/>
* <xsd:element name="DCPType"
* type="wfs:DCPTypeType" maxOccurs="unbounded"/>
* </xsd:sequence>
* </xsd:complexType>
* </pre>
* </p>
*/
private void handleDescribeFT() {
String capName = "DescribeFeatureType";
start(capName);
start("SchemaDescriptionLanguage");
element("XMLSCHEMA", null);
end("SchemaDescriptionLanguage");
handleDcpType(capName, HTTP_GET);
handleDcpType(capName, HTTP_POST);
end(capName);
}
/**
* Encodes the wfs:GetFeature element.
*
* <xsd:complexType name="GetFeatureTypeType">
* <xsd:sequence>
* <xsd:element name="ResultFormat" type="wfs:ResultFormatType"/>
* <xsd:element name="DCPType" type="wfs:DCPTypeType" maxOccurs="unbounded"/>
* </xsd:sequence>
* </xsd:complexType>
*/
private void handleGetFeature() {
String capName = "GetFeature";
start(capName);
String resultFormat = "ResultFormat";
start(resultFormat);
//we accept numerous formats, but cite only allows you to have GML2
if (wfs.getCiteConformanceHacks()) {
element("GML2", null);
} else {
//FULL MONTY
Collection featureProducers = GeoServerExtensions.extensions(WFSGetFeatureOutputFormat.class);
Map dupes = new HashMap();
for (Iterator i = featureProducers.iterator(); i.hasNext();) {
WFSGetFeatureOutputFormat format = (WFSGetFeatureOutputFormat) i.next();
if (!dupes.containsKey(format.getCapabilitiesElementName())) {
element(format.getCapabilitiesElementName(), null);
dupes.put(format.getCapabilitiesElementName(), new Object());
}
}
}
end(resultFormat);
handleDcpType(capName, HTTP_GET);
handleDcpType(capName, HTTP_POST);
end(capName);
}
/**
* Encodes the wfs:Transaction element.
* <p>
* <pre>
* <xsd:complexType name="TransactionType">
* <xsd:sequence>
* <xsd:element name="DCPType" type="wfs:DCPTypeType" maxOccurs="unbounded"/>
* </xsd:sequence>
* </xsd:complexType>
* </pre>
* </p>
*/
private void handleTransaction() {
String capName = "Transaction";
start(capName);
handleDcpType(capName, HTTP_GET);
handleDcpType(capName, HTTP_POST);
end(capName);
}
/**
* Encodes the wfs:LockFeature element.
* <p>
* <pre>
* <xsd:complexType name="LockFeatureTypeType">
* <xsd:sequence>
* <xsd:element name="DCPType" type="wfs:DCPTypeType" maxOccurs="unbounded"/>
* </xsd:sequence>
* </xsd:complexType>
* </pre>
* </p>
*/
private void handleLock() {
String capName = "LockFeature";
start(capName);
handleDcpType(capName, HTTP_GET);
handleDcpType(capName, HTTP_POST);
end(capName);
}
/**
* Encodes the wfs:GetFeatureWithLock element.
*
* <xsd:complexType name="GetFeatureTypeType">
* <xsd:sequence>
* <xsd:element name="ResultFormat" type="wfs:ResultFormatType"/>
* <xsd:element name="DCPType" type="wfs:DCPTypeType" maxOccurs="unbounded"/>
* </xsd:sequence>
* </xsd:complexType>
*/
private void handleFeatureWithLock() {
String capName = "GetFeatureWithLock";
start(capName);
start("ResultFormat");
//TODO: output format extensions
element("GML2", null);
end("ResultFormat");
handleDcpType(capName, HTTP_GET);
handleDcpType(capName, HTTP_POST);
end(capName);
}
/**
* Encodes a <code>DCPType</code> element.
* <p>
* <pre>
* <!-- Available Distributed Computing Platforms (DCPs) are
* listed here. At present, only HTTP is defined. -->
* <xsd:complexType name="DCPTypeType">
* <xsd:sequence>
* <xsd:element name="HTTP" type="wfs:HTTPType"/>
* </xsd:sequence>
* </xsd:complexType>
*
* </pre>
* </p>
* @param capabilityName the URL of the onlineresource for HTTP GET
* method requests
* @param httpMethod the URL of the onlineresource for HTTP POST method
* requests
*/
private void handleDcpType(String capabilityName, String httpMethod) {
String proxifiedBaseUrl = RequestUtils.proxifiedBaseURL(request.getBaseUrl(), wfs.getGeoServer().getProxyBaseUrl());
if (proxifiedBaseUrl.endsWith("?")) {
proxifiedBaseUrl = proxifiedBaseUrl.substring(0, proxifiedBaseUrl.length() - 1);
}
if (HTTP_GET.equals(httpMethod)) {
proxifiedBaseUrl = ResponseUtils.appendPath(proxifiedBaseUrl, "wfs?request=" + capabilityName);
} else if (HTTP_POST.equals(httpMethod)) {
proxifiedBaseUrl = ResponseUtils.appendPath(proxifiedBaseUrl, "wfs?");
}
start("DCPType");
start("HTTP");
AttributesImpl atts = new AttributesImpl();
atts.addAttribute("", "onlineResource", "onlineResource", "", proxifiedBaseUrl);
element(httpMethod, null, atts);
end("HTTP");
end("DCPType");
}
/**
* Encodes the wfs:FeatureTYpeList element.
* <p>
* <pre>
* <xsd:complexType name="FeatureTypeListType">
* <xsd:sequence>
* <xsd:element name="Operations"
* type="wfs:OperationsType" minOccurs="0"/>
* <xsd:element name="FeatureType"
* type="wfs:FeatureTypeType" maxOccurs="unbounded"/>
* </xsd:sequence>
* </xsd:complexType>
* </pre>
* </p>
*/
private void handleFeatureTypes() {
if (!wfs.isEnabled()) {
// should we return anything if we are disabled?
}
start("FeatureTypeList");
start("Operations");
if ((wfs.getServiceLevel() | WFS.SERVICE_BASIC) != 0) {
element("Query", null);
}
if ((wfs.getServiceLevel() | WFS.SERVICE_INSERT) != 0) {
element("Insert", null);
}
if ((wfs.getServiceLevel() | WFS.SERVICE_UPDATE) != 0) {
element("Update", null);
}
if ((wfs.getServiceLevel() | WFS.SERVICE_DELETE) != 0) {
element("Delete", null);
}
if ((wfs.getServiceLevel() | WFS.SERVICE_LOCKING) != 0) {
element("Lock", null);
}
end("Operations");
List featureTypes = new ArrayList(catalog.getFeatureTypeInfos().values());
Collections.sort(featureTypes, new FeatureTypeInfoTitleComparator());
for (Iterator it = featureTypes.iterator(); it.hasNext();) {
FeatureTypeInfo ftype = (FeatureTypeInfo) it.next();
//can't handle ones that aren't enabled.
//and they shouldn't be handled, as they won't function.
//JD: deal with this
//if (ftype.isEnabled()) {
handleFeatureType(ftype);
//}
}
end("FeatureTypeList");
}
/**
* Default handle of a FeatureTypeInfo content that writes the
* latLongBBox as well as the GlobalBasic's parameters
*
* <p>
* <pre>
* <xsd:complexType name="FeatureTypeType">
* <xsd:sequence>
* <xsd:element name="Name" type="xsd:QName"/>
* <xsd:element ref="wfs:Title" minOccurs="0"/>
* <xsd:element ref="wfs:Abstract" minOccurs="0"/>
* <xsd:element ref="wfs:Keywords" minOccurs="0"/>
* <xsd:element ref="wfs:SRS"/>
* <xsd:element name="Operations"
* type="wfs:OperationsType" minOccurs="0"/>
* <xsd:element name="LatLongBoundingBox"
* type="wfs:LatLongBoundingBoxType"
* minOccurs="0" maxOccurs="unbounded"/>
* <xsd:element name="MetadataURL"
* type="wfs:MetadataURLType"
* minOccurs="0" maxOccurs="unbounded"/>
* </xsd:sequence>
* </xsd:complexType>
* </pre>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -