X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=runtime%2Forg.argeo.slc.support.simple%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fslc%2Fcore%2Fexecution%2FExecutionResourcesFactoryBean.java;fp=runtime%2Forg.argeo.slc.support.simple%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fslc%2Fcore%2Fexecution%2FExecutionResourcesFactoryBean.java;h=68ff63ef6139e345022f4bcad5d85dc02cf6ed2c;hb=5ae9dc81ad1c3ddfa99a8456b0c5263dd483642d;hp=0000000000000000000000000000000000000000;hpb=2531d7501fcb56eed16a7c61b2d842bd65228f53;p=gpl%2Fargeo-slc.git diff --git a/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/ExecutionResourcesFactoryBean.java b/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/ExecutionResourcesFactoryBean.java new file mode 100644 index 000000000..68ff63ef6 --- /dev/null +++ b/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/ExecutionResourcesFactoryBean.java @@ -0,0 +1,34 @@ +package org.argeo.slc.core.execution; + +import org.springframework.beans.factory.FactoryBean; +import org.springframework.core.io.Resource; +import org.springframework.util.Assert; + +/** Workaround when execution placedholders needs to be passed.*/ +public class ExecutionResourcesFactoryBean implements FactoryBean { + private ExecutionResources executionResources; + private String relativePath; + + public Object getObject() throws Exception { + Assert.notNull(executionResources, "executionResources is null"); + Assert.notNull(relativePath, "relativePath is null"); + return executionResources.getWritableResource(relativePath); + } + + public Class getObjectType() { + return Resource.class; + } + + public boolean isSingleton() { + return true; + } + + public void setExecutionResources(ExecutionResources executionResources) { + this.executionResources = executionResources; + } + + public void setRelativePath(String relativePath) { + this.relativePath = relativePath; + } + +}