// Path: src/main/java/generator/extenders/RandomiserInstance.java
// public class RandomiserInstance
// {
//     //the name of the randomiser type to load
//     private String randomiserType; 
//     
//     //name and description are standard fields for all the user-defined cases.
//     private String name;       
//     private String description;
//     
//     //any object can be stored in the properties hashmap, however, it will be
//     //its String representation that will be saved in the XML file.
//     private LinkedHashMap properties;
//     
//     
//     public RandomiserInstance()
//     {        
//     }
//     
// 
//     public RandomiserInstance( String randomiserType,
//                                String name,
//                                String description,
//                                LinkedHashMap properties)
//     {
//         this.randomiserType = randomiserType;
//         this.name = name;
//         this.description = description;
//         this.properties = properties;
//     }
//     
//     
//     public String getRandomiserType()
//     {
//         return randomiserType;
//     }
// 
//     public void setRandomiserType(String randomiserType)
//     {
//         this.randomiserType = randomiserType;
//     }
// 
//     public String getName()
//     {
//         return name;
//     }
// 
//     public void setName(String name)
//     {
//         this.name = name;
//     }
// 
//     public String getDescription()
//     {
//         return description;
//     }
// 
//     public void setDescription(String description)
//     {
//         this.description = description;
//     }
// 
//     public LinkedHashMap getProperties()
//     {
//         return properties;
//     }
// 
//     public void setProperties(LinkedHashMap properties)
//     {
//         this.properties = properties;
//     }
// 
//     public String toString()
//     {
//         return name;        
//     }
// }


import java.util.LinkedHashMap;
import java.util.Set;
import java.util.Vector;
import generator.extenders.RandomiserInstance;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xml.sax.SAXException;
import org.apache.log4j.Logger;

            elemRI = addElementRI(ri);
            addElementDescription(ri,elemRI);
            
            LinkedHashMap properties;
            properties = ri.getProperties();
            
            Set<String> keys;
            if(properties==null) {
              ri.setProperties(new LinkedHashMap());
              logger.warn("Properties are null, has this object been linked in RandomiserInstance?");
            } else {
              keys = properties.keySet();
              for(String key : keys)
              {
                  String value = (String) properties.get(key);
                  addElementProperty(key,value,elemRI);
              }
            }
        }
        xmlSaver.writeXMLContent(dom,"conf/Repository.xml");
    }
    

    
    private Element addElementRI(RandomiserInstance ri)
    {
        Element elemRI = dom.createElement("randomiser-instance");
        elemRI.setAttribute("randomiser-type",ri.getRandomiserType());
        elemRI.setAttribute("name",ri.getName());
        root.appendChild(elemRI);

// Path: src/main/java/generator/extenders/RandomiserInstance.java
// public class RandomiserInstance
// {
//     //the name of the randomiser type to load
//     private String randomiserType; 
//     
//     //name and description are standard fields for all the user-defined cases.
//     private String name;       
//     private String description;
//     
//     //any object can be stored in the properties hashmap, however, it will be
//     //its String representation that will be saved in the XML file.
//     private LinkedHashMap properties;
//     
//     
//     public RandomiserInstance()
//     {        
//     }
//     
// 
//     public RandomiserInstance( String randomiserType,
//                                String name,
//                                String description,
//                                LinkedHashMap properties)
//     {
//         this.randomiserType = randomiserType;
//         this.name = name;
//         this.description = description;
//         this.properties = properties;
//     }
//     
//     
//     public String getRandomiserType()
//     {
//         return randomiserType;
//     }
// 
//     public void setRandomiserType(String randomiserType)
//     {
//         this.randomiserType = randomiserType;
//     }
// 
//     public String getName()
//     {
//         return name;
//     }
// 
//     public void setName(String name)
//     {
//         this.name = name;
//     }
// 
//     public String getDescription()
//     {
//         return description;
//     }
// 
//     public void setDescription(String description)
//     {
//         this.description = description;
//     }
// 
//     public LinkedHashMap getProperties()
//     {
//         return properties;
//     }
// 
//     public void setProperties(LinkedHashMap properties)
//     {
//         this.properties = properties;
//     }
// 
//     public String toString()
//     {
//         return name;        
//     }
// }


// Path: src/main/java/generator/misc/RandomInstanceSaver.java
import java.util.LinkedHashMap;
import java.util.Set;
import java.util.Vector;
import generator.extenders.RandomiserInstance;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xml.sax.SAXException;
import org.apache.log4j.Logger;

            elemRI = addElementRI(ri);
            addElementDescription(ri,elemRI);
            
            LinkedHashMap properties;
            properties = ri.getProperties();
            
            Set<String> keys;
            if(properties==null) {
              ri.setProperties(new LinkedHashMap());
              logger.warn("Properties are null, has this object been linked in RandomiserInstance?");
            } else {
              keys = properties.keySet();
              for(String key : keys)
              {
                  String value = (String) properties.get(key);
                  addElementProperty(key,value,elemRI);
              }
            }
        }
        xmlSaver.writeXMLContent(dom,"conf/Repository.xml");
    }
    

    
    private Element addElementRI(RandomiserInstance ri)
    {
        Element elemRI = dom.createElement("randomiser-instance");
        elemRI.setAttribute("randomiser-type",ri.getRandomiserType());
        elemRI.setAttribute("name",ri.getName());
        root.appendChild(elemRI);

        logger.debug("added a ranomiser-instance element: "+ri.getName() + ", "+ri.getDescription());
