Extension SDK 10.1.2

oracle.ide.xml
Class XMLRecognizer

java.lang.Object
  extended byoracle.ide.model.DefaultRecognizer
      extended byoracle.ide.xml.XMLRecognizer
All Implemented Interfaces:
Recognizer

public final class XMLRecognizer
extends DefaultRecognizer

The XMLRecognizer is the default Recognizer implementation used in the IDE. It contains support for recognizing an XML document through a variety of mechanisms.


Method Summary
 Node create(java.net.URL url, java.lang.Class dataClass)
          Creates an instance of the design-time node associated with the specified URL.
static NodeInfo findNodeInfo(java.lang.Class dataClass)
          This method finds a NodeInfo instance that is associated with a particular data Class.
 java.util.Map getExtensionToClassMap()
           
static void mapDoctypeToClass(java.lang.String publicId, java.lang.String systemId, java.lang.Class cls)
          Maps the specified public ID and system ID (from the XML doctype) to the specified data class.
static void mapExtensionToClass(java.lang.String extension, java.lang.Class cls)
          Maps the specified file extension to the specified data class.
static void mapNamespaceElemToClass(java.lang.String namespaceURI, java.lang.String localElemName, java.lang.Class cls)
          Maps the specified namespace element (a combination of the XML namespace URI with local element name) to the specified data class.
static void mapRootElementToClass(java.lang.String rootElem, java.lang.Class cls)
          Maps the specified file extension to the specified data class.
static void mapRootElementToDataClass(java.lang.String rootElem, java.lang.Class cls)
           
 java.lang.Class recognize(java.net.URL url)
          Gets the Class of the data item associated with the specified URL.
static void registerNodeInfo(NodeInfo info)
          Uses the specified NodeInfo to register recognizer behavior.
static void treatExtensionAsXML(java.lang.String extension)
          Registers the specified extension as one that corresponds to an XML file.
static void treatExtensionAsXML(java.lang.String extension, NodeInfoLoader loader)
          Registers the specified extension as one that corresponds to an XML file.
 java.net.URL validate(java.net.URL newURL, java.net.URL oldURL)
          Validate the specified new name.
 
Methods inherited from class oracle.ide.model.DefaultRecognizer
canConvert, clearExtensionToClassMap, getClassForExtension, getDocumentInfo, getValidConversions, registerConversion, registerDocumentInfo, sanitizeExtension, sanitizeExtensionAsString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

treatExtensionAsXML

public static void treatExtensionAsXML(java.lang.String extension)
Registers the specified extension as one that corresponds to an XML file. The XMLRecognizer only attempts to find a data class for an XML file if the URL for the file has an extension that is treated as XML.

The extension passed in is allowed to contain or omit the leading "."; if it is omitted, it will be added automatically.


treatExtensionAsXML

public static void treatExtensionAsXML(java.lang.String extension,
                                       NodeInfoLoader loader)
Registers the specified extension as one that corresponds to an XML file. The NodeInfoLoader will be used to trigger the lazy loading of NodeInfo objects if an URL with the specified extension is recognized by XMLRecognizer.

The loader can be null, which means that there is no NodeInfoLoader that needs to be invoked for the specified extension.


mapExtensionToClass

public static void mapExtensionToClass(java.lang.String extension,
                                       java.lang.Class cls)
Maps the specified file extension to the specified data class.

The specified extension is allowed to contain or omit the leading "."; if omitted, it will be added automatically.


mapNamespaceElemToClass

public static void mapNamespaceElemToClass(java.lang.String namespaceURI,
                                           java.lang.String localElemName,
                                           java.lang.Class cls)
Maps the specified namespace element (a combination of the XML namespace URI with local element name) to the specified data class. This is the preferred recognition mechanism for objects that are marshalled by Object2Dom.


mapDoctypeToClass

public static void mapDoctypeToClass(java.lang.String publicId,
                                     java.lang.String systemId,
                                     java.lang.Class cls)
Maps the specified public ID and system ID (from the XML doctype) to the specified data class. One of public ID or system ID must be non-null; if both IDs are null, this method has no effect.


mapRootElementToClass

public static void mapRootElementToClass(java.lang.String rootElem,
                                         java.lang.Class cls)
Maps the specified file extension to the specified data class.

The specified extension is allowed to contain or omit the leading "."; if omitted, it will be added automatically.


registerNodeInfo

public static void registerNodeInfo(NodeInfo info)
Uses the specified NodeInfo to register recognizer behavior.

See Also:
NodeInfo

findNodeInfo

public static NodeInfo findNodeInfo(java.lang.Class dataClass)
This method finds a NodeInfo instance that is associated with a particular data Class.

Parameters:
dataClass - The data Class.
Returns:
the NodeInfo associated with the data class or null if no NodeInfo is found.

recognize

public java.lang.Class recognize(java.net.URL url)
Description copied from interface: Recognizer
Gets the Class of the data item associated with the specified URL. Implementations must return null if the URL is not recognized. The Class returned must be the data model class. This value is passed to the Recognizer.create(URL, Class) method which will create the design-time node.

Specified by:
recognize in interface Recognizer
Overrides:
recognize in class DefaultRecognizer

create

public Node create(java.net.URL url,
                   java.lang.Class dataClass)
            throws java.lang.IllegalAccessException,
                   java.lang.InstantiationException
Description copied from interface: Recognizer
Creates an instance of the design-time node associated with the specified URL. This method is called by the NodeFactory. This method must return a Node instance. The type parameter specifies the Class of the data object.

Specified by:
create in interface Recognizer
Overrides:
create in class DefaultRecognizer
Throws:
java.lang.IllegalAccessException
java.lang.InstantiationException

validate

public java.net.URL validate(java.net.URL newURL,
                             java.net.URL oldURL)
                      throws RecognizerException
Description copied from interface: Recognizer
Validate the specified new name. Returns null if the name does not validate. This method may modify the URL to make it valid, such as adding a file extension. The old URL is used as the validation base. For example, if the new URL does not have the correct file extension, the old URL extension may be added to the new URL during the validation process.

Specified by:
validate in interface Recognizer
Overrides:
validate in class DefaultRecognizer
Throws:
RecognizerException

getExtensionToClassMap

public java.util.Map getExtensionToClassMap()
Overrides:
getExtensionToClassMap in class DefaultRecognizer
Returns:
An unsynchronized Map that should be synchronized upon when used.

mapRootElementToDataClass

public static void mapRootElementToDataClass(java.lang.String rootElem,
                                             java.lang.Class cls)

Extension SDK

 

Copyright © 1997, 2004, Oracle. All rights reserved.