|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.eclipse.emf.ecore.resource.impl.ContentHandlerImpl
org.eclipse.emf.ecore.xmi.impl.XMLContentHandlerImpl
org.eclipse.emf.ecore.xmi.impl.RootXMLContentHandlerImpl
public class RootXMLContentHandlerImpl
A specialized ContentHandler implementation that matches root element names and namespaces.
| Nested Class Summary | |
|---|---|
static class |
RootXMLContentHandlerImpl.Describer
A describer that creates a RootXMLContentHandlerImpl instance. |
| Nested classes/interfaces inherited from class org.eclipse.emf.ecore.xmi.impl.XMLContentHandlerImpl |
|---|
XMLContentHandlerImpl.XMI |
| Nested classes/interfaces inherited from interface org.eclipse.emf.ecore.resource.ContentHandler |
|---|
ContentHandler.ByteOrderMark, ContentHandler.Registry, ContentHandler.Validity |
| Field Summary | |
|---|---|
static java.lang.String |
CONTENT_TYPE_ID
The key in the constructor's parameter map representing the content type identifier String. |
protected java.lang.String |
contentTypeID
The content type identifier for content that matches this handler. |
static java.lang.String |
ELEMENT_NAMES
The key in the constructor's parameter map representing the root element names
which are encoded as a space separated list of names. |
protected java.lang.String[] |
elementNames
The expected name of the root element or the first non-XMI element. |
protected java.lang.String[] |
extensions
The file extensions for which this handler applies. |
static java.lang.String |
EXTENSIONS
The key in the constructor's parameter map representing the extensions
which are encoded as a space separate list of suffixes. |
protected java.lang.String |
kind
The kind of content that's expected; XMI content has special handling. |
static java.lang.String |
KIND
The key in the constructor's parameter map representing the kind of resource being processed;
only the value xmi |
protected java.lang.String |
namespace
The namespace of the root element or the first non-XMI element. |
static java.lang.String |
NAMESPACE
The key in the constructor's parameter map representing the namespace. |
static java.lang.String |
NAMESPACE_PATTERN
The key in the constructor's parameter map representing the namespace pattern. |
protected java.util.regex.Pattern |
namespacePattern
The namespace pattern of the root element or the first non-XMI element. |
static java.lang.String |
XMI_KIND
A kind value indicating XMI content. |
| Fields inherited from interface org.eclipse.emf.ecore.resource.ContentHandler |
|---|
BYTE_ORDER_MARK_PROPERTY, CHARSET_PROPERTY, CONTENT_TYPE_PROPERTY, INVALID_CONTENT_DESCRIPTION, OPTION_REQUESTED_PROPERTIES, UNSPECIFIED_CONTENT_TYPE, VALIDITY_PROPERTY |
| Constructor Summary | |
|---|---|
RootXMLContentHandlerImpl(java.util.Map<java.lang.String,java.lang.String> parameters)
Creates an instance corresponding to the given parameters. |
|
RootXMLContentHandlerImpl(java.lang.String contentTypeID,
java.lang.String[] extensions,
java.lang.String kind,
java.util.regex.Pattern namespacePattern,
java.lang.String[] elementNames)
Creates an instance initialized with the given arguments. |
|
RootXMLContentHandlerImpl(java.lang.String contentTypeID,
java.lang.String[] extensions,
java.lang.String kind,
java.lang.String namespace,
java.lang.String[] elementNames)
Creates an instance initialized with the given arguments. |
|
| Method Summary | |
|---|---|
boolean |
canHandle(URI uri)
Returns true if the extensions are null or empty, of if the URI's file extension matches one of the extension's values. |
java.util.Map<java.lang.String,java.lang.Object> |
contentDescription(URI uri,
java.io.InputStream inputStream,
java.util.Map<?,?> options,
java.util.Map<java.lang.Object,java.lang.Object> context)
Returns a valid content description if the XML content of the input stream has an element that matches the element names and namespace. |
protected boolean |
isMatchingNamespace(java.lang.String rootElementNamespace)
Returns whether the given root element's namespace matches the namespace expected for the content type. |
| Methods inherited from class org.eclipse.emf.ecore.xmi.impl.XMLContentHandlerImpl |
|---|
createXMLResource, getCharset, isXMINameAndNamespace, isXMINamespace, load |
| Methods inherited from class org.eclipse.emf.ecore.resource.impl.ContentHandlerImpl |
|---|
createContentDescription, getByteOrderMark, getRequestedProperties, isRequestedProperty |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.lang.String contentTypeID
protected java.lang.String[] extensions
protected java.lang.String kind
XMI content has special handling.
protected java.lang.String namespace
protected java.util.regex.Pattern namespacePattern
protected java.lang.String[] elementNames
public static final java.lang.String CONTENT_TYPE_ID
constructor's parameter map representing the content type identifier String.
contentTypeID,
Constant Field Valuespublic static final java.lang.String EXTENSIONS
constructor's parameter map representing the extensions
which are encoded as a space separate list of suffixes.
extensions,
Constant Field Valuespublic static final java.lang.String KIND
constructor's parameter map representing the kind of resource being processed;
only the value xmi is recognized.
- See Also:
kind,
Constant Field Values
public static final java.lang.String XMI_KIND
kind value indicating XMI content.
public static final java.lang.String NAMESPACE
constructor's parameter map representing the namespace.
namespace,
Constant Field Valuespublic static final java.lang.String NAMESPACE_PATTERN
constructor's parameter map representing the namespace pattern.
namespacePattern,
Constant Field Valuespublic static final java.lang.String ELEMENT_NAMES
constructor's parameter map representing the root element names
which are encoded as a space separated list of names.
elementNames,
Constant Field Values| Constructor Detail |
|---|
public RootXMLContentHandlerImpl(java.util.Map<java.lang.String,java.lang.String> parameters)
parameters - the map of key value pairs.CONTENT_TYPE_ID,
EXTENSIONS,
KIND,
NAMESPACE,
ELEMENT_NAMES
public RootXMLContentHandlerImpl(java.lang.String contentTypeID,
java.lang.String[] extensions,
java.lang.String kind,
java.lang.String namespace,
java.lang.String[] elementNames)
contentTypeID - the content type identifier for content recognized this this handler.extensions - the extensions handled by this instance;
null or an empty array specifies that this handler applies for all URIs.kind - the kind of content that's expected; XMI_KIND supports special handling.namespace - the expected namespace of the root element or first non-XMI element.elementNames - the expected element names of the root element or the first non-XMI element;
null or an empty array specifies that any root element name is allowed.
public RootXMLContentHandlerImpl(java.lang.String contentTypeID,
java.lang.String[] extensions,
java.lang.String kind,
java.util.regex.Pattern namespacePattern,
java.lang.String[] elementNames)
contentTypeID - the content type identifier for content recognized this this handler.extensions - the extensions handled by this instance;
null or an empty array specifies that this handler applies for all URIs.kind - the kind of content that's expected; XMI_KIND supports special handling.namespacePattern - a pattern that will match the expected namespace of the root element or first non-XMI element.elementNames - the expected element names of the root element or the first non-XMI element;
null or an empty array specifies that any root element name is allowed.| Method Detail |
|---|
public boolean canHandle(URI uri)
extensions are null or empty, of if the URI's file extension matches one of the extension's values.
canHandle in interface ContentHandlercanHandle in class ContentHandlerImpluri - the URI in questions.
public java.util.Map<java.lang.String,java.lang.Object> contentDescription(URI uri,
java.io.InputStream inputStream,
java.util.Map<?,?> options,
java.util.Map<java.lang.Object,java.lang.Object> context)
throws java.io.IOException
contentDescription in interface ContentHandlercontentDescription in class XMLContentHandlerImpluri - the URI for which to determine the content description.inputStream - the input stream associated with the given URI.options - a map of options to direct what kind of description is needed.context - a map of contextual information that content handlers use to store partially computed results.
java.io.IOException - if there is a problem reading the stream.protected boolean isMatchingNamespace(java.lang.String rootElementNamespace)
|
Copyright 2001-2006 IBM Corporation and others. All Rights Reserved. |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||