source: release-kits/lirk3/ant-scripts/tasks/antelope/src/ise/antelope/tasks/NetworkUtilTask.java@ 14982

Last change on this file since 14982 was 14982, checked in by oranfry, 16 years ago

initial import of LiRK3

File size: 1.3 KB
Line 
1package ise.antelope.tasks;
2
3import ise.antelope.tasks.typedefs.net.*;
4
5import java.io.*;
6import java.net.*;
7import java.util.*;
8import org.apache.tools.ant.BuildException;
9
10import org.apache.tools.ant.Task;
11
12/**
13 * A task to answer a bunch of questions about network interfaces.
14 *
15 * Copyright 2003
16 *
17 * @version $Revision: 1.1 $
18 */
19public class NetworkUtilTask extends Task {
20
21
22 private String property = null;
23 private boolean failOnError = false;
24
25 private Vector ops = new Vector();
26
27 /**
28 * @param name where to put the answer
29 */
30 public void setProperty(String name) {
31 property = name;
32 }
33
34 public void addNetop(NetOp op) {
35 ops.add(op);
36 }
37
38 /**
39 * hostname
40 */
41 public void addHostname(Hostname op) {
42 ops.add(op);
43 }
44
45 /** While multiple ops could be added, only the first one is executed. */
46 public void execute() {
47 if (ops.size() == 0)
48 return;
49 NetOp op = (NetOp)ops.get(0);
50 String value = op.execute();
51 if (property != null) {
52 Unset unset = new Unset();
53 unset.setProject(getProject());
54 unset.setName(property);
55 unset.execute();
56 getProject().setProperty(property, value);
57 }
58 }
59
60}
61
Note: See TracBrowser for help on using the repository browser.