Source code: dr/davmgr/protocol/cmd/Command.java
1 package dr.davmgr.protocol.cmd;
2
3 import dr.davmgr.protocol.*;
4 import java.net.URL;
5 import java.util.Vector;
6
7 public class Command {
8 protected URL url = null;
9 protected Urls urls=null;
10 protected boolean reversable = false;
11
12 protected boolean canceled=false;
13
14 protected ErrorListener errorListener = null;
15 protected StatusListener statusListener = null;
16 protected AuthorizationListener authorizationListener = null;
17 protected ConfirmationListener confirmationListener = null;
18 protected OverwriteListener overwriteListener = null;
19
20 public Command() { }
21 public Command(Urls urls) {
22 this.urls=urls;
23 }
24 public Command(URL url) {
25 this.url = url;
26 }
27 public URL getURL() {
28 return url;
29 }
30 public void setURL(URL url) {
31 this.url=url;
32 }
33
34 public void setUrls(Urls urls) {
35 this.urls=urls;
36 }
37 public Urls getUrls() {
38 return urls;
39 }
40 public boolean isReversable() {
41 return reversable;
42 }
43 public void setReversable(boolean reversable) {
44 this.reversable=reversable;
45 }
46
47 public void setStatusListener(StatusListener listener) {
48 statusListener=listener;
49 }
50 public StatusListener getStatusListener() {
51 return statusListener;
52 }
53 public void setErrorListener(ErrorListener listener) {
54 errorListener=listener;
55 }
56 public ErrorListener getErrorListener() {
57 return errorListener;
58 }
59 public void setAuthorizationListener(AuthorizationListener listener) {
60 authorizationListener=listener;
61 }
62 public AuthorizationListener getAuthorizationListener() {
63 return authorizationListener;
64 }
65 public void setConfirmationListener(ConfirmationListener listener) {
66 confirmationListener=listener;
67 }
68 public ConfirmationListener getConfirmationListener() {
69 return confirmationListener;
70 }
71 public void setOverwriteListener(OverwriteListener listener) {
72 overwriteListener=listener;
73 }
74 public OverwriteListener getOverwriteListener() {
75 return overwriteListener;
76 }
77 public boolean fireOverwriteRequest(URL url) {
78 if (overwriteListener==null) return false;
79 return overwriteListener.canOverwrite(url);
80 }
81 public Authorization fireAuthorizationRequest(Urls urls, String realm, int type) {
82 if (authorizationListener==null) return null;
83 return authorizationListener.getAuthorization(urls, realm, type);
84 }
85 public boolean isCanceled() {
86 return canceled;
87 }
88 public void cancel() {
89 canceled=true;
90 }
91 public void finalize() {
92 url=null; urls=null;
93 errorListener=null;
94 statusListener=null;
95 authorizationListener=null;
96 confirmationListener=null;
97 overwriteListener=null;
98 }
99 }