Changeset 25537

Show
Ignore:
Timestamp:
08.05.2012 09:49:00 (7 years ago)
Author:
sjm84
Message:

Reformatting this file ahead of some changes

Files:
1 modified

Legend:

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

    r24883 r25537  
    99 
    1010/** base class for collection construction */ 
    11 public abstract class CollectionConstructor  
    12     extends Thread { 
     11public abstract class CollectionConstructor extends Thread 
     12{ 
    1313 
    14     /** the site in which building is to take place */ 
    15     protected String site_home = null; 
    16     /** the name of the site*/ 
    17     protected String site_name = null; 
    18     /** the name of the collection */ 
    19     protected String collection_name = null; 
    20     /** the stage of construction */ 
    21     protected int process_type = -1; 
    22     /** other arguments/parameters for the construction process - in a paramList */ 
    23     protected Element process_params = null; 
    24     /** the list of listeners for the process */ 
    25     protected EventListenerList listeners = null; 
    26     /** A flag used to determine if this process has been asked to cancel. */ 
    27     protected boolean cancel = false; 
    28      
    29     public CollectionConstructor(String name) { 
    30     super(name); 
    31     this.listeners = new EventListenerList(); 
    32     } 
    33      
    34     /** carry out any set up stuff - returns false if couldn't set up properly 
    35      */ 
    36     public boolean configure() { 
    37     return true; 
    38     } 
    39     public void stopAction() { 
    40     this.cancel = true; 
    41     } 
    42      
    43     public void setActionType(int type) { 
    44     this.process_type = type; 
    45     } 
    46     public void setSiteHome(String site_home) { 
    47     this.site_home = site_home; 
    48      
    49     File siteHomeFile = new File(site_home); 
    50     this.site_name = siteHomeFile.getName(); 
    51     } 
    52     public void setCollectionName(String coll_name) { 
    53     this.collection_name = coll_name; 
    54     } 
    55     public void setProcessParams(Element params) { 
    56     this.process_params = params; 
    57     } 
    58     public boolean addListener(ConstructionListener listener) { 
    59     this.listeners.add(ConstructionListener.class, listener); 
    60     return true; 
    61     } 
    62     public boolean removeListener(ConstructionListener listener) { 
    63     this.listeners.remove(ConstructionListener.class, listener); 
    64     return true; 
    65     } 
     14    /** the site in which building is to take place */ 
     15    protected String site_home = null; 
     16    /** the name of the site */ 
     17    protected String site_name = null; 
     18    /** the name of the collection */ 
     19    protected String collection_name = null; 
     20    /** the stage of construction */ 
     21    protected int process_type = -1; 
     22    /** other arguments/parameters for the construction process - in a paramList */ 
     23    protected Element process_params = null; 
     24    /** the list of listeners for the process */ 
     25    protected EventListenerList listeners = null; 
     26    /** A flag used to determine if this process has been asked to cancel. */ 
     27    protected boolean cancel = false; 
    6628 
    67     protected void sendProcessBegun(ConstructionEvent evt) { 
    68     Object[] concerned = this.listeners.getListenerList(); 
    69     for(int i = 0; i < concerned.length ; i+=2) { 
    70         if(concerned[i] == ConstructionListener.class) { 
    71         ((ConstructionListener)concerned[i+1]).processBegun(evt); 
    72         } 
     29    public CollectionConstructor(String name) 
     30    { 
     31        super(name); 
     32        this.listeners = new EventListenerList(); 
    7333    } 
    74     } 
    75     protected void sendProcessComplete(ConstructionEvent evt) { 
    76     Object[] concerned = this.listeners.getListenerList(); 
    77     for(int i = 0; i < concerned.length ; i+=2) { 
    78         if(concerned[i] == ConstructionListener.class) { 
    79         ((ConstructionListener)concerned[i+1]).processComplete(evt); 
    80         } 
     34 
     35    /** 
     36     * carry out any set up stuff - returns false if couldn't set up properly 
     37     */ 
     38    public boolean configure() 
     39    { 
     40        return true; 
    8141    } 
    82     } 
    83      
    84     protected void sendProcessStatus(ConstructionEvent evt) { 
    8542 
    86     Object[] concerned = this.listeners.getListenerList(); 
    87     for(int i = 0; i < concerned.length ; i+=2) { 
    88         if(concerned[i] == ConstructionListener.class) { 
    89         ((ConstructionListener)concerned[i+1]).processStatus(evt); 
    90         } 
     43    public void stopAction() 
     44    { 
     45        this.cancel = true; 
    9146    } 
    92     } 
    93     protected void sendMessage(ConstructionEvent evt) { 
    9447 
    95     Object[] concerned = this.listeners.getListenerList(); 
    96     for(int i = 0; i < concerned.length ; i+=2) { 
    97         if(concerned[i] == ConstructionListener.class) { 
    98         ((ConstructionListener)concerned[i+1]).message(evt); 
    99         } 
     48    public void setActionType(int type) 
     49    { 
     50        this.process_type = type; 
    10051    } 
    101     } 
    102      
    103     abstract public void run(); 
     52 
     53    public void setSiteHome(String site_home) 
     54    { 
     55        this.site_home = site_home; 
     56 
     57        File siteHomeFile = new File(site_home); 
     58        this.site_name = siteHomeFile.getName(); 
     59    } 
     60 
     61    public void setCollectionName(String coll_name) 
     62    { 
     63        this.collection_name = coll_name; 
     64    } 
     65 
     66    public void setProcessParams(Element params) 
     67    { 
     68        this.process_params = params; 
     69    } 
     70 
     71    public boolean addListener(ConstructionListener listener) 
     72    { 
     73        this.listeners.add(ConstructionListener.class, listener); 
     74        return true; 
     75    } 
     76 
     77    public boolean removeListener(ConstructionListener listener) 
     78    { 
     79        this.listeners.remove(ConstructionListener.class, listener); 
     80        return true; 
     81    } 
     82 
     83    protected void sendProcessBegun(ConstructionEvent evt) 
     84    { 
     85        Object[] concerned = this.listeners.getListenerList(); 
     86        for (int i = 0; i < concerned.length; i += 2) 
     87        { 
     88            if (concerned[i] == ConstructionListener.class) 
     89            { 
     90                ((ConstructionListener) concerned[i + 1]).processBegun(evt); 
     91            } 
     92        } 
     93    } 
     94 
     95    protected void sendProcessComplete(ConstructionEvent evt) 
     96    { 
     97        Object[] concerned = this.listeners.getListenerList(); 
     98        for (int i = 0; i < concerned.length; i += 2) 
     99        { 
     100            if (concerned[i] == ConstructionListener.class) 
     101            { 
     102                ((ConstructionListener) concerned[i + 1]).processComplete(evt); 
     103            } 
     104        } 
     105    } 
     106 
     107    protected void sendProcessStatus(ConstructionEvent evt) 
     108    { 
     109 
     110        Object[] concerned = this.listeners.getListenerList(); 
     111        for (int i = 0; i < concerned.length; i += 2) 
     112        { 
     113            if (concerned[i] == ConstructionListener.class) 
     114            { 
     115                ((ConstructionListener) concerned[i + 1]).processStatus(evt); 
     116            } 
     117        } 
     118    } 
     119 
     120    protected void sendMessage(ConstructionEvent evt) 
     121    { 
     122 
     123        Object[] concerned = this.listeners.getListenerList(); 
     124        for (int i = 0; i < concerned.length; i += 2) 
     125        { 
     126            if (concerned[i] == ConstructionListener.class) 
     127            { 
     128                ((ConstructionListener) concerned[i + 1]).message(evt); 
     129            } 
     130        } 
     131    } 
     132 
     133    abstract public void run(); 
    104134}