[Title] Implement CLI wizard
authorho.namkoong <ho.namkoong@samsung.com>
Wed, 5 Dec 2012 09:48:43 +0000 (18:48 +0900)
committerho.namkoong <ho.namkoong@samsung.com>
Thu, 6 Dec 2012 07:44:11 +0000 (16:44 +0900)
[Type]
[Module]
[Priority]
[Jira#]
[Redmine#] 7053
[Problem]
[Cause]
[Solution]
[TestCase]

Change-Id: Iae8758d6279070a830a52f4f1ef8d4cb1bdb0e2e

org.tizen.common.sign/src/org/tizen/common/sign/util/XMLUtil.java
org.tizen.common/src/org/tizen/common/util/CollectionUtil.java [changed mode: 0755->0644]
org.tizen.common/src/org/tizen/common/util/FileUtil.java
org.tizen.common/test/src/org/tizen/common/util/CollectionUtilTest.java [changed mode: 0755->0644]
org.tizen.common/test/src/org/tizen/common/util/FileUtilTest.java
org.tizen.common/test/test_files/about_files/LICENSE-2.0.htm [new file with mode: 0644]
org.tizen.common/test/test_files/about_files/freemarker-LICENSE.txt [new file with mode: 0644]
org.tizen.common/test/test_files/resource/about_files/LICENSE-2.0.htm [new file with mode: 0644]
org.tizen.common/test/test_files/resource/about_files/freemarker-LICENSE.txt [new file with mode: 0644]
org.tizen.common/test/test_files/resource/resource/text.txt [new file with mode: 0644]
org.tizen.common/test/test_files/resource/text.txt [new file with mode: 0644]

index 1b61bab..a1c01da 100644 (file)
 package org.tizen.common.sign.util;
 
 import java.io.ByteArrayOutputStream;
+import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
 
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
@@ -38,9 +42,11 @@ import javax.xml.transform.dom.DOMSource;
 import javax.xml.transform.stream.StreamResult;
 
 import org.tizen.common.util.Assert;
+import org.tizen.common.util.FileUtil;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
 import org.xml.sax.SAXException;
 
 /**
@@ -55,52 +61,55 @@ import org.xml.sax.SAXException;
  */
 public class XMLUtil
 {
-       /**
-        * Create {@link Document}
-        * 
-        * @param in {@link InputStream} to provide xml contents
-        * 
-        * @return {@link Document} to be created
-        * 
-        * @throws ParserConfigurationException When {@link DocumentBuilder} can't be created
-        * @throws SAXException When xml can't be parsed
-        * @throws IOException When <code>in</code> throw {@link IOException}
-        */
-       public static
-       Document
-       create(
-               final InputStream in
-       )
-       throws ParserConfigurationException, SAXException, IOException
-       {
-               final DocumentBuilderFactory factory =
-                       DocumentBuilderFactory.newInstance();
-               
-               final DocumentBuilder builder = factory.newDocumentBuilder();
-               
-               return builder.parse( in );
-       }
+    
+    public static final String FILE_EXT_XML = "xml";
+    
+    /**
+     * Create {@link Document}
+     * 
+     * @param in {@link InputStream} to provide xml contents
+     * 
+     * @return {@link Document} to be created
+     * 
+     * @throws ParserConfigurationException When {@link DocumentBuilder} can't be created
+     * @throws SAXException When xml can't be parsed
+     * @throws IOException When <code>in</code> throw {@link IOException}
+     */
+    public static
+    Document
+    create(
+        final InputStream in
+    )
+    throws ParserConfigurationException, SAXException, IOException
+    {
+        final DocumentBuilderFactory factory =
+            DocumentBuilderFactory.newInstance();
+        
+        final DocumentBuilder builder = factory.newDocumentBuilder();
+        
+        return builder.parse( in );
+    }
 
 
-       /**
-        * Create empty {@link Document}
-        
-        * @return {@link Document} to be created
-        
-        * @throws ParserConfigurationException When {@link DocumentBuilder} can't be created
-        */
-       public static
-       Document
-       create()
-       throws ParserConfigurationException
-       {
-               final DocumentBuilderFactory factory =
-                       DocumentBuilderFactory.newInstance();
-               
-               final DocumentBuilder builder = factory.newDocumentBuilder();
-               
-               return builder.newDocument();
-       }
+    /**
+     * Create empty {@link Document}
+     * 
+     * @return {@link Document} to be created
+     * 
+     * @throws ParserConfigurationException When {@link DocumentBuilder} can't be created
+     */
+    public static
+    Document
+    create()
+    throws ParserConfigurationException
+    {
+        final DocumentBuilderFactory factory =
+            DocumentBuilderFactory.newInstance();
+        
+        final DocumentBuilder builder = factory.newDocumentBuilder();
+        
+        return builder.newDocument();
+    }
 
     /**
      * All of the child nodes are removed.
@@ -152,4 +161,68 @@ public class XMLUtil
         
         return outStream;
     }
+    
+    
+    /**
+     * 
+     * Get document root from file. return null if file is not xml.
+     * 
+     * @param file XML file.
+     * @return root element of the file
+     * @throws Exception
+     * @author ho.namkoong{@literal <ho.namkoong@samsung.com>}
+     */
+    public static Element getDocumentRootFromFile(File file) throws Exception {
+        Assert.notNull(file);
+        
+        if(!file.isFile() || !FileUtil.getFileExtension(file.getName()).equals(FILE_EXT_XML)) {
+            return null;
+        }
+        URL fileUrl = file.toURI().toURL();
+        InputStream in = fileUrl.openStream();
+        Document fileDoc = create(in);
+        return fileDoc.getDocumentElement();
+    }
+    
+    /**
+     * 
+     * Get child elements whose name is tag from the parent element.
+     * 
+     * @param parent parent element
+     * @param tag name of the child elements.
+     * @return
+     */
+    public static List<Element> getElementsByTag(Element parent, String tag) {
+        Assert.notNull(parent);
+        Assert.notNull(tag);
+        
+        List<Element> result = new ArrayList<Element>();
+        NodeList nodeList = parent.getElementsByTagName(tag);
+        for(int i=0; i<nodeList.getLength(); i++) {
+            Node node = nodeList.item(i);
+            if(node.getNodeType() == Node.ELEMENT_NODE) {
+            result.add((Element) node);
+            }
+        }
+        return result;
+    }
+    
+    /**
+     * Returns the Children of the Element.
+     * @param element
+     * @return List of the child elements
+     * 
+     * @since 4.0
+     */
+    public static List<Element> getChildrenOfElement(Element element) {
+        List<Element> list = new ArrayList<Element>();
+        NodeList children = element.getChildNodes();
+        for (int i = 0, l = children.getLength(); i < l; i++) {
+            Node child = children.item(i);
+            if (child.getNodeType() == Node.ELEMENT_NODE) {
+                list.add((Element) child);
+            }
+        }
+        return list;
+    }
 }
old mode 100755 (executable)
new mode 100644 (file)
index fde2ed3..c8b980a
@@ -59,1442 +59,1508 @@ import org.tizen.common.util.ArrayUtil.ArrayIterator;
  */
 public class CollectionUtil
 {
-       
-       /**
-        * Empty bytes
-        */
-       protected static final byte[] EMPTY_BYTE_ARRAY = new byte[0]; 
-       protected static final byte[] EMPTY_BYTES = EMPTY_BYTE_ARRAY;
-       
-       private static final String ARRAY_START = "{";
-       
-       private static final String ARRAY_END = "}";
-       
-       private static final String EMPTY_ARRAY = ARRAY_START + ARRAY_END;
-       
-       private static final String ARRAY_ELEMENT_SEPARATOR = ", ";
+    
+    /**
+     * Empty bytes
+     */
+    protected static final byte[] EMPTY_BYTE_ARRAY = new byte[0];
+    protected static final byte[] EMPTY_BYTES = EMPTY_BYTE_ARRAY;
+    
+    private static final String ARRAY_START = "{";
+    
+    private static final String ARRAY_END = "}";
+    
+    private static final String EMPTY_ARRAY = ARRAY_START + ARRAY_END;
+    
+    private static final String ARRAY_ELEMENT_SEPARATOR = ", ";
 
-       private static final Set<Class<?>> APPROXIMABLE_COLLECTION_TYPES = 
-               Collections.unmodifiableSet( new HashSet<Class<?>>( Arrays.asList( new Class<?>[] {
-                       Collection.class,
-                       Set.class, HashSet.class, SortedSet.class, LinkedHashSet.class, TreeSet.class,
-                       List.class, LinkedList.class, ArrayList.class
-               } ) ) );
+    private static final Set<Class<?>> APPROXIMABLE_COLLECTION_TYPES = 
+        Collections.unmodifiableSet( new HashSet<Class<?>>( Arrays.asList( new Class<?>[] {
+            Collection.class,
+            Set.class, HashSet.class, SortedSet.class, LinkedHashSet.class, TreeSet.class,
+            List.class, LinkedList.class, ArrayList.class
+        } ) ) );
 
-       private static final Set<Class<?>> APPROXIMABLE_MAP_TYPES = 
-               Collections.unmodifiableSet( new HashSet<Class<?>>( Arrays.asList( new Class<?>[] {
-                       Map.class, SortedMap.class, HashMap.class, LinkedHashMap.class, TreeMap.class
-               } ) ) );
-       
+    private static final Set<Class<?>> APPROXIMABLE_MAP_TYPES = 
+        Collections.unmodifiableSet( new HashSet<Class<?>>( Arrays.asList( new Class<?>[] {
+            Map.class, SortedMap.class, HashMap.class, LinkedHashMap.class, TreeMap.class
+        } ) ) );
+    
 
 
-       /* Object */
-       /**
-        * Empty Collection
-        */
-       public static final Collection<Object> EMPTY_COLLECTION = 
-               Collections.unmodifiableCollection( new ArrayList<Object>() );
+    /* Object */
+    /**
+     * Empty Collection
+     */
+    public static final Collection<Object> EMPTY_COLLECTION = 
+        Collections.unmodifiableCollection( new ArrayList<Object>() );
 
-       /**
-        * protected constructor
-        */
-       protected CollectionUtil() {}
+    /**
+     * protected constructor
+     */
+    protected CollectionUtil() {}
 
-       /**
-        * <p>
-        * check <code>collection</code> has no element.
-        
-        * use without null check.
-        
-        * Old style
-        
-        * <code>
-        * List list = null;
-        * ...
-        * if ( null != list && !list.isEmpty() ) {
-        *  ...
-        * }
-        * </code>
-        
-        * Usage :
-        * <p>
-        
-        * <code>
-        * List list = null;
-        * ...
-        * if ( !CollectionUtil.isEmpty( list ) ) {
-        *      ...
-        * }
-        * </code>
-        
-        * or "import static" style if you use JDK6
-        
-        * </code>
-        * import static org.tizen.common.util.CollectionUtil.isEmpty;
-        *  
-        * ...
-        * List list = null;
-        * ...
-        * if ( !isEmpty( list ) ) {
-        *      ...
-        * }
-        * </code>
-        
-        * @param collection {@link Collection} to check
-        
-        * @return value if collection is empty
-        */
-       public static
-       boolean
-       isEmpty(
-               final Collection<?> collection
-       )
-       {
-               if ( null == collection )
-               {
-                       return true;
-               }
-               
-               return collection.isEmpty();
-       }
-       
-       /**
-        * <p>
-        * Return <code>collection</code>'s size.
-        
-        * use without null check.
-        
-        * Return <code>0</code> if <code>collection</code> is <code>null</code>
-        
-        * <p>
-        
-        * Old style
-        * <code>
-        * if ( null != list ) {
-        *      for ( int i = 0, n = list.size() ; i < n ; ++i ) {
-        *              ...
-        *      }
-        * }
-        * </code>
-        
-        
-        * <code>
-        * for ( int i = 0, n = CollectionUtil.size( list ) ; i < n ; ++i ) {
-        *      ...
-        * }
-        *  
-        * </code>
-        * or "import static" style if you use JDK6
-        
-        * </code>
-        * import static org.tizen.common.util.CollectionUtil.isEmpty;
-        * ...
-        *  
-        * for ( int i = 0, n = size( list ) ; i < n ; ++i ) {
-        *      ...
-        * }
-        *  
-        * </code>
-        
-        * @param collection {@link Collection} to check
-        
-        * @return size of <code>collection</code>
-        
-        * @see Collection#size()
-        */
-       public static
-       int
-       size(
-               final Collection<?> collection
-       )
-       {
-               if ( null == collection )
-               {
-                       return 0;
-               }
-               
-               return collection.size();
-       }
+    /**
+     * <p>
+     * check <code>collection</code> has no element.
+     * 
+     * use without null check.
+     * 
+     * Old style
+     * 
+     * <code>
+     * List list = null;
+     * ...
+     * if ( null != list && !list.isEmpty() ) {
+     *  ...
+     * }
+     * </code>
+     * 
+     * Usage :
+     * <p>
+     * 
+     * <code>
+     * List list = null;
+     * ...
+     * if ( !CollectionUtil.isEmpty( list ) ) {
+     *  ...
+     * }
+     * </code>
+     * 
+     * or "import static" style if you use JDK6
+     * 
+     * </code>
+     * import static org.tizen.common.util.CollectionUtil.isEmpty;
+     *  
+     * ...
+     * List list = null;
+     * ...
+     * if ( !isEmpty( list ) ) {
+     *  ...
+     * }
+     * </code>
+     * 
+     * @param collection {@link Collection} to check
+     * 
+     * @return value if collection is empty
+     */
+    public static
+    boolean
+    isEmpty(
+        final Collection<?> collection
+    )
+    {
+        if ( null == collection )
+        {
+            return true;
+        }
+        
+        return collection.isEmpty();
+    }
+    
+    /**
+     * <p>
+     * Return <code>collection</code>'s size.
+     * 
+     * use without null check.
+     * 
+     * Return <code>0</code> if <code>collection</code> is <code>null</code>
+     * 
+     * <p>
+     * 
+     * Old style
+     * <code>
+     * if ( null != list ) {
+     *  for ( int i = 0, n = list.size() ; i < n ; ++i ) {
+     *      ...
+     *  }
+     * }
+     * </code>
+     * 
+     * 
+     * <code>
+     * for ( int i = 0, n = CollectionUtil.size( list ) ; i < n ; ++i ) {
+     *  ...
+     * }
+     *  
+     * </code>
+     * or "import static" style if you use JDK6
+     * 
+     * </code>
+     * import static org.tizen.common.util.CollectionUtil.isEmpty;
+     * ...
+     *  
+     * for ( int i = 0, n = size( list ) ; i < n ; ++i ) {
+     *  ...
+     * }
+     *  
+     * </code>
+     * 
+     * @param collection {@link Collection} to check
+     * 
+     * @return size of <code>collection</code>
+     * 
+     * @see Collection#size()
+     */
+    public static
+    int
+    size(
+        final Collection<?> collection
+    )
+    {
+        if ( null == collection )
+        {
+            return 0;
+        }
+        
+        return collection.size();
+    }
 
-       /**
-        * <p>
-        * run <code>runner</code> iterateing element of <code>collection</code>.
-        
-        * use without null-check for <code>collection</code>
-        
-        * delegate error handling to <code>runner</code>
-        * </p>
-        
-        * <code>
-        
-        * CollectionUtil.iterate(
-        *      new ArrayList<String>( Arrays.asList( "hello", "Hello", "World", null, "Test" ) ),
-        *      new IteratingRunner<String>() {
-        *              public void run( String arg ) {
-        *                      ...
-        *              }
-        *      }
-        * );
-        
-        * </code>
-        
-        * @param <T> type of element in <code>collection</code>
-        * @param collection {@link Collection} containing element
-        * @param runner {@link Runnable} to execute
-        
-        * @throws InvocationTargetException when <code>runner</code>'s {@link Runnable#run()} throws exception 
-        
-        * @see {@link #iterate(Collection, IteratingRunner, boolean)}
-        * @see FilterIterator
-        */
-       public static <T>
-       void
-       iterate(
-               final Collection<? extends T> collection,
-               final IteratingRunner<T> runner
-       )
-       throws InvocationTargetException
-       {
-               iterate( collection, runner, false );
-       }
-       
-       /**
-        * <p>
-        * run <code>runner</code> iterateing element of <code>collection</code>.
-        
-        * use without null-check for <code>collection</code>
-        
-        * delegate error handling to <code>runner</code>
-        
-        * </p>
-        * <code>
-        
-        * CollectionUtil.iterate(
-        *      new ArrayList<String>( Arrays.asList( "hello", "Hello", "World", null, "Test" ) ),
-        *      new IteratingRunner<String>() {
-        *              public void run( String arg ) {
-        *                      ...
-        *              }
-        *      },
-        *      true
-        * );
-        
-        * </code>
-        
-        * @param <T> type of element in <code>collection</code>
-        * @param collection {@link Collection} containing element
-        * @param runner {@link Runnable} to execute
-        * @param bForceProcess flag to iterate continuously when exception occurs
-        
-        * @throws InvocationTargetException when <code>runner</code>'s {@link Runnable#run()} throws exception 
-        
-        * @see FilterIterator
-        */
-       public static <T>
-       void
-       iterate(
-               final Collection<? extends T> collection,
-               final IteratingRunner<T> runner,
-               final boolean bForceProcess
-       )
-       throws InvocationTargetException
-       {
-               if ( null == runner )
-               {
-                       return ;
-               }
-               if ( isEmpty( collection ) )
-               {
-                       return ;
-               }
-               
-               for ( final T arg : collection )
-               {
-                       if ( null == arg && !bForceProcess )
-                       {
-                               continue ;
-                       }
-                       try
-                       {
-                               runner.run( arg );
-                       } catch ( Throwable e )
-                       {
-                               if ( !bForceProcess )
-                               {
-                                       throw new InvocationTargetException( e );
-                               }
-                       }
-               }
-       }
-       
-       /**
-        * <p>
-        * fiter <code>collection</code> to <code>result</code> using <code>runner</code>
-        
-        * determined if stop or keep going using <code>bForceProcess</code> in case of exception.
-        * </p>
-        
-        * @param <T> type of element in <code>collection</code>
-        * @param collection {@link Collection} to filter
-        * @param results collection to save result
-        * @param runner object to determine if filter
-        * @param bForceProcess flag to keep going when exception occurs
-        
-        * @throws InvocationTargetException when <code>runner</code>'s {@link Runnable#run()} throws exception 
-        */
-       public static <T>
-       void
-       filter(
-               final Collection<? extends T> collection,
-               final Collection<T> results,
-               final IteratingAcceptor<T> runner,
-               final boolean bForceProcess
-       ) throws InvocationTargetException
-       {
-               if ( null == results )
-               {
-                       return ;
-               }
-               if ( isEmpty( collection ) )
-               {
-                       return ;
-               }
-               
-               for ( final T arg : collection )
-               {
-                       if ( null == arg && !bForceProcess )
-                       {
-                               continue ;
-                       }
-                       try
-                       {
-                               if ( runner.accept( arg ) )
-                               {
-                                       results.add( arg );
-                               }
-                       } catch ( Throwable e )
-                       {
-                               if ( !bForceProcess )
-                               {
-                                       throw new InvocationTargetException( e );
-                               }
-                       }
+    /**
+     * <p>
+     * run <code>runner</code> iterateing element of <code>collection</code>.
+     * 
+     * use without null-check for <code>collection</code>
+     * 
+     * delegate error handling to <code>runner</code>
+     * </p>
+     * 
+     * <code>
+     * 
+     * CollectionUtil.iterate(
+     *  new ArrayList<String>( Arrays.asList( "hello", "Hello", "World", null, "Test" ) ),
+     *  new IteratingRunner<String>() {
+     *      public void run( String arg ) {
+     *          ...
+     *      }
+     *  }
+     * );
+     * 
+     * </code>
+     * 
+     * @param <T> type of element in <code>collection</code>
+     * @param collection {@link Collection} containing element
+     * @param runner {@link Runnable} to execute
+     * 
+     * @throws InvocationTargetException when <code>runner</code>'s {@link Runnable#run()} throws exception 
+     * 
+     * @see {@link #iterate(Collection, IteratingRunner, boolean)}
+     * @see FilterIterator
+     */
+    public static <T>
+    void
+    iterate(
+        final Collection<? extends T> collection,
+        final IteratingRunner<T> runner
+    )
+    throws InvocationTargetException
+    {
+        iterate( collection, runner, false );
+    }
+    
+    /**
+     * <p>
+     * run <code>runner</code> iterateing element of <code>collection</code>.
+     * 
+     * use without null-check for <code>collection</code>
+     * 
+     * delegate error handling to <code>runner</code>
+     * 
+     * </p>
+     * <code>
+     * 
+     * CollectionUtil.iterate(
+     *  new ArrayList<String>( Arrays.asList( "hello", "Hello", "World", null, "Test" ) ),
+     *  new IteratingRunner<String>() {
+     *      public void run( String arg ) {
+     *          ...
+     *      }
+     *  },
+     *  true
+     * );
+     * 
+     * </code>
+     * 
+     * @param <T> type of element in <code>collection</code>
+     * @param collection {@link Collection} containing element
+     * @param runner {@link Runnable} to execute
+     * @param bForceProcess flag to iterate continuously when exception occurs
+     * 
+     * @throws InvocationTargetException when <code>runner</code>'s {@link Runnable#run()} throws exception 
+     * 
+     * @see FilterIterator
+     */
+    public static <T>
+    void
+    iterate(
+        final Collection<? extends T> collection,
+        final IteratingRunner<T> runner,
+        final boolean bForceProcess
+    )
+    throws InvocationTargetException
+    {
+        if ( null == runner )
+        {
+            return ;
+        }
+        if ( isEmpty( collection ) )
+        {
+            return ;
+        }
+        
+        for ( final T arg : collection )
+        {
+            if ( null == arg && !bForceProcess )
+            {
+                continue ;
+            }
+            try
+            {
+                runner.run( arg );
+            } catch ( Throwable e )
+            {
+                if ( !bForceProcess )
+                {
+                    throw new InvocationTargetException( e );
+                }
+            }
+        }
+    }
+    
+    /**
+     * <p>
+     * fiter <code>collection</code> to <code>result</code> using <code>runner</code>
+     * 
+     * determined if stop or keep going using <code>bForceProcess</code> in case of exception.
+     * </p>
+     * 
+     * @param <T> type of element in <code>collection</code>
+     * @param collection {@link Collection} to filter
+     * @param results collection to save result
+     * @param runner object to determine if filter
+     * @param bForceProcess flag to keep going when exception occurs
+     * 
+     * @throws InvocationTargetException when <code>runner</code>'s {@link Runnable#run()} throws exception 
+     */
+    public static <T>
+    void
+    filter(
+        final Collection<? extends T> collection,
+        final Collection<T> results,
+        final IteratingAcceptor<T> runner,
+        final boolean bForceProcess
+    ) throws InvocationTargetException
+    {
+        if ( null == results )
+        {
+            return ;
+        }
+        if ( isEmpty( collection ) )
+        {
+            return ;
+        }
+        
+        for ( final T arg : collection )
+        {
+            if ( null == arg && !bForceProcess )
+            {
+                continue ;
+            }
+            try
+            {
+                if ( runner.accept( arg ) )
+                {
+                    results.add( arg );
+                }
+            } catch ( Throwable e )
+            {
+                if ( !bForceProcess )
+                {
+                    throw new InvocationTargetException( e );
+                }
+            }
 
-               }
-       }
-       
-       /**
-        * <p>
-        * Return first element in <code>collection</code><br>
-        
-        * Return <code>null</code> if <code>collection</code> is null or empty
-        * </p>
-        * @param <T> type of element in <code>collection</code>
-        * @param collection {@link Collection} to check
-        
-        * @return first elemtn in <code>collection</code>
-        */
-       public static <T>
-       T
-       pickupFirst( final Collection<T> collection )
-       {
-               if ( isEmpty( collection ) )
-               {
-                       return null;
-               }
-               
-               final Iterator<T> iter = collection.iterator();
-               return (iter.hasNext())?(iter.next()):null;
-       }
+        }
+    }
+    
+    /**
+     * <p>
+     * Return first element in <code>collection</code><br>
+     * 
+     * Return <code>null</code> if <code>collection</code> is null or empty
+     * </p>
+     * @param <T> type of element in <code>collection</code>
+     * @param collection {@link Collection} to check
+     * 
+     * @return first elemtn in <code>collection</code>
+     */
+    public static <T>
+    T
+    pickupFirst( final Collection<T> collection )
+    {
+        if ( isEmpty( collection ) )
+        {
+            return null;
+        }
+        
+        final Iterator<T> iter = collection.iterator();
+        return (iter.hasNext())?(iter.next()):null;
+    }
 
-       /**
-        * <p>
-        * Extract and return first element in <code>collection</code><br>
-        
-        * Return <code>null</code> if <code>collection</code> is null or empty
-        * </p>
-        * @param <T> type of element in <code>collection</code>
-        * @param collection {@link Collection} to check
-        
-        * @return first elemtn in <code>collection</code>
-        */
-       public static <T>
-       T
-       removeFirst( final Collection<T> collection )
-       {
-               if ( isEmpty( collection ) )
-               {
-                       return null;
-               }
-               
-               final Iterator<T> iter = collection.iterator();
-               if ( iter.hasNext() )
-               {
-                       T ret = iter.next();
-                       iter.remove();
-                       return ret;
-               }
-               return null;
-       }
+    /**
+     * <p>
+     * Extract and return first element in <code>collection</code><br>
+     * 
+     * Return <code>null</code> if <code>collection</code> is null or empty
+     * </p>
+     * @param <T> type of element in <code>collection</code>
+     * @param collection {@link Collection} to check
+     * 
+     * @return first elemtn in <code>collection</code>
+     */
+    public static <T>
+    T
+    removeFirst( final Collection<T> collection )
+    {
+        if ( isEmpty( collection ) )
+        {
+            return null;
+        }
+        
+        final Iterator<T> iter = collection.iterator();
+        if ( iter.hasNext() )
+        {
+            T ret = iter.next();
+            iter.remove();
+            return ret;
+        }
+        return null;
+    }
 
 
-       /**
-        * <p>
-        * Return last element in <code>collection</code><br>
-        
-        * Return <code>null</code> if <code>collection</code> is null or empty
-        
-        * Don't use this in case of big data or looping algorithm
-        * </p>
-        * @param <T> type of element in <code>collection</code>
-        * @param collection {@link Collection} to check
-        
-        * @return last elemtn in <code>collection</code>
-        */
-       public static <T>
-       T
-       pickupLast( final Collection<T> collection )
-       {
-               if ( isEmpty( collection ) )
-               {
-                       return null;
-               }
-               
-               final Iterator<T> iter = collection.iterator();
-               
-               T temp = null;
-               while ( iter.hasNext() )
-               {
-                       temp = iter.next();
-               }
-               return temp;
-       }
-       
-       /**
-        * <p>
-        * Extract and return last element in <code>collection</code><br>
-        
-        * Return <code>null</code> if <code>collection</code> is null or empty
-        
-        * Don't use this in case of big data or looping algorithm
-        * </p>
-        * @param <T> type of element in <code>collection</code>
-        * @param collection {@link Collection} to check
-        
-        * @return last elemtn in <code>collection</code>
-        */
-       public static <T>
-       T
-       removeLast( final Collection<T> collection )
-       {
-               if ( isEmpty( collection ) )
-               {
-                       return null;
-               }
-               
-               final Iterator<T> iter = collection.iterator();
-               
-               T temp = null;
-               while ( iter.hasNext() )
-               {
-                       temp = iter.next();
-               }
-               iter.remove();
-               return temp;
-       }
+    /**
+     * <p>
+     * Return last element in <code>collection</code><br>
+     * 
+     * Return <code>null</code> if <code>collection</code> is null or empty
+     * 
+     * Don't use this in case of big data or looping algorithm
+     * </p>
+     * @param <T> type of element in <code>collection</code>
+     * @param collection {@link Collection} to check
+     * 
+     * @return last elemtn in <code>collection</code>
+     */
+    public static <T>
+    T
+    pickupLast( final Collection<T> collection )
+    {
+        if ( isEmpty( collection ) )
+        {
+            return null;
+        }
+        
+        final Iterator<T> iter = collection.iterator();
+        
+        T temp = null;
+        while ( iter.hasNext() )
+        {
+            temp = iter.next();
+        }
+        return temp;
+    }
+    
+    /**
+     * <p>
+     * Extract and return last element in <code>collection</code><br>
+     * 
+     * Return <code>null</code> if <code>collection</code> is null or empty
+     * 
+     * Don't use this in case of big data or looping algorithm
+     * </p>
+     * @param <T> type of element in <code>collection</code>
+     * @param collection {@link Collection} to check
+     * 
+     * @return last elemtn in <code>collection</code>
+     */
+    public static <T>
+    T
+    removeLast( final Collection<T> collection )
+    {
+        if ( isEmpty( collection ) )
+        {
+            return null;
+        }
+        
+        final Iterator<T> iter = collection.iterator();
+        
+        T temp = null;
+        while ( iter.hasNext() )
+        {
+            temp = iter.next();
+        }
+        iter.remove();
+        return temp;
+    }
 
-       /**
-        * Convert {@link Enumeration} to {@link Iterator} using decoration pattern 
-        
-        * @param <K> element type to be handled by enumertaion
-        */
-       static class
-       EnumerationAdapter<K>
-       implements Iterator<K>
-       {
-               protected final Enumeration<K> enumeration;
-               /**
-                * Constructor with {@link Enumeration}
-                
-                * @param enumeration {@link Enumeration} to convert 
-                */
-               public
-               EnumerationAdapter(
-                       final Enumeration<K> enumeration
-               )
-               {
-                   Assert.notNull( enumeration );
-                       this.enumeration = enumeration;
-               }
+    /**
+     * Convert {@link Enumeration} to {@link Iterator} using decoration pattern 
+     * 
+     * @param <K> element type to be handled by enumertaion
+     */
+    static class
+    EnumerationAdapter<K>
+    implements Iterator<K>
+    {
+        protected final Enumeration<K> enumeration;
+        /**
+         * Constructor with {@link Enumeration}
+         * 
+         * @param enumeration {@link Enumeration} to convert 
+         */
+        public
+        EnumerationAdapter(
+            final Enumeration<K> enumeration
+        )
+        {
+            Assert.notNull( enumeration );
+            this.enumeration = enumeration;
+        }
 
-               /* (non-Javadoc)
-                * @see java.util.Iterator#hasNext()
-                */
-               @Override
-               public
-               boolean
-               hasNext()
-               {
-                       return enumeration.hasMoreElements();
-               }
+        /* (non-Javadoc)
+         * @see java.util.Iterator#hasNext()
+         */
+        @Override
+        public
+        boolean
+        hasNext()
+        {
+            return enumeration.hasMoreElements();
+        }
 
-               /* (non-Javadoc)
-                * @see java.util.Iterator#next()
-                */
-               @Override
-               public
-               K
-               next()
-               {
-                       return enumeration.nextElement();
-               }
+        /* (non-Javadoc)
+         * @see java.util.Iterator#next()
+         */
+        @Override
+        public
+        K
+        next()
+        {
+            return enumeration.nextElement();
+        }
 
-               /* (non-Javadoc)
-                * @see java.util.Iterator#remove()
-                */
-               @Override
-               public
-               void
-               remove()
-               {
-                       throw new UnsupportedOperationException();
-               }
-       }
-       
-       /**
-        
-        * Return Iterator to be converted from <code>enumeration</code>
-        
-        * @param <E> element type interating <code>enumeration</code>
-        * @param enumeration {@link Enumeration} object to be converted
-        
-        * @return converted {@link Iterator}
-        */
-       public
-       static <E>
-       Iterator<E>
-       iterator(
-               final Enumeration<E> enumeration
-       ) {
-               return new EnumerationAdapter<E>( enumeration );
-       }
+        /* (non-Javadoc)
+         * @see java.util.Iterator#remove()
+         */
+        @Override
+        public
+        void
+        remove()
+        {
+            throw new UnsupportedOperationException();
+        }
+    }
+    
+    /**
+     * 
+     * Return Iterator to be converted from <code>enumeration</code>
+     * 
+     * @param <E> element type interating <code>enumeration</code>
+     * @param enumeration {@link Enumeration} object to be converted
+     * 
+     * @return converted {@link Iterator}
+     */
+    public
+    static <E>
+    Iterator<E>
+    iterator(
+        final Enumeration<E> enumeration
+    ) {
+        return new EnumerationAdapter<E>( enumeration );
+    }
 
-       
-       /**
-        * Convert array object to {@link List}
-        
-        * @param source array candidate object
-        
-        * @return converted {@link List}
-        */
-       public static
-       List<?>
-       asList(
-               final Object source
-       )
-       {
-               return Arrays.asList( ArrayUtil.toObjectArray( source ) );
-       }
+    
+    /**
+     * Convert array object to {@link List}
+     * 
+     * @param source array candidate object
+     * 
+     * @return converted {@link List}
+     */
+    public static
+    List<?>
+    asList(
+        final Object source
+    )
+    {
+        return Arrays.asList( ArrayUtil.toObjectArray( source ) );
+    }
 
-       /**
-        
-        * Add array object to <code>collection</code>
-        
-        * @param array array candidate object to be added
-        * @param collection {@link Collection} to add
-        
-        * @see ArrayUtil#toObjectArray(Object)
-        */
-       public static
-       void
-       mergeArrayIntoCollection(
-               final Object array,
-               final Collection<Object> collection
-       )
-       {
-           Assert.notNull( collection );
-               final Object[] arr = ArrayUtil.toObjectArray( array );
-               for ( int i=0, n=arr.length ; i<n ; ++i )
-               {
-                       collection.add( arr[i] );
-               }
-       }
+    /**
+     * 
+     * Add array object to <code>collection</code>
+     * 
+     * @param array array candidate object to be added
+     * @param collection {@link Collection} to add
+     * 
+     * @see ArrayUtil#toObjectArray(Object)
+     */
+    public static
+    void
+    mergeArrayIntoCollection(
+        final Object array,
+        final Collection<Object> collection
+    )
+    {
+        Assert.notNull( collection );
+        final Object[] arr = ArrayUtil.toObjectArray( array );
+        for ( int i=0, n=arr.length ; i<n ; ++i )
+        {
+            collection.add( arr[i] );
+        }
+    }
 
-       /**
-        * Check if <code>iterator</code> meet <code>element</code> in iteration
-        
-        * @param iterator iterating object
-        * @param element object to check
-        
-        * @return <code>true</code> if <code>iterator</code> meet <code>element</code>
-        */
-       public static
-       boolean
-       contains(
-               final Iterator<Object> iterator,
-               final Object element
-       )
-       {
-               if ( null == iterator )
-               {
-                       return false;
-               }
-               
-               while ( iterator.hasNext() )
-               {
-                       final Object candidate = iterator.next();
-                       if ( ObjectUtil.equals( candidate, element ) ) 
-                       {
-                               return true; 
-                       }
-               }
-               return false;
-       }
+    /**
+     * Check if <code>iterator</code> meet <code>element</code> in iteration
+     * 
+     * @param iterator iterating object
+     * @param element object to check
+     * 
+     * @return <code>true</code> if <code>iterator</code> meet <code>element</code>
+     */
+    public static
+    boolean
+    contains(
+        final Iterator<Object> iterator,
+        final Object element
+    )
+    {
+        if ( null == iterator )
+        {
+            return false;
+        }
+        
+        while ( iterator.hasNext() )
+        {
+            final Object candidate = iterator.next();
+            if ( ObjectUtil.equals( candidate, element ) ) 
+            {
+                return true; 
+            }
+        }
+        return false;
+    }
 
-       /**
-        * Check if <code>enumeration</code> meet <code>element</code> in iteration
-        
-        * @param enumeration iterating object
-        * @param element object to check
-        
-        * @return <code>true</code> if <code>enumeration</code> meet <code>element</code>
-        */
-       public static
-       boolean
-       contains(
-               final Enumeration<Object> enumeration,
-               final Object element
-       )
-       {
-               if ( null == enumeration )
-               {
-                       return false;
-               }
-               while( enumeration.hasMoreElements() )
-               {
-                       final Object candidate = enumeration.nextElement();
-                       if ( ObjectUtil.equals( candidate, element ) )
-                       {
-                               return true; 
-                       }
-               }
-               return false;
-       }
+    /**
+     * Check if <code>enumeration</code> meet <code>element</code> in iteration
+     * 
+     * @param enumeration iterating object
+     * @param element object to check
+     * 
+     * @return <code>true</code> if <code>enumeration</code> meet <code>element</code>
+     */
+    public static
+    boolean
+    contains(
+        final Enumeration<Object> enumeration,
+        final Object element
+    )
+    {
+        if ( null == enumeration )
+        {
+            return false;
+        }
+        while( enumeration.hasMoreElements() )
+        {
+            final Object candidate = enumeration.nextElement();
+            if ( ObjectUtil.equals( candidate, element ) )
+            {
+                return true; 
+            }
+        }
+        return false;
+    }
 
 
-       
-       /**
-        * Check if <code>collection</code> contains <code>element</code>
-        
-        * @param collection {@link Collection} to check
-        * @param element object to check
-        
-        * @return <code>true</code> if <code>collection</code> contain <code>element</code>
-        */
-       public static
-       boolean
-       contains(
-               final Collection<Object> collection,
-               final Object element
-       )
-       {
-               if ( null == collection )
-               {
-                       return false;
-               }
-               for ( final Object candidate : collection )
-               {
-                       if ( ObjectUtil.equals( candidate, element ) )
-                       {
-                               return true; 
-                       }
-               }
-               return false;
-       }
-       
-       /**
-        * Check and return if <code>source</code> contain any element of <code>candidates</code>
-        
-        * @param source {@link Collection} to check
-        * @param candidates {@link Collection} whose element is expected in <code>source</code>
-        
-        * @return <code>true</code> if <code>source</code> contain any elemnt of <code>candidates</code>
-        */
-       public static
-       boolean
-       containsAny(
-               final Collection<?> source,
-               final Collection<?> candidates
-       )
-       {
-               if ( isEmpty( source ) || isEmpty( candidates) )
-               {
-                       return false; 
-               }
+    
+    /**
+     * Check if <code>collection</code> contains <code>element</code>
+     * 
+     * @param collection {@link Collection} to check
+     * @param element object to check
+     * 
+     * @return <code>true</code> if <code>collection</code> contain <code>element</code>
+     */
+    public static
+    boolean
+    contains(
+        final Collection<Object> collection,
+        final Object element
+    )
+    {
+        if ( null == collection )
+        {
+            return false;
+        }
+        for ( final Object candidate : collection )
+        {
+            if ( ObjectUtil.equals( candidate, element ) )
+            {
+                return true; 
+            }
+        }
+        return false;
+    }
+    
+    /**
+     * Check and return if <code>source</code> contain any element of <code>candidates</code>
+     * 
+     * @param source {@link Collection} to check
+     * @param candidates {@link Collection} whose element is expected in <code>source</code>
+     * 
+     * @return <code>true</code> if <code>source</code> contain any elemnt of <code>candidates</code>
+     */
+    public static
+    boolean
+    containsAny(
+        final Collection<?> source,
+        final Collection<?> candidates
+    )
+    {
+        if ( isEmpty( source ) || isEmpty( candidates) )
+        {
+            return false; 
+        }
 
-               for ( final Object candidate : candidates )
-               {
-                       if ( source.contains( candidate ) )
-                       {
-                               return true; 
-                       }
-               }
-               return false;
-       }
+        for ( final Object candidate : candidates )
+        {
+            if ( source.contains( candidate ) )
+            {
+                return true; 
+            }
+        }
+        return false;
+    }
 
-       /**
-        * Check <code>collectionType</code> is approximable collection type
-        
-        * @param collectionType type to check
-        
-        * @return <code>true</code> if <code>collectionType</code> is in {@link #APPROXIMABLE_COLLECTION_TYPES} 
-        
-        * @see #APPROXIMABLE_COLLECTION_TYPES
-        */
-       public static
-       boolean
-       isApproximableCollectionType(
-               final Class<?> collectionType
-       )
-       {
-               return APPROXIMABLE_COLLECTION_TYPES.contains( collectionType );
-       }
-       
-       /**
-        * Check <code>mapType</code> is approximable map type
-        
-        * @param mapType type to check
-        
-        * @return <code>true</code> if <code>mapType</code> is in {@link #APPROXIMABLE_MAP_TYPES} 
-        
-        * @see #APPROXIMABLE_MAP_TYPES
-        */
-       public static
-       boolean
-       isApproximableMapType(
-               final Class<?> mapType
-       )
-       {
-               return APPROXIMABLE_MAP_TYPES.contains( mapType );
-       }
-       
-       /**
-        * Create <code>collection</code> matched approximable collection
-        
-        * @param <K> containing type
-        * @param collection {@link Collection} to convert
-        * @param initialCapacity initial size of created collection
-        
-        * @return created approximable collection
-        */
-       public static <K>
-       Collection<K>
-       createApproximableCollection(
-               final Collection<K> collection,
-               final int initialCapacity
-       )
-       {
-               if ( collection instanceof LinkedList<?> )
-               {
-                       return new LinkedList<K>();
-               }
-               else if ( collection instanceof List<?> )
-               {
-                       return new ArrayList<K>( initialCapacity);
-               }
-               else if ( collection instanceof SortedSet<?> )
-               {
-                       return new TreeSet<K>( ( (SortedSet<K>)collection).comparator() );
-               }
-               else
-               {
-                       return new LinkedHashSet<K>( initialCapacity);
-               }
-       }
-       
-       /**
-        * @param <K> Map's Key type
-        * @param <V> Map's Value type
-        * @param map Map argument
-        * @param initialCapacity initial argument for Map which will be created
-        
-        * @return created ApproximableMap
-        */
-       public static <K, V>
-       Map<K, V>
-       createApproximableMap(
-               final Map<K, V> map,
-               final int initialCapacity
-       )
-       {
-               if ( map instanceof SortedMap<?, ?> )
-               {
-                       return new TreeMap<K, V>( ( (SortedMap<K, V>) map).comparator() );
-               }
-               else
-               {
-                       return new LinkedHashMap<K, V>( initialCapacity );
-               }
-       }
-       
-       /* print */
-       
-       /**
-        * Converts <code>obj</code> object to String.
-        
-        * @param obj object to convert
-        
-        * @return converted String
-        */
-       public static
-       String
-       toString(
-               final Object obj
-       )
-       {
-               if ( null == obj )
-               {
-                       return NULL_STRING;
-               }
+    /**
+     * Check <code>collectionType</code> is approximable collection type
+     * 
+     * @param collectionType type to check
+     * 
+     * @return <code>true</code> if <code>collectionType</code> is in {@link #APPROXIMABLE_COLLECTION_TYPES} 
+     * 
+     * @see #APPROXIMABLE_COLLECTION_TYPES
+     */
+    public static
+    boolean
+    isApproximableCollectionType(
+        final Class<?> collectionType
+    )
+    {
+        return APPROXIMABLE_COLLECTION_TYPES.contains( collectionType );
+    }
+    
+    /**
+     * Check <code>mapType</code> is approximable map type
+     * 
+     * @param mapType type to check
+     * 
+     * @return <code>true</code> if <code>mapType</code> is in {@link #APPROXIMABLE_MAP_TYPES} 
+     * 
+     * @see #APPROXIMABLE_MAP_TYPES
+     */
+    public static
+    boolean
+    isApproximableMapType(
+        final Class<?> mapType
+    )
+    {
+        return APPROXIMABLE_MAP_TYPES.contains( mapType );
+    }
+    
+    /**
+     * Create <code>collection</code> matched approximable collection
+     * 
+     * @param <K> containing type
+     * @param collection {@link Collection} to convert
+     * @param initialCapacity initial size of created collection
+     * 
+     * @return created approximable collection
+     */
+    public static <K>
+    Collection<K>
+    createApproximableCollection(
+        final Collection<K> collection,
+        final int initialCapacity
+    )
+    {
+        if ( collection instanceof LinkedList<?> )
+        {
+            return new LinkedList<K>();
+        }
+        else if ( collection instanceof List<?> )
+        {
+            return new ArrayList<K>( initialCapacity);
+        }
+        else if ( collection instanceof SortedSet<?> )
+        {
+            return new TreeSet<K>( ( (SortedSet<K>)collection).comparator() );
+        }
+        else
+        {
+            return new LinkedHashSet<K>( initialCapacity);
+        }
+    }
+    
+    /**
+     * @param <K> Map's Key type
+     * @param <V> Map's Value type
+     * @param map Map argument
+     * @param initialCapacity initial argument for Map which will be created
+     * 
+     * @return created ApproximableMap
+     */
+    public static <K, V>
+    Map<K, V>
+    createApproximableMap(
+        final Map<K, V> map,
+        final int initialCapacity
+    )
+    {
+        if ( map instanceof SortedMap<?, ?> )
+        {
+            return new TreeMap<K, V>( ( (SortedMap<K, V>) map).comparator() );
+        }
+        else
+        {
+            return new LinkedHashMap<K, V>( initialCapacity );
+        }
+    }
+    
+    /* print */
+    
+    /**
+     * Converts <code>obj</code> object to String.
+     * 
+     * @param obj object to convert
+     * 
+     * @return converted String
+     */
+    public static
+    String
+    toString(
+        final Object obj
+    )
+    {
+        if ( null == obj )
+        {
+            return NULL_STRING;
+        }
 
-               if ( obj instanceof String )
-               {
-                       return (String) obj;
-               }
-               else if ( obj.getClass().isArray() )
-               {
-                   int length = Array.getLength( obj );
-                   
-                   if ( 0 == length )
-                   {
-                       return EMPTY_ARRAY; 
-                   }
-                   
-                   final StringBuilder buffer= new StringBuilder();
-                   
-                   buffer.append( ARRAY_START);
-                   for ( int i=0 ; i<length ; ++i )
-                   {
-                       if ( 0 != i ) {
-                           buffer.append( ARRAY_ELEMENT_SEPARATOR );
-                       }
-                       
-                       buffer.append( toString( Array.get( obj, i ) ) );
-                   }
-                   buffer.append( ARRAY_END );
-                   return buffer.toString();
-               }
-               return ObjectUtil.nvl( obj.toString(), EMPTY_STRING );
-       }
+        if ( obj instanceof String )
+        {
+            return (String) obj;
+        }
+        else if ( obj.getClass().isArray() )
+        {
+            int length = Array.getLength( obj );
+            
+            if ( 0 == length )
+            {
+                return EMPTY_ARRAY; 
+            }
+            
+            final StringBuilder buffer= new StringBuilder();
+            
+            buffer.append( ARRAY_START);
+            for ( int i=0 ; i<length ; ++i )
+            {
+                if ( 0 != i ) {
+                    buffer.append( ARRAY_ELEMENT_SEPARATOR );
+                }
+                
+                buffer.append( toString( Array.get( obj, i ) ) );
+            }
+            buffer.append( ARRAY_END );
+            return buffer.toString();
+        }
+        return ObjectUtil.nvl( obj.toString(), EMPTY_STRING );
+    }
 
-       /**
-        * Returns a String from <code>array</code> Object[] with String separator.
-        
-        * @param array Object[] to combine
-        * @param separator the delimiter which is used when Object[] combined
-        
-        * @return combined String
-        */
-       public static <E>
-       String
-       concatenate(
-               final E[] array,
-               final String separator
-       )
-       {
-               return concatenate( (null==array)?null:new ArrayIterator<E>( array ), separator ); 
-       }
-               
-       /**
-        * Returns a String from col {@link Collection} with String separator.  
-        
-        * @param col {@link Collection} object to combine
-        * @param separator the delimiter which is used when {@link Collection} object combined
-        
-        * @return combined String
-        */
-       public static <E>
-       String
-       concatenate(
-               final Collection<E> col,
-               final String separator
-       )
-       {
-               return concatenate( (null==col)?(null):col.iterator(), separator ); 
-       }
-       
-       /**
-        * Returns a String from {@link Iterator} with String separator.
-        
-        * @param iter {@link Iterator} to combine objects
-        * @param separator the delimiter which is used when {@link Iterator} combined
-        
-        * @return combined String
-        */
-       public static <E>
-       String
-       concatenate(
-               Iterator<E> iter,
-               final String separator
-       )
-       {
-               if ( null == iter )
-               {
-                       return NULL_STRING;
-               }
-               
-               if ( !iter.hasNext() )
-               {
-                       return EMPTY_ARRAY; 
-               }
-               
-               final StringBuilder buffer= new StringBuilder();
-               boolean bInit = false;
-               
-               while ( iter.hasNext() )
-               {
-                       Object obj = iter.next();
-                       if ( bInit )
-                       {
-                               buffer.append( separator );
-                       }
-                       bInit = true;
-                       
-                       buffer.append( toString( obj ) );
-               }
-               return buffer.toString();
-       }
-       
-       /* Hash */
-       private static final int MULTIPLIER= 31;
+    /**
+     * Returns a String from <code>array</code> Object[] with String separator.
+     * 
+     * @param array Object[] to combine
+     * @param separator the delimiter which is used when Object[] combined
+     * 
+     * @return combined String
+     */
+    public static <E>
+    String
+    concatenate(
+        final E[] array,
+        final String separator
+    )
+    {
+        return concatenate( (null==array)?null:new ArrayIterator<E>( array ), separator ); 
+    }
+        
+    /**
+     * Returns a String from col {@link Collection} with String separator.  
+     * 
+     * @param col {@link Collection} object to combine
+     * @param separator the delimiter which is used when {@link Collection} object combined
+     * 
+     * @return combined String
+     */
+    public static <E>
+    String
+    concatenate(
+        final Collection<E> col,
+        final String separator
+    )
+    {
+        return concatenate( (null==col)?(null):col.iterator(), separator ); 
+    }
+    
+    /**
+     * Returns a String from {@link Iterator} with String separator.
+     * 
+     * @param iter {@link Iterator} to combine objects
+     * @param separator the delimiter which is used when {@link Iterator} combined
+     * 
+     * @return combined String
+     */
+    public static <E>
+    String
+    concatenate(
+        Iterator<E> iter,
+        final String separator
+    )
+    {
+        if ( null == iter )
+        {
+            return NULL_STRING;
+        }
+        
+        if ( !iter.hasNext() )
+        {
+            return EMPTY_ARRAY; 
+        }
+        
+        final StringBuilder buffer= new StringBuilder();
+        boolean bInit = false;
+        
+        while ( iter.hasNext() )
+        {
+            Object obj = iter.next();
+            if ( bInit )
+            {
+                buffer.append( separator );
+            }
+            bInit = true;
+            
+            buffer.append( toString( obj ) );
+        }
+        return buffer.toString();
+    }
+    
+    /* Hash */
+    private static final int MULTIPLIER= 31;
 
-       private static final int INITIAL_HASH = 7;
-       
-       /**
-        * Creates hash value about object.
-        * <br>
-        * In case of array, get hash value using object's hash value in the array.
-        
-        * @param obj object to get hash value
-        
-        * @return hash value
-        */
-       public static
-       int
-       hashCode(
-               final Object obj
-       )
-       {
-               if ( null == obj )
-               {
-                       return 0;
-               }
-               if ( obj.getClass().isArray() )
-               {
-                       if ( obj instanceof Object[] )
-                       {
-                               return hashCode( (Object[] )obj );
-                       }
-                       else if ( obj instanceof boolean[] )
-                       {
-                               return hashCode( (boolean[] )obj );
-                       }
-                       else if ( obj instanceof byte[] )
-                       {
-                               return hashCode( (byte[] )obj);
-                       }
-                       else if ( obj instanceof char[] )
-                       {
-                               return hashCode( (char[] )obj);
-                       }
-                       else if ( obj instanceof double[] )
-                       {
-                               return hashCode( (double[] )obj);
-                       }
-                       else if ( obj instanceof float[] )
-                       {
-                               return hashCode( (float[] )obj);
-                       }
-                       else if ( obj instanceof int[] )
-                       {
-                               return hashCode( (int[] )obj);
-                       }
-                       else if ( obj instanceof long[] )
-                       {
-                               return hashCode( (long[] )obj);
-                       }
-                       else if ( obj instanceof short[] )
-                       {
-                               return hashCode( (short[] )obj);
-                       }
-               }
-               
-               return obj.hashCode();
-       }
+    private static final int INITIAL_HASH = 7;
+    
+    /**
+     * Creates hash value about object.
+     * <br>
+     * In case of array, get hash value using object's hash value in the array.
+     * 
+     * @param obj object to get hash value
+     * 
+     * @return hash value
+     */
+    public static
+    int
+    hashCode(
+        final Object obj
+    )
+    {
+        if ( null == obj )
+        {
+            return 0;
+        }
+        if ( obj.getClass().isArray() )
+        {
+            if ( obj instanceof Object[] )
+            {
+                return hashCode( (Object[] )obj );
+            }
+            else if ( obj instanceof boolean[] )
+            {
+                return hashCode( (boolean[] )obj );
+            }
+            else if ( obj instanceof byte[] )
+            {
+                return hashCode( (byte[] )obj);
+            }
+            else if ( obj instanceof char[] )
+            {
+                return hashCode( (char[] )obj);
+            }
+            else if ( obj instanceof double[] )
+            {
+                return hashCode( (double[] )obj);
+            }
+            else if ( obj instanceof float[] )
+            {
+                return hashCode( (float[] )obj);
+            }
+            else if ( obj instanceof int[] )
+            {
+                return hashCode( (int[] )obj);
+            }
+            else if ( obj instanceof long[] )
+            {
+                return hashCode( (long[] )obj);
+            }
+            else if ( obj instanceof short[] )
+            {
+                return hashCode( (short[] )obj);
+            }
+        }
+        
+        return obj.hashCode();
+    }
 
-       /**
-        * Returns hash value about <code>array</code> Object[].
-        
-        * @param array Object[] to get hash value
-        
-        * @return hash value
-        */
-       public static
-       int
-       hashCode(
-               final Object[] array
-       )
-       {
-               if ( null == array )
-               {
-                       return 0;
-               }
-               
-               int hash = INITIAL_HASH;
-               for( int i=0, arraySize=array.length ; i<arraySize ; ++i )
-               {
-                       hash = MULTIPLIER * hash + hashCode( array[i] );
-               }
+    /**
+     * Returns hash value about <code>array</code> Object[].
+     * 
+     * @param array Object[] to get hash value
+     * 
+     * @return hash value
+     */
+    public static
+    int
+    hashCode(
+        final Object[] array
+    )
+    {
+        if ( null == array )
+        {
+            return 0;
+        }
+        
+        int hash = INITIAL_HASH;
+        for( int i=0, arraySize=array.length ; i<arraySize ; ++i )
+        {
+            hash = MULTIPLIER * hash + hashCode( array[i] );
+        }
 
-               return hash;
-       }
+        return hash;
+    }
 
-       /**
-        * Returns hash value about <code>array</code> boolean[].
-        
-        * @param array boolean[] to get hash value
-        
-        * @return hash value
-        */
-       public static
-       int
-       hashCode(
-               final boolean[] array
-       )
-       {
-               if ( null == array )
-               {
-                       return 0;
-               }
-               
-               int hash = INITIAL_HASH;
-               for( int i=0, arraySize=array.length ; i<arraySize ; ++i )
-               {
-                       hash = MULTIPLIER * hash + hashCode( array[i] );
-               }
+    /**
+     * Returns hash value about <code>array</code> boolean[].
+     * 
+     * @param array boolean[] to get hash value
+     * 
+     * @return hash value
+     */
+    public static
+    int
+    hashCode(
+        final boolean[] array
+    )
+    {
+        if ( null == array )
+        {
+            return 0;
+        }
+        
+        int hash = INITIAL_HASH;
+        for( int i=0, arraySize=array.length ; i<arraySize ; ++i )
+        {
+            hash = MULTIPLIER * hash + hashCode( array[i] );
+        }
 
-               return hash;
-       }
+        return hash;
+    }
 
-       /**
-        * Returns hash value about <code>array</code> int[].  
-        
-        * @param array int[] to get hash value
-        
-        * @return hash value
-        */
-       public static int
-       hashCode(
-               final byte[] array
-       )
-       {
-               if ( null == array )
-               {
-                       return 0;
-               }
-               
-               int hash = INITIAL_HASH;
-               for( int i=0, arraySize=array.length ; i<arraySize ; ++i )
-               {
-                       hash = MULTIPLIER * hash + array[i];
-               }
+    /**
+     * Returns hash value about <code>array</code> int[].  
+     * 
+     * @param array int[] to get hash value
+     * 
+     * @return hash value
+     */
+    public static int
+    hashCode(
+        final byte[] array
+    )
+    {
+        if ( null == array )
+        {
+            return 0;
+        }
+        
+        int hash = INITIAL_HASH;
+        for( int i=0, arraySize=array.length ; i<arraySize ; ++i )
+        {
+            hash = MULTIPLIER * hash + array[i];
+        }
 
-               return hash;
-       }
+        return hash;
+    }
 
-       /**
-        * Returns hash value about <code>array</code> char[].
-        
-        * @param array char[] to get hash value
-        
-        * @return hash value
-        */
-       public static
-       int
-       hashCode(
-               final char[] array
-       )
-       {
-               if ( null == array )
-               {
-                       return 0;
-               }
-               
-               int hash = INITIAL_HASH;
-               for( int i=0, arraySize=array.length ; i<arraySize ; ++i )
-               {
-                       hash = MULTIPLIER * hash + hashCode( array[i] );
-               }
+    /**
+     * Returns hash value about <code>array</code> char[].
+     * 
+     * @param array char[] to get hash value
+     * 
+     * @return hash value
+     */
+    public static
+    int
+    hashCode(
+        final char[] array
+    )
+    {
+        if ( null == array )
+        {
+            return 0;
+        }
+        
+        int hash = INITIAL_HASH;
+        for( int i=0, arraySize=array.length ; i<arraySize ; ++i )
+        {
+            hash = MULTIPLIER * hash + hashCode( array[i] );
+        }
 
-               return hash;
-       }
+        return hash;
+    }
 
-       /**
-        * Returns hash value about <code>array</code> double[].
-        
-        * @param array double[] to get hash value
-        
-        * @return hash value
-        */
-       public static
-       int 
-       hashCode(
-               final double[] array
-       )
-       {
-               if ( null == array )
-               {
-                       return 0;
-               }
-               
-               int hash = INITIAL_HASH;
-               for( int i=0, arraySize=array.length ; i<arraySize ; ++i )
-               {
-                       hash = MULTIPLIER * hash + hashCode( array[i] );
-               }
+    /**
+     * Returns hash value about <code>array</code> double[].
+     * 
+     * @param array double[] to get hash value
+     * 
+     * @return hash value
+     */
+    public static
+    int 
+    hashCode(
+        final double[] array
+    )
+    {
+        if ( null == array )
+        {
+            return 0;
+        }
+        
+        int hash = INITIAL_HASH;
+        for( int i=0, arraySize=array.length ; i<arraySize ; ++i )
+        {
+            hash = MULTIPLIER * hash + hashCode( array[i] );
+        }
 
-               return hash;
-       }
+        return hash;
+    }
 
-       /**
-        * Returns hash value about <code>array</code> float[].
-        
-        * @param array float[] to get hash value
-        
-        * @return hash value
-        */
-       public static
-       int
-       hashCode(
-               final float[] array
-       )
-       {
-               if ( null == array )
-               {
-                       return 0;
-               }
-               
-               int hash = INITIAL_HASH;
-               for( int i=0, arraySize=array.length ; i<arraySize ; ++i )
-               {
-                       hash = MULTIPLIER * hash + hashCode( array[i] );
-               }
+    /**
+     * Returns hash value about <code>array</code> float[].
+     * 
+     * @param array float[] to get hash value
+     * 
+     * @return hash value
+     */
+    public static
+    int
+    hashCode(
+        final float[] array
+    )
+    {
+        if ( null == array )
+        {
+            return 0;
+        }
+        
+        int hash = INITIAL_HASH;
+        for( int i=0, arraySize=array.length ; i<arraySize ; ++i )
+        {
+            hash = MULTIPLIER * hash + hashCode( array[i] );
+        }
 
-               return hash;
-       }
+        return hash;
+    }
 
-       /**
-        * Returns hash value about <code>array</code> int[].
-        
-        * @param array int[] to get hash value
-        
-        * @return hash value
-        */
-       public static
-       int
-       hashCode(
-               final int[] array
-       )
-       {
-               if ( null == array )
-               {
-                       return 0;
-               }
-               
-               int hash = INITIAL_HASH;
-               for( int i=0, arraySize=array.length ; i<arraySize ; ++i )
-               {
-                       hash = MULTIPLIER * hash + hashCode( array[i] );
-               }
+    /**
+     * Returns hash value about <code>array</code> int[].
+     * 
+     * @param array int[] to get hash value
+     * 
+     * @return hash value
+     */
+    public static
+    int
+    hashCode(
+        final int[] array
+    )
+    {
+        if ( null == array )
+        {
+            return 0;
+        }
+        
+        int hash = INITIAL_HASH;
+        for( int i=0, arraySize=array.length ; i<arraySize ; ++i )
+        {
+            hash = MULTIPLIER * hash + hashCode( array[i] );
+        }
 
-               return hash;
-       }
+        return hash;
+    }
 
-       /**
-        * Returns hash value about <code>array</code> long[].
-        
-        * @param array long[] to get hash value 
-        
-        * @return hash value
-        */
-       public static
-       int
-       hashCode(
-               final long[] array
-       )
-       {
-               if ( null == array )
-               {
-                       return 0;
-               }
-               
-               int hash = INITIAL_HASH;
-               for( int i=0, arraySize=array.length ; i<arraySize ; ++i )
-               {
-                       hash = MULTIPLIER * hash + hashCode( array[i] );
-               }
+    /**
+     * Returns hash value about <code>array</code> long[].
+     * 
+     * @param array long[] to get hash value 
+     * 
+     * @return hash value
+     */
+    public static
+    int
+    hashCode(
+        final long[] array
+    )
+    {
+        if ( null == array )
+        {
+            return 0;
+        }
+        
+        int hash = INITIAL_HASH;
+        for( int i=0, arraySize=array.length ; i<arraySize ; ++i )
+        {
+            hash = MULTIPLIER * hash + hashCode( array[i] );
+        }
 
-               return hash;
-       }
+        return hash;
+    }
 
-       /**
-        * Returns hash value about <code>array</code> short[].
-        
-        * @param array short[] to get hash value
-        
-        * @return hash value
-        */
-       public static
-       int
-       hashCode(
-               final short[] array
-       )
-       {
-               if ( null == array )
-               {
-                       return 0;
-               }
-               
-               int hash = INITIAL_HASH;
-               for( int i=0, arraySize=array.length ; i<arraySize ; ++i )
-               {
-                       hash = MULTIPLIER * hash + hashCode( array[i] );
-               }
+    /**
+     * Returns hash value about <code>array</code> short[].
+     * 
+     * @param array short[] to get hash value
+     * 
+     * @return hash value
+     */
+    public static
+    int
+    hashCode(
+        final short[] array
+    )
+    {
+        if ( null == array )
+        {
+            return 0;
+        }
+        
+        int hash = INITIAL_HASH;
+        for( int i=0, arraySize=array.length ; i<arraySize ; ++i )
+        {
+            hash = MULTIPLIER * hash + hashCode( array[i] );
+        }
 
-               return hash;
-       }
+        return hash;
+    }
 
-       /**
-        * Returns hash value about <code>bool</code> boolean.
-        
-        * @param bool boolean type parameter to get hash value
-        
-        * @return hash value
-        */
-       public static
-       int
-       hashCode(
-               final boolean bool
-       )
-       {
-               return bool ? 1231 : 1237;
-       }
+    /**
+     * Returns hash value about <code>bool</code> boolean.
+     * 
+     * @param bool boolean type parameter to get hash value
+     * 
+     * @return hash value
+     */
+    public static
+    int
+    hashCode(
+        final boolean bool
+    )
+    {
+        return bool ? 1231 : 1237;
+    }
 
-       /**
-        * Return hash value about <code>dbl</code> double.
-        
-        * @param dbl double type parameter to get hash value
-        
-        * @return hash value
-        */
-       public static
-       int
-       hashCode(
-               final double dbl
-       )
-       {
-               long bits = Double.doubleToLongBits( dbl );
-               return hashCode( bits );
-       }
+    /**
+     * Return hash value about <code>dbl</code> double.
+     * 
+     * @param dbl double type parameter to get hash value
+     * 
+     * @return hash value
+     */
+    public static
+    int
+    hashCode(
+        final double dbl
+    )
+    {
+        long bits = Double.doubleToLongBits( dbl );
+        return hashCode( bits );
+    }
 
-       /**
-        * Returns hash value about <code>flt</code> float.
-        
-        * @param flt float type parameter to get hash value
-        
-        * @return hash value
-        */
-       public static
-       int
-       hashCode(
-               float flt
-       )
-       {
-               return Float.floatToIntBits( flt );
-       }
+    /**
+     * Returns hash value about <code>flt</code> float.
+     * 
+     * @param flt float type parameter to get hash value
+     * 
+     * @return hash value
+     */
+    public static
+    int
+    hashCode(
+        float flt
+    )
+    {
+        return Float.floatToIntBits( flt );
+    }
 
 
-       /**
-        * Returns hash value about <code>lng</code> long.
-        
-        * @param lng long type parameter to get hash value
-        
-        * @return hash value
-        */
-       public static
-       int
-       hashCode(
-               final long lng
-       )
-       {
-               return (int) ( lng ^ ( lng >>> 32 ) );
-       }
-       
-       /* Equals */
-       /**
-        * Returns whether it is same object type or not by comparing each column's type of {@link Collection} object.
-        
-        * @param <K> object type about {@link Collection}
-        * @param cols {@link Collection} objects
-        
-        * @return true if each column's type of the {@link Collection} object is same
-        */
-       @SuppressWarnings("unchecked")
-       public static <K>
-       boolean
-       equals(
-               final Collection<? extends K>... cols
-       )
-       {
-               
-               // flag if collection is null
-               boolean bInit = false;
-               int size = 0;
-               for ( final Collection<? extends K> col : cols )
-               {
-                       if ( !bInit )
-                       {
-                               if ( null == col )
-                               {
-                                       size = -1;
-                               }
-                               else
-                               {
-                                       size = col.size();
-                               }
-                               bInit = true;
-                       }
-                       if ( size < 0 )
-                       {
-                               if ( null != col )
-                               {
-                                       return false;
-                               }
-                       }
-                       else if ( null == col || col.size() != size )
-                       {
-                               return false;
-                       }
-               }
-               if ( size < 0 )
-               {
-                       return true;
-               }
+    /**
+     * Returns hash value about <code>lng</code> long.
+     * 
+     * @param lng long type parameter to get hash value
+     * 
+     * @return hash value
+     */
+    public static
+    int
+    hashCode(
+        final long lng
+    )
+    {
+        return (int) ( lng ^ ( lng >>> 32 ) );
+    }
+    
+    /* Equals */
+    /**
+     * Returns whether it is same object type or not by comparing each column's type of {@link Collection} object.
+     * 
+     * @param <K> object type about {@link Collection}
+     * @param cols {@link Collection} objects
+     * 
+     * @return true if each column's type of the {@link Collection} object is same
+     */
+    @SuppressWarnings("unchecked")
+    public static <K>
+    boolean
+    equals(
+        final Collection<? extends K>... cols
+    )
+    {
+        
+        // flag if collection is null
+        boolean bInit = false;
+        int size = 0;
+        for ( final Collection<? extends K> col : cols )
+        {
+            if ( !bInit )
+            {
+                if ( null == col )
+                {
+                    size = -1;
+                }
+                else
+                {
+                    size = col.size();
+                }
+                bInit = true;
+            }
+            if ( size < 0 )
+            {
+                if ( null != col )
+                {
+                    return false;
+                }
+            }
+            else if ( null == col || col.size() != size )
+            {
+                return false;
+            }
+        }
+        if ( size < 0 )
+        {
+            return true;
+        }
 
-               final Iterator<? extends K>[] iters = new Iterator[cols.length];
-               for ( int i = 0, n = iters.length ; i<n ; ++i )
-               {
-                       iters[i] = cols[i].iterator();
-               }
-               
-               while ( iters[0].hasNext() )
-               {
-                       final K obj = iters[0].next();
-                       for ( int i = 1, n = iters.length ; i<n ; ++i )
-                       {
-                               final K other = iters[i].next();
-                               
-                               if ( !ObjectUtil.equals( obj, other ) )
-                               {
-                                       return false;
-                               }
-                       }
-               }
-               
-               return true;
-       }
-       
-       /**
-        * Returns whether it is same object type or not by comparing each column's type of Object[].
-        
-        * @param objsVar target objects
-        
-        * @return true if each column's type of the Object[] is same
-        
-        */
-       public static
-       boolean
-       equals(
-               final Object[]... objsVar
-       )
-       {
-               // flag if collection is null
-               boolean bInit = false;
-               int size = 0;
-               for ( final Object[] objs : objsVar )
-               {
-                       if ( !bInit )
-                       {
-                               if ( null == objs )
-                               {
-                                       size = -1;
-                               }
-                               else
-                               {
-                                       size = objs.length;
-                               }
-                               bInit = true;
-                       }
-                       if ( size < 0 )
-                       {
-                               if ( null != objs )
-                               {
-                                       return false;
-                               }
-                       }
-                       else if ( null == objs || objs.length != size )
-                       {
-                               return false;
-                       }
-               }
-               if ( size < 0 )
-               {
-                       return true;
-               }
+        final Iterator<? extends K>[] iters = new Iterator[cols.length];
+        for ( int i = 0, n = iters.length ; i<n ; ++i )
+        {
+            iters[i] = cols[i].iterator();
+        }
+        
+        while ( iters[0].hasNext() )
+        {
+            final K obj = iters[0].next();
+            for ( int i = 1, n = iters.length ; i<n ; ++i )
+            {
+                final K other = iters[i].next();
+                
+                if ( !ObjectUtil.equals( obj, other ) )
+                {
+                    return false;
+                }
+            }
+        }
+        
+        return true;
+    }
+    
+    /**
+     * Returns whether it is same object type or not by comparing each column's type of Object[].
+     * 
+     * @param objsVar target objects
+     * 
+     * @return true if each column's type of the Object[] is same
+     * 
+     */
+    public static
+    boolean
+    equals(
+        final Object[]... objsVar
+    )
+    {
+        // flag if collection is null
+        boolean bInit = false;
+        int size = 0;
+        for ( final Object[] objs : objsVar )
+        {
+            if ( !bInit )
+            {
+                if ( null == objs )
+                {
+                    size = -1;
+                }
+                else
+                {
+                    size = objs.length;
+                }
+                bInit = true;
+            }
+            if ( size < 0 )
+            {
+                if ( null != objs )
+                {
+                    return false;
+                }
+            }
+            else if ( null == objs || objs.length != size )
+            {
+                return false;
+            }
+        }
+        if ( size < 0 )
+        {
+            return true;
+        }
 
-               
-               for ( int i=1, n=objsVar.length ; i<n ; ++i )
-               {
-                       for ( int j=0 ; j<size ; ++j )
-                       {
-                               if ( !ObjectUtil.equals( objsVar[0][j], objsVar[i][j] ) )
-                               {
-                                       return false;
-                               }
-                       }
-               }
-               return true;
+        
+        for ( int i=1, n=objsVar.length ; i<n ; ++i )
+        {
+            for ( int j=0 ; j<size ; ++j )
+            {
+                if ( !ObjectUtil.equals( objsVar[0][j], objsVar[i][j] ) )
+                {
+                    return false;
+                }
+            }
+        }
+        return true;
 
-       }
-       
-       /**
-        * <p>
-        * Swaps <code><I>i</I></code>th object's location with <code><I>j</I></code>th object in <code>objs</code> Object[].
-        * </p>
-        * @param objs target
-        * @param i location of object to be swapped
-        * @param j location of object to be swapped
-        */
-       public static
-       void
-       swap(
-               final Object[] objs,
-               final int i,
-               final int j
-       )
-       {
-               Object temp = objs[i];
-               objs[i] = objs[j];
-               objs[j] = temp;
-       }
+    }
+    
+    /**
+     * <p>
+     * Swaps <code><I>i</I></code>th object's location with <code><I>j</I></code>th object in <code>objs</code> Object[].
+     * </p>
+     * @param objs target
+     * @param i location of object to be swapped
+     * @param j location of object to be swapped
+     */
+    public static
+    void
+    swap(
+        final Object[] objs,
+        final int i,
+        final int j
+    )
+    {
+        Object temp = objs[i];
+        objs[i] = objs[j];
+        objs[j] = temp;
+    }
+    
+    /**
+     * 
+     * Check that target class is available class to be inserted in the collection.
+     * If return is positive, target class is available.
+     * If return is negative, target class is not available.
+     * If return is zero, we cannot judge that target class is available or not.
+     * For example, if collection size is zero, or every element in the collection is null, we cannot judge it.
+     * Although collection is defined for Object, all of its elements are String, it returns negative,
+     * because we cannot know generic type exactly in runtime.  
+     * 
+     * @param collection
+     * @param targetClass
+     * @return
+     * @author ho.namkoong{@literal <ho.namkoong@samsung.com>}
+     */
+    public static 
+    int 
+    isAvailableGenericTypeForCollection(
+        final Collection<?> collection,
+        final Class<?> targetClass
+    ) 
+    {
+        if(collection.size() < 1) {
+            return 0;
+        }
+        boolean foundNotNull = false;
+        for(Object o: collection) {
+            if(o != null) {
+                foundNotNull = true;
+                if(o.getClass().isAssignableFrom(targetClass)) {
+                    return 1;
+                }
+            }
+        }
+        if(foundNotNull) {
+            return -1;
+        }
+        return 0;
+    }
+    
+    /**
+     * 
+     * Resolve set as list.
+     * Result list has same order of iterator of set. 
+     * 
+     * @param set set to be resolved as a list.
+     * @return list which contains all the elements in the set.
+     * @author ho.namkoong{@literal <ho.namkoong@samsung.com>}
+     */
+    public static <E>
+    List<E> 
+    resolveSetAsList(
+        final Set<E> set
+    ) 
+    {
+        Iterator<E> itr = set.iterator();
+        ArrayList<E> result = new ArrayList<E>();
+        
+        while(itr.hasNext()) {
+             E obj = itr.next();
+             result.add(obj);
+        }
+        
+        return result;
+    }
 }
index 250a72c..0e7f335 100755 (executable)
@@ -40,6 +40,7 @@ import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.OutputStream;
 import java.io.OutputStreamWriter;
+import java.net.URL;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashSet;
@@ -578,4 +579,71 @@ public class FileUtil {
         Assert.isTrue( aDirectory.isDirectory(), "Is not a directory: " + aDirectory );
         Assert.isTrue( aDirectory.canRead(), "Directory cannot be read: " + aDirectory );
     }
+    
+    /**
+     * This method takes a URL as parameter to read the contents, and to add
+     * into a string buffer.
+     * 
+     * @param source
+     *            URL to read the contents.
+     * @return string, contents of a file specified in the URL source path.
+     * @throws IOException
+     */
+    public static String readFromFile(URL source) throws IOException {
+        char[] chars = new char[4092];
+        InputStreamReader contentsReader = null;
+        StringBuffer buffer = new StringBuffer();
+        if (!new java.io.File(source.getFile()).exists()) {
+            throw new FileNotFoundException();
+        } else {
+            contentsReader = new InputStreamReader(source.openStream());
+            int c;
+            do {
+                c = contentsReader.read(chars);
+                if (c == -1)
+                    break;
+                buffer.append(chars, 0, c);
+            } while (c != -1);
+            contentsReader.close();
+        }
+        return buffer.toString();
+    }
+    
+    /**
+     * Append path.
+     * @param originalPath original path
+     * @param appendPath path which will be appended to original path.
+     * @return appended path 
+     */
+    public static String appendPath(String originalPath, String appendPath) {
+        originalPath = originalPath.trim();
+        appendPath = appendPath.trim();
+        
+        if(OSChecker.isWindows()) {
+            originalPath = originalPath.replace('/', File.separatorChar);
+            appendPath = appendPath.replace('/', File.separatorChar);
+        }
+        else {
+            originalPath = originalPath.replace('\\', File.separatorChar);
+            appendPath = appendPath.replace('\\', File.separatorChar);
+        }
+        
+        return trimLastPath(originalPath).concat(trimFirstPath(appendPath));
+    }
+    
+    private static String trimLastPath(String originalPath) {
+        char lastChar = originalPath.charAt(originalPath.length() - 1);
+        if(lastChar == File.separatorChar) {
+            return originalPath.substring(0, originalPath.length() - 1);
+        }
+        return originalPath;
+    }
+    
+    private static String trimFirstPath(String originalPath) {
+        char firstChar = originalPath.charAt(0);
+        if(firstChar != File.separatorChar) {
+            return ("" + File.separatorChar).concat(originalPath);
+        }
+        return originalPath;
+    }
 }
old mode 100755 (executable)
new mode 100644 (file)
index d548d29..b98b36b
@@ -53,6 +53,7 @@ import java.util.TreeSet;
 import java.util.Vector;
 import java.util.concurrent.atomic.AtomicInteger;
 
+import org.junit.Before;
 import org.junit.Test;
 
 
@@ -949,5 +950,72 @@ CollectionUtilTest
         } catch (Exception e) {
         }
     }
+    
+    /**
+     * Test {@link CollectionUtil#isAvailableGenericTypeForCollection(Collection, Class)}
+     * 
+     * @throws Exception is case of failure in test
+     * 
+     * @see {@link CollectionUtil#resolveSetAsList(Set)}
+     */
+    @Test
+    public
+    void
+    test_isAvailableGenericTypeForCollection() {
+        ArrayList<Object> testList = new ArrayList<Object>();
+        
+        int result = CollectionUtil.isAvailableGenericTypeForCollection(testList, Object.class);
+        assertTrue(result == 0);
+        
+        testList.add(null);
+        result = CollectionUtil.isAvailableGenericTypeForCollection(testList, Object.class);
+        assertTrue(result == 0);
+        
+        testList.add("empty");
+        result = CollectionUtil.isAvailableGenericTypeForCollection(testList, File.class);
+        assertTrue(result == -1);
+        
+        result = CollectionUtil.isAvailableGenericTypeForCollection(testList, Object.class);
+        assertTrue(result == -1);
+        
+        result = CollectionUtil.isAvailableGenericTypeForCollection(testList, String.class);
+        assertTrue(result == 1);
+        
+        testList.add(new Object());
+        result = CollectionUtil.isAvailableGenericTypeForCollection(testList, Object.class);
+        assertTrue(result == 1);
+        
+        testList.remove(0);
+        result = CollectionUtil.isAvailableGenericTypeForCollection(testList, String.class);
+        assertTrue(result == 1);
+    }
+    
+    
+    
+    /**
+     * Test {@link CollectionUtil#resolveSetAsList(Set)}
+     * 
+     * @throws Exception is case of failure in test
+     * 
+     * @see {@link CollectionUtil#resolveSetAsList(Set)}
+     */
+    @Test
+    public
+    void
+    test_resolveSetAsList() {
+        LinkedHashSet<String> set = new LinkedHashSet<String>();
+        String[] stringArray= {"one", "two", "three", "four", "five"};
+        
+        for(String string: stringArray) {
+            set.add(string);
+        }
+        
+        List<String> result = CollectionUtil.resolveSetAsList(set);
+        
+        for(int i=0; i<stringArray.length; i++) {
+            System.out.println(i);
+            assertTrue(result.get(i).equals(stringArray[i]));
+        }
+    }
 }
 
index dd3594e..a0bfeaa 100644 (file)
@@ -27,7 +27,13 @@ package org.tizen.common.util;
 import static org.junit.Assert.*;
 
 import java.io.ByteArrayInputStream;
+import java.io.File;
 import java.io.InputStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Stack;
 
 import org.junit.Test;
 
@@ -42,6 +48,9 @@ import org.junit.Test;
  */
 public class FileUtilTest {
 
+    public static final String TEST_RESOURCE_DEST = "test/_test_files";
+    public static final String TEST_RESOURCE_SRC = "test/test_files";
+    
        /**
         * Test {@link FileUtil#getFileExtension(String)}
         * 
@@ -116,5 +125,213 @@ public class FileUtilTest {
           new Object[] {"",""},      
         };
     }
-
+    
+    /**
+     * Test {@link FileUtil#copyRecursively(String, String)}
+     *  
+     * @throws Exception in case of failure in test
+     * 
+     * @see {@link FileUtil#copyRecursively(String, String)}
+     */
+    @Test
+    public void test_copyRecursively1() throws Exception {
+        
+        try {
+            if(!checkTestSrcExist()) {
+                return;
+            }
+            
+            FileUtil.copyRecursively(TEST_RESOURCE_SRC, TEST_RESOURCE_DEST);
+            
+            List<File> result = compareFiles(TEST_RESOURCE_SRC, TEST_RESOURCE_DEST);
+            assertTrue(result.size() == 0);
+        }
+        finally {
+            File destDir = new File(TEST_RESOURCE_DEST);
+            if(destDir.exists()) {
+                FileUtil.recursiveDelete(destDir);
+            }
+        }
+    }
+    
+    /**
+     * Test {@link FileUtil#copyRecursively(String, String, boolean)}}
+     *  
+     * @throws Exception in case of failure in test
+     * 
+     * @see {@link FileUtil#copyRecursively(String, String, boolean)}
+     */
+    @Test
+    public void test_copyRecursively2() throws Exception {
+        
+        try {
+            if(!checkTestSrcExist()) {
+                return;
+            }
+            
+            String overwriteFileName = "about_files/LICENSE-2.0.htm";
+            String originalFileName = "about_files/freemarker-LICENSE.txt";
+            String copiedFileName = FileUtil.appendPath(TEST_RESOURCE_DEST, originalFileName);
+            
+            long overwriteSize = new File(overwriteFileName).getTotalSpace();
+            long originalSize = new File(originalFileName).getTotalSpace();
+            
+            FileUtil.copyTo(FileUtil.appendPath(TEST_RESOURCE_SRC, overwriteFileName), copiedFileName);
+            FileUtil.copyRecursively(TEST_RESOURCE_SRC, TEST_RESOURCE_DEST, false);
+            
+            long copiedSize = new File(copiedFileName).getTotalSpace();
+            assertTrue(overwriteSize == copiedSize);
+            
+            File destDir = new File(TEST_RESOURCE_DEST);
+            if(destDir.exists()) {
+                FileUtil.recursiveDelete(destDir);
+            }
+            
+            List<File> result = compareFiles(TEST_RESOURCE_SRC, TEST_RESOURCE_DEST);
+            assertTrue(result.size() == 0);
+            
+            FileUtil.copyRecursively(TEST_RESOURCE_SRC, TEST_RESOURCE_DEST, true);
+            
+            copiedSize = new File(copiedFileName).getTotalSpace();
+            assertTrue(originalSize == copiedSize);
+            
+            result = compareFiles(TEST_RESOURCE_SRC, TEST_RESOURCE_DEST);
+            assertTrue(result.size() == 0);
+        }
+        finally {
+            File destDir = new File(TEST_RESOURCE_DEST);
+            if(destDir.exists()) {
+                FileUtil.recursiveDelete(destDir);
+            }
+        }
+    }
+    
+    /**
+     * Test {@link FileUtil#copyRecursively(String, String, boolean, File...)}
+     *  
+     * @throws Exception in case of failure in test
+     * 
+     * @see {@link FileUtil#copyRecursively(String, String, boolean, File...)}
+     */
+    @Test
+    public void test_copyRecursively3() throws Exception {
+        
+        try {
+            if(!checkTestSrcExist()) {
+                return;
+            }
+            
+            HashSet<File> filter = new HashSet<File>();
+            File filter1 = new File(TEST_RESOURCE_SRC + "/about_files/LICENSE-2.0.htm");
+            File filter2 = new File(TEST_RESOURCE_SRC + "/resource/text.txt");
+            File filter3 = new File(TEST_RESOURCE_SRC + "/resource/resource/text.txt");
+            
+            filter.add(filter1);
+            filter.add(filter2);
+            filter.add(filter3);
+            
+            FileUtil.copyRecursively(TEST_RESOURCE_SRC, TEST_RESOURCE_DEST, false, filter1, filter2, filter3);
+            
+            List<File> result = compareFiles(TEST_RESOURCE_SRC, TEST_RESOURCE_DEST);
+            
+            for(File resultFile: result) {
+                assertTrue(filter.contains(resultFile));
+            }
+        }
+        finally {
+            File destDir = new File(TEST_RESOURCE_DEST);
+            if(destDir.exists()) {
+                FileUtil.recursiveDelete(destDir);
+            }
+        }
+    }
+    
+    private boolean checkTestSrcExist() {
+        File src = new File(TEST_RESOURCE_SRC);
+        return src.exists();
+    }
+    
+    /**
+     * This method is used for checking whether copyRecursively works fine.
+     * If destDir does not contain some files in srcDir, they are contained in result List.
+     * @param srcDir source directory
+     * @param destDir destination direcoty to be compared with source directory.
+     * @return Files in source directory destination directory does not contain.
+     */
+    private static List<File> compareFiles(String srcDir, String destDir) {
+        
+        List<File> result = new ArrayList<File>();
+        File srcFiles = new File(srcDir);
+        
+        if(!srcFiles.exists()) {
+            return result;
+        }
+        
+        Stack<File> srcStack = new Stack<File>();
+        Stack<File> destStack = new Stack<File>();
+        
+        while(!srcStack.isEmpty()) {
+            File _srcFile = srcStack.pop();
+            File _destFile = destStack.pop();
+            
+            if(!_destFile.exists()) {
+                result.add(_srcFile);
+            }
+            
+            if(_srcFile.isDirectory()) {
+                for(File __srcFile:_srcFile.listFiles()) {
+                    srcStack.add(__srcFile);
+                    destStack.add(new File(_destFile, __srcFile.getName()));
+                }
+            }
+        }
+        
+        return result;
+    }
+    
+    /**
+     * Test {@link FileUtil#readFromFile(URL)}
+     * 
+     * @throws Exception in case of failure in test
+     * 
+     * @see {@link FileUtil#readFromFile(URL)}
+     * @throws Exception
+     */
+    @Test
+    public void test_readFromFile() throws Exception {
+        
+        String result = "HOHOHO\nHAHAHA\nNAMKOONGHO";
+        
+        File file = new File("test/test_files/resource/text.txt");
+        
+        if(file.exists()) {
+            URL url = file.toURI().toURL();
+            assertTrue(result.equals(FileUtil.readFromFile(url)));
+        }
+    }
+    /**
+     * Test {@link FileUtil#appendPath(String, String)}
+     * 
+     * @throws Exception in case of failure in test
+     *
+     * @see {@link FileUtil#appendPath(String, String)}
+     * @throws Exception
+     */
+    @Test
+    public void test_appendPath() throws Exception {
+        String windowFirst = "\\a\\b\\c\\d\\";
+        String windowLast = "\\e\\f\\g\\h\\";
+        
+        String linuxFirst = "/a/b/c/d/";
+        String linuxLast = "/e/f/g/h/";
+        
+        String result = File.separatorChar + "a" + File.separatorChar + "b" + File.separatorChar + "c" + 
+                File.separatorChar + "d" + File.separatorChar + "e" + File.separatorChar + "f" + File.separatorChar + 
+                "g" + File.separatorChar + "h" + File.separatorChar;
+        
+        assertTrue(result.equals(FileUtil.appendPath(windowFirst, linuxLast)));
+        assertTrue(result.equals(FileUtil.appendPath(windowFirst, windowLast)));
+        assertTrue(result.equals(FileUtil.appendPath(linuxFirst, linuxLast)));
+        assertTrue(result.equals(FileUtil.appendPath(linuxFirst, windowLast)));
+    }
 }
diff --git a/org.tizen.common/test/test_files/about_files/LICENSE-2.0.htm b/org.tizen.common/test/test_files/about_files/LICENSE-2.0.htm
new file mode 100644 (file)
index 0000000..f7ca656
--- /dev/null
@@ -0,0 +1,191 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html lang="en">
+  <head>
+    <title>Apache License, Version 2.0</title>
+
+    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
+    <meta property="og:image" content="http://www.apache.org/images/asf_logo.gif" />
+
+    <link rel="stylesheet" type="text/css" media="screen" href="/css/style.css">
+    <link rel="stylesheet" type="text/css" media="screen" href="/css/code.css">
+
+    <script type="text/javascript" src="/js/jquery.js"></script>
+    <script type="text/javascript" src="/js/apache_boot.js"></script>
+
+    
+
+    
+    <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file to you under the Apache License, Version 2.0 (the &quot;License&quot;); you may not use this file except in compliance with the License.  You may obtain a copy of the License at . http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an &quot;AS IS&quot; BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the specific language governing permissions and limitations under the License. -->
+  </head>
+
+  <body>
+    <div id="page" class="container_16">
+      <div id="header" class="grid_8">
+        <h1>The Apache Software Foundation</h1>
+        <h2>Apache License, Version 2.0</h2>
+      </div>
+
+      <div class="clear"></div>
+      <div id="content" class="grid_16"><div class="section-content"><p>Apache License<br></br>Version 2.0, January 2004<br></br>
+<a href="http://www.apache.org/licenses/">http://www.apache.org/licenses/</a> </p>
+<p>TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION</p>
+<p><strong><a name="definitions">1. Definitions</a></strong>.</p>
+<p>"License" shall mean the terms and conditions for use, reproduction, and
+distribution as defined by Sections 1 through 9 of this document.</p>
+<p>"Licensor" shall mean the copyright owner or entity authorized by the
+copyright owner that is granting the License.</p>
+<p>"Legal Entity" shall mean the union of the acting entity and all other
+entities that control, are controlled by, or are under common control with
+that entity. For the purposes of this definition, "control" means (i) the
+power, direct or indirect, to cause the direction or management of such
+entity, whether by contract or otherwise, or (ii) ownership of fifty
+percent (50%) or more of the outstanding shares, or (iii) beneficial
+ownership of such entity.</p>
+<p>"You" (or "Your") shall mean an individual or Legal Entity exercising
+permissions granted by this License.</p>
+<p>"Source" form shall mean the preferred form for making modifications,
+including but not limited to software source code, documentation source,
+and configuration files.</p>
+<p>"Object" form shall mean any form resulting from mechanical transformation
+or translation of a Source form, including but not limited to compiled
+object code, generated documentation, and conversions to other media types.</p>
+<p>"Work" shall mean the work of authorship, whether in Source or Object form,
+made available under the License, as indicated by a copyright notice that
+is included in or attached to the work (an example is provided in the
+Appendix below).</p>
+<p>"Derivative Works" shall mean any work, whether in Source or Object form,
+that is based on (or derived from) the Work and for which the editorial
+revisions, annotations, elaborations, or other modifications represent, as
+a whole, an original work of authorship. For the purposes of this License,
+Derivative Works shall not include works that remain separable from, or
+merely link (or bind by name) to the interfaces of, the Work and Derivative
+Works thereof.</p>
+<p>"Contribution" shall mean any work of authorship, including the original
+version of the Work and any modifications or additions to that Work or
+Derivative Works thereof, that is intentionally submitted to Licensor for
+inclusion in the Work by the copyright owner or by an individual or Legal
+Entity authorized to submit on behalf of the copyright owner. For the
+purposes of this definition, "submitted" means any form of electronic,
+verbal, or written communication sent to the Licensor or its
+representatives, including but not limited to communication on electronic
+mailing lists, source code control systems, and issue tracking systems that
+are managed by, or on behalf of, the Licensor for the purpose of discussing
+and improving the Work, but excluding communication that is conspicuously
+marked or otherwise designated in writing by the copyright owner as "Not a
+Contribution."</p>
+<p>"Contributor" shall mean Licensor and any individual or Legal Entity on
+behalf of whom a Contribution has been received by Licensor and
+subsequently incorporated within the Work.</p>
+<p><strong><a name="copyright">2. Grant of Copyright License</a></strong>. Subject to the
+terms and conditions of this License, each Contributor hereby grants to You
+a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+copyright license to reproduce, prepare Derivative Works of, publicly
+display, publicly perform, sublicense, and distribute the Work and such
+Derivative Works in Source or Object form.</p>
+<p><strong><a name="patent">3. Grant of Patent License</a></strong>. Subject to the terms
+and conditions of this License, each Contributor hereby grants to You a
+perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+(except as stated in this section) patent license to make, have made, use,
+offer to sell, sell, import, and otherwise transfer the Work, where such
+license applies only to those patent claims licensable by such Contributor
+that are necessarily infringed by their Contribution(s) alone or by
+combination of their Contribution(s) with the Work to which such
+Contribution(s) was submitted. If You institute patent litigation against
+any entity (including a cross-claim or counterclaim in a lawsuit) alleging
+that the Work or a Contribution incorporated within the Work constitutes
+direct or contributory patent infringement, then any patent licenses
+granted to You under this License for that Work shall terminate as of the
+date such litigation is filed.</p>
+<p><strong><a name="redistribution">4. Redistribution</a></strong>. You may reproduce and
+distribute copies of the Work or Derivative Works thereof in any medium,
+with or without modifications, and in Source or Object form, provided that
+You meet the following conditions:</p>
+<ol>
+<li>
+<p>You must give any other recipients of the Work or Derivative Works a
+copy of this License; and</p>
+</li>
+<li>
+<p>You must cause any modified files to carry prominent notices stating
+that You changed the files; and</p>
+</li>
+<li>
+<p>You must retain, in the Source form of any Derivative Works that You
+distribute, all copyright, patent, trademark, and attribution notices from
+the Source form of the Work, excluding those notices that do not pertain to
+any part of the Derivative Works; and</p>
+</li>
+<li>
+<p>If the Work includes a "NOTICE" text file as part of its distribution,
+then any Derivative Works that You distribute must include a readable copy
+of the attribution notices contained within such NOTICE file, excluding
+those notices that do not pertain to any part of the Derivative Works, in
+at least one of the following places: within a NOTICE text file distributed
+as part of the Derivative Works; within the Source form or documentation,
+if provided along with the Derivative Works; or, within a display generated
+by the Derivative Works, if and wherever such third-party notices normally
+appear. The contents of the NOTICE file are for informational purposes only
+and do not modify the License. You may add Your own attribution notices
+within Derivative Works that You distribute, alongside or as an addendum to
+the NOTICE text from the Work, provided that such additional attribution
+notices cannot be construed as modifying the License.
+You may add Your own copyright statement to Your modifications and may
+provide additional or different license terms and conditions for use,
+reproduction, or distribution of Your modifications, or for any such
+Derivative Works as a whole, provided Your use, reproduction, and
+distribution of the Work otherwise complies with the conditions stated in
+this License.</p>
+</li>
+</ol>
+<p><strong><a name="contributions">5. Submission of Contributions</a></strong>. Unless You
+explicitly state otherwise, any Contribution intentionally submitted for
+inclusion in the Work by You to the Licensor shall be under the terms and
+conditions of this License, without any additional terms or conditions.
+Notwithstanding the above, nothing herein shall supersede or modify the
+terms of any separate license agreement you may have executed with Licensor
+regarding such Contributions.</p>
+<p><strong><a name="trademarks">6. Trademarks</a></strong>. This License does not grant
+permission to use the trade names, trademarks, service marks, or product
+names of the Licensor, except as required for reasonable and customary use
+in describing the origin of the Work and reproducing the content of the
+NOTICE file.</p>
+<p><strong><a name="no-warranty">7. Disclaimer of Warranty</a></strong>. Unless required by
+applicable law or agreed to in writing, Licensor provides the Work (and
+each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including,
+without limitation, any warranties or conditions of TITLE,
+NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You
+are solely responsible for determining the appropriateness of using or
+redistributing the Work and assume any risks associated with Your exercise
+of permissions under this License.</p>
+<p><strong><a name="no-liability">8. Limitation of Liability</a></strong>. In no event and
+under no legal theory, whether in tort (including negligence), contract, or
+otherwise, unless required by applicable law (such as deliberate and
+grossly negligent acts) or agreed to in writing, shall any Contributor be
+liable to You for damages, including any direct, indirect, special,
+incidental, or consequential damages of any character arising as a result
+of this License or out of the use or inability to use the Work (including
+but not limited to damages for loss of goodwill, work stoppage, computer
+failure or malfunction, or any and all other commercial damages or losses),
+even if such Contributor has been advised of the possibility of such
+damages.</p>
+<p><strong><a name="additional">9. Accepting Warranty or Additional Liability</a></strong>.
+While redistributing the Work or Derivative Works thereof, You may choose
+to offer, and charge a fee for, acceptance of support, warranty, indemnity,
+or other liability obligations and/or rights consistent with this License.
+However, in accepting such obligations, You may act only on Your own behalf
+and on Your sole responsibility, not on behalf of any other Contributor,
+and only if You agree to indemnify, defend, and hold each Contributor
+harmless for any liability incurred by, or claims asserted against, such
+Contributor by reason of your accepting any such warranty or additional
+liability.</p>
+<p>END OF TERMS AND CONDITIONS</p>
+
+    <div class="clear"></div>
+    
+    </div>
+    <div id="copyright" class="container_16">
+      <p>Copyright &#169; 2011 The Apache Software Foundation, Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.<br/>Apache and the Apache feather logo are trademarks of The Apache Software Foundation.</p>
+    </div>
+  </body>
+</html>
diff --git a/org.tizen.common/test/test_files/about_files/freemarker-LICENSE.txt b/org.tizen.common/test/test_files/about_files/freemarker-LICENSE.txt
new file mode 100644 (file)
index 0000000..4c5f086
--- /dev/null
@@ -0,0 +1,69 @@
+FreeMarker 1.x was released under the LGPL license. Later, by community\r
+consensus, we have switched over to a BSD-style license. As of FreeMarker\r
+2.2pre1, the original author, Benjamin Geer, has relinquished the copyright in\r
+behalf of Visigoth Software Society. The current copyright holder is the\r
+Visigoth Software Society.\r
+\r
+------------------------------------------------------------------------------\r
+Copyright (c) 2003 The Visigoth Software Society. All rights reserved.\r
+\r
+Redistribution and use in source and binary forms, with or without\r
+modification, are permitted provided that the following conditions are met:\r
+\r
+1.  Redistributions of source code must retain the above copyright notice,\r
+    this list of conditions and the following disclaimer.\r
+\r
+2.  The end-user documentation included with the redistribution, if any, must\r
+    include the following acknowlegement:\r
+      "This product includes software developed by the \r
+      Visigoth Software Society (http://www.visigoths.org/)."\r
+    Alternately, this acknowlegement may appear in the software itself, if and\r
+    wherever such third-party acknowlegements normally appear.\r
+\r
+3.  Neither the name "FreeMarker", "Visigoth", nor any of the names of the\r
+    project contributors may be used to endorse or promote products derived\r
+    from this software without prior written permission. For written\r
+    permission, please contact visigoths@visigoths.org.\r
+\r
+4.  Products derived from this software may not be called "FreeMarker" or\r
+    "Visigoth" nor may "FreeMarker" or "Visigoth" appear in their names\r
+    without prior written permission of the Visigoth Software Society.\r
+\r
+THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,\r
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND\r
+FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\r
+VISIGOTH SOFTWARE SOCIETY OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\r
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\r
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY\r
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\r
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,\r
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+------------------------------------------------------------------------------\r
+\r
+This software consists of voluntary contributions made by many individuals on\r
+behalf of the Visigoth Software Society. For more information on the Visigoth\r
+Software Society, please see http://www.visigoths.org/\r
+\r
+------------------------------------------------------------------------------\r
+\r
+FREEMARKER SUBCOMPONENTS UNDER DIFFERENT LICENSE:\r
+\r
+FreeMarker includes a number of subcomponents that are licensed by the Apache\r
+Software Foundation under the Apache License, Version 2.0. Your use of these\r
+subcomponents is subject to the terms and conditions of the Apache License,\r
+Version 2.0. You may obtain a copy of the License at\r
+\r
+    http://www.apache.org/licenses/LICENSE-2.0\r
+    \r
+The subcomponents under this licence are the following files, which are\r
+included both in freemarker.jar and in the source code:\r
+  \r
+    freemarker/ext/jsp/web-app_2_2.dtd\r
+    freemarker/ext/jsp/web-app_2_3.dtd\r
+    freemarker/ext/jsp/web-app_2_4.xsd\r
+    freemarker/ext/jsp/web-app_2_5.xsd\r
+    freemarker/ext/jsp/web-jsptaglibrary_1_1.dtd\r
+    freemarker/ext/jsp/web-jsptaglibrary_1_2.dtd\r
+    freemarker/ext/jsp/web-jsptaglibrary_2_0.xsd\r
+    freemarker/ext/jsp/web-jsptaglibrary_2_1.xsd\r
diff --git a/org.tizen.common/test/test_files/resource/about_files/LICENSE-2.0.htm b/org.tizen.common/test/test_files/resource/about_files/LICENSE-2.0.htm
new file mode 100644 (file)
index 0000000..f7ca656
--- /dev/null
@@ -0,0 +1,191 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html lang="en">
+  <head>
+    <title>Apache License, Version 2.0</title>
+
+    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
+    <meta property="og:image" content="http://www.apache.org/images/asf_logo.gif" />
+
+    <link rel="stylesheet" type="text/css" media="screen" href="/css/style.css">
+    <link rel="stylesheet" type="text/css" media="screen" href="/css/code.css">
+
+    <script type="text/javascript" src="/js/jquery.js"></script>
+    <script type="text/javascript" src="/js/apache_boot.js"></script>
+
+    
+
+    
+    <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file to you under the Apache License, Version 2.0 (the &quot;License&quot;); you may not use this file except in compliance with the License.  You may obtain a copy of the License at . http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an &quot;AS IS&quot; BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the specific language governing permissions and limitations under the License. -->
+  </head>
+
+  <body>
+    <div id="page" class="container_16">
+      <div id="header" class="grid_8">
+        <h1>The Apache Software Foundation</h1>
+        <h2>Apache License, Version 2.0</h2>
+      </div>
+
+      <div class="clear"></div>
+      <div id="content" class="grid_16"><div class="section-content"><p>Apache License<br></br>Version 2.0, January 2004<br></br>
+<a href="http://www.apache.org/licenses/">http://www.apache.org/licenses/</a> </p>
+<p>TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION</p>
+<p><strong><a name="definitions">1. Definitions</a></strong>.</p>
+<p>"License" shall mean the terms and conditions for use, reproduction, and
+distribution as defined by Sections 1 through 9 of this document.</p>
+<p>"Licensor" shall mean the copyright owner or entity authorized by the
+copyright owner that is granting the License.</p>
+<p>"Legal Entity" shall mean the union of the acting entity and all other
+entities that control, are controlled by, or are under common control with
+that entity. For the purposes of this definition, "control" means (i) the
+power, direct or indirect, to cause the direction or management of such
+entity, whether by contract or otherwise, or (ii) ownership of fifty
+percent (50%) or more of the outstanding shares, or (iii) beneficial
+ownership of such entity.</p>
+<p>"You" (or "Your") shall mean an individual or Legal Entity exercising
+permissions granted by this License.</p>
+<p>"Source" form shall mean the preferred form for making modifications,
+including but not limited to software source code, documentation source,
+and configuration files.</p>
+<p>"Object" form shall mean any form resulting from mechanical transformation
+or translation of a Source form, including but not limited to compiled
+object code, generated documentation, and conversions to other media types.</p>
+<p>"Work" shall mean the work of authorship, whether in Source or Object form,
+made available under the License, as indicated by a copyright notice that
+is included in or attached to the work (an example is provided in the
+Appendix below).</p>
+<p>"Derivative Works" shall mean any work, whether in Source or Object form,
+that is based on (or derived from) the Work and for which the editorial
+revisions, annotations, elaborations, or other modifications represent, as
+a whole, an original work of authorship. For the purposes of this License,
+Derivative Works shall not include works that remain separable from, or
+merely link (or bind by name) to the interfaces of, the Work and Derivative
+Works thereof.</p>
+<p>"Contribution" shall mean any work of authorship, including the original
+version of the Work and any modifications or additions to that Work or
+Derivative Works thereof, that is intentionally submitted to Licensor for
+inclusion in the Work by the copyright owner or by an individual or Legal
+Entity authorized to submit on behalf of the copyright owner. For the
+purposes of this definition, "submitted" means any form of electronic,
+verbal, or written communication sent to the Licensor or its
+representatives, including but not limited to communication on electronic
+mailing lists, source code control systems, and issue tracking systems that
+are managed by, or on behalf of, the Licensor for the purpose of discussing
+and improving the Work, but excluding communication that is conspicuously
+marked or otherwise designated in writing by the copyright owner as "Not a
+Contribution."</p>
+<p>"Contributor" shall mean Licensor and any individual or Legal Entity on
+behalf of whom a Contribution has been received by Licensor and
+subsequently incorporated within the Work.</p>
+<p><strong><a name="copyright">2. Grant of Copyright License</a></strong>. Subject to the
+terms and conditions of this License, each Contributor hereby grants to You
+a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+copyright license to reproduce, prepare Derivative Works of, publicly
+display, publicly perform, sublicense, and distribute the Work and such
+Derivative Works in Source or Object form.</p>
+<p><strong><a name="patent">3. Grant of Patent License</a></strong>. Subject to the terms
+and conditions of this License, each Contributor hereby grants to You a
+perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+(except as stated in this section) patent license to make, have made, use,
+offer to sell, sell, import, and otherwise transfer the Work, where such
+license applies only to those patent claims licensable by such Contributor
+that are necessarily infringed by their Contribution(s) alone or by
+combination of their Contribution(s) with the Work to which such
+Contribution(s) was submitted. If You institute patent litigation against
+any entity (including a cross-claim or counterclaim in a lawsuit) alleging
+that the Work or a Contribution incorporated within the Work constitutes
+direct or contributory patent infringement, then any patent licenses
+granted to You under this License for that Work shall terminate as of the
+date such litigation is filed.</p>
+<p><strong><a name="redistribution">4. Redistribution</a></strong>. You may reproduce and
+distribute copies of the Work or Derivative Works thereof in any medium,
+with or without modifications, and in Source or Object form, provided that
+You meet the following conditions:</p>
+<ol>
+<li>
+<p>You must give any other recipients of the Work or Derivative Works a
+copy of this License; and</p>
+</li>
+<li>
+<p>You must cause any modified files to carry prominent notices stating
+that You changed the files; and</p>
+</li>
+<li>
+<p>You must retain, in the Source form of any Derivative Works that You
+distribute, all copyright, patent, trademark, and attribution notices from
+the Source form of the Work, excluding those notices that do not pertain to
+any part of the Derivative Works; and</p>
+</li>
+<li>
+<p>If the Work includes a "NOTICE" text file as part of its distribution,
+then any Derivative Works that You distribute must include a readable copy
+of the attribution notices contained within such NOTICE file, excluding
+those notices that do not pertain to any part of the Derivative Works, in
+at least one of the following places: within a NOTICE text file distributed
+as part of the Derivative Works; within the Source form or documentation,
+if provided along with the Derivative Works; or, within a display generated
+by the Derivative Works, if and wherever such third-party notices normally
+appear. The contents of the NOTICE file are for informational purposes only
+and do not modify the License. You may add Your own attribution notices
+within Derivative Works that You distribute, alongside or as an addendum to
+the NOTICE text from the Work, provided that such additional attribution
+notices cannot be construed as modifying the License.
+You may add Your own copyright statement to Your modifications and may
+provide additional or different license terms and conditions for use,
+reproduction, or distribution of Your modifications, or for any such
+Derivative Works as a whole, provided Your use, reproduction, and
+distribution of the Work otherwise complies with the conditions stated in
+this License.</p>
+</li>
+</ol>
+<p><strong><a name="contributions">5. Submission of Contributions</a></strong>. Unless You
+explicitly state otherwise, any Contribution intentionally submitted for
+inclusion in the Work by You to the Licensor shall be under the terms and
+conditions of this License, without any additional terms or conditions.
+Notwithstanding the above, nothing herein shall supersede or modify the
+terms of any separate license agreement you may have executed with Licensor
+regarding such Contributions.</p>
+<p><strong><a name="trademarks">6. Trademarks</a></strong>. This License does not grant
+permission to use the trade names, trademarks, service marks, or product
+names of the Licensor, except as required for reasonable and customary use
+in describing the origin of the Work and reproducing the content of the
+NOTICE file.</p>
+<p><strong><a name="no-warranty">7. Disclaimer of Warranty</a></strong>. Unless required by
+applicable law or agreed to in writing, Licensor provides the Work (and
+each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including,
+without limitation, any warranties or conditions of TITLE,
+NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You
+are solely responsible for determining the appropriateness of using or
+redistributing the Work and assume any risks associated with Your exercise
+of permissions under this License.</p>
+<p><strong><a name="no-liability">8. Limitation of Liability</a></strong>. In no event and
+under no legal theory, whether in tort (including negligence), contract, or
+otherwise, unless required by applicable law (such as deliberate and
+grossly negligent acts) or agreed to in writing, shall any Contributor be
+liable to You for damages, including any direct, indirect, special,
+incidental, or consequential damages of any character arising as a result
+of this License or out of the use or inability to use the Work (including
+but not limited to damages for loss of goodwill, work stoppage, computer
+failure or malfunction, or any and all other commercial damages or losses),
+even if such Contributor has been advised of the possibility of such
+damages.</p>
+<p><strong><a name="additional">9. Accepting Warranty or Additional Liability</a></strong>.
+While redistributing the Work or Derivative Works thereof, You may choose
+to offer, and charge a fee for, acceptance of support, warranty, indemnity,
+or other liability obligations and/or rights consistent with this License.
+However, in accepting such obligations, You may act only on Your own behalf
+and on Your sole responsibility, not on behalf of any other Contributor,
+and only if You agree to indemnify, defend, and hold each Contributor
+harmless for any liability incurred by, or claims asserted against, such
+Contributor by reason of your accepting any such warranty or additional
+liability.</p>
+<p>END OF TERMS AND CONDITIONS</p>
+
+    <div class="clear"></div>
+    
+    </div>
+    <div id="copyright" class="container_16">
+      <p>Copyright &#169; 2011 The Apache Software Foundation, Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.<br/>Apache and the Apache feather logo are trademarks of The Apache Software Foundation.</p>
+    </div>
+  </body>
+</html>
diff --git a/org.tizen.common/test/test_files/resource/about_files/freemarker-LICENSE.txt b/org.tizen.common/test/test_files/resource/about_files/freemarker-LICENSE.txt
new file mode 100644 (file)
index 0000000..4c5f086
--- /dev/null
@@ -0,0 +1,69 @@
+FreeMarker 1.x was released under the LGPL license. Later, by community\r
+consensus, we have switched over to a BSD-style license. As of FreeMarker\r
+2.2pre1, the original author, Benjamin Geer, has relinquished the copyright in\r
+behalf of Visigoth Software Society. The current copyright holder is the\r
+Visigoth Software Society.\r
+\r
+------------------------------------------------------------------------------\r
+Copyright (c) 2003 The Visigoth Software Society. All rights reserved.\r
+\r
+Redistribution and use in source and binary forms, with or without\r
+modification, are permitted provided that the following conditions are met:\r
+\r
+1.  Redistributions of source code must retain the above copyright notice,\r
+    this list of conditions and the following disclaimer.\r
+\r
+2.  The end-user documentation included with the redistribution, if any, must\r
+    include the following acknowlegement:\r
+      "This product includes software developed by the \r
+      Visigoth Software Society (http://www.visigoths.org/)."\r
+    Alternately, this acknowlegement may appear in the software itself, if and\r
+    wherever such third-party acknowlegements normally appear.\r
+\r
+3.  Neither the name "FreeMarker", "Visigoth", nor any of the names of the\r
+    project contributors may be used to endorse or promote products derived\r
+    from this software without prior written permission. For written\r
+    permission, please contact visigoths@visigoths.org.\r
+\r
+4.  Products derived from this software may not be called "FreeMarker" or\r
+    "Visigoth" nor may "FreeMarker" or "Visigoth" appear in their names\r
+    without prior written permission of the Visigoth Software Society.\r
+\r
+THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,\r
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND\r
+FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\r
+VISIGOTH SOFTWARE SOCIETY OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\r
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\r
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY\r
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\r
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,\r
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+------------------------------------------------------------------------------\r
+\r
+This software consists of voluntary contributions made by many individuals on\r
+behalf of the Visigoth Software Society. For more information on the Visigoth\r
+Software Society, please see http://www.visigoths.org/\r
+\r
+------------------------------------------------------------------------------\r
+\r
+FREEMARKER SUBCOMPONENTS UNDER DIFFERENT LICENSE:\r
+\r
+FreeMarker includes a number of subcomponents that are licensed by the Apache\r
+Software Foundation under the Apache License, Version 2.0. Your use of these\r
+subcomponents is subject to the terms and conditions of the Apache License,\r
+Version 2.0. You may obtain a copy of the License at\r
+\r
+    http://www.apache.org/licenses/LICENSE-2.0\r
+    \r
+The subcomponents under this licence are the following files, which are\r
+included both in freemarker.jar and in the source code:\r
+  \r
+    freemarker/ext/jsp/web-app_2_2.dtd\r
+    freemarker/ext/jsp/web-app_2_3.dtd\r
+    freemarker/ext/jsp/web-app_2_4.xsd\r
+    freemarker/ext/jsp/web-app_2_5.xsd\r
+    freemarker/ext/jsp/web-jsptaglibrary_1_1.dtd\r
+    freemarker/ext/jsp/web-jsptaglibrary_1_2.dtd\r
+    freemarker/ext/jsp/web-jsptaglibrary_2_0.xsd\r
+    freemarker/ext/jsp/web-jsptaglibrary_2_1.xsd\r
diff --git a/org.tizen.common/test/test_files/resource/resource/text.txt b/org.tizen.common/test/test_files/resource/resource/text.txt
new file mode 100644 (file)
index 0000000..70b287d
--- /dev/null
@@ -0,0 +1,3 @@
+HOHOHO
+HAHAHA
+NAMKOONGHO
\ No newline at end of file
diff --git a/org.tizen.common/test/test_files/resource/text.txt b/org.tizen.common/test/test_files/resource/text.txt
new file mode 100644 (file)
index 0000000..70b287d
--- /dev/null
@@ -0,0 +1,3 @@
+HOHOHO
+HAHAHA
+NAMKOONGHO
\ No newline at end of file