Line | |
---|
1 | package ise.antelope.tasks;
|
---|
2 |
|
---|
3 | import ise.antelope.tasks.typedefs.net.*;
|
---|
4 |
|
---|
5 | import java.io.*;
|
---|
6 | import java.net.*;
|
---|
7 | import java.util.*;
|
---|
8 | import org.apache.tools.ant.BuildException;
|
---|
9 |
|
---|
10 | import 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 | */
|
---|
19 | public 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.