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:
PropertyEditor, ResourceLoaderAware, Converter<String,Resource>

public class FileServiceResourceConverter
extends PropertyEditorSupport
implements Converter<String,Resource>, 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
 Resource convert(String source)
          Convert the source path to a Resource.
 void setAsText(String text)
           
 void setFileService(FileService fileService)
           
 void setResourceLoader(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(ResourceLoader resourceLoader)
Set the resource loader as a fallback for resources that are not managed by the FileService.

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

convert

public Resource convert(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 Converter<String,Resource>
See Also:
Converter.convert(Object)

setAsText

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


Copyright © 2011. All Rights Reserved.