Sha256: c7920edc7ccabfb87ebe3879dd0f425954b3f52a01055e028905ce8dfb8c4bd5

Contents?: true

Size: 1.43 KB

Versions: 2

Compression:

Stored size: 1.43 KB

Contents

module TorqueBox
  module Container

    class FoundationCommand

      def initialize()
        @options_parser = OptionParser.new
        parser_options( @options_parser )
      end

      def parser_options(opts)
        opts.on( '-L', '--logging CONFIG_XML', 'Specify a logging configuration' ) do |logging_config_xml|
          @logging_config_xml = logging_config_xml
        end
        opts.on_tail( '-h', '--help', 'Show this message' ) do
          puts opts
          exit
        end
      end


      def run()
      
        full_path = File.expand_path( File.join( File.dirname( __FILE__ ), 'log4j.xml' ) )

        if ( @logging_config_xml )
          full_path = File.expand_path( @logging_config_xml ) 
        end

        puts "setting logging to #{full_path}"
        org.apache.log4j.xml::DOMConfigurator.configure( full_path )

        container = TorqueBox::Container::Foundation.new
        configure( container )
        container.start
        after_start( container )

        interrupted = false
        trap( "INT" ) do
          before_stop( container )
          container.stop
          interrupted = true
        end

        while ( ! interrupted )
          sleep( 2 )
        end
      end

      def configure(container)
        # no op
      end

      def after_start(container)
      end

      def before_stop(container)
      end

      def parse!(args)
        @options_parser.parse!(args)
      end

    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
org.torquebox.torquebox-container-foundation-1.0.0.Beta23-java lib/torquebox/container/foundation_command.rb
org.torquebox.torquebox-container-foundation-1.0.0.Beta22-java lib/torquebox/container/foundation_command.rb