Tabnine Logo
FactoryCreator
Code IndexAdd Tabnine to your IDE (free)

How to use
FactoryCreator
in
org.geotools.factory

Best Java code snippets using org.geotools.factory.FactoryCreator (Showing top 20 results out of 315)

origin: org.geotools/gt-process

/**
 * Returns the service registry. The registry will be created the first
 * time this method is invoked.
 */
private static FactoryRegistry getServiceRegistry() {
  synchronized (Processors.class) {
    if (registry == null) {
      registry = new FactoryCreator(ProcessFactory.class);
    }
  }
  return registry;
}

origin: org.geotools/gt-metadata

        final int modifiers = type.getModifiers();
        if (!Modifier.isAbstract(modifiers)) {
          final T candidate = createSafe(category, type, hints);
          if (candidate == null) {
            continue;
          if (isAcceptable(candidate, category, hints, filter)) {
            cache(category, candidate);
            return candidate;
          dispose(candidate);
for (final Iterator<T> it=getUnfilteredProviders(category); it.hasNext();) {
  final T factory = it.next();
  final Class<?> implementation = factory.getClass();
  if (types!=null && !isTypeOf(types, implementation)) {
    continue;
    candidate = createSafe(category, implementation, hints);
  } catch (FactoryNotFoundException exception) {
    continue;
  if (isAcceptable(candidate, category, hints, filter)) {
    cache(category, candidate);
    return candidate;
  dispose(candidate);
origin: org.geotools/gt2-metadata

/**
 * Invokes {@link #createServiceProvider}, but checks against recursive calls. If the specified
 * implementation is already under construction, returns {@code null} in order to tell to
 * {@link #getServiceProvider} that it need to search for an other implementation. This is
 * needed for avoiding infinite recursivity when a factory is a wrapper around an ther factory
 * of the same category. For example this is the case of
 * {@link org.geotools.referencing.operation.BufferedCoordinateOperationFactory}.
 */
private Object createSafe(final Class category, final Class implementation, final Hints hints) {
  if (!underConstruction.add(implementation)) {
    return null;
  }
  try {
    return createServiceProvider(category, implementation, hints);
  } finally {
    if (!underConstruction.remove(implementation)) {
      throw new AssertionError();
    }
  }
}
origin: org.geotools/gt-main

return super.isAcceptable(provider, category, hints);
origin: org.geotools/gt2-metadata

        final int modifiers = type.getModifiers();
        if (!Modifier.isAbstract(modifiers)) {
          final Object candidate = createSafe(category, type, hints);
          if (candidate == null) {
            continue;
          if (isAcceptable(candidate, category, hints, filter)) {
            cache(category, candidate);
            return candidate;
          dispose(candidate);
for (final Iterator it=getUnfilteredProviders(category); it.hasNext();) {
  final Object factory = it.next();
  final Class implementation = factory.getClass();
  if (types!=null && !isTypeOf(types, implementation)) {
    continue;
    candidate = createSafe(category, implementation, hints);
  } catch (FactoryRegistryException exception) {
    if (exception.getCause() instanceof NoSuchMethodException) {
  if (isAcceptable(candidate, category, hints, filter)) {
    cache(category, candidate);
    return candidate;
  dispose(candidate);
origin: org.geotools/gt-metadata

/**
 * Invokes {@link #createServiceProvider}, but checks against recursive calls. If the specified
 * implementation is already under construction, returns {@code null} in order to tell to
 * {@link #getServiceProvider} that it need to search for an other implementation. This is
 * needed for avoiding infinite recursivity when a factory is a wrapper around an ther factory
 * of the same category. For example this is the case of
 * {@link org.geotools.referencing.operation.BufferedCoordinateOperationFactory}.
 */
private <T> T createSafe(final Class<T> category, final Class<?> implementation, final Hints hints) {
  if (!underConstruction.add(implementation)) {
    return null;
  }
  try {
    return createServiceProvider(category, implementation, hints);
  } finally {
    if (!underConstruction.remove(implementation)) {
      throw new AssertionError();
    }
  }
}
origin: org.geotools/gt2-main

return super.isAcceptable(provider, category, hints);
origin: org.geoserver.extension/dxf-core

  /**
   * Returns the service registry. The registry will be created the first time this method is
   * invoked.
   */
  private static FactoryRegistry getServiceRegistry() {        
    if (registry == null) {
      registry = new FactoryCreator(Arrays.asList(new Class<?>[] { DXFWriter.class }));
    }
    return registry;
  }
}
origin: org.geotools/gt-main

/**
 * Creates a new instance of the specified factory using the specified hints.
 *
 * @param  category The category to instantiate.
 * @param  implementation The factory class to instantiate.
 * @param  hints The implementation hints.
 * @return The factory.
 * @throws FactoryRegistryException if the factory creation failed.
 */
protected Object createServiceProvider(final Class category,
                    final Class implementation,
                    final Hints hints)
    throws FactoryRegistryException
{
  if (GeometryFactory.class.isAssignableFrom(category) &&
    GeometryFactory.class.equals(implementation))
  {
    return new GeometryFactory(getPrecisionModel(hints), getSRID(hints),
                  getCoordinateSequenceFactory(hints));
  }
  return super.createServiceProvider(category, implementation, hints);
}
origin: org.geotools/gt-coverage

/**
 * Returns the service registry. The registry will be created the first time
 * this method is invoked.
 */
private static FactoryRegistry getServiceRegistry() {
  assert Thread.holdsLock(GridFormatFinder.class);
  if (registry == null) {
    registry = new FactoryCreator(Arrays
        .asList(new Class<?>[] { GridFormatFactorySpi.class }));
  }
  return registry;
}
origin: org.geotools/gt2-main

/**
 * Creates a new instance of the specified factory using the specified hints.
 *
 * @param  category The category to instantiate.
 * @param  implementation The factory class to instantiate.
 * @param  hints The implementation hints.
 * @return The factory.
 * @throws FactoryRegistryException if the factory creation failed.
 */
protected Object createServiceProvider(final Class category,
                    final Class implementation,
                    final Hints hints)
    throws FactoryRegistryException
{
  if (GeometryFactory.class.isAssignableFrom(category) &&
    GeometryFactory.class.equals(implementation))
  {
    return new GeometryFactory(getPrecisionModel(hints), getSRID(hints),
                  getCoordinateSequenceFactory(hints));
  }
  return super.createServiceProvider(category, implementation, hints);
}
origin: org.geotools/gt-main

/**
 * Returns the service registry. The registry will be created the first time
 * this method is invoked.
 */
private static FactoryRegistry getServiceRegistry() {
  assert Thread.holdsLock(DataStoreFinder.class);
  if (registry == null) {
    registry = new FactoryCreator(Arrays
        .asList(new Class<?>[] { DataStoreFactorySpi.class }));
  }
  return registry;
}
origin: org.geotools/gt-main

/**
 * Returns the service registry. The registry will be created the first time
 * this method is invoked.
 */
private static FactoryRegistry getServiceRegistry() {
  assert Thread.holdsLock(DataAccessFinder.class);
  if (registry == null) {
    registry = new FactoryCreator(Arrays.asList(new Class<?>[] { DataAccessFactory.class }));
  }
  return registry;
}
origin: org.geotools/gt-coverage

/**
 * Returns the service registry. The registry will be created the first
 * time this method is invoked.
 */
private static FactoryRegistry getServiceRegistry() {
  assert Thread.holdsLock(CoverageFactoryFinder.class);
  if (registry == null) {
    registry = new FactoryCreator(Arrays.asList(new Class<?>[] {
        GridCoverageFactory.class}));
  }
  return registry;
}
origin: org.geotools/gt2-main

/**
 * Returns the service registry. The registry will be created the first
 * time this method is invoked.
 */
private static FactoryRegistry getServiceRegistry() {
  assert Thread.holdsLock(Converters.class);
  if (registry == null) {
    registry = new FactoryCreator(Arrays.asList(new Class[] {
        ConverterFactory.class,}));
  }
  return registry;
}

origin: org.geotools/gt-jdbc

/**
 * Returns the service registry. The registry will be created the first time this method is
 * invoked.
 */
private static FactoryRegistry getServiceRegistry() {
  assert Thread.holdsLock(DataSourceFinder.class);
  if (registry == null) {
    registry = new FactoryCreator(Arrays.asList(new Class<?>[] { DataSourceFactorySpi.class,
        UnWrapper.class }));
  }
  return registry;
}
origin: org.geotools/gt-render

/**
 * Returns the service registry. The registry will be created the first time
 * this method is invoked.
 */
private static FactoryRegistry getServiceRegistry() {
  assert Thread.holdsLock(DynamicSymbolFactoryFinder.class);
  if (registry == null) {
    registry = new FactoryCreator(Arrays.asList(new Class<?>[] { MarkFactory.class,
        ExternalGraphicFactory.class }));
  }
  return registry;
}
origin: org.geotools/gt2-coverage

/**
 * Returns the service registry. The registry will be created the first time
 * this method is invoked.
 */
private static FactoryRegistry getServiceRegistry() {
  assert Thread.holdsLock(GridFormatFinder.class);
  if (registry == null) {
    registry = new FactoryCreator(Arrays
        .asList(new Class[] { GridFormatFactorySpi.class }));
  }
  return registry;
}
origin: org.geotools/gt-imagemosaic

/**
 * Returns the service registry. The registry will be created the first time
 * this method is invoked.
 */
private static FactoryRegistry getServiceRegistry() {
  assert Thread.holdsLock(PropertiesCollectorFinder.class);
  if (registry == null) {
    registry = new FactoryCreator(Arrays.asList(new Class<?>[] { PropertiesCollectorSPI.class }));
  }
  return registry;
}
origin: org.geotools/gt2-main

/**
 * Returns the service registry. The registry will be created the first time
 * this method is invoked.
 */
private static FactoryRegistry getServiceRegistry() {
  assert Thread.holdsLock(DataStoreFinder.class);
  if (registry == null) {
    registry = new FactoryCreator(Arrays
        .asList(new Class[] { DataStoreFactorySpi.class }));
  }
  return registry;
}

org.geotools.factoryFactoryCreator

Javadoc

A FactoryRegistry capable to creates factories if no appropriate instance was found in the registry.

This class maintains a cache of previously created factories, as WeakReference. Calls to #getServiceProvider first check if a previously created factory can fit.

Most used methods

  • <init>
    Constructs a new registry for the specified categories.
  • createServiceProvider
    Creates a new instance of the specified factory using the specified hints. The default implementatio
  • isAcceptable
  • cache
    Caches the specified factory under the specified category.
  • createSafe
    Invokes #createServiceProvider, but checks against recursive calls. If the specified implementation
  • dispose
    Dispose the specified factory after. This method is invoked when a factory has been created, and the
  • getCachedProviders
    Returns the providers available in the cache. To be used by FactoryRegistry.
  • getUnfilteredProviders
  • isTypeOf
    Returns true if the specified implementation is one of the specified types.

Popular in Java

  • Reactive rest calls using spring rest template
  • setRequestProperty (URLConnection)
  • setScale (BigDecimal)
  • scheduleAtFixedRate (Timer)
  • BigInteger (java.math)
    An immutable arbitrary-precision signed integer.FAST CRYPTOGRAPHY This implementation is efficient f
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • Path (java.nio.file)
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • Stack (java.util)
    Stack is a Last-In/First-Out(LIFO) data structure which represents a stack of objects. It enables u
  • JButton (javax.swing)
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now