glassfish 0.9.5-universal-java → 1.0.0-universal-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. data/History.txt +247 -0
  2. data/LICENSE.txt +774 -0
  3. data/README.txt +140 -0
  4. data/bin/gfrake +5 -1
  5. data/bin/glassfish +5 -7
  6. data/generators/gfrake/templates/glassfish.yml +39 -0
  7. data/lib/command_line_parser.rb +29 -40
  8. data/lib/config.rb +57 -63
  9. data/lib/glassfish.rb +3 -79
  10. data/{modules → lib/java}/akuma.jar +0 -0
  11. data/lib/java/gf-jruby-connector.jar +0 -0
  12. data/lib/java/glassfish-embedded-nucleus.jar +0 -0
  13. data/lib/java/glassfish-gem.jar +0 -0
  14. data/lib/java/grizzly-jruby-module.jar +0 -0
  15. data/lib/java/grizzly-jruby.jar +0 -0
  16. data/lib/jruby/rack/grizzly_helper.rb +230 -0
  17. data/lib/jruby/rack/merb.rb +34 -0
  18. data/lib/jruby/rack/rackup.rb +46 -0
  19. data/lib/jruby/rack/rails.rb +29 -0
  20. data/lib/jruby/rack/sinatra.rb +18 -0
  21. data/lib/jruby/rails_path.rb +11 -0
  22. data/lib/{templates/profile.properties → rack/adapter/merb.rb} +18 -7
  23. data/lib/rack/adapter/rails.rb +268 -0
  24. data/lib/rack/handler/grizzly.rb +59 -0
  25. data/lib/server.rb +164 -0
  26. data/lib/version.rb +1 -1
  27. metadata +83 -153
  28. data/bin/glassfish_rails +0 -61
  29. data/config/asadminenv.conf +0 -6
  30. data/config/asenv.bat +0 -29
  31. data/config/asenv.conf +0 -31
  32. data/config/glassfish.container +0 -4
  33. data/domains/domain1/config/admin-keyfile +0 -3
  34. data/domains/domain1/config/cacerts.jks +0 -0
  35. data/domains/domain1/config/default-web.xml +0 -1133
  36. data/domains/domain1/config/domain-passwords +0 -0
  37. data/domains/domain1/config/domain.xml +0 -190
  38. data/domains/domain1/config/glassfish_gem_version.yml +0 -7
  39. data/domains/domain1/config/keyfile +0 -6
  40. data/domains/domain1/config/keystore.jks +0 -0
  41. data/domains/domain1/config/logging.properties +0 -46
  42. data/domains/domain1/config/login.conf +0 -21
  43. data/domains/domain1/config/server.policy +0 -170
  44. data/domains/domain1/config/sun-acc.xml +0 -40
  45. data/domains/domain1/docroot/index.html +0 -83
  46. data/domains/domain1/master-password +0 -0
  47. data/lib/appclient/appclientlogin.conf +0 -10
  48. data/lib/appclient/client.policy +0 -79
  49. data/lib/appclient/wss-client-config-1.0.xml +0 -84
  50. data/lib/appclient/wss-client-config-2.0.xml +0 -96
  51. data/lib/registration/servicetag-registry.xml +0 -18
  52. data/lib/templates/cacerts.jks +0 -0
  53. data/lib/templates/default-web.xml +0 -1133
  54. data/lib/templates/docroot/index.html +0 -83
  55. data/lib/templates/domain.xml +0 -180
  56. data/lib/templates/domain.xml.xsl +0 -100
  57. data/lib/templates/keyfile +0 -6
  58. data/lib/templates/keystore.jks +0 -0
  59. data/lib/templates/logging.properties +0 -48
  60. data/lib/templates/login.conf +0 -21
  61. data/lib/templates/server.policy +0 -170
  62. data/lib/templates/sun-acc.xml +0 -40
  63. data/modules/admin-cli.jar +0 -0
  64. data/modules/api-exporter.jar +0 -0
  65. data/modules/asm-all-repackaged.jar +0 -0
  66. data/modules/auto-depends.jar +0 -0
  67. data/modules/bean-validator.jar +0 -0
  68. data/modules/branding.jar +0 -0
  69. data/modules/cli-framework.jar +0 -0
  70. data/modules/common-util.jar +0 -0
  71. data/modules/config-api.jar +0 -0
  72. data/modules/config.jar +0 -0
  73. data/modules/deployment-admin.jar +0 -0
  74. data/modules/deployment-autodeploy.jar +0 -0
  75. data/modules/deployment-common.jar +0 -0
  76. data/modules/flashlight-agent.jar +0 -0
  77. data/modules/flashlight-framework.jar +0 -0
  78. data/modules/gf-jruby-connector.jar +0 -0
  79. data/modules/gfprobe-provider-client.jar +0 -0
  80. data/modules/glassfish-api.jar +0 -0
  81. data/modules/glassfish-ee-api.jar +0 -0
  82. data/modules/glassfish-extra-jre-packages.jar +0 -0
  83. data/modules/glassfish-gem.jar +0 -0
  84. data/modules/glassfish.jar +0 -0
  85. data/modules/grizzly-comet.jar +0 -0
  86. data/modules/grizzly-cometd.jar +0 -0
  87. data/modules/grizzly-compat.jar +0 -0
  88. data/modules/grizzly-config.jar +0 -0
  89. data/modules/grizzly-framework.jar +0 -0
  90. data/modules/grizzly-http.jar +0 -0
  91. data/modules/grizzly-jruby-module.jar +0 -0
  92. data/modules/grizzly-jruby.jar +0 -0
  93. data/modules/grizzly-messagesbus.jar +0 -0
  94. data/modules/grizzly-portunif.jar +0 -0
  95. data/modules/grizzly-rcm.jar +0 -0
  96. data/modules/grizzly-utils.jar +0 -0
  97. data/modules/hk2-core.jar +0 -0
  98. data/modules/hk2.jar +0 -0
  99. data/modules/internal-api.jar +0 -0
  100. data/modules/kernel.jar +0 -0
  101. data/modules/launcher.jar +0 -0
  102. data/modules/org.apache.felix.configadmin.jar +0 -0
  103. data/modules/org.apache.felix.fileinstall.jar +0 -0
  104. data/modules/org.apache.felix.shell.jar +0 -0
  105. data/modules/org.apache.felix.shell.remote.jar +0 -0
  106. data/modules/org.apache.felix.shell.tui.jar +0 -0
  107. data/modules/osgi-main.jar +0 -0
  108. data/modules/pkg-client.jar +0 -0
  109. data/modules/tiger-types-osgi.jar +0 -0
@@ -1,79 +1,3 @@
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
- require 'java'
37
- require 'glassfish-gem.jar'
38
- require 'glassfish.jar'
39
- require 'akuma.jar'
40
- require 'yaml'
41
- require 'ftools'
42
- require 'version'
43
-
44
-
45
- #
46
- #Invokes and runs GlassFish
47
- #
48
- module GlassFish
49
- class Server
50
- import "org.glassfish.scripting.gem.GlassFishMain"
51
- import "org.glassfish.scripting.gem.Options"
52
-
53
- def startup(args)
54
- if args[:log_level] > 4
55
- puts "Arguments: "
56
- args.each do |k, v|
57
- puts "\t#{k}=>#{v}"
58
- end
59
- end
60
-
61
- opts = Options.new()
62
- opts.runtimes = args[:runtimes]
63
- opts.runtimes_min = args[:runtimes_min]
64
- opts.runtimes_max = args[:runtimes_max]
65
- opts.environment = args[:environment]
66
- opts.port = args[:port]
67
- opts.contextRoot = args[:contextroot]
68
- opts.appDir = args[:app_dir]
69
- opts.daemon = args[:daemon]
70
- opts.pid = args[:pid]
71
- opts.log = args[:log]
72
- opts.log_console = args[:log_console]
73
- opts.domainDir = args[:domain_dir]
74
- opts.log_level = args[:log_level]
75
- opts.jvm_opts = args[:jvm_options]
76
- gf = GlassFishMain.start opts
77
- end
78
- end
79
- end
1
+ require 'rack'
2
+ require 'server'
3
+ require 'command_line_parser'
File without changes
@@ -0,0 +1,230 @@
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
+
37
+ module JRuby
38
+ module Rack
39
+ class Response
40
+ include Java::com.sun.grizzly.jruby.rack.RackResponse
41
+ def initialize(arr)
42
+ @status, @headers, @body = *arr
43
+ end
44
+
45
+ def getStatus
46
+ @status
47
+ end
48
+
49
+ def getHeaders
50
+ @headers
51
+ end
52
+
53
+ def getBody
54
+ b = ""
55
+ begin
56
+ @body.each {|part| b << part }
57
+ ensure
58
+ @body.close if @body.respond_to? :close
59
+ end
60
+ b
61
+ end
62
+
63
+ def respond(response)
64
+ if fwd = @headers["Forward"]
65
+ fwd.call(response)
66
+ else
67
+ write_status(response)
68
+ write_headers(response)
69
+ write_body(response)
70
+ end
71
+ end
72
+
73
+ def write_status(response)
74
+ response.setStatus(@status.to_i)
75
+ end
76
+
77
+ def write_headers(response)
78
+ mime_headers = response.getResponse().getMimeHeaders()
79
+
80
+ @headers.each do |k,v|
81
+ case k
82
+ when /^Content-Type$/i
83
+ response.content_type = v.to_s
84
+ when /^Content-Length$/i
85
+ response.content_length = v.to_i
86
+ else
87
+ if v.respond_to?(:each)
88
+ v.each do |val|
89
+ len = rstrip_newline(val)
90
+ mime_headers.addValue(k.to_java_bytes,0, k.length).setBytes(val.to_java_bytes, 0, len)
91
+ end
92
+ else
93
+ len = rstrip_newline(v)
94
+ mime_headers.addValue(k.to_java_bytes,0, k.length).setBytes(val.to_java_bytes, 0, val.length)
95
+ end
96
+ end
97
+ end
98
+ end
99
+
100
+ # Strips off any \r or \n from the end of the
101
+ # v MUST not be null
102
+ def rstrip_newline(v)
103
+ len = v.size
104
+ (v.size-1).downto(0) do |i|
105
+ if(v[i] == 10 || v[i] == 13)
106
+ len -= 1
107
+ end
108
+ end
109
+ len
110
+ end
111
+
112
+
113
+ def write_body(response)
114
+ stream = response.output_stream
115
+ begin
116
+ @body.each do |el|
117
+ stream.write(el.to_java_bytes)
118
+ end
119
+ ensure
120
+ @body.close if @body.respond_to? :close
121
+ end
122
+ end
123
+ end
124
+
125
+
126
+ class GrizzlyLog
127
+ def initialize(logger = $logger)
128
+ @logger = logger
129
+ end
130
+ def puts(msg)
131
+ write msg.to_s
132
+ end
133
+
134
+ def write(msg)
135
+ case $gf_ruby_log_level
136
+ when 3,4,5 then @logger.severe("#{msg}")
137
+ when 2 then @logger.warning("#{msg}")
138
+ when 0,1 then @logger.info("#{msg}")
139
+ else @logger.info("#{msg}")
140
+ end
141
+ end
142
+
143
+ def flush; end
144
+ def close; end
145
+ end
146
+
147
+ class GrizzlyHelper
148
+ attr_reader :public_root, :gem_path
149
+
150
+ def initialize(glassfish_config = nil)
151
+ @glassfish_config = glassfish_config || $glassfish_config
152
+ @public_root = File.join(@glassfish_config.app_root, "public")
153
+ @gem_path = @glassfish_config.gem_path
154
+ setup_gems
155
+ end
156
+
157
+ def logdev
158
+ @logdev ||= GrizzlyLog.new
159
+ end
160
+
161
+ def logger
162
+ @logger ||= begin; require 'logger'; Logger.new(logdev); end
163
+ end
164
+
165
+ def setup_gems
166
+ ENV['GEM_PATH'] = @gem_path
167
+ end
168
+
169
+ def self.instance
170
+ @instance ||= self.new
171
+ end
172
+ end
173
+
174
+ class Errors
175
+ def initialize(file_server)
176
+ @file_server = file_server
177
+ end
178
+
179
+ def call(env)
180
+ [code = response_code(env), *response_content(env, code)]
181
+ end
182
+
183
+ def response_code(env)
184
+ exc = env['rack.exception']
185
+ if exc
186
+ env['rack.showstatus.detail'] = exc.getMessage
187
+ if exc.getCause.kind_of?(Java::JavaLang::InterruptedException)
188
+ 503
189
+ else
190
+ 500
191
+ end
192
+ else
193
+ 500
194
+ end
195
+ end
196
+
197
+ def response_content(env, code)
198
+ @responses ||= Hash.new do |h,k|
199
+ env["PATH_INFO"] = "/#{code}.html"
200
+ response = @file_server.call(env)
201
+ body = response[2]
202
+ unless Array === body
203
+ newbody = ""
204
+ body.each do |chunk|
205
+ newbody << chunk
206
+ end
207
+ response[2] = [newbody]
208
+ end
209
+ h[k] = response
210
+ end
211
+ response = @responses[code]
212
+ if response[0] != 404
213
+ env["rack.showstatus.detail"] = nil
214
+ response[1..2]
215
+ else
216
+ [{}, []]
217
+ end
218
+ end
219
+ end
220
+
221
+ class ErrorsApp
222
+ def self.new
223
+ ::Rack::Builder.new {
224
+ use ::Rack::ShowStatus
225
+ run Errors.new(::Rack::File.new(GrizzlyHelper.instance.public_root))
226
+ }.to_app
227
+ end
228
+ end
229
+ end
230
+ end
@@ -0,0 +1,34 @@
1
+ # Merb init file.
2
+ # Thanks to Yehuda Katz for coding help
3
+
4
+ #translate merb/Glassfish log levels
5
+
6
+ #load required files
7
+ require 'rubygems'
8
+ gem 'merb-core', '>= 0'
9
+ require 'merb-core'
10
+ require 'rack/handler/grizzly'
11
+ require 'rack/adapter/merb'
12
+ Merb::Rack::Adapter.register %w{grizzly}, :GrizzlyMerb
13
+
14
+ #Figure out the correct log level to use
15
+ case $glassfish_log_level
16
+ when "FATAL" then log_level = :fatal
17
+ when "ERROR" then log_level = :error
18
+ when "WARN" then log_level = :warn
19
+ when "INFO" then log_level = :info
20
+ when "DEBUG" then log_level = :debug
21
+ end
22
+
23
+ # Set up the server and log stream, supress merb signal trapping
24
+ Merb.disable(:signals)
25
+
26
+ # Start merb
27
+ Merb.start({
28
+ :environment => $glassfish_config.environment,
29
+ :merb_root => $glassfish_config.appRoot,
30
+ :adapter => "grizzly",
31
+ :log_level => log_level,
32
+ :path_prefix => $glassfish_config.contextRoot == "/"?
33
+ nil:$glassfish_config.contextRoot
34
+ })
@@ -0,0 +1,46 @@
1
+ require 'rubygems'
2
+
3
+ begin
4
+ gem 'rack'
5
+ require 'rack'
6
+ rescue LoadError
7
+ error = <<EOF
8
+ ###
9
+ ERROR : Is rack installed? Install using 'gem install rack'
10
+ ###
11
+ EOF
12
+ puts "\n"+error
13
+ end
14
+
15
+
16
+ def get_rackup_app(config, env={})
17
+ config ||= "config.ru"
18
+ #Load all the files inside this directory
19
+ $: << "#{File.dirname(config)}"
20
+
21
+ #Read contents of rackup script
22
+ config_data = File.read(config)
23
+
24
+ #create an app based on whats given by the rackup script
25
+ inner_app = eval "Rack::Builder.new {( " + config_data + "\n )}.to_app",nil, config
26
+
27
+ case env
28
+ when "development", "test"
29
+ app = Rack::Builder.new {
30
+ use Rack::CommonLogger, $stderr
31
+ use Rack::ShowExceptions
32
+ use Rack::Lint
33
+ run inner_app
34
+ }.to_app
35
+
36
+ when "deployment", "production"
37
+ app = Rack::Builder.new {
38
+ use Rack::CommonLogger, $stderr
39
+ run inner_app
40
+ }.to_app
41
+
42
+ when "none"
43
+ app = inner_app
44
+ end
45
+
46
+ end
@@ -0,0 +1,29 @@
1
+ require 'jruby/rack/grizzly_helper'
2
+ require 'rack/adapter/rails'
3
+
4
+ module JRuby
5
+ module Rack
6
+ class RailsGrizzlyHelper < GrizzlyHelper
7
+ attr_accessor :rails_env, :rails_root, :context_root
8
+
9
+ def initialize(glassfish_config = nil)
10
+ super
11
+ @rails_root = @glassfish_config.app_root
12
+ @rails_env = @glassfish_config.environment
13
+ @context_root = @glassfish_config.context_root
14
+ end
15
+
16
+ def options
17
+ {:public => public_root, :root => rails_root, :environment => rails_env, :prefix=>context_root}
18
+ end
19
+
20
+ end
21
+
22
+ class RailsFactory
23
+ def self.new
24
+ helper = RailsGrizzlyHelper.instance
25
+ ::Rack::Adapter::Rails.new(helper)
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,18 @@
1
+ require 'rack/handler/grizzly'
2
+ $: << "#{File.dirname($glassfish_appFile)}"
3
+ load $glassfish_appFile
4
+ disable :run
5
+
6
+ set :server, 'grizzly'
7
+ set :environment, $rackEnv.to_sym
8
+ set :root, $glassfish_appRoot
9
+ set :port, 0000
10
+ set :views, $glassfish_appRoot + '/views'
11
+ set :public, $glassfish_appRoot + '/public'
12
+ set :sessions, false
13
+ set :logging, true
14
+ set :app_file, $glassfish_appFile
15
+ set :adapter, 'grizzly'
16
+
17
+
18
+ $grizzly_rack_app