com.ptc.edadata
Class EdaData

java.lang.Object
  extended bycom.ptc.edadata.EdaData

public class EdaData
extends Object

Title: EdaData

Description: This is the top-level class which contains the main calls to gather data from InterComm

Copyright: Copyright (c) 2004

Company: PTC


Field Summary
private  ExtensionFilter m_attrFormat
           
private  boolean m_bDeleteTarget
           
private  boolean m_bGetAllVariants
           
private  BOMColumnDef[] m_bomColumnDef
           
private  ExtensionFilter m_bomFormat
           
private  BOMListMember[] m_bomListAll
           
private  BOMRow[] m_bomRow
           
private  ExtensionFilter m_brdFormat
           
private  ExtensionFilter m_briFormat
           
private  BOMResponseItem m_bsItem
           
private  ExtensionFilter m_cfgFormat
           
private  ExtensionFilter m_cpmFormat
           
private  ExtensionFilter m_dvptFormat
           
private  String m_ecadType
           
private  ExtensionFilter m_edaFormat
           
private  ExtensionFilter m_eddmFormat
           
private  ExtensionFilter m_edfFormat
           
private  ExtensionFilter m_hkpFormat
           
private  ExtensionFilter m_iffFormat
           
private  ExtensionFilter m_iniFormat
           
private  int m_iTotalDimensions
           
private  int m_iTotalRecords
           
private  ExtensionFilter m_libFormat
           
private  ExtensionFilter m_mcmFormat
           
private  ExtensionFilter m_mgcComp
           
private  ExtensionFilter m_mgcFormat
           
private  ExtensionFilter m_mgnFormat
           
private  ExtensionFilter m_pcbFormat
           
private  Properties m_properties
           
private  SchematicRequestItem m_srItem
           
private static String m_strAPI
           
private  String m_strBRIConvertFile
           
private  String m_strChangeDir
           
private  String m_strCMD
           
private  String m_strCMDBatch
           
private  String m_strCMDQuotes
           
private  String m_strConduitBinPath
           
private  String m_strDel
           
private  String m_strDelim
           
private  String m_strDesignAppPath
           
private  String m_strDesignFile
           
private  String m_strDesignFileText
           
private  String m_strDesignRootPath
           
private  String m_strEddmType
           
private  String m_strICM
           
private  String m_strIFFConvertFile
           
private  String m_strInterAppPath
           
private  String m_strLibraryPath
           
private  String m_strMaster
           
private  String m_strMGCComp
           
private  String m_strMGCType
           
private  String m_strMGNConvertFile
           
private  String m_strOpen
           
private  String m_strOS
           
private  String m_strOutputFilePath
           
private  String m_strPCB
           
private  String m_strPCBConvertBatchFile
           
private  String m_strSCH
           
private  String m_strSchematic
           
private  String m_strSeperateCommand
           
private  String m_strShellCMD
           
private  String m_strTargetPath
           
private  String[] m_strTargetText
           
private  String m_strTempBOMFile
           
private  String m_strTempFilePath
           
private  String m_strTMPCFG
           
private  String m_strTools
           
private  String m_strUnknown
           
private  String m_strUnknownDir
           
private  String m_strUnknownFile
           
private  String m_strVersionScriptFile
           
private  String m_strViewDraw
           
private  ExtensionFilter m_tagFormat
           
private  ExtensionFilter m_textFormat
           
private  Vector m_vecFiles
           
private  Vector m_vectBomList
           
private static String NO_DIRECTORY
           
 
Constructor Summary
EdaData()
          Empty constructor
 
Method Summary
private  String applyQuotes(String command)
           
private  boolean checkDesignFile(File designFile)
           
private  File[] checkDesignFiles(File[] designFiles)
           
private  Vector checkDesignFiles(Vector designFiles)
           
private  FileListResponseItem checkFileList(FileListResponseItem fri)
           
private  void clearData()
           
 BOMListMember consolidateBOM(BOMListMember bom, String numberColName, String nameColName, String qtyColName, String refDesColName)
          Consolidate raw BOM by given columns
private  boolean containsElement(Vector container, String element)
           
private  File convertFileFormat(File fileSource, String format)
           
private  Vector convertFiles(File[] designFiles)
           
private  FileListMember[] convertFiles(File[] designFiles, String role)
           
private  File[] convertFiles(FileListResponseItem flri)
          Utility method to convert all FileListResponseItems to File[]
private  File[] convertFiles(Vector designFiles)
           
private  FileListMember[] convertFiles(Vector designFiles, String role)
           
private  String[] convertFileString(File[] designFiles)
           
private  File createBOMBatchFile(File[] designFiles)
           
private  File[] createBOMFiles(File[] edaFiles)
           
private  File createEDABatchFile(File[] designFiles, String storageDir)
           
private  String createTimeStamp(String string)
           
private  boolean deleteTarget()
           
private  Vector executeCommand(String commandLine)
           
private  File[] filterDesignFormat(File[] designFiles)
           
private  String fixVarName(String variable)
           
private  FileListResponseItem getArchiveFiles()
          This method will get all the files in the design container directory
private  Vector getBoardFiles(File rootDir, boolean doRecurse)
           
private  String getBoardPath(File rootDir)
           
private  BOMResponseItem getBOM(File designFile)
          This method will generate a BOM and return the data object
private  CleanupResponseItem getCleanup()
           
private  String getCommand(String designFile, String executableFile)
           
private  File getConfigFile(File parentDir)
           
private  String getConvertBOMCommand(FileListResponseItem fri)
           
private  String getConvertEDACommand(FileListResponseItem fri)
           
private  File[] getDefaultFiles(File rootDir, boolean recursive)
           
private  FileListResponseItem getDesignFiles()
           
private  String getDesignLib(File[] rootFiles)
           
private  EDAViewableResponseItem getEDAViewables()
           
private  Vector getFiles(File rootDir)
           
private  Vector getFormat(File[] designFiles)
           
private  String getLatestViewpoint(File fileName, String objectType)
           
private  File getMasterDesignFile(FileListMember[] flm)
           
private  Vector getOutput(String commandLine)
           
private  VerifyDesignResponseItem getVerifyDesigns()
           
private  void initializeEDAData()
           
private  boolean isDesignFiles(File[] designFiles)
           
private  boolean isMasterDesignFile(FileListMember flm)
           
private  File[] matchFiles(File[] designFiles, org.apache.regexp.RE pattern)
           
private  void printErrString(String stringName)
           
private  void printOutString(String commandName)
           
private  void printOutString(String commandName, String[] output)
           
private  void printOutString(String commandName, Vector output)
           
private  void processData(BufferedReader input)
           
 Response ProcessRequest(Request request)
           
private  void readData(BufferedReader input)
           
private  String removeElement(String stringName, int position)
           
private  String safeDirString(String pathName)
           
private  String safeDirTrailSlash(String pathName)
           
private  String safeQuotes(String pathName)
           
private  String safeSlashes(String pathName, String ecadType)
           
private  String safeString(String pathName)
           
private  FileListMember[] setFileRoles(FileListMember[] flm)
           
private  void storeData(String[] values, int row)
           
private  boolean writeToTarget()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_bsItem

private BOMResponseItem m_bsItem

m_strAPI

private static final String m_strAPI
See Also:
Constant Field Values

m_srItem

private SchematicRequestItem m_srItem

NO_DIRECTORY

private static final String NO_DIRECTORY
See Also:
Constant Field Values

m_iTotalDimensions

private int m_iTotalDimensions

m_iTotalRecords

private int m_iTotalRecords

m_strDelim

private String m_strDelim

m_bomColumnDef

private BOMColumnDef[] m_bomColumnDef

m_bomRow

private BOMRow[] m_bomRow

m_vectBomList

private Vector m_vectBomList

m_bomListAll

private BOMListMember[] m_bomListAll

m_properties

private Properties m_properties

m_strOS

private String m_strOS

m_strDel

private String m_strDel

m_strSeperateCommand

private String m_strSeperateCommand

m_strChangeDir

private String m_strChangeDir

m_strOpen

private String m_strOpen

m_strShellCMD

private String m_strShellCMD

m_strCMD

private String m_strCMD

m_strCMDBatch

private String m_strCMDBatch

m_strCMDQuotes

private String m_strCMDQuotes

m_strICM

private String m_strICM

m_strDesignRootPath

private String m_strDesignRootPath

m_strDesignAppPath

private String m_strDesignAppPath

m_strOutputFilePath

private String m_strOutputFilePath

m_strTempFilePath

private String m_strTempFilePath

m_strInterAppPath

private String m_strInterAppPath

m_strLibraryPath

private String m_strLibraryPath

m_strConduitBinPath

private String m_strConduitBinPath

m_strDesignFile

private String m_strDesignFile

m_ecadType

private String m_ecadType

m_strTargetPath

private String m_strTargetPath

m_bDeleteTarget

private boolean m_bDeleteTarget

m_strTargetText

private String[] m_strTargetText

m_bGetAllVariants

private boolean m_bGetAllVariants

m_vecFiles

private Vector m_vecFiles

m_strIFFConvertFile

private final String m_strIFFConvertFile

m_strMGNConvertFile

private final String m_strMGNConvertFile

m_strVersionScriptFile

private final String m_strVersionScriptFile

m_strPCBConvertBatchFile

private final String m_strPCBConvertBatchFile

m_strBRIConvertFile

private final String m_strBRIConvertFile

m_strTools

private final String m_strTools
See Also:
Constant Field Values

m_strDesignFileText

private final String m_strDesignFileText

m_strUnknown

private final String m_strUnknown

m_strUnknownFile

private final String m_strUnknownFile

m_strUnknownDir

private final String m_strUnknownDir

m_strMaster

private final String m_strMaster

m_strEddmType

private final String m_strEddmType

m_strSchematic

private final String m_strSchematic

m_strPCB

private final String m_strPCB

m_strMGCType

private final String m_strMGCType

m_strMGCComp

private final String m_strMGCComp

m_strSCH

private final String m_strSCH

m_strViewDraw

private final String m_strViewDraw

m_strTempBOMFile

private String m_strTempBOMFile

m_cpmFormat

private ExtensionFilter m_cpmFormat

m_brdFormat

private ExtensionFilter m_brdFormat

m_mcmFormat

private ExtensionFilter m_mcmFormat

m_textFormat

private ExtensionFilter m_textFormat

m_tagFormat

private ExtensionFilter m_tagFormat

m_edaFormat

private ExtensionFilter m_edaFormat

m_iffFormat

private ExtensionFilter m_iffFormat

m_bomFormat

private ExtensionFilter m_bomFormat

m_libFormat

private ExtensionFilter m_libFormat

m_attrFormat

private ExtensionFilter m_attrFormat

m_dvptFormat

private ExtensionFilter m_dvptFormat

m_eddmFormat

private ExtensionFilter m_eddmFormat

m_mgcFormat

private ExtensionFilter m_mgcFormat

m_mgcComp

private ExtensionFilter m_mgcComp

m_edfFormat

private ExtensionFilter m_edfFormat

m_mgnFormat

private ExtensionFilter m_mgnFormat

m_iniFormat

private ExtensionFilter m_iniFormat

m_pcbFormat

private ExtensionFilter m_pcbFormat

m_hkpFormat

private ExtensionFilter m_hkpFormat

m_briFormat

private ExtensionFilter m_briFormat

m_cfgFormat

private ExtensionFilter m_cfgFormat

m_strTMPCFG

private final String m_strTMPCFG
Constructor Detail

EdaData

public EdaData()
Empty constructor

Method Detail

ProcessRequest

public Response ProcessRequest(Request request)
                        throws BOMResponseException,
                               FileListResponseException,
                               EDAViewableResponseException,
                               VerifyDesignResponseException,
                               CleanupResponseException
Throws:
BOMResponseException
FileListResponseException
EDAViewableResponseException
VerifyDesignResponseException
CleanupResponseException

createTimeStamp

private String createTimeStamp(String string)

printOutString

private void printOutString(String commandName)

printOutString

private void printOutString(String commandName,
                            Vector output)

printOutString

private void printOutString(String commandName,
                            String[] output)

printErrString

private void printErrString(String stringName)

getDesignFiles

private FileListResponseItem getDesignFiles()
                                     throws FileListResponseException
Throws:
FileListResponseException

getCommand

private String getCommand(String designFile,
                          String executableFile)
                   throws SecurityException,
                          org.apache.regexp.RESyntaxException
Throws:
SecurityException
org.apache.regexp.RESyntaxException

checkDesignFiles

private File[] checkDesignFiles(File[] designFiles)
                         throws IOException,
                                InterruptedException,
                                SecurityException,
                                org.apache.regexp.RESyntaxException
Throws:
IOException
InterruptedException
SecurityException
org.apache.regexp.RESyntaxException

checkDesignFiles

private Vector checkDesignFiles(Vector designFiles)
                         throws IOException,
                                InterruptedException,
                                org.apache.regexp.RESyntaxException
Throws:
IOException
InterruptedException
org.apache.regexp.RESyntaxException

isDesignFiles

private boolean isDesignFiles(File[] designFiles)
                       throws IOException,
                              InterruptedException,
                              SecurityException,
                              org.apache.regexp.RESyntaxException
Throws:
IOException
InterruptedException
SecurityException
org.apache.regexp.RESyntaxException

checkDesignFile

private boolean checkDesignFile(File designFile)
                         throws IOException,
                                InterruptedException,
                                SecurityException,
                                org.apache.regexp.RESyntaxException
Throws:
IOException
InterruptedException
SecurityException
org.apache.regexp.RESyntaxException

matchFiles

private File[] matchFiles(File[] designFiles,
                          org.apache.regexp.RE pattern)
                   throws SecurityException
Throws:
SecurityException

clearData

private void clearData()

convertFiles

private File[] convertFiles(FileListResponseItem flri)
Utility method to convert all FileListResponseItems to File[]

Parameters:
flri - FileListResponseItem
Returns:
File[]

convertFiles

private File[] convertFiles(Vector designFiles)

convertFiles

private Vector convertFiles(File[] designFiles)
                     throws SecurityException
Throws:
SecurityException

convertFileString

private String[] convertFileString(File[] designFiles)
                            throws SecurityException
Throws:
SecurityException

convertFiles

private FileListMember[] convertFiles(File[] designFiles,
                                      String role)
                               throws SecurityException
Throws:
SecurityException

convertFiles

private FileListMember[] convertFiles(Vector designFiles,
                                      String role)
                               throws SecurityException
Throws:
SecurityException

getConfigFile

private File getConfigFile(File parentDir)
                    throws IOException,
                           SecurityException,
                           org.apache.regexp.RESyntaxException
Throws:
IOException
SecurityException
org.apache.regexp.RESyntaxException

getArchiveFiles

private FileListResponseItem getArchiveFiles()
                                      throws FileListResponseException
This method will get all the files in the design container directory

Returns:
FileListResponseItem
Throws:
FileListResponseException

setFileRoles

private FileListMember[] setFileRoles(FileListMember[] flm)
                               throws IOException,
                                      InterruptedException,
                                      SecurityException,
                                      org.apache.regexp.RESyntaxException
Throws:
IOException
InterruptedException
SecurityException
org.apache.regexp.RESyntaxException

getMasterDesignFile

private File getMasterDesignFile(FileListMember[] flm)
                          throws IOException,
                                 InterruptedException,
                                 SecurityException
Throws:
IOException
InterruptedException
SecurityException

getFiles

private Vector getFiles(File rootDir)
                 throws IOException,
                        SecurityException
Throws:
IOException
SecurityException

getBoardFiles

private Vector getBoardFiles(File rootDir,
                             boolean doRecurse)
                      throws IOException,
                             InterruptedException,
                             SecurityException,
                             org.apache.regexp.RESyntaxException
Throws:
IOException
InterruptedException
SecurityException
org.apache.regexp.RESyntaxException

applyQuotes

private String applyQuotes(String command)

getDefaultFiles

private File[] getDefaultFiles(File rootDir,
                               boolean recursive)
                        throws IOException,
                               SecurityException
Throws:
IOException
SecurityException

getBoardPath

private String getBoardPath(File rootDir)
                     throws IOException,
                            InterruptedException,
                            SecurityException,
                            org.apache.regexp.RESyntaxException
Throws:
IOException
InterruptedException
SecurityException
org.apache.regexp.RESyntaxException

getDesignLib

private String getDesignLib(File[] rootFiles)
                     throws SecurityException
Throws:
SecurityException

getOutput

private Vector getOutput(String commandLine)
                  throws IOException,
                         InterruptedException
Throws:
IOException
InterruptedException

getCleanup

private CleanupResponseItem getCleanup()
                                throws CleanupResponseException
Throws:
CleanupResponseException

deleteTarget

private boolean deleteTarget()
                      throws IOException,
                             SecurityException
Throws:
IOException
SecurityException

writeToTarget

private boolean writeToTarget()
                       throws IOException,
                              SecurityException
Throws:
IOException
SecurityException

getVerifyDesigns

private VerifyDesignResponseItem getVerifyDesigns()
                                           throws VerifyDesignResponseException
Throws:
VerifyDesignResponseException

getEDAViewables

private EDAViewableResponseItem getEDAViewables()
                                         throws EDAViewableResponseException
Throws:
EDAViewableResponseException

getBOM

private BOMResponseItem getBOM(File designFile)
                        throws BOMResponseException,
                               FileListResponseException
This method will generate a BOM and return the data object

Returns:
BOMResponseItem
Throws:
BOMResponseException
FileListResponseException

checkFileList

private FileListResponseItem checkFileList(FileListResponseItem fri)
                                    throws FileListResponseException,
                                           IOException,
                                           InterruptedException,
                                           SecurityException,
                                           org.apache.regexp.RESyntaxException
Throws:
FileListResponseException
IOException
InterruptedException
SecurityException
org.apache.regexp.RESyntaxException

getConvertBOMCommand

private String getConvertBOMCommand(FileListResponseItem fri)
                             throws FileListResponseException,
                                    IOException,
                                    InterruptedException,
                                    SecurityException,
                                    org.apache.regexp.RESyntaxException
Throws:
FileListResponseException
IOException
InterruptedException
SecurityException
org.apache.regexp.RESyntaxException

getConvertEDACommand

private String getConvertEDACommand(FileListResponseItem fri)
                             throws FileListResponseException,
                                    IOException,
                                    InterruptedException,
                                    SecurityException,
                                    org.apache.regexp.RESyntaxException
Throws:
FileListResponseException
IOException
InterruptedException
SecurityException
org.apache.regexp.RESyntaxException

filterDesignFormat

private File[] filterDesignFormat(File[] designFiles)
                           throws SecurityException
Throws:
SecurityException

getFormat

private Vector getFormat(File[] designFiles)
                  throws IOException,
                         InterruptedException,
                         SecurityException,
                         org.apache.regexp.RESyntaxException
Throws:
IOException
InterruptedException
SecurityException
org.apache.regexp.RESyntaxException

fixVarName

private String fixVarName(String variable)
                   throws org.apache.regexp.RESyntaxException
Throws:
org.apache.regexp.RESyntaxException

containsElement

private boolean containsElement(Vector container,
                                String element)

getLatestViewpoint

private String getLatestViewpoint(File fileName,
                                  String objectType)
                           throws IOException,
                                  InterruptedException,
                                  SecurityException,
                                  org.apache.regexp.RESyntaxException
Throws:
IOException
InterruptedException
SecurityException
org.apache.regexp.RESyntaxException

isMasterDesignFile

private boolean isMasterDesignFile(FileListMember flm)

initializeEDAData

private void initializeEDAData()

executeCommand

private Vector executeCommand(String commandLine)
                       throws IOException,
                              InterruptedException
Throws:
IOException
InterruptedException

createBOMFiles

private File[] createBOMFiles(File[] edaFiles)
                       throws BOMResponseException,
                              InterruptedException,
                              SecurityException
Throws:
BOMResponseException
InterruptedException
SecurityException

createBOMBatchFile

private File createBOMBatchFile(File[] designFiles)
                         throws IOException,
                                FileListResponseException,
                                InterruptedException,
                                SecurityException,
                                org.apache.regexp.RESyntaxException
Throws:
IOException
FileListResponseException
InterruptedException
SecurityException
org.apache.regexp.RESyntaxException

createEDABatchFile

private File createEDABatchFile(File[] designFiles,
                                String storageDir)
                         throws IOException,
                                FileListResponseException,
                                InterruptedException,
                                SecurityException,
                                org.apache.regexp.RESyntaxException
Throws:
IOException
FileListResponseException
InterruptedException
SecurityException
org.apache.regexp.RESyntaxException

convertFileFormat

private File convertFileFormat(File fileSource,
                               String format)
                        throws IOException,
                               SecurityException,
                               org.apache.regexp.RESyntaxException
Throws:
IOException
SecurityException
org.apache.regexp.RESyntaxException

safeQuotes

private String safeQuotes(String pathName)

safeSlashes

private String safeSlashes(String pathName,
                           String ecadType)
                    throws org.apache.regexp.RESyntaxException
Throws:
org.apache.regexp.RESyntaxException

safeDirString

private String safeDirString(String pathName)
                      throws org.apache.regexp.RESyntaxException
Throws:
org.apache.regexp.RESyntaxException

safeDirTrailSlash

private String safeDirTrailSlash(String pathName)
                          throws org.apache.regexp.RESyntaxException
Throws:
org.apache.regexp.RESyntaxException

safeString

private String safeString(String pathName)

removeElement

private String removeElement(String stringName,
                             int position)

processData

private void processData(BufferedReader input)
                  throws IOException,
                         org.apache.regexp.RESyntaxException
Throws:
IOException
org.apache.regexp.RESyntaxException

readData

private void readData(BufferedReader input)
               throws IOException,
                      org.apache.regexp.RESyntaxException
Throws:
IOException
org.apache.regexp.RESyntaxException

storeData

private void storeData(String[] values,
                       int row)

consolidateBOM

public BOMListMember consolidateBOM(BOMListMember bom,
                                    String numberColName,
                                    String nameColName,
                                    String qtyColName,
                                    String refDesColName)
                             throws BOMResponseException
Consolidate raw BOM by given columns

Parameters:
bom - BOMListMember Raw BOM to consolidate
numberColName - String Raw BOM's column playing role: Number
nameColName - String Raw BOM's column playing role: Name
qtyColName - String Column name to use for Quantity column
refDesColName - String Raw BOM's column playing role: Ref Designator
Returns:
BOMListMember
Throws:
BOMResponseException