当前位置: 首页>>代码示例>>Java>>正文


Java NamingListener类代码示例

本文整理汇总了Java中javax.naming.event.NamingListener的典型用法代码示例。如果您正苦于以下问题:Java NamingListener类的具体用法?Java NamingListener怎么用?Java NamingListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


NamingListener类属于javax.naming.event包,在下文中一共展示了NamingListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: removeNamingListener

import javax.naming.event.NamingListener; //导入依赖的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);
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:25,代码来源:LdapContextImpl.java

示例2: test_removeNamingListener

import javax.naming.event.NamingListener; //导入依赖的package包/类
public void test_removeNamingListener() throws Exception {
    MockLdapClient client = new MockLdapClient();
    Hashtable<Object, Object> env = new Hashtable<Object, Object>();

    context = new LdapContextImpl(client, env, "cn=test");
    // remove not registered listener, do nothing
    context.removeNamingListener(new TestNamingListener());

    NamingListener listener = new TestNamingListener();

    context.addNamingListener("test=listener", EventContext.OBJECT_SCOPE,
            listener);
    context.removeNamingListener(listener);

    listener = new TestNamingListener();
    context.addNamingListener("test=listener", EventContext.OBJECT_SCOPE,
            listener);
    context.addNamingListener("test=listener", EventContext.ONELEVEL_SCOPE,
            listener);
    context.removeNamingListener(listener);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:22,代码来源:LdapContextImplTest.java

示例3: removeNamingListener

import javax.naming.event.NamingListener; //导入依赖的package包/类
public void removeNamingListener(NamingListener l) throws NamingException {
    Iterator it = listeners.keySet().iterator();
    while (it.hasNext()) {
        String name = (String) it.next();
        getListeners(name).remove(l);
    }
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:8,代码来源:EventDirCtx.java

示例4: fire

import javax.naming.event.NamingListener; //导入依赖的package包/类
/**
 * @param name
 * @param type
 * @param newBd
 * @param oldBd
 * @param changeInfo
 */
private void fire(String name, int type, Binding newBd, Binding oldBd,
    Object changeInfo) {

    NamingEvent e = new NamingEvent(this, type, newBd, oldBd, changeInfo);
    List l = getListeners(name);
    for (int i = 0; i < l.size(); i++) {
        e.dispatch((NamingListener) l.get(i));
    }
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:17,代码来源:EventDirCtx.java

示例5: getSchema

import javax.naming.event.NamingListener; //导入依赖的package包/类
public DirContext getSchema(String name) throws NamingException {
    List l = getListeners(name);
    NamingExceptionEvent e = new NamingExceptionEvent(this,
        new NamingException("Ok"));
    for (int i = 0; i < l.size(); i++) {
        e.dispatch((NamingListener) l.get(i));
    }
    return null;
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:10,代码来源:EventDirCtx.java

示例6: QueueElement

import javax.naming.event.NamingListener; //导入依赖的package包/类
QueueElement(EventObject event, Vector<NamingListener> vector) {
    this.event = event;
    this.vector = vector;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:5,代码来源:EventQueue.java

示例7: RemoveNamingListener

import javax.naming.event.NamingListener; //导入依赖的package包/类
RemoveNamingListener(EventContext ctx, NamingListener listener) {
    this.ctx = ctx;
    this.listener = listener;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:5,代码来源:RemoveNamingListenerTest.java

示例8: addNamingListener

import javax.naming.event.NamingListener; //导入依赖的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));
}
 
开发者ID:shannah,项目名称:cn1,代码行数:61,代码来源:LdapContextImpl.java

示例9: addNamingListener

import javax.naming.event.NamingListener; //导入依赖的package包/类
public void addNamingListener(Name name, String s, Object[] aobj,
        SearchControls searchcontrols, NamingListener naminglistener)
        throws NamingException {

}
 
开发者ID:shannah,项目名称:cn1,代码行数:6,代码来源:MockEventDirContext.java

示例10: addNamingListener

import javax.naming.event.NamingListener; //导入依赖的package包/类
public void addNamingListener(Name name, int i, NamingListener naminglistener)
        throws NamingException {
    throw new UnsupportedOperationException("in EventContextMockUp");
}
 
开发者ID:shannah,项目名称:cn1,代码行数:5,代码来源:NamingEventTest.java

示例11: removeNamingListener

import javax.naming.event.NamingListener; //导入依赖的package包/类
public void removeNamingListener(NamingListener naminglistener) throws NamingException {
    throw new UnsupportedOperationException("in EventContextMockUp");
}
 
开发者ID:shannah,项目名称:cn1,代码行数:4,代码来源:NamingEventTest.java

示例12: addNamingListener

import javax.naming.event.NamingListener; //导入依赖的package包/类
public void addNamingListener(Name name, int i,
		NamingListener naminglistener) throws NamingException {
	throw new UnsupportedOperationException("in EventContextMockUp");
}
 
开发者ID:shannah,项目名称:cn1,代码行数:5,代码来源:NamingExceptionEventTest.java

示例13: removeNamingListener

import javax.naming.event.NamingListener; //导入依赖的package包/类
public void removeNamingListener(NamingListener naminglistener)
		throws NamingException {
	throw new UnsupportedOperationException("in EventContextMockUp");
}
 
开发者ID:shannah,项目名称:cn1,代码行数:5,代码来源:NamingExceptionEventTest.java

示例14: addNamingListener

import javax.naming.event.NamingListener; //导入依赖的package包/类
@Override
public void addNamingListener(String target, int scope, NamingListener listener) {
}
 
开发者ID:Reading-eScience-Centre,项目名称:edal-java,代码行数:4,代码来源:JNDI.java

示例15: removeNamingListener

import javax.naming.event.NamingListener; //导入依赖的package包/类
@Override
public void removeNamingListener(NamingListener listener) {
}
 
开发者ID:Reading-eScience-Centre,项目名称:edal-java,代码行数:4,代码来源:JNDI.java


注:本文中的javax.naming.event.NamingListener类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。