01: /**
02: *
03: */package nl.hippo.cms.wizard.resources;
04:
05: import nl.hippo.cms.wizard.WizardResult;
06:
07: import org.apache.cocoon.components.modules.input.InputModule;
08: import org.springframework.web.context.WebApplicationContext;
09: import org.apache.avalon.framework.service.ServiceManager;
10: import org.apache.avalon.framework.service.WrapperServiceSelector;
11:
12: /**
13: * @author a.bogaart@hippo.nl
14: *
15: */
16: public class HippoResource extends AbstractResource {
17:
18: public static final String TYPE = "hippo";
19:
20: //@Override
21: public void fillResult(WizardResult result,
22: WebApplicationContext context) throws Exception {
23: super .fillResult(result, context);
24:
25: ServiceManager manager = (ServiceManager) context
26: .getBean("serviceManager");
27: WrapperServiceSelector selector = (WrapperServiceSelector) manager
28: .lookup(InputModule.ROLE + "Selector");
29: InputModule model = (InputModule) selector.select("model");
30:
31: String sourceURI = (String) model.getAttribute(
32: "/types/resources/resource[@name='" + result.getType()
33: + "']/template", null, null);
34: if (sourceURI != null)
35: result.setSourceURI(sourceURI);
36: String workflowName = (String) model.getAttribute(
37: "/types/resources/resource[@name='" + result.getType()
38: + "']/workflowName", null, null);
39: if (workflowName != null)
40: result.setWorkflowName(workflowName);
41: String pipeline = (String) model.getAttribute(
42: "/types/resources/resource[@name='" + result.getType()
43: + "']/pipeline", null, null);
44: if (pipeline != null)
45: result.setPipeline(pipeline);
46: }
47:
48: public String getType() {
49: return TYPE;
50: }
51: }
|