KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > jetspeed > services > urlmanager > URLManagerService


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 at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * 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 and
14  * limitations under the License.
15  */

16
17 package org.apache.jetspeed.services.urlmanager;
18
19 import org.apache.turbine.services.Service;
20 import java.util.List JavaDoc;
21
22 /**
23  * <p>This service provides a central repository for storing URL
24  * 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  */

30 public interface URLManagerService extends Service {
31
32     /**
33      * The service name
34      */

35     public String JavaDoc SERVICE_NAME = "URLManager";
36
37     /**
38      * Matches any status in a list() operation
39      */

40     public int STATUS_ANY = -1;
41
42     /**
43      * Current status is unknown
44      */

45     public int STATUS_UNKNOWN = 0;
46
47     /**
48      * The URL can be fetched corretcly
49      */

50     public int STATUS_OK = 1;
51
52     /**
53      * The URL has permanent fatal errors
54      */

55     public int STATUS_UNREACHABLE = 2;
56
57     /**
58      * A possibly transient problem prevented the system to fetch this URL
59      */

60     public int STATUS_TEMPORARY_UNAVAILABLE = 4;
61
62     /**
63      * The content of this URL is corrupted or unparseable
64      */

65     public int STATUS_CONTENT_ERROR = 8;
66     
67     /**
68      * This URL is not currently available for use
69      */

70     public int STATUS_BAD = STATUS_UNREACHABLE | STATUS_TEMPORARY_UNAVAILABLE | STATUS_CONTENT_ERROR;
71
72     /**
73      * Registers a new URL record
74      *
75      * @param url the url to register
76      */

77     public void register( String JavaDoc url );
78
79     /**
80      * Registers a new URL record. If the url is already registered in
81      * the system, updates the status of this URL info record
82      *
83      * @param url the url to register
84      * @param status the status of this url
85      */

86     public void register( String JavaDoc url, int status );
87
88     /**
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 record
92      *
93      * @param url the url to register
94      * @param status the status of this url
95      * @param message a descriptive message of the status
96      */

97     public void register( String JavaDoc url, int status, String JavaDoc message );
98
99     /**
100      * Register or replace an URL record. All records are keyed to
101      * the imutable URL of URLInfo.
102      *
103      * @param info the info record to store
104      */

105     public void register( URLInfo info );
106
107     /**
108      * Unregister an URL from the repository
109      *
110      * @param url the url to remove
111      */

112     public void unregister( String JavaDoc url );
113
114     /**
115      * Get the information record stored in the database about
116      * an URL.
117      *
118      * @param url the url whose record is sought
119      * @return the description record found in the repository or null.
120      */

121     public URLInfo getInfo( String JavaDoc url );
122     
123     /**
124      * Test whether the URL is currently believed to be OK by this
125      * repository.
126      *
127      * @param url the url to be tested
128      * @return false is the url is known by this repository and has
129      * a status indicating an error, true otherwise.
130      */

131     public boolean isOK( String JavaDoc url );
132     
133     /**
134      * List of the current known URLs in the repository
135      *
136      * @return a List of URL strings known to this repository
137      */

138     public List JavaDoc list();
139         
140     /**
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 status
146      * @return a List of URL strings known to this repository with this status
147      */

148     public List JavaDoc list( int status );
149
150     /**
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      */

156     public int getProxyPort( String JavaDoc protocol );
157
158     /**
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 protocol
163      */

164     public String JavaDoc getProxyHost( String JavaDoc protocol );
165
166 }
167
Popular Tags