]> git.argeo.org Git - gpl/argeo-slc.git/blob - runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/ExecutionResourcesFactoryBean.java
Introduce JMX agent
[gpl/argeo-slc.git] / runtime / org.argeo.slc.core / src / main / java / org / argeo / slc / core / execution / ExecutionResourcesFactoryBean.java
1 package org.argeo.slc.core.execution;
2
3 import org.springframework.beans.factory.FactoryBean;
4 import org.springframework.core.io.Resource;
5 import org.springframework.util.Assert;
6
7 /** Workaround when execution placedholders needs to be passed.*/
8 public class ExecutionResourcesFactoryBean implements FactoryBean {
9 private ExecutionResources executionResources;
10 private String relativePath;
11
12 public Object getObject() throws Exception {
13 Assert.notNull(executionResources, "executionResources is null");
14 Assert.notNull(relativePath, "relativePath is null");
15 return executionResources.getWritableResource(relativePath);
16 }
17
18 public Class<? extends Object> getObjectType() {
19 return Resource.class;
20 }
21
22 public boolean isSingleton() {
23 return true;
24 }
25
26 public void setExecutionResources(ExecutionResources executionResources) {
27 this.executionResources = executionResources;
28 }
29
30 public void setRelativePath(String relativePath) {
31 this.relativePath = relativePath;
32 }
33
34 }