com.ptc.windchill.instassm
Class InstallationRegistry

java.lang.Object
  extended bycom.ptc.windchill.instassm.InstallationRegistry

public class InstallationRegistry
extends Object

An internal-use-only class that provides simple Java APIs for manipulating the InstallationRegistry.

Supported API: false

Extendable: false


Field Summary
private  HashMap assemblies_
           
private  HashMap assemblyElements_
           
private  Document doc_
           
private static String IAREG_ZIP_ENTRY_NAME
           
private static String IAREG_ZIP_FILE_NAME
           
private  int instregVersion_
           
private  HashMap localeElements_
           
private  HashMap locales_
           
private  HashMap releaseIds_
           
private static String ROOT_ELEMENT
           
private  HashMap tempPatchElements_
           
private  HashMap tempPatches_
           
 
Constructor Summary
(package private) InstallationRegistry()
          Create a new, empty registry.
private InstallationRegistry(InputStream input_stream)
          Read the registry from the speicfied input stream.
 
Method Summary
(package private)  void addAssembly(InstalledAssembly ia)
          Add/update record for assembly with the assembly id specified in the release identifier.
(package private)  void addLocale(InstalledLocale il)
          Add/update record for locale with the specified code.
(package private)  void addTempPatch(InstalledTempPatch itp)
          Add/update record for locale with the specified code.
private  void analyzeDocument()
          Scan the DOM document for assembly information.
private static void copyInstRegFilesToWindchillCodebase()
           
static boolean existsInLocalFile()
          Determines if the registry exists and can be loaded via the method readFromLocalFile().
private  void findAssemblies(Element root)
           
private  void findLocales(Element root)
           
private  void findTempPatches(Element root)
           
 InstalledAssembly getAssemblyFor(String assembly_id)
          The InstalledAssembly for the assembly with the specified assembly id.
 ReleaseId[] getAssemblyReleaseIds()
          The set of release ids for all assemblies in the registry, in order of appearance in the file.
private static File getInstallationRegistryFile(boolean use_treat_r70_when_set)
           
private static String getInstallationRegistryUrl()
           
 InstalledAssembly[] getInstalledAssemblies()
          An array of all the InstalledAssemblies for the current registry.
 InstalledLocale[] getInstalledLocales()
          An array of all the InstalledLocales for the current registry above and beyond the default locales provided by Windchill

Supported API: false

Extendable: false
 InstalledTempPatch[] getInstalledTempPatches()
          An array of all the InstalledTempPatches for the current registry.
 int getInstregVersion()
          The instreg version of this InstallationRegistry.
private  void index(InstalledAssembly ia, Element element)
           
private  void index(InstalledLocale locale, Element element)
           
private  void index(InstalledTempPatch temp_patch, Element element)
           
private  void initDerivedContainers()
          Clear all containers that contain assembly information.
private  void logInstallerMessage(String msg)
           
private static void moveR70InstRegFilesToStandardInstRegDir()
           
static InstallationRegistry readFromContext()
          Load the registry using class loader.
static InstallationRegistry readFromLocalFile()
          Load the registry by directly loading the file.
 void removeInstalledAssembly(String[] assembly_ids)
          Remove the specified installed assembly from both the standard and secondary install registry locations.
protected  void setAttributesOn(Element element)
           
private  void setInstregVersion(Element root)
           
private  void setInstregVersion(int instreg_version)
           
(package private) static boolean thereIsAnInstallationRegistryFileHere(File dir)
           
static boolean thereIsAStandardInstallationRegistryInLoadPoint(File load_point)
           
static boolean thereIsAWindchillProductInstallationRegistryInLoadPoint(File load_point)
           
private  void updateRegistry()
           
(package private)  void writeToLocalFile()
          Writes the current assembly registry object's contents to the proper location under the /installer/instreg, and when a Windchill install also under $(wt.home)/codebase/instreg dir.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

instregVersion_

private int instregVersion_

ROOT_ELEMENT

private static final String ROOT_ELEMENT
See Also:
Constant Field Values

IAREG_ZIP_FILE_NAME

private static final String IAREG_ZIP_FILE_NAME
See Also:
Constant Field Values

IAREG_ZIP_ENTRY_NAME

private static final String IAREG_ZIP_ENTRY_NAME
See Also:
Constant Field Values

doc_

private Document doc_

releaseIds_

private HashMap releaseIds_

assemblies_

private HashMap assemblies_

assemblyElements_

private HashMap assemblyElements_

locales_

private HashMap locales_

localeElements_

private HashMap localeElements_

tempPatches_

private HashMap tempPatches_

tempPatchElements_

private HashMap tempPatchElements_
Constructor Detail

InstallationRegistry

InstallationRegistry()
               throws IAException
Create a new, empty registry.


InstallationRegistry

private InstallationRegistry(InputStream input_stream)
                      throws IAException
Read the registry from the speicfied input stream. The stream is assumed to contain a ZipFile containing a single entry for the IAR.xml file. This file will be found, opened, and parsed.

Parameters:
input_stream - an InputStream that returns the jar'ed contents of the XML file as a jar entry named InstallationRegistry.xml.
Throws:
IAException - if the stream is not a zip stream, the IAR.xml entry can't be found, or it contains invalid content
Method Detail

getInstallationRegistryFile

private static File getInstallationRegistryFile(boolean use_treat_r70_when_set)
                                         throws IAException
Returns:
a non-null File that may not exist located in a File that may also not exist. The caller should check for its existence before attempting to use it.
Throws:
IAException

getInstallationRegistryUrl

private static String getInstallationRegistryUrl()
                                          throws IAException
Throws:
IAException

thereIsAStandardInstallationRegistryInLoadPoint

public static boolean thereIsAStandardInstallationRegistryInLoadPoint(File load_point)
                                                               throws IAException
Returns:
true, an install registry file was found in the standard location for this load point, false if directory/file do not exist
Throws:
IAException

thereIsAWindchillProductInstallationRegistryInLoadPoint

public static boolean thereIsAWindchillProductInstallationRegistryInLoadPoint(File load_point)
                                                                       throws IAException
Returns:
true, an install registry file was found in the Windchill product location for this load point, false if directory/file do not exist
Throws:
IAException

thereIsAnInstallationRegistryFileHere

static boolean thereIsAnInstallationRegistryFileHere(File dir)
                                              throws IAException
Returns:
true, an install registry file was found in specified directory, false if directory/file do not exist
Throws:
IAException

analyzeDocument

private void analyzeDocument()
                      throws IAException
Scan the DOM document for assembly information.

Throws:
IAException

updateRegistry

private void updateRegistry()
                     throws IAException
Throws:
IAException

setAttributesOn

protected void setAttributesOn(Element element)
                        throws IAException
Throws:
IAException

findAssemblies

private void findAssemblies(Element root)
                     throws IAException
Throws:
IAException

index

private void index(InstalledAssembly ia,
                   Element element)

findLocales

private void findLocales(Element root)
                  throws IAException
Throws:
IAException

index

private void index(InstalledLocale locale,
                   Element element)

findTempPatches

private void findTempPatches(Element root)
                      throws IAException
Throws:
IAException

index

private void index(InstalledTempPatch temp_patch,
                   Element element)

initDerivedContainers

private void initDerivedContainers()
Clear all containers that contain assembly information.


addAssembly

void addAssembly(InstalledAssembly ia)
           throws IAException
Add/update record for assembly with the assembly id specified in the release identifier.

Throws:
IAException

addLocale

void addLocale(InstalledLocale il)
         throws IAException
Add/update record for locale with the specified code.

Throws:
IAException

addTempPatch

void addTempPatch(InstalledTempPatch itp)
            throws IAException
Add/update record for locale with the specified code.

Throws:
IAException

getAssemblyReleaseIds

public ReleaseId[] getAssemblyReleaseIds()
The set of release ids for all assemblies in the registry, in order of appearance in the file. Note that this order is not semantically significant.

Supported API: false

Extendable: false

Returns:
non-null, possibly empty array of ReleaseId

getAssemblyFor

public InstalledAssembly getAssemblyFor(String assembly_id)
The InstalledAssembly for the assembly with the specified assembly id.

Supported API: false

Extendable: false

Returns:
possibly null InstalledAssembly

getInstalledAssemblies

public InstalledAssembly[] getInstalledAssemblies()
An array of all the InstalledAssemblies for the current registry.

Supported API: false

Extendable: false

Returns:
non-null, possibly empty array of InstalledAssembly

getInstalledLocales

public InstalledLocale[] getInstalledLocales()
An array of all the InstalledLocales for the current registry above and beyond the default locales provided by Windchill

Supported API: false

Extendable: false

Returns:
non-null, possibly empty array of InstalledLocale

getInstalledTempPatches

public InstalledTempPatch[] getInstalledTempPatches()
An array of all the InstalledTempPatches for the current registry.

Supported API: false

Extendable: false

Returns:
non-null, possibly empty array of InstalledTempPatch

setInstregVersion

private void setInstregVersion(Element root)
                        throws IAException
Throws:
IAException

setInstregVersion

private void setInstregVersion(int instreg_version)
                        throws IAException
Throws:
IAException

getInstregVersion

public int getInstregVersion()
The instreg version of this InstallationRegistry.

Supported API: false

Extendable: false

Returns:
integer

writeToLocalFile

void writeToLocalFile()
                throws IAException
Writes the current assembly registry object's contents to the proper location under the /installer/instreg, and when a Windchill install also under $(wt.home)/codebase/instreg dir.

Throws:
IAException

moveR70InstRegFilesToStandardInstRegDir

private static void moveR70InstRegFilesToStandardInstRegDir()
                                                     throws IAException
Throws:
IAException

copyInstRegFilesToWindchillCodebase

private static void copyInstRegFilesToWindchillCodebase()
                                                 throws IAException
Throws:
IAException

removeInstalledAssembly

public void removeInstalledAssembly(String[] assembly_ids)
                             throws IAException
Remove the specified installed assembly from both the standard and secondary install registry locations.

Supported API: false

Extendable: false

Returns:
the installed assembly removed if one existed, else null
Throws:
IAException - if the registry resource cannot be found in the context or if the registry is malformed

readFromContext

public static InstallationRegistry readFromContext()
                                            throws IAException
Load the registry using class loader. Client-side apps should use this method to obtain an IAR instance.

Supported API: false

Extendable: false

Returns:
a non-null InstallationRegistry
Throws:
IAException - if the registry resource cannot be found in the context or if the registry is malformed

existsInLocalFile

public static boolean existsInLocalFile()
                                 throws IAException
Determines if the registry exists and can be loaded via the method readFromLocalFile().

Throws:
IAException

readFromLocalFile

public static InstallationRegistry readFromLocalFile()
                                              throws IAException
Load the registry by directly loading the file. This should only be invoked if the application is running on the server and WIndchill/codebase is in the classpath.

Supported API: false

Extendable: false

Returns:
a non-null InstallationRegistry
Throws:
IAException - if the registry resource cannot be found and fail_if_doesnt_exist, or if the registry is malformed

logInstallerMessage

private void logInstallerMessage(String msg)