com.ptc.wvs.server.publish
Class WildfireDownload

java.lang.Object
  extended bycom.ptc.wvs.server.publish.WildfireDownload

public class WildfireDownload
extends Object


Field Summary
private  Vector addToWorkspaceVector
           
private  WTPrincipal authenticationObject
           
private  ArrayList cadNamesList
           
private  ArrayList contentFilesList
           
private static boolean deleteWS
           
private  EPMDocConfigSpec docConfigSpec
           
private  ArrayList docNamesList
           
private  ArrayList docNumbersList
           
private static String DOWNLOAD_URL
           
private  ArrayList downloadVeto
           
private  FileAdapterClientProxy fac
           
private  ArrayList foldersList
           
private static boolean fullyPopulateWS
           
private  String fvLookup
           
private  ArrayList genericNamesList
           
private  String httpPassword
           
private  String httpUser
           
private  WTPrincipal httpWTUser
           
private  ArrayList instanceNamesList
           
private static boolean retrieveAll
           
private static String UPLOAD_URL1
           
private static String UPLOAD_URL3
           
private static boolean VERBOSE
           
private static String WINDCHILL_CODEBASE
           
private  String workingFolder
           
private  WTContainer workspaceContainer
           
private  String workspaceName
           
private  boolean writeToFile
           
private static String WRK_FLDR_NAME_PROP
           
private  EPMWorkspace ws
           
private static String WS_NAME_PROP
           
private  HashMap wsContentMap
           
private  WTProperties wtprops
           
private static WVSProperties wvsProperties
           
 
Constructor Summary
WildfireDownload()
          Creates a new instance of WildfireDownload
WildfireDownload(String wrkFldr)
          Creates a new instance of WildfireDownload
WildfireDownload(String wrkFldr, EPMDocConfigSpec dcs)
          Creates a new instance of WildfireDownload
WildfireDownload(String wrkFolder, String wsName, WTContainer wsContainer, EPMDocConfigSpec dcs, String httpUser, String httpPassword, String fvLookup, boolean writeToFile)
          Create an instance of WildfireDownload passing in an authentication object, a workspace name a local working folder for download and a config spec
WildfireDownload(WTPrincipal authObject)
          Create an instance of WildfireDownload passing in an authentication object
WildfireDownload(WTPrincipal authObject, String wrkFolder)
          Create an instance of WildfireDownload passing in an authentication object, a workspace name and a local working folder for download
WildfireDownload(WTPrincipal authObject, String wrkFolder, String wsName)
          Create an instance of WildfireDownload passing in an authentication object, a workspace name and a local working folder for download
 
Method Summary
 void addEPMDocToWorkspace(EPMDocument thisDoc)
           
 void addToUpload(EPMDocument doc, File file)
           
 void addToWS(EPMDocument doc)
           
 void addToWS(EPMDocument doc, boolean recursive)
           
 void closeConnection()
          Close Windchill connection
private  void configureHttpUser()
           
 void createConnection()
          Create a Windchill connection
private  EPMWorkspace createWorkspace(String name, EPMDocConfigSpec dcs, WTContainer container, WTPrincipal principal)
          Create a new EPMWorkspace, and log the creation to the console.
private  EPMWorkspace createWorkspace(String name, EPMDocConfigSpec dcs, WTContainer container, WTPrincipal principal, Folder folder)
           
 void destroyWorkspace()
           
private  void destroyWorkspace(EPMWorkspace workspace, String owner)
          Delete a Workspace from Windchill
static void destroyWorkspace(String wsName, WTPrincipal principal)
           
 void destroyWorkspace1()
           
static boolean destroyWorkspace1(String wsName, WTPrincipal principal)
           
 void download(String[] docArray)
           
 void downloadAll(EPMDocument thisDoc)
           
 void downloadAll(EPMDocument thisDoc, boolean populateWSOnly)
           
 void downloadAll(String docName)
           
private  void downloadAllInternal(EPMDocument doc, boolean recursive)
           
static Object[] getContents(EPMWorkspace workspace)
          This method lists all the contents of a workspace in an array.
static EPMDocument getEPMDocument(String number)
          This convenience method finds a document based on its unique number using the latest config spec
static EPMDocument getEPMDocument(String number, ConfigSpec configSpec)
          This method finds a document based on its unique number and the config spec.
static EPMDocument getEPMDocument(String number, EPMWorkspace workspace)
          This convenience method finds a document based on its unique number using the workspace config spec.
private static EPMWorkspace getEPMWorkspace(String workspaceName, WTPrincipal principal)
          This method finds a workspace given its name
private  EPMDocument getGenericForInstance(EPMDocument instanceDoc, ConfigSpec configSpec)
          This method returns the appropriate version of generic document for the input instance document (if any) by applying the input config specs.
private  void init()
          Simple init method for the simpler constructors
 void initializeUpload()
           
static void main(String[] args)
           
 void performUpload()
           
 void setDownloadVeto(ArrayList dv)
           
private static void usage()
          Simple usage function
private  void windchillAuthenticate()
          Initial Windchill authentication/login method
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WINDCHILL_CODEBASE

private static final String WINDCHILL_CODEBASE
See Also:
Constant Field Values

UPLOAD_URL1

private static final String UPLOAD_URL1
See Also:
Constant Field Values

UPLOAD_URL3

private static final String UPLOAD_URL3
See Also:
Constant Field Values

DOWNLOAD_URL

private static final String DOWNLOAD_URL
See Also:
Constant Field Values

wvsProperties

private static WVSProperties wvsProperties

VERBOSE

private static boolean VERBOSE

retrieveAll

private static boolean retrieveAll

fullyPopulateWS

private static boolean fullyPopulateWS

deleteWS

private static boolean deleteWS

authenticationObject

private WTPrincipal authenticationObject

httpWTUser

private WTPrincipal httpWTUser

fac

private FileAdapterClientProxy fac

workspaceName

private String workspaceName

workspaceContainer

private WTContainer workspaceContainer

ws

private EPMWorkspace ws

docConfigSpec

private EPMDocConfigSpec docConfigSpec

workingFolder

private String workingFolder

httpUser

private String httpUser

httpPassword

private String httpPassword

fvLookup

private String fvLookup

writeToFile

private boolean writeToFile

wtprops

private WTProperties wtprops

WS_NAME_PROP

private static final String WS_NAME_PROP
See Also:
Constant Field Values

WRK_FLDR_NAME_PROP

private static final String WRK_FLDR_NAME_PROP
See Also:
Constant Field Values

cadNamesList

private ArrayList cadNamesList

genericNamesList

private ArrayList genericNamesList

foldersList

private ArrayList foldersList

contentFilesList

private ArrayList contentFilesList

addToWorkspaceVector

private Vector addToWorkspaceVector

wsContentMap

private HashMap wsContentMap

downloadVeto

private ArrayList downloadVeto

docNumbersList

private ArrayList docNumbersList

docNamesList

private ArrayList docNamesList

instanceNamesList

private ArrayList instanceNamesList
Constructor Detail

WildfireDownload

public WildfireDownload()
                 throws WTException
Creates a new instance of WildfireDownload


WildfireDownload

public WildfireDownload(String wrkFldr)
                 throws WTException
Creates a new instance of WildfireDownload

Parameters:
wrkFldr - WOrking Folder

WildfireDownload

public WildfireDownload(String wrkFldr,
                        EPMDocConfigSpec dcs)
                 throws WTException
Creates a new instance of WildfireDownload

Parameters:
wrkFldr - WOrking Folder

WildfireDownload

public WildfireDownload(WTPrincipal authObject)
                 throws WTException
Create an instance of WildfireDownload passing in an authentication object

Parameters:
authObject - Authentication object thats been created by the calling application

WildfireDownload

public WildfireDownload(WTPrincipal authObject,
                        String wrkFolder)
                 throws WTException
Create an instance of WildfireDownload passing in an authentication object, a workspace name and a local working folder for download

Parameters:
authObject - Authentication object thats been created by the calling application
wrkFolder - working folder

WildfireDownload

public WildfireDownload(WTPrincipal authObject,
                        String wrkFolder,
                        String wsName)
                 throws WTException
Create an instance of WildfireDownload passing in an authentication object, a workspace name and a local working folder for download

Parameters:
authObject - Authentication object thats been created by the calling application
wrkFolder - working folder
wsName - workspace name

WildfireDownload

public WildfireDownload(String wrkFolder,
                        String wsName,
                        WTContainer wsContainer,
                        EPMDocConfigSpec dcs,
                        String httpUser,
                        String httpPassword,
                        String fvLookup,
                        boolean writeToFile)
                 throws WTException
Create an instance of WildfireDownload passing in an authentication object, a workspace name a local working folder for download and a config spec

Parameters:
wrkFolder - working folder
wsName - workspace name
Method Detail

init

private void init()
           throws IOException
Simple init method for the simpler constructors

Throws:
IOException

createConnection

public void createConnection()
                      throws IOException
Create a Windchill connection

Throws:
IOException

closeConnection

public void closeConnection()
Close Windchill connection


addEPMDocToWorkspace

public void addEPMDocToWorkspace(EPMDocument thisDoc)
                          throws IOException,
                                 WTException
Throws:
IOException
WTException

download

public void download(String[] docArray)
              throws IOException,
                     WTException
Throws:
IOException
WTException

setDownloadVeto

public void setDownloadVeto(ArrayList dv)

downloadAll

public void downloadAll(String docName)
                 throws IOException,
                        WTException
Throws:
IOException
WTException

downloadAll

public void downloadAll(EPMDocument thisDoc)
                 throws IOException,
                        WTException
Throws:
IOException
WTException

downloadAll

public void downloadAll(EPMDocument thisDoc,
                        boolean populateWSOnly)
                 throws IOException,
                        WTException
Throws:
IOException
WTException

downloadAllInternal

private void downloadAllInternal(EPMDocument doc,
                                 boolean recursive)
                          throws IOException,
                                 WTException
Throws:
IOException
WTException

initializeUpload

public void initializeUpload()
                      throws IOException,
                             WTException
Throws:
IOException
WTException

addToWS

public void addToWS(EPMDocument doc)
             throws WTException
Throws:
WTException

addToWS

public void addToWS(EPMDocument doc,
                    boolean recursive)
             throws WTException
Throws:
WTException

addToUpload

public void addToUpload(EPMDocument doc,
                        File file)
                 throws IOException,
                        WTException
Throws:
IOException
WTException

performUpload

public void performUpload()
                   throws IOException,
                          WTException
Throws:
IOException
WTException

destroyWorkspace

public static void destroyWorkspace(String wsName,
                                    WTPrincipal principal)

destroyWorkspace1

public static boolean destroyWorkspace1(String wsName,
                                        WTPrincipal principal)

destroyWorkspace

public void destroyWorkspace()

destroyWorkspace1

public void destroyWorkspace1()

windchillAuthenticate

private void windchillAuthenticate()
                            throws UserNotFoundException,
                                   WTException,
                                   WTPropertyVetoException
Initial Windchill authentication/login method

Throws:
UserNotFoundException
WTException
WTPropertyVetoException

configureHttpUser

private void configureHttpUser()

getEPMWorkspace

private static EPMWorkspace getEPMWorkspace(String workspaceName,
                                            WTPrincipal principal)
                                     throws WTException
This method finds a workspace given its name

Parameters:
workspaceName - The name of the workspace to be searched
Returns:
EPMWorkspace
Throws:
WTException

createWorkspace

private EPMWorkspace createWorkspace(String name,
                                     EPMDocConfigSpec dcs,
                                     WTContainer container,
                                     WTPrincipal principal)
                              throws WTException,
                                     WTPropertyVetoException
Create a new EPMWorkspace, and log the creation to the console.

Throws:
WTException
WTPropertyVetoException

createWorkspace

private EPMWorkspace createWorkspace(String name,
                                     EPMDocConfigSpec dcs,
                                     WTContainer container,
                                     WTPrincipal principal,
                                     Folder folder)
                              throws WTException,
                                     WTPropertyVetoException
Throws:
WTException
WTPropertyVetoException

destroyWorkspace

private void destroyWorkspace(EPMWorkspace workspace,
                              String owner)
                       throws WTException
Delete a Workspace from Windchill

Throws:
WTException

getContents

public static Object[] getContents(EPMWorkspace workspace)
                            throws WTException
This method lists all the contents of a workspace in an array.

Parameters:
workspace - The workspace whose contents are to be retrieved
Returns:
Object[]
Throws:
WTException

getEPMDocument

public static EPMDocument getEPMDocument(String number)
                                  throws WTException
This convenience method finds a document based on its unique number using the latest config spec

Parameters:
number - The number of the document to be searched.
Returns:
EPMDocument
Throws:
WTException

getEPMDocument

public static EPMDocument getEPMDocument(String number,
                                         EPMWorkspace workspace)
                                  throws WTException
This convenience method finds a document based on its unique number using the workspace config spec. If either of workspace or its config spce is null doc returned will be null and not latest.

Parameters:
number - The number of the document to be searched.
workspace - The workspace which is used for config spec.
Returns:
EPMDocument
Throws:
WTException

getEPMDocument

public static EPMDocument getEPMDocument(String number,
                                         ConfigSpec configSpec)
                                  throws WTException
This method finds a document based on its unique number and the config spec.

Parameters:
number - The number of the document to be searched.
configSpec - The config spec to be used for filtering the document iterations
Returns:
EPMDocument
Throws:
WTException

getGenericForInstance

private EPMDocument getGenericForInstance(EPMDocument instanceDoc,
                                          ConfigSpec configSpec)
This method returns the appropriate version of generic document for the input instance document (if any) by applying the input config specs.

Parameters:
instanceDoc - The instance document for which the generic document is to be found.
configSpec - The config spec to be applied to filter out the proper version of generic
Returns:
EPMDocument
Throws:
WTException

main

public static void main(String[] args)
Parameters:
args - the command line arguments

usage

private static void usage()
Simple usage function