Author: dallen6
Date: 2010-05-03 03:42:35 -0400 (Mon, 03 May 2010)
New Revision: 6208
Modified:
api/trunk/weld-spi/src/main/java/org/jboss/weld/serialization/spi/ProxyServices.java
Log:
Updated ProxyServices
Modified:
api/trunk/weld-spi/src/main/java/org/jboss/weld/serialization/spi/ProxyServices.java
===================================================================
---
api/trunk/weld-spi/src/main/java/org/jboss/weld/serialization/spi/ProxyServices.java 2010-05-03
06:01:38 UTC (rev 6207)
+++
api/trunk/weld-spi/src/main/java/org/jboss/weld/serialization/spi/ProxyServices.java 2010-05-03
07:42:35 UTC (rev 6208)
@@ -22,48 +22,75 @@
import org.jboss.weld.bootstrap.api.Service;
/**
- * <p>Support services related to proxy generation and serialization which are
required
- * to be implemented by all containers.</p>
- *
* <p>
- * These services are used by all Weld proxy classes to ensure the correct class loaders
- * are used and to aid in the serialization and deserialization of these classes across
- * container instances.
+ * Support services related to proxy generation and serialization which are
+ * required to be implemented by all containers.
* </p>
- *
* <p>
- * Required in all environments since proxies are always in use. A default
- * implementation will be used if none are provided by the container which
- * will use the information directly from the type of proxy.
+ * These services are used by all Weld proxy classes to ensure the correct class
+ * loaders are used and to aid in the serialization and deserialization of these
+ * classes across container instances.
* </p>
+ * <p>
+ * Required in all environments since proxies are always in use. A default
+ * implementation will be used if none are provided by the container which will
+ * use the information directly from the type of proxy.
+ * </p>
+ * <p>
+ * {@link ProxyServices} is a per-deployment service.
+ * </p>
*
- * <p> {@link ProxyServices} is a per-deployment service.</p>
- *
* @author David Allen
- *
*/
public interface ProxyServices extends Service
{
/**
* Returns the class loader that will load the proxy class which extends or
- * implements the given type. This class loader may simply be the same
- * class loader used for the type, or it may be another class loader designed
- * to hold proxies while still providing access to the given type and any of its
+ * implements the given type. This class loader may simply be the same class
+ * loader used for the type, or it may be another class loader designed to
+ * hold proxies while still providing access to the given type and any of its
* ancestors and used types.
*
* @param type the super type (class or interface) of the proxy
* @return the class loader to use for the proxy class
*/
public ClassLoader getClassLoader(Class<?> type);
-
+
/**
* Returns the protection domain to use when a security manager is present
- * during generation of a proxy class with the given super type. Usually
- * this protection domain will need to correspond to the one used with
- * the class loader provided by {@link #getClassLoader(Class)}.
+ * during generation of a proxy class with the given super type. Usually this
+ * protection domain will need to correspond to the one used with the class
+ * loader provided by {@link #getClassLoader(Class)}.
*
* @param type the super type (class or interface) of the proxy
* @return the protection domain to use for the proxy class
*/
public ProtectionDomain getProtectionDomain(Class<?> type);
+
+ /**
+ * Allows a proxy object to be intercepted before it is serialized to an
+ * object stream. The object may be wrapped or otherwise handled in such a
+ * way to allow it to be serialized and then later deserialized in another
+ * VM. The default Weld implementation uses a wrapper class which contains
+ * enough information to recreate the proxy class and then to deserialize the
+ * proxy object itself.
+ *
+ * @param proxyObject the proxy object from Weld being serialized
+ * @return a replacement object or the proxy
+ */
+ public Object wrapForSerialization(Object proxyObject);
+
+ /**
+ * Loads the superclass of a proxy using the correct classloader for an
+ * application. The superclass will usually be a class contained in a Weld
+ * deployment or some class accessible from a deployment's classloader. This
+ * is only used during deserialization of a proxy where the superclass for it
+ * is needed to create that proxy class just before deserializing the proxy
+ * object.
+ *
+ * @param className the superclass name for the proxy class
+ * @return the corresponding Class object
+ */
+ public Class<?> loadProxySuperClass(String className);
+
}
Show replies by date