View Javadoc

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.TurbineServices;
20  import java.util.List;
21  
22  /***
23   * <p>This is a static wrapper around the URLManagerService for easing 
24   * access to its functionalities</p>
25   *
26   * @author <a href="mailto:raphael@apache.org">Raphaël Luta</a>
27   * @version $Id: URLManager.java,v 1.7 2004/02/23 03:30:47 jford Exp $
28   */
29  public class URLManager {
30  
31      /*** 
32       * @see URLManagerService#STATUS_ANY
33       */
34      public static int STATUS_ANY = URLManagerService.STATUS_ANY;
35  
36      /*** 
37       * @see URLManagerService#STATUS_UNKNOWN
38       */
39      public static int STATUS_UNKNOWN = URLManagerService.STATUS_UNKNOWN;
40  
41      /*** 
42       * @see URLManagerService#STATUS_OK
43       */
44      public static int STATUS_OK = URLManagerService.STATUS_OK;
45  
46      /*** 
47       * @see URLManagerService#STATUS_UNREACHABLE
48       */
49      public static int STATUS_UNREACHABLE = URLManagerService.STATUS_UNREACHABLE;
50  
51      /*** 
52       * @see URLManagerService#STATUS_TEMPORARY_UNAVAILABLE
53       */
54      public static int STATUS_TEMPORARY_UNAVAILABLE = URLManagerService.STATUS_TEMPORARY_UNAVAILABLE;
55  
56      /*** 
57       * @see URLManagerService#STATUS_CONTENT_ERROR
58       */
59      public static int STATUS_CONTENT_ERROR = URLManagerService.STATUS_CONTENT_ERROR;
60      
61      /*** 
62       * @see URLManagerService#STATUS_BAD
63       */
64      public static int STATUS_BAD = URLManagerService.STATUS_BAD;
65  
66      /*** 
67       * @see URLManagerService#register
68       */
69      public static void register( String url ) {
70          URLManagerService ums = (URLManagerService)TurbineServices
71              .getInstance()
72              .getService( URLManagerService.SERVICE_NAME );
73          
74          ums.register( url );
75      }
76  
77      /*** 
78       * @see URLManagerService#register
79       */
80      public static void register( String url, int status ) {
81          URLManagerService ums = (URLManagerService)TurbineServices
82              .getInstance()
83              .getService( URLManagerService.SERVICE_NAME );
84          
85          ums.register( url, status );
86      }
87  
88      /*** 
89       * @see URLManagerService#register
90       */
91      public static void register( String url, int status, String message ) {
92          URLManagerService ums = (URLManagerService)TurbineServices
93              .getInstance()
94              .getService( URLManagerService.SERVICE_NAME );
95          
96          ums.register( url, status, message );
97      }
98  
99      /*** 
100      * @see URLManagerService#register
101      */
102     public static void register( URLInfo info ) {
103         URLManagerService ums = (URLManagerService)TurbineServices
104             .getInstance()
105             .getService( URLManagerService.SERVICE_NAME );
106         
107         ums.register( info );
108     }
109 
110     /*** 
111      * @see URLManagerService#unregister
112      */
113     public static void unregister( String url ) {
114         URLManagerService ums = (URLManagerService)TurbineServices
115             .getInstance()
116             .getService( URLManagerService.SERVICE_NAME );
117         
118         ums.unregister( url );
119     }
120 
121     /*** 
122      * @see URLManagerService#getInfo
123      */
124     public static URLInfo getInfo( String url ) {
125         URLManagerService ums = (URLManagerService)TurbineServices
126             .getInstance()
127             .getService( URLManagerService.SERVICE_NAME );
128         
129         return ums.getInfo( url );
130     }
131     
132     /*** 
133      * @see URLManagerService#isOK
134      */
135     public static boolean isOK( String url ) {
136         URLManagerService ums = (URLManagerService)TurbineServices
137             .getInstance()
138             .getService( URLManagerService.SERVICE_NAME );
139         
140         return ums.isOK( url );
141     }
142     
143     /*** 
144      * @see URLManagerService#list
145      */
146     public static List list() {
147         URLManagerService ums = (URLManagerService)TurbineServices
148             .getInstance()
149             .getService( URLManagerService.SERVICE_NAME );
150         
151         return ums.list();
152     }
153         
154     /*** 
155      * @see URLManagerService#list
156      */
157     public static List list( int status ) {
158         URLManagerService ums = (URLManagerService)TurbineServices
159             .getInstance()
160             .getService( URLManagerService.SERVICE_NAME );
161         
162         return ums.list( status );
163     }
164 
165     /*** 
166      * @see URLManagerService#getProxyPort
167      */
168     public static int getProxyPort( String protocol ) {
169         URLManagerService ums = (URLManagerService)TurbineServices
170             .getInstance()
171             .getService( URLManagerService.SERVICE_NAME );
172         
173         return ums.getProxyPort( protocol );
174     }
175     
176     /*** 
177      * @see URLManagerService#getProxyHost
178      */
179     public static String getProxyHost( String protocol ) {
180         URLManagerService ums = (URLManagerService)TurbineServices
181             .getInstance()
182             .getService( URLManagerService.SERVICE_NAME );
183         
184         return ums.getProxyHost( protocol );
185     }
186 }