本文整理汇总了Java中javax.naming.ldap.UnsolicitedNotificationListener类的典型用法代码示例。如果您正苦于以下问题:Java UnsolicitedNotificationListener类的具体用法?Java UnsolicitedNotificationListener怎么用?Java UnsolicitedNotificationListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
UnsolicitedNotificationListener类属于javax.naming.ldap包,在下文中一共展示了UnsolicitedNotificationListener类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addNamingListener
import javax.naming.ldap.UnsolicitedNotificationListener; //导入依赖的package包/类
/**
* Adds <tt>l</tt> to list of listeners interested in <tt>nm</tt>
* and filter.
*/
synchronized void addNamingListener(String nm, String filter,
SearchControls ctls, NamingListener l) throws NamingException {
if (l instanceof ObjectChangeListener ||
l instanceof NamespaceChangeListener) {
NotifierArgs args = new NotifierArgs(nm, filter, ctls, l);
NamingEventNotifier notifier = notifiers.get(args);
if (notifier == null) {
notifier = new NamingEventNotifier(this, ctx, args, l);
notifiers.put(args, notifier);
} else {
notifier.addNamingListener(l);
}
}
if (l instanceof UnsolicitedNotificationListener) {
// Add listener to this's list of unsolicited notifiers
if (unsolicited == null) {
unsolicited = new Vector<>(3);
}
unsolicited.addElement((UnsolicitedNotificationListener)l);
}
}
示例2: addNamingListener
import javax.naming.ldap.UnsolicitedNotificationListener; //导入依赖的package包/类
/**
* Adds {@code l} to list of listeners interested in {@code nm}
* and filter.
*/
synchronized void addNamingListener(String nm, String filter,
SearchControls ctls, NamingListener l) throws NamingException {
if (l instanceof ObjectChangeListener ||
l instanceof NamespaceChangeListener) {
NotifierArgs args = new NotifierArgs(nm, filter, ctls, l);
NamingEventNotifier notifier = notifiers.get(args);
if (notifier == null) {
notifier = new NamingEventNotifier(this, ctx, args, l);
notifiers.put(args, notifier);
} else {
notifier.addNamingListener(l);
}
}
if (l instanceof UnsolicitedNotificationListener) {
// Add listener to this's list of unsolicited notifiers
if (unsolicited == null) {
unsolicited = new Vector<>(3);
}
unsolicited.addElement((UnsolicitedNotificationListener)l);
}
}
示例3: addNamingListener
import javax.naming.ldap.UnsolicitedNotificationListener; //导入依赖的package包/类
/**
* Adds <tt>l</tt> to list of listeners interested in <tt>nm</tt>
* and filter.
*/
synchronized void addNamingListener(String nm, String filter,
SearchControls ctls, NamingListener l) throws NamingException {
if (l instanceof ObjectChangeListener ||
l instanceof NamespaceChangeListener) {
NotifierArgs args = new NotifierArgs(nm, filter, ctls, l);
NamingEventNotifier notifier =
(NamingEventNotifier) notifiers.get(args);
if (notifier == null) {
notifier = new NamingEventNotifier(this, ctx, args, l);
notifiers.put(args, notifier);
} else {
notifier.addNamingListener(l);
}
}
if (l instanceof UnsolicitedNotificationListener) {
// Add listener to this's list of unsolicited notifiers
if (unsolicited == null) {
unsolicited = new Vector(3);
}
unsolicited.addElement(l);
}
}
示例4: removeNamingListener
import javax.naming.ldap.UnsolicitedNotificationListener; //导入依赖的package包/类
public void removeNamingListener(NamingListener namingListener)
throws NamingException {
if (listeners == null || !listeners.containsKey(namingListener)) {
return;
}
if (namingListener instanceof UnsolicitedNotificationListener) {
unls.remove(namingListener);
}
List<Integer> idList = listeners.remove(namingListener);
if (idList == null) {
return;
}
try {
for (Integer id : idList) {
client.removePersistentSearch(id.intValue(), requestControls);
}
} catch (IOException e) {
CommunicationException ex = new CommunicationException();
ex.setRootCause(e);
}
}
示例5: addNamingListener
import javax.naming.ldap.UnsolicitedNotificationListener; //导入依赖的package包/类
public void addNamingListener(Name name, String filter,
Object[] filterArgs, SearchControls searchControls,
NamingListener namingListener) throws NamingException {
checkName(name);
if (namingListener == null) {
return;
}
if (!(name instanceof LdapName)) {
if (name instanceof CompositeName && name.size() == 1) {
name = name.getPrefix(1);
} else {
// FIXME: read message from file
throw new InvalidNameException(
"Target cannot span multiple namespaces: "
+ name.toString());
}
}
if (namingListener instanceof UnsolicitedNotificationListener) {
if (unls == null) {
unls = new ArrayList<UnsolicitedNotificationListener>();
addUnsolicitedListener();
}
unls.add((UnsolicitedNotificationListener) namingListener);
if (!(namingListener instanceof NamespaceChangeListener)
&& !(namingListener instanceof ObjectChangeListener)) {
return;
}
}
if (searchControls == null) {
searchControls = new SearchControls();
}
Filter f = LdapUtils.parseFilter(filter, filterArgs);
String targetDN = getTargetDN(name, contextDn);
Name tempName = new LdapName(contextDn.toString());
tempName.addAll(name);
String baseDN = tempName.toString();
int messageId = doPersistentSearch(targetDN, baseDN, f, searchControls,
namingListener);
if (listeners == null) {
listeners = new HashMap<NamingListener, List<Integer>>();
}
List<Integer> idList = listeners.get(namingListener);
if (idList == null) {
idList = new ArrayList<Integer>();
}
idList.add(Integer.valueOf(messageId));
}