1 23 package com.sun.ejb.containers; 24 25 import java.rmi.RemoteException ; 26 import java.security.Principal ; 27 28 import javax.ejb.*; 29 import javax.jms.*; 30 31 import javax.transaction.UserTransaction ; 32 33 import com.sun.ejb.*; 34 import com.sun.enterprise.*; 35 import com.sun.enterprise.log.Log; 36 import java.util.logging.*; 37 import com.sun.logging.*; 38 39 44 45 public final class MessageBeanContextImpl extends EJBContextImpl implements MessageDrivenContext 46 { 47 private static Logger _logger=null; 48 static{ 49 _logger=LogDomains.getLogger(LogDomains.MDB_LOGGER); 50 } 51 52 private boolean afterSetContext = false; 53 54 MessageBeanContextImpl(Object ejb, BaseContainer container) 55 { 56 super(ejb, container); 57 } 58 59 void setEJBStub(EJBObject ejbStub) 60 { 61 throw new RuntimeException ("No stubs for Message-driven beans"); 62 } 63 64 void setEJBObjectImpl(EJBObjectImpl ejbo) 65 { 66 throw new RuntimeException ("No EJB Object for Message-driven beans"); 67 } 68 69 EJBObjectImpl getEJBObjectImpl() 70 { 71 throw new RuntimeException ("No EJB Object for Message-driven beans"); 72 } 73 74 public void setContextCalled() { 75 this.afterSetContext = true; 76 } 77 78 81 82 85 public UserTransaction getUserTransaction() 86 throws java.lang.IllegalStateException 87 { 88 if ( !this.afterSetContext ) { 92 throw new java.lang.IllegalStateException ("Operation not allowed"); 93 } 94 95 return ((BaseContainer)getContainer()).getUserTransaction(); 96 } 97 98 102 public EJBHome getEJBHome() 103 { 104 RuntimeException exception = new java.lang.IllegalStateException 105 ("getEJBHome not allowed for message-driven beans"); 106 throw exception; 107 } 108 109 public boolean isCallerInRole(String roleRef) 110 { 111 throw new java.lang.IllegalStateException ("isCallerInRole() is not defined for message-driven ejbs"); 112 } 113 114 protected void checkAccessToCallerSecurity() 115 throws java.lang.IllegalStateException 116 { 117 if ( isUnitialized() || isInEjbRemove() ) { 120 throw new java.lang.IllegalStateException ("Operation not allowed"); 121 } 122 123 } 124 125 public TimerService getTimerService() 126 throws java.lang.IllegalStateException { 127 128 if( !afterSetContext ) { 129 throw new java.lang.IllegalStateException ("Operation not allowed"); 130 } 131 132 ContainerFactoryImpl cf = (ContainerFactoryImpl) 133 Switch.getSwitch().getContainerFactory(); 134 EJBTimerService timerService = cf.getEJBTimerService(); 135 if( timerService == null ) { 136 throw new EJBException("EJB Timer service not available"); 137 } 138 return new EJBTimerServiceWrapper(timerService, this); 139 } 140 141 public void checkTimerServiceMethodAccess() 142 throws java.lang.IllegalStateException { 143 144 if ( isUnitialized() || isInEjbRemove() ) { 147 throw new java.lang.IllegalStateException 148 ("EJB Timer Service method calls cannot be called in " + 149 " this context"); 150 } 151 } 152 153 } 154 | Popular Tags |