Changeset 5148


Ignore:
Timestamp:
2003-08-18T13:50:54+12:00 (21 years ago)
Author:
kjdon
Message:

code style consistency check - class variables no longer end in _

Location:
trunk/gsdl3/src/java/org/greenstone/gsdl3
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl3/src/java/org/greenstone/gsdl3/build/CollectionConstructor.java

    r4852 r5148  
    1111
    1212    /** the site in which building is to take place */
    13     protected String site_home_ = null;
     13    protected String site_home = null;
    1414    /** the name of the collection */
    15     protected String collection_name_ = null;
     15    protected String collection_name = null;
    1616    /** the stage of construction */
    17     protected int process_type_ = -1;
     17    protected int process_type = -1;
    1818    /** other arguments/parameters for the construction process - in a paramList */
    19     protected Element process_params_ = null;
     19    protected Element process_params = null;
    2020    /** the list of listeners for the process */
    21     protected EventListenerList listeners_ = null;
     21    protected EventListenerList listeners = null;
    2222    /** A flag used to determine if this process has been asked to cancel. */
    23     protected boolean cancel_ = false;
     23    protected boolean cancel = false;
    2424   
    2525    public CollectionConstructor(String name) {
    2626    super(name);
    27     listeners_ = new EventListenerList();
     27    this.listeners = new EventListenerList();
    2828    }
    2929   
     
    3434    }
    3535    public void stopAction() {
    36     cancel_ = true;
     36    this.cancel = true;
    3737    }
    3838   
    3939    public void setActionType(int type) {
    40     process_type_ = type;
     40    this.process_type = type;
    4141    }
    4242    public void setSiteHome(String site_home) {
    43     site_home_ = site_home;
     43    this.site_home = site_home;
    4444    }
    4545    public void setCollectionName(String coll_name) {
    46     collection_name_ = coll_name;
     46    this.collection_name = coll_name;
    4747    }
    4848    public void setProcessParams(Element params) {
    49     process_params_ = params;
     49    this.process_params = params;
    5050    }
    5151    public boolean addListener(ConstructionListener listener) {
    52     listeners_.add(ConstructionListener.class, listener);
     52    this.listeners.add(ConstructionListener.class, listener);
    5353    return true;
    5454    }
    5555    public boolean removeListener(ConstructionListener listener) {
    56     listeners_.remove(ConstructionListener.class, listener);
     56    this.listeners.remove(ConstructionListener.class, listener);
    5757    return true;
    5858    }
    5959
    6060    protected void sendProcessBegun(ConstructionEvent evt) {
    61     Object[] concerned = listeners_.getListenerList();
     61    Object[] concerned = this.listeners.getListenerList();
    6262    for(int i = 0; i < concerned.length ; i+=2) {
    6363        if(concerned[i] == ConstructionListener.class) {
     
    6767    }
    6868    protected void sendProcessComplete(ConstructionEvent evt) {
    69     Object[] concerned = listeners_.getListenerList();
     69    Object[] concerned = this.listeners.getListenerList();
    7070    for(int i = 0; i < concerned.length ; i+=2) {
    7171        if(concerned[i] == ConstructionListener.class) {
     
    7777    protected void sendProcessStatus(ConstructionEvent evt) {
    7878
    79     Object[] concerned = listeners_.getListenerList();
     79    Object[] concerned = this.listeners.getListenerList();
    8080    for(int i = 0; i < concerned.length ; i+=2) {
    8181        if(concerned[i] == ConstructionListener.class) {
     
    8686    protected void sendMessage(ConstructionEvent evt) {
    8787
    88     Object[] concerned = listeners_.getListenerList();
     88    Object[] concerned = this.listeners.getListenerList();
    8989    for(int i = 0; i < concerned.length ; i+=2) {
    9090        if(concerned[i] == ConstructionListener.class) {
  • trunk/gsdl3/src/java/org/greenstone/gsdl3/build/ConstructionEvent.java

    r3661 r5148  
    88    /** the event id for these events - use a random number thats
    99    not reserved*/
    10     private static int event_id_ = RESERVED_ID_MAX+77;
     10    private static final int EVENT_ID = RESERVED_ID_MAX+77;
    1111    /** The status associated with the event. */
    12     private int status_ = -1;
     12    private int status = -1;
    1313    /** Any message associated with this event. */
    14     private String message_ = null;
     14    private String message = null;
    1515    /* Constructor.
    1616     * @param source The <strong>CollectionConstructor</strong> that fired this message.
     
    1919     */
    2020    public ConstructionEvent(Object source, int status, String message) {
    21     super(source, event_id_);
    22     message_ = message;
    23     status_ = status;
     21    super(source, EVENT_ID);
     22    this.message = message;
     23    this.status = status;
    2424    }
    2525    /** Gets the message associated with this event.
     
    2727     */
    2828    public String getMessage() {
    29     return message_;
     29    return this.message;
    3030    }
    3131    /** Gets the status associated with this event. This status can then be matched back to the constants in <strong>GShell</strong>.
     
    3333     */
    3434    public int getStatus() {
    35     return status_;
     35    return this.status;
    3636    }
    3737    /** returns a String representation of the event */
    3838    public String toString() {
    39     return "org.greenstone.gsdl3.build.ConstructionEvent[" + message_
    40 + "," + status_ + "]";
     39    return "org.greenstone.gsdl3.build.ConstructionEvent[" + this.message
     40+ "," + this.status + "]";
    4141    }
    4242}
  • trunk/gsdl3/src/java/org/greenstone/gsdl3/build/GS2PerlConstructor.java

    r4970 r5148  
    2727    /** gsdlhome for greenstone 2 - we use the perl modules and building
    2828     * scripts from there */
    29     protected String gsdl2home_ = null;
     29    protected String gsdl2home = null;
    3030    /** gsdlhome for gsdl3 - shouldn't need this eventually ??*/
    31     protected String gsdl3home_ = null;
     31    protected String gsdl3home = null;
    3232    /** gsdlos for greenstone 2 */
    33     protected String gsdlos_ = null;
     33    protected String gsdlos = null;
    3434    /** the path environment variable */
    35     protected String path_ = null;
     35    protected String path = null;
    3636
    3737    public GS2PerlConstructor(String name) {
     
    4242    public boolean configure() {
    4343    // try to get the environment variables
    44     gsdl2home_ = System.getProperty("GSDLHOME");
    45     gsdl3home_ = System.getProperty("GSDL3HOME");
    46     gsdlos_ = System.getProperty("GSDLOS");
    47     path_ = System.getProperty("PATH");
    48     if (gsdl2home_ ==null ) {
     44    this.gsdl2home = System.getProperty("GSDLHOME");
     45    this.gsdl3home = System.getProperty("GSDL3HOME");
     46    this.gsdlos = System.getProperty("GSDLOS");
     47    this.path = System.getProperty("PATH");
     48    if (this.gsdl2home ==null ) {
    4949        System.err.println("You must have greenstone2 installed, and GSDLHOME set for GS2Perl building to work!!");
    5050        return false;
    5151    }
    52     if (gsdl3home_ == null|| gsdlos_==null) {
     52    if (this.gsdl3home == null|| this.gsdlos == null) {
    5353       System.err.println("You must have GSDL3HOME and GSDLOS set for GS2Perl building to work!!");
    5454        return false;
    5555    } 
    56     if (path_==null) {
     56    if (this.path==null) {
    5757        System.err.println("You must have the PATH set for GS2Perl building to work!!");
    5858        return false;
     
    6464    String msg;
    6565    ConstructionEvent evt;
    66     if (process_type_ == -1) {
     66    if (this.process_type == -1) {
    6767        msg = "Error: you must set the action type";
    6868        evt = new ConstructionEvent(this, GSStatus.ERROR, msg);
     
    7070        return;
    7171    }
    72     if (site_home_==null) {
     72    if (this.site_home==null) {
    7373        msg = "Error: you must set site_home";
    7474        evt = new ConstructionEvent(this, GSStatus.ERROR, msg);
     
    7676        return;
    7777    }
    78     if (process_type_ != NEW && collection_name_ ==null) {
     78    if (this.process_type != NEW && this.collection_name ==null) {
    7979        msg = "Error: you must set collection_name";
    8080        evt = new ConstructionEvent(this, GSStatus.ERROR, msg);
     
    8383    }
    8484   
    85     switch (process_type_) {
     85    switch (this.process_type) {
    8686    case NEW:
    8787        newCollection();
     
    110110    command.add("gs2_mkcol.pl");
    111111    command.add("-site");
    112     command.add(site_home_);
    113     command.add("-collectdir");
    114     command.add(GSFile.collectDir(site_home_));
    115     command.addAll(extractParameters(process_params_));
    116     command.add(collection_name_);
     112    command.add(this.site_home);
     113    command.add("-collectdir");
     114    command.add(GSFile.collectDir(this.site_home));
     115    command.addAll(extractParameters(this.process_params));
     116    command.add(this.collection_name);
    117117    String [] command_str = {};
    118118    command_str = (String [])command.toArray(command_str);
     
    129129    command.add("import.pl");
    130130    command.add("-collectdir");
    131     command.add(GSFile.collectDir(site_home_));
    132     command.addAll(extractParameters(process_params_));
    133     command.add(collection_name_);
     131    command.add(GSFile.collectDir(this.site_home));
     132    command.addAll(extractParameters(this.process_params));
     133    command.add(this.collection_name);
    134134    String [] command_str = {};
    135135    command_str = (String [])command.toArray(command_str);
     
    146146    command.add("buildcol.pl");
    147147    command.add("-collectdir");
    148     command.add(GSFile.collectDir(site_home_));
    149     command.addAll(extractParameters(process_params_));
    150     command.add(collection_name_);
     148    command.add(GSFile.collectDir(this.site_home));
     149    command.addAll(extractParameters(this.process_params));
     150    command.add(this.collection_name);
    151151    String [] command_str = {};
    152152    command_str = (String [])command.toArray(command_str);
     
    163163
    164164    // first check that we have a building directory
    165     File build_dir = new File(GSFile.collectionBuildDir(site_home_, collection_name_));
     165    File build_dir = new File(GSFile.collectionBuildDir(this.site_home, this.collection_name));
    166166    if (!build_dir.exists()) {
    167167        sendMessage(new ConstructionEvent(this, GSStatus.ERROR, "build dir doesn't exist!"));
     
    170170
    171171    // move building to index
    172     File index_dir = new File(GSFile.collectionIndexDir(site_home_, collection_name_));
     172    File index_dir = new File(GSFile.collectionIndexDir(this.site_home, this.collection_name));
    173173    if (index_dir.exists()) {
    174174        sendMessage(new ConstructionEvent(this, GSStatus.INFO, "deleting index directory"));
     
    188188    command.add("convert_coll_from_gs2.pl");
    189189    command.add("-collectdir");
    190     command.add(GSFile.collectDir(site_home_));
    191     command.addAll(extractParameters(process_params_));
    192     command.add(collection_name_);
     190    command.add(GSFile.collectDir(this.site_home));
     191    command.addAll(extractParameters(this.process_params));
     192    command.add(this.collection_name);
    193193    String [] command_str = {};
    194194    command_str = (String [])command.toArray(command_str);
     
    231231    ConstructionEvent evt;
    232232   
    233     String args[] = {"GSDLHOME="+gsdl2home_,  "GSDLOS="+gsdlos_, "PATH="+path_};
     233    String args[] = {"GSDLHOME="+this.gsdl2home,  "GSDLOS="+this.gsdlos, "PATH="+this.path};
    234234    String command_str = "";
    235235    for(int i = 0; i < command.length; i++) {
     
    250250        String eline = null;
    251251        String stdinline = null;
    252         while (((eline = ebr.readLine()) != null || (stdinline = stdinbr.readLine()) != null) && !cancel_) {
     252        while (((eline = ebr.readLine()) != null || (stdinline = stdinbr.readLine()) != null) && !this.cancel) {
    253253        if(eline != null) {
    254254            sendProcessStatus(new ConstructionEvent(this, GSStatus.CONTINUING, eline));
     
    258258        }
    259259        }
    260         if(!cancel_) {
     260        if(!this.cancel) {
    261261        // Now display final message based on exit value
    262262        prcs.waitFor();
  • trunk/gsdl3/src/java/org/greenstone/gsdl3/build/GS2PerlListener.java

    r3684 r5148  
    55
    66    /** a buffer holding all the messages */
    7     protected StringBuffer log_=null;
     7    protected StringBuffer log=null;
    88    /** a buffer holding only the latest update */
    9     protected StringBuffer update_ = null;
     9    protected StringBuffer update = null;
    1010
    1111    /** a status code */
    12     protected int status_ = -1;
     12    protected int status = -1;
    1313    /** whether the process this is listeneing to is finshed */
    14     protected boolean finished_ = false;
     14    protected boolean finished = false;
    1515
    1616    public GS2PerlListener() {
    17     log_ = new StringBuffer();
    18     update_ = new StringBuffer();
     17    this.log = new StringBuffer();
     18    this.update = new StringBuffer();
    1919    }
    2020
    2121    public boolean isFinished() {
    22     return finished_;
     22    return this.finished;
    2323    }
    2424    public String getLog() {
    25     return log_.toString();
     25    return this.log.toString();
    2626    }
    2727    public int getStatus() {
    28     return status_;
     28    return this.status;
    2929    }
    3030    synchronized public String getUpdate() {
    31     log_.append(update_);
    32     String tmp = update_.toString();
    33     update_.delete(0, update_.length());
     31    this.log.append(this.update);
     32    String tmp = this.update.toString();
     33    this.update.delete(0, this.update.length());
    3434    return tmp;
    3535    }
     
    3939    /** This event handler used to signify that a task has been started */
    4040    synchronized public void processBegun(ConstructionEvent evt) {
    41     status_ = evt.getStatus();
    42     update_.append(evt.getMessage()+"\n");
     41    this.status = evt.getStatus();
     42    this.update.append(evt.getMessage()+"\n");
    4343   
    4444    }
    4545    /** This event handler used to signify that a task has been completed */
    4646    synchronized public void processComplete(ConstructionEvent evt){
    47     status_ = evt.getStatus();
    48     update_.append(evt.getMessage()+"\n");
     47    this.status = evt.getStatus();
     48    this.update.append(evt.getMessage()+"\n");
    4949    }
    5050    /** This event handler used to send status updates as the task is progressing */
    5151    synchronized public void processStatus(ConstructionEvent evt){
    52     status_ = evt.getStatus();
    53     update_.append(evt.getMessage()+"\n");
     52    this.status = evt.getStatus();
     53    this.update.append(evt.getMessage()+"\n");
    5454    }
    5555    /**  This event handler used to send any other messages to the listeners */
    5656    synchronized public void message(ConstructionEvent evt){
    57     status_ = evt.getStatus();
    58     update_.append(evt.getMessage()+"\n");
     57    this.status = evt.getStatus();
     58    this.update.append(evt.getMessage()+"\n");
    5959    }
    6060
  • trunk/gsdl3/src/java/org/greenstone/gsdl3/build/StatusDisplay.java

    r3694 r5148  
    2626
    2727    /** the display area for the status messages */
    28     protected TextArea display_;
     28    protected TextArea display;
    2929    /** how long to delay between requests */
    30     protected int delay_=3000; // 3 secs
     30    protected int delay=3000; // 3 secs
    3131    /** the thread used */
    32     protected Thread updatorThread_;
     32    protected Thread updator_thread;
    3333    /** the url for the requests */
    34     protected URL status_cgi_ = null;
     34    protected URL status_cgi = null;
    3535    /** if true, stops sending requests, and cant be unset */
    36     protected boolean completed_ = false;
     36    protected boolean completed = false;
    3737    // init is called if you leave the page and go back - need to somehow retrieve all the previous messages that have been obtained cos we may have left the page and gone back to it during an import or something. dont want to lose all the info.
    3838    public void init() {
    3939    //Create the text field and make it uneditable.
    40     display_ = new TextArea();
    41     display_.setEditable(false);
    42     display_.setBackground(Color.white);
     40    this.display = new TextArea();
     41    this.display.setEditable(false);
     42    this.display.setBackground(Color.white);
    4343    //Set the layout manager so that the text field will be
    4444    //as wide as possible.
     
    4646
    4747    //Add the text field to the applet.
    48     add(display_);
     48    add(this.display);
    4949    validate();
    5050
     
    5454
    5555    // check the initial error state - there may be no more messages to come
    56     completed_ = GSStatus.isCompleted(Integer.parseInt(parameterValue("initial_code")));
     56    this.completed = GSStatus.isCompleted(Integer.parseInt(parameterValue("initial_code")));
    5757       
    5858    // we always do the same query
     
    6060    library = tidy_URL(library);
    6161    try {
    62         status_cgi_ = new URL(library);
     62        this.status_cgi = new URL(library);
    6363    } catch (Exception e) {
    6464        System.out.println("Error creating URL for "+library+": "+e.getMessage());
     
    6767   
    6868    public void start() {
    69     if (completed_) {
     69    if (this.completed) {
    7070        // do nothing
    7171    } else {
    72         if (updatorThread_ == null) {
    73         updatorThread_ = new Thread(this);
     72        if (this.updator_thread == null) {
     73        this.updator_thread = new Thread(this);
    7474        }
    75         updatorThread_.start();
     75        this.updator_thread.start();
    7676    }
    7777    }
    7878    public void stop() {
    79     updatorThread_ = null;
     79    this.updator_thread = null;
    8080    }
    8181    public void run() {
    8282   
    83     if (completed_) { // do nothing. dont know if we need this here
     83    if (this.completed) { // do nothing. dont know if we need this here
    8484        return;
    8585    }
     
    8989
    9090        //Remember which thread we are.
    91         Thread currentThread = Thread.currentThread();
     91        Thread current_thread = Thread.currentThread();
    9292
    9393        //This is the  loop.
    94         while (currentThread == updatorThread_ && !completed_) {
     94        while (current_thread == this.updator_thread && !this.completed) {
    9595        queryServer();
    96             display_.repaint();
     96            this.display.repaint();
    9797       
    9898            //Delay for the specified time
    9999            try {
    100         Thread.sleep(delay_);
     100        Thread.sleep(this.delay);
    101101            } catch (InterruptedException e) {
    102102                break;
     
    107107    /** add some more text to the display    */
    108108    void addItem(String new_text) {
    109     String t = display_.getText()+"\n"+new_text;
    110     display_.setText(t);
    111     display_.setCaretPosition(t.length()); // so that you always see the
     109    String t = this.display.getText()+"\n"+new_text;
     110    this.display.setText(t);
     111    this.display.setCaretPosition(t.length()); // so that you always see the
    112112    // most recent entries - ie so that it scrolls down automatically
    113113    repaint();
     
    117117
    118118    // Send the query
    119     System.out.println("sending query: " + status_cgi_); // this appears in the java console
     119    System.out.println("sending query: " + this.status_cgi); // this appears in the java console
    120120    try {
    121         DataInputStream in = new DataInputStream(status_cgi_.openStream());
     121        DataInputStream in = new DataInputStream(this.status_cgi.openStream());
    122122        DOMParser parser = new DOMParser();
    123123        parser.parse(new InputSource(in));
     
    128128        String status = status_elem.getAttribute(GSXML.STATUS_ERROR_CODE_ATT);
    129129        System.out.println("received status "+status);
    130         completed_ = GSStatus.isCompleted(Integer.parseInt(status));
     130        this.completed = GSStatus.isCompleted(Integer.parseInt(status));
    131131        addItem(GSXML.getNodeText(status_elem));
    132132        } else {
    133133        System.out.println("Error - no status receieved");
    134         completed_=true;
     134        this.completed=true;
    135135        }
    136136        in.close();
    137137    } catch (Exception e) {
    138         System.err.println( "Error sending query ("+status_cgi_+"): " + e);
     138        System.err.println( "Error sending query ("+this.status_cgi+"): " + e);
    139139    }
    140140
  • trunk/gsdl3/src/java/org/greenstone/gsdl3/service/GS2Construct.java

    r5147 r5148  
    218218        // at the moment, delete is synchronous. but it may take ages so should do the command in another thread maybe? in which case we will want to ask for status
    219219        System.err.println("had a status request for delete - this shouldn't happen!!");
    220         //t = doc_.createTextNode("");
     220        //t = this.doc.createTextNode("");
    221221        //status.appendChild(t);
    222222        status.setAttribute(GSXML.STATUS_ERROR_CODE_ATT, Integer.toString(GSStatus.ERROR));
     
    268268        // reload is synchronous - this makes no sense
    269269        System.err.println("had a status request for reload - this shouldn't happen!!");
    270         //t = doc_.createTextNode("");
     270        //t = this.doc.createTextNode("");
    271271        //status.appendChild(t);
    272272        status.setAttribute(GSXML.STATUS_ERROR_CODE_ATT, Integer.toString(GSStatus.ERROR));
  • trunk/gsdl3/src/java/org/greenstone/gsdl3/service/XSLTServices.java

    r5126 r5148  
    187187      // something funny with the doc -
    188188      Element new_doc = this.doc.createElement(GSXML.DOCUMENT_ELEM);
    189       new_doc.setAttribute(GSXML.NAME_ATT, ids[j]); //GSXML.createDocumentElement(doc_, ids[j]);
     189      new_doc.setAttribute(GSXML.NAME_ATT, ids[j]); //GSXML.createDocumentElement(this.doc, ids[j]);
    190190      GSXML.addDocText(this.doc, new_doc, document);
    191191      response.appendChild(new_doc);
     
    249249    Element e = this.doc.createElement(GSXML.DOCUMENT_ELEM);
    250250    e.setAttribute(GSXML.NAME_ATT, id);
    251     //Node no = GSXML.createDocumentElement(doc_, id);
     251    //Node no = GSXML.createDocumentElement(this.doc, id);
    252252    resource_list.appendChild(e);
    253253      } catch (Throwable t) {
Note: See TracChangeset for help on using the changeset viewer.