bee_java 0.0.1

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/bin/gendeps ADDED
@@ -0,0 +1,47 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # Copyright 2008-2009 Michel Casabianca <michel.casabianca@gmail.com>
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Script to generate dependencies YAML file for a Maven 2 project.
18
+
19
+ require 'erb'
20
+
21
+ TEMPLATE = ERB.new('- group: <%= group %>
22
+ artifact: <%= artifact %>
23
+ version: <%= version %>
24
+ % if type
25
+ type: <%= type %>
26
+ % end
27
+ % if scope
28
+ scope: <%= scope %>
29
+ % end
30
+ % if classifier
31
+ classifier: <%= classifier %>
32
+ % end
33
+
34
+ ', nil, '%')
35
+
36
+ lines = `mvn dependency:list`
37
+ for line in lines.split("\n")
38
+ if line =~ /^\[INFO\] ([^:]+):([^:]+):([^:]+):([^:]+):([^:]+)\s*$/
39
+ group = $1
40
+ artifact = $2
41
+ type = $3
42
+ version = $4
43
+ scope = $5
44
+ classifier = nil
45
+ puts TEMPLATE.result(binding)
46
+ end
47
+ end
data/bin/maven2bee ADDED
@@ -0,0 +1,74 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # Copyright 2008-2009 Michel Casabianca <michel.casabianca@gmail.com>
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Script to extract Maven 2 dependencies from project file into a Bee
18
+ # dependencies file.
19
+
20
+ require 'rexml/document'
21
+ require 'rexml/xpath'
22
+ require 'erb'
23
+
24
+ HELP = 'Usage: maven2bee file'
25
+ TEMPLATE = ERB.new('- group: <%= group %>
26
+ artifact: <%= artifact %>
27
+ version: <%= version %>
28
+ % if type
29
+ type: <%= type %>
30
+ % end
31
+ % if scope
32
+ scope: <%= scope %>
33
+ % end
34
+ % if classifier
35
+ classifier: <%= classifier %>
36
+ % end
37
+
38
+ ', nil, '%')
39
+
40
+ def deps_to_yaml(file)
41
+ result = ''
42
+ document = REXML::Document.new(File.read(ARGV[0]))
43
+ REXML::XPath.each(document, '//dependency') do |dependency|
44
+ group = dependency.elements['groupId'].text.strip
45
+ artifact = dependency.elements['artifactId'].text.strip
46
+ version = dependency.elements['version'].text.strip
47
+ if dependency.elements['type'] and dependency.elements['type'].text
48
+ type = dependency.elements['type'].text.strip
49
+ else
50
+ type = nil
51
+ end
52
+ if dependency.elements['scope'] and dependency.elements['scope'].text
53
+ scope = dependency.elements['scope'].text.strip
54
+ else
55
+ scope = nil
56
+ end
57
+ if dependency.elements['classifier'] and dependency.elements['classifier'].text
58
+ classifier = dependency.elements['classifier'].text.strip
59
+ else
60
+ classifier = nil
61
+ end
62
+ result += TEMPLATE.result(binding)
63
+ end
64
+ return result
65
+ end
66
+
67
+ if ARGV.length < 1
68
+ puts HELP
69
+ exit
70
+ else
71
+ for file in ARGV
72
+ puts deps_to_yaml(file)
73
+ end
74
+ end
data/build/README ADDED
@@ -0,0 +1,23 @@
1
+ = Bee Java
2
+
3
+ BeeJava is a package to build and generate Java project using Bee.
4
+
5
+ = Home Page
6
+
7
+ This software is hosted on RubyForge (thanks to them for their great job!)
8
+ at http://bee.rubyforge.org.
9
+
10
+ = Documentation
11
+
12
+ For more information about this software, please read the documentation
13
+ in "bee_java" section on Gem server (type "gem_server" and go at URL
14
+ http://localhost:8808) if you installed it using Gem.
15
+
16
+ = License
17
+
18
+ bee is Open Source and released under the Apache License (see LICENSE file
19
+ or go to URL http://www.apache.org/licenses/LICENSE-2.0).
20
+
21
+ = Copyright
22
+
23
+ Bee_java version 0.0.1 (C) Michel Casabianca - 2008-2010
data/egg/lib/build.erb ADDED
@@ -0,0 +1,54 @@
1
+ - build: <%= name %>
2
+ default: all
3
+ description: Build file for project <%= name.capitalize %>
4
+
5
+ - properties:
6
+ name: "<%= name %>"
7
+ version: "0.0.1"
8
+ src: "src"
9
+ tst: "test"
10
+ lib: "lib"
11
+ build: "build"
12
+ classes: "#{build}/classes"
13
+ test_classes: "#{build}/tst-classes"
14
+ jar: "#{build}/#{name}-#{version}.jar"
15
+
16
+ - target: compile
17
+ description: Compile Java source files
18
+ script:
19
+ - java.javac:
20
+ src: :src
21
+ dest: :classes
22
+
23
+ - target: test
24
+ depends: compile
25
+ description: Run unit tests
26
+ script:
27
+ - java.classpath:
28
+ classpath: classpath
29
+ directories: [:classes, :test_classes]
30
+ - java.javac:
31
+ src: :tst
32
+ dest: :test_classes
33
+ classpath: :classpath
34
+ - java.junit:
35
+ src: :tst
36
+ classpath: :classpath
37
+
38
+ - target: jar
39
+ depends: test
40
+ description: Generate JAR archive
41
+ script:
42
+ - java.jar:
43
+ src: :classes
44
+ dest: :jar
45
+
46
+ - target: clean
47
+ description: Clean generated files
48
+ script:
49
+ - rmdir: :build
50
+
51
+ - target: all
52
+ depends: [clean, jar]
53
+ description: Clean generated files
54
+
@@ -0,0 +1,5 @@
1
+ - repository: http://www.ibiblio.org/maven2
2
+
3
+ - group: junit
4
+ artifact: junit
5
+ version: 4.3
@@ -0,0 +1,9 @@
1
+ package <%= File.dirname(main.gsub(/\./, '/')).gsub(/\//, '.') %>;
2
+
3
+ public class <%= File.basename(main.gsub(/\./, '/')) %> {
4
+
5
+ public static String hello(String who) {
6
+ return "Hello "+who+"!";
7
+ }
8
+
9
+ }
data/egg/lib/test.erb ADDED
@@ -0,0 +1,20 @@
1
+ package <%= File.dirname(main.gsub(/\./, '/')).gsub(/\//, '.') %>;
2
+
3
+ import junit.framework.TestCase;
4
+
5
+ public class <%= File.basename(main.gsub(/\./, '/')) %>Test
6
+ extends TestCase {
7
+
8
+ private <%= File.basename(main.gsub(/\./, '/')) %> instance;
9
+
10
+ public void setUp() {
11
+ this.instance = new <%= File.basename(main.gsub(/\./, '/')) %>();
12
+ }
13
+
14
+ public void test() {
15
+ String expected = "Hello World!";
16
+ String actual = instance.hello("World");
17
+ assertEquals(expected, actual);
18
+ }
19
+
20
+ }
data/egg/lib.yml ADDED
@@ -0,0 +1,71 @@
1
+ # Copyright 2008-2009 Michel Casabianca <michel.casabianca@gmail.com>
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ - build: tiny
16
+ default: all
17
+ description: "Generate a Java project for a library"
18
+
19
+ - properties:
20
+ name: test
21
+ main: test.Test
22
+ description: |
23
+ This script will create Java project for a library. Build file has
24
+ 'compile', 'test' and 'jar' targets to compile, run unit tests, and
25
+ generate JAR archive.
26
+
27
+ - target: welcome
28
+ description: "Print information message"
29
+ script:
30
+ - print: :description
31
+
32
+ - target: prompt
33
+ depends: welcome
34
+ description: "Prompt for project information"
35
+ script:
36
+ - print: "Please answer following questions to generate the project:"
37
+ - prompt:
38
+ message: "What is the library's name?"
39
+ default: :name
40
+ property: name
41
+ - prompt:
42
+ message: "What is the library's main class?"
43
+ default: :main
44
+ property: main
45
+
46
+ - target: generate
47
+ depends: prompt
48
+ description: "Generate project"
49
+ script:
50
+ - print: "Generating project..."
51
+ - rb: |
52
+ error "A directory named '#{name}' already exists, aborting" if
53
+ File.exists?("#{here}/#{name}")
54
+ - mkdir: "#{here}/#{name}/src/#{File.dirname(main.gsub(/\./,'/'))}"
55
+ - erb: { src: "#{base}/lib/source.erb", dest: "#{here}/#{name}/src/#{main.gsub(/\./,'/')}.java" }
56
+ - mkdir: "#{here}/#{name}/test/#{File.dirname(main.gsub(/\./,'/'))}"
57
+ - erb: { src: "#{base}/lib/test.erb", dest: "#{here}/#{name}/test/#{main.gsub(/\./,'/')}Test.java" }
58
+ - erb: { src: "#{base}/lib/build.erb", dest: "#{here}/#{name}/build.yml" }
59
+ - cp: { src: "#{base}/lib/dependencies.yml", dest: "#{here}/#{name}/dependencies.yml" }
60
+
61
+ - target: customization
62
+ depends: generate
63
+ description: "Print information about project customization"
64
+ script:
65
+ - print: |
66
+ Project has been generated in directory '#{name}'. Type 'bee -b' to
67
+ print information about generated build file.
68
+ Enjoy!
69
+
70
+ - target: all
71
+ depends: [welcome, prompt, generate, customization]
@@ -0,0 +1,34 @@
1
+ - build: <%= name %>
2
+ default: all
3
+ description: Build file for project <%= name.capitalize %>
4
+
5
+ - properties:
6
+ name: "<%= name %>"
7
+ src: "src"
8
+ build: "build"
9
+ classes: "#{build}/classes"
10
+ main: "<%= main %>"
11
+ classpath: :classes
12
+
13
+ - target: compile
14
+ description: Compile Java source files
15
+ script:
16
+ - java.javac:
17
+ src: :src
18
+ dest: :classes
19
+
20
+ - target: run
21
+ depends: compile
22
+ description: Run java program
23
+ script:
24
+ - java.java:
25
+ main: :main
26
+ classpath: :classes
27
+
28
+ - target: clean
29
+ description: Clean generated files
30
+ script:
31
+ - rmdir: :build
32
+
33
+ - target: all
34
+ depends: [clean, compile, run]
@@ -0,0 +1,9 @@
1
+ package <%= File.dirname(main.gsub(/\./, '/')).gsub(/\//, '.') %>;
2
+
3
+ public class <%= File.basename(main.gsub(/\./, '/')) %> {
4
+
5
+ public static void main(String[] args) {
6
+ System.out.println("Hello World!");
7
+ }
8
+
9
+ }
data/egg/tiny.yml ADDED
@@ -0,0 +1,68 @@
1
+ # Copyright 2008-2009 Michel Casabianca <michel.casabianca@gmail.com>
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ - build: tiny
16
+ default: all
17
+ description: "Generate a tiny Java project"
18
+
19
+ - properties:
20
+ name: test
21
+ main: test.Test
22
+ description: |
23
+ This script will create a tiny Java project. Build file has targets
24
+ 'compile' and 'run' to compile and run Java source file. This is an
25
+ accurate project to quickly test Java code.
26
+
27
+ - target: welcome
28
+ description: "Print information message"
29
+ script:
30
+ - print: :description
31
+
32
+ - target: prompt
33
+ depends: welcome
34
+ description: "Prompt for project information"
35
+ script:
36
+ - print: "Please answer following questions to generate the project:"
37
+ - prompt:
38
+ message: "What is the project's name?"
39
+ default: :name
40
+ property: name
41
+ - prompt:
42
+ message: "What is the project's main class?"
43
+ default: :main
44
+ property: main
45
+
46
+ - target: generate
47
+ depends: prompt
48
+ description: "Generate project"
49
+ script:
50
+ - print: "Generating project..."
51
+ - rb: |
52
+ error "A directory named '#{name}' already exists, aborting" if
53
+ File.exists?("#{here}/#{name}")
54
+ - mkdir: "#{here}/#{name}/src/#{File.dirname(main.gsub(/\./,'/'))}"
55
+ - erb: { src: "#{base}/tiny/source.erb", dest: "#{here}/#{name}/src/#{main.gsub(/\./,'/')}.java" }
56
+ - erb: { src: "#{base}/tiny/build.erb", dest: "#{here}/#{name}/build.yml" }
57
+
58
+ - target: customization
59
+ depends: generate
60
+ description: "Print information about project customization"
61
+ script:
62
+ - print: |
63
+ Project has been generated in directory '#{name}'. Type 'bee -b' to
64
+ print information about generated build file.
65
+ Enjoy!
66
+
67
+ - target: all
68
+ depends: [welcome, prompt, generate, customization]
@@ -0,0 +1,56 @@
1
+ - build: <%= name %>
2
+ default: all
3
+ description: Build file for sample XML-RPC project
4
+
5
+ - properties:
6
+ name: "<%= name %>"
7
+ src: "src"
8
+ build: "build"
9
+ classes: "#{build}/classes"
10
+ client: "test.Client"
11
+ server: "test.Server"
12
+ classpath: :classes
13
+
14
+ - target: depends
15
+ description: Get dependencies
16
+ script:
17
+ - java.classpath:
18
+ classpath: cp_compile
19
+ - rb: "cp_runtime = cp_compile + ':' + classes"
20
+
21
+ - target: compile
22
+ depends: depends
23
+ description: Compile Java source files
24
+ script:
25
+ - java.javac:
26
+ src: :src
27
+ dest: :classes
28
+ classpath: :cp_compile
29
+ - copy:
30
+ root: :src
31
+ includes: "**/*.properties"
32
+ dest: :classes
33
+
34
+ - target: client
35
+ depends: compile
36
+ description: Run XML-RPC client
37
+ script:
38
+ - java.java:
39
+ main: :client
40
+ classpath: :cp_runtime
41
+
42
+ - target: server
43
+ depends: compile
44
+ description: Run XML-RPC server
45
+ script:
46
+ - java.java:
47
+ main: :server
48
+ classpath: :cp_runtime
49
+
50
+ - target: clean
51
+ description: Clean generated files
52
+ script:
53
+ - rmdir: :build
54
+
55
+ - target: all
56
+ depends: [clean, compile]
@@ -0,0 +1,26 @@
1
+ - repository: http://www.ibiblio.org/maven2
2
+
3
+ - group: org.apache.xmlrpc
4
+ artifact: xmlrpc-common
5
+ version: 3.1.3
6
+
7
+ - group: org.apache.xmlrpc
8
+ artifact: xmlrpc-client
9
+ version: 3.1.3
10
+
11
+ - group: org.apache.xmlrpc
12
+ artifact: xmlrpc-server
13
+ version: 3.1.3
14
+
15
+ - group: org.apache.ws.commons.util
16
+ artifact: ws-commons-util
17
+ version: 1.0.2
18
+
19
+ - group: commons-logging
20
+ artifact: commons-logging
21
+ version: 1.1
22
+
23
+ - group: org.apache.ws.commons
24
+ artifact: ws-commons-java5
25
+ version: 1.0
26
+
@@ -0,0 +1,19 @@
1
+ package test;
2
+
3
+ import java.net.URL;
4
+ import org.apache.xmlrpc.client.XmlRpcClient;
5
+ import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
6
+
7
+ public class Client {
8
+
9
+ public static void main(String[] args)
10
+ throws Exception {
11
+ XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
12
+ config.setServerURL(new URL("http://localhost:8000"));
13
+ XmlRpcClient client = new XmlRpcClient();
14
+ client.setConfig(config);
15
+ Object[] params = new Object[]{"World"};
16
+ System.out.println(client.execute("test.hello", params));
17
+ }
18
+
19
+ }
@@ -0,0 +1,29 @@
1
+ package test;
2
+
3
+ import java.net.InetAddress;
4
+
5
+ import org.apache.xmlrpc.common.TypeConverterFactoryImpl;
6
+ import org.apache.xmlrpc.server.PropertyHandlerMapping;
7
+ import org.apache.xmlrpc.server.XmlRpcServer;
8
+ import org.apache.xmlrpc.server.XmlRpcServerConfigImpl;
9
+ import org.apache.xmlrpc.webserver.WebServer;
10
+
11
+ public class Server {
12
+
13
+ private static final int port = 8000;
14
+
15
+ public static void main(String[] args) throws Exception {
16
+ WebServer webServer = new WebServer(port);
17
+ XmlRpcServer xmlRpcServer = webServer.getXmlRpcServer();
18
+ PropertyHandlerMapping phm = new PropertyHandlerMapping();
19
+ phm.load(Thread.currentThread().getContextClassLoader(),
20
+ "test/handlers.properties");
21
+ xmlRpcServer.setHandlerMapping(phm);
22
+ XmlRpcServerConfigImpl serverConfig = (XmlRpcServerConfigImpl)
23
+ xmlRpcServer.getConfig();
24
+ serverConfig.setEnabledForExtensions(true);
25
+ serverConfig.setContentLengthOptional(false);
26
+ System.out.println("Starting server on port "+port+"...");
27
+ webServer.start();
28
+ }
29
+ }
@@ -0,0 +1,9 @@
1
+ package test;
2
+
3
+ public class TestHandler {
4
+
5
+ public String hello(String who) {
6
+ return "Hello "+who+"!";
7
+ }
8
+
9
+ }
@@ -0,0 +1 @@
1
+ test=test.TestHandler
data/egg/xmlrpc.yml ADDED
@@ -0,0 +1,64 @@
1
+ # Copyright 2008-2009 Michel Casabianca <michel.casabianca@gmail.com>
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ - build: xmlrpc
16
+ default: all
17
+ description: "Generate a sample XML-RPC Java project"
18
+
19
+ - properties:
20
+ name: xmlrpc
21
+ description: |
22
+ This script will create a sample XML-RPC Java project.
23
+
24
+ - target: welcome
25
+ description: "Print information message"
26
+ script:
27
+ - print: :description
28
+
29
+ - target: prompt
30
+ depends: welcome
31
+ description: "Prompt for project information"
32
+ script:
33
+ - print: "Please answer following questions to generate the project:"
34
+ - prompt:
35
+ message: "What is the project's name?"
36
+ default: :name
37
+ property: name
38
+
39
+ - target: generate
40
+ depends: prompt
41
+ description: "Generate project"
42
+ script:
43
+ - print: "Generating project..."
44
+ - rb: |
45
+ error "A directory named '#{name}' already exists, aborting" if
46
+ File.exists?("#{here}/#{name}")
47
+ - mkdir: "#{here}/#{name}"
48
+ - erb: { src: "#{base}/xmlrpc/build.yml", dest: "#{here}/#{name}/build.yml" }
49
+ - copy:
50
+ root: "#{base}/xmlrpc/"
51
+ excludes: "**/build.yml"
52
+ dest: "#{here}/#{name}"
53
+
54
+ - target: customization
55
+ depends: generate
56
+ description: "Print information about project customization"
57
+ script:
58
+ - print: |
59
+ Project has been generated in directory '#{name}'. Type 'bee -b' to
60
+ print information about generated build file.
61
+ Enjoy!
62
+
63
+ - target: all
64
+ depends: [welcome, prompt, generate, customization]