<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE erlref SYSTEM "erlref.dtd">

<erlref>
  <header>
    <copyright>
      <year>1999</year>
      <year>2013</year>
      <holder>Ericsson AB, All Rights Reserved</holder>
    </copyright>
    <legalnotice>
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at
 
      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.

  The Initial Developer of the Original Code is Ericsson AB.
    </legalnotice>

    <title>cosTransactions</title>
    <prepared>Niclas Eklund</prepared>
    <responsible>Niclas Eklund</responsible>
    <docno></docno>
    <approved>Niclas Eklund</approved>
    <checked></checked>
    <date>1999-04-23</date>
    <rev>PA1</rev>
  </header>
  <module>cosTransactions</module>
  <modulesummary>The main module of the cosTransactions application.</modulesummary>
  <description>
    <p>To get access to the record definitions for the structures use:      <br></br>
<c>-include_lib("cosTransactions/include/CosTransactions.hrl").</c></p>
    <p>This module contains the functions for starting and stopping the application.
      If the application is started using <c>application:start(cosTransactions)</c> the 
      default configuration is used (see listing below). The Factory reference is stored using the CosNaming Service
      under the id <c>"oe_cosTransactionsFac_IPNo"</c>.</p>
    <p>The following application configuration parameters exist:</p>
    <list type="bulleted">
      <item><em>maxRetries</em> - default is 40 times, i.e., if a transaction participant is unreachable
       the application will retry to contact it <c>N</c> times. Reaching the maximum is considered to be a disaster.</item>
      <item><em>comFailWait</em> - default is 5000 milliseconds, i.e., before the application
       retries to contact unreachable transaction participants the application wait <c>Time</c> milliseconds.</item>
    </list>
  </description>
  <funcs>
    <func>
      <name>start() -> Return</name>
      <fsummary>Start the cosTransactions application</fsummary>
      <type>
        <v>Return = ok | {error, Reason}</v>
      </type>
      <desc>
        <p>This operation starts the cosTransactions application.</p>
      </desc>
    </func>
    <func>
      <name>stop() -> Return</name>
      <fsummary>Stop the cosTransactions application</fsummary>
      <type>
        <v>Return = ok | {error, Reason}</v>
      </type>
      <desc>
        <p>This operation stops the cosTransactions application.</p>
      </desc>
    </func>
    <func>
      <name>start_factory() -> TransactionFactory</name>
      <fsummary>Start a <c>Transaction Factory</c></fsummary>
      <type>
        <v>TransactionFactory = #objref</v>
      </type>
      <desc>
        <p>This operation creates a <seealso marker="CosTransactions_TransactionFactory">Transaction Factory</seealso>.
          The Factory is used to create a new top-level <seealso marker="CosTransactions_Control">transaction</seealso> using default options (see listing below).</p>
      </desc>
    </func>
    <func>
      <name>start_factory(FacDef) -> TransactionFactory</name>
      <fsummary>Start a <c>Transaction Factory</c>with given options</fsummary>
      <type>
        <v>FacDef = [Options], see Option listing below.</v>
        <v>TransactionFactory = #objref</v>
      </type>
      <desc>
        <p>This operation creates a <seealso marker="CosTransactions_TransactionFactory">Transaction Factory</seealso>.
          The Factory is used to create a new top-level transaction. </p>
        <p>The FacDef list must be a list of {Item, Value} tuples, 
          where the following values are allowed: </p>
        <list type="bulleted">
          <item>{hash_max, HashValue} - 
           This value denotes the upper bound of the hash value the 
          <seealso marker="CosTransactions_Coordinator">Coordinator</seealso> uses.
           Default is <c>1013</c>. HashValue must be an integer.</item>
          <item>{allow_subtr, Boolean} -
           If set to true it is possible to create <seealso marker="CosTransactions_Coordinator">subtransactions</seealso>.
           Default is <c>true</c>.</item>
          <item>{typecheck, Boolean} -
           If set to to true all transaction operation's arguments will be type-checked.
           Default is <c>true</c>.</item>
          <item>{tty, Boolean} -  
           Enables or disables error printouts to the tty. 
           If Flag is false, all text that the error logger would have sent to the terminal is discarded. 
           If Flag is true, error messages are sent to the terminal screen. </item>
          <item>{logfile, FileName} -
           This function makes it possible to store all system information in <c>FileName</c> (string()).
           It can be used in combination with the tty(false) item in to have a silent system, 
           where all system information are logged to a file. 
           As default no logfile is used.</item>
          <item><c>{maxRetries, Integer}</c> -
           default is 40 times, i.e., if a transaction participant is unreachable the application will 
           retry to contact it <c>N</c> times. Reaching the maximum is considered to be a disaster.
           This option overrides the application configuration parameter.</item>
          <item><c>{comFailWait, Integer}</c> -
           default is 5000 milliseconds, i.e., before the application retries to contact unreachable 
           transaction participants the application wait <c>Time</c> milliseconds.
           This option overrides the application configuration parameter.</item>
        </list>
      </desc>
    </func>
    <func>
      <name>stop_factory(TransactionFactory) -> Reply</name>
      <fsummary>Terminate the target object</fsummary>
      <type>
        <v>TransactionFactory = #objref</v>
        <v>Reply = ok | {'EXCEPTION', E}</v>
      </type>
      <desc>
        <p>This operation stop the target transaction factory.</p>
      </desc>
    </func>
  </funcs>
  
</erlref>

