Module: TorqueBox

Defined in:
stomp/lib/torquebox/stomp/jms_stomplet.rb,
stomp/lib/torquebox/stomp/message.rb,
stomp/lib/torquebox/stomp/rack/stomp_javascript_client_provider.rb,
web/lib/torquebox/session/servlet_store.rb,
cache/lib/torquebox/cache.rb,
messaging/lib/torquebox/messaging/session.rb,
messaging/lib/torquebox/messaging/datamapper_marshaling.rb,
messaging/lib/torquebox/messaging/backgroundable_processor.rb,
messaging/lib/torquebox/messaging/topic.rb,
messaging/lib/torquebox/messaging/json_message.rb,
messaging/lib/torquebox/messaging/destination.rb,
messaging/lib/torquebox/messaging/future.rb,
messaging/lib/torquebox/messaging/marshal_base64_message.rb,
messaging/lib/torquebox/messaging/connection.rb,
messaging/lib/torquebox/messaging/message.rb,
messaging/lib/torquebox/messaging/text_message.rb,
messaging/lib/torquebox/messaging/backgroundable.rb,
messaging/lib/torquebox/messaging/future_responder.rb,
messaging/lib/torquebox/messaging/connection_factory.rb,
messaging/lib/torquebox/messaging/task.rb,
messaging/lib/torquebox/messaging/edn_message.rb,
messaging/lib/torquebox/messaging/xa_session.rb,
messaging/lib/torquebox/messaging/message_processor.rb,
messaging/lib/torquebox/messaging/xa_connection.rb,
messaging/lib/torquebox/messaging/xa_connection_factory.rb,
messaging/lib/torquebox/messaging/marshal_message.rb,
messaging/lib/torquebox/messaging/future_status.rb,
messaging/lib/torquebox/messaging/queue.rb,
messaging/lib/torquebox/messaging/processor_middleware/default_middleware.rb,
messaging/lib/torquebox/messaging/processor_middleware/with_transaction.rb,
messaging/lib/torquebox/messaging/processor_middleware/chain.rb,
core/lib/torquebox/msc.rb,
core/lib/torquebox/service_registry.rb,
core/lib/torquebox/registry.rb,
core/lib/torquebox/kernel.rb,
core/lib/torquebox/component_manager.rb,
core/lib/torquebox/codecs.rb,
core/lib/torquebox/injectors.rb,
core/lib/torquebox/logger.rb,
core/lib/torquebox/service.rb,
core/lib/torquebox/core.rb,
core/lib/torquebox/codecs/edn.rb,
core/lib/torquebox/codecs/marshal.rb,
core/lib/torquebox/codecs/json.rb,
core/lib/torquebox/codecs/marshal_smart.rb,
core/lib/torquebox/codecs/marshal_base64.rb,
transactions/lib/torquebox/transactions.rb,
transactions/lib/torquebox/active_record_adapters.rb,
transactions/lib/torquebox/active_record_adapters.rb,
rake-support/lib/torquebox/launchd.rb,
rake-support/lib/torquebox/rails.rb,
rake-support/lib/torquebox/server.rb,
rake-support/lib/torquebox/upstart.rb,
rake-support/lib/torquebox/deploy_utils.rb,
naming/lib/torquebox/naming.rb,
security/lib/torquebox/security/authentication.rb,
configure/lib/torquebox/configure.rb,
configure/lib/torquebox/configuration.rb,
configure/lib/torquebox/configuration/global.rb,
configure/lib/torquebox/configuration/validator.rb

Defined Under Namespace

Modules: Authentication, Codecs, Configuration, DeployUtils, Infinispan, Injectors, Launchd, Messaging, Naming, Session, Stomp, Transactions, Upstart Classes: Authenticator, ComponentManager, FallbackLogger, InjectionError, Kernel, Logger, MSC, Rails, Registry, Server, Service, ServiceRegistry

Constant Summary

CONFIGURATION_ROOT =
'<root>'

Class Method Summary (collapse)

Class Method Details

+ (Object) configure(&block)



24
25
26
27
28
29
30
# File 'configure/lib/torquebox/configure.rb', line 24

def self.configure(&block)
  config = Thread.current[:torquebox_config]
  entry_map = Thread.current[:torquebox_config_entry_map]
  Configuration::Entry.new( CONFIGURATION_ROOT, config, entry_map, :allow_block => true ).
    process( nil, &block )
  config
end

+ (Object) fetch(something, options = {})



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'core/lib/torquebox/injectors.rb', line 27

def self.fetch(something,options={})
  timeout = options[:timeout] || 45
  unless TorqueBox::Registry.has_key?(something.to_s)
    handler_registry = TorqueBox::ServiceRegistry['torquebox.core.injection.injectable-handler-registry']
    # handler_registry should only be nil when running outside of
    # TorqueBox so we just return the nil value and skip everything
    # else to facilitate testing outside the container
    return nil if handler_registry.nil?
    handler = handler_registry.get_handler(something)
    raise InjectionError.new("Invalid injection - #{something}") if handler.nil?
    injectable = handler.handle(something, true)
    service_name = injectable.get_service_name(TorqueBox::Registry['service-target'],
                                               TorqueBox::Registry['deployment-unit'])
    service = TorqueBox::ServiceRegistry.registry.getService(service_name)
    raise InjectionError.new("Service not found for injection - #{something}") if service.nil?
    state = TorqueBox::MSC.wait_for_service_to_start(service, timeout)
    raise InjectionError.new("Injected service failed to start - #{service_name}") if state != 'UP'
    value = service.value
    raise InjectionError.new("Injected service had no value - #{service_name}") if value.nil?
    value = value.convert(JRuby.runtime) if value.respond_to?(:convert)
    if something.to_s.start_with?("service:")
      # don't cache services to support zero-downtime deploys (TORQUE-1217)
      return value
    else
      TorqueBox::Registry.merge!(something.to_s => value)
    end
  end
  TorqueBox::Registry[something.to_s]
end

+ (Object) transaction(*resources, &block)



23
24
25
# File 'transactions/lib/torquebox/transactions.rb', line 23

def self.transaction(*resources, &block)
  Transactions::Manager.current.run(*resources, &block)
end