1 28 29 package com.caucho.ejb; 30 31 import com.caucho.util.CharBuffer; 32 33 import javax.ejb.EJBHome ; 34 import javax.ejb.EJBMetaData ; 35 import java.io.Serializable ; 36 37 public class EJBMetaDataImpl implements EJBMetaData , Serializable { 38 private EJBHome home; 40 41 private Class homeInterfaceClass; 42 private Class remoteInterfaceClass; 43 private Class primaryKeyClass; 44 45 private boolean isSession; 46 private boolean isStatelessSession; 47 48 51 public EJBMetaDataImpl() 52 { 53 } 54 55 58 EJBMetaDataImpl(EJBHome home, 59 Class homeInterfaceClass, 60 Class remoteInterfaceClass, 61 Class primaryKeyClass) 62 { 63 this.home = home; 64 this.homeInterfaceClass = homeInterfaceClass; 65 this.remoteInterfaceClass = remoteInterfaceClass; 66 this.primaryKeyClass = primaryKeyClass; 67 } 68 69 public EJBHome getEJBHome() 70 { 71 return this.home; 72 } 73 74 public void setEJBHome(EJBHome home) 75 { 76 this.home = home; 77 } 78 79 public Class getHomeInterfaceClass() 80 { 81 return this.homeInterfaceClass; 82 } 83 84 public Class getRemoteInterfaceClass() 85 { 86 return this.remoteInterfaceClass; 87 } 88 89 public Class getPrimaryKeyClass() 90 { 91 return this.primaryKeyClass; 92 } 93 94 void setSession(boolean isSession) 95 { 96 this.isSession = isSession; 97 } 98 99 public boolean isSession() 100 { 101 return this.isSession; 102 } 103 104 void setStatelessSession(boolean isStatelessSession) 105 { 106 this.isStatelessSession = isStatelessSession; 107 } 108 109 public boolean isStatelessSession() 110 { 111 return this.isStatelessSession; 112 } 113 114 public String toString() 115 { 116 CharBuffer cb = new CharBuffer(); 117 118 cb.append("MetaData["); 119 if (isSession() && isStatelessSession()) 120 cb.append("stateless-session"); 121 else if (isSession()) 122 cb.append("session"); 123 else 124 cb.append("entity"); 125 126 if (homeInterfaceClass != null) 127 cb.append(" home:" + homeInterfaceClass.getName()); 128 if (remoteInterfaceClass != null) 129 cb.append(" remote:" + remoteInterfaceClass.getName()); 130 if (primaryKeyClass != null) 131 cb.append(" key:" + primaryKeyClass.getName()); 132 133 cb.append("]"); 134 135 return cb.toString(); 136 } 137 } 138 | Popular Tags |