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  /***
20   * <p>This is a simple URL information record which can be used
21   * to track URL resources status in a persistent way.</p>
22   *
23   * <p>The url String used to initialize it MUST be interned,
24   * to ensure that if two such urls are "equal()", they will be
25   * also "==" </p>
26   *
27   *
28   * @author <a href="mailto:raphael@apache.org">Raphaël Luta</a>
29   * @version $Id: URLInfo.java,v 1.5 2004/02/23 03:30:47 jford Exp $
30   */
31  public class URLInfo implements java.io.Serializable {
32          
33      private String url;
34      private int status;
35      private String message;
36  
37      /***
38       * Creates a new minimum URLInfo record
39       *
40       * @param url a non-null url described by this class
41       */
42      URLInfo( String url ) {
43          this( url, URLManagerService.STATUS_UNKNOWN, null );
44      }
45          
46      /***
47       * Creates a new URLInfo record
48       *
49       * @param url a non-null url described by this class
50       * @param status the status of this url
51       */
52      URLInfo( String url, int status ) {
53          this( url, status, null );
54      }
55          
56      /***
57       * Creates a new URLInfo record
58       *
59       * @param url a non-null url described by this class
60       * @param status the status of this url
61       * @param message a message suitable for display describing
62       * the status of the url
63       */
64      URLInfo( String url, int status, String message ) {
65          this.url = url.intern();
66          this.status = status;
67          this.message = message;
68      }
69          
70      /***
71       * Get the url.
72       *
73       * @return the url string described by this object
74       */
75      public String getURL() {
76          return this.url;
77      }
78          
79      /***
80       * Get the status
81       *
82       * @return the status for this url
83       */
84      public int getStatus() {
85          return status;
86      }
87          
88      /***
89       * Set the status
90       *
91       * @param status the status for this url
92       */
93      public void setStatus( int status ) {
94          this.status = status;
95      }
96  
97      /***
98       * Get the message
99       *
100      * @return the message for this url
101      */
102     public String getMessage() {
103         return message;
104     }
105         
106     /***
107      * Set the message
108      *
109      * @param message the message for this url
110      */
111     public void setMessage( String message ) {
112         this.message = message;
113     }
114 
115 }