diff options
Diffstat (limited to 'bundles/org.eclipse.wst.xml.core/src-catalog/org/eclipse/wst/xml/core/internal/catalog')
17 files changed, 0 insertions, 2380 deletions
diff --git a/bundles/org.eclipse.wst.xml.core/src-catalog/org/eclipse/wst/xml/core/internal/catalog/Catalog.java b/bundles/org.eclipse.wst.xml.core/src-catalog/org/eclipse/wst/xml/core/internal/catalog/Catalog.java deleted file mode 100644 index d071382e03..0000000000 --- a/bundles/org.eclipse.wst.xml.core/src-catalog/org/eclipse/wst/xml/core/internal/catalog/Catalog.java +++ /dev/null @@ -1,556 +0,0 @@ -/******************************************************************************* - * 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 v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.xml.core.internal.catalog; - -import java.io.IOException; -import java.io.InputStream; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.runtime.Platform; -import org.eclipse.wst.xml.core.internal.Logger; -import org.eclipse.wst.xml.core.internal.XMLCorePlugin; -import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalog; -import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalogElement; -import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalogEntry; -import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalogEvent; -import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalogListener; -import org.eclipse.wst.xml.core.internal.catalog.provisional.INextCatalog; -public class Catalog implements ICatalog -{ - - class CatalogLS - { - public void load() - { - } - - public synchronized void save() - { - try - { - new CatalogWriter().write(Catalog.this, location); - } catch (Exception e) - { - Logger.logException(e); - } - } - } - - class DefaultCatalogLS extends CatalogLS - { - public void load() - { - NextCatalog userCatalogReference = new NextCatalog(); - userCatalogReference.setId(XMLCorePlugin.USER_CATALOG_ID); - userCatalogReference.setCatalogLocation(USER_CATALOG_FILE); - addCatalogElement(userCatalogReference); - - NextCatalog systemCatalogReference = new NextCatalog(); - systemCatalogReference.setId(XMLCorePlugin.SYSTEM_CATALOG_ID); - systemCatalogReference.setCatalogLocation(SYSTEM_CATALOG_FILE); - addCatalogElement(systemCatalogReference); - - /* - * Here we save the file in order to 'reflect' the catalog that - * we've created from plug-in extensions to disk. The 'default' - * catalog is only ever written to disk and never read from disk. - */ - save(); - } - } - - class InternalResolver - { - protected Map publicMap = new HashMap(); - - protected Map systemMap = new HashMap(); - - protected Map uriMap = new HashMap(); - - InternalResolver() - { - for (Iterator i = catalogElements.iterator(); i.hasNext();) - { - ICatalogElement catalogElement = (ICatalogElement) i.next(); - if (catalogElement.getType() == ICatalogElement.TYPE_ENTRY) - { - ICatalogEntry entry = (ICatalogEntry) catalogElement; - Map map = getEntryMap(entry.getEntryType()); - map.put(entry.getKey(), entry); - } - } - } - - private Map getEntryMap(int entryType) - { - Map map = systemMap; - switch (entryType) - { - case ICatalogEntry.ENTRY_TYPE_PUBLIC: - map = publicMap; - break; - case ICatalogEntry.ENTRY_TYPE_URI: - map = uriMap; - break; - default: - break; - } - return map; - } - - protected String getMappedURI(Map map, String key) - { - CatalogEntry entry = (CatalogEntry) map.get(key); - if(entry == null) return null; - String uri = entry.getURI(); - try - { - // TODO CS : do we really want to resolve these here? - // I'm guessing we should return the 'platform:' form of the URI - // to the caller. - if (uri.startsWith("platform:")) //$NON-NLS-1$ - { - URL entryURL = new URL(entry.getAbsolutePath(uri)); - uri = Platform.resolve(entryURL).toString(); - - // we need to ensure URI's are of form "file:///D:/XXX" and NOT - // "file:D:/XXX". Otherwise the EMF URI class gets confused - // (see bug 103607) - String FILE_SCHEME = "file:"; //$NON-NLS-1$ - if (uri.startsWith(FILE_SCHEME) && !uri.startsWith(FILE_SCHEME + "/")) //$NON-NLS-1$ - { - uri = FILE_SCHEME + "///" + uri.substring(FILE_SCHEME.length()); //$NON-NLS-1$ - } - } - return uri; - } catch (IOException e) - { - return null; - } - } - - public String resolvePublic(String publicId, String systemId) - throws MalformedURLException, IOException - { - String result = getMappedURI(publicMap, publicId); - if (result == null) - { - result = getMappedURI(systemMap, systemId); - } - // our clients used to pass namespace in place of public id, so we need to check uri map for those - if (result == null) - { - result = getMappedURI(uriMap, publicId); - } - if (result == null) - { - result = resolveSubordinateCatalogs( - ICatalogEntry.ENTRY_TYPE_PUBLIC, publicId, systemId); - } - return result; - } - - public String resolveSystem(String systemId) - throws MalformedURLException, IOException - { - String result = getMappedURI(systemMap, systemId); - if (result == null) - { - result = resolveSubordinateCatalogs( - ICatalogEntry.ENTRY_TYPE_SYSTEM, null, systemId); - } - return result; - } - - public String resolveURI(String uri) throws MalformedURLException, - IOException - { - String result = getMappedURI(uriMap, uri); - if (result == null) - { - result = resolveSubordinateCatalogs( - ICatalogEntry.ENTRY_TYPE_URI, null, uri); - } - return result; - } - } - - class SystemCatalogLS extends CatalogLS - { - public void load() - { - new CatalogContributorRegistryReader(Catalog.this).readRegistry(); - - /* - * Here we save the file in order to 'reflect' the catalog that - * we've created from plugin extensions to disk. - * The 'system' catalog is only ever written to disk and never read from disk. - */ - save(); - } - } - - class UserCatalogLS extends CatalogLS - { - public void load() - { - InputStream inputStream = null; - try - { - URL url = new URL(location); - inputStream = url.openStream(); - boolean oldNotificationEnabled = isNotificationEnabled(); - setNotificationEnabled(false); - clear(); - try - { - CatalogReader.read(Catalog.this, inputStream); - } finally - { - setNotificationEnabled(oldNotificationEnabled); - } - notifyChanged(); - } catch (Exception e) - { - } finally - { - if (inputStream != null) - { - try - { - inputStream.close(); - } catch (Exception e) - { - } - } - } - } - } - - public static final String DEFAULT_CATALOG_FILE = "default_catalog.xml"; //$NON-NLS-1$ - - public static final String SYSTEM_CATALOG_FILE = "system_catalog.xml"; //$NON-NLS-1$ - - public static final String USER_CATALOG_FILE = "user_catalog.xml"; //$NON-NLS-1$ - - protected String base; - - protected List catalogElements = new ArrayList(); - - protected CatalogLS catalogLS; - - protected String id; - - protected InternalResolver internalResolver; - - protected boolean isNotificationEnabled; - - protected List listenerList = new ArrayList(); - - protected String location; - - protected CatalogSet resourceSet; - - public Catalog(CatalogSet catalogResourceSet, String id, String location) - { - this.resourceSet = catalogResourceSet; - this.id = id; - this.location = location; - - if (XMLCorePlugin.DEFAULT_CATALOG_ID.equals(id)) - { - catalogLS = new DefaultCatalogLS(); - } else if (XMLCorePlugin.SYSTEM_CATALOG_ID.equals(id)) - { - catalogLS = new SystemCatalogLS(); - } else - { - catalogLS = new UserCatalogLS(); - } - } - - public void addCatalogElement(ICatalogElement element) - { - catalogElements.add(element); - element.setOwnerCatalog(this); - internalResolver = null; - notifyAddElement(element); - } - - public void addEntriesFromCatalog(ICatalog catalog) - { - try - { - setNotificationEnabled(false); - if (catalog != null) - { - ICatalogElement[] entries = ((Catalog)catalog).getCatalogElements(); - for (int i = 0; i < entries.length; i++) - { - CatalogElement clone = (CatalogElement)((CatalogElement)entries[i]).clone(); - addCatalogElement(clone); - } - } else - { - Logger.log(Logger.ERROR, "argument was null in Catalog.addEntriesFromCatalog"); //$NON-NLS-1$ - } - } finally - { - setNotificationEnabled(true); - } - internalResolver = null; - notifyChanged(); - } - - public void addListener(ICatalogListener listener) - { - listenerList.add(listener); - } - - public void clear() - { - catalogElements.clear(); - internalResolver = null; - notifyChanged(); - } - - public ICatalogElement createCatalogElement(int type) - { - switch (type) - { - case ICatalogElement.TYPE_ENTRY: - return new CatalogEntry(); - case ICatalogElement.TYPE_NEXT_CATALOG: - return new NextCatalog(); - case ICatalogEntry.ENTRY_TYPE_PUBLIC: - return new CatalogEntry(ICatalogEntry.ENTRY_TYPE_PUBLIC); - case ICatalogEntry.ENTRY_TYPE_SYSTEM: - return new CatalogEntry(ICatalogEntry.ENTRY_TYPE_SYSTEM); - case ICatalogEntry.ENTRY_TYPE_URI: - return new CatalogEntry(ICatalogEntry.ENTRY_TYPE_URI); - default: - return new CatalogElement(type); - } - } - - public String getBase() - { - return base; - } - - private List getCatalogElements(int type) - { - List result = new ArrayList(); - ICatalogElement[] elements = (ICatalogElement[]) catalogElements - .toArray(new ICatalogElement[catalogElements.size()]); - for (int i = 0; i < elements.length; i++) - { - ICatalogElement element = elements[i]; - if (element.getType() == type) - { - result.add(element); - } - } - return result; - } - - public ICatalogEntry[] getCatalogEntries() - { - List result = getCatalogElements(ICatalogElement.TYPE_ENTRY); - return (ICatalogEntry[]) result - .toArray(new ICatalogEntry[result.size()]); - } - - protected CatalogSet getCatalogSet() - { - return resourceSet; - } - - public String getId() - { - return id; - } - - public String getLocation() - { - return location; - } - - public INextCatalog[] getNextCatalogs() - { - List result = getCatalogElements(ICatalogElement.TYPE_NEXT_CATALOG); - return (INextCatalog[]) result.toArray(new INextCatalog[result.size()]); - } - - protected InternalResolver getOrCreateInternalResolver() - { - if (internalResolver == null) - { - internalResolver = new InternalResolver(); - } - return internalResolver; - } - - protected boolean isNotificationEnabled() - { - return isNotificationEnabled; - } - - public void load() throws IOException - { - catalogLS.load(); - } - - protected void notifyAddElement(ICatalogElement entry) - { - if (isNotificationEnabled) - { - ICatalogEvent event = new CatalogEvent(this, entry, - ICatalogEvent.ELEMENT_ADDED); - notifyListeners(event); - } - } - - protected void notifyChanged() - { - ICatalogEvent event = new CatalogEvent(this, null, - ICatalogEvent.CHANGED); - notifyListeners(event); - } - - protected void notifyListeners(ICatalogEvent event) - { - List list = new ArrayList(); - list.addAll(listenerList); - for (Iterator i = list.iterator(); i.hasNext();) - { - ICatalogListener listener = (ICatalogListener) i.next(); - listener.catalogChanged(event); - } - } - - protected void notifyRemoveElement(ICatalogElement element) - { - if (isNotificationEnabled) - { - ICatalogEvent event = new CatalogEvent(this, element, - ICatalogEvent.ELEMENT_REMOVED); - notifyListeners(event); - } - } - - public void removeCatalogElement(ICatalogElement element) - { - catalogElements.remove(element); - internalResolver = null; - notifyRemoveElement(element); - - } - - public void removeListener(ICatalogListener listener) - { - listenerList.remove(listener); - } - - public String resolvePublic(String publicId, String systemId) - throws MalformedURLException, IOException - { - return getOrCreateInternalResolver().resolvePublic(publicId, systemId); - } - - protected String resolveSubordinateCatalogs(int entryType, String publicId, - String systemId) throws MalformedURLException, IOException - { - String result = null; - INextCatalog[] nextCatalogs = getNextCatalogs(); - for (int i = 0; i < nextCatalogs.length; i++) - { - INextCatalog nextCatalog = nextCatalogs[i]; - ICatalog catalog = nextCatalog.getReferencedCatalog(); - if (catalog != null) - { - switch (entryType) - { - case ICatalogEntry.ENTRY_TYPE_PUBLIC: - result = catalog.resolvePublic(publicId, systemId); - break; - case ICatalogEntry.ENTRY_TYPE_SYSTEM: - result = catalog.resolveSystem(systemId); - break; - case ICatalogEntry.ENTRY_TYPE_URI: - result = catalog.resolveURI(systemId); - break; - default: - break; - } - if (result != null) - { - return result; - } - } - } - return null; - } - - public String resolveSystem(String systemId) throws MalformedURLException, - IOException - { - return getOrCreateInternalResolver().resolveSystem(systemId); - } - - public String resolveURI(String uri) throws MalformedURLException, - IOException - { - return getOrCreateInternalResolver().resolveURI(uri); - } - - public void save() throws IOException - { - catalogLS.save(); - } - - public void setBase(String base) - { - this.base = base; - } - - public void setId(String id) - { - this.id = id; - } - - public void setLocation(String location) - { - this.location = location; - } - - protected void setNotificationEnabled(boolean b) - { - isNotificationEnabled = b; - } - - public ICatalogElement[] getCatalogElements() - { - return (ICatalogElement[]) catalogElements.toArray(new ICatalogElement[catalogElements.size()]); - } - - - - -} diff --git a/bundles/org.eclipse.wst.xml.core/src-catalog/org/eclipse/wst/xml/core/internal/catalog/CatalogContributorRegistryReader.java b/bundles/org.eclipse.wst.xml.core/src-catalog/org/eclipse/wst/xml/core/internal/catalog/CatalogContributorRegistryReader.java deleted file mode 100644 index 2f01c5fc67..0000000000 --- a/bundles/org.eclipse.wst.xml.core/src-catalog/org/eclipse/wst/xml/core/internal/catalog/CatalogContributorRegistryReader.java +++ /dev/null @@ -1,269 +0,0 @@ -/******************************************************************************* - * 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 v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.xml.core.internal.catalog; - -import java.io.IOException; -import java.net.URL; - -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtensionPoint; -import org.eclipse.core.runtime.IExtensionRegistry; -import org.eclipse.core.runtime.InvalidRegistryObjectException; -import org.eclipse.core.runtime.Platform; -import org.eclipse.wst.xml.core.internal.Logger; -import org.eclipse.wst.xml.core.internal.XMLCoreMessages; -import org.eclipse.wst.xml.core.internal.XMLCorePlugin; -import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalog; -import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalogElement; -import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalogEntry; -import org.eclipse.wst.xml.core.internal.catalog.provisional.INextCatalog; -import org.osgi.framework.Bundle; - -public class CatalogContributorRegistryReader -{ - protected static final String EXTENSION_POINT_ID = "catalogContributions"; //$NON-NLS-1$ - protected static final String TAG_CONTRIBUTION = "catalogContribution"; //$NON-NLS-1$ - /* - * this is a sample exptension - * <extension point="org.eclipse.wst.xml.core.catalogContributions"> - * <catalogContribution> - * <uri - * name="http://schemas.xmlsoap.org/wsdl/soap/" - * uri="xsd/soap.xsd"/> - * <public - * publicId="-//W3C//DTD XHTML 1.1//EN" - * uri="dtds/xhtml11-flat.dtd"/> - * <nextCatalog id="nestedCatalog" catalog="data/catalog1.xml"/> - * </catalogContribution> - * </extension> - * - */ - protected ICatalog catalog; - - protected String declaringExtensionId; - - protected CatalogContributorRegistryReader(ICatalog aCatalog) - { - catalog = aCatalog; - } - - /** - * read from plugin registry and parse it. - */ - protected void readRegistry() - { - IExtensionRegistry pluginRegistry = Platform.getExtensionRegistry(); - IExtensionPoint point = pluginRegistry.getExtensionPoint(XMLCorePlugin.getDefault().getBundle().getSymbolicName(), EXTENSION_POINT_ID); - if (point != null) - { - IConfigurationElement[] elements = point.getConfigurationElements(); - for (int i = 0; i < elements.length; i++) - { - readElement(elements[i]); - } - } - - } - - public static String resolvePath(URL platformURL, String path) - { - String fileLocation = path; - int jarPathStart = path.indexOf("jar:"); //$NON-NLS-1$ - jarPathStart = jarPathStart < 0 ? 0 : jarPathStart + "jar:".length(); //$NON-NLS-1$ - int jarPathEnd = path.indexOf("!"); //$NON-NLS-1$ - jarPathEnd = jarPathEnd < 0 ? path.length() : jarPathEnd; - fileLocation = path.substring(jarPathStart, jarPathEnd); - - String result = path; - String resolvedLocation = fileLocation; - URL resolvedURL = null; - if (fileLocation.startsWith("platform:/plugin")) //$NON-NLS-1$ - { - // this is the speclial case, where the resource is located relative - // to another plugin (not the one that declares the extension point) - // - try - { - resolvedURL = Platform.resolve(new URL(fileLocation)); - } catch (IOException e) - { - // do nothing - } - } - else{ - // this is the typical case, where the resource is located relative - // to the plugin that declares the extension point - try { - resolvedURL = new URL(Platform.resolve(platformURL), fileLocation); - } catch (IOException e) { - // do nothing - } - } - - if(resolvedURL != null){ - resolvedLocation = resolvedURL.toExternalForm().replace('\\', '/'); - result = result.replaceFirst(fileLocation, resolvedLocation); - } - return result; - } - - public static URL getPlatformURL(String pluginId){ - Bundle bundle = Platform.getBundle(pluginId); - if (bundle != null) - { - URL bundleEntry = bundle.getEntry("/"); //$NON-NLS-1$ - - if(bundleEntry != null){ - try - { - return Platform.resolve(bundleEntry); - } catch (IOException e) - { - Logger.logException(e); - } - } - } - return null; - } - - private String resolvePath(String path) - { - return resolvePath(getPlatformURL(declaringExtensionId), path); - } - - protected void readElement(IConfigurationElement element) - { - try - { - declaringExtensionId = element.getDeclaringExtension().getNamespace(); - } - catch (InvalidRegistryObjectException e) - { - Logger.logException(e); - } - - if (TAG_CONTRIBUTION.equals(element.getName())){ - IConfigurationElement[] mappingInfoElementList = element.getChildren(OASISCatalogConstants.TAG_PUBLIC); - processMappingInfoElements(mappingInfoElementList); - mappingInfoElementList = element.getChildren(OASISCatalogConstants.TAG_SYSTEM); - processMappingInfoElements(mappingInfoElementList); - mappingInfoElementList = element.getChildren(OASISCatalogConstants.TAG_URI); - processMappingInfoElements(mappingInfoElementList); - IConfigurationElement[] nextCatalogElementList = element.getChildren(OASISCatalogConstants.TAG_NEXT_CATALOG); - processNextCatalogElements(nextCatalogElementList); - - } - - } - - private void processMappingInfoElements(IConfigurationElement[] childElementList) - { - if (catalog == null) - return; - for (int i = 0; i < childElementList.length; i++) - { - IConfigurationElement childElement = childElementList[i]; - String name = childElement.getName(); - String key = null; - - int type = ICatalogEntry.ENTRY_TYPE_PUBLIC; - if (OASISCatalogConstants.TAG_PUBLIC.equals(name)) - { - key = childElement.getAttribute(OASISCatalogConstants.ATTR_PUBLIC_ID); - } - else if (OASISCatalogConstants.TAG_SYSTEM.equals(name)) - { - key = childElement.getAttribute(OASISCatalogConstants.ATTR_SYSTEM_ID); - type = ICatalogEntry.ENTRY_TYPE_SYSTEM; - } - else if (OASISCatalogConstants.TAG_URI.equals(name)) - { - key = childElement.getAttribute(OASISCatalogConstants.ATTR_NAME); - type = ICatalogEntry.ENTRY_TYPE_URI; - } - else if (OASISCatalogConstants.TAG_NEXT_CATALOG.equals(name)) - { - processNextCatalogElements(new IConfigurationElement[]{childElement}); - continue; - } - if (key == null || key.equals("")) //$NON-NLS-1$ - { - Logger.log(Logger.ERROR, XMLCoreMessages.Catalog_entry_key_not_set); - continue; - } - String entryURI = childElement.getAttribute(OASISCatalogConstants.ATTR_URI); // mandatory - if (entryURI == null || entryURI.equals("")) //$NON-NLS-1$ - { - Logger.log(Logger.ERROR, XMLCoreMessages.Catalog_entry_uri_not_set); - continue; - } - ICatalogElement catalogElement = catalog.createCatalogElement(type); - if (catalogElement instanceof ICatalogEntry) - { - ICatalogEntry entry = (ICatalogEntry) catalogElement; - entry.setKey(key); - String resolvedPath = resolvePath(entryURI); - entry.setURI(resolvedPath); - String id = childElement.getAttribute(OASISCatalogConstants.ATTR_ID); // optional - if (id != null && !id.equals("")) //$NON-NLS-1$ - { - entry.setId(id); - } - } - // process any other attributes - for (int j = 0; j < childElement.getAttributeNames().length; j++) - { - String attrName = childElement.getAttributeNames()[j]; - if (!attrName.equals(OASISCatalogConstants.ATTR_URI) && !attrName.equals(OASISCatalogConstants.ATTR_NAME) && !attrName.equals(OASISCatalogConstants.ATTR_PUBLIC_ID) - && !attrName.equals(OASISCatalogConstants.ATTR_SYSTEM_ID) && !attrName.equals(OASISCatalogConstants.ATTR_CATALOG) && !attrName.equals(OASISCatalogConstants.ATTR_ID) - && !attrName.equals(OASISCatalogConstants.ATTR_BASE)) - { - String attrValue = childElement.getAttribute(attrName); - if (attrValue != null && !attrValue.equals("")) //$NON-NLS-1$ - { - catalogElement.setAttributeValue(attrName, attrValue); - } - } - } - catalog.addCatalogElement(catalogElement); - } - } - - private void processNextCatalogElements(IConfigurationElement[] childElementList) - { - if (catalog == null) - return; - for (int i = 0; i < childElementList.length; i++) - { - IConfigurationElement childElement = childElementList[i]; - String location = childElement.getAttribute(OASISCatalogConstants.ATTR_CATALOG); // mandatory - if (location == null || location.equals("")) //$NON-NLS-1$ - { - Logger.log(Logger.ERROR, XMLCoreMessages.Catalog_next_catalog_location_uri_not_set); - continue; - } - INextCatalog nextCatalog = new NextCatalog(); - String resolvedPath = resolvePath(location); - nextCatalog.setCatalogLocation(resolvedPath); - String id = childElement.getAttribute(OASISCatalogConstants.ATTR_ID); - if (id != null && !id.equals("")) //$NON-NLS-1$ - { - nextCatalog.setId(id); - } - catalog.addCatalogElement(nextCatalog); - } - } - - - -} diff --git a/bundles/org.eclipse.wst.xml.core/src-catalog/org/eclipse/wst/xml/core/internal/catalog/CatalogElement.java b/bundles/org.eclipse.wst.xml.core/src-catalog/org/eclipse/wst/xml/core/internal/catalog/CatalogElement.java deleted file mode 100644 index 1e51a04ffd..0000000000 --- a/bundles/org.eclipse.wst.xml.core/src-catalog/org/eclipse/wst/xml/core/internal/catalog/CatalogElement.java +++ /dev/null @@ -1,155 +0,0 @@ -/******************************************************************************* - * 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 v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.xml.core.internal.catalog; - -import java.net.MalformedURLException; -import java.net.URI; -import java.net.URISyntaxException; -import java.net.URL; -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalog; -import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalogElement; - - -public class CatalogElement implements ICatalogElement -{ - int type; - - String id; - - Map attributes = new HashMap(); - - ICatalog ownerCatalog; - - public CatalogElement(int aType) - { - super(); - type = aType; - } - - public int getType() - { - return type; - } - - public String getAttributeValue(String name) - { - return (String) attributes.get(name); - } - - public void setAttributeValue(String name, String value) - { - attributes.put(name, value); - } - - public String[] getAttributes() - { - Collection c = attributes.values(); - String[] result = new String[c.size()]; - attributes.keySet().toArray(result); - return result; - } - - public String getId() - { - return id; - } - - public void setId(String id) - { - this.id = id; - } - - public ICatalog getOwnerCatalog() - { - return ownerCatalog; - } - - public void setOwnerCatalog(ICatalog catalog) - { - this.ownerCatalog = catalog; - } - - protected static String makeAbsolute(String baseLocation, String location) - { - URL local = null; - location = location.replace('\\', '/'); - try - { - URL baseURL = new URL(baseLocation); - local = new URL(baseURL, location); - } catch (MalformedURLException e) - { - } - - if (local != null) - { - return local.toString(); - } else - { - return location; - } - } - - public String getAbsolutePath(String path) - { - try - { - URI uri = new URI(path); - if (uri.isAbsolute()) - { - return path; - } - } catch (URISyntaxException e) - { - } - - String result = path; - Catalog catalog = (Catalog) getOwnerCatalog(); - if (catalog != null) - { - String base = catalog.getBase(); - if (base == null || base.equals("")) //$NON-NLS-1$ - { - base = catalog.getLocation(); - } - result = makeAbsolute(base, path); - } - return result; - } - - /* - * Since we don't have events notifications for entry properties, clone() - * could allow to copy and edit entry and then replace it in catalog. Entry - * replacement will signal ICatalogEvent @return - */ - public Object clone() - { - ICatalogElement element = ownerCatalog.createCatalogElement(type); - String[] attributes = getAttributes(); - for (int i = 0; i < attributes.length; i++) - { - String attrName = attributes[i]; - String attrValue = getAttributeValue(attrName); - element.setAttributeValue(attrName, attrValue); - } - element.setOwnerCatalog(ownerCatalog); - element.setId(id); - return element; - } - - -} diff --git a/bundles/org.eclipse.wst.xml.core/src-catalog/org/eclipse/wst/xml/core/internal/catalog/CatalogEntry.java b/bundles/org.eclipse.wst.xml.core/src-catalog/org/eclipse/wst/xml/core/internal/catalog/CatalogEntry.java deleted file mode 100644 index 550a8e41d9..0000000000 --- a/bundles/org.eclipse.wst.xml.core/src-catalog/org/eclipse/wst/xml/core/internal/catalog/CatalogEntry.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - * 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 v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.xml.core.internal.catalog; - -import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalogElement; -import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalogEntry; - -public class CatalogEntry extends CatalogElement implements ICatalogEntry, Cloneable -{ - int entryType = ICatalogEntry.ENTRY_TYPE_PUBLIC; - String key; - String uri; - - protected CatalogEntry(int anEntryType) - { - super(ICatalogElement.TYPE_ENTRY); - entryType = anEntryType; - } - - protected CatalogEntry() - { - super(ICatalogElement.TYPE_ENTRY); - } - - public void setEntryType(int value) - { - entryType = value; - } - - public int getEntryType() - { - return entryType; - } - - public void setKey(String value) - { - key = value; - } - - public String getKey() - { - return key; - } - - public String getURI() - { - return uri; - } - - public void setURI(String value) - { - uri = value; - } - - public Object clone() - { - CatalogEntry entry = (CatalogEntry)super.clone(); - entry.setEntryType(entryType); - entry.setKey(key); - entry.setURI(uri); - return entry; - } -} diff --git a/bundles/org.eclipse.wst.xml.core/src-catalog/org/eclipse/wst/xml/core/internal/catalog/CatalogEvent.java b/bundles/org.eclipse.wst.xml.core/src-catalog/org/eclipse/wst/xml/core/internal/catalog/CatalogEvent.java deleted file mode 100644 index 8fba64d62f..0000000000 --- a/bundles/org.eclipse.wst.xml.core/src-catalog/org/eclipse/wst/xml/core/internal/catalog/CatalogEvent.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * 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 v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.xml.core.internal.catalog; - -import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalog; -import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalogElement; -import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalogEvent; - - -public class CatalogEvent implements ICatalogEvent -{ - protected ICatalog catalog; - protected ICatalogElement catalogElement; - protected int eventType; - - public CatalogEvent(Catalog catalog, ICatalogElement element, int eventType) - { - this.catalog = catalog; - this.catalogElement = element; - this.eventType = eventType; - } - - public ICatalog getCatalog() - { - return catalog; - } - - public ICatalogElement getCatalogElement() - { - return catalogElement; - } - - public int getEventType() - { - return eventType; - } -} diff --git a/bundles/org.eclipse.wst.xml.core/src-catalog/org/eclipse/wst/xml/core/internal/catalog/CatalogReader.java b/bundles/org.eclipse.wst.xml.core/src-catalog/org/eclipse/wst/xml/core/internal/catalog/CatalogReader.java deleted file mode 100644 index bdb88d343b..0000000000 --- a/bundles/org.eclipse.wst.xml.core/src-catalog/org/eclipse/wst/xml/core/internal/catalog/CatalogReader.java +++ /dev/null @@ -1,220 +0,0 @@ -/******************************************************************************* - * 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 v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.xml.core.internal.catalog; - -import java.io.IOException; -import java.io.InputStream; -import java.util.Stack; - -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.parsers.SAXParser; -import javax.xml.parsers.SAXParserFactory; - -import org.eclipse.wst.common.uriresolver.internal.URI; -import org.eclipse.wst.common.uriresolver.internal.util.URIHelper; -import org.eclipse.wst.xml.core.internal.Logger; -import org.eclipse.wst.xml.core.internal.XMLCoreMessages; -import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalogElement; -import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalogEntry; -import org.xml.sax.Attributes; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; -import org.xml.sax.helpers.DefaultHandler; - -/** - * - * - */ -public final class CatalogReader -{ - public static void read(Catalog xmlCatalog, InputStream input) throws IOException - { - try - { - SAXParserFactory factory = SAXParserFactory.newInstance(); - factory.setNamespaceAware(true); - SAXParser parser = factory.newSAXParser(); - parser.parse(new InputSource(input), new CatalogContentHandler(xmlCatalog)); - } - catch (ParserConfigurationException e) - { - Logger.logException(e); - } - catch (SAXException e) - { - Logger.logException(e); - } - } - protected static class CatalogContentHandler extends DefaultHandler - { - protected Catalog catalog; - protected Stack baseURIStack = new Stack(); - - public CatalogContentHandler(Catalog xmlCatalog) - { - this.catalog = xmlCatalog; - String base = xmlCatalog.getBase(); - if(base == null || base == "") { //$NON-NLS-1$ - base = xmlCatalog.getLocation(); - } - baseURIStack.push(base); - } - - public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException - { - // set base - String base = attributes.getValue(OASISCatalogConstants.ATTR_BASE); //$NON-NLS-1$ - if (base != null && !base.equals("")) //$NON-NLS-1$ - { - baseURIStack.push(base); - } else { - baseURIStack.push(baseURIStack.peek()); - } - - // processing for backward compatability start - if (localName.equals(CompatabilityConstants.TAG_USER_ENTRY)) - { - int type = ICatalogEntry.ENTRY_TYPE_PUBLIC; - String typeName = attributes.getValue("", CompatabilityConstants.ATT_TYPE); //$NON-NLS-1$ - if (typeName != null) - { - if (typeName.compareToIgnoreCase("SYSTEM") == 0) //$NON-NLS-1$ - { - type = ICatalogEntry.ENTRY_TYPE_SYSTEM; - } - } - ICatalogElement catalogElement = catalog.createCatalogElement(type); - if (catalogElement instanceof CatalogEntry) - { - CatalogEntry catalogEntry = (CatalogEntry) catalogElement; - String key = attributes.getValue("", CompatabilityConstants.ATT_ID); //$NON-NLS-1$ - catalogEntry.setKey(key); - String entryUri = attributes.getValue("", CompatabilityConstants.ATT_URI); //$NON-NLS-1$ - - // For relative URIs, try to resolve them using the corresponding base URI. - if(URI.createURI(entryUri).isRelative()) { - entryUri = URI.resolveRelativeURI(entryUri, baseURIStack.peek().toString()); - } - - catalogEntry.setURI(URIHelper.ensureURIProtocolFormat(entryUri)); - String webURL = attributes.getValue("", CompatabilityConstants.ATT_WEB_URL); //$NON-NLS-1$ - if (webURL != null) - { - catalogEntry.setAttributeValue( - ICatalogEntry.ATTR_WEB_URL, webURL); - } - } - catalog.addCatalogElement(catalogElement); - return; - } - // processing for backward compatability start - - int type = ICatalogEntry.ENTRY_TYPE_PUBLIC; - String key = null; - //dw String catalogId = attributes.getValue("", OASISCatalogConstants.ATTR_ID); - if (OASISCatalogConstants.TAG_PUBLIC.equals(localName)) - { - key = attributes.getValue("", OASISCatalogConstants.ATTR_PUBLIC_ID); //$NON-NLS-1$ - } - else if (OASISCatalogConstants.TAG_SYSTEM.equals(localName)) - { - key = attributes.getValue("", OASISCatalogConstants.ATTR_SYSTEM_ID); //$NON-NLS-1$ - type = ICatalogEntry.ENTRY_TYPE_SYSTEM; - } - else if (OASISCatalogConstants.TAG_URI.equals(localName)) - { - key = attributes.getValue("", OASISCatalogConstants.ATTR_NAME); //$NON-NLS-1$ - type = ICatalogEntry.ENTRY_TYPE_URI; - } - else if (OASISCatalogConstants.TAG_NEXT_CATALOG.equals(localName)) - { - String nextCatalogId = attributes.getValue("", OASISCatalogConstants.ATTR_ID); //$NON-NLS-1$ - - String location = attributes.getValue("", OASISCatalogConstants.ATTR_CATALOG); //$NON-NLS-1$ - NextCatalog delegate = new NextCatalog(); - delegate.setCatalogLocation(location); - delegate.setId(nextCatalogId); - catalog.addCatalogElement(delegate); - return; - } - else{ - // do not handle other entries - return; - } - if (key == null || key.equals("")) //$NON-NLS-1$ - { - Logger.log(Logger.ERROR, XMLCoreMessages.Catalog_entry_key_not_set); - return; - } - String entryURI = attributes.getValue("", OASISCatalogConstants.ATTR_URI); // mandatory //$NON-NLS-1$ - if (entryURI == null || entryURI.equals("")) //$NON-NLS-1$ - { - Logger.log(Logger.ERROR, XMLCoreMessages.Catalog_entry_uri_not_set); - return; - } - - ICatalogElement catalogElement = catalog.createCatalogElement(type); - if (catalogElement instanceof CatalogEntry) - { - CatalogEntry catalogEntry = (CatalogEntry) catalogElement; - catalogEntry.setKey(key); - - // For relative URIs, try to resolve them using the corresponding base URI. - if(URI.createURI(entryURI).isRelative()) { - entryURI = URI.resolveRelativeURI(entryURI, baseURIStack.peek().toString()); - } - - catalogEntry.setURI(URIHelper.ensureURIProtocolFormat(entryURI)); - - } - // process any other attributes - for (int j = 0; j < attributes.getLength(); j++) - { - String attrName = attributes.getLocalName(j); - if (!attrName.equals(OASISCatalogConstants.ATTR_URI) && !attrName.equals(OASISCatalogConstants.ATTR_NAME) && !attrName.equals(OASISCatalogConstants.ATTR_PUBLIC_ID) - && !attrName.equals(OASISCatalogConstants.ATTR_SYSTEM_ID) && !attrName.equals(OASISCatalogConstants.ATTR_CATALOG) && !attrName.equals(OASISCatalogConstants.ATTR_ID) - && !attrName.equals(OASISCatalogConstants.ATTR_BASE)) - { - String attrValue = attributes.getValue(attrName); - if (attrValue != null && !attrValue.equals("")) //$NON-NLS-1$ - { - catalogElement.setAttributeValue(attrName, attrValue); - } - } - } - catalog.addCatalogElement(catalogElement); - - } - - public void endElement(String uri, String localName, String qName) throws SAXException - { - if (baseURIStack.size() > 0) - { - baseURIStack.pop(); - } - } - - } - - // for backward compatability - interface CompatabilityConstants{ - - public static final String TAG_ID_XML_CATALOG_SETTINGS = "XMLCatalogSettings"; //$NON-NLS-1$ - public static final String TAG_ID_USER_ENTRIES = "UserEntries"; //$NON-NLS-1$ - public static final String TAG_USER_ENTRY = "UserEntry"; //$NON-NLS-1$ - public static final String ATT_TYPE = "TYPE"; //$NON-NLS-1$ - public static final String ATT_ID = "ID"; //$NON-NLS-1$ - public static final String ATT_URI = "URI"; //$NON-NLS-1$ - public static final String ATT_WEB_URL = "WEB_URL"; //$NON-NLS-1$ - } -} diff --git a/bundles/org.eclipse.wst.xml.core/src-catalog/org/eclipse/wst/xml/core/internal/catalog/CatalogSet.java b/bundles/org.eclipse.wst.xml.core/src-catalog/org/eclipse/wst/xml/core/internal/catalog/CatalogSet.java deleted file mode 100644 index acfbd165e8..0000000000 --- a/bundles/org.eclipse.wst.xml.core/src-catalog/org/eclipse/wst/xml/core/internal/catalog/CatalogSet.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * 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 v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.xml.core.internal.catalog; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.wst.xml.core.internal.Logger; - - - -public class CatalogSet { - protected Map uriResourceMap = new HashMap(); - protected Map catalogPersistenceLocations = new HashMap(); - public CatalogSet() { - super(); - } - - /** - * Find a Catalog with the given ID. If one is not found, create one at the given URI. - * - * @param id - * @param uri - the URI, the parent of this file path must already exist - * @return - */ - public Catalog lookupOrCreateCatalog(String id, String uri) { - Catalog catalog = getCatalog(id, uri); - if (catalog == null) { - catalog = new Catalog(this, id, uri); - try { - catalog.load(); - uriResourceMap.put(uri, catalog); - } - catch (Exception e) { - // we catch and log all exceptions, to disallow - // one bad extension interfering with others - Logger.logException("error loading catalog: " + id + " " + uri, e); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - return catalog; - } - - private Catalog getCatalog(String id, String uri) { - return (Catalog) uriResourceMap.get(uri); - } - - public void putCatalogPersistenceLocation(String logicalURI, String actualURI) { - catalogPersistenceLocations.put(logicalURI, actualURI); - } - - // Never used? - public String getCatalogPersistenceLocation(String id) { - return (String) catalogPersistenceLocations.get(id); - } -} diff --git a/bundles/org.eclipse.wst.xml.core/src-catalog/org/eclipse/wst/xml/core/internal/catalog/CatalogWriter.java b/bundles/org.eclipse.wst.xml.core/src-catalog/org/eclipse/wst/xml/core/internal/catalog/CatalogWriter.java deleted file mode 100644 index 1cf4de2a61..0000000000 --- a/bundles/org.eclipse.wst.xml.core/src-catalog/org/eclipse/wst/xml/core/internal/catalog/CatalogWriter.java +++ /dev/null @@ -1,223 +0,0 @@ -/******************************************************************************* - * 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 v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.xml.core.internal.catalog; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStream; - -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.OutputKeys; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; - -import org.eclipse.wst.xml.core.internal.Logger; -import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalog; -import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalogEntry; -import org.eclipse.wst.xml.core.internal.catalog.provisional.INextCatalog; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -/** - * Write OASIS XML Catalog format - * - */ -public final class CatalogWriter -{ - private Document doc; - - public void write(ICatalog xmlCatalog, String uri) throws FileNotFoundException, IOException - { - visitCatalog(xmlCatalog); - OutputStream outputStream = getOutputStream(uri); - serialize(outputStream); - } - - public void write(ICatalog catalog, OutputStream os) throws FileNotFoundException, IOException - { - if (catalog != null) - { - visitCatalog(catalog); - serialize(os); - } - } - - private void visitCatalog(ICatalog xmlCatalog) - { - try - { - doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); - } - catch (ParserConfigurationException e) - { - Logger.logException(e); - } - if (doc == null) - return; - Element catalogElement = doc.createElementNS(OASISCatalogConstants.namespaceName, OASISCatalogConstants.TAG_CATALOG); - doc.appendChild(catalogElement); - processCatalogEntries(xmlCatalog, catalogElement); - processNextCatalogs(xmlCatalog, catalogElement); - } - - private void processCatalogEntries(ICatalog catalog, Element parent) - { - ICatalogEntry[] catalogEntries = catalog.getCatalogEntries(); - - for (int i = 0; i < catalogEntries.length; i++) - { - ICatalogEntry entry = catalogEntries[i]; - String key = entry.getKey(); - String uri = entry.getURI(); - String id = entry.getId(); - Element childElement = null; - - switch (entry.getEntryType()) - { - case ICatalogEntry.ENTRY_TYPE_PUBLIC : - childElement = parent.getOwnerDocument().createElement(OASISCatalogConstants.TAG_PUBLIC); - if (childElement != null) - { - childElement.setAttribute(OASISCatalogConstants.ATTR_PUBLIC_ID, key); - childElement.setAttribute(OASISCatalogConstants.ATTR_URI, uri); - } - break; - case ICatalogEntry.ENTRY_TYPE_SYSTEM : - childElement = parent.getOwnerDocument().createElement(OASISCatalogConstants.TAG_SYSTEM); - if (childElement != null) - { - childElement.setAttribute(OASISCatalogConstants.ATTR_SYSTEM_ID, key); - childElement.setAttribute(OASISCatalogConstants.ATTR_URI, uri); - } - break; - case ICatalogEntry.ENTRY_TYPE_URI : - childElement = parent.getOwnerDocument().createElement(OASISCatalogConstants.TAG_URI); - if (childElement != null) - { - childElement.setAttribute(OASISCatalogConstants.ATTR_NAME, key); - childElement.setAttribute(OASISCatalogConstants.ATTR_URI, uri); - } - break; - default : - break; - } - if(childElement != null && id != null && !id.equals("")){ //$NON-NLS-1$ - childElement.setAttribute(OASISCatalogConstants.ATTR_ID, id); - } - - String[] attributes = entry.getAttributes(); - for (int j = 0; j < attributes.length; j++) - { - String attrName = attributes[j]; - if (attrName != null && !attrName.equals("")) //$NON-NLS-1$ - { - String attrValue = entry.getAttributeValue(attrName); - if (childElement != null && attrValue != null) - { - childElement.setAttribute(attrName, attrValue); - } - } - } - if (childElement != null) - { - parent.appendChild(childElement); - } - } - } - - private void processNextCatalogs(ICatalog catalog, Element parent) - { - // handle catalog entries - INextCatalog[] nextCatalogs = catalog.getNextCatalogs(); - Element childElement = null; - //dw String attrValue = null; - for (int i = 0; i < nextCatalogs.length; i++) - { - INextCatalog delegate = nextCatalogs[i]; - childElement = parent.getOwnerDocument().createElement(OASISCatalogConstants.TAG_NEXT_CATALOG); - if (childElement != null) - { - parent.appendChild(childElement); - String location = delegate.getCatalogLocation(); - if (location != null) - { - childElement.setAttribute(OASISCatalogConstants.ATTR_CATALOG, location); - } - String id = delegate.getId(); - if (id != null) - { - childElement.setAttribute(OASISCatalogConstants.ATTR_ID, id); - } - } - } - } - - private void serialize(OutputStream outputStream) throws FileNotFoundException, IOException - { - if (doc == null) - return; - try - { - TransformerFactory transformerFactory = TransformerFactory.newInstance(); - Transformer transformer = transformerFactory.newTransformer(); - transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$ - transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$ - // Unless a width is set, there will be only line breaks but no - // indentation. - // The IBM JDK and the Sun JDK don't agree on the property name, - // so we set them both. - // - transformer.setOutputProperty("{http://xml.apache.org/xalan}indent-amount", "2"); //$NON-NLS-1$ //$NON-NLS-2$ - transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2"); //$NON-NLS-1$ //$NON-NLS-2$ - String encoding = "UTF-8"; // TBD //$NON-NLS-1$ - if (encoding != null) - { - transformer.setOutputProperty(OutputKeys.ENCODING, encoding); - } - transformer.transform(new DOMSource(doc), new StreamResult(outputStream)); - } - catch (TransformerException e) - { - Logger.logException(e); - } - } - - private OutputStream getOutputStream(String uri) throws FileNotFoundException, IOException - { - String filePath = removeProtocol(uri); - File file = new File(filePath); - OutputStream stream = new FileOutputStream(file); - return stream; - } - - protected static String removeProtocol(String uri) - { - String result = uri; - String protocol_pattern = ":"; //$NON-NLS-1$ - if (uri != null) - { - int index = uri.indexOf(protocol_pattern); - if (index > 2) - { - result = result.substring(index + protocol_pattern.length()); - } - } - return result; - } -} diff --git a/bundles/org.eclipse.wst.xml.core/src-catalog/org/eclipse/wst/xml/core/internal/catalog/NextCatalog.java b/bundles/org.eclipse.wst.xml.core/src-catalog/org/eclipse/wst/xml/core/internal/catalog/NextCatalog.java deleted file mode 100644 index 16f755ace9..0000000000 --- a/bundles/org.eclipse.wst.xml.core/src-catalog/org/eclipse/wst/xml/core/internal/catalog/NextCatalog.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * 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 v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * Raj Mandayam, IBM - * 136400 NextCatalog.getReferencedCatalog() takes a lot of time computing constant information - * - *******************************************************************************/ -package org.eclipse.wst.xml.core.internal.catalog; - -import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalog; -import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalogElement; -import org.eclipse.wst.xml.core.internal.catalog.provisional.INextCatalog; - - - -public class NextCatalog extends CatalogElement implements INextCatalog -{ - private String location; - private ICatalog referencedCatalog; - - public NextCatalog() - { - super(ICatalogElement.TYPE_NEXT_CATALOG); - } - - public String getCatalogLocation() - { - return location; - } - - public ICatalog getReferencedCatalog() - { - if (referencedCatalog == null) - { - referencedCatalog = ((Catalog)ownerCatalog).getCatalogSet().lookupOrCreateCatalog(getId(), getAbsolutePath(location)); - } - return referencedCatalog; - } - - public void setCatalogLocation(String uri) - { - location = uri; - referencedCatalog = null; - } - - public Object clone() - { - NextCatalog nextCatalog = (NextCatalog)super.clone(); - nextCatalog.setCatalogLocation(location); - return nextCatalog; - } -} diff --git a/bundles/org.eclipse.wst.xml.core/src-catalog/org/eclipse/wst/xml/core/internal/catalog/OASISCatalogConstants.java b/bundles/org.eclipse.wst.xml.core/src-catalog/org/eclipse/wst/xml/core/internal/catalog/OASISCatalogConstants.java deleted file mode 100644 index a3c578a7bf..0000000000 --- a/bundles/org.eclipse.wst.xml.core/src-catalog/org/eclipse/wst/xml/core/internal/catalog/OASISCatalogConstants.java +++ /dev/null @@ -1,83 +0,0 @@ -/******************************************************************************* - * 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 v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.xml.core.internal.catalog; - -public interface OASISCatalogConstants -{ - public static final String namespaceName = "urn:oasis:names:tc:entity:xmlns:xml:catalog"; //$NON-NLS-1$ - /** Types of the catalog entries */ - /** The CATALOG element name. */ - public static final String TAG_CATALOG = "catalog"; //$NON-NLS-1$ - /** The GROUP catalog entry. */ - public static final String TAG_GROUP = "group"; //$NON-NLS-1$ - /** The PUBLIC catalog entry. */ - public static final String TAG_PUBLIC = "public"; //$NON-NLS-1$ - /** The SYSTEM catalog etnry. */ - public static final String TAG_SYSTEM = "system"; //$NON-NLS-1$ - /** The URI catalog entry. */ - public static final String TAG_URI = "uri"; //$NON-NLS-1$ - /** The REWRITE_SYSTEM catalog entry. */ - public static final String TAG_REWRITE_SYSTEM = "rewriteSystem"; //$NON-NLS-1$ - /** The REWRITE_URI catalog entry. */ - public static final String TAG_REWRITE_URI = "rewritePublic"; //$NON-NLS-1$ - /** The DELEGATE_PUBLIC catalog entry. */ - public static final String TAG_DELEGATE_PUBLIC = "delegatePublic"; //$NON-NLS-1$ - /** The DELEGATE_SYSTEM catalog entry. */ - public static final String TAG_DELEGATE_SYSTEM = "delegateSystem"; //$NON-NLS-1$ - /** The DELEGATE_URI catalog entry. */ - public static final String TAG_DELEGATE_URI = "delegateUri"; //$NON-NLS-1$ - /** The NEXT_CATALOG catalog entry. */ - public static final String TAG_NEXT_CATALOG = "nextCatalog"; //$NON-NLS-1$ - /** Attributes */ - /** Attribute id used in all catalog entries */ - public static final String ATTR_ID = "id"; //$NON-NLS-1$ - /** Attribute id base in all catalog entries */ - public static final String ATTR_BASE = "xml:base"; //$NON-NLS-1$ - /** Attribute id prefere in catalog entries: CATALOG, GROUP */ - public static final String ATTR_PREFERE = "prefere"; //$NON-NLS-1$ - /** Attribute used in catalog entries of type: PUBLIC */ - public static final String ATTR_PUBLIC_ID = "publicId"; //$NON-NLS-1$ - /** - * Attribute used in catalog entries of type: SYSTEM - */ - public static final String ATTR_SYSTEM_ID = "systemId"; //$NON-NLS-1$ - /** - * Attribute used in catalog entries of type: URI - */ - public static final String ATTR_NAME = "name"; //$NON-NLS-1$ - /** - * Attribute used in catalog entries of type: PUBLIC, URI - */ - public static final String ATTR_URI = "uri"; //$NON-NLS-1$ - /** - * Attribute used in catalog entries of type: REWRITE_SYSTEM, DELEGATE_SYSTEM - */ - public static final String ATTR_SYSTEM_ID_START_STRING = "systemIdStartString"; //$NON-NLS-1$ - /** - * Attribute used in catalog entries of type: REWRITE_SYSTEM, REWRITE_URI - */ - public static final String ATTR_REWRITE_PREFIX = "rewritePrefix"; //$NON-NLS-1$ - /** - * Attribute used in catalog entries of type: DELEGATE_PUBLIC - */ - public static final String ATTR_PUBLIC_ID_START_STRING = "publicIdStartString"; //$NON-NLS-1$ - /** - * Attribute used in catalog entries of type: DELEGATE_PUBLIC, - * DELEGATE_SYSTEM, DELEGATE_URI, NEXT_CATALOG - */ - public static final String ATTR_CATALOG = "catalog"; //$NON-NLS-1$ - /** - * Attribute used in catalog entries of type: REWRITE_URI, DELEGATE_URI - */ - public static final String ATTR_URI_START_STRING = "uriStartString"; //$NON-NLS-1$ -} diff --git a/bundles/org.eclipse.wst.xml.core/src-catalog/org/eclipse/wst/xml/core/internal/catalog/XMLCatalogURIResolverExtension.java b/bundles/org.eclipse.wst.xml.core/src-catalog/org/eclipse/wst/xml/core/internal/catalog/XMLCatalogURIResolverExtension.java deleted file mode 100644 index 0b4af07ab5..0000000000 --- a/bundles/org.eclipse.wst.xml.core/src-catalog/org/eclipse/wst/xml/core/internal/catalog/XMLCatalogURIResolverExtension.java +++ /dev/null @@ -1,102 +0,0 @@ -/******************************************************************************* - * 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 v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.xml.core.internal.catalog; - -import java.io.IOException; -import java.net.MalformedURLException; -import org.eclipse.core.resources.IFile; -import org.eclipse.wst.common.uriresolver.internal.provisional.URIResolverExtension; -import org.eclipse.wst.xml.core.internal.Logger; -import org.eclipse.wst.xml.core.internal.XMLCoreMessages; -import org.eclipse.wst.xml.core.internal.XMLCorePlugin; -import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalog; - -/** - * This class is used to inject the XMLCatalog resolution behaviour into the - * Common Extensible URI Resolver. This class is referenced in the XML Catalog - * plugin's plugin.xml file. - */ -public class XMLCatalogURIResolverExtension implements URIResolverExtension -{ - public String resolve(IFile file, String baseLocation, String publicId, String systemId) - { - // if we have catalog in a project we may add it - // to the catalog manager first - ICatalog catalog = XMLCorePlugin.getDefault().getDefaultXMLCatalog(); - if (catalog == null) - { - Logger.log(Logger.ERROR_DEBUG, XMLCoreMessages.Catalog_resolution_null_catalog); - return null; - } - String resolved = null; - if (systemId != null) - { - try - { - resolved = catalog.resolveSystem(systemId); - if (resolved == null) - { - resolved = catalog.resolveURI(systemId); - } - } - catch (MalformedURLException me) - { - Logger.log(Logger.ERROR_DEBUG, XMLCoreMessages.Catalog_resolution_malformed_url); - resolved = null; - } - catch (IOException ie) - { - Logger.log(Logger.ERROR_DEBUG, XMLCoreMessages.Catalog_resolution_io_exception); - resolved = null; - } - } - if (resolved == null) - { - if (publicId != null) - { - // CS : this is a temporary workaround for bug 96772 - // - // For schemas we always use locations where available and only use - // namespace when no location is specified. For XML entities (such as DOCTYPE) - // default always utilize the public catalog entry. - // - // This lame test below roughly discriminate between schema and XML entities. - // TODO (bug 103243) remove this lame test once we move to the new URIResolver API - // since the new API is explicit about namespace and publicId - // - if (!(systemId != null && systemId.endsWith(".xsd"))) //$NON-NLS-1$ - { - try - { - resolved = catalog.resolvePublic(publicId, systemId); - if (resolved == null) - { - resolved = catalog.resolveURI(publicId); - } - } - catch (MalformedURLException me) - { - Logger.log(Logger.ERROR_DEBUG, XMLCoreMessages.Catalog_resolution_malformed_url); - resolved = null; - } - catch (IOException ie) - { - Logger.log(Logger.ERROR_DEBUG, XMLCoreMessages.Catalog_resolution_io_exception); - resolved = null; - } - } - } - } - return resolved; - } -} diff --git a/bundles/org.eclipse.wst.xml.core/src-catalog/org/eclipse/wst/xml/core/internal/catalog/provisional/ICatalog.java b/bundles/org.eclipse.wst.xml.core/src-catalog/org/eclipse/wst/xml/core/internal/catalog/provisional/ICatalog.java deleted file mode 100644 index 0637a3cb79..0000000000 --- a/bundles/org.eclipse.wst.xml.core/src-catalog/org/eclipse/wst/xml/core/internal/catalog/provisional/ICatalog.java +++ /dev/null @@ -1,233 +0,0 @@ -/******************************************************************************* - * 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 v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.xml.core.internal.catalog.provisional; - -import java.io.IOException; -import java.net.MalformedURLException; - - - -/** - * A representation of the model object '<em><b>Catalog</b></em>'. - * - * <p> - * This interface is not intended to be implemented by clients. - * </p> - * - */ -public interface ICatalog -{ - /** - * Returns catalog id string - * - * @return catalog id string - */ - public String getId(); - - /** - * Sets catalog id string - * - */ - public void setId(String id); - - - public void setLocation(String location); - public String getLocation(); - - /** - * Return the applicable PUBLIC or SYSTEM identifier. - * - * <p> - * This method searches the Catalog and returns the system identifier - * specified for the given system or public identifiers. If no appropriate - * PUBLIC or SYSTEM entry is found in the Catalog, null is returned. - * </p> - * - * @param publicId - * The public identifier to locate in the catalog. Public - * identifiers are normalized before comparison. - * @param systemId - * The nominal system identifier for the entity in question (as - * provided in the source document). - * - * @throws MalformedURLException - * The formal system identifier of a subordinate catalog cannot - * be turned into a valid URL. - * @throws IOException - * Error reading subordinate catalog file. - * - * @return The system identifier to use. Note that the nominal system - * identifier is not returned if a match is not found in the - * catalog, instead null is returned to indicate that no match was - * found. - */ - public String resolvePublic(String publicId, String systemId) - throws MalformedURLException, IOException; - - /** - * Return the applicable SYSTEM system identifier. - * - * <p> - * If a SYSTEM entry exists in the Catalog for the system ID specified, - * return the mapped value. - * </p> - * - * <p> - * On Windows-based operating systems, the comparison between the system - * identifier provided and the SYSTEM entries in the Catalog is - * case-insensitive. - * </p> - * - * @param systemId - * The system ID to locate in the catalog. - * - * @return The resolved system identifier. - * - * @throws MalformedURLException - * The formal system identifier of a subordinate catalog cannot - * be turned into a valid URL. - * @throws IOException - * Error reading subordinate catalog file. - */ - public String resolveSystem(String systemId) throws MalformedURLException, - IOException; - - /** - * Return the applicable URI. - * - * <p> - * If a URI entry exists in the Catalog for the URI specified, return the - * mapped value. - * </p> - * - * <p> - * URI comparison is case sensitive. - * </p> - * - * @param uri - * The URI to locate in the catalog. - * - * @return The resolved URI. - * - * @throws MalformedURLException - * The system identifier of a subordinate catalog cannot be - * turned into a valid URL. - * @throws IOException - * Error reading subordinate catalog file. - */ - public String resolveURI(String uri) throws MalformedURLException, - IOException; - - /** - * Adds catalog element to the collection of the catalog elements. - * - * @param element - - * catalog element - */ - public void addCatalogElement(ICatalogElement element); - - /** - * Removes catalog element from the collection of the catalog elements. - * - * @param element - - * catalog element - */ - public void removeCatalogElement(ICatalogElement element); - - /** - * Returns an array of catalog elements of type ICatalogElement.TYPE_ENTRY - * - * @return an array of catalog elements - */ - public ICatalogEntry[] getCatalogEntries(); - - /** - * Returns an array of catalog elements of type - * ICatalogElement.TYPE_DELEGATE - * - * @return an array of catalog elements - */ - public INextCatalog[] getNextCatalogs(); - - /** - * Returns new catalog element with the specified type. If the type is one - * of ELEMENT_TYPE, the result entry will have corresponding interface. - * - * @return - */ - public ICatalogElement createCatalogElement(int type); - - /** - * Removes all the elements from this catalog. - * - */ - public void clear(); - - //public void load() throws IOException; - - public void save() throws IOException; - - /* - * Loads catalog from the specified location. Expecting OASIS XML Catalog - * format - * - * @param location - - * uri of the file where catalog will be saved - - * @throws IOException - - * problem loading file - * - */ - //public void load(InputStream inputStream) throws IOException; - - /* - * Saves catalog to the specified location in OASIS XML Catalog format - * - * @param location - - * uri of the file where catalog will be saved - - * @throws IOException - - * problem saving file - * - */ - //public void save(OutputStream outputStream) throws IOException; - - /** - * This method copies all catalog entries from source catalog to this one. - * - * @param catalog - - * source catalog - * @param includeNested - - * a boolean flag indicating wether to include entries of the - * same type from the nested catalogs - */ - public void addEntriesFromCatalog(ICatalog catalog); - - /** - * Adds a listener of the catalog events - * - * @param listener - - * listener of the catalog events - * @see ICatalogEvent - */ - public void addListener(ICatalogListener listener); - - /** - * Removes a listener of the catalog events - * - * @param listener - - * listener of the catalog events - * @see ICatalogEvent - */ - public void removeListener(ICatalogListener listener); -} diff --git a/bundles/org.eclipse.wst.xml.core/src-catalog/org/eclipse/wst/xml/core/internal/catalog/provisional/ICatalogElement.java b/bundles/org.eclipse.wst.xml.core/src-catalog/org/eclipse/wst/xml/core/internal/catalog/provisional/ICatalogElement.java deleted file mode 100644 index 15055c3c3c..0000000000 --- a/bundles/org.eclipse.wst.xml.core/src-catalog/org/eclipse/wst/xml/core/internal/catalog/provisional/ICatalogElement.java +++ /dev/null @@ -1,83 +0,0 @@ -/******************************************************************************* - * 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 v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.xml.core.internal.catalog.provisional; - - -/** - * - * <p> - * This interface is not intended to be implemented by clients. - * </p> - * - */ -public interface ICatalogElement -{ - /** Types of the catalog entries */ - /** The PUBLIC, URI or SYSTEM Catalog Entry. */ - public static final int TYPE_ENTRY = 1; - - /** The NEXT_CATALOG Catalog Entry type. */ - public static final int TYPE_NEXT_CATALOG = 10; - - /** - * Returns the value of the '<em><b>Type</b></em>' attribute. - * - * @return the value of the '<em>Type</em>' attribute. - */ - int getType(); - - /** - * Returns the value of the attribute with specified name. - * - * @return the value of the attribute with specified name. - * @see #setAttributeValue(String) - */ - String getAttributeValue(String name); - - /** - * Sets the value of the named attribute. - * - * @param name - * the name of the attribute that will be set - * @param value - * the new value of the named attribute. - * @see #getAttributeValue() - */ - void setAttributeValue(String name, String value); - - /** - * Returns an array of attribute names for any dynamic attributes that may exist - * - * @return array of attribute names - * @see #getAttributeValue() - * @see #setAttributeValue(String) - */ - String[] getAttributes(); - - /** - * Returns element's id string - * - * @return element's id string - */ - public String getId(); - - /** - * Sets element's id string - * - */ - public void setId(String id); - - public void setOwnerCatalog(ICatalog catalog); - - public ICatalog getOwnerCatalog(); -} diff --git a/bundles/org.eclipse.wst.xml.core/src-catalog/org/eclipse/wst/xml/core/internal/catalog/provisional/ICatalogEntry.java b/bundles/org.eclipse.wst.xml.core/src-catalog/org/eclipse/wst/xml/core/internal/catalog/provisional/ICatalogEntry.java deleted file mode 100644 index 271cbe2ea7..0000000000 --- a/bundles/org.eclipse.wst.xml.core/src-catalog/org/eclipse/wst/xml/core/internal/catalog/provisional/ICatalogEntry.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * 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 v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.xml.core.internal.catalog.provisional; - -/** - * - * <p> - * This interface is not intended to be implemented by clients. - * </p> - * - */ -public interface ICatalogEntry extends ICatalogElement -{ - /** The SYSTEM Catalog Entry type. */ - public static final int ENTRY_TYPE_PUBLIC = 2; - - /** The SYSTEM Catalog Entry type. */ - public static final int ENTRY_TYPE_SYSTEM = 3; - - /** The URI Catalog Entry type. */ - public static final int ENTRY_TYPE_URI = 4; - - /** Attribute name for Web address of catalog entry */ - public static final String ATTR_WEB_URL = "webURL"; //$NON-NLS-1$ - - /** - * - * @param entryType - */ - public void setEntryType(int entryType); - - /** - * - * @return - */ - public int getEntryType(); - - /** - * - * @param key - */ - public void setKey(String key); - - /** - * - * @return - */ - public String getKey(); - - /** - * - * @return - */ - public String getURI(); - - /** - * - * @param uri - */ - public void setURI(String uri); -} diff --git a/bundles/org.eclipse.wst.xml.core/src-catalog/org/eclipse/wst/xml/core/internal/catalog/provisional/ICatalogEvent.java b/bundles/org.eclipse.wst.xml.core/src-catalog/org/eclipse/wst/xml/core/internal/catalog/provisional/ICatalogEvent.java deleted file mode 100644 index 7825768172..0000000000 --- a/bundles/org.eclipse.wst.xml.core/src-catalog/org/eclipse/wst/xml/core/internal/catalog/provisional/ICatalogEvent.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * 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 v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.xml.core.internal.catalog.provisional; - - - -/** - * - * <p> - * This interface is not intended to be implemented by clients. - * </p> - * - */ -public interface ICatalogEvent -{ - /** */ - public static final int CHANGED = 0; - - public static final int ELEMENT_ADDED = 1; - - /** */ - public static final int ELEMENT_REMOVED = 2; - - /** */ - public static final int ELEMENT_CHANGED = 3; - - /** - * - * @return - */ - public int getEventType(); - - /** - * - * @return - */ - public ICatalog getCatalog(); - - /** - * - * @return - */ - public ICatalogElement getCatalogElement(); -} diff --git a/bundles/org.eclipse.wst.xml.core/src-catalog/org/eclipse/wst/xml/core/internal/catalog/provisional/ICatalogListener.java b/bundles/org.eclipse.wst.xml.core/src-catalog/org/eclipse/wst/xml/core/internal/catalog/provisional/ICatalogListener.java deleted file mode 100644 index 7c3dc0d3fe..0000000000 --- a/bundles/org.eclipse.wst.xml.core/src-catalog/org/eclipse/wst/xml/core/internal/catalog/provisional/ICatalogListener.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * 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 v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.xml.core.internal.catalog.provisional; - -import java.util.EventListener; - - -/** - * The clients of the catalog that want to listen to catalog changes should - * implement this interface. - * - * @see ICatalog, ICatalogEvent, - * - */ -public interface ICatalogListener extends EventListener -{ - /** - * This method allows to react to catalog events - * - * @param event - - * an event that client should react to - */ - public void catalogChanged(ICatalogEvent event); -} diff --git a/bundles/org.eclipse.wst.xml.core/src-catalog/org/eclipse/wst/xml/core/internal/catalog/provisional/INextCatalog.java b/bundles/org.eclipse.wst.xml.core/src-catalog/org/eclipse/wst/xml/core/internal/catalog/provisional/INextCatalog.java deleted file mode 100644 index 47c939cf80..0000000000 --- a/bundles/org.eclipse.wst.xml.core/src-catalog/org/eclipse/wst/xml/core/internal/catalog/provisional/INextCatalog.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * 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 v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.xml.core.internal.catalog.provisional; - - - -/** - * - * A representation of the nextCatalog OASIS XML catalog element. Object of the - * class that implements this interface would serve as a reference to the - * catalog object. - * - * @see ICatalog, ICatalogElement - * - * This interface currently is used only by the catalog itself. Need to find if - * there are any clients that need it. - * - * <p> - * This interface is not intended to be implemented by clients. - * </p> - * - */ -public interface INextCatalog extends ICatalogElement -{ - /** - * Set location of the referenced catalog. - * - * @param uri - - * location uri of the referenced catalog - */ - public void setCatalogLocation(String uri); - - /** - * Get location uri of the referenced catalog. - * - * @return location uri of the referenced catalog - */ - public String getCatalogLocation(); - - public ICatalog getReferencedCatalog(); - - -} |