FileDocCategorySizeDatePackage
JBoss5DeploymentUnit.javaAPI DocJBoss 4.2.15942Fri Jul 13 20:53:48 BST 2007org.jboss.ejb3.deployers

JBoss5DeploymentUnit

public class JBoss5DeploymentUnit extends Object implements org.jboss.ejb3.DeploymentUnit
Comment
author
Bill Burke
version
$Revision: 43304 $

Fields Summary
private org.jboss.deployers.spi.deployer.DeploymentUnit
unit
private org.jboss.ejb3.interceptor.InterceptorInfoRepository
interceptorInfoRepository
private Map
defaultPersistenceProperties
Constructors Summary
public JBoss5DeploymentUnit(org.jboss.deployers.spi.deployer.DeploymentUnit unit)


     
   
      this.unit = unit;
   
Methods Summary
java.net.URLextractDescriptorUrl(java.lang.String resource)

      try
      {
         VirtualFile vf = unit.getMetaDataFile(resource);
         if (vf == null) return null;
         return vf.toURL();
      }
      catch (Exception e)
      {
         throw new RuntimeException(e);
      }
   
public java.lang.ClassLoadergetClassLoader()

      return unit.getClassLoader();
   
public java.util.ListgetClasses()

      return null;
   
public java.lang.StringgetDefaultEntityManagerName()

      String url = getUrl().toString();
      String name = url.substring(url.lastIndexOf('/") + 1, url.lastIndexOf('."));
      return name;
   
public java.util.MapgetDefaultPersistenceProperties()

      return defaultPersistenceProperties;
   
public java.net.URLgetEjbJarXml()

      return extractDescriptorUrl("ejb-jar.xml");
   
public org.jboss.ejb3.interceptor.InterceptorInfoRepositorygetInterceptorInfoRepository()

      return interceptorInfoRepository;
   
public java.net.URLgetJbossXml()

      return extractDescriptorUrl("jboss.xml");
   
public java.util.HashtablegetJndiProperties()

      return null;
   
public org.jboss.virtual.VirtualFilegetMetaDataFile(java.lang.String name)

      return unit.getMetaDataFile(name);
   
public java.net.URLgetPersistenceXml()

      return extractDescriptorUrl("persistence.xml");
   
public java.net.URLgetRelativeURL(java.lang.String jar)

      try
      {
         return new URL(jar);
      }
      catch (MalformedURLException e)
      {
         try
         {
            if (jar.startsWith(".."))
            {
               if (getUrl() == null)
                  throw new RuntimeException("relative <jar-file> not allowed when standalone deployment unit is used");
               String tmpjar = jar.substring(3);
               VirtualFile vf = unit.getDeploymentContext().getRoot().getParent().findChild(tmpjar);
               return vf.toURL();
            }
            else
            {
               File fp = new File(jar);
               return fp.toURL();
            }
         }
         catch (Exception e1)
         {
            throw new RuntimeException("could not find relative path: " + jar, e1);
         }
      }
   
public java.lang.ClassLoadergetResourceLoader()

      return unit.getClassLoader();
   
public java.util.ListgetResources(org.jboss.virtual.VirtualFileFilter filter)

      VisitorAttributes va = new VisitorAttributes();
      va.setLeavesOnly(true);
      SuffixesExcludeFilter noJars = new SuffixesExcludeFilter(JarUtils.getSuffixes());
      va.setRecurseFilter(noJars);
      FilterVirtualFileVisitor visitor = new FilterVirtualFileVisitor(filter, va);

      List<VirtualFile> classpath = unit.getDeploymentContext().getClassPath();
      if (classpath != null)
      {
         for (VirtualFile vf : classpath)
         {
            try
            {
               vf.visit(visitor);
            }
            catch (IOException e)
            {
               throw new RuntimeException(e);
            }
         }
      }
      return visitor.getMatched();
   
public org.jboss.virtual.VirtualFilegetRootFile()

      return unit.getDeploymentContext().getRoot();
   
public java.lang.StringgetShortName()

      return unit.getDeploymentContext().getRoot().getName();
   
public java.net.URLgetUrl()

      try
      {
         return unit.getDeploymentContext().getRoot().toURL();
      }
      catch (Exception e)
      {
         throw new RuntimeException(e);
      }
   
public voidsetDefaultPersistenceProperties(java.util.Map defaultPersistenceProperties)

      this.defaultPersistenceProperties = defaultPersistenceProperties;