nitind | d6e591d | 2005-03-14 22:21:57 +0000 | [diff] [blame] | 1 | /******************************************************************************* |
amywu | ecebb04 | 2007-04-10 20:07:35 +0000 | [diff] [blame] | 2 | * Copyright (c) 2001, 2005 IBM Corporation and others. |
nitind | d6e591d | 2005-03-14 22:21:57 +0000 | [diff] [blame] | 3 | * All rights reserved. This program and the accompanying materials |
| 4 | * are made available under the terms of the Eclipse Public License v1.0 |
| 5 | * which accompanies this distribution, and is available at |
| 6 | * http://www.eclipse.org/legal/epl-v10.html |
amywu | ecebb04 | 2007-04-10 20:07:35 +0000 | [diff] [blame] | 7 | * |
nitind | d6e591d | 2005-03-14 22:21:57 +0000 | [diff] [blame] | 8 | * Contributors: |
| 9 | * IBM Corporation - initial API and implementation |
| 10 | *******************************************************************************/ |
| 11 | |
| 12 | package org.eclipse.wst.dtd.core.internal.emf.util; |
| 13 | |
| 14 | import java.util.HashMap; |
| 15 | import java.util.Map; |
| 16 | |
| 17 | import org.eclipse.emf.common.util.URI; |
| 18 | import org.eclipse.emf.ecore.resource.Resource; |
| 19 | import org.eclipse.emf.ecore.resource.ResourceSet; |
| 20 | import org.eclipse.emf.ecore.resource.impl.ResourceFactoryImpl; |
| 21 | |
| 22 | |
| 23 | public class DTDResourceFactoryImpl extends ResourceFactoryImpl { |
nitind | d6e591d | 2005-03-14 22:21:57 +0000 | [diff] [blame] | 24 | public DTDResourceFactoryImpl() { |
| 25 | super(); |
| 26 | } |
| 27 | |
| 28 | public Resource createResource(String filename) { |
| 29 | return new DTDResourceImpl(filename); |
| 30 | } |
| 31 | |
| 32 | public Resource createResource(URI uri) { |
| 33 | return new DTDResourceImpl(uri); |
| 34 | } |
| 35 | |
| 36 | public Resource createResource(ResourceSet resources, URI uri) { |
| 37 | Resource resource = new DTDResourceImpl(uri); |
| 38 | resources.getResources().add(resource); |
| 39 | return resource; |
| 40 | } |
| 41 | |
| 42 | public Resource createResource(ResourceSet resources, String uri) { |
| 43 | Resource resource = new DTDResourceImpl(uri); |
| 44 | resources.getResources().add(resource); |
| 45 | return resource; |
| 46 | } |
| 47 | |
| 48 | public Resource load(String uri) throws Exception { |
| 49 | Resource resource = createResource(uri); |
| 50 | resource.load(new HashMap()); |
| 51 | return resource; |
| 52 | } |
| 53 | |
| 54 | public Resource load(URI uri) throws Exception { |
| 55 | Resource resource = createResource(uri); |
| 56 | resource.load(new HashMap()); |
| 57 | return resource; |
| 58 | } |
| 59 | |
| 60 | public Resource load(ResourceSet resources, String uri) throws Exception { |
| 61 | return load(resources, uri, new HashMap()); |
| 62 | } |
| 63 | |
| 64 | public Resource load(ResourceSet resources, URI uri) throws Exception { |
| 65 | return load(resources, uri, new HashMap()); |
| 66 | } |
| 67 | |
| 68 | public Resource load(ResourceSet resources, String uri, Map options) throws Exception { |
| 69 | Resource resource = createResource(resources, uri); |
| 70 | resource.load(options); |
| 71 | return resource; |
| 72 | } |
| 73 | |
| 74 | public Resource load(ResourceSet resources, URI uri, Map options) throws Exception { |
| 75 | Resource resource = createResource(resources, uri); |
| 76 | resource.load(options); |
| 77 | return resource; |
| 78 | } |
| 79 | } // DTDResourceFactoryImpl |