Class DNSManager


  • public class DNSManager
    extends org.apache.manifoldcf.core.database.BaseTable
    This class manages the database table into which we DNS entries for hosts. The data resides in the database, as well as in cache (up to a certain point). The result is that there is a memory limited, database-backed repository of DNS entries that we can draw on. Note that this code is also responsible for efficiently caching the mapping of IP address to a canonical host name.

    dnsdata
    FieldTypeDescription        
    hostnameVARCHAR(255)Primary Key
    canonicalhostnameVARCHAR(255)
    ipaddressVARCHAR(16)
    expirationtimeBIGINT


    • Constructor Summary

      Constructors 
      Constructor Description
      DNSManager​(org.apache.manifoldcf.core.interfaces.IThreadContext tc, org.apache.manifoldcf.core.interfaces.IDBInterface database)
      Constructor.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void deinstall()
      Uninstall the manager.
      protected static java.lang.String getDNSKey​(java.lang.String hostName)
      Construct a key which represents an individual host name.
      void install()
      Install the manager.
      DNSManager.DNSInfo lookup​(java.lang.String hostName, long currentTime)
      Given a host name, look up the ip address and fqdn.
      protected DNSManager.DNSInfo readDNSInfo​(java.lang.String hostName)
      Read DNS data, if it exists.
      void writeDNSData​(java.lang.String hostName, java.lang.String fqdn, java.lang.String ipaddress, long expirationTime)
      Write DNS data, replacing any existing row.
      • Methods inherited from class org.apache.manifoldcf.core.database.BaseTable

        addTableIndex, analyzeTable, beginTransaction, buildConjunctionClause, constructCountClause, constructDistinctOnClause, constructDoubleCastClause, constructOffsetLimitClause, constructRegexpClause, constructSubstringClause, endTransaction, findConjunctionClauseMax, getDatabaseCacheKey, getDBInterface, getMaxInClause, getMaxOrClause, getSleepAmt, getTableIndexes, getTableName, getTableSchema, getTransactionID, getWindowedReportMaxRows, makeTableKey, noteModifications, performAddIndex, performAlter, performCommit, performCreate, performDelete, performDrop, performInsert, performModification, performQuery, performQuery, performRemoveIndex, performUpdate, prepareRowForSave, readRow, reindexTable, signalRollback, sleepFor
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DNSManager

        public DNSManager​(org.apache.manifoldcf.core.interfaces.IThreadContext tc,
                          org.apache.manifoldcf.core.interfaces.IDBInterface database)
                   throws org.apache.manifoldcf.core.interfaces.ManifoldCFException
        Constructor. Note that one robotsmanager handle is only useful within a specific thread context, so the calling connector object logic must recreate the handle whenever the thread context changes.
        Parameters:
        tc - is the thread context.
        database - is the database handle.
        Throws:
        org.apache.manifoldcf.core.interfaces.ManifoldCFException
    • Method Detail

      • install

        public void install()
                     throws org.apache.manifoldcf.core.interfaces.ManifoldCFException
        Install the manager.
        Throws:
        org.apache.manifoldcf.core.interfaces.ManifoldCFException
      • deinstall

        public void deinstall()
                       throws org.apache.manifoldcf.core.interfaces.ManifoldCFException
        Uninstall the manager.
        Throws:
        org.apache.manifoldcf.core.interfaces.ManifoldCFException
      • lookup

        public DNSManager.DNSInfo lookup​(java.lang.String hostName,
                                         long currentTime)
                                  throws org.apache.manifoldcf.core.interfaces.ManifoldCFException
        Given a host name, look up the ip address and fqdn.
        Returns:
        null if there is no available cached version of this info.
        Throws:
        org.apache.manifoldcf.core.interfaces.ManifoldCFException
      • writeDNSData

        public void writeDNSData​(java.lang.String hostName,
                                 java.lang.String fqdn,
                                 java.lang.String ipaddress,
                                 long expirationTime)
                          throws org.apache.manifoldcf.core.interfaces.ManifoldCFException
        Write DNS data, replacing any existing row.
        Parameters:
        hostName - is the host.
        fqdn - is the canonical host name.
        ipaddress - is the host ip address, in standard form.
        expirationTime - is the time this data should expire.
        Throws:
        org.apache.manifoldcf.core.interfaces.ManifoldCFException
      • getDNSKey

        protected static java.lang.String getDNSKey​(java.lang.String hostName)
        Construct a key which represents an individual host name.
        Parameters:
        hostName - is the name of the connector.
        Returns:
        the cache key.
      • readDNSInfo

        protected DNSManager.DNSInfo readDNSInfo​(java.lang.String hostName)
                                          throws org.apache.manifoldcf.core.interfaces.ManifoldCFException
        Read DNS data, if it exists.
        Returns:
        null if the data doesn't exist at all. Return DNS data if it does.
        Throws:
        org.apache.manifoldcf.core.interfaces.ManifoldCFException