Project

General

Profile

Revision 2187

Improve handling of default values.
Call fileNew() if no default Harvest List file is specified.
Improve documentation for default properties.

View differences:

lib/harvester/runHarvestListEditor.sh
3 3
LIB_JARS=$METACAT_LIB/xercesImpl.jar
4 4
export CLASSPATH=$METACAT_CLASSES:$LIB_JARS
5 5
cd $METACAT_CLASSES
6
java edu.ucsb.nceas.metacat.harvesterClient.HarvestListEditor &
6
java edu.ucsb.nceas.metacat.harvesterClient.HarvestListEditor
src/edu/ucsb/nceas/metacat/harvesterClient/HarvestListEditor.java
82 82
  String clipboardScope = "";
83 83
	JButton copyButton;
84 84
	JButton cutButton;
85
  String defaultDocumentType;
86
  String defaultDocumentURL;
87
  String defaultHarvestList;
88
  String defaultIdentifier;
89
  String defaultRevision;
90
  String defaultScope;
85
  String defaultDocumentType = "eml://ecoinformatics.org/eml-2.0.0";
86
  String defaultDocumentURL = "http://";
87
  String defaultHarvestList = "";
88
  String defaultIdentifier = "1";
89
  String defaultRevision = "1";
90
  String defaultScope = "dataset";
91 91
	Document doc;
92 92
	JScrollPane docPane;
93 93
  JFileChooser fileChooser = new JFileChooser();
......
310 310
        }        
311 311
      }
312 312
    }
313
    else {
314
      fileNew();
315
    }
313 316

  
314 317
    try {    
315 318
      tempFile = File.createTempFile("harvestListTemp", ".xml");
......
726 729

  
727 730
    properties = new Properties();
728 731

  
729
    try {
730
      properties.load(new FileInputStream(propertiesFile));
731
      defaultHarvestList = properties.getProperty("defaultHarvestList");
732
      defaultDocumentType = properties.getProperty("defaultDocumentType");
733
      defaultDocumentURL = properties.getProperty("defaultDocumentURL");
734
      defaultIdentifier = properties.getProperty("defaultIdentifier");
735
      defaultRevision = properties.getProperty("defaultRevision");
736
      defaultScope = properties.getProperty("defaultScope");    
732
    if (propertiesFile.exists()) {
733
      try {
734
        properties.load(new FileInputStream(propertiesFile));
735
        defaultHarvestList = properties.getProperty("defaultHarvestList");
736
        defaultDocumentType = properties.getProperty("defaultDocumentType");
737
        defaultDocumentURL = properties.getProperty("defaultDocumentURL");
738
        defaultIdentifier = properties.getProperty("defaultIdentifier");
739
        defaultRevision = properties.getProperty("defaultRevision");
740
        defaultScope = properties.getProperty("defaultScope");    
741
      }
742
      catch (IOException ioe) {
743
        System.out.println("Error loading properties file: " + ioe.getMessage());
744
      }  
737 745
    }
738
    catch (IOException ioe) {
739
      System.out.println("Error loading properties file: " + ioe.getMessage());
740
    }    
741 746
  }
742 747
  
743 748

  
docs/user/harvestListEditor.html
105 105
    </tr>
106 106
    <tr>
107 107
      <td>defaultScope</td>
108
      <td>Determines the value that is pasted into the "Scope" field
109
          of the currently selected row when the "Paste Defaults" button 
110
          is clicked.</td>
111
      <td>Example:<br>xyz_dataset</td>
108
      <td>Determines the value that is pasted into the <em>Scope</em> field
109
          of the currently selected row when the 
110
          <code>Paste Defaults</code> button is clicked. The <em>Scope</em> 
111
          field should contain a symbolic identifer that indicates which 
112
          family of documents this EML document belongs to.</td>
113
      <td>
114
          Example:&nbsp;&nbsp;&nbsp;xyz_dataset<br>
115
          Default:&nbsp;&nbsp;&nbsp;&nbsp;dataset
116
      </td>
112 117
    </tr>
113 118
    <tr>
114 119
      <td>defaulIdentifer</td>
115
      <td>Determines the value that is pasted into the "Identifier" field
116
          of the currently selected row when the "Paste Defaults" button 
117
          is clicked. This should be a whole number value.</td>
118
      <td>Example:<br>1</td>
120
      <td>Determines the value that is pasted into the <em>Identifier</em> field
121
          of the currently selected row when the <code>Paste Defaults</code> button 
122
          is clicked. The <em>Identifier</em> field should contain
123
          a numeric value indicating the identifier for this particular
124
          EML document within the Scope.</td>
125
      <td>
126
          Example:&nbsp;&nbsp;&nbsp;2<br>
127
          Default:&nbsp;&nbsp;&nbsp;&nbsp;1
128
      </td>
119 129
    </tr>
120 130
    <tr>
121 131
      <td>defaultRevision</td>
122
      <td>Determines the value that is pasted into the "Revision" field
123
          of the currently selected row when the "Paste Defaults" button 
124
          is clicked. This should be a whole number value.</td>
125
      <td>Example:<br>1</td>
132
      <td>Determines the value that is pasted into the <em>Revision</em> field
133
          of the currently selected row when the <code>Paste Defaults</code> button 
134
          is clicked. The <em>Revision</em> field should contain a numeric
135
          value indicating the revision number of this EML document within
136
          the Scope and Identifier.</td>
137
      <td>
138
          Example:&nbsp;&nbsp;&nbsp;2<br>
139
          Default:&nbsp;&nbsp;&nbsp;&nbsp;1
140
      </td>
126 141
    </tr>
127 142
    <tr>
128 143
      <td>defaultDocumentType</td>
129
      <td>Determines the value that is pasted into the "Document Type" field
130
          of the currently selected row when the "Paste Defaults" button 
144
      <td>Determines the value that is pasted into the <em>Document Type</em> field
145
          of the currently selected row when the <code>Paste Defaults</code> button 
131 146
          is clicked.</td>
132 147
      <td>A document type specification
133 148
          <br><br>
......
136 151
    </tr>
137 152
    <tr>
138 153
      <td>defaultDocumentURL</td>
139
      <td>Determines the value that is pasted into the "Document URL" field
140
          of the currently selected row when the "Paste Defaults" button 
154
      <td>Determines the value that is pasted into the <em>Document URL</em> field
155
          of the currently selected row when the <code>Paste Defaults</code> button 
141 156
          is clicked. Typically, this value would be set to the portion
142
          of the URL that all EML documents at your site share in common.</td>
157
          of the URL that all harvested EML documents at your site share in common.</td>
143 158
      <td>A URL, or partial URL
144 159
          <br><br>
160
          Example:<br> <code>http://somehost.institution.edu/somepath/<code>
161
          <br><br>
145 162
          Default:<br> <code>http://<code>
146
          <br><br>
147
          Example:<br> <code>http://somehost.institution.edu/somepath/<code>
148 163
      </td>
149 164
    </tr>
150 165
  </table>

Also available in: Unified diff