Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 202626

Summary: TPTP needs to provide upgrade functionality
Product: z_Archived Reporter: jkubasta
Component: TPTPAssignee: Joel Cayne <jcayne>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P1 CC: paulslau
Version: unspecifiedKeywords: plan
Target Milestone: ---Flags: paulslau: review+
Hardware: PC   
OS: Windows 2000   
Whiteboard:
Attachments:
Description Flags
CreateUpgrade class
none
CreateUpgrade class - 2
none
CreateUpgrade class - 3
none
ConfigUpgrade patch none

Description jkubasta CLA 2007-09-07 09:30:04 EDT
RAC configuration upgrade need to be supported and should be provided from TPTP team. 
TPTP's config.jar could add a class to enable to extract user inputs at previous install then store into a text or hashtable. At ugrade, RAC can use the previous inputs by calling API when regenerating new config files.
Comment 1 Joel Cayne CLA 2008-01-30 16:07:01 EST
The information that can be provided for the upgrade based on the current SetConfig includes: Java Home, Network access mode, Security enabled and Users allowed to access the Agent Controller. The information can be output to a property file or stored in a hashtable and accessed by the AC at upgrade.
Comment 2 Joel Cayne CLA 2008-02-21 10:39:55 EST
Created attachment 90359 [details]
CreateUpgrade class

Attached class contains the functionality for upgrading the AC version for TPTP 4.5.0 to a new install. Process to follow allows for obtaining the installation information from the current install, uninstall and new installation using the data stored (obtained by this class).
Comment 3 Paul Slauenwhite CLA 2008-02-22 15:35:42 EST
(In reply to comment #2)
> Created an attachment (id=90359) [details]
> CreateUpgrade class
> 
> Attached class contains the functionality for upgrading the AC version for TPTP
> 4.5.0 to a new install. Process to follow allows for obtaining the installation
> information from the current install, uninstall and new installation using the
> data stored (obtained by this class).
> 

Reviewed with comments:

-Change $Id: $ to $Id$.
-Put the package declaration below the copyright comment.
-Add the @author, @version, and @since tags to the class JavaDoc comment.
-Define static constants in a constants class/interface for JAVA_PATH or is there a similar constant to SecurityEnabled.TAG, for example.
-Instead of walking the DOM (see traverseNode(NodeList), consider querying the exact properties you need since there are only a few (e.g. getElementById(String) or getElementsByTagName(String)).
-Do you need getDoc() and getHash() (getPropertyFile(File) should return the map)?
-Consider making this class a singleton (privatized constructor) or provide s static method getPropertyFile(File) that returns the map.
-Why do you need to store "Agent Controller Configuration" in the map?
Comment 4 Joel Cayne CLA 2008-02-26 10:08:04 EST
Created attachment 90748 [details]
CreateUpgrade class - 2

Thanks for reviewing the class Paul, I have made changes based on your comments.

- Updated the Id field
- Moved the package declaration
- Added the JavaDoc tags
- Replaced JAVA_PATH and host with a constant
- Used getElementsByTagName(String) instead of walking the DOM
- Removed getDoc() and getHash() (updated getPropertyFile(File)).
- Made the class a singleton.
- Removed "Agent Controller Configuration"

Paul, can you please review the updated class? Thanks!
Comment 5 Paul Slauenwhite CLA 2008-02-29 12:16:23 EST
(In reply to comment #4)
> Created an attachment (id=90748) [details]
> CreateUpgrade class - 2
> 
> Thanks for reviewing the class Paul, I have made changes based on your
> comments.
> 
> - Updated the Id field
> - Moved the package declaration
> - Added the JavaDoc tags
> - Replaced JAVA_PATH and host with a constant
> - Used getElementsByTagName(String) instead of walking the DOM
> - Removed getDoc() and getHash() (updated getPropertyFile(File)).
> - Made the class a singleton.
> - Removed "Agent Controller Configuration"
> 
> Paul, can you please review the updated class? Thanks!
> 

Reviewed.  Looks good.

-I would put your full name in the class comment so others can easily identify you.
-org.eclipse.tptp.platform.agentcontroller.config.Constants should be included in this patch.
-Unless you expect this class to be subclasses, make your protected methods and fields private.
-Stylistic comment, I like putting braces around single line blocks (e.g. if, loops, etc.) since it makes it easier to read and less prone to error if other lines are added to the block.
-The hash variable should be called properties (or similar) and you should probably type the return value of the getPropertyFile() (maybe called addPropertyFile()) method to Properties.
-I think you need getHash() or have parseDocument() return the properties.  My original comment was in context of not have the file passed to the singleton accessor (or having a public parseDocument() method).
Comment 6 Joel Cayne CLA 2008-02-29 16:14:36 EST
Created attachment 91249 [details]
 CreateUpgrade class - 3

Updated based on comments. Thanks Paul.
Comment 7 Joel Cayne CLA 2008-02-29 16:17:16 EST
Patch checked into HEAD.
Comment 8 Paul Slauenwhite CLA 2008-03-03 06:58:20 EST
(In reply to comment #6)
> Created an attachment (id=91249) [details]
>  CreateUpgrade class - 3
> 
> Updated based on comments. Thanks Paul.
> 

Joel, there is a problem with a singleton accessors accepting a parameter that is not used until the parseDocument() method is called.  The singleton design pattern only contained shared state (e.g. instance variables) between callers.  Passing in a file path that is associated only to the caller breaks the design pattern.  For example, caller A passes in file path A1 at time T1, caller B passes in file path B1 at time T2, and caller A calls the parseDocument() method at time T3.  To resolve, change the getInstance() method to not accept any parameters and change the parseDocument() method to accept the file path parameter. 

In addition, all new APIs in non-internal packaged require the @provisional JavaDoc tag
(see
http://www.eclipse.org/tptp/home/documents/process/development/api_contract.html).
Comment 9 Joel Cayne CLA 2008-03-03 10:20:06 EST
Created attachment 91372 [details]
ConfigUpgrade patch

Adds @provisional tag and moves the file path to parse as part of parseDocument().
Comment 10 Paul Slauenwhite CLA 2008-03-03 13:00:30 EST
(In reply to comment #9)
> Created an attachment (id=91372) [details]
> ConfigUpgrade patch
> 
> Adds @provisional tag and moves the file path to parse as part of
> parseDocument().
> 

Looks nice!
Comment 11 jkubasta CLA 2008-04-15 11:11:57 EDT
Verified, so closing