[jboss-svn-commits] JBL Code SVN: r20828 - labs/jbosslabs/trunk/portal-extensions/jbosswiki/wiki-common/src/java-migration/org/jboss/labs/clearspace.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Fri Jun 27 02:26:10 EDT 2008
Author: szimano
Date: 2008-06-27 02:26:09 -0400 (Fri, 27 Jun 2008)
New Revision: 20828
Modified:
labs/jbosslabs/trunk/portal-extensions/jbosswiki/wiki-common/src/java-migration/org/jboss/labs/clearspace/CSMigration.java
labs/jbosslabs/trunk/portal-extensions/jbosswiki/wiki-common/src/java-migration/org/jboss/labs/clearspace/migration-howto.txt
Log:
safer migration
Modified: labs/jbosslabs/trunk/portal-extensions/jbosswiki/wiki-common/src/java-migration/org/jboss/labs/clearspace/CSMigration.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jbosswiki/wiki-common/src/java-migration/org/jboss/labs/clearspace/CSMigration.java 2008-06-27 06:19:48 UTC (rev 20827)
+++ labs/jbosslabs/trunk/portal-extensions/jbosswiki/wiki-common/src/java-migration/org/jboss/labs/clearspace/CSMigration.java 2008-06-27 06:26:09 UTC (rev 20828)
@@ -152,7 +152,8 @@
WikiPage page = we.getByName(pageName, null, 1,
ConfigurationParser.getDefaultLangugeCode());
- String content = "Page "+pageName+" imported by JSP to CS migration";
+ String content = "Page " + pageName
+ + " imported by JSP to CS migration";
org.w3c.dom.Document body = WikiContentHelper
.wikiToJiveDocument(content);
@@ -169,17 +170,17 @@
System.out.println("Added page: " + pageName + " as "
+ wsd.getDocumentID());
} catch (DocumentAlreadyExistsException e) {
- // ignore
+ log.write("Couldnt add page: " + pageName + " - DocumentAlreadyExistsException\n");
e.printStackTrace();
} catch (SOAPFaultException e) {
e.printStackTrace();
System.out.println("Error while processing page: " + pageName);
} catch (DuplicateIDException e) {
- // TODO Auto-generated catch block
+ log.write("Couldnt add page : " + pageName + " - duplicate id\n");
e.printStackTrace();
} catch (RejectedException e) {
- // TODO Auto-generated catch block
+ log.write("Couldnt add page: " + pageName + " - Rejected\n");
e.printStackTrace();
} catch (NullPointerException e) {
// ignore - page coudln't be open
@@ -194,58 +195,66 @@
log.write("\nAll pages import END\n");
}
- private void importAttachments(Set<String> toTransform)
- throws DocumentObjectNotFoundException, UnauthorizedException,
- IOException {
+ private void importAttachments(Set<String> toTransform) throws IOException {
log.write("\nAttachment import START\n");
for (String pageName : toTransform) {
WikiPage page = we.getByName(pageName, null, ConfigurationParser
.getDefaultLangugeCode());
+ try {
+ Document original = documentManager.getDocument(pageDictionary
+ .get(pageName));
- Document original = documentManager.getDocument(pageDictionary
- .get(pageName));
+ // add attachments
- // add attachments
+ Set<String> atts = we.getAttachmentsSet(page,
+ ConfigurationParser.getDefaultLangugeCode());
- Set<String> atts = we.getAttachmentsSet(page, ConfigurationParser
- .getDefaultLangugeCode());
+ if (atts != null)
+ for (String att : atts) {
+ try {
+ WikiAttachment wa = we.getAttachment(
+ page.getName(), att, ConfigurationParser
+ .getDefaultLangugeCode());
- if (atts != null)
- for (String att : atts) {
- try {
- WikiAttachment wa = we.getAttachment(page.getName(),
- att, ConfigurationParser
- .getDefaultLangugeCode());
+ attachmentManager.createAttachment(original, att,
+ mimeTypes.getContentType(att), wa
+ .getInputStream(), null);
- attachmentManager.createAttachment(original, att,
- mimeTypes.getContentType(att), wa
- .getInputStream(), null);
+ wa.getInputStream().close();
+ original.setMinorEdit(true);
+ original.save();
- wa.getInputStream().close();
- original.setMinorEdit(true);
- original.save();
-
- System.out.println("Attachment " + att + " added for "
- + page.getName());
- } catch (AttachmentException e) {
- System.err.println("Problem with adding attachment "
- + att + " for page " + pageName);
- log.write("Problem with adding attachment " + att
- + " for page " + pageName + "\n");
- e.printStackTrace();
- } catch (NullPointerException e) {
- // ignore - page coudln't be open
- log.write("Problem with adding attachment " + att
- + " for page " + pageName + "\n");
- log.write(e.toString());
+ System.out.println("Attachment " + att
+ + " added for " + page.getName());
+ } catch (AttachmentException e) {
+ System.err
+ .println("Problem with adding attachment "
+ + att + " for page " + pageName);
+ log.write("Problem with adding attachment " + att
+ + " for page " + pageName + "\n");
+ e.printStackTrace();
+ } catch (NullPointerException e) {
+ // ignore - page coudln't be open
+ log.write("Problem with adding attachment " + att
+ + " for page " + pageName + "\n");
+ log.write(e.toString());
+ }
}
- }
+ } catch (DocumentObjectNotFoundException e) {
+ log.write("Problem with migrating attachments for page "
+ + pageName + " DocumentObjectNotFound\n");
+ e.printStackTrace();
+ } catch (UnauthorizedException e) {
+ log.write("Problem with migrating attachments for page "
+ + pageName + " Unuthorized\n");
+ e.printStackTrace();
+ }
}
log.write("\nAttachment import END\n");
}
- private void importVersions(Set<String> toTransform) throws Exception {
+ private void importVersions(Set<String> toTransform) throws IOException {
// Connection c = getCSConnection();
log.write("\nVersion import START\n");
try {
@@ -332,6 +341,14 @@
log.write("Problem with migrating versions for page "
+ pageName + "\n");
log.write(e.toString());
+ } catch (DocumentObjectNotFoundException e) {
+ log.write("Problem with migrating versions for page "
+ + pageName + " DocumentObjectNotFound\n");
+ e.printStackTrace();
+ } catch (UnauthorizedException e) {
+ log.write("Problem with migrating versions for page "
+ + pageName + " Unuthorized\n");
+ e.printStackTrace();
}
}
} catch (IOException e) {
Modified: labs/jbosslabs/trunk/portal-extensions/jbosswiki/wiki-common/src/java-migration/org/jboss/labs/clearspace/migration-howto.txt
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jbosswiki/wiki-common/src/java-migration/org/jboss/labs/clearspace/migration-howto.txt 2008-06-27 06:19:48 UTC (rev 20827)
+++ labs/jbosslabs/trunk/portal-extensions/jbosswiki/wiki-common/src/java-migration/org/jboss/labs/clearspace/migration-howto.txt 2008-06-27 06:26:09 UTC (rev 20828)
@@ -13,7 +13,7 @@
3. setup cs with db created. IMPORTANT make sure max_packet setting in MySQL is set to something more then default
4. Change number of max attachments in clearspace settings (from 5 to something reasonable) and switch off indexing
5. run sql-script.txt (change db name if needed)
-ALTER TABLE `cs`.`jiveWikiLink` MODIFY COLUMN `targetText` LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL;
+ALTER TABLE `cslabs`.`jiveWikiLink` MODIFY COLUMN `targetText` LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL;
6. set envirnment MIGRATE to true export MIGRATE=true
7. run clearspace, login -> migration will start
8. Stop clearspace, run generated sql script in mysql (see clearspace log) versions_and_users-${DATE}.sql
More information about the jboss-svn-commits
mailing list