edu.internet2.middleware.grouperClientExt.com.thoughtworks.xstream.persistence
Class FileStreamStrategy

java.lang.Object
  extended by edu.internet2.middleware.grouperClientExt.com.thoughtworks.xstream.persistence.FileStreamStrategy
All Implemented Interfaces:
StreamStrategy

public class FileStreamStrategy
extends Object
implements StreamStrategy

The default naming strategy is based on the key's toString method and escapes non digit, non a-z, A-Z characters. In order to change the escaping/unescaping algorithm, simply extend this class and rewrite its getName/extractKey methods.

Author:
Guilherme Silveira

Constructor Summary
FileStreamStrategy(File baseDirectory)
           
FileStreamStrategy(File baseDirectory, XStream xstream)
           
 
Method Summary
 boolean containsKey(Object key)
           
protected  String escape(String key)
           
protected  String extractKey(String name)
          Given a filename, the unescape method returns the key which originated it.
 Object get(Object key)
           
protected  String getName(Object key)
          Given a key, the escape method returns the filename which shall be used.
protected  boolean isValid(File dir, String name)
           
 Iterator iterator()
           
 Object put(Object key, Object value)
           
 Object remove(Object key)
           
 int size()
           
protected  String unescape(String name)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileStreamStrategy

public FileStreamStrategy(File baseDirectory)

FileStreamStrategy

public FileStreamStrategy(File baseDirectory,
                          XStream xstream)
Method Detail

isValid

protected boolean isValid(File dir,
                          String name)

extractKey

protected String extractKey(String name)
Given a filename, the unescape method returns the key which originated it.

Parameters:
name - the filename
Returns:
the original key

unescape

protected String unescape(String name)

getName

protected String getName(Object key)
Given a key, the escape method returns the filename which shall be used.

Parameters:
key - the key
Returns:
the desired and escaped filename

escape

protected String escape(String key)

put

public Object put(Object key,
                  Object value)
Specified by:
put in interface StreamStrategy

iterator

public Iterator iterator()
Specified by:
iterator in interface StreamStrategy

size

public int size()
Specified by:
size in interface StreamStrategy

containsKey

public boolean containsKey(Object key)

get

public Object get(Object key)
Specified by:
get in interface StreamStrategy

remove

public Object remove(Object key)
Specified by:
remove in interface StreamStrategy


Copyright © 2012 Internet2. All Rights Reserved.