found = this.pendingCallbackSessionInfoSet.contains(currSessionName.getRelativeWildcard());
}
}
if (found) {
SessionName sessionName = new SessionName(this.engineGlob, name);
SessionInfo sessionInfo = this.requestBroker.getAuthenticate().getSessionInfo(sessionName);
DispatchManager mgr = null;
if (sessionInfo != null)
mgr = sessionInfo.getDispatchManager();
if (mgr != null) {
mgr.addConnectionStatusListener(this, true); // true: fire initial event
// done already:
//if (this.callbackSessionStateSet == null) this.callbackSessionStateSet = new TreeSet();
//this.callbackSessionStateSet.add(sessionName.getRelativeName());
}
else
System.err.println("EventPlugin.sessionAdded: Unexpected missing of " + name);
}
} catch (Throwable e) {
e.printStackTrace();
}
}
}
if (this.clientSet == null) return;
SessionInfo sessionInfo = clientEvent.getSessionInfo();
SessionName sessionName = sessionInfo.getSessionName();
try {
ConnectQosData cd = sessionInfo.getConnectQos().getData();
// A client can on connect send a event/connect=false clientProperty to suppress the event fired
if (cd.getClientProperty(ContextNode.EVENT_MARKER_TAG + ContextNode.SEP + "connect", true) == false) {
if (log.isLoggable(Level.FINE)) log.fine("Found " + ContextNode.EVENT_MARKER_TAG + ContextNode.SEP + "connect=true for "+sessionName.toString());
return;
}
}
catch (Throwable e) {
e.printStackTrace();
log.warning("Accessing connectQos failed: " + e.toString());
}
String relativeName = sessionName.getRelativeName();
String event = ContextNode.SEP + ContextNode.EVENT_MARKER_TAG + ContextNode.SEP + "connect";
String foundEvent = relativeName + event; // "client/joe/session/1/event/connect"
if (!this.clientSet.contains(foundEvent)) {
// "client/joe/session/*/event/connect"
foundEvent = sessionName.getRelativePubSessionIdWildcard() + event;
if (!this.clientSet.contains(foundEvent)) {
// "client/*/session/1/event/connect"
foundEvent = sessionName.getRelativeSubjectIdWildcard() + event;
if (!this.clientSet.contains(foundEvent)) {
// "client/*/session/*/event/connect"
foundEvent = sessionName.getRelativeWildcard() + event;
if (!this.clientSet.contains(foundEvent)) {
return;
}
}
}
}
try {
//PublishKey(glob, Constants.EVENT_OID_LOGIN/*"__sys__Login"*/, "text/plain");
// Key '__sys__UserList' for login/logout event
// PublishKey(glob, Constants.EVENT_OID_USERLIST/*"__sys__UserList"*/, "text/plain");
String summary = "Login of client " + sessionName.getAbsoluteName();
String description = sessionInfo.toXml();
String eventType = foundEvent;
String errorCode = null;
if (this.smtpDestinationHelper != null) {
sendEmail(summary, description, eventType, null, sessionName, false);
}
if (this.publishDestinationHelper != null) {
sendMessage(summary, description,
eventType, errorCode, sessionName, sessionInfo.getRemotePropertyArr());
}
if (this.jmxDestinationHelper != null) {
sendJmxNotification(summary, description, eventType, null, false);
}