1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 package de.bea.domingo.http;
24
25 import java.applet.Applet;
26 import java.io.IOException;
27
28 import javax.xml.parsers.SAXParserFactory;
29
30 import de.bea.domingo.DNotesFactory;
31 import de.bea.domingo.DNotesMonitor;
32 import de.bea.domingo.DNotesRuntimeException;
33 import de.bea.domingo.DSession;
34 import de.bea.domingo.monitor.MonitorEnabled;
35
36 /***
37 * Factory for sessions to Notes/Domino.
38 *
39 * @author <a href=mailto:kriede@users.sourceforge.net>Kurt Riede</a>
40 */
41 public final class NotesHttpFactory extends DNotesFactory implements MonitorEnabled {
42
43
44
45
46
47 /*** Retry count while waiting for disposal. */
48 public static final int MAX_DISPOSE_TRIES = 10;
49
50 /*** Time to wait for garbage collector [milliseconds]. */
51 public static final int TIME_WAIT_FOR_GC = 100;
52
53 /*** Threshold size for weak cache. */
54 public static final int DEFAULT_CACHE_THRESHOLD = 2000;
55
56 /*** Key for map of default IIOP session. */
57 public static final String DEFAULT_IIOP_SESSION_KEY = "defaultIIOPSession";
58
59 /*** Default file/path of the domingo support database. */
60 public static final String DEFAULT_DOMINGO_DATABASE = "domingo.nsf";
61
62 /*** File/path of the domingo support database as configured. */
63 private final String fDomingoDatabase;
64
65
66
67
68
69 /*** Base Monitor instance. */
70 private DNotesMonitor fMonitor = null;
71
72 private SAXParserFactory fFactory = SAXParserFactory.newInstance();
73
74
75
76
77
78 /***
79 * Default constructor.
80 *
81 * <p>Must be public to allow abstract factory (the base class) to create
82 * an instance of this class.</p>
83 */
84 public NotesHttpFactory() {
85 String property = getProperty("de.bea.domingo.http.database", DEFAULT_DOMINGO_DATABASE);
86 if (property == null || property.length() == 0) {
87 fDomingoDatabase = DEFAULT_DOMINGO_DATABASE;
88 } else {
89 fDomingoDatabase = property;
90 }
91 }
92
93 /***
94 * Package-private constructor to create a factory from with the Lotus Notes
95 * VM with restricted security.
96 *
97 * <p>Must be public to allow abstract factory (the base class) to create
98 * an instance of this class.</p>
99 */
100 NotesHttpFactory(final int threshold) {
101 throw new UnsupportedOperationException();
102 }
103
104 /***
105 * Returns the shared SAX parser factory.
106 *
107 * @return SAX parser factory
108 */
109 public SAXParserFactory getSAXParserFactory() {
110 return fFactory;
111 }
112
113 /***
114 * @see de.bea.domingo.DNotesFactory#gc()
115 * @deprecated only use this method for testing
116 */
117 public void gc() {
118 }
119
120 /***
121 * {@inheritDoc}
122 * @see de.bea.domingo.DNotesFactory#disposeInternal(boolean)
123 * @deprecated use {@link #disposeInternal(boolean)} instead
124 */
125 public void disposeInternal(final boolean force) throws DNotesRuntimeException {
126 disposeInstance(force);
127 }
128
129 /***
130 * {@inheritDoc}
131 * @see de.bea.domingo.DNotesFactory#disposeInstance(boolean)
132 */
133 public void disposeInstance(final boolean force) throws DNotesRuntimeException {
134
135 }
136
137 /***
138 * {@inheritDoc}
139 * @see de.bea.domingo.DNotesFactory#disposeInstance()
140 */
141 public void disposeInstance() throws DNotesRuntimeException {
142
143 }
144
145
146
147
148
149 /***
150 * {@inheritDoc}
151 *
152 * @see de.bea.domingo.DNotesFactory#getSession()
153 */
154 public DSession getSession() throws DNotesRuntimeException {
155 throw new UnsupportedOperationException();
156 }
157
158 /***
159 * {@inheritDoc}
160 *
161 * @see de.bea.domingo.DNotesFactory#getSession(java.lang.String)
162 */
163 public DSession getSession(final String passwd) throws DNotesRuntimeException {
164 throw new UnsupportedOperationException();
165 }
166
167 /***
168 * {@inheritDoc}
169 *
170 * @see de.bea.domingo.DNotesFactory#getSession(java.lang.String,
171 * java.lang.String, java.lang.String)
172 */
173 public DSession getSession(final String host, final String user, final String passwd) throws DNotesRuntimeException {
174 try {
175 return SessionHttp.getInstance(this, host, user, passwd, getMonitor());
176 } catch (IOException e) {
177 throw new NotesHttpRuntimeException(e.getMessage(), e);
178 }
179 }
180
181 /***
182 * {@inheritDoc}
183 *
184 * @see de.bea.domingo.DNotesFactory#getSession(java.lang.String, java.lang.String[], java.lang.String, java.lang.String)
185 */
186 public DSession getSession(final String serverUrl, final String[] args, final String user, final String password)
187 throws DNotesRuntimeException {
188 throw new UnsupportedOperationException();
189 }
190
191 /***
192 * {@inheritDoc}
193 *
194 * @see de.bea.domingo.DNotesFactory#getSessionSSL(java.lang.String, java.lang.String, java.lang.String)
195 */
196 public DSession getSessionSSL(final String serverUrl, final String user, final String password)
197 throws DNotesRuntimeException {
198 throw new UnsupportedOperationException();
199 }
200
201 /***
202 * {@inheritDoc}
203 *
204 * @see de.bea.domingo.DNotesFactory#getSession(java.applet.Applet,
205 * java.lang.String, java.lang.String)
206 */
207 public DSession getSession(final Applet applet, final String user, final String passwd) throws DNotesRuntimeException {
208 throw new UnsupportedOperationException();
209 }
210
211 /***
212 * {@inheritDoc}
213 *
214 * @see de.bea.domingo.DNotesFactory#getSession(java.lang.Object)
215 */
216 public DSession getSession(final Object notesSession) throws DNotesRuntimeException {
217 throw new UnsupportedOperationException();
218 }
219
220 /***
221 * {@inheritDoc}
222 *
223 * @see de.bea.domingo.DNotesFactory#getSessionWithFullAccess()
224 */
225 public DSession getSessionWithFullAccess() throws DNotesRuntimeException {
226 throw new UnsupportedOperationException();
227 }
228
229 /***
230 * {@inheritDoc}
231 *
232 * @see de.bea.domingo.DNotesFactory#getSessionWithFullAccess(java.lang.String)
233 */
234 public DSession getSessionWithFullAccess(final String password) throws DNotesRuntimeException {
235 throw new UnsupportedOperationException();
236 }
237
238 /***
239 * {@inheritDoc}
240 *
241 * @see de.bea.domingo.DNotesFactory#sinitThread()
242 */
243 public void sinitThread() {
244 }
245
246 /***
247 * {@inheritDoc}
248 *
249 * @see de.bea.domingo.DNotesFactory#stermThread()
250 */
251 public void stermThread() {
252 }
253
254 /***
255 * {@inheritDoc}
256 *
257 * @see de.bea.domingo.DNotesFactory#getMonitor()
258 */
259 public DNotesMonitor getMonitor() {
260 return fMonitor;
261 }
262
263 /***
264 * {@inheritDoc}
265 *
266 * @see de.bea.domingo.DNotesFactory#setMonitor(de.bea.domingo.DNotesMonitor)
267 */
268 public void setMonitor(final DNotesMonitor theMonitor) {
269 this.fMonitor = theMonitor;
270 }
271
272 /***
273 * Returns the file/path of the domingo suport database as configured.
274 *
275 * @return file/path of domingo suport database
276 */
277 public String getDomingoDatabase() {
278 return fDomingoDatabase;
279 }
280 }