lib/rgeoserver/catalog.rb in rgeoserver-0.5.5 vs lib/rgeoserver/catalog.rb in rgeoserver-0.5.6
- old
+ new
@@ -31,20 +31,31 @@
sym = :xml || format.to_sym
{:accept => sym, :content_type=> sym}
end
#== Resources
+
+ # Shortcut to ResourceInfo.list to this catalog. See ResourceInfo#list
+ # @param [RGeoServer::ResourceInfo.class] klass
+ # @param [RGeoServer::Catalog] catalog
+ # @param [Array<String>] names
+ # @param [Hash] options
+ # @param [bool] check_remote if already exists in catalog and cache it
+ # @yield [RGeoServer::ResourceInfo]
+ def list klass, names, options, check_remote = false, &block
+ ResourceInfo.list klass, self, names, options, check_remote, &block
+ end
#= Workspaces
# List of available workspaces
# @return [Array<RGeoServer::Workspace>]
def get_workspaces &block
response = self.search :workspaces => nil
doc = Nokogiri::XML(response)
workspaces = doc.xpath(Workspace.root_xpath).collect{|w| w.text.to_s }
- ResourceInfo.list Workspace, self, workspaces, {}, &block
+ list Workspace, workspaces, {}, &block
end
# @param [String] workspace name
# @return [RGeoServer::Workspace]
def get_workspace workspace
@@ -78,11 +89,11 @@
# @return [Array<RGeoServer::Layer>]
def get_layers &block
response = self.search :layers => nil
doc = Nokogiri::XML(response)
layers = doc.xpath(Layer.root_xpath).collect{|l| l.text.to_s }
- ResourceInfo.list Layer, self, layers, {}, &block
+ list Layer, layers, {}, &block
end
# @param [String] layer name
# @return [RGeoServer::Layer]
def get_layer layer
@@ -98,11 +109,11 @@
# @return [Array<RGeoServer::Style>]
def get_styles &block
response = self.search :styles => nil
doc = Nokogiri::XML(response)
styles = doc.xpath(Style.root_xpath).collect{|l| l.text.to_s }
- ResourceInfo.list Style, self, styles, {}, &block
+ list Style, styles, {}, &block
end
# @param [String] style name
# @return [RGeoServer::Style]
def get_style style
@@ -182,16 +193,19 @@
# @param [String] workspace
# @param [String] coveragestore
# @return [RGeoServer::CoverageStore]
def get_coverage_store workspace, coveragestore
- response = self.search({:workspaces => workspace, :name => coveragestore})
- doc = Nokogiri::XML(response)
- name = doc.at_xpath(CoverageStore.member_xpath)
- return CoverageStore.new self, workspace, name.text if name
+ cs = CoverageStore.new self, :workspace => workspace, :name => coveragestore
+ return cs.new?? nil : cs
end
+ def get_coverage workspace, coverage_store, coverage
+ c = Coverage.new self, :workspace => workspace, :coverage_store => coverage_store, :name => coverage
+ return c.new?? nil : c
+ end
+
#= WMS Stores (Web Map Services)
# List of WMS stores.
# @param [String] workspace
# @return [Array<RGeoServer::WmsStore>]
@@ -209,9 +223,21 @@
response = self.search({:workspaces => workspace, :name => wmsstore})
doc = Nokogiri::XML(response)
name = doc.at_xpath(WmsStore.member_xpath)
return WmsStore.new self, workspace, name.text if name
end
-
+
+ #= Configuration reloading
+ # Reloads the catalog and configuration from disk. This operation is used to reload GeoServer in cases where an external tool has modified the on disk configuration. This operation will also force GeoServer to drop any internal caches and reconnect to all data stores.
+ def reload
+ do_url 'reload', method = :put
+ end
+
+ #= Resource reset
+ # Resets all store/raster/schema caches and starts fresh. This operation is used to force GeoServer to drop all caches and stores and reconnect fresh to each of them first time they are needed by a request. This is useful in case the stores themselves cache some information about the data structures they manage that changed in the meantime.
+ def reset
+ do_url 'reset', method = :put
+ end
+
end
end