當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。