ontomde-uml2-ejb2 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt ADDED
@@ -0,0 +1,5 @@
1
+ == 1.0.0 / 2007-10-29
2
+
3
+ * 1 major enhancement
4
+ * Birthday!
5
+
data/Manifest.txt ADDED
@@ -0,0 +1,7 @@
1
+ History.txt
2
+ Manifest.txt
3
+ README.txt
4
+ Rakefile
5
+ lib/ontomde-uml2-ejb2.rb
6
+ lib/ontomde-uml2-ejb2/version.rb
7
+ test/test_ontomde-uml2-ejb2.rb
data/README.txt ADDED
@@ -0,0 +1,41 @@
1
+ ontomde-uml2-ejb2
2
+ by stephane (Pierre) Carrie
3
+ http://ontomde.rubyforge.org
4
+
5
+ == DESCRIPTION:
6
+
7
+ ontomde-uml2-ejb2 is a library for generatin EJB2 library.
8
+
9
+ == FEATURES/PROBLEMS:
10
+
11
+ * beta release
12
+
13
+ == SYNOPSIS:
14
+
15
+ == REQUIREMENTS:
16
+
17
+ == INSTALL:
18
+
19
+ * (unix) sudo gem install ontomde-uml2-ejb2
20
+ * (win) gem install ontomde-uml2-ejb2
21
+
22
+ Additional information is available on ontoMDE web site :
23
+ http://ontomde.rubyforge.org/website/download.html
24
+ == LICENSE:
25
+
26
+ Copyright (C) 2008 Orange-labs
27
+ 38 rue General Leclerc
28
+ 92130 ISSY LES MOULINEAUX, France
29
+
30
+ This program is free software: you can redistribute it and/or modify
31
+ it under the terms of the GNU Affero General Public License as
32
+ published by the Free Software Foundation, either version 3 of the
33
+ License, or (at your option) any later version.
34
+
35
+ This program is distributed in the hope that it will be useful,
36
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
37
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
38
+ GNU Affero General Public License for more details.
39
+
40
+ You should have received a copy of the GNU Affero General Public License
41
+ along with this program. If not, see http://www.gnu.org/licenses/.
data/Rakefile ADDED
@@ -0,0 +1,22 @@
1
+ # -*- ruby -*-
2
+
3
+ require 'rubygems'
4
+ require 'hoe'
5
+ require './lib/ontomde-uml2-ejb2/version.rb'
6
+
7
+ Hoe.new('ontomde-uml2-ejb2', Ontomde::Uml2::Ejb2::VERSION) do |p|
8
+ p.rubyforge_name = 'ontomde'
9
+ p.author = 'Stephane (Pierre) Carrie'
10
+ p.email = 'stephanepierre.carrie@orange-ftgroup.com'
11
+ p.summary = 'OntoMDE EJB2 cartridge'
12
+ p.description = p.paragraphs_of('README.txt', 2..5).join("\n\n")
13
+ p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
14
+ p.url="http://ontomde.rubyforge.org"
15
+
16
+ p.extra_deps=[
17
+ ['ontomde-uml2-java',"= #{Ontomde::Uml2::Ejb2::VERSION}"]
18
+ ]
19
+ p.spec_extras={ :required_ruby_version => '>=1.8.6' ,:required_rubygems_version => '>=1.0.0'}
20
+ end
21
+
22
+ # vim: syntax=Ruby
@@ -0,0 +1,8 @@
1
+ module Ontomde
2
+ module Uml2
3
+ module Ejb2
4
+ VERSION = '1.0.4'
5
+ end
6
+ end
7
+ end
8
+
@@ -0,0 +1,193 @@
1
+ require 'ontomde-uml2-java'
2
+ require 'ontomde-uml2-ejb2/version.rb'
3
+
4
+ module Mrdf_Model
5
+ def ejb2_services
6
+ ca=Array.new
7
+ uml_Class_all.each { |c|
8
+ next unless c.kind_of?(Muml_Class)
9
+ next unless c.umlx_hasStereotype?('Service')
10
+ ca << c
11
+ }
12
+ return ca
13
+ end
14
+
15
+ def ejb2_transform!
16
+ return unless context[:ejb2]
17
+ ejb2_services.each { |c|
18
+ c.ejb2_transform!
19
+ }
20
+ ejb2_generateConfig #TODO
21
+ ejb2_generateJonasConfig
22
+ end
23
+
24
+
25
+ def ejb2_target_ejbconf
26
+ return context[:target_ejbconf,"#{context[:build]}META-INF"]
27
+ end
28
+ def ejb2_generateConfig
29
+ mtk_writeSession(context[:ejbJarFile,"#{ejb2_target_ejbconf}/ejb-jar.xml"]) {
30
+ ejb2_writeConfig
31
+ }
32
+ end
33
+
34
+ def ejb2_writeConfig
35
+ write <<END
36
+ <?xml version="1.0"?>
37
+ <!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN' 'http://java.sun.com/dtd/ejb-jar_2_0.dtd'>
38
+
39
+ <ejb-jar>
40
+ <enterprise-beans>
41
+ END
42
+ ejb2_services.each { |c|
43
+ write <<END
44
+ <!-- #{c.ejb_Name} -->
45
+ <session>
46
+ <ejb-name>#{c.ejb_Name}</ejb-name>
47
+ <home>#{c.ejb_home_one.java_qualifiedName}</home>
48
+ <remote>#{c.ejb_remote_one.java_qualifiedName}</remote>
49
+ <ejb-class>#{c.ejb_bean_one.java_qualifiedName}</ejb-class>
50
+ <session-type>Stateless</session-type>
51
+ <transaction-type>Container</transaction-type>
52
+ </session>
53
+ END
54
+ }
55
+ write <<END
56
+ </enterprise-beans>
57
+ <assembly-descriptor>
58
+ END
59
+ ejb2_services.each { |c|
60
+ write <<END
61
+ <!-- #{c.ejb_Name} -->
62
+ <container-transaction>
63
+ <method>
64
+ <ejb-name>#{c.ejb_Name}</ejb-name>
65
+ <method-name>*</method-name>
66
+ </method>
67
+ <trans-attribute>Required</trans-attribute>
68
+ </container-transaction>
69
+ END
70
+ }
71
+ write <<END
72
+ </assembly-descriptor>
73
+ </ejb-jar>
74
+ END
75
+
76
+ end
77
+ def ejb2_generateJonasConfig
78
+ mtk_writeSession(context[:ejbJonasJarFile,"#{ejb2_target_ejbconf}/jonas-ejb-jar.xml"]) {
79
+ ejb2_writeJonasConfig
80
+ }
81
+ end
82
+
83
+ def ejb2_writeJonasConfig
84
+ write <<END
85
+ <?xml version="1.0"?>
86
+ <jonas-ejb-jar
87
+ xmlns="http://www.objectweb.org/jonas/ns"
88
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
89
+ xsi:schemaLocation="http://www.objectweb.org/jonas/ns http://www.objectweb.org/jonas/ns/jonas-ejb-jar_4_0.xsd" >
90
+ END
91
+
92
+ ejb2_services.each { |c|
93
+ write <<END
94
+ <!-- #{c.ejb_Name} -->
95
+ <jonas-session>
96
+ <ejb-name>#{c.ejb_Name}</ejb-name>
97
+ <jndi-name>odn.#{c.ejb_remote_one.java_Name}</jndi-name>
98
+ <session-timeout>60</session-timeout>
99
+ </jonas-session>
100
+ END
101
+ }
102
+
103
+ write <<END
104
+ </jonas-ejb-jar>
105
+ END
106
+ end
107
+ end
108
+
109
+ module Muml_Class
110
+ #ejb_Home class related to this ejb service
111
+ rdf_safe_attr_reader_many :ejb_home
112
+ #
113
+ #ejb_remote interface related to this ejb service
114
+ rdf_safe_attr_reader_many :ejb_remote
115
+ #
116
+ #ejb_bean related to this ejb service
117
+ rdf_safe_attr_reader_many :ejb_bean
118
+
119
+ #process this java bean to :
120
+ #* generate the proper ejb interfaces,
121
+ #* add required exceptions,
122
+ #* add required interface implementations
123
+ #* ...
124
+ def ejb2_transform!
125
+ log.debug { "processing ejb service: #{self}" }
126
+ ejb2_createRemoteInterface!
127
+ ejb2_createHomeInterface!
128
+ ejb2_createBean!
129
+ end
130
+
131
+ #Return an alias name for this class"
132
+ def ejb_Name
133
+ return "#{java_Name}EJB"
134
+ end
135
+
136
+ #creates a bean class for this service class
137
+ #(this implementation just appends bean to the class name)
138
+ def ejb2_createBean!
139
+ self.ejb_bean=self
140
+ self.uml_name="#{self.uml_name}Bean"
141
+ ejb2_addOperationExceptions!(umlx_getOrCreateInterface("java.rmi.RemoteException"))
142
+ end
143
+
144
+ #creates a home interface for this service class
145
+ def ejb2_createHomeInterface!
146
+ log.debug { "creating ejb home interface for: #{self}" }
147
+ h=self.umlx_owner_one.umlx_createAndAddInterface("#{self.rdf_uri}_ejbHome","#{uml_name}Home")
148
+ h.umlx_createAndAddGeneralization(umlx_getOrCreateInterface("javax.ejb.EJBHome"))
149
+ self.ejb_home=h
150
+
151
+ cr=h.umlx_createAndAddOperation("#{h.rdf_uri}_create","create")
152
+ cr.uml_raisedException_add(umlx_getOrCreateInterface("javax.ejb.CreateException"))
153
+ cr.uml_raisedException_add(umlx_getOrCreateInterface("java.rmi.RemoteException"))
154
+ crret=cr.umlx_createAndAddReturnParameter("#{cr.rdf_uri}_ret","return")
155
+ crret.uml_type=self.ejb_remote_one
156
+ end
157
+
158
+ #creates a remote interface for this service class
159
+ def ejb2_createRemoteInterface!
160
+ log.debug { "creating ejb remote interface for: #{self}" }
161
+ r=self.umlx_owner_one.umlx_createAndAddInterface("#{self.rdf_uri}_ejbRemote","#{uml_name}")
162
+ r.umlx_createAndAddGeneralization(umlx_getOrCreateInterface("javax.ejb.EJBObject"))
163
+ self.ejb_remote=r
164
+ ejb2_copyMethodsTo!(ejb_remote_one,"ejbRemote",umlx_getOrCreateInterface("java.rmi.RemoteException"))
165
+ end
166
+
167
+ def ejb2_copyMethodsTo!(ejb,uri_suffix,exception)
168
+ uml_ownedOperation.each { |sop|
169
+ op=ejb.umlx_createAndAddOperation("#{sop.rdf_uri}_#{uri_suffix}","#{sop.uml_name}")
170
+ op.uml_raisedException_add(exception)
171
+ sop.uml_ownedParameter.each { |sp|
172
+ p=op.umlx_createAndAddParameter("#{sp.rdf_uri}_#{uri_suffix}",sp.uml_name)
173
+ sp.umlx_copyToAttributeProperty(p)
174
+ p.uml_type=sp.uml_type
175
+ p.uml_direction=sp.uml_direction
176
+ p.uml_isUnique=sp.uml_isUnique
177
+ p.uml_isOrdered=sp.uml_isOrdered
178
+ p.java_use_Arrays=sp.java_use_Arrays
179
+ p.uml_upperValue=sp.uml_upperValue
180
+ p.uml_lowerValue=sp.uml_lowerValue
181
+ }
182
+ }
183
+ end
184
+ #adds exception to every operation
185
+ def ejb2_addOperationExceptions!(exception)
186
+ uml_ownedOperation.each { |op|
187
+ op.uml_raisedException_add(exception)
188
+ }
189
+ end
190
+ end
191
+
192
+
193
+
File without changes
metadata ADDED
@@ -0,0 +1,79 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ontomde-uml2-ejb2
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.4
5
+ platform: ruby
6
+ authors:
7
+ - Stephane (Pierre) Carrie
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-03-03 00:00:00 +01:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: ontomde-uml2-java
17
+ version_requirement:
18
+ version_requirements: !ruby/object:Gem::Requirement
19
+ requirements:
20
+ - - "="
21
+ - !ruby/object:Gem::Version
22
+ version: 1.0.4
23
+ version:
24
+ - !ruby/object:Gem::Dependency
25
+ name: hoe
26
+ version_requirement:
27
+ version_requirements: !ruby/object:Gem::Requirement
28
+ requirements:
29
+ - - ">="
30
+ - !ruby/object:Gem::Version
31
+ version: 1.5.0
32
+ version:
33
+ description: "ontomde-uml2-ejb2 is a library for generatin EJB2 library. == FEATURES/PROBLEMS: * beta release == SYNOPSIS:"
34
+ email: stephanepierre.carrie@orange-ftgroup.com
35
+ executables: []
36
+
37
+ extensions: []
38
+
39
+ extra_rdoc_files:
40
+ - History.txt
41
+ - Manifest.txt
42
+ - README.txt
43
+ files:
44
+ - History.txt
45
+ - Manifest.txt
46
+ - README.txt
47
+ - Rakefile
48
+ - lib/ontomde-uml2-ejb2.rb
49
+ - lib/ontomde-uml2-ejb2/version.rb
50
+ - test/test_ontomde-uml2-ejb2.rb
51
+ has_rdoc: true
52
+ homepage: http://ontomde.rubyforge.org
53
+ post_install_message:
54
+ rdoc_options:
55
+ - --main
56
+ - README.txt
57
+ require_paths:
58
+ - lib
59
+ required_ruby_version: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: 1.8.6
64
+ version:
65
+ required_rubygems_version: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: 1.0.0
70
+ version:
71
+ requirements: []
72
+
73
+ rubyforge_project: ontomde
74
+ rubygems_version: 1.0.1
75
+ signing_key:
76
+ specification_version: 2
77
+ summary: OntoMDE EJB2 cartridge
78
+ test_files:
79
+ - test/test_ontomde-uml2-ejb2.rb