本文整理匯總了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);
}
示例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());
}
示例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());
}
}