Module: Mrdf_Model

Defined in:
lib/ontomde-java/ejb2/main-ejb2.rb,
lib/ontomde-java/crank/menu.rb

Overview

ejb2 generator

Instance Method Summary collapse

Instance Method Details

#crank_home_crankbeanObject



31
32
33
34
35
36
37
# File 'lib/ontomde-java/crank/menu.rb', line 31

def crank_home_crankbean   
  eachCrankBean.each { |c|
  write <<BEAN
  <li><h:commandLink action="#{c.java_Name.upcase}" value="#{c.java_Name}s" styleClass="titleCommandLink"/></li>
BEAN
  }
end


22
23
24
25
26
27
28
29
# File 'lib/ontomde-java/crank/menu.rb', line 22

def crank_home_footer
   write <<FOOTER
</ul>
</div>
</h:form>
</ui:composition>
FOOTER
end

#crank_home_headerObject



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/ontomde-java/crank/menu.rb', line 7

def crank_home_header
  write <<END
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
>
  <h:form>
<div class="blocmenu">

<h2>Menu Principal</h2>
<ul>

END
end

#ejb2_generateConfigObject



28
29
30
31
32
# File 'lib/ontomde-java/ejb2/main-ejb2.rb', line 28

def ejb2_generateConfig
	mtk_writeSession(context[:ejbJarFile,"#{ejb2_target_ejbconf}/ejb-jar.xml"]) {
		ejb2_writeConfig
		}
end

#ejb2_generateJonasConfigObject



77
78
79
80
81
# File 'lib/ontomde-java/ejb2/main-ejb2.rb', line 77

def ejb2_generateJonasConfig
	mtk_writeSession(context[:ejbJonasJarFile,"#{ejb2_target_ejbconf}/jonas-ejb-jar.xml"]) {
		ejb2_writeJonasConfig
		}
end

#ejb2_servicesObject



5
6
7
8
9
10
11
12
13
# File 'lib/ontomde-java/ejb2/main-ejb2.rb', line 5

def ejb2_services
	ca=Array.new
	uml_Class_all.each { |c| 
		next unless c.kind_of?(Muml_Class)
		next unless c.umlx_hasStereotype?('Service')
		ca << c
	}
	return ca
end

#ejb2_target_ejbconfObject



25
26
27
# File 'lib/ontomde-java/ejb2/main-ejb2.rb', line 25

def ejb2_target_ejbconf
	return context[:target_ejbconf,"#{context[:build]}META-INF"]
end

#ejb2_transform!Object



15
16
17
18
19
20
21
22
# File 'lib/ontomde-java/ejb2/main-ejb2.rb', line 15

def ejb2_transform!
	return unless context[:ejb2]
	ejb2_services.each { |c|
		c.ejb2_transform!
	}
	ejb2_generateConfig #TODO
	ejb2_generateJonasConfig
end

#ejb2_writeConfigObject



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/ontomde-java/ejb2/main-ejb2.rb', line 34

def ejb2_writeConfig
	write <<END
<?xml version="1.0"?>
<!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN' 'http://java.sun.com/dtd/ejb-jar_2_0.dtd'>

<ejb-jar>
 <enterprise-beans>
END
	ejb2_services.each { |c|
		write <<END
    <!-- #{c.ejb_Name} -->
    <session>
       <ejb-name>#{c.ejb_Name}</ejb-name> 
       <home>#{c.ejb_home_one.java_qualifiedName}</home>
       <remote>#{c.ejb_remote_one.java_qualifiedName}</remote>
       <ejb-class>#{c.ejb_bean_one.java_qualifiedName}</ejb-class>
       <session-type>Stateless</session-type>
       <transaction-type>Container</transaction-type>
    </session>
END
	}
	write <<END
 </enterprise-beans>
 <assembly-descriptor>
END
	ejb2_services.each { |c|
		write <<END
   <!-- #{c.ejb_Name} -->
   <container-transaction>
       <method>
          <ejb-name>#{c.ejb_Name}</ejb-name> 
          <method-name>*</method-name>
       </method>
       <trans-attribute>Required</trans-attribute>
   </container-transaction>
END
	}
write <<END
 </assembly-descriptor>
</ejb-jar>
END

end

#ejb2_writeJonasConfigObject



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/ontomde-java/ejb2/main-ejb2.rb', line 83

def ejb2_writeJonasConfig
	write <<END
<?xml version="1.0"?>
<jonas-ejb-jar 
xmlns="http://www.objectweb.org/jonas/ns"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.objectweb.org/jonas/ns http://www.objectweb.org/jonas/ns/jonas-ejb-jar_4_0.xsd" >
END

	ejb2_services.each { |c|
		write <<END
   <!-- #{c.ejb_Name} -->
   <jonas-session>
       <ejb-name>#{c.ejb_Name}</ejb-name> 
       <jndi-name>odn.#{c.ejb_remote_one.java_Name}</jndi-name>
       <session-timeout>60</session-timeout>
   </jonas-session>
END
	}

write <<END
</jonas-ejb-jar>
END
end