Revision 259d1bbd
Added by Niels Hoffmann over 12 years ago
.gitattributes | ||
---|---|---|
1439 | 1439 |
cdmlib-remote-webapp/ide/eclipse/cdmlib-remote[!!-~]-[!!-~]remote[!!-~]debug.launch -text |
1440 | 1440 |
cdmlib-remote-webapp/ide/eclipse/cdmserver[!!-~]-[!!-~]profile.launch -text |
1441 | 1441 |
cdmlib-remote-webapp/ide/eclipse/cdmserver[!!-~]-[!!-~]run.launch -text |
1442 |
cdmlib-remote-webapp/ide/src/main/java/eu/etaxonomy/cdm/remote/config/AbstractWebApplicationConfigurer.java -text |
|
1443 |
cdmlib-remote-webapp/ide/src/main/java/eu/etaxonomy/cdm/remote/config/DataSourceConfigurer.java -text |
|
1444 |
cdmlib-remote-webapp/ide/src/main/java/eu/etaxonomy/cdm/remote/config/LoggingConfigurer.java -text |
|
1445 |
cdmlib-remote-webapp/ide/src/main/resources/log4j.properties -text |
|
1446 |
cdmlib-remote-webapp/ide/src/main/webapp/WEB-INF/applicationContext.views.xml -text |
|
1447 |
cdmlib-remote-webapp/ide/src/main/webapp/WEB-INF/applicationContext.xml -text |
|
1448 |
cdmlib-remote-webapp/ide/src/main/webapp/WEB-INF/cdmlib-remote-servlet.xml -text |
|
1449 |
cdmlib-remote-webapp/ide/src/main/webapp/WEB-INF/cdmrest-servlet.xml -text |
|
1450 |
cdmlib-remote-webapp/ide/src/main/webapp/WEB-INF/datasources/configurable.xml -text |
|
1451 |
cdmlib-remote-webapp/ide/src/main/webapp/WEB-INF/datasources/datasources-local.xml -text |
|
1452 |
cdmlib-remote-webapp/ide/src/main/webapp/WEB-INF/datasources/empty-default-datasource.xml -text |
|
1453 |
cdmlib-remote-webapp/ide/src/main/webapp/WEB-INF/datasources/p6spy.xml -text |
|
1454 |
cdmlib-remote-webapp/ide/src/main/webapp/WEB-INF/datasources/routing-datasource.xml -text |
|
1455 |
cdmlib-remote-webapp/ide/src/main/webapp/WEB-INF/json-views.xml -text |
|
1456 |
cdmlib-remote-webapp/ide/src/main/webapp/WEB-INF/jsp/index.jsp -text |
|
1457 |
cdmlib-remote-webapp/ide/src/main/webapp/WEB-INF/oai-views.xml -text |
|
1458 |
cdmlib-remote-webapp/ide/src/main/webapp/WEB-INF/web.xml -text |
|
1459 |
cdmlib-remote-webapp/ide/src/main/webapp/WEB-INF/xml-views.xml -text |
|
1460 |
cdmlib-remote-webapp/ide/src/main/webapp/human.xsl -text |
|
1461 |
cdmlib-remote-webapp/ide/src/main/webapp/oai2.xsl -text |
|
1462 |
cdmlib-remote-webapp/ide/src/test/java/eu/etaxonomy/AppTest.java -text |
|
1463 |
cdmlib-remote-webapp/ide/src/test/resources/log4j.properties -text |
|
1464 | 1442 |
cdmlib-remote-webapp/pom.xml -text |
1443 |
cdmlib-remote-webapp/src/main/java/eu/etaxonomy/cdm/remote/config/AbstractWebApplicationConfigurer.java -text |
|
1444 |
cdmlib-remote-webapp/src/main/java/eu/etaxonomy/cdm/remote/config/DataSourceConfigurer.java -text |
|
1445 |
cdmlib-remote-webapp/src/main/java/eu/etaxonomy/cdm/remote/config/LoggingConfigurer.java -text |
|
1446 |
cdmlib-remote-webapp/src/main/resources/log4j.properties -text |
|
1447 |
cdmlib-remote-webapp/src/main/webapp/WEB-INF/applicationContext.views.xml -text |
|
1448 |
cdmlib-remote-webapp/src/main/webapp/WEB-INF/applicationContext.xml -text |
|
1449 |
cdmlib-remote-webapp/src/main/webapp/WEB-INF/cdmlib-remote-servlet.xml -text |
|
1450 |
cdmlib-remote-webapp/src/main/webapp/WEB-INF/cdmrest-servlet.xml -text |
|
1451 |
cdmlib-remote-webapp/src/main/webapp/WEB-INF/datasources/configurable.xml -text |
|
1452 |
cdmlib-remote-webapp/src/main/webapp/WEB-INF/datasources/datasources-local.xml -text |
|
1453 |
cdmlib-remote-webapp/src/main/webapp/WEB-INF/datasources/empty-default-datasource.xml -text |
|
1454 |
cdmlib-remote-webapp/src/main/webapp/WEB-INF/datasources/p6spy.xml -text |
|
1455 |
cdmlib-remote-webapp/src/main/webapp/WEB-INF/datasources/routing-datasource.xml -text |
|
1456 |
cdmlib-remote-webapp/src/main/webapp/WEB-INF/json-views.xml -text |
|
1457 |
cdmlib-remote-webapp/src/main/webapp/WEB-INF/jsp/index.jsp -text |
|
1458 |
cdmlib-remote-webapp/src/main/webapp/WEB-INF/oai-views.xml -text |
|
1459 |
cdmlib-remote-webapp/src/main/webapp/WEB-INF/web.xml -text |
|
1460 |
cdmlib-remote-webapp/src/main/webapp/WEB-INF/xml-views.xml -text |
|
1461 |
cdmlib-remote-webapp/src/main/webapp/human.xsl -text |
|
1462 |
cdmlib-remote-webapp/src/main/webapp/oai2.xsl -text |
|
1463 |
cdmlib-remote-webapp/src/test/java/eu/etaxonomy/AppTest.java -text |
|
1464 |
cdmlib-remote-webapp/src/test/resources/log4j.properties -text |
|
1465 | 1465 |
cdmlib-remote/LICENSE.TXT -text |
1466 | 1466 |
cdmlib-remote/README.TXT -text |
1467 | 1467 |
cdmlib-remote/pom.xml -text |
... | ... | |
1710 | 1710 |
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/application/ICdmApplicationLocalConfiguration.java -text |
1711 | 1711 |
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/application/ICdmApplicationRemoteConfiguration.java -text |
1712 | 1712 |
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/conversation/ConversationHolder.java -text |
1713 |
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/conversation/ConversationHolderMock.java -text |
|
1713 | 1714 |
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/conversation/IConversationEnabled.java -text |
1714 | 1715 |
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/facade/DerivedUnitFacade.java -text |
1715 | 1716 |
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/facade/DerivedUnitFacadeCacheStrategy.java -text |
cdmlib-remote-webapp/ide/src/main/java/eu/etaxonomy/cdm/remote/config/AbstractWebApplicationConfigurer.java | ||
---|---|---|
1 |
// $Id$ |
|
2 |
/** |
|
3 |
* Copyright (C) 2009 EDIT |
|
4 |
* European Distributed Institute of Taxonomy |
|
5 |
* http://www.e-taxonomy.eu |
|
6 |
* |
|
7 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
8 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
9 |
*/ |
|
10 |
package eu.etaxonomy.cdm.remote.config; |
|
11 |
|
|
12 |
import java.util.ArrayList; |
|
13 |
import java.util.List; |
|
14 |
|
|
15 |
import org.apache.log4j.Logger; |
|
16 |
import org.springframework.beans.factory.annotation.Autowired; |
|
17 |
import org.springframework.context.ApplicationContext; |
|
18 |
import org.springframework.web.context.WebApplicationContext; |
|
19 |
|
|
20 |
/** |
|
21 |
* @author a.kohlbecker |
|
22 |
* @date 20.07.2010 |
|
23 |
* |
|
24 |
*/ |
|
25 |
public abstract class AbstractWebApplicationConfigurer { |
|
26 |
|
|
27 |
private static final String ATTRIBUTE_ERROR_MESSAGES = "cdm.errorMessages"; |
|
28 |
|
|
29 |
public static final Logger logger = Logger.getLogger(AbstractWebApplicationConfigurer.class); |
|
30 |
|
|
31 |
WebApplicationContext webApplicationContext; |
|
32 |
|
|
33 |
|
|
34 |
@Autowired |
|
35 |
public void setApplicationContext(ApplicationContext applicationContext){ |
|
36 |
|
|
37 |
if(WebApplicationContext.class.isAssignableFrom(applicationContext.getClass())) { |
|
38 |
this.webApplicationContext = (WebApplicationContext)applicationContext; |
|
39 |
} else { |
|
40 |
logger.error("The " + this.getClass().getSimpleName() + " only can be used within a WebApplicationContext"); |
|
41 |
} |
|
42 |
} |
|
43 |
|
|
44 |
/** |
|
45 |
* Find a property in the ServletContext if not found search in a second |
|
46 |
* step in the environment variables of the OS |
|
47 |
* |
|
48 |
* @param property |
|
49 |
* @param required |
|
50 |
* @return |
|
51 |
*/ |
|
52 |
protected String findProperty(String property, boolean required) { |
|
53 |
// 1. look for the property in the ServletContext |
|
54 |
Object obj = webApplicationContext.getServletContext().getAttribute(property); |
|
55 |
String value = (String)obj; |
|
56 |
// 2. look for the property in environment variables of the OS |
|
57 |
if(value == null){ |
|
58 |
value = System.getProperty(property); |
|
59 |
} |
|
60 |
if(value == null && required){ |
|
61 |
logger.error("property {" + property + "} not found."); |
|
62 |
logger.error("--> This property can be set in two ways:"); |
|
63 |
logger.error("--> 1. as attribute to the ServletContext"); |
|
64 |
logger.error("--> 2. as system property e.g. -D" + property); |
|
65 |
logger.error("Stopping application ..."); |
|
66 |
System.exit(-1); |
|
67 |
} |
|
68 |
return value; |
|
69 |
} |
|
70 |
|
|
71 |
protected void addErrorMessageToServletContextAttributes(String errorMessage) { |
|
72 |
Object o = webApplicationContext.getServletContext().getAttribute(ATTRIBUTE_ERROR_MESSAGES); |
|
73 |
List<String> messages; |
|
74 |
if(o != null && o instanceof List<?>){ |
|
75 |
messages = (List<String>) o; |
|
76 |
} else { |
|
77 |
messages = new ArrayList<String>(); |
|
78 |
} |
|
79 |
messages.add(errorMessage); |
|
80 |
webApplicationContext.getServletContext().setAttribute(ATTRIBUTE_ERROR_MESSAGES, messages); |
|
81 |
} |
|
82 |
|
|
83 |
|
|
84 |
|
|
85 |
} |
cdmlib-remote-webapp/ide/src/main/java/eu/etaxonomy/cdm/remote/config/DataSourceConfigurer.java | ||
---|---|---|
1 |
// $Id$ |
|
2 |
/** |
|
3 |
* Copyright (C) 2009 EDIT |
|
4 |
* European Distributed Institute of Taxonomy |
|
5 |
* http://www.e-taxonomy.eu |
|
6 |
* |
|
7 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
8 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
9 |
*/ |
|
10 |
|
|
11 |
package eu.etaxonomy.cdm.remote.config; |
|
12 |
|
|
13 |
import java.io.File; |
|
14 |
import java.lang.reflect.InvocationTargetException; |
|
15 |
import java.lang.reflect.Method; |
|
16 |
import java.sql.Connection; |
|
17 |
import java.sql.ResultSet; |
|
18 |
import java.sql.SQLException; |
|
19 |
import java.util.Properties; |
|
20 |
|
|
21 |
import javax.naming.NamingException; |
|
22 |
import javax.sql.DataSource; |
|
23 |
|
|
24 |
import org.apache.log4j.Logger; |
|
25 |
import org.springframework.beans.factory.xml.XmlBeanFactory; |
|
26 |
import org.springframework.context.annotation.Bean; |
|
27 |
import org.springframework.context.annotation.Configuration; |
|
28 |
import org.springframework.core.io.FileSystemResource; |
|
29 |
import org.springframework.jndi.JndiObjectFactoryBean; |
|
30 |
|
|
31 |
import com.mchange.v2.c3p0.ComboPooledDataSource; |
|
32 |
|
|
33 |
import eu.etaxonomy.cdm.model.common.CdmMetaData; |
|
34 |
import eu.etaxonomy.cdm.model.common.CdmMetaData.MetaDataPropertyName; |
|
35 |
|
|
36 |
/** |
|
37 |
* The <code>DataSourceConfigurer</code> can be used as a replacement for a xml configuration in the application context. |
|
38 |
* Enter the following in your application context configuration in order to enable the <code>DataSourceConfigurer</code>: |
|
39 |
* |
|
40 |
<pre> |
|
41 |
<!-- enable processing of annotations such as @Autowired and @Configuration --> |
|
42 |
<context:annotation-config/> |
|
43 |
|
|
44 |
<bean class="eu.etaxonomy.cdm.remote.config.DataSourceConfigurer" > |
|
45 |
</bean> |
|
46 |
</pre> |
|
47 |
* The <code>DataSourceConfigurer</code> allows alternative ways to specify a data source: |
|
48 |
* |
|
49 |
* <ol> |
|
50 |
* <li>Specify the data source bean to use in the Java environment properties: |
|
51 |
* <code>-Dcdm.datasource={dataSourceName}</code> ({@link #ATTRIBUTE_DATASOURCE_NAME}). |
|
52 |
* The data source bean with the given name will then be loaded from the <code>cdm.beanDefinitionFile</code> |
|
53 |
* ({@link #CDM_BEAN_DEFINITION_FILE}), which must be a valid Spring bean definition file. |
|
54 |
* </li> |
|
55 |
* <li> |
|
56 |
* Use a JDBC data source which is bound into the JNDI context. In this case the JNDI name is specified |
|
57 |
* via the {@link #ATTRIBUTE_JDBC_JNDI_NAME} as attribute to the ServletContext. |
|
58 |
* This scenario usually being used by the cdm-server application. |
|
59 |
* </li> |
|
60 |
* </ol> |
|
61 |
* The attributes used in (1) and (2) are in a first step being searched in the ServletContext |
|
62 |
* if not found search in a second step in the environment variables of the OS, see:{@link #findProperty(String, boolean)}. |
|
63 |
* |
|
64 |
* @author a.kohlbecker |
|
65 |
* @date 04.02.2011 |
|
66 |
* |
|
67 |
*/ |
|
68 |
@Configuration |
|
69 |
public class DataSourceConfigurer extends AbstractWebApplicationConfigurer { |
|
70 |
|
|
71 |
public static final Logger logger = Logger.getLogger(DataSourceConfigurer.class); |
|
72 |
|
|
73 |
private static final String ATTRIBUTE_JDBC_JNDI_NAME = "cdm.jdbcJndiName"; |
|
74 |
private static final String ATTRIBUTE_HIBERNATE_DIALECT = "hibernate.dialect"; |
|
75 |
private static final String CDM_BEAN_DEFINITION_FILE = "cdm.beanDefinitionFile"; |
|
76 |
private static final String ATTRIBUTE_DATASOURCE_NAME = "cdm.datasource"; |
|
77 |
|
|
78 |
private static final String DATASOURCE_BEANDEF_DEFAULT = System.getProperty("user.home")+File.separator+".cdmLibrary"+File.separator+"datasources.xml"; |
|
79 |
|
|
80 |
private static String beanDefinitionFile = DATASOURCE_BEANDEF_DEFAULT; |
|
81 |
|
|
82 |
public void setBeanDefinitionFile(String filename){ |
|
83 |
beanDefinitionFile = filename; |
|
84 |
} |
|
85 |
|
|
86 |
|
|
87 |
private DataSource dataSource; |
|
88 |
|
|
89 |
private Properties getHibernateProperties() { |
|
90 |
Properties hibernateProperties = webApplicationContext.getBean("jndiHibernateProperties", Properties.class); |
|
91 |
return hibernateProperties; |
|
92 |
} |
|
93 |
|
|
94 |
|
|
95 |
|
|
96 |
@Bean |
|
97 |
public DataSource dataSource() { |
|
98 |
|
|
99 |
String beanName = findProperty(ATTRIBUTE_DATASOURCE_NAME, true); |
|
100 |
String jndiName = null; |
|
101 |
if(this.dataSource == null){ |
|
102 |
jndiName = findProperty(ATTRIBUTE_JDBC_JNDI_NAME, false); |
|
103 |
|
|
104 |
if(jndiName != null){ |
|
105 |
dataSource = useJndiDataSource(jndiName); |
|
106 |
} else { |
|
107 |
dataSource = loadDataSourceBean(beanName); |
|
108 |
} |
|
109 |
} |
|
110 |
|
|
111 |
if(dataSource == null){ |
|
112 |
return null; |
|
113 |
} |
|
114 |
|
|
115 |
// validate correct schema version |
|
116 |
try { |
|
117 |
|
|
118 |
Connection connection = dataSource.getConnection(); |
|
119 |
|
|
120 |
ResultSet resultSet = connection.createStatement().executeQuery(MetaDataPropertyName.DB_SCHEMA_VERSION.getSqlQuery()); |
|
121 |
String version = null; |
|
122 |
if(resultSet.next()){ |
|
123 |
version = resultSet.getString(1); |
|
124 |
} else { |
|
125 |
throw new RuntimeException("Unable to retrieve version info from data source " + dataSource.toString()); |
|
126 |
} |
|
127 |
|
|
128 |
connection.close(); |
|
129 |
|
|
130 |
if(!CdmMetaData.isDbSchemaVersionCompatible(version)){ |
|
131 |
/* |
|
132 |
* any exception thrown here would be nested into a spring |
|
133 |
* BeanException which can not be caught in the servlet |
|
134 |
* container, so we post the information into the |
|
135 |
* ServletContext |
|
136 |
*/ |
|
137 |
String errorMessage = "Incompatible version [" + (beanName != null ? beanName : jndiName) + "] expected version: " + CdmMetaData.getDbSchemaVersion() + ", data base version " + version; |
|
138 |
addErrorMessageToServletContextAttributes(errorMessage); |
|
139 |
} |
|
140 |
|
|
141 |
|
|
142 |
} catch (SQLException e) { |
|
143 |
RuntimeException re = new RuntimeException("Unable to connect or to retrieve version info from data source " + dataSource.toString() , e); |
|
144 |
addErrorMessageToServletContextAttributes(re.getMessage()); |
|
145 |
throw re; |
|
146 |
|
|
147 |
} |
|
148 |
return dataSource; |
|
149 |
} |
|
150 |
|
|
151 |
|
|
152 |
private DataSource useJndiDataSource(String jndiName) { |
|
153 |
logger.info("using jndi datasource '" + jndiName + "'"); |
|
154 |
|
|
155 |
JndiObjectFactoryBean jndiFactory = new JndiObjectFactoryBean(); |
|
156 |
/* |
|
157 |
JndiTemplate jndiTemplate = new JndiTemplate(); |
|
158 |
jndiFactory.setJndiTemplate(jndiTemplate); no need to use a JndiTemplate |
|
159 |
if I try using JndiTemplate I get an org.hibernate.AnnotationException: "Unknown Id.generator: system-increment" |
|
160 |
when running multiple intances via the Bootloader |
|
161 |
*/ |
|
162 |
jndiFactory.setResourceRef(true); |
|
163 |
jndiFactory.setJndiName(jndiName); |
|
164 |
try { |
|
165 |
jndiFactory.afterPropertiesSet(); |
|
166 |
} catch (IllegalArgumentException e) { |
|
167 |
logger.error(e); |
|
168 |
} catch (NamingException e) { |
|
169 |
logger.error(e); |
|
170 |
} |
|
171 |
Object obj = jndiFactory.getObject(); |
|
172 |
return (DataSource)obj; |
|
173 |
} |
|
174 |
|
|
175 |
private DataSource loadDataSourceBean(String beanName) { |
|
176 |
|
|
177 |
String beanDefinitionFileFromProperty = findProperty(CDM_BEAN_DEFINITION_FILE, false); |
|
178 |
String path = (beanDefinitionFileFromProperty != null ? beanDefinitionFileFromProperty : beanDefinitionFile); |
|
179 |
logger.info("loading DataSourceBean '" + beanName + "' from: " + path); |
|
180 |
FileSystemResource file = new FileSystemResource(path); |
|
181 |
XmlBeanFactory beanFactory = new XmlBeanFactory(file); |
|
182 |
DataSource dataSource = beanFactory.getBean(beanName, DataSource.class); |
|
183 |
if(dataSource instanceof ComboPooledDataSource){ |
|
184 |
logger.info("DataSourceBean '" + beanName + "' is a ComboPooledDataSource [URL:" + ((ComboPooledDataSource)dataSource).getJdbcUrl()+ "]"); |
|
185 |
} else { |
|
186 |
logger.error("DataSourceBean '" + beanName + "' IS NOT a ComboPooledDataSource"); |
|
187 |
} |
|
188 |
return dataSource; |
|
189 |
} |
|
190 |
|
|
191 |
@Bean |
|
192 |
public Properties hibernateProperties(){ |
|
193 |
Properties props = getHibernateProperties(); |
|
194 |
props.setProperty(ATTRIBUTE_HIBERNATE_DIALECT, inferHibernateDialectName()); |
|
195 |
return props; |
|
196 |
} |
|
197 |
|
|
198 |
public String inferHibernateDialectName() { |
|
199 |
DataSource ds = dataSource(); |
|
200 |
String url = "<SEE PRIOR REFLECTION ERROR>"; |
|
201 |
Method m = null; |
|
202 |
try { |
|
203 |
m = ds.getClass().getMethod("getUrl"); |
|
204 |
} catch (SecurityException e) { |
|
205 |
logger.error(e); |
|
206 |
} catch (NoSuchMethodException e) { |
|
207 |
try { |
|
208 |
m = ds.getClass().getMethod("getJdbcUrl"); |
|
209 |
} catch (SecurityException e2) { |
|
210 |
logger.error(e2); |
|
211 |
} catch (NoSuchMethodException e2) { |
|
212 |
logger.error(e2); |
|
213 |
} |
|
214 |
} |
|
215 |
try { |
|
216 |
url = (String)m.invoke(ds); |
|
217 |
} catch (IllegalArgumentException e) { |
|
218 |
logger.error(e); |
|
219 |
} catch (IllegalAccessException e) { |
|
220 |
logger.error(e); |
|
221 |
} catch (InvocationTargetException e) { |
|
222 |
logger.error(e); |
|
223 |
} catch (SecurityException e) { |
|
224 |
logger.error(e); |
|
225 |
} |
|
226 |
|
|
227 |
if(url != null && url.contains("mysql")){ |
|
228 |
return "org.hibernate.dialect.MySQLDialect"; |
|
229 |
} |
|
230 |
|
|
231 |
logger.error("hibernate dialect mapping for "+url+ " not jet implemented or unavailable"); |
|
232 |
return null; |
|
233 |
} |
|
234 |
|
|
235 |
} |
cdmlib-remote-webapp/ide/src/main/java/eu/etaxonomy/cdm/remote/config/LoggingConfigurer.java | ||
---|---|---|
1 |
// $Id$ |
|
2 |
/** |
|
3 |
* Copyright (C) 2009 EDIT |
|
4 |
* European Distributed Institute of Taxonomy |
|
5 |
* http://www.e-taxonomy.eu |
|
6 |
* |
|
7 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
8 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
9 |
*/ |
|
10 |
package eu.etaxonomy.cdm.remote.config; |
|
11 |
|
|
12 |
import java.io.IOException; |
|
13 |
|
|
14 |
import org.apache.log4j.Logger; |
|
15 |
import org.apache.log4j.PatternLayout; |
|
16 |
import org.apache.log4j.RollingFileAppender; |
|
17 |
import org.springframework.beans.factory.InitializingBean; |
|
18 |
import org.springframework.context.annotation.Configuration; |
|
19 |
|
|
20 |
/** |
|
21 |
* @author a.kohlbecker |
|
22 |
* @date 20.07.2010 |
|
23 |
* |
|
24 |
*/ |
|
25 |
@Configuration |
|
26 |
public class LoggingConfigurer extends AbstractWebApplicationConfigurer implements InitializingBean { |
|
27 |
|
|
28 |
/** |
|
29 |
* |
|
30 |
*/ |
|
31 |
private static final String ROLLING_FILE_APPENDER = "rollingFileAppender"; |
|
32 |
private static final String CDM_LOGFILE = "cdm.logfile"; |
|
33 |
|
|
34 |
protected void configureLogFile() { |
|
35 |
PatternLayout layout = new PatternLayout("%d %p [%c] - %m%n"); |
|
36 |
String logFile = findProperty(CDM_LOGFILE, false); |
|
37 |
if (logFile == null) { |
|
38 |
logger.info("No logfile specified, runing without."); |
|
39 |
return; |
|
40 |
} |
|
41 |
try { |
|
42 |
RollingFileAppender appender = new RollingFileAppender(layout, logFile); |
|
43 |
appender.setName(ROLLING_FILE_APPENDER); |
|
44 |
appender.setMaxBackupIndex(3); |
|
45 |
appender.setMaxFileSize("2MB"); |
|
46 |
Logger.getRootLogger().addAppender(appender); |
|
47 |
logger.info("logging to :" + logFile); |
|
48 |
} catch (IOException e) { |
|
49 |
logger.error("Creating RollingFileAppender failed:", e); |
|
50 |
} |
|
51 |
} |
|
52 |
|
|
53 |
/* (non-Javadoc) |
|
54 |
* @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet() |
|
55 |
*/ |
|
56 |
@Override |
|
57 |
public void afterPropertiesSet() throws Exception { |
|
58 |
configureLogFile(); |
|
59 |
} |
|
60 |
|
|
61 |
|
|
62 |
|
|
63 |
} |
cdmlib-remote-webapp/ide/src/main/resources/log4j.properties | ||
---|---|---|
1 |
# |
|
2 |
# |
|
3 |
# If you are having problems with logging you may debug Log4J initialization, |
|
4 |
# start the application with a system property log4j.configDebug set to "true". |
|
5 |
# E.g.: |
|
6 |
# |
|
7 |
# java -Dlog4j.configDebug=true |
|
8 |
# |
|
9 |
|
|
10 |
log4j.rootLogger=WARN, stdout |
|
11 |
|
|
12 |
|
|
13 |
log4j.appender.stdout=org.apache.log4j.ConsoleAppender |
|
14 |
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout |
|
15 |
log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - %m%n |
|
16 |
|
|
17 |
## |
|
18 |
## NOTICE !!!! |
|
19 |
## no need to configure a FileAppender here |
|
20 |
## use eu.etaxonomy.cdm.remote.config.LoggingConfigurer instead |
|
21 |
## |
|
22 |
|
|
23 |
### |
|
24 |
# cdm |
|
25 |
### |
|
26 |
log4j.logger.eu.etaxonomy.cdm = INFO |
|
27 |
# avoid vast amount of "getCitation not yet implemented" & "getProblems not yet implemented" messages |
|
28 |
log4j.logger.eu.etaxonomy.cdm.model.name.TaxonNameBase = ERROR |
|
29 |
log4j.logger.eu.etaxonomy.cdm.database.UpdatableRoutingDataSource = INFO |
|
30 |
log4j.logger.eu.etaxonomy.cdm.persistence.dao.AbstractBeanInitializer = ERROR |
|
31 |
log4j.logger.eu.etaxonomy.cdm.remote.controller = INFO |
|
32 |
log4j.logger.eu.etaxonomy.cdm.remote.controller.interceptor = WARN |
|
33 |
#log4j.logger.eu.etaxonomy.cdm.remote.json.processor.AbstractCdmBeanProcessor = DEBUG |
|
34 |
# prevent CdmExceptionResolver from logging errors |
|
35 |
log4j.logger.eu.etaxonomy.cdm.remote.exception.CdmExceptionResolver = ERROR |
|
36 |
|
|
37 |
### |
|
38 |
# springframework |
|
39 |
### |
|
40 |
log4j.logger.org.springframework = warn |
|
41 |
log4j.logger.org.springframework.web.servlet.DispatcherServlet = WARN |
|
42 |
log4j.logger.org.springframework.web.servlet.mvc.annotation = WARN |
|
43 |
#log4j.category.org.springframework.web.servlet.mvc.support=DEBUG, stdout |
|
44 |
log4j.logger.org.springframework.web.servlet.view = WARN |
|
45 |
|
|
46 |
### |
|
47 |
# json-lib |
|
48 |
### |
|
49 |
log4j.logger.net.sf.json.JSONObject = ERROR |
|
50 |
|
|
51 |
### |
|
52 |
# Hibernate |
|
53 |
### |
|
54 |
log4j.logger.org.hibernate=WARN |
|
55 |
# log just the SQL |
|
56 |
log4j.logger.org.hibernate.SQL=WARN |
|
57 |
log4j.logger.org.hibernate.search = ERROR |
|
58 |
# log JDBC bind parameters |
|
59 |
log4j.logger.org.hibernate.type=WARN |
|
60 |
# log schema export/update |
|
61 |
log4j.logger.org.hibernate.tool.hbm2ddl=WARN |
|
62 |
# This overcomes the proxy narrow log of hibernate |
|
63 |
log4j.logger.org.hibernate.engine.StatefulPersistenceContext.ProxyWarnLog=ERROR |
cdmlib-remote-webapp/ide/src/main/webapp/WEB-INF/applicationContext.views.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<beans xmlns="http://www.springframework.org/schema/beans" |
|
3 |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
4 |
xmlns:tx="http://www.springframework.org/schema/tx" |
|
5 |
xmlns:context="http://www.springframework.org/schema/context" |
|
6 |
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd |
|
7 |
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd |
|
8 |
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd |
|
9 |
"> |
|
10 |
|
|
11 |
<!-- |
|
12 |
- Accepts a configuration file. |
|
13 |
- The default configuration file is /WEB-INF/views.xml |
|
14 |
<bean name="viewResolver" class="org.springframework.web.servlet.view.XmlViewResolver"> |
|
15 |
<!- - |
|
16 |
FOR DEBUGING ONLY !!!! |
|
17 |
<property name="cache" value="false"/> |
|
18 |
- -> |
|
19 |
</bean> |
|
20 |
--> |
|
21 |
|
|
22 |
<import resource="classpath:eu/etaxonomy/cdm/remote/json/jsonConfigurations.xml"/> |
|
23 |
|
|
24 |
<!-- |
|
25 |
A TaxonNodeComparator with substitutionRules to allow correct sorted |
|
26 |
taxon nodes e.g. in a taxonomic tree browser |
|
27 |
--> |
|
28 |
<bean name="taxonNodeByNameComparator" class="eu.etaxonomy.cdm.model.taxon.TaxonNodeByNameComparator"> |
|
29 |
<property name="substitutionRules"> |
|
30 |
<map> |
|
31 |
<entry key=".*?( sp\.| ssp\.| spp\.| n\.|Nomina dubia|Incertae sedis|Nomina excludenda).*" value="_" /> |
|
32 |
</map> |
|
33 |
</property> |
|
34 |
</bean> |
|
35 |
|
|
36 |
</beans> |
cdmlib-remote-webapp/ide/src/main/webapp/WEB-INF/applicationContext.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<beans xmlns="http://www.springframework.org/schema/beans" |
|
3 |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
4 |
xmlns:tx="http://www.springframework.org/schema/tx" |
|
5 |
xmlns:context="http://www.springframework.org/schema/context" |
|
6 |
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd |
|
7 |
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd |
|
8 |
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd |
|
9 |
"> |
|
10 |
|
|
11 |
<!-- include default application context and customization --> |
|
12 |
<import resource="classpath:/eu/etaxonomy/cdm/defaultApplicationContext.xml"/> |
|
13 |
<bean id="persistentTermInitializer" class="eu.etaxonomy.cdm.database.PersistentTermInitializer"> |
|
14 |
<property name="omit" value="false" /> |
|
15 |
</bean> |
|
16 |
<context:component-scan base-package="eu/etaxonomy/cdm/ext" /> |
|
17 |
|
|
18 |
<import resource="classpath:/eu/etaxonomy/cdm/remote.xml"/> |
|
19 |
|
|
20 |
<context:component-scan base-package="eu/etaxonomy/cdm/io"> |
|
21 |
<context:exclude-filter type="regex" expression="eu\.etaxonomy\.cdm\.io\.pesi.*" /> |
|
22 |
<context:exclude-filter type="regex" expression="eu\.etaxonomy\.cdm\.io\.faunaEuropaea.*" /> |
|
23 |
<context:exclude-filter type="regex" expression="eu\.etaxonomy\.cdm\.io\.erms.*" /> |
|
24 |
<context:exclude-filter type="regex" expression="eu\.etaxonomy\.cdm\.io\.eflora.*" /> |
|
25 |
<context:exclude-filter type="regex" expression="eu\.etaxonomy\.cdm\.io\.berlinModel.*" /> |
|
26 |
</context:component-scan> |
|
27 |
|
|
28 |
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> |
|
29 |
<property name="properties"> |
|
30 |
<props> |
|
31 |
<prop key="eu.etaxonomy.cdm.base.path">${user.home}/.cdmLibrary/</prop> |
|
32 |
<prop key="eu.etaxonomy.cdm.search.index.path">${user.home}/.cdmLibrary/index/</prop> |
|
33 |
</props> |
|
34 |
</property> |
|
35 |
</bean> |
|
36 |
|
|
37 |
<!-- enable the configuration of transactional behavior based on annotations --> |
|
38 |
<tx:annotation-driven transaction-manager="transactionManager"/> |
|
39 |
|
|
40 |
<!-- import additional beans into the root context --> |
|
41 |
<import resource="applicationContext.views.xml"/> |
|
42 |
|
|
43 |
<!-- CONFIGURE WEB APPLICATION HERE --> |
|
44 |
<import resource="datasources/configurable.xml" /> |
|
45 |
|
|
46 |
<context:annotation-config/> |
|
47 |
<bean class="eu.etaxonomy.cdm.remote.config.LoggingConfigurer"> |
|
48 |
</bean> |
|
49 |
|
|
50 |
<!-- OAI-PMH TODO externalize? --> |
|
51 |
<bean name="taxonOaiPmhController" class="eu.etaxonomy.cdm.remote.controller.oaipmh.TaxonOaiPmhController"> |
|
52 |
<property name="cachingModel" ref="taxonOaiPmhCacheMapping"/> |
|
53 |
</bean> |
|
54 |
|
|
55 |
<bean name="taxonOaiPmhCacheMapping" class="org.springmodules.cache.provider.ehcache.EhCacheCachingModel"> |
|
56 |
<property name="cacheName" value="eu.etaxonomy.cdm.remote.controller.TaxonOaiPmhController.resumptionToken"/> |
|
57 |
</bean> |
|
58 |
<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean"> |
|
59 |
<property name="configLocation" value="classpath:/eu/etaxonomy/cdm/remote/ehcache.xml" /> |
|
60 |
<property name="shared" value="true"/> |
|
61 |
</bean> |
|
62 |
|
|
63 |
<bean id="serializableFactory" class="org.springmodules.cache.serializable.XStreamSerializableFactory"/> |
|
64 |
|
|
65 |
<bean id="cacheProviderFacade" class="org.springmodules.cache.provider.ehcache.EhCacheFacade"> |
|
66 |
<property name="cacheManager" ref="cacheManager" /> |
|
67 |
<property name="serializableFactory" ref="serializableFactory"/> |
|
68 |
</bean> |
|
69 |
|
|
70 |
</beans> |
cdmlib-remote-webapp/ide/src/main/webapp/WEB-INF/cdmlib-remote-servlet.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<beans xmlns="http://www.springframework.org/schema/beans" |
|
3 |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" |
|
4 |
xmlns:tx="http://www.springframework.org/schema/tx" |
|
5 |
xsi:schemaLocation="http://www.springframework.org/schema/beans |
|
6 |
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd |
|
7 |
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd |
|
8 |
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd |
|
9 |
"> |
|
10 |
<context:component-scan base-package="eu/etaxonomy/cdm/remote" /> |
|
11 |
|
|
12 |
|
|
13 |
<!-- |
|
14 |
======= HandlerMappings ======= |
|
15 |
--> |
|
16 |
<!-- |
|
17 |
first we try to find the controller using the simpleurlmapping, then |
|
18 |
the classname this follows the principal of "convention over |
|
19 |
configuration" |
|
20 |
--> |
|
21 |
<bean |
|
22 |
class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping"> |
|
23 |
<property name="order" value="1" /> |
|
24 |
<property name="interceptors"> |
|
25 |
<list> |
|
26 |
<!--<ref bean="contentNegociationHandlerInterceptor" /> --> |
|
27 |
<ref bean="localeContextHandlerInterceptor" /> |
|
28 |
</list> |
|
29 |
</property> |
|
30 |
<property name="pathMatcher"> |
|
31 |
<!-- must match the pathMatcher as set in AnnotationMethodHandlerAdapter --> |
|
32 |
<bean class="eu.etaxonomy.cdm.remote.controller.util.CdmAntPathMatcher" /> |
|
33 |
</property> |
|
34 |
</bean> |
|
35 |
|
|
36 |
<!-- |
|
37 |
<bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping"> |
|
38 |
<property name="order" value="0" /> |
|
39 |
<property name="mappings"> |
|
40 |
<props> |
|
41 |
<prop key="/index.do">urlFilenameViewController |
|
42 |
</prop> |
|
43 |
<prop key="/">welcomeFileViewController |
|
44 |
</prop> |
|
45 |
</props> |
|
46 |
</property> |
|
47 |
</bean> |
|
48 |
--> |
|
49 |
|
|
50 |
<!-- |
|
51 |
======= HandlerAdapters ======= |
|
52 |
--> |
|
53 |
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"> |
|
54 |
<property name="pathMatcher"> |
|
55 |
<!-- must match the pathMatcher as set in DefaultAnnotationHandlerMapping --> |
|
56 |
<bean class="eu.etaxonomy.cdm.remote.controller.util.CdmAntPathMatcher" /> |
|
57 |
</property> |
|
58 |
</bean> |
|
59 |
|
|
60 |
<!-- |
|
61 |
======= Remoting ======= |
|
62 |
--> |
|
63 |
<import resource="classpath:/eu/etaxonomy/cdm/httpinvokerServices.xml"/> |
|
64 |
|
|
65 |
<bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping"> |
|
66 |
<property name="order" value="0" /> |
|
67 |
<property name="mappings"> |
|
68 |
|
|
69 |
<!-- Needed for spring remoting with the http invoker --> |
|
70 |
<!-- The configuration of the services is imported from httpinvokerServices.xml --> |
|
71 |
<props> |
|
72 |
<prop key="/remoting/agent.service">httpAgentService</prop> |
|
73 |
<prop key="/remoting/annotation.service">httpAnnotationService</prop> |
|
74 |
<prop key="/remoting/auditevent.service">httpAuditEventService</prop> |
|
75 |
<prop key="/remoting/classification.service">httpClassificationService</prop> |
|
76 |
<prop key="/remoting/collection.service">httpCollectionService</prop> |
|
77 |
<prop key="/remoting/common.service">httpCommonService</prop> |
|
78 |
<prop key="/remoting/description.service">httpDescriptionService</prop> |
|
79 |
<prop key="/remoting/featurenode.service">httpFeatureNodeService</prop> |
|
80 |
<prop key="/remoting/featuretree.service">httpFeatureTreeService</prop> |
|
81 |
<prop key="/remoting/group.service">httpGroupService</prop> |
|
82 |
<prop key="/remoting/identificationkey.service">httpIdentificationKeyService</prop> |
|
83 |
<prop key="/remoting/location.service">httpLocationService</prop> |
|
84 |
<prop key="/remoting/marker.service">httpMarkerService</prop> |
|
85 |
<prop key="/remoting/media.service">httpMediaService</prop> |
|
86 |
<prop key="/remoting/name.service">httpNameService</prop> |
|
87 |
<prop key="/remoting/occurrence.service">httpOccurrenceService</prop> |
|
88 |
<prop key="/remoting/polytomouskeynode.service">httpPolytomousKeyNodeService</prop> |
|
89 |
<prop key="/remoting/polytomouskey.service">httpPolytomousKeyService</prop> |
|
90 |
<prop key="/remoting/reference.service">httpReferenceService</prop> |
|
91 |
<prop key="/remoting/service.service">httpServiceService</prop> |
|
92 |
<prop key="/remoting/taxonnode.service">httpTaxonNodeService</prop> |
|
93 |
<prop key="/remoting/taxon.service">httpTaxonService</prop> |
|
94 |
<prop key="/remoting/term.service">httpTermService</prop> |
|
95 |
<prop key="/remoting/user.service">httpUserService</prop> |
|
96 |
<prop key="/remoting/vocabulary.service">httpVocabularyService</prop> |
|
97 |
<prop key="/remoting/authenticationManager.service">httpAuthenticationManager</prop> |
|
98 |
</props> |
|
99 |
</property> |
|
100 |
</bean> |
|
101 |
|
|
102 |
<!-- needed when using SimpleUrlHandlerMapping --> |
|
103 |
<bean |
|
104 |
class="org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter" /> |
|
105 |
|
|
106 |
<!-- needed for HTTPInvoker --> |
|
107 |
<bean class="org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter" /> |
|
108 |
|
|
109 |
<!-- |
|
110 |
======= HandlerInterceptors ======= |
|
111 |
--> |
|
112 |
<!-- |
|
113 |
<bean id="datasourceContextHandlerInterceptor" |
|
114 |
class="eu.etaxonomy.cdm.remote.controller.interceptor.DatasourceContextHandlerInterceptor" /> --> |
|
115 |
<bean id="localeContextHandlerInterceptor" |
|
116 |
class="eu.etaxonomy.cdm.remote.controller.interceptor.LocaleContextHandlerInterceptor" /> |
|
117 |
<!-- |
|
118 |
=== no longer needed, replaced by ContentNegotiatingViewResolver == |
|
119 |
<bean id="contentNegociationHandlerInterceptor" |
|
120 |
class="eu.etaxonomy.cdm.remote.controller.interceptor.ContentNegociationHandlerInterceptor"> |
|
121 |
<property name="mapping"> |
|
122 |
<map> |
|
123 |
<entry key="text/json" value="json" /> |
|
124 |
<entry key="application/json" value="json" /> |
|
125 |
<entry key="application/xml" value="xml" /> |
|
126 |
</map> |
|
127 |
</property> |
|
128 |
<property name="defaultExtension" value="xml" /> |
|
129 |
</bean> |
|
130 |
--> |
|
131 |
|
|
132 |
<!-- |
|
133 |
======= ViewControllers ======= |
|
134 |
--> |
|
135 |
<bean id="urlFilenameViewController" class="org.springframework.web.servlet.mvc.UrlFilenameViewController"> |
|
136 |
</bean> |
|
137 |
<!-- |
|
138 |
The welcome-file-list in the web.xml will is ignored since the |
|
139 |
cdmserver servlet is mapped to the root path [/] So the welcome file |
|
140 |
list is being replaced by a SimpleUrlHandlerMapping on the root path |
|
141 |
[/] which is mapped via this ViewController to the [index] view |
|
142 |
<bean id="welcomeFileViewController" |
|
143 |
class="org.springframework.web.servlet.mvc.UrlFilenameViewController"> |
|
144 |
<property name="suffix"> |
|
145 |
<value>index</value> |
|
146 |
</property> |
|
147 |
</bean> |
|
148 |
--> |
|
149 |
|
|
150 |
|
|
151 |
<!-- |
|
152 |
======= ViewResolver ======= |
|
153 |
--> |
|
154 |
<bean id="oaiViewResolver" class="org.springframework.web.servlet.view.XmlViewResolver"> |
|
155 |
<property name="order" value="0"/> |
|
156 |
<property name="location" value="/WEB-INF/oai-views.xml"/> |
|
157 |
<!-- FOR DEBUGING ONLY !!!! |
|
158 |
<property name="cache" value="false"/> |
|
159 |
--> |
|
160 |
</bean> |
|
161 |
|
|
162 |
|
|
163 |
<bean id="contentNegotiatingViewResolver" class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver"> |
|
164 |
<property name="order" value="1" /> |
|
165 |
<property name="mediaTypes"> |
|
166 |
<map> |
|
167 |
<entry key="xml" value="application/xml" /> |
|
168 |
<entry key="dc" value="application/xml" /> |
|
169 |
<entry key="rdf" value="application/xml" /> |
|
170 |
<entry key="json" value="application/json" /> |
|
171 |
<entry key="json" value="application/json" /> |
|
172 |
</map> |
|
173 |
</property> |
|
174 |
<property name="viewResolvers"> |
|
175 |
<list> |
|
176 |
<bean id="xmlTypeViewResolver" class="eu.etaxonomy.cdm.remote.view.PatternViewResolver"> |
|
177 |
<property name="location" value="/WEB-INF/xml-views.xml"/> |
|
178 |
<!-- |
|
179 |
turn caching off FOR DEBUGING ONLY !!!! |
|
180 |
<property name="cache" value="false"/> |
|
181 |
--> |
|
182 |
</bean> |
|
183 |
<bean id="jsonTypeViewResolver" class="eu.etaxonomy.cdm.remote.view.PatternViewResolver"> |
|
184 |
<property name="location" value="/WEB-INF/json-views.xml"/> |
|
185 |
<!-- |
|
186 |
turn caching off FOR DEBUGING ONLY !!!! |
|
187 |
<property name="cache" value="false"/> |
|
188 |
--> |
|
189 |
</bean> |
|
190 |
</list> |
|
191 |
</property> |
|
192 |
</bean> |
|
193 |
|
|
194 |
<!-- |
|
195 |
=== the viewResolverJsp is currently unused === |
|
196 |
<bean id="viewResolverJsp" |
|
197 |
class="org.springframework.web.servlet.view.InternalResourceViewResolver"> |
|
198 |
<property name="order" value="1" /> |
|
199 |
<property name="prefix" value="/WEB-INF/jsp/" /> |
|
200 |
<property name="suffix" value=".jsp" /> |
|
201 |
<property name="viewNames"> |
|
202 |
<!- - |
|
203 |
view names (or name patterns) that can be handled |
|
204 |
- -> |
|
205 |
<list> |
|
206 |
<value>index</value> |
|
207 |
</list> |
|
208 |
</property> |
|
209 |
</bean> |
|
210 |
--> |
|
211 |
|
|
212 |
<!-- |
|
213 |
======= Exception Handling ======= |
|
214 |
--> |
|
215 |
<bean id="exceptionResolver" class="eu.etaxonomy.cdm.remote.exception.CdmExceptionResolver"> |
|
216 |
</bean> |
|
217 |
|
|
218 |
<!-- |
|
219 |
======= Security ======= |
|
220 |
--> |
|
221 |
<!-- <bean id="basicProcessingFilter" class="org.springframework.security.ui.basicauth.BasicProcessingFilter">--> |
|
222 |
<!-- <property name="authenticationManager"><ref bean="authenticationManager"/></property>--> |
|
223 |
<!-- <property name="authenticationEntryPoint"><ref bean="authenticationEntryPoint"/></property>--> |
|
224 |
<!-- </bean>--> |
|
225 |
<!-- <bean id="authenticationEntryPoint" class="org.springframework.security.ui.basicauth.BasicProcessingFilterEntryPoint">--> |
|
226 |
<!-- <property name="realmName"><value>Name Of Your Realm</value></property>--> |
|
227 |
<!-- </bean>--> |
|
228 |
|
|
229 |
</beans> |
cdmlib-remote-webapp/ide/src/main/webapp/WEB-INF/cdmrest-servlet.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<beans xmlns="http://www.springframework.org/schema/beans" |
|
3 |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" |
|
4 |
xmlns:tx="http://www.springframework.org/schema/tx" |
|
5 |
xsi:schemaLocation="http://www.springframework.org/schema/beans |
|
6 |
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd |
|
7 |
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd |
|
8 |
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd |
|
9 |
"> |
|
10 |
<context:component-scan base-package="eu/etaxonomy/cdm/remote" /> |
|
11 |
|
|
12 |
|
|
13 |
<!-- |
|
14 |
======= HandlerMappings ======= |
|
15 |
--> |
|
16 |
<!-- |
|
17 |
first we try to find the controller using the simpleurlmapping, then |
|
18 |
the classname this follows the principal of "convention over |
|
19 |
configuration" |
|
20 |
--> |
|
21 |
<bean |
|
22 |
class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping"> |
|
23 |
<property name="order" value="1" /> |
|
24 |
<property name="interceptors"> |
|
25 |
<list> |
|
26 |
<!--<ref bean="contentNegociationHandlerInterceptor" /> --> |
|
27 |
<ref bean="localeContextHandlerInterceptor" /> |
|
28 |
</list> |
|
29 |
</property> |
|
30 |
<property name="pathMatcher"> |
|
31 |
<!-- must match the pathMatcher as set in AnnotationMethodHandlerAdapter --> |
|
32 |
<bean class="eu.etaxonomy.cdm.remote.controller.util.CdmAntPathMatcher" /> |
|
33 |
</property> |
|
34 |
</bean> |
|
35 |
|
|
36 |
<bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping"> |
|
37 |
<property name="order" value="0" /> |
|
38 |
<property name="mappings"> |
|
39 |
<!-- |
|
40 |
<props> |
|
41 |
<prop key="/index.do">urlFilenameViewController |
|
42 |
</prop> |
|
43 |
<prop key="/">welcomeFileViewController |
|
44 |
</prop> |
|
45 |
</props> |
|
46 |
--> |
|
47 |
|
|
48 |
<!-- Needed for spring remoting with the http invoker --> |
|
49 |
<!-- The configuration of the services is imported from httpinvokerServices.xml --> |
|
50 |
<props> |
|
51 |
<prop key="/agent.service">httpAgentService</prop> |
|
52 |
<prop key="/annotation.service">httpAnnotationService</prop> |
|
53 |
<prop key="/auditevent.service">httpAuditEventService</prop> |
|
54 |
<prop key="/classification.service">httpClassificationService</prop> |
|
55 |
<prop key="/collection.service">httpCollectionService</prop> |
|
56 |
<prop key="/common.service">httpCommonService</prop> |
|
57 |
<prop key="/description.service">httpDescriptionService</prop> |
|
58 |
<prop key="/featurenode.service">httpFeatureNodeService</prop> |
|
59 |
<prop key="/featuretree.service">httpFeatureTreeService</prop> |
|
60 |
<prop key="/group.service">httpGroupService</prop> |
|
61 |
<prop key="/identificationkey.service">httpIdentificationKeyService</prop> |
|
62 |
<prop key="/location.service">httpLocationService</prop> |
|
63 |
<prop key="/marker.service">httpMarkerService</prop> |
|
64 |
<prop key="/media.service">httpMediaService</prop> |
|
65 |
<prop key="/name.service">httpNameService</prop> |
|
66 |
<prop key="/occurrence.service">httpOccurrenceService</prop> |
|
67 |
<prop key="/polytomouskeynode.service">httpPolytomousKeyNodeService</prop> |
|
68 |
<prop key="/polytomouskey.service">httpPolytomousKeyService</prop> |
|
69 |
<prop key="/reference.service">httpReferenceService</prop> |
|
70 |
<prop key="/service.service">httpServiceService</prop> |
|
71 |
<prop key="/taxonnode.service">httpTaxonNodeService</prop> |
|
72 |
<prop key="/taxon.service">httpTaxonService</prop> |
|
73 |
<prop key="/term.service">httpTermService</prop> |
|
74 |
<prop key="/user.service">httpUserService</prop> |
|
75 |
<prop key="/vocabulary.service">httpVocabularyService</prop> |
|
76 |
</props> |
|
77 |
</property> |
|
78 |
</bean> |
|
79 |
|
|
80 |
<!-- |
|
81 |
======= HandlerAdapters ======= |
|
82 |
--> |
|
83 |
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"> |
|
84 |
<property name="pathMatcher"> |
|
85 |
<!-- must match the pathMatcher as set in DefaultAnnotationHandlerMapping --> |
|
86 |
<bean class="eu.etaxonomy.cdm.remote.controller.util.CdmAntPathMatcher" /> |
|
87 |
</property> |
|
88 |
</bean> |
|
89 |
|
|
90 |
<!-- needed when using SimpleUrlHandlerMapping --> |
|
91 |
<bean |
|
92 |
class="org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter" /> |
|
93 |
|
|
94 |
<!-- needed for HTTPInvoker --> |
|
95 |
<bean class="org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter" /> |
|
96 |
|
|
97 |
|
|
98 |
<!-- |
|
99 |
======= HandlerInterceptors ======= |
|
100 |
--> |
|
101 |
<!-- |
|
102 |
<bean id="datasourceContextHandlerInterceptor" |
|
103 |
class="eu.etaxonomy.cdm.remote.controller.interceptor.DatasourceContextHandlerInterceptor" /> --> |
|
104 |
<bean id="localeContextHandlerInterceptor" |
|
105 |
class="eu.etaxonomy.cdm.remote.controller.interceptor.LocaleContextHandlerInterceptor" /> |
|
106 |
<!-- |
|
107 |
=== no longer needed, replaced by ContentNegotiatingViewResolver == |
|
108 |
<bean id="contentNegociationHandlerInterceptor" |
|
109 |
class="eu.etaxonomy.cdm.remote.controller.interceptor.ContentNegociationHandlerInterceptor"> |
|
110 |
<property name="mapping"> |
|
111 |
<map> |
|
112 |
<entry key="text/json" value="json" /> |
|
113 |
<entry key="application/json" value="json" /> |
|
114 |
<entry key="application/xml" value="xml" /> |
|
115 |
</map> |
|
116 |
</property> |
|
117 |
<property name="defaultExtension" value="xml" /> |
|
118 |
</bean> |
|
119 |
--> |
|
120 |
|
|
121 |
<!-- |
|
122 |
======= ViewControllers ======= |
|
123 |
--> |
|
124 |
<bean id="urlFilenameViewController" class="org.springframework.web.servlet.mvc.UrlFilenameViewController"> |
|
125 |
</bean> |
|
126 |
<!-- |
|
127 |
The welcome-file-list in the web.xml will is ignored since the |
|
128 |
cdmserver servlet is mapped to the root path [/] So the welcome file |
|
129 |
list is being replaced by a SimpleUrlHandlerMapping on the root path |
|
130 |
[/] which is mapped via this ViewController to the [index] view |
|
131 |
<bean id="welcomeFileViewController" |
|
132 |
class="org.springframework.web.servlet.mvc.UrlFilenameViewController"> |
|
133 |
<property name="suffix"> |
|
134 |
<value>index</value> |
|
135 |
</property> |
|
136 |
</bean> |
|
137 |
--> |
|
138 |
|
|
139 |
|
|
140 |
<!-- |
|
141 |
======= ViewResolver ======= |
|
142 |
--> |
|
143 |
<bean id="oaiViewResolver" class="org.springframework.web.servlet.view.XmlViewResolver"> |
|
144 |
<property name="order" value="0"/> |
|
145 |
<property name="location" value="/WEB-INF/oai-views.xml"/> |
|
146 |
<!-- FOR DEBUGING ONLY !!!! |
|
147 |
<property name="cache" value="false"/> |
|
148 |
--> |
|
149 |
</bean> |
|
150 |
|
|
151 |
|
|
152 |
<bean id="contentNegotiatingViewResolver" class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver"> |
|
153 |
<property name="order" value="1" /> |
|
154 |
<property name="mediaTypes"> |
|
155 |
<map> |
|
156 |
<entry key="xml" value="application/xml" /> |
|
157 |
<entry key="dc" value="application/xml" /> |
|
158 |
<entry key="rdf" value="application/xml" /> |
|
159 |
<entry key="json" value="application/json" /> |
|
160 |
<entry key="json" value="application/json" /> |
|
161 |
</map> |
|
162 |
</property> |
|
163 |
<property name="viewResolvers"> |
|
164 |
<list> |
|
165 |
<bean id="xmlTypeViewResolver" class="eu.etaxonomy.cdm.remote.view.PatternViewResolver"> |
|
166 |
<property name="location" value="/WEB-INF/xml-views.xml"/> |
|
167 |
<!-- |
|
168 |
turn caching off FOR DEBUGING ONLY !!!! |
|
169 |
<property name="cache" value="false"/> |
|
170 |
--> |
|
171 |
</bean> |
|
172 |
<bean id="jsonTypeViewResolver" class="eu.etaxonomy.cdm.remote.view.PatternViewResolver"> |
|
173 |
<property name="location" value="/WEB-INF/json-views.xml"/> |
|
174 |
<!-- |
|
175 |
turn caching off FOR DEBUGING ONLY !!!! |
|
176 |
<property name="cache" value="false"/> |
|
177 |
--> |
|
178 |
</bean> |
|
179 |
</list> |
|
180 |
</property> |
|
181 |
</bean> |
|
182 |
|
|
183 |
<!-- |
|
184 |
=== the viewResolverJsp is currently unused === |
|
185 |
<bean id="viewResolverJsp" |
|
186 |
class="org.springframework.web.servlet.view.InternalResourceViewResolver"> |
|
187 |
<property name="order" value="1" /> |
|
188 |
<property name="prefix" value="/WEB-INF/jsp/" /> |
|
189 |
<property name="suffix" value=".jsp" /> |
|
190 |
<property name="viewNames"> |
|
191 |
<!- - |
|
192 |
view names (or name patterns) that can be handled |
|
193 |
- -> |
|
194 |
<list> |
|
195 |
<value>index</value> |
|
196 |
</list> |
|
197 |
</property> |
|
198 |
</bean> |
|
199 |
--> |
|
200 |
|
|
201 |
<!-- |
|
202 |
======= Exception Handling ======= |
|
203 |
--> |
|
204 |
<bean id="exceptionResolver" class="eu.etaxonomy.cdm.remote.exception.CdmExceptionResolver"> |
|
205 |
</bean> |
|
206 |
|
|
207 |
<!-- |
|
208 |
======= Remoting ======= |
|
209 |
--> |
|
210 |
<import resource="classpath:/eu/etaxonomy/cdm/httpinvokerServices.xml"/> |
|
211 |
|
|
212 |
<!-- |
|
213 |
======= Security ======= |
|
214 |
--> |
|
215 |
<!-- <bean id="basicProcessingFilter" class="org.springframework.security.ui.basicauth.BasicProcessingFilter">--> |
|
216 |
<!-- <property name="authenticationManager"><ref bean="authenticationManager"/></property>--> |
|
217 |
<!-- <property name="authenticationEntryPoint"><ref bean="authenticationEntryPoint"/></property>--> |
|
218 |
<!-- </bean>--> |
|
219 |
<!-- <bean id="authenticationEntryPoint" class="org.springframework.security.ui.basicauth.BasicProcessingFilterEntryPoint">--> |
|
220 |
<!-- <property name="realmName"><value>Name Of Your Realm</value></property>--> |
|
221 |
<!-- </bean>--> |
|
222 |
|
|
223 |
</beans> |
cdmlib-remote-webapp/ide/src/main/webapp/WEB-INF/datasources/configurable.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<beans xmlns="http://www.springframework.org/schema/beans" |
|
3 |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
4 |
xmlns:context="http://www.springframework.org/schema/context" |
|
5 |
xsi:schemaLocation="http://www.springframework.org/schema/beans |
|
6 |
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd |
|
7 |
http://www.springframework.org/schema/context |
|
8 |
http://www.springframework.org/schema/context/spring-context-2.5.xsd"> |
|
9 |
|
|
10 |
<!-- enable processing of annotations such as @Autowired and @Configuration --> |
|
11 |
<context:annotation-config/> |
|
12 |
|
|
13 |
<bean class="eu.etaxonomy.cdm.remote.config.DataSourceConfigurer" > |
|
14 |
</bean> |
|
15 |
|
|
16 |
<bean id="jndiHibernateProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean"> |
|
17 |
<property name="properties"><!-- This configures default hibernate properties --> |
|
18 |
<props> |
|
19 |
<!-- |
|
20 |
the hibernate.dialect will be set by the JndiDataSourceConfig accorging to the |
|
21 |
according WebAppContext attributes or to the environment variable |
|
22 |
--> |
|
23 |
<prop key="hibernate.hbm2ddl.auto">validate</prop><!-- !!! must never be update !!! --> |
|
24 |
<prop key="hibernate.cache.provider_class">org.hibernate.cache.NoCacheProvider</prop> |
|
25 |
<prop key="hibernate.show_sql">false</prop> |
|
26 |
<prop key="hibernate.format_sql">false</prop> |
|
27 |
<prop key="hibernate.search.default.indexBase">${eu.etaxonomy.cdm.search.index.path}</prop> |
|
28 |
</props> |
|
29 |
</property> |
|
30 |
</bean> |
|
31 |
</beans> |
cdmlib-remote-webapp/ide/src/main/webapp/WEB-INF/datasources/datasources-local.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<beans xmlns="http://www.springframework.org/schema/beans" |
|
3 |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
4 |
xmlns:context="http://www.springframework.org/schema/context" |
|
5 |
xsi:schemaLocation="http://www.springframework.org/schema/beans |
|
6 |
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd |
|
7 |
http://www.springframework.org/schema/context |
|
8 |
http://www.springframework.org/schema/context/spring-context-2.5.xsd"> |
|
9 |
|
|
10 |
<bean id="dataSource" lazy-init="true" class="eu.etaxonomy.cdm.database.UpdatableRoutingDataSource"> |
|
11 |
<property name="targetDataSources"> |
|
12 |
<map key-type="java.lang.String"> |
|
13 |
<entry key="cichorieae" value-ref="cichorieaeDataSource"/> |
|
14 |
<entry key="palmae" value-ref="palmaeDataSource"/> |
|
15 |
<entry key="diptera" value-ref="dipteraDataSource"/> |
|
16 |
</map> |
|
17 |
</property> |
|
18 |
<property name="defaultTargetDataSource" ref="cichorieaeDataSource"/> |
|
19 |
</bean> |
|
20 |
|
|
21 |
<bean id="cichorieaeDataSource" lazy-init="true" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> |
|
22 |
<property name="driverClassName" value="com.mysql.jdbc.Driver"/> |
|
23 |
<property name="username" value="${local.usr}"/> |
|
24 |
<property name="password" value="${local.pwd}"/> |
|
25 |
<property name="url" value="jdbc:mysql://${local.host}/cdm_local_cichorieae"/> |
|
26 |
</bean> |
|
27 |
<bean id="palmaeDataSource" lazy-init="true" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> |
|
28 |
<property name="driverClassName" value="com.mysql.jdbc.Driver"/> |
|
29 |
<property name="username" value="${local.usr}"/> |
|
30 |
<property name="password" value="${local.pwd}"/> |
|
31 |
<property name="url" value="jdbc:mysql://${local.host}/cdm_local_palmae"/> |
|
32 |
</bean> |
|
33 |
|
|
34 |
<bean id="dipteraDataSource" lazy-init="true" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> |
|
35 |
<property name="driverClassName" value="com.mysql.jdbc.Driver"/> |
|
36 |
<property name="username" value="${local.usr}"/> |
|
37 |
<property name="password" value="${local.pwd}"/> |
|
38 |
<property name="url" value="jdbc:mysql://${local.host}/cdm_local_diptera"/> |
|
39 |
</bean> |
|
40 |
|
|
41 |
<!-- This configures default properties, which can overridden with the file specified by the location property --> |
|
42 |
<bean id="hibernateProperties" |
|
43 |
class="org.springframework.beans.factory.config.PropertiesFactoryBean"> |
|
44 |
<property name="properties"> |
|
45 |
<props> |
|
46 |
<prop key="hibernate.hbm2ddl.auto">validate</prop> |
|
47 |
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop> |
|
48 |
<prop key="hibernate.cache.provider_class">org.hibernate.cache.NoCacheProvider</prop> |
|
49 |
<prop key="hibernate.show_sql">true</prop> |
|
50 |
<prop key="hibernate.format_sql">false</prop> |
|
51 |
</props> |
|
52 |
</property> |
|
53 |
</bean> |
|
54 |
|
|
55 |
</beans> |
cdmlib-remote-webapp/ide/src/main/webapp/WEB-INF/datasources/empty-default-datasource.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<beans xmlns="http://www.springframework.org/schema/beans" |
|
3 |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
4 |
xmlns:context="http://www.springframework.org/schema/context" |
|
5 |
xsi:schemaLocation="http://www.springframework.org/schema/beans |
|
6 |
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd |
|
7 |
http://www.springframework.org/schema/context |
|
8 |
http://www.springframework.org/schema/context/spring-context-2.5.xsd"> |
|
9 |
|
|
10 |
<bean id="dataSource" lazy-init="true" class="eu.etaxonomy.cdm.database.UpdatableRoutingDataSource"> |
|
11 |
<property name="targetDataSources"> |
|
12 |
<map key-type="java.lang.String"> |
|
13 |
<entry key="empty_default" value-ref="empty_defaultDataSource"/> |
|
14 |
</map> |
|
15 |
</property> |
|
16 |
<property name="defaultTargetDataSource" ref="empty_defaultDataSource"/> |
|
17 |
</bean> |
|
18 |
|
|
19 |
<bean id="empty_defaultDataSource" lazy-init="true" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> |
|
20 |
<property name="driverClassName" value="com.mysql.jdbc.Driver"/> |
|
21 |
<property name="username" value="${local.usr}"/> |
|
22 |
<property name="password" value="${local.pwd}"/> |
|
23 |
<property name="url" value="jdbc:mysql://${local.host}/cdm_empty_default"/> |
|
24 |
</bean> |
|
25 |
|
|
26 |
<!-- This configures default properties, which can overridden with the file specified by the location property --> |
|
27 |
<bean id="hibernateProperties" |
|
28 |
class="org.springframework.beans.factory.config.PropertiesFactoryBean"> |
|
29 |
<property name="properties"> |
|
30 |
<props> |
|
31 |
<prop key="hibernate.hbm2ddl.auto">validate</prop> |
|
32 |
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop> |
|
33 |
<prop key="hibernate.cache.provider_class">org.hibernate.cache.NoCacheProvider</prop> |
|
34 |
<prop key="hibernate.show_sql">false</prop> |
|
35 |
<prop key="hibernate.format_sql">false</prop> |
|
36 |
</props> |
|
37 |
</property> |
|
38 |
</bean> |
|
39 |
|
|
40 |
</beans> |
cdmlib-remote-webapp/ide/src/main/webapp/WEB-INF/datasources/p6spy.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<beans xmlns="http://www.springframework.org/schema/beans" |
|
3 |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
4 |
xmlns:tx="http://www.springframework.org/schema/tx" |
|
5 |
xmlns:context="http://www.springframework.org/schema/context" |
|
6 |
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd |
|
7 |
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd |
|
8 |
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd |
|
9 |
"> |
|
10 |
|
|
11 |
<!-- |
|
12 |
see also /cdmlib-remote/src/main/resources/spy.properties in which P6Spy is configured |
|
13 |
important properities are: |
|
14 |
realdriver=com.mysql.jdbc.Driver |
|
15 |
log4j.logger.p6spy=INFO,STDOUT |
|
16 |
log4j.logger.p6spy=INFO, SQLPROFILER_CLIENT |
|
17 |
log4j.appender.SQLPROFILER_CLIENT.RemoteHost = |
|
18 |
|
|
19 |
you can use sqlprofiler as SQLPROFILER_CLIENT |
|
20 |
--> |
|
21 |
<bean id="dataSource" lazy-init="true" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> |
|
22 |
<property name="driverClassName" value="com.p6spy.engine.spy.P6SpyDriver"/> |
|
23 |
<property name="username" value="${local.usr}"/> |
|
24 |
<property name="password" value="${local.pwd}"/> |
|
25 |
<property name="url" value="jdbc:mysql://${local.host}/cdm_local_cichorieae"/> |
|
26 |
</bean> |
|
27 |
|
|
28 |
|
|
29 |
<!-- This configures default properties, which can overridden with the file specified by the location property --> |
|
30 |
<bean id="hibernateProperties" |
|
31 |
class="org.springframework.beans.factory.config.PropertiesFactoryBean"> |
|
32 |
<property name="properties"> |
|
33 |
<props> |
|
34 |
<prop key="hibernate.hbm2ddl.auto">validate</prop> |
|
35 |
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop> |
|
36 |
<prop key="hibernate.cache.provider_class">org.hibernate.cache.NoCacheProvider</prop> |
|
37 |
<prop key="hibernate.show_sql">false</prop> |
|
38 |
<prop key="hibernate.format_sql">false</prop> |
|
39 |
</props> |
|
40 |
</property> |
|
41 |
</bean> |
|
42 |
|
|
43 |
|
|
44 |
</beans> |
cdmlib-remote-webapp/ide/src/main/webapp/WEB-INF/datasources/routing-datasource.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<beans xmlns="http://www.springframework.org/schema/beans" |
|
3 |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
4 |
xmlns:context="http://www.springframework.org/schema/context" |
|
5 |
xsi:schemaLocation="http://www.springframework.org/schema/beans |
|
6 |
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd |
|
7 |
http://www.springframework.org/schema/context |
|
8 |
http://www.springframework.org/schema/context/spring-context-2.5.xsd"> |
|
9 |
|
|
10 |
|
|
11 |
<bean id="dataSource" lazy-init="true" class="eu.etaxonomy.cdm.database.SelectableDataSource"> |
|
12 |
<!-- The property beanDefinitionFile defaults to "datasources.xml" in {USER_HOME}./cdmLibrary |
|
13 |
|
|
14 |
WARNING !!! |
|
15 |
The beanDefinitionFile now mus be configured in |
|
16 |
eu.etaxonomy.cdm.database.DataSourceBeanLoader |
|
17 |
|
|
18 |
--> |
|
19 |
<!-- The property defaultDatasourceName defaults to "default" |
|
20 |
<property name="beanDefinitionFile" value="datasources-p6spy.xml" /> |
|
21 |
<property name="defaultDatasourceName" value="cichorieae" /> |
|
22 |
--> |
|
23 |
</bean> |
|
24 |
|
|
25 |
<!-- This configures default properties, which can overridden with the file specified by the location property --> |
|
26 |
<bean id="hibernateProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean"> |
|
27 |
<property name="properties"> |
|
28 |
<props> |
|
29 |
<!-- |
|
30 |
Configuring the C3P0ConnectionProvider |
|
31 |
======================================== |
|
32 |
see http://www.mchange.com/projects/c3p0/index.html#hibernate-specific |
|
33 |
and also org.springframework.orm.hibernate3.AbstractSessionFactoryBean.setDataSource(DataSource dataSource) |
|
34 |
|
|
35 |
IMPORTANT: |
|
36 |
Because of the constraint (1) the org.hibernate.connection.C3P0ConnectionProvider anc not be used |
|
37 |
for the cdm library because it requires the dataSource bean in some cases. |
|
38 |
|
|
39 |
(1) |
|
40 |
Do NOT specify the dataSource in the sessionFactory for example in the |
|
41 |
org.springframework.orm.hibernate3.LocalSessionFactoryBean |
|
42 |
!!!==> If *dataSource* is set, this will override corresponding settings in Hibernate properties.!!! |
|
43 |
If this is set, the Hibernate settings should not define a connection provider to |
|
44 |
avoid meaningless double configuration. |
|
45 |
(2) |
|
46 |
Hibernate uses the hibernate.c3p0.max_size property to determine if c3p0 |
|
47 |
is begin used. Therefore the max_size property MUST be set. - maybe not need in hibernate 3.4 + |
|
48 |
(3) If you are using Hibernate's C3P0ConnectionProvider you must set the following properties |
|
49 |
in your hibernate configuration, using hibernate-specific configuration keys. |
|
50 |
All other properties must be defined as usual in a c3p0.properties file. |
|
51 |
This is confusing, and will hopefully be simplified some time in the future, but for now... |
|
52 |
|
|
53 |
hibernate.c3p0.acquire_increment |
|
54 |
hibernate.c3p0.idle_test_period |
|
55 |
hibernate.c3p0.timeout |
|
56 |
hibernate.c3p0.max_size |
|
57 |
hibernate.c3p0.max_statements |
|
58 |
hibernate.c3p0.min_size |
|
59 |
hibernate.c3p0.validate |
|
60 |
--> |
|
61 |
<prop key="hibernate.hbm2ddl.auto">update</prop> |
|
62 |
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop> |
|
63 |
<prop key="hibernate.cache.provider_class">org.hibernate.cache.NoCacheProvider</prop> |
|
64 |
<prop key="hibernate.show_sql">false</prop> |
|
65 |
<prop key="hibernate.format_sql">false</prop> |
|
66 |
<prop key="hibernate.search.default.indexBase">${user.home}/.cdmLibrary/</prop> |
|
67 |
</props> |
|
68 |
</property> |
|
69 |
</bean> |
|
70 |
|
|
71 |
</beans> |
cdmlib-remote-webapp/ide/src/main/webapp/WEB-INF/json-views.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<beans xmlns="http://www.springframework.org/schema/beans" |
|
3 |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
4 |
xsi:schemaLocation="http://www.springframework.org/schema/beans |
|
5 |
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"> |
|
6 |
|
|
7 |
<!-- |
|
8 |
=============================================================== |
|
9 |
This is the configuaration file for the |
|
10 |
eu.etaxonomy.cdm.remote.view.PatternViewResolver |
|
11 |
=============================================================== |
|
12 |
|
|
13 |
- bean names are ant style patterns |
|
14 |
- the eu.etaxonomy.cdm.remote.view.PatternViewResolver |
|
15 |
must be used to resolve patterns used as bean names |
|
16 |
--> |
|
17 |
|
|
18 |
<!-- entity services --> |
|
19 |
<bean name="**/*" class="eu.etaxonomy.cdm.remote.view.JsonView"> |
|
20 |
<property name="jsonConfig" ref="jsonConfig" /> |
|
21 |
</bean> |
|
22 |
|
|
23 |
<!-- taxonomy service --> |
|
24 |
<bean name="**/classification **/classification/* **/classification/**/*" class="eu.etaxonomy.cdm.remote.view.JsonView"> |
|
25 |
<property name="jsonConfig" ref="jsonConfigClassification" /> |
|
26 |
</bean> |
|
27 |
|
|
28 |
<!-- portal service --> |
|
29 |
<bean name="**/portal/* **/portal/**/*" class="eu.etaxonomy.cdm.remote.view.JsonView"> |
|
30 |
<property name="jsonConfig" ref="jsonConfigPortal" /> |
|
31 |
</bean> |
|
32 |
</beans> |
cdmlib-remote-webapp/ide/src/main/webapp/WEB-INF/jsp/index.jsp | ||
---|---|---|
1 |
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" |
|
2 |
pageEncoding="ISO-8859-1"%> |
|
3 |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
|
4 |
<html> |
|
5 |
<head> |
|
6 |
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
|
7 |
<title>CDM Remote API</title> |
|
8 |
</head> |
|
9 |
<body> |
|
10 |
<h1>CDM Remote API</h1> |
|
11 |
<p>This is the root of the CDM remote web application which offers the following APIs.</p> |
|
12 |
<ul> |
|
13 |
<li><a href="http://wp5.e-taxonomy.eu/cdmlib/rest-api.html">RESTful API</a></li> |
|
14 |
<li><a href="http://wp5.e-taxonomy.eu/cdmlib/oai-pmh.html">OAI-PMH</a></li> |
|
15 |
</ul> |
|
16 |
</body> |
|
17 |
</html> |
cdmlib-remote-webapp/ide/src/main/webapp/WEB-INF/oai-views.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<beans xmlns="http://www.springframework.org/schema/beans" |
|
3 |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
4 |
xsi:schemaLocation="http://www.springframework.org/schema/beans |
|
5 |
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"> |
|
6 |
|
|
7 |
<!-- |
|
8 |
=============================================================== |
|
9 |
This is the configuaration file for a |
|
10 |
eu.etaxonomy.cdm.remote.view.XMLViewResolver |
|
11 |
=============================================================== |
|
12 |
--> |
|
13 |
<bean name="oai/exception" class="eu.etaxonomy.cdm.remote.view.oaipmh.ExceptionView"> |
|
14 |
<property name="contentType" value="text/xml; charset=UTF-8"/> |
|
15 |
<property name="marshaller" ref="marshaller"/> |
|
16 |
<property name="mapper" ref="dozerMapper"/> |
|
17 |
</bean> |
|
18 |
|
|
19 |
<bean name="oai/identify" class="eu.etaxonomy.cdm.remote.view.oaipmh.IdentifyView"> |
|
20 |
<property name="contentType" value="text/xml; charset=UTF-8"/> |
|
21 |
<property name="marshaller" ref="marshaller"/> |
|
22 |
<property name="mapper" ref="dozerMapper"/> |
|
23 |
</bean> |
|
24 |
|
|
25 |
<bean name="oai/getRecord.rdf" class="eu.etaxonomy.cdm.remote.view.oaipmh.rdf.GetRecordView"> |
|
26 |
<property name="contentType" value="text/xml; charset=UTF-8"/> |
|
27 |
<property name="marshaller" ref="marshaller"/> |
|
28 |
<property name="mapper" ref="dozerMapper"/> |
|
29 |
</bean> |
Also available in: Unified diff
remoting services now working