1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.xnap.pkg;
21
22
23 /***
24 */
25 public abstract class AbstractDependencyNode implements DependencyNode
26 {
27
28
29
30 private Object id;
31 private boolean required;
32
33
34
35 public AbstractDependencyNode(Object id)
36 {
37 this.id = id;
38 }
39
40
41
42 public Object getID()
43 {
44 return id;
45 }
46
47 public boolean isRequired()
48 {
49 return required;
50 }
51
52 public void require(boolean requireInstalled)
53 throws UnsatisfiedDependenciesException
54 {
55 if (required) {
56
57 return;
58 }
59
60 required = true;
61 try {
62 checkDepends(requireInstalled);
63 }
64 catch (UnsatisfiedDependenciesException e) {
65 required = false;
66 throw e;
67 }
68 }
69
70 public abstract void checkDepends(boolean requireInstalled)
71 throws UnsatisfiedDependenciesException;
72
73 public void setRequired(boolean required)
74 {
75 this.required = required;
76 }
77
78 public String toString()
79 {
80 return getID().toString();
81 }
82
83 }
84