greenstone.org greenstone wiki greenstone trac planet greenstone

Changeset 16330

Show
Ignore:
Timestamp:
2008-07-10 12:53:51 (3 months ago)
Author:
ak19
Message:

Changes to work with the remote GS server which now knows its server version and informs the GLI client application. These changes (which mostly involved moving around code and deleting lines no longer needed) are based on the fact that config3.xml has been merged into config.xml and configRemote3.xml has been merged into configRemote.xml.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • gli/trunk/src/org/greenstone/gatherer/Configuration.java

    r15801 r16330  
    6767    /** The name of the general Gatherer configuration file. */ 
    6868    static public String CONFIG_XML = "config.xml"; 
    69     /** The name of the general Gatherer configuration file for running with GS3. */ 
    70     static public String GS3_CONFIG_XML = "config3.xml"; 
    7169    static public String FEDORA_CONFIG_PREFIX = "fedora-"; 
    7270 
     
    130128    static public URL gliserver_url = null; 
    131129    static public URL library_url = null; 
    132  
    133  
     130     
     131     
    134132    /** Constructor. 
    135133     * @param gsdl_path The path to the Greenstone directory as a <strong>String</strong>. 
     
    137135     * @param gsdl3_src_path The path to the Greenstone 3 src directory as a <strong>String</strong>. 
    138136     * @param site_name The name of the Greenstone 3 site currently in use. 
     137     * @param fedora_info A FedoraInfo object containing the user-provided details for creating 
     138     * a connection to a Fedora repository. 
    139139     */ 
    140     public Configuration(String gli_user_directory_path, String gsdl_path, String gsdl3_path, String gsdl3_src_path, String site_name, 
    141                         FedoraInfo fedora_info) 
     140    public Configuration(String gli_user_directory_path, String gsdl_path, String gsdl3_path, String gsdl3_src_path,  
     141                                String site_name, FedoraInfo fedora_info)  
    142142    { 
    143143        super(); 
    144         self = this; 
     144        self = this; // allows Configuration to statically refer to itself in the static methods 
    145145 
    146146        this.gli_user_directory_path = gli_user_directory_path; 
     
    154154        // Try to load the configuration file from the user specific location 
    155155        String config_xml_file_name = CONFIG_XML; 
    156         if (gsdl3_path != null || (Gatherer.isGsdlRemote && Gatherer.GS3)) { 
    157             config_xml_file_name = GS3_CONFIG_XML; 
    158         } 
    159156 
    160157        if (fedora_info != null && fedora_info.isActive()) { 
     
    206203        } 
    207204         
    208         if (gsdl3_path != null || (Gatherer.GS3 && Gatherer.isGsdlRemote)) { 
    209             if (this.site_name == null || this.site_name.equals("")) { 
    210                 this.site_name = getString("general.site_name", true); 
    211                 this.servlet_path = getString("general.servlet_path", true); 
    212                 if (this.site_name.equals("")) { 
    213                     this.site_name = "localsite"; // can we assume these?? 
    214                     this.servlet_path = "/library"; 
    215                     setString("general.site_name", true, this.site_name); 
    216                     setString("general.servlet_path", true, this.servlet_path); 
    217                 } 
    218                  
    219             } else { 
    220                 // we set the current one in the config 
    221                 setString("general.site_name", true, this.site_name); 
    222                 if (this.servlet_path != null && !this.servlet_path.equals("")) { 
    223                     setString("general.servlet_path", true, this.servlet_path); 
    224                 } 
    225             } 
    226         } 
    227     } 
    228  
     205        if(gsdl3_path != null) { 
     206            prepareForGS3(); 
     207        } 
     208 
     209    } 
     210 
     211    // Called when (gsdl3_path != null) || (Gatherer.GS3 && Gatherer.isGsdlRemote)  
     212    static public void prepareForGS3() { 
     213        if (site_name == null || site_name.equals("")) { 
     214            site_name = getString("general.site_name", true); 
     215            servlet_path = getString("general.servlet_path", true); 
     216            if (site_name.equals("")) { 
     217                site_name = "localsite"; // can we assume these?? 
     218                servlet_path = "/library"; 
     219                setString("general.site_name", true, site_name); 
     220                setString("general.servlet_path", true, servlet_path); 
     221            } 
     222             
     223        } else { 
     224            // we set the current one in the config 
     225            setString("general.site_name", true, site_name); 
     226            if (servlet_path != null && !servlet_path.equals("")) { 
     227                setString("general.servlet_path", true, servlet_path); 
     228            } 
     229        } 
     230    } 
    229231 
    230232    static private boolean updateUserConfigXMLFileIfNecessary(File config_xml_file) 
     
    708710        File user_config_xml = null; 
    709711        String config_xml_name = CONFIG_XML; 
    710  
    711         if (gsdl3_path!=null) { 
    712             config_xml_name = GS3_CONFIG_XML; 
    713         } 
    714                  
    715         if (Gatherer.isGsdlRemote) { 
    716             if (Gatherer.GS3){ 
    717                 config_xml_name = GS3_CONFIG_XML; 
    718             }else{ 
    719                 config_xml_name = CONFIG_XML; 
    720             } 
    721         } 
    722712 
    723713        if (fedora_info != null && fedora_info.isActive()) {