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


Java IvyListener类代码示例

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


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

示例1: Entry

import org.apache.ivy.core.event.IvyListener; //导入依赖的package包/类
public Entry(Session newSession, String newUser, String newHost, int newPort) {
    session = newSession;
    host = newHost;
    user = newUser;
    port = newPort;
    IvyContext.getContext().getEventManager().addIvyListener(new IvyListener() {
        public void progress(IvyEvent event) {
            event.getSource().removeIvyListener(this);
            clearSession(session);
        }
    }, EndResolveEvent.NAME);
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:13,代码来源:SshCache.java

示例2: testEvent

import org.apache.ivy.core.event.IvyListener; //导入依赖的package包/类
@Test
public void testEvent() throws Exception {
    ResolveReport report = ivy.resolve(new File(
            "test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml").toURI().toURL(),
        getResolveOptions(new String[] {"*"}));

    final List<IvyEvent> events = new ArrayList<>();
    ivy.getEventManager().addIvyListener(new IvyListener() {
        public void progress(IvyEvent event) {
            events.add(event);
        }
    });
    ModuleDescriptor md = report.getModuleDescriptor();
    String pattern = "build/test/retrieve/[module]/[conf]/[artifact]-[revision].[ext]";
    ivy.retrieve(md.getModuleRevisionId(),
        getRetrieveOptions().setDestArtifactPattern(pattern));
    assertEquals(4, events.size());
    assertTrue(events.get(0) instanceof StartRetrieveEvent);
    assertTrue(events.get(1) instanceof StartRetrieveArtifactEvent);
    assertTrue(events.get(2) instanceof EndRetrieveArtifactEvent);
    assertTrue(events.get(3) instanceof EndRetrieveEvent);
    EndRetrieveEvent ev = (EndRetrieveEvent) events.get(3);
    assertEquals(1, ev.getNbCopied());
    assertEquals(0, ev.getNbUpToDate());

    events.clear();
    ivy.retrieve(md.getModuleRevisionId(),
        getRetrieveOptions().setDestArtifactPattern(pattern));
    assertEquals(2, events.size());
    assertTrue(events.get(0) instanceof StartRetrieveEvent);
    assertTrue(events.get(1) instanceof EndRetrieveEvent);
    ev = (EndRetrieveEvent) events.get(1);
    assertEquals(0, ev.getNbCopied());
    assertEquals(1, ev.getNbUpToDate());
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:36,代码来源:RetrieveTest.java

示例3: ensureConnectionOpened

import org.apache.ivy.core.event.IvyListener; //导入依赖的package包/类
protected synchronized void ensureConnectionOpened() throws IOException {
    if (in == null) {
        Message.verbose("connecting to " + getUsername() + "@" + getHost() + "... ");
        String connectionCommand = getConnectionCommand();
        exec(connectionCommand);

        try {
            readResponse(false); // waits for first prompt

            if (reuseConnection > 0) {
                connectionCleaner = new IvyThread() {
                    public void run() {
                        initContext();
                        try {
                            long sleep = REUSE_CONNECTION_SLEEP_TIME;
                            while (in != null && sleep > 0) {
                                sleep(sleep);
                                sleep = reuseConnection
                                        - (System.currentTimeMillis() - lastCommand);
                                if (inCommand && sleep <= 0) {
                                    sleep = reuseConnection;
                                }
                            }
                        } catch (InterruptedException e) {
                            // nothing to do
                        }
                        disconnect();
                    }
                };
                connectionCleaner.start();
            }

            if (ivy != null) {
                ivy.getEventManager().addIvyListener(new IvyListener() {
                    public void progress(IvyEvent event) {
                        disconnect();
                        event.getSource().removeIvyListener(this);
                    }
                }, EndResolveEvent.NAME);
            }

        } catch (IOException ex) {
            closeConnection();
            throw new IOException("impossible to connect to " + getUsername() + "@" + getHost()
                    + " using " + getAuthentication() + ": " + ex.getMessage());
        }
        Message.verbose("connected to " + getHost());
    }
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:50,代码来源:VsftpRepository.java


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