Project

General

Profile

« Previous | Next » 

Revision 5027

Added by daigle over 14 years ago

Change MetaCatVersion to MetacatVersion

View differences:

test/JDBCTest.java
29 29
import java.lang.*;
30 30
import java.sql.*;
31 31
import edu.ucsb.nceas.metacat.*;
32
import edu.ucsb.nceas.metacat.database.*;
32 33
import edu.ucsb.nceas.metacat.service.PropertyService;
33 34
import edu.ucsb.nceas.utilities.PropertyNotFoundException;
34 35

  
test/MaxmumDBConnection.java
31 31
import java.lang.*;
32 32
import java.sql.*;
33 33
import edu.ucsb.nceas.metacat.*;
34
import edu.ucsb.nceas.metacat.database.*;
34 35

  
35 36

  
36 37
/**
test/test.properties
1 1
# Set this to the location of the metacat application context
2 2
# directory.  The tests will use this to find metacat.properties
3
#metacat.contextDir=/usr/local/tomcat/webapps/knb
4
metacat.contextDir=/usr/share/tomcat5.5/webapps/knb
3
metacat.contextDir=/usr/local/tomcat/webapps/knb
4
#metacat.contextDir=/usr/share/tomcat5.5/webapps/knb
test/edu/ucsb/nceas/MCTestCase.java
55 55
import edu.ucsb.nceas.metacat.client.MetacatFactory;
56 56
import edu.ucsb.nceas.metacat.client.MetacatInaccessibleException;
57 57
import edu.ucsb.nceas.metacat.service.PropertyService;
58
import edu.ucsb.nceas.metacat.service.ServiceException;
58
import edu.ucsb.nceas.metacat.shared.ServiceException;
59 59
import edu.ucsb.nceas.metacat.util.RequestUtil;
60 60
import edu.ucsb.nceas.utilities.IOUtil;
61 61
import edu.ucsb.nceas.utilities.PropertyNotFoundException;
......
381 381
	protected void setUp() throws Exception {
382 382
		try {
383 383
			if (metacatConnectionNeeded)
384
			debug("Test Metacat: " + metacatUrl);
384
			debug("setUp() - Testing Metacat Url: " + metacatUrl);
385 385
			m = MetacatFactory.createMetacatConnection(metacatUrl);
386 386
		} catch (MetacatInaccessibleException mie) {
387 387
			System.err.println("Metacat is: " + metacatUrl);
......
520 520

  
521 521
	protected String insertDocumentId(String docid, String docText, boolean result,
522 522
			boolean expectKarmaException) {
523
		debug("insertDocid(): docid=" + docid + " expectedResult=" + result
523
		debug("insertDocumentId() - docid=" + docid + " expectedResult=" + result
524 524
				+ " expectKarmaException=" + expectKarmaException);
525 525
		String response = null;
526 526
		try {
......
552 552

  
553 553
	protected String uploadDocumentId(String docid, String filePath, boolean result,
554 554
			boolean expectedKarmaException) {
555
		debug("uploadDocid(): docid=" + docid + " filePath=" + filePath
555
		debug("uploadDocumentId() - docid=" + docid + " filePath=" + filePath
556 556
				+ " expectedResult=" + result + " expectedKarmaException="
557 557
				+ expectedKarmaException);
558 558
		String response = null;
......
588 588
	 */
589 589
	protected String updateDocumentId(String docid, String docText, boolean result,
590 590
			boolean expectedKarmaFailure) {
591
		debug("updateDocid(): docid=" + docid + " expectedResult=" + result
591
		debug("updateDocumentId() - docid=" + docid + " expectedResult=" + result
592 592
				+ " expectedKarmaFailure=" + expectedKarmaFailure);
593 593
		String response = null;
594 594
		try {
595 595
			response = m.update(docid, new StringReader(testdocument), null);
596

  
596
			debug("updateDocumentId() - response=" + response);
597
			
597 598
			if (result) {
598 599
				assertTrue(response, (response.indexOf("<success>") != -1));
599 600
				assertTrue(response, response.indexOf(docid) != -1);
600 601
			} else {
601 602
				assertTrue(response, (response.indexOf("<success>") == -1));
602
			}
603
			debug("updateDocid(): response=" + response);
603
			}			
604 604
		} catch (MetacatInaccessibleException mie) {
605 605
			fail("Metacat Inaccessible:\n" + mie.getMessage());
606 606
		} catch (InsufficientKarmaException ike) {
......
624 624
	 * Delete a document into metacat. The expected result is passed as result
625 625
	 */
626 626
	protected void deleteDocumentId(String docid, boolean result, boolean expectedKarmaFailure) {
627
		debug("deleteDocid(): docid=" + docid + " expectedResult=" + result
627
		debug("deleteDocumentId() - docid=" + docid + " expectedResult=" + result
628 628
				+ " expectedKarmaFailure=" + expectedKarmaFailure);
629 629
		try {
630 630
			Thread.sleep(5000);
631 631
			String response = m.delete(docid);
632
			debug("deleteDocumentId() -  response=" + response);
633
			
632 634
			if (result) {
633 635
				assertTrue(response, response.indexOf("<success>") != -1);
634 636
			} else {
635 637
				assertTrue(response, response.indexOf("<success>") == -1);
636 638
			}
637
			debug("deleteDocid():  response=" + response);
638 639
		} catch (MetacatInaccessibleException mie) {
639 640
			fail("Metacat Inaccessible:\n" + mie.getMessage());
640 641
		} catch (InsufficientKarmaException ike) {
......
658 659
	 */
659 660
	protected void readDocumentIdWhichEqualsDoc(String docid, String testDoc, boolean result,
660 661
			boolean expectedKarmaFailure) {
661
		debug("readDocidWhichEqualsDoc(): docid=" + docid + " expectedResult=" + result
662
		debug("readDocumentIdWhichEqualsDoc() - docid=" + docid + " expectedResult=" + result
662 663
				+ " expectedKarmaFailure=" + expectedKarmaFailure);
663 664
		try {
664 665
			Reader r = m.read(docid);
665 666
			String doc = IOUtil.getAsString(r, true);
667
			debug("readDocumentIdWhichEqualsDoc() -  doc=" + doc);
668
			
666 669
			if (result) {
667 670

  
668 671
				if (!testDoc.equals(doc)) {
......
678 681
			} else {
679 682
				assertTrue(doc.indexOf("<error>") != -1);
680 683
			}
681
			debug("readDocidWhichEqualsDoc():  doc=" + doc);
682 684
		} catch (MetacatInaccessibleException mie) {
683 685
			fail("Metacat Inaccessible:\n" + mie.getMessage());
684 686
		} catch (InsufficientKarmaException ike) {
test/edu/ucsb/nceas/metacattest/AccessControlTest.java
1570 1570
	/**
1571 1571
	 * Tests Tests a version 2.1.0 EML document when permission order is
1572 1572
	 * denyFirst, the combination of allow and deny rules affect user to read,
1573
	 * update and delete a document. Here are test cases 1.An user inserts a
1574
	 * document with access rules (denyFirst) - allow READ rule for another
1575
	 * user, deny READ rule for public. Another user reads this document -
1576
	 * success Another user updates this document(except access part) -failure
1577
	 * Another user updates this document(access part) -failure Another user
1578
	 * deletes this document - failure 2. The user updates this documents with
1579
	 * access rules (denyFirst) - allow READ and WRITE rule for another user,
1580
	 * deny READ and WRITE rule for public. Another user reads this document -
1581
	 * success Another user updates this document(except access part) -success
1582
	 * Another user updates this document(access part) -failure Another user
1583
	 * deletes this document - failure 3. The user updates this documents with
1584
	 * access rules (denyFirst) - allow ALL rule for another user, deny ALL rule
1585
	 * for public. Another user reads this document - success Another user
1586
	 * updates this document(except access part) -success Another user updates
1587
	 * this document(access part) -success Another user deletes this document -
1588
	 * success 4. The user updates this documents with access rules (denyFirst) -
1573
	 * update and delete a document. Here are test cases 
1574
	 * 
1575
	 * 1. A user inserts a document with access rules (denyFirst) - allow READ 
1576
	 * rule for another user, deny READ rule for public. Another user reads this 
1577
	 * document - success. Another user updates this document(except access part) 
1578
	 * - failure. Another user updates this document(access part) -failure Another 
1579
	 * user deletes this document - failure 
1580
	 * 
1581
	 * 2. The user updates this documents with access rules (denyFirst) - allow 
1582
	 * READ and WRITE rule for another user, deny READ and WRITE rule for public. 
1583
	 * Another user reads this document - success. Another user updates this 
1584
	 * document(except access part) - success. Another user updates this 
1585
	 * document(access part) -failure. Another user deletes this document - failure.
1586
	 *  
1587
	 * 3. The user updates this documents with access rules (denyFirst) - allow 
1588
	 * ALL rule for another user, deny ALL rule for public. Another user reads 
1589
	 * this document - success. Another user updates this document(except access part)
1590
	 * - success. Another user updates this document(access part) - success. Another 
1591
	 * user deletes this document - success.
1592
	 * 
1593
	 * 4. The user updates this documents with access rules (denyFirst) -
1589 1594
	 * allow READ and WRITE rule for another user, deny WRITE rule for public.
1590
	 * Another user reads this document - success Another user updates this
1591
	 * document(except access part) -success Another user updates this
1592
	 * document(access part) -failure Another user deletes this document -
1593
	 * failure 5. The user updates this documents with access rules (denyFirst) -
1595
	 * Another user reads this document - success. Another user updates this
1596
	 * document(except access part) - success. Another user updates this
1597
	 * document(access part) -failure. Another user deletes this document -
1598
	 * failure. 
1599
	 * 
1600
	 * 5. The user updates this documents with access rules (denyFirst) -
1594 1601
	 * allow READ and WRITE rule for another user, deny READ rule for public.
1595
	 * Another user reads this document - success Another user updates this
1596
	 * document(except access part) - success Another user updates this
1597
	 * document(access part) -failure Another user deletes this document -
1598
	 * failure 6. The user updates this documents with access rules (denyFirst) -
1602
	 * Another user reads this document - success. Another user updates this
1603
	 * document(except access part) - success. Another user updates this
1604
	 * document(access part) - failure. Another user deletes this document -
1605
	 * failure.
1606
	 * 
1607
	 * 6. The user updates this documents with access rules (denyFirst) -
1599 1608
	 * allow READ rule for another user, deny READ rule for a group (which
1600
	 * another user is in the group) Another user reads this document - success
1601
	 * Another user updates this document(except access part) -failure Another
1602
	 * user updates this document(access part) -failure Another user deletes
1603
	 * this document - failure 7. The user updates this documents with access
1604
	 * rules (denyFirst) - allow READ and WRITE rule for another user, deny READ
1605
	 * and WRITE rule for a group (which another user is in the group) Another
1606
	 * user reads this document - success Another user updates this
1607
	 * document(except access part) - success Another user updates this
1608
	 * document(access part) -failure Another user deletes this document -
1609
	 * failure 8. The user updates this documents with access rules (denyFirst) -
1609
	 * another user is in the group). Another user reads this document - success.
1610
	 * Another user updates this document(except access part) - failure. Another
1611
	 * user updates this document(access part) -failure. Another user deletes
1612
	 * this document - failure.
1613
	 *  
1614
	 * 7. The user updates this documents with access rules (denyFirst) - allow 
1615
	 * READ and WRITE rule for another user, deny READ and WRITE rule for a 
1616
	 * group (which another user is in the group). Another user reads this document
1617
	 * - success. Another user updates this document(except access part) - success. 
1618
	 * Another user updates this document(access part) -failure. Another user deletes 
1619
	 * this document - failure. 
1620
	 * 
1621
	 * 8. The user updates this documents with access rules (denyFirst) -
1610 1622
	 * allow ALL rule for another user, deny ALL rule for a group (which another
1611
	 * user is in the group) Another user reads this document - success Another
1612
	 * user updates this document(except access part) - success Another user
1613
	 * updates this document(access part) - success Another user deletes this
1614
	 * document - success 9. The user updates this documents with access rules
1615
	 * (denyFirst) - allow READ and WRITE rule for another user, deny WRITE rule
1616
	 * for a group (which another user is in the group) Another user reads this
1617
	 * document - success Another user updates this document(except access part) -
1618
	 * success Another user updates this document(access part) - failure Another
1619
	 * user deletes this document - failure 10. The user updates this documents
1620
	 * with access rules (denyFirst) - allow READ and WRITE rule for another
1621
	 * user, deny READ rule for a group (which another user is in the group)
1622
	 * Another user reads this document - success Another user updates this
1623
	 * document(except access part) - success Another user updates this
1624
	 * document(access part) -failure Another user deletes this document -
1625
	 * failure
1623
	 * user is in the group). Another user reads this document - success. Another
1624
	 * user updates this document(except access part) - success. Another user
1625
	 * updates this document(access part) - success. Another user deletes this
1626
	 * document - success.
1627
	 *  
1628
	 * 9. The user updates this documents with access rules (denyFirst) - allow 
1629
	 * READ and WRITE rule for another user, deny WRITE rule for a group (which 
1630
	 * another user is in the group). Another user reads this document - success. 
1631
	 * Another user updates this document(except access part) - success. Another 
1632
	 * user updates this document(access part) - failure. Another user deletes 
1633
	 * this document - failure.
1634
	 *  
1635
	 * 10. The user updates this documents with access rules (denyFirst) - allow 
1636
	 * READ and WRITE rule for another user, deny READ rule for a group (which 
1637
	 * another user is in the group). Another user reads this document - success. 
1638
	 * Another user updates this document(except access part) - success. Another 
1639
	 * user updates this document(access part) -failure. Another user deletes 
1640
	 * this document - failure.
1626 1641
	 */
1627 1642
	public void test210DenyFirst() {
1628 1643
		debug("\nRunning: test210DenyFirst()");
......
2062 2077

  
2063 2078
	/***************************************************************************
2064 2079
	 * Test the case when no access is specified and owner is logged in No
2065
	 * online or inline data is involved -> an user inserts a document and is
2066
	 * able to read it, update it, set permissions on it and delete it ->
2067
	 * another user is not able to do anything with the document when no access
2080
	 * online or inline data is involved 
2081
	 * 
2082
     * 1) a user inserts a document and is able to read it, update it, set 
2083
     * permissions on it and delete it.
2084
     * 
2085
	 * 2) another user is not able to do anything with the document when no access
2068 2086
	 * is specified for that user -> test what all the other user can do when
2069 2087
	 * read only, write only and change permissions only permissions are
2070 2088
	 * specified
......
2072 2090
	 */
2073 2091
	public void document201Test() {
2074 2092
		try {
2075
			debug("\nRunning: document201Test()");
2093
			debug("\ndocument201Test() : Starting");
2076 2094
			String emlVersion = EML2_0_1;
2077 2095

  
2078 2096
			newdocid = generateDocumentId();
test/edu/ucsb/nceas/metacattest/SubTreeTest.java
28 28

  
29 29
import edu.ucsb.nceas.MCTestCase;
30 30
import edu.ucsb.nceas.metacat.*;
31
import edu.ucsb.nceas.metacat.database.*;
32
import edu.ucsb.nceas.metacat.replication.*;
31 33
import edu.ucsb.nceas.metacat.service.PropertyService;
32 34
import edu.ucsb.nceas.metacat.util.MetacatUtil;
33 35

  
test/edu/ucsb/nceas/metacattest/UploadIPCCDataTest.java
29 29
import edu.ucsb.nceas.metacat.*;
30 30
import edu.ucsb.nceas.metacat.client.Metacat;
31 31
import edu.ucsb.nceas.metacat.client.MetacatFactory;
32
import edu.ucsb.nceas.metacat.replication.*;
32 33
import edu.ucsb.nceas.metacat.service.PropertyService;
33 34
import edu.ucsb.nceas.metacat.util.MetacatUtil;
34 35
import edu.ucsb.nceas.utilities.IOUtil;
test/edu/ucsb/nceas/metacattest/BuildIndexTest.java
45 45
import edu.ucsb.nceas.metacat.client.MetacatInaccessibleException;
46 46
import edu.ucsb.nceas.metacat.database.DatabaseService;
47 47
import edu.ucsb.nceas.metacat.service.PropertyService;
48
import edu.ucsb.nceas.metacat.service.ServiceException;
48
import edu.ucsb.nceas.metacat.shared.ServiceException;
49 49
import edu.ucsb.nceas.metacat.util.MetacatUtil;
50 50
import edu.ucsb.nceas.utilities.IOUtil;
51 51
import edu.ucsb.nceas.utilities.PropertyNotFoundException;
test/edu/ucsb/nceas/metacattest/ReplicationServerListTest.java
28 28

  
29 29
import edu.ucsb.nceas.MCTestCase;
30 30
import edu.ucsb.nceas.metacat.*;
31
import edu.ucsb.nceas.metacat.database.*;
32
import edu.ucsb.nceas.metacat.replication.*;
31 33
import edu.ucsb.nceas.metacat.service.PropertyService;
32 34
import edu.ucsb.nceas.metacat.util.MetacatUtil;
33 35
import junit.framework.Test;
lib/workflowscheduler.properties.metadata.xml
1
<?xml version="1.0"?>
2

  
3
<metadataConfig>
4
	<group>
5
		<index>1</index>
6
		<name>Database</name>
7
		<description>Database Configuration Values.</description>
8
	</group>
9
	<group>
10
		<index>2</index>
11
		<name>Server Configuration</name>
12
		<description>Server Configuration Values.</description>
13
	</group>
14
	<group>
15
		<index>3</index>
16
		<name>Application Configuration</name>
17
		<description>Application Configuration Values.</description>
18
	</group>
19
	<group>
20
		<index>4</index>
21
		<name>Data Manager Configuration</name>
22
		<description>Data Manager Configuration Values.</description>
23
	</group>
24

  
25
	<config>
26
		<key>database.user</key>
27
		<label>Database Username</label>
28
		<group>1</group>
29
		<index>1</index>
30
		<description>
31
			Name of database user to own all tables.
32
		</description>
33
		<helpFile>properties.html#database.user</helpFile>
34
	</config>
35

  
36
	<config>
37
		<key>database.password</key>
38
		<label>Database Password</label>
39
		<group>1</group>
40
		<index>2</index>
41
		<fieldType>password</fieldType>
42
		<description>Password for database user.</description>
43
		<helpFile>properties.html#database.password</helpFile>
44
	</config>
45

  
46
	<config>
47
		<key>database.type</key>
48
		<label>Database Type</label>
49
		<group>1</group>
50
		<index>3</index>
51
		<fieldType>select</fieldType>
52
		<option>
53
			<name>PostgreSQL</name>
54
			<value>postgres</value>
55
		</option>
56
		<option>
57
			<name>Oracle</name>
58
			<value>oracle</value>
59
		</option>
60
		<!-- option>
61
			<name>SQL Server</name>
62
			<value>sqlserver</value>
63
		</option -->
64
		<description>What kind of database is running.</description>
65
		<helpFile>properties.html#database.type</helpFile>
66
	</config>
67

  
68
	<config>
69
		<key>database.driver</key>
70
		<label>Database Driver</label>
71
		<group>1</group>
72
		<index>4</index>
73
		<fieldType>select</fieldType>
74
		<option>
75
			<name>org.postgresql.Driver</name>
76
			<value>org.postgresql.Driver</value>
77
		</option>
78
		<option>
79
			<name>oracle.jdbc.driver.OracleDriver</name>
80
			<value>oracle.jdbc.driver.OracleDriver</value>
81
		</option>
82
		<!-- option>
83
			<name>com.microsoft.jdbc.sqlserver.SQLServerDriver</name>
84
			<value>com.microsoft.jdbc.sqlserver.SQLServerDriver</value>
85
		</option -->
86
		<description>
87
			Which driver is required. This should conform to your
88
			database type.
89
		</description>
90
		<helpFile>properties.html#database.driver</helpFile>
91
	</config>
92

  
93
	<config>
94
		<key>database.adapter</key>
95
		<label>Database Adapter</label>
96
		<group>1</group>
97
		<index>5</index>
98
		<fieldType>select</fieldType>
99
		<option>
100
			<name>edu.ucsb.nceas.dbadapter.PostgresqlAdapter</name>
101
			<value>edu.ucsb.nceas.dbadapter.PostgresqlAdapter</value>
102
		</option>
103
		<option>
104
			<name>edu.ucsb.nceas.dbadapter.OracleAdapter</name>
105
			<value>edu.ucsb.nceas.dbadapter.OracleAdapter</value>
106
		</option>
107
		<!-- option>
108
			<name>edu.ucsb.nceas.dbadapter.SqlserverAdapter</name>
109
			<value>edu.ucsb.nceas.dbadapter.SqlserverAdapter</value>
110
		</option -->
111
		<description>
112
			Which adapter is required. This should conform to your
113
			database type.
114
		</description>
115
		<helpFile>properties.html#database.adapter</helpFile>
116
	</config>
117

  
118
	<config>
119
		<key>database.connectionURI</key>
120
		<label>JDBC Connection String</label>
121
		<group>1</group>
122
		<index>6</index>
123
		<description>Database connection string.</description>
124
		<helpFile>properties.html#database.connectionURI</helpFile>
125
	</config>
126

  
127
	<config>
128
		<key>server.name</key>
129
		<label>Server Name</label>
130
		<group>2</group>
131
		<index>1</index>
132
		<description>
133
			Name of the server where Metacat will be available.
134
		</description>
135
		<helpFile>properties.html#server.name</helpFile>
136
	</config>
137

  
138
	<config>
139
		<key>server.httpPort</key>
140
		<label>HTTP Port</label>
141
		<group>2</group>
142
		<index>2</index>
143
		<description>
144
			Non secure port where Metacat will be available.
145
		</description>
146
		<helpFile>properties.html#server.httpPort</helpFile>
147
	</config>
148

  
149
	<config>
150
		<key>server.httpSSLPort</key>
151
		<label>HTTP SSL Port</label>
152
		<group>2</group>
153
		<index>3</index>
154
		<description>
155
			Secure port where Metacat will be available.
156
		</description>
157
		<helpFile>properties.html#server.httpSSLPort</helpFile>
158
	</config>
159
	
160
	<config>
161
		<key>application.deployDir</key>
162
		<label>Deploy Location</label>
163
		<group>2</group>
164
		<index>4</index>
165
		<description>
166
			The directory where the application is deployed.
167
		</description>
168
		<helpFile>properties.html#application.deployDir</helpFile>
169
	</config>
170
	
171
	<config>
172
		<key>auth.allowedSubmitters</key>
173
		<label>Allowed Submitters</label>
174
		<group>3</group>
175
		<index>1</index>
176
		<description>Allowed Submitters</description>
177
		<helpFile>properties.html#auth.allowedSubmitters</helpFile>
178
	</config>
179

  
180
	<config>
181
		<key>auth.deniedSubmitters</key>
182
		<label>Denied Submitters</label>
183
		<group>3</group>
184
		<index>2</index>
185
		<description>Denied Submitters</description>
186
		<helpFile>properties.html#auth.deniedSubmitters</helpFile>
187
	</config>
188

  
189
	<config>
190
		<key>application.context</key>
191
		<label>Metacat Context</label>
192
		<group>3</group>
193
		<index>3</index>
194
		<description>
195
			Name of the context under which Metacat will run. This is
196
			the directory in which the Metacat war file is deployed.
197
		</description>
198
		<helpFile>properties.html#application.context</helpFile>
199
	</config>
200

  
201
	<config>
202
		<key>application.knbSiteURL</key>
203
		<label>KNB Site URL</label>
204
		<group>3</group>
205
		<index>4</index>
206
		<description>
207
			Location of KNB website. Usually left as
208
			http://knb.ecoinformatics.org
209
		</description>
210
		<helpFile>properties.html#application.knbSiteURL</helpFile>
211
	</config>
212

  
213
	<config>
214
		<key>application.datafilepath</key>
215
		<label>Data File Path</label>
216
		<group>3</group>
217
		<index>5</index>
218
		<description>
219
			Where to store data. This should be some location outside
220
			the knb install direcories.
221
		</description>
222
		<helpFile>properties.html#application.datafilepath</helpFile>
223
	</config>
224

  
225
	<config>
226
		<key>application.inlinedatafilepath</key>
227
		<label>Inline Data File Path</label>
228
		<group>3</group>
229
		<index>6</index>
230
		<description>
231
			Where to store inline data. This should be some location
232
			outside the knb install direcories.
233
		</description>
234
		<helpFile>properties.html#application.inlinedatafilepath</helpFile>
235
	</config>
236
	
237
	<config>
238
		<key>application.documentfilepath</key>
239
		<label>Document File Path</label>
240
		<group>3</group>
241
		<index>7</index>
242
		<description>
243
			Where to store metadata documents. This should be some location
244
			outside the knb install direcories.
245
		</description>
246
		<helpFile>properties.html#application.documentfilepath</helpFile>
247
	</config>
248
	
249
	<config>
250
		<key>application.tempDir</key>
251
		<label>Temporary File Path</label>
252
		<group>3</group>
253
		<index>8</index>
254
		<description>
255
			Where to store temporary documents. This is primarily used by
256
			the data registry code. &lt;font color="red"&gt; Note: this must be 
257
			set to a directory that is dedicated solely to temporary data, 
258
			since the contents may be deleted programatically.&lt;/font&gt;
259
		</description>
260
		<helpFile>properties.html#application.tempDir</helpFile>
261
	</config>
262
	
263
	<config>
264
		<key>replication.logdir</key>
265
		<label>Replication Log Directory</label>
266
		<group>3</group>
267
		<index>9</index>
268
		<description>
269
			The directory where replication log should be located.
270
		</description>
271
		<helpFile>properties.html#replication.logdir</helpFile>
272
	</config>
273
	
274
	<!-- START Data Manager configuration -->
275
	<config>
276
		<key>datamanager.server</key>
277
		<label>Database Server</label>
278
		<group>4</group>
279
		<index>1</index>
280
		<description>
281
			Host or IP of database server
282
		</description>
283
		<helpFile>properties.html#datamanager.server</helpFile>
284
	</config>
285
	
286
	<config>
287
		<key>datamanager.database</key>
288
		<label>Database Name</label>
289
		<group>4</group>
290
		<index>2</index>
291
		<description>
292
			Name of the data manager database
293
		</description>
294
		<helpFile>properties.html#datamanager.database</helpFile>
295
	</config>
296
	
297
	<config>
298
		<key>datamanager.user</key>
299
		<label>Database Username</label>
300
		<group>4</group>
301
		<index>3</index>
302
		<description>
303
			Name of database user to own all tables.
304
		</description>
305
		<helpFile>properties.html#datamanager.user</helpFile>
306
	</config>
307

  
308
	<config>
309
		<key>datamanager.password</key>
310
		<label>Database Password</label>
311
		<group>4</group>
312
		<index>4</index>
313
		<fieldType>password</fieldType>
314
		<description>Password for database user.</description>
315
		<helpFile>properties.html#datamanager.password</helpFile>
316
	</config>
317
	<!-- END Data Manager configuration -->
318

  
319
</metadataConfig>
0 320

  
lib/workflowscheduler.web.xml
1
<!DOCTYPE web-app
2
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
3
        "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
4

  
5
<web-app>
6

  
7
	<display-name>Workflow Scheduler</display-name>
8

  
9
	<context-param>
10
		<param-name>jones</param-name>
11
		<param-value>jones@nceas.ucsb.edu</param-value>
12
		<description></description>
13
	</context-param>
14

  
15
    <context-param>
16
      <param-name>configFileName</param-name>
17
      <param-value>workflowscheduler.properties</param-value>
18
      <description>The main configuration file for application</description>
19
    </context-param>
20

  
21
	<context-param>
22
		<param-name>serviceStratagy</param-name>
23
		<!-- Meaning of the different values :
24
			
25
			PARTIAL-BUFFER
26
			- Partially buffers the first xKb to disk. Once that has buffered, the the 
27
			result is streamed to the user. This will allow for most errors to be caught
28
			early.
29
			
30
			BUFFER
31
			- stores the entire response in memory first, before sending it off to
32
			the user (may run out of memory)
33
			
34
			SPEED
35
			- outputs directly to the response (and cannot recover in the case of an
36
			error)
37
			
38
			FILE
39
			- outputs to the local filesystem first, before sending it off to the user
40
		-->
41
		<param-value>PARTIAL-BUFFER</param-value>
42
	</context-param>
43
	<context-param>
44
		<param-name>PARTIAL_BUFFER_STRATEGY_SIZE</param-name>
45
		<param-value>50</param-value>
46
	</context-param>
47

  
48
	<servlet>
49
		<servlet-name>WorkflowScheduler</servlet-name>
50
		<servlet-class>
51
			edu.ucsb.nceas.metacat.workflow.WorkflowSchedulerServlet
52
		</servlet-class>
53
		<init-param>
54
			<param-name>debug</param-name>
55
			<param-value>1</param-value>
56
		</init-param>
57
		<init-param>
58
			<param-name>listings</param-name>
59
			<param-value>true</param-value>
60
		</init-param>
61
		<load-on-startup>1</load-on-startup>
62
	</servlet>
63

  
64
	<servlet-mapping>
65
		<servlet-name>WorkflowScheduler</servlet-name>
66
		<url-pattern>/scheduler</url-pattern>
67
	</servlet-mapping>
68

  
69
	<servlet-mapping>
70
		<servlet-name>WorkflowScheduler</servlet-name>
71
		<url-pattern>/scheduler/*</url-pattern>
72
	</servlet-mapping>
73

  
74
	<servlet-mapping>
75
		<servlet-name>WorkflowScheduler</servlet-name>
76
		<url-pattern>/servlet/scheduler</url-pattern>
77
	</servlet-mapping>
78

  
79
	<session-config>
80
		<session-timeout>30000</session-timeout>
81
	</session-config>
82

  
83

  
84
	<!-- currently the W3C havent settled on a media type for WSDL;
85
		http://www.w3.org/TR/2003/WD-wsdl12-20030303/#ietf-draft
86
		for now we go with the basic 'it's XML' response -->
87
	<mime-mapping>
88
		<extension>wsdl</extension>
89
		<mime-type>text/xml</mime-type>
90
	</mime-mapping>
91

  
92
	<mime-mapping>
93
		<extension>xsd</extension>
94
		<mime-type>text/xml</mime-type>
95
	</mime-mapping>
96

  
97
	<mime-mapping>
98
		<extension>xsl</extension>
99
		<mime-type>text/xml</mime-type>
100
	</mime-mapping>
101

  
102

  
103
	<welcome-file-list>
104
		<welcome-file>index.jsp</welcome-file>
105
		<welcome-file>index.html</welcome-file>
106
	</welcome-file-list>
107

  
108

  
109
	<taglib>
110
		<taglib-uri>
111
			http://jakarta.apache.org/taglibs/xtags-1.0
112
		</taglib-uri>
113
		<taglib-location>/WEB-INF/xtags.tld</taglib-location>
114
	</taglib>
115

  
116
	<taglib>
117
		<taglib-uri>/tags/struts-bean</taglib-uri>
118
		<taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
119
	</taglib>
120

  
121
	<taglib>
122
		<taglib-uri>/tags/struts-html</taglib-uri>
123
		<taglib-location>/WEB-INF/struts-html.tld</taglib-location>
124
	</taglib>
125

  
126
	<taglib>
127
		<taglib-uri>/tags/struts-logic</taglib-uri>
128
		<taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
129
	</taglib>
130

  
131
	<taglib>
132
		<taglib-uri>/tags/struts-nested</taglib-uri>
133
		<taglib-location>/WEB-INF/struts-nested.tld</taglib-location>
134
	</taglib>
135

  
136
	<taglib>
137
		<taglib-uri>/tags/struts-tiles</taglib-uri>
138
		<taglib-location>/WEB-INF/struts-tiles.tld</taglib-location>
139
	</taglib>
140

  
141
	<!-- spring taglib -->
142
	<taglib>
143
		<taglib-uri>/tags/spring</taglib-uri>
144
		<taglib-location>/WEB-INF/tld/spring.tld</taglib-location>
145
	</taglib>
146

  
147
	<!-- 
148
		<error-page>
149
		<exception-type>java.lang.Exception</exception-type>
150
		<location>/WEB-INF/pages/errors/Exception.jsp</location>
151
		</error-page>
152
		<error-page>
153
		<exception-type>javax.servlet.ServletException</exception-type>
154
		<location>/WEB-INF/pages/errors/Exception.jsp</location>
155
		</error-page>
156
		<error-page>
157
		<exception-type>org.vfny.geoserver.global.ConfigurationException</exception-type>
158
		<location>/WEB-INF/pages/errors/Exception.jsp</location>
159
		</error-page>
160
	-->
161

  
162
	<security-constraint>
163
		<web-resource-collection>
164
			<web-resource-name>CFG</web-resource-name>
165
			<url-pattern>*.cfg</url-pattern>
166
		</web-resource-collection>
167
		<auth-constraint />
168
	</security-constraint>
169

  
170
	<security-constraint>
171
		<web-resource-collection>
172
			<web-resource-name>PROPERTIES</web-resource-name>
173
			<url-pattern>*.properties</url-pattern>
174
		</web-resource-collection>
175
		<auth-constraint />
176
	</security-constraint>
177

  
178
</web-app>
0 179

  
src/edu/ucsb/nceas/metacat/database/DBConnection.java
359 359
     }
360 360
     catch (ClassNotFoundException e)
361 361
     {
362
       logMetacat.error("Error in DBConnectionPool "+e.getMessage());
362
       logMetacat.error("DBConnectionPool.openConnection - Class not found:  " + e.getMessage());
363 363
       return null;
364 364
     }
365 365
     // Connect to the database
src/edu/ucsb/nceas/metacat/admin/PropertiesAdmin.java
35 35

  
36 36
import org.apache.log4j.Logger;
37 37

  
38
import edu.ucsb.nceas.metacat.MetaCatVersion;
38
import edu.ucsb.nceas.metacat.MetacatVersion;
39 39
import edu.ucsb.nceas.metacat.database.DBVersion;
40 40
import edu.ucsb.nceas.metacat.service.PropertyService;
41 41
import edu.ucsb.nceas.metacat.service.ServiceService;
......
53 53
 * Control the display of the main properties configuration page and the 
54 54
 * processing of the configuration values.
55 55
 */
56
public class PropertiesAdmin extends MetaCatAdmin {
56
public class PropertiesAdmin extends MetacatAdmin {
57 57

  
58 58
	private static PropertiesAdmin propertiesAdmin = null;
59 59
	private static Logger logMetacat = Logger.getLogger(PropertiesAdmin.class);
......
157 157

  
158 158
				// Forward the request to the JSP page
159 159
				RequestUtil.forwardRequest(request, response,
160
						"/admin/properties-configuration.jsp");
160
						"/admin/properties-configuration.jsp", null);
161 161

  
162 162
			} catch (GeneralPropertyException gpe) {
163 163
				throw new AdminException("Problem getting or setting property while " 
......
179 179
			Vector<String> processingErrors = new Vector<String>();
180 180
			Vector<String> processingSuccess = new Vector<String>();
181 181

  
182
			MetaCatVersion metacatVersion = null;
182
			MetacatVersion metacatVersion = null;
183 183
			
184 184
			try {
185 185
				metacatVersion = SystemUtil.getMetacatVersion();
......
273 273
					RequestUtil.clearRequestMessages(request);
274 274
					RequestUtil.setRequestFormErrors(request, validationErrors);
275 275
					RequestUtil.setRequestErrors(request, processingErrors);
276
					RequestUtil.forwardRequest(request, response, "/admin");
276
					RequestUtil.forwardRequest(request, response, "/admin", null);
277 277
				} else {
278 278
					// Now that the options have been set, change the
279 279
					// 'propertiesConfigured' option to 'true'
......
295 295
					RequestUtil.clearRequestMessages(request);
296 296
					RequestUtil.setRequestSuccess(request, processingSuccess);
297 297
					RequestUtil.forwardRequest(request, response, 
298
							"/admin?configureType=configure&processForm=false");
298
							"/admin?configureType=configure&processForm=false", null);
299 299
				}
300 300

  
301 301
			} catch (ServletException se) {
src/edu/ucsb/nceas/metacat/admin/BackupAdmin.java
48 48
/**
49 49
 * Control the display of the login page 
50 50
 */
51
public class BackupAdmin extends MetaCatAdmin {
51
public class BackupAdmin extends MetacatAdmin {
52 52

  
53 53
	private static BackupAdmin Admin = null;
54 54
	private static Logger logMetacat = Logger.getLogger(BackupAdmin.class);
......
113 113
				
114 114
				// Forward the request to the JSP page
115 115
				RequestUtil.forwardRequest(request, response,
116
						"/admin/backup-configuration.jsp");
116
						"/admin/backup-configuration.jsp", null);
117 117
			} catch (IOException ioe) {
118 118
				throw new AdminException("IO problem while initializing "
119 119
						+ "backup configuration page:" + ioe.getMessage());
......
174 174
					RequestUtil.clearRequestMessages(request);
175 175
					RequestUtil.setRequestFormErrors(request, validationErrors);
176 176
					RequestUtil.setRequestErrors(request, processingErrors);
177
					RequestUtil.forwardRequest(request, response, "/admin");
177
					RequestUtil.forwardRequest(request, response, "/admin", null);
178 178
				} else {
179 179
					// Reload the main metacat configuration page
180 180
					processingSuccess.add("Directory: " + backupDir + " configured.");
181 181
					RequestUtil.clearRequestMessages(request);
182 182
					RequestUtil.setRequestSuccess(request, processingSuccess);
183 183
					RequestUtil.forwardRequest(request, response,
184
							"/admin?configureType=configure&processForm=false");
184
							"/admin?configureType=configure&processForm=false", null);
185 185
				}
186 186
			} catch (IOException ioe) {
187 187
				throw new AdminException("IO problem while processing login page: " 
src/edu/ucsb/nceas/metacat/service/PropertyService.java
61 61
	public static final String UNCONFIGURED = "false"; 
62 62
	public static final String BYPASSED = "bypassed";
63 63
	
64
	private static final String MAIN_CONFIG_NAME = "metacat.properties";
64
	private static String MAIN_CONFIG_NAME = "";
65 65
	private static final String AUTH_CONFIG_NAME = "auth.properties";
66 66
	
67 67
	private static boolean bypassAlreadyChecked = false;
......
96 96
	private PropertyService() throws ServiceException {		
97 97
		_serviceName = "PropertyService";
98 98
		
99
		MAIN_CONFIG_NAME = ServiceService.CONFIG_FILE_NAME;
100
		
99 101
		initialize();		
100 102
	}
101 103
	
src/edu/ucsb/nceas/metacat/workflow/WorkflowScheduler.java
27 27
package edu.ucsb.nceas.metacat.workflow;
28 28

  
29 29
import java.io.IOException;
30
import java.io.PrintWriter;
30 31
import java.util.Calendar;
31 32
import java.util.Hashtable;
32 33
import java.util.HashMap;
33 34

  
34 35
import javax.servlet.http.HttpServletRequest;
35 36
import javax.servlet.http.HttpServletResponse;
36
import javax.servlet.ServletException;
37 37

  
38 38
import org.apache.log4j.Logger;
39 39

  
40
import edu.ucsb.nceas.metacat.MetaCatServlet;
41 40
import edu.ucsb.nceas.metacat.scheduler.BaseScheduler;
42 41
import edu.ucsb.nceas.metacat.scheduler.ScheduledJobAccess;
43 42
import edu.ucsb.nceas.metacat.scheduler.ScheduledJobDAO;
44
import edu.ucsb.nceas.metacat.scheduler.ScheduledJobParamDAO;
45 43
import edu.ucsb.nceas.metacat.scheduler.SchedulerService;
46 44
import edu.ucsb.nceas.metacat.scheduler.MetacatSchedulerException;
47 45
import edu.ucsb.nceas.metacat.shared.AccessException;
48 46
import edu.ucsb.nceas.metacat.shared.ServiceException;
49 47
import edu.ucsb.nceas.metacat.util.ErrorSendingErrorException;
50 48
import edu.ucsb.nceas.metacat.util.ResponseUtil;
51
import edu.ucsb.nceas.metacat.util.RequestUtil;
52 49
import edu.ucsb.nceas.utilities.DateUtil;
53 50
import edu.ucsb.nceas.utilities.UtilException;
54 51

  
......
56 53
 * @author daigle
57 54
 *
58 55
 */
59
/**
60
 * @author daigle
61
 *
62
 */
63 56
public class WorkflowScheduler extends BaseScheduler {
64 57
	
65 58
	private static WorkflowScheduler workflowScheduler = null;
......
177 170
			// Schedule the job
178 171
			String xmlResult = schedulerService.scheduleJob(jobName, startCal, endCal, intervalValue, intervalUnit,
179 172
					WORKFLOW_JOB_CLASS, WORKFLOW_JOB_GROUP, jobParams, username, groups);
180

  
181
			// if there is a forwardto param on the request, then send the user to the page
182
			// referenced in that param, otherwise, just send the xml back.
183
			String forwardtos[] = params.get("forwardto");
184
			String forwardto = null;
185
			if (forwardtos != null && forwardtos.length > 0) {
186
				forwardto = forwardtos[0];
187
			}
188 173
			
189
			if (forwardto != null) {
190
				String qformats[] = params.get("qformat");
191
				String qformat = null;
192
				if (qformats != null && qformats.length > 0) {
193
					qformat = qformats[0];
194
				}
195
				
196
				String destination = "/style/skins/" + qformat + "/" + forwardto
197
					+ "?workflowid=" + jobParams.get("workflowid") 
198
					+ "&karid=" + jobParams.get("karid");			
199
				RequestUtil.forwardRequest(request, response, destination);
200
			} else {
201
				ResponseUtil.sendSuccessXML(response, xmlResult);
202
			}
174
			ResponseUtil.sendSuccessXML(response, xmlResult);
203 175
			
204 176
		} catch (UtilException ue) {
205
			throw new MetacatSchedulerException("WorkflowScheduler.scheduleJob - Utility issue when scheduling job: " + ue.getMessage());
177
			throw new MetacatSchedulerException("WorkflowScheduler.scheduleJob - " 
178
					+ "Utility issue when scheduling job: " + ue.getMessage());
206 179
		} catch (ServiceException se) {
207
			throw new MetacatSchedulerException("WorkflowScheduler.scheduleJob - Service issue when scheduling job", se);
208
		} catch (IOException ioe) {
209
			throw new MetacatSchedulerException("WorkflowScheduler.scheduleJob - I/O issue when scheduling job: " + ioe.getMessage());
210
		} catch (ServletException se) {
211
			throw new MetacatSchedulerException("WorkflowScheduler.scheduleJob - Servlet issue when scheduling job: " + se.getMessage());
180
			throw new MetacatSchedulerException("WorkflowScheduler.scheduleJob - " 
181
					+ "Service issue when scheduling job", se);
212 182
		} catch (ErrorSendingErrorException esee) {
213
			throw new MetacatSchedulerException("WorkflowScheduler.scheduleJob - Issue sending error when scheduling job: " + esee.getMessage());			
183
			throw new MetacatSchedulerException("WorkflowScheduler.scheduleJob - " 
184
					+ "Issue sending error when scheduling job: " + esee.getMessage());			
214 185
		}
215 186
	}
216 187
	
......
244 215
			SchedulerService schedulerService = SchedulerService.getInstance();
245 216
			String xmlResult = schedulerService.unScheduleJob(jobName, username, groups);
246 217
			
247
			
248
			String forwardtos[] = params.get("forwardto");
249
			String forwardto = null;
250
			if (forwardtos != null && forwardtos.length > 0) {
251
				forwardto = forwardtos[0];
252
			}
253
			
254
			// if there is a forwardto param on the request, then send the user to the page
255
			// referenced in that param, otherwise, just send the xml back.
256
			if (forwardto != null) {
257
				String qformats[] = params.get("qformat");
258
				String qformat = null;
259
				if (qformats != null && qformats.length > 0) {
260
					qformat = qformats[0];
261
				}
262
				
263
				ScheduledJobAccess jobAccess = new ScheduledJobAccess();
264
				ScheduledJobDAO jobDAO = jobAccess.getJobByName(jobName);
265
				
266
				// we need to include the workflow id in the forward url
267
				ScheduledJobParamDAO workflowIdJobParamDAO = jobDAO.getJobParam("workflowid");
268
				if (workflowIdJobParamDAO == null) {
269
					throw new MetacatSchedulerException("WorkflowScheduler.unScheduleJob - could not find workflow " 
270
							+ "id when unscheduling job: " + jobName);
271
				}	
272
				
273
				// we need to include the workflow id in the forward url
274
				ScheduledJobParamDAO karJobParamDAO = jobDAO.getJobParam("karid");
275
				if (karJobParamDAO == null) {
276
					throw new MetacatSchedulerException("WorkflowScheduler.unScheduleJob - could not find kar " 
277
							+ "id when unscheduling job: " + jobName);
278
				}
279
				
280
				// we need to include the workflow id in the url
281
				ScheduledJobParamDAO workflowNameJobParamDAO = jobDAO.getJobParam("workflowname");
282
				if (workflowNameJobParamDAO == null) {
283
					throw new MetacatSchedulerException("WorkflowScheduler.unScheduleJob - could not find workflow " 
284
							+ "name when unscheduling job: " + jobName);
285
				}
286
				
287
				String destination = "/style/skins/" + qformat + "/" + forwardto
288
					+ "?workflowid=" + workflowIdJobParamDAO.getValue() 
289
					+ "&karid=" + karJobParamDAO.getValue()
290
					+ "&workflowname=" + workflowNameJobParamDAO.getValue();
291
				
292
				RequestUtil.forwardRequest(request, response, destination.toString());
293
			} else {
294
				ResponseUtil.sendSuccessXML(response, xmlResult);
295
			}
296 218
			ResponseUtil.sendSuccessXML(response, xmlResult);
219

  
297 220
		} catch (ServiceException se) {
298
			throw new MetacatSchedulerException(
299
					"WorkflowScheduler.unScheduleJob - Service issue unscheduling job",
300
					se);
221
			throw new MetacatSchedulerException("WorkflowScheduler.unScheduleJob - " 
222
					+ "Service issue unscheduling job", se);
301 223
		} catch (Exception e) {
302
			throw new MetacatSchedulerException(
303
					"WorkflowScheduler.unScheduleJob - Generic issue unscheduling job: "
304
							+ e.getMessage());
224
			throw new MetacatSchedulerException("WorkflowScheduler.unScheduleJob - " 
225
					+ "Generic issue unscheduling job: " + e.getMessage());
305 226
		}
306 227
	}
307 228
	
......
339 260
			SchedulerService schedulerService = SchedulerService.getInstance();
340 261
			String result = schedulerService.rescheduleJob(jobDAO, username, groups);
341 262

  
342
			// if there is a forwardto param on the request, then send the user to the page
343
			// referenced in that param, otherwise, just send the xml back.
344
			String forwardtos[] = params.get("forwardto");
345
			String forwardto = null;
346
			if (forwardtos != null && forwardtos.length > 0) {
347
				forwardto = forwardtos[0];
348
			}
263
			ResponseUtil.sendSuccessXML(response, result);
349 264
			
350
			if (forwardto != null) {
351
				String qformats[] = params.get("qformat");
352
				String qformat = null;
353
				if (qformats != null && qformats.length > 0) {
354
					qformat = qformats[0];
355
				}
356
				
357
				// we need to include the workflow id in the url
358
				ScheduledJobParamDAO workflowIdJobParamDAO = jobDAO.getAllJobParams().get("workflowid");
359
				if (workflowIdJobParamDAO == null) {
360
					throw new MetacatSchedulerException("WorkflowScheduler.reScheduleJob - could not find workflow " 
361
							+ "id when deleting job: " + jobName);
362
					
363
				}
364
				
365
				// we need to include the workflow id in the url
366
				ScheduledJobParamDAO karJobParamDAO = jobDAO.getJobParam("karid");
367
				if (karJobParamDAO == null) {
368
					throw new MetacatSchedulerException("WorkflowScheduler.reScheduleJob - could not find kar " 
369
							+ "id when deleting job: " + jobName);
370
				}
371
				
372
				// we need to include the workflow id in the url
373
				ScheduledJobParamDAO workflowNameJobParamDAO = jobDAO.getJobParam("workflowname");
374
				if (workflowNameJobParamDAO == null) {
375
					throw new MetacatSchedulerException("WorkflowScheduler.reScheduleJob - could not find workflow " 
376
							+ "name when deleting job: " + jobName);
377
				}
378
				
379
				String destination = "/style/skins/" + qformat + "/" + forwardto
380
					+ "?workflowid=" + workflowIdJobParamDAO.getValue()	
381
					+ "&karid=" + karJobParamDAO.getValue()
382
					+ "&workflowname=" + workflowNameJobParamDAO.getValue();
383
				
384
				RequestUtil.forwardRequest(request, response, destination);
385
			} else {
386
				ResponseUtil.sendSuccessXML(response, result);
387
			}
388
			
389 265
		} catch (AccessException ae) {
390
			throw new MetacatSchedulerException("WorkflowScheduler.scheduleJob - DB access issue when scheduling job  : ", ae);
266
			throw new MetacatSchedulerException("WorkflowScheduler.reScheduleJob - " 
267
					+ "DB access issue when scheduling job  : ", ae);
391 268
		} catch (ServiceException se) {
392
			throw new MetacatSchedulerException("WorkflowScheduler.scheduleJob - Service issue scheduling job", se);
393
		} catch (IOException ioe) {
394
			throw new MetacatSchedulerException("WorkflowScheduler.scheduleJob - I/O issue scheduling job: " + ioe.getMessage());
395
		} catch (ServletException se) {
396
			throw new MetacatSchedulerException("WorkflowScheduler.scheduleJob - Servlet issue scheduling job: " + se.getMessage());
269
			throw new MetacatSchedulerException("WorkflowScheduler.reScheduleJob - " 
270
					+ "Service issue scheduling job", se);
397 271
		} catch (ErrorSendingErrorException esee) {
398
			throw new MetacatSchedulerException("WorkflowScheduler.scheduleJob - Issue sending erro when scheduling job: " + esee.getMessage());			
272
			throw new MetacatSchedulerException("WorkflowScheduler.reScheduleJob - " 
273
					+ "Issue sending erro when scheduling job: " + esee.getMessage());			
399 274
		}
400 275
	}
401 276
	
......
405 280
	public void deleteJob(HttpServletRequest request, HttpServletResponse response, 
406 281
			Hashtable<String, String[]> params, String username, String[] groups) throws MetacatSchedulerException {
407 282
		 try {
408
		// workflow job id must exist
409
		String jobNames[] = params.get("workflowjobid");	
410
		if (jobNames == null || jobNames.length == 0) {
411
			throw new MetacatSchedulerException("WorkflowScheduler.deleteJob - workflowjobid field must be populated "
412
					+ "in scheduler parameters when deleting job.");
413
		}			
414
		String jobName = jobNames[0];
283
			// workflow job id must exist
284
			String jobNames[] = params.get("workflowjobid");
285
			if (jobNames == null || jobNames.length == 0) {
286
				throw new MetacatSchedulerException(
287
						"WorkflowScheduler.deleteJob - workflowname field must be populated "
288
								+ "in scheduler parameters when deleting job.");
289
			}
290
			String jobName = jobNames[0];
415 291

  
416
		ScheduledJobAccess jobAccess = new ScheduledJobAccess();
417
		ScheduledJobDAO jobDAO = jobAccess.getJobByName(jobName);
418
		
419
		// delete the job
420
		SchedulerService schedulerService = SchedulerService.getInstance();
421
		String result = schedulerService.deleteJob(jobDAO, username, groups);
422
		
423
		// if there is a forwardto param on the request, then send the user to the page
424
		// referenced in that param, otherwise, just send the xml back.
425
		String forwardtos[] = params.get("forwardto");
426
		String forwardto = null;
427
		if (forwardtos != null && forwardtos.length > 0) {
428
			forwardto = forwardtos[0];
429
		}
430
		
431
		if (forwardto != null) {
432
			String qformats[] = params.get("qformat");
433
			String qformat = null;
434
			if (qformats != null && qformats.length > 0) {
435
				qformat = qformats[0];
436
			}
437
			
438
			// we need to include the workflow id in the url
439
			ScheduledJobParamDAO workflowIdJobParamDAO = jobDAO.getAllJobParams().get("workflowid");
440
			if (workflowIdJobParamDAO == null) {
441
				throw new MetacatSchedulerException("WorkflowScheduler.deleteJob - could not find workflow " 
442
						+ "id when deleting job: " + jobName);
443
				
444
			}
445
			
446
			// we need to include the workflow id in the url
447
			ScheduledJobParamDAO karJobParamDAO = jobDAO.getJobParam("karid");
448
			if (karJobParamDAO == null) {
449
				throw new MetacatSchedulerException("WorkflowScheduler.deleteJob - could not find kar " 
450
						+ "id when deleting job: " + jobName);
451
			}
452
			
453
			// we need to include the workflow id in the url
454
			ScheduledJobParamDAO workflowNameJobParamDAO = jobDAO.getJobParam("workflowname");
455
			if (workflowNameJobParamDAO == null) {
456
				throw new MetacatSchedulerException("WorkflowScheduler.deleteJob - could not find workflow " 
457
						+ "name when deleting job: " + jobName);
458
			}
459
			
460
			String destination = "/style/skins/" + qformat + "/" + forwardto
461
				+ "?workflowid=" + workflowIdJobParamDAO.getValue()	
462
				+ "&karid=" + karJobParamDAO.getValue()
463
				+ "&workflowname=" + workflowNameJobParamDAO.getValue();
464
			
465
			RequestUtil.forwardRequest(request, response, destination);
466
		} else {
292
			ScheduledJobAccess jobAccess = new ScheduledJobAccess();
293
			ScheduledJobDAO jobDAO = jobAccess.getJobByName(jobName);
294

  
295
			// delete the job
296
			SchedulerService schedulerService = SchedulerService.getInstance();
297
			String result = schedulerService.deleteJob(jobDAO, username, groups);
298

  
467 299
			ResponseUtil.sendSuccessXML(response, result);
468
		}
469
		
300

  
470 301
		} catch (AccessException ae) {
471
				throw new MetacatSchedulerException("WorkflowScheduler.deleteJob - DB access issue when deleting job  : ", ae);
302
			throw new MetacatSchedulerException("WorkflowScheduler.deleteJob - "
303
					+ "DB access issue when deleting job  : ", ae);
472 304
		} catch (ServiceException se) {
473
			throw new MetacatSchedulerException("WorkflowScheduler.deleteJob - Service issue deleting job", se);
474
		} catch (IOException ioe) {
475
			throw new MetacatSchedulerException("WorkflowScheduler.deleteJob - I/O issue deleting job: " + ioe.getMessage());
476
		} catch (ServletException se) {
477
			throw new MetacatSchedulerException("WorkflowScheduler.deleteJob - Servlet issue deleting job: " + se.getMessage());
305
			throw new MetacatSchedulerException("WorkflowScheduler.deleteJob - "
306
					+ "Service issue deleting job", se);
478 307
		} catch (ErrorSendingErrorException esee) {
479
			throw new MetacatSchedulerException("WorkflowScheduler.deleteJob - Issue sending erro when deleting job: " + esee.getMessage());			
308
			throw new MetacatSchedulerException("WorkflowScheduler.deleteJob - "
309
					+ "Issue sending erro when deleting job: " + esee.getMessage());
480 310
		}
481 311
	}
482 312
	
......
497 327
	public void getJobs(HttpServletRequest request, HttpServletResponse response, 
498 328
			Hashtable<String, String[]> params, String username, String[] groups) throws MetacatSchedulerException {
499 329
		
500
		String workFlowId = null;
501
		String qformat = "";
330
		String workflowId = null;
502 331
		
503
		String workFlowIds[] = params.get("workflowid");
504
		if (workFlowIds != null && workFlowIds.length != 0) {
505
			workFlowId = workFlowIds[0];
332
		String workflowIds[] = params.get("workflowid");
333
		if (workflowIds != null && workflowIds.length != 0) {
334
			workflowId = workflowIds[0];
506 335
		}
507 336
		
508
        if (params.containsKey("qformat")) {
509
            qformat = params.get("qformat")[0];
510
        }
511
		
337
        PrintWriter out = null;
512 338
		try {
513 339
			// get the job info in xml format
514
			String xmlResult = SchedulerService.getInstance().getJobsInfoXML(WORKFLOW_JOB_GROUP, "workflowid", workFlowId);
515
			logMetacat.debug("WorkflowScheduler.getJobs - xmlResult: " + xmlResult);
516
			
517
			if (qformat == null || qformat.equals(MetaCatServlet.XMLFORMAT)) {
518
				ResponseUtil.send(response, xmlResult);
519
			} else {				
520
				ResponseUtil.transformAndSendXML(response, xmlResult, "-//NCEAS//scheduledWorkflowResultset//EN", 
521
					"-//W3C//HTML//EN", qformat, params);
340
			out = response.getWriter();
341
			SchedulerService.getInstance().getJobsInfoXML(WORKFLOW_JOB_GROUP,
342
					"workflowid", workflowId, out);
343
		} catch (ServiceException se) {
344
			throw new MetacatSchedulerException("WorkflowScheduler.getJobs - " 
345
					+ "Service error when transforming XML for workflow id: " 
346
					+ workflowId + " : " + se.getMessage());
347
		} catch (IOException ioe) {
348
			throw new MetacatSchedulerException("WorkflowScheduler.getJobs - " 
349
					+ "I/O error when transforming XML for workflow id: " 
350
					+ workflowId + " : " + ioe.getMessage());
351
		} finally {
352
			if (out != null) {
353
				out.close();
522 354
			}
523
		} catch (ServiceException se) {
524
			throw new MetacatSchedulerException("WorkflowScheduler.getJobs - Service issue getting jobs", se);
525
		} catch (Exception e) {
526
			throw new MetacatSchedulerException("WorkflowScheduler.getJobs - Generic issue getting jobs: " 
527
					+ e.getMessage());
528
		}		
529
	}	
355
		}
356
	}
530 357
}
src/edu/ucsb/nceas/metacat/util/SystemUtil.java
34 34

  
35 35
import org.apache.log4j.Logger;
36 36

  
37
import edu.ucsb.nceas.metacat.MetaCatVersion;
37
import edu.ucsb.nceas.metacat.MetacatVersion;
38 38
import edu.ucsb.nceas.metacat.service.PropertyService;
39 39
import edu.ucsb.nceas.metacat.service.ServiceService;
40 40
import edu.ucsb.nceas.metacat.shared.MetacatUtilException;
......
48 48

  
49 49
	private static Logger logMetacat = Logger.getLogger(SystemUtil.class);
50 50
	private static String METACAT_SERVLET = "metacat";
51
	private static String METACAT_WEB_SERVLET = "metacatweb";
51 52
	private static int OS_CLASS = 0;
52 53
	
53 54
	// Class of OS.  If we need more granularity, we should create a version
......
222 223
	public static String getServletURL() throws PropertyNotFoundException {
223 224
		return getContextURL() + "/" + METACAT_SERVLET;
224 225
	}
226
	
227
	/**
228
	 * Get the web front end servlet URL. This is made up of the server URL with 
229
	 * context + file separator + the metacat web servlet name
230
	 * 
231
	 * @return string holding the web servlet URL
232
	 */
233
	public static String getWebServletURL() throws PropertyNotFoundException {
234
		return getContextURL() + "/" + METACAT_WEB_SERVLET;
235
	}
225 236

  
226 237
	/**
227 238
	 * Get the style skins URL. This is made up of the server URL with context +
......
251 262
	 * 
252 263
	 * @return a MetaCatVersion object holding metacat version information
253 264
	 */
254
	public static MetaCatVersion getMetacatVersion() throws PropertyNotFoundException {
265
	public static MetacatVersion getMetacatVersion() throws PropertyNotFoundException {
255 266
		String metacatVersionString = 
256 267
			PropertyService.getProperty("application.metacatVersion");
257
		return new MetaCatVersion(metacatVersionString);
268
		return new MetacatVersion(metacatVersionString);
258 269
	}
259 270
	
260 271
	/**
src/edu/ucsb/nceas/metacat/util/RequestUtil.java
26 26

  
27 27
package edu.ucsb.nceas.metacat.util;
28 28

  
29
import java.io.InputStreamReader;
29 30
import java.io.IOException;
31
import java.io.BufferedReader;
32
import java.io.PrintWriter;
33
import java.io.StringReader;
34
import java.net.MalformedURLException;
35
import java.net.URL;
36
import java.net.URLConnection;
30 37
import java.util.Enumeration;
31 38
import java.util.HashMap;
32 39
import java.util.Hashtable;
......
46 53
import org.apache.log4j.Logger;
47 54

  
48 55
import edu.ucsb.nceas.metacat.service.SessionService;
56
import edu.ucsb.nceas.metacat.shared.MetacatUtilException;
49 57

  
50 58
public class RequestUtil {
51 59
	
......
69 77
	 *            the context-relative URL to which the request is forwarded
70 78
	 */
71 79
	public static void forwardRequest(HttpServletRequest request,
72
			HttpServletResponse response, String destination)
80
			HttpServletResponse response, String destinationUrl, Hashtable<String, String[]> params)
73 81
			throws IOException, ServletException {
74 82

  
75
		logMetacat.debug("Forwarding request to " + destination);
83
		destinationUrl += "?" + paramsToQuery(params);
84
		
85
		logMetacat.debug("Forwarding request to " + destinationUrl);
76 86
		ServletContext servletContext = request.getSession()
77 87
				.getServletContext();
78 88

  
79
		servletContext.getRequestDispatcher(destination).forward(request,
89
		servletContext.getRequestDispatcher(destinationUrl).forward(request,
80 90
				response);
81 91
	}
82 92

  
......
116 126
		return null;
117 127
	}
118 128
	
129
	public static String get(String urlString, Hashtable<String, String[]> params)  throws MetacatUtilException {	
130
		try {
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff