1 | |
package org.paneris.rimauresq.model; |
2 | |
|
3 | |
import org.paneris.rimauresq.model.generated.SettingTableBase; |
4 | |
import org.melati.poem.DefinitionSource; |
5 | |
import org.melati.poem.Database; |
6 | |
import org.melati.poem.PoemException; |
7 | |
import org.melati.poem.PoemTask; |
8 | |
import org.melati.poem.PoemThread; |
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | |
|
23 | |
|
24 | |
public class SettingTable extends SettingTableBase { |
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | |
public SettingTable( |
36 | |
Database database, String name, |
37 | |
DefinitionSource definitionSource) throws PoemException { |
38 | 4 | super(database, name, definitionSource); |
39 | 4 | } |
40 | |
|
41 | |
|
42 | |
public void postInitialise() { |
43 | 4 | super.postInitialise(); |
44 | 4 | PoemThread.withAccessToken( |
45 | |
getDatabase().getUserTable().administratorUser(), |
46 | |
new PoemTask() { |
47 | |
public void run() { |
48 | 4 | String installationDir = "/dist/rimauresq"; |
49 | 4 | ensure("CVSRoot",installationDir,"CVS Root", |
50 | |
"The directory into which system was checked out from CVS"); |
51 | 4 | ensure("SMTPServer","127.0.0.1","SMTP server", |
52 | |
"The SMTP server for outgoing mail"); |
53 | |
|
54 | 4 | ensure("BoardsAttachmentsPath", installationDir + "/www/attachments", |
55 | |
"Boards attachments Path", |
56 | |
"A directory which will contain one directory " + |
57 | |
"for each board (named after the board) in which " + |
58 | |
"to store attachments for this board " + |
59 | |
"(e.g. /usr/httpd/testapp/board_attachments)"); |
60 | |
|
61 | 4 | ensure("BoardsAttachmentsURL", "/attachments", |
62 | |
"Boards attachments URL", |
63 | |
"A URL to the directory defined by " + |
64 | |
"BoardsAttachmentsPath" + |
65 | |
"(e.g. http://www.testapp.co.uk/board_attachments)"); |
66 | 4 | ensure("BoardsEmailDomain", "wvm.paneris.net", |
67 | |
"localhost", |
68 | |
"The domain which receives mail for this database. " + |
69 | |
"Note that this must be the same as that defined in " + |
70 | |
"smtpServer.properties " + |
71 | |
"(or equivalent, if you set a different name when " + |
72 | |
"starting SMTPServerServlet) "+ |
73 | |
"(e.g. boards.testapp.co.uk)"); |
74 | 4 | ensure("BoardsEmailTemplates", "org/paneris/wvm/boards/emailtemplates", |
75 | |
"Boards email templates", |
76 | |
"The directory containing the templates for " + |
77 | |
"sending out email. " + |
78 | |
"This is relative to WM's TemplatePath " + |
79 | |
"(e.g. testapp/boards/emailtemplates)"); |
80 | 4 | ensure("BoardsSystemURL","/db/board", |
81 | |
"Boards system URL", |
82 | |
"The URL to the BoardAdmin handler for this database " + |
83 | |
" (e.g. http://www.testapp.co.uk/testapp/"+ |
84 | |
"org.paneris.melati.boards.BoardAdmin)"); |
85 | 4 | ensure("BoardsStylesheetURL","/styles/boards.css", |
86 | |
"Stylesheet URL", |
87 | |
"A URL to a stylesheet for all board pages"); |
88 | 4 | ensure("LogicalDatabase","rimauresq", |
89 | |
"Logical database", |
90 | |
"The name of the database " + |
91 | |
"(note this must agree with the entry in " + |
92 | |
"org.melati.LogicalDatabase.properties) eg testdb"); |
93 | 4 | ensure("UploadURL","/fs", |
94 | |
"Upload URL", |
95 | |
"Base reference for uploaded files "); |
96 | 4 | ensure("UploadDir", installationDir + "/www/fs", |
97 | |
"Upload Directory", |
98 | |
"Where in the files system to write uploaded files "); |
99 | |
|
100 | 4 | } |
101 | |
|
102 | 4 | public String toString() { |
103 | 0 | return "Creating default settings"; |
104 | |
} |
105 | |
} |
106 | |
); |
107 | 4 | } |
108 | |
|
109 | |
|
110 | |
|
111 | |
|
112 | |
|
113 | |
|
114 | |
|
115 | |
public org.melati.poem.Setting ensure(String name, String value, |
116 | |
String displayname, String description) { |
117 | 100 | org.melati.poem.Setting p = super.ensure(name, value, displayname, |
118 | |
description); |
119 | 100 | if (p.getValue() == null || p.getValue().equals("")) { |
120 | 0 | p.setValue(value); |
121 | |
} |
122 | 100 | return p; |
123 | |
} |
124 | |
|
125 | |
} |
126 | |
|