KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > metadata > ApplicationMetaData


1 /*
2 * JBoss, Home of Professional Open Source
3 * Copyright 2005, JBoss Inc., and individual contributors as indicated
4 * by the @authors tag. See the copyright.txt in the distribution for a
5 * full listing of individual contributors.
6 *
7 * This is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as
9 * published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
11 *
12 * This software is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this software; if not, write to the Free
19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 */

22 package org.jboss.metadata;
23
24 import org.jboss.deployment.DeploymentException;
25 import org.jboss.mx.util.MBeanServerLocator;
26 import org.w3c.dom.DocumentType JavaDoc;
27 import org.w3c.dom.Element JavaDoc;
28
29 import javax.management.MBeanServer JavaDoc;
30 import javax.management.ObjectName JavaDoc;
31 import java.net.URL JavaDoc;
32 import java.net.URLClassLoader JavaDoc;
33 import java.util.ArrayList JavaDoc;
34 import java.util.HashMap JavaDoc;
35 import java.util.HashSet JavaDoc;
36 import java.util.Iterator JavaDoc;
37 import java.util.Map JavaDoc;
38 import java.util.Set JavaDoc;
39
40 /**
41  * The top level meta data from the jboss.xml and ejb-jar.xml descriptor.
42  *
43  * @author <a HREF="mailto:sebastien.alborini@m4x.org">Sebastien Alborini</a>
44  * @author <a HREF="mailto:peter.antman@tim.se">Peter Antman</a>
45  * @author <a HREF="mailto:Scott.Stark@jboss.org">Scott Stark</a>
46  * @author <a HREF="mailto:criege@riege.com">Christian Riege</a>
47  * @author <a HREF="mailto:Christoph.Jung@infor.de">Christoph G. Jung</a>.
48  * @author <a HREF="mailto:Thomas.Diesler@jboss.org">Thomas Diesler</a>.
49  *
50  * @version $Revision: 58349 $
51  */

52 public class ApplicationMetaData
53    extends MetaData
54 {
55    public static final int EJB_1x = 1;
56    public static final int EJB_2x = 2;
57    private String JavaDoc description;
58    private String JavaDoc displayName;
59    /** The ejb jar URL */
60    private URL JavaDoc url;
61    /** version of the dtd used to create ejb-jar.xml */
62    protected int ejbVersion;
63    protected int ejbMinorVersion;
64    /** ArrayList<BeanMetaData> for the ejbs */
65    private ArrayList JavaDoc beans = new ArrayList JavaDoc();
66    /** A HashMap<String, String> for webservice description publish locations */
67    private HashMap JavaDoc wsdlPublishLocationMap = new HashMap JavaDoc();
68    /** True if this is a web service deployment */
69    private boolean webServiceDeployment;
70    /** The optional JBossWS config-name */
71    private String JavaDoc configName;
72    /** The optional JBossWS config-file */
73    private String JavaDoc configFile;
74    private String JavaDoc clientJar;
75    /** List<RelationMetaData> of relations in this application. */
76    private ArrayList JavaDoc<RelationMetaData> relationships = new ArrayList JavaDoc<RelationMetaData>();
77    /** The assembly-descriptor */
78    private AssemblyDescriptorMetaData assemblyDescriptor = new AssemblyDescriptorMetaData();
79    /** A HashMap<String, ConfigurationMetaData> for container configs */
80    private HashMap JavaDoc configurations = new HashMap JavaDoc();
81    /** A HashMap<String, InvokerProxyBindingMetaData> for invoker bindings */
82    private HashMap JavaDoc invokerBindings = new HashMap JavaDoc();
83    /** A HashMap<String, String> of res-name to JNDI name/URL */
84    private HashMap JavaDoc resources = new HashMap JavaDoc();
85    private HashMap JavaDoc plugins = new HashMap JavaDoc();
86    /** The user defined JMX name for the EJBModule */
87    private String JavaDoc jmxName;
88    /** The security-domain value assigned to the application */
89    private String JavaDoc securityDomain;
90    /** The unauthenticated-principal value assigned to the application */
91    private String JavaDoc unauthenticatedPrincipal;
92    /** The web context root to use for web services */
93    private String JavaDoc webServiceContextRoot;
94    /** An unused flag if the spec security restrictions should be enforced */
95    private boolean enforceEjbRestrictions;
96    /** The missing-method-permissions-excluded-mode value */
97    private boolean excludeMissingMethods = true;
98    /** Whether to throw an exception on a rollback if there is no exception */
99    private boolean exceptionRollback = false;
100    /** The JACC context id for the container */
101    private String JavaDoc jaccContextID;
102
103
104    /** The ClassLoader to load additional resources */
105    private URLClassLoader JavaDoc resourceCl;
106
107    public ApplicationMetaData()
108    {
109    }
110
111    /** Get the ClassLoader to load additional resources */
112    public URLClassLoader JavaDoc getResourceCl()
113    {
114       return resourceCl;
115    }
116
117    /** Set the ClassLoader to load additional resources */
118    public void setResourceClassLoader(URLClassLoader JavaDoc resourceCl)
119    {
120       this.resourceCl = resourceCl;
121    }
122
123    public String JavaDoc getDescription()
124    {
125       return description;
126    }
127
128    public void setDescription(String JavaDoc description)
129    {
130       this.description = description;
131    }
132
133    public String JavaDoc getDisplayName()
134    {
135       return displayName;
136    }
137
138    public void setDisplayName(String JavaDoc displayName)
139    {
140       this.displayName = displayName;
141    }
142
143    public URL JavaDoc getUrl()
144    {
145       return url;
146    }
147
148    public void setUrl(URL JavaDoc u)
149    {
150       url = u;
151    }
152
153    public boolean isEJB1x()
154    {
155       return ejbVersion == 1;
156    }
157
158    public boolean isEJB2x()
159    {
160       return ejbVersion == 2;
161    }
162
163    public boolean isEJB21()
164    {
165       return ejbVersion == 2 && ejbMinorVersion == 1;
166    }
167
168    public int getEjbMinorVersion()
169    {
170       return ejbMinorVersion;
171    }
172
173    public void setEjbMinorVersion(int ejbMinorVersion)
174    {
175       this.ejbMinorVersion = ejbMinorVersion;
176    }
177
178    public int getEjbVersion()
179    {
180       return ejbVersion;
181    }
182
183    public void setEjbVersion(int ejbVersion)
184    {
185       this.ejbVersion = ejbVersion;
186    }
187
188    public Iterator JavaDoc getEnterpriseBeans()
189    {
190       return beans.iterator();
191    }
192
193    /**
194     * Get an EJB by its declared &lt;ejb-name&gt; tag
195     *
196     * @param ejbName EJB to return
197     *
198     * @return BeanMetaData pertaining to the given ejb-name,
199     * <code>null</code> if none found
200     */

201    public BeanMetaData getBeanByEjbName(String JavaDoc ejbName)
202    {
203       Iterator JavaDoc iterator = getEnterpriseBeans();
204       while (iterator.hasNext())
205       {
206          BeanMetaData current = (BeanMetaData)iterator.next();
207          if (current.getEjbName().equals(ejbName))
208          {
209             return current;
210          }
211       }
212
213       // not found
214
return null;
215    }
216
217    public String JavaDoc getConfigFile()
218    {
219       return configFile;
220    }
221
222    public void setConfigFile(String JavaDoc configFile)
223    {
224       this.configFile = configFile;
225    }
226
227    public String JavaDoc getConfigName()
228    {
229       return configName;
230    }
231
232    public void setConfigName(String JavaDoc configName)
233    {
234       this.configName = configName;
235    }
236
237    public String JavaDoc getClientJar()
238    {
239       return clientJar;
240    }
241
242    public void setClientJar(String JavaDoc clientJar)
243    {
244       this.clientJar = clientJar;
245    }
246
247    public HashMap JavaDoc getWsdlPublishLocations()
248    {
249       return wsdlPublishLocationMap;
250    }
251
252    public String JavaDoc getWsdlPublishLocationByName(String JavaDoc name)
253    {
254       // if not found, the we will use default
255
return (String JavaDoc)wsdlPublishLocationMap.get(name);
256    }
257
258    public String JavaDoc getWebServiceContextRoot()
259    {
260       return webServiceContextRoot;
261    }
262
263    public void setWebServiceContextRoot(String JavaDoc webServiceContextRoot)
264    {
265       if (webServiceContextRoot.charAt(0) != '/')
266       {
267          webServiceContextRoot = "/" + webServiceContextRoot;
268       }
269       this.webServiceContextRoot = webServiceContextRoot;
270    }
271
272    public boolean isWebServiceDeployment()
273    {
274       return webServiceDeployment;
275    }
276
277    public void setWebServiceDeployment(boolean webServiceDeployment)
278    {
279       this.webServiceDeployment = webServiceDeployment;
280    }
281
282    public void addRelationship(RelationMetaData rmd)
283    {
284       relationships.add(rmd);
285    }
286    /**
287     * Get the container managed relations in this application.
288     * Items are instance of RelationMetaData.
289     */

290    public Iterator JavaDoc getRelationships()
291    {
292       return relationships.iterator();
293    }
294
295    public AssemblyDescriptorMetaData getAssemblyDescriptor()
296    {
297       return assemblyDescriptor;
298    }
299
300    public Iterator JavaDoc getConfigurations()
301    {
302       return configurations.values().iterator();
303    }
304
305    public ConfigurationMetaData getConfigurationMetaDataByName(String JavaDoc name)
306    {
307       return (ConfigurationMetaData)configurations.get(name);
308    }
309
310    public void addInvokerProxyBinding(InvokerProxyBindingMetaData md)
311    {
312       invokerBindings.put(md.getName(), md);
313    }
314    public Iterator JavaDoc getInvokerProxyBindings()
315    {
316       return invokerBindings.values().iterator();
317    }
318
319    public InvokerProxyBindingMetaData getInvokerProxyBindingMetaDataByName(String JavaDoc name)
320    {
321       return (InvokerProxyBindingMetaData)invokerBindings.get(name);
322    }
323
324    public String JavaDoc getResourceByName(String JavaDoc name)
325    {
326       // if not found, the container will use default
327
return (String JavaDoc)resources.get(name);
328    }
329
330    public void mapResource(String JavaDoc name, String JavaDoc value)
331    {
332       resources.put(name, value);
333    }
334
335    public void addPluginData(String JavaDoc pluginName, Object JavaDoc pluginData)
336    {
337       plugins.put(pluginName, pluginData);
338    }
339
340    public Object JavaDoc getPluginData(String JavaDoc pluginName)
341    {
342       return plugins.get(pluginName);
343    }
344
345    public String JavaDoc getJmxName()
346    {
347       return jmxName;
348    }
349    public void setJmxName(String JavaDoc name)
350    {
351       this.jmxName = name;
352    }
353
354    public String JavaDoc getJaccContextID()
355    {
356       return jaccContextID;
357    }
358    public void setJaccContextID(String JavaDoc jaccContextID)
359    {
360       this.jaccContextID = jaccContextID;
361    }
362
363    public String JavaDoc getSecurityDomain()
364    {
365       return securityDomain;
366    }
367
368    /**
369     * Set the security domain for this web application
370     */

371    public void setSecurityDomain(String JavaDoc securityDomain)
372    {
373       this.securityDomain = securityDomain;
374    }
375
376    public String JavaDoc getUnauthenticatedPrincipal()
377    {
378       return unauthenticatedPrincipal;
379    }
380
381    public void setUnauthenticatedPrincipal(String JavaDoc unauthenticatedPrincipal)
382    {
383       this.unauthenticatedPrincipal = unauthenticatedPrincipal;
384    }
385
386    public boolean getEnforceEjbRestrictions()
387    {
388       return enforceEjbRestrictions;
389    }
390
391    public void setEnforceEjbRestrictions(boolean enforceEjbRestrictions)
392    {
393       this.enforceEjbRestrictions = enforceEjbRestrictions;
394    }
395
396    public boolean isExcludeMissingMethods()
397    {
398       return excludeMissingMethods;
399    }
400
401    public void setExcludeMissingMethods(boolean excludeMissingMethods)
402    {
403       this.excludeMissingMethods = excludeMissingMethods;
404    }
405
406    public MessageDestinationMetaData getMessageDestination(String JavaDoc name)
407    {
408       return assemblyDescriptor.getMessageDestinationMetaData(name);
409    }
410
411    public boolean getExceptionRollback()
412    {
413       return exceptionRollback;
414    }
415    public void setExceptionRollback(boolean flag)
416    {
417       this.exceptionRollback = flag;
418    }
419
420    public void addBeanMetaData(BeanMetaData metaData)
421    {
422       beans.add(metaData);
423    }
424
425    /**
426     * Import data provided by ejb-jar.xml
427     *
428     * @throws DeploymentException When there was an error encountered
429     * while parsing ejb-jar.xml
430     */

431    public void importEjbJarXml(Element JavaDoc element)
432       throws DeploymentException
433    {
434       // EJB version is determined by the doc type that was used to
435
// verify the ejb-jar.xml.
436
DocumentType JavaDoc docType = element.getOwnerDocument().getDoctype();
437
438       if (docType == null)
439       {
440          // test if this is a 2.1 schema-based descriptor
441
if ("http://java.sun.com/xml/ns/j2ee".equals(element.getNamespaceURI()))
442          {
443             ejbVersion = 2;
444             ejbMinorVersion = 1;
445          }
446          else
447          {
448             // No good, EJB 1.1/2.1 requires a DOCTYPE declaration
449
throw new DeploymentException("ejb-jar.xml must either obey " +
450                "the right xml schema or define a valid DOCTYPE!");
451          }
452       }
453       else
454       {
455          String JavaDoc publicId = docType.getPublicId();
456          if (publicId == null)
457          {
458             // We need a public Id
459
throw new DeploymentException("The DOCTYPE declaration in " +
460                "ejb-jar.xml must define a PUBLIC id");
461          }
462
463          // Check for a known public Id
464
if (publicId.startsWith("-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0"))
465          {
466             ejbVersion = 2;
467          }
468          else if (publicId.startsWith("-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1"))
469          {
470             ejbVersion = 1;
471          }
472          else
473          {
474             // Unknown
475
throw new DeploymentException("Unknown PUBLIC id in " +
476                "ejb-jar.xml: " + publicId);
477          }
478       }
479
480       // find the beans
481
Element JavaDoc enterpriseBeans = getUniqueChild(element, "enterprise-beans");
482
483       // Entity Beans
484
HashMap JavaDoc schemaNameMap = new HashMap JavaDoc();
485       Iterator JavaDoc iterator = getChildrenByTagName(enterpriseBeans, "entity");
486       while (iterator.hasNext())
487       {
488          Element JavaDoc currentEntity = (Element JavaDoc)iterator.next();
489          EntityMetaData entityMetaData = new EntityMetaData(this);
490          try
491          {
492             entityMetaData.importEjbJarXml(currentEntity);
493          }
494          catch (DeploymentException e)
495          {
496             throw new DeploymentException("Error in ejb-jar.xml " +
497                "for Entity Bean " + entityMetaData.getEjbName() + ": " +
498                e.getMessage());
499          }
500
501          // Ensure unique-ness of <abstract-schema-name>
502
String JavaDoc abstractSchemaName = entityMetaData.getAbstractSchemaName();
503          if (abstractSchemaName != null)
504          {
505             if (schemaNameMap.containsKey(abstractSchemaName))
506             {
507                //
508
throw new DeploymentException(entityMetaData.getEjbName() +
509                   ": Duplicate abstract-schema name '" + abstractSchemaName +
510                   "'. Already defined for Entity '" +
511                   ((EntityMetaData)schemaNameMap.get(abstractSchemaName)).getEjbName() + "'.");
512             }
513             schemaNameMap.put(abstractSchemaName, entityMetaData);
514          }
515
516          beans.add(entityMetaData);
517       }
518
519       // Session Beans
520
iterator = getChildrenByTagName(enterpriseBeans, "session");
521       while (iterator.hasNext())
522       {
523          Element JavaDoc currentSession = (Element JavaDoc)iterator.next();
524          SessionMetaData sessionMetaData = new SessionMetaData(this);
525          try
526          {
527             sessionMetaData.importEjbJarXml(currentSession);
528          }
529          catch (DeploymentException e)
530          {
531             throw new DeploymentException("Error in ejb-jar.xml for " +
532                "Session Bean " + sessionMetaData.getEjbName() + ": " +
533                e.getMessage());
534          }
535          beans.add(sessionMetaData);
536       }
537
538       // Message Driven Beans
539
iterator = getChildrenByTagName(enterpriseBeans, "message-driven");
540       while (iterator.hasNext())
541       {
542          Element JavaDoc currentMessageDriven = (Element JavaDoc)iterator.next();
543          MessageDrivenMetaData messageDrivenMetaData =
544             new MessageDrivenMetaData(this);
545
546          try
547          {
548             messageDrivenMetaData.importEjbJarXml(currentMessageDriven);
549          }
550          catch (DeploymentException e)
551          {
552             throw new DeploymentException("Error in ejb-jar.xml for " +
553                "Message Driven Bean " +
554                messageDrivenMetaData.getEjbName() + ": " + e.getMessage());
555          }
556          beans.add(messageDrivenMetaData);
557       }
558
559       // Enforce unique-ness of declared ejb-name Elements
560
Set JavaDoc ejbNames = new HashSet JavaDoc();
561       Iterator JavaDoc beanIt = beans.iterator();
562       while (beanIt.hasNext())
563       {
564          BeanMetaData bmd = (BeanMetaData)beanIt.next();
565
566          String JavaDoc beanName = bmd.getEjbName();
567          if (ejbNames.contains(beanName))
568          {
569             throw new DeploymentException("Duplicate definition of an " +
570                "EJB with name '" + beanName + "'.");
571          }
572
573          ejbNames.add(beanName);
574       }
575
576       // Relationships
577
Element JavaDoc relationshipsElement = getOptionalChild(element,
578          "relationships");
579       if (relationshipsElement != null)
580       {
581          // used to assure that a relationship name is not reused
582
Set JavaDoc relationNames = new HashSet JavaDoc();
583
584          iterator = getChildrenByTagName(relationshipsElement,
585             "ejb-relation");
586          while (iterator.hasNext())
587          {
588             Element JavaDoc relationElement = (Element JavaDoc)iterator.next();
589             RelationMetaData relationMetaData = new RelationMetaData();
590             try
591             {
592                relationMetaData.importEjbJarXml(relationElement);
593             }
594             catch (DeploymentException e)
595             {
596                throw new DeploymentException("Error in ejb-jar.xml " +
597                   "for relation " + relationMetaData.getRelationName() +
598                   ": " + e.getMessage());
599             }
600
601             // if the relationship has a name, assure that it has not
602
// already been used
603
String JavaDoc relationName = relationMetaData.getRelationName();
604             if (relationName != null)
605             {
606                if (relationNames.contains(relationName))
607                {
608                   throw new DeploymentException("ejb-relation-name must " +
609                      "be unique in ejb-jar.xml file: ejb-relation-name is " +
610                      relationName);
611                }
612                relationNames.add(relationName);
613             }
614
615             relationships.add(relationMetaData);
616          }
617       }
618
619       // read the assembly descriptor (optional)
620
Element JavaDoc descrElement = getOptionalChild(element, "assembly-descriptor");
621       if (descrElement != null)
622       {
623          // set the security roles (optional)
624
iterator = getChildrenByTagName(descrElement, "security-role");
625          while (iterator.hasNext())
626          {
627             Element JavaDoc securityRole = (Element JavaDoc)iterator.next();
628             try
629             {
630                String JavaDoc roleName = getElementContent(getUniqueChild(securityRole, "role-name"));
631                SecurityRoleMetaData srMetaData = new SecurityRoleMetaData(roleName);
632                assemblyDescriptor.addSecurityRoleMetaData(srMetaData);
633             }
634             catch (DeploymentException e)
635             {
636                throw new DeploymentException("Error in ejb-jar.xml " +
637                   "for security-role: " + e.getMessage());
638             }
639          }
640
641          // set the method permissions (optional)
642
iterator = getChildrenByTagName(descrElement,
643             "method-permission");
644          try
645          {
646             while (iterator.hasNext())
647             {
648                Element JavaDoc methodPermission = (Element JavaDoc)iterator.next();
649                // Look for the unchecked element
650
Element JavaDoc unchecked = getOptionalChild(methodPermission,
651                   "unchecked");
652
653                boolean isUnchecked = false;
654                Set JavaDoc roles = null;
655                if (unchecked != null)
656                {
657                   isUnchecked = true;
658                }
659                else
660                {
661                   // Get the role-name elements
662
roles = new HashSet JavaDoc();
663                   Iterator JavaDoc rolesIterator = getChildrenByTagName(methodPermission, "role-name");
664                   while (rolesIterator.hasNext())
665                   {
666                      roles.add(getElementContent((Element JavaDoc)rolesIterator.next()));
667                   }
668                   if (roles.size() == 0)
669                      throw new DeploymentException("An unchecked " +
670                         "element or one or more role-name elements " +
671                         "must be specified in method-permission");
672                }
673
674                // find the methods
675
Iterator JavaDoc methods = getChildrenByTagName(methodPermission,
676                   "method");
677                while (methods.hasNext())
678                {
679                   // load the method
680
MethodMetaData method = new MethodMetaData();
681                   method.importEjbJarXml((Element JavaDoc)methods.next());
682                   if (isUnchecked)
683                   {
684                      method.setUnchecked();
685                   }
686                   else
687                   {
688                      method.setRoles(roles);
689                   }
690
691                   // give the method to the right bean
692
BeanMetaData bean = getBeanByEjbName(method.getEjbName());
693                   if (bean == null)
694                   {
695                      throw new DeploymentException(method.getEjbName() +
696                         " doesn't exist");
697                   }
698                   bean.addPermissionMethod(method);
699                }
700             }
701          }
702          catch (DeploymentException e)
703          {
704             throw new DeploymentException("Error in ejb-jar.xml, " +
705                "in method-permission: " + e.getMessage());
706          }
707
708          // set the container transactions (optional)
709
iterator = getChildrenByTagName(descrElement,
710             "container-transaction");
711          try
712          {
713             while (iterator.hasNext())
714             {
715                Element JavaDoc containerTransaction = (Element JavaDoc)iterator.next();
716
717                // find the type of the transaction
718
String JavaDoc type = getElementContent(getUniqueChild(containerTransaction, "trans-attribute"));
719                byte transactionType = MethodMetaData.getTransactionAttribute(type);
720
721                // find the methods
722
Iterator JavaDoc methods = getChildrenByTagName(containerTransaction, "method");
723                while (methods.hasNext())
724                {
725                   // load the method
726
MethodMetaData method = new MethodMetaData();
727                   method.importEjbJarXml((Element JavaDoc)methods.next());
728                   method.setTransactionType(transactionType);
729
730                   // give the method to the right bean
731
BeanMetaData bean = getBeanByEjbName(method.getEjbName());
732                   if (bean == null)
733                   {
734                      throw new DeploymentException("bean " +
735                         method.getEjbName() + " doesn't exist");
736                   }
737                   bean.addTransactionMethod(method);
738                }
739             }
740          }
741          catch (DeploymentException e)
742          {
743             throw new DeploymentException("Error in ejb-jar.xml, " +
744                "in <container-transaction>: " + e.getMessage());
745          }
746
747          // Get the exclude-list methods
748
Element JavaDoc excludeList = getOptionalChild(descrElement,
749             "exclude-list");
750          if (excludeList != null)
751          {
752             iterator = getChildrenByTagName(excludeList, "method");
753             while (iterator.hasNext())
754             {
755                Element JavaDoc methodInf = (Element JavaDoc)iterator.next();
756                // load the method
757
MethodMetaData method = new MethodMetaData();
758                method.importEjbJarXml(methodInf);
759                method.setExcluded();
760
761                // give the method to the right bean
762
BeanMetaData bean = getBeanByEjbName(method.getEjbName());
763                if (bean == null)
764                {
765                   throw new DeploymentException("bean " +
766                      method.getEjbName() + " doesn't exist");
767                }
768                bean.addExcludedMethod(method);
769             }
770          }
771
772          // set the message destinations (optional)
773
iterator = getChildrenByTagName(descrElement, "message-destination");
774          while (iterator.hasNext())
775          {
776             Element JavaDoc messageDestination = (Element JavaDoc)iterator.next();
777             try
778             {
779                MessageDestinationMetaData messageDestinationMetaData = new MessageDestinationMetaData();
780                messageDestinationMetaData.importEjbJarXml(messageDestination);
781                assemblyDescriptor.addMessageDestinationMetaData(messageDestinationMetaData);
782             }
783             catch (Throwable JavaDoc t)
784             {
785                throw new DeploymentException("Error in ejb-jar.xml " +
786                   "for message destination: " + t.getMessage());
787             }
788          }
789       }
790    }
791
792    public void importJbossXml(Element JavaDoc element)
793       throws DeploymentException
794    {
795       Iterator JavaDoc iterator;
796
797       // all the tags are optional
798

799       // Get the enforce-ejb-restrictions
800
Element JavaDoc enforce = getOptionalChild(element, "enforce-ejb-restrictions");
801       if (enforce != null)
802       {
803          String JavaDoc tmp = getElementContent(enforce);
804          enforceEjbRestrictions = Boolean.valueOf(tmp).booleanValue();
805       }
806
807       // Get any user defined JMX name
808
Element JavaDoc jmxNameElement = getOptionalChild(element,
809          "jmx-name");
810       if (jmxNameElement != null)
811       {
812          jmxName = getElementContent(jmxNameElement);
813       }
814
815       // Throw an exception when marked rollback with no exception thrown
816
exceptionRollback = MetaData.getOptionalChildBooleanContent(element, "exception-on-rollback", false);
817
818       // Get the security domain name
819
Element JavaDoc securityDomainElement = getOptionalChild(element,
820          "security-domain");
821       if (securityDomainElement != null)
822       {
823          securityDomain = getElementContent(securityDomainElement);
824       }
825
826       // G