Package org.gvsig.gpe.lib.spi
Interface GPEProviderManager
public interface GPEProviderManager
- Author:
- Jorge Piera
-
Method Summary
Modifier and TypeMethodDescriptionbooleanReturn true if exists a driver that can open the filevoidaddGpeParser(Class clazz) Adds a new GPE parservoidaddGpeParser(String name, String description, Class clazz) Adds a new GPE parservoidAdds a new GPEWriterHandlerImplementorvoidaddGpeWriterHandlerImplementor(String name, String description, Class clazz) Adds a new GPEWriterHandlerImplementorvoidaddParsersFile(File file) It loads the parsers of a parsers file.voidaddWritersFile(File file) It loads the writers of a writers file.createParser(File file) Gets the parser that can open the file (if it exists)createParser(String name) Create a new parser from a namecreateParser(URI uri) Gets the parser that can open the file (if it exists)createParserByClass(String prefferredImplClassName) Create a new parser from a namecreateParserByMimeType(String mimeType) Create a new parser from a mime type.Create a new content writer from a namecreateWriterHandlerImplementorByClass(String prefferredImplClassName) Create a new writer from a class name.Create a new writer from a mime type.getWriterHandlerByFormat(String format) Gets all the writers that can write the provided format.
-
Method Details
-
addGpeParser
Adds a new GPE parser- Parameters:
name- Driver name. It must be written like FORMAT VERSIONdescription- Driver description. Just a descriptive textclazz- The parser class
-
addGpeParser
Adds a new GPE parser- Parameters:
clazz- The parser class
-
addParsersFile
It loads the parsers of a parsers file. The file is a properties file. Every line has the structure: Parser=Parser class- Parameters:
file- File that contains the parsers list- Throws:
IOExceptionFileNotFoundExceptionParserNotRegisteredException
-
addWritersFile
It loads the writers of a writers file. The file is a properties file. Every line has the structure: Writer=Parser class- Parameters:
file- File that contains the writers list- Throws:
IOExceptionFileNotFoundException
-
getAllParsers
IGPEParser[] getAllParsers()- Returns:
- all the registered parsers
-
addGpeWriterHandlerImplementor
void addGpeWriterHandlerImplementor(String name, String description, Class clazz) throws WriterHandlerNotRegisteredException Adds a new GPEWriterHandlerImplementor- Parameters:
name- Driver name. It must be written like FORMAT VERSIONdescription- Driver description. Just a descriptive textclazz- The parser class
-
addGpeWriterHandlerImplementor
Adds a new GPEWriterHandlerImplementor- Parameters:
clazz- The parser class
-
createParser
Create a new parser from a name- Parameters:
name- GPEParser namecontenHandler- Application contenHandler usett to throw the parsing eventserrorHandler- Application errror handler used to put errors and warnings
-
createParserByClass
Create a new parser from a name- Parameters:
name- GPEParser namecontenHandler- Application contenHandler usett to throw the parsing eventserrorHandler- Application errror handler used to put errors and warnings
-
createParserByMimeType
Create a new parser from a mime type. Each parser has a method namedthat returns the mimetype that the parser can read. One parser only supports one mimetype.invalid reference
GPEParser#getFormat()This method retrieve all the parsers and returns the first parser that is able to read the mimetype. If there are more parsers that can open the file will not be used.
- Parameters:
mimeType- The mimetype of the file to open- Returns:
- A parser that can parse the mimetype.
- Throws:
ParserCreationException- If it is not possible to create a parser- See Also:
-
createParser
Gets the parser that can open the file (if it exists)- Parameters:
uri- File to open- Returns:
- Null if the driver doesn't exist
-
createParser
Gets the parser that can open the file (if it exists)- Parameters:
file- File to open- Returns:
- Null if the driver doesn't exist
-
createWriterHandlerImplementor
IGPEWriterHandlerImplementor createWriterHandlerImplementor(String name) throws WriterHandlerCreationException Create a new content writer from a name- Parameters:
name- GPEWriterHandler name GPEParser namecontenHandler- Application contenHandler usett to throw the parsing eventserrorHandler- Application errror handler used to put errors and warnings
-
createWriterHandlerImplementorByClass
IGPEWriterHandlerImplementor createWriterHandlerImplementorByClass(String prefferredImplClassName) throws WriterHandlerCreationException Create a new writer from a class name. This method can be used if the class name is known but, the common method to get a writer is using the mime type. *- Parameters:
prefferredImplClassName- The name of the class that implementsinvalid reference
GPEWriterHandler- Returns:
- A writer for a concrete format.
- Throws:
WriterHandlerCreationException- If it is not possible to create a writer
-
createWriterHandlerImplementorByMimeType
IGPEWriterHandlerImplementor createWriterHandlerImplementorByMimeType(String mimeType) throws WriterHandlerCreationException Create a new writer from a mime type. Each writer has a method namedthat returns the mimetype that the writer can write. One writer only supports one mimetype.invalid reference
GPEWriterHandler#getFormat()This method retrieve all the writers and returns the first one that is able to write the mimetype. If there are more writer that can write the format will not be used.
- Parameters:
mimeType- The mimetype of the file to write- Returns:
- A writer that can write the mimetype.
- Throws:
WriterHandlerCreationException- If it is not possible to create a writer- See Also:
-
getWriterHandlerByFormat
Gets all the writers that can write the provided format. The elements are of type IGPEWriterHandler- Parameters:
format- as a short form (without version). Example: "gml", "kml"- Returns:
-
accept
Return true if exists a driver that can open the file- Parameters:
uri- File to open- Returns:
- true if the driver exists
-