X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=cms%2Forg.argeo.slc.spring%2Fsrc%2Forg%2Fargeo%2Fslc%2Fcore%2Fexecution%2FExecutionResourcesFactoryBean.java;fp=cms%2Forg.argeo.slc.spring%2Fsrc%2Forg%2Fargeo%2Fslc%2Fcore%2Fexecution%2FExecutionResourcesFactoryBean.java;h=b217c3bfabf39cd5d5b1e2a0d6fd1d57cd33fa7c;hb=ecc22e604e47533c79de9cecdcdeacbc752cbff1;hp=0000000000000000000000000000000000000000;hpb=e07ded4632e53f8b8869763bc1f1f4091361e76e;p=gpl%2Fargeo-slc.git diff --git a/cms/org.argeo.slc.spring/src/org/argeo/slc/core/execution/ExecutionResourcesFactoryBean.java b/cms/org.argeo.slc.spring/src/org/argeo/slc/core/execution/ExecutionResourcesFactoryBean.java new file mode 100644 index 000000000..b217c3bfa --- /dev/null +++ b/cms/org.argeo.slc.spring/src/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 Resource 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; + } + +}