com.ptc.wgmecad
Class FileManager

java.lang.Object
  extended bycom.ptc.wgmecad.FileManager

public class FileManager
extends Object

Created by IntelliJ IDEA. User: barky Date: Dec 16, 2002 Time: 11:28:12 AM To change this template use Options | File Templates.


Field Summary
private static ArgumentMap argMap
           
private static ArgumentRegister argReg
           
(package private)  int countAllDesignChangeListeners
           
(package private)  Vector curAllDesignChangeListeners
           
(package private)  DesignAll currentAllDesign
           
static String designQueryIOFileName
           
static String EDA_DIR
           
static String edaDirName
           
static String errorFileName
           
private static FileManager instance
           
(package private) static org.apache.log4j.Logger logger
           
private  ProcessManager pm
           
private static String projPropHeader
           
static String projSettingsFileName
           
private static SecondaryArgumentMap sargMap
           
private static SecondaryArgumentRegister sargReg
           
(package private)  int sizeAllDesignChangeListeners
           
(package private)  boolean startAllDesignChangeListeners
           
static String tempDirName
           
static String WGMTEMP_DIR
           
static String WIDCHILL_ATTR_FILE
           
static String WINDCHILL_DIR
           
 
Constructor Summary
private FileManager()
           
 
Method Summary
 void addAllDesignChangeListener(ActionListener actionListener)
           
static void checkDir(File dir)
           
static void copyFile(File in, File out)
           
static void copyStream(InputStream in, OutputStream out)
           
private static String extractValueFromTemplateLine(String line, String key)
           
private  void fixCurrentAllDesign()
           
 AttributeStatus[] getAttributeStatusForCheckin()
           
 void getAvailableCabinets(JComboBox combo, String solution, String context)
          contact the windchill server on a separate thread and then update the combo box.
 void getAvailableContexts(ContextChooser cc)
           
 void getAvailableSolutions()
           
 void getAvailableTeams(JComboBox combo, String solution, String context)
          contact the windchill server on a separate thread and then update the combo box.
static Vector getCaseCorrectFile(File file)
          recursively evaluate the directory paths to find an actual File (or files) that matches this one, but in a case-insensitive way.
static Vector getCaseCorrectFile(File file, boolean isDirectory)
           
 Vector getCompFileLines()
           
 Vector getCompFileLines(File fn)
           
 DesignAll getCurrentAllDesign()
           
private  String getCurrentDesignByProjectDirectory(String currentDesignArgument)
          if we find a project settings file in the current project directory, then attempt to load the design information from that file.
 Properties getDesignAttributes(String projDir)
           
 File getDesignBomTemplateFile()
           
 ECADContentStatus[] getECADContentStatus(String _epmDocType)
           
 ECADContentStatus[] getECADContentStatusForCheckin()
           
static FileManager getInstance()
           
 PersistedDesign[] getRecentDesigns(String authoringApp, int numberDays)
           
static File getRelativeFile(File root, File leaf)
          transform the leaf file into a reference relative to the root
static Object[] getValuePartPropValues(File bomTemplate)
           
 boolean isAttrFilePresent(String projDir)
           
 void loadCompFileIntoDocument(Document document)
          suck in the comp file and add it to the document passed in, but later on the GUI thread.
 void loadContentStatus(DesignAll _design, boolean preLoad, String fromWhere)
           
 void loadContentStatus(DesignAll _design, boolean preLoad, String fromWhere, boolean refreshUI)
           
 void notifyListenerOfCurrentAllDesignChange()
           
 void runAllDesignChangeListener(String whatListener)
           
 void saveDesignAttributes(DesignAll dsn, Properties extraAttrs)
           
 void saveDesignAttributes(DesignAll dsn, Properties extraAttrs, File dsnAttrFile)
           
 void saveDesignAttributes(DesignAll dsn, Properties extraAttrs, File brdAttrFile, File schAttrFile)
           
 void saveDesignAttributes(Properties stdAttrs, Properties userAttrs, Properties extraAttrs, File attrFile)
           
 boolean setCurrentAllDesign(DesignAll _design)
           
 void setDesignBomTemplateFile(File bomTemplate)
           
 boolean setJustCurrentAllDesign(DesignAll design)
           
private  void updateComboWithStrings(JComboBox combo, String[] vals, boolean editable, String opName, boolean addToExisting)
           
 void updateDesignFromDesign(DesignAll fromDsn, String epmDocType)
           
 DesignAll updateFromDesignAttrFile(String projDir, DesignAll _currentDesign, boolean _preLoad, String fromWhere)
           
 void writeAttributeDefFile()
          format of the file is: attributeName attributeType ECAD_Document_Name bSend bReceive attributeType := integer | string | float ECAD_Document_Name := ECAD-ASSEMBLY | ECAD-BOARD | ECAD-SOURCE | ECAD-SCHEMATIC bSend and bReceive := true | false
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

static org.apache.log4j.Logger logger

argMap

private static ArgumentMap argMap

argReg

private static ArgumentRegister argReg

sargMap

private static SecondaryArgumentMap sargMap

sargReg

private static SecondaryArgumentRegister sargReg

curAllDesignChangeListeners

Vector curAllDesignChangeListeners

sizeAllDesignChangeListeners

int sizeAllDesignChangeListeners

countAllDesignChangeListeners

int countAllDesignChangeListeners

startAllDesignChangeListeners

boolean startAllDesignChangeListeners

currentAllDesign

DesignAll currentAllDesign

WINDCHILL_DIR

public static final String WINDCHILL_DIR
See Also:
Constant Field Values

WGMTEMP_DIR

public static final String WGMTEMP_DIR
See Also:
Constant Field Values

WIDCHILL_ATTR_FILE

public static final String WIDCHILL_ATTR_FILE
See Also:
Constant Field Values

EDA_DIR

public static final String EDA_DIR
See Also:
Constant Field Values

projSettingsFileName

public static final String projSettingsFileName

tempDirName

public static final String tempDirName

edaDirName

public static final String edaDirName

designQueryIOFileName

public static final String designQueryIOFileName

errorFileName

public static final String errorFileName

projPropHeader

private static final String projPropHeader

pm

private ProcessManager pm

instance

private static FileManager instance
Constructor Detail

FileManager

private FileManager()
Method Detail

getDesignBomTemplateFile

public File getDesignBomTemplateFile()

loadCompFileIntoDocument

public void loadCompFileIntoDocument(Document document)
suck in the comp file and add it to the document passed in, but later on the GUI thread.

Parameters:
document -

getCompFileLines

public Vector getCompFileLines()

getCaseCorrectFile

public static Vector getCaseCorrectFile(File file)
recursively evaluate the directory paths to find an actual File (or files) that matches this one, but in a case-insensitive way.

Parameters:
file -
Returns:

getCaseCorrectFile

public static Vector getCaseCorrectFile(File file,
                                        boolean isDirectory)

getCompFileLines

public Vector getCompFileLines(File fn)

addAllDesignChangeListener

public void addAllDesignChangeListener(ActionListener actionListener)

runAllDesignChangeListener

public void runAllDesignChangeListener(String whatListener)

setDesignBomTemplateFile

public void setDesignBomTemplateFile(File bomTemplate)

getInstance

public static FileManager getInstance()

getCurrentAllDesign

public DesignAll getCurrentAllDesign()

updateDesignFromDesign

public void updateDesignFromDesign(DesignAll fromDsn,
                                   String epmDocType)

isAttrFilePresent

public boolean isAttrFilePresent(String projDir)

getDesignAttributes

public Properties getDesignAttributes(String projDir)
                               throws IOException
Throws:
IOException

saveDesignAttributes

public void saveDesignAttributes(Properties stdAttrs,
                                 Properties userAttrs,
                                 Properties extraAttrs,
                                 File attrFile)
                          throws IOException
Throws:
IOException

saveDesignAttributes

public void saveDesignAttributes(DesignAll dsn,
                                 Properties extraAttrs,
                                 File brdAttrFile,
                                 File schAttrFile)
                          throws IOException
Throws:
IOException

saveDesignAttributes

public void saveDesignAttributes(DesignAll dsn,
                                 Properties extraAttrs,
                                 File dsnAttrFile)
                          throws IOException
Throws:
IOException

saveDesignAttributes

public void saveDesignAttributes(DesignAll dsn,
                                 Properties extraAttrs)
                          throws IOException
Throws:
IOException

getCurrentDesignByProjectDirectory

private String getCurrentDesignByProjectDirectory(String currentDesignArgument)
if we find a project settings file in the current project directory, then attempt to load the design information from that file. If the file isn't there, or there is an error, or it can't be read, or the syntax of the file is incorrect, it will reutrn null.

Returns:

writeAttributeDefFile

public void writeAttributeDefFile()
                           throws UnableToWriteFileException
format of the file is: attributeName attributeType ECAD_Document_Name bSend bReceive attributeType := integer | string | float ECAD_Document_Name := ECAD-ASSEMBLY | ECAD-BOARD | ECAD-SOURCE | ECAD-SCHEMATIC bSend and bReceive := true | false

Throws:
UnableToWriteFileException

updateFromDesignAttrFile

public DesignAll updateFromDesignAttrFile(String projDir,
                                          DesignAll _currentDesign,
                                          boolean _preLoad,
                                          String fromWhere)

loadContentStatus

public void loadContentStatus(DesignAll _design,
                              boolean preLoad,
                              String fromWhere)

loadContentStatus

public void loadContentStatus(DesignAll _design,
                              boolean preLoad,
                              String fromWhere,
                              boolean refreshUI)

setCurrentAllDesign

public boolean setCurrentAllDesign(DesignAll _design)
Returns:
true on success

setJustCurrentAllDesign

public boolean setJustCurrentAllDesign(DesignAll design)
Parameters:
design - the new design that should be current
Returns:
true on success

fixCurrentAllDesign

private void fixCurrentAllDesign()

notifyListenerOfCurrentAllDesignChange

public void notifyListenerOfCurrentAllDesignChange()

getAvailableContexts

public void getAvailableContexts(ContextChooser cc)

getAvailableSolutions

public void getAvailableSolutions()

getAvailableCabinets

public void getAvailableCabinets(JComboBox combo,
                                 String solution,
                                 String context)
contact the windchill server on a separate thread and then update the combo box.

Parameters:
combo -

getAvailableTeams

public void getAvailableTeams(JComboBox combo,
                              String solution,
                              String context)
contact the windchill server on a separate thread and then update the combo box.

Parameters:
combo -

updateComboWithStrings

private void updateComboWithStrings(JComboBox combo,
                                    String[] vals,
                                    boolean editable,
                                    String opName,
                                    boolean addToExisting)

getECADContentStatus

public ECADContentStatus[] getECADContentStatus(String _epmDocType)

getECADContentStatusForCheckin

public ECADContentStatus[] getECADContentStatusForCheckin()

getAttributeStatusForCheckin

public AttributeStatus[] getAttributeStatusForCheckin()
                                               throws WindchillFunctionException
Throws:
WindchillFunctionException

copyFile

public static void copyFile(File in,
                            File out)
                     throws IOException
Throws:
IOException

copyStream

public static void copyStream(InputStream in,
                              OutputStream out)
                       throws IOException
Throws:
IOException

getRecentDesigns

public PersistedDesign[] getRecentDesigns(String authoringApp,
                                          int numberDays)

getValuePartPropValues

public static Object[] getValuePartPropValues(File bomTemplate)

extractValueFromTemplateLine

private static String extractValueFromTemplateLine(String line,
                                                   String key)

getRelativeFile

public static File getRelativeFile(File root,
                                   File leaf)
transform the leaf file into a reference relative to the root

Parameters:
root -
leaf -
Returns:
a leaf File name relative to the root, or null

checkDir

public static void checkDir(File dir)
                     throws CancelledException,
                            ProjectLocationException
Throws:
CancelledException
ProjectLocationException