[jboss-cvs] JBossAS SVN: r72212 - trunk/server/src/main/org/jboss/deployment/dependency.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Apr 15 07:27:53 EDT 2008


Author: scott.stark at jboss.org
Date: 2008-04-15 07:27:52 -0400 (Tue, 15 Apr 2008)
New Revision: 72212

Added:
   trunk/server/src/main/org/jboss/deployment/dependency/ContainerDependencyItem.java
   trunk/server/src/main/org/jboss/deployment/dependency/ContainerDependencyMetaData.java
Modified:
   trunk/server/src/main/org/jboss/deployment/dependency/JndiDependencyMetaData.java
Log:
Update the resolver functionality

Copied: trunk/server/src/main/org/jboss/deployment/dependency/ContainerDependencyItem.java (from rev 72011, branches/InjectionPrototype/server/src/main/org/jboss/deployment/dependency/ContainerDependencyItem.java)
===================================================================
--- trunk/server/src/main/org/jboss/deployment/dependency/ContainerDependencyItem.java	                        (rev 0)
+++ trunk/server/src/main/org/jboss/deployment/dependency/ContainerDependencyItem.java	2008-04-15 11:27:52 UTC (rev 72212)
@@ -0,0 +1,81 @@
+/*
+ * 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 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.util.JBossStringBuilder;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public class ContainerDependencyItem extends AbstractDependencyItem
+   implements DependencyItem
+{
+   /**
+    * Create a dependency on a container.
+    * 
+    * @param containerName - the name of the target container the item depends on
+    * @param componentID - the 
+    * @param whenRequired
+    */
+   public ContainerDependencyItem(Object containerName,
+         String componentID, ControllerState whenRequired)
+   {
+      super(componentID, containerName, whenRequired, null);
+   }
+
+   @Override
+   public boolean resolve(Controller controller)
+   {
+      boolean resolved = super.resolve(controller);
+      setResolved(resolved);
+      return isResolved();
+   }
+
+   @Override
+   public void toString(JBossStringBuilder buffer)
+   {
+      super.toString(buffer);
+      buffer.append(" depend=").append(getName());
+   }
+   
+   @Override
+   public void toShortString(JBossStringBuilder buffer)
+   {
+      buffer.append(getName()).append(" depend ").append(getName());
+   }
+
+   @Override
+   public String toHumanReadableString()
+   {
+      StringBuilder builder = new StringBuilder();
+      builder.append("JndiDepends: '");
+      builder.append(getName());
+      builder.append("'");
+      return builder.toString();
+   }
+
+}

Copied: trunk/server/src/main/org/jboss/deployment/dependency/ContainerDependencyMetaData.java (from rev 72011, branches/InjectionPrototype/server/src/main/org/jboss/deployment/dependency/ContainerDependencyMetaData.java)
===================================================================
--- trunk/server/src/main/org/jboss/deployment/dependency/ContainerDependencyMetaData.java	                        (rev 0)
+++ trunk/server/src/main/org/jboss/deployment/dependency/ContainerDependencyMetaData.java	2008-04-15 11:27:52 UTC (rev 72212)
@@ -0,0 +1,188 @@
+/*
+ * 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.HashSet;
+import java.util.Set;
+
+import org.jboss.logging.Logger;
+import org.jboss.metadata.javaee.spec.ResourceInjectionTargetMetaData;
+import org.jboss.util.JBossObject;
+import org.jboss.util.JBossStringBuilder;
+
+/**
+ * Metadata for an endpoint container and its dependencies on other endpoints.
+ * 
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public class ContainerDependencyMetaData extends JBossObject
+{
+   private static final long serialVersionUID = 1L;
+
+   private static final Logger log = Logger
+         .getLogger(ContainerDependencyMetaData.class);
+
+   /** The unique name of the deployment root */
+   private String deploymentRootName;
+   /** The deployment relative path name */
+   private String deploymentPath;
+   /** The id of the component in the deployment */
+   private String componentName;
+
+   private Set<String> jndiNames = new HashSet<String>();
+
+   /** The jndi name of the container */
+   private String containerName;
+
+   /** The injection targets this bean container has */
+   private Set<ResourceInjectionTargetMetaData> targets = new HashSet<ResourceInjectionTargetMetaData>();
+   /** The jndi lookups this bean container has */
+   private Set<JndiDependencyMetaData> jndiDepends = new HashSet<JndiDependencyMetaData>();
+   /** The jndi names for other container this container depends on */
+   private Set<String> jndiAliasDepends = new HashSet<String>();
+
+
+   /**
+    * Create a demand for a container name
+    * 
+    * @param componentID -
+    *           the id of the component in the deployment
+    */
+   public ContainerDependencyMetaData(String containerName, String componentName, String deploymentPath)
+   {
+      this.containerName = containerName;
+      this.componentName = componentName;
+      this.deploymentPath = deploymentPath;
+   }
+
+   public String getComponentName()
+   {
+      return componentName;
+   }
+   public String getComponentID()
+   {
+      return deploymentPath + "#" + componentName;
+   }
+   public String getDeploymentPath()
+   {
+      return deploymentPath;
+   }
+
+   public String getDeploymentRootName()
+   {
+      return deploymentRootName;
+   }
+   public void setDeploymentRootName(String deploymentRootName)
+   {
+      this.deploymentRootName = deploymentRootName;
+   }
+
+   public String getContainerName()
+   {
+      return containerName;
+   }
+
+
+   public void addDependency(ContainerDependencyMetaData endpointCDMD)
+   {
+      jndiAliasDepends.add(endpointCDMD.getContainerName());
+   }
+
+   public void addInjectionTargets(Set<ResourceInjectionTargetMetaData> injectionTargets)
+   {
+      log.info("addInjectionTargets, " + injectionTargets);
+      this.targets.addAll(injectionTargets);
+   }
+
+   public Set<ResourceInjectionTargetMetaData> getInjectionTargets()
+   {
+      return this.targets;
+   }
+
+   public void addJndiDependency(JndiDependencyMetaData jdmd)
+   {
+      log.info("addJndiDependency, " + jdmd);
+      jndiDepends.add(jdmd);
+   }
+
+   public Set<JndiDependencyMetaData> getJndiDepends()
+   {
+      return this.jndiDepends;
+   }
+   public void addJndiName(String jndiName)
+   {
+      jndiNames.add(jndiName);      
+   }
+   public Set<String> getJndiNames()
+   {
+      return jndiNames;
+   }
+
+   public String toShortString()
+   {
+      JBossStringBuilder buffer = new JBossStringBuilder();
+      toShortString(buffer);
+      return buffer.toString();
+   }
+
+   public void toShortString(JBossStringBuilder buffer)
+   {
+      buffer.append(containerName);
+   }
+   @Override
+   protected int getHashCode()
+   {
+      // TODO Auto-generated method stub
+      return super.getHashCode();
+   }
+
+   @Override
+   protected String toStringImplementation()
+   {
+      StringBuilder tmp = new StringBuilder("ContainerDependencyMetaData(");
+      tmp.append("deploymentPath=");
+      tmp.append(deploymentPath);
+      tmp.append(",componentName=");
+      tmp.append(this.componentName);
+      tmp.append(",containerName=");
+      tmp.append(this.containerName);
+      tmp.append(",jndiNames=");
+      tmp.append(this.jndiNames);
+      tmp.append(",jndiAliasDepends=");
+      tmp.append(this.jndiAliasDepends);
+      tmp.append(",targets=");
+      tmp.append(this.targets);
+      tmp.append(",jndiDepends=");
+      tmp.append(this.jndiDepends);
+      tmp.append(")");
+      return tmp.toString();
+   }
+
+   @Override
+   public boolean equals(Object obj)
+   {
+      // TODO Auto-generated method stub
+      return super.equals(obj);
+   }
+
+}

Modified: trunk/server/src/main/org/jboss/deployment/dependency/JndiDependencyMetaData.java
===================================================================
--- trunk/server/src/main/org/jboss/deployment/dependency/JndiDependencyMetaData.java	2008-04-15 11:01:23 UTC (rev 72211)
+++ trunk/server/src/main/org/jboss/deployment/dependency/JndiDependencyMetaData.java	2008-04-15 11:27:52 UTC (rev 72212)
@@ -58,11 +58,16 @@
     * @param jndiName - the name to lookup
     * @param loader - the ClassLoader to use as the TCL during lookup.
     */
+   public JndiDependencyMetaData(String jndiName, ClassLoader loader)
+   {
+      this(jndiName, loader, ControllerState.INSTALLED);
+   }
    public JndiDependencyMetaData(String jndiName, ClassLoader loader,
          ControllerState whenRequired)
    {
       this.jndiName = jndiName;
       this.loader = loader;
+      this.whenRequired = whenRequired;
    }
 
    public Object getDependency()




More information about the jboss-cvs-commits mailing list