1
|
package eu.dnetlib.msro.workflows.nodes.index;
|
2
|
|
3
|
import javax.annotation.Resource;
|
4
|
|
5
|
import com.google.common.base.Joiner;
|
6
|
import eu.dnetlib.enabling.locators.UniqueServiceLocator;
|
7
|
import eu.dnetlib.miscutils.functional.xml.XMLIndenter;
|
8
|
import eu.dnetlib.rmi.enabling.ISLookUpException;
|
9
|
import eu.dnetlib.rmi.enabling.ISLookUpService;
|
10
|
import org.apache.commons.logging.Log;
|
11
|
import org.apache.commons.logging.LogFactory;
|
12
|
import org.springframework.beans.factory.annotation.Required;
|
13
|
|
14
|
public class ContextLoader {
|
15
|
|
16
|
/**
|
17
|
* logger.
|
18
|
*/
|
19
|
private static final Log log = LogFactory.getLog(ContextLoader.class); // NOPMD by marko on 11/24/08 5:02 PM
|
20
|
|
21
|
private String xquery;
|
22
|
|
23
|
@Resource
|
24
|
private UniqueServiceLocator serviceLocator;
|
25
|
|
26
|
public String load() throws ISLookUpException {
|
27
|
|
28
|
log.info("loading ContextDSResources: " + getXquery());
|
29
|
|
30
|
final StringBuilder sb = new StringBuilder("<ContextDSResources>");
|
31
|
Joiner.on("").appendTo(sb, this.serviceLocator.getService(ISLookUpService.class).quickSearchProfile(getXquery()));
|
32
|
sb.append("</ContextDSResources>");
|
33
|
|
34
|
log.debug("got ContextDSResources: \n" + XMLIndenter.indent(sb.toString()));
|
35
|
|
36
|
return sb.toString();
|
37
|
}
|
38
|
|
39
|
public String getXquery() {
|
40
|
return this.xquery;
|
41
|
}
|
42
|
|
43
|
@Required
|
44
|
public void setXquery(final String xquery) {
|
45
|
this.xquery = xquery;
|
46
|
}
|
47
|
|
48
|
}
|