<%@ jet package="org.eclipse.emf.codegen.ecore.templates.model" imports="org.eclipse.emf.codegen.ecore.genmodel.*" class="ResourceFactoryClass"%>
<%
/**
 * Copyright (c) 2002-2006 IBM Corporation and others.
 * All rights reserved.   This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v2.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v20.html
 *
 * Contributors:
 *   IBM - Initial API and implementation
 */
%>
<%GenPackage genPackage = (GenPackage)argument; GenModel genModel=genPackage.getGenModel();%>
<%final boolean isJDK50 = genModel.getComplianceLevel().getValue() >= GenJDKLevel.JDK50;%>
<%@ include file="../Header.javajetinc"%>
package <%=genPackage.getUtilitiesPackageName()%>;

<%genModel.getImportedName("org.eclipse.emf.common.util.URI");%>
<%genModel.getImportedName("org.eclipse.emf.ecore.resource.Resource");%>
<%genModel.markImportLocation(stringBuffer);%>

/**
 * <!-- begin-user-doc -->
 * The <b>Resource Factory</b> associated with the package.
 * <!-- end-user-doc -->
 * @see <%=genPackage.getQualifiedResourceClassName()%>
<%if (genPackage.hasAPITags()) {%>
 * <%=genPackage.getAPITags(genModel.getIndentation(stringBuffer))%>
<%}%>
 * @generated
 */
<%if (isJDK50 && genPackage.hasAPIDeprecatedTag()) {%>
@Deprecated
<%}%>
public class <%=genPackage.getResourceFactoryClassName()%> extends <%=genPackage.getImportedResourceFactoryBaseClassName()%>
{
<%if (genModel.hasCopyrightField()) {%>
	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public static final <%=genModel.getImportedName("java.lang.String")%> copyright = <%=genModel.getCopyrightFieldLiteral()%>;<%=genModel.getNonNLS()%>

<%}%>
<%if (genPackage.hasExtendedMetaData() && !genPackage.hasTargetNamespace()) {%>
	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected <%=genModel.getImportedName("org.eclipse.emf.ecore.util.ExtendedMetaData")%> extendedMetaData;

<%} else if (genPackage.hasXMLMap()) {%>
	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected <%=genModel.getImportedName("org.eclipse.emf.ecore.xmi.XMLResource$XMLMap")%> xmlMap = new <%=genModel.getImportedName("org.eclipse.emf.ecore.xmi.impl.XMLMapImpl")%>();

<%}%>
	/**
	 * Creates an instance of the resource factory.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public <%=genPackage.getResourceFactoryClassName()%>()
	{
		super();
<%if (genPackage.hasExtendedMetaData() && !genPackage.hasTargetNamespace()) {%>
		extendedMetaData = new <%=genModel.getImportedName("org.eclipse.emf.ecore.util.BasicExtendedMetaData")%>(new <%=genModel.getImportedName("org.eclipse.emf.ecore.impl.EPackageRegistryImpl")%>(<%=genModel.getImportedName("org.eclipse.emf.ecore.EPackage")%>.Registry.INSTANCE));
		extendedMetaData.putPackage(null, <%=genPackage.getImportedPackageInterfaceName()%>.eINSTANCE);
<%} else if (genPackage.hasXMLMap() && !genPackage.hasTargetNamespace()) {%>
		xmlMap.setNoNamespacePackage(<%=genPackage.getImportedPackageInterfaceName()%>.eINSTANCE);
<%}%>
	}

	/**
	 * Creates an instance of the resource.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
  <%if (genModel.useClassOverrideAnnotation()) {%>
	@Override
  <%}%>
	public Resource createResource(URI uri)
	{
<%@ include file="ResourceFactoryClass/createResource.override.javajetinc" fail="alternative" %>
<%@ start %>
<%if (genPackage.hasExtendedMetaData()) {%>
		<%=genModel.getImportedName("org.eclipse.emf.ecore.xmi.XMLResource")%> result = new <%=genPackage.getResourceClassName()%>(uri);
		result.getDefaultSaveOptions().put(<%=genModel.getImportedName("org.eclipse.emf.ecore.xmi.XMLResource")%>.OPTION_EXTENDED_META_DATA, <%if (genPackage.hasTargetNamespace()){%>Boolean.TRUE<%}else{%>extendedMetaData<%}%>);
		result.getDefaultLoadOptions().put(<%=genModel.getImportedName("org.eclipse.emf.ecore.xmi.XMLResource")%>.OPTION_EXTENDED_META_DATA, <%if (genPackage.hasTargetNamespace()){%>Boolean.TRUE<%}else{%>extendedMetaData<%}%>);

		result.getDefaultSaveOptions().put(<%=genModel.getImportedName("org.eclipse.emf.ecore.xmi.XMLResource")%>.OPTION_SCHEMA_LOCATION, Boolean.TRUE);

		result.getDefaultLoadOptions().put(<%=genModel.getImportedName("org.eclipse.emf.ecore.xmi.XMLResource")%>.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.TRUE);
		result.getDefaultSaveOptions().put(<%=genModel.getImportedName("org.eclipse.emf.ecore.xmi.XMLResource")%>.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.TRUE);

		result.getDefaultLoadOptions().put(<%=genModel.getImportedName("org.eclipse.emf.ecore.xmi.XMLResource")%>.OPTION_USE_LEXICAL_HANDLER, Boolean.TRUE);
<%if (genPackage.isDataTypeConverters() && genPackage.hasDocumentRoot()) {%>
		result.getDefaultLoadOptions().put(<%=genPackage.getResourceClassName()%>.OPTION_USE_DATA_CONVERTER, Boolean.TRUE);
<%}%>
<%} else if (genPackage.hasXMLMap()) {%>
		<%=genModel.getImportedName("org.eclipse.emf.ecore.xmi.XMLResource")%> result = new <%=genPackage.getResourceClassName()%>(uri);
		result.getDefaultSaveOptions().put(<%=genModel.getImportedName("org.eclipse.emf.ecore.xmi.XMLResource")%>.OPTION_XML_MAP, xmlMap);
		result.getDefaultLoadOptions().put(<%=genModel.getImportedName("org.eclipse.emf.ecore.xmi.XMLResource")%>.OPTION_XML_MAP, xmlMap);
<%} else {%>
		Resource result = new <%=genPackage.getResourceClassName()%>(uri);
<%}%>
		return result;
<%@ end %><%//ResourceFactoryClass/createResource.override.javajetinc%>
	}

} //<%=genPackage.getResourceFactoryClassName()%>
<%genModel.emitSortedImports();%>
