Class: RGeoServer::WmsStore

Inherits:
ResourceInfo show all
Defined in:
lib/rgeoserver/wmsstore.rb

Constant Summary collapse

@@route =
"workspaces/%s/wmsstores"
@@root =
"wmsStores"
@@resource_name =
"wmsStore"

Constants inherited from ResourceInfo

ResourceInfo::OBJ_ATTRIBUTES, ResourceInfo::OBJ_DEFAULT_ATTRIBUTES

Instance Attribute Summary

Attributes inherited from ResourceInfo

#catalog

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ResourceInfo

#clear, #create_method, #delete, list, #new?, #profile, #profile=, #profile_xml_to_ng, #refresh, #save, #to_s, update_attribute_accessors, #update_method, #update_params

Constructor Details

#initialize(catalog, options) ⇒ WmsStore

Returns a new instance of WmsStore.

Parameters:



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/rgeoserver/wmsstore.rb', line 57

def initialize catalog, options 
  super(catalog)
  _run_initialize_callbacks do
    workspace = options[:workspace] || 'default'
    if workspace.instance_of? String
      @workspace = @catalog.get_workspace(workspace)
    elsif workspace.instance_of? Workspace
      @workspace = workspace
    else
      raise "Not a valid workspace"
    end
    @name = options[:name].strip
    @route = route
  end        
end

Class Method Details

.member_xpathObject



24
25
26
# File 'lib/rgeoserver/wmsstore.rb', line 24

def self.member_xpath
  "//#{resource_name}"
end

.resource_nameObject



16
17
18
# File 'lib/rgeoserver/wmsstore.rb', line 16

def self.resource_name
  @@resource_name
end

.rootObject



12
13
14
# File 'lib/rgeoserver/wmsstore.rb', line 12

def self.root
  @@root
end

.root_xpathObject



20
21
22
# File 'lib/rgeoserver/wmsstore.rb', line 20

def self.root_xpath
  "//#{root}/#{resource_name}"
end

Instance Method Details

#catalog=(val) ⇒ Object



83
84
85
86
# File 'lib/rgeoserver/wmsstore.rb', line 83

def catalog= val
  catalog_will_change! unless val == @catalog
  @catalog = val
end

#nameObject



42
43
44
# File 'lib/rgeoserver/wmsstore.rb', line 42

def name
  @name      
end

#name=(val) ⇒ Object



73
74
75
76
# File 'lib/rgeoserver/wmsstore.rb', line 73

def name= val
  name_will_change! unless val == @name
  @name = val
end

#profile_xml_to_hash(profile_xml) ⇒ Object



88
89
90
91
# File 'lib/rgeoserver/wmsstore.rb', line 88

def profile_xml_to_hash profile_xml
  doc = profile_xml_to_ng profile_xml 
  return {'name' => doc.at_xpath('//name').text.strip, 'enabled' => @enabled }
end

#routeObject



28
29
30
# File 'lib/rgeoserver/wmsstore.rb', line 28

def route
  @@route % @workspace.name 
end

#workspaceObject



46
47
48
# File 'lib/rgeoserver/wmsstore.rb', line 46

def workspace
  @workspace
end

#workspace=(val) ⇒ Object



78
79
80
81
# File 'lib/rgeoserver/wmsstore.rb', line 78

def workspace= val
  workspace_will_change! unless val == @workspace
  @workspace = val
end

#workspace_nameObject



50
51
52
# File 'lib/rgeoserver/wmsstore.rb', line 50

def workspace_name
  @workspace.name
end

#xml(options = nil) ⇒ Object



32
33
34
35
36
37
38
39
40
# File 'lib/rgeoserver/wmsstore.rb', line 32

def xml options = nil
  <<-cs
    <wmsStore>
    <enabled>true</enabled>
    <name>#{name}</name>
    <workspace><name>#{workspace_name}</name></workspace>
   </wmsStore>
  cs
end