Package com.thoughtworks.xstream.persistence

Examples of com.thoughtworks.xstream.persistence.FilePersistenceStrategy


    }

    private final class PersistenceArrayListConverter implements Converter {
        public void marshal(Object source, HierarchicalStreamWriter writer,
            MarshallingContext context) {
            final XmlArrayList list = new XmlArrayList(new FilePersistenceStrategy(dir, xstream));
            context.convertAnother(dir);
            list.addAll((Collection)source);
        }
View Full Code Here


        }

        public Object unmarshal(HierarchicalStreamReader reader,
            UnmarshallingContext context) {
            final File directory = (File)context.convertAnother(null, File.class);
            final XmlArrayList persistentList = new XmlArrayList(new FilePersistenceStrategy(directory, xstream));
            final ArrayList list = new ArrayList(persistentList);
            //persistentList.clear(); // remove files
            return list;
        }
View Full Code Here

          new File(ruta).mkdirs();
            //System.out.println("created:"+ruta);
        }

      //System.out.println("RUTA:"+ruta+"/"+serName);
      PersistenceStrategy strategy = new FilePersistenceStrategy(new File(ruta));
      // creates the list:
      List list = new XmlArrayList(strategy);
      list.add(event);
      return true;
    }
View Full Code Here

      return false;
    }
   }
  
   public Event getEventByID(String id,String path,String serName){
       PersistenceStrategy strategy = new FilePersistenceStrategy(new File(path+"/"+serName));
    // creates the list:
    List list = new XmlArrayList(strategy);
    for(Iterator it = list.iterator(); it.hasNext(); ) {
      Event event = (Event) it.next();
      if(event.getId().equals(id)) {
View Full Code Here

      OnlyDir onlyDir = new OnlyDir();
      String[] listDirs = file.list(onlyDir);
      Vector vector =new Vector();
      for(int i = 0;i<listDirs.length;i++){
        try{
          PersistenceStrategy strategy = new FilePersistenceStrategy(new File(path+"/"+serName+"/"+listDirs[i]));
          List list = new XmlArrayList(strategy);
       
          for(Iterator it = list.iterator(); it.hasNext(); ) {
           
            Event event = (Event) it.next();
View Full Code Here

    }
   
   }
     
   public Event[] getAllEvents(String path,String serName){
       PersistenceStrategy strategy = new FilePersistenceStrategy(new File(path+"/"+serName));
    // creates the list:
    List list = new XmlArrayList(strategy);
    if(list.size()>0){
      Event[] array = (Event[])list.toArray(new Event[list.size()]);
      return array;
View Full Code Here

    else
      return null;
   }
  
   public boolean delEvent(String id,String path,String serName){
       PersistenceStrategy strategy = new FilePersistenceStrategy(new File(path+"/"+serName));
    // creates the list:
    List list = new XmlArrayList(strategy);
    for(Iterator it = list.iterator(); it.hasNext(); ) {
      Event event = (Event) it.next();
      if(event.getId().equals(id)) {
View Full Code Here

    }
    return false;
   }
  
   public boolean updEvent(String id,Event newEvent,String path,String serName){
       PersistenceStrategy strategy = new FilePersistenceStrategy(new File(path+"/"+serName));
    // creates the list:
    List list = new XmlArrayList(strategy);
    for(Iterator it = list.iterator(); it.hasNext(); ) {
      Event event = (Event) it.next();
      if(event.getId().equals(id)) {
View Full Code Here

TOP

Related Classes of com.thoughtworks.xstream.persistence.FilePersistenceStrategy

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.