当前位置: 首页>>代码示例>>C#>>正文


C# Configure.ToString方法代码示例

本文整理汇总了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;
        }
开发者ID:ndd305,项目名称:gsrcc,代码行数:44,代码来源:RestClient.cs

示例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();
            }
        }
开发者ID:ndd305,项目名称:gsrcc,代码行数:41,代码来源:RestClient.cs


注:本文中的Configure.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。