Changeset 4852
- Timestamp:
- 2003-07-02T14:38:27+12:00 (21 years ago)
- Location:
- trunk/gsdl3/src/java/org/greenstone/gsdl3/build
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl3/src/java/org/greenstone/gsdl3/build/CollectionConstructor.java
r3683 r4852 9 9 public abstract class CollectionConstructor 10 10 extends Thread { 11 12 public static final int NEW = 0;13 public static final int IMPORT = 1;14 public static final int BUILD = 2;15 public static final int ACTIVATE = 3;16 11 17 12 /** the site in which building is to take place */ … … 99 94 } 100 95 101 public void run(){ 102 String msg; 103 ConstructionEvent evt; 104 if (process_type_ == -1) { 105 msg = "Error: you must set the action type"; 106 evt = new ConstructionEvent(this, GSStatus.ERROR, msg); 107 sendMessage(evt); 108 return; 109 } 110 if (site_home_==null) { 111 msg = "Error: you must set site_home"; 112 evt = new ConstructionEvent(this, GSStatus.ERROR, msg); 113 sendMessage(evt); 114 return; 115 } 116 if (process_type_ != NEW && collection_name_ ==null) { 117 msg = "Error: you must set collection_name"; 118 evt = new ConstructionEvent(this, GSStatus.ERROR, msg); 119 sendMessage(evt); 120 return; 121 } 122 123 switch (process_type_) { 124 case NEW: 125 newCollection(); 126 break; 127 case IMPORT: 128 importCollection(); 129 break; 130 case BUILD: 131 buildCollection(); 132 break; 133 case ACTIVATE: 134 activateCollection(); 135 break; 136 default: 137 msg = "wrong type of action specified!"; 138 evt = new ConstructionEvent(this, GSStatus.ERROR, msg); 139 sendMessage(evt); 140 break; 141 } 142 143 } 144 145 abstract protected void newCollection(); 146 abstract protected void importCollection(); 147 abstract protected void buildCollection(); 148 abstract protected void activateCollection(); 96 abstract public void run(); 149 97 } -
trunk/gsdl3/src/java/org/greenstone/gsdl3/build/ConstructCollection.java
r3684 r4852 49 49 } 50 50 if (val.equals("new")) { 51 process_mode = CollectionConstructor.NEW;51 process_mode = GS2PerlConstructor.NEW; 52 52 } else if (val.equals("import")) { 53 process_mode = CollectionConstructor.IMPORT;53 process_mode = GS2PerlConstructor.IMPORT; 54 54 } else if (val.equals("build")) { 55 process_mode = CollectionConstructor.BUILD;55 process_mode = GS2PerlConstructor.BUILD; 56 56 } else if (val.equals("activate")) { 57 process_mode = CollectionConstructor.ACTIVATE;57 process_mode = GS2PerlConstructor.ACTIVATE; 58 58 } 59 59 … … 85 85 // check that the collection name is valid - ie the directory exists if this is not a new one, or doesn't exist if we are creating a new one 86 86 File coll_dir = new File(GSFile.collectionBaseDir(site_home, coll_name)); 87 if (process_mode != CollectionConstructor.NEW && !coll_dir.exists()) {87 if (process_mode != GS2PerlConstructor.NEW && !coll_dir.exists()) { 88 88 System.out.println("ERROR: Invalid collection ("+coll_name+")."); 89 89 printUsage(); 90 90 return; 91 } else if (process_mode == CollectionConstructor.NEW &&91 } else if (process_mode == GS2PerlConstructor.NEW && 92 92 coll_dir.exists()) { 93 93 System.out.println("ERROR: there is already a collection named "+coll_name); … … 98 98 99 99 ConstructCollection processor = new ConstructCollection(); 100 CollectionConstructor constructor = new GS2PerlConstructor("perl_build");100 GS2PerlConstructor constructor = new GS2PerlConstructor("perl_build"); 101 101 if (!constructor.configure()) { 102 102 System.out.println("couldn't configure the constructor!!"); -
trunk/gsdl3/src/java/org/greenstone/gsdl3/build/GS2PerlConstructor.java
r3984 r4852 19 19 public class GS2PerlConstructor 20 20 extends CollectionConstructor { 21 22 public static final int NEW = 0; 23 public static final int IMPORT = 1; 24 public static final int BUILD = 2; 25 public static final int ACTIVATE = 3; 21 26 22 27 /** gsdlhome for greenstone 2 - we use the perl modules and building … … 56 61 } 57 62 63 public void run() { 64 String msg; 65 ConstructionEvent evt; 66 if (process_type_ == -1) { 67 msg = "Error: you must set the action type"; 68 evt = new ConstructionEvent(this, GSStatus.ERROR, msg); 69 sendMessage(evt); 70 return; 71 } 72 if (site_home_==null) { 73 msg = "Error: you must set site_home"; 74 evt = new ConstructionEvent(this, GSStatus.ERROR, msg); 75 sendMessage(evt); 76 return; 77 } 78 if (process_type_ != NEW && collection_name_ ==null) { 79 msg = "Error: you must set collection_name"; 80 evt = new ConstructionEvent(this, GSStatus.ERROR, msg); 81 sendMessage(evt); 82 return; 83 } 84 85 switch (process_type_) { 86 case NEW: 87 newCollection(); 88 break; 89 case IMPORT: 90 importCollection(); 91 break; 92 case BUILD: 93 buildCollection(); 94 break; 95 case ACTIVATE: 96 activateCollection(); 97 break; 98 default: 99 msg = "wrong type of action specified!"; 100 evt = new ConstructionEvent(this, GSStatus.ERROR, msg); 101 sendMessage(evt); 102 break; 103 } 104 105 } 106 58 107 protected void newCollection() { 59 108 sendMessage(new ConstructionEvent(this, GSStatus.INFO, "Collection construction: new collection."));
Note:
See TracChangeset
for help on using the changeset viewer.