All Packages Class Hierarchy This Package Previous Next Index
Class com.sun.install.products.InstallComponent
java.lang.Object
|
+----com.sun.install.products.InstallComponent
- public abstract class InstallComponent
- extends Object
- implements Serializable
InstallComponent is a class that each member of the product tree
extends. It is a generic class that provides default behavior
to add/remove members to form a realtime dependency tree and to
query and extract information about the current state of the
product tree, such as:
- Which InstallComponents will participate in the install
- Which InstallComponents will not install, due to dependencies
- How large the installation will be
This class cannot be used on its own.
-
installDirKey
- The WizardState key that contains the intended installation directory.
Deprecated.
-
name
- The name of this node.
Deprecated.
-
parent
- Our parent.
Deprecated.
-
properties
- Property sheet for this component.
Deprecated.
-
InstallComponent()
- Create a new InstallComponent.
-
InstallComponent(Hashtable)
- Create a new InstallComponent with the desired destinationTable.
-
addRuntimeResources(Vector)
- Add the runtime resources required by this class.
-
countInstallable()
- Number of installable things this component represents.
-
countUninstallable()
- Number of uninstallable things this component represents.
-
genericQuery(Hashtable, Vector, String)
- Query this tree, recursively following the supplied rules and
returning the desired value(s).
-
genericQuery(Hashtable, Vector, String, String)
- Query this tree, recursively following the supplied rules and
returning the desired value(s).
-
getComponentDescription()
- Gets the component's description.
-
getDependentItems()
- Returns install descriptions for all items that require this
install component.
-
getDestinationTable()
- Get this components's destination table.
-
getInstallable()
- Returns an Installable object that uniquely describes this
component.
-
getInstallDirKey()
- Gets the key for the install directory
-
getInstallLocation()
- Gets our install location.
-
getName()
- Gets the name of this InstallComponent
-
getParent()
- Gets the parent of this InstallComponent
-
getProperty(String)
- Retrieves a value from this component's property sheet.
-
getRegisteredComponents()
- Gets the registered components of this component if it is shared (has a UUID).
-
getState()
- Gets the state of this InstallComponent
-
initialize(WizardState)
- Do any initialization of InstallComponents, including any
dependencies and/or information retrieval.
-
install(WizardState)
- Install the bits associated with this InstallComponent.
-
installCanceled()
- Determines if the install was cancelled.
-
isInstalled()
- Returns true if this component has been installed (according to
the system install registry).
-
isNodeActive()
- Determines if this node is active.
-
isRegistered()
- Checks whether this component is in the system registry or not.
-
performInstallation(WizardState)
- This method is called by the ProductTask, and does the preinstall registry
query and the postinstall registration.
-
performUninstallation(WizardState)
- This method is called by the ProductTask, and does the uninstall registry
query and the postinstall registration.
-
print(int)
- Prints out this InstallComponent and its children in a graphical,
hierarchical representation.
-
readMetaFile(String, String, String, WizardState)
-
Utility function to read a file with each line being a "keyvalue" pair.
-
refresh(Vector, String)
- Do any refreshing of this component's information.
-
setComponentDescription(ComponentDescription)
- Sets this component's description.
-
setDestinationTable(Hashtable)
- Sets the destination table for this component to the desired table.
-
setInstallDirKey(String)
- Sets the key for the install directory
-
setName(String)
- Sets the name of this InstallComponent
-
setParent(InstallComponent)
- Sets the parent of this InstallComponent
-
setProperty(String, Object)
- Sets a property into this install component's property sheet.
-
setState(WizardState)
- Sets the state of this InstallComponent
-
toString()
- Converts this object into a readable string.
-
uninstall(WizardState)
- Uninstall the bits associated with this InstallComponent.
-
uninstallCanceled()
- Determines if the uninstall was cancelled.
-
writeMetaFile(String, String, Hashtable, WizardState)
-
Utility function to write a file with each line being a "keyvalue" pair.
name
protected String name
- Note: name is deprecated.
use get/setName()
- The name of this node. Used for debugging purposes only. No relation
to names that might appear to an end user
parent
protected InstallComponent parent
- Note: parent is deprecated.
use set/getParent()
- Our parent. This is null if this is the top of the product tree.
installDirKey
protected String installDirKey
- Note: installDirKey is deprecated.
use get/setInstallDirKey()
- The WizardState key that contains the intended installation directory.
properties
protected Hashtable properties
- Note: properties is deprecated.
use get/setProperty()
- Property sheet for this component. Queries can be made against the tree using
rules that look at these properties, and each property can optionally have a return
value. By default, all components have the following default properties and values:
"nodeIsActive", Boolean(true)
InstallComponent
public InstallComponent()
- Create a new InstallComponent.
InstallComponent
public InstallComponent(Hashtable destinationTable)
- Create a new InstallComponent with the desired destinationTable.
- Parameters:
- destinationTable - The table describing the location and size impact of
installing this component.
setDestinationTable
public void setDestinationTable(Hashtable destinationTable)
- Sets the destination table for this component to the desired table.
- Parameters:
- destinationTable - The destination Table of this component.
getDestinationTable
public Hashtable getDestinationTable()
- Get this components's destination table.
- Returns:
- The destination table for this component.
getName
public String getName()
- Gets the name of this InstallComponent
- Returns:
- The name of this component
setName
public void setName(String name)
- Sets the name of this InstallComponent
- Parameters:
- name - The new name
getParent
public InstallComponent getParent()
- Gets the parent of this InstallComponent
- Returns:
- The parent of this component
setParent
public void setParent(InstallComponent parent)
- Sets the parent of this InstallComponent
- Parameters:
- parent - The new parent
getState
public WizardState getState()
- Gets the state of this InstallComponent
- Returns:
- The state of this InstallComponent
setState
public void setState(WizardState state)
- Sets the state of this InstallComponent
- Parameters:
- state - The new state
initialize
public boolean initialize(WizardState state)
- Do any initialization of InstallComponents, including any
dependencies and/or information retrieval. The default is
to initialize all of our children.
If you override this method in a subclass,
be sure to call super.initialize() at some point.
- Parameters:
- state - The WizardState that this InstallComponent belongs to. Useful for getting
date out of the wizard state.
- Returns:
- true, if the initialization was successful, false otherwise.
refresh
public boolean refresh(Vector targets,
String sharedPoolKey)
- Do any refreshing of this component's information.
If you override this method in a subclass,
be sure to call super.refresh() at some point.
- Parameters:
- targets - The target properties (of type java.lang.String) to refresh
- sharedPoolKey - key pointing to pool to use during refreshing.
- Returns:
- true, if the refresh was successful, false otherwise.
getProperty
public Object getProperty(String key)
- Retrieves a value from this component's property sheet.
- Parameters:
- key - The key used to store the desired value
- Returns:
- The desired value
setProperty
public void setProperty(String key,
Object value)
- Sets a property into this install component's property sheet. Can be retrieved via
getProperty();
- Parameters:
- key - The key used to store the desired value
- value - The object to store under the specified key.
genericQuery
public void genericQuery(Hashtable finalTable,
Vector rules,
String returnKey)
- Query this tree, recursively following the supplied rules and
returning the desired value(s).
This method can be used to gather information for each component
in the tree. You specify the rules to use when traversing the
tree. If a component doesn't "follow the rule", then the
operation does not proceed through that component to other
components below. If the component does follow the rule, then a
lookup is done in the component's property sheet and the value is
added to the final table, keyed by the component's ID. If the component
does not know about the rule, the query passes through to the children.
- Parameters:
- rules - A Vector of Strings. For each String supplied, a
lookup is done on the component's property sheet using the
string as a key. If a Boolean value of
true is
found using each key in the rules, then the component passes
the rules. If no rules are supplied, then every component in
the query will by default "pass" the rules.
- returnKey - If the component passes the rules supplied, then
another lookup is done on the property sheet using this key,
and the value is added to the final table, keyed by the
component's componentID.
- finalTable - The hashtable to add the resulting information to.
genericQuery
public void genericQuery(Hashtable finalTable,
Vector rules,
String returnKey,
String sharedPoolKey)
- Query this tree, recursively following the supplied rules and
returning the desired value(s).
This method can be used to gather information for each component
in the tree. You specify the rules to use when traversing the
tree. If a component doesn't "follow the rule", then the
operation does not proceed through that component to other
components below. If the component does follow the rule, then a
lookup is done in the component's property sheet and the value is
added to the final table, keyed by the component's ID. If the component
does not know about the rule, the query passes through to the children.
- Parameters:
- rules - A Vector of Strings. For each String supplied, a
lookup is done on the component's property sheet using the
string as a key. If a Boolean value of
true is
found using each key in the rules, then the component passes
the rules. If no rules are supplied, then every component in
the query will by default "pass" the rules.
- returnKey - If the component passes the rules supplied, then
another lookup is done on the property sheet using this key,
and the value is added to the final table, keyed by the
component's componentID.
- finalTable - The hashtable to add the resulting information to.
- sharedPoolKey - A key identifying the pool to use when performing the query.
The sharedPool is used during queries that involve shared components. Each
time a shared component is encountered during the query, it performs the query
(which might result in the shared component adding something to the finalTable
as well), then adds itself to the pool of
Installables. If the same
shared resource is encountered in the query, it does not participate in the query
again. This is used, for example, during disk space checking, when shared components
only count their space requirements once. Passing null causes no pool
to be used.
- See Also:
- Installable
print
public void print(int level)
- Prints out this InstallComponent and its children in a graphical,
hierarchical representation.
- Parameters:
- level - The level of indention to print this tree out.
This would normally be '0' at the top of the tree
and automatically increment for each level of the tree.
getInstallable
public Installable getInstallable()
- Returns an Installable object that uniquely describes this
component.
setComponentDescription
public void setComponentDescription(ComponentDescription componentDescription)
- Sets this component's description. If this description includes a UUID, the component
is considered a shared component and will update the system registry.
- Parameters:
- componentDescription - The description of this component
getComponentDescription
public ComponentDescription getComponentDescription()
- Gets the component's description.
- Returns:
- The description of this component, or
null if none exists.
isNodeActive
public boolean isNodeActive()
- Determines if this node is active. A node is active if it has a property of
nodeIsActive
and is set to Boolean(true).
- Returns:
- Whether the node is active or not.
getRegisteredComponents
public ComponentDescription[] getRegisteredComponents()
- Gets the registered components of this component if it is shared (has a UUID). This class simply
returns the component description of this component.
- Returns:
- The descriptions of the registered components of this component.
isInstalled
public boolean isInstalled()
- Returns true if this component has been installed (according to
the system install registry). Returns false if the component
is not registered as being installed, or if the registry cannot
be queried.
installCanceled
public boolean installCanceled()
- Determines if the install was cancelled.
- Returns:
- Whether or not the install was cancelled (the
"install.cancelled"
property of the wizard state is true
uninstallCanceled
public boolean uninstallCanceled()
- Determines if the uninstall was cancelled.
- Returns:
- Whether or not the uninstall was cancelled (the
"uninstall.cancelled"
property of the wizard state is true
getDependentItems
public ComponentDescription[] getDependentItems()
- Returns install descriptions for all items that require this
install component.
setInstallDirKey
public void setInstallDirKey(String installDirKey)
- Sets the key for the install directory
- Parameters:
- installDirKey - The intended key that should be used
to reference the installation directory
for this Leaf.
getInstallDirKey
public String getInstallDirKey()
- Gets the key for the install directory
- Returns:
- The WizardState key for the intended installation
directory for this Leaf
getInstallLocation
public String getInstallLocation()
- Gets our install location. If we do not have one (i.e.
setInstallDirKey() was never
called), we defer to our parent in the product tree. If we do have one, and it is relative (i.e.
getInstallDirKey().startsWith(File.separator) returns false), then
we prepend our relative install directory to our parent's install directory. If it is absolute
(i.e. getInstallDirKey().startsWith(File.separator) returns true),
we ignore our parent's setting and return our absolute path.
- Returns:
- The install location for this component
toString
public String toString()
- Converts this object into a readable string.
- Returns:
- The name of this object
- Overrides:
- toString in class Object
readMetaFile
public static Hashtable readMetaFile(String path,
String delimiter,
String key,
WizardState state)
- Utility function to read a file with each line being a "keyvalue" pair. Sets the
resulting hashtable into the wizard state.
- Parameters:
- path - The path to the file to read
- delimiter - The string that separates each key from its value
- key - The key to use when setting the resulting hashtable into the WizardState. If you do not
want this table stored into the WizardState, pass null.
- state - The wizard state this component belongs to
- Returns:
- the resulting hashtable, or
null if there was an error reading the file
writeMetaFile
public static boolean writeMetaFile(String path,
String delimiter,
Hashtable table,
WizardState state)
- Utility function to write a file with each line being a "keyvalue" pair.
- Parameters:
- state - The wizard state this component belongs to
- path - The path to the file to write
- delimiter - The string that separates each key from its value
- table - The table to write. Each key/value pair is separated by the supplied delimiter.
- Returns:
- true if the file was sucessfully written, false otherwise
performInstallation
public boolean performInstallation(WizardState state)
- This method is called by the ProductTask, and does the preinstall registry
query and the postinstall registration. This method calls the install() method
if the component has not yet been installed (according to the registry).
- Parameters:
- state - The WizardState.
- Returns:
- true if the install was successful; false otherwise.
install
public boolean install(WizardState state)
- Install the bits associated with this InstallComponent.
performUninstallation
public boolean performUninstallation(WizardState state)
- This method is called by the ProductTask, and does the uninstall registry
query and the postinstall registration. This method calls the install() method
if the component has not yet been installed (according to the registry).
uninstall
public boolean uninstall(WizardState state)
- Uninstall the bits associated with this InstallComponent.
- Parameters:
- state - The wizard state associated with this object.
isRegistered
public boolean isRegistered()
- Checks whether this component is in the system registry or not.
- Returns:
- whether this component is in the system registry or not.
addRuntimeResources
public void addRuntimeResources(Vector resourceVector)
- Add the runtime resources required by this class.
- Parameters:
- resourceVector - The vector containing all of the required resources
for this class
countInstallable
public int countInstallable()
- Number of installable things this component represents. Used for progress bar division.
- Returns:
- The InstallComponent always returns
0
countUninstallable
public int countUninstallable()
- Number of uninstallable things this component represents. Used for progress bar division.
- Returns:
- The InstallComponent always returns
0
All Packages Class Hierarchy This Package Previous Next Index