001: /*
002: * Copyright 2007 Hippo.
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016: package nl.hippo.cms.brokenlinkchecker;
017:
018: import java.util.HashSet;
019: import java.util.Iterator;
020: import java.util.Set;
021: import nl.hippo.cms.brokenlinkchecker.log.BrokenLinkCheckerLog;
022: import nl.hippo.cms.brokenlinkchecker.log.NoOperationLog;
023:
024: /**
025: * <p>
026: * Simple bean implementation of the broken link checker run configuration.
027: * </p>
028: */
029: public class BrokenLinkCheckerRunConfigurationBean implements
030: BrokenLinkCheckerRunConfiguration {
031: /**
032: * <p>
033: * The default value for the number of documents in a single batch that
034: * is retrieved using a DASL.
035: * </p>
036: */
037: private static final int DEFAULT_DOCUMENT_BATCH_SIZE = 100;
038:
039: /**
040: * <p>
041: * The default value for the number of threads to use for checking
042: * links.
043: * </p>
044: */
045: private static final int DEFAULT_NUMBER_OF_LINK_CHECKING_THREADS = 10;
046:
047: /**
048: * <p>
049: * The default value for the number of seconds to wait for a response.
050: * </p>
051: */
052: private static final int DEFAULT_LINK_CHECK_TIMEOUT_SECONDS = 10;
053:
054: private String documentTreeToCheckRootUrl;
055:
056: private String documentsBaseUrl;
057:
058: private Set internalUrlPrefixesToIgnore = new HashSet();
059:
060: private String internalLinksBaseUrl;
061:
062: private String repositoryUsername;
063:
064: private String repositoryPassword;
065:
066: private String resultDocumentUrl;
067:
068: private int documentBatchSize = DEFAULT_DOCUMENT_BATCH_SIZE;
069:
070: private int numberOfLinkCheckingThreads = DEFAULT_NUMBER_OF_LINK_CHECKING_THREADS;
071:
072: private int linkCheckTimeoutSeconds = DEFAULT_LINK_CHECK_TIMEOUT_SECONDS;
073:
074: private BrokenLinkCheckerLog log = NoOperationLog.getInstance();
075:
076: /**
077: * <p>
078: * Create an instance of this class. The following attributes will be
079: * set to default values:
080: * </p>
081: * <table>
082: * <tr>
083: * <th>Attribute</th>
084: * <th>Default value</th>
085: * </tr>
086: * <tr>
087: * <td>{@link #documentBatchSize}</td>
088: * <td>100</td>
089: * </tr>
090: * <tr>
091: * <td>{@link #numberOfLinkCheckingThreads}</td>
092: * <td>10</td>
093: * </tr>
094: * <tr>
095: * <td>{@link #linkCheckTimeoutSeconds}</td>
096: * <td>10</td>
097: * </tr>
098: * <tr>
099: * <td>{@link #log}</td>
100: * <td>An instance of {@link NoOperationLog}.</td>
101: * </tr>
102: * </table>
103: */
104: public BrokenLinkCheckerRunConfigurationBean() {
105: super ();
106:
107: // No action needed. There is nothing to initialize.
108: }
109:
110: public int getDocumentBatchSize() {
111: return documentBatchSize;
112: }
113:
114: public void setDocumentBatchSize(int documentBatchSize) {
115: this .documentBatchSize = documentBatchSize;
116: }
117:
118: public String getDocumentsBaseUrl() {
119: return documentsBaseUrl;
120: }
121:
122: public void setDocumentsBaseUrl(String documentsBaseUrl) {
123: this .documentsBaseUrl = documentsBaseUrl;
124: }
125:
126: public Iterator internalUrlPrefixesToIgnoreIterator() {
127: return internalUrlPrefixesToIgnore.iterator();
128: }
129:
130: public void addInternalUrlPrefixToIgnore(String prefix) {
131: internalUrlPrefixesToIgnore.add(prefix);
132: }
133:
134: public void addInternalUrlPrefixesToIgnore(Set prefixes) {
135: internalUrlPrefixesToIgnore.addAll(prefixes);
136: }
137:
138: public String getDocumentTreeToCheckRootUrl() {
139: return documentTreeToCheckRootUrl;
140: }
141:
142: public void setDocumentTreeToCheckRootUrl(
143: String documentTreeToCheckRootUrl) {
144: this .documentTreeToCheckRootUrl = documentTreeToCheckRootUrl;
145: }
146:
147: public String getInternalLinksBaseUrl() {
148: return internalLinksBaseUrl;
149: }
150:
151: public void setInternalLinksBaseUrl(String internalLinksBaseUrl) {
152: this .internalLinksBaseUrl = internalLinksBaseUrl;
153: }
154:
155: public int getLinkCheckTimeoutSeconds() {
156: return linkCheckTimeoutSeconds;
157: }
158:
159: public void setLinkCheckTimeoutSeconds(int linkCheckTimeoutSeconds) {
160: this .linkCheckTimeoutSeconds = linkCheckTimeoutSeconds;
161: }
162:
163: public BrokenLinkCheckerLog getLog() {
164: return log;
165: }
166:
167: public void setLog(BrokenLinkCheckerLog log) {
168: this .log = log;
169: }
170:
171: public int getNumberOfLinkCheckingThreads() {
172: return numberOfLinkCheckingThreads;
173: }
174:
175: public void setNumberOfLinkCheckingThreads(
176: int numberOfLinkCheckingThreads) {
177: this .numberOfLinkCheckingThreads = numberOfLinkCheckingThreads;
178: }
179:
180: public String getRepositoryPassword() {
181: return repositoryPassword;
182: }
183:
184: public void setRepositoryPassword(String repositoryPassword) {
185: this .repositoryPassword = repositoryPassword;
186: }
187:
188: public String getRepositoryUsername() {
189: return repositoryUsername;
190: }
191:
192: public void setRepositoryUsername(String repositoryUsername) {
193: this .repositoryUsername = repositoryUsername;
194: }
195:
196: public String getResultDocumentUrl() {
197: return resultDocumentUrl;
198: }
199:
200: public void setResultDocumentUrl(String resultDocumentUrl) {
201: this.resultDocumentUrl = resultDocumentUrl;
202: }
203: }
|