本文整理汇总了C#中Configure.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Configure.ToString方法的具体用法?C# Configure.ToString怎么用?C# Configure.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Configure
的用法示例。
在下文中一共展示了Configure.ToString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: createDatastoreShapefile
/**
* − <dataStore> <name>xxx</name> <description>xxx</description> <type>Shapefile</type> <enabled>true</enabled> −
* <workspace> <name>ws</name> <atom:link rel="alternate"
* href="http://localhost:8085/geoserver/rest/workspaces/ws.xml" type="application/xml"/> </workspace> −
* <connectionParameters> <entry key="memory mapped buffer">true</entry> <entry
* key="create spatial index">true</entry> <entry key="charset">ISO-8859-1</entry> <entry
* key="url">file:data/ad2/soils.shp</entry> <entry key="namespace">http://ws</entry> </connectionParameters> −
* <featureTypes> <atom:link rel="alternate" href=
* "http://localhost:8085/geoserver/rest/workspaces/ws/datastores/xxx/featuretypes.xml" type="application/xml"/>
* </featureTypes> </dataStore>
*/
/**
* This method does not upload a shapefile via zip. It rather creates a reference to a Shapefile that has already
* exists in the GS data directory.
*
* @param charset
* defaults to UTF-8 if not set. Charset, that any text content is stored in.
*
* @param relpath
* A path to the file, relative to gsdata dir, e.g. "file:data/water.shp"
*/
public Boolean createDatastoreShapefile(String workspace, String dsName, String dsNamespace, String relpath,
String charset, Boolean memoryMappedBuffer, Boolean createSpatialIndex, Configure autoConfig)
{
if (autoConfig == Configure.first)
autoConfig = Configure.empty;
if (relpath == null)
throw new Exception("parameter relpath may not be null");
String createSpatialIndexParam = RestUtil.entryKey("create spatial index", createSpatialIndex);
String memoryMappedBufferParamter = RestUtil.entryKey("memory mapped buffer", memoryMappedBuffer);
String charsetParamter = "<entry key=\"charset\">" + (charset == null ? "UTF-8" : charset) + "</entry>";
String urlParamter = "<entry key=\"url\">" + relpath + "</entry>";
String namespaceParamter = "<entry key=\"namespace\">" + dsName + "</entry>";
String typeParamter = "<type>Shapefile</type>";
String xml = "<dataStore><name>" + dsName + "</name><enabled>true</enabled>" + typeParamter
+ "<connectionParameters>" + createSpatialIndexParam + memoryMappedBufferParamter + charsetParamter
+ urlParamter + namespaceParamter + typeParamter + "</connectionParameters></dataStore>";
String configureParam = autoConfig == Configure.empty ? "" : "?configure=" + autoConfig.ToString();
int returnCode = sendRESTint(METHOD_POST, "/workspaces/" + workspace + "/datastores.xml" + configureParam, xml);
return 201 == returnCode;
}
示例2: createCoverageGeoTiff
/**
* This method does not upload a shapefile via zip. It rather creates a reference to a Shapefile that has already
* exists in the GS data directory. <br/>
*
* TODO: This is buggy and always puts the coveragestore in the default workspace. Therefore we set the default
* workspace defore every command, and reset it afterwards. This will change the default workspace for a moment!
*
* @param relpath
* A path to the file, relative to gsdata dir, e.g. "file:data/water.shp"
*/
public Boolean createCoverageGeoTiff(String wsName, String csName, String csNamespace, String relpath, Configure autoConfig)
{
String oldDefault = getDefaultWs();
try {
setDefaultWs(wsName);
if (relpath == null)
throw new Exception("parameter relpath may not be null");
if (autoConfig == Configure.empty)
autoConfig = Configure.first;
String urlParamter = "<url>" + relpath + "</url>";
// String namespaceParamter = "<entry key=\"namespace\">" + dsName
// + "</entry>";
String typeParamter = "<type>GeoTIFF</type>";
String xml = "<coverageStore><name>" + csName + "</name><enabled>true</enabled>" + typeParamter
+ urlParamter + "</coverageStore>";
int returnCode = sendRESTint(METHOD_POST, "/workspaces/" + wsName + "/coveragestores?configure="
+ autoConfig.ToString(), xml);
return 201 == returnCode;
} catch (IOException e) {
setDefaultWs(oldDefault);
throw e;
} finally {
reload();
}
}