package org.neo4j.tutor.tree;

import org.neo4j.api.core.EmbeddedNeo;

public class FileFactory
{
	private static FileFactory factory = new FileFactory();
	private EmbeddedNeo neo;
	
	private FileFactory()
	{
	}
	
	public static FileFactory getFactory()
	{
		return factory;
	}

	// Simple dependency injection
	public void injectNeo( EmbeddedNeo neo )
	{
		this.neo = neo;
	}
	
	// Accessor for neo factory
	private EmbeddedNeo getNeo()
	{
		return this.neo;
	}
	
	/**
	 * Creates a new file setting the name of the file to <code>name</code>.
	 * 
	 * @param name the name of the file
	 * @return the new file
	 * @throws IllegalArgumentException if <code>null name</code>
	 */
	public File createNewFile( String name )
	{
		if ( name == null )
		{
			throw new IllegalArgumentException( "Null name" );
		}
		// --- TODO
		// --- create node to represent the new file  ---
		// --- set the name of the file using File.NAME key ---
		// --- create the File wrapping the node and return it---
		
		return null;
	}
}
