1
2
3
4
5
6
7
8
9
10
11 package psiprobe.model;
12
13 import java.io.File;
14 import java.io.Serializable;
15 import java.sql.Timestamp;
16
17 import psiprobe.tools.logging.LogDestination;
18
19
20
21
22
23
24 public class DisconnectedLogDestination implements LogDestination, Serializable {
25
26
27 private static final long serialVersionUID = 1L;
28
29
30 private Application application;
31
32
33 private boolean root;
34
35
36 private boolean context;
37
38
39 private String name;
40
41
42 private String index;
43
44
45 private String targetClass;
46
47
48 private String conversionPattern;
49
50
51 private File file;
52
53
54 private String logType;
55
56
57 private long size;
58
59
60 private Timestamp lastModified;
61
62
63 private String level;
64
65
66 private String[] validLevels;
67
68
69 private String encoding;
70
71
72
73
74
75
76
77
78 public DisconnectedLogDestination builder(LogDestination destination) {
79 this.application = destination.getApplication();
80 this.root = destination.isRoot();
81 this.context = destination.isContext();
82 this.name = destination.getName();
83 this.index = destination.getIndex();
84 this.targetClass = destination.getTargetClass();
85 this.conversionPattern = destination.getConversionPattern();
86 this.file = destination.getFile();
87 this.logType = destination.getLogType();
88 this.size = destination.getSize();
89 this.lastModified = destination.getLastModified();
90 this.level = destination.getLevel();
91 this.validLevels = destination.getValidLevels();
92 this.encoding = destination.getEncoding();
93 return this;
94 }
95
96 @Override
97 public Application getApplication() {
98 return application;
99 }
100
101 @Override
102 public boolean isRoot() {
103 return root;
104 }
105
106 @Override
107 public boolean isContext() {
108 return context;
109 }
110
111 @Override
112 public String getName() {
113 return name;
114 }
115
116 @Override
117 public String getIndex() {
118 return index;
119 }
120
121 @Override
122 public String getTargetClass() {
123 return targetClass;
124 }
125
126 @Override
127 public String getConversionPattern() {
128 return conversionPattern;
129 }
130
131 @Override
132 public File getFile() {
133 return file;
134 }
135
136 @Override
137 public String getLogType() {
138 return logType;
139 }
140
141 @Override
142 public long getSize() {
143 return size;
144 }
145
146 @Override
147 public Timestamp getLastModified() {
148 return lastModified == null ? null : new Timestamp(lastModified.getTime());
149 }
150
151 @Override
152 public String getLevel() {
153 return level;
154 }
155
156 @Override
157 public String[] getValidLevels() {
158 return validLevels == null ? new String[0] : validLevels.clone();
159 }
160
161 @Override
162 public String getEncoding() {
163 return encoding;
164 }
165 }