com.ptc.windchill.upgrade.dust
Class ExportBlobDataServer

java.lang.Object
  extended bycom.ptc.windchill.upgrade.dust.ExportBlobDataServer
All Implemented Interfaces:
RemoteAccess

public class ExportBlobDataServer
extends Object
implements RemoteAccess

For the given class and its descendents, finds all properties of those classes which are blobs. For each blob, extract it from the database, and write the encoded object to the data file. A file will be written for each class examined and will have the same name as the class with a .data suffix.


Field Summary
private static boolean DEVELOPER_MODE
           
private  boolean enforce
           
private static String EXPORT_SERVER_METHOD_NAME
           
private  ExportXMLHandler handler
           
static int INLINEBLOB
           
private static ExportBlobDataServer instance__
           
private  ExportLogging logger
           
private static int MAX_OBJECTS
           
private  int number_of_classes_processed
           
static int ORACLE_8_0_BLOB_TYPE
           
private static int PAGE_SIZE
           
private static int PAGE_SIZE_DEFAULT
           
private  PagingIteratorIfc pagingIterator
           
private static String RESOURCE
           
private  Hashtable serializedClasses
           
private static String SERVER_CLASS_NAME
           
static int SMALLBLOB
           
private  TimerStats timerStats
           
private  long totalInstanceCount_
           
private  boolean useMaxObjects
           
 
Fields inherited from interface wt.method.RemoteAccess
versionID
 
Constructor Summary
ExportBlobDataServer()
           
 
Method Summary
private  void addIfNeeded(SortedSet set, ClassInfo class_info)
          Return the set of classes and their descendants, including only those which are concrete and persistable.
private  boolean changeAccessControl(boolean setting)
          Changes the access control, returning the initial setting.
private  String exportBlobDataFor_(String output_dir, String root_class_name, String release_level, Integer page_size, Integer max_objects)
           
static String exportBlobDataFor(String dir, String class_name, String release_level, Integer page_size, Integer max_objects)
          Request to rewrite all blobs for each concrete persistable class to .xml files.
private  SortedSet getAllClassNames(String root_class_name)
          Return the set of the class and its descendants, including only those which are concrete and persistable.
private  SortedSet getAllClassNames(String[] root_class_names)
          Return the set of classes and their descendants, including only those which are concrete and persistable.
private  PropertyDescriptor[] getBlobPropertyDescriptors(ClassInfo ci)
          Returns an array of PropertyDescriptor with an entry for each property that is a persistent blob type.
static ExportBlobDataServer getInstance()
           
private  File getOutputDirectory(String output_dir)
          Ensures the directory specified by the user argument is usable.
private  void interrupt()
          Halt processing.
private  boolean isBlobLike(PropertyDescriptor pd, ColumnDescriptor[] cds)
          Determines whether the property is stored in as a blob-like object.
private static boolean isConcretePersistable(ClassInfo class_info)
          Returns true if the class is both concrete and persistable.
static boolean isSQLTypeBlob(int sql_type)
           
private  int queryAndExport(ClassInfo class_info, PropertyDescriptor[] blob_pds)
          For each instance of class_info type classes, read blob data, serialize it, encode it, and write it as XML to a data file.
private  Object readBlob(Persistable p, PropertyDescriptor blob_pds)
          Returns a de-serialized blob object.
private  void stop()
          Halt processing.
private  void writeBlobsForClass(String class_name, File dir, int total_number_of_classes)
          The main loop called for each class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEVELOPER_MODE

private static final boolean DEVELOPER_MODE
See Also:
Constant Field Values

PAGE_SIZE_DEFAULT

private static final int PAGE_SIZE_DEFAULT
See Also:
Constant Field Values

PAGE_SIZE

private static int PAGE_SIZE

MAX_OBJECTS

private static int MAX_OBJECTS

RESOURCE

private static final String RESOURCE

SERVER_CLASS_NAME

private static final String SERVER_CLASS_NAME

EXPORT_SERVER_METHOD_NAME

private static final String EXPORT_SERVER_METHOD_NAME
See Also:
Constant Field Values

SMALLBLOB

public static final int SMALLBLOB
See Also:
Constant Field Values

INLINEBLOB

public static final int INLINEBLOB
See Also:
Constant Field Values

ORACLE_8_0_BLOB_TYPE

public static final int ORACLE_8_0_BLOB_TYPE
See Also:
Constant Field Values

instance__

private static ExportBlobDataServer instance__

logger

private ExportLogging logger

enforce

private boolean enforce

useMaxObjects

private boolean useMaxObjects

timerStats

private TimerStats timerStats

handler

private ExportXMLHandler handler

totalInstanceCount_

private long totalInstanceCount_

serializedClasses

private Hashtable serializedClasses

number_of_classes_processed

private int number_of_classes_processed

pagingIterator

private PagingIteratorIfc pagingIterator
Constructor Detail

ExportBlobDataServer

public ExportBlobDataServer()
                     throws WTException
Method Detail

getInstance

public static ExportBlobDataServer getInstance()
                                        throws WTException
Throws:
WTException

exportBlobDataFor

public static String exportBlobDataFor(String dir,
                                       String class_name,
                                       String release_level,
                                       Integer page_size,
                                       Integer max_objects)
                                throws WTException
Request to rewrite all blobs for each concrete persistable class to .xml files.

Parameters:
dir - the output directory
class_name - export blobs for objects of this class and all subclasses/implementations of this class
Throws:
WTException

exportBlobDataFor_

private String exportBlobDataFor_(String output_dir,
                                  String root_class_name,
                                  String release_level,
                                  Integer page_size,
                                  Integer max_objects)
                           throws WTException
Throws:
WTException

writeBlobsForClass

private void writeBlobsForClass(String class_name,
                                File dir,
                                int total_number_of_classes)
                         throws WTException,
                                InterruptedException
The main loop called for each class. This method does the The class will be skipped if a data file by the same name already exists in the output directory.

Throws:
WTException
InterruptedException

queryAndExport

private int queryAndExport(ClassInfo class_info,
                           PropertyDescriptor[] blob_pds)
                    throws SAXException,
                           WTException,
                           InterruptedException
For each instance of class_info type classes, read blob data, serialize it, encode it, and write it as XML to a data file.

Throws:
SAXException
WTException
InterruptedException

readBlob

private Object readBlob(Persistable p,
                        PropertyDescriptor blob_pds)
                 throws WTException,
                        InvocationTargetException,
                        IllegalAccessException
Returns a de-serialized blob object.

Throws:
WTException
InvocationTargetException
IllegalAccessException

getBlobPropertyDescriptors

private PropertyDescriptor[] getBlobPropertyDescriptors(ClassInfo ci)
                                                 throws WTException
Returns an array of PropertyDescriptor with an entry for each property that is a persistent blob type.

Throws:
WTException

isBlobLike

private boolean isBlobLike(PropertyDescriptor pd,
                           ColumnDescriptor[] cds)
Determines whether the property is stored in as a blob-like object. A blob-like object is either a true database blob, or a serialized object stored as a VARCHAR.


isSQLTypeBlob

public static boolean isSQLTypeBlob(int sql_type)

getAllClassNames

private SortedSet getAllClassNames(String root_class_name)
                            throws WTException
Return the set of the class and its descendants, including only those which are concrete and persistable.

Throws:
WTException

getAllClassNames

private SortedSet getAllClassNames(String[] root_class_names)
                            throws WTException
Return the set of classes and their descendants, including only those which are concrete and persistable.

Throws:
WTException

addIfNeeded

private void addIfNeeded(SortedSet set,
                         ClassInfo class_info)
Return the set of classes and their descendants, including only those which are concrete and persistable.


isConcretePersistable

private static boolean isConcretePersistable(ClassInfo class_info)
Returns true if the class is both concrete and persistable.


interrupt

private void interrupt()
Halt processing. Called when it is detected that the client is no longer responding to feedback.


stop

private void stop()
Halt processing. Called when it is detected that the client is no longer responding to feedback.


changeAccessControl

private boolean changeAccessControl(boolean setting)
Changes the access control, returning the initial setting.


getOutputDirectory

private File getOutputDirectory(String output_dir)
                         throws WTException
Ensures the directory specified by the user argument is usable.

Throws:
WTException