KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > j2biz > blogunity > pojo > SystemConfiguration


1 /*
2  * $Id: SystemConfiguration.java,v 1.13 2005/01/08 15:52:28 michelson Exp $
3  *
4  * Copyright (c) 2004 j2biz Group, http://www.j2biz.com
5  * Koeln / Duesseldorf , Germany
6  *
7  * @author Max Kalina
8  *
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23  *
24  */

25
26 package com.j2biz.blogunity.pojo;
27
28 import java.io.ByteArrayInputStream JavaDoc;
29 import java.io.File JavaDoc;
30 import java.io.InputStream JavaDoc;
31 import java.io.Serializable JavaDoc;
32 import java.util.Locale JavaDoc;
33
34 import com.j2biz.blogunity.util.PasswordEncryptionService;
35
36 /**
37  * @hibernate.class table="SYS_CONFIG" dynamic-insert = "true" dynamic-update =
38  * "true"
39  *
40  *
41  * TODO to cache it or not cache?
42  * @@hibernate.cache usage="read-write"
43  *
44  * @author michelson
45  * @version $$
46  * @since 0.1
47  *
48  *
49  */

50 public class SystemConfiguration implements Serializable JavaDoc {
51
52     private static final long serialVersionUID = 3689635791537977654L;
53
54     private Long JavaDoc id;
55
56     private String JavaDoc dataDir;
57
58     private String JavaDoc tempDir;
59
60     // private String renderEngineClass;
61

62     private String JavaDoc velocityProperties;
63
64     private String JavaDoc dateFormat = "d.MM.yyyy";
65
66     private String JavaDoc timeFormat = "HH:mm:ss";
67
68     private String JavaDoc datetimeFormat = "d.MM.yyyy, HH:mm:ss";
69
70     private String JavaDoc siteTitle = "Blogunity";
71
72     private String JavaDoc siteDescription = "Blogunity is a lightweight community blog software.";
73
74     private String JavaDoc siteKeywords = "blogunity, blog, community, java, calendar, diary";
75
76     private int individualBlogsPerUser = -1;
77
78     private int communityBlogsPerUser = -1;
79
80     private int userpicsPerUser = 5;
81
82     /*
83      * default maximal size is 50KB
84      */

85     private int maxUserpicSize = 52700;
86
87     /*
88      * default maximal width is 100px
89      */

90     private int maxUserpicWidth = 100;
91
92     /*
93      * default maximal height is 100px
94      */

95     private int maxUserpicHeight = 100;
96
97     private boolean allowNewUsers = true;
98
99     private boolean validateNewUsers = false;
100
101     private boolean rankingOn = false;
102
103     private boolean themeEditingAllowed = true;
104
105     private boolean accessLoggingEnabled = true;
106
107     private Locale JavaDoc systemLocale = Locale.ENGLISH;
108
109     private String JavaDoc smtpHost;
110
111     private String JavaDoc smtpUser;
112
113     private String JavaDoc smtpPassword;
114
115     private boolean passwordEncriptionEnabled = false;
116
117     private int passwordEncryptionType = PasswordEncryptionService.MD5;
118
119     private File JavaDoc blogsDirectory = null;
120
121     private File JavaDoc usersDirectory = null;
122
123     /**
124      * @hibernate.property name="?asswordEncriptionEnabled"
125      * column="PASSWORD_ENCRIPTION_ENABLED" type="boolean"
126      * not-null="false" unique="true"
127      *
128      * @return
129      */

130     public boolean getPasswordEncriptionEnabled() {
131         return passwordEncriptionEnabled;
132     }
133
134     public boolean isPasswordEncriptionEnabled() {
135         return passwordEncriptionEnabled;
136     }
137
138     public void setPasswordEncriptionEnabled(boolean passwordEncriptionEnabled) {
139         this.passwordEncriptionEnabled = passwordEncriptionEnabled;
140     }
141
142     /**
143      * @hibernate.property name="passwordEncryptionType"
144      * column="PASSWORD_ENCRIPTION_TYPE" type="int"
145      * not-null="false" unique="true"
146      *
147      * @return
148      */

149     public int getPasswordEncryptionType() {
150         return passwordEncryptionType;
151     }
152
153     /**
154      * @param passwordEncryptionType
155      */

156     public void setPasswordEncryptionType(int passwordEncryptionType) {
157         this.passwordEncryptionType = passwordEncryptionType;
158     }
159
160     /**
161      * @hibernate.property name="smtpHost" column="SMTP_HOST" type="string"
162      * not-null="false" unique="true"
163      *
164      * @return
165      */

166     public String JavaDoc getSmtpHost() {
167         return smtpHost;
168     }
169
170     public void setSmtpHost(String JavaDoc smtpHost) {
171         this.smtpHost = smtpHost;
172     }
173
174     /**
175      * @hibernate.property name="smtpPassword" column="SMTP_PASSWORD"
176      * type="string" not-null="false" unique="true"
177      *
178      * @return
179      */

180     public String JavaDoc getSmtpPassword() {
181         return smtpPassword;
182     }
183
184     public void setSmtpPassword(String JavaDoc smtpPassword) {
185         this.smtpPassword = smtpPassword;
186     }
187
188     /**
189      * @hibernate.property name="smtpUser" column="SMTP_USER" type="string"
190      * not-null="false" unique="true"
191      *
192      * @return
193      */

194     public String JavaDoc getSmtpUser() {
195         return smtpUser;
196     }
197
198     public void setSmtpUser(String JavaDoc smtpUser) {
199         this.smtpUser = smtpUser;
200     }
201
202     /**
203      * @hibernate.property name="systemLocale" column="SYSTEM_LOCALE"
204      * type="locale" not-null="true" unique="true"
205      *
206      * @return Returns the value of the system's locale.
207      */

208     public Locale JavaDoc getSystemLocale() {
209         return systemLocale;
210     }
211
212     /**
213      *
214      * @param systemLocale
215      */

216     public void setSystemLocale(Locale JavaDoc systemLocale) {
217         this.systemLocale = systemLocale;
218     }
219
220     /**
221      * @hibernate.property name="accessLoggingEnabled"
222      * column="ACCESS_LOGGING_ENABLED" type="boolean"
223      * not-null="true" unique="true"
224      *
225      * @return boolean
226      *
227      * Returns true, if access logging for blogs is enabled. AccessLog-Files
228      * will be written separatly for each blog in <DATA_DIR>/ <BLOG-NAME>/logs -
229      * directory in Combined-Log-Format.
230      *
231      *
232      * @return
233      */

234     public boolean getAccessLoggingEnabled() {
235         return accessLoggingEnabled;
236     }
237
238     /**
239      * Returns true, if access logging for blogs is enabled. AccessLog-Files
240      * will be written separatly for each blog in <DATA_DIR>/ <BLOG-NAME>/logs -
241      * directory in Combined-Log-Format.
242      *
243      * @return
244      */

245     public boolean isAccessLoggingEnabled() {
246         return accessLoggingEnabled;
247     }
248
249     public void setAccessLoggingEnabled(boolean accessLoggingEnabled) {
250         this.accessLoggingEnabled = accessLoggingEnabled;
251     }
252
253     /**
254      * @hibernate.property name="allowNewUsers" column="ALLOW_NEW_USERS"
255      * type="boolean" not-null="true" unique="false"
256      *
257      * @return boolean
258      * @return Returns the allowNewUsers.
259      */

260     public boolean getAllowNewUsers() {
261         return allowNewUsers;
262     }
263
264     /**
265      * @return Returns the allowNewUsers.
266      */

267     public boolean isAllowNewUsers() {
268         return allowNewUsers;
269     }
270
271     /**
272      * @param allowNewUsers
273      * The allowNewUsers to set.
274      */

275     public void setAllowNewUsers(boolean allowNewUsers) {
276         this.allowNewUsers = allowNewUsers;
277     }
278
279     /**
280      * @hibernate.property name="dataDir" column="DATA_DIR" type="string"
281      * not-null="true" unique="true"
282      *
283      * @return Returns the dataDir.
284      */

285     public String JavaDoc getDataDir() {
286         return dataDir;
287     }
288
289     /**
290      * @param dataDir
291      * The dataDir to set.
292      */

293     public void setDataDir(String JavaDoc dataDir) {
294         this.dataDir = dataDir;
295     }
296
297     /**
298      * Gets the absolute path to the temporary directory, where temporary data
299      * (e.g. file-uploads) will be saved.
300      *
301      *
302      * @hibernate.property name="tempDir" column="TEMP_DIR" type="string"
303      * not-null="true" unique="true"
304      *
305      *
306      * @return returns the absolute path to the temporary directory.
307      */

308     public String JavaDoc getTempDir() {
309         return tempDir;
310     }
311
312     /**
313      * Set the absolute path to the temporary directory, where temporary data
314      * (e.g. file-uploads) will be saved.
315      *
316      * @param tempDir
317      * is a abolute path to the temporary directory.
318      */

319     public void setTempDir(String JavaDoc tempDir) {
320         this.tempDir = tempDir;
321     }
322
323     /**
324      * @hibernate.id generator-class="increment" type="long" column="ID"
325      * unsaved-value="null"
326      *
327      * @return Returns the id.
328      */

329     public Long JavaDoc getId() {
330         return id;
331     }
332
333     /**
334      * @param id
335      * The id to set.
336      */

337     public void setId(Long JavaDoc id) {
338         this.id = id;
339     }
340
341     // /**
342
// * @hibernate.property name="renderEngineClass"
343
// * column="RENDERENGINE_CLASS" type="string"
344
// * not-null="true" unique="true"
345
// *
346
// * @return Returns the renderEngineClass.
347
// */
348
// public String getRenderEngineClass() {
349
// return renderEngineClass;
350
// }
351
//
352
// /**
353
// * @param renderEngineClass
354
// * The renderEngineClass to set.
355
// */
356
// public void setRenderEngineClass(String renderEngineClass) {
357
// this.renderEngineClass = renderEngineClass;
358
// }
359

360     /**
361      * @hibernate.property name="validateNewUsers" column="VALIDATE_NEW_USERS"
362      * type="boolean" not-null="true" unique="true"
363      *
364      * @return Returns the validateNewUsers.
365      */

366     public boolean getValidateNewUsers() {
367         return validateNewUsers;
368     }
369
370     /**
371      * @return Returns the validateNewUsers.
372      */

373     public boolean isValidateNewUsers() {
374         return validateNewUsers;
375     }
376
377     /**
378      * @param validateNewUsers
379      * The validateNewUsers to set.
380      */

381     public void setValidateNewUsers(boolean validateNewUsers) {
382         this.validateNewUsers = validateNewUsers;
383     }
384
385     /**
386      * @return
387      */

388     public InputStream JavaDoc getVelocityPropertiesAsStream() {
389
390         return new ByteArrayInputStream JavaDoc(getVelocityProperties().getBytes());
391
392     }
393
394     /**
395      * @hibernate.property name="velocityProperties"
396      * column="VELOCITY_PROPERTIES" type="text"
397      * not-null="true" unique="false"
398      *
399      * @return Returns the velocityProperties.
400      */

401     public String JavaDoc getVelocityProperties() {
402         return velocityProperties;
403     }
404
405     /**
406      * @param velocityProperties
407      * The velocityProperties to set.
408      */

409     public void setVelocityProperties(String JavaDoc velocityProperties) {
410         this.velocityProperties = velocityProperties;
411     }
412
413     /**
414      * @hibernate.property name="dateFormat" column="DATE_FORMAT" type="string"
415      * not-null="true" unique="true"
416      *
417      * @return Returns the dateFormat.
418      */

419     public String JavaDoc getDateFormat() {
420         return dateFormat;
421     }
422
423     /**
424      * @param dateFormat
425      * The dateFormat to set.
426      */

427     public void setDateFormat(String JavaDoc dateFormat) {
428         this.dateFormat = dateFormat;
429     }
430
431     /**
432      * @hibernate.property name="datetimeFormat" column="DATETIME_FORMAT"
433      * type="string" not-null="true" unique="true"
434      *
435      * @return Returns the datetimeFormat.
436      */

437     public String JavaDoc getDatetimeFormat() {
438         return datetimeFormat;
439     }
440
441     /**
442      * @param datetimeFormat
443      * The datetimeFormat to set.
444      */

445     public void setDatetimeFormat(String JavaDoc datetimeFormat) {
446         this.datetimeFormat = datetimeFormat;
447     }
448
449     /**
450      * @hibernate.property name="timeFormat" column="TIME_FORMAT" type="string"
451      * not-null="true" unique="true"
452      *
453      * @return Returns the timeFormat.
454      */

455     public String JavaDoc getTimeFormat() {
456         return timeFormat;
457     }
458
459     /**
460      * @param timeFormat
461      * The timeFormat to set.
462      */

463     public void setTimeFormat(String JavaDoc timeFormat) {
464         this.timeFormat = timeFormat;
465     }
466
467     /**
468      * @hibernate.property name="siteDescription" column="SITE_DESCRIPTION"
469      * type="text" not-null="false" unique="false"
470      *
471      * @return Returns the siteDescription.
472      */

473     public String JavaDoc getSiteDescription() {
474         return siteDescription;
475     }
476
477     /**
478      * @param siteDescription
479      * The siteDescription to set.
480      */

481     public void setSiteDescription(String JavaDoc siteDescription) {
482         this.siteDescription = siteDescription;
483     }
484
485     /**
486      * @hibernate.property name="siteKeywords" column="SITE_KEYWORDS"
487      * type="text" not-null="false" unique="false"
488      * @return Returns the siteKeywords.
489      */

490     public String JavaDoc getSiteKeywords() {
491         return siteKeywords;
492     }
493
494     /**
495      * @param siteKeywords
496      * The siteKeywords to set.
497      */

498     public void setSiteKeywords(String JavaDoc siteKeywords) {
499         this.siteKeywords = siteKeywords;
500     }
501
502     /**
503      * @hibernate.property name="siteTitle" column="SITE_TITLE" type="string"
504      * not-null="true" unique="true"
505      * @return Returns the siteTitle.
506      */

507     public String JavaDoc getSiteTitle() {
508         return siteTitle;
509     }
510
511     /**
512      * @param siteTitle
513      * The siteTitle to set.
514      */

515     public void setSiteTitle(String JavaDoc siteTitle) {
516         this.siteTitle = siteTitle;
517     }
518
519     /**
520      * @hibernate.property name="communityBlogsPerUser"
521      * column="COMMUNITY_BLOGS_PER_USER" type="integer"
522      * not-null="true" unique="true"
523      *
524      * @return Returns the communityBlogsPerUser.
525      */

526     public int getCommunityBlogsPerUser() {
527         return communityBlogsPerUser;
528     }
529
530     /**
531      * @param communityBlogsPerUser
532      * The communityBlogsPerUser to set.
533      */

534     public void setCommunityBlogsPerUser(int communityBlogsPerUser) {
535         this.communityBlogsPerUser = communityBlogsPerUser;
536     }
537
538     /**
539      * @hibernate.property name="individualBlogsPerUser"
540      * column="INDIVIDUAL_BLOGS_PER_USER" type="integer"
541      * not-null="true" unique="true"
542      * @return Returns the individualBlogsPerUser.
543      */

544     public int getIndividualBlogsPerUser() {
545         return individualBlogsPerUser;
546     }
547
548     /**
549      * @param individualBlogsPerUser
550      * The individualBlogsPerUser to set.
551      */

552     public void setIndividualBlogsPerUser(int individualBlogsPerUser) {
553         this.individualBlogsPerUser = individualBlogsPerUser;
554     }
555
556     /**
557      * @hibernate.property name="userpicsPerUser" column="USERPICS_PER_USER"
558      * type="integer" not-null="true" unique="true"
559      * @return Returns the userpicsPerUser.
560      */

561     public int getUserpicsPerUser() {
562         return userpicsPerUser;
563     }
564
565     /**
566      * @param userpicsPerUser
567      * The userpicsPerUser to set.
568      */

569     public void setUserpicsPerUser(int userpicsPerUser) {
570         this.userpicsPerUser = userpicsPerUser;
571     }
572
573     /**
574      * @hibernate.property name="maxUserpicHeight" column="MAX_USERPIC_HEIGHT"
575      * type="integer" not-null="true" unique="true"
576      * @return
577      */

578     public int getMaxUserpicHeight() {
579         return maxUserpicHeight;
580     }
581
582     /**
583      * @param maxUserpicHeight
584      */

585     public void setMaxUserpicHeight(int maxUserpicHeight) {
586         this.maxUserpicHeight = maxUserpicHeight;
587     }
588
589     /**
590      * @hibernate.property name="maxUserpicSize" column="MAX_USERPIC_SIZE"
591      * type="integer" not-null="true" unique="true"
592      * @return
593      */

594     public int getMaxUserpicSize() {
595         return maxUserpicSize;
596     }
597
598     /**
599      * @param maxUserpicSize
600      */

601     public void setMaxUserpicSize(int maxUserpicSize) {
602         this.maxUserpicSize = maxUserpicSize;
603     }
604
605     /**
606      * @hibernate.property name="maxUserpicWidht" column="MAX_USERPIC_WIDTH"
607      * type="integer" not-null="true" unique="true"
608      * @return
609      */

610     public int getMaxUserpicWidth() {
611         return maxUserpicWidth;
612     }
613
614     /**
615      * @param maxUserpicWidth
616      */

617     public void setMaxUserpicWidth(int maxUserpicWidth) {
618         this.maxUserpicWidth = maxUserpicWidth;
619     }
620
621     /**
622      * @hibernate.property name="rankingOn" column="RANKING_ON" type="boolean"
623      * not-null="true" unique="false"
624      *
625      * @return Returns the rankingOn.
626      */

627     public boolean getRankingOn() {
628         return rankingOn;
629     }
630
631     /**
632      * @return Returns the rankingOn.
633      */

634     public boolean isRankingOn() {
635         return rankingOn;
636     }
637
638     /**
639      * @param rankingOn
640      * The rankingOn to set.
641      */

642     public void setRankingOn(boolean rankingOn) {
643         this.rankingOn = rankingOn;
644     }
645
646     /**
647      * @hibernate.property name="themeEditingAllowed"
648      * column="THEME_EDITING_ALLOWED" type="boolean"
649      * not-null="true" unique="false"
650      *
651      * @return Returns the themeEditingAllowed.
652      */

653     public boolean getThemeEditingAllowed() {
654         return themeEditingAllowed;
655     }
656
657     /**
658      * @return Returns the themeEditingAllowed.
659      */

660     public boolean isThemeEditingAllowed() {
661         return themeEditingAllowed;
662     }
663
664     /**
665      * @param themeEditingAllowed
666      * The themeEditingAllowed to set.
667      */

668     public void setThemeEditingAllowed(boolean themeEditingAllowed) {
669         this.themeEditingAllowed = themeEditingAllowed;
670     }
671
672     /**
673      * Returns the directory where all blog-specific resources are saved.
674      *
675      * @return
676      */

677     public File JavaDoc getBlogsDirectory() {
678         if (blogsDirectory == null) blogsDirectory = new File JavaDoc(dataDir, "blogs");
679         return blogsDirectory;
680     }
681
682     /**
683      * Returns the directory where all user-specific resources are saved.
684      *
685      * @return
686      */

687     public File JavaDoc getUsersDirectory() {
688         if (usersDirectory == null) usersDirectory = new File JavaDoc(dataDir, "users");
689         return usersDirectory;
690     }
691 }
Popular Tags