Project

General

Profile

1
package eu.dnetlib.msro.openaireplus.workflows.nodes.index;
2

    
3
import javax.annotation.Resource;
4

    
5
import org.apache.commons.logging.Log;
6
import org.apache.commons.logging.LogFactory;
7
import org.springframework.beans.factory.annotation.Required;
8

    
9
import com.google.common.base.Joiner;
10

    
11
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpException;
12
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService;
13
import eu.dnetlib.enabling.locators.UniqueServiceLocator;
14
import eu.dnetlib.miscutils.functional.xml.IndentXmlString;
15

    
16
public class ContextLoader {
17

    
18
	/**
19
	 * logger.
20
	 */
21
	private static final Log log = LogFactory.getLog(ContextLoader.class); // NOPMD by marko on 11/24/08 5:02 PM
22

    
23
	private String xquery;
24

    
25
	@Resource
26
	private UniqueServiceLocator serviceLocator;
27

    
28
	public String load() throws ISLookUpException {
29

    
30
		log.info("loading ContextDSResources: " + getXquery());
31

    
32
		StringBuilder sb = new StringBuilder("<ContextDSResources>");
33
		Joiner.on("").appendTo(sb, serviceLocator.getService(ISLookUpService.class).quickSearchProfile(getXquery()));
34
		sb.append("</ContextDSResources>");
35

    
36
		log.debug("got ContextDSResources: \n" + IndentXmlString.apply(sb.toString()));
37

    
38
		return sb.toString();
39
	}
40

    
41
	public String getXquery() {
42
		return xquery;
43
	}
44

    
45
	@Required
46
	public void setXquery(final String xquery) {
47
		this.xquery = xquery;
48
	}
49

    
50
}
(1-1/6)