KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > opencms > db > CmsExportPoint


1 /*
2  * File : $Source: /usr/local/cvs/opencms/src/org/opencms/db/CmsExportPoint.java,v $
3  * Date : $Date: 2006/10/19 09:32:27 $
4  * Version: $Revision: 1.10 $
5  *
6  * This library is part of OpenCms -
7  * the Open Source Content Mananagement System
8  *
9  * Copyright (c) 2005 Alkacon Software GmbH (http://www.alkacon.com)
10  *
11  * This library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Lesser General Public
13  * License as published by the Free Software Foundation; either
14  * version 2.1 of the License, or (at your option) any later version.
15  *
16  * This library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  * Lesser General Public License for more details.
20  *
21  * For further information about Alkacon Software GmbH, please see the
22  * company website: http://www.alkacon.com
23  *
24  * For further information about OpenCms, please see the
25  * project website: http://www.opencms.org
26  *
27  * You should have received a copy of the GNU Lesser General Public
28  * License along with this library; if not, write to the Free Software
29  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30  */

31
32 package org.opencms.db;
33
34 import org.opencms.main.OpenCms;
35
36 /**
37  * Contains the data of a single export point.<p>
38  *
39  * @author Alexander Kandzior
40  *
41  * @version $Revision: 1.10 $
42  *
43  * @since 6.0.0
44  */

45 public class CmsExportPoint {
46
47     /** The configured destination path. */
48     private String JavaDoc m_configuredDestination;
49
50     /** The destination path in the "real" file system, relative to the web application folder. */
51     private String JavaDoc m_destinationPath;
52
53     /** The URI of the OpenCms VFS resource (folder) of the export point. */
54     private String JavaDoc m_uri;
55
56     /**
57      * Creates a new, empty export point.<p>
58      */

59     public CmsExportPoint() {
60
61         m_uri = "";
62         m_configuredDestination = "";
63         m_destinationPath = "";
64     }
65
66     /**
67      * Creates a new export point.<p>
68      *
69      * @param uri the folder in the OpenCms VFS to write as export point
70      * @param destination the destination folder in the "real" file system,
71      * relative to the web application root
72      */

73     public CmsExportPoint(String JavaDoc uri, String JavaDoc destination) {
74
75         m_uri = uri;
76         m_configuredDestination = destination;
77         m_destinationPath = OpenCms.getSystemInfo().getAbsoluteRfsPathRelativeToWebApplication(destination);
78     }
79
80     /**
81      * @see java.lang.Object#equals(java.lang.Object)
82      */

83     public boolean equals(Object JavaDoc obj) {
84
85         if (obj == this) {
86             return true;
87         }
88         if (obj instanceof CmsExportPoint) {
89             return ((CmsExportPoint)obj).m_uri.equals(m_uri);
90         }
91         return false;
92     }
93
94     /**
95      * Returns the configured destination path.<p>
96      *
97      * The configured destination path is always relative to the
98      * web application path.<p>
99      *
100      * @return the configured destination path
101      *
102      * @see #getDestinationPath()
103      */

104     public String JavaDoc getConfiguredDestination() {
105
106         return m_configuredDestination;
107     }
108
109     /**
110      * Returns the destination path in the "real" file system.<p>
111      *
112      * @return the destination
113      */

114     public String JavaDoc getDestinationPath() {
115
116         return m_destinationPath;
117     }
118
119     /**
120      * Returns the uri of the OpenCms VFS folder to write as export point.<p>
121      *
122      * @return the uri
123      */

124     public String JavaDoc getUri() {
125
126         return m_uri;
127     }
128
129     /**
130      * @see java.lang.Object#hashCode()
131      */

132     public int hashCode() {
133
134         return getUri().hashCode();
135     }
136
137     /**
138      * Sets the configured destination path.<p>
139      *
140      * The configured destination path is always relative to the
141      * web application path.<p>
142      *
143      * This set method will automatically set the destination path as well.<p>
144      *
145      * @param value the configured destination path
146      *
147      */

148     public void setConfiguredDestination(String JavaDoc value) {
149
150         m_configuredDestination = value;
151         m_destinationPath = OpenCms.getSystemInfo().getAbsoluteRfsPathRelativeToWebApplication(m_configuredDestination);
152
153     }
154
155     /**
156      * Dummy method to expose the destination path as bean property.<p>
157      *
158      * This is required by the {@link org.apache.commons.beanutils.BeanUtils} package in order to
159      * enable using this Object with the digester.<p>
160      *
161      * The method does not actually change the value of the destination path.
162      * Use the <code>{@link #setConfiguredDestination(String)}</code> method instead.
163      *
164      * @param value the destination path (will be ignored)
165      */

166     public void setDestinationPath(String JavaDoc value) {
167
168         if (value == null) {
169             // check required to avoid "unused parameter" warning
170
}
171     }
172
173     /**
174      * Sets the uri of the OpenCms VFS folder to write as export point.<p>
175      *
176      * @param value the uri to set
177      */

178     public void setUri(String JavaDoc value) {
179
180         m_uri = value;
181     }
182
183     /**
184      * @see java.lang.Object#toString()
185      */

186     public String JavaDoc toString() {
187
188         return "[" + getClass().getName() + ", uri: " + m_uri + ", destination: " + m_destinationPath + "]";
189     }
190 }
Popular Tags