Source Code Cross Referenced for MigrateProperties.java in  » Issue-Tracking » scarab-0.21 » org » tigris » scarab » migration » b18b19 » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Issue Tracking » scarab 0.21 » org.tigris.scarab.migration.b18b19 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* ================================================================
002:         * Copyright (c) 2004 CollabNet.  All rights reserved.
003:         * 
004:         * Redistribution and use in source and binary forms, with or without
005:         * modification, are permitted provided that the following conditions are
006:         * met:
007:         * 
008:         * 1. Redistributions of source code must retain the above copyright
009:         * notice, this list of conditions and the following disclaimer.
010:         * 
011:         * 2. Redistributions in binary form must reproduce the above copyright
012:         * notice, this list of conditions and the following disclaimer in the
013:         * documentation and/or other materials provided with the distribution.
014:         * 
015:         * 3. The end-user documentation included with the redistribution, if
016:         * any, must include the following acknowlegement: "This product includes
017:         * software developed by Collab.Net <http://www.Collab.Net/>."
018:         * Alternately, this acknowlegement may appear in the software itself, if
019:         * and wherever such third-party acknowlegements normally appear.
020:         * 
021:         * 4. The hosted project names must not be used to endorse or promote
022:         * products derived from this software without prior written
023:         * permission. For written permission, please contact info@collab.net.
024:         * 
025:         * 5. Products derived from this software may not use the "Tigris" or 
026:         * "Scarab" names nor may "Tigris" or "Scarab" appear in their names without 
027:         * prior written permission of Collab.Net.
028:         * 
029:         * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
030:         * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
031:         * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
032:         * IN NO EVENT SHALL COLLAB.NET OR ITS CONTRIBUTORS BE LIABLE FOR ANY
033:         * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
034:         * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
035:         * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
036:         * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
037:         * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
038:         * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
039:         * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
040:         *
041:         * ====================================================================
042:         * 
043:         * This software consists of voluntary contributions made by many
044:         * individuals on behalf of Collab.Net.
045:         */
046:        package org.tigris.scarab.migration.b18b19;
047:
048:        import java.io.BufferedOutputStream;
049:        import java.io.FileOutputStream;
050:        import java.io.IOException;
051:        import java.io.PrintWriter;
052:        import java.io.Writer;
053:
054:        import org.apache.tools.ant.BuildException;
055:        import org.apache.tools.ant.Task;
056:
057:        public class MigrateProperties extends Task {
058:            //
059:            // Need to initialise this so that we have an object to lock on.
060:            //
061:            private static String[] propertyMap = new String[0];
062:
063:            static {
064:                synchronized (propertyMap) {
065:                    if (propertyMap.length == 0) {
066:                        //
067:                        // This array maps the old properties (source) to the new
068:                        // ones (target), where the first of each pair is the target
069:                        // and the second is the source.
070:                        //
071:                        // Some of the source properties have a '+' character in them
072:                        // - this means that the text following the '+' should be
073:                        // appended to the property value before being assigned to the
074:                        // target property.
075:                        //
076:                        propertyMap = new String[] {
077:                                // Target prop.          Source prop.
078:
079:                                // Scarab.properties
080:                                "scarab.site.name",
081:                                "scarab.site.name",
082:                                "scarab.http.domain",
083:                                "scarab.http.domain",
084:                                "scarab.http.scheme",
085:                                "scarab.http.scheme",
086:                                "scarab.http.scriptname",
087:                                "scarab.http.scriptname",
088:                                "scarab.http.port",
089:                                "scarab.http.port",
090:                                "scarab.automatic.role.approval",
091:                                "scarab.automatic.role.approval",
092:                                "scarab.timezone",
093:                                "scarab.timezone",
094:                                "scarab.email.encoding",
095:                                "scarab.email.encoding",
096:                                "scarab.email.default.fromName",
097:                                "scarab.email.default.fromName",
098:                                "scarab.email.default.fromAddress",
099:                                "scarab.email.default.fromAddress",
100:                                "scarab.register.email.checkValidA",
101:                                "scarab.register.email.checkValidA",
102:                                "scarab.register.email.badEmails",
103:                                "scarab.register.email.badEmails",
104:                                "scarab.email.register.fromName",
105:                                "scarab.email.register.fromName",
106:                                "scarab.email.register.fromAddress",
107:                                "scarab.email.register.fromAddress",
108:                                "scarab.email.forgotpassword.fromName",
109:                                "scarab.email.forgotpassword.fromName",
110:                                "scarab.email.forgotpassword.fromAddress",
111:                                "scarab.email.forgotpassword.fromAddress",
112:                                "scarab.attachments.repository",
113:                                "scarab.attachments.path",
114:                                "searchindex.path",
115:                                "scarab.lucene.index.path",
116:                                "services.TorqueService.classname",
117:                                "scarab.torque.service",
118:                                "services.DatabaseInitializer.classname",
119:                                "scarab.dbinit.service",
120:                                "torque.managed_class.org.tigris.scarab.om.Module.manager",
121:                                "scarab.module.service",
122:                                "torque.managed_class.org.tigris.scarab.om.ScarabUser.manager",
123:                                "scarab.user.service",
124:                                "scarab.dataexport.encoding",
125:                                "scarab.dataexport.encoding",
126:
127:                                // TurbineResources.properties
128:                                "turbine.mode",
129:                                "scarab.mode",
130:                                "template.homepage",
131:                                "scarab.homepage",
132:                                "session.timeout",
133:                                "scarab.session.timeout",
134:                                "system.mail.host",
135:                                "scarab.system.mail.host",
136:                                "services.LocalizationService.locale.default.language",
137:                                "scarab.locale.default.language",
138:                                "services.LocalizationService.locale.default.country",
139:                                "scarab.locale.default.country",
140:                                "services.UploadService.repository",
141:                                "scarab.file.upload.path",
142:                                "services.UploadService.size.max",
143:                                "scarab.file.max.size",
144:                                "resolver.cache.template",
145:                                "scarab.template.cache",
146:                                "resolver.cache.module",
147:                                "scarab.template.cache",
148:                                "services.VelocityService.file.resource.loader.cache",
149:                                "scarab.template.cache",
150:                                "services.EmailService.file.resource.loader.cache",
151:                                "scarab.template.cache",
152:                                "services.VelocityService.file.resource.loader.path",
153:                                "template.path+/templates",
154:                                "services.EmailService.file.resource.loader.path",
155:                                "template.path+/templates",
156:                                "module.packages",
157:                                "scarab.module.packages",
158:
159:                                "services.LocalizationService.classname",
160:                                "scarab.localization.service",
161:                                "torque.manager.useCache",
162:                                "scarab.torque.manager.cache",
163:                                "action.sessionvalidator",
164:                                "scarab.sessionvalidator",
165:                                "pipeline.default.descriptor",
166:                                "scarab.default.pipeline.descriptor",
167:                                "exceptionHandler.default",
168:                                "scarab.request.error.handler",
169:                                "services.PullService.tool.request.link",
170:                                "scarab.pull.link",
171:                                "services.PullService.tool.request.staticLink",
172:                                "scarab.pull.staticlink",
173:                                "services.SecurityService.user.manager",
174:                                "scarab.security.user.manager",
175:                                "services.IntakeService.serialize.path",
176:                                "scarab.intake.serialize.file",
177:
178:                                "log4j.category.default",
179:                                "scarab.log.level.turbine+, turbine",
180:                                "log4j.category.org.tigris.scarab",
181:                                "scarab.log.level.scarab+, scarab",
182:                                "log4j.appender.scarab.file",
183:                                "scarab.log.file.scarab",
184:                                "log4j.appender.scarab.layout.conversionPattern",
185:                                "scarab.log.pattern",
186:                                "log4j.appender.scarab.append",
187:                                "scarab.log.append.scarab",
188:                                "log4j.category.org.tigris.scarab.util.xmlissues",
189:                                "scarab.log.level.scarabxmlimport+, scarabxmlimport",
190:                                "log4j.appender.scarabxmlimport.file",
191:                                "scarab.log.file.scarabxmlimport",
192:                                "log4j.appender.scarabxmlimport.layout.conversionPattern",
193:                                "scarab.log.pattern",
194:                                "log4j.appender.scarabxmlimport.append",
195:                                "scarab.log.append.scarabxmlimport",
196:                                "log4j.category.org.apache.turbine",
197:                                "scarab.log.level.turbine+, turbine",
198:                                "log4j.appender.turbine.file",
199:                                "scarab.log.file.turbine",
200:                                "log4j.appender.turbine.layout.conversionPattern",
201:                                "scarab.log.pattern",
202:                                "log4j.appender.turbine.append",
203:                                "scarab.log.append.turbine",
204:                                "log4j.category.org.apache.torque",
205:                                "scarab.log.level.torque+, torque",
206:                                "log4j.appender.torque.file",
207:                                "scarab.log.file.torque",
208:                                "log4j.appender.torque.layout.conversionPattern",
209:                                "scarab.log.pattern",
210:                                "log4j.appender.torque.append",
211:                                "scarab.log.append.torque",
212:                                "log4j.category.org.apache.fulcrum",
213:                                "scarab.log.level.fulcrum+, services",
214:                                "log4j.appender.services.file",
215:                                "scarab.log.file.fulcrum",
216:                                "log4j.appender.services.layout.conversionPattern",
217:                                "scarab.log.pattern",
218:                                "log4j.appender.services.append",
219:                                "scarab.log.append.fulcrum",
220:                                "log4j.category.org.apache.stratum",
221:                                "scarab.log.level.stratum+, stratum",
222:                                "log4j.appender.stratum.file",
223:                                "scarab.log.file.stratum",
224:                                "log4j.appender.stratum.layout.conversionPattern",
225:                                "scarab.log.pattern",
226:                                "log4j.appender.stratum.append",
227:                                "scarab.log.append.stratum",
228:                                "log4j.category.org.apache.jcs",
229:                                "scarab.log.level.jcs+, jcs",
230:                                "log4j.appender.jcs.file",
231:                                "scarab.log.file.jcs",
232:                                "log4j.appender.jcs.layout.conversionPattern",
233:                                "scarab.log.pattern",
234:                                "log4j.appender.jcs.append",
235:                                "scarab.log.append.jcs",
236:                                "log4j.category.org.apache.fulcrum.db",
237:                                "scarab.log.level.torque+, torque",
238:                                "log4j.category.org.apache.commons",
239:                                "scarab.log.level.turbine+, turbine",
240:                                "log4j.category.org.apache.commons.beanutils",
241:                                "scarab.log.level.beanutils+, turbine",
242:                                "log4j.category.org.apache.velocity",
243:                                "scarab.log.level.velocity+, velocity",
244:                                "log4j.appender.velocity.file",
245:                                "scarab.log.file.velocity",
246:                                "log4j.appender.velocity.layout.conversionPattern",
247:                                "scarab.log.pattern",
248:                                "log4j.appender.velocity.append",
249:                                "scarab.log.append.velocity" };
250:                    }
251:                }
252:            }
253:
254:            private String outputFile = "CustomSettings.properties";
255:
256:            public void execute() throws BuildException {
257:                PrintWriter writer = null;
258:                try {
259:                    //
260:                    // Open the output file for writing.
261:                    //
262:                    writer = new PrintWriter(new BufferedOutputStream(
263:                            new FileOutputStream(this .outputFile)));
264:
265:                    //
266:                    // Now iterate through each property in the map, check whether it
267:                    // exists within the ant properties, and if so add it to the output
268:                    // file.
269:                    //
270:                    for (int i = 0; i < propertyMap.length; i += 2) {
271:                        //
272:                        // Work out the name of the ant property associated with
273:                        // this output property. The value from the map may contain
274:                        // a '+' character which separates the ant property name
275:                        // from the string that should be appended to its value
276:                        // when it is written to the output file.
277:                        //
278:                        String outProperty = propertyMap[i];
279:                        String inProperty = propertyMap[i + 1];
280:                        String appendString = "";
281:                        int splitPos = inProperty.indexOf('+');
282:                        if (splitPos >= 0) {
283:                            appendString = inProperty.substring(splitPos + 1);
284:                            inProperty = inProperty.substring(0, splitPos);
285:                        }
286:
287:                        String antPropertyValue = getProject().getProperty(
288:                                inProperty);
289:                        if (antPropertyValue != null) {
290:                            //
291:                            // The ant property may contain a '=' character due
292:                            // to the way the property has been set up to work
293:                            // with filtered copies. In these cases, only the
294:                            // part of the value after the '=' needs to be written
295:                            // to the output file.
296:                            //
297:                            splitPos = antPropertyValue.indexOf('=');
298:                            if (splitPos >= 0) {
299:                                antPropertyValue = antPropertyValue
300:                                        .substring(splitPos + 1);
301:                            }
302:
303:                            //
304:                            // Now we have all the information we need, so write the
305:                            // property to the output file.
306:                            //
307:                            writer.println(outProperty + '=' + antPropertyValue
308:                                    + appendString);
309:                        }
310:                    }
311:                } catch (IOException ex) {
312:                    throw new BuildException(ex);
313:                } finally {
314:                    writer.close();
315:                }
316:            }
317:
318:            public void setOutput(String filename) {
319:                this.outputFile = filename;
320:            }
321:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.