Module: Muml_Class

Defined in:
lib/ontomde-uml2-ejb2.rb

Instance Method Summary collapse

Instance Method Details

#ejb2_addOperationExceptions!(exception) ⇒ Object

adds exception to every operation



185
186
187
188
189
# File 'lib/ontomde-uml2-ejb2.rb', line 185

def ejb2_addOperationExceptions!(exception)
	uml_ownedOperation.each { |op|
		op.uml_raisedException_add(exception)	
	}
end

#ejb2_copyMethodsTo!(ejb, uri_suffix, exception) ⇒ Object



167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
# File 'lib/ontomde-uml2-ejb2.rb', line 167

def ejb2_copyMethodsTo!(ejb,uri_suffix,exception)
	uml_ownedOperation.each { |sop|
		op=ejb.umlx_createAndAddOperation("#{sop.rdf_uri}_#{uri_suffix}","#{sop.uml_name}")
		op.uml_raisedException_add(exception)	
		sop.uml_ownedParameter.each { |sp|
			p=op.umlx_createAndAddParameter("#{sp.rdf_uri}_#{uri_suffix}",sp.uml_name)
			sp.umlx_copyToAttributeProperty(p)
			p.uml_type=sp.uml_type
			p.uml_direction=sp.uml_direction
			p.uml_isUnique=sp.uml_isUnique
			p.uml_isOrdered=sp.uml_isOrdered
			p.java_use_Arrays=sp.java_use_Arrays
			p.uml_upperValue=sp.uml_upperValue
			p.uml_lowerValue=sp.uml_lowerValue
			}
	}
end

#ejb2_createBean!Object

creates a bean class for this service class (this implementation just appends bean to the class name)



138
139
140
141
142
# File 'lib/ontomde-uml2-ejb2.rb', line 138

def ejb2_createBean!
	self.ejb_bean=self
	self.uml_name="#{self.uml_name}Bean"
	ejb2_addOperationExceptions!(umlx_getOrCreateInterface("java.rmi.RemoteException"))
end

#ejb2_createHomeInterface!Object

creates a home interface for this service class



145
146
147
148
149
150
151
152
153
154
155
156
# File 'lib/ontomde-uml2-ejb2.rb', line 145

def ejb2_createHomeInterface!
	log.debug { "creating ejb home interface for: #{self}" }
	h=self.umlx_owner_one.umlx_createAndAddInterface("#{self.rdf_uri}_ejbHome","#{uml_name}Home")
	h.umlx_createAndAddGeneralization(umlx_getOrCreateInterface("javax.ejb.EJBHome"))
	self.ejb_home=h

	cr=h.umlx_createAndAddOperation("#{h.rdf_uri}_create","create")
	cr.uml_raisedException_add(umlx_getOrCreateInterface("javax.ejb.CreateException"))
	cr.uml_raisedException_add(umlx_getOrCreateInterface("java.rmi.RemoteException"))
	crret=cr.umlx_createAndAddReturnParameter("#{cr.rdf_uri}_ret","return")
	crret.uml_type=self.ejb_remote_one
end

#ejb2_createRemoteInterface!Object

creates a remote interface for this service class



159
160
161
162
163
164
165
# File 'lib/ontomde-uml2-ejb2.rb', line 159

def ejb2_createRemoteInterface!
	log.debug { "creating ejb remote interface for: #{self}" }
	r=self.umlx_owner_one.umlx_createAndAddInterface("#{self.rdf_uri}_ejbRemote","#{uml_name}")
	r.umlx_createAndAddGeneralization(umlx_getOrCreateInterface("javax.ejb.EJBObject"))
	self.ejb_remote=r
	ejb2_copyMethodsTo!(ejb_remote_one,"ejbRemote",umlx_getOrCreateInterface("java.rmi.RemoteException"))
end

#ejb2_transform!Object

process this java bean to :

  • generate the proper ejb interfaces,

  • add required exceptions,

  • add required interface implementations



124
125
126
127
128
129
# File 'lib/ontomde-uml2-ejb2.rb', line 124

def ejb2_transform!
	log.debug { "processing ejb service: #{self}" }
	ejb2_createRemoteInterface!
	ejb2_createHomeInterface!
	ejb2_createBean!
end

#ejb_NameObject

Return an alias name for this class“



132
133
134
# File 'lib/ontomde-uml2-ejb2.rb', line 132

def ejb_Name
	return "#{java_Name}EJB"
end