Source Code Cross Referenced for ImportMvnForum.java in  » Forum » mvnforum-1.1 » com » mvnforum » admin » importexport » mvnforum » 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 » Forum » mvnforum 1.1 » com.mvnforum.admin.importexport.mvnforum 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         * $Header: /cvsroot/mvnforum/mvnforum/src/com/mvnforum/admin/importexport/mvnforum/ImportMvnForum.java,v 1.15 2007/06/22 09:08:30 hau_mvn Exp $
0003:         * $Author: hau_mvn $
0004:         * $Revision: 1.15 $
0005:         * $Date: 2007/06/22 09:08:30 $
0006:         *
0007:         * ====================================================================
0008:         *
0009:         * Copyright (C) 2002-2007 by MyVietnam.net
0010:         *
0011:         * All copyright notices regarding mvnForum MUST remain 
0012:         * intact in the scripts and in the outputted HTML.
0013:         * The "powered by" text/logo with a link back to
0014:         * http://www.mvnForum.com and http://www.MyVietnam.net in 
0015:         * the footer of the pages MUST remain visible when the pages
0016:         * are viewed on the internet or intranet.
0017:         *
0018:         * This program is free software; you can redistribute it and/or modify
0019:         * it under the terms of the GNU General Public License as published by
0020:         * the Free Software Foundation; either version 2 of the License, or
0021:         * any later version.
0022:         *
0023:         * This program is distributed in the hope that it will be useful,
0024:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
0025:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0026:         * GNU General Public License for more details.
0027:         *
0028:         * You should have received a copy of the GNU General Public License
0029:         * along with this program; if not, write to the Free Software
0030:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
0031:         *
0032:         * Support can be obtained from support forums at:
0033:         * http://www.mvnForum.com/mvnforum/index
0034:         *
0035:         * Correspondence and Marketing Questions can be sent to:
0036:         * info at MyVietnam net
0037:         *
0038:         * @author: Igor Manic   
0039:         */
0040:        package com.mvnforum.admin.importexport.mvnforum;
0041:
0042:        import java.io.*;
0043:        import java.util.Calendar;
0044:        import java.util.zip.ZipEntry;
0045:        import java.util.zip.ZipInputStream;
0046:
0047:        import javax.servlet.http.HttpServletRequest;
0048:        import javax.servlet.http.HttpServletResponse;
0049:
0050:        import com.mvnforum.MVNForumConfig;
0051:        import com.mvnforum.MVNForumGlobal;
0052:        import com.mvnforum.admin.ImportWebHelper;
0053:        import com.mvnforum.admin.importexport.SetParentRule;
0054:        import net.myvietnam.mvncore.exception.*;
0055:        import org.apache.commons.digester.Digester;
0056:        import org.apache.commons.logging.Log;
0057:        import org.apache.commons.logging.LogFactory;
0058:        import org.xml.sax.SAXException;
0059:
0060:        /**
0061:         * @author Igor Manic
0062:         * @version $Revision: 1.15 $, $Date: 2007/06/22 09:08:30 $
0063:         * <br/>
0064:         * <code>ImportMvnForum</code> class encapsulates processing
0065:         * of MVN Forum's XML or ZIP backups, and imports all the data into MVN Forum.
0066:         * For details see {@link #importXml(File, HttpServletRequest, HttpServletResponse, int, String, Calendar, String, boolean, int)}
0067:         * and {@link #importZip(File, HttpServletRequest, HttpServletResponse, int, String, Calendar, String, boolean, int)}
0068:         * <br/>
0069:         * This class cannot be instantiated.
0070:         */
0071:        public class ImportMvnForum extends ImportWebHelper {
0072:
0073:            /** Message log. */
0074:            private static Log log = LogFactory.getLog(ImportMvnForum.class);
0075:
0076:            /** Cannot instantiate. */
0077:            private ImportMvnForum() {
0078:            }
0079:
0080:            // =================================================================
0081:            // ===================== MAIN PUBLIC METHODS =======================
0082:            // =================================================================
0083:            /**
0084:             * This method performs processing of MVN Forum's XML backup file <code>importFile</code>
0085:             * and imports the data into the MVN Forum system. It clears the database
0086:             * and files, does neccessary setup (including startup of message output),
0087:             * and calls {@link #processXml(File, Calendar)} to do actual processing.<br/>
0088:             *
0089:             * @param importFile MVN Forum XML backup file to be imported.
0090:             * @param request Current session's <code>HttpServletRequest</code> object.
0091:             * @param response Current session's <code>HttpServletResponse</code> object.
0092:             * @param logonMemberID MemberID of user who is logged in, and who initiated import process.
0093:             * @param logonMemberName MemberName of user who is logged in, and who initiated import process.
0094:             * @param importTime The moment when import process was started.
0095:             * @param importIP From this IP address admin requested import.
0096:             * @param clearIfError Should it clear/reset the database in case of error.
0097:             * @param messageLevel What messages should be written to output during the process.
0098:             *                     For details see {@link com.mvnforum.MVNForumConfig#MESSAGE_LEVEL_ALL_MESSAGES},
0099:             *                     {@link com.mvnforum.MVNForumConfig#MESSAGE_LEVEL_IMPORTANT_MESSAGES} and
0100:             *                     {@link com.mvnforum.MVNForumConfig#MESSAGE_LEVEL_ONLY_ERRORS}.
0101:             *
0102:             * @exception ImportException If there is an error during the process. See {@link net.myvietnam.mvncore.exception.ImportException}.
0103:             */
0104:            public static void importXml(File importFile,
0105:                    HttpServletRequest request, HttpServletResponse response,
0106:                    int logonMemberID, String logonMemberName,
0107:                    Calendar importTime, String importIP, boolean clearIfError,
0108:                    int messageLevel) throws ImportException {
0109:                try {
0110:                    response.setContentType("text/html; charset=utf-8");
0111:                    setOutputHtmlWriter(response.getWriter());
0112:                    setMessageOutputLevel(messageLevel);
0113:                    startHtml(request);
0114:                    clearDatabase();
0115:                    clearFiles(request.getSession().getServletContext());
0116:                } catch (DatabaseException e) {
0117:                    handleFatalError(
0118:                            "Database error while clearing previous contents.",
0119:                            e, clearIfError, request);
0120:                } catch (IOException e) {
0121:                    handleFatalError(
0122:                            "I/O error while clearing previous contents.", e,
0123:                            clearIfError, request);
0124:                }
0125:
0126:                try {
0127:                    processXml(importFile, importTime);
0128:                    handleSuccess(request);
0129:                } catch (ImportException e) {
0130:                    handleFatalError(e.getMessage(), e.getException(),
0131:                            clearIfError, request);
0132:                } catch (IOException e) {
0133:                    handleFatalError("I/O error while reading XML file.", e,
0134:                            clearIfError, request);
0135:                } catch (SAXException e) {
0136:                    if (e.getException() == null) {
0137:                        handleFatalError(
0138:                                "Error while parsing uploaded XML file.", e,
0139:                                clearIfError, request);
0140:                    } else {
0141:                        handleFatalError(
0142:                                "Error while parsing uploaded XML file. Detail: "
0143:                                        + e.getException().getMessage(), e
0144:                                        .getException(), clearIfError, request);
0145:                    }
0146:                } finally {
0147:                    /* Don't delete this XML since this method was maybe started from the
0148:                     * command-line, which means this file is not temporary (uploaded)
0149:                     * //if ((importFile!=null) && (importFile.exists())) importFile.delete();
0150:                     * Anyway, if neccessary, this XML will be deleted in calling WebHandler
0151:                     */
0152:                }
0153:            }
0154:
0155:            /**
0156:             * This method performs processing of MVN Forum's ZIP backup file <code>importFile</code>
0157:             * and imports the data into the MVN Forum system. It clears the database
0158:             * and files, does neccessary setup (including startup of message output),
0159:             * extracts the files from ZIP, and calls {@link #processXml(File, Calendar)}
0160:             * to do actual processing of the main XML file (found in ZIP).<br/>
0161:             *
0162:             * @param importFile MVN Forum ZIP backup file to be imported.
0163:             * @param request Current session's <code>HttpServletRequest</code> object.
0164:             * @param response Current session's <code>HttpServletResponse</code> object.
0165:             * @param logonMemberID MemberID of user who is logged in, and who initiated import process.
0166:             * @param logonMemberName MemberName of user who is logged in, and who initiated import process.
0167:             * @param importTime The moment when import process was started.
0168:             * @param importIP From this IP address admin requested import.
0169:             * @param clearIfError If <code>true</code>, the database will be cleared/reset
0170:             *                     in case of error rises during the import. Default <code>Guest</code>
0171:             *                     and <code>Admin</code> users will be created.
0172:             * @param messageLevel What amount of messages (informational, important, error)
0173:             *                     will be written to output.
0174:             *
0175:             * @exception ImportException If there is an error during the process. See {@link net.myvietnam.mvncore.exception.ImportException}.
0176:             */
0177:            public static void importZip(File importFile,
0178:                    HttpServletRequest request, HttpServletResponse response,
0179:                    int logonMemberID, String logonMemberName,
0180:                    Calendar importTime, String importIP, boolean clearIfError,
0181:                    int messageLevel) throws ImportException {
0182:                File importXml = null;
0183:                try {
0184:                    response.setContentType("text/html; charset=utf-8");
0185:                    setOutputHtmlWriter(response.getWriter());
0186:                    setMessageOutputLevel(messageLevel);
0187:                    startHtml(request);
0188:                    clearDatabase();
0189:                    clearFiles(request.getSession().getServletContext());
0190:                } catch (DatabaseException e) {
0191:                    handleFatalError(
0192:                            "Database error while clearing previous contents.",
0193:                            e, clearIfError, request);
0194:                } catch (IOException e) {
0195:                    handleFatalError(
0196:                            "I/O error while clearing previous contents.", e,
0197:                            clearIfError, request);
0198:                }
0199:
0200:                /* Now extract ZIP file into mvnForumHome, and give me back only XML file.
0201:                 * IMPORTANT: DON'T CALL clearFiles() AFTER THE EXTRACTION OF THE ZIP!
0202:                 * Otherwise, all extracted files will be deleted too
0203:                 */
0204:                try {
0205:                    addImportantMessage("Extracting the ZIP file.");
0206:                    importXml = extractImportZip(importFile, request);
0207:                    if (importXml == null) {
0208:                        handleFatalError(
0209:                                "Error while extracting the file: can't find IMPORT.xml in ZIP file.",
0210:                                null/*error*/, clearIfError, request);
0211:                    }
0212:                } catch (IOException e) {
0213:                    handleFatalError("I/O error while extracting the file.", e,
0214:                            clearIfError, request);
0215:                } finally {
0216:                    importFile.delete();
0217:                    importFile = null;
0218:                }
0219:
0220:                //from this point on, use only importXml file (importFile is deleted)
0221:                try {
0222:                    processXml(importXml, importTime);
0223:                    handleSuccess(request);
0224:                } catch (ImportException e) {
0225:                    handleFatalError(e.getMessage(), e.getException(),
0226:                            clearIfError, request);
0227:                } catch (IOException e) {
0228:                    handleFatalError("I/O error while reading XML file.", e,
0229:                            clearIfError, request);
0230:                } catch (SAXException e) {
0231:                    if (e.getException() == null) {
0232:                        handleFatalError(
0233:                                "Error while parsing uploaded XML file.", e,
0234:                                clearIfError, request);
0235:                    } else {
0236:                        handleFatalError(
0237:                                "Error while parsing uploaded XML file. Detail: "
0238:                                        + e.getException().getMessage(), e
0239:                                        .getException(), clearIfError, request);
0240:                    }
0241:                } finally {
0242:                    //now delete temporary XML file (extracted from ZIP, and already imported to database)
0243:                    if ((importFile != null) && (importFile.exists()))
0244:                        importFile.delete();
0245:                    if ((importXml != null) && (importXml.exists()))
0246:                        importXml.delete();
0247:                }
0248:            }
0249:
0250:            /**
0251:             * This method should unpack the zip into mvnForumHome.
0252:             * It should also return importXml file (which was also extracted)
0253:             */
0254:            private static File extractImportZip(File importZipFile,
0255:                    HttpServletRequest request) throws IOException {
0256:                String avatarsDir = request.getSession().getServletContext()
0257:                        .getRealPath(MVNForumGlobal.UPLOADED_AVATAR_DIR);
0258:                String attachsDir = MVNForumConfig.getAttachmentDir();
0259:                String mvnForumHomeDir = MVNForumConfig.getMVNForumHome();
0260:                if (!new File(avatarsDir).mkdirs()) {
0261:                    /* Ignore, since this error will also happen when the directory
0262:                     * already exists, which is probably the case here, since we
0263:                     * didn't remove it in clearFiles() process.
0264:                     */
0265:                }
0266:                if (!new File(attachsDir).mkdirs()) {
0267:                    /* Ignore, since this error will also happen when the directory
0268:                     * already exists, which is probably the case here, since we
0269:                     * didn't remove it in clearFiles() process.
0270:                     */
0271:                }
0272:                if (!avatarsDir.endsWith(File.separator))
0273:                    avatarsDir += File.separator;
0274:                if (!attachsDir.endsWith(File.separator))
0275:                    attachsDir += File.separator;
0276:                if (!mvnForumHomeDir.endsWith(File.separator))
0277:                    mvnForumHomeDir += File.separator;
0278:
0279:                ZipInputStream zipInputStream = new ZipInputStream(
0280:                        new FileInputStream(importZipFile));
0281:                File foundXmlFile = null;
0282:                while (true) {
0283:                    // Get the next ZIP entry.  Break out of the loop if there are no more.
0284:                    ZipEntry zipEntry = zipInputStream.getNextEntry();
0285:                    if (zipEntry == null)
0286:                        break;
0287:                    // Read data from the ZIP entry.  The read() method will return -1 when there are no more data to read.
0288:                    String srcName = zipEntry.getName();
0289:                    String destPath = mvnForumHomeDir + srcName; //temp value; it'll be changed
0290:                    //for directory name comparisons, don't use String.startsWith() since it doesn't ignore char case (and we need that)
0291:                    if ((srcName.length() >= MVNForumConfig.BACKUP_FILE_AvatarsDirNameInZip
0292:                            .length())
0293:                            && (srcName
0294:                                    .substring(
0295:                                            0,
0296:                                            MVNForumConfig.BACKUP_FILE_AvatarsDirNameInZip
0297:                                                    .length())
0298:                                    .equalsIgnoreCase(MVNForumConfig.BACKUP_FILE_AvatarsDirNameInZip))) {
0299:                        //addImportantMessage("Extracting \""+MVNForumConfig.BACKUP_FILE_AvatarsDirNameInZip+"\" from the backup ZIP file.");
0300:                        try {
0301:                            String this Avatar = srcName
0302:                                    .substring(
0303:                                            MVNForumConfig.BACKUP_FILE_AvatarsDirNameInZip
0304:                                                    .length(), srcName.length());
0305:                            //now calculate destPath, but ignore avatarsDir itself, since it's already created
0306:                            if (this Avatar.length() <= 0)
0307:                                destPath = null;
0308:                            else
0309:                                destPath = avatarsDir
0310:                                        + this Avatar.replace('/',
0311:                                                File.separatorChar);
0312:                        } catch (StringIndexOutOfBoundsException e) {
0313:                            //it's probably the "AVATARS/" entry itself, so thisAvatar is empty
0314:                            destPath = null;
0315:                        }
0316:                    } else if ((srcName.length() >= MVNForumConfig.BACKUP_FILE_AttachsDirNameInZip
0317:                            .length())
0318:                            && (srcName
0319:                                    .substring(
0320:                                            0,
0321:                                            MVNForumConfig.BACKUP_FILE_AttachsDirNameInZip
0322:                                                    .length())
0323:                                    .equalsIgnoreCase(MVNForumConfig.BACKUP_FILE_AttachsDirNameInZip))) {
0324:                        //addImportantMessage("Extracting \""+MVNForumConfig.BACKUP_FILE_AttachsDirNameInZip+"\" from the backup ZIP file.");
0325:                        try {
0326:                            String this Attach = srcName
0327:                                    .substring(
0328:                                            MVNForumConfig.BACKUP_FILE_AttachsDirNameInZip
0329:                                                    .length(), srcName.length());
0330:                            //now calculate destPath, but ignore attachsDir itself, since it's already created
0331:                            if (this Attach.length() <= 0)
0332:                                destPath = null;
0333:                            else
0334:                                destPath = attachsDir
0335:                                        + this Attach.replace('/',
0336:                                                File.separatorChar);
0337:                        } catch (StringIndexOutOfBoundsException e) {
0338:                            //it's probably the "ATTACHMENTS/" entry itself, so thisAttach is empty
0339:                            destPath = null;
0340:                        }
0341:                    } else {
0342:                        //it isn't neither avatar nor attachment, so don't process/replace path
0343:                        destPath = mvnForumHomeDir
0344:                                + srcName.replace('/', File.separatorChar);
0345:                    }
0346:                    if ((destPath != null) && (destPath.length() > 0)) {
0347:                        File destFile = new File(destPath);
0348:                        if (zipEntry.isDirectory()) {
0349:                            addMessage("Extracting directory \"" + srcName
0350:                                    + "\".");
0351:                            destFile.mkdirs();
0352:                        } else {
0353:                            addMessage("Extracting file \"" + srcName
0354:                                    + "\", size=" + zipEntry.getSize() + ".");
0355:                            FileOutputStream outStream = new FileOutputStream(
0356:                                    destFile);
0357:                            byte[] buffer = new byte[1024];
0358:                            int n;
0359:                            while ((n = zipInputStream.read(buffer)) > 0) {
0360:                                outStream.write(buffer, 0, n);
0361:                            }
0362:                            outStream.close();
0363:                            outStream = null;
0364:                            if (srcName
0365:                                    .equalsIgnoreCase(MVNForumConfig.BACKUP_FILE_MainXmlFileNameInZip)
0366:                                    || srcName
0367:                                            .equalsIgnoreCase("/"
0368:                                                    + MVNForumConfig.BACKUP_FILE_MainXmlFileNameInZip)) {
0369:                                foundXmlFile = destFile;
0370:                            }
0371:                        }
0372:                    }
0373:                    zipInputStream.closeEntry();
0374:                }
0375:                zipInputStream.close();
0376:                return foundXmlFile;
0377:                //this method doesn't matter if IMPORT.xml doesn't exist - it will return null, and
0378:                //the caller method should decide what to do then
0379:            }
0380:
0381:            // =================================================================
0382:            // ================== MAIN PROCESSING XML METHOD ===================
0383:            // =================================================================
0384:            /**
0385:             * This method performs actual processing of MVN Forum's XML file <code>inputFile</code>
0386:             * and imports the data into the MVN Forum system.<br/>
0387:             * Don't use this method directly. Instead, you should use
0388:             * {@link #importXml(File, HttpServletRequest, HttpServletResponse, int, String, Calendar, String, boolean, int)}.
0389:             *
0390:             * @param inputFile MVN Forum XML file to be imported.
0391:             * @param importTime The moment when import process was started.
0392:             *
0393:             * @exception IOException If there is an I/O error while processing XML file.
0394:             * @exception SAXException If there is an error while parsing XML file.
0395:             * @exception ImportException If there is some other error during the import.
0396:             */
0397:            protected static void processXml(File inputFile, Calendar importTime)
0398:                    throws IOException, SAXException, ImportException {
0399:                addImportantMessage("Starting importing database info...");
0400:
0401:                //SAXParserFactory factory=SAXParserFactory.newInstance();
0402:                Digester digester = new Digester();
0403:                //should try new Digester(SAXParser), or Digester(XMLReader)
0404:                digester.setValidating(true);
0405:                digester.setNamespaceAware(true);
0406:                //digester.setSchema("mvn.xsd");
0407:
0408:                /* =================================================================
0409:                 * This is the main part of file - XML processing rules for Digester
0410:                 * =================================================================
0411:                 *
0412:                 * NOTE: Since SetTopRule is firing the desired method at the end of
0413:                 * the XML element matching the pattern, I had to implement my own
0414:                 * SetParentRule which does exactly the same thing (calls desired
0415:                 * child's method with a parent object as an argument). The difference
0416:                 * is that it is firing the "setParent" method at the beginning of the
0417:                 * corresponding XML element, thus leaving me the chance to, for example,
0418:                 * create messages as they arrive from the XML parser, not waiting the
0419:                 * end of the whole document (!!!), because I can't add a message, unless
0420:                 * I already added it's parent messages, thread, forum and category.
0421:                 *
0422:                 * NOTE: In SetPropertiesRule (see attachment processing below), I had to
0423:                 * define setAttachmentId() instead of setAttachmentID(), to avoid some
0424:                 * strange problems that Digester has (because it tries to automatically
0425:                 * convert all words to first letter capital, other small, and it
0426:                 * doesn't handle well the case with "attachmentID" property, that is,
0427:                 * it doesn't "see" setAttachmentID() method).
0428:                 * So, I defined attachmentId property and method setAttachmentId() is
0429:                 * then executed OK.
0430:                 */
0431:
0432:                /* First, I'll create root object of class MvnForumXML.
0433:                 * It's constructor will create default contents of the database, including
0434:                 * admin member (with MemberID=1, MemberName="Admin", MemberPassword="admin").
0435:                 * Later, if I find admin in XML, I'll just rewrite this default's admin data,
0436:                 * except for the MemberName which has to remain "Admin" and can't be changed.
0437:                 */
0438:                digester.addObjectCreate("mvnforum", MvnForumXML.class);
0439:                digester.addSetProperties("mvnforum", "version",
0440:                        "mvnForumXmlVersion");
0441:                digester.addSetProperties("mvnforum", "exportDate",
0442:                        "mvnForumExportDate");
0443:
0444:                digester.addCallMethod("mvnforum/MemberList",
0445:                        "postProcessMemberList");
0446:                digester.addObjectCreate("mvnforum/MemberList/Member",
0447:                        MvnForumMemberXML.class);
0448:                digester.addSetProperties("mvnforum/MemberList/Member",
0449:                        "class", "memberClass");
0450:                digester.addCallMethod("mvnforum/MemberList/Member",
0451:                        "addMember");
0452:                digester.addCallMethod("mvnforum/MemberList/Member/MemberName",
0453:                        "setMemberName", 0);
0454:                digester.addCallMethod(
0455:                        "mvnforum/MemberList/Member/MemberPassword",
0456:                        "setMemberPassword", 0);
0457:                digester.addCallMethod(
0458:                        "mvnforum/MemberList/Member/MemberFirstEmail",
0459:                        "setMemberFirstEmail", 0);
0460:                digester.addCallMethod(
0461:                        "mvnforum/MemberList/Member/MemberEmail",
0462:                        "setMemberEmail", 0);
0463:                digester.addCallMethod(
0464:                        "mvnforum/MemberList/Member/MemberEmailVisible",
0465:                        "setMemberEmailVisible", 0);
0466:                digester.addCallMethod(
0467:                        "mvnforum/MemberList/Member/MemberNameVisible",
0468:                        "setMemberNameVisible", 0);
0469:                digester.addCallMethod(
0470:                        "mvnforum/MemberList/Member/MemberFirstIP",
0471:                        "setMemberFirstIP", 0);
0472:                digester.addCallMethod(
0473:                        "mvnforum/MemberList/Member/MemberLastIP",
0474:                        "setMemberLastIP", 0);
0475:                digester.addCallMethod(
0476:                        "mvnforum/MemberList/Member/MemberViewCount",
0477:                        "setMemberViewCount", 0);
0478:                digester.addCallMethod(
0479:                        "mvnforum/MemberList/Member/MemberPostCount",
0480:                        "setMemberPostCount", 0);
0481:                digester.addCallMethod(
0482:                        "mvnforum/MemberList/Member/MemberCreationDate",
0483:                        "setMemberCreationDate", 0);
0484:                digester.addCallMethod(
0485:                        "mvnforum/MemberList/Member/MemberModifiedDate",
0486:                        "setMemberModifiedDate", 0);
0487:                digester.addCallMethod(
0488:                        "mvnforum/MemberList/Member/MemberExpireDate",
0489:                        "setMemberExpireDate", 0);
0490:                //log.debug("DIGESTER:::: [ OK ]" + "mvnforum/MemberList/Member/MemberExpireDate");
0491:                digester.addCallMethod(
0492:                        "mvnforum/MemberList/Member/MemberLastLogon",
0493:                        "setMemberLastLogon", 0);
0494:                digester.addCallMethod(
0495:                        "mvnforum/MemberList/Member/MemberOption",
0496:                        "setMemberOption", 0);
0497:                digester.addCallMethod(
0498:                        "mvnforum/MemberList/Member/MemberStatus",
0499:                        "setMemberStatus", 0);
0500:                digester.addCallMethod(
0501:                        "mvnforum/MemberList/Member/MemberActivateCode",
0502:                        "setMemberActivateCode", 0);
0503:                digester.addCallMethod(
0504:                        "mvnforum/MemberList/Member/MemberTempPassword",
0505:                        "setMemberTempPassword", 0);
0506:                digester.addCallMethod(
0507:                        "mvnforum/MemberList/Member/MemberMessageCount",
0508:                        "setMemberMessageCount", 0);
0509:                digester.addCallMethod(
0510:                        "mvnforum/MemberList/Member/MemberMessageOption",
0511:                        "setMemberMessageOption", 0);
0512:                digester.addCallMethod(
0513:                        "mvnforum/MemberList/Member/MemberPostsPerPage",
0514:                        "setMemberPostsPerPage", 0);
0515:                digester.addCallMethod(
0516:                        "mvnforum/MemberList/Member/MemberWarnCount",
0517:                        "setMemberWarnCount", 0);
0518:                digester.addCallMethod(
0519:                        "mvnforum/MemberList/Member/MemberVoteCount",
0520:                        "setMemberVoteCount", 0);
0521:                digester.addCallMethod(
0522:                        "mvnforum/MemberList/Member/MemberVoteTotalStars",
0523:                        "setMemberVoteTotalStars", 0);
0524:                digester.addCallMethod(
0525:                        "mvnforum/MemberList/Member/MemberRewardPoints",
0526:                        "setMemberRewardPoints", 0);
0527:                digester.addCallMethod(
0528:                        "mvnforum/MemberList/Member/MemberTitle",
0529:                        "setMemberTitle", 0);
0530:                digester.addCallMethod(
0531:                        "mvnforum/MemberList/Member/MemberTimeZone",
0532:                        "setMemberTimeZone", 0);
0533:                digester.addCallMethod(
0534:                        "mvnforum/MemberList/Member/MemberSignature",
0535:                        "setMemberSignature", 0);
0536:                digester.addCallMethod(
0537:                        "mvnforum/MemberList/Member/MemberAvatar",
0538:                        "setMemberAvatar", 0);
0539:                digester.addCallMethod("mvnforum/MemberList/Member/MemberSkin",
0540:                        "setMemberSkin", 0);
0541:                digester.addCallMethod(
0542:                        "mvnforum/MemberList/Member/MemberLanguage",
0543:                        "setMemberLanguage", 0);
0544:                digester.addCallMethod(
0545:                        "mvnforum/MemberList/Member/MemberFirstname",
0546:                        "setMemberFirstname", 0);
0547:                digester.addCallMethod(
0548:                        "mvnforum/MemberList/Member/MemberLastname",
0549:                        "setMemberLastname", 0);
0550:                digester.addCallMethod(
0551:                        "mvnforum/MemberList/Member/MemberGender",
0552:                        "setMemberGender", 0);
0553:                digester.addCallMethod(
0554:                        "mvnforum/MemberList/Member/MemberBirthday",
0555:                        "setMemberBirthday", 0);
0556:                digester.addCallMethod(
0557:                        "mvnforum/MemberList/Member/MemberAddress",
0558:                        "setMemberAddress", 0);
0559:                digester.addCallMethod("mvnforum/MemberList/Member/MemberCity",
0560:                        "setMemberCity", 0);
0561:                digester.addCallMethod(
0562:                        "mvnforum/MemberList/Member/MemberState",
0563:                        "setMemberState", 0);
0564:                digester.addCallMethod(
0565:                        "mvnforum/MemberList/Member/MemberCountry",
0566:                        "setMemberCountry", 0);
0567:                digester.addCallMethod(
0568:                        "mvnforum/MemberList/Member/MemberPhone",
0569:                        "setMemberPhone", 0);
0570:                digester.addCallMethod(
0571:                        "mvnforum/MemberList/Member/MemberMobile",
0572:                        "setMemberMobile", 0);
0573:                digester.addCallMethod("mvnforum/MemberList/Member/MemberFax",
0574:                        "setMemberFax", 0);
0575:                digester.addCallMethod(
0576:                        "mvnforum/MemberList/Member/MemberCareer",
0577:                        "setMemberCareer", 0);
0578:                digester.addCallMethod(
0579:                        "mvnforum/MemberList/Member/MemberHomepage",
0580:                        "setMemberHomepage", 0);
0581:                digester.addCallMethod(
0582:                        "mvnforum/MemberList/Member/MemberYahoo",
0583:                        "setMemberYahoo", 0);
0584:                digester.addCallMethod("mvnforum/MemberList/Member/MemberAol",
0585:                        "setMemberAol", 0);
0586:                digester.addCallMethod("mvnforum/MemberList/Member/MemberIcq",
0587:                        "setMemberIcq", 0);
0588:                digester.addCallMethod("mvnforum/MemberList/Member/MemberMsn",
0589:                        "setMemberMsn", 0);
0590:                digester.addCallMethod(
0591:                        "mvnforum/MemberList/Member/MemberCoolLink1",
0592:                        "setMemberCoolLink1", 0);
0593:                digester.addCallMethod(
0594:                        "mvnforum/MemberList/Member/MemberCoolLink2",
0595:                        "setMemberCoolLink2", 0);
0596:
0597:                digester
0598:                        .addCallMethod(
0599:                                "mvnforum/MemberList/Member/GlobalPermissionList/GlobalPermission",
0600:                                "addMemberPermission", 0);
0601:
0602:                digester
0603:                        .addCallMethod(
0604:                                "mvnforum/MemberList/Member/MessageFolderList/MessageFolder",
0605:                                "addMessageFolder", 4);
0606:                digester
0607:                        .addCallParam(
0608:                                "mvnforum/MemberList/Member/MessageFolderList/MessageFolder/FolderName",
0609:                                0);
0610:                digester
0611:                        .addCallParam(
0612:                                "mvnforum/MemberList/Member/MessageFolderList/MessageFolder/FolderOrder",
0613:                                1);
0614:                digester
0615:                        .addCallParam(
0616:                                "mvnforum/MemberList/Member/MessageFolderList/MessageFolder/FolderCreationDate",
0617:                                2);
0618:                digester
0619:                        .addCallParam(
0620:                                "mvnforum/MemberList/Member/MessageFolderList/MessageFolder/FolderModifiedDate",
0621:                                3);
0622:
0623:                digester
0624:                        .addCallMethod(
0625:                                "mvnforum/MemberList/Member/GlobalWatchList/GlobalWatch",
0626:                                "addGlobalWatch", 6);
0627:                digester
0628:                        .addCallParam(
0629:                                "mvnforum/MemberList/Member/GlobalWatchList/GlobalWatch/WatchType",
0630:                                0);
0631:                digester
0632:                        .addCallParam(
0633:                                "mvnforum/MemberList/Member/GlobalWatchList/GlobalWatch/WatchOption",
0634:                                1);
0635:                digester
0636:                        .addCallParam(
0637:                                "mvnforum/MemberList/Member/GlobalWatchList/GlobalWatch/WatchStatus",
0638:                                2);
0639:                digester
0640:                        .addCallParam(
0641:                                "mvnforum/MemberList/Member/GlobalWatchList/GlobalWatch/WatchCreationDate",
0642:                                3);
0643:                digester
0644:                        .addCallParam(
0645:                                "mvnforum/MemberList/Member/GlobalWatchList/GlobalWatch/WatchLastSentDate",
0646:                                4);
0647:                digester
0648:                        .addCallParam(
0649:                                "mvnforum/MemberList/Member/GlobalWatchList/GlobalWatch/WatchEndDate",
0650:                                5);
0651:
0652:                digester.addCallMethod("mvnforum/GroupList",
0653:                        "postProcessGroupList");
0654:                digester.addObjectCreate("mvnforum/GroupList/Group",
0655:                        MvnForumGroupXML.class);
0656:                digester.addSetProperties("mvnforum/GroupList/Group", "class",
0657:                        "groupClass");
0658:                digester.addCallMethod("mvnforum/GroupList/Group", "addGroup");
0659:                digester.addCallMethod(
0660:                        "mvnforum/GroupList/Group/GroupOwnerName",
0661:                        "setGroupOwnerName", 0);
0662:                digester.addCallMethod("mvnforum/GroupList/Group/GroupName",
0663:                        "setGroupName", 0);
0664:                digester.addCallMethod("mvnforum/GroupList/Group/GroupDesc",
0665:                        "setGroupDesc", 0);
0666:                digester.addCallMethod("mvnforum/GroupList/Group/GroupOption",
0667:                        "setGroupOption", 0);
0668:                digester.addCallMethod(
0669:                        "mvnforum/GroupList/Group/GroupCreationDate",
0670:                        "setGroupCreationDate", 0);
0671:                digester.addCallMethod(
0672:                        "mvnforum/GroupList/Group/GroupModifiedDate",
0673:                        "setGroupModifiedDate", 0);
0674:
0675:                digester
0676:                        .addCallMethod(
0677:                                "mvnforum/GroupList/Group/GlobalPermissionList/GlobalPermission",
0678:                                "addGroupPermission", 0);
0679:
0680:                digester.addCallMethod(
0681:                        "mvnforum/GroupList/Group/GroupMemberList/GroupMember",
0682:                        "addGroupMember", 4);
0683:                digester
0684:                        .addCallParam(
0685:                                "mvnforum/GroupList/Group/GroupMemberList/GroupMember/MemberName",
0686:                                0);
0687:                digester
0688:                        .addCallParam(
0689:                                "mvnforum/GroupList/Group/GroupMemberList/GroupMember/Privilege",
0690:                                1);
0691:                digester
0692:                        .addCallParam(
0693:                                "mvnforum/GroupList/Group/GroupMemberList/GroupMember/CreationDate",
0694:                                2);
0695:                digester
0696:                        .addCallParam(
0697:                                "mvnforum/GroupList/Group/GroupMemberList/GroupMember/ModifiedDate",
0698:                                3);
0699:
0700:                //digester.addCallMethod("mvnforum/GuestGlobalPermissionList/GlobalPermission", "addGuestGlobalPermission", 0);
0701:                //digester.addCallMethod("mvnforum/RegisteredMembersGlobalPermissionList/GlobalPermission", "addRegisteredMembersGlobalPermission", 0);
0702:
0703:                digester.addObjectCreate("*/Category",
0704:                        MvnForumCategoryXML.class);
0705:                //digester.addSetTop("*/Category", "setParentCategoryIfHave");
0706:                SetParentRule categoryParentRule = new SetParentRule(
0707:                        "setParentCategoryIfHave");
0708:                digester.addRule("*/Category", categoryParentRule);
0709:                digester.addCallMethod("*/Category", "addCategory");
0710:                digester.addCallMethod("*/Category/CategoryName",
0711:                        "setCategoryName", 0);
0712:                digester.addCallMethod("*/Category/CategoryDesc",
0713:                        "setCategoryDesc", 0);
0714:                digester.addCallMethod("*/Category/CategoryCreationDate",
0715:                        "setCategoryCreationDate", 0);
0716:                digester.addCallMethod("*/Category/CategoryModifiedDate",
0717:                        "setCategoryModifiedDate", 0);
0718:                digester.addCallMethod("*/Category/CategoryOrder",
0719:                        "setCategoryOrder", 0);
0720:                digester.addCallMethod("*/Category/CategoryOption",
0721:                        "setCategoryOption", 0);
0722:                digester.addCallMethod("*/Category/CategoryStatus",
0723:                        "setCategoryStatus", 0);
0724:
0725:                digester.addCallMethod(
0726:                        "*/Category/CategoryWatchList/CategoryWatch",
0727:                        "addCategoryWatch", 7);
0728:                digester
0729:                        .addCallParam(
0730:                                "*/Category/CategoryWatchList/CategoryWatch/MemberName",
0731:                                0);
0732:                digester.addCallParam(
0733:                        "*/Category/CategoryWatchList/CategoryWatch/WatchType",
0734:                        1);
0735:                digester
0736:                        .addCallParam(
0737:                                "*/Category/CategoryWatchList/CategoryWatch/WatchOption",
0738:                                2);
0739:                digester
0740:                        .addCallParam(
0741:                                "*/Category/CategoryWatchList/CategoryWatch/WatchStatus",
0742:                                3);
0743:                digester
0744:                        .addCallParam(
0745:                                "*/Category/CategoryWatchList/CategoryWatch/WatchCreationDate",
0746:                                4);
0747:                digester
0748:                        .addCallParam(
0749:                                "*/Category/CategoryWatchList/CategoryWatch/WatchLastSentDate",
0750:                                5);
0751:                digester
0752:                        .addCallParam(
0753:                                "*/Category/CategoryWatchList/CategoryWatch/WatchEndDate",
0754:                                6);
0755:
0756:                digester.addObjectCreate("*/Forum", MvnForumForumXML.class);
0757:                digester.addCallMethod("*/Forum", "addForum");
0758:                //digester.addSetTop("*/Forum", "setParentCategory");
0759:                SetParentRule forumParentRule = new SetParentRule(
0760:                        "setParentCategory");
0761:                digester.addRule("*/Forum", forumParentRule);
0762:                digester.addCallMethod("*/Forum/LastPostMemberName",
0763:                        "setForumLastPostMemberName", 0);
0764:                digester.addCallMethod("*/Forum/ForumName", "setForumName", 0);
0765:                digester.addCallMethod("*/Forum/ForumDesc", "setForumDesc", 0);
0766:                digester.addCallMethod("*/Forum/ForumCreationDate",
0767:                        "setForumCreationDate", 0);
0768:                digester.addCallMethod("*/Forum/ForumModifiedDate",
0769:                        "setForumModifiedDate", 0);
0770:                digester.addCallMethod("*/Forum/ForumLastPostDate",
0771:                        "setForumLastPostDate", 0);
0772:                digester
0773:                        .addCallMethod("*/Forum/ForumOrder", "setForumOrder", 0);
0774:                digester.addCallMethod("*/Forum/ForumType", "setForumType", 0);
0775:                digester.addCallMethod("*/Forum/ForumFormatOption",
0776:                        "setForumFormatOption", 0);
0777:                digester.addCallMethod("*/Forum/ForumOption", "setForumOption",
0778:                        0);
0779:                digester.addCallMethod("*/Forum/ForumStatus", "setForumStatus",
0780:                        0);
0781:                digester.addCallMethod("*/Forum/ForumModerationMode",
0782:                        "setForumModerationMode", 0);
0783:                digester.addCallMethod("*/Forum/ForumPassword",
0784:                        "setForumPassword", 0);
0785:                digester.addCallMethod("*/Forum/ForumThreadCount",
0786:                        "setForumThreadCount", 0);
0787:                digester.addCallMethod("*/Forum/ForumPostCount",
0788:                        "setForumPostCount", 0);
0789:
0790:                digester
0791:                        .addCallMethod(
0792:                                "*/Forum/MemberForumPermissionList/MemberForumPermission",
0793:                                "addMemberForumPermission", 2);
0794:                digester
0795:                        .addCallParam(
0796:                                "*/Forum/MemberForumPermissionList/MemberForumPermission/MemberName",
0797:                                0);
0798:                digester
0799:                        .addCallParam(
0800:                                "*/Forum/MemberForumPermissionList/MemberForumPermission/ForumPermission",
0801:                                1);
0802:
0803:                digester
0804:                        .addCallMethod(
0805:                                "*/Forum/GroupForumPermissionList/GroupForumPermission",
0806:                                "addGroupForumPermission", 2);
0807:                digester
0808:                        .addCallParam(
0809:                                "*/Forum/GroupForumPermissionList/GroupForumPermission/GroupName",
0810:                                0);
0811:                digester
0812:                        .addCallParam(
0813:                                "*/Forum/GroupForumPermissionList/GroupForumPermission/ForumPermission",
0814:                                1);
0815:
0816:                //digester.addCallMethod("*/Forum/GuestForumPermissionList/ForumPermission", "addGuestForumPermission", 0);
0817:                //digester.addCallMethod("*/Forum/RegisteredMembersForumPermissionList/ForumPermission", "addRegisteredMembersForumPermission", 0);
0818:
0819:                digester.addCallMethod("*/Forum/ForumWatchList/ForumWatch",
0820:                        "addForumWatch", 7);
0821:                digester.addCallParam(
0822:                        "*/Forum/ForumWatchList/ForumWatch/MemberName", 0);
0823:                digester.addCallParam(
0824:                        "*/Forum/ForumWatchList/ForumWatch/WatchType", 1);
0825:                digester.addCallParam(
0826:                        "*/Forum/ForumWatchList/ForumWatch/WatchOption", 2);
0827:                digester.addCallParam(
0828:                        "*/Forum/ForumWatchList/ForumWatch/WatchStatus", 3);
0829:                digester.addCallParam(
0830:                        "*/Forum/ForumWatchList/ForumWatch/WatchCreationDate",
0831:                        4);
0832:                digester.addCallParam(
0833:                        "*/Forum/ForumWatchList/ForumWatch/WatchLastSentDate",
0834:                        5);
0835:                digester.addCallParam(
0836:                        "*/Forum/ForumWatchList/ForumWatch/WatchEndDate", 6);
0837:
0838:                digester.addObjectCreate("*/Thread", MvnForumThreadXML.class);
0839:                //digester.addSetTop("*/Thread", "setParentForum");
0840:                SetParentRule threadParentRule = new SetParentRule(
0841:                        "setParentForum");
0842:                digester.addRule("*/Thread", threadParentRule);
0843:                digester.addCallMethod("*/Thread", "addThread");
0844:                digester.addCallMethod("*/Thread/MemberName",
0845:                        "setThreadMemberName", 0);
0846:                digester.addCallMethod("*/Thread/LastPostMemberName",
0847:                        "setThreadLastPostMemberName", 0);
0848:                digester.addCallMethod("*/Thread/ThreadTopic",
0849:                        "setThreadTopic", 0);
0850:                digester.addCallMethod("*/Thread/ThreadBody", "setThreadBody",
0851:                        0);
0852:                digester.addCallMethod("*/Thread/ThreadVoteCount",
0853:                        "setThreadVoteCount", 0);
0854:                digester.addCallMethod("*/Thread/ThreadVoteTotalStars",
0855:                        "setThreadVoteTotalStars", 0);
0856:                digester.addCallMethod("*/Thread/ThreadCreationDate",
0857:                        "setThreadCreationDate", 0);
0858:                digester.addCallMethod("*/Thread/ThreadLastPostDate",
0859:                        "setThreadLastPostDate", 0);
0860:                digester.addCallMethod("*/Thread/ThreadType", "setThreadType",
0861:                        0);
0862:                digester.addCallMethod("*/Thread/ThreadOption",
0863:                        "setThreadOption", 0);
0864:                digester.addCallMethod("*/Thread/ThreadStatus",
0865:                        "setThreadStatus", 0);
0866:                digester.addCallMethod("*/Thread/ThreadHasPoll",
0867:                        "setThreadHasPoll", 0);
0868:                digester.addCallMethod("*/Thread/ThreadViewCount",
0869:                        "setThreadViewCount", 0);
0870:                digester.addCallMethod("*/Thread/ThreadReplyCount",
0871:                        "setThreadReplyCount", 0);
0872:                digester.addCallMethod("*/Thread/ThreadIcon", "setThreadIcon",
0873:                        0);
0874:                digester.addCallMethod("*/Thread/ThreadDuration",
0875:                        "setThreadDuration", 0);
0876:
0877:                digester.addCallMethod("*/Thread/ThreadWatchList/ThreadWatch",
0878:                        "addThreadWatch", 7);
0879:                digester.addCallParam(
0880:                        "*/Thread/ThreadWatchList/ThreadWatch/MemberName", 0);
0881:                digester.addCallParam(
0882:                        "*/Thread/ThreadWatchList/ThreadWatch/WatchType", 1);
0883:                digester.addCallParam(
0884:                        "*/Thread/ThreadWatchList/ThreadWatch/WatchOption", 2);
0885:                digester.addCallParam(
0886:                        "*/Thread/ThreadWatchList/ThreadWatch/WatchStatus", 3);
0887:                digester
0888:                        .addCallParam(
0889:                                "*/Thread/ThreadWatchList/ThreadWatch/WatchCreationDate",
0890:                                4);
0891:                digester
0892:                        .addCallParam(
0893:                                "*/Thread/ThreadWatchList/ThreadWatch/WatchLastSentDate",
0894:                                5);
0895:                digester.addCallParam(
0896:                        "*/Thread/ThreadWatchList/ThreadWatch/WatchEndDate", 6);
0897:
0898:                digester.addCallMethod(
0899:                        "*/Thread/FavoriteThreadList/FavoriteThread",
0900:                        "addFavoriteThread", 5);
0901:                digester
0902:                        .addCallParam(
0903:                                "*/Thread/FavoriteThreadList/FavoriteThread/MemberName",
0904:                                0);
0905:                digester
0906:                        .addCallParam(
0907:                                "*/Thread/FavoriteThreadList/FavoriteThread/FavoriteCreationDate",
0908:                                1);
0909:                digester
0910:                        .addCallParam(
0911:                                "*/Thread/FavoriteThreadList/FavoriteThread/FavoriteType",
0912:                                2);
0913:                digester
0914:                        .addCallParam(
0915:                                "*/Thread/FavoriteThreadList/FavoriteThread/FavoriteOption",
0916:                                3);
0917:                digester
0918:                        .addCallParam(
0919:                                "*/Thread/FavoriteThreadList/FavoriteThread/FavoriteStatus",
0920:                                4);
0921:
0922:                digester.addObjectCreate("*/Post", MvnForumPostXML.class);
0923:                //digester.addSetTop("*/Post", "setParentThreadOrPost");
0924:                SetParentRule postParentRule = new SetParentRule(
0925:                        "setParentThreadOrPost");
0926:                digester.addRule("*/Post", postParentRule);
0927:                digester.addCallMethod("*/Post", "addPost");
0928:                digester.addCallMethod("*/Post/MemberName",
0929:                        "setPostMemberName", 0);
0930:                digester.addCallMethod("*/Post/LastEditMemberName",
0931:                        "setPostLastEditMemberName", 0);
0932:                digester.addCallMethod("*/Post/PostTopic", "setPostTopic", 0);
0933:                digester.addCallMethod("*/Post/PostBody", "setPostBody", 0);
0934:                digester.addCallMethod("*/Post/PostCreationDate",
0935:                        "setPostCreationDate", 0);
0936:                digester.addCallMethod("*/Post/PostLastEditDate",
0937:                        "setPostLastEditDate", 0);
0938:                digester.addCallMethod("*/Post/PostCreationIP",
0939:                        "setPostCreationIP", 0);
0940:                digester.addCallMethod("*/Post/PostLastEditIP",
0941:                        "setPostLastEditIP", 0);
0942:                digester.addCallMethod("*/Post/PostEditCount",
0943:                        "setPostEditCount", 0);
0944:                digester.addCallMethod("*/Post/PostFormatOption",
0945:                        "setPostFormatOption", 0);
0946:                digester.addCallMethod("*/Post/PostOption", "setPostOption", 0);
0947:                digester.addCallMethod("*/Post/PostStatus", "setPostStatus", 0);
0948:                digester.addCallMethod("*/Post/PostIcon", "setPostIcon", 0);
0949:                digester.addCallMethod("*/Post/PostAttachCount",
0950:                        "setPostAttachCount", 0);
0951:
0952:                digester.addObjectCreate("*/Attachment",
0953:                        MvnForumAttachmentXML.class);
0954:                digester.addSetProperties("*/Attachment", "id", "attachmentId");
0955:                //digester.addSetTop("*/Attachment", "setParentPost");
0956:                SetParentRule attachmentParentRule = new SetParentRule(
0957:                        "setParentPost");
0958:                digester.addRule("*/Attachment", attachmentParentRule);
0959:                digester.addCallMethod("*/Attachment", "addAttachment");
0960:                digester.addCallMethod("*/Attachment/MemberName",
0961:                        "setAttachMemberName", 0);
0962:                digester.addCallMethod("*/Attachment/AttachFilename",
0963:                        "setAttachFilename", 0);
0964:                digester.addCallMethod("*/Attachment/AttachFileSize",
0965:                        "setAttachFileSize", 0);
0966:                digester.addCallMethod("*/Attachment/AttachMimeType",
0967:                        "setAttachMimeType", 0);
0968:                digester.addCallMethod("*/Attachment/AttachDesc",
0969:                        "setAttachDesc", 0);
0970:                digester.addCallMethod("*/Attachment/AttachCreationIP",
0971:                        "setAttachCreationIP", 0);
0972:                digester.addCallMethod("*/Attachment/AttachCreationDate",
0973:                        "setAttachCreationDate", 0);
0974:                digester.addCallMethod("*/Attachment/AttachModifiedDate",
0975:                        "setAttachModifiedDate", 0);
0976:                digester.addCallMethod("*/Attachment/AttachDownloadCount",
0977:                        "setAttachDownloadCount", 0);
0978:                digester.addCallMethod("*/Attachment/AttachOption",
0979:                        "setAttachOption", 0);
0980:                digester.addCallMethod("*/Attachment/AttachStatus",
0981:                        "setAttachStatus", 0);
0982:
0983:                /* At this point, on top of stack we have only the root MvnForumXML object */
0984:
0985:                digester.addCallMethod("mvnforum/RankList/Rank", "addRank", 6);
0986:                digester.addCallParam("mvnforum/RankList/Rank/RankMinPosts", 0);
0987:                digester.addCallParam("mvnforum/RankList/Rank/RankLevel", 1);
0988:                digester.addCallParam("mvnforum/RankList/Rank/RankTitle", 2);
0989:                digester.addCallParam("mvnforum/RankList/Rank/RankImage", 3);
0990:                digester.addCallParam("mvnforum/RankList/Rank/RankType", 4);
0991:                digester.addCallParam("mvnforum/RankList/Rank/RankOption", 5);
0992:
0993:                /* ==================================================================
0994:                 * This was the main part of file - XML processing rules for Digester
0995:                 * ==================================================================
0996:                 */
0997:
0998:                digester.parse(inputFile);
0999:
1000:                try {
1001:                    MvnForumXML.finishImport();
1002:                } catch (CreateException e) {
1003:                    throw new ImportException(e.getMessage(), e); //just rethrow
1004:                } catch (DuplicateKeyException e) {
1005:                    throw new ImportException(e.getMessage(), e); //just rethrow
1006:                } catch (ObjectNotFoundException e) {
1007:                    throw new ImportException(e.getMessage(), e); //just rethrow
1008:                } catch (DatabaseException e) {
1009:                    throw new ImportException(e.getMessage(), e); //just rethrow
1010:                } catch (ForeignKeyNotFoundException e) {
1011:                    throw new ImportException(e.getMessage(), e); //just rethrow
1012:                } catch (BadInputException e) {
1013:                    throw new ImportException(e.getMessage(), e); //just rethrow
1014:                }
1015:            }
1016:
1017:            /**
1018:             * Adds <code>message</code> to the output stream that was setup in
1019:             * {@link #importXml(File, HttpServletRequest, HttpServletResponse, int, String, Calendar, String, boolean, int)}.
1020:             * <br/>This method was made public to be available to MVN Forum XML processing classes.
1021:             *
1022:             * @param message Message to be written to output.
1023:             * @see com.mvnforum.admin.ImportWebHelper#addMessage(java.lang.String)
1024:             *
1025:             */
1026:            public static void addMessage(String message) {
1027:                ImportWebHelper.addMessage(message);
1028:            }
1029:
1030:            /**
1031:             * Adds important (bold) <code>message</code> to the output stream that was setup in
1032:             * {@link #importXml(File, HttpServletRequest, HttpServletResponse, int, String, Calendar, String, boolean, int)}.
1033:             * <br/>This method was made public to be available to MVN Forum XML processing classes.
1034:             *
1035:             * @param message Message to be written to output.
1036:             * @see com.mvnforum.admin.ImportWebHelper#addImportantMessage(java.lang.String)
1037:             *
1038:             */
1039:            public static void addImportantMessage(String message) {
1040:                ImportWebHelper.addImportantMessage(message);
1041:            }
1042:
1043:            /**
1044:             * Ensure that default entries in MVN Forum (admin and virtual guest members, rank titles,
1045:             * <code>Registered Members</code> group, ...) are created.<br/>
1046:             * This method was made public to be available to MVN Forum XML processing classes.<br/>
1047:             * Since these defaults will be imported from XML (they are supposed to be
1048:             * in the XML), this method won't do anything. At the end of import, defaults
1049:             * will be checked and created in case XML didn't contain them.
1050:             *
1051:             * @see com.mvnforum.admin.ImportWebHelper#addMessage(java.lang.String)
1052:             *
1053:             */
1054:            public static void createDefaultContents() throws CreateException,
1055:                    DuplicateKeyException, ObjectNotFoundException,
1056:                    DatabaseException, ForeignKeyNotFoundException {
1057:                //don't create any database entries now
1058:                /* This method overrides ImportWebHelper.createDefaultContents().
1059:                 * It's used in MVNForumXML constructor.
1060:                 * But, in case of error, ImportWebHandler.finalErrorHandling will be
1061:                 * called, and it uses ImportWebHelper.createDefaultContents() version
1062:                 * of this method (so, in that case, all neccessary default contents
1063:                 * will be created).
1064:                 */
1065:            }
1066:
1067:            private static void handleSuccess(HttpServletRequest request) {
1068:                addSuccessMessage(request);
1069:                endHtml();
1070:            }
1071:
1072:            //it's possible I called this method with e==null
1073:            private static void handleFatalError(String message, Exception e,
1074:                    boolean clearIfError, HttpServletRequest request)
1075:                    throws ImportException {
1076:
1077:                if (e == null) {
1078:                    log.error(message);
1079:                } else {
1080:                    log.error(message, e);
1081:                }
1082:
1083:                if ((e == null) || (e.getMessage() == null)) {
1084:                    addErrorMessage(message);
1085:                } else {
1086:                    addErrorMessage(message + "<br/>Cause: " + e.getMessage());
1087:                }
1088:
1089:                //try to clear the database and rollback to valid empty state with "admin" member
1090:                ImportWebHelper.addFinalErrorHandling(request, clearIfError);
1091:                endHtml();
1092:                if (e == null) {
1093:                    throw new ImportException(message);
1094:                } else {
1095:                    throw new ImportException(message, e);
1096:                }
1097:            }
1098:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.