rename local path to base path
[jSite2.git] / src / net / pterodactylus / jsite / core / Project.java
1 /*
2  * jSite2 - Project.java -
3  * Copyright © 2008 David Roden
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18  */
19
20 package net.pterodactylus.jsite.core;
21
22 import java.beans.PropertyChangeListener;
23
24 import net.pterodactylus.util.beans.AbstractBean;
25
26 /**
27  * Container for project information. A Project is capable of notifying
28  * {@link PropertyChangeListener}s if any of the contained properties change.
29  * 
30  * @author David ‘Bombe’ Roden <bombe@freenetproject.org>
31  * @version $Id$
32  */
33 public class Project extends AbstractBean {
34
35         /** Name of the “name” property. */
36         public static final String PROPERTY_NAME = "name";
37
38         /** Name of the “description” property. */
39         public static final String PROPERTY_DESCRIPTION = "description";
40
41         /** Name of the “public key” property. */
42         public static final String PROPERTY_PUBLIC_KEY = "publicKey";
43
44         /** Name of the “private key” property. */
45         public static final String PROPERTY_PRIVATE_KEY = "privateKey";
46
47         /** Name of the “local path” property. */
48         public static final String PROPERTY_LOCAL_PATH = "localPath";
49
50         /** The name of the project. */
51         private String name;
52
53         /** The description of the project. */
54         private String description;
55
56         /** The public key. */
57         private String publicKey;
58
59         /** The private key. */
60         private String privateKey;
61
62         /** The base path of the project. */
63         private String basePath;
64
65         //
66         // EVENT MANAGEMENT
67         //
68
69         /**
70          * Returns the name of the project.
71          * 
72          * @return The name of the project
73          */
74         public String getName() {
75                 return name;
76         }
77
78         /**
79          * Sets the name of the project.
80          * 
81          * @param name
82          *            The name of the project
83          */
84         public void setName(String name) {
85                 String oldName = this.name;
86                 this.name = name;
87                 if (!equal(oldName, name)) {
88                         firePropertyChange(PROPERTY_NAME, oldName, name);
89                 }
90         }
91
92         /**
93          * Returns the description of the project.
94          * 
95          * @return The description of the project
96          */
97         public String getDescription() {
98                 return description;
99         }
100
101         /**
102          * Sets the description of the project
103          * 
104          * @param description
105          *            The description of the project
106          */
107         public void setDescription(String description) {
108                 String oldDescription = this.description;
109                 this.description = description;
110                 if (!equal(oldDescription, description)) {
111                         firePropertyChange(PROPERTY_DESCRIPTION, oldDescription, description);
112                 }
113         }
114
115         /**
116          * Returns the public key of the project.
117          * 
118          * @return The public key of the project
119          */
120         public String getPublicKey() {
121                 return publicKey;
122         }
123
124         /**
125          * Sets the public key of the project.
126          * 
127          * @param publicKey
128          *            The public key of the project
129          */
130         public void setPublicKey(String publicKey) {
131                 String oldPublicKey = this.publicKey;
132                 this.publicKey = publicKey;
133                 if (!equal(oldPublicKey, publicKey)) {
134                         firePropertyChange(PROPERTY_PUBLIC_KEY, oldPublicKey, publicKey);
135                 }
136         }
137
138         /**
139          * Returns the private key of the project.
140          * 
141          * @return The private key of the project
142          */
143         public String getPrivateKey() {
144                 return privateKey;
145         }
146
147         /**
148          * Sets the private key of the project.
149          * 
150          * @param privateKey
151          *            The private key of the project
152          */
153         public void setPrivateKey(String privateKey) {
154                 String oldPrivateKey = this.privateKey;
155                 this.privateKey = privateKey;
156                 if (!equal(oldPrivateKey, privateKey)) {
157                         firePropertyChange(PROPERTY_PRIVATE_KEY, oldPrivateKey, privateKey);
158                 }
159         }
160
161         /**
162          * Returns the base path of the project.
163          * 
164          * @return The base path of the project
165          */
166         public String getBasePath() {
167                 return basePath;
168         }
169
170         /**
171          * Sets the base path of the project.
172          * 
173          * @param basePath
174          *            The base path of the project
175          */
176         public void setBasePath(String basePath) {
177                 String oldBasePath = this.basePath;
178                 this.basePath = basePath;
179                 firePropertyChange(PROPERTY_LOCAL_PATH, oldBasePath, basePath);
180         }
181
182 }