/* */ package org.jboss.ejb.plugins.local;
/* */
/* */ import java.lang.reflect.InvocationHandler;
/* */ import java.lang.reflect.Method;
/* */ import javax.ejb.EJBLocalHome;
/* */ import javax.ejb.EJBLocalObject;
/* */ import javax.ejb.RemoveException;
/* */
/* */ public class LocalHomeProxy extends LocalProxy
/* */ implements InvocationHandler
/* */ {
/* */ static final long serialVersionUID = 1762319499924478521L;
/* */ protected static final Method REMOVE_BY_PRIMARY_KEY;
/* */ protected static final Method REMOVE_OBJECT;
/* */
/* */ public LocalHomeProxy(String jndiName, BaseLocalProxyFactory factory)
/* */ {
/* 73 */ super(jndiName, factory);
/* */ }
/* */
/* */ protected Object getId()
/* */ {
/* 78 */ return this.jndiName;
/* */ }
/* */
/* */ public Object invoke(Object proxy, Method m, Object[] args)
/* */ throws Throwable
/* */ {
/* 94 */ Object retValue = null;
/* */
/* 96 */ if (args == null) {
/* 97 */ args = EMPTY_ARGS;
/* */ }
/* */
/* 100 */ if (m.equals(TO_STRING))
/* */ {
/* 102 */ retValue = this.jndiName + "Home";
/* */ }
/* 104 */ else if (m.equals(EQUALS))
/* */ {
/* 107 */ Object temp = invoke(proxy, TO_STRING, args);
/* 108 */ retValue = new Boolean(temp.equals(this.jndiName + "Home"));
/* */ }
/* 110 */ else if (m.equals(HASH_CODE))
/* */ {
/* 112 */ retValue = new Integer(hashCode());
/* */ }
/* 114 */ else if (m.equals(REMOVE_BY_PRIMARY_KEY))
/* */ {
/* */ try
/* */ {
/* 120 */ Object id = args[0];
/* 121 */ retValue = this.factory.invoke(id, REMOVE_OBJECT, EMPTY_ARGS);
/* */ }
/* */ catch (Exception e)
/* */ {
/* 125 */ RemoveException re = new RemoveException(e.getMessage());
/* 126 */ re.initCause(e);
/* 127 */ throw re;
/* */ }
/* */
/* */ }
/* */ else
/* */ {
/* 133 */ retValue = this.factory.invokeHome(m, args);
/* */ }
/* */
/* 136 */ return retValue;
/* */ }
/* */
/* */ static
/* */ {
/* */ try
/* */ {
/* 56 */ Class[] empty = new Class[0];
/* 57 */ Class type = EJBLocalHome.class;
/* */
/* 59 */ REMOVE_BY_PRIMARY_KEY = type.getMethod("remove", new Class[] { Object.class });
/* */
/* 62 */ REMOVE_OBJECT = EJBLocalObject.class.getMethod("remove", empty);
/* */ }
/* */ catch (Exception e)
/* */ {
/* 66 */ e.printStackTrace();
/* 67 */ throw new ExceptionInInitializerError(e);
/* */ }
/* */ }
/* */ }
/* Location: /home/mnovotny/projects/EMBEDDED_JBOSS_BETA3_COMMUNITY/embedded/output/lib/embedded-jboss/lib/jboss-embedded-all.jar
* Qualified Name: org.jboss.ejb.plugins.local.LocalHomeProxy
* JD-Core Version: 0.6.0
*/