[jboss-cvs] JBossAS SVN: r58146 - in trunk/server/src/main/org/jboss: deployment ejb ejb/deployers metadata
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Nov 6 00:30:42 EST 2006
Author: scott.stark at jboss.org
Date: 2006-11-06 00:30:29 -0500 (Mon, 06 Nov 2006)
New Revision: 58146
Added:
trunk/server/src/main/org/jboss/deployment/EjbJarObjectFactory.java
trunk/server/src/main/org/jboss/deployment/EjbParsingDeployer.java
trunk/server/src/main/org/jboss/deployment/JBossEjbObjectFactory.java
trunk/server/src/main/org/jboss/deployment/JBossEjbParsingDeployer.java
trunk/server/src/main/org/jboss/ejb/deployers/
trunk/server/src/main/org/jboss/ejb/deployers/EjbDeployer.java
Modified:
trunk/server/src/main/org/jboss/ejb/Container.java
trunk/server/src/main/org/jboss/ejb/EjbModule.java
trunk/server/src/main/org/jboss/ejb/EjbUtil.java
trunk/server/src/main/org/jboss/metadata/ApplicationMetaData.java
trunk/server/src/main/org/jboss/metadata/BeanMetaData.java
trunk/server/src/main/org/jboss/metadata/EntityMetaData.java
trunk/server/src/main/org/jboss/metadata/InvokerProxyBindingMetaData.java
trunk/server/src/main/org/jboss/metadata/RelationMetaData.java
trunk/server/src/main/org/jboss/metadata/SecurityIdentityMetaData.java
Log:
Move the ejb deployer to the vdf framework
Added: trunk/server/src/main/org/jboss/deployment/EjbJarObjectFactory.java
===================================================================
--- trunk/server/src/main/org/jboss/deployment/EjbJarObjectFactory.java 2006-11-06 05:28:20 UTC (rev 58145)
+++ trunk/server/src/main/org/jboss/deployment/EjbJarObjectFactory.java 2006-11-06 05:30:29 UTC (rev 58146)
@@ -0,0 +1,464 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.deployment;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.jboss.logging.Logger;
+import org.jboss.metadata.ApplicationMetaData;
+import org.jboss.metadata.DDObjectFactory;
+import org.jboss.metadata.EntityMetaData;
+import org.jboss.metadata.IconMetaData;
+import org.jboss.metadata.MessageDestinationMetaData;
+import org.jboss.metadata.MessageDrivenMetaData;
+import org.jboss.metadata.MethodMetaData;
+import org.jboss.metadata.QueryMetaData;
+import org.jboss.metadata.RelationMetaData;
+import org.jboss.metadata.RelationshipRoleMetaData;
+import org.jboss.metadata.SecurityIdentityMetaData;
+import org.jboss.metadata.SecurityRoleMetaData;
+import org.jboss.metadata.SessionMetaData;
+import org.jboss.xb.binding.ObjectModelFactory;
+import org.jboss.xb.binding.UnmarshallingContext;
+import org.xml.sax.Attributes;
+
+/**
+ * An ObjectModelFactory implementation for parsing ejb-jar.xml descriptors.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public class EjbJarObjectFactory extends DDObjectFactory
+ implements ObjectModelFactory
+{
+ private static Logger log = Logger.getLogger(EjbJarObjectFactory.class);
+ private int ejbVersion = 2;
+ private int ejbMinorVersion = 0;
+
+ static class EnterpriseBeans
+ {
+ ApplicationMetaData app;
+ EnterpriseBeans(ApplicationMetaData app)
+ {
+ this.app = app;
+ }
+ List<EntityMetaData> entityBeans = new ArrayList<EntityMetaData>();
+ List<SessionMetaData> sessionBeans = new ArrayList<SessionMetaData>();
+ List<MessageDrivenMetaData> messageBeans = new ArrayList<MessageDrivenMetaData>();
+ }
+ static class Relationships
+ {
+ ApplicationMetaData app;
+ Relationships(ApplicationMetaData app)
+ {
+ this.app = app;
+ }
+ // used to assure that a relationship name is not reused
+ Set relationNames = new HashSet();
+ List<RelationMetaData> relations = new ArrayList<RelationMetaData>();
+ }
+ static class AssemblyDescriptor
+ {
+ static class MethodPermission
+ {
+ List<MethodMetaData> methods = new ArrayList<MethodMetaData>();
+ }
+ static class ContainerTransaction
+ {
+
+ }
+ List<SecurityRoleMetaData> securityRoles = new ArrayList<SecurityRoleMetaData>();
+ List<MethodPermission> methodPermissions = new ArrayList<MethodPermission>();
+ List<ContainerTransaction> transactions = new ArrayList<ContainerTransaction>();
+ List<MessageDestinationMetaData> destinations = new ArrayList<MessageDestinationMetaData>();
+ List<MethodMetaData> excluded = new ArrayList<MethodMetaData>();
+ }
+
+ public void startDTD(String name, String publicId, String systemId)
+ {
+ // Check for a known public Id
+ if (publicId.startsWith("-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0"))
+ {
+ ejbVersion = 2;
+ }
+ else if (publicId.startsWith("-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1"))
+ {
+ ejbVersion = 1;
+ }
+ }
+
+ public ApplicationMetaData newRoot(Object root, UnmarshallingContext navigator,
+ String namespaceURI, String localName, Attributes attrs)
+ {
+ ApplicationMetaData metaData = null;
+ if (root != null)
+ metaData = (ApplicationMetaData) root;
+ else
+ metaData = new ApplicationMetaData();
+ return metaData;
+ }
+
+ public Object completeRoot(Object root, UnmarshallingContext ctx,
+ String uri, String name)
+ {
+ return root;
+ }
+
+ /**
+ * Create the application child elements
+ *
+ * @param dd
+ * @param navigator
+ * @param namespaceURI
+ * @param localName
+ * @param attrs
+ * @return
+ */
+ public Object newChild(ApplicationMetaData dd, UnmarshallingContext navigator,
+ String namespaceURI, String localName, Attributes attrs)
+ {
+ Object child = null;
+ log.debug("newChild, " + localName);
+
+ // Check version
+ String version = attrs.getValue(namespaceURI, "version");
+ if( version != null )
+ {
+ if( version.equals("2.1") )
+ {
+ dd.setEjbVersion(2);
+ dd.setEjbMinorVersion(1);
+ }
+ }
+ else
+ {
+ // Use version from dtd
+ dd.setEjbVersion(ejbVersion);
+ dd.setEjbMinorVersion(ejbMinorVersion);
+ }
+
+ // Check elements
+ if (localName.equals("enterprise-beans"))
+ child = new EnterpriseBeans(dd);
+ else if(localName.equals("relationships"))
+ child = new Relationships(dd);
+ else if( localName.equals("assembly-descriptor"))
+ child = new AssemblyDescriptor();
+ else if(localName.equals("icon"))
+ child = new IconMetaData();
+ else if (log.isTraceEnabled())
+ {
+ log.trace("Ignoring: " + localName);
+ }
+ return child;
+ }
+
+ /**
+ * ejb-jar/enterprise-beans children
+ *
+ * @param module
+ * @param navigator
+ * @param namespaceURI
+ * @param localName
+ * @param attrs
+ * @return
+ */
+ public Object newChild(EnterpriseBeans beans, UnmarshallingContext navigator,
+ String namespaceURI, String localName, Attributes attrs)
+ {
+ Object child = null;
+ if (localName.equals("entity"))
+ {
+ child = new EntityMetaData(beans.app);
+ }
+ else if (localName.equals("session"))
+ {
+ child = new SessionMetaData(beans.app);
+ }
+ else if (localName.equals("message-driven"))
+ {
+ child = new MessageDrivenMetaData(beans.app);
+ }
+ return child;
+ }
+
+ public Object newChild(EntityMetaData entity, UnmarshallingContext navigator,
+ String namespaceURI, String localName, Attributes attrs)
+ {
+ Object child = null;
+ // Handle the *-ref elements
+ if ((child = newEnvRefGroupChild(localName)) != null)
+ return child;
+ else if (localName.equals("security-identity"))
+ child = new SecurityIdentityMetaData();
+ else if (localName.equals("query"))
+ {
+ child = new QueryMetaData();
+ }
+ else
+ {
+ log.debug("Ignoring: " + localName);
+ }
+ return child;
+ }
+ public Object newChild(MessageDrivenMetaData mdb, UnmarshallingContext navigator,
+ String namespaceURI, String localName, Attributes attrs)
+ {
+ Object child = null;
+ // Handle the *-ref elements
+ if ((child = newEnvRefGroupChild(localName)) != null)
+ return child;
+ else if (localName.equals("security-identity"))
+ child = new SecurityIdentityMetaData();
+ else
+ {
+ log.debug("Ignoring: " + localName);
+ }
+ return child;
+ }
+ public Object newChild(SessionMetaData session, UnmarshallingContext navigator,
+ String namespaceURI, String localName, Attributes attrs)
+ {
+ Object child = null;
+ // Handle the *-ref elements
+ if ((child = newEnvRefGroupChild(localName)) != null)
+ return child;
+ else if (localName.equals("security-identity"))
+ child = new SecurityIdentityMetaData();
+ else
+ {
+ log.debug("Ignoring: " + localName);
+ }
+ return child;
+ }
+
+ /**
+ *
+ * @param relations
+ * @param navigator
+ * @param namespaceURI
+ * @param localName
+ * @param attrs
+ * @return
+ */
+ public Object newChild(Relationships relations, UnmarshallingContext navigator,
+ String namespaceURI, String localName, Attributes attrs)
+ {
+ Object child = null;
+ if (localName.equals("ejb-relation"))
+ child = new RelationMetaData();
+ else
+ {
+ log.debug("Ignoring: " + localName);
+ }
+ return child;
+ }
+ public Object newChild(RelationMetaData relation, UnmarshallingContext navigator,
+ String namespaceURI, String localName, Attributes attrs)
+ {
+ Object child = null;
+
+ // left role
+ if( localName.equals("ejb-relationship-role") )
+ {
+ child = new RelationshipRoleMetaData(relation);
+ // TODO need to populate RelationshipRoleMetaData
+ }
+ else
+ {
+ log.debug("Ignoring: " + localName);
+ }
+ return child;
+ }
+
+ public void addChild(ApplicationMetaData parent, EnterpriseBeans beans,
+ UnmarshallingContext navigator, String namespaceURI, String localName)
+ {
+ // Noop
+ }
+ public void addChild(EnterpriseBeans beans, EntityMetaData md,
+ UnmarshallingContext navigator, String namespaceURI, String localName)
+ {
+ beans.app.addBeanMetaData(md);
+ }
+ public void addChild(EnterpriseBeans beans, SessionMetaData md,
+ UnmarshallingContext navigator, String namespaceURI, String localName)
+ {
+ beans.app.addBeanMetaData(md);
+ }
+ public void addChild(EnterpriseBeans beans, MessageDrivenMetaData md,
+ UnmarshallingContext navigator, String namespaceURI, String localName)
+ {
+ beans.app.addBeanMetaData(md);
+ }
+
+ public void addChild(ApplicationMetaData parent, Relationships relationships,
+ UnmarshallingContext navigator, String namespaceURI, String localName)
+ {
+ // Noop?
+ }
+ public void addChild(Relationships relationships, RelationMetaData relation,
+ UnmarshallingContext navigator, String namespaceURI, String localName)
+ {
+ // Need to validate...
+ relationships.app.addRelationship(relation);
+ }
+ public void addChild(ApplicationMetaData parent, AssemblyDescriptor ad,
+ UnmarshallingContext navigator, String namespaceURI, String localName)
+ {
+ // TODO
+ }
+
+ /**
+ * Set text values of ejb-jar/* children
+ * @param dd
+ * @param navigator
+ * @param namespaceURI
+ * @param localName
+ * @param value
+ */
+ public void setValue(ApplicationMetaData dd,
+ UnmarshallingContext navigator, String namespaceURI, String localName,
+ String value)
+ {
+ if( localName.equals("display-name") )
+ dd.setDisplayName(value);
+ else if( localName.equals("description") )
+ dd.setDescription(value);
+ else if(localName.equals("ejb-client-jar"))
+ dd.setClientJar(value);
+ }
+
+ /**
+ * Set text values of entity/* children
+ * @param dd
+ * @param navigator
+ * @param namespaceURI
+ * @param localName
+ * @param value
+ */
+ public void setValue(EntityMetaData entity,
+ UnmarshallingContext navigator, String namespaceURI, String localName,
+ String value)
+ {
+
+ if( localName.equals("display-name") )
+ entity.setDisplayName(value);
+ else if( localName.equals("description") )
+ entity.setDescription(value);
+ else if( localName.equals("ejb-name") )
+ entity.setEjbName(value);
+ else if( localName.equals("home") )
+ entity.setHomeClass(value);
+ else if( localName.equals("remote") )
+ entity.setRemoteClass(value);
+ else if( localName.equals("local-home") )
+ entity.setLocalHomeClass(value);
+ else if( localName.equals("local") )
+ entity.setLocalClass(value);
+ else if( localName.equals("ejb-class") )
+ entity.setEjbClass(value);
+ else if( localName.equals("persistence-type") )
+ {
+ boolean cmp = false;
+ if( value.equals("Bean") )
+ {
+ cmp = false;
+ }
+ else if( value.equals("Container") )
+ {
+ cmp = true;
+ }
+ else
+ {
+ throw new IllegalStateException( entity.getEjbName() + ": " +
+ "persistence-type must be 'Bean' or 'Container'!" );
+ }
+ entity.setCmp(cmp);
+ }
+ else if( localName.equals("prim-key-class") )
+ entity.setPrimaryKeyClass(value);
+ else if( localName.equals("reentrant") )
+ {
+ boolean flag = Boolean.valueOf(value);
+ entity.setReentrant(flag);
+ }
+ else if( localName.equals("cmp-version") )
+ {
+ int cmpVersion = 2;
+ if( "1.x".equals(value) )
+ {
+ cmpVersion = 1;
+ }
+ else if( "2.x".equals(value) )
+ {
+ cmpVersion = 2;
+ }
+ entity.setCmpVersion(cmpVersion);
+ }
+ else if( localName.equals("abstract-schema-name") )
+ entity.setAbstractSchemaName(value);
+ else if( localName.equals("cmp-field") )
+ {
+ entity.getCmpFields().add(value);
+ }
+ else if( localName.equals("primkey-field") )
+ entity.setPrimKeyField(value);
+ }
+
+ public void setValue(IconMetaData icon,
+ UnmarshallingContext navigator, String namespaceURI, String localName,
+ String value)
+ {
+ if( localName.equals("small-icon") )
+ icon.setSmallIcon(value);
+ if( localName.equals("large-icon") )
+ icon.setLargeIcon(value);
+ }
+
+ public void setValue(RelationMetaData relation,
+ UnmarshallingContext navigator, String namespaceURI, String localName,
+ String value)
+ {
+ if( localName.equals("description") )
+ {
+ relation.setDescription(value);
+ }
+ else if( localName.equals("display-name") )
+ {
+ relation.setDisplayName(value);
+ }
+ else if( localName.equals("ejb-relation-name") )
+ {
+ relation.setRelationName(value);
+ }
+ else if( localName.equals("ejb-relation-name") )
+ {
+ relation.setRelationName(value);
+ }
+
+ }
+
+}
Added: trunk/server/src/main/org/jboss/deployment/EjbParsingDeployer.java
===================================================================
--- trunk/server/src/main/org/jboss/deployment/EjbParsingDeployer.java 2006-11-06 05:28:20 UTC (rev 58145)
+++ trunk/server/src/main/org/jboss/deployment/EjbParsingDeployer.java 2006-11-06 05:30:29 UTC (rev 58146)
@@ -0,0 +1,89 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.deployment;
+
+import org.jboss.deployers.plugins.deployers.helpers.ObjectModelFactoryDeployer;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentUnit;
+import org.jboss.metadata.ApplicationMetaData;
+import org.jboss.xb.binding.ObjectModelFactory;
+
+/**
+ * An ObjectModelFactoryDeployer for translating ejb-jar.xml descriptors into
+ * ApplicationMetaData instances.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public class EjbParsingDeployer extends ObjectModelFactoryDeployer<ApplicationMetaData>
+{
+ /** The name of the ejb descriptor in the deployment context metadata path */
+ private String ejbXmlPath = "ejb-jar.xml";
+
+ public EjbParsingDeployer()
+ {
+ super(ApplicationMetaData.class);
+ }
+
+ /**
+ * Get the virtual file path for the application descriptor in the
+ * DeploymentContext.getMetaDataPath.
+ *
+ * @return the current virtual file path for the application descriptor
+ */
+ public String getAppXmlPath()
+ {
+ return ejbXmlPath;
+ }
+ /**
+ * Set the virtual file path for the application descriptor in the
+ * DeploymentContext.getMetaDataLocation. The standard path is application.xml
+ * to be found in the META-INF metdata path.
+ *
+ * @param ejbXmlPath - new virtual file path for the application descriptor
+ */
+ public void setAppXmlPath(String ejbXmlPath)
+ {
+ this.ejbXmlPath = ejbXmlPath;
+ }
+
+ /**
+ * Return EjbJarObjectFactory as our ObjectModelFactory.
+ * @return a new EjbJarObjectFactory instance
+ */
+ @Override
+ protected ObjectModelFactory getObjectModelFactory(ApplicationMetaData root)
+ {
+ return new EjbJarObjectFactory();
+ }
+
+ /**
+ * Overriden to invoke createMetaData(unit, ejbXmlPath, null) to parse any
+ * ejbXmlPath descriptor into a ApplicationMetaData instance.
+ */
+ @Override
+ public void deploy(DeploymentUnit unit) throws DeploymentException
+ {
+ createMetaData(unit, ejbXmlPath, null);
+ }
+
+}
Added: trunk/server/src/main/org/jboss/deployment/JBossEjbObjectFactory.java
===================================================================
--- trunk/server/src/main/org/jboss/deployment/JBossEjbObjectFactory.java 2006-11-06 05:28:20 UTC (rev 58145)
+++ trunk/server/src/main/org/jboss/deployment/JBossEjbObjectFactory.java 2006-11-06 05:30:29 UTC (rev 58146)
@@ -0,0 +1,238 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.deployment;
+
+import java.util.ArrayList;
+
+import org.jboss.logging.Logger;
+import org.jboss.metadata.ApplicationMetaData;
+import org.jboss.metadata.BeanMetaData;
+import org.jboss.metadata.DDObjectFactory;
+import org.jboss.metadata.InvokerProxyBindingMetaData;
+import org.jboss.metadata.MessageDestinationMetaData;
+import org.jboss.metadata.SecurityRoleMetaData;
+import org.jboss.xb.binding.UnmarshallingContext;
+import org.xml.sax.Attributes;
+
+/**
+ * ObjectFactory for translating jboss.xml into ApplicationMetaData instance
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public class JBossEjbObjectFactory extends DDObjectFactory
+{
+ private static Logger log = Logger.getLogger(JBossEjbObjectFactory.class);
+ private ApplicationMetaData appMetaData;
+
+ static class EnterpriseBeans
+ {
+ }
+ static class BeanHolder
+ {
+ String ejbName;
+ BeanMetaData metaData;
+ }
+
+ public JBossEjbObjectFactory(ApplicationMetaData dd)
+ {
+ super();
+ this.appMetaData = dd;
+ }
+
+ /**
+ * Return the root.
+ */
+ public Object newRoot(Object root, UnmarshallingContext navigator,
+ String namespaceURI, String localName, Attributes attrs)
+ {
+ // If both the root and metaData are null the deployer is likely in the wrong order
+ if( root == null && appMetaData == null )
+ throw new IllegalStateException("No existing ApplicationMetaData, check the JBossEjbObjectFactory order");
+
+ return root == null ? appMetaData : root;
+ }
+
+ public Object completeRoot(Object root, UnmarshallingContext ctx,
+ String uri, String name)
+ {
+ return root;
+ }
+
+ /**
+ * Called when parsing of a new element started.
+ */
+ public Object newChild(ApplicationMetaData dd, UnmarshallingContext navigator,
+ String namespaceURI, String localName, Attributes attrs)
+ {
+ Object child = null;
+ log.debug("newChild, "+localName);
+ if ((child = newEnvRefGroupChild(localName)) != null)
+ return child;
+ else if (localName.equals("security-role"))
+ child = new SecurityRoleMetaData();
+ // TODO
+ else if (localName.equals("message-destination"))
+ {
+ child = new MessageDestinationMetaData();
+ }
+ else if(localName.equals("invoker-proxy-bindings"))
+ {
+ child = new ArrayList<InvokerProxyBindingMetaData>();
+ }
+ else if(localName.equals("container-configurations"))
+ {
+ // TODO
+ }
+ else if(localName.equals("webservices"))
+ {
+ // TODO
+ }
+ else if(localName.equals("enterprise-beans"))
+ {
+ child = new EnterpriseBeans();
+ }
+ return child;
+ }
+
+ public Object newChild(EnterpriseBeans beans, UnmarshallingContext navigator,
+ String namespaceURI, String localName, Attributes attrs)
+ {
+ Object child = null;
+ if (localName.equals("entity") || localName.equals("session") || localName.equals("message-driven") )
+ child = new BeanHolder();
+ return child;
+ }
+ public Object newChild(BeanHolder bean, UnmarshallingContext navigator,
+ String namespaceURI, String localName, Attributes attrs)
+ {
+ Object child = null;
+ if ((child = newEnvRefGroupChild(localName)) != null)
+ {
+ // TODO: how is being associated with the bean metadata
+ return child;
+ }
+
+ return child;
+ }
+
+ public Object newChild(ArrayList<InvokerProxyBindingMetaData> bindings, UnmarshallingContext navigator,
+ String namespaceURI, String localName, Attributes attrs)
+ {
+ Object child = null;
+ if (localName.equals("invoker-proxy-binding"))
+ child = new InvokerProxyBindingMetaData();
+ // TODO
+ else if (localName.equals("message-destination"))
+ {
+ child = new MessageDestinationMetaData();
+ }
+ else if(localName.equals("invoker-proxy-bindings"))
+ {
+ child = new ArrayList<InvokerProxyBindingMetaData>();
+ }
+
+ return child;
+ }
+
+ public Object newChild(InvokerProxyBindingMetaData md, UnmarshallingContext navigator,
+ String namespaceURI, String localName, Attributes attrs)
+ {
+ Object child = null;
+ if (localName.equals("proxy-factory-config"))
+ child = null; // TODO
+ return child;
+ }
+
+ public void addChild(ApplicationMetaData parent, ArrayList<InvokerProxyBindingMetaData> bindings,
+ UnmarshallingContext navigator, String namespaceURI, String localName)
+ {
+ for(InvokerProxyBindingMetaData md : bindings)
+ {
+ parent.addInvokerProxyBinding(md);
+ }
+ }
+
+ public void setValue(ApplicationMetaData amd,
+ UnmarshallingContext navigator, String namespaceURI, String localName,
+ String value)
+ {
+ if (localName.equals("jmx-name"))
+ {
+ amd.setJmxName(value);
+ }
+ else if(localName.equals("exception-on-rollback"))
+ {
+ boolean flag = Boolean.valueOf(value);
+ amd.setExceptionRollback(flag);
+ }
+ else if(localName.equals("security-domain"))
+ {
+ amd.setSecurityDomain(value);
+ }
+ else if(localName.equals("unauthenticated-principal"))
+ {
+ amd.setUnauthenticatedPrincipal(value);
+ }
+
+ }
+
+ public void setValue(InvokerProxyBindingMetaData md,
+ UnmarshallingContext navigator, String namespaceURI, String localName,
+ String value)
+ {
+ if (localName.equals("invoker-mbean"))
+ {
+ md.setInvokerMBean(value);
+ }
+ else if (localName.equals("proxy-factory"))
+ {
+ md.setProxyFactory(value);
+ }
+ }
+
+ public void setValue(BeanHolder bean,
+ UnmarshallingContext navigator, String namespaceURI, String localName,
+ String value)
+ {
+ if( localName.equals("ejb-name") )
+ {
+ bean.ejbName = value;
+ // Lookup the metadata
+ bean.metaData = appMetaData.getBeanByEjbName(value);
+ }
+ else if( localName.equals("jndi-name") )
+ {
+ bean.metaData.setJndiName(value);
+ }
+ else if( localName.equals("local-jndi-name") )
+ {
+ bean.metaData.setLocalJndiName(value);
+ }
+ else if( localName.equals("call-by-value") )
+ {
+ boolean flag = Boolean.valueOf(value);
+ bean.metaData.setCallByValue(flag);
+ }
+
+ }
+}
Added: trunk/server/src/main/org/jboss/deployment/JBossEjbParsingDeployer.java
===================================================================
--- trunk/server/src/main/org/jboss/deployment/JBossEjbParsingDeployer.java 2006-11-06 05:28:20 UTC (rev 58145)
+++ trunk/server/src/main/org/jboss/deployment/JBossEjbParsingDeployer.java 2006-11-06 05:30:29 UTC (rev 58146)
@@ -0,0 +1,103 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.deployment;
+
+import org.jboss.deployers.plugins.deployers.helpers.ObjectModelFactoryDeployer;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentUnit;
+import org.jboss.metadata.ApplicationMetaData;
+import org.jboss.metadata.WebMetaData;
+import org.jboss.metadata.web.JBossWebMetaDataObjectFactory;
+import org.jboss.xb.binding.ObjectModelFactory;
+
+/**
+ * An ObjectModelFactoryDeployer for translating jboss-web.xml descriptors into
+ * WebMetaData instances.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public class JBossEjbParsingDeployer extends ObjectModelFactoryDeployer<ApplicationMetaData>
+{
+ private String jbossXmlPath = "jboss.xml";
+
+ public JBossEjbParsingDeployer()
+ {
+ super(ApplicationMetaData.class);
+ setRelativeOrder(PARSER_DEPLOYER+1);
+ }
+
+ /**
+ * Get the virtual file path for the jboss-web descriptor in the
+ * DeploymentContext.getMetaDataPath.
+ *
+ * @return the current virtual file path for the web-app descriptor
+ */
+ public String getWebXmlPath()
+ {
+ return jbossXmlPath;
+ }
+ /**
+ * Set the virtual file path for the jboss-web descriptor in the
+ * DeploymentContext.getMetaDataLocation. The standard path is jboss-web.xml
+ * to be found in the WEB-INF metdata path.
+ *
+ * @param jbossXmlPath - new virtual file path for the web-app descriptor
+ */
+ public void setWebXmlPath(String jbossXmlPath)
+ {
+ this.jbossXmlPath = jbossXmlPath;
+ }
+
+ /**
+ * Overriden to indicate we expect to run the parse even if an existing
+ * WebMetaData attachment is found.
+ * @return true.
+ */
+ @Override
+ protected boolean allowsReparse()
+ {
+ return true;
+ }
+
+ /**
+ * Return JBossWebMetaDataObjectFactory as our ObjectModelFactory.
+ * @return a new JBossWebMetaDataObjectFactory instance
+ */
+ @Override
+ protected ObjectModelFactory getObjectModelFactory(ApplicationMetaData root)
+ {
+ return new JBossEjbObjectFactory(root);
+ }
+
+ /**
+ * Overriden to invoke createMetaData(unit, jbossXmlPath, null) to parse any
+ * jbossXmlPath descriptor into a ApplicationMetaData instance.
+ */
+ @Override
+ public void deploy(DeploymentUnit unit) throws DeploymentException
+ {
+ log.debug("deploy, unit: "+unit);
+ createMetaData(unit, jbossXmlPath, null);
+ }
+
+}
Modified: trunk/server/src/main/org/jboss/ejb/Container.java
===================================================================
--- trunk/server/src/main/org/jboss/ejb/Container.java 2006-11-06 05:28:20 UTC (rev 58145)
+++ trunk/server/src/main/org/jboss/ejb/Container.java 2006-11-06 05:30:29 UTC (rev 58146)
@@ -53,6 +53,7 @@
import javax.transaction.TransactionManager;
import javax.xml.soap.SOAPMessage;
+import org.jboss.deployers.spi.deployer.DeploymentUnit;
import org.jboss.deployment.DeploymentException;
import org.jboss.deployment.DeploymentInfo;
import org.jboss.ejb.plugins.local.BaseLocalProxyFactory;
@@ -146,7 +147,7 @@
/**
* Externally supplied configuration data
*/
- private DeploymentInfo di;
+ private DeploymentUnit di;
/**
* This is the new metadata. it includes information from both ejb-jar and
@@ -397,21 +398,28 @@
/**
* Gets the DeploymentInfo for this Container
- *
+ * @deprecated use DeploymentUnit accessors
* @return The DeploymentInfo for this Container
*/
public final DeploymentInfo getDeploymentInfo()
{
- return di;
+ return null;
}
-
/**
* Sets the DeploymentInfo of this Container
- *
+ * @deprecated use DeploymentUnit accessors
* @param di The new DeploymentInfo to be used
*/
public final void setDeploymentInfo(DeploymentInfo di)
{
+ }
+
+ public final DeploymentUnit getDeploymentUnit()
+ {
+ return di;
+ }
+ public final void setDeploymentUnit(DeploymentUnit di)
+ {
this.di = di;
}
Modified: trunk/server/src/main/org/jboss/ejb/EjbModule.java
===================================================================
--- trunk/server/src/main/org/jboss/ejb/EjbModule.java 2006-11-06 05:28:20 UTC (rev 58145)
+++ trunk/server/src/main/org/jboss/ejb/EjbModule.java 2006-11-06 05:30:29 UTC (rev 58146)
@@ -25,6 +25,7 @@
import java.lang.reflect.Method;
import java.net.URL;
import java.net.URLClassLoader;
+import java.security.Policy;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -47,6 +48,8 @@
import javax.security.jacc.EJBRoleRefPermission;
import javax.transaction.TransactionManager;
+import org.jboss.deployers.spi.deployer.DeploymentUnit;
+import org.jboss.deployers.spi.structure.DeploymentContext;
import org.jboss.deployment.DeploymentException;
import org.jboss.deployment.DeploymentInfo;
import org.jboss.deployment.EARDeployerMBean;
@@ -62,6 +65,7 @@
import org.jboss.metadata.MethodMetaData;
import org.jboss.metadata.SecurityRoleRefMetaData;
import org.jboss.mx.loading.RepositoryClassLoader;
+import org.jboss.ejb.deployers.EjbDeployer;
import org.jboss.ejb.plugins.SecurityProxyInterceptor;
import org.jboss.ejb.plugins.StatefulSessionInstancePool;
import org.jboss.security.AuthenticationManager;
@@ -76,6 +80,7 @@
import org.jboss.mx.util.MBeanProxyExt;
import org.jboss.mx.util.ObjectNameFactory;
import org.jboss.util.loading.DelegatingClassLoader;
+import org.jboss.virtual.VirtualFile;
import org.jboss.web.WebClassLoader;
import org.jboss.web.WebServiceMBean;
import org.jboss.invocation.InvocationType;
@@ -145,7 +150,7 @@
/** Name of this deployment unit, url it was deployed from */
final String name;
- private DeploymentInfo deploymentInfo;
+ private DeploymentUnit deploymentUnit;
private ServiceControllerMBean serviceController;
@@ -158,21 +163,45 @@
/** Whether we are call by value */
private boolean callByValue;
-
-
- public EjbModule(final DeploymentInfo di, TransactionManager tm,
- ObjectName webServiceName)
+ private ApplicationMetaData appMetaData;
+
+ public EjbModule(final DeploymentUnit unit, ApplicationMetaData metaData)
{
- this.deploymentInfo = di;
- String name = deploymentInfo.url.toString();
+ this.appMetaData = metaData;
+ this.deploymentUnit = unit;
+ String name = deploymentUnit.getName();
if (name.endsWith("/"))
{
name = name.substring(0, name.length() - 1);
}
this.name = name;
+ }
+ /**
+ * @deprecated DeploymentInfo is obsolete
+ */
+ public EjbModule(final DeploymentInfo di, TransactionManager tm,
+ ObjectName webServiceName)
+ {
+ this.name = "deprecated";
+ }
+
+
+ public TransactionManager getTxMgr()
+ {
+ return tm;
+ }
+ public void setTxMgr(TransactionManager tm)
+ {
this.tm = tm;
- this.webServiceName = webServiceName;
}
+ public ObjectName getWebServiceName()
+ {
+ return webServiceName;
+ }
+ public void setWebServiceName(ObjectName webServiceName)
+ {
+ this.webServiceName = webServiceName;
+ }
public Map getModuleDataMap()
{
@@ -299,7 +328,7 @@
*/
public URL getURL()
{
- return deploymentInfo.url;
+ return appMetaData.getUrl();
}
// Service implementation ----------------------------------------
@@ -338,31 +367,33 @@
//Set up the beans in this module.
try
{
- ApplicationMetaData appMetaData = (ApplicationMetaData) deploymentInfo.metaData;
Iterator beans = appMetaData.getEnterpriseBeans();
- String contextID = deploymentInfo.shortName;
+ String contextID = appMetaData.getJaccContextID();
+ if( contextID == null )
+ contextID = EjbDeployer.shortNameFromDeploymentName(deploymentUnit.getName());
+ appMetaData.setJaccContextID(contextID);
PolicyConfigurationFactory pcFactory = PolicyConfigurationFactory.getPolicyConfigurationFactory();
PolicyConfiguration pc = pcFactory.getPolicyConfiguration(contextID, true);
while (beans.hasNext())
{
BeanMetaData bean = (BeanMetaData) beans.next();
log.info("Deploying " + bean.getEjbName());
- Container con = createContainer(bean, deploymentInfo);
- con.setDeploymentInfo(deploymentInfo);
+ Container con = createContainer(bean, deploymentUnit);
+ con.setDeploymentUnit(deploymentUnit);
addContainer(con);
//@todo support overriding the context id via metadata is needed
con.setJaccContextID(contextID);
// Register the permissions with the JACC layer
createPermissions(bean, pc);
- deploymentInfo.context.put("javax.security.jacc.PolicyConfiguration", pc);
+ deploymentUnit.addAttachment(PolicyConfiguration.class, pc);
// Link this to the parent PC
- DeploymentInfo current = deploymentInfo;
- while( current.parent != null )
- current = current.parent;
- PolicyConfiguration parentPC = (PolicyConfiguration)
- current.context.get("javax.security.jacc.PolicyConfiguration");
- if( parentPC != null && parentPC != pc )
- parentPC.linkConfiguration(pc);
+ DeploymentContext current = deploymentUnit.getDeploymentContext();
+ while (current.getParent() != null)
+ current = current.getParent();
+ PolicyConfiguration parentPC =
+ current.getTransientAttachments().getAttachment(PolicyConfiguration.class);
+ if (parentPC != null && parentPC != pc)
+ parentPC.linkConfiguration(pc);
}
pc.commit();
@@ -379,7 +410,7 @@
of the deployment can be tracked.
*/
server.registerMBean(con, jmxName);
- deploymentInfo.mbeans.add(jmxName);
+ //deploymentUnit.mbeans.add(jmxName);
BeanMetaData metaData = con.getBeanMetaData();
Collection depends = metaData.getDepends();
serviceController.create(jmxName, depends);
@@ -393,14 +424,14 @@
String securityDomain = Util.unprefixSecurityDomain(appMetaData.getSecurityDomain());
if(securityDomain == null)
securityDomain = SecurityConstants.DEFAULT_EJB_APPLICATION_POLICY; //Fallback
- URL xacmlURL = deploymentInfo.localCl.findResource("META-INF/jboss-xacml-policy.xml");
- if(xacmlURL != null)
+ VirtualFile xacmlFile = deploymentUnit.getMetaDataFile("jboss-xacml-policy.xml");
+ if(xacmlFile != null)
{
AuthorizationManager authzmgr = Util.getAuthorizationManager(securityDomain);
if(authzmgr instanceof PolicyRegistration)
{
PolicyRegistration xam = (PolicyRegistration)authzmgr;
- xam.registerPolicy(contextID,xacmlURL);
+ xam.registerPolicy(contextID, xacmlFile.toURL());
}
}
}
@@ -488,15 +519,14 @@
(WebServiceMBean) MBeanProxyExt.create(WebServiceMBean.class,
webServiceName);
}
- ApplicationMetaData metaData = (ApplicationMetaData) deploymentInfo.metaData;
ListIterator iter = containerOrdering.listIterator(containerOrdering.size());
// Unegister the permissions with the JACC layer
- String contextID = deploymentInfo.shortName;
+ String contextID = appMetaData.getJaccContextID();
PolicyConfigurationFactory pcFactory = PolicyConfigurationFactory.getPolicyConfigurationFactory();
PolicyConfiguration pc = pcFactory.getPolicyConfiguration(contextID, true);
pc.delete();
//Unregister any xacml policies
- String securityDomain = Util.unprefixSecurityDomain(metaData.getSecurityDomain());
+ String securityDomain = Util.unprefixSecurityDomain(appMetaData.getSecurityDomain());
if(securityDomain != null)
{
AuthorizationManager authzmgr = Util.getAuthorizationManager(securityDomain);
@@ -583,39 +613,39 @@
// Container Creation
// ******************
- private Container createContainer(BeanMetaData bean, DeploymentInfo sdi)
+ private Container createContainer(BeanMetaData bean, DeploymentUnit unit)
throws Exception
{
- ClassLoader cl = sdi.ucl;
- ClassLoader localCl = sdi.localCl;
+ ClassLoader cl = unit.getClassLoader();
+ VirtualFile root = unit.getDeploymentContext().getRoot();
Container container = null;
// Added message driven deployment
if (bean.isMessageDriven())
{
- container = createMessageDrivenContainer(bean, cl, localCl);
+ container = createMessageDrivenContainer(bean, cl, root);
}
else if (bean.isSession()) // Is session?
{
if (((SessionMetaData) bean).isStateless()) // Is stateless?
{
- container = createStatelessSessionContainer((SessionMetaData) bean, cl, localCl);
+ container = createStatelessSessionContainer((SessionMetaData) bean, cl, root);
}
else // Stateful
{
- container = createStatefulSessionContainer((SessionMetaData) bean, cl, localCl);
+ container = createStatefulSessionContainer((SessionMetaData) bean, cl, root);
}
}
else // Entity
{
- container = createEntityContainer(bean, cl, localCl);
+ container = createEntityContainer(bean, cl, root);
}
return container;
}
private MessageDrivenContainer createMessageDrivenContainer(BeanMetaData bean,
ClassLoader cl,
- ClassLoader localCl)
+ VirtualFile root)
throws Exception
{
// get the container configuration for this bean
@@ -626,7 +656,7 @@
MessageDrivenContainer container = new MessageDrivenContainer();
int transType = bean.isContainerManagedTx() ? CMT : BMT;
- initializeContainer(container, conf, bean, transType, cl, localCl);
+ initializeContainer(container, conf, bean, transType, cl, root);
createProxyFactories(bean, container, cl);
container.setInstancePool(createInstancePool(conf, cl));
@@ -635,7 +665,7 @@
private StatelessSessionContainer createStatelessSessionContainer(SessionMetaData bean,
ClassLoader cl,
- ClassLoader localCl)
+ VirtualFile root)
throws Exception
{
// get the container configuration for this bean
@@ -644,7 +674,7 @@
// Create container
StatelessSessionContainer container = new StatelessSessionContainer();
int transType = bean.isContainerManagedTx() ? CMT : BMT;
- initializeContainer(container, conf, bean, transType, cl, localCl);
+ initializeContainer(container, conf, bean, transType, cl, root);
if (bean.getHome() != null || bean.getServiceEndpoint()!=null)
{
createProxyFactories(bean, container, cl);
@@ -656,7 +686,7 @@
private StatefulSessionContainer createStatefulSessionContainer(SessionMetaData bean,
ClassLoader cl,
- ClassLoader localCl)
+ VirtualFile root)
throws Exception
{
// get the container configuration for this bean
@@ -665,7 +695,7 @@
// Create container
StatefulSessionContainer container = new StatefulSessionContainer();
int transType = bean.isContainerManagedTx() ? CMT : BMT;
- initializeContainer(container, conf, bean, transType, cl, localCl);
+ initializeContainer(container, conf, bean, transType, cl, root);
if (bean.getHome() != null || bean.getServiceEndpoint()!=null)
{
createProxyFactories(bean, container, cl);
@@ -685,7 +715,7 @@
private EntityContainer createEntityContainer(BeanMetaData bean,
ClassLoader cl,
- ClassLoader localCl)
+ VirtualFile root)
throws Exception
{
// get the container configuration for this bean
@@ -694,7 +724,7 @@
// Create container
EntityContainer container = new EntityContainer();
int transType = CMT;
- initializeContainer(container, conf, bean, transType, cl, localCl);
+ initializeContainer(container, conf, bean, transType, cl, root);
if (bean.getHome() != null)
{
createProxyFactories(bean, container, cl);
@@ -742,12 +772,13 @@
BeanMetaData bean,
int transType,
ClassLoader cl,
- ClassLoader localCl)
+ VirtualFile root)
throws NamingException, DeploymentException
{
// Create local classloader for this container
// For loading resources that must come from the local jar. Not for loading classes!
- container.setLocalClassLoader(new URLClassLoader(new URL[0], localCl));
+ // The VFS should be used for this
+ // container.setLocalClassLoader(new URLClassLoader(new URL[0], localCl));
// Set metadata (do it *before* creating the container's WebClassLoader)
container.setEjbModule(this);
container.setBeanMetaData(bean);
Modified: trunk/server/src/main/org/jboss/ejb/EjbUtil.java
===================================================================
--- trunk/server/src/main/org/jboss/ejb/EjbUtil.java 2006-11-06 05:28:20 UTC (rev 58145)
+++ trunk/server/src/main/org/jboss/ejb/EjbUtil.java 2006-11-06 05:30:29 UTC (rev 58146)
@@ -29,6 +29,8 @@
import javax.management.MBeanServer;
+import org.jboss.deployers.spi.deployer.DeploymentUnit;
+import org.jboss.deployers.spi.structure.DeploymentContext;
import org.jboss.deployment.DeploymentInfo;
import org.jboss.deployment.MainDeployerMBean;
import org.jboss.logging.Logger;
@@ -64,6 +66,10 @@
{
return resolveLink(server, di, link, false);
}
+ public static String findEjbLink(MBeanServer server, DeploymentUnit unit, String link)
+ {
+ return resolveLink(server, unit, link, false);
+ }
/**
* Resolves an <ejb-link> target for an <ejb-local-ref> entry
@@ -79,6 +85,10 @@
{
return resolveLink(server, di, link, true);
}
+ public static String findLocalEjbLink(MBeanServer server, DeploymentUnit unit, String link)
+ {
+ return resolveLink(server, unit, link, true);
+ }
/**
* Resolves a <message-destination> target for a <message-destination-link>
@@ -94,6 +104,10 @@
{
return resolveMessageDestination(server, di, link);
}
+ public static MessageDestinationMetaData findMessageDestination(MBeanServer server, DeploymentUnit unit, String link)
+ {
+ return resolveMessageDestination(server, unit, link);
+ }
private static String resolveLink(MBeanServer server, DeploymentInfo di, String link, boolean isLocal)
{
@@ -130,7 +144,42 @@
return resolveAbsoluteLink(top, link, isLocal);
}
}
+ private static String resolveLink(MBeanServer server, DeploymentUnit unit, String link, boolean isLocal)
+ {
+ if (link == null)
+ {
+ return null;
+ }
+ if (log.isTraceEnabled())
+ {
+ log.trace("resolveLink( {" + unit + "}, {" + link + "}, {" + isLocal + "}");
+ }
+
+ if (unit == null)
+ {
+ // We should throw an IllegalArgumentException here probably?
+ return null;
+ }
+
+ if (link.indexOf('#') != -1)
+ {
+ // <ejb-link> is specified in the form path/file.jar#Bean
+ return resolveRelativeLink(server, unit, link, isLocal);
+ }
+ else
+ {
+ // <ejb-link> contains a Bean Name, scan the DeploymentInfo tree
+ DeploymentContext top = unit.getDeploymentContext();
+ while (top != null)
+ {
+ top = top.getParent();
+ }
+
+ return resolveAbsoluteLink(top, link, isLocal);
+ }
+ }
+
private static String resolveRelativeLink(MBeanServer server, DeploymentInfo di, String link, boolean isLocal)
{
@@ -320,7 +369,34 @@
return resolveAbsoluteMessageDestination(top, link);
}
}
+ private static MessageDestinationMetaData resolveMessageDestination(MBeanServer server, DeploymentUnit unit, String link)
+ {
+ if (link == null)
+ return null;
+ if (log.isTraceEnabled())
+ log.trace("resolveLink( {" + unit + "}, {" + link + "})");
+
+ if (unit == null)
+ // We should throw an IllegalArgumentException here probably?
+ return null;
+
+ if (link.indexOf('#') != -1)
+ // link is specified in the form path/file.jar#Bean
+ return resolveRelativeMessageDestination(server, unit, link);
+ else
+ {
+ // link contains a Bean Name, scan the DeploymentInfo tree
+ DeploymentContext top = unit.getDeploymentContext();
+ while (top != null)
+ {
+ top = top.getParent();
+ }
+
+ return resolveAbsoluteMessageDestination(top.getDeploymentUnit(), link);
+ }
+ }
+
private static MessageDestinationMetaData resolveRelativeMessageDestination(MBeanServer server, DeploymentInfo di, String link)
{
String path = link.substring(0, link.indexOf('#'));
@@ -401,7 +477,87 @@
return null;
}
}
+ private static MessageDestinationMetaData resolveRelativeMessageDestination(MBeanServer server, DeploymentUnit unit, String link)
+ {
+ String path = link.substring(0, link.indexOf('#'));
+ String destinationName = link.substring(link.indexOf('#') + 1);
+ String us = unit.getName();
+ // Remove the trailing slash for unpacked deployments
+ if (us.charAt(us.length() - 1) == '/')
+ us = us.substring(0, us.length() - 1);
+
+ String ourPath = us.substring(0, us.lastIndexOf('/'));
+
+ if (log.isTraceEnabled())
+ {
+ log.trace("Resolving relative message-destination-link: " + link);
+ log.trace("Looking for: '" + link + "', we're located at: '" + ourPath + "'");
+ }
+
+ for (StringTokenizer st = new StringTokenizer(path, "/"); st.hasMoreTokens();)
+ {
+ String s = st.nextToken();
+ if (s.equals(".."))
+ ourPath = ourPath.substring(0, ourPath.lastIndexOf('/'));
+ else
+ ourPath += "/" + s;
+ }
+
+ URL target = null;
+ try
+ {
+ target = Strings.toURL(ourPath);
+ }
+ catch (MalformedURLException mue)
+ {
+ log.warn("Can't construct URL for: " + ourPath);
+ return null;
+ }
+
+ DeploymentInfo targetInfo = null;
+ try
+ {
+ targetInfo = (DeploymentInfo) server.invoke
+ (
+ MainDeployerMBean.OBJECT_NAME,
+ "getDeployment",
+ new Object[] {target},
+ new String[] {URL.class.getName()}
+ );
+ }
+ catch (Exception e)
+ {
+ log.warn("Got Exception when looking for DeploymentInfo: " + e);
+ return null;
+ }
+
+ if (targetInfo == null)
+ {
+ log.warn("Can't locate deploymentInfo for target: " + target);
+ return null;
+ }
+
+ if (log.isTraceEnabled())
+ log.trace("Found appropriate DeploymentInfo: " + targetInfo);
+
+ if (targetInfo.metaData instanceof ApplicationMetaData)
+ {
+ ApplicationMetaData appMD = (ApplicationMetaData) targetInfo.metaData;
+ return appMD.getMessageDestination(destinationName);
+ }
+ else if (targetInfo.metaData instanceof WebMetaData)
+ {
+ WebMetaData webMD = (WebMetaData) targetInfo.metaData;
+ return webMD.getMessageDestination(destinationName);
+ }
+ else
+ {
+ log.warn("DeploymentInfo " + targetInfo + " is not an EJB .jar " + "file!");
+ return null;
+ }
+ }
+
private static MessageDestinationMetaData resolveAbsoluteMessageDestination(DeploymentInfo di, String link)
{
if (log.isTraceEnabled())
@@ -434,4 +590,178 @@
// Not found
return null;
}
+ private static MessageDestinationMetaData resolveAbsoluteMessageDestination(DeploymentUnit unit, String link)
+ {
+ if (log.isTraceEnabled())
+ log.trace("Resolving absolute link, unit: " + unit);
+
+ // Search current DeploymentInfo
+ ApplicationMetaData appMD = unit.getAttachment(ApplicationMetaData.class);
+ if (appMD != null)
+ {
+ MessageDestinationMetaData mdMD = appMD.getMessageDestination(link);
+ if (mdMD != null)
+ return mdMD;
+ }
+ WebMetaData webMD = unit.getAttachment(WebMetaData.class);
+ if( webMD != null )
+ {
+ return webMD.getMessageDestination(link);
+ }
+
+ // Search each subcontext
+ Iterator<DeploymentContext> it = unit.getDeploymentContext().getChildren().iterator();
+ while (it.hasNext())
+ {
+ DeploymentContext child = it.next();
+ MessageDestinationMetaData mdMD = resolveAbsoluteMessageDestination(child.getDeploymentUnit(), link);
+ if (mdMD != null)
+ return mdMD;
+ }
+
+ // Not found
+ return null;
+ }
+
+ private static String resolveRelativeLink(MBeanServer server, DeploymentUnit unit, String link, boolean isLocal)
+ {
+
+ String path = link.substring(0, link.indexOf('#'));
+ String ejbName = link.substring(link.indexOf('#') + 1);
+ String us = unit.getName();
+
+ // Remove the trailing slash for unpacked deployments
+ if (us.charAt(us.length() - 1) == '/')
+ us = us.substring(0, us.length() - 1);
+
+ String ourPath = us.substring(0, us.lastIndexOf('/'));
+
+ if (log.isTraceEnabled())
+ {
+ log.trace("Resolving relative link: " + link);
+ log.trace("Looking for: '" + link + "', we're located at: '" + ourPath + "'");
+ }
+
+ for (StringTokenizer st = new StringTokenizer(path, "/"); st.hasMoreTokens();)
+ {
+ String s = st.nextToken();
+ if (s.equals(".."))
+ {
+ ourPath = ourPath.substring(0, ourPath.lastIndexOf('/'));
+ }
+ else
+ {
+ ourPath += "/" + s;
+ }
+ }
+
+ URL target = null;
+
+ try
+ {
+ target = Strings.toURL(ourPath);
+ }
+ catch (MalformedURLException mue)
+ {
+ log.warn("Can't construct URL for: " + ourPath);
+ return null;
+ }
+
+ DeploymentInfo targetInfo = null;
+ try
+ {
+ targetInfo = (DeploymentInfo) server.invoke(MainDeployerMBean.OBJECT_NAME, "getDeployment", new Object[]
+ {target}, new String[]
+ {URL.class.getName()});
+ }
+ catch (Exception e)
+ {
+ log.warn("Got Exception when looking for DeploymentInfo: " + e);
+ return null;
+ }
+
+ if (targetInfo == null)
+ {
+ log.warn("Can't locate deploymentInfo for target: " + target);
+ return null;
+ }
+
+ if (log.isTraceEnabled())
+ {
+ log.trace("Found appropriate DeploymentInfo: " + targetInfo);
+ }
+
+ String linkTarget = null;
+ if (targetInfo.metaData instanceof ApplicationMetaData)
+ {
+ ApplicationMetaData appMD = (ApplicationMetaData) targetInfo.metaData;
+ BeanMetaData beanMD = appMD.getBeanByEjbName(ejbName);
+
+ if (beanMD != null)
+ {
+ linkTarget = getJndiName(beanMD, isLocal);
+ }
+ else
+ {
+ log.warn("No Bean named '" + ejbName + "' found in '" + path + "'!");
+ }
+ }
+ else
+ {
+ log.warn("DeploymentInfo " + targetInfo + " is not an EJB .jar " + "file!");
+ }
+
+ return linkTarget;
+ }
+
+ private static String resolveAbsoluteLink(DeploymentContext ctx, String link, boolean isLocal)
+ {
+ if (log.isTraceEnabled())
+ {
+ log.trace("Resolving absolute link, ctx: " + ctx);
+ }
+
+ String ejbName = null;
+
+ // Search current DeploymentInfo
+ ApplicationMetaData appMD = ctx.getTransientAttachments().getAttachment(ApplicationMetaData.class);
+ if (appMD != null)
+ {
+ // Look in the ejb module for a match
+ BeanMetaData beanMD = appMD.getBeanByEjbName(link);
+ if (beanMD != null)
+ {
+ ejbName = getJndiName(beanMD, isLocal);
+ if (log.isTraceEnabled())
+ {
+ log.trace("Found Bean: " + beanMD + ", resolves to: " + ejbName);
+ }
+
+ return ejbName;
+ }
+ else if (log.isTraceEnabled())
+ {
+ // Dump the ejb module ejbNames
+ log.trace("No match for ejb-link: " + link+", module names:");
+ Iterator iter = appMD.getEnterpriseBeans();
+ while (iter.hasNext())
+ {
+ beanMD = (BeanMetaData) iter.next();
+ String beanEjbName = getJndiName(beanMD, isLocal);
+ log.trace("... ejbName: " + beanEjbName);
+ }
+ }
+ }
+
+ // Search each subcontext
+ Iterator it = ctx.getChildren().iterator();
+ while (it.hasNext() && ejbName == null)
+ {
+ DeploymentInfo child = (DeploymentInfo) it.next();
+ ejbName = resolveAbsoluteLink(child, link, isLocal);
+ }
+
+ return ejbName;
+ }
+
}
\ No newline at end of file
Added: trunk/server/src/main/org/jboss/ejb/deployers/EjbDeployer.java
===================================================================
--- trunk/server/src/main/org/jboss/ejb/deployers/EjbDeployer.java 2006-11-06 05:28:20 UTC (rev 58145)
+++ trunk/server/src/main/org/jboss/ejb/deployers/EjbDeployer.java 2006-11-06 05:30:29 UTC (rev 58146)
@@ -0,0 +1,180 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb.deployers;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+
+import org.jboss.deployers.plugins.deployers.helpers.AbstractSimpleRealDeployer;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentUnit;
+import org.jboss.ejb.EjbModule;
+import org.jboss.metadata.ApplicationMetaData;
+import org.jboss.mx.util.ObjectNameConverter;
+import org.jboss.system.metadata.ServiceAttributeMetaData;
+import org.jboss.system.metadata.ServiceConstructorMetaData;
+import org.jboss.system.metadata.ServiceDependencyValueMetaData;
+import org.jboss.system.metadata.ServiceMetaData;
+
+/**
+ * A real deployer that translates ApplicationMetaData into ServiceMetaData for
+ * the ejb module service mbeans.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public class EjbDeployer extends AbstractSimpleRealDeployer<ApplicationMetaData>
+{
+ private String transactionManagerServiceName;
+ private String webServiceName;
+
+ /**
+ * A utility method that takes a deployment unit name and strips it down to the base war
+ * name without the .war suffix.
+ * @param name - the DeploymentUnit name.
+ */
+ public static String shortNameFromDeploymentName(String name)
+ {
+ String shortName = name;
+ String[] parts = name.split("/|\\.");
+ if( parts.length > 1 )
+ {
+ // If it ends in .war, use the previous part
+ if( parts[parts.length-1].equals("war") )
+ shortName = parts[parts.length-2];
+ // else use the last part
+ else
+ shortName = parts[parts.length-1];
+ }
+ return shortName;
+ }
+
+ public EjbDeployer(Class<ApplicationMetaData> deploymentType)
+ {
+ super(deploymentType);
+ }
+
+ public String getTransactionManagerServiceName()
+ {
+ return transactionManagerServiceName;
+ }
+
+ public void setTransactionManagerServiceName(
+ String transactionManagerServiceName)
+ {
+ this.transactionManagerServiceName = transactionManagerServiceName;
+ }
+
+ public String getWebServiceName()
+ {
+ return webServiceName;
+ }
+
+ public void setWebServiceName(String webServiceName)
+ {
+ this.webServiceName = webServiceName;
+ }
+
+ @Override
+ public void deploy(DeploymentUnit unit, ApplicationMetaData deployment)
+ throws DeploymentException
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void undeploy(DeploymentUnit unit, ApplicationMetaData deployment)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /**
+ * Get the object name of the ServiceMetaData instance associated with
+ * the WebMetaData. This uses the pattern:
+ * "jboss.web.deployment:war="+metaData.getContextRoot()
+ *
+ * @param metaData - the web app metaData
+ * @return "jboss.web.deployment:war="+metaData.getContextRoot();
+ * @throws MalformedObjectNameException
+ */
+ protected ObjectName getObjectName(DeploymentUnit unit, ApplicationMetaData metaData)
+ throws MalformedObjectNameException
+ {
+ String name = metaData.getJmxName();
+ if( name == null )
+ {
+ name = EjbModule.BASE_EJB_MODULE_NAME + ",module="
+ + shortNameFromDeploymentName(unit.getName());
+ }
+
+ // Build an escaped JMX name including deployment shortname
+ ObjectName ejbModuleName = ObjectNameConverter.convert(name);
+ return ejbModuleName;
+ }
+
+ protected void deployEjbModule(DeploymentUnit unit, ApplicationMetaData metaData)
+ throws Exception
+ {
+ log.debug("deployWebModule");
+ try
+ {
+ ServiceMetaData ejbModule = new ServiceMetaData();
+ ObjectName objectName = getObjectName(unit, metaData);
+ ejbModule.setObjectName(objectName);
+ ejbModule.setCode(EjbModule.class.getName());
+ // EjbModule(DeploymentUnit)
+ ServiceConstructorMetaData constructor = new ServiceConstructorMetaData();
+ constructor.setSignature(new String[] { DeploymentUnit.class.getName()});
+ constructor.setParameters(new Object[] {unit, this, metaData});
+ ejbModule.setConstructor(constructor);
+
+ List<ServiceAttributeMetaData> attributes = new ArrayList<ServiceAttributeMetaData>();
+ // Add injection of the TM
+ ServiceAttributeMetaData tm = new ServiceAttributeMetaData();
+ tm.setName("txMgr");
+ String tmProxyType = "javax.transaction.TransactionManager";
+ ServiceDependencyValueMetaData tmDepends = new ServiceDependencyValueMetaData(transactionManagerServiceName, tmProxyType);
+ tm.setValue(tmDepends);
+ attributes.add(tm);
+ // Add injection of the WebServiceName
+ ServiceAttributeMetaData ws = new ServiceAttributeMetaData();
+ ws.setName("webServiceName");
+ ServiceDependencyValueMetaData wsDepends = new ServiceDependencyValueMetaData();
+ wsDepends.setDependency(webServiceName);
+ attributes.add(ws);
+ ejbModule.setAttributes(attributes);
+
+ // TODO could create multiple components for the deployment
+ unit.addAttachment(ServiceMetaData.class, ejbModule);
+ }
+ catch (Exception e)
+ {
+ throw DeploymentException.rethrowAsDeploymentException("Error creating rar deployment " + unit.getName(), e);
+ }
+
+ }
+}
Modified: trunk/server/src/main/org/jboss/metadata/ApplicationMetaData.java
===================================================================
--- trunk/server/src/main/org/jboss/metadata/ApplicationMetaData.java 2006-11-06 05:28:20 UTC (rev 58145)
+++ trunk/server/src/main/org/jboss/metadata/ApplicationMetaData.java 2006-11-06 05:30:29 UTC (rev 58146)
@@ -53,6 +53,8 @@
{
public static final int EJB_1x = 1;
public static final int EJB_2x = 2;
+ private String description;
+ private String displayName;
/** The ejb jar URL */
private URL url;
/** version of the dtd used to create ejb-jar.xml */
@@ -68,8 +70,9 @@
private String configName;
/** The optional JBossWS config-file */
private String configFile;
+ private String clientJar;
/** List<RelationMetaData> of relations in this application. */
- private ArrayList relationships = new ArrayList();
+ private ArrayList<RelationMetaData> relationships = new ArrayList<RelationMetaData>();
/** The assembly-descriptor */
private AssemblyDescriptorMetaData assemblyDescriptor = new AssemblyDescriptorMetaData();
/** A HashMap<String, ConfigurationMetaData> for container configs */
@@ -93,7 +96,10 @@
private boolean excludeMissingMethods = true;
/** Whether to throw an exception on a rollback if there is no exception */
private boolean exceptionRollback = false;
+ /** The JACC context id for the container */
+ private String jaccContextID;
+
/** The ClassLoader to load additional resources */
private URLClassLoader resourceCl;
@@ -113,6 +119,26 @@
this.resourceCl = resourceCl;
}
+ public String getDescription()
+ {
+ return description;
+ }
+
+ public void setDescription(String description)
+ {
+ this.description = description;
+ }
+
+ public String getDisplayName()
+ {
+ return displayName;
+ }
+
+ public void setDisplayName(String displayName)
+ {
+ this.displayName = displayName;
+ }
+
public URL getUrl()
{
return url;
@@ -138,6 +164,26 @@
return ejbVersion == 2 && ejbMinorVersion == 1;
}
+ public int getEjbMinorVersion()
+ {
+ return ejbMinorVersion;
+ }
+
+ public void setEjbMinorVersion(int ejbMinorVersion)
+ {
+ this.ejbMinorVersion = ejbMinorVersion;
+ }
+
+ public int getEjbVersion()
+ {
+ return ejbVersion;
+ }
+
+ public void setEjbVersion(int ejbVersion)
+ {
+ this.ejbVersion = ejbVersion;
+ }
+
public Iterator getEnterpriseBeans()
{
return beans.iterator();
@@ -187,6 +233,16 @@
this.configName = configName;
}
+ public String getClientJar()
+ {
+ return clientJar;
+ }
+
+ public void setClientJar(String clientJar)
+ {
+ this.clientJar = clientJar;
+ }
+
public HashMap getWsdlPublishLocations()
{
return wsdlPublishLocationMap;
@@ -218,6 +274,10 @@
this.webServiceDeployment = webServiceDeployment;
}
+ public void addRelationship(RelationMetaData rmd)
+ {
+ relationships.add(rmd);
+ }
/**
* Get the container managed relations in this application.
* Items are instance of RelationMetaData.
@@ -242,6 +302,10 @@
return (ConfigurationMetaData)configurations.get(name);
}
+ public void addInvokerProxyBinding(InvokerProxyBindingMetaData md)
+ {
+ invokerBindings.put(md.getName(), md);
+ }
public Iterator getInvokerProxyBindings()
{
return invokerBindings.values().iterator();
@@ -272,7 +336,20 @@
{
return jmxName;
}
+ public void setJmxName(String name)
+ {
+ this.jmxName = name;
+ }
+ public String getJaccContextID()
+ {
+ return jaccContextID;
+ }
+ public void setJaccContextID(String jaccContextID)
+ {
+ this.jaccContextID = jaccContextID;
+ }
+
public String getSecurityDomain()
{
return securityDomain;
@@ -315,6 +392,10 @@
{
return exceptionRollback;
}
+ public void setExceptionRollback(boolean flag)
+ {
+ this.exceptionRollback = flag;
+ }
public void addBeanMetaData(BeanMetaData metaData)
{
Modified: trunk/server/src/main/org/jboss/metadata/BeanMetaData.java
===================================================================
--- trunk/server/src/main/org/jboss/metadata/BeanMetaData.java 2006-11-06 05:28:20 UTC (rev 58145)
+++ trunk/server/src/main/org/jboss/metadata/BeanMetaData.java 2006-11-06 05:30:29 UTC (rev 58146)
@@ -72,6 +72,8 @@
private ApplicationMetaData application;
// from ejb-jar.xml
+ private String description;
+ private String displayName;
/** The ejb-name element specifies an enterprise bean's name. This name is
assigned by the ejb-jar file producer to name the enterprise bean in
the ejb-jar file's deployment descriptor. The name must be unique
@@ -181,6 +183,26 @@
this.beanType = beanType;
}
+ public String getDescription()
+ {
+ return description;
+ }
+
+ public void setDescription(String description)
+ {
+ this.description = description;
+ }
+
+ public String getDisplayName()
+ {
+ return displayName;
+ }
+
+ public void setDisplayName(String displayName)
+ {
+ this.displayName = displayName;
+ }
+
public boolean isSession()
{
return beanType == SESSION_TYPE;
@@ -752,6 +774,246 @@
return timerPersistence;
}
+ public ApplicationMetaData getApplication()
+ {
+ return application;
+ }
+
+ public void setApplication(ApplicationMetaData application)
+ {
+ this.application = application;
+ }
+
+ public ClusterConfigMetaData getClusterConfig()
+ {
+ return clusterConfig;
+ }
+
+ public void setClusterConfig(ClusterConfigMetaData clusterConfig)
+ {
+ this.clusterConfig = clusterConfig;
+ }
+
+ public ConfigurationMetaData getConfiguration()
+ {
+ return configuration;
+ }
+
+ public void setConfiguration(ConfigurationMetaData configuration)
+ {
+ this.configuration = configuration;
+ }
+
+ public String getHomeClass()
+ {
+ return homeClass;
+ }
+
+ public void setHomeClass(String homeClass)
+ {
+ this.homeClass = homeClass;
+ }
+
+ public IorSecurityConfigMetaData getIorSecurityConfig()
+ {
+ return iorSecurityConfig;
+ }
+
+ public void setIorSecurityConfig(IorSecurityConfigMetaData iorSecurityConfig)
+ {
+ this.iorSecurityConfig = iorSecurityConfig;
+ }
+
+ public String getLocalClass()
+ {
+ return localClass;
+ }
+
+ public void setLocalClass(String localClass)
+ {
+ this.localClass = localClass;
+ }
+
+ public String getLocalHomeClass()
+ {
+ return localHomeClass;
+ }
+
+ public void setLocalHomeClass(String localHomeClass)
+ {
+ this.localHomeClass = localHomeClass;
+ }
+
+ public ArrayList getMethodAttributes()
+ {
+ return methodAttributes;
+ }
+
+ public void setMethodAttributes(ArrayList methodAttributes)
+ {
+ this.methodAttributes = methodAttributes;
+ }
+
+ public ConcurrentReaderHashMap getMethodTx()
+ {
+ return methodTx;
+ }
+
+ public void setMethodTx(ConcurrentReaderHashMap methodTx)
+ {
+ this.methodTx = methodTx;
+ }
+
+ public String getRemoteClass()
+ {
+ return remoteClass;
+ }
+
+ public void setRemoteClass(String remoteClass)
+ {
+ this.remoteClass = remoteClass;
+ }
+
+ public SecurityIdentityMetaData getSecurityIdentity()
+ {
+ return securityIdentity;
+ }
+
+ public void setSecurityIdentity(SecurityIdentityMetaData securityIdentity)
+ {
+ this.securityIdentity = securityIdentity;
+ }
+
+ public String getServiceEndpointClass()
+ {
+ return serviceEndpointClass;
+ }
+
+ public void setServiceEndpointClass(String serviceEndpointClass)
+ {
+ this.serviceEndpointClass = serviceEndpointClass;
+ }
+
+ public void setCallByValue(boolean callByValue)
+ {
+ this.callByValue = callByValue;
+ }
+
+ public void setClustered(boolean clustered)
+ {
+ this.clustered = clustered;
+ }
+
+ public void setConfigurationName(String configurationName)
+ {
+ this.configurationName = configurationName;
+ }
+
+ public void setContainerManagedTx(boolean containerManagedTx)
+ {
+ this.containerManagedTx = containerManagedTx;
+ }
+
+ public void setDepends(Collection depends)
+ {
+ this.depends = depends;
+ }
+
+ public void setEjbClass(String ejbClass)
+ {
+ this.ejbClass = ejbClass;
+ }
+
+ public void setEjbLocalReferences(HashMap ejbLocalReferences)
+ {
+ this.ejbLocalReferences = ejbLocalReferences;
+ }
+
+ public void setEjbReferences(HashMap ejbReferences)
+ {
+ this.ejbReferences = ejbReferences;
+ }
+
+ public void setEjbTimeoutIdentity(SecurityIdentityMetaData ejbTimeoutIdentity)
+ {
+ this.ejbTimeoutIdentity = ejbTimeoutIdentity;
+ }
+
+ public void setEnvironmentEntries(ArrayList environmentEntries)
+ {
+ this.environmentEntries = environmentEntries;
+ }
+
+ public void setExceptionRollback(boolean exceptionRollback)
+ {
+ this.exceptionRollback = exceptionRollback;
+ }
+
+ public void setExcludedMethods(ArrayList excludedMethods)
+ {
+ this.excludedMethods = excludedMethods;
+ }
+
+ public void setInvokerBindings(HashMap invokerBindings)
+ {
+ this.invokerBindings = invokerBindings;
+ }
+
+ public void setJndiName(String jndiName)
+ {
+ this.jndiName = jndiName;
+ }
+
+ public void setLocalJndiName(String localJndiName)
+ {
+ this.localJndiName = localJndiName;
+ }
+
+ public void setMessageDestinationReferences(HashMap messageDestinationReferences)
+ {
+ this.messageDestinationReferences = messageDestinationReferences;
+ }
+
+ public void setPermissionMethods(ArrayList permissionMethods)
+ {
+ this.permissionMethods = permissionMethods;
+ }
+
+ public void setResourceEnvReferences(HashMap resourceEnvReferences)
+ {
+ this.resourceEnvReferences = resourceEnvReferences;
+ }
+
+ public void setResourceReferences(HashMap resourceReferences)
+ {
+ this.resourceReferences = resourceReferences;
+ }
+
+ public void setSecurityProxy(String securityProxy)
+ {
+ this.securityProxy = securityProxy;
+ }
+
+ public void setSecurityRoleReferences(ArrayList securityRoleReferences)
+ {
+ this.securityRoleReferences = securityRoleReferences;
+ }
+
+ public void setServiceReferences(HashMap serviceReferences)
+ {
+ this.serviceReferences = serviceReferences;
+ }
+
+ public void setTimerPersistence(boolean timerPersistence)
+ {
+ this.timerPersistence = timerPersistence;
+ }
+
+ public void setTransactionMethods(ArrayList transactionMethods)
+ {
+ this.transactionMethods = transactionMethods;
+ }
+
/** Called to parse the ejb-jar.xml enterprise-beans child ejb elements
* @param element one of session/entity/message-driven
* @throws DeploymentException
Modified: trunk/server/src/main/org/jboss/metadata/EntityMetaData.java
===================================================================
--- trunk/server/src/main/org/jboss/metadata/EntityMetaData.java 2006-11-06 05:28:20 UTC (rev 58145)
+++ trunk/server/src/main/org/jboss/metadata/EntityMetaData.java 2006-11-06 05:30:29 UTC (rev 58146)
@@ -64,9 +64,9 @@
private boolean reentrant;
private int cmpVersion;
private String abstractSchemaName;
- private ArrayList cmpFields = new ArrayList();
+ private ArrayList<String> cmpFields = new ArrayList<String>();
private String primKeyField;
- private ArrayList queries = new ArrayList();
+ private ArrayList<QueryMetaData> queries = new ArrayList<QueryMetaData>();
private boolean readOnly = false;
private boolean doDistCachInvalidations = false;
private CacheInvalidationConfigMetaData cacheInvalidConfig = null;
@@ -101,26 +101,108 @@
return !cmp;
}
+
+ public String getAbstractSchemaName()
+ {
+ return abstractSchemaName;
+ }
+
+ public void setAbstractSchemaName(String abstractSchemaName)
+ {
+ this.abstractSchemaName = abstractSchemaName;
+ }
+
+ public CacheInvalidationConfigMetaData getCacheInvalidConfig()
+ {
+ return cacheInvalidConfig;
+ }
+
+ public void setCacheInvalidConfig(
+ CacheInvalidationConfigMetaData cacheInvalidConfig)
+ {
+ this.cacheInvalidConfig = cacheInvalidConfig;
+ }
+
+ public boolean isCmp()
+ {
+ return cmp;
+ }
+
+ public void setCmp(boolean cmp)
+ {
+ this.cmp = cmp;
+ }
+
+ public ArrayList<String> getCmpFields()
+ {
+ return cmpFields;
+ }
+
+ public void setCmpFields(ArrayList<String> cmpFields)
+ {
+ this.cmpFields = cmpFields;
+ }
+
+ public int getCmpVersion()
+ {
+ return cmpVersion;
+ }
+
+ public void setCmpVersion(int cmpVersion)
+ {
+ this.cmpVersion = cmpVersion;
+ }
+
+ public boolean isDoDistCachInvalidations()
+ {
+ return doDistCachInvalidations;
+ }
+
+ public void setDoDistCachInvalidations(boolean doDistCachInvalidations)
+ {
+ this.doDistCachInvalidations = doDistCachInvalidations;
+ }
+
public String getPrimaryKeyClass()
{
return primaryKeyClass;
}
+ public void setPrimaryKeyClass(String primaryKeyClass)
+ {
+ this.primaryKeyClass = primaryKeyClass;
+ }
+
+ public boolean isReadOnly()
+ {
+ return readOnly;
+ }
+
+ public void setReadOnly(boolean readOnly)
+ {
+ this.readOnly = readOnly;
+ }
+
public boolean isReentrant()
{
return reentrant;
}
- public String getAbstractSchemaName()
+ public void setReentrant(boolean reentrant)
{
- return abstractSchemaName;
+ this.reentrant = reentrant;
}
- public boolean isReadOnly()
+ public void setPrimKeyField(String primKeyField)
{
- return readOnly;
+ this.primKeyField = primKeyField;
}
+ public void setQueries(ArrayList queries)
+ {
+ this.queries = queries;
+ }
+
/**
* Gets the container managed fields.
* @returns iterator over Strings containing names of the fields
Modified: trunk/server/src/main/org/jboss/metadata/InvokerProxyBindingMetaData.java
===================================================================
--- trunk/server/src/main/org/jboss/metadata/InvokerProxyBindingMetaData.java 2006-11-06 05:28:20 UTC (rev 58145)
+++ trunk/server/src/main/org/jboss/metadata/InvokerProxyBindingMetaData.java 2006-11-06 05:30:29 UTC (rev 58146)
@@ -50,6 +50,9 @@
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
+ public InvokerProxyBindingMetaData()
+ {
+ }
public InvokerProxyBindingMetaData(String name)
{
this.name = name;
@@ -62,12 +65,20 @@
{
return name;
}
+ public void setName(String name)
+ {
+ this.name = name;
+ }
/** Get the detached invoker MBean service name associated with the proxy */
public String getInvokerMBean()
{
return mbean;
}
+ public void setInvokerMBean(String mbean)
+ {
+ this.mbean = mbean;
+ }
/** Get the class name of the org.jboss.ejb.EJBProxyFactory implementation
* used to create proxies for this configuration
@@ -76,6 +87,10 @@
{
return proxyFactory;
}
+ public void setProxyFactory(String factory)
+ {
+ this.proxyFactory = factory;
+ }
/** An arbitary configuration to pass to the EJBProxyFactory implementation
*/
Modified: trunk/server/src/main/org/jboss/metadata/RelationMetaData.java
===================================================================
--- trunk/server/src/main/org/jboss/metadata/RelationMetaData.java 2006-11-06 05:28:20 UTC (rev 58145)
+++ trunk/server/src/main/org/jboss/metadata/RelationMetaData.java 2006-11-06 05:30:29 UTC (rev 58146)
@@ -1,24 +1,24 @@
/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
package org.jboss.metadata;
import java.util.Iterator;
@@ -26,69 +26,116 @@
import org.w3c.dom.Element;
import org.jboss.deployment.DeploymentException;
-/**
- * Represents one ejb-relation element found in the ejb-jar.xml
- * file's relationships elements.
- *
+/**
+ * Represents one ejb-relation element found in the ejb-jar.xml file's
+ * relationships elements.
+ *
* @author <a href="mailto:dain at daingroup.com">Dain Sundstrom</a>
+ * @author Scott.Stark at jboss.org
* @version $Revision$
*/
-public class RelationMetaData extends MetaData {
+public class RelationMetaData extends MetaData
+{
+ private String description;
+ private String displayName;
/** Name of the relation. Loaded from the ejb-relation-name element. */
private String relationName;
-
- /**
+
+ /**
* The left relationship role. Loaded from an ejb-relationship-role.
* Left/right assignment is completely arbitrary.
*/
private RelationshipRoleMetaData left;
- /**
+ /**
* The right relationship role. Loaded from an ejb-relationship-role.
* Left/right assignment is completely arbitrary.
*/
- private RelationshipRoleMetaData right;
-
- /**
- * Gets the relation name.
- * Relation name is loaded from the ejb-relation-name element.
+ private RelationshipRoleMetaData right;
+
+ public String getDescription()
+ {
+ return description;
+ }
+
+ public void setDescription(String description)
+ {
+ this.description = description;
+ }
+
+ public String getDisplayName()
+ {
+ return displayName;
+ }
+
+ public void setDisplayName(String displayName)
+ {
+ this.displayName = displayName;
+ }
+
+ /**
+ * Gets the relation name. Relation name is loaded from the ejb-relation-name
+ * element.
*/
- public String getRelationName() {
+ public String getRelationName()
+ {
return relationName;
}
-
- /**
- * Gets the left relationship role.
- * The relationship role is loaded from an ejb-relationship-role.
- * Left/right assignment is completely arbitrary.
+
+ public void setRelationName(String name)
+ {
+ relationName = name;
+ if( relationName != null && relationName.length() == 0 )
+ relationName = null;
+ }
+
+ /**
+ * Gets the left relationship role. The relationship role is loaded from an
+ * ejb-relationship-role. Left/right assignment is completely arbitrary.
*/
- public RelationshipRoleMetaData getLeftRelationshipRole() {
+ public RelationshipRoleMetaData getLeftRelationshipRole()
+ {
return left;
}
-
- /**
- * Gets the right relationship role.
- * The relationship role is loaded from an ejb-relationship-role.
- * Left/right assignment is completely arbitrary.
+
+ public void setLeftRelationshipRole(RelationshipRoleMetaData left)
+ {
+ this.left = left;
+ }
+
+ /**
+ * Gets the right relationship role. The relationship role is loaded from an
+ * ejb-relationship-role. Left/right assignment is completely arbitrary.
*/
- public RelationshipRoleMetaData getRightRelationshipRole() {
+ public RelationshipRoleMetaData getRightRelationshipRole()
+ {
return right;
}
-
- public RelationshipRoleMetaData getOtherRelationshipRole(
- RelationshipRoleMetaData role) {
- if(left == role) {
+ public void setRightRelationshipRole(RelationshipRoleMetaData left)
+ {
+ this.left = left;
+ }
+
+ public RelationshipRoleMetaData getOtherRelationshipRole(RelationshipRoleMetaData role)
+ {
+ if (left == role)
+ {
return right;
- } else if(right == role) {
+ }
+ else if (right == role)
+ {
return left;
- } else {
- throw new IllegalArgumentException("Specified role is not the left " +
- "or right role. role=" + role);
}
+ else
+ {
+ throw new IllegalArgumentException("Specified role is not the left "
+ + "or right role. role=" + role);
+ }
}
- public void importEjbJarXml (Element element) throws DeploymentException {
+ public void importEjbJarXml(Element element) throws DeploymentException
+ {
// name - treating empty values as not specified
relationName = getOptionalChildContent(element, "ejb-relation-name");
if ("".equals(relationName))
@@ -98,60 +145,71 @@
// left role
Iterator iter = getChildrenByTagName(element, "ejb-relationship-role");
- if(iter.hasNext()) {
+ if (iter.hasNext())
+ {
left = new RelationshipRoleMetaData(this);
left.importEjbJarXml((Element) iter.next());
- } else {
- throw new DeploymentException("Expected 2 ejb-relationship-role " +
- "roles but found none");
+ } else
+ {
+ throw new DeploymentException("Expected 2 ejb-relationship-role "
+ + "roles but found none");
}
-
+
// right role
- if(iter.hasNext()) {
+ if (iter.hasNext())
+ {
right = new RelationshipRoleMetaData(this);
right.importEjbJarXml((Element) iter.next());
- } else {
- throw new DeploymentException("Expected 2 ejb-relationship-role " +
- "but only found one");
+ } else
+ {
+ throw new DeploymentException("Expected 2 ejb-relationship-role "
+ + "but only found one");
}
// assure there are only two ejb-relationship-role elements
- if(iter.hasNext()) {
- throw new DeploymentException("Expected only 2 ejb-relationship-" +
- "role but found more then 2");
+ if (iter.hasNext())
+ {
+ throw new DeploymentException("Expected only 2 ejb-relationship-"
+ + "role but found more then 2");
}
- // JBossCMP needs ejb-relation-name if jbosscmp-jdbc.xml is used to map relationships.
- if(relationName == null)
+ // JBossCMP needs ejb-relation-name if jbosscmp-jdbc.xml is used to map
+ // relationships.
+ if (relationName == null)
{
- // generate unique name, we can't rely on ejb-relationship-role-name being unique
- relationName =
- left.getEntityName() +
- (left.getCMRFieldName() == null ? "" : "_" + left.getCMRFieldName()) +
- "-" +
- right.getEntityName() +
- (right.getCMRFieldName() == null ? "" : "_" + right.getCMRFieldName());
+ // generate unique name, we can't rely on ejb-relationship-role-name
+ // being unique
+ relationName = left.getEntityName()
+ + (left.getCMRFieldName() == null ? "" : "_"
+ + left.getCMRFieldName())
+ + "-"
+ + right.getEntityName()
+ + (right.getCMRFieldName() == null ? "" : "_"
+ + right.getCMRFieldName());
}
// assure that the left role and right role do not have the same name
String leftName = left.getRelationshipRoleName();
String rightName = right.getRelationshipRoleName();
- if(leftName != null && leftName.equals(rightName)) {
- throw new DeploymentException("ejb-relationship-role-name must be " +
- "unique in ejb-relation: ejb-relationship-role-name is " +
- leftName);
+ if (leftName != null && leftName.equals(rightName))
+ {
+ throw new DeploymentException("ejb-relationship-role-name must be "
+ + "unique in ejb-relation: ejb-relationship-role-name is "
+ + leftName);
}
-
+
// verify cascade delete
- if(left.isCascadeDelete() && right.isMultiplicityMany()) {
- throw new DeploymentException("cascade-delete is only allowed in " +
- "ejb-relationship-role where the other role has a " +
- "multiplicity One");
+ if (left.isCascadeDelete() && right.isMultiplicityMany())
+ {
+ throw new DeploymentException("cascade-delete is only allowed in "
+ + "ejb-relationship-role where the other role has a "
+ + "multiplicity One");
}
- if(right.isCascadeDelete() && left.isMultiplicityMany()) {
- throw new DeploymentException("cascade-delete is only allowed in " +
- "ejb-relationship-role where the other role has a " +
- "multiplicity One");
+ if (right.isCascadeDelete() && left.isMultiplicityMany())
+ {
+ throw new DeploymentException("cascade-delete is only allowed in "
+ + "ejb-relationship-role where the other role has a "
+ + "multiplicity One");
}
}
}
Modified: trunk/server/src/main/org/jboss/metadata/SecurityIdentityMetaData.java
===================================================================
--- trunk/server/src/main/org/jboss/metadata/SecurityIdentityMetaData.java 2006-11-06 05:28:20 UTC (rev 58145)
+++ trunk/server/src/main/org/jboss/metadata/SecurityIdentityMetaData.java 2006-11-06 05:30:29 UTC (rev 58146)
@@ -34,7 +34,7 @@
* <p/>
* Used in: session, entity, message-driven
*
- * @author <a href="mailto:Scott_Stark at displayscape.com">Scott Stark</a>.
+ * @author Scott.Stark at jboss.org
* @author <a href="mailto:Thomas.Diesler at jboss.org">Thomas Diesler</a>.
* @version $Revision$
*/
More information about the jboss-cvs-commits
mailing list