Class: TorqueBox::Naming::NamingService
- Inherits:
-
Object
- Object
- TorqueBox::Naming::NamingService
- Defined in:
- lib/torquebox/naming/naming_service.rb
Instance Attribute Summary collapse
-
#export ⇒ Object
Returns the value of attribute export.
-
#host ⇒ Object
Returns the value of attribute host.
-
#port ⇒ Object
Returns the value of attribute port.
-
#rmi_host ⇒ Object
Returns the value of attribute rmi_host.
-
#rmi_port ⇒ Object
Returns the value of attribute rmi_port.
Instance Method Summary collapse
- #available_port ⇒ Object
- #before_start(container) ⇒ Object
- #fundamental_deployment_paths ⇒ Object
-
#initialize(&block) ⇒ NamingService
constructor
A new instance of NamingService.
Constructor Details
#initialize(&block) ⇒ NamingService
Returns a new instance of NamingService.
41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/torquebox/naming/naming_service.rb', line 41 def initialize(&block) @host = 'localhost' @port = 1099 @rmi_host = 'localhost' @rmi_port = 1098 @export = true instance_eval(&block) if block end |
Instance Attribute Details
#export ⇒ Object
Returns the value of attribute export.
39 40 41 |
# File 'lib/torquebox/naming/naming_service.rb', line 39 def export @export end |
#host ⇒ Object
Returns the value of attribute host.
34 35 36 |
# File 'lib/torquebox/naming/naming_service.rb', line 34 def host @host end |
#port ⇒ Object
Returns the value of attribute port.
33 34 35 |
# File 'lib/torquebox/naming/naming_service.rb', line 33 def port @port end |
#rmi_host ⇒ Object
Returns the value of attribute rmi_host.
37 38 39 |
# File 'lib/torquebox/naming/naming_service.rb', line 37 def rmi_host @rmi_host end |
#rmi_port ⇒ Object
Returns the value of attribute rmi_port.
36 37 38 |
# File 'lib/torquebox/naming/naming_service.rb', line 36 def rmi_port @rmi_port end |
Instance Method Details
#available_port ⇒ Object
70 71 72 73 74 75 |
# File 'lib/torquebox/naming/naming_service.rb', line 70 def available_port server = TCPServer.new('127.0.0.1', 0) port = server.addr[1] server.close port end |
#before_start(container) ⇒ Object
61 62 63 64 65 66 67 68 |
# File 'lib/torquebox/naming/naming_service.rb', line 61 def before_start(container) Java::java.lang::System.setProperty( 'java.naming.factory.initial', 'org.jnp.interfaces.NamingContextFactory' ) Java::java.lang::System.setProperty( 'java.naming.factory.url.pkgs', 'org.jboss.naming:org.jnp.interfaces' ) Java::java.lang::System.setProperty( 'jnp.host', self.host.to_s ) Java::java.lang::System.setProperty( 'jnp.port', self.port.to_s ) Java::java.lang::System.setProperty( 'jnp.rmiHost', self.rmi_host.to_s ) Java::java.lang::System.setProperty( 'jnp.rmiPort', self.rmi_port.to_s ) end |
#fundamental_deployment_paths ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/torquebox/naming/naming_service.rb', line 25 def fundamental_deployment_paths paths = [ File.join( File.dirname(__FILE__), 'naming-local-jboss-beans.xml' ) ] if ( @export ) paths << File.join( File.dirname(__FILE__), 'naming-rmi-jboss-beans.xml' ) end paths end |