# com.bea.ide.lang.control
ControlDocumentFactory Class

public class ControlDocumentFactory
extends `DefaultDocumentHandler`
implements `IRelatedDocumentHandler`

Creates Document handlers for webservice documents.

Hierarchy
  `Object`
  `DefaultDocumentHandler`
  `ControlDocumentFactory`

All Implemented Interfaces
  `IDocumentHandler`, `IRelatedDocumentHandler`

## Field Summary

`public static final `String`` | `EXTENSION` String
`public static final `String`` | `EXTENSION_IMPL` String
`public static final `String`` | `EXTENSION_OLD` String

## Constructor Summary

ControlDocumentFactory() Creates a control document factory with the default extension.
ControlDocumentFactory(boolean useCtrl) Creates a control document factory that uses either the old or new file extension.

## Method Summary

`public `IDocument`` | `createDocumentObject`(`URI` uriFile) Create a document object for the given file.
`public `String`` | `getBaseName`(`String` sFile) Derives the base name for the given file, stripping away all extension and name suffix information.
`public `String`` | `getDefaultNameSuffix`() Add this to the name of control files.
`public `URI`` | `getParentDocument`(`URI` uriFile) Obtain the parent document for the given file.
`public `String`` | `invalidNameCheck`(`String` sFile) Checks the given filename to see if it is a valid name for this handler.
`public boolean` | `isAutogenerated`(`URI` uriFile) This method allows the handler to determine if the specified file is autogenerated.
`public `String`` | `suggestValidName`(`String` sFile) Examine the given filename and derive a valid filename from it.

Methods from `com.bea.ide.document.`DefaultDocumentHandler``
``createNewFile`, `getDefaultExtension`, `getExtension`, `getHandlerId`, `getTemplate`, `openDocument`, `resolveUnknownPriority`,`

Methods from class `java.lang.`Object``
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods from interface `com.bea.ide.document.`IDocumentHandler``
``createNewFile`, `getBaseName`, `getDefaultExtension`, `getHandlerId`, `invalidNameCheck`, `openDocument`, `resolveUnknownPriority`, `suggestValidName``

Methods from interface `com.bea.ide.document.`IRelatedDocumentHandler``
``getParentDocument`, `isAutogenerated``

## Field Detail

### EXTENSION

    public static final String EXTENSION

### EXTENSION_IMPL

    public static final String EXTENSION_IMPL

### EXTENSION_OLD

    public static final String EXTENSION_OLD

## Constructor Detail

### ControlDocumentFactory

    public ControlDocumentFactory()

  Creates a control document factory with the default extension.

### ControlDocumentFactory

    public ControlDocumentFactory(boolean useCtrl)

  Creates a control document factory that uses either the old or new file extension.

## Method Detail

### createDocumentObject(URI) Method

    public IDocument createDocumentObject(URI uriFile)

Create a document object for the given file.

Overrides
  `DefaultDocumentHandler.createDocumentObject(URI)`

#### Parameters

uriFile
  Name of the existing file to create the IDocument interface for

#### Returns

An object implementing the IDocument interface that represents the contents of the given file

### getBaseName(String) Method

    public String getBaseName(String sFile)

Description copied from `IDocumentHandler.getBaseName(String)`
Derives the base name for the given file, stripping away all extension and name suffix information. Generally, it simply removes the extension, but some handlers may also add a pre-extension suffix to a file. This method strips all of that out to determine the original name.

Overrides
  `DefaultDocumentHandler.getBaseName(String)`

#### Parameters

sFile
  The filename that should be examined to find the original name. This should not contain any path information (i.e. directory or separators)

#### Returns

The base name that the given name was derived from.

### getDefaultNameSuffix() Method

    public String getDefaultNameSuffix()

Add this to the name of control files.

### getParentDocument(URI) Method

    public URI getParentDocument(URI uriFile)

Description copied from `IRelatedDocumentHandler.getParentDocument(URI)`
Obtain the parent document for the given file. If the isAutogenerated method returns true for a URI, this method should return the document from which the first was generated.

#### Parameters

uriFile
  URI of autogenerated file

#### Returns

URI of the file used to generate uriFile, or null if uriFile is not autogenerated or it's parent cannot be determined.

### invalidNameCheck(String) Method

    public String invalidNameCheck(String sFile)

Description copied from `IDocumentHandler.invalidNameCheck(String)`
Checks the given filename to see if it is a valid name for this handler. This check may include verification of the extension and any other requirements on the filename. For example, the java handler can require that the filename be a valid java identifier.

Overrides
  `DefaultDocumentHandler.invalidNameCheck(String)`

#### Parameters

sFile
  The filename that should be examined for validity. This should not contain any path information (i.e. directory or separators).

#### Returns

String value indicating the error message that should be shown to the user or null if the name is valid.

### isAutogenerated(URI) Method

    public boolean isAutogenerated(URI uriFile)

Description copied from `IRelatedDocumentHandler.isAutogenerated(URI)`
This method allows the handler to determine if the specified file is autogenerated. This is the equivalent of instantiating the document for the file and using the `IRelatedDocument``` interface to make the same method call. This method does not require instantiating the document however and is therefore lighter weight.

#### Parameters

uriFile
  File to check for autogeneration

#### Returns

true if the given uri is a file that was completely generated from the contents of another file.

### suggestValidName(String) Method

    public String suggestValidName(String sFile)

Description copied from `IDocumentHandler.suggestValidName(String)`
Examine the given filename and derive a valid filename from it. This method differs from `IDocumentHandler.invalidNameCheck(String)``` in that rather than returning an error, it will attempt to address any invalid characters in the name and correct them. An example is an implementation that replaces spaces with '_' in a handler that does not allow spaces.

Overrides
  `DefaultDocumentHandler.suggestValidName(String)`

#### Parameters

sFile
  The filename that should be examined for validity. This should not contain any path information (i.e. directory or separators).

#### Returns

A valid filename for which invalidNameCheck will return null, indicating a valid name.