Permalink
Browse files

filename case changes

  • Loading branch information...
1 parent 2aeaf9f commit 211903a30169f7fad500300512464aa8eac0d28d Florian Feldhaus committed May 20, 2012
Showing with 0 additions and 250 deletions.
  1. +0 −59 lib/occi/Exceptions.rb
  2. +0 −47 lib/occi/Log.rb
  3. +0 −90 lib/occi/Registry.rb
  4. +0 −54 lib/occi/extensions/monitoring/Metric.rb
View
@@ -1,59 +0,0 @@
-##############################################################################
-# Copyright 2011 Service Computing group, TU Dortmund
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-##############################################################################
-
-##############################################################################
-# Description: registry for all Category/Kind/Mixin instances currently
-# known to the OCCI server
-# Author(s): Hayati Bice, Florian Feldhaus, Piotr Kasprzak
-##############################################################################
-
-module OCCI
-
- # Tried to create an already existing mixin
- class MixinAlreadyExistsError < RuntimeError;
- end
-
- class CategoryNotFoundException < RuntimeError;
- end
-
- class CategoryMissingException < RuntimeError;
- end
-
- class MixinNotFoundException < RuntimeError;
- end
-
- class MixinCreationException < RuntimeError;
- end
-
- class LocationAlreadyRegisteredException < RuntimeError;
- end
-
- class LocationNotRegisteredException < RuntimeError;
- end
-
- # Tried to create an already existing mixin
- class BackendError < RuntimeError;
- end
-
- class ParserException < RuntimeError;
- end
-
- class ContentTypeNotSupported < RuntimeError;
- end
-
- class CategoryNotFound < RuntimeError;
- end
-end
View
@@ -1,47 +0,0 @@
-##############################################################################
-# Copyright 2011 Service Computing group, TU Dortmund
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-##############################################################################
-
-##############################################################################
-# Description: OCCI logger
-# Author(s): Hayati Bice, Florian Feldhaus, Piotr Kasprzak
-##############################################################################
-
-require 'logger'
-
-module OCCI
- class Log
-
- def self.debug(message)
- ActiveSupport::Notifications.instrument("log",:level=>Logger::DEBUG,:message=>message)
- end
-
- def self.info(message)
- ActiveSupport::Notifications.instrument("log", :level => Logger::INFO, :message => message)
- end
-
- def self.warn(message)
- ActiveSupport::Notifications.instrument("log", :level => Logger::WARN, :message => message)
- end
-
- def self.error(message)
- ActiveSupport::Notifications.instrument("log", :level => Logger::ERROR, :message => message)
- end
-
- def self.fatal(message)
- ActiveSupport::Notifications.instrument("log", :level => Logger::FATAL, :message => message)
- end
- end
-end
View
@@ -1,90 +0,0 @@
-##############################################################################
-# Copyright 2011 Service Computing group, TU Dortmund
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-##############################################################################
-
-##############################################################################
-# Description: registry for all Category/Kind/Mixin instances currently
-# known to the OCCI server
-# Author(s): Hayati Bice, Florian Feldhaus, Piotr Kasprzak
-##############################################################################
-
-require 'occi/log'
-
-module OCCI
- # ---------------------------------------------------------------------------------------------------------------------
- module Registry
-
- @@categories = {}
- @@categories_initial = {}
- @@locations = {}
-
- def self.reset()
- @@categories = @@categories_initial
- end
-
- # ---------------------------------------------------------------------------------------------------------------------
- def self.register(category)
- OCCI::Log.debug("### Registering category #{category.type_identifier}")
- @@categories[category.type_identifier] = category
- @@categories_initial[category.type_identifier] = category
- @@locations[category.term] = category.type_identifier unless category.kind_of?(OCCI::Core::Action)
- end
-
- # ---------------------------------------------------------------------------------------------------------------------
- def self.unregister(category)
- OCCI::Log.debug("### Unregistering category #{category.type_identifier}")
- @@categories.delete(category.type_identifier)
- @@categories_initial.delete(category.type_identifier)
- @@locations.delete(category.term) unless category.kind_of?(OCCI :Core::Action)
- end
-
- # Returns the category corresponding to a given type identifier
- #
- # @param [URI] type identifier of a category
- def self.get_by_id(id)
- @@categories.fetch(id) { OCCI::Log.debug("Category with id #{id} not found"); nil }
- end
-
- # Returns the category corresponding to a given location
- #
- # @param [URI] Location of a category
- def self.get_by_location(location)
- id = @@locations.fetch(location.delete('/')) { OCCI::Log.debug("Category with location #{location} not found"); nil }
- self.get_by_id(id)
- end
-
- # Return all categories from category registry. If filter is present, return only the categories specified by filter
- #
- # @param [Hashie:Hash] filter
- # @return [Hashie::Mash] collection
- def self.get(filter = [])
- collection = Hashie::Mash.new({:kinds => [], :mixins => [], :actions => []})
- filter.each do |cat|
- category = get_by_id(cat.type_identifier)
- collection.kinds << category if category.kind_of?(OCCI::Core::Kind)
- collection.mixins << category if category.kind_of?(OCCI::Core::Mixin)
- collection.actions << category if category.kind_of?(OCCI::Core::Action)
- end
- if filter.empty?
- @@categories.each_value do |category|
- collection.kinds << category if category.kind_of? OCCI::Core::Kind
- collection.mixins << category if category.kind_of? OCCI::Core::Mixin
- collection.actions << category if category.kind_of? OCCI::Core::Action
- end
- end
- return collection
- end
- end
-end
@@ -1,54 +0,0 @@
-##############################################################################
-# Copyright 2012 GWDG
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-##############################################################################
-
-##############################################################################
-# Description: OCCI monitoring metric
-# Author(s): Ali Imran Jehangiri, Florian Feldhaus, Piotr Kasprzak
-##############################################################################
-
-require 'singleton'
-
-require 'occi/core/mixin'
-
-module OCCI
- module Monitor
- class Metric < OCCI::Core::Mixin
-
- # Define appropriate mixin
- begin
- # Define actions
- actions = []
-
- related = []
- entities = []
-
- term = "metric"
- scheme = "http://schemas.ogf.org/occi/monitoring#"
- title = "Metric"
-
- attributes = OCCI::Core::Attributes.new()
- attributes << OCCI::Core::Attribute.new(name = 'value', mutable = false, mandatory = true, unique = true)
- attributes << OCCI::Core::Attribute.new(name = 'timestamp', mutable = false, mandatory = true, unique = true)
- attributes << OCCI::Core::Attribute.new(name = 'samplerate', mutable = true, mandatory = false, unique = true)
- attributes << OCCI::Core::Attribute.new(name = 'resolution', mutable = true, mandatory = false, unique = true)
- attributes << OCCI::Core::Attribute.new(name = 'unit', mutable = false, mandatory = true, unique = true)
-
- MIXIN = OCCI::Core::Mixin.new(term, scheme, title, attributes, actions, related, entities)
- OCCI::CategoryRegistry.register(MIXIN)
- end
- end
- end
-end

0 comments on commit 211903a

Please sign in to comment.