001: /*
002: * File : $Source: /usr/local/cvs/opencms/src/org/opencms/db/CmsExportPoint.java,v $
003: * Date : $Date: 2008-02-27 12:05:42 $
004: * Version: $Revision: 1.13 $
005: *
006: * This library is part of OpenCms -
007: * the Open Source Content Management System
008: *
009: * Copyright (c) 2002 - 2008 Alkacon Software GmbH (http://www.alkacon.com)
010: *
011: * This library is free software; you can redistribute it and/or
012: * modify it under the terms of the GNU Lesser General Public
013: * License as published by the Free Software Foundation; either
014: * version 2.1 of the License, or (at your option) any later version.
015: *
016: * This library is distributed in the hope that it will be useful,
017: * but WITHOUT ANY WARRANTY; without even the implied warranty of
018: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
019: * Lesser General Public License for more details.
020: *
021: * For further information about Alkacon Software GmbH, please see the
022: * company website: http://www.alkacon.com
023: *
024: * For further information about OpenCms, please see the
025: * project website: http://www.opencms.org
026: *
027: * You should have received a copy of the GNU Lesser General Public
028: * License along with this library; if not, write to the Free Software
029: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
030: */
031:
032: package org.opencms.db;
033:
034: import org.opencms.main.OpenCms;
035:
036: /**
037: * Contains the data of a single export point.<p>
038: *
039: * @author Alexander Kandzior
040: *
041: * @version $Revision: 1.13 $
042: *
043: * @since 6.0.0
044: */
045: public class CmsExportPoint {
046:
047: /** The configured destination path. */
048: private String m_configuredDestination;
049:
050: /** The destination path in the "real" file system, relative to the web application folder. */
051: private String m_destinationPath;
052:
053: /** The URI of the OpenCms VFS resource (folder) of the export point. */
054: private String m_uri;
055:
056: /**
057: * Creates a new, empty export point.<p>
058: */
059: public CmsExportPoint() {
060:
061: m_uri = "";
062: m_configuredDestination = "";
063: m_destinationPath = "";
064: }
065:
066: /**
067: * Creates a new export point.<p>
068: *
069: * @param uri the folder in the OpenCms VFS to write as export point
070: * @param destination the destination folder in the "real" file system,
071: * relative to the web application root
072: */
073: public CmsExportPoint(String uri, String destination) {
074:
075: m_uri = uri;
076: m_configuredDestination = destination;
077: m_destinationPath = OpenCms
078: .getSystemInfo()
079: .getAbsoluteRfsPathRelativeToWebApplication(destination);
080: }
081:
082: /**
083: * @see java.lang.Object#equals(java.lang.Object)
084: */
085: public boolean equals(Object obj) {
086:
087: if (obj == this ) {
088: return true;
089: }
090: if (obj instanceof CmsExportPoint) {
091: return ((CmsExportPoint) obj).m_uri.equals(m_uri);
092: }
093: return false;
094: }
095:
096: /**
097: * Returns the configured destination path.<p>
098: *
099: * The configured destination path is always relative to the
100: * web application path.<p>
101: *
102: * @return the configured destination path
103: *
104: * @see #getDestinationPath()
105: */
106: public String getConfiguredDestination() {
107:
108: return m_configuredDestination;
109: }
110:
111: /**
112: * Returns the destination path in the "real" file system.<p>
113: *
114: * @return the destination
115: */
116: public String getDestinationPath() {
117:
118: return m_destinationPath;
119: }
120:
121: /**
122: * Returns the uri of the OpenCms VFS folder to write as export point.<p>
123: *
124: * @return the uri
125: */
126: public String getUri() {
127:
128: return m_uri;
129: }
130:
131: /**
132: * @see java.lang.Object#hashCode()
133: */
134: public int hashCode() {
135:
136: return getUri().hashCode();
137: }
138:
139: /**
140: * Sets the configured destination path.<p>
141: *
142: * The configured destination path is always relative to the
143: * web application path.<p>
144: *
145: * This set method will automatically set the destination path as well.<p>
146: *
147: * @param value the configured destination path
148: *
149: */
150: public void setConfiguredDestination(String value) {
151:
152: m_configuredDestination = value;
153: m_destinationPath = OpenCms.getSystemInfo()
154: .getAbsoluteRfsPathRelativeToWebApplication(
155: m_configuredDestination);
156:
157: }
158:
159: /**
160: * Dummy method to expose the destination path as bean property.<p>
161: *
162: * This is required by the {@link org.apache.commons.beanutils.BeanUtils} package in order to
163: * enable using this Object with the digester.<p>
164: *
165: * The method does not actually change the value of the destination path.
166: * Use the <code>{@link #setConfiguredDestination(String)}</code> method instead.
167: *
168: * @param value the destination path (will be ignored)
169: */
170: public void setDestinationPath(String value) {
171:
172: if (value == null) {
173: // check required to avoid "unused parameter" warning
174: }
175: }
176:
177: /**
178: * Sets the uri of the OpenCms VFS folder to write as export point.<p>
179: *
180: * @param value the uri to set
181: */
182: public void setUri(String value) {
183:
184: m_uri = value;
185: }
186:
187: /**
188: * @see java.lang.Object#toString()
189: */
190: public String toString() {
191:
192: return "[" + getClass().getName() + ", uri: " + m_uri
193: + ", destination: " + m_destinationPath + "]";
194: }
195: }
|