• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java GeoServerRESTPublisher类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中it.geosolutions.geoserver.rest.GeoServerRESTPublisher的典型用法代码示例。如果您正苦于以下问题:Java GeoServerRESTPublisher类的具体用法?Java GeoServerRESTPublisher怎么用?Java GeoServerRESTPublisher使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



GeoServerRESTPublisher类属于it.geosolutions.geoserver.rest包,在下文中一共展示了GeoServerRESTPublisher类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: deleteStyle

import it.geosolutions.geoserver.rest.GeoServerRESTPublisher; //导入依赖的package包/类
/**
 * Delete style.
 *
 * @param styleToDelete the style to delete
 * @return true, if successful
 */
@Override
public boolean deleteStyle(StyleWrapper styleToDelete) {
    if (styleToDelete == null) {
        return false;
    }

    boolean result = false;
    GeoServerRESTManager manager = GeoServerRESTManagerFactory.getManager(connection);
    GeoServerRESTPublisher publisher = manager.getPublisher();

    if (publisher != null) {
        if (isDefaultWorkspace(styleToDelete.getWorkspace())) {
            result = publisher.removeStyle(styleToDelete.getStyle());
        } else {
            result = publisher.removeStyleInWorkspace(styleToDelete.getWorkspace(),
                    styleToDelete.getStyle());
        }
    }

    return result;
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:28,代码来源:GeoServerClient.java


示例2: deleteWorkspace

import it.geosolutions.geoserver.rest.GeoServerRESTPublisher; //导入依赖的package包/类
/**
 * Delete workspace.
 *
 * @param workspaceName the workspace name
 * @return true, if successful
 */
@Override
public boolean deleteWorkspace(String workspaceName) {
    if (workspaceName == null) {
        return false;
    }

    boolean result = false;
    GeoServerRESTManager manager = GeoServerRESTManagerFactory.getManager(connection);
    GeoServerRESTPublisher publisher = manager.getPublisher();

    if (publisher != null) {
        if (isDefaultWorkspace(workspaceName)) {
            ConsoleManager.getInstance().error(this, Localisation.getString(
                    GeoServerClient.class, "GeoServerClient.cannotDeleteDefaultWorkspace"));
        } else {
            result = publisher.removeWorkspace(workspaceName, false);
        }
    }

    return result;
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:28,代码来源:GeoServerClient.java


示例3: publish

import it.geosolutions.geoserver.rest.GeoServerRESTPublisher; //导入依赖的package包/类
@CliCommand(value = "shapefile publish", help = "Publish a shapefile.")
public boolean publish(
        @CliOption(key = "workspace", mandatory = true, help = "The workspace") String workspace,
        @CliOption(key = "datastore", mandatory = false, help = "The datastore") String datastore,
        @CliOption(key = "layer", mandatory = false, help = "The layer name") String layer,
        @CliOption(key = "file", mandatory = true, help = "The zipped shapefile") File file,
        @CliOption(key = "srs", mandatory = false, unspecifiedDefaultValue = "EPSG:4326", help = "The EPSG srs code") String srs,
        @CliOption(key = "style", mandatory = false, help = "The style") String style
) throws Exception {
    String baseName = file.getName().substring(0, file.getName().lastIndexOf(".zip"));
    if (datastore == null) {
        datastore = baseName;
    }
    if (layer == null) {
        layer = baseName;
    }
    GeoServerRESTPublisher publisher = new GeoServerRESTPublisher(geoserver.getUrl(), geoserver.getUser(), geoserver.getPassword());
    return publisher.publishShp(workspace, datastore, layer, file, srs, style);
}
 
开发者ID:jericks,项目名称:geoserver-shell,代码行数:20,代码来源:ShapefileCommands.java


示例4: publishWorkspace

import it.geosolutions.geoserver.rest.GeoServerRESTPublisher; //导入依赖的package包/类
public void publishWorkspace()
{
  try
  {
    GeoServerRESTPublisher publisher = GeoserverProperties.getPublisher();
    
    // IMPORTANT: The URI must match the namespace of the store or rendering doesn't work
    if (publisher.createWorkspace(GeoserverProperties.getWorkspace(), new URI(GeoserverProperties.getWorkspace())))
    {
      log.info("Created the workspace [" + GeoserverProperties.getWorkspace() + "].");
    }
    else
    {
      log.warn("Failed to create the workspace [" + GeoserverProperties.getWorkspace() + "].");
    }
  }
  catch (URISyntaxException e)
  {
    throw new ConfigurationException("The URI [" + GeoserverProperties.getWorkspace() + "] is invalid.", e);
  }
}
 
开发者ID:terraframe,项目名称:geoprism,代码行数:22,代码来源:GeoserverRestService.java


示例5: publishStyle

import it.geosolutions.geoserver.rest.GeoServerRESTPublisher; //导入依赖的package包/类
public boolean publishStyle(String styleName, String body, boolean force)
{
  GeoServerRESTPublisher publisher = GeoserverProperties.getPublisher();

  if (force && styleExists(styleName))
  {
    publisher.removeStyle(styleName, true);
  }

  if (publisher.publishStyle(body, styleName, true))
  {
    log.info("Published the SLD [" + styleName + "].");
    return true;
  }
  else
  {
    log.warn("Failed to publish the SLD [" + styleName + "].");
    return false;
  }
}
 
开发者ID:terraframe,项目名称:geoprism,代码行数:21,代码来源:GeoserverRestService.java


示例6: removeLayer

import it.geosolutions.geoserver.rest.GeoServerRESTPublisher; //导入依赖的package包/类
/**
 * Removes the layer from geoserver.
 * 
 * @param layer
 * @return
 */
public void removeLayer(String layer)
{
  if (GeoserverFacade.layerExists(layer))
  {
    String workspace = GeoserverProperties.getWorkspace();
    GeoServerRESTPublisher publisher = GeoserverProperties.getPublisher();

    if (publisher.removeLayer(workspace, layer))
    {
      log.info("Removed the layer for [" + layer + "].");
    }
    else
    {
      log.warn("Failed to remove the layer for [" + layer + "].");
    }
  }
}
 
开发者ID:terraframe,项目名称:geoprism,代码行数:24,代码来源:GeoserverRestService.java


示例7: reset

import it.geosolutions.geoserver.rest.GeoServerRESTPublisher; //导入依赖的package包/类
@CliCommand(value = "geoserver reset", help = "Reset Geoserver's configuration.")
public boolean reset() {
    GeoServerRESTPublisher publisher = new GeoServerRESTPublisher(geoserver.getUrl(), geoserver.getUser(), geoserver.getPassword());
    return publisher.reset();
}
 
开发者ID:jericks,项目名称:geoserver-shell,代码行数:6,代码来源:GeoserverCommands.java


示例8: updateLayerStyles

import it.geosolutions.geoserver.rest.GeoServerRESTPublisher; //导入依赖的package包/类
/**
 * Update layer styles.
 *
 * @param layer the original layer
 * @return true, if successful
 */
@Override
public boolean updateLayerStyles(GeoServerLayer layer) {
    if (layer == null) {
        return false;
    }

    StyleWrapper updatedStyle = layer.getStyle();

    boolean ok = false;
    GeoServerRESTManager manager = GeoServerRESTManagerFactory.getManager(connection);
    GeoServerRESTPublisher publisher = manager.getPublisher();

    if (publisher != null) {
        GSLayerEncoder layerEncoder = new GSLayerEncoder();

        String defaultStyle;
        if (isDefaultWorkspace(updatedStyle.getWorkspace())) {
            defaultStyle = updatedStyle.getStyle();
        } else {
            defaultStyle = updatedStyle.getWorkspace() + ":" + updatedStyle.getStyle();
        }
        layerEncoder.setDefaultStyle(defaultStyle);
        ok = publisher.configureLayer(layer.getLayerWorkspace(), layer.getLayerName(),
                layerEncoder);
    }

    return ok;
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:35,代码来源:GeoServerClient.java


示例9: publishFromDB

import it.geosolutions.geoserver.rest.GeoServerRESTPublisher; //导入依赖的package包/类
@Override
public boolean publishFromDB(String tableName, String srs) {
    GeoServerRESTPublisher publisher = new GeoServerRESTPublisher(GEOSERVER_URL, GEOSERVER_USERNAME, GEOSERVER_PASS);

    GSLayerEncoder layerEncoder = new GSLayerEncoder();
    layerEncoder.setEnabled(true);
    layerEncoder.setQueryable(true);
    layerEncoder.setDefaultStyle(GEOSERVER_DEFAULT_STYLE);

    GSFeatureTypeEncoder featureTypeEncoder = new GSFeatureTypeEncoder();
    featureTypeEncoder.setSRS((srs == null) ? GEOSERVER_DEFAULT_SRS : srs);
    featureTypeEncoder.setName(tableName);

    return publisher.publishDBLayer(GEOSERVER_DEFAULT_WS, GEOSERVER_DEFAULT_STORAGE, featureTypeEncoder, layerEncoder);
}
 
开发者ID:VKrava,项目名称:postgis-geoserver-connector,代码行数:16,代码来源:GeoserverPublisher.java


示例10: delete

import it.geosolutions.geoserver.rest.GeoServerRESTPublisher; //导入依赖的package包/类
@CliCommand(value = "style delete", help = "Delete a style.")
public boolean delete(
        @CliOption(key = "name", mandatory = true, help = "The name") String name,
        @CliOption(key = "workspace", mandatory = false, help = "The workspace") String workspace,
        @CliOption(key = "purge", mandatory = false, help = "Whether to delete the SLD File from the server or not", unspecifiedDefaultValue = "false") boolean purge
) throws Exception {
    GeoServerRESTPublisher publisher = new GeoServerRESTPublisher(geoserver.getUrl(), geoserver.getUser(), geoserver.getPassword());
    if (workspace == null) {
        return publisher.removeStyle(name, purge);
    } else {
        return removeStyle(name, workspace, purge);
    }
}
 
开发者ID:jericks,项目名称:geoserver-shell,代码行数:14,代码来源:StyleCommands.java


示例11: create

import it.geosolutions.geoserver.rest.GeoServerRESTPublisher; //导入依赖的package包/类
@CliCommand(value = "style create", help = "Create a style.")
public boolean create(
        @CliOption(key = "name", mandatory = true, help = "The name") String name,
        @CliOption(key = "workspace", mandatory = false, help = "The workspace") String workspace,
        @CliOption(key = "file", mandatory = true, help = "The SLD File") File sldFile
) throws Exception {
    GeoServerRESTPublisher publisher = new GeoServerRESTPublisher(geoserver.getUrl(), geoserver.getUser(), geoserver.getPassword());
    if (workspace == null) {
        return publisher.publishStyle(sldFile, name);
    } else {
        return publishStyle(sldFile, name, workspace);
    }
}
 
开发者ID:jericks,项目名称:geoserver-shell,代码行数:14,代码来源:StyleCommands.java


示例12: modify

import it.geosolutions.geoserver.rest.GeoServerRESTPublisher; //导入依赖的package包/类
@CliCommand(value = "style modify", help = "Update a style.")
public boolean modify(
        @CliOption(key = "name", mandatory = true, help = "The name") String name,
        @CliOption(key = "workspace", mandatory = false, help = "The workspace") String workspace,
        @CliOption(key = "file", mandatory = true, help = "The SLD File") File sldFile
) throws Exception {
    GeoServerRESTPublisher publisher = new GeoServerRESTPublisher(geoserver.getUrl(), geoserver.getUser(), geoserver.getPassword());
    if (workspace == null) {
        return publisher.updateStyle(sldFile, name);
    } else {
        return updateStyle(sldFile, name, workspace);
    }
}
 
开发者ID:jericks,项目名称:geoserver-shell,代码行数:14,代码来源:StyleCommands.java


示例13: backup

import it.geosolutions.geoserver.rest.GeoServerRESTPublisher; //导入依赖的package包/类
@CliCommand(value = "geoserver backup", help = "Backup Geoserver's configuration.")
public boolean backup(
        @CliOption(key = "directory", mandatory = true, help = "The backup ") String backupDir,
        @CliOption(key = "includedata", mandatory = false, unspecifiedDefaultValue = "false", help = "The include data flag") boolean includeData,
        @CliOption(key = "includegwc", mandatory = false, unspecifiedDefaultValue = "false", help = "The include GWC flag") boolean includeGwc,
        @CliOption(key = "includelog", mandatory = false, unspecifiedDefaultValue = "false", help = "The include log files flag") boolean includeLog
) {
    GeoServerRESTPublisher publisher = new GeoServerRESTPublisher(geoserver.getUrl(), geoserver.getUser(), geoserver.getPassword());
    String result = publisher.backup(backupDir, includeData, includeGwc, includeLog);
    return result != null;
}
 
开发者ID:jericks,项目名称:geoserver-shell,代码行数:12,代码来源:GeoserverCommands.java


示例14: restore

import it.geosolutions.geoserver.rest.GeoServerRESTPublisher; //导入依赖的package包/类
@CliCommand(value = "geoserver restore", help = "Restore Geoserver's configuration from a backup directory.")
public boolean restore(
        @CliOption(key = "directory", mandatory = true, help = "The backup ") String backupDir
) {
    GeoServerRESTPublisher publisher = new GeoServerRESTPublisher(geoserver.getUrl(), geoserver.getUser(), geoserver.getPassword());
    String result = publisher.restore(backupDir);
    return result != null;
}
 
开发者ID:jericks,项目名称:geoserver-shell,代码行数:9,代码来源:GeoserverCommands.java


示例15: create

import it.geosolutions.geoserver.rest.GeoServerRESTPublisher; //导入依赖的package包/类
@CliCommand(value = "workspace create", help = "Create a workspace.")
public boolean create(
        @CliOption(key = "name", mandatory = true, help = "The name") String name
) throws Exception {
    GeoServerRESTPublisher publisher = new GeoServerRESTPublisher(geoserver.getUrl(), geoserver.getUser(), geoserver.getPassword());
    return publisher.createWorkspace(name);
}
 
开发者ID:jericks,项目名称:geoserver-shell,代码行数:8,代码来源:WorkspaceCommands.java


示例16: delete

import it.geosolutions.geoserver.rest.GeoServerRESTPublisher; //导入依赖的package包/类
@CliCommand(value = "workspace delete", help = "Delete a workspace.")
public boolean delete(
        @CliOption(key = "name", mandatory = true, help = "The name") String name,
        @CliOption(key = "recurse", mandatory = false, unspecifiedDefaultValue = "false", help = "Whether to delete recursively") boolean recurse) {
    GeoServerRESTPublisher publisher = new GeoServerRESTPublisher(geoserver.getUrl(), geoserver.getUser(), geoserver.getPassword());
    return publisher.removeWorkspace(name, recurse);
}
 
开发者ID:jericks,项目名称:geoserver-shell,代码行数:8,代码来源:WorkspaceCommands.java


示例17: create

import it.geosolutions.geoserver.rest.GeoServerRESTPublisher; //导入依赖的package包/类
@CliCommand(value = "namespace create", help = "Create a namespace.")
public boolean create(
        @CliOption(key = "prefix", mandatory = true, help = "The prefix") String prefix,
        @CliOption(key = "uri", mandatory = true, help = "The uri") String uri) throws Exception {
    GeoServerRESTPublisher publisher = new GeoServerRESTPublisher(geoserver.getUrl(), geoserver.getUser(), geoserver.getPassword());
    return publisher.createNamespace(prefix, URI.create(uri));
}
 
开发者ID:jericks,项目名称:geoserver-shell,代码行数:8,代码来源:NamespaceCommands.java


示例18: update

import it.geosolutions.geoserver.rest.GeoServerRESTPublisher; //导入依赖的package包/类
@CliCommand(value = "namespace modify", help = "Modify a namespace.")
public boolean update(
        @CliOption(key = "prefix", mandatory = true, help = "The prefix") String prefix,
        @CliOption(key = "uri", mandatory = true, help = "The uri") String uri) throws Exception {
    GeoServerRESTPublisher publisher = new GeoServerRESTPublisher(geoserver.getUrl(), geoserver.getUser(), geoserver.getPassword());
    return publisher.updateNamespace(prefix, URI.create(uri));
}
 
开发者ID:jericks,项目名称:geoserver-shell,代码行数:8,代码来源:NamespaceCommands.java


示例19: delete

import it.geosolutions.geoserver.rest.GeoServerRESTPublisher; //导入依赖的package包/类
@CliCommand(value = "namespace delete", help = "Delete a namespace.")
public boolean delete(
        @CliOption(key = "prefix", mandatory = true, help = "The prefix") String prefix,
        @CliOption(key = "recurse", mandatory = false, unspecifiedDefaultValue = "false", help = "Whether to delete recursively") boolean recurse) {
    GeoServerRESTPublisher publisher = new GeoServerRESTPublisher(geoserver.getUrl(), geoserver.getUser(), geoserver.getPassword());
    return publisher.removeNamespace(prefix, recurse);
}
 
开发者ID:jericks,项目名称:geoserver-shell,代码行数:8,代码来源:NamespaceCommands.java


示例20: uploadSLD

import it.geosolutions.geoserver.rest.GeoServerRESTPublisher; //导入依赖的package包/类
/**
 * Upload sld.
 *
 * @param styleWrapper the style wrapper
 * @param sldBody the sld body
 * @return true, if successful
 */
@Override
public boolean uploadSLD(StyleWrapper styleWrapper, String sldBody) {
    String workspaceName = styleWrapper.getWorkspace();
    String styleName = styleWrapper.getStyle();

    if (!workspaceValid(workspaceName)) {
        return false;
    }

    boolean result = false;
    GeoServerRESTManager manager = GeoServerRESTManagerFactory.getManager(connection);
    GeoServerRESTPublisher publisher = manager.getPublisher();

    if (publisher != null) {
        if (styleExists(workspaceName, styleName)) {
            if (isDefaultWorkspace(workspaceName)) {
                result = publisher.updateStyle(sldBody, styleName, true);
            } else {
                result = publisher.updateStyleInWorkspace(workspaceName, sldBody, styleName);
            }
        } else {
            if (isDefaultWorkspace(workspaceName)) {
                result = publisher.publishStyle(sldBody, styleName, true);
            } else {
                GeoServerRESTReader reader = manager.getReader();

                if (reader != null) {
                    if (!reader.existsWorkspace(workspaceName)) {
                        if (!publisher.createWorkspace(workspaceName)) {

                            ConsoleManager.getInstance().error(this,
                                    Localisation.getField(GeoServerClient.class,
                                            "GeoServerClient.failedToCreateWorkspace")
                                            + workspaceName);
                            return false;
                        }
                    }
                } else {
                    return false;
                }
                result = publisher.publishStyleInWorkspace(workspaceName, sldBody, styleName);
            }
        }
    }

    if (result) {
        ConsoleManager.getInstance().information(this,
                String.format("%s : %s %s/%s",
                        Localisation.getString(GeoServerClient.class,
                                "GeoServerClient.styleUploaded"),
                        connection.getConnectionName(), workspaceName, styleName));
    }
    return result;
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:62,代码来源:GeoServerClient.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DHKeyPairGenerator类代码示例发布时间:2022-05-22
下一篇:
Java Encryption类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap