wt.step.processor.conversion
Class EPMSchemaConverter

java.lang.Object
  extended bywt.step.processor.conversion.SchemaConverter
      extended bywt.step.processor.conversion.EPMSchemaConverter

public class EPMSchemaConverter
extends SchemaConverter

The EDMS Toolkit (from EPM Technology) implementation of the SchemaConverter interface. This uses Express/X mappings to convert between Windchill and other standard schemas. The Toolkit uses a temporary database to hold schemas, mappings and models. For speed this database is only created/updated as needed.


Nested Class Summary
(package private) static class EPMSchemaConverter.PropertiesWrapper
          Test code
 
Nested classes inherited from class wt.step.processor.conversion.SchemaConverter
SchemaConverter.ExtensionFilter
 
Field Summary
private  edm.edmi.CEDMDatabase _database
           
private  iso10303.sdai.SdaiRepository _dictionaryRepository
           
private  File _logFile
           
private  String _logFilename
           
private  iso10303.sdai.SdaiSession _session
           
private  iso10303.sdai.SdaiRepository _workingRepository
           
private static String EDMS_DB_DIR_PROP
          EPM Toolkit database access properties
private static String EDMS_DB_NAME_PROP
           
private static String EDMS_DB_PASSWORD_PROP
           
private static String EDMS_DICTIONARY_REPOSITORY
           
private static String EDMS_WORKING_HEADER_MODEL
           
private static String EDMS_WORKING_REPOSITORY
          EPM Toolkit database defaults
private static String EDMS_WORKING_SRC_MODEL
           
private static String EDMS_WORKING_TARGET_MODEL
           
private static String EXPRESSX_MODEL_POSTFIX
           
private static String FORCE_MAPPING_RELOAD_PROP
           
private static String FORCE_RELOAD_ALL_PROP
           
private static String HEADER_MODEL_FILE_PROP
           
private static int STEP_FILE_REAL_PRECISION
           
private static String STEPFILE_BACKUP_POSTFIX
           
 
Fields inherited from class wt.step.processor.conversion.SchemaConverter
SCHEMAS_DIR_PROP, WINDCHILL_SCHEMA_NAME_PROP
 
Constructor Summary
EPMSchemaConverter()
           
 
Method Summary
private  void applyMapping(String srcSchemaName, String targetSchemaName, File mappingFile, String srcFilename, String targetFilename)
           
private  void closeDatabase(String dbPassword)
           
private  void convertDataFile(String srcFilename, String srcSchemaName, String mappingName, String headerModelFilename, String targetSchemaName, String targetFilename)
           
 void convertForExport(String srcFilename, String targetFilename, String exportSchemaName)
          Converts the source file from Windchill schema to that defined by the converters configuration.
 void convertForImport(String srcFilename, String targetFilename, String importSchemaName)
          Converts the source file to Windchill schema from that defined by the converters configuration.
private  void deleteMapping(String mappingName)
           
private  void deleteModel(iso10303.sdai.SdaiRepository repository, String modelName)
          Delete a model from the specified repository
private  void deleteModel(String modelName)
          Delete a model (defaults to the 'working' repository
private  iso10303.sdai.SdaiModel getModel(iso10303.sdai.SdaiRepository repository, String modelName)
           
private  void initialiseLogFile()
           
private  void loadMapping(File mappingFile, String mappingName)
           
private  void loadModel(String stepFilename, String repositoryName, String modelName, boolean isHeaderModel)
          Load a model from a STEP file
private  void loadSchema(File schemaFile, String schemaName)
          Load a schema into the EPM database.
static void main(String[] args)
           
private  boolean mappingExists(String mappingName)
          Check wether an express X mapping already exists.
protected  void openDatabase(String dbPassword, boolean deleteExisting)
          Open a EPM Database, creating it if necessary.
private  boolean schemaExists(String schemaName)
           
private  void test(String[] args)
           
private  void updateHeader(String headerModelFilename, String schema, String filename)
           
private  void updateMapping(boolean forceMappingReload, String mappingName, File mappingFile)
           
private  void updateSchemas(String srcSchemaName, File srcSchemaFile, String targetSchemaName, File targetSchemaFile)
           
 
Methods inherited from class wt.step.processor.conversion.SchemaConverter
clearConversionLog, getConversionLog, getConverterInstance, getExportMappingFile, getExportSchemaNames, getExpressNameFromFile, getImportMappingFile, getImportSchemaNames, getLogFilename, getMandatoryProperty, getProperty, getSchemaFile, getSingleTypedFile, getWindchillSchemaFilename
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EDMS_DB_DIR_PROP

private static final String EDMS_DB_DIR_PROP
EPM Toolkit database access properties

See Also:
Constant Field Values

EDMS_DB_NAME_PROP

private static final String EDMS_DB_NAME_PROP
See Also:
Constant Field Values

EDMS_DB_PASSWORD_PROP

private static final String EDMS_DB_PASSWORD_PROP
See Also:
Constant Field Values

FORCE_MAPPING_RELOAD_PROP

private static final String FORCE_MAPPING_RELOAD_PROP
See Also:
Constant Field Values

FORCE_RELOAD_ALL_PROP

private static final String FORCE_RELOAD_ALL_PROP
See Also:
Constant Field Values

HEADER_MODEL_FILE_PROP

private static final String HEADER_MODEL_FILE_PROP
See Also:
Constant Field Values

EDMS_WORKING_REPOSITORY

private static final String EDMS_WORKING_REPOSITORY
EPM Toolkit database defaults

See Also:
Constant Field Values

EDMS_DICTIONARY_REPOSITORY

private static final String EDMS_DICTIONARY_REPOSITORY
See Also:
Constant Field Values

EDMS_WORKING_SRC_MODEL

private static final String EDMS_WORKING_SRC_MODEL
See Also:
Constant Field Values

EDMS_WORKING_TARGET_MODEL

private static final String EDMS_WORKING_TARGET_MODEL
See Also:
Constant Field Values

EDMS_WORKING_HEADER_MODEL

private static final String EDMS_WORKING_HEADER_MODEL
See Also:
Constant Field Values

STEP_FILE_REAL_PRECISION

private static final int STEP_FILE_REAL_PRECISION
See Also:
Constant Field Values

STEPFILE_BACKUP_POSTFIX

private static final String STEPFILE_BACKUP_POSTFIX
See Also:
Constant Field Values

EXPRESSX_MODEL_POSTFIX

private static final String EXPRESSX_MODEL_POSTFIX
See Also:
Constant Field Values

_logFilename

private String _logFilename

_logFile

private File _logFile

_database

private edm.edmi.CEDMDatabase _database

_session

private iso10303.sdai.SdaiSession _session

_workingRepository

private iso10303.sdai.SdaiRepository _workingRepository

_dictionaryRepository

private iso10303.sdai.SdaiRepository _dictionaryRepository
Constructor Detail

EPMSchemaConverter

public EPMSchemaConverter()
Method Detail

convertForExport

public void convertForExport(String srcFilename,
                             String targetFilename,
                             String exportSchemaName)
                      throws ConversionException,
                             TransferException
Description copied from class: SchemaConverter
Converts the source file from Windchill schema to that defined by the converters configuration. The result is the completed export file. Implementations can assume that the source and target files will have a different file location/name.

Specified by:
convertForExport in class SchemaConverter
Parameters:
exportSchemaName - The name of the schema to export to. This should
Throws:
ConversionException
TransferException

convertForImport

public void convertForImport(String srcFilename,
                             String targetFilename,
                             String importSchemaName)
                      throws ConversionException,
                             TransferException
Description copied from class: SchemaConverter
Converts the source file to Windchill schema from that defined by the converters configuration. The result is a STEP file ready for import into Windchill. Implementations can assume that the source and target files will have a different file location/name.

Specified by:
convertForImport in class SchemaConverter
Throws:
ConversionException
TransferException

applyMapping

private void applyMapping(String srcSchemaName,
                          String targetSchemaName,
                          File mappingFile,
                          String srcFilename,
                          String targetFilename)
                   throws ConversionException,
                          TransferException
Throws:
ConversionException
TransferException

initialiseLogFile

private void initialiseLogFile()

openDatabase

protected void openDatabase(String dbPassword,
                            boolean deleteExisting)
                     throws ConversionException
Open a EPM Database, creating it if necessary.

Parameters:
dbPassword - The password used to open or create the database.
deleteExisting - Delete any existing working database. This has the effect of forcing all schemas and mappings to be reloaded.
Throws:
ConversionException

updateSchemas

private void updateSchemas(String srcSchemaName,
                           File srcSchemaFile,
                           String targetSchemaName,
                           File targetSchemaFile)
                    throws ConversionException
Throws:
ConversionException

updateMapping

private void updateMapping(boolean forceMappingReload,
                           String mappingName,
                           File mappingFile)
                    throws ConversionException
Throws:
ConversionException

updateHeader

private void updateHeader(String headerModelFilename,
                          String schema,
                          String filename)
                   throws ConversionException
Throws:
ConversionException

schemaExists

private boolean schemaExists(String schemaName)

loadSchema

private void loadSchema(File schemaFile,
                        String schemaName)
                 throws ConversionException
Load a schema into the EPM database.

Throws:
ConversionException

mappingExists

private boolean mappingExists(String mappingName)
                       throws ConversionException
Check wether an express X mapping already exists. Dependent on the rule that the internal model recording the mapping has name _XPX_MAP.

Throws:
ConversionException

loadMapping

private void loadMapping(File mappingFile,
                         String mappingName)
                  throws ConversionException
Throws:
ConversionException

convertDataFile

private void convertDataFile(String srcFilename,
                             String srcSchemaName,
                             String mappingName,
                             String headerModelFilename,
                             String targetSchemaName,
                             String targetFilename)
                      throws ConversionException
Throws:
ConversionException

closeDatabase

private void closeDatabase(String dbPassword)
                    throws ConversionException
Throws:
ConversionException

deleteMapping

private void deleteMapping(String mappingName)
                    throws ConversionException
Throws:
ConversionException

deleteModel

private void deleteModel(String modelName)
                  throws ConversionException
Delete a model (defaults to the 'working' repository

Throws:
ConversionException

deleteModel

private void deleteModel(iso10303.sdai.SdaiRepository repository,
                         String modelName)
                  throws ConversionException
Delete a model from the specified repository

Throws:
ConversionException

getModel

private iso10303.sdai.SdaiModel getModel(iso10303.sdai.SdaiRepository repository,
                                         String modelName)
                                  throws ConversionException
Throws:
ConversionException

loadModel

private void loadModel(String stepFilename,
                       String repositoryName,
                       String modelName,
                       boolean isHeaderModel)
                throws ConversionException
Load a model from a STEP file

Throws:
ConversionException

main

public static void main(String[] args)
                 throws Throwable
Throws:
Throwable

test

private void test(String[] args)
           throws Throwable
Throws:
Throwable