Changeset 14304


Ignore:
Timestamp:
2007-08-06T10:20:40+12:00 (17 years ago)
Author:
qq6
Message:

Added the configuration for the remote gs3

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gli/trunk/src/org/greenstone/gatherer/Gatherer.java

    r14257 r14304  
    161161        // We have to use our own collect directory since we can't use the Greenstone one
    162162        setCollectDirectoryPath(getGLIUserDirectoryPath() + "collect" + File.separator);
     163        if (go.run_gsdl3){   
     164        GS3=true;
     165        go.gsdl3_path=null;
     166        go.gsdl3_src_path=null;
     167        }
    163168    }
    164169    // No, we have a local Greenstone
     
    175180    if (isGsdlRemote) {
    176181        Configuration.TEMPLATE_CONFIG_XML = "xml/configRemote.xml";
    177         Configuration.CONFIG_XML = "configRemote.xml";
    178         Configuration.GS3_CONFIG_XML = "config3Remote.xml";
     182        if (!go.run_gsdl3){ 
     183        Configuration.CONFIG_XML = "configRemote.xml";
     184        }else{
     185        Configuration.GS3_CONFIG_XML = "config3Remote.xml";
     186        }
    179187
    180188        File collect_directory = new File(Gatherer.getCollectDirectoryPath());
     
    232240        new Configuration(getGLIUserDirectoryPath(), gsdl_path, gsdl3_path, gsdl3_src_path, site_name);
    233241
    234         if (GS3) {
    235         // Load Greenstone 3 servlet configuration
    236         servlet_config = new ServletConfiguration(gsdl3_path);
    237         }
    238 
    239242        // Check we know where Perl is
    240243        Configuration.perl_path = perl_path;
     
    248251        }
    249252
    250         if (GS3 && Configuration.servlet_path == null) {
    251         Configuration.servlet_path = servlet_config.getServletPath(Configuration.site_name);
    252         }
    253 
    254253        // the feedback dialog has been loaded with a default locale,
    255254        // now set the user specified one
     
    291290        DebugStream.println("Configuration.library_url = " + Configuration.library_url);
    292291        if (Configuration.library_url == null) {
    293         missingEXEC();
     292        missingEXEC();
     293        //missingGLIServer();
    294294        }
    295295
     
    314314            gliserver_url_string = Configuration.gliserver_url.toString();
    315315        }
     316        }
     317
     318        if (GS3) {
     319        // Load Greenstone 3 servlet configuration
     320        if (isGsdlRemote){
     321            servlet_config = new ServletConfiguration(Configuration.gli_user_directory_path);
     322        }else{
     323            servlet_config= new ServletConfiguration(gsdl3_path);
     324        }
     325        }
     326
     327        if (GS3 && Configuration.servlet_path == null) {
     328        Configuration.servlet_path = servlet_config.getServletPath(Configuration.site_name);
    316329        }
    317330
     
    403416    g_man = new GUIManager(size);
    404417
    405     }
    406 
    407 
    408     public void openGUI() {
    409       // Size and place the frame on the screen
    410       Rectangle bounds = Configuration.getBounds("general.bounds", true);
    411       if (bounds == null) {
    412         // Choose a sensible default value
    413         bounds = new Rectangle(0, 0, 640, 480);
    414       }
    415      
    416       // Ensure width and height are reasonable
    417       size = bounds.getSize();
    418       if (size.width < 640) {
    419         size.width = 640;
    420       } else if (size.width > Configuration.screen_size.width && Configuration.screen_size.width > 0) {
    421         size.width = Configuration.screen_size.width;
    422       }
    423       if (size.height < 480) {
    424         size.height = 480;
    425       } else if (size.height > Configuration.screen_size.height && Configuration.screen_size.height > 0) {
    426         size.height = Configuration.screen_size.height;
    427       }
    428      
    429       if (!g_man_built) {
    430        
    431         g_man.display();
    432        
    433         // Place the window in the desired location on the screen, if this is do-able (not under most linux window managers apparently. In fact you're lucky if they listen to any of your screen size requests).
    434         g_man.setLocation(bounds.x, bounds.y);
    435         g_man.setVisible(true);
    436        
    437         // After the window has been made visible, check that it is in the correct place
    438         // sometimes java places a window not in the correct place,
    439         // but with an offset. If so, we work out what the offset is
    440         // and change the desired location to take that into account
    441         Point location = g_man.getLocation();
    442         int x_offset = bounds.x - location.x;
    443         int y_offset = bounds.y - location.y;
    444         // If not, offset the window to move it into the correct location
    445         if (x_offset > 0 || y_offset > 0) {
    446           ///ystem.err.println("changing the location to "+(bounds.x + x_offset)+" "+ (bounds.y + y_offset));
    447           g_man.setLocation(bounds.x + x_offset, bounds.y + y_offset);
    448         }
    449        
    450         // The 'after-display' triggers several events which don't occur until after the visual components are actually available on screen. Examples of these would be the various html renderings, as they can't happen offscreen.
    451         g_man.afterDisplay();
    452         g_man_built = true;
    453       } else {
    454         g_man.setVisible(true);
    455       }
    456       // Get a list of the core Greenstone classifiers and plugins
    457       Classifiers.loadClassifiersList(null);
    458       Plugins.loadPluginsList(null);
    459      
    460       // If using a remote Greenstone we need to download the collection configurations now
    461       if (Gatherer.isGsdlRemote) {
    462         if (RemoteGreenstoneServer.downloadCollectionConfigurations().equals("")) {
    463           // !! Something went wrong downloading the collection configurations
    464           System.err.println("Error: Could not download collection configurations.");
    465           System.exit(0);
    466         }
    467       }
    468  
    469   if (open_collection_file_path == null) {
     418    // Get a list of the core Greenstone classifiers and plugins
     419    Classifiers.loadClassifiersList(null);
     420    Plugins.loadPluginsList(null);
     421
     422    // If using a remote Greenstone we need to download the collection configurations now
     423    if (Gatherer.isGsdlRemote) {
     424        if (RemoteGreenstoneServer.downloadCollectionConfigurations().equals("")) {
     425        // !! Something went wrong downloading the collection configurations
     426        System.err.println("Error: Could not download collection configurations.");
     427        System.exit(0);
     428        }
     429    }
     430
     431    }
     432
     433    public void openGUI()
     434    {
     435    // Size and place the frame on the screen
     436    Rectangle bounds = Configuration.getBounds("general.bounds", true);
     437    if (bounds == null) {
     438        // Choose a sensible default value
     439        bounds = new Rectangle(0, 0, 640, 480);
     440    }
     441   
     442    // Ensure width and height are reasonable
     443    size = bounds.getSize();
     444    if (size.width < 640) {
     445        size.width = 640;
     446    }
     447    else if (size.width > Configuration.screen_size.width && Configuration.screen_size.width > 0) {
     448        size.width = Configuration.screen_size.width;
     449    }
     450    if (size.height < 480) {
     451        size.height = 480;
     452    }
     453    else if (size.height > Configuration.screen_size.height && Configuration.screen_size.height > 0) {
     454        size.height = Configuration.screen_size.height;
     455    }
     456
     457    if (!g_man_built) {
     458
     459        g_man.display();
     460
     461        // Place the window in the desired location on the screen, if this is do-able (not under most linux window managers apparently. In fact you're lucky if they listen to any of your screen size requests).
     462        g_man.setLocation(bounds.x, bounds.y);
     463        g_man.setVisible(true);
     464
     465        // After the window has been made visible, check that it is in the correct place
     466        // sometimes java places a window not in the correct place,
     467        // but with an offset. If so, we work out what the offset is
     468        // and change the desired location to take that into account
     469        Point location = g_man.getLocation();
     470        int x_offset = bounds.x - location.x;
     471        int y_offset = bounds.y - location.y;
     472        // If not, offset the window to move it into the correct location
     473        if (x_offset > 0 || y_offset > 0) {
     474        ///ystem.err.println("changing the location to "+(bounds.x + x_offset)+" "+ (bounds.y + y_offset));
     475        g_man.setLocation(bounds.x + x_offset, bounds.y + y_offset);
     476        }
     477
     478        // The 'after-display' triggers several events which don't occur until after the visual components are actually available on screen. Examples of these would be the various html renderings, as they can't happen offscreen.
     479        g_man.afterDisplay();
     480        g_man_built = true;
     481    }
     482    else {
     483        g_man.setVisible(true);
     484    }
     485
     486    // Get a list of the core Greenstone classifiers and plugins
     487    /*Classifiers.loadClassifiersList(null);
     488    Plugins.loadPluginsList(null);
     489
     490    // If using a remote Greenstone we need to download the collection configurations now
     491    if (Gatherer.isGsdlRemote) {
     492        if (RemoteGreenstoneServer.downloadCollectionConfigurations().equals("")) {
     493        // !! Something went wrong downloading the collection configurations
     494        System.err.println("Error: Could not download collection configurations.");
     495        System.exit(0);
     496        }
     497    }*/
     498
     499    // If there was a collection left open last time, reopen it
     500     if (open_collection_file_path == null) {
    470501     
    471502      //the menu bar items, file and edit, are disabled from the moment of their creation. if there is no left-over collection from the last session, enable them; otherwise it is untill the collection finishes loading, will they be enabled in collectionManager.java
    472       setMenuBarEnabled(true);
    473   } else {
     503      setMenuBarEnabled(true);
     504      } else {
    474505 
    475506      // If there was a collection left open last time, reopen it
    476       c_man.openCollectionFromLastTime();
    477   }
    478     }
     507      c_man.openCollectionFromLastTime();
     508      }
     509    }
     510
    479511    public static void setMenuBarEnabled(boolean enabled) {
    480512      g_man.menu_bar.file.setEnabled(enabled);
     
    715747    WarningDialog dialog;
    716748    if (GS3) {
    717         dialog = new WarningDialog("warning.MissingEXEC_GS3", Dictionary.get("MissingEXEC_GS3.Title"), Dictionary.get("MissingEXEC_GS3.Message"), "general.library_url", false);
    718     }
    719     else {
     749        dialog = new WarningDialog("warning.MissingEXEC", Dictionary.get("MissingEXEC_GS3.Title"), Dictionary.get("MissingEXEC_GS3.Message"), "general.library_url", false);
     750    }else {
    720751        dialog = new WarningDialog("warning.MissingEXEC", Dictionary.get("MissingEXEC.Title"), Dictionary.get("MissingEXEC.Message"), "general.library_url", false);
    721752    }
     
    739770    static private void missingGLIServer()
    740771    {
    741     WarningDialog dialog = new WarningDialog("warning.MissingGLIServer", Dictionary.get("MissingGLIServer.Title"), Dictionary.get("MissingGLIServer.Message"), "general.gliserver_url", false);
     772    WarningDialog dialog;
     773    if (GS3) {
     774        dialog = new WarningDialog("warning.MissingGLIServer", Dictionary.get("MissingGLIServer_GS3.Title"), Dictionary.get("MissingGLIServer_GS3.Message"), "general.gliserver_url", false);
     775    }else {
     776        dialog = new WarningDialog("warning.MissingGLIServer", Dictionary.get("MissingGLIServer.Title"), Dictionary.get("MissingGLIServer.Message"), "general.gliserver_url", false);
     777    }
    742778    dialog.setValueField(new URLField(Configuration.getColor("coloring.editable_foreground", false), Configuration.getColor("coloring.editable_background", false)));
    743779    dialog.display();
     
    9791015        Process image_magick_process = Runtime.getRuntime().exec(command);
    9801016        image_magick_process.waitFor();
    981        
     1017
    9821018        //new way of detection of ImageMagick
    9831019        InputStreamReader isr = new InputStreamReader(image_magick_process.getInputStream());
Note: See TracChangeset for help on using the changeset viewer.