1/*2 * Copyright 2000-2001,2004 The Apache Software Foundation.3 * 4 * Licensed under the Apache License, Version 2.0 (the "License");5 * you may not use this file except in compliance with the License.6 * You may obtain a copy of the License at7 * 8 * http://www.apache.org/licenses/LICENSE-2.09 * 10 * Unless required by applicable law or agreed to in writing, software11 * distributed under the License is distributed on an "AS IS" BASIS,12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13 * See the License for the specific language governing permissions and14 * limitations under the License.15 */1617packageorg.apache.jetspeed.services.urlmanager;
1819import org.apache.turbine.services.Service;
20import java.util.List;
2122/***23 * <p>This service provides a central repository for storing URL24 * informations</p>25 * <strong>It should be extended to also provide access to their contents</strong>26 *27 * @author <a href="mailto:raphael@apache.org">Raphaël Luta</a>28 * @version $Id: URLManagerService.java,v 1.6 2004/02/23 03:30:47 jford Exp $29 */30publicinterfaceURLManagerServiceextends Service {
3132/***33 * The service name34 */35public String SERVICE_NAME = "URLManager";
3637/***38 * Matches any status in a list() operation39 */40publicint STATUS_ANY = -1;
4142/***43 * Current status is unknown44 */45publicint STATUS_UNKNOWN = 0;
4647/***48 * The URL can be fetched corretcly49 */50publicint STATUS_OK = 1;
5152/***53 * The URL has permanent fatal errors54 */55publicint STATUS_UNREACHABLE = 2;
5657/***58 * A possibly transient problem prevented the system to fetch this URL59 */60publicint STATUS_TEMPORARY_UNAVAILABLE = 4;
6162/***63 * The content of this URL is corrupted or unparseable64 */65publicint STATUS_CONTENT_ERROR = 8;
6667/***68 * This URL is not currently available for use69 */70publicint STATUS_BAD = STATUS_UNREACHABLE | STATUS_TEMPORARY_UNAVAILABLE | STATUS_CONTENT_ERROR;
7172/***73 * Registers a new URL record74 * 75 * @param url the url to register76 */77publicvoid register( String url );
7879/***80 * Registers a new URL record. If the url is already registered in 81 * the system, updates the status of this URL info record82 * 83 * @param url the url to register84 * @param status the status of this url85 */86publicvoid register( String url, int status );
8788/***89 * Registers a new URL record. If the url is already registered in 90 * the system, updates both the status and the message of this URL 91 * info record92 * 93 * @param url the url to register94 * @param status the status of this url95 * @param message a descriptive message of the status96 */97publicvoid register( String url, int status, String message );
9899/***100 * Register or replace an URL record. All records are keyed to101 * the imutable URL of URLInfo.102 * 103 * @param info the info record to store104 */105publicvoid register( URLInfo info );
106107/***108 * Unregister an URL from the repository109 * 110 * @param url the url to remove111 */112publicvoid unregister( String url );
113114/***115 * Get the information record stored in the database about116 * an URL.117 * 118 * @param url the url whose record is sought119 * @return the description record found in the repository or null.120 */121publicURLInfo getInfo( String url );
122123/***124 * Test whether the URL is currently believed to be OK by this 125 * repository.126 * 127 * @param url the url to be tested128 * @return false is the url is known by this repository and has129 * a status indicating an error, true otherwise.130 */131publicboolean isOK( String url );
132133/***134 * List of the current known URLs in the repository135 *136 * @return a List of URL strings known to this repository137 */138public List list();
139140/***141 * List of the current known URLs in the repository which have 142 * the given status.143 *144 * @param status the status to be retrieved. May be 145 * {@link URLManagerService#STATUS_ANY} to indicate any status146 * @return a List of URL strings known to this repository with this status147 */148public List list( int status );
149150/***151 * Return the proxy's port for a protocol.152 *153 * @param protocol The protocol that the proxy supports, e.g. 'http'154 * @return The port of the proxy (1-65535), or -1 if no port was specified (= use default)155 */156publicint getProxyPort( String protocol );
157158/***159 * Return the proxy's hostname for a protocol.160 *161 * @param protocol The protocol that the proxy supports, e.g. 'http'162 * @return The hostname of the proxy, or <code>null</code> if no proxy is specified for this protocol163 */164public String getProxyHost( String protocol );
165166 }