    View Javadoc
    1   /*
    2    * Copyright (c) 2003
    3    * Information Desire GmbH
    4    * All rights reserved.
    5    */
    6   package com.infodesire.infobit.external.impl;
    7
    8   import com.infodesire.infobit.InfobitException;
    9   import com.infodesire.infobit.InfobitSecurityException;
    10
    11  import com.infodesire.infobit.data.Infobit;
    12  import com.infodesire.infobit.data.Version;
    13
    14  import org.apache.commons.logging.Log;
    15  import org.apache.commons.logging.LogFactory;
    16
    17  import java.util.Collection;
    18  import java.util.HashSet;
    19  import java.util.Set;
    20
    21  /***
    22   * This class represents the assignment of the version of an infobit as the
    23   * actual one.
    24   *
    25   * @author    peter2
    26   * @created   2. September 2003
    27   * @version   $Revision: 1.1 $
    28   */
    29  class ActualVersionNode extends BufferNode {
    30
    31      private final static Log _log = LogFactory.getLog(ActualVersionNode.class);
    32
    33      /***
    34       * Buffered representation of the referred infobit
    35       */
    36      private InfobitNode _infobitNode;
    37
    38      /***
    39       * The resolution of {@link #_infobitNode}
    40       */
    41      private Infobit _infobit;
    42
    43      /***
    44       * Buffered representation of the actual version
    45       */
    46      private ContentNode _actualVersionNode;
    47
    48      /***
    49       * The resolved {@link #_actualVersionNode actual version}
    50       */
    51      private Version _actualVersion;
    52
    53
    54      /***
    55       * Gets the Dependencies attribute of the ActualVersionNode object
    56       *
    57       * @return   The Dependencies value
    58       */
    59      Collection getDependencies() {
    60          Set dep = new HashSet();
    61          dep.add(_infobitNode);
    62          dep.add(_actualVersionNode);
    63
    64          return dep;
    65      }
    66
    67
    68      /***
    69       * Gets the {@link #setInfobitNode infobit node} for which to set the actual
    70       * version.
    71       *
    72       * @return   The InfobitNode value
    73       */
    74      InfobitNode getInfobitNode() {
    75          return _infobitNode;
    76      }
    77
    78
    79      /***
    80       * Retrieves the {@link #setActualVersionNode actual version} of the {@link
    81       * #setInfobitNode referred infobit node}.
    82       *
    83       * @return   The ActualVersionNode value
    84       */
    85      ContentNode getActualVersionNode() {
    86          return _actualVersionNode;
    87      }
    88
    89
    90      /***
    91       * Defines the infobit referred to by its buffered representation.
    92       *
    93       * @param node  The new InfobitNode value
    94       */
    95      void setInfobitNode(InfobitNode node) {
    96          _infobitNode = node;
    97      }
    98
    99
    100     /***
    101      * Defines the actual version of the {@link #setInfobitNode referred infobit
    102      * node}
    103      *
    104      * @param node  The new ActualVersionNode value
    105      */
    106     void setActualVersionNode(ContentNode node) {
    107         _actualVersionNode = node;
    108     }
    109
    110
    111     /***
    112      * DOCUMENT METHOD
    113      *
    114      * @param dependency  Description of Parameter
    115      * @param value       Description of Parameter
    116      */
    117     void resolveDependency(BufferNode dependency, Object value) {
    118         if (dependency == _infobitNode) {
    119             _infobit = (Infobit) value;
    120         }
    121         else if (dependency == _actualVersionNode) {
    122             _actualVersion = (Version) value;
    123         }
    124         else {
    125             String m = "Failed assertion: Unknown dependency";
    126             _log.fatal(m);
    127             throw new RuntimeException(m);
    128         }
    129     }
    130
    131
    132     /***
    133      * Sets the actual version.
    134      *
    135      * @return                              Always <code>null</code>
    136      * @exception InfobitException          Description of Exception
    137      * @exception InfobitSecurityException  Description of Exception
    138      */
    139     Object persistBuffer() throws InfobitException, InfobitSecurityException {
    140         _manager.setActualVersion(_infobit, _actualVersion);
    141
    142         return null;
    143     }
    144
    145 }

This page was automatically generated by Maven