1 24 33 34 package org.datashare; 35 36 import org.datashare.objects.DataShareConnectionDescriptor; 37 import org.datashare.objects.DefaultObjectInfo; 38 import java.util.Date ; 39 import java.net.InetAddress ; 40 41 42 51 public class ConsumerInfo extends DefaultObjectInfo implements PersistDataCallbackInterface 52 { 53 56 protected ClientInfo clientInfo = null; 57 58 61 protected SessionInfo sessionInfo = null; 62 63 66 protected ChannelInfo channelInfo = null; 67 68 72 private ConsumerInfo() 73 { 74 originalType = CONSUMERTYPE; 75 } 76 77 81 public ConsumerInfo(ClientInfo clientInfo, 82 SessionInfo sessionInfo, 83 ChannelInfo channelInfo) 84 { 85 this(); name = clientInfo.getName(); 87 toString = clientInfo.getKeyValue(); 88 this.keyValue = clientInfo.getKeyValue(); 89 this.parentKeyValue = channelInfo.getKeyValue(); this.grandparentKeyValue = sessionInfo.getKeyValue(); this.clientInfo = clientInfo; 92 this.sessionInfo = sessionInfo; 93 this.channelInfo = channelInfo; 94 this.clientRealName = clientInfo.getClientRealName(); 95 this.clientClass = clientInfo.getClientClass(); 96 } 97 98 103 public String 104 getType() 105 { 106 return CONSUMERTYPE; 107 } 108 109 114 public String 115 getInfo() 116 { 117 return this.clientInfo.getInfo() + "<tr><td>Joined function</td><td>" + this.date.toString() + 118 "</td></tr><tr><td>Consumer activity</td><td>" + (this.getActive()?"Active":"Inactive") + "</td></tr>"; 119 } 120 121 126 public String 127 getKeyValue() 128 { 129 return clientInfo.getKeyValue(); } 131 132 138 public void 139 setDatabaseID(String ak) 140 { 141 SessionUtilities.getLoggingInterface().debugMsg(SessionUtilities.getLoggingInterface().DEBUG, 142 SessionUtilities.getLoggingInterface().DATABASE, 143 "setDatabaseID(): EJB Key for " + this.getKeyValue() + " has value of " + ak); 144 databaseID = ak; 145 waitingForKey = false; 146 keyHasBeenReturned = true; 147 } 148 149 155 public String 156 getDatabaseID() 157 { 158 String thisKey = null; 159 if(this.clientInfo.saveData) 160 { 161 if(databaseID != null) 162 thisKey = databaseID; 163 else 164 thisKey = retrieveEJB(); 165 } 166 return thisKey; 167 } 168 169 172 public ClientInfo 173 getClientInfo() 174 { 175 return this.clientInfo; 176 } 177 } 178 | Popular Tags |