bee_java 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/bin/beedoc CHANGED
@@ -18,7 +18,6 @@
18
18
 
19
19
  $:.unshift(File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib')))
20
20
  require 'rubygems'
21
- require 'bee'
22
21
  require 'erb'
23
22
  require 'fileutils'
24
23
  require 'yaml'
data/build/README CHANGED
@@ -20,4 +20,4 @@ or go to URL http://www.apache.org/licenses/LICENSE-2.0).
20
20
 
21
21
  = Copyright
22
22
 
23
- Bee_java version 0.0.2 (C) Michel Casabianca - 2008-2010
23
+ Bee_java version 0.0.3 (C) Michel Casabianca - 2008-2010
data/egg/lib/build.erb CHANGED
@@ -1,5 +1,5 @@
1
- - build: <%= name %>
2
- default: all
1
+ - build: <%= name %>
2
+ default: all
3
3
  description: Build file for project <%= name.capitalize %>
4
4
 
5
5
  - properties:
@@ -0,0 +1 @@
1
+ Manifest-Version: 1.0
@@ -0,0 +1,20 @@
1
+ package <%= _package %>;
2
+
3
+ import java.io.*;
4
+ import javax.servlet.*;
5
+
6
+ public class <%= _main_class %>
7
+ extends GenericServlet {
8
+
9
+ public void service(ServletRequest request, ServletResponse response)
10
+ throws ServletException, IOException {
11
+ ServletOutputStream out = response.getOutputStream() ;
12
+ out.println("<HTML><HEAD>") ;
13
+ out.println("<TITLE>Hello World!</TITLE>") ;
14
+ out.println("</HEAD>") ;
15
+ out.println("<BODY>") ;
16
+ out.println("<H3>Hello World!</H3>") ;
17
+ out.println("</BODY></HTML>") ;
18
+ }
19
+
20
+ }
@@ -0,0 +1,12 @@
1
+ package <%= _package %>;
2
+
3
+ import junit.framework.TestCase;
4
+
5
+ public class <%= _test_class %>
6
+ extends TestCase {
7
+
8
+ public void test() {
9
+ assertTrue(true);
10
+ }
11
+
12
+ }
@@ -0,0 +1,96 @@
1
+ - build: <%= name %>
2
+ default: all
3
+ description: Build file for project Test
4
+ extends: tomcat.yml
5
+
6
+ - properties:
7
+ name: "<%= name %>"
8
+ version: "0.0.1"
9
+ src: "src"
10
+ test: "test"
11
+ build: "build"
12
+ classes: "#{build}/classes"
13
+ test_classes: "#{build}/test-classes"
14
+ jar: "#{build}/#{name}-#{version}.jar"
15
+ clean_dirs:
16
+ - :build
17
+ - "#{tomcat_base}/logs/*"
18
+ - "#{tomcat_base}/work/*"
19
+ - "#{tomcat_base}/temp/*"
20
+ clean_files: []
21
+
22
+ - target: classpath
23
+ description: Build classpath
24
+ script:
25
+ - java.classpath:
26
+ classpath: classpath
27
+ directories: [:classes, :test_classes]
28
+
29
+ - target: compile
30
+ depends: classpath
31
+ description: Compile Java source files
32
+ script:
33
+ - java.javac:
34
+ src: :src
35
+ dest: :classes
36
+ classpath: :classpath
37
+
38
+ - target: test
39
+ depends: compile
40
+ description: Run unit tests
41
+ script:
42
+ - java.javac:
43
+ src: :test
44
+ dest: :test_classes
45
+ classpath: :classpath
46
+ - java.junit:
47
+ src: :test
48
+ classpath: :classpath
49
+
50
+ - target: jar
51
+ depends: test
52
+ description: Generate JAR archive
53
+ script:
54
+ - java.jar:
55
+ src: :classes
56
+ dest: :jar
57
+
58
+ - target: web
59
+ depends: jar
60
+ description: Generate web archive
61
+ script:
62
+ - mkdir: "#{build}/web"
63
+ - copy:
64
+ root: web
65
+ dest: "#{build}/web"
66
+ - mkdir: "#{build}/web/WEB-INF/lib"
67
+ - cp:
68
+ src: :jar
69
+ dest: "#{build}/web/WEB-INF/lib"
70
+
71
+ - target: war
72
+ depends: web
73
+ description: Build the WAR archive
74
+ script:
75
+ - zip:
76
+ root: "#{build}/web"
77
+ dest: "#{build}/#{name}-#{version}.war"
78
+
79
+ - target: run
80
+ depends: [web, tomcat_restart]
81
+ description: Run application using Tomcat
82
+
83
+ - target: logs
84
+ description: Print Tomcat logs on the console
85
+ script:
86
+ - "tail -f tomcat/logs/catalina.out"
87
+
88
+ - target: clean
89
+ description: Clean generated files
90
+ script:
91
+ - rmdir: :clean_dirs
92
+ - rm: :clean_files
93
+
94
+ - target: all
95
+ depends: [clean, run]
96
+ description: Clean and run application
@@ -0,0 +1,9 @@
1
+ - repository: http://www.ibiblio.org/maven2
2
+
3
+ - group: junit
4
+ artifact: junit
5
+ version: 4.3
6
+
7
+ - group: servletapi
8
+ artifact: servletapi
9
+ version: 2.4
@@ -0,0 +1,397 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ Licensed to the Apache Software Foundation (ASF) under one or more
4
+ contributor license agreements. See the NOTICE file distributed with
5
+ this work for additional information regarding copyright ownership.
6
+ The ASF licenses this file to You under the Apache License, Version 2.0
7
+ (the "License"); you may not use this file except in compliance with
8
+ the License. You may obtain a copy of the License at
9
+
10
+ http://www.apache.org/licenses/LICENSE-2.0
11
+
12
+ Unless required by applicable law or agreed to in writing, software
13
+ distributed under the License is distributed on an "AS IS" BASIS,
14
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ See the License for the specific language governing permissions and
16
+ limitations under the License.
17
+ -->
18
+ <!-- Example Server Configuration File -->
19
+ <!-- Note that component elements are nested corresponding to their
20
+ parent-child relationships with each other -->
21
+
22
+ <!-- A "Server" is a singleton element that represents the entire JVM,
23
+ which may contain one or more "Service" instances. The Server
24
+ listens for a shutdown command on the indicated port.
25
+
26
+ Note: A "Server" is not itself a "Container", so you may not
27
+ define subcomponents such as "Valves" or "Loggers" at this level.
28
+ -->
29
+
30
+ <Server port="8005" shutdown="SHUTDOWN">
31
+
32
+ <!-- Comment these entries out to disable JMX MBeans support used for the
33
+ administration web application -->
34
+ <Listener className="org.apache.catalina.core.AprLifecycleListener" />
35
+ <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />
36
+ <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
37
+ <Listener className="org.apache.catalina.storeconfig.StoreConfigLifecycleListener"/>
38
+
39
+ <!-- Global JNDI resources -->
40
+ <GlobalNamingResources>
41
+
42
+ <!-- Test entry for demonstration purposes -->
43
+ <Environment name="simpleValue" type="java.lang.Integer" value="30"/>
44
+
45
+ <!-- Editable user database that can also be used by
46
+ UserDatabaseRealm to authenticate users -->
47
+ <Resource name="UserDatabase" auth="Container"
48
+ type="org.apache.catalina.UserDatabase"
49
+ description="User database that can be updated and saved"
50
+ factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
51
+ pathname="conf/tomcat-users.xml" />
52
+
53
+ </GlobalNamingResources>
54
+
55
+ <!-- A "Service" is a collection of one or more "Connectors" that share
56
+ a single "Container" (and therefore the web applications visible
57
+ within that Container). Normally, that Container is an "Engine",
58
+ but this is not required.
59
+
60
+ Note: A "Service" is not itself a "Container", so you may not
61
+ define subcomponents such as "Valves" or "Loggers" at this level.
62
+ -->
63
+
64
+ <!-- Define the Tomcat Stand-Alone Service -->
65
+ <Service name="Catalina">
66
+
67
+ <!-- A "Connector" represents an endpoint by which requests are received
68
+ and responses are returned. Each Connector passes requests on to the
69
+ associated "Container" (normally an Engine) for processing.
70
+
71
+ By default, a non-SSL HTTP/1.1 Connector is established on port 8080.
72
+ You can also enable an SSL HTTP/1.1 Connector on port 8443 by
73
+ following the instructions below and uncommenting the second Connector
74
+ entry. SSL support requires the following steps (see the SSL Config
75
+ HOWTO in the Tomcat 5 documentation bundle for more detailed
76
+ instructions):
77
+ * If your JDK version 1.3 or prior, download and install JSSE 1.0.2 or
78
+ later, and put the JAR files into "$JAVA_HOME/jre/lib/ext".
79
+ * Execute:
80
+ %JAVA_HOME%\bin\keytool -genkey -alias tomcat -keyalg RSA (Windows)
81
+ $JAVA_HOME/bin/keytool -genkey -alias tomcat -keyalg RSA (Unix)
82
+ with a password value of "changeit" for both the certificate and
83
+ the keystore itself.
84
+
85
+ By default, DNS lookups are enabled when a web application calls
86
+ request.getRemoteHost(). This can have an adverse impact on
87
+ performance, so you can disable it by setting the
88
+ "enableLookups" attribute to "false". When DNS lookups are disabled,
89
+ request.getRemoteHost() will return the String version of the
90
+ IP address of the remote client.
91
+ -->
92
+
93
+ <!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
94
+ <Connector port="8080" maxHttpHeaderSize="8192"
95
+ maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
96
+ enableLookups="false" redirectPort="8443" acceptCount="100"
97
+ connectionTimeout="20000" disableUploadTimeout="true" />
98
+ <!-- Note : To disable connection timeouts, set connectionTimeout value
99
+ to 0 -->
100
+
101
+ <!-- Note : To use gzip compression you could set the following properties :
102
+
103
+ compression="on"
104
+ compressionMinSize="2048"
105
+ noCompressionUserAgents="gozilla, traviata"
106
+ compressableMimeType="text/html,text/xml"
107
+ -->
108
+
109
+ <!-- Define a SSL HTTP/1.1 Connector on port 8443 -->
110
+ <!--
111
+ <Connector port="8443" maxHttpHeaderSize="8192"
112
+ maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
113
+ enableLookups="false" disableUploadTimeout="true"
114
+ acceptCount="100" scheme="https" secure="true"
115
+ clientAuth="false" sslProtocol="TLS" />
116
+ -->
117
+
118
+ <!-- Define an AJP 1.3 Connector on port 8009 -->
119
+ <Connector port="8009"
120
+ enableLookups="false" redirectPort="8443" protocol="AJP/1.3" />
121
+
122
+ <!-- Define a Proxied HTTP/1.1 Connector on port 8082 -->
123
+ <!-- See proxy documentation for more information about using this. -->
124
+ <!--
125
+ <Connector port="8082"
126
+ maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
127
+ enableLookups="false" acceptCount="100" connectionTimeout="20000"
128
+ proxyPort="80" disableUploadTimeout="true" />
129
+ -->
130
+
131
+ <!-- An Engine represents the entry point (within Catalina) that processes
132
+ every request. The Engine implementation for Tomcat stand alone
133
+ analyzes the HTTP headers included with the request, and passes them
134
+ on to the appropriate Host (virtual host). -->
135
+
136
+ <!-- You should set jvmRoute to support load-balancing via AJP ie :
137
+ <Engine name="Standalone" defaultHost="localhost" jvmRoute="jvm1">
138
+ -->
139
+
140
+ <!-- Define the top level container in our container hierarchy -->
141
+ <Engine name="Catalina" defaultHost="localhost">
142
+
143
+ <!-- The request dumper valve dumps useful debugging information about
144
+ the request headers and cookies that were received, and the response
145
+ headers and cookies that were sent, for all requests received by
146
+ this instance of Tomcat. If you care only about requests to a
147
+ particular virtual host, or a particular application, nest this
148
+ element inside the corresponding <Host> or <Context> entry instead.
149
+
150
+ For a similar mechanism that is portable to all Servlet 2.4
151
+ containers, check out the "RequestDumperFilter" Filter in the
152
+ example application (the source for this filter may be found in
153
+ "$CATALINA_HOME/webapps/examples/WEB-INF/classes/filters").
154
+
155
+ Note that this Valve uses the platform's default character encoding.
156
+ This may cause problems for developers in another encoding, e.g.
157
+ UTF-8. Use the RequestDumperFilter instead.
158
+
159
+ Also note that enabling this Valve will write a ton of stuff to your
160
+ logs. They are likely to grow quite large. This extensive log writing
161
+ will definitely slow down your server.
162
+
163
+ Request dumping is disabled by default. Uncomment the following
164
+ element to enable it. -->
165
+ <!--
166
+ <Valve className="org.apache.catalina.valves.RequestDumperValve"/>
167
+ -->
168
+
169
+ <!-- Because this Realm is here, an instance will be shared globally -->
170
+
171
+ <!-- This Realm uses the UserDatabase configured in the global JNDI
172
+ resources under the key "UserDatabase". Any edits
173
+ that are performed against this UserDatabase are immediately
174
+ available for use by the Realm. -->
175
+ <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
176
+ resourceName="UserDatabase"/>
177
+
178
+ <!-- Comment out the old realm but leave here for now in case we
179
+ need to go back quickly -->
180
+ <!--
181
+ <Realm className="org.apache.catalina.realm.MemoryRealm" />
182
+ -->
183
+
184
+ <!-- Replace the above Realm with one of the following to get a Realm
185
+ stored in a database and accessed via JDBC -->
186
+
187
+ <!--
188
+ <Realm className="org.apache.catalina.realm.JDBCRealm"
189
+ driverName="org.gjt.mm.mysql.Driver"
190
+ connectionURL="jdbc:mysql://localhost/authority"
191
+ connectionName="test" connectionPassword="test"
192
+ userTable="users" userNameCol="user_name" userCredCol="user_pass"
193
+ userRoleTable="user_roles" roleNameCol="role_name" />
194
+ -->
195
+
196
+ <!--
197
+ <Realm className="org.apache.catalina.realm.JDBCRealm"
198
+ driverName="oracle.jdbc.driver.OracleDriver"
199
+ connectionURL="jdbc:oracle:thin:@ntserver:1521:ORCL"
200
+ connectionName="scott" connectionPassword="tiger"
201
+ userTable="users" userNameCol="user_name" userCredCol="user_pass"
202
+ userRoleTable="user_roles" roleNameCol="role_name" />
203
+ -->
204
+
205
+ <!--
206
+ <Realm className="org.apache.catalina.realm.JDBCRealm"
207
+ driverName="sun.jdbc.odbc.JdbcOdbcDriver"
208
+ connectionURL="jdbc:odbc:CATALINA"
209
+ userTable="users" userNameCol="user_name" userCredCol="user_pass"
210
+ userRoleTable="user_roles" roleNameCol="role_name" />
211
+ -->
212
+
213
+ <!-- Define the default virtual host
214
+ Note: XML Schema validation will not work with Xerces 2.2.
215
+ -->
216
+ <Host name="localhost" appBase="webapps"
217
+ unpackWARs="true" autoDeploy="true"
218
+ xmlValidation="false" xmlNamespaceAware="false">
219
+
220
+ <!-- Defines a cluster for this node,
221
+ By defining this element, means that every manager will be changed.
222
+ So when running a cluster, only make sure that you have webapps in there
223
+ that need to be clustered and remove the other ones.
224
+ A cluster has the following parameters:
225
+
226
+ className = the fully qualified name of the cluster class
227
+
228
+ clusterName = a descriptive name for your cluster, can be anything
229
+
230
+ mcastAddr = the multicast address, has to be the same for all the nodes
231
+
232
+ mcastPort = the multicast port, has to be the same for all the nodes
233
+
234
+ mcastBindAddress = bind the multicast socket to a specific address
235
+
236
+ mcastTTL = the multicast TTL if you want to limit your broadcast
237
+
238
+ mcastSoTimeout = the multicast readtimeout
239
+
240
+ mcastFrequency = the number of milliseconds in between sending a "I'm alive" heartbeat
241
+
242
+ mcastDropTime = the number a milliseconds before a node is considered "dead" if no heartbeat is received
243
+
244
+ tcpThreadCount = the number of threads to handle incoming replication requests, optimal would be the same amount of threads as nodes
245
+
246
+ tcpListenAddress = the listen address (bind address) for TCP cluster request on this host,
247
+ in case of multiple ethernet cards.
248
+ auto means that address becomes
249
+ InetAddress.getLocalHost().getHostAddress()
250
+
251
+ tcpListenPort = the tcp listen port
252
+
253
+ tcpSelectorTimeout = the timeout (ms) for the Selector.select() method in case the OS
254
+ has a wakup bug in java.nio. Set to 0 for no timeout
255
+
256
+ printToScreen = true means that managers will also print to std.out
257
+
258
+ expireSessionsOnShutdown = true means that
259
+
260
+ useDirtyFlag = true means that we only replicate a session after setAttribute,removeAttribute has been called.
261
+ false means to replicate the session after each request.
262
+ false means that replication would work for the following piece of code: (only for SimpleTcpReplicationManager)
263
+ <%%
264
+ HashMap map = (HashMap)session.getAttribute("map");
265
+ map.put("key","value");
266
+ %>
267
+ replicationMode = can be either 'pooled', 'synchronous' or 'asynchronous'.
268
+ * Pooled means that the replication happens using several sockets in a synchronous way. Ie, the data gets replicated, then the request return. This is the same as the 'synchronous' setting except it uses a pool of sockets, hence it is multithreaded. This is the fastest and safest configuration. To use this, also increase the nr of tcp threads that you have dealing with replication.
269
+ * Synchronous means that the thread that executes the request, is also the
270
+ thread the replicates the data to the other nodes, and will not return until all
271
+ nodes have received the information.
272
+ * Asynchronous means that there is a specific 'sender' thread for each cluster node,
273
+ so the request thread will queue the replication request into a "smart" queue,
274
+ and then return to the client.
275
+ The "smart" queue is a queue where when a session is added to the queue, and the same session
276
+ already exists in the queue from a previous request, that session will be replaced
277
+ in the queue instead of replicating two requests. This almost never happens, unless there is a
278
+ large network delay.
279
+ -->
280
+ <!--
281
+ When configuring for clustering, you also add in a valve to catch all the requests
282
+ coming in, at the end of the request, the session may or may not be replicated.
283
+ A session is replicated if and only if all the conditions are met:
284
+ 1. useDirtyFlag is true or setAttribute or removeAttribute has been called AND
285
+ 2. a session exists (has been created)
286
+ 3. the request is not trapped by the "filter" attribute
287
+
288
+ The filter attribute is to filter out requests that could not modify the session,
289
+ hence we don't replicate the session after the end of this request.
290
+ The filter is negative, ie, anything you put in the filter, you mean to filter out,
291
+ ie, no replication will be done on requests that match one of the filters.
292
+ The filter attribute is delimited by ;, so you can't escape out ; even if you wanted to.
293
+
294
+ filter=".*\.gif;.*\.js;" means that we will not replicate the session after requests with the URI
295
+ ending with .gif and .js are intercepted.
296
+
297
+ The deployer element can be used to deploy apps cluster wide.
298
+ Currently the deployment only deploys/undeploys to working members in the cluster
299
+ so no WARs are copied upons startup of a broken node.
300
+ The deployer watches a directory (watchDir) for WAR files when watchEnabled="true"
301
+ When a new war file is added the war gets deployed to the local instance,
302
+ and then deployed to the other instances in the cluster.
303
+ When a war file is deleted from the watchDir the war is undeployed locally
304
+ and cluster wide
305
+ -->
306
+
307
+ <!--
308
+ <Cluster className="org.apache.catalina.cluster.tcp.SimpleTcpCluster"
309
+ managerClassName="org.apache.catalina.cluster.session.DeltaManager"
310
+ expireSessionsOnShutdown="false"
311
+ useDirtyFlag="true"
312
+ notifyListenersOnReplication="true">
313
+
314
+ <Membership
315
+ className="org.apache.catalina.cluster.mcast.McastService"
316
+ mcastAddr="228.0.0.4"
317
+ mcastPort="45564"
318
+ mcastFrequency="500"
319
+ mcastDropTime="3000"/>
320
+
321
+ <Receiver
322
+ className="org.apache.catalina.cluster.tcp.ReplicationListener"
323
+ tcpListenAddress="auto"
324
+ tcpListenPort="4001"
325
+ tcpSelectorTimeout="100"
326
+ tcpThreadCount="6"/>
327
+
328
+ <Sender
329
+ className="org.apache.catalina.cluster.tcp.ReplicationTransmitter"
330
+ replicationMode="pooled"
331
+ ackTimeout="15000"
332
+ waitForAck="true"/>
333
+
334
+ <Valve className="org.apache.catalina.cluster.tcp.ReplicationValve"
335
+ filter=".*\.gif;.*\.js;.*\.jpg;.*\.png;.*\.htm;.*\.html;.*\.css;.*\.txt;"/>
336
+
337
+ <Deployer className="org.apache.catalina.cluster.deploy.FarmWarDeployer"
338
+ tempDir="/tmp/war-temp/"
339
+ deployDir="/tmp/war-deploy/"
340
+ watchDir="/tmp/war-listen/"
341
+ watchEnabled="false"/>
342
+
343
+ <ClusterListener className="org.apache.catalina.cluster.session.ClusterSessionListener"/>
344
+ </Cluster>
345
+ -->
346
+
347
+
348
+
349
+ <!-- Normally, users must authenticate themselves to each web app
350
+ individually. Uncomment the following entry if you would like
351
+ a user to be authenticated the first time they encounter a
352
+ resource protected by a security constraint, and then have that
353
+ user identity maintained across *all* web applications contained
354
+ in this virtual host. -->
355
+ <!--
356
+ <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
357
+ -->
358
+
359
+ <!-- Access log processes all requests for this virtual host. By
360
+ default, log files are created in the "logs" directory relative to
361
+ $CATALINA_HOME. If you wish, you can specify a different
362
+ directory with the "directory" attribute. Specify either a relative
363
+ (to $CATALINA_HOME) or absolute path to the desired directory.
364
+ -->
365
+ <!--
366
+ <Valve className="org.apache.catalina.valves.AccessLogValve"
367
+ directory="logs" prefix="localhost_access_log." suffix=".txt"
368
+ pattern="common" resolveHosts="false"/>
369
+ -->
370
+
371
+ <!-- Access log processes all requests for this virtual host. By
372
+ default, log files are created in the "logs" directory relative to
373
+ $CATALINA_HOME. If you wish, you can specify a different
374
+ directory with the "directory" attribute. Specify either a relative
375
+ (to $CATALINA_HOME) or absolute path to the desired directory.
376
+ This access log implementation is optimized for maximum performance,
377
+ but is hardcoded to support only the "common" and "combined" patterns.
378
+ -->
379
+ <!--
380
+ <Valve className="org.apache.catalina.valves.FastCommonAccessLogValve"
381
+ directory="logs" prefix="localhost_access_log." suffix=".txt"
382
+ pattern="common" resolveHosts="false"/>
383
+ -->
384
+
385
+ <!-- <%= name.capitalize %> application -->
386
+ <Context path="/<%= name %>"
387
+ docBase="<%= here %>/<%= name %>/build/web"
388
+ debug="1"
389
+ reloadable="true"/>
390
+
391
+ </Host>
392
+
393
+ </Engine>
394
+
395
+ </Service>
396
+
397
+ </Server>
@@ -0,0 +1,8 @@
1
+ <?xml version='1.0' encoding='utf-8'?>
2
+ <tomcat-users>
3
+ <role rolename="tomcat"/>
4
+ <role rolename="role1"/>
5
+ <user username="tomcat" password="tomcat" roles="tomcat"/>
6
+ <user username="both" password="tomcat" roles="tomcat,role1"/>
7
+ <user username="role1" password="tomcat" roles="role1"/>
8
+ </tomcat-users>