Interface OptionalFactory

All Superinterfaces:
Factory
All Known Subinterfaces:
Driver, FileDriver, GridFormatFactorySpi, ProcessFactory, PropertiesCollectorSPI
All Known Implementing Classes:
Abstract_URI_AuthorityFactory, AbstractFeatureCollectionProcessFactory, AIGFormatFactory, AllAuthoritiesFactory, AnnotatedBeanProcessFactory, AnnotationDrivenProcessFactory, ArcGridFormatFactory, AuthorityBackedFactory, AuthorityFactoryAdapter, BaseGridFormatFactorySPI, ByteFileNameExtractorSPI, CenterLineProcess, CoordinateOperationFactoryUsingWKT, CRSExtractorSPI, CurrentDateExtractorSPI, DateExtractorSPI, DefaultDriver, DefaultFileDriver, DefaultPropertiesCollectorSPI, DeferredAuthorityFactory, DoubleFileNameExtractorSPI, DTEDFormatFactory, ECWFormatFactory, EnviHdrFormatFactory, ErdasImgFormatFactory, EsriExtension, EsriHdrFormatFactory, FactoryUsingWKT, FallbackAuthorityFactory, FeatureToFeatureProcessFactory, FloatFileNameExtractorSPI, FSDateExtractorSPI, GeometryProcessFactory, GeoPackageFormatFactorySpi, GeoTiffFormatFactorySpi, GrassCoverageFormatFactory, GRIBFormatFactorySPI, HTTP_AuthorityFactory, HTTP_URI_AuthorityFactory, IAUAuthorityFactory, IAULongitudeFirstFactory, IDRISIFormatFactory, ImageMosaicFormatFactory, ImagePyramidFormatFactory, IntegerFileNameExtractorSPI, JP2ECWFormatFactory, JP2KFormatFactory, JP2KFormatFactory, JP2MrSIDFormatFactory, LongFileNameExtractorSPI, LongitudeFirstEpsgDecorator, LongitudeFirstFactory, ManyAuthoritiesFactory, MBTilesFormatFactorySpi, MrSIDFormatFactory, NetCDFCRSAuthorityFactory, NetCDFDriver, NetCDFFormatFactorySPI, NITFFormatFactory, OrderedAxisAuthorityFactory, OrderedAxisCRSAuthorityFactory, PGRasterFactory, PolygonLabelProcess, RasterProcessFactory, ResolutionExtractorSPI, ResolutionXExtractorSPI, ResolutionYExtractorSPI, RPFTOCFormatFactory, RuntimeExtractorSPI, ShortFileNameExtractorSPI, SingleProcessFactory, SkeletonizeProcess, SRPFormatFactory, StaticMethodsProcessFactory, StringFileNameExtractorSPI, ThreadedEpsgFactory, ThreadedHsqlEpsgFactory, ThreadedPostgreSQLEpsgFactory, TimestampFileNameExtractorSPI, TPKFormatFactorySpi, TransformedAuthorityFactory, UnnamedExtension, URN_AuthorityFactory, VectorProcessFactory, VRTFormatFactory, VSIFormatFactory, WorldImageFormatFactory

public interface OptionalFactory extends Factory
An optional factory that may not be available in all configurations.

Such factories often need some external resources. For example the default EPSG factory need a MS-Access database installed on the client machine. This database is not bundle in Geotools distribution; if the user have not installed it, the factory can't work.

This interface is not a manager for automatic download of external resources. It is just a way to tell to FactoryFinder that this factory exists, but can't do its job for whatever reasons (usually a missing resource that the user shall download and install himself), so FactoryFinder has to choose an other factory. In other words, the OptionalFactory interface is used as a filter, nothing else. The process is as follows:

  • When FactoryRegistry.getFactories(Class, Predicate, Hints) is invoked, it starts to iterate over all registered factories. If an ordering is set, it is taken in account for the iteration order.
  • If no suitable factory was found before the iterator reachs this optional factory, then isAvailable() is invoked. If it returns true, then this optional factory is processed like any other factories. Otherwise it is ignored.

NOTE: OptionalFactory is not designed for factories with intermittent state (i.e. return value of isAvailable() varying in an unpredictable way). The behavior is undetermined if the isAvailable() state changes with time.

Since:
2.0
Author:
Martin Desruisseaux
See Also:
  • org.geotools.data.DataStoreFactorySpi#isAvailable
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Returns true if this factory is ready for use.

    Methods inherited from interface Factory

    getImplementationHints
  • Method Details

    • isAvailable

      boolean isAvailable()
      Returns true if this factory is ready for use. An optional factory may returns false for now but returns true later. However, the converse is not recommended.