Methods
Constants
LIBRARIES = Hash.new { |h,k| h[k] = Array.new }
  The map of library ‘require’ names to the package descriptor search paths that they define.
LIBRARY_NAME = "copland"
  The name of the "core" Copland library. This will always be loaded by default, but we define a library name to keep things consistent. Also to allow packages to explicitly require it, if they desire.
SEARCH_PATHS = [ File.join( File.dirname( __FILE__ ), "copland", "impl" ) ]
  The search paths of the core Copland library.
SUBSTITUTION_STRING_REGEXP = /\${(.*?)}/
  This is the regular expression that is used to match substitution string patterns in a value.
DEFAULT_SYMBOL_SOURCE = "copland.SymbolSourceManager"
  A constant identifying the name of the SymbolSourceManager service.
NOT_FOUND = Object.new
  A constant used to indicate that the symbol was not found
Classes and Modules
Module Copland::Configuration
  ::Module Copland::Configuration::YAML
  ::  ::Module Copland::Configuration::YAML::TypeValidator
  ::  ::Class Copland::Configuration::YAML::ConfigurationPointProcessor
  ::  ::Class Copland::Configuration::YAML::ImplementorProcessor
  ::  ::Class Copland::Configuration::YAML::InterceptorProcessor
  ::  ::Class Copland::Configuration::YAML::ListenerProcessor
  ::  ::Class Copland::Configuration::YAML::Loader
  ::  ::Class Copland::Configuration::YAML::PackageProcessor
  ::  ::Class Copland::Configuration::YAML::Parser
  ::  ::Class Copland::Configuration::YAML::SchemaParser
  ::  ::Class Copland::Configuration::YAML::ServicePointProcessor
  ::Class Copland::Configuration::Loader
  ::Class Copland::Configuration::ParserError
Module Copland::ConfigurationPoint
  ::Module Copland::ConfigurationPoint::ConfigurationPointFunctionality
  ::  ::Module Copland::ConfigurationPoint::ConfigurationPointFunctionality::Fixated
  ::Class Copland::ConfigurationPoint::ContributionTypeMismatch
  ::Class Copland::ConfigurationPoint::ListConfigurationPoint
  ::Class Copland::ConfigurationPoint::MapConfigurationPoint
Module Copland::EventProducer
Module Copland::Implementation
  ::Module Copland::Implementation::IncludeExclude
  ::Module Copland::Implementation::IncludeExcludeFactory
  ::Class Copland::Implementation::BuilderFactory
  ::Class Copland::Implementation::LoggingInterceptor
  ::Class Copland::Implementation::LoggingInterceptorFactory
  ::Class Copland::Implementation::Startup
  ::Class Copland::Implementation::StartupClient
  ::Class Copland::Implementation::SymbolSource
  ::Class Copland::Implementation::SymbolSourceDefinition
  ::Class Copland::Implementation::SymbolSourceManager
Module Copland::Instantiator
  ::Class Copland::Instantiator::Abstract
  ::Class Copland::Instantiator::Complex
  ::Class Copland::Instantiator::Identity
  ::Class Copland::Instantiator::Simple
Module Copland::InterceptorChainBuilder
  ::Class Copland::InterceptorChainBuilder::InterceptedServiceProxy
  ::Class Copland::InterceptorChainBuilder::InterceptorChainElement
  ::Class Copland::InterceptorChainBuilder::ProxyObjectChainElement
Module Copland::Orderer
Module Copland::ServiceModel
  ::Class Copland::ServiceModel::AbstractServiceModel
  ::Class Copland::ServiceModel::PrototypeDeferredServiceModel
  ::Class Copland::ServiceModel::PrototypeServiceModel
  ::Class Copland::ServiceModel::Proxy
  ::Class Copland::ServiceModel::SingletonDeferredServiceModel
  ::Class Copland::ServiceModel::SingletonServiceModel
  ::Class Copland::ServiceModel::ThreadedServiceModel
Module Copland::Version
Class Copland::ClassFactory
Class Copland::ConfigurationPointNotFound
Class Copland::CoplandBug
Class Copland::CoplandException
Class Copland::DefaultSchemaProcessor
Class Copland::DisallowedOperationException
Class Copland::DuplicatePackageError
Class Copland::Interceptor
Class Copland::LogFactory
Class Copland::Logger
Class Copland::MissingImplementationException
Class Copland::NoSuchPoolException
Class Copland::NoSuchRegisteredClassException
Class Copland::OrderingException
Class Copland::Package
  ::Module Copland::Package::Fixated
Class Copland::PackageNotFound
Class Copland::QueryableMutex
Class Copland::Registry
  ::Module Copland::Registry::Fixated
  ::Module Copland::Registry::Shutdown
Class Copland::Schema
  ::Module Copland::Schema::Fixated
Class Copland::SchemaNotFound
Class Copland::ServicePoint
  ::Module Copland::ServicePoint::Fixated
Class Copland::ServicePointNotFound
Class Copland::ValidationException
Public Instance methods
get_class( ref )

A convenience function for parsing the reference (using get_class_ref_parts) and automatically doing the require (if needed). The class that was referred to is returned.

     # File lib/copland/utils.rb, line 103
103:   def get_class( ref )
104:     require_file, class_name = get_class_ref_parts( ref )
105: 
106:     require require_file if require_file
107:     return eval( class_name )
108:   end
get_class_ref_parts( ref )

Deconstructs the given reference to get the require and classname parts of the reference. If there is no require portion, then it will return nil for that part.

For example:

  'copland/impl/builder/BuilderFactory'

would return:

  [ 'copland/impl/builder', '::BuilderFactory' ]

and

  'LoggingInterceptor'

would return:

  [ nil, '::LoggingInterceptor' ]

Note that ’::’ is prepended onto the class part, to help ensure that the requested class is always evaluated in the topmost context.

    # File lib/copland/utils.rb, line 92
92:   def get_class_ref_parts( ref )
93:     if ref =~ %r{^(.+)/([^/]+)$}
94:       return [ $1, "::" + $2 ]
95:     end
96: 
97:     return [ nil, ref ]
98:   end
get_possibly_local_service( registry, pkg, id ) {|pkg, id, local_service| ...}

Examines the id to determine whether it is a local service, or a fully-qualified service name. If it is local, then it pertains to the given pkg parameter. Otherwise, the corresponding package is looked up in the registry.

Without a block, this always calls Package#service( id ). With a block, it passes the correct pkg and unqualified service name to the block and returns the result.

    # File lib/copland/utils.rb, line 53
53:   def get_possibly_local_service( registry, pkg, id )
54:     original_package = pkg
55: 
56:     if id =~ /^(.+)\.([^.]+)$/
57:       pkg = registry.package( $1 )
58:       id = $2
59:     end
60: 
61:     local_service = ( original_package == pkg )
62: 
63:     if block_given?
64:       yield pkg, id, local_service
65:     else
66:       pkg.service( id, local_service )
67:     end
68:   end
lookup_symbol( registry, symbol )

Looks in the SymbolSource service for the given symbol.

     # File lib/copland/utils.rb, line 214
214:   def lookup_symbol( registry, symbol )
215:     source = registry.service( DEFAULT_SYMBOL_SOURCE )
216:     source.lookup( symbol, NOT_FOUND )
217:   end
substitute_symbols( registry, value )

Substitutes all symbols (in place) for the given value. If the value responds to the type_id method, then the result of the value method is used for the substitution (thus, this works on private YAML types).

     # File lib/copland/utils.rb, line 192
192:   def substitute_symbols( registry, value )
193:     str = ( value.respond_to?( :type_id ) ? value.value : value )
194:     return unless str.respond_to? :gsub!
195: 
196:     str.gsub!( SUBSTITUTION_STRING_REGEXP ) do
197:       symbol = $1
198:       result = lookup_symbol( registry, symbol )
199:       if result == NOT_FOUND
200:         symbol.upcase.gsub( /[^a-zA-Z0-9]/, "_" )
201:       else
202:         result
203:       end
204:     end
205:   end
translate_array( registry, pkg, point, array )

Translate an array value.

     # File lib/copland/utils.rb, line 185
185:   def translate_array( registry, pkg, point, array )
186:     array.map { |v| translate_value( registry, pkg, point, v ) }
187:   end
translate_hash( registry, pkg, point, hash )

Translate a hash value.

     # File lib/copland/utils.rb, line 176
176:   def translate_hash( registry, pkg, point, hash )
177:     new_hash = Hash.new
178:     hash.each_pair do |k, v|
179:       new_hash[k] = translate_value( registry, pkg, point, v )
180:     end
181:     return new_hash
182:   end
translate_value( registry, pkg, point, value )

Translates the given value. If the value is an object that responds the type_id method, then it is translated to another value, based on its type_id. Otherwise, the value itself is returned.

The values are translated based on this table:

service-id:the value is treated as a as service-id, and the service is looked up
configuration-id:the value is treated as a as configuration-point id, and the configuration point is looked up and used as the value
class:the value is interpreted as the path to and name of a class.
log:the value is ignored, but a new logger is allocated for the service point
int:the value is interpreted as an integer
real:the value is interpreted as a floating point
string:the value is interpreted as a string
     # File lib/copland/utils.rb, line 127
127:   def translate_value( registry, pkg, point, value )
128:     unless Thread.current[:disable_symbol_substitution]
129:       substitute_symbols( registry, value )
130:     end
131: 
132:     if value.is_a?( Array )
133:       return translate_array( registry, pkg, point, value )
134: 
135:     elsif value.is_a?( Hash )
136:       return translate_hash( registry, pkg, point, value )
137: 
138:     elsif value.respond_to?( :type_id )
139:       case value.type_id
140:         when "service"
141:           return get_possibly_local_service( registry, pkg, value.value )
142:         when "configuration"
143:           cfg = get_possibly_local_service(
144:             registry, pkg, value.value ) do |pkg,id|
145:               raise PackageNotFound, value.value unless pkg
146:               pkg.configuration_point id
147:             end
148:           raise ConfigurationPointNotFound, value.value unless cfg
149:           cfg.substitute_symbols!
150:           return cfg
151:         when "class"
152:           return get_class( value.value )
153:         when "log"
154:           return registry.logs.get( point.full_name )
155:         when "integer"
156:           return value.value.to_i
157:         when "real"
158:           return value.value.to_f
159:         when "string"
160:           return value.value.to_s
161:         when "hash"
162:           return translate_hash( registry, pkg, point, value.value )
163:         when "array"
164:           return translate_array( registry, pkg, point, value.value )
165:         when "boolean"
166:           return value.to_s == "true"
167:         else
168:           raise Copland::Configuration::ParserError, "unknown value type id: #{value.type_id}"
169:       end
170:     end
171: 
172:     value
173:   end