glassfish 0.9.5-universal-java → 1.0.0-universal-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +247 -0
- data/LICENSE.txt +774 -0
- data/README.txt +140 -0
- data/bin/gfrake +5 -1
- data/bin/glassfish +5 -7
- data/generators/gfrake/templates/glassfish.yml +39 -0
- data/lib/command_line_parser.rb +29 -40
- data/lib/config.rb +57 -63
- data/lib/glassfish.rb +3 -79
- data/{modules → lib/java}/akuma.jar +0 -0
- data/lib/java/gf-jruby-connector.jar +0 -0
- data/lib/java/glassfish-embedded-nucleus.jar +0 -0
- data/lib/java/glassfish-gem.jar +0 -0
- data/lib/java/grizzly-jruby-module.jar +0 -0
- data/lib/java/grizzly-jruby.jar +0 -0
- data/lib/jruby/rack/grizzly_helper.rb +230 -0
- data/lib/jruby/rack/merb.rb +34 -0
- data/lib/jruby/rack/rackup.rb +46 -0
- data/lib/jruby/rack/rails.rb +29 -0
- data/lib/jruby/rack/sinatra.rb +18 -0
- data/lib/jruby/rails_path.rb +11 -0
- data/lib/{templates/profile.properties → rack/adapter/merb.rb} +18 -7
- data/lib/rack/adapter/rails.rb +268 -0
- data/lib/rack/handler/grizzly.rb +59 -0
- data/lib/server.rb +164 -0
- data/lib/version.rb +1 -1
- metadata +83 -153
- data/bin/glassfish_rails +0 -61
- data/config/asadminenv.conf +0 -6
- data/config/asenv.bat +0 -29
- data/config/asenv.conf +0 -31
- data/config/glassfish.container +0 -4
- data/domains/domain1/config/admin-keyfile +0 -3
- data/domains/domain1/config/cacerts.jks +0 -0
- data/domains/domain1/config/default-web.xml +0 -1133
- data/domains/domain1/config/domain-passwords +0 -0
- data/domains/domain1/config/domain.xml +0 -190
- data/domains/domain1/config/glassfish_gem_version.yml +0 -7
- data/domains/domain1/config/keyfile +0 -6
- data/domains/domain1/config/keystore.jks +0 -0
- data/domains/domain1/config/logging.properties +0 -46
- data/domains/domain1/config/login.conf +0 -21
- data/domains/domain1/config/server.policy +0 -170
- data/domains/domain1/config/sun-acc.xml +0 -40
- data/domains/domain1/docroot/index.html +0 -83
- data/domains/domain1/master-password +0 -0
- data/lib/appclient/appclientlogin.conf +0 -10
- data/lib/appclient/client.policy +0 -79
- data/lib/appclient/wss-client-config-1.0.xml +0 -84
- data/lib/appclient/wss-client-config-2.0.xml +0 -96
- data/lib/registration/servicetag-registry.xml +0 -18
- data/lib/templates/cacerts.jks +0 -0
- data/lib/templates/default-web.xml +0 -1133
- data/lib/templates/docroot/index.html +0 -83
- data/lib/templates/domain.xml +0 -180
- data/lib/templates/domain.xml.xsl +0 -100
- data/lib/templates/keyfile +0 -6
- data/lib/templates/keystore.jks +0 -0
- data/lib/templates/logging.properties +0 -48
- data/lib/templates/login.conf +0 -21
- data/lib/templates/server.policy +0 -170
- data/lib/templates/sun-acc.xml +0 -40
- data/modules/admin-cli.jar +0 -0
- data/modules/api-exporter.jar +0 -0
- data/modules/asm-all-repackaged.jar +0 -0
- data/modules/auto-depends.jar +0 -0
- data/modules/bean-validator.jar +0 -0
- data/modules/branding.jar +0 -0
- data/modules/cli-framework.jar +0 -0
- data/modules/common-util.jar +0 -0
- data/modules/config-api.jar +0 -0
- data/modules/config.jar +0 -0
- data/modules/deployment-admin.jar +0 -0
- data/modules/deployment-autodeploy.jar +0 -0
- data/modules/deployment-common.jar +0 -0
- data/modules/flashlight-agent.jar +0 -0
- data/modules/flashlight-framework.jar +0 -0
- data/modules/gf-jruby-connector.jar +0 -0
- data/modules/gfprobe-provider-client.jar +0 -0
- data/modules/glassfish-api.jar +0 -0
- data/modules/glassfish-ee-api.jar +0 -0
- data/modules/glassfish-extra-jre-packages.jar +0 -0
- data/modules/glassfish-gem.jar +0 -0
- data/modules/glassfish.jar +0 -0
- data/modules/grizzly-comet.jar +0 -0
- data/modules/grizzly-cometd.jar +0 -0
- data/modules/grizzly-compat.jar +0 -0
- data/modules/grizzly-config.jar +0 -0
- data/modules/grizzly-framework.jar +0 -0
- data/modules/grizzly-http.jar +0 -0
- data/modules/grizzly-jruby-module.jar +0 -0
- data/modules/grizzly-jruby.jar +0 -0
- data/modules/grizzly-messagesbus.jar +0 -0
- data/modules/grizzly-portunif.jar +0 -0
- data/modules/grizzly-rcm.jar +0 -0
- data/modules/grizzly-utils.jar +0 -0
- data/modules/hk2-core.jar +0 -0
- data/modules/hk2.jar +0 -0
- data/modules/internal-api.jar +0 -0
- data/modules/kernel.jar +0 -0
- data/modules/launcher.jar +0 -0
- data/modules/org.apache.felix.configadmin.jar +0 -0
- data/modules/org.apache.felix.fileinstall.jar +0 -0
- data/modules/org.apache.felix.shell.jar +0 -0
- data/modules/org.apache.felix.shell.remote.jar +0 -0
- data/modules/org.apache.felix.shell.tui.jar +0 -0
- data/modules/osgi-main.jar +0 -0
- data/modules/pkg-client.jar +0 -0
- data/modules/tiger-types-osgi.jar +0 -0
@@ -0,0 +1,11 @@
|
|
1
|
+
module Rails
|
2
|
+
class Configuration
|
3
|
+
def threadsafe?
|
4
|
+
if(Rails::Configuration.instance_methods.include?'threadsafe!')
|
5
|
+
preload_frameworks && cache_classes && !dependency_loading && action_controller.allow_concurrency
|
6
|
+
else
|
7
|
+
false
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
#
|
2
2
|
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
3
|
-
#
|
4
|
-
# Copyright
|
5
|
-
#
|
3
|
+
#
|
4
|
+
# Copyright 2007-2008 Sun Microsystems, Inc. All rights reserved.
|
5
|
+
#
|
6
6
|
# The contents of this file are subject to the terms of either the GNU
|
7
7
|
# General Public License Version 2 only ("GPL") or the Common Development
|
8
8
|
# and Distribution License("CDDL") (collectively, the "License"). You
|
@@ -10,7 +10,7 @@
|
|
10
10
|
# a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
|
11
11
|
# or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
|
12
12
|
# language governing permissions and limitations under the License.
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# When distributing the software, include this License Header Notice in each
|
15
15
|
# file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
|
16
16
|
# Sun designates this particular file as subject to the "Classpath" exception
|
@@ -19,9 +19,9 @@
|
|
19
19
|
# Header, with the fields enclosed by brackets [] replaced by your own
|
20
20
|
# identifying information: "Portions Copyrighted [year]
|
21
21
|
# [name of copyright owner]"
|
22
|
-
#
|
22
|
+
#
|
23
23
|
# Contributor(s):
|
24
|
-
#
|
24
|
+
#
|
25
25
|
# If you wish your version of this file to be governed by only the CDDL or
|
26
26
|
# only the GPL Version 2, indicate your decision by adding "[Contributor]
|
27
27
|
# elects to include this software in this distribution under the [CDDL or GPL
|
@@ -34,4 +34,15 @@
|
|
34
34
|
# holder.
|
35
35
|
#
|
36
36
|
|
37
|
-
|
37
|
+
# Grizzly Adapter for Merb: when asked to start, it returns the already-running grizzly server instance
|
38
|
+
require 'jruby/rack/grizzly_helper'
|
39
|
+
module Merb
|
40
|
+
module Rack
|
41
|
+
class GrizzlyMerb
|
42
|
+
def self.start(opts={})
|
43
|
+
$merb_app = opts[:app]
|
44
|
+
::JRuby::Rack::GrizzlyHelper.instance
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,268 @@
|
|
1
|
+
#
|
2
|
+
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
3
|
+
#
|
4
|
+
# Copyright 2007-2008 Sun Microsystems, Inc. All rights reserved.
|
5
|
+
#
|
6
|
+
# The contents of this file are subject to the terms of either the GNU
|
7
|
+
# General Public License Version 2 only ("GPL") or the Common Development
|
8
|
+
# and Distribution License("CDDL") (collectively, the "License"). You
|
9
|
+
# may not use this file except in compliance with the License. You can obtain
|
10
|
+
# a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
|
11
|
+
# or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
|
12
|
+
# language governing permissions and limitations under the License.
|
13
|
+
#
|
14
|
+
# When distributing the software, include this License Header Notice in each
|
15
|
+
# file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
|
16
|
+
# Sun designates this particular file as subject to the "Classpath" exception
|
17
|
+
# as provided by Sun in the GPL Version 2 section of the License file that
|
18
|
+
# accompanied this code. If applicable, add the following below the License
|
19
|
+
# Header, with the fields enclosed by brackets [] replaced by your own
|
20
|
+
# identifying information: "Portions Copyrighted [year]
|
21
|
+
# [name of copyright owner]"
|
22
|
+
#
|
23
|
+
# Contributor(s):
|
24
|
+
#
|
25
|
+
# If you wish your version of this file to be governed by only the CDDL or
|
26
|
+
# only the GPL Version 2, indicate your decision by adding "[Contributor]
|
27
|
+
# elects to include this software in this distribution under the [CDDL or GPL
|
28
|
+
# Version 2] license." If you don't indicate a single choice of license, a
|
29
|
+
# recipient has the option to distribute your version of this file under
|
30
|
+
# either the CDDL, the GPL Version 2 or to extend the choice of license to
|
31
|
+
# its licensees as provided above. However, if you add GPL Version 2 code
|
32
|
+
# and therefore, elected the GPL Version 2 license, then the option applies
|
33
|
+
# only if the new code is made subject to such option by the copyright
|
34
|
+
# holder.
|
35
|
+
#
|
36
|
+
require 'jruby/rack/rails'
|
37
|
+
|
38
|
+
require 'rubygems'
|
39
|
+
|
40
|
+
begin
|
41
|
+
gem 'rack'
|
42
|
+
require 'rack'
|
43
|
+
rescue LoadError
|
44
|
+
error = <<EOF
|
45
|
+
###
|
46
|
+
ERROR : Is rack installed? Install Rack using 'gem install rack'
|
47
|
+
###
|
48
|
+
EOF
|
49
|
+
puts "\n"+error
|
50
|
+
raise
|
51
|
+
end
|
52
|
+
|
53
|
+
|
54
|
+
# Based on http://github.com/macournoyer/thin/tree/master/lib/rack/adapter/rails.rb
|
55
|
+
# Adapter to run a Rails app with any supported Rack handler.
|
56
|
+
# By default it will try to load the Rails application in the
|
57
|
+
# current directory in the development environment.
|
58
|
+
# Options:
|
59
|
+
# root: Root directory of the Rails app
|
60
|
+
# env: Rails environment to run in (development, production or test)
|
61
|
+
# Based on http://fuzed.rubyforge.org/ Rails adapter
|
62
|
+
module Rack
|
63
|
+
module Adapter
|
64
|
+
class Rails
|
65
|
+
FILE_METHODS = %w(GET HEAD).freeze
|
66
|
+
|
67
|
+
def initialize(helper)
|
68
|
+
options = helper.options
|
69
|
+
@rails_grizzly_helper = helper
|
70
|
+
@root = options[:root] || Dir.pwd
|
71
|
+
@env = options[:environment] || 'development'
|
72
|
+
@prefix = options[:prefix]
|
73
|
+
@public = options[:public]
|
74
|
+
|
75
|
+
load_application
|
76
|
+
|
77
|
+
@rails_app = if rack_based?
|
78
|
+
ActionController::Dispatcher.new
|
79
|
+
else
|
80
|
+
CgiApp.new
|
81
|
+
end
|
82
|
+
|
83
|
+
@file_app = Rack::File.new(::File.join(@root, "public"))
|
84
|
+
|
85
|
+
end
|
86
|
+
|
87
|
+
def rack_based?
|
88
|
+
ActionController.const_defined?(:Dispatcher) &&
|
89
|
+
(ActionController::Dispatcher.instance_methods.include?(:call) ||
|
90
|
+
ActionController::Dispatcher.instance_methods.include?("call"))
|
91
|
+
end
|
92
|
+
|
93
|
+
def load_application
|
94
|
+
ENV['RAILS_ROOT'] = @root
|
95
|
+
ENV['RAILS_ENV'] = @env
|
96
|
+
|
97
|
+
|
98
|
+
require "#{@root}/config/environment"
|
99
|
+
require 'dispatcher'
|
100
|
+
|
101
|
+
setup_logger
|
102
|
+
|
103
|
+
if !@prefix.nil? && @prefix != "/"
|
104
|
+
if ActionController::Base.respond_to?('relative_url_root=') #for rails < 2.2
|
105
|
+
ActionController::Base.relative_url_root = @prefix
|
106
|
+
else
|
107
|
+
ActionController::AbstractRequest.relative_url_root = @prefix
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
end
|
112
|
+
|
113
|
+
def file_exist?(path)
|
114
|
+
full_path = ::File.join(@file_app.root, Utils.unescape(path))
|
115
|
+
::File.file?(full_path) && ::File.readable_real?(full_path)
|
116
|
+
end
|
117
|
+
|
118
|
+
def call(env)
|
119
|
+
path = env['PATH_INFO'].chomp('/')
|
120
|
+
method = env['REQUEST_METHOD']
|
121
|
+
cached_path = (path.empty? ? 'index' : path) + ActionController::Base.page_cache_extension
|
122
|
+
|
123
|
+
if FILE_METHODS.include?(method)
|
124
|
+
if file_exist?(path) # Serve the file if it's there
|
125
|
+
return @file_app.call(env)
|
126
|
+
elsif file_exist?(cached_path) # Serve the page cache if it's there
|
127
|
+
env['PATH_INFO'] = cached_path
|
128
|
+
return @file_app.call(env)
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
# No static file, let Rails handle it
|
133
|
+
@rails_app.call(env)
|
134
|
+
end
|
135
|
+
|
136
|
+
protected
|
137
|
+
|
138
|
+
# For Rails pre Rack (2.3)
|
139
|
+
class CgiApp
|
140
|
+
require 'cgi'
|
141
|
+
def call(env)
|
142
|
+
request = Request.new(env)
|
143
|
+
response = Response.new
|
144
|
+
session_options = ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS
|
145
|
+
cgi = CGIWrapper.new(request, response)
|
146
|
+
|
147
|
+
Dispatcher.dispatch(cgi, session_options, response)
|
148
|
+
|
149
|
+
response.finish
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
class CGIWrapper < ::CGI
|
154
|
+
def initialize(request, response, *args)
|
155
|
+
@request = request
|
156
|
+
@response = response
|
157
|
+
@args = *args
|
158
|
+
@input = request.body
|
159
|
+
|
160
|
+
super *args
|
161
|
+
end
|
162
|
+
|
163
|
+
def header(options = "text/html")
|
164
|
+
if options.is_a?(String)
|
165
|
+
@response['Content-Type'] = options unless @response['Content-Type']
|
166
|
+
else
|
167
|
+
@response['Content-Length'] = options.delete('Content-Length').to_s if options['Content-Length']
|
168
|
+
|
169
|
+
@response['Content-Type'] = options.delete('type') || "text/html"
|
170
|
+
@response['Content-Type'] += "; charset=" + options.delete('charset') if options['charset']
|
171
|
+
|
172
|
+
@response['Content-Language'] = options.delete('language') if options['language']
|
173
|
+
@response['Expires'] = options.delete('expires') if options['expires']
|
174
|
+
|
175
|
+
@response.status = options.delete('Status') if options['Status']
|
176
|
+
|
177
|
+
# Convert 'cookie' header to 'Set-Cookie' headers.
|
178
|
+
# Because Set-Cookie header can appear more the once in the response body,
|
179
|
+
# we store it in a line break seperated string that will be translated to
|
180
|
+
# multiple Set-Cookie header by the handler.
|
181
|
+
if cookie = options.delete('cookie')
|
182
|
+
cookies = []
|
183
|
+
|
184
|
+
case cookie
|
185
|
+
when Array then cookie.each { |c| cookies << c.to_s }
|
186
|
+
when Hash then cookie.each { |_, c| cookies << c.to_s }
|
187
|
+
else cookies << cookie.to_s
|
188
|
+
end
|
189
|
+
|
190
|
+
@output_cookies.each { |c| cookies << c.to_s } if @output_cookies
|
191
|
+
|
192
|
+
@response['Set-Cookie'] = cookies unless cookies.empty?
|
193
|
+
end
|
194
|
+
|
195
|
+
options.each { |k,v| @response[k] = v }
|
196
|
+
end
|
197
|
+
|
198
|
+
""
|
199
|
+
end
|
200
|
+
|
201
|
+
def params
|
202
|
+
@params ||= @request.params
|
203
|
+
end
|
204
|
+
|
205
|
+
def cookies
|
206
|
+
@request.cookies
|
207
|
+
end
|
208
|
+
|
209
|
+
def query_string
|
210
|
+
@request.query_string
|
211
|
+
end
|
212
|
+
|
213
|
+
# Used to wrap the normal args variable used inside CGI.
|
214
|
+
def args
|
215
|
+
@args
|
216
|
+
end
|
217
|
+
|
218
|
+
# Used to wrap the normal env_table variable used inside CGI.
|
219
|
+
def env_table
|
220
|
+
@request.env
|
221
|
+
end
|
222
|
+
|
223
|
+
# Used to wrap the normal stdinput variable used inside CGI.
|
224
|
+
def stdinput
|
225
|
+
@input
|
226
|
+
end
|
227
|
+
|
228
|
+
def stdoutput
|
229
|
+
STDERR.puts "stdoutput should not be used."
|
230
|
+
@response.body
|
231
|
+
end
|
232
|
+
end
|
233
|
+
|
234
|
+
private
|
235
|
+
|
236
|
+
def setup_logger
|
237
|
+
#Based on the server log level adjust rails log level as well
|
238
|
+
|
239
|
+
if $glassfish_log_level
|
240
|
+
begin
|
241
|
+
log_level = ActiveSupport::BufferedLogger.const_get($glassfish_log_level)
|
242
|
+
rescue
|
243
|
+
# We do nothing. This just means that user has not explicitly asked to change the log level
|
244
|
+
end
|
245
|
+
end
|
246
|
+
|
247
|
+
if defined?(::RAILS_DEFAULT_LOGGER)
|
248
|
+
class << ::RAILS_DEFAULT_LOGGER # Make these accessible to wire in the log device
|
249
|
+
public :instance_variable_get, :instance_variable_set
|
250
|
+
end
|
251
|
+
if defined?(ActiveSupport::BufferedLogger) # Rails 2.x
|
252
|
+
old_device = ::RAILS_DEFAULT_LOGGER.instance_variable_get "@log"
|
253
|
+
old_device.close rescue nil
|
254
|
+
::RAILS_DEFAULT_LOGGER.instance_variable_set "@log", @rails_grizzly_helper.logdev
|
255
|
+
else # Rails 1.x
|
256
|
+
old_device = ::RAILS_DEFAULT_LOGGER.instance_variable_get "@logdev"
|
257
|
+
old_device.close rescue nil
|
258
|
+
::RAILS_DEFAULT_LOGGER.instance_variable_set "@logdev", Logger::LogDevice.new(@rails_grizzly_helper.logdev)
|
259
|
+
end
|
260
|
+
::RAILS_DEFAULT_LOGGER.level = log_level if log_level
|
261
|
+
$gf_ruby_log_level = ::RAILS_DEFAULT_LOGGER.level
|
262
|
+
end
|
263
|
+
end
|
264
|
+
|
265
|
+
end
|
266
|
+
end
|
267
|
+
end
|
268
|
+
|
@@ -0,0 +1,59 @@
|
|
1
|
+
#
|
2
|
+
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
3
|
+
#
|
4
|
+
# Copyright 2007-2008 Sun Microsystems, Inc. All rights reserved.
|
5
|
+
#
|
6
|
+
# The contents of this file are subject to the terms of either the GNU
|
7
|
+
# General Public License Version 2 only ("GPL") or the Common Development
|
8
|
+
# and Distribution License("CDDL") (collectively, the "License"). You
|
9
|
+
# may not use this file except in compliance with the License. You can obtain
|
10
|
+
# a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
|
11
|
+
# or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
|
12
|
+
# language governing permissions and limitations under the License.
|
13
|
+
#
|
14
|
+
# When distributing the software, include this License Header Notice in each
|
15
|
+
# file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
|
16
|
+
# Sun designates this particular file as subject to the "Classpath" exception
|
17
|
+
# as provided by Sun in the GPL Version 2 section of the License file that
|
18
|
+
# accompanied this code. If applicable, add the following below the License
|
19
|
+
# Header, with the fields enclosed by brackets [] replaced by your own
|
20
|
+
# identifying information: "Portions Copyrighted [year]
|
21
|
+
# [name of copyright owner]"
|
22
|
+
#
|
23
|
+
# Contributor(s):
|
24
|
+
#
|
25
|
+
# If you wish your version of this file to be governed by only the CDDL or
|
26
|
+
# only the GPL Version 2, indicate your decision by adding "[Contributor]
|
27
|
+
# elects to include this software in this distribution under the [CDDL or GPL
|
28
|
+
# Version 2] license." If you don't indicate a single choice of license, a
|
29
|
+
# recipient has the option to distribute your version of this file under
|
30
|
+
# either the CDDL, the GPL Version 2 or to extend the choice of license to
|
31
|
+
# its licensees as provided above. However, if you add GPL Version 2 code
|
32
|
+
# and therefore, elected the GPL Version 2 license, then the option applies
|
33
|
+
# only if the new code is made subject to such option by the copyright
|
34
|
+
# holder.
|
35
|
+
#
|
36
|
+
require 'jruby/rack/grizzly_helper'
|
37
|
+
module Rack
|
38
|
+
module Handler
|
39
|
+
class Grizzly
|
40
|
+
def initialize(rack_app)
|
41
|
+
@rack_app = rack_app
|
42
|
+
end
|
43
|
+
def self.run (rack_app, *args)
|
44
|
+
@rack_app = rack_app
|
45
|
+
$grizzly_rack_app = rack_app
|
46
|
+
#Look at me, I'm a dummy method
|
47
|
+
end
|
48
|
+
def self.stop
|
49
|
+
#I'm another dummy method
|
50
|
+
end
|
51
|
+
def self.method_missing (m, *args)
|
52
|
+
puts "Someone tried to call #{m} on Rack::Handler::Grizzly!"
|
53
|
+
end
|
54
|
+
def call(env)
|
55
|
+
JRuby::Rack::Response.new(@rack_app.call(env))
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
data/lib/server.rb
ADDED
@@ -0,0 +1,164 @@
|
|
1
|
+
#--
|
2
|
+
#DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
3
|
+
#
|
4
|
+
#Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
|
5
|
+
#
|
6
|
+
#The contents of this file are subject to the terms of either the GNU
|
7
|
+
#General Public License Version 2 only ("GPL") or the Common Development
|
8
|
+
#and Distribution License("CDDL") (collectively, the "License"). You
|
9
|
+
#may not use this file except in compliance with the License. You can obtain
|
10
|
+
#a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
|
11
|
+
#or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
|
12
|
+
#language governing permissions and limitations under the License.
|
13
|
+
#
|
14
|
+
#When distributing the software, include this License Header Notice in each
|
15
|
+
#file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
|
16
|
+
#Sun designates this particular file as subject to the "Classpath" exception
|
17
|
+
#as provided by Sun in the GPL Version 2 section of the License file that
|
18
|
+
#accompanied this code. If applicable, add the following below the License
|
19
|
+
#Header, with the fields enclosed by brackets [] replaced by your own
|
20
|
+
#identifying information: "Portions Copyrighted [year]
|
21
|
+
#[name of copyright owner]"
|
22
|
+
#
|
23
|
+
#Contributor(s):
|
24
|
+
#
|
25
|
+
#If you wish your version of this file to be governed by only the CDDL or
|
26
|
+
#only the GPL Version 2, indicate your decision by adding "[Contributor]
|
27
|
+
#elects to include this software in this distribution under the [CDDL or GPL
|
28
|
+
#Version 2] license." If you don't indicate a single choice of license, a
|
29
|
+
#recipient has the option to distribute your version of this file under
|
30
|
+
#either the CDDL, the GPL Version 2 or to extend the choice of license to
|
31
|
+
#its licensees as provided above. However, if you add GPL Version 2 code
|
32
|
+
#and therefore, elected the GPL Version 2 license, then the option applies
|
33
|
+
#only if the new code is made subject to such option by the copyright
|
34
|
+
#holder.
|
35
|
+
#++
|
36
|
+
|
37
|
+
#
|
38
|
+
# Invokes and runs GlassFish
|
39
|
+
#
|
40
|
+
|
41
|
+
#Loads all the jars
|
42
|
+
$LOAD_PATH << "#{File.dirname(__FILE__)}/../lib/java"
|
43
|
+
|
44
|
+
require 'java'
|
45
|
+
require 'glassfish-gem.jar'
|
46
|
+
require 'akuma.jar'
|
47
|
+
require 'yaml'
|
48
|
+
require 'ftools'
|
49
|
+
require 'version'
|
50
|
+
require 'config'
|
51
|
+
|
52
|
+
module GlassFish
|
53
|
+
class Server
|
54
|
+
import "org.glassfish.scripting.gem.GlassFishMain"
|
55
|
+
import "org.glassfish.scripting.gem.Options"
|
56
|
+
|
57
|
+
java.lang.System.setProperty("addtional.load.path", "#{File.dirname(__FILE__)}/../lib")
|
58
|
+
|
59
|
+
attr_accessor :opts
|
60
|
+
|
61
|
+
def initialize(args, &block)
|
62
|
+
|
63
|
+
unless args[:log_level].nil?
|
64
|
+
if args[:log_level] > 4
|
65
|
+
puts "Arguments: "
|
66
|
+
args.each do |k, v|
|
67
|
+
puts "\t#{k}=>#{v}"
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
if args[:log_level] > 3
|
72
|
+
debug = true
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
76
|
+
|
77
|
+
java.lang.System.getProperties().put("jruby.runtime", JRuby.runtime) unless args[:daemon]
|
78
|
+
|
79
|
+
@opts = Options.new
|
80
|
+
@opts.runtimes = args[:runtimes]
|
81
|
+
@opts.runtimes_min = args[:runtimes_min]
|
82
|
+
@opts.runtimes_max = args[:runtimes_max]
|
83
|
+
@opts.environment = args[:environment]
|
84
|
+
@opts.port = args[:port]
|
85
|
+
@opts.address = args[:address]
|
86
|
+
@opts.contextRoot = args[:contextroot]
|
87
|
+
@opts.appDir = args[:app_dir]
|
88
|
+
@opts.daemon = args[:daemon]
|
89
|
+
@opts.pid = args[:pid]
|
90
|
+
@opts.log = args[:log]
|
91
|
+
@opts.log_console = args[:log_console]
|
92
|
+
@opts.domainDir = args[:domain_dir]
|
93
|
+
@opts.log_level = args[:log_level]
|
94
|
+
@opts.jvm_opts = args[:jvm_options]
|
95
|
+
|
96
|
+
|
97
|
+
unless args[:grizzly_config].nil?
|
98
|
+
args[:grizzly_config].each do |key, val|
|
99
|
+
case key
|
100
|
+
when "chunking-enabled"
|
101
|
+
@opts.grizzlyConfig.chunkingEnabled = val unless val.nil?
|
102
|
+
when "request-timeout"
|
103
|
+
@opts.grizzlyConfig.requestTimeout = val unless val.nil?
|
104
|
+
when "send-buffer-size"
|
105
|
+
@opts.grizzlyConfig.sendBufferSize = val unless val.nil?
|
106
|
+
when "max-keepalive-connextions"
|
107
|
+
@opts.grizzlyConfig.maxKeepaliveConnections = val unless val.nil?
|
108
|
+
when "keepalive-timeout"
|
109
|
+
@opts.grizzlyConfig.keepaliveTimeout = val unless val.nil?
|
110
|
+
when "thread-pool"
|
111
|
+
unless val.nil?
|
112
|
+
val.each do |k, v|
|
113
|
+
case k
|
114
|
+
when "idle-thread-timeout-seconds"
|
115
|
+
@opts.grizzlyConfig.threadPool.idleThreadTimeoutSeconds = v unless v.nil?
|
116
|
+
when "max-queue-size"
|
117
|
+
@opts.grizzlyConfig.threadPool.maxQueueSize = v unless v.nil?
|
118
|
+
when "max-thread-pool-size"
|
119
|
+
@opts.grizzlyConfig.threadPool.maxThreadPoolSize = v unless v.nil?
|
120
|
+
when "min-thread-pool-size"
|
121
|
+
@opts.grizzlyConfig.threadPool.minThreadPoolSize = v unless v.nil?
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
#Create the app using Rack builder
|
130
|
+
if(block)
|
131
|
+
app = Rack::Builder.new(&block).to_app
|
132
|
+
app = Rack::CommonLogger.new(@app) if debug
|
133
|
+
if app.nil?
|
134
|
+
app = block
|
135
|
+
end
|
136
|
+
@opts.app = app;
|
137
|
+
|
138
|
+
java.lang.System.getProperties().put("glassfish.rackupApp", app)
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
def self.start(args, &block)
|
143
|
+
#Validate the command line options
|
144
|
+
args = GlassFish::Config.init_opts.merge! args
|
145
|
+
Config.new.validate! args
|
146
|
+
new(args, &block).start!
|
147
|
+
end
|
148
|
+
|
149
|
+
def start
|
150
|
+
GlassFishMain.start @opts
|
151
|
+
end
|
152
|
+
alias :start! :start
|
153
|
+
|
154
|
+
def stop
|
155
|
+
GlassFishMain.start @opts
|
156
|
+
end
|
157
|
+
|
158
|
+
def name
|
159
|
+
"GlassFish v3 server"
|
160
|
+
end
|
161
|
+
|
162
|
+
alias :to_s :name
|
163
|
+
end
|
164
|
+
end
|