Project

General

Profile

« Previous | Next » 

Revision 4080

Added by daigle over 16 years ago

Merge 1.9 changes into Head

View differences:

lib/configure.jsp
1
<%@ page    language="java" import="java.util.Enumeration,java.util.Iterator,java.util.Set,java.util.Map,edu.ucsb.nceas.utilities.OptionsMetadata" %>
2
<% 
3
/**
4
 *  '$RCSfile$'
5
 *    Copyright: 2006 Regents of the University of California and the
6
 *               National Center for Ecological Analysis and Synthesis
7
 *  For Details: http://www.nceas.ucsb.edu/
8
 *
9
 *   '$Author$'
10
 *     '$Date$'
11
 * '$Revision$'
12
 * 
13
 * This program is free software; you can redistribute it and/or modify
14
 * it under the terms of the GNU General Public License as published by
15
 * the Free Software Foundation; either version 2 of the License, or
16
 * (at your option) any later version.
17
 *
18
 * This program is distributed in the hope that it will be useful,
19
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
 * GNU General Public License for more details.
22
 *
23
 * You should have received a copy of the GNU General Public License
24
 * along with this program; if not, write to the Free Software
25
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26
 */
27
%>
28
<html>
29
<head>
30
<title>Metacat Configuration</title>
31
<style language="Javascript">
32
body {
33
    font-family: Arial, sans-serif;
34
    font-size: 12pt;
35
    margin-left: 30px;
36
    margin-right: 30px;
37
    width: 700px;
38
}
39

  
40
.section {
41
    font-size: 16pt;
42
    font-weight: bold;
43
    border-bottom: solid #dddddd 1px;
44
}
45
label,input {
46
	display: block;
47
	width: 400px;
48
	float: left;
49
	margin-bottom: 10px;
50
}
51

  
52
label {
53
	text-align: right;
54
	width: 250px;
55
	padding-right: 20px;
56
}
57

  
58
br {
59
	clear: left;
60
}
61

  
62
input[type="submit"] {
63
    width: 50px;
64
}
65
</style>
66
</head>
67
<body>
68
<p><img src="metacat-logo.png" width="100px" align="right"/> 
69
<h2>Metacat Configuration</h2>
70
</p>
71

  
72
<p>Welcome to MetaCat!</p>
73
<p>This installation of Metacat needs to be configured before it can
74
   function properly. Please fill out the required information and you'll be
75
   up and running.
76
</p>
77
<br clear="right"/>
78

  
79
<form method="POST" action="<%= request.getContextPath() %>/metacat">
80
<% 
81
    OptionsMetadata metadata = (OptionsMetadata)request.getAttribute("metadata");
82
	if (metadata != null) {
83
        Set groups = metadata.getGroups();
84
        Iterator iter = groups.iterator();
85
   		while (iter.hasNext()) {
86
       		String groupName = (String)iter.next();
87
%>
88
			<p class="section"><%= groupName  %></p>
89
<%
90
			Map keys = metadata.getKeysInGroup(groupName);
91
			Iterator optionsList = keys.values().iterator();
92
			while (optionsList.hasNext()) {
93
    			String name = (String)optionsList.next();
94
    			if (!name.equals("configured")) {
95
%>
96
     				<label for="<%= name %>" title="<%= metadata.getOptionDescription(name) %>"><%= metadata.getOptionLabel(name) %></label>
97
	    			<input id="<%= name %>" name="<%= name %>" 
98
	           			value="<%= request.getAttribute(name) %>"
99
	           			<% if (name.equals("password")) { %>
100
	           				type="password"
101
	           			<% } else { %>
102
	           				type="text" 
103
	           			<% } %>
104
	           			alt="<%= metadata.getOptionDescription(name) %>"
105
	           			/><br/>
106
<%
107
    			}
108
			}
109
   		}
110
   	}
111
%>
112

  
113
			<input type="hidden" name="action" value="configure"/>
114
			<p><input type="submit" value="Save"/></p>
115

  
116
</form>
117

  
118
</body>
119
</html>
120 0

  
lib/configure-restart.jsp
1
<%@ page    language="java" %>
2
<% 
3
/**
4
 *  '$RCSfile$'
5
 *    Copyright: 2006 Regents of the University of California and the
6
 *               National Center for Ecological Analysis and Synthesis
7
 *  For Details: http://www.nceas.ucsb.edu/
8
 *
9
 *   '$Author$'
10
 *     '$Date$'
11
 * '$Revision$'
12
 * 
13
 * This program is free software; you can redistribute it and/or modify
14
 * it under the terms of the GNU General Public License as published by
15
 * the Free Software Foundation; either version 2 of the License, or
16
 * (at your option) any later version.
17
 *
18
 * This program is distributed in the hope that it will be useful,
19
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
 * GNU General Public License for more details.
22
 *
23
 * You should have received a copy of the GNU General Public License
24
 * along with this program; if not, write to the Free Software
25
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26
 */
27
%>
28
<html>
29
<head>
30
<title>Metacat Configuration Succeeded</title>
31
<style language="Javascript">
32
body {
33
    font-family: Arial, sans-serif;
34
    font-size: 12pt;
35
    margin-left: 30px;
36
    margin-right: 30px;
37
    width: 700px;
38
}
39
.section {
40
    font-size: 16pt;
41
    font-weight: bold;
42
    border-bottom: solid #dddddd 1px;
43
}
44
</style>
45
</head>
46
<body>
47
<p><img src="metacat-logo.png" width="100px" align="right"/> 
48
<h2>Metacat Configuration Succeeded</h2>
49
</p>
50

  
51
<p>Congratulations!</p>
52
<p>You have now successfully configured this installation of Metacat. All that
53
   remains is to configure geoserver and restart the metacat servlet for the changes to take effect.
54
</p>
55

  
56
<br clear="right"/>
57
<p class="section">Configuring Geoserver</p>
58
<p>Metacat ships with <a href="http://docs.codehaus.org/display/GEOS/Home">Geoserver</a> to handle the spatial functionality.
59
   Regardless of whether you plan on using the spatial functionality you should,
60
   for security purposes, configure geoserver initially so that it doesn't use
61
   the default password.
62
   To configure geoserver with a new admin password:
63
   <ol>
64
    <li> Point your browser to 
65
     <a href="<%= request.getScheme() + "://" +
66
       request.getServerName() + ":" + request.getServerPort() +
67
              request.getContextPath() %>/geoserver.jsp"><%= request.getScheme() + "://" +
68
	                      request.getServerName() + ":" + request.getServerPort() +
69
			                      request.getContextPath() %>/geoserver.jsp</a>. </li>
70
     <li> Login using the default username and password ( <em>admin</em> / <em>geoserver</em> ) </li>
71
    <li> Point your browser to 
72
     <a href="<%= request.getScheme() + "://" +
73
       request.getServerName() + ":" + request.getServerPort() +
74
              request.getContextPath() %>/config/loginEdit.do"><%= request.getScheme() + "://" +
75
	                      request.getServerName() + ":" + request.getServerPort() +
76
			                      request.getContextPath() %>/config/loginEdit.do</a>, enter a new user and password then submit. </li>
77
     <li> In the upper-left, click <em>Apply</em> then <em>Save</em> to save your new password.
78

  
79

  
80
    </ol>
81
</p>
82

  
83
<br clear="right"/>
84
<p class="section">Restarting Metacat</p>
85
<p>The simplest way to restart metacat is to restart the entire servlet engine.
86
   For Tomcat, this would mean calling "$TOMCAT_HOME/bin/tomcat.sh restart" or
87
   an equivalent command appropriate to your operating system. After restarting,
88
   you can access your new Metacat server at the URL:
89
   <a href="<%= request.getScheme() + "://" + 
90
       request.getServerName() + ":" + request.getServerPort() +
91
       request.getContextPath() %>"><%= request.getScheme() + "://" + 
92
                request.getServerName() + ":" + request.getServerPort() +
93
                request.getContextPath() %></a>
94
</p>
95

  
96
</body>
97
</html>
98 0

  
lib/index.jsp
1
<%@ page    language="java" %>
2
<% 
3
/**
1
<%@ page    language="java" import="edu.ucsb.nceas.metacat.util.MetaCatUtil" %>
2
<%
3
	/**
4 4
 *  '$RCSfile$'
5 5
 *    Copyright: 2000 Regents of the University of California and the
6 6
 *               National Center for Ecological Analysis and Synthesis
......
43 43
 
44 44
String qformat     = request.getParameter("qformat");
45 45
String addedParams = "";
46
String redirectURI = "";
46 47

  
47
//if qformat has not been set, set its value to "DEFAULT_STYLE"
48
if (qformat==null) {
49
  qformat = DEFAULT_STYLE;
50
  addedParams = "?qformat="+qformat;
48
if (MetaCatUtil.isMetacatConfigured()) {
49
    //if qformat has not been set, set its value to "DEFAULT_STYLE"
50
    if (qformat==null) {
51
      qformat = DEFAULT_STYLE;
52
      addedParams = "?qformat="+qformat;
53
    }
54
    redirectURI = "/style/skins/"+qformat+"/"+addedParams;
55
} else {
56
    redirectURI = "/metacat";
51 57
}
52 58

  
53
String redirectURI = "/style/skins/"+qformat+"/"+addedParams;
59

  
60

  
54 61
%>
55 62

  
56 63
<jsp:forward page="<%= redirectURI %>" />
lib/web.xml.tomcat5
154 154
      <load-on-startup>2</load-on-startup>
155 155
    </servlet>
156 156
    
157
    <servlet>
158
      <servlet-name>MetaCatAdmin</servlet-name>
159
      <servlet-class>edu.ucsb.nceas.metacat.admin.MetaCatAdminServlet</servlet-class>
160
      <init-param>
161
        <param-name>debug</param-name>
162
        <param-value>1</param-value>
163
      </init-param>
164
      <init-param>
165
        <param-name>listings</param-name>
166
        <param-value>true</param-value>
167
      </init-param>
168
      <load-on-startup>3</load-on-startup>
169
    </servlet>
170
    
157 171
     <servlet>
158 172
      <servlet-name>replication</servlet-name>
159 173
      <servlet-class>edu.ucsb.nceas.metacat.MetacatReplication</servlet-class>
......
216 230
      </init-param>
217 231
      <load-on-startup>3</load-on-startup>
218 232
    </servlet>
219
    -->    
220

  
233
    -->
234
    
221 235
<servlet>
222 236
      <servlet-name>AxisServlet</servlet-name>
223 237
      <display-name>Apache-Axis Servlet</display-name>
......
268 282
        <servlet-name>metacat</servlet-name>
269 283
        <url-pattern>/servlet/metacat</url-pattern>
270 284
    </servlet-mapping>
285

  
286
        
287
    <servlet-mapping>
288
        <servlet-name>MetaCatAdmin</servlet-name>
289
        <url-pattern>/admin</url-pattern>
290
    </servlet-mapping>
291

  
292
 <!--   
293
    <servlet-mapping>
294
        <servlet-name>MetaCatAdmin</servlet-name>
295
        <url-pattern>/admin/*</url-pattern>
296
    </servlet-mapping>
297
-->
271 298
    
272 299
    <servlet-mapping>
273 300
        <servlet-name>replication</servlet-name>
lib/admin/ldap-configuration.jsp
1
<%@ page language="java" import="java.util.Set,java.util.Map,java.util.Vector" %>
2
<%@ page language="java" import="edu.ucsb.nceas.utilities.*" %>
3
<%
4
	/**
5
 *  '$RCSfile$'
6
 *    Copyright: 2008 Regents of the University of California and the
7
 *               National Center for Ecological Analysis and Synthesis
8
 *  For Details: http://www.nceas.ucsb.edu/
9
 *
10
 *   '$Author$'
11
 *     '$Date$'
12
 * '$Revision$'
13
 * 
14
 * This program is free software; you can redistribute it and/or modify
15
 * it under the terms of the GNU General Public License as published by
16
 * the Free Software Foundation; either version 2 of the License, or
17
 * (at your option) any later version.
18
 *
19
 * This program is distributed in the hope that it will be useful,
20
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22
 * GNU General Public License for more details.
23
 *
24
 * You should have received a copy of the GNU General Public License
25
 * along with this program; if not, write to the Free Software
26
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
27
 */
28
%>
29

  
30
<%
31
	PropertiesMetaData propMetadata =
32
		(PropertiesMetaData)request.getAttribute("metadata");
33
 	Vector<String> ldapOrganizations = 
34
 		(Vector<String>)request.getAttribute("orgList"); 
35
	Map<Integer, MetaDataGroup> groupMap = 
36
		(Map<Integer, MetaDataGroup>)request.getAttribute("groupMap"); 
37
%>
38

  
39
<html>
40
<head>
41

  
42
<title>LDAP Configuration</title>
43
<link rel="stylesheet" type="text/css" 
44
        href="<%= request.getContextPath() %>/admin/admin.css"></link>
45
<script language="JavaScript" type="text/JavaScript" src="<%= request.getContextPath() %>/admin/admin.js"></script>
46
<script language="JavaScript" type="text/JavaScript" src="<%= request.getContextPath() %>/help/help.js"></script>
47

  
48
</head>
49
<body>
50
<img src="<%= request.getContextPath() %>/metacat-logo.png" width="100px" align="right"/> 
51
<h2>LDAP Configuration</h2>
52
Enter authentication service properties here. 
53
<br class="ldap-header">
54

  
55
<%@ include file="./page-message-section.jsp"%>
56

  
57

  
58
<form method="POST" name="configuration_form" action="<%= request.getContextPath() %>/admin" 
59
                                        onsubmit="return submitForm(this);">
60
<%
61
	Map<Integer, MetaDataProperty> globalPropertiesMap = propMetadata.getPropertiesInGroup(1);
62
	MetaDataGroup globalGroup = groupMap.get(new Integer(1));
63
%>
64
  <h3><%=globalGroup.getName()%></h3> 
65
  <hr class=config>
66
<%
67
 	if (globalGroup.getComment() != null) {
68
%>
69
  <div class="heading-comment"><%=globalGroup.getComment()%></div><br>
70
<%
71
	}
72
%>
73
<br>
74
<table class="config-section">
75
<%
76
	Set<Integer> globalIdSet = globalPropertiesMap.keySet();
77
	for (Integer globalId : globalIdSet) {
78
		MetaDataProperty globalProperty = globalPropertiesMap.get(globalId);
79
%>
80
	<tr>
81
		<td class="config-property-label">
82
			<label for="<%= globalProperty.getKey() %>" title="<%= globalProperty.getDescription() %>"><%=globalProperty.getLabel()%></label>
83
		</td>	
84
		<td class="config-property-input" >	
85
			<input id="<%= globalProperty.getKey() %>" name="<%= globalProperty.getKey() %>" 
86
				value="<%= request.getAttribute(globalProperty.getKey()) %>"             		    	    	           		    	             			
87
				type="text"           			
88
				alt="LDAP server URL"/>	   
89
		</td>
90
		<td class="config-question-mark">        		    
91
			<img src="style/images/question-mark.gif" onClick="helpWindow('<%= request.getContextPath() %>', '<%= globalProperty.getHelpFile() %>')"/><br/>
92
		</td>
93
	</tr>
94
<%
95
	}
96
    Map<Integer, MetaDataProperty> orgPropertyMap = propMetadata.getPropertiesInGroup(2);
97
    MetaDataGroup orgGroup = groupMap.get(new Integer(2));
98
    Set<Integer> orgIdSet = orgPropertyMap.keySet();
99
%>
100
	</table>
101
	<h3><%=orgGroup.getName()%></h3> 
102
    <hr class=config>
103
<%
104
 	if (orgGroup.getComment() != null) {
105
%>
106
  <div class="heading-comment"><%= orgGroup.getComment() %></div>
107
<%
108
 	}
109
%>
110
<br>
111
<%
112
	for (String orgName : ldapOrganizations) {
113
%>
114
<table class="config-section">
115
	<tr>
116
		<td class="config-checkbox">
117
	  		<input class="org" type="checkbox" name="<%= orgName %>.cb" onClick="toggleHiddenTable(this, 'hiding-section-<%= orgName %>')"/>
118
	  	</td>
119
	  	<td class="config-checkbox-label">	
120
			<label for="<%= orgName %>.cb"><%=orgName%></label>
121
		</td> 
122
		<td class="config-question-mark">
123
			<img src="style/images/question-mark.gif"
124
					alt="blah"
125
					title="blah"/>
126
		</td>
127
	</tr>
128
</table>
129
<table class="config-section-hiding" id="hiding-section-<%= orgName %>">  
130
<%
131
	  	for (Integer orgId : orgIdSet) {
132
	  	MetaDataProperty orgProperty = orgPropertyMap.get(orgId);
133
	  	String orgKeyName = orgProperty.getKey() + "." + orgName;
134
%>		
135
	<tr>
136
		<td class="config-property-label" >	
137
	    	<label for="<%= orgKeyName %>" title="<%= orgProperty.getDescription() %>"><%= orgProperty.getLabel() %></label>
138
     	</td>	
139
     	<td class="config-property-input" >
140
			<input name="<%= orgKeyName %>" 
141
				value="<%= request.getAttribute(orgKeyName) %>"	  
142
<% 
143
			if (orgProperty.getFieldType().equals("password")) { 
144
%>           		    	    	           		    	             			
145
	           	type="password"       
146
<%
147
	  		}
148
%>    			
149
	           alt="List of administrators for this installation in LDAP DN syntax (colon separated)"/>	           		    
150
		</td>
151
		<td class="config-question-mark">
152
			<img src="style/images/question-mark.gif" onClick="helpWindow('<%= request.getContextPath() %>', '<%= orgProperty.getHelpFile() %>')"/>
153
		</td>
154
	</tr>	  
155
<%
156
	  	}
157
%>
158
      </table>
159
<%
160
	}
161
%>
162

  
163
  <input type="hidden" name="configureType" value="ldap"/>
164
  <input type="hidden" name="processForm" value="true"/>
165
  <input class="left-button" type="submit" value="Save"/>
166
  <input class="button" type="button" value="Cancel" onClick="forward('./admin')"> 
167

  
168
</form>
169

  
170
</body>
171
</html>
0 172

  
lib/admin/admin.js
1
 /*
2
  *   '$RCSfile$'
3
  *     Purpose: Default style sheet for admin web pages 
4
  *   Copyright: 2008 Regents of the University of California and the
5
  *               National Center for Ecological Analysis and Synthesis
6
  *     Authors: Matt Jones
7
  *
8
  *    '$Author$'
9
  *      '$Date$'
10
  *  '$Revision$'
11
  *
12
  * This program is free software; you can redistribute it and/or modify
13
  * it under the terms of the GNU General Public License as published by
14
  * the Free Software Foundation; either version 2 of the License, or
15
  * (at your option) any later version.
16
  *
17
  * This program is distributed in the hope that it will be useful,
18
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
  * GNU General Public License for more details.
21
  *
22
  * You should have received a copy of the GNU General Public License
23
  * along with this program; if not, write to the Free Software
24
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
25
  */
26

  
27
function validateForm(form_ref) {
28
    j = form_ref.length
29
    for (i = 0; i < j; i++) {
30
        if (form_ref.elements[i].value == "") {
31
            alert("All form fields must be populated");
32
            return false;
33
        }
34
    }
35
    return true;
36
}
37

  
38
function submitForm(action,form_ref) {
39
	form_ref.action.value=action;
40
	form_ref.sessionId.value=<xsl:value-of select="$sessid" />;
41
	form_ref.submit();
42
}
43

  
44
function validataAndSubmitForm(action,form_ref) {
45
	form_ref.action.value=action;
46
	form_ref.sessionId.value=<xsl:value-of select="$sessid" />;
47
	validateForm(form_ref)
48
	form_ref.submit();
49
}
50

  
51
function forward(location) {
52
	window.location = location;
53
}
54

  
55
function toggleHiddenRow(thisObj, id) {
56
	if (thisObj.checked) {
57
		showRow(id);
58
	} else {
59
		hideObject(id);
60
	}
61
}
62

  
63
function toggleHiddenInline(thisObj, id) {
64
	if (thisObj.checked) {
65
		showInline(id);
66
	} else {
67
		hideObject(id);
68
	}
69
}
70

  
71
function toggleHiddenTable(thisObj, id) {
72
	if (thisObj.checked) {
73
		showSection(id);
74
	} else {
75
		hideObject(id);
76
	}
77
}
78

  
79
function hideObject(objectID) 
80
{ 
81
	document.getElementById(objectID).style.display = 'none'; 
82
} 
83

  
84
function showRow(objectID) 
85
{ 
86
	document.getElementById(objectID).style.display = 'table-row'; 
87
} 
88

  
89
function showInline(objectID)
90
{
91
        document.getElementById(objectID).style.display = 'inline';
92
}
93

  
94
function showSection(objectID) 
95
{ 
96
	document.getElementById(objectID).style.display = 'table'; 
97
} 
98

  
0 99

  
lib/admin/skins-configuration.jsp
1
<%@ page language="java" %>
2
<%@ page import="java.util.Set,java.util.HashMap,java.util.Map,java.util.SortedMap,java.util.Vector" %>
3
<%@ page import="edu.ucsb.nceas.utilities.PropertiesMetaData" %>
4
<%@ page import="edu.ucsb.nceas.utilities.MetaDataGroup,edu.ucsb.nceas.utilities.MetaDataProperty" %>
5
<% 
6
/**
7
 *  '$RCSfile$'
8
 *    Copyright: 2008 Regents of the University of California and the
9
 *               National Center for Ecological Analysis and Synthesis
10
 *  For Details: http://www.nceas.ucsb.edu/
11
 *
12
 *   '$Author$'
13
 *     '$Date$'
14
 * '$Revision$'
15
 * 
16
 * This program is free software; you can redistribute it and/or modify
17
 * it under the terms of the GNU General Public License as published by
18
 * the Free Software Foundation; either version 2 of the License, or
19
 * (at your option) any later version.
20
 *
21
 * This program is distributed in the hope that it will be useful,
22
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24
 * GNU General Public License for more details.
25
 *
26
 * You should have received a copy of the GNU General Public License
27
 * along with this program; if not, write to the Free Software
28
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
29
 */
30
%>
31

  
32
<%
33
 	Vector<String> skinNames = (Vector<String>)request.getAttribute("skinNameList"); 
34
	String defaultStyle = (String)request.getAttribute("defaultStyle");
35
%>
36

  
37
<html>
38
<head>
39

  
40
<title>Skins Configuration</title>
41
<link rel="stylesheet" type="text/css" 
42
        href="<%= request.getContextPath() %>/admin/admin.css"></link>
43
<script language="JavaScript" type="text/JavaScript" src="<%= request.getContextPath() %>/admin/admin.js"></script>
44
<script language="JavaScript" type="text/JavaScript" src="<%= request.getContextPath() %>/help/help.js"></script>
45

  
46

  
47
</head>
48
<body>
49
<img src="<%= request.getContextPath() %>/metacat-logo.png" width="100px" align="right"/> 
50
<h2>Skins Configuration</h2>
51

  
52
<br class="skins-header">
53

  
54
<%@ include file="./page-message-section.jsp"%>
55

  
56
<form method="POST" name="configuration_form" action="<%= request.getContextPath() %>/admin" 
57
                                        onsubmit="return validate_form();">
58

  
59

  
60
<h3>Skins Configuration</h3>
61
<hr class=config>
62
<div class="heading-comment">
63
	Choose and configure the skins that will be available in this instance of MetaCat
64
</div><br>
65

  
66
<%
67
	HashMap<String, HashMap<String, String>> allSkinProperties = 
68
		(HashMap<String, HashMap<String, String>>)request.getAttribute("skinProperties");
69
	HashMap<String, PropertiesMetaData> allMetaData = 
70
		(HashMap<String, PropertiesMetaData>)request.getAttribute("metadataMap");
71

  
72
	for (String skinName : skinNames) {
73
%>
74
	<table class="config-section">
75
		<tr>
76
			<td class="config-checkbox">
77
				<input type="checkbox" name="<%= skinName %>.cb" id="<%= skinName %>.cb"onClick="toggleHiddenTable(this, 'hiding-section-<%= skinName %>')"/>
78
			</td>
79
			<td class="config-checkbox-label">	
80
				<label for="<%= skinName %>.cb %>"><%= skinName %></label>
81
<%
82
		if (skinName.equals(defaultStyle)) {
83
%>		
84
				<div style="display: inline;" id="hiding-default-<%= skinName %>"> (default)<div>	
85
<%
86
		} else {
87
%>		
88
				<div style="display: none;" id="hiding-default-<%= skinName %>"> (default)<div>	
89
<%
90
		} 
91
%>
92
			</td> 
93
			<td class="config-question-mark">
94
				<img src="style/images/question-mark.gif"
95
						alt="blah"
96
						title="blah"/>
97
			</td>
98
		</tr>
99
	</table>
100
	<table class="config-section-hiding" id="hiding-section-<%= skinName %>">
101
<%
102
		HashMap<String, String> skinProperties = allSkinProperties.get(skinName);
103
		PropertiesMetaData metaData = (PropertiesMetaData)allMetaData.get(skinName);
104
		Map<Integer, MetaDataGroup> metaDataGroups = metaData.getGroups();
105
		Set<Integer> groupKeys = metaDataGroups.keySet();
106
		for (Integer groupkey : groupKeys) {
107
			SortedMap<Integer, MetaDataProperty> propertyMap = metaData.getPropertiesInGroup(groupkey);
108
			Set<Integer> propertyKeys = propertyMap.keySet();
109
%>
110
			<tr>
111
				<td class="config-property-label" >
112
					<label for="<%= skinName %>-radio"> Make <%= skinName %> default </label>
113
				</td>
114
				<td class="config-property-input" >
115
					<input type="radio" name="default-flag" id="<%= skinName %>-radio" value="<%= skinName %>" onChange="toggleHiddenInline(this, 'hiding-default-<%= skinName %>')"/>
116
				</td>
117
				<td class="config-question-mark">
118
					<img src="style/images/question-mark.gif" 
119
							alt="boffo" 
120
							title="biffo"/><br>
121
				</td>
122
			</tr>
123
<%
124
			for (Integer propertyKey : propertyKeys) {
125
%>		
126
			<tr>	
127
<%		
128
				MetaDataProperty metaDataProperty = propertyMap.get(propertyKey);							
129
				String fieldType = metaDataProperty.getFieldType(); 
130
				if (fieldType.equals("select")) {
131
%> 
132
				<td class="config-property-label">
133
					<label for="<%= metaDataProperty.getKey() %>" title="<%= metaDataProperty.getDescription() %>"><%= metaDataProperty.getLabel() %></label>  
134
				</td>
135
				<td class="config-property-input"> 			
136
					<select name="<%= metaDataProperty.getKey() %>">
137
<%
138
					Vector<String> fieldOptions = metaDataProperty.getFieldOptions();
139
					for (String optionName : fieldOptions) {
140
%>
141
						<option value="<%= optionName %>"> <%= optionName %>
142
<%
143
					}
144
%>
145
					</select>
146
				</td>
147
				<td class="config-question-mark"> 
148
					<img src="style/images/question-mark.gif" 
149
							alt="<%= metaDataProperty.getDescription() %>" 
150
							title="<%= metaDataProperty.getDescription() %>"/><br/>
151
				</td>
152

  
153
<%		
154
				} else if (fieldType.equals("password")) {
155
%>
156
				<td class="config-property-label">
157
					<label  for="<%= metaDataProperty.getKey() %>" title="<%= metaDataProperty.getDescription() %>"><%= metaDataProperty.getLabel() %></label>
158
				</td>
159
				<td class="config-property-input"> 
160
					<input id="<%= metaDataProperty.getKey() %>" name="<%= metaDataProperty.getKey() %>" 	             		    	    	           		    	             			
161
							type="<%= fieldType %>"
162
							alt="<%= metaDataProperty.getDescription() %>"/> 
163
				</td>
164
				<td class="config-question-mark"> 
165
					<img src="style/images/question-mark.gif" 
166
							alt="<%= metaDataProperty.getDescription() %>" 
167
							title="<%= metaDataProperty.getDescription() %>"/><br/>
168
				</td>
169
<%		
170
				} else {
171
%>
172
				<td class="config-property-label">
173
					<label for="<%= metaDataProperty.getKey() %>" title="<%= metaDataProperty.getDescription() %>"><%= metaDataProperty.getLabel() %></label>
174
				</td>
175
				<td class="config-property-input"> 
176
					<input id="<%= metaDataProperty.getKey() %>" name="<%= metaDataProperty.getKey() %>" 
177
							value="<%= skinProperties.get(metaDataProperty.getKey()) %>"	             		    	    	           		    	             			
178
							type="<%= fieldType %>	"           			
179
							alt="<%= metaDataProperty.getDescription() %>"/>	           		    
180
				</td>
181
				<td class="config-question-mark"> 
182
					<img src="style/images/question-mark.gif" onClick="helpWindow('ldap_url_help.html')"/><br/>
183
				</td>
184
<%   			
185
				}					
186
			}	
187
%>
188
			</tr>
189
<%
190
		}
191

  
192
%>
193

  
194
	</table>
195
<%
196
	}
197
%>
198
	<input type="hidden" name="configureType" value="skins"/>
199
	<input type="hidden" name="processForm" value="true"/>
200
	<br>
201
	<input class="left-button" type="submit" value="Save"/>
202
	<input class="button" type="button" value="Cancel" onClick="forward('./admin')"> 
203

  
204
</form>
205

  
206
</body>
207
</html>
0 208

  
lib/admin/properties-configuration.jsp
1
<%@ page language="java" import="java.util.Collection,java.util.Set,java.util.TreeSet,java.util.Map,java.util.Vector" %>
2
<%@ page language="java" import="edu.ucsb.nceas.utilities.PropertiesMetaData,edu.ucsb.nceas.utilities.MetaDataGroup,edu.ucsb.nceas.utilities.MetaDataProperty" %>
3
<% 
4
/**
5
 *  '$RCSfile$'
6
 *    Copyright: 2008 Regents of the University of California and the
7
 *               National Center for Ecological Analysis and Synthesis
8
 *  For Details: http://www.nceas.ucsb.edu/
9
 *
10
 *   '$Author$'
11
 *     '$Date$'
12
 * '$Revision$'
13
 * 
14
 * This program is free software; you can redistribute it and/or modify
15
 * it under the terms of the GNU General Public License as published by
16
 * the Free Software Foundation; either version 2 of the License, or
17
 * (at your option) any later version.
18
 *
19
 * This program is distributed in the hope that it will be useful,
20
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22
 * GNU General Public License for more details.
23
 *
24
 * You should have received a copy of the GNU General Public License
25
 * along with this program; if not, write to the Free Software
26
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
27
 */
28
%>
29

  
30
<html>
31
<head>
32

  
33
<title>Metacat Properties Configuration</title>
34
<link rel="stylesheet" type="text/css" 
35
        href="<%= request.getContextPath() %>/admin/admin.css"></link>
36
<script language="JavaScript" type="text/JavaScript" src="<%= request.getContextPath() %>/admin/admin.js"></script>
37

  
38
</head>
39
<body>
40
<img src="<%= request.getContextPath() %>/metacat-logo.png" width="100px" align="right"/> 
41
<h2>MetaCat Properties Configuration</h2>
42

  
43
<p>Enter MetaCat System properties here.  All Fields must be filled in before saving.
44
</p>
45
<br clear="right"/>
46

  
47
<%@ include file="page-message-section.jsp"%>
48

  
49
<form method="POST" name="configuration_form" action="<%= request.getContextPath() %>/admin" 
50
                                        onsubmit="return submitForm(this);">
51
<% 
52
	// metadata holds all group and properties metadata
53
    PropertiesMetaData metadata = (PropertiesMetaData)request.getAttribute("metadata");
54
	if (metadata != null) {
55
		// each group describes a section of properties
56
		Map<Integer, MetaDataGroup> groupMap = metadata.getGroups();
57
		Set<Integer> groupIdSet = groupMap.keySet();
58
		for (Integer groupId : groupIdSet) {
59
			// for this group, display the header (group name)
60
			MetaDataGroup metaDataGroup = (MetaDataGroup)groupMap.get(groupId);
61
%>
62
			<p class="section"><%= metaDataGroup.getName()  %></p>
63
			<table class="config-section">
64
<%
65
			// get all the properties in this group
66
			Map<Integer, MetaDataProperty> propertyMap = 
67
				metadata.getPropertiesInGroup(metaDataGroup.getIndex());
68
			Set<Integer> propertyIndexes = propertyMap.keySet();
69
			// iterate through each property and display appropriately
70
			for (Integer propertyIndex : propertyIndexes) {
71
				MetaDataProperty metaDataProperty = propertyMap.get(propertyIndex);
72
    			String fieldType = metaDataProperty.getFieldType(); 
73
    			if (fieldType.equals("select")) {
74
%> 
75
			<tr>
76
				<td class="config-property-label">
77
     				<label for="<%= metaDataProperty.getKey() %>" title="<%= metaDataProperty.getDescription() %>"><%= metaDataProperty.getLabel() %></label>   
78
     			</td>	
79
     			<td class="config-property-input" >		
80
					<select name="<%= metaDataProperty.getKey() %>">
81
<%
82
					Vector<String> fieldOptions = metaDataProperty.getFieldOptions();
83
					for (String optionName : fieldOptions) {
84
%>
85
					<option value="<%= optionName %>"> <%= optionName %>
86
<%
87
				}
88
%>
89
					</select>
90
				</td>
91
				<td class="config-question-mark">
92
					<img src="style/images/question-mark.gif" 
93
	           		       alt="<%= metaDataProperty.getDescription() %>" 
94
	           		       title="<%= metaDataProperty.getDescription() %>"/>
95
				</td>
96
			</tr>
97

  
98
<%		
99
				} else if (fieldType.equals("password")) {
100
%>
101
			<tr>
102
				<td class="config-property-label">
103
					<label for="<%= metaDataProperty.getKey() %>" title="<%= metaDataProperty.getDescription() %>"><%= metaDataProperty.getLabel() %></label>
104
     			</td>	
105
     			<td class="config-property-input" >	
106
					<input id="<%= metaDataProperty.getKey() %>" name="<%= metaDataProperty.getKey() %>" 	             		    	    	           		    	             			
107
	           		    	type="<%= fieldType %>"
108
	           		    	alt="<%= metaDataProperty.getDescription() %>"/> 
109
				</td>
110
				<td class="config-question-mark">
111
					<img src="style/images/question-mark.gif" 
112
	           		       alt="<%= metaDataProperty.getDescription() %>" 
113
	           		       title="<%= metaDataProperty.getDescription() %>"/>
114
				</td>
115
			</tr>
116
<%		
117
				} else {
118
%>
119
			<tr>
120
				<td class="config-property-label">
121
					<label for="<%= metaDataProperty.getKey() %>" title="<%= metaDataProperty.getDescription() %>"><%= metaDataProperty.getLabel() %></label>
122
     			</td>	
123
     			<td class="config-property-input" >							
124
					<input id="<%= metaDataProperty.getKey() %>" name="<%= metaDataProperty.getKey() %>" 
125
	    			        value="<%= request.getAttribute(metaDataProperty.getKey()) %>"	             		    	    	           		    	             			
126
	           		    	type="<%= fieldType %>	"           			
127
	           		    	alt="<%= metaDataProperty.getDescription() %>"/>	
128
	           	</td>
129
				<td class="config-question-mark">           		    
130
					<img class=question-mark src="style/images/question-mark.gif" onClick="helpWindow('ldap_url_help.html')"/>
131
				</td>
132
 
133
<%   			
134
				}
135
			}
136
%>
137

  
138
			</table>
139
<%
140
		}
141
	}
142
%>
143

  
144
			<input type="hidden" name="configureType" value="properties"/>
145
			<input type="hidden" name="processForm" value="true"/>
146
			<input class=left-button type="submit" value="Save"/>
147
			<input class=button type="button" value="Cancel" onClick="forward('./admin')"> 
148

  
149
</form>
150

  
151
</body>
152
</html>
0 153

  
lib/org.properties.metadata.xml
1
<?xml version="1.0"?>
2

  
3
<metadataConfig>
4
	<group>
5
		<index>1</index>
6
		<name>Global Values</name>
7
		<description>Database Configuration Values.</description>
8
	</group>
9
	<group>
10
		<index>2</index>
11
		<name>Organizational Level Values</name>
12
		<comment>
13
			Select the organizations for which you have admin rights, and update
14
			the configuration information if necessary.
15
		</comment>
16
		<description>Server Configuration Values.</description>
17
	</group>
18

  
19
	<config>
20
		<key>ldap.url</key>
21
		<label>LDAP URL</label>
22
		<group>1</group>
23
		<index>1</index>
24
		<description>LDAP Server URL.</description>
25
		<helpFile>properties.html#ldap.url</helpFile>
26
	</config>
27

  
28
	<config>
29
		<key>ldap.surl</key>
30
		<label>LDAP Secure URL</label>
31
		<group>1</group>
32
		<index>2</index>
33
		<description>LDAP Secure Server URL.</description>
34
		<helpFile>properties.html#ldap.surl</helpFile>
35
	</config>
36

  
37
	<config>
38
		<key>ldap.administrators</key>
39
		<label>MetaCat Administrators</label>
40
		<group>1</group>
41
		<index>3</index>
42
		<description>LDAP Administrators.</description>
43
		<helpFile>properties.html#ldap.admin</helpFile>
44
	</config>
45
	
46
	<config>
47
		<key>ldap.allowedSubmitters</key>
48
		<label>Allowed Submitters</label>
49
		<group>1</group>
50
		<index>4</index>
51
		<description>Allowed Submitters</description>
52
		<helpFile>properties.html#ldap.allowed</helpFile>
53
	</config>
54

  
55
	<config>
56
		<key>ldap.deniedSubmitters</key>
57
		<label>Denied Submitters</label>
58
		<group>1</group>
59
		<index>5</index>
60
		<description>Denied Submitters</description>
61
		<helpFile>properties.html#ldap.denied</helpFile>
62
	</config>
63
	
64
	<config>
65
		<key>ldap.org</key>
66
		<label>LDAP Organization</label>
67
		<group>2</group>
68
		<index>1</index>
69
		<description>LDAP Organization</description>
70
		<helpFile>properties.html#ldap.org</helpFile>
71
	</config>
72
	
73
	<config>
74
		<key>ldap.base</key>
75
		<label>LDAP Base</label>
76
		<group>2</group>
77
		<index>2</index>
78
		<description>LDAP Base.</description>
79
		<helpFile>properties.html#ldap.base</helpFile>
80
	</config>
81
	
82
	<config>
83
		<key>ldap.user</key>
84
		<label>LDAP User Name</label>
85
		<group>2</group>
86
		<index>3</index>
87
		<description>LDAP User Name</description>
88
		<helpFile>properties.html#ldap.user</helpFile>
89
	</config>
90

  
91
	<config>
92
		<key>ldap.password</key>
93
		<label>LDAP Password</label>
94
		<group>2</group>
95
		<fieldType>password</fieldType>
96
		<index>4</index>
97
		<description>LDAP Password</description>
98
		<helpFile>properties.html#ldap.passwd</helpFile>
99
	</config>
100

  
101
</metadataConfig>
0 102

  
lib/style/skins/sanparks/SaeonLogin.jspx
22 22
	<jsp:element name="script">
23 23
		<jsp:attribute name="language">JavaScript</jsp:attribute>
24 24
		<jsp:attribute name="src">
25
			<jsp:expression>SERVER_URL_WITH_CONTEXT + "/style/skins/sanparks/searchPathQuery.js"</jsp:expression>
25
			<jsp:expression>CONTEXT_URL + "/style/skins/sanparks/searchPathQuery.js"</jsp:expression>
26 26
		</jsp:attribute>
27 27
	</jsp:element>
28 28
	<script type="text/javascript">
......
63 63
		<jsp:attribute name="rel">stylesheet</jsp:attribute>
64 64
		<jsp:attribute name="type">text/css</jsp:attribute>
65 65
		<jsp:attribute name="href">
66
			<jsp:expression>SERVER_URL_WITH_CONTEXT + "/style/skins/sanparks/sanparks.css"</jsp:expression>
66
			<jsp:expression>CONTEXT_URL + "/style/skins/sanparks/sanparks.css"</jsp:expression>
67 67
		</jsp:attribute>
68 68
	</jsp:element>
69 69
</head>
......
338 338
				<jsp:element name="form">
339 339
					<jsp:attribute name="method">post</jsp:attribute>
340 340
					<jsp:attribute name="action">
341
						<jsp:expression>SERVER_URL_WITH_CONTEXT + "/style/skins/sanparks/upload.jsp"</jsp:expression>
341
						<jsp:expression>CONTEXT_URL + "/style/skins/sanparks/upload.jsp"</jsp:expression>
342 342
					</jsp:attribute>
343 343
					<input type="submit" value="Go >" class="button_login" />
344 344
				</jsp:element>
......
373 373
	
374 374
		<!-- map frame -->
375 375
        <script language="JavaScript">
376
            insertMap("<jsp:expression>SERVER_URL_WITH_CONTEXT</jsp:expression>");
376
            insertMap("<jsp:expression>CONTEXT_URL</jsp:expression>");
377 377
        </script>
378 378
	</td>
379 379
	
test/JDBCTest.java
24 24
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
25 25
 */
26 26

  
27

  
28

  
29 27
import java.io.*;
30 28
import java.util.Vector;
31 29
import java.lang.*;
32 30
import java.sql.*;
33 31
import edu.ucsb.nceas.metacat.*;
32
import edu.ucsb.nceas.metacat.service.PropertyService;
33
import edu.ucsb.nceas.utilities.PropertyNotFoundException;
34 34

  
35

  
36 35
/**
37 36
 * A class to test DBConnectionPool class
38 37
 */
39
 
40
public class JDBCTest
41
{
42
 
43
  /**
44
   * the main routine used to test how many sql command one connection can 
45
   * execute   
46
   * Usage: java -cp metacat.jar JDBC-diver-file  <-Driver driverName -t times>
47
   *
48
   * @param drivername, the jdbc dirver name for database
49
   * @param times, how many queries  will be run
50
   */
51
  public static void main(String [] args)
52
  {
53
    //instaniate a DBConnectionPool object
54
    //Becuase it is singleton, we should use getInstance method
55
    int loop = 10;
56
    String driverName = null;
57
    Connection conn = null;
58
    long index = (new Double (Math.random()*100000)).longValue();
59
    System.out.println("index: "+index);
60
   
61 38

  
62
    try
63
    {
64
      for ( int i=0 ; i < args.length; ++i ) 
65
      {
66
        if ( args[i].equals("-Driver"))
67
        {
68
          driverName=args[++i];
69
         
70
        }//if
71
        else if ( args[i].equals( "-t" ) ) 
72
        {
73
          loop =  Integer.parseInt(args[++i]);
74
        }//else if 
75
        else 
76
        {
77
          System.err.println
78
            ( "   args[" +i+ "] '" +args[i]+ "' ignored." );
79
        }//else
80
      }//for
81
      
82
      System.out.println("Driver name: "+driverName);
83
      //open and get one connection
84
      conn = getConnection(driverName);
85
    
86
      
87
      //use this connection excecute sql command
88
      for (int i= 0; i<loop; i++)
89
      {
90
          
91
        if (conn == null || conn.isClosed())
92
        {
93
          System.out.println("db conncetion is bad");
94
          break;
95
        }
96
        //System.out.println("metadata: "+conn.getMetaData());
97
        //System.out.println("warning: "+conn.getWarnings());
98
        insert(conn, index);
99
        select(conn);
100
        index++;
101
      }//for
102
      System.out.println("End");
103
     
104
    }//try
105
    catch (SQLException e)
106
    {
107
      System.out.println("error in sql: "+e.getMessage());
108
    }//catch
109
    catch (Exception ee)
110
    {
111
      System.out.println("error in other: "+ee.getMessage());
112
    }
113
    finally
114
    {
115
       try
116
       {
117
         conn.close();
118
       }
119
       catch (SQLException eee)
120
       {
121
         System.out.println("error in close connection: "+eee.getMessage());
122
       }
123
    }//finally
124
  }//main
125
  
39
public class JDBCTest {
126 40

  
127
  /**
128
   * Method to open a connection to database
129
   */
130
  private static Connection getConnection(String nameOfDriver) 
131
                                    throws SQLException, ClassNotFoundException
132
  {
133
    String url = null;
134
    String user = null;
135
    String password = null;
136
    url = MetaCatUtil.getOption("defaultDB");
137
    //System.out.println("url: "+url);
138
    user = MetaCatUtil.getOption("user");
139
    //System.out.println("user: "+user);
140
    password = MetaCatUtil.getOption("password");
141
    //System.out.println("password: "+password);
142
    //load Oracle dbDriver
143
    Class.forName(nameOfDriver);
144
    //System.out.println("after load dbDriver");
145
    //open and return connection
146
    return DriverManager.getConnection(url, user, password);
147
  }
148
  
149
  
150
  /**
151
   * Method to run a sal insert command
152
   * @param conn, the connection will be used
153
   * @param i, part of docid
154
   */
155
  private static void insert(Connection conn, long i) throws SQLException
156
  {
157
   
158
    int serialNumber = 0;
159
    //Connection conn = null;
160
    PreparedStatement pStmt = null;
161
    String sql = "insert into xml_documents (docid) values (?)";
162
    String docid = "jing."+i;
163
    try
164
    {
165
      
166
      pStmt = conn.prepareStatement(sql);
167
      pStmt.setString(1, docid);
168
      pStmt.execute();
169
      System.out.println("Inserted successfully: "+i);
170
     }
171
     finally
172
     {
173
       pStmt.close();
174
     }
175
    
176
  }//insert
177
    
178
 
179
  /**
180
   * Method to run a sql select commnad
181
   * @param conn, connection will be used
182
   */
183
  private static void select(Connection conn) throws SQLException
184
  {
185
   
186
    int serialNumber = 0;
187
    PreparedStatement pStmt = null;
188
    ResultSet rs = null;
189
    String sql = "select docid from xml_documents where docid like'%jing%'";
190
    
191
    try
192
    {
193
     
194
      pStmt = conn.prepareStatement(sql);
195
      pStmt.execute();
196
      rs = pStmt.getResultSet();
197
      if (rs.next())
198
      {
199
        String str = rs.getString(1);
200
        System.out.println("Select docid: "+str);
201
      }
202
    }
203
    finally
204
    {
205
      pStmt.close();
41
	/**
42
	 * the main routine used to test how many sql command one connection can 
43
	 * execute   
44
	 * Usage: java -cp metacat.jar JDBC-diver-file  <-Driver driverName -t times>
45
	 *
46
	 * @param drivername, the jdbc dirver name for database
47
	 * @param times, how many queries  will be run
48
	 */
49
	public static void main(String[] args) {
50
		//instaniate a DBConnectionPool object
51
		//Becuase it is singleton, we should use getInstance method
52
		int loop = 10;
53
		String driverName = null;
54
		Connection conn = null;
55
		long index = (new Double(Math.random() * 100000)).longValue();
56
		System.out.println("index: " + index);
206 57

  
207
    }
208
    
209
  }//select
210
  
58
		try {
59
			for (int i = 0; i < args.length; ++i) {
60
				if (args[i].equals("-Driver")) {
61
					driverName = args[++i];
62

  
63
				}//if
64
				else if (args[i].equals("-t")) {
65
					loop = Integer.parseInt(args[++i]);
66
				}//else if 
67
				else {
68
					System.err.println("   args[" + i + "] '" + args[i] + "' ignored.");
69
				}//else
70
			}//for
71

  
72
			System.out.println("Driver name: " + driverName);
73
			//open and get one connection
74
			conn = getConnection(driverName);
75

  
76
			//use this connection excecute sql command
77
			for (int i = 0; i < loop; i++) {
78

  
79
				if (conn == null || conn.isClosed()) {
80
					System.out.println("db conncetion is bad");
81
					break;
82
				}
83
				//System.out.println("metadata: "+conn.getMetaData());
84
				//System.out.println("warning: "+conn.getWarnings());
85
				insert(conn, index);
86
				select(conn);
87
				index++;
88
			}//for
89
			System.out.println("End");
90

  
91
		}//try
92
		catch (SQLException e) {
93
			System.out.println("error in sql: " + e.getMessage());
94
		}//catch
95
		catch (Exception ee) {
96
			System.out.println("error in other: " + ee.getMessage());
97
		} finally {
98
			try {
99
				conn.close();
100
			} catch (SQLException eee) {
101
				System.out.println("error in close connection: " + eee.getMessage());
102
			}
103
		}//finally
104
	}//main
105

  
106
	/**
107
	 * Method to open a connection to database
108
	 */
109
	private static Connection getConnection(String nameOfDriver) throws SQLException,
110
			ClassNotFoundException {
111
		String url = null;
112
		String user = null;
113
		String password = null;
114

  
115
		try {
116
			url = PropertyService.getProperty("database.connectionURI");
117
			//System.out.println("url: "+url);
118
			user = PropertyService.getProperty("database.user");
119
			//System.out.println("user: "+user);
120
			password = PropertyService.getProperty("database.password");
121
			//System.out.println("password: "+password);
122
		} catch (PropertyNotFoundException pnfe) {
123
			System.err.println("Could not get property in static block: "
124
					+ pnfe.getMessage());
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff