Jive Forums API (5.5.20.2-oracle) Developer Javadocs

com.jivesoftware.forum.database
Class DbDataExport

java.lang.Object
  extended by com.jivesoftware.util.AbstractPollableRunnable
      extended by com.jivesoftware.forum.database.DbDataExport
All Implemented Interfaces:
PollableRunnable, java.io.Serializable, java.lang.Runnable

public class DbDataExport
extends AbstractPollableRunnable
implements java.io.Serializable

Main data export class for Jive Forums data. This class implements PollableRunnable which means it also implements Runnable so this class should be instantiated, configured (by setting properties) and executed in the TaskEngine.

This class was designed to be very flexible in which data is exported. The result of running this will be an XML document which validates against the Jive Forums DTD and which contains the data you ask for. For example, it's possible to export only user data or only forum data, or everything.

Export options:

Key properties:

Note: since this is a resource intensive task it should be run with the lowest thread priority.

See Also:
Serialized Form

Field Summary
static java.lang.String DEFAULT_ENCODING
          Default encoding used for the XML file.
static java.text.SimpleDateFormat DEFAULT_FILE_DATE_FORMAT
          Default format of the output file name.
 
Constructor Summary
DbDataExport(ForumFactory factory)
          Creates a new export task.
 
Method Summary
 void doRun()
          Writes out XML data from the Jive Forums system.
 java.lang.String getEncoding()
          Returns the encoding used for writing the XML file.
 java.util.Collection getErrors()
          Returns an unmodifiable collection of errors (if any) that occured during data export.
 java.util.Collection getExportedCategories()
          Returns the collection of categories being exported.
 java.util.Collection getExportedForums()
          Returns the collection of forums being exported.
 java.lang.String getFilename()
          Returns the name of the file to export data to.
 java.io.OutputStream getOutputStream()
          Returns the output stream where data is written to.
 int getTaskMaximum()
          Returns the maximum value of task progress (default is 100).
 int getTaskValue()
          Returns the current value of the task's progress.
 boolean isExportAnnouncementsEnabled()
          Indicates whether or not announcements will be exported.
 boolean isExportAttachmentsEnabled()
          Resturns whether or not attachments should be exported
 boolean isExportForumsEnabled()
          Indicates if forums will be exported.
 boolean isExportGroupsEnabled()
          Indicates if groups will be exported.
 boolean isExportIDsEnabled()
          Indicates if IDs will be exported.
 boolean isExportJivePropertiesEnabled()
          Returns whether or not jive properties are being exported
 boolean isExportPermsEnabled()
          Indicates if all permissions (that includes global and per-forum permissions) will be exported.
 boolean isExportPollsEnabled()
          Indicates whether or not polls will be exported.
 boolean isExportPrivateMessagesEnabled()
          Returns whether private messages are being exported
 boolean isExportUsersEnabled()
          Indicates if users will be exported.
static void main(java.lang.String[] args)
           
 void setEncoding(java.lang.String encoding)
          Sets the encoding used for writing the XML file.
 void setExportAnnouncementsEnabled(boolean exportAnnouncementsEnabled)
          Sets whether or not announcements will be exported.
 void setExportAttachmentsEnabled(boolean exportAttachmentsEnabled)
          Sets whether or not attachments should be exported
 void setExportForumsEnabled(boolean exportForums)
          Sets whether or not forums will be exported.
 void setExportGroupsEnabled(boolean exportGroups)
          Sets whether or not groups will be exported.
 void setExportIDsEnabled(boolean exportIDs)
          Sets if IDs should be exported with each object.
 void setExportJivePropertiesEnabled(boolean exportJivePropertiesEnabled)
          Sets whether or not jive properties should be exported (default is true)
 void setExportPermsEnabled(boolean exportPerms)
          Sets whether or not permissions will be exported.
 void setExportPollsEnabled(boolean exportPollsEnabled)
          Sets whether or not polls will be exported.
 void setExportPrivateMessagesEnabled(boolean exportPrivateMessagesEnabled)
          Sets where or not private messages should be exported.
 void setExportUsersEnabled(boolean exportUsers)
          Sets whether or not users should be exported.
 void setFilename(java.lang.String filename)
          Sets the filename used to export forum data to.
 void setOutputStream(java.io.OutputStream outputStream)
          Sets the output stream to use for exported data.
 
Methods inherited from class com.jivesoftware.util.AbstractPollableRunnable
cancel, getEndDate, getPercentComplete, getStartDate, getTaskMinimum, isFinished, isIndeterminate, isRunning, run
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_FILE_DATE_FORMAT

public static final java.text.SimpleDateFormat DEFAULT_FILE_DATE_FORMAT
Default format of the output file name. Can override by setting the Jive property of 'dataExport.fileDateFormat'.


DEFAULT_ENCODING

public static final java.lang.String DEFAULT_ENCODING
Default encoding used for the XML file. Can override by setting the Jive property of 'dataExport.encoding'.

See Also:
Constant Field Values
Constructor Detail

DbDataExport

public DbDataExport(ForumFactory factory)
             throws UnauthorizedException
Creates a new export task. The forum factory with system admin privileges is needed to get access to all content.

Throws:
UnauthorizedException
Method Detail

isExportIDsEnabled

public boolean isExportIDsEnabled()
Indicates if IDs will be exported.

Returns:
true if IDs will be exported with each object, false otherwise.

setExportIDsEnabled

public void setExportIDsEnabled(boolean exportIDs)
Sets if IDs should be exported with each object. Since Jive maintains IDs for each of its objects (ie, forum IDs, message IDs, user IDs), exporting the IDs might be useful if you want to import your data again and have same IDs associated with objects.

By default, IDs will not be exported.

Parameters:
exportIDs - true to indicate that IDs should be exported with each Jive object, false to not export IDs.

isExportUsersEnabled

public boolean isExportUsersEnabled()
Indicates if users will be exported.

Returns:
true if users will be exported, false otherwise.

setExportUsersEnabled

public void setExportUsersEnabled(boolean exportUsers)
Sets whether or not users should be exported. Users will be exported by default.

Parameters:
exportUsers - true to indicate that user objects should be exported, false to not export.

isExportGroupsEnabled

public boolean isExportGroupsEnabled()
Indicates if groups will be exported.

Returns:
true if groups will be exported, false otherwise.

setExportGroupsEnabled

public void setExportGroupsEnabled(boolean exportGroups)
Sets whether or not groups will be exported. Groups will be exported by default.

Parameters:
exportGroups - true to indicate that groups should be exported, false to not export.

isExportForumsEnabled

public boolean isExportForumsEnabled()
Indicates if forums will be exported.

Returns:
true if forums will be exported, false otherwise.

setExportForumsEnabled

public void setExportForumsEnabled(boolean exportForums)
Sets whether or not forums will be exported. Forums will be exported by default.

Parameters:
exportForums - true to indicate that forums should be exported, false to not export.

isExportPermsEnabled

public boolean isExportPermsEnabled()
Indicates if all permissions (that includes global and per-forum permissions) will be exported.

Returns:
true if all permissions will be exported, false otherwise.

setExportPermsEnabled

public void setExportPermsEnabled(boolean exportPerms)
Sets whether or not permissions will be exported. This includes both global and per-forum permission settings. By default all permissions are exported. Note, if you choose to not export forums, only the system admin privileges will be exported.

Parameters:
exportPerms - true to indicate that all permissions should be exported, false to not export.

isExportPollsEnabled

public boolean isExportPollsEnabled()
Indicates whether or not polls will be exported.

Returns:
true if all polls will be exported, false otherwise.

setExportPollsEnabled

public void setExportPollsEnabled(boolean exportPollsEnabled)
Sets whether or not polls will be exported.

Parameters:
exportPollsEnabled - true to indicate that all polls should be exported, false otherwise.

isExportAnnouncementsEnabled

public boolean isExportAnnouncementsEnabled()
Indicates whether or not announcements will be exported.

Returns:
true if all announcements will be exported, false otherwise.

setExportAnnouncementsEnabled

public void setExportAnnouncementsEnabled(boolean exportAnnouncementsEnabled)
Sets whether or not announcements will be exported.

Parameters:
exportAnnouncementsEnabled - true to indicate that all announcements should be exported, false otherwise.

isExportPrivateMessagesEnabled

public boolean isExportPrivateMessagesEnabled()
Returns whether private messages are being exported

Returns:
true if private messages are being exported

setExportPrivateMessagesEnabled

public void setExportPrivateMessagesEnabled(boolean exportPrivateMessagesEnabled)
Sets where or not private messages should be exported. The default value is true.

Parameters:
exportPrivateMessagesEnabled - true if private messages are being exported

getExportedForums

public java.util.Collection getExportedForums()
Returns the collection of forums being exported. Developers can take this collection and add/remove forum IDs to it (as Longs). If this collection is empty, all forums will be exported.

Returns:
a collection of the forums being exported.

getExportedCategories

public java.util.Collection getExportedCategories()
Returns the collection of categories being exported. Developers can take this collection and add/remove forum IDs to it (as Longs). If this collection is empty, all categories will be exported.

Returns:
a collection of the categories being exported.

setExportJivePropertiesEnabled

public void setExportJivePropertiesEnabled(boolean exportJivePropertiesEnabled)
Sets whether or not jive properties should be exported (default is true)

Parameters:
exportJivePropertiesEnabled - true if jive properties should be exported, false otherwise

isExportJivePropertiesEnabled

public boolean isExportJivePropertiesEnabled()
Returns whether or not jive properties are being exported

Returns:
true if jive properties are being exported, otherwise false

isExportAttachmentsEnabled

public boolean isExportAttachmentsEnabled()
Resturns whether or not attachments should be exported

Returns:
true if attachments should be exported

setExportAttachmentsEnabled

public void setExportAttachmentsEnabled(boolean exportAttachmentsEnabled)
Sets whether or not attachments should be exported

Parameters:
exportAttachmentsEnabled - true if attachments should be exported, false otherwise

getOutputStream

public java.io.OutputStream getOutputStream()
Returns the output stream where data is written to.

Returns:
the output stream used for export data.

setOutputStream

public void setOutputStream(java.io.OutputStream outputStream)
Sets the output stream to use for exported data.

Parameters:
outputStream - the output stream to use for exported data.

getEncoding

public java.lang.String getEncoding()
Returns the encoding used for writing the XML file.

Returns:
the encoding used for writing the XML file.

setEncoding

public void setEncoding(java.lang.String encoding)
                 throws java.io.UnsupportedEncodingException
Sets the encoding used for writing the XML file. Will throw an error if the encoding is invalid.

Parameters:
encoding - the encoding used for writing the XML file
Throws:
java.io.UnsupportedEncodingException

setFilename

public void setFilename(java.lang.String filename)
                 throws java.lang.IllegalArgumentException
Sets the filename used to export forum data to. Note, only letters, numbers, "-", "_" and "." are allowed in the name of the file. If invalid characters are detected, an IllegalArgumentException will be thrown.

Parameters:
filename - the name of the file to export data to.
Throws:
java.lang.IllegalArgumentException

getFilename

public java.lang.String getFilename()
Returns the name of the file to export data to. Note, this does not return the full path - just the filename.

Returns:
the name of the file to export data to.

getTaskMaximum

public int getTaskMaximum()
Description copied from interface: PollableRunnable
Returns the maximum value of task progress (default is 100). If this is in indeterminate mode then this will return -1.

Specified by:
getTaskMaximum in interface PollableRunnable
Overrides:
getTaskMaximum in class AbstractPollableRunnable
Returns:
the maximum value of task progress.

getTaskValue

public int getTaskValue()
Description copied from interface: PollableRunnable
Returns the current value of the task's progress. This will be x where min <= x <= max. If this is in indeterminate mode then this will return -1.

Specified by:
getTaskValue in interface PollableRunnable
Specified by:
getTaskValue in class AbstractPollableRunnable
Returns:
the current value of the task's progress.

getErrors

public java.util.Collection getErrors()
Returns an unmodifiable collection of errors (if any) that occured during data export.

Returns:
a collection of errors.

doRun

public void doRun()
Writes out XML data from the Jive Forums system.

Specified by:
doRun in class AbstractPollableRunnable

main

public static void main(java.lang.String[] args)

Jive Forums Project Page

Copyright © 1999-2006 Jive Software.