Autodesk FDO Bulk Copy Utility API Reference

FDO Utility Bulk Copy API

API Reference Autodesk FDO Bulk Copy Utility

FdoBulkCopy.h

Go to the documentation of this file.
00001 #ifndef FDO_BULKCOPY_H
00002 #define FDO_BULKCOPY_H
00003 // 
00004 
00005  //
00006  // Copyright (C) 2004-2006  Autodesk, Inc.
00007  // 
00008  // This library is free software; you can redistribute it and/or
00009  // modify it under the terms of version 2.1 of the GNU Lesser
00010  // General Public License as published by the Free Software Foundation.
00011  // 
00012  // This library is distributed in the hope that it will be useful,
00013  // but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  // Lesser General Public License for more details.
00016  // 
00017  // You should have received a copy of the GNU Lesser General Public
00018  // License along with this library; if not, write to the Free Software
00019  // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00020 
00021 #include <Fdo.h>
00022 #include <Fdo/Xml/Deserializable.h>
00023 #include <Fdo/Xml/Serializable.h>
00024 #include <Utilities/FdoBulkCopy.h>
00025 class FdoIConnection;
00026 
00027 #include <Utilities/BulkCopy/FdoBulkCopyMappingSchemaCollection.h>
00028 #include <Utilities/BulkCopy/FdoBulkCopyProgress.h>
00029 
00030 /// <summary> FdoBulkCopyOptions is an enumeration of the different options for processing of bulk copy.</summary>
00031 /// <param name="FdoBulkCopyOptions_None">No options are specified.</param> 
00032 /// <param name="FdoBulkCopyOptions_IgnoreErrors">Continue inserting objects if there is an error.</param> 
00033 /// <param name="FdoBulkCopyOptions_IgnoreUnsupportedData">Ignore datatypes that doesn't exist, geometric types that doesn't exist, etc</param> 
00034 /// <param name="FdoBulkCopyOptions_IgnoreUnknownCoordSysMismatch">Copy the geometry with no transformation of the coordinates if the input or output coordinate system is unknown or arbitrary</param> 
00035 
00036 enum FdoBulkCopyOptions
00037 {
00038     FdoBulkCopyOptions_None = 0x0,
00039     FdoBulkCopyOptions_IgnoreErrors = 0x01, // continue inserting features if there is an error
00040     FdoBulkCopyOptions_IgnoreUnsupportedData = 0x02, // ignore datatypes that doesn't exist, geometric types that doesn't exist, etc.
00041     FdoBulkCopyOptions_IgnoreUnknownCoordSysMismatch = 0x04 // copy the geometry with no transformation of the coordinates if the input or output coordinate system is unknown or arbitrary
00042 
00043 };
00044 
00045 ///<summary>The FdoBulkCopy class is used to copy data from a source datastore to a target datastore.</summary>
00046 
00047 class FdoBulkCopy : public FdoXmlDeserializable, public FdoXmlSerializable, public FdoIDisposable
00048 {
00049 
00050 public:
00051     ///<summary>Constructs a default empty instance of a FdoBulkCopy.</summary>
00052     /// <returns>Returns FdoBulkCopy</returns> 
00053     FDOBULKCOPY_API static FdoBulkCopy* Create();
00054 
00055     ///<summary>Sets the source connection.</summary>
00056     /// <param name="connection">The source connection</param> 
00057     /// <returns>Returns nothing</returns> 
00058     FDOBULKCOPY_API void SetSourceConnection(FdoIConnection* connection);
00059 
00060     ///<summary>Gets the source connection.</summary>
00061     /// <returns>Returns the source connection</returns> 
00062     FDOBULKCOPY_API FdoIConnection* GetSourceConnection();
00063 
00064     ///<summary>Sets the target connection.</summary>
00065     /// <param name="connection">The target connection</param> 
00066     /// <returns>Returns nothing</returns> 
00067     FDOBULKCOPY_API void SetTargetConnection(FdoIConnection* connection);
00068 
00069     ///<summary>Gets the target connection.</summary>
00070     /// <returns>Returns the target connection</returns> 
00071     FDOBULKCOPY_API FdoIConnection* GetTargetConnection();
00072 
00073     ///<summary>Sets the logfile name.</summary>
00074     /// <param name="logFile">The logfile name</param> 
00075     /// <returns>Returns nothing</returns> 
00076     FDOBULKCOPY_API void SetLogFile(FdoString *logFile);
00077 
00078     ///<summary>Gets the logfile name.</summary>
00079     /// <returns>Returns the logfile name</returns> 
00080     FDOBULKCOPY_API FdoString *GetLogFile();
00081 
00082     ///<summary>Sets the options.</summary>
00083     /// <param name="options">The options</param> 
00084     /// <returns>Returns nothing</returns> 
00085     FDOBULKCOPY_API void SetOptions(FdoInt32 options);
00086 
00087     ///<summary>Gets the options.</summary>
00088     /// <returns>Returns the options</returns> 
00089     FDOBULKCOPY_API FdoInt32 GetOptions();
00090 
00091     ///<summary>Sets the transaction size.</summary>
00092     /// <param name="transactionSize">The transaction size</param> 
00093     /// <returns>Returns nothing</returns> 
00094     FDOBULKCOPY_API void SetTransactionSize(FdoInt32 transactionSize);
00095 
00096     ///<summary>Gets the transaction size.</summary>
00097     /// <returns>Returns the transaction size</returns> 
00098     FDOBULKCOPY_API FdoInt32 GetTransactionSize();
00099 
00100     ///<summary>Gets the mapping schema. Returns an empty FdoBulkCopyMappingSchemaCollection
00101     ///collection if ReadXML is not called. Otherwise, returns the mapping data from the XML
00102     ///mapping file. An empty collection will copy all the schemas from the source datastore.
00103     ///If a subset of the schemas should be copied, a FdoBulkCopyMappingSchema object should be
00104     ///added to the collection for each schema.
00105     ////</summary>
00106     /// <returns>Returns the mapping schema</returns> 
00107     FDOBULKCOPY_API FdoBulkCopyMappingSchemaCollection* GetMappingSchemas();
00108 
00109     ///<summary>Executes the bulk copy.</summary>
00110     /// <param name="progress">The progress callback object.</param> 
00111     /// <returns>Number of objects inserted</returns> 
00112     FDOBULKCOPY_API FdoInt32 Execute(FdoBulkCopyProgress *progress = NULL);
00113 
00114 //DOM-IGNORE-BEGIN
00115     // Public non-API functions for XML support
00116     virtual FdoXmlSaxHandler* XmlStartElement(
00117         FdoXmlSaxContext* context, 
00118         FdoString* uri, 
00119         FdoString* name, 
00120         FdoString* qname, 
00121         FdoXmlAttributeCollection* atts
00122     );
00123     virtual FdoBoolean XmlEndElement(
00124         FdoXmlSaxContext* context, 
00125         FdoString* uri, 
00126         FdoString* name, 
00127         FdoString* qname
00128     );
00129 
00130 protected:
00131     FdoBulkCopy();
00132     virtual ~FdoBulkCopy();
00133     virtual void Dispose();
00134 
00135     void _writeXml(FdoXmlWriter *,const FdoXmlFlags *);
00136 
00137 
00138 private:
00139 
00140     FdoPtr<FdoIConnection> mSourceConnection;
00141     FdoPtr<FdoIConnection> mTargetConnection;
00142     FdoStringP mFileName;
00143     FdoPtr<FdoBulkCopyMappingSchemaCollection> mSchemas;
00144     FdoPtr<FdoBulkCopyMappingSchema> mCurrentSchema; //used for reading xml
00145     FdoPtr<FdoBulkCopyMappingClass> mCurrentClass; // used for reading xml
00146     FdoInt32 mOptions;
00147     int mTransactionSize;
00148     FdoPtr<FdoBulkCopyProgress> mProgress;
00149 
00150 //DOM-IGNORE-END
00151 
00152 };
00153 
00154 #endif

Comments?