public static Destination newInstance(String type, HashMap params) 
    throws UnsupportedDestinationException 
    {
        
        Destination d = null;

        if(type.equals("file")) {
            d = new FileDestination(params);
        } else if(type.equals("file")) {
            d = new ConsoleDestination(params);
        } else if(type.equals("jdbc")) {
            d = new JDBCDestination(params);
        } else if(type.equals("class")) {
        // custom destination class....
            throw new UnsupportedDestinationException("destination '"+type+"' not supported.");
        } else {
        // unsupported destination
            throw new UnsupportedDestinationException("destination '"+type+"' not supported.");
        }

        String reference = (String)params.get("ref");
        if(d!= null) d.setReference(reference);
        
        return d;
    }