edu.mssm.crover.mutations.drivers
Class MutationDriverCache

java.lang.Object
  |
  +--edu.mssm.crover.mutations.drivers.MutationDriverCache
All Implemented Interfaces:
MutationDriver
Direct Known Subclasses:
DiMLibDriver, TinyGrapDriver

public abstract class MutationDriverCache
extends java.lang.Object
implements MutationDriver

MutationDriver cache. This astract class provides the following cahing mechanism:

  • If no mutants are in the cache for a particular sequence, the subclass driver is invoked to obtain the mutants.
  • If the mutants are in the cache, it is checked wether they stayed there for too long (the delay which is considered too long is defined via the property mutations.drivers.cache.invalidate-after (milli-seconds). Mutants that are determined as having been in the cache for too long are obtained from the subclass driver as if no caching had occured. This ensures that the mutant information is up-to-date within the cache.invalidate-after quantity.
  • If the cached mutants are still considered up-to-date, they are returned immediately. The cache is implemented with weak references that will not prevent the garbage collection of the cached instances.


    Nested Class Summary
    protected  class MutationDriverCache.CachedMutants
              Keeps the mutants and the time at which they entered the cache.
     
    Constructor Summary
    MutationDriverCache()
               
     
    Method Summary
    protected  java.util.Map getAccessionCodeMap(java.lang.String origin)
               
    protected  Mutant[] getCachedMutants(java.lang.String origin, java.lang.String accession_code)
               
    abstract  DriverInformation getInformation()
               
    protected  Mutant[] getMutants(java.lang.String origin, java.lang.String accession_code)
              Checks wether the mutants are in the cache, returns them if they were found there, otherwise delegate to the subclass.
    protected abstract  Mutant[] getMutantsFor(java.lang.String origin, java.lang.String accession_code)
              Not Cached, implemented by each driver specialization.
     Mutant[] getMutantsFor(java.lang.String origin, java.lang.String accession_code, short pure_type_signature, boolean filter_by_pure_signature, short cumulative_type_signature, boolean filter_by_cumulative_signature, boolean filter_by_exact_cumulative_signature)
              Cached, implemented by the abstract driver class.
     Mutation[][] getMutationsFor(java.lang.String origin, java.lang.String accession_code, short pure_type_signature, boolean filter_by_pure_signature, short cumulative_type_signature, boolean filter_by_cumulative_signature, boolean filter_by_exact_cumulative_signature)
              Cached, implemented by the abstract driver class.
    protected  void pushInCache(java.lang.String origin, java.lang.String accession_code, Mutant[] mutants)
               
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Constructor Detail

    MutationDriverCache

    public MutationDriverCache()
    Method Detail

    getInformation

    public abstract DriverInformation getInformation()
    Specified by:
    getInformation in interface MutationDriver

    getMutantsFor

    protected abstract Mutant[] getMutantsFor(java.lang.String origin,
                                              java.lang.String accession_code)
                                       throws SourceNotAvailable,
                                              ProtocolError,
                                              UnsupportedOrigin
    Not Cached, implemented by each driver specialization. Returns all the mutants known on this sequence.

    SourceNotAvailable
    ProtocolError
    UnsupportedOrigin

    getMutationsFor

    public final Mutation[][] getMutationsFor(java.lang.String origin,
                                              java.lang.String accession_code,
                                              short pure_type_signature,
                                              boolean filter_by_pure_signature,
                                              short cumulative_type_signature,
                                              boolean filter_by_cumulative_signature,
                                              boolean filter_by_exact_cumulative_signature)
                                       throws SourceNotAvailable,
                                              ProtocolError,
                                              UnsupportedOrigin
    Cached, implemented by the abstract driver class.

    Specified by:
    getMutationsFor in interface MutationDriver
    Parameters:
    origin - Orgin of the sequence for which the mutation server is queried.
    accession_code - Accession code, relative to the origin, for which the mutation server is queried.
    pure_type_signature - Mutants that are returned must have this pure_type_signature.
    cumulative_type_signature - Mutants that are returned must have this cumulative_type_signature. The semantic of "have" is defined below.
    filter_by_pure_signature - If true, the query results are filtered according to the pure signature, if false the pure signature is ignored.
    filter_by_exact_cumulative_signature - If true, the query results are filtered according to the exact cumulative signature (the match can only be accepted when cumulative_type_signature == mutant.cumulative_signature). If false the cumulative signature is ignored.
    filter_by_cumulative_signature - If true, the query results are filtered according to the cumulative signature, i.e. (cumulative_type_signature & mutant.cumulative_signature)!=0. If false the cumulative signature is ignored.
    SourceNotAvailable
    ProtocolError
    UnsupportedOrigin
    See Also:
    Mutant

    getMutantsFor

    public final Mutant[] getMutantsFor(java.lang.String origin,
                                        java.lang.String accession_code,
                                        short pure_type_signature,
                                        boolean filter_by_pure_signature,
                                        short cumulative_type_signature,
                                        boolean filter_by_cumulative_signature,
                                        boolean filter_by_exact_cumulative_signature)
                                 throws SourceNotAvailable,
                                        ProtocolError,
                                        UnsupportedOrigin
    Cached, implemented by the abstract driver class.

    Specified by:
    getMutantsFor in interface MutationDriver
    Parameters:
    origin - Orgin of the sequence for which the mutation server is queried.
    accession_code - Accession code, relative to the origin, for which the mutation server is queried.
    pure_type_signature - Mutants that are returned must have this pure_type_signature.
    cumulative_type_signature - Mutants that are returned must have this cumulative_type_signature. The semantic of "have" is defined below.
    filter_by_pure_signature - If true, the query results are filtered according to the pure signature, if false the pure signature is ignored.
    filter_by_exact_cumulative_signature - If true, the query results are filtered according to the exact cumulative signature (the match can only be accepted when cumulative_type_signature == mutant.cumulative_signature). If false the cumulative signature is ignored.
    filter_by_cumulative_signature - If true, the query results are filtered according to the cumulative signature, i.e. (cumulative_type_signature & mutant.cumulative_signature)!=0. If false the cumulative signature is ignored.
    SourceNotAvailable
    ProtocolError
    UnsupportedOrigin
    See Also:
    Mutant

    getMutants

    protected Mutant[] getMutants(java.lang.String origin,
                                  java.lang.String accession_code)
                           throws SourceNotAvailable,
                                  ProtocolError,
                                  UnsupportedOrigin
    Checks wether the mutants are in the cache, returns them if they were found there, otherwise delegate to the subclass.

    SourceNotAvailable
    ProtocolError
    UnsupportedOrigin

    pushInCache

    protected void pushInCache(java.lang.String origin,
                               java.lang.String accession_code,
                               Mutant[] mutants)

    getCachedMutants

    protected Mutant[] getCachedMutants(java.lang.String origin,
                                        java.lang.String accession_code)

    getAccessionCodeMap

    protected java.util.Map getAccessionCodeMap(java.lang.String origin)


    Copyright @ 2003 Mount Sinai School of Medicine. All Rights Reserved.