1 23 package com.sun.enterprise; 24 25 import javax.transaction.Transaction ; 26 import javax.transaction.SystemException ; 27 import org.apache.catalina.Context; 28 import com.sun.ejb.Container; 29 import com.sun.enterprise.security.SecurityContext; 30 import java.util.logging.*; 32 import com.sun.logging.*; 33 35 import java.lang.reflect.Method ; 36 import com.sun.xml.rpc.spi.runtime.Tie; 37 38 import com.sun.ejb.ComponentContext; 39 40 45 public class ComponentInvocation { 46 private static Logger _logger=null; 48 static{ 49 _logger=LogDomains.getLogger(LogDomains.ROOT_LOGGER); 50 } 51 53 static final public int SERVLET_INVOCATION = 0; 54 static final public int EJB_INVOCATION = 1; 55 static final public int APP_CLIENT_INVOCATION = 2; 56 static final public int UN_INITIALIZED = 3; 57 static final public int SERVICE_STARTUP = 4; 58 59 private int invocationType = UN_INITIALIZED; 60 61 62 public Object instance; 64 65 public Object container; 67 68 public Transaction transaction; 69 70 public ComponentContext context = null; 72 73 public SecurityContext oldSecurityContext; 77 78 public Boolean auth = null; 79 public boolean preInvokeDone = false; 80 81 private boolean transactionCompleting = false; 84 85 88 private Tie webServiceTie; 89 private Method webServiceMethod; 90 91 public ComponentInvocation() 92 {} 93 94 public ComponentInvocation(int invocationType) 95 { 96 this.invocationType = invocationType; 97 } 98 99 public ComponentInvocation(Object instance, Object container) 100 { 101 this.instance = instance; 102 this.container = container; 103 } 104 105 public ComponentInvocation(Object instance, Object container, ComponentContext context) 106 { 107 this.instance = instance; 108 this.container = container; 109 this.context = context; 110 } 111 112 113 public int getInvocationType() { 114 if (invocationType == UN_INITIALIZED) { 115 if (container instanceof Context) { 116 invocationType = SERVLET_INVOCATION; 117 return SERVLET_INVOCATION; 118 } else if (container instanceof Container) { 119 invocationType = EJB_INVOCATION; 120 return EJB_INVOCATION; 121 } else { 122 invocationType = APP_CLIENT_INVOCATION; 123 return APP_CLIENT_INVOCATION; 124 } 125 } 126 else 127 return invocationType; 128 } 129 130 131 public Object getInstance() { 132 return instance; 133 } 134 135 138 public Object getContainerContext() { 139 return container; 140 } 141 142 public Transaction getTransaction() { 143 return transaction; 144 } 145 146 public void setTransaction(Transaction tran) { 147 this.transaction = tran; 148 } 149 152 public void setOldSecurityContext (SecurityContext sc){ 153 this.oldSecurityContext = sc; 154 } 155 159 public SecurityContext getOldSecurityContext (){ 160 return oldSecurityContext; 161 } 162 163 public boolean isTransactionCompleting() { 164 return transactionCompleting; 165 } 166 167 public void setTransactionCompeting(boolean value) { 168 transactionCompleting = value; 169 } 170 171 172 public void setWebServiceTie(Tie tie) { 173 webServiceTie = tie; 174 } 175 176 public Tie getWebServiceTie() { 177 return webServiceTie; 178 } 179 180 public void setWebServiceMethod(Method method) { 181 webServiceMethod = method; 182 } 183 184 public Method getWebServiceMethod() { 185 return webServiceMethod; 186 } 187 188 public String toString() { 189 String str = instance + "," + container; 190 if (transaction != null) { 191 try { 192 str += "," + transaction.getStatus(); 193 } catch (SystemException ex) { 194 _logger.log(Level.SEVERE,"enterprise.system_exception",ex); 197 } 199 } else { 200 str += ",no transaction"; 201 } 202 return str; 203 } 204 } 205 | Popular Tags |