Revision 36368
Added by Michele Artini about 9 years ago
modules/dnet-node-services/trunk/src/main/java/eu/dnetlib/enabling/resultSetManager/ResultSetFactory.java | ||
---|---|---|
1 |
package eu.dnetlib.enabling.resultSetManager; |
|
2 |
|
|
3 |
import org.springframework.beans.factory.annotation.Required; |
|
4 |
|
|
5 |
import eu.dnetlib.rmi.objects.resultSet.ResultSet; |
|
6 |
|
|
7 |
public class ResultSetFactory { |
|
8 |
|
|
9 |
private ResultSetServiceImpl service; |
|
10 |
|
|
11 |
private ResultSetRegistry registry; |
|
12 |
|
|
13 |
public <T> ResultSet<T> createResultSet(final ResultSetIterator<T> iter) { |
|
14 |
final String rsId = registry.registerIterator(iter); |
|
15 |
final String protocol = service.getMainProtocol(); |
|
16 |
return new ResultSet<T>(rsId, protocol, service.getProtocols().get(protocol)); |
|
17 |
} |
|
18 |
|
|
19 |
public ResultSetServiceImpl getService() { |
|
20 |
return service; |
|
21 |
} |
|
22 |
|
|
23 |
@Required |
|
24 |
public void setService(final ResultSetServiceImpl service) { |
|
25 |
this.service = service; |
|
26 |
} |
|
27 |
|
|
28 |
public ResultSetRegistry getRegistry() { |
|
29 |
return registry; |
|
30 |
} |
|
31 |
|
|
32 |
@Required |
|
33 |
public void setRegistry(final ResultSetRegistry registry) { |
|
34 |
this.registry = registry; |
|
35 |
} |
|
36 |
} |
modules/dnet-node-services/trunk/src/main/java/eu/dnetlib/enabling/resultSetManager/ResultSetRegistry.java | ||
---|---|---|
1 |
package eu.dnetlib.enabling.resultSetManager; |
|
2 |
|
|
3 |
import java.util.UUID; |
|
4 |
|
|
5 |
import javax.annotation.PostConstruct; |
|
6 |
|
|
7 |
import org.apache.commons.logging.Log; |
|
8 |
import org.apache.commons.logging.LogFactory; |
|
9 |
import org.springframework.beans.factory.annotation.Required; |
|
10 |
|
|
11 |
import com.google.common.cache.Cache; |
|
12 |
import com.google.common.cache.CacheBuilder; |
|
13 |
import com.google.common.cache.RemovalListener; |
|
14 |
import com.google.common.cache.RemovalNotification; |
|
15 |
|
|
16 |
import eu.dnetlib.rmi.soap.exceptions.ResultSetException; |
|
17 |
|
|
18 |
public class ResultSetRegistry { |
|
19 |
|
|
20 |
private static final Log log = LogFactory.getLog(ResultSetRegistry.class); |
|
21 |
|
|
22 |
private CacheBuilder<String, ResultSetIterator<?>> cacheBuilder; |
|
23 |
private Cache<String, ResultSetIterator<?>> cache; |
|
24 |
|
|
25 |
@PostConstruct |
|
26 |
public void initCache() { |
|
27 |
cache = cacheBuilder.removalListener(new RemovalListener<String, ResultSetIterator<?>>() { |
|
28 |
|
|
29 |
@Override |
|
30 |
public void onRemoval(final RemovalNotification<String, ResultSetIterator<?>> notification) { |
|
31 |
log.info("Deleting old resultset: " + notification.getKey() + " - finished: " + notification.getValue().isFinished()); |
|
32 |
} |
|
33 |
}).build(); |
|
34 |
} |
|
35 |
|
|
36 |
public ResultSetIterator<?> findIterator(final String rsId) throws ResultSetException { |
|
37 |
|
|
38 |
final ResultSetIterator<?> iter = cache.getIfPresent(rsId); |
|
39 |
if (iter != null) { |
|
40 |
return iter; |
|
41 |
} else { |
|
42 |
log.error("Resultset not found, id = " + rsId); |
|
43 |
throw new ResultSetException("ResultSet not found, id = " + rsId); |
|
44 |
} |
|
45 |
} |
|
46 |
|
|
47 |
public String registerIterator(final ResultSetIterator<?> iter) { |
|
48 |
final String rsId = "rs-" + UUID.randomUUID(); |
|
49 |
|
|
50 |
cache.put(rsId, iter); |
|
51 |
|
|
52 |
return rsId; |
|
53 |
} |
|
54 |
|
|
55 |
public CacheBuilder<String, ResultSetIterator<?>> getCacheBuilder() { |
|
56 |
return cacheBuilder; |
|
57 |
} |
|
58 |
|
|
59 |
@Required |
|
60 |
public void setCacheBuilder(final CacheBuilder<String, ResultSetIterator<?>> cacheBuilder) { |
|
61 |
this.cacheBuilder = cacheBuilder; |
|
62 |
} |
|
63 |
|
|
64 |
} |
modules/dnet-node-services/trunk/src/main/java/eu/dnetlib/enabling/resultSetManager/ResultSetIterator.java | ||
---|---|---|
1 |
package eu.dnetlib.enabling.resultSetManager; |
|
2 |
|
|
3 |
import java.util.List; |
|
4 |
|
|
5 |
public interface ResultSetIterator<T> { |
|
6 |
|
|
7 |
int position(); |
|
8 |
|
|
9 |
boolean isFinished(); |
|
10 |
|
|
11 |
int getTotal(); |
|
12 |
|
|
13 |
List<T> getNextElements(int n); |
|
14 |
|
|
15 |
} |
modules/dnet-node-services/trunk/src/main/java/eu/dnetlib/enabling/resultSetManager/ResultSetServiceCore.java | ||
---|---|---|
1 |
package eu.dnetlib.enabling.resultSetManager; |
|
2 |
|
|
3 |
import java.util.List; |
|
4 |
|
|
5 |
import org.springframework.beans.factory.annotation.Required; |
|
6 |
import org.springframework.web.bind.annotation.PathVariable; |
|
7 |
|
|
8 |
import com.google.common.collect.Lists; |
|
9 |
import com.google.gson.Gson; |
|
10 |
|
|
11 |
import eu.dnetlib.rmi.objects.resultSet.ResultSetResponse; |
|
12 |
import eu.dnetlib.rmi.soap.exceptions.ResultSetException; |
|
13 |
|
|
14 |
public class ResultSetServiceCore { |
|
15 |
|
|
16 |
private ResultSetRegistry registry; |
|
17 |
|
|
18 |
public ResultSetResponse getNextResults(@PathVariable final String rsId, @PathVariable final int n) throws ResultSetException { |
|
19 |
final ResultSetIterator<?> iter = registry.findIterator(rsId); |
|
20 |
|
|
21 |
final int from = iter.position(); |
|
22 |
final Gson gson = new Gson(); |
|
23 |
|
|
24 |
final List<String> elements = Lists.newArrayList(); |
|
25 |
for (Object o : iter.getNextElements(n)) { |
|
26 |
elements.add(gson.toJson(o)); |
|
27 |
} |
|
28 |
|
|
29 |
final int to = iter.position(); |
|
30 |
final boolean end = iter.isFinished(); |
|
31 |
final int total = iter.getTotal(); |
|
32 |
|
|
33 |
return new ResultSetResponse(from, to, end, total, elements); |
|
34 |
} |
|
35 |
|
|
36 |
public ResultSetRegistry getRegistry() { |
|
37 |
return registry; |
|
38 |
} |
|
39 |
|
|
40 |
@Required |
|
41 |
public void setRegistry(final ResultSetRegistry registry) { |
|
42 |
this.registry = registry; |
|
43 |
} |
|
44 |
} |
modules/dnet-node-services/trunk/src/main/java/eu/dnetlib/enabling/resultSetManager/ResultSetRestController.java | ||
---|---|---|
1 |
package eu.dnetlib.enabling.resultSetManager; |
|
2 |
|
|
3 |
import javax.annotation.Resource; |
|
4 |
|
|
5 |
import org.springframework.web.bind.annotation.PathVariable; |
|
6 |
import org.springframework.web.bind.annotation.RequestMapping; |
|
7 |
import org.springframework.web.bind.annotation.RequestMethod; |
|
8 |
import org.springframework.web.bind.annotation.RestController; |
|
9 |
|
|
10 |
import eu.dnetlib.rmi.objects.resultSet.ResultSetResponse; |
|
11 |
import eu.dnetlib.rmi.rest.ResultSetService; |
|
12 |
import eu.dnetlib.rmi.soap.exceptions.ResultSetException; |
|
13 |
|
|
14 |
@RestController |
|
15 |
@RequestMapping("/rest/rs") |
|
16 |
public class ResultSetRestController implements ResultSetService { |
|
17 |
|
|
18 |
@Resource |
|
19 |
private ResultSetServiceCore core; |
|
20 |
|
|
21 |
@Override |
|
22 |
@RequestMapping(value = "/{rsId}/{n}", method = RequestMethod.GET) |
|
23 |
public ResultSetResponse getNextResults(@PathVariable final String rsId, @PathVariable final int n) throws ResultSetException { |
|
24 |
return core.getNextResults(rsId, n); |
|
25 |
} |
|
26 |
} |
modules/dnet-node-services/trunk/src/main/java/eu/dnetlib/enabling/resultSetManager/ResultSetServiceImpl.java | ||
---|---|---|
1 |
package eu.dnetlib.enabling.resultSetManager; |
|
2 |
|
|
3 |
import org.springframework.beans.factory.annotation.Required; |
|
4 |
|
|
5 |
import eu.dnetlib.common.services.AbstractBaseService; |
|
6 |
import eu.dnetlib.rmi.objects.resultSet.ResultSetResponse; |
|
7 |
import eu.dnetlib.rmi.soap.ResultSetService; |
|
8 |
import eu.dnetlib.rmi.soap.exceptions.ResultSetException; |
|
9 |
|
|
10 |
public class ResultSetServiceImpl extends AbstractBaseService implements ResultSetService { |
|
11 |
|
|
12 |
private ResultSetServiceCore core; |
|
13 |
|
|
14 |
@Override |
|
15 |
public ResultSetResponse getNextResults(final String rsId, final int n) throws ResultSetException { |
|
16 |
return core.getNextResults(rsId, n); |
|
17 |
} |
|
18 |
|
|
19 |
public ResultSetServiceCore getCore() { |
|
20 |
return core; |
|
21 |
} |
|
22 |
|
|
23 |
@Required |
|
24 |
public void setCore(final ResultSetServiceCore core) { |
|
25 |
this.core = core; |
|
26 |
} |
|
27 |
|
|
28 |
} |
modules/dnet-node-services/trunk/src/main/java/eu/dnetlib/enabling/test/TestServiceImpl.java | ||
---|---|---|
3 | 3 |
import org.springframework.beans.factory.annotation.Required; |
4 | 4 |
|
5 | 5 |
import eu.dnetlib.common.services.AbstractBaseService; |
6 |
import eu.dnetlib.enabling.resultSetManager.ResultSetFactory;
|
|
6 |
import eu.dnetlib.data.resultSet.ResultSetFactory;
|
|
7 | 7 |
import eu.dnetlib.rmi.objects.dsmanager.BrowsableField; |
8 | 8 |
import eu.dnetlib.rmi.objects.resultSet.ResultSet; |
9 | 9 |
import eu.dnetlib.rmi.soap.TestService; |
modules/dnet-node-services/trunk/src/main/java/eu/dnetlib/enabling/test/SampleResultSetIterator.java | ||
---|---|---|
4 | 4 |
|
5 | 5 |
import com.google.common.collect.Lists; |
6 | 6 |
|
7 |
import eu.dnetlib.enabling.resultSetManager.ResultSetIterator;
|
|
7 |
import eu.dnetlib.data.resultSet.ResultSetIterator;
|
|
8 | 8 |
import eu.dnetlib.rmi.objects.dsmanager.BrowsableField; |
9 | 9 |
|
10 | 10 |
public class SampleResultSetIterator implements ResultSetIterator<BrowsableField> { |
modules/dnet-node-services/trunk/src/main/java/eu/dnetlib/data/resultSet/ResultSetFactory.java | ||
---|---|---|
1 |
package eu.dnetlib.data.resultSet; |
|
2 |
|
|
3 |
import org.springframework.beans.factory.annotation.Required; |
|
4 |
import org.springframework.core.io.Resource; |
|
5 |
|
|
6 |
import com.google.common.base.Function; |
|
7 |
|
|
8 |
import eu.dnetlib.enabling.datastructures.CleaningRule; |
|
9 |
import eu.dnetlib.enabling.datastructures.TransformationRule; |
|
10 |
import eu.dnetlib.miscutils.ApplyXslt; |
|
11 |
import eu.dnetlib.rmi.objects.resultSet.ResultSet; |
|
12 |
|
|
13 |
public class ResultSetFactory { |
|
14 |
|
|
15 |
private ResultSetServiceImpl service; |
|
16 |
|
|
17 |
private ResultSetRegistry registry; |
|
18 |
|
|
19 |
public <T> ResultSet<T> createResultSet(final ResultSetIterator<T> iter) { |
|
20 |
final String rsId = registry.registerIterator(iter); |
|
21 |
final String protocol = service.getMainProtocol(); |
|
22 |
return new ResultSet<T>(rsId, protocol, service.getProtocols().get(protocol)); |
|
23 |
} |
|
24 |
|
|
25 |
public <T, K> ResultSet<T> transform(final ResultSet<K> rs, final Function<K, T> function) { |
|
26 |
// TODO |
|
27 |
return null; |
|
28 |
} |
|
29 |
|
|
30 |
public ResultSet<String> transform(final ResultSet<String> rs, final String ruleId) { |
|
31 |
// TODO |
|
32 |
return null; |
|
33 |
} |
|
34 |
|
|
35 |
public ResultSet<String> transform(final ResultSet<String> rs, final TransformationRule rule) { |
|
36 |
// TODO |
|
37 |
return null; |
|
38 |
} |
|
39 |
|
|
40 |
public ResultSet<String> applyXslt(final ResultSet<String> rs, final String xslt) { |
|
41 |
return transform(rs, new ApplyXslt(xslt)); |
|
42 |
} |
|
43 |
|
|
44 |
public ResultSet<String> applyXslt(final ResultSet<String> rs, final Resource xslt) { |
|
45 |
return transform(rs, new ApplyXslt(xslt)); |
|
46 |
} |
|
47 |
|
|
48 |
public ResultSet<String> clean(final ResultSet<String> rs, final String ruleId) { |
|
49 |
// TODO |
|
50 |
return null; |
|
51 |
} |
|
52 |
|
|
53 |
public ResultSet<String> clean(final ResultSet<String> rs, final CleaningRule rule) { |
|
54 |
// TODO |
|
55 |
return null; |
|
56 |
} |
|
57 |
|
|
58 |
public ResultSetServiceImpl getService() { |
|
59 |
return service; |
|
60 |
} |
|
61 |
|
|
62 |
@Required |
|
63 |
public void setService(final ResultSetServiceImpl service) { |
|
64 |
this.service = service; |
|
65 |
} |
|
66 |
|
|
67 |
public ResultSetRegistry getRegistry() { |
|
68 |
return registry; |
|
69 |
} |
|
70 |
|
|
71 |
@Required |
|
72 |
public void setRegistry(final ResultSetRegistry registry) { |
|
73 |
this.registry = registry; |
|
74 |
} |
|
75 |
} |
modules/dnet-node-services/trunk/src/main/java/eu/dnetlib/data/resultSet/ResultSetRegistry.java | ||
---|---|---|
1 |
package eu.dnetlib.data.resultSet; |
|
2 |
|
|
3 |
import java.util.UUID; |
|
4 |
|
|
5 |
import javax.annotation.PostConstruct; |
|
6 |
|
|
7 |
import org.apache.commons.logging.Log; |
|
8 |
import org.apache.commons.logging.LogFactory; |
|
9 |
import org.springframework.beans.factory.annotation.Required; |
|
10 |
|
|
11 |
import com.google.common.cache.Cache; |
|
12 |
import com.google.common.cache.CacheBuilder; |
|
13 |
import com.google.common.cache.RemovalListener; |
|
14 |
import com.google.common.cache.RemovalNotification; |
|
15 |
|
|
16 |
import eu.dnetlib.rmi.soap.exceptions.ResultSetException; |
|
17 |
|
|
18 |
public class ResultSetRegistry { |
|
19 |
|
|
20 |
private static final Log log = LogFactory.getLog(ResultSetRegistry.class); |
|
21 |
|
|
22 |
private CacheBuilder<String, ResultSetIterator<?>> cacheBuilder; |
|
23 |
private Cache<String, ResultSetIterator<?>> cache; |
|
24 |
|
|
25 |
@PostConstruct |
|
26 |
public void initCache() { |
|
27 |
cache = cacheBuilder.removalListener(new RemovalListener<String, ResultSetIterator<?>>() { |
|
28 |
|
|
29 |
@Override |
|
30 |
public void onRemoval(final RemovalNotification<String, ResultSetIterator<?>> notification) { |
|
31 |
log.info("Deleting old resultset: " + notification.getKey() + " - finished: " + notification.getValue().isFinished()); |
|
32 |
} |
|
33 |
}).build(); |
|
34 |
} |
|
35 |
|
|
36 |
public ResultSetIterator<?> findIterator(final String rsId) throws ResultSetException { |
|
37 |
|
|
38 |
final ResultSetIterator<?> iter = cache.getIfPresent(rsId); |
|
39 |
if (iter != null) { |
|
40 |
return iter; |
|
41 |
} else { |
|
42 |
log.error("Resultset not found, id = " + rsId); |
|
43 |
throw new ResultSetException("ResultSet not found, id = " + rsId); |
|
44 |
} |
|
45 |
} |
|
46 |
|
|
47 |
public String registerIterator(final ResultSetIterator<?> iter) { |
|
48 |
final String rsId = "rs-" + UUID.randomUUID(); |
|
49 |
|
|
50 |
cache.put(rsId, iter); |
|
51 |
|
|
52 |
return rsId; |
|
53 |
} |
|
54 |
|
|
55 |
public CacheBuilder<String, ResultSetIterator<?>> getCacheBuilder() { |
|
56 |
return cacheBuilder; |
|
57 |
} |
|
58 |
|
|
59 |
@Required |
|
60 |
public void setCacheBuilder(final CacheBuilder<String, ResultSetIterator<?>> cacheBuilder) { |
|
61 |
this.cacheBuilder = cacheBuilder; |
|
62 |
} |
|
63 |
|
|
64 |
} |
modules/dnet-node-services/trunk/src/main/java/eu/dnetlib/data/resultSet/ResultSetIterator.java | ||
---|---|---|
1 |
package eu.dnetlib.data.resultSet; |
|
2 |
|
|
3 |
import java.util.List; |
|
4 |
|
|
5 |
public interface ResultSetIterator<T> { |
|
6 |
|
|
7 |
int position(); |
|
8 |
|
|
9 |
boolean isFinished(); |
|
10 |
|
|
11 |
int getTotal(); |
|
12 |
|
|
13 |
List<T> getNextElements(int n); |
|
14 |
|
|
15 |
} |
modules/dnet-node-services/trunk/src/main/java/eu/dnetlib/data/resultSet/ResultSetServiceCore.java | ||
---|---|---|
1 |
package eu.dnetlib.data.resultSet; |
|
2 |
|
|
3 |
import java.util.List; |
|
4 |
|
|
5 |
import org.springframework.beans.factory.annotation.Required; |
|
6 |
import org.springframework.web.bind.annotation.PathVariable; |
|
7 |
|
|
8 |
import com.google.common.collect.Lists; |
|
9 |
import com.google.gson.Gson; |
|
10 |
|
|
11 |
import eu.dnetlib.rmi.objects.resultSet.ResultSetResponse; |
|
12 |
import eu.dnetlib.rmi.soap.exceptions.ResultSetException; |
|
13 |
|
|
14 |
public class ResultSetServiceCore { |
|
15 |
|
|
16 |
private ResultSetRegistry registry; |
|
17 |
|
|
18 |
public ResultSetResponse getNextResults(@PathVariable final String rsId, @PathVariable final int n) throws ResultSetException { |
|
19 |
final ResultSetIterator<?> iter = registry.findIterator(rsId); |
|
20 |
|
|
21 |
final int from = iter.position(); |
|
22 |
final Gson gson = new Gson(); |
|
23 |
|
|
24 |
final List<String> elements = Lists.newArrayList(); |
|
25 |
for (Object o : iter.getNextElements(n)) { |
|
26 |
elements.add(gson.toJson(o)); |
|
27 |
} |
|
28 |
|
|
29 |
final int to = iter.position(); |
|
30 |
final boolean end = iter.isFinished(); |
|
31 |
final int total = iter.getTotal(); |
|
32 |
|
|
33 |
return new ResultSetResponse(from, to, end, total, elements); |
|
34 |
} |
|
35 |
|
|
36 |
public ResultSetRegistry getRegistry() { |
|
37 |
return registry; |
|
38 |
} |
|
39 |
|
|
40 |
@Required |
|
41 |
public void setRegistry(final ResultSetRegistry registry) { |
|
42 |
this.registry = registry; |
|
43 |
} |
|
44 |
} |
modules/dnet-node-services/trunk/src/main/java/eu/dnetlib/data/resultSet/ResultSetRestController.java | ||
---|---|---|
1 |
package eu.dnetlib.data.resultSet; |
|
2 |
|
|
3 |
import javax.annotation.Resource; |
|
4 |
|
|
5 |
import org.springframework.web.bind.annotation.PathVariable; |
|
6 |
import org.springframework.web.bind.annotation.RequestMapping; |
|
7 |
import org.springframework.web.bind.annotation.RequestMethod; |
|
8 |
import org.springframework.web.bind.annotation.RestController; |
|
9 |
|
|
10 |
import eu.dnetlib.rmi.objects.resultSet.ResultSetResponse; |
|
11 |
import eu.dnetlib.rmi.rest.ResultSetService; |
|
12 |
import eu.dnetlib.rmi.soap.exceptions.ResultSetException; |
|
13 |
|
|
14 |
@RestController |
|
15 |
@RequestMapping("/rest/rs") |
|
16 |
public class ResultSetRestController implements ResultSetService { |
|
17 |
|
|
18 |
@Resource |
|
19 |
private ResultSetServiceCore core; |
|
20 |
|
|
21 |
@Override |
|
22 |
@RequestMapping(value = "/{rsId}/{n}", method = RequestMethod.GET) |
|
23 |
public ResultSetResponse getNextResults(@PathVariable final String rsId, @PathVariable final int n) throws ResultSetException { |
|
24 |
return core.getNextResults(rsId, n); |
|
25 |
} |
|
26 |
} |
modules/dnet-node-services/trunk/src/main/java/eu/dnetlib/data/resultSet/ResultSetServiceImpl.java | ||
---|---|---|
1 |
package eu.dnetlib.data.resultSet; |
|
2 |
|
|
3 |
import org.springframework.beans.factory.annotation.Required; |
|
4 |
|
|
5 |
import eu.dnetlib.common.services.AbstractBaseService; |
|
6 |
import eu.dnetlib.rmi.objects.resultSet.ResultSetResponse; |
|
7 |
import eu.dnetlib.rmi.soap.ResultSetService; |
|
8 |
import eu.dnetlib.rmi.soap.exceptions.ResultSetException; |
|
9 |
|
|
10 |
public class ResultSetServiceImpl extends AbstractBaseService implements ResultSetService { |
|
11 |
|
|
12 |
private ResultSetServiceCore core; |
|
13 |
|
|
14 |
@Override |
|
15 |
public ResultSetResponse getNextResults(final String rsId, final int n) throws ResultSetException { |
|
16 |
return core.getNextResults(rsId, n); |
|
17 |
} |
|
18 |
|
|
19 |
public ResultSetServiceCore getCore() { |
|
20 |
return core; |
|
21 |
} |
|
22 |
|
|
23 |
@Required |
|
24 |
public void setCore(final ResultSetServiceCore core) { |
|
25 |
this.core = core; |
|
26 |
} |
|
27 |
|
|
28 |
} |
modules/dnet-node-services/trunk/src/main/resources/eu/dnetlib/enabling/resultSetManager/applicationContext-resultSet-service.properties | ||
---|---|---|
1 |
dnet.resultsets.cache.conf = maximumSize=300, expireAfterAccess=10m, expireAfterWrite=1h |
modules/dnet-node-services/trunk/src/main/resources/eu/dnetlib/enabling/resultSetManager/applicationContext-resultSet-service.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 |
xmlns:t="http://dnetlib.eu/springbeans/t" xmlns:template="http://dnetlib.eu/springbeans/template" |
|
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/configuration/security http://cxf.apache.org/schemas/configuration/security.xsd |
|
10 |
http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd |
|
11 |
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd |
|
12 |
http://dnetlib.eu/springbeans/template http://dnetlib.eu/springbeans/template.xsd"> |
|
13 |
|
|
14 |
<!-- service beans --> |
|
15 |
<bean id="newResultSetService" |
|
16 |
class="eu.dnetlib.enabling.resultSetManager.ResultSetServiceImpl" |
|
17 |
p:core-ref="newResultSetCore" |
|
18 |
p:mainProtocol="REST"> |
|
19 |
<property name="protocols"> |
|
20 |
<map> |
|
21 |
<entry key="SOAP" value="http://${container.hostname}:${container.port}/${container.context}/services/rs"/> |
|
22 |
<entry key="REST" value="http://${container.hostname}:${container.port}/${container.context}/mvc/rest/rs"/> |
|
23 |
</map> |
|
24 |
</property> |
|
25 |
</bean> |
|
26 |
|
|
27 |
<!-- endpoints --> |
|
28 |
<jaxws:endpoint id="newResultSetServiceEndpoint" implementor="#newResultSetService" |
|
29 |
implementorClass="eu.dnetlib.rmi.soap.ResultSetService" |
|
30 |
address="/rs" /> |
|
31 |
|
|
32 |
<!-- Other beans --> |
|
33 |
<bean id="newResultSetCore" |
|
34 |
class="eu.dnetlib.enabling.resultSetManager.ResultSetServiceCore" |
|
35 |
p:registry-ref="newResultSetRegistry" /> |
|
36 |
|
|
37 |
<bean id="newResultSetRegistry" |
|
38 |
class="eu.dnetlib.enabling.resultSetManager.ResultSetRegistry"> |
|
39 |
<property name="cacheBuilder"> |
|
40 |
<bean class="com.google.common.cache.CacheBuilder" factory-method="from"> |
|
41 |
<constructor-arg value="${dnet.resultsets.cache.conf}" /> |
|
42 |
</bean> |
|
43 |
</property> |
|
44 |
</bean> |
|
45 |
|
|
46 |
<bean id="newResultSetFactory" |
|
47 |
class="eu.dnetlib.enabling.resultSetManager.ResultSetFactory" |
|
48 |
p:registry-ref="newResultSetRegistry" |
|
49 |
p:service-ref="newResultSetService" /> |
|
50 |
|
|
51 |
</beans> |
modules/dnet-node-services/trunk/src/main/resources/eu/dnetlib/data/resultSet/applicationContext-resultSet-service.properties | ||
---|---|---|
1 |
dnet.resultsets.cache.conf = maximumSize=300, expireAfterAccess=10m, expireAfterWrite=1h |
modules/dnet-node-services/trunk/src/main/resources/eu/dnetlib/data/resultSet/applicationContext-resultSet-service.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 |
xmlns:t="http://dnetlib.eu/springbeans/t" xmlns:template="http://dnetlib.eu/springbeans/template" |
|
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/configuration/security http://cxf.apache.org/schemas/configuration/security.xsd |
|
10 |
http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd |
|
11 |
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd |
|
12 |
http://dnetlib.eu/springbeans/template http://dnetlib.eu/springbeans/template.xsd"> |
|
13 |
|
|
14 |
<!-- service beans --> |
|
15 |
<bean id="newResultSetService" |
|
16 |
class="eu.dnetlib.data.resultSet.ResultSetServiceImpl" |
|
17 |
p:core-ref="newResultSetCore" |
|
18 |
p:mainProtocol="REST"> |
|
19 |
<property name="protocols"> |
|
20 |
<map> |
|
21 |
<entry key="SOAP" value="http://${container.hostname}:${container.port}/${container.context}/services/rs"/> |
|
22 |
<entry key="REST" value="http://${container.hostname}:${container.port}/${container.context}/mvc/rest/rs"/> |
|
23 |
</map> |
|
24 |
</property> |
|
25 |
</bean> |
|
26 |
|
|
27 |
<!-- endpoints --> |
|
28 |
<jaxws:endpoint id="newResultSetServiceEndpoint" implementor="#newResultSetService" |
|
29 |
implementorClass="eu.dnetlib.rmi.soap.ResultSetService" |
|
30 |
address="/rs" /> |
|
31 |
|
|
32 |
<!-- Other beans --> |
|
33 |
<bean id="newResultSetCore" |
|
34 |
class="eu.dnetlib.data.resultSet.ResultSetServiceCore" |
|
35 |
p:registry-ref="newResultSetRegistry" /> |
|
36 |
|
|
37 |
<bean id="newResultSetRegistry" |
|
38 |
class="eu.dnetlib.data.resultSet.ResultSetRegistry"> |
|
39 |
<property name="cacheBuilder"> |
|
40 |
<bean class="com.google.common.cache.CacheBuilder" factory-method="from"> |
|
41 |
<constructor-arg value="${dnet.resultsets.cache.conf}" /> |
|
42 |
</bean> |
|
43 |
</property> |
|
44 |
</bean> |
|
45 |
|
|
46 |
<bean id="newResultSetFactory" |
|
47 |
class="eu.dnetlib.data.resultSet.ResultSetFactory" |
|
48 |
p:registry-ref="newResultSetRegistry" |
|
49 |
p:service-ref="newResultSetService" /> |
|
50 |
|
|
51 |
</beans> |
modules/dnet-node-services/trunk/.springBeans | ||
---|---|---|
7 | 7 |
</configSuffixes> |
8 | 8 |
<enableImports><![CDATA[false]]></enableImports> |
9 | 9 |
<configs> |
10 |
<config>src/main/resources/eu/dnetlib/enabling/resultSetManager/applicationContext-resultSet-service.xml</config>
|
|
10 |
<config>src/main/resources/eu/dnetlib/data/resultSet/applicationContext-resultSet-service.xml</config>
|
|
11 | 11 |
</configs> |
12 | 12 |
<autoconfigs> |
13 | 13 |
</autoconfigs> |
Also available in: Unified diff
move resultSetService ii eu/dnetlib/data