[jboss-cvs] JBossAS SVN: r110192 - in trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer: env and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Dec 23 13:25:22 EST 2010


Author: marius.bogoevici
Date: 2010-12-23 13:25:22 -0500 (Thu, 23 Dec 2010)
New Revision: 110192

Removed:
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/JBossProxyServices.java
Modified:
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/WeldBootstrapDeployer.java
Log:
code cleanup: removing JBossProxyServices - which is not being used (and we would much prefer to use the default implementation anyway)

Deleted: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/JBossProxyServices.java
===================================================================
--- trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/JBossProxyServices.java	2010-12-23 18:04:26 UTC (rev 110191)
+++ trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/JBossProxyServices.java	2010-12-23 18:25:22 UTC (rev 110192)
@@ -1,131 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2010, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.weld.integration.deployer;
-
-import org.jboss.classloading.spi.RealClassLoader;
-import org.jboss.weld.bean.proxy.util.SimpleProxyServices;
-import org.jboss.weld.exceptions.WeldException;
-import org.jboss.weld.logging.messages.BeanMessage;
-import org.jboss.weld.serialization.spi.ProxyServices;
-
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-
-/**
- * A {@link ProxyServices} implementation for JBoss AS. This needs to be used if Weld is shared.
- *
- * @author Marius Bogoevici
- */
-public class JBossProxyServices extends SimpleProxyServices
-{
-
-   public ClassLoader getClassLoader(final Class<?> proxiedBeanType)
-   {
-      SecurityManager sm = System.getSecurityManager();
-      if (sm != null)
-      {
-         return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>()
-         {
-            public ClassLoader run()
-            {
-               return _getClassLoader(proxiedBeanType);
-            }
-         });
-      }
-      else
-      {
-         return _getClassLoader(proxiedBeanType);
-      }
-   }
-
-   /**
-    * Return the thread context classloader or its first {@link org.jboss.classloading.spi.RealClassLoader}
-    * parent for classes from the java.* package (WARs WebCtxLoader$ENCLoader cannot be used for defining new proxy classes)
-    *
-    * If no {@link org.jboss.classloading.spi.RealClassLoader} is found, we return whatever we found.
-    *
-    * If there is no thread context classloader, then just fall back to the default Weld behaviour.
-    *
-    */
-   private ClassLoader _getClassLoader(Class<?> proxiedBeanType)
-   {
-      if (proxiedBeanType.getName().startsWith("java"))
-      {
-         ClassLoader threadContextClassLoader = getThreadContextClassLoader();
-         ClassLoader actualClassLoader = threadContextClassLoader;
-         while (actualClassLoader != null && !(actualClassLoader instanceof RealClassLoader))
-         {
-            actualClassLoader = actualClassLoader.getParent();
-         }
-         if (actualClassLoader != null)
-         {
-            return actualClassLoader;
-         }
-         else if (threadContextClassLoader != null)
-         {
-            return threadContextClassLoader;
-         }
-      }
-      // fall back to the default Weld behaviour
-      return super.getClassLoader(proxiedBeanType);
-   }
-
-   private static ClassLoader getThreadContextClassLoader()
-   {
-      SecurityManager sm = System.getSecurityManager();
-      if (sm != null)
-      {
-         return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>()
-         {
-            public ClassLoader run()
-            {
-               return Thread.currentThread().getContextClassLoader();
-            }
-         });
-      }
-      else
-      {
-         return Thread.currentThread().getContextClassLoader();
-      }
-   }
-
-   public Class<?> loadBeanClass(final String className)
-   {
-      try
-      {
-         return (Class<?>) AccessController.doPrivileged(new PrivilegedExceptionAction<Object>()
-         {
-            public Object run() throws Exception
-            {
-               return Class.forName(className, true, getThreadContextClassLoader());
-            }
-         });
-      }
-      catch (PrivilegedActionException pae)
-      {
-         throw new WeldException(BeanMessage.CANNOT_LOAD_CLASS, className, pae.getException());
-      }
-   }
-}

Modified: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/WeldBootstrapDeployer.java
===================================================================
--- trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/WeldBootstrapDeployer.java	2010-12-23 18:04:26 UTC (rev 110191)
+++ trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/WeldBootstrapDeployer.java	2010-12-23 18:25:22 UTC (rev 110192)
@@ -23,8 +23,6 @@
 
 import org.jboss.beans.metadata.api.annotations.Start;
 import org.jboss.beans.metadata.api.annotations.Stop;
-import org.jboss.beans.metadata.plugins.AbstractInjectionValueMetaData;
-import org.jboss.beans.metadata.plugins.AbstractValueMetaData;
 import org.jboss.beans.metadata.spi.BeanMetaData;
 import org.jboss.beans.metadata.spi.ValueMetaData;
 import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
@@ -35,11 +33,9 @@
 import org.jboss.weld.bootstrap.api.Bootstrap;
 import org.jboss.weld.bootstrap.api.SingletonProvider;
 import org.jboss.weld.integration.deployer.DeployersUtils;
-import org.jboss.weld.integration.deployer.JBossProxyServices;
 import org.jboss.weld.integration.deployer.env.bda.DUTopLevelClassLoaderGetter;
 import org.jboss.weld.integration.deployer.env.bda.DeploymentImpl;
 
-import org.jboss.weld.integration.deployer.env.helpers.BootstrapBean;
 import org.jboss.weld.integration.provider.JBossSingletonProvider;
 
 
@@ -136,7 +132,6 @@
       bootstrap.addPropertyMetaData("transactionServices", bootstrap.createInject("JBossTransactionServices"));
       bootstrap.addPropertyMetaData("securityServices", bootstrap.createInject("JBossSecurityServices"));
       bootstrap.addPropertyMetaData("validationServices", createValidationServices(unit));
-      bootstrap.addPropertyMetaData("proxyServices", createProxyServices());
       bootstrap.setCreate("initialize");
       bootstrap.setStart("boot");
       bootstrap.setDestroy("shutdown");
@@ -163,16 +158,6 @@
    }
 
    /**
-    * Create proxy services
-    *
-    * @return the {@link org.jboss.weld.serialization.spi.ProxyServices} instance
-    */
-   protected JBossProxyServices createProxyServices()
-   {
-      return new JBossProxyServices();
-   }
-
-   /**
     * Create bootstrap bean.
     *
     * @param unit the deployment unit



More information about the jboss-cvs-commits mailing list