[jboss-cvs] JBossAS SVN: r66592 - in trunk/server/src/main/org/jboss/deployment: dependency and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Oct 30 23:52:19 EDT 2007
Author: scott.stark at jboss.org
Date: 2007-10-30 23:52:18 -0400 (Tue, 30 Oct 2007)
New Revision: 66592
Added:
trunk/server/src/main/org/jboss/deployment/ReferenceMetaDataResolverDeployer.java
trunk/server/src/main/org/jboss/deployment/dependency/
trunk/server/src/main/org/jboss/deployment/dependency/JndiDependencyItem.java
trunk/server/src/main/org/jboss/deployment/dependency/JndiDependencyMetaData.java
Log:
checkpoint resolving deployer
Added: trunk/server/src/main/org/jboss/deployment/ReferenceMetaDataResolverDeployer.java
===================================================================
--- trunk/server/src/main/org/jboss/deployment/ReferenceMetaDataResolverDeployer.java (rev 0)
+++ trunk/server/src/main/org/jboss/deployment/ReferenceMetaDataResolverDeployer.java 2007-10-31 03:52:18 UTC (rev 66592)
@@ -0,0 +1,482 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, 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.net.MalformedURLException;
+import java.net.URL;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.StringTokenizer;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.beans.metadata.plugins.AbstractDemandMetaData;
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.beans.metadata.spi.SupplyMetaData;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
+import org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer;
+import org.jboss.deployers.structure.spi.DeploymentContext;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.structure.spi.main.MainDeployerStructure;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.client.jboss.JBossClientMetaData;
+import org.jboss.metadata.ear.jboss.JBossAppMetaData;
+import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
+import org.jboss.metadata.ejb.jboss.JBossEntityBeanMetaData;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
+import org.jboss.metadata.javaee.spec.MessageDestinationMetaData;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+import org.jboss.system.metadata.ServiceDeployment;
+import org.jboss.system.metadata.ServiceMetaData;
+import org.jboss.util.Strings;
+
+/**
+ * A deployer which resolves references for parsing deployers
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class ReferenceMetaDataResolverDeployer
+ extends AbstractRealDeployer
+{
+ private static Logger log = Logger.getLogger(ReferenceMetaDataResolverDeployer.class);
+ private ConcurrentHashMap referenceMap = new ConcurrentHashMap<String, String>();
+
+ public ReferenceMetaDataResolverDeployer()
+ {
+ setStage(DeploymentStages.DESCRIBE);
+ HashSet<String> inputs = new HashSet<String>();
+ inputs.add(JBossAppMetaData.class.getName());
+ inputs.add(JBossClientMetaData.class.getName());
+ inputs.add(ServiceDeployment.class.getName());
+ inputs.add(JBossMetaData.class.getName());
+ inputs.add(JBossWebMetaData.class.getName());
+ super.setInputs(inputs);
+ }
+
+ public void deploy(DeploymentUnit unit) throws DeploymentException
+ {
+ JBossAppMetaData ear = unit.getAttachment(JBossAppMetaData.class);
+
+ }
+
+ public void undeploy(DeploymentUnit unit)
+ {
+ }
+
+ protected void resolve(JBossAppMetaData ear)
+ {
+ }
+ protected void resolve(ServiceDeployment sar)
+ {
+ }
+ protected void resolve(JBossClientMetaData car)
+ {
+ }
+ protected void resolve(JBossMetaData ejb)
+ {
+ }
+ protected void resolve(JBossWebMetaData war)
+ {
+ }
+
+ /**
+ * Resolves an <ejb-link> target for an <ejb-ref> entry and
+ * returns the name of the target in the JNDI tree.
+ *
+ * @param server the main deployer
+ * @param unit DeploymentUnit
+ * @param link Content of the <ejb-link> entry.
+ *
+ * @return The JNDI Entry of the target bean; <code>null</code> if
+ * no appropriate target could be found.
+ */
+ public static String findEjbLink(MainDeployerStructure server, DeploymentUnit unit, String link)
+ {
+ return resolveLink(server, unit, link, false);
+ }
+
+ /**
+ * Resolves an <ejb-link> target for an <ejb-local-ref> entry
+ * and returns the name of the target in the JNDI tree.
+ *
+ * @param server the main deployer
+ * @param unit DeploymentUnit
+ * @param link Content of the <ejb-link> entry.
+ *
+ * @return The JNDI Entry of the target bean; <code>null</code> if
+ * no appropriate target could be found.
+ */
+ public static String findLocalEjbLink(MainDeployerStructure server, DeploymentUnit unit, String link)
+ {
+ return resolveLink(server, unit, link, true);
+ }
+
+ /**
+ * Resolves a <message-destination> target for a <message-destination-link>
+ * entry and returns the name of the target in the JNDI tree.
+ *
+ * @param server the main deployer
+ * @param di DeploymentUnit
+ * @param link Content of the <message-driven-link> entry.
+ *
+ * @return The JNDI Entry of the target; <code>null</code> if
+ * no appropriate target could be found.
+ */
+ public static MessageDestinationMetaData findMessageDestination(MainDeployerStructure server, DeploymentUnit di, String link)
+ {
+ return resolveMessageDestination(server, di, link);
+ }
+
+ private static String resolveLink(MainDeployerStructure server, DeploymentUnit di, String link, boolean isLocal)
+ {
+ if (link == null)
+ {
+ return null;
+ }
+
+ if (log.isTraceEnabled())
+ {
+ log.trace("resolveLink( {" + di + "}, {" + link + "}, {" + isLocal + "}");
+ }
+
+ if (di == 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, di, link, isLocal);
+ }
+ else
+ {
+ // <ejb-link> contains a Bean Name, scan the DeploymentUnit tree
+ DeploymentUnit top = di.getTopLevel();
+ return resolveAbsoluteLink(top, link, isLocal);
+ }
+ }
+
+ private static String resolveRelativeLink(MainDeployerStructure 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;
+ }
+
+ DeploymentUnit targetUnit = null;
+ try
+ {
+ DeploymentContext ctx = server.getDeploymentContext(target.toString());
+ targetUnit = ctx.getDeploymentUnit();
+ }
+ catch (Exception e)
+ {
+ log.warn("Got Exception when looking for DeploymentUnit: " + e);
+ return null;
+ }
+
+ if (targetUnit == null)
+ {
+ log.warn("Can't locate DeploymentUnit for target: " + target);
+ return null;
+ }
+
+ if (log.isTraceEnabled())
+ {
+ log.trace("Found appropriate DeploymentUnit: " + targetUnit);
+ }
+
+ String linkTarget = null;
+ if (targetUnit.getAttachment(JBossMetaData.class) != null)
+ {
+ JBossMetaData appMD = targetUnit.getAttachment(JBossMetaData.class);
+ JBossEnterpriseBeanMetaData beanMD = appMD.getEnterpriseBean(ejbName);
+
+ if (beanMD != null)
+ {
+ linkTarget = getJndiName(beanMD, isLocal);
+ }
+ else
+ {
+ log.warn("No Bean named '" + ejbName + "' found in '" + path + "'!");
+ }
+ }
+ else
+ {
+ log.warn("DeploymentUnit " + targetUnit + " is not an EJB .jar " + "file!");
+ }
+
+ return linkTarget;
+ }
+
+ private static String resolveAbsoluteLink(DeploymentUnit unit, String link, boolean isLocal)
+ {
+ if (log.isTraceEnabled())
+ {
+ log.trace("Resolving absolute link, di: " + unit);
+ }
+
+ String ejbName = null;
+
+ // Search current DeploymentUnit
+ if (unit.getAttachment(JBossMetaData.class) != null)
+ {
+ JBossMetaData appMD = unit.getAttachment(JBossMetaData.class);
+ JBossEnterpriseBeanMetaData beanMD = appMD.getEnterpriseBean(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:");
+ for(JBossEnterpriseBeanMetaData md : appMD.getEnterpriseBeans())
+ {
+ String beanEjbName = getJndiName(md, isLocal);
+ log.trace("... ejbName: " + beanEjbName);
+ }
+ }
+ }
+ else if (unit.getAttachment("EJB_DEPLOYMENTS") != null)
+ {
+ log.debug("Saw EJB3 module, cannot resolve it");
+ }
+
+ // Search each subcontext
+ Iterator<DeploymentUnit> it = unit.getChildren().iterator();
+ while (it.hasNext() && ejbName == null)
+ {
+ DeploymentUnit child = it.next();
+ ejbName = resolveAbsoluteLink(child, link, isLocal);
+ }
+
+ return ejbName;
+ }
+
+ private static String getJndiName(JBossEnterpriseBeanMetaData beanMD, boolean isLocal)
+ {
+ String jndiName = null;
+ if (isLocal)
+ {
+ // Validate that there is a local home associated with this bean
+ jndiName = beanMD.determineLocalJndiName();
+ if (jndiName == null)
+ {
+ log.warn("LocalHome jndi name requested for: '" + beanMD.getEjbName() + "' but there is no LocalHome class");
+ }
+ }
+ else
+ {
+ if( beanMD.isEntity() )
+ {
+ JBossEntityBeanMetaData md = (JBossEntityBeanMetaData) beanMD;
+ jndiName = md.getJndiName();
+ }
+ else if( beanMD.isSession())
+ {
+ JBossSessionBeanMetaData md = (JBossSessionBeanMetaData) beanMD;
+ jndiName = md.getJndiName();
+ }
+ }
+ return jndiName;
+ }
+
+ private static MessageDestinationMetaData resolveMessageDestination(MainDeployerStructure server, DeploymentUnit di, String link)
+ {
+ if (link == null)
+ return null;
+
+ if (log.isTraceEnabled())
+ log.trace("resolveLink( {" + di + "}, {" + link + "})");
+
+ if (di == 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, di, link);
+ else
+ {
+ // link contains a Bean Name, scan the DeploymentUnit tree
+ DeploymentUnit top = di.getTopLevel();
+ return resolveAbsoluteMessageDestination(top, link);
+ }
+ }
+
+ private static MessageDestinationMetaData resolveRelativeMessageDestination(MainDeployerStructure 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;
+ }
+
+ DeploymentUnit targetUnit = null;
+ try
+ {
+ DeploymentContext ctx = server.getDeploymentContext(target.toString());
+ targetUnit = ctx.getDeploymentUnit();
+ }
+ catch (Exception e)
+ {
+ log.warn("Got Exception when looking for DeploymentUnit: " + e);
+ return null;
+ }
+
+ if (targetUnit == null)
+ {
+ log.warn("Can't locate DeploymentUnit for target: " + target);
+ return null;
+ }
+
+ if (log.isTraceEnabled())
+ log.trace("Found appropriate DeploymentUnit: " + targetUnit);
+
+ if (targetUnit.getAttachment(JBossMetaData.class) != null)
+ {
+ JBossMetaData appMD = targetUnit.getAttachment(JBossMetaData.class);
+ return appMD.getAssemblyDescriptor().getMessageDestination(destinationName);
+ }
+ if (targetUnit.getAttachment(JBossWebMetaData.class) != null)
+ {
+ JBossWebMetaData webMD = targetUnit.getAttachment(JBossWebMetaData.class);
+ return webMD.getMessageDestination(destinationName);
+ }
+ else
+ {
+ log.warn("DeploymentUnit " + targetUnit + " is not an EJB .jar " + "file!");
+ return null;
+ }
+ }
+
+ private static MessageDestinationMetaData resolveAbsoluteMessageDestination(DeploymentUnit unit, String link)
+ {
+ if (log.isTraceEnabled())
+ log.trace("Resolving absolute link, di: " + unit);
+
+ // Search current DeploymentUnit
+ if (unit.getAttachment(JBossMetaData.class) != null)
+ {
+ JBossMetaData appMD = unit.getAttachment(JBossMetaData.class);
+ MessageDestinationMetaData mdMD = appMD.getAssemblyDescriptor().getMessageDestination(link);
+ if (mdMD != null)
+ return mdMD;
+ }
+ if (unit.getAttachment(JBossWebMetaData.class) != null)
+ {
+ JBossWebMetaData webMD = unit.getAttachment(JBossWebMetaData.class);
+ return webMD.getMessageDestination(link);
+ }
+
+ // Search each subcontext
+ Iterator<DeploymentUnit> it = unit.getChildren().iterator();
+ while (it.hasNext())
+ {
+ DeploymentUnit child = it.next();
+ MessageDestinationMetaData mdMD = resolveAbsoluteMessageDestination(child, link);
+ if (mdMD != null)
+ return mdMD;
+ }
+
+ // Not found
+ return null;
+ }
+}
Property changes on: trunk/server/src/main/org/jboss/deployment/ReferenceMetaDataResolverDeployer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ native
Added: trunk/server/src/main/org/jboss/deployment/dependency/JndiDependencyItem.java
===================================================================
--- trunk/server/src/main/org/jboss/deployment/dependency/JndiDependencyItem.java (rev 0)
+++ trunk/server/src/main/org/jboss/deployment/dependency/JndiDependencyItem.java 2007-10-31 03:52:18 UTC (rev 66592)
@@ -0,0 +1,122 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, 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.dependency;
+
+import javax.naming.InitialContext;
+import javax.naming.NameNotFoundException;
+
+import org.jboss.dependency.plugins.AbstractDependencyItem;
+import org.jboss.dependency.spi.Controller;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.dependency.spi.DependencyItem;
+import org.jboss.logging.Logger;
+import org.jboss.util.JBossStringBuilder;
+
+/**
+ * Dependency on a jndi name
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class JndiDependencyItem extends AbstractDependencyItem
+ implements DependencyItem
+{
+ private static final Logger log = Logger.getLogger(JndiDependencyItem.class);
+
+ /** The demand jndi name */
+ private String jndiName;
+ /** The jndi name lookup value */
+ private Object demand;
+ /** The container class loader to use during lookup */
+ private ClassLoader loader;
+
+ /**
+ * Create a demand for a jndi name lookup using the given class loader.
+ *
+ * @param jndiName - the name to lookup
+ * @param loader - the ClassLoader to use as the TCL during lookup.
+ */
+ public JndiDependencyItem(String jndiName, ClassLoader loader,
+ ControllerState whenRequired)
+ {
+ super(jndiName, null, whenRequired, null);
+ this.jndiName = jndiName;
+ this.loader = loader;
+ }
+
+ public Object getDemand()
+ {
+ return demand;
+ }
+
+ @Override
+ public boolean resolve(Controller controller)
+ {
+ ClassLoader tcl = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ Thread.currentThread().setContextClassLoader(loader);
+ InitialContext ctx = new InitialContext();
+ demand = ctx.lookup(jndiName);
+ setResolved(true);
+ return isResolved();
+ }
+ catch(NameNotFoundException e)
+ {
+ // ignore
+ }
+ catch(Throwable ignored)
+ {
+ if (log.isTraceEnabled())
+ log.trace("Unexpected error", ignored);
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(tcl);
+ }
+ setResolved(false);
+ return isResolved();
+ }
+
+ @Override
+ public void toString(JBossStringBuilder buffer)
+ {
+ super.toString(buffer);
+ buffer.append(" depend=").append(jndiName);
+ }
+
+ @Override
+ public void toShortString(JBossStringBuilder buffer)
+ {
+ buffer.append(getName()).append(" depend ").append(jndiName);
+ }
+
+ @Override
+ public String toHumanReadableString()
+ {
+ StringBuilder builder = new StringBuilder();
+ builder.append("JndiDepends: '");
+ builder.append(jndiName);
+ builder.append("'");
+ return builder.toString();
+ }
+}
Property changes on: trunk/server/src/main/org/jboss/deployment/dependency/JndiDependencyItem.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ native
Added: trunk/server/src/main/org/jboss/deployment/dependency/JndiDependencyMetaData.java
===================================================================
--- trunk/server/src/main/org/jboss/deployment/dependency/JndiDependencyMetaData.java (rev 0)
+++ trunk/server/src/main/org/jboss/deployment/dependency/JndiDependencyMetaData.java 2007-10-31 03:52:18 UTC (rev 66592)
@@ -0,0 +1,107 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, 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.dependency;
+
+import java.util.Iterator;
+
+import org.jboss.beans.metadata.spi.DependencyMetaData;
+import org.jboss.beans.metadata.spi.MetaDataVisitor;
+import org.jboss.beans.metadata.spi.MetaDataVisitorNode;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.dependency.spi.DependencyItem;
+import org.jboss.kernel.spi.dependency.KernelControllerContext;
+import org.jboss.logging.Logger;
+import org.jboss.util.JBossObject;
+import org.jboss.util.JBossStringBuilder;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class JndiDependencyMetaData extends JBossObject
+ implements DependencyMetaData
+{
+ private static final long serialVersionUID = 1L;
+
+ private static final Logger log = Logger.getLogger(JndiDependencyMetaData.class);
+
+ /** The demand jndi name */
+ private String jndiName;
+ /** The jndi name lookup value */
+ private Object demand;
+ /** The container class loader to use during lookup */
+ private ClassLoader loader;
+ private ControllerState whenRequired = ControllerState.INSTALLED;
+
+ /**
+ * Create a demand for a jndi name lookup using the given class loader.
+ *
+ * @param jndiName - the name to lookup
+ * @param loader - the ClassLoader to use as the TCL during lookup.
+ */
+ public JndiDependencyMetaData(String jndiName, ClassLoader loader,
+ ControllerState whenRequired)
+ {
+ this.jndiName = jndiName;
+ this.loader = loader;
+ }
+
+ public Object getDependency()
+ {
+ return demand;
+ }
+
+ public ControllerState getWhenRequired()
+ {
+ return whenRequired;
+ }
+
+ public void describeVisit(MetaDataVisitor vistor)
+ {
+ vistor.describeVisit(this);
+ }
+
+ public Iterator<? extends MetaDataVisitorNode> getChildren()
+ {
+ return null;
+ }
+
+ public void initialVisit(MetaDataVisitor visitor)
+ {
+ KernelControllerContext context = visitor.getControllerContext();
+ DependencyItem item = new JndiDependencyItem(jndiName, loader, whenRequired);
+ visitor.addDependency(item);
+ visitor.initialVisit(this);
+ }
+
+ public String toShortString()
+ {
+ JBossStringBuilder buffer = new JBossStringBuilder();
+ toShortString(buffer);
+ return buffer.toString();
+ }
+
+ public void toShortString(JBossStringBuilder buffer)
+ {
+ buffer.append(jndiName);
+ }
+}
Property changes on: trunk/server/src/main/org/jboss/deployment/dependency/JndiDependencyMetaData.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ native
More information about the jboss-cvs-commits
mailing list