Project

General

Profile

« Previous | Next » 

Revision 46818

codebase used to migrate to java8 the production system

View differences:

webapps/dnet-container-provision/trunk/deploy.info
1
{
2
	"type_source": "SVN", 
3
	"goal": "package -U -T 4C source:jar", 
4
	"url": "http://svn-public.driver.research-infrastructures.eu/driver/dnet40/webapps/dnet-container-provision/trunk", 
5
	"deploy_repository": "dnet4-snapshots", 
6
	"version": "4", 
7
	"mail": "sandro.labruzzo@isti.cnr.it,michele.artini@isti.cnr.it,claudio.atzori@isti.cnr.it,alessia.bardi@isti.cnr.it", 
8
	"deploy_repository_url": "http://maven.research-infrastructures.eu/nexus/content/repositories/dnet4-snapshots", 
9
	"name": "dnet-container-provision",
10
	"nightly" : "true",
11
	"cron" : "0 0 0 1/1 * ? *"
12
}
webapps/dnet-container-provision/trunk/src/main/java/eu/dnetlib/swagger/configuration/SwaggerDocumentationConfig.java
1
package eu.dnetlib.swagger.configuration;
2

  
3
import eu.dnetlib.common.rmi.DNetRestDocumentation;
4
import io.swagger.annotations.Api;
5
import org.springframework.beans.factory.annotation.Value;
6
import org.springframework.context.annotation.Bean;
7
import org.springframework.context.annotation.Configuration;
8
import org.springframework.stereotype.Controller;
9
import org.springframework.web.bind.annotation.RestController;
10
import springfox.documentation.builders.ApiInfoBuilder;
11
import springfox.documentation.builders.PathSelectors;
12
import springfox.documentation.builders.RequestHandlerSelectors;
13
import springfox.documentation.service.ApiInfo;
14
import springfox.documentation.service.Contact;
15
import springfox.documentation.spi.DocumentationType;
16
import springfox.documentation.spring.web.plugins.Docket;
17
import springfox.documentation.swagger2.annotations.EnableSwagger2;
18

  
19
@Configuration
20
@EnableSwagger2
21
public class SwaggerDocumentationConfig {
22

  
23
    @Value("${api.rest.contact.name}")
24
    private String contactName;
25

  
26
    @Value("${api.rest.contact.url}")
27
    private String contactUrl;
28

  
29
    @Value("${api.rest.contact.email}")
30
    private String contactEmail;
31

  
32
	@Value("${api.rest.title}")
33
	private String title;
34

  
35
	@Value("${api.rest.description}")
36
	private String description;
37

  
38
	@Value("${api.rest.license}")
39
	private String license;
40
	@Value("${api.rest.license.url}")
41
	private String licenseUrl;
42

  
43
    @Bean
44
    public Docket customImplementation(){
45
        return new Docket(DocumentationType.SWAGGER_2)
46
                .select()
47
			        //.apis(RequestHandlerSelectors.any())
48
                    //.apis(RequestHandlerSelectors.basePackage("eu.dnetlib.**.controller.*"))
49
		            //.apis(RequestHandlerSelectors.withClassAnnotation(RestController.class))
50
		            .apis(RequestHandlerSelectors.withClassAnnotation(DNetRestDocumentation.class))
51
                    //.paths(PathSelectors.ant("/ds/**"))
52
                    .build()
53
                .directModelSubstitute(org.joda.time.LocalDate.class, java.sql.Date.class)
54
                .directModelSubstitute(org.joda.time.DateTime.class, java.util.Date.class)
55
                .apiInfo(apiInfo());
56
    }
57

  
58
	private ApiInfo apiInfo() {
59
		return new ApiInfoBuilder()
60
				.title(title)
61
				.description(description)
62
				.license(license)
63
				.licenseUrl(licenseUrl)
64
				.termsOfServiceUrl("")
65
				.version("1.0.0")
66
				.contact(new Contact(contactName, contactUrl, contactEmail))
67
				.build();
68
	}
69

  
70
}
0 71

  
webapps/dnet-container-provision/trunk/src/main/java/eu/dnetlib/swagger/configuration/RFC3339DateFormat.java
1
package eu.dnetlib.swagger.configuration;
2

  
3
import java.text.FieldPosition;
4
import java.util.Date;
5

  
6
import com.fasterxml.jackson.databind.util.ISO8601DateFormat;
7
import com.fasterxml.jackson.databind.util.ISO8601Utils;
8

  
9
public class RFC3339DateFormat extends ISO8601DateFormat {
10

  
11
  // Same as ISO8601DateFormat but serializing milliseconds.
12
  @Override
13
  public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) {
14
    String value = ISO8601Utils.format(date, true);
15
    toAppendTo.append(value);
16
    return toAppendTo;
17
  }
18

  
19
}
0 20

  
webapps/dnet-container-provision/trunk/src/main/java/eu/dnetlib/swagger/configuration/ApiOriginFilter.java
1
package eu.dnetlib.swagger.configuration;
2

  
3
import java.io.IOException;
4
import javax.servlet.*;
5
import javax.servlet.http.HttpServletResponse;
6

  
7
public class ApiOriginFilter implements Filter {
8
	@Override
9
	public void doFilter(ServletRequest request, ServletResponse response,
10
			FilterChain chain) throws IOException, ServletException {
11
		HttpServletResponse res = (HttpServletResponse) response;
12
		res.addHeader("Access-Control-Allow-Origin", "*");
13
		res.addHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT");
14
		res.addHeader("Access-Control-Allow-Headers", "Content-Type");
15
		chain.doFilter(request, response);
16
	}
17

  
18
	@Override
19
	public void destroy() {
20
	}
21

  
22
	@Override
23
	public void init(FilterConfig filterConfig) throws ServletException {
24
	}
25
}
0 26

  
webapps/dnet-container-provision/trunk/src/main/java/eu/dnetlib/swagger/configuration/HomeController.java
1
package eu.dnetlib.swagger.configuration;
2

  
3
import org.apache.commons.logging.Log;
4
import org.apache.commons.logging.LogFactory;
5
import org.springframework.stereotype.Controller;
6
import org.springframework.web.bind.annotation.RequestMapping;
7

  
8
/**
9
 * Home redirection to swagger api documentation 
10
 */
11
@Controller
12
public class HomeController {
13

  
14
	@RequestMapping(value = "/docs")
15
	public String index() {
16
		return "redirect:swagger-ui.html";
17
	}
18
}
0 19

  
webapps/dnet-container-provision/trunk/src/main/java/eu/dnetlib/swagger/configuration/ApiResponseMessage.java
1
package eu.dnetlib.swagger.configuration;
2

  
3
import javax.xml.bind.annotation.XmlTransient;
4

  
5
@javax.xml.bind.annotation.XmlRootElement
6
public class ApiResponseMessage {
7
	public static final int ERROR = 1;
8
	public static final int WARNING = 2;
9
	public static final int INFO = 3;
10
	public static final int OK = 4;
11
	public static final int TOO_BUSY = 5;
12

  
13
	int code;
14
	String type;
15
	String message;
16
	
17
	public ApiResponseMessage(){}
18
	
19
	public ApiResponseMessage(int code, String message){
20
		this.code = code;
21
		switch(code){
22
		case ERROR:
23
			setType("error");
24
			break;
25
		case WARNING:
26
			setType("warning");
27
			break;
28
		case INFO:
29
			setType("info");
30
			break;
31
		case OK:
32
			setType("ok");
33
			break;
34
		case TOO_BUSY:
35
			setType("too busy");
36
			break;
37
		default:
38
			setType("unknown");
39
			break;
40
		}
41
		this.message = message;
42
	}
43

  
44
	@XmlTransient
45
	public int getCode() {
46
		return code;
47
	}
48

  
49
	public void setCode(int code) {
50
		this.code = code;
51
	}
52

  
53
	public String getType() {
54
		return type;
55
	}
56

  
57
	public void setType(String type) {
58
		this.type = type;
59
	}
60

  
61
	public String getMessage() {
62
		return message;
63
	}
64

  
65
	public void setMessage(String message) {
66
		this.message = message;
67
	}
68
}
0 69

  
webapps/dnet-container-provision/trunk/src/main/java/eu/dnetlib/EndpointDocController.java
1
package eu.dnetlib;
2

  
3
import java.util.List;
4
import java.util.Map;
5
import java.util.Map.Entry;
6
import java.util.Set;
7

  
8
import com.google.common.collect.Lists;
9
import com.google.common.collect.Maps;
10
import com.google.common.collect.Sets;
11
import org.apache.commons.logging.Log;
12
import org.apache.commons.logging.LogFactory;
13
import org.springframework.beans.factory.annotation.Autowired;
14
import org.springframework.web.bind.annotation.RequestMapping;
15
import org.springframework.web.bind.annotation.RequestMethod;
16
import org.springframework.web.bind.annotation.RestController;
17
import org.springframework.web.method.HandlerMethod;
18
import org.springframework.web.servlet.mvc.method.RequestMappingInfo;
19
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
20

  
21
/**
22
 * Created by claudio on 30/11/2016.
23
 */
24
@RestController
25
public class EndpointDocController {
26

  
27
	private static final Log log = LogFactory.getLog(EndpointDocController.class);
28

  
29
	@Autowired
30
	private List<RequestMappingHandlerMapping> handlerMappings;
31

  
32
	@RequestMapping(value = "/endpointdoc", method = RequestMethod.GET)
33
	public Set<String> show() {
34

  
35
		final Set<String> res = Sets.newHashSet();
36
		for(RequestMappingHandlerMapping handler : handlerMappings) {
37

  
38
			for(Entry<RequestMappingInfo, HandlerMethod> e : handler.getHandlerMethods().entrySet()) {
39
				final RequestMappingInfo info = e.getKey();
40
				res.add(info.toString());
41
			}
42
		}
43
		return res;
44
	}
45

  
46
}
webapps/dnet-container-provision/trunk/src/main/resources/META-INF/cxf/org.apache.cxf.Logger
1
org.apache.cxf.common.logging.Log4jLogger
webapps/dnet-container-provision/trunk/src/main/resources/META-INF/services/javax.xml.transform.TransformerFactory
1
net.sf.saxon.TransformerFactoryImpl
webapps/dnet-container-provision/trunk/src/main/resources/eu/dnetlib/cnr-site.properties
1
# SERVICES
2
container.hostname      =   localhost
3
container.port          =   8980
4
container.context       =   provision
5
services.registration.delay = 15000
6
services.is.host        =   localhost
7
services.is.port        =   8280
8
services.is.baseurl     =   http://${services.is.host}:${services.is.port}/app/services
9
services.is.lookup.url  =   ${services.is.baseurl}/isLookUp
10
transport.soap.force.local.address=true
11

  
12
# REST API CONFIGURATION
13
api.rest.title          =   OpenAIRE data provision REST API
14
api.rest.description    =   The OpenAIRE data provision REST API allows developers to access the metadata information space of OpenAIRE programmatically.
15
api.rest.license        =   LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE.
16
api.rest.license.url    =   https://creativecommons.org/licenses/by/4.0
17
api.rest.contact.name   =   D-Net team
18
api.rest.contact.url    =   http://www.d-net.research-infrastructures.eu
19
api.rest.contact.email  =   dnet-team@isti.cnr.it
20

  
21
# SWAGGER
22
springfox.documentation.swagger.v2.path     =   /api-docs
23
spring.jackson.date-format                  =   io.swagger.RFC3339DateFormat
24
spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS=false
25

  
26
# DNET SERVICE CONFIGURATION
27
service.index.solr.default.interpretation=openaire
28
service.solr.index.jsonConfiguration= \
29
	{"id":"solr",\
30
	"address":"localhost:9983",\
31
	"port":"8983",\
32
	"webContext":"solr",\
33
	"numShards":"4",\
34
	"replicationFactor":"1",\
35
    "maxShardsPerNode":"4",\
36
	"host":"localhost",\
37
	"feedingShutdownTolerance":"30000",\
38
	"feedingBufferFlushThreshold":"1000",\
39
	"feedingSimulationMode":"false",\
40
	"luceneMatchVersion":"4.9",\
41
	"serverLibPath":"../../../../contrib/extraction/lib",\
42
	"filterCacheSize":"512","filterCacheInitialSize":"512",\
43
	"queryCacheSize":"512","queryCacheInitialSize":"512",\
44
	"documentCacheSize":"512","documentCacheInitialSize":"512",\
45
	"ramBufferSizeMB":"960","mergeFactor":"40",\
46
	"autosoftcommit":"-1","autocommit":"15000",\
47
	"termIndexInterval":"1024","maxIndexingThreads":"8",\
48
	"queryResultWindowSize":"20","queryResultMaxDocCached":"200"} 
49

  
50
services.publisher.oai.host     =   localhost
51
services.publisher.oai.port     =   27017
52
service.index.feed.repeatDelay  =   20000
53
service.index.solr.nh.mdformat.enable   = true
54
service.index.solr.rank.enable          = true
55
dnet.openaire.db.name           =   dnet_openaireplus
webapps/dnet-container-provision/trunk/src/main/resources/eu/dnetlib/applicationContext-ehcache.xml
1
<beans xmlns="http://www.springframework.org/schema/beans"
2
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
3
	xmlns:util="http://www.springframework.org/schema/util" xmlns:cache="http://www.springframework.org/schema/cache"
4
	xmlns:jaxws="http://cxf.apache.org/jaxws" xmlns:template="http://dnetlib.eu/springbeans/template"
5
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
6
                        http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
7
	http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd
8
	http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
9

  
10
	<!-- THIS FILE MUST CONTAIN THE CACHEMANAGER DECALRES IN DEPENDENCY MODULES 
11
		THAT MUST BE USED BY THE CONTAINER BECAUSE WE CANNOT HAVE MULTIPLE <cache:annotation-driven> 
12
		IN DIFFERENT MODULES. -->
13
		
14
		<cache:annotation-driven cache-manager="provisionCacheManager" />
15
		
16
		<!-- ADD TO THE ARRAY OF CACHE MANAGERS THE CACHE MANAGER DEFINED IN MODULES" APPLICATION CONTEXTS -->
17
		<bean id="provisionCacheManager" class="org.springframework.cache.support.CompositeCacheManager">
18
    		<property name="cacheManagers">
19
        		<array>
20
            		<ref bean="vocabularyCacheManager" />
21
           	 		<ref bean="theOAICacheManager" />
22
           	 		<ref bean="oaiUtilsCacheManager" />
23
			        <ref bean="datasourceCacheManager" />
24
        		</array>
25
    		</property>
26
    		<property name="fallbackToNoOpCache" value="true" />
27
		</bean>
28
</beans>
webapps/dnet-container-provision/trunk/src/main/resources/eu/dnetlib/applicationContext-locators.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:jaxws="http://cxf.apache.org/jaxws"
4
	xmlns:sec="http://cxf.apache.org/configuration/security" xmlns:wsa="http://cxf.apache.org/ws/addressing"
5
	xmlns:p="http://www.springframework.org/schema/p" xmlns:http="http://cxf.apache.org/transports/http/configuration"
6
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
7
                        http://cxf.apache.org/ws/addressing http://cxf.apache.org/schemas/ws-addr-conf.xsd
8
                        http://cxf.apache.org/configuration/security http://cxf.apache.org/schemas/configuration/security.xsd
9
                        http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd
10
                        http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
11

  
12
	<!-- common service resolution chain -->
13
	<bean id="serviceResolver" class="eu.dnetlib.enabling.tools.ServiceResolverChain">
14
		<property name="resolvers">
15
			<list>
16
				<bean id="jaxwsServiceResolver" class="eu.dnetlib.enabling.tools.JaxwsServiceResolverImpl" />
17
			</list>
18
		</property>
19
	</bean>
20

  
21
	<bean id="jobScheduler"
22
		class="org.springframework.scheduling.quartz.SchedulerFactoryBean"
23
		destroy-method="destroy">
24
		<property name="jobFactory">
25
			<bean id="jobSchedulerFactory"
26
				class="org.springframework.scheduling.quartz.SpringBeanJobFactory" />
27
		</property>
28
	</bean>
29

  
30
	<jaxws:client id="isLookUpService"
31
		serviceClass="eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService"
32
		address="${services.is.lookup.url}" />
33

  
34
	<bean id="uuidGenerator" class="eu.dnetlib.enabling.tools.UniqueIdentifierGeneratorImpl" />
35

  
36
	<alias name="cxfEndpointReferenceBuilder" alias="eprBuilder" />
37
</beans>
webapps/dnet-container-provision/trunk/src/main/resources/log4j.properties
1
### Root Level ###
2
log4j.rootLogger=WARN, LOGFILE
3
#log4j.rootLogger=WARN, CONSOLE
4

  
5
### Configuration for the LOGFILE appender ###
6
log4j.appender.LOGFILE=org.apache.log4j.RollingFileAppender
7
log4j.appender.LOGFILE.MaxFileSize=25MB
8
log4j.appender.LOGFILE.MaxBackupIndex=10
9
log4j.appender.LOGFILE.File=logs/dnet.log
10
log4j.appender.LOGFILE.Append=true
11
log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout
12
log4j.appender.LOGFILE.layout.ConversionPattern=[%-5p] %d %c - %m%n
13

  
14
### Configuration for the CONSOLE appender ###
15
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
16
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
17
log4j.appender.CONSOLE.layout.ConversionPattern=[%-5p] %d %c - %m%n
18

  
19
org.apache.cxf.Logger=org.apache.cxf.common.logging.Log4jLogger
20

  
21
### Application Level ###
22
log4j.logger.eu.dnetlib=INFO
23
log4j.logger.org.apache.cxf.ws.addressing.ContextUtils=FATAL
24
log4j.logger.eu.dnetlib.enabling.inspector=FATAL
25
log4j.logger.eu.dnetlib.springutils.stringtemplate.StringTemplateViewResolver=FATAL
26
log4j.logger.org.apache.xerces.parsers.SAXParser=OFF
27

  
28
### Spring ###
29
log4j.logger.org.springframework=ERROR
30

  
31

  
webapps/dnet-container-provision/trunk/src/main/webapp/WEB-INF/cxf.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:cxf="http://cxf.apache.org/core"
4
	xmlns:http="http://cxf.apache.org/transports/http/configuration"
5
	xmlns:wsa="http://cxf.apache.org/ws/addressing" xmlns:p="http://www.springframework.org/schema/p"
6
	xmlns:pol="http://cxf.apache.org/policy" xmlns:condbean="http://dnetlib.eu/springbeans/condbean"
7
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
8
			http://cxf.apache.org/ws/addressing http://cxf.apache.org/schemas/ws-addr-conf.xsd
9
			http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd
10
			http://cxf.apache.org/policy http://cxf.apache.org/schemas/policy.xsd
11
			http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
12
			http://dnetlib.eu/springbeans/condbean http://dnetlib.eu/springbeans/condbean.xsd">
13

  
14
<!-- CXF bus with logging. Please set the log level of org.apache.cxf.interceptor to FATAL to hide the logging of EVERY incoming and outgoing messages. -->
15
	<cxf:bus>
16
		<cxf:outInterceptors>
17
			<ref bean="outCxfLoggingInterceptor" />
18
		</cxf:outInterceptors>
19
		<cxf:inInterceptors>
20
			<ref bean="inCxfLoggingInterceptor" />
21
		</cxf:inInterceptors>
22
	</cxf:bus>
23

  
24
	<bean id="outCxfLoggingInterceptor" class="org.apache.cxf.interceptor.LoggingOutInterceptor" />
25
	<bean id="inCxfLoggingInterceptor" class="org.apache.cxf.interceptor.LoggingInInterceptor" />
26

  
27
	<http:conduit name="*.http-conduit">
28
		<http:client AllowChunking="true" Connection="Keep-Alive" />
29
	</http:conduit>
30
</beans>
webapps/dnet-container-provision/trunk/src/main/webapp/WEB-INF/applicationContext.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2

  
3
<beans xmlns="http://www.springframework.org/schema/beans"
4
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
5
	xmlns:context="http://www.springframework.org/schema/context"
6
	xmlns:cxf="http://cxf.apache.org/core"
7
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
8
	http://www.springframework.org/schema/context
9
           http://www.springframework.org/schema/context/spring-context-2.5.xsd
10
           http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd">
11

  
12
	<import resource="classpath:META-INF/cxf/cxf.xml" />
13
	<import resource="classpath:META-INF/cxf/cxf-extension-jaxws.xml" />
14
	<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
15

  
16
	<import resource="classpath*:/eu/dnetlib/**/applicationContext*.xml" />
17

  
18
	<context:annotation-config />
19
	<!-- if the following import is not the last one, something overrides bus 
20
		configuration disabling logging and any other customized feature. -->
21
	<import resource="./cxf.xml" />
22

  
23
</beans>
webapps/dnet-container-provision/trunk/src/main/webapp/WEB-INF/dispatcher-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:p="http://www.springframework.org/schema/p"
4
	xmlns:context="http://www.springframework.org/schema/context"
5
	xmlns:mvc="http://www.springframework.org/schema/mvc"
6
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
7
		http://www.springframework.org/schema/context
8
        http://www.springframework.org/schema/context/spring-context.xsd
9
        http://www.springframework.org/schema/mvc
10
        http://www.springframework.org/schema/mvc/spring-mvc.xsd">
11

  
12
	<mvc:annotation-driven />
13

  
14
	<context:component-scan base-package="eu.dnetlib">
15

  
16
	</context:component-scan>
17

  
18
	<import resource="classpath*:/eu/dnetlib/**/webContext*.xml" />
19

  
20
	<bean id="beanHandlerMapping" p:order="1"
21
		class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping" />
22
	
23
	<bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter" />
24
	
25
	<mvc:resources mapping="/resources/**" location="classpath:/eu/dnetlib/web/resources/" />
26

  
27
	<mvc:resources mapping="swagger-ui.html" location="classpath:/META-INF/resources/" />
28
	<mvc:resources mapping="/webjars/**" location="classpath:/META-INF/resources/webjars/" />
29

  
30
</beans>
webapps/dnet-container-provision/trunk/src/main/webapp/WEB-INF/web.xml
1
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2
	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
3
	version="3.0">
4
	<display-name>OpenAIRE provision container web app</display-name>
5
	<context-param>
6
		<param-name>contextConfigLocation</param-name>
7
		<param-value>/WEB-INF/applicationContext.xml</param-value>
8
	</context-param>
9
	<filter>
10
		<filter-name>springSecurityFilterChain</filter-name>
11
		<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
12
	</filter>
13

  
14
	<filter-mapping>
15
		<filter-name>springSecurityFilterChain</filter-name>
16
		<url-pattern>/*</url-pattern>
17
	</filter-mapping>
18

  
19
	<listener>
20
		<listener-class> org.springframework.web.context.ContextLoaderListener</listener-class>
21
	</listener>
22
	<servlet>
23
		<servlet-name>CXFServlet</servlet-name>
24
		<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
25
		<load-on-startup>1</load-on-startup>
26
	</servlet>
27
	<servlet>
28
		<servlet-name>dispatcher</servlet-name>
29
		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
30
		<load-on-startup>1</load-on-startup>
31
	</servlet>
32
	<servlet-mapping>
33
		<servlet-name>dispatcher</servlet-name>
34
		<url-pattern>/mvc/*</url-pattern>
35
	</servlet-mapping>
36
	<servlet-mapping>
37
		<servlet-name>CXFServlet</servlet-name>
38
		<url-pattern>/services/*</url-pattern>
39
	</servlet-mapping>
40
</web-app>
webapps/dnet-container-provision/trunk/src/main/webapp/index.html
1
if this container runs the IS, you can access the web interface <a href="mvc/inspector">here</a>
webapps/dnet-container-provision/trunk/pom.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
3
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
4
	<parent>
5
		<groupId>eu.dnetlib</groupId>
6
		<artifactId>dnet-container-parent</artifactId>
7
		<version>1.0.0-SNAPSHOT</version>
8
		<relativePath></relativePath>
9
	</parent>
10
	<modelVersion>4.0.0</modelVersion>
11
	<groupId>eu.dnetlib</groupId>
12
	<artifactId>dnet-container-provision</artifactId>
13
	<packaging>war</packaging>
14
	<version>1.0.0-SNAPSHOT</version>
15
	<dependencies>
16

  
17
		<!-- Common components in every container -->
18
		<dependency>
19
			<groupId>eu.dnetlib</groupId>
20
			<artifactId>cnr-log4j-inspector</artifactId>
21
			<version>[1.0.0,2.0.0)</version>
22
		</dependency>
23

  
24
		<!-- Common services in every container -->
25
		<dependency>
26
			<groupId>eu.dnetlib</groupId>
27
			<artifactId>cnr-enabling-hnm-service</artifactId>
28
			<version>[2.0.0,3.0.0)</version>
29
		</dependency>
30
		<dependency>
31
			<groupId>eu.dnetlib</groupId>
32
			<artifactId>cnr-enabling-hcm-service</artifactId>
33
			<version>[2.0.0,3.0.0)</version>
34
		</dependency>
35

  
36
		<dependency>
37
			<groupId>eu.dnetlib</groupId>
38
			<artifactId>cnr-resultset-service</artifactId>
39
			<version>[2.0.0,3.0.0)</version>
40
		</dependency>
41
		<dependency>
42
			<groupId>eu.dnetlib</groupId>
43
			<artifactId>cnr-resultset-inspector</artifactId>
44
			<version>[2.0.0,3.0.0)</version>
45
		</dependency>
46

  
47
		<!-- Vocabulary REST publisher -->
48
		<dependency>
49
			<groupId>eu.dnetlib</groupId>
50
			<artifactId>dnet-vocabulary-publisher</artifactId>
51
			<version>[2.0.0,3.0.0)</version>
52
		</dependency>
53

  
54
		<!-- OAI publisher service -->
55
		<dependency>
56
			<groupId>eu.dnetlib</groupId>
57
			<artifactId>cnr-data-information-oai-publisher</artifactId>
58
			<version>[6.0.0-SNAPSHOT,7.0.0)</version>
59
		</dependency>
60

  
61
		<!-- Inspector security -->
62
		<dependency>
63
			<groupId>eu.dnetlib</groupId>
64
			<artifactId>cnr-inspector-security</artifactId>
65
			<version>[1.0.0,2.0.0)</version>
66
		</dependency>
67
		<dependency>
68
			<groupId>eu.dnetlib</groupId>
69
			<artifactId>dnet-webapp-monitoring</artifactId>
70
			<version>[1.0.0,2.0.0)</version>
71
		</dependency>
72

  
73
		<dependency>
74
			<groupId>xerces</groupId>
75
			<artifactId>xercesImpl</artifactId>
76
			<version>2.11.0</version>
77
			<scope>compile</scope>
78
		</dependency>
79

  
80

  
81
		<!-- Index service -->
82
		<dependency>
83
			<groupId>eu.dnetlib</groupId>
84
			<artifactId>dnet-index-solr-service</artifactId>
85
			<version>[2.4.5-OR-SNAPSHOT]</version>
86
		</dependency>
87

  
88
		<dependency>
89
			<groupId>eu.dnetlib</groupId>
90
			<artifactId>cnr-openaire-exporter</artifactId>
91
			<version>[6.0.0,7.0.0)</version>
92
		</dependency>
93

  
94
		
95
        <dependency>
96
            <groupId>eu.dnetlib</groupId>
97
            <artifactId>dnet-datasource-rest-api</artifactId>
98
            <version>[0.0.1,2.0.0)</version>
99
        </dependency>
100

  
101
		<dependency>
102
			<groupId>javax.servlet</groupId>
103
			<artifactId>javax.servlet-api</artifactId>
104
			<version>${javax.servlet.version}</version>
105
			<scope>provided</scope>
106
		</dependency>
107

  
108
		<!-- SWAGGER -->
109
		<dependency>
110
			<groupId>com.fasterxml.jackson.datatype</groupId>
111
			<artifactId>jackson-datatype-joda</artifactId>
112
			<version>2.6.6</version>
113
		</dependency>
114
		<dependency>
115
			<groupId>joda-time</groupId>
116
			<artifactId>joda-time</artifactId>
117
			<version>2.8.2</version>
118
		</dependency>
119

  
120
		<dependency>
121
			<groupId>io.springfox</groupId>
122
			<artifactId>springfox-swagger2</artifactId>
123
			<version>${springfox-version}</version>
124
		</dependency>
125
		<dependency>
126
			<groupId>io.springfox</groupId>
127
			<artifactId>springfox-swagger-ui</artifactId>
128
			<version>${springfox-version}</version>
129
		</dependency>
130

  
131
		<dependency>
132
			<groupId>org.hibernate</groupId>
133
			<artifactId>hibernate-validator</artifactId>
134
			<version>5.2.4.Final</version>
135
		</dependency>
136

  
137
	</dependencies>
138
	<properties>
139
		<springfox-version>2.5.0</springfox-version>
140
		<dnet.container.context>provision</dnet.container.context>
141
		<dnet.container.port>8980</dnet.container.port>
142
	</properties>
143
</project>
webapps/dnet-container-provision/branches/prod/src/main/resources/META-INF/cxf/org.apache.cxf.Logger
1
org.apache.cxf.common.logging.Log4jLogger
webapps/dnet-container-provision/branches/prod/src/main/resources/eu/dnetlib/cnr-site.properties
1
container.hostname = localhost
2
container.port = 8980
3
container.context = dnet
4
services.registration.delay = 30000
5

  
6
services.is.host=localhost
7
services.is.port=8280
8
services.is.baseurl=http://${services.is.host}:${services.is.port}/is/services
9

  
10
services.is.lookup.url=${services.is.baseurl}/isLookUp
11

  
12
service.index.solr.default.interpretation=openaire
13

  
14
transport.soap.force.local.address=true
15

  
16
service.solr.index.jsonConfiguration= \
17
        {"id":"solr",\
18
        "address":"index1.t.hadoop.research-infrastructures.eu:9983,index2.t.hadoop.research-infrastructures.eu:9983,index3.t.hadoop.research-infrastructures.eu:9983",\
19
        "port":"8983",\
20
        "webContext":"solr",\
21
        "numShards":"1",\
22
        "replicationFactor":"3",\
23
        "host":"index1.t.hadoop.research-infrastructures.eu",\
24
        "feedingShutdownTolerance":"30000",\
25
        "feedingBufferFlushThreshold":"1000",\
26
        "feedingSimulationMode":"false",\
27
        "luceneMatchVersion":"4.9",\
28
        "serverLibPath":"../../../../contrib/extraction/lib",\
29
        "filterCacheSize":"512","filterCacheInitialSize":"512",\
30
        "queryCacheSize":"512","queryCacheInitialSize":"512",\
31
        "documentCacheSize":"512","documentCacheInitialSize":"512",\
32
        "ramBufferSizeMB":"960","mergeFactor":"40",\
33
        "autosoftcommit":"-1","autocommit":"15000",\
34
        "termIndexInterval":"1024","maxIndexingThreads":"8",\
35
        "queryResultWindowSize":"20","queryResultMaxDocCached":"200"}
36
        
37
services.publisher.oai.host=localhost
38
services.publisher.oai.port=27017
39

  
40
dnet.openaire.db.name = dnet_openaireplus_node6_t
webapps/dnet-container-provision/branches/prod/src/main/resources/eu/dnetlib/applicationContext-ehcache.xml
1
<beans xmlns="http://www.springframework.org/schema/beans"
2
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
3
	xmlns:util="http://www.springframework.org/schema/util" xmlns:cache="http://www.springframework.org/schema/cache"
4
	xmlns:jaxws="http://cxf.apache.org/jaxws" xmlns:template="http://dnetlib.eu/springbeans/template"
5
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
6
                        http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
7
	http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd
8
	http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
9

  
10
	<!-- THIS FILE MUST CONTAIN THE CACHEMANAGER DECALRES IN DEPENDENCY MODULES 
11
		THAT MUST BE USED BY THE CONTAINER BECAUSE WE CANNOT HAVE MULTIPLE <cache:annotation-driven> 
12
		IN DIFFERENT MODULES. -->
13
		
14
		<cache:annotation-driven cache-manager="provisionCacheManager" />
15
		
16
		<!-- ADD TO THE ARRAY OF CACHE MANAGERS THE CACHE MANAGER DEFINED IN MODULES" APPLICATION CONTEXTS -->
17
		<bean id="provisionCacheManager" class="org.springframework.cache.support.CompositeCacheManager">
18
    		<property name="cacheManagers">
19
        		<array>
20
            		<ref bean="vocabularyCacheManager" />
21
           	 		<ref bean="theOAICacheManager" />
22
           	 		<ref bean="oaiUtilsCacheManager" />
23
        		</array>
24
    		</property>
25
    		<property name="fallbackToNoOpCache" value="true" />
26
		</bean>
27
</beans>
webapps/dnet-container-provision/branches/prod/src/main/resources/eu/dnetlib/applicationContext-locators.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:jaxws="http://cxf.apache.org/jaxws"
4
	xmlns:sec="http://cxf.apache.org/configuration/security" xmlns:wsa="http://cxf.apache.org/ws/addressing"
5
	xmlns:p="http://www.springframework.org/schema/p" xmlns:http="http://cxf.apache.org/transports/http/configuration"
6
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
7
                        http://cxf.apache.org/ws/addressing http://cxf.apache.org/schemas/ws-addr-conf.xsd
8
                        http://cxf.apache.org/configuration/security http://cxf.apache.org/schemas/configuration/security.xsd
9
                        http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd
10
                        http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
11

  
12
	<!-- common service resolution chain -->
13
	<bean id="serviceResolver" class="eu.dnetlib.enabling.tools.ServiceResolverChain">
14
		<property name="resolvers">
15
			<list>
16
				<bean id="jaxwsServiceResolver" class="eu.dnetlib.enabling.tools.JaxwsServiceResolverImpl" />
17
			</list>
18
		</property>
19
	</bean>
20

  
21
	<bean id="jobScheduler"
22
		class="org.springframework.scheduling.quartz.SchedulerFactoryBean"
23
		destroy-method="destroy">
24
		<property name="jobFactory">
25
			<bean id="jobSchedulerFactory"
26
				class="org.springframework.scheduling.quartz.SpringBeanJobFactory" />
27
		</property>
28
	</bean>
29

  
30
	<jaxws:client id="isLookUpService"
31
		serviceClass="eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService"
32
		address="${services.is.lookup.url}" />
33

  
34
	<bean id="uuidGenerator" class="eu.dnetlib.enabling.tools.UniqueIdentifierGeneratorImpl" />
35

  
36
	<alias name="cxfEndpointReferenceBuilder" alias="eprBuilder" />
37
</beans>
webapps/dnet-container-provision/branches/prod/src/main/resources/log4j.properties
1
### Root Level ###
2
log4j.rootLogger=WARN, LOGFILE
3

  
4
### Configuration for the LOGFILE appender ###
5
log4j.appender.LOGFILE=org.apache.log4j.RollingFileAppender
6
log4j.appender.LOGFILE.MaxFileSize=25MB
7
log4j.appender.LOGFILE.MaxBackupIndex=10
8
log4j.appender.LOGFILE.File=logs/provision/dnet.log
9
log4j.appender.LOGFILE.Append=true
10
log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout
11
log4j.appender.LOGFILE.layout.ConversionPattern=[%-5p] %d %c - %m%n
12

  
13
org.apache.cxf.Logger=org.apache.cxf.common.logging.Log4jLogger
14

  
15
### Application Level ###
16
log4j.logger.eu.dnetlib=INFO
17
log4j.logger.org.apache.cxf.interceptor=FATAL
18
log4j.logger.org.apache.cxf.ws.addressing.ContextUtils=FATAL
19
log4j.logger.eu.dnetlib.xml.database.LoggingTrigger=WARN
20
log4j.logger.eu.dnetlib.enabling.inspector=FATAL
21
log4j.logger.eu.dnetlib.springutils.stringtemplate.StringTemplateViewResolver=FATAL             
22
log4j.logger.eu.dnetlib.enabling.is.sn.SynchronousNotificationSenderImpl=WARN
23
log4j.logger.eu.dnetlib.enabling.tools.LocalServiceResolverImpl=WARN
24
log4j.logger.eu.dnetlib.enabling.is.sn.NotificationInvokerImpl=WARN
25
log4j.logger.org.apache.xerces.parsers.SAXParser=OFF
26
log4j.logger.eu.dnetlib.conf.PropertyFetcher=WARN
27

  
28
### Spring ###
29
log4j.logger.org.springframework=WARN
webapps/dnet-container-provision/branches/prod/src/main/webapp/WEB-INF/cxf.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:cxf="http://cxf.apache.org/core"
4
	xmlns:http="http://cxf.apache.org/transports/http/configuration"
5
	xmlns:wsa="http://cxf.apache.org/ws/addressing" xmlns:p="http://www.springframework.org/schema/p"
6
	xmlns:pol="http://cxf.apache.org/policy" xmlns:condbean="http://dnetlib.eu/springbeans/condbean"
7
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
8
			http://cxf.apache.org/ws/addressing http://cxf.apache.org/schemas/ws-addr-conf.xsd
9
			http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd
10
			http://cxf.apache.org/policy http://cxf.apache.org/schemas/policy.xsd
11
			http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
12
			http://dnetlib.eu/springbeans/condbean http://dnetlib.eu/springbeans/condbean.xsd">
13

  
14
<!-- CXF bus with logging. Please set the log level of org.apache.cxf.interceptor to FATAL to hide the logging of EVERY incoming and outgoing messages. -->
15
	<cxf:bus>
16
		<cxf:outInterceptors>
17
			<ref bean="outCxfLoggingInterceptor" />
18
		</cxf:outInterceptors>
19
		<cxf:inInterceptors>
20
			<ref bean="inCxfLoggingInterceptor" />
21
		</cxf:inInterceptors>
22
	</cxf:bus>
23

  
24
	<bean id="outCxfLoggingInterceptor" class="org.apache.cxf.interceptor.LoggingOutInterceptor" />
25
	<bean id="inCxfLoggingInterceptor" class="org.apache.cxf.interceptor.LoggingInInterceptor" />
26

  
27
	<http:conduit name="*.http-conduit">
28
		<http:client AllowChunking="true" Connection="Keep-Alive" />
29
	</http:conduit>
30
</beans>
webapps/dnet-container-provision/branches/prod/src/main/webapp/WEB-INF/applicationContext.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2

  
3
<beans xmlns="http://www.springframework.org/schema/beans"
4
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
5
	xmlns:context="http://www.springframework.org/schema/context"
6
	xmlns:cxf="http://cxf.apache.org/core"
7
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
8
	http://www.springframework.org/schema/context
9
           http://www.springframework.org/schema/context/spring-context-2.5.xsd
10
           http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd">
11

  
12
	<import resource="classpath:META-INF/cxf/cxf.xml" />
13
	<import resource="classpath:META-INF/cxf/cxf-extension-jaxws.xml" />
14
	<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
15

  
16
	<import resource="classpath*:/eu/dnetlib/**/applicationContext*.xml" />
17

  
18
	<context:annotation-config />
19
	<!-- if the following import is not the last one, something overrides bus 
20
		configuration disabling logging and any other customized feature. -->
21
	<import resource="./cxf.xml" />
22

  
23
</beans>
webapps/dnet-container-provision/branches/prod/src/main/webapp/WEB-INF/dispatcher-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:p="http://www.springframework.org/schema/p"
4
	xmlns:context="http://www.springframework.org/schema/context"
5
	xmlns:mvc="http://www.springframework.org/schema/mvc"
6
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
7
		http://www.springframework.org/schema/context
8
        http://www.springframework.org/schema/context/spring-context.xsd
9
        http://www.springframework.org/schema/mvc
10
        http://www.springframework.org/schema/mvc/spring-mvc.xsd">
11

  
12
	<mvc:annotation-driven />
13

  
14
	<context:component-scan base-package="eu.dnetlib">
15

  
16
	</context:component-scan>
17

  
18
	<import resource="classpath*:/eu/dnetlib/**/webContext*.xml" />
19

  
20
	<bean id="beanHandlerMapping" p:order="1"
21
		class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping" />
22
	
23
	<bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter" />
24
	
25
	<mvc:resources mapping="/resources/**" location="classpath:/eu/dnetlib/web/resources/" />
26

  
27
</beans>
webapps/dnet-container-provision/branches/prod/src/main/webapp/WEB-INF/web.xml
1
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2
	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
3
	version="3.0">
4
	<display-name>DNet-2.0 container web app</display-name>
5
	<context-param>
6
		<param-name>contextConfigLocation</param-name>
7
		<param-value>/WEB-INF/applicationContext.xml</param-value>
8
	</context-param>
9
	<filter>
10
		<filter-name>springSecurityFilterChain</filter-name>
11
		<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
12
	</filter>
13

  
14
	<filter-mapping>
15
		<filter-name>springSecurityFilterChain</filter-name>
16
		<url-pattern>/*</url-pattern>
17
	</filter-mapping>
18

  
19
	<listener>
20
		<listener-class> org.springframework.web.context.ContextLoaderListener</listener-class>
21
	</listener>
22
	<servlet>
23
		<servlet-name>CXFServlet</servlet-name>
24
		<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
25
		<load-on-startup>1</load-on-startup>
26
	</servlet>
27
	<servlet>
28
		<servlet-name>dispatcher</servlet-name>
29
		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
30
		<load-on-startup>1</load-on-startup>
31
	</servlet>
32
	<servlet-mapping>
33
		<servlet-name>dispatcher</servlet-name>
34
		<url-pattern>/mvc/*</url-pattern>
35
	</servlet-mapping>
36
	<servlet-mapping>
37
		<servlet-name>CXFServlet</servlet-name>
38
		<url-pattern>/services/*</url-pattern>
39
	</servlet-mapping>
40
</web-app>
webapps/dnet-container-provision/branches/prod/src/main/webapp/index.html
1
if this container runs the IS, you can access the web interface <a href="mvc/inspector">here</a>
webapps/dnet-container-provision/branches/prod/pom.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
4
	<parent>
5
		<groupId>eu.dnetlib</groupId>
6
		<artifactId>dnet-container-parent</artifactId>
7
		<version>1.0.0</version>
8
		<relativePath></relativePath>
9
	</parent>
10
	<modelVersion>4.0.0</modelVersion>
11
	<groupId>eu.dnetlib</groupId>
12
	<artifactId>dnet-container-provision</artifactId>
13
	<packaging>war</packaging>
14
	<version>2.0.0-PROD-SNAPSHOT</version>
15
	<dependencies>
16

  
17
		<!-- Common components in every container -->
18
		<dependency>
19
			<groupId>eu.dnetlib</groupId>
20
			<artifactId>cnr-log4j-inspector</artifactId>
21
			<version>[1.0.0,2.0.0)</version>
22
		</dependency>
23

  
24
		<!-- Common services in every container -->
25
		<dependency>
26
			<groupId>eu.dnetlib</groupId>
27
			<artifactId>cnr-enabling-hnm-service</artifactId>
28
			<version>[2.0.0,3.0.0)</version>
29
		</dependency>
30
		<dependency>
31
			<groupId>eu.dnetlib</groupId>
32
			<artifactId>cnr-enabling-hcm-service</artifactId>
33
			<version>[2.0.0,3.0.0)</version>
34
		</dependency>
35

  
36
		<dependency>
37
			<groupId>eu.dnetlib</groupId>
38
			<artifactId>cnr-resultset-service</artifactId>
39
			<version>[2.0.0,3.0.0)</version>
40
		</dependency>
41
		<dependency>
42
			<groupId>eu.dnetlib</groupId>
43
			<artifactId>cnr-resultset-inspector</artifactId>
44
			<version>[2.0.0,3.0.0)</version>
45
		</dependency>
46

  
47
		<!-- Vocabulary REST publisher -->
48
		<dependency>
49
			<groupId>eu.dnetlib</groupId>
50
			<artifactId>dnet-vocabulary-publisher</artifactId>
51
			<version>[2.1.0,3.0.0)</version>
52
		</dependency>
53

  
54
		<!-- OAI publisher service -->
55
		<dependency>
56
			<groupId>eu.dnetlib</groupId>
57
			<artifactId>cnr-data-information-oai-publisher</artifactId>
58
			<version>[6.0.0,7.0.0)</version>
59
		</dependency>
60

  
61
		<!-- Inspector security -->
62
		<dependency>
63
			<groupId>eu.dnetlib</groupId>
64
			<artifactId>cnr-inspector-security</artifactId>
65
			<version>[1.0.0,2.0.0)</version>
66
		</dependency>
67
		<dependency>
68
			<groupId>eu.dnetlib</groupId>
69
			<artifactId>dnet-webapp-monitoring</artifactId>
70
			<version>[1.0.0,2.0.0)</version>
71
		</dependency>
72

  
73
		<dependency>
74
			<groupId>xerces</groupId>
75
			<artifactId>xercesImpl</artifactId>
76
			<version>2.11.0</version>
77
			<scope>compile</scope>
78
		</dependency>
79

  
80
		<!-- Index service -->
81
		<dependency>
82
			<groupId>eu.dnetlib</groupId>
83
			<artifactId>dnet-index-solr-service</artifactId>
84
			<version>[2.4.3-OR]</version>
85
		</dependency>
86

  
87
		<dependency>
88
			<groupId>eu.dnetlib</groupId>
89
			<artifactId>cnr-openaire-exporter</artifactId>
90
			<version>[6.0.0,7.0.0)</version>
91
		</dependency>
92

  
93

  
94
	</dependencies>
95
	<properties>
96
		<dnet.container.context>provision</dnet.container.context>
97
		<dnet.container.port>8980</dnet.container.port>
98
	</properties>
99
</project>
webapps/dnet-container-provision/branches/beta/src/main/java/eu/dnetlib/swagger/configuration/SwaggerDocumentationConfig.java
1
package eu.dnetlib.swagger.configuration;
2

  
3
import eu.dnetlib.common.rmi.DNetRestDocumentation;
4
import io.swagger.annotations.Api;
5
import org.springframework.beans.factory.annotation.Value;
6
import org.springframework.context.annotation.Bean;
7
import org.springframework.context.annotation.Configuration;
8
import org.springframework.stereotype.Controller;
9
import org.springframework.web.bind.annotation.RestController;
10
import springfox.documentation.builders.ApiInfoBuilder;
11
import springfox.documentation.builders.PathSelectors;
12
import springfox.documentation.builders.RequestHandlerSelectors;
13
import springfox.documentation.service.ApiInfo;
14
import springfox.documentation.service.Contact;
15
import springfox.documentation.spi.DocumentationType;
16
import springfox.documentation.spring.web.plugins.Docket;
17
import springfox.documentation.swagger2.annotations.EnableSwagger2;
18

  
19
@Configuration
20
@EnableSwagger2
21
public class SwaggerDocumentationConfig {
22

  
23
    @Value("${api.rest.contact.name}")
24
    private String contactName;
25

  
26
    @Value("${api.rest.contact.url}")
27
    private String contactUrl;
28

  
29
    @Value("${api.rest.contact.email}")
30
    private String contactEmail;
31

  
32
	@Value("${api.rest.title}")
33
	private String title;
34

  
35
	@Value("${api.rest.description}")
36
	private String description;
37

  
38
	@Value("${api.rest.license}")
39
	private String license;
40
	@Value("${api.rest.license.url}")
41
	private String licenseUrl;
42

  
43
    @Bean
44
    public Docket customImplementation(){
45
        return new Docket(DocumentationType.SWAGGER_2)
46
                .select()
47
			        //.apis(RequestHandlerSelectors.any())
48
                    //.apis(RequestHandlerSelectors.basePackage("eu.dnetlib.**.controller.*"))
49
		            //.apis(RequestHandlerSelectors.withClassAnnotation(RestController.class))
50
		            .apis(RequestHandlerSelectors.withClassAnnotation(DNetRestDocumentation.class))
51
                    //.paths(PathSelectors.ant("/ds/**"))
52
                    .build()
53
                .directModelSubstitute(org.joda.time.LocalDate.class, java.sql.Date.class)
54
                .directModelSubstitute(org.joda.time.DateTime.class, java.util.Date.class)
55
                .apiInfo(apiInfo());
56
    }
57

  
58
	private ApiInfo apiInfo() {
59
		return new ApiInfoBuilder()
60
				.title(title)
61
				.description(description)
62
				.license(license)
63
				.licenseUrl(licenseUrl)
64
				.termsOfServiceUrl("")
65
				.version("1.0.0")
66
				.contact(new Contact(contactName, contactUrl, contactEmail))
67
				.build();
68
	}
69

  
70
}
webapps/dnet-container-provision/branches/beta/src/main/java/eu/dnetlib/swagger/configuration/RFC3339DateFormat.java
1
package eu.dnetlib.swagger.configuration;
2

  
3
import java.text.FieldPosition;
4
import java.util.Date;
5

  
6
import com.fasterxml.jackson.databind.util.ISO8601DateFormat;
7
import com.fasterxml.jackson.databind.util.ISO8601Utils;
8

  
9
public class RFC3339DateFormat extends ISO8601DateFormat {
10

  
11
  // Same as ISO8601DateFormat but serializing milliseconds.
12
  @Override
13
  public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) {
14
    String value = ISO8601Utils.format(date, true);
15
    toAppendTo.append(value);
16
    return toAppendTo;
17
  }
18

  
19
}
webapps/dnet-container-provision/branches/beta/src/main/java/eu/dnetlib/swagger/configuration/ApiOriginFilter.java
1
package eu.dnetlib.swagger.configuration;
2

  
3
import java.io.IOException;
4
import javax.servlet.*;
5
import javax.servlet.http.HttpServletResponse;
6

  
7
public class ApiOriginFilter implements Filter {
8
	@Override
9
	public void doFilter(ServletRequest request, ServletResponse response,
10
			FilterChain chain) throws IOException, ServletException {
11
		HttpServletResponse res = (HttpServletResponse) response;
12
		res.addHeader("Access-Control-Allow-Origin", "*");
13
		res.addHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT");
14
		res.addHeader("Access-Control-Allow-Headers", "Content-Type");
15
		chain.doFilter(request, response);
16
	}
17

  
18
	@Override
19
	public void destroy() {
20
	}
21

  
22
	@Override
23
	public void init(FilterConfig filterConfig) throws ServletException {
24
	}
25
}
webapps/dnet-container-provision/branches/beta/src/main/java/eu/dnetlib/swagger/configuration/HomeController.java
1
package eu.dnetlib.swagger.configuration;
2

  
3
import org.apache.commons.logging.Log;
4
import org.apache.commons.logging.LogFactory;
5
import org.springframework.stereotype.Controller;
6
import org.springframework.web.bind.annotation.RequestMapping;
7

  
8
/**
9
 * Home redirection to swagger api documentation 
10
 */
11
@Controller
12
public class HomeController {
13

  
14
	@RequestMapping(value = "/docs")
15
	public String index() {
16
		return "redirect:swagger-ui.html";
17
	}
18
}
webapps/dnet-container-provision/branches/beta/src/main/java/eu/dnetlib/swagger/configuration/ApiResponseMessage.java
1
package eu.dnetlib.swagger.configuration;
2

  
3
import javax.xml.bind.annotation.XmlTransient;
4

  
5
@javax.xml.bind.annotation.XmlRootElement
6
public class ApiResponseMessage {
7
	public static final int ERROR = 1;
8
	public static final int WARNING = 2;
9
	public static final int INFO = 3;
10
	public static final int OK = 4;
11
	public static final int TOO_BUSY = 5;
12

  
13
	int code;
14
	String type;
15
	String message;
16
	
17
	public ApiResponseMessage(){}
18
	
19
	public ApiResponseMessage(int code, String message){
20
		this.code = code;
21
		switch(code){
22
		case ERROR:
23
			setType("error");
24
			break;
25
		case WARNING:
26
			setType("warning");
27
			break;
28
		case INFO:
29
			setType("info");
30
			break;
31
		case OK:
32
			setType("ok");
33
			break;
34
		case TOO_BUSY:
35
			setType("too busy");
36
			break;
37
		default:
38
			setType("unknown");
39
			break;
40
		}
41
		this.message = message;
42
	}
43

  
44
	@XmlTransient
45
	public int getCode() {
46
		return code;
47
	}
48

  
49
	public void setCode(int code) {
50
		this.code = code;
51
	}
52

  
53
	public String getType() {
54
		return type;
55
	}
56

  
57
	public void setType(String type) {
58
		this.type = type;
59
	}
60

  
61
	public String getMessage() {
62
		return message;
63
	}
64

  
65
	public void setMessage(String message) {
66
		this.message = message;
67
	}
68
}
webapps/dnet-container-provision/branches/beta/src/main/java/eu/dnetlib/EndpointDocController.java
1
package eu.dnetlib;
2

  
3
import java.util.List;
4
import java.util.Map;
5
import java.util.Map.Entry;
6
import java.util.Set;
7

  
8
import com.google.common.collect.Lists;
9
import com.google.common.collect.Maps;
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff