org.springframework.batch.admin.service
Class FileServiceResourceConverter

java.lang.Object
  extended by java.beans.PropertyEditorSupport
      extended by org.springframework.batch.admin.service.FileServiceResourceConverter
All Implemented Interfaces:
java.beans.PropertyEditor, org.springframework.context.ResourceLoaderAware, org.springframework.core.convert.converter.Converter<java.lang.String,org.springframework.core.io.Resource>

public class FileServiceResourceConverter
extends java.beans.PropertyEditorSupport
implements org.springframework.core.convert.converter.Converter<java.lang.String,org.springframework.core.io.Resource>, org.springframework.context.ResourceLoaderAware

Converter for String to Resource that knows about local files managed by a FileService.

Author:
Dave Syer

Constructor Summary
FileServiceResourceConverter()
          Convenient constructor for declarative configuration purposes.
FileServiceResourceConverter(FileService fileService)
           
 
Method Summary
 org.springframework.core.io.Resource convert(java.lang.String source)
          Convert the source path to a Resource.
 void setAsText(java.lang.String text)
           
 void setFileService(FileService fileService)
           
 void setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader)
          Set the resource loader as a fallback for resources that are not managed by the FileService.
 
Methods inherited from class java.beans.PropertyEditorSupport
addPropertyChangeListener, firePropertyChange, getAsText, getCustomEditor, getJavaInitializationString, getSource, getTags, getValue, isPaintable, paintValue, removePropertyChangeListener, setSource, setValue, supportsCustomEditor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileServiceResourceConverter

public FileServiceResourceConverter()
Convenient constructor for declarative configuration purposes.


FileServiceResourceConverter

public FileServiceResourceConverter(FileService fileService)
Parameters:
fileService -
Method Detail

setFileService

public void setFileService(FileService fileService)
Parameters:
fileService - the fileService to set

setResourceLoader

public void setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader)
Set the resource loader as a fallback for resources that are not managed by the FileService.

Specified by:
setResourceLoader in interface org.springframework.context.ResourceLoaderAware
See Also:
ResourceLoaderAware.setResourceLoader(ResourceLoader)

convert

public org.springframework.core.io.Resource convert(java.lang.String source)
Convert the source path to a Resource. If it is a managed file from the FileService then it will be returned as a wrapper.

Specified by:
convert in interface org.springframework.core.convert.converter.Converter<java.lang.String,org.springframework.core.io.Resource>
See Also:
Converter.convert(Object)

setAsText

public void setAsText(java.lang.String text)
               throws java.lang.IllegalArgumentException
Specified by:
setAsText in interface java.beans.PropertyEditor
Overrides:
setAsText in class java.beans.PropertyEditorSupport
Throws:
java.lang.IllegalArgumentException


Copyright © 2011. All Rights Reserved.