FileDocCategorySizeDatePackage
JmxDeploymentUnit.javaAPI DocJBoss 4.2.16995Fri Jul 13 20:53:58 BST 2007org.jboss.ejb3

JmxDeploymentUnit

public class JmxDeploymentUnit extends Object implements DeploymentUnit
Comment
author
Bill Burke
version
$Revision: 60233 $

Fields Summary
protected static final Logger
log
private org.jboss.deployment.DeploymentInfo
deploymentInfo
org.jboss.ejb3.interceptor.InterceptorInfoRepository
interceptorInfoRepository
Constructors Summary
public JmxDeploymentUnit(org.jboss.deployment.DeploymentInfo deploymentInfo)

//   private VirtualFile vfsRoot;

     
   
      this.deploymentInfo = deploymentInfo;
//      try
//      {
//         VFS vfs = VFS.getVFS(deploymentInfo.url);
//         vfsRoot = vfs.getRoot();
//      }
//      catch (IOException e)
//      {
//         throw new RuntimeException();
//      }
   
Methods Summary
java.net.URLextractDescriptorUrl(java.lang.String resource)

      String urlStr = deploymentInfo.url.getFile();
      // However the jar must also contain at least one ejb-jar.xml
      try
      {
         URL dd = deploymentInfo.localCl.findResource(resource);
         if (dd == null)
         {
            return null;
         }

         // If the DD url is not a subset of the urlStr then this is coming
         // from a jar referenced by the deployment jar manifest and the
         // this deployment jar it should not be treated as an ejb-jar
         if (deploymentInfo.localUrl != null)
         {
            urlStr = deploymentInfo.localUrl.toString();
         }

         String ddStr = dd.toString();
         if (ddStr.indexOf(urlStr) >= 0)
         {
            return dd;
         }
      }
      catch (Exception ignore)
      {
      }
      return null;
   
public java.lang.ClassLoadergetClassLoader()

      return deploymentInfo.ucl;
   
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()

      try
      {
         EJB3DeployerMBean deployer = (EJB3DeployerMBean) MBeanProxyExt.create(EJB3DeployerMBean.class, EJB3DeployerMBean.OBJECT_NAME,
                 deploymentInfo.getServer());

         return deployer.getDefaultProperties();
      }
      catch (Exception e)
      {
         throw new RuntimeException(e);
      }
   
public java.net.URLgetEjbJarXml()

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

      return interceptorInfoRepository;
   
public java.net.URLgetJbossXml()

      return extractDescriptorUrl("META-INF/jboss.xml");
   
public java.util.HashtablegetJndiProperties()

      return null;
   
public java.net.URLgetPersistenceXml()

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

      URL url = null;
      try
      {
         url = 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 base = getUrl().toString();
               jar = jar.replaceAll("\\.\\./", "+");
               int idx = jar.lastIndexOf('+");
               jar = jar.substring(idx + 1);
               for (int i = 0; i < idx + 1; i++)
               {
                  int slash = base.lastIndexOf('/");
                  base = base.substring(0, slash + 1);
               }
               url = new URL(base + jar.substring(idx));
            }
            else
            {
               File fp = new File(jar);
               url = fp.toURL();
            }
         }
         catch (MalformedURLException e1)
         {
            throw new RuntimeException("Unable to find relative url: " + jar, e1);
         }
      }
      return url;
   
public java.lang.ClassLoadergetResourceLoader()

      return deploymentInfo.localCl;
   
public java.lang.StringgetShortName()

      return deploymentInfo.shortName;
   
public java.net.URLgetUrl()

      return deploymentInfo.url;