Java Doc for Configuration.java in  » GIS » GeoTools-2.4.1 » org » geotools » xml » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » GIS » GeoTools 2.4.1 » org.geotools.xml 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.geotools.xml.Configuration

All known Subclasses:   org.geotools.sld.SLDConfiguration,  org.geotools.gml3.smil.SMIL20LANGConfiguration,  org.geotools.filter.v1_0.OGCConfiguration,  org.geotools.gml2.GMLConfiguration,  org.geotools.gml2.TestConfiguration,  org.geotools.ml.MLConfiguration,  org.geotools.wms.v1_1_1.bindings.WMSV1_1_1Configuration,  org.geotools.xlink.XLINKConfiguration,  org.geotools.filter.v1_1.OGCConfiguration,  org.geotools.po.bindings.POConfiguration,  org.geotools.gml3.GMLConfiguration,  org.geotools.gml3.smil.SMIL20Configuration,  org.geotools.data.complex.config.OasisCatalogConfigurationWrapper,  org.geotools.gml3.ApplicationSchemaConfiguration,  org.geotools.gml3.bindings.TestConfiguration,  org.geotools.xs.XSConfiguration,
Configuration
abstract public class Configuration (Code)
Responsible for configuring a parser runtime environment.

Implementations have the following responsibilites:

  • Configuration of bindings.
  • Configuration of context used by bindings.
  • Supplying specialized handlers for looking up schemas.
  • Supplying specialized handlers for parsing schemas.
  • Declaring dependencies on other configurations

Dependencies

Configurations have dependencies on one another, that result from teh fact that one schema imports another. Configuration dependencies are transitive. Each configuration should declare all dependencies in the constructor using the Configuration.addDependency(Configuration) method.

 class MyConfiguration extends Configuration {
 public MyConfiguration() {
 super();
 addDependency( new FooConfiguration() );
 addDependency( new BarConfiguration() );
 }
 ...
 }
 

Binding Configuration

In able for a particular binding to be found during a parse, the configuration must first populate a container with said binding. This can be done by returning the appropriate instance of org.geotools.xml.BindingConfiguration in Configuration.getBindingConfiguration() :

 
 BindingConfiguration getBindingConfiguration() {
 return new MyBindingConfiguration();
 }
 
 
Instances of type org.geotools.xml.BindingConfiguration are used to populate a container with all the bindings from a particular schema.

Context Configuration

Many bindings have dependencies on other types of objects. The pattern used to satisfy these dependencies is known as Constructor Injection. Which means that any dependencies a binding has is passed to it in its constructor. For instance, the following binding has a dependency on java.util.List.

 
 class MyBinding implements SimpleBinding {
 List list;
 public MyBinding(List list) {
 this.list = list;
 }
 }
 
 
Before a binding can be created, the container in which it is housed in must be able to satisfy all of its dependencies. It is the responsibility of the configuration to statisfy this criteria. This is known as configuring the binding context. The following is a suitable configuration for the above binding.
 
 class MyConfiguration extends Configuration {
 ....
 void configureContext(MutablePicoContainer container) {
 container.registerComponentImplementation(ArrayList.class);
 }
 }
 
 

Schema Resolution

XML instance documents often contain schema uri references that are invalid with respect to the parser, or non-existant. A configuration can supply specialized look up classes to prevent the parser from following an invalid uri and prevent any errors that may occur as a result.

An instance of org.eclipse.xsd.util.XSDSchemaLocationResolver can be used to override a schemaLocation referencing another schema. This can be useful when the entity parsing an instance document stores schemas in a location unkown to the entity providing hte instance document.

An instance of org.eclipse.xsd.util.XSDSchemaLocator can be used to provide an pre-parsed schema and prevent the parser from parsing a schemaLocation manually. This can be useful when an instance document does not supply a schemaLocation for the targetNamespace of the document.

 
 class MyConfiguration implements Configuration {
 XSDSchemaLocationResolver getSchemaLocationResolver() {
 return new MySchemaLocationResolver();
 }
 XSDSchemaLocator getSchemaLocator() {
 return new MySchemaLocator();
 }
 }
 
 

The XSDSchemaLocator and XSDSchemaLocationResolver implementations are used in a couple of scenarios. The first is when the schemaLocation attribute of the root element of the instance document is being parsed. The schemaLocation attribute has the form:

 
 schemaLocation="namespace location namespace location ..."
 
 
In which (namespace,location) tuples are listed. For each each namespace encountered when parsing the schemaLocation attribute, an appropriate resolver / locator is looked up. If an override is not aviable, the framework attempts to resolve the location part of the tuple into a schema. The second scenario occurs when the parsing of a schema encounters an import or an include element. These elements have the form:
 
 <import namespace="" schemaLocation=""/>
 
 
and:
 
 <include schemaLocation="">
 
 
respectivley. Similar to above, the schemaLocation (and namespace in the case of an import) are used to find an override. If not found they are resolved directly.


author:
   Justin Deoliveira,Refractions Research Inc.,jdeolive@refractions.net
See Also:   org.geotools.xml.BindingConfiguration



Constructor Summary
public  Configuration()
     Creates a new configuration.

Method Summary
protected  voidaddDependency(Configuration dependency)
     Adds a dependent configuration.
final public  ListallDependencies()
     Returns all dependencies in the configuration dependency tree.
protected  voidconfigureBindings(MutablePicoContainer container)
     Template method allowing subclass to override any bindings.
protected  voidconfigureContext(MutablePicoContainer container)
     Configures the root context to be used when parsing elements.

The context satisifies any depenencencies needed by a binding.

protected  XSDSchemaLocatorcreateSchemaLocator()
     Template method for creating a new instance of XSDSchemaLocator .
final public  booleanequals(Object obj)
     Equals override, equality is based soley on Configuration.getNamespaceURI() .
public  voidflush()
    
abstract public  BindingConfigurationgetBindingConfiguration()
    
final public  ListgetDependencies()
    
abstract public  StringgetNamespaceURI()
    
final public  ListgetProperties()
     Returns a list of parser properties to set.

To set a parser property:

 Configuration configuration = ...
 configuration.getProperties().add( Parser.Properties....
abstract public  StringgetSchemaFileURL()
     Returns the url to the file definiing hte schema.
public  XSDSchemaLocationResolvergetSchemaLocationResolver()
     Returns a schema location resolver instance used to override schema location uri's encountered in an instance document.

This method should be overridden to return such an instance.

public  XSDSchemaLocatorgetSchemaLocator()
     Returns a schema locator, used to create imported and included schemas when parsing an instance document.

This method may be overriden to return such an instance.

final public  inthashCode()
    
public  XSDSchemaschema()
     Convenience method for creating an instance of the schema for this configuration.
final public  MutablePicoContainersetupBindings(MutablePicoContainer container)
     Configures a container which houses all the bindings used during a parse.
final public  MutablePicoContainersetupContext(MutablePicoContainer container)
     Configures the root context to be used when parsing elements.


Constructor Detail
Configuration
public Configuration()(Code)
Creates a new configuration.

Any dependent schemas should be added in sublcass constructor. The xml schema dependency does not have to be added.





Method Detail
addDependency
protected void addDependency(Configuration dependency)(Code)
Adds a dependent configuration.

This method should only be called from the constructor.


Parameters:
  dependency -



allDependencies
final public List allDependencies()(Code)
Returns all dependencies in the configuration dependency tree.

The return list contains no duplicates.

All dependencies in teh configuration dependency tree.



configureBindings
protected void configureBindings(MutablePicoContainer container)(Code)
Template method allowing subclass to override any bindings.
Parameters:
  container - Container containing all bindings, keyed by QName.



configureContext
protected void configureContext(MutablePicoContainer container)(Code)
Configures the root context to be used when parsing elements.

The context satisifies any depenencencies needed by a binding. This is often a factory used to create something.

This method should be overriden. The default implementation does nothing.


Parameters:
  container - The container representing the context.



createSchemaLocator
protected XSDSchemaLocator createSchemaLocator()(Code)
Template method for creating a new instance of XSDSchemaLocator .

Subclasses may override this method, the default implementation returns a new instance of SchemaLocator .




equals
final public boolean equals(Object obj)(Code)
Equals override, equality is based soley on Configuration.getNamespaceURI() .



flush
public void flush()(Code)
Flushes any internal state



getBindingConfiguration
abstract public BindingConfiguration getBindingConfiguration()(Code)
The binding set for types, elements, attributes of the configuration schema.



getDependencies
final public List getDependencies()(Code)
a list of direct dependencies of the configuration.



getNamespaceURI
abstract public String getNamespaceURI()(Code)
The namespace of the configuration schema.



getProperties
final public List getProperties()(Code)
Returns a list of parser properties to set.

To set a parser property:

 Configuration configuration = ...
 configuration.getProperties().add( Parser.Properties.... );
 

A list of hte set parser properties.



getSchemaFileURL
abstract public String getSchemaFileURL()(Code)
Returns the url to the file definiing hte schema.

For schema which are defined by multiple files, this method should return the base schema which includes all other files that define the schema.

TODO: rename this to getSchemaLocation()



getSchemaLocationResolver
public XSDSchemaLocationResolver getSchemaLocationResolver()(Code)
Returns a schema location resolver instance used to override schema location uri's encountered in an instance document.

This method should be overridden to return such an instance. The default implemntation returns null

The schema location resolver, or null



getSchemaLocator
public XSDSchemaLocator getSchemaLocator()(Code)
Returns a schema locator, used to create imported and included schemas when parsing an instance document.

This method may be overriden to return such an instance. The default delegates to Configuration.createSchemaLocator() to and caches the restult. This method may return null to indicate that no such locator should be used.

The schema locator, or null



hashCode
final public int hashCode()(Code)



schema
public XSDSchema schema()(Code)
Convenience method for creating an instance of the schema for this configuration. The schema for this configuration.



setupBindings
final public MutablePicoContainer setupBindings(MutablePicoContainer container)(Code)
Configures a container which houses all the bindings used during a parse.
Parameters:
  container - The container housing the binding objects.



setupContext
final public MutablePicoContainer setupContext(MutablePicoContainer container)(Code)
Configures the root context to be used when parsing elements.
Parameters:
  container - The container representing the context.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.