<%@ jet package="org.eclipse.emf.codegen.ecore.templates.model" imports="org.eclipse.emf.codegen.ecore.genmodel.*" class="ResourceFactoryClass" version="$Id: ResourceFactoryClass.javajet,v 1.3 2004/05/16 17:22:37 emerks Exp $" %>
<%
/**
 * <copyright>
 *
 * Copyright (c) 2002-2004 IBM Corporation and others.
 * All rights reserved.   This program and the accompanying materials
 * are made available under the terms of the Common Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/cpl-v10.html
 *
 * Contributors:
 *   IBM - Initial API and implementation
 *
 * </copyright>
 */
%>
<%GenPackage genPackage = (GenPackage)argument; GenModel genModel=genPackage.getGenModel();%>
<%@ include file="../Header.jetinc"%>
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()%>
 * @generated
 */
public class <%=genPackage.getResourceFactoryClassName()%> extends <%=genPackage.getImportedResourceFactoryBaseClassName()%>
{
<%if (genModel.getCopyrightText() != null) {%>
	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public static final <%=genModel.getImportedName("java.lang.String")%> copyright = "<%=genModel.getCopyrightText()%>";<%=genModel.getNonNLS()%>

<%}%>
<%if (genPackage.hasExtendedMetaData()) {%>
	/**
	 * <!-- 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()) {%>
 <%if (genPackage.hasTargetNamespace()) {%>
		extendedMetaData = <%=genModel.getImportedName("org.eclipse.emf.ecore.util.ExtendedMetaData")%>.INSTANCE;
 <%} else {%>
		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
	 */
	public Resource createResource(URI uri)
	{
<%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, extendedMetaData);
		result.getDefaultLoadOptions().put(<%=genModel.getImportedName("org.eclipse.emf.ecore.xmi.XMLResource")%>.OPTION_EXTENDED_META_DATA, extendedMetaData);

		result.getDefaultSaveOptions().put(<%=genModel.getImportedName("org.eclipse.emf.ecore.xmi.XMLResource")%>.OPTION_SCHEMA_LOCATION, 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);
<%} 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;
	}

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