package com.github.aureliano.achmed.resources;

import com.github.aureliano.achmed.exception.NoSuchResourceException;

public final class ResourceFactory {

	private ResourceFactory() {
		super();
	}
	
	public static IResource createResource(ResourceType type) {
		switch (type) {
			case FILE : throw new NoSuchResourceException("File resource not implemented yet.");
			case EXEC : throw new NoSuchResourceException("File resource not implemented yet.");
			case PACKAGE : throw new NoSuchResourceException("File resource not implemented yet.");
			case SERVICE : throw new NoSuchResourceException("File resource not implemented yet.");
			default : throw new NoSuchResourceException("There is no such resource implementation to " + type + " type.");
		}
	}
	
	public static IResource createResource(String typeName) {
		ResourceType type = null;
		try {
			type = ResourceType.valueOf(typeName.toUpperCase());
		} catch (IllegalArgumentException ex) {
			throw new NoSuchResourceException("There is no such resource implementation to '" + typeName + "' type.");
		}
		
		return createResource(type);
	}
}
@@ -724,16 +724,17 @@
 tion to 
+'
 %22 + type
@@ -737,16 +737,17 @@
 type + %22
+'
  type.%22)

Create resource factory.