org.geotoolkit.factory
Class Factory.Availability

Object
  extended by Factory.Availability
All Implemented Interfaces:
ConformanceResult, Result
Enclosing class:
Factory

protected class Factory.Availability
extends Object
implements ConformanceResult

The default conformance result returned by Factory.availability(). This class is live, i.e. the pass() method will return false if the enclosing factory has been disposed without the need to create a new instance of Availability.

Since:
3.03
Version:
3.14
Author:
Martin Desruisseaux (Geomatys)
Module:
utility/geotk-utility (download)    View source code for this class

Constructor Summary
Factory.Availability()
          Creates a default Availability object.
Factory.Availability(Throwable failureCause)
          Creates a conformance result which declares that the factory is not available because of the given exception.
 
Method Summary
 InternationalString getExplanation()
          Returns an explanation of the meaning of conformance for this result.
 Throwable getFailureCause()
          If the factory is not available because of some exception, the exception that caused the failure.
 Citation getSpecification()
          Returns the requirement against which the factory is being evaluated.
 Boolean pass()
          Returns true if the enclosing factory is ready for use.
 String toString()
          Returns a string representation of this conformance result.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Factory.Availability

public Factory.Availability()
Creates a default Availability object. The new conformance result will pass as long as the enclosing factory has not been disposed.


Factory.Availability

public Factory.Availability(Throwable failureCause)
Creates a conformance result which declares that the factory is not available because of the given exception.

Parameters:
failureCause - The raison why the factory is not available.
Method Detail

getSpecification

public Citation getSpecification()
Returns the requirement against which the factory is being evaluated. The default implementation returns null, which is a departure from ISO 19115 since this information is supposed to be mandatory. Subclasses are encouraged to provide a value.

Specified by:
getSpecification in interface ConformanceResult

getExplanation

public InternationalString getExplanation()
Returns an explanation of the meaning of conformance for this result. If this Availability object has been constructed with a Throwable, then this method returns "Error" completed with the message of the last cause having a localized message (we pickup the last cause on the assumption that it is the root of the problem). Otherwise this method returns a text like "This result indicates if the factory is available for use".

Specified by:
getExplanation in interface ConformanceResult

getFailureCause

public Throwable getFailureCause()
If the factory is not available because of some exception, the exception that caused the failure. Otherwise null. Note that a null value doesn't mean that the factory is available - the pass() method still need to be invoked.

Returns:
The exception which make the factory unavailable, or null if none.

pass

public Boolean pass()
Returns true if the enclosing factory is ready for use. The default implementation returns true if no throwable was given at construction time and the enclosing factory has not been disposed.

Specified by:
pass in interface ConformanceResult
Returns:
true if the enclosing factory is ready for use.

toString

public String toString()
Returns a string representation of this conformance result. This is mostly for debugging purpose.

Overrides:
toString in class Object


Copyright © 2009-2012 Geotoolkit.org. All Rights Reserved.