diff options
Diffstat (limited to 'lib/cosTransactions')
61 files changed, 0 insertions, 7822 deletions
| diff --git a/lib/cosTransactions/AUTHORS b/lib/cosTransactions/AUTHORS deleted file mode 100644 index 6d03df4c5a..0000000000 --- a/lib/cosTransactions/AUTHORS +++ /dev/null @@ -1,4 +0,0 @@ -Original Authors: -Niclas Eklund - -Contributors: diff --git a/lib/cosTransactions/Makefile b/lib/cosTransactions/Makefile deleted file mode 100644 index e8d0d1c0cd..0000000000 --- a/lib/cosTransactions/Makefile +++ /dev/null @@ -1,42 +0,0 @@ -# -# %CopyrightBegin% -#  -# Copyright Ericsson AB 1999-2016. All Rights Reserved. -#  -# 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. -#  -# %CopyrightEnd% -# -# -include $(ERL_TOP)/make/target.mk -include $(ERL_TOP)/make/$(TARGET)/otp.mk - -# ---------------------------------------------------- -# Application version -# ---------------------------------------------------- -include vsn.mk -VSN=$(COSTRANSACTIONS_VSN) - -# ---------------------------------------------------- -# Common Macros -# ---------------------------------------------------- -# SUB_DIRECTORIES = src test examples doc/src -# At the moment we don't have any example programs. -SUB_DIRECTORIES = src doc/src - -SPECIAL_TARGETS =  - -# ---------------------------------------------------- -# Default Subdir Targets -# ---------------------------------------------------- -include $(ERL_TOP)/make/otp_subdir.mk diff --git a/lib/cosTransactions/doc/html/.gitignore b/lib/cosTransactions/doc/html/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 --- a/lib/cosTransactions/doc/html/.gitignore +++ /dev/null diff --git a/lib/cosTransactions/doc/man3/.gitignore b/lib/cosTransactions/doc/man3/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 --- a/lib/cosTransactions/doc/man3/.gitignore +++ /dev/null diff --git a/lib/cosTransactions/doc/man6/.gitignore b/lib/cosTransactions/doc/man6/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 --- a/lib/cosTransactions/doc/man6/.gitignore +++ /dev/null diff --git a/lib/cosTransactions/doc/pdf/.gitignore b/lib/cosTransactions/doc/pdf/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 --- a/lib/cosTransactions/doc/pdf/.gitignore +++ /dev/null diff --git a/lib/cosTransactions/doc/src/CosTransactions_Control.xml b/lib/cosTransactions/doc/src/CosTransactions_Control.xml deleted file mode 100644 index bf5e25a701..0000000000 --- a/lib/cosTransactions/doc/src/CosTransactions_Control.xml +++ /dev/null @@ -1,74 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<!DOCTYPE erlref SYSTEM "erlref.dtd"> - -<erlref> -  <header> -    <copyright> -      <year>1999</year> -      <year>2016</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_Control</title> -    <prepared>Niclas Eklund</prepared> -    <responsible>Niclas Eklund</responsible> -    <docno></docno> -    <approved>Niclas Eklund</approved> -    <checked></checked> -    <date>1999-04-12</date> -    <rev>PA1</rev> -  </header> -  <module>CosTransactions_Control</module> -  <modulesummary>This module implements the OMG CosTransactions::Control interface.</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> -  </description> -  <funcs> -    <func> -      <name>get_coordinator(Control) -> Return</name> -      <fsummary>Return the Coordinator object associated with the target object</fsummary> -      <type> -        <v>Control = #objref</v> -        <v>Return =  Coordinator | {'EXCEPTION', E}</v> -        <v>Coordinator = #objref</v> -        <v>E = #'CosTransactions_Unavailable' {}</v> -      </type> -      <desc> -        <p>This operation returns the Coordinator object associated with the target object. -          The Coordinator supports operations for termination of a transaction.</p> -      </desc> -    </func> -    <func> -      <name>get_terminator(Control) -> Return</name> -      <fsummary>Return the Terminator object associated with the target object</fsummary> -      <type> -        <v>Control = #objref</v> -        <v>Return =  Terminator | {'EXCEPTION', E}</v> -        <v>Terminator = #objref</v> -        <v>E = #'CosTransactions_Unavailable' {}</v> -      </type> -      <desc> -        <p>This operation returns the Terminator object associated with the target object. -          The Terminator supports operations for termination of a transaction.</p> -      </desc> -    </func> -  </funcs> -   -</erlref> - diff --git a/lib/cosTransactions/doc/src/CosTransactions_Coordinator.xml b/lib/cosTransactions/doc/src/CosTransactions_Coordinator.xml deleted file mode 100644 index 006ba4cc29..0000000000 --- a/lib/cosTransactions/doc/src/CosTransactions_Coordinator.xml +++ /dev/null @@ -1,230 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<!DOCTYPE erlref SYSTEM "erlref.dtd"> - -<erlref> -  <header> -    <copyright> -      <year>1999</year><year>2016</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. -     -    </legalnotice> - -    <title>CosTransactions_Coordinator</title> -    <prepared></prepared> -    <docno></docno> -    <checked></checked> -    <date>1999-04-12</date> -    <rev>PA1</rev> -  </header> -  <module>CosTransactions_Coordinator</module> -  <modulesummary>This module implements the OMG CosTransactions::Coordinator interface.</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> -  </description> -  <funcs> -    <func> -      <name>create_subtransaction(Coordinator) -> Control</name> -      <fsummary>Create a new subtransaction.</fsummary> -      <type> -        <v>Coordinator = #objref</v> -        <v>Control = #objref</v> -      </type> -      <desc> -        <p>A new subtransaction is created whose parent is the Coordinator argument.</p> -        <p>Raises exception:</p> -        <list type="bulleted"> -          <item>'SubtransactionsUnavailable' - if nested transactions are not supported.</item> -          <item>'Inactive' - if target transaction has already been prepared.</item> -        </list> -      </desc> -    </func> -    <func> -      <name>get_transaction_name(Coordinator) -> Name</name> -      <fsummary>Return the name associated with the object.</fsummary> -      <type> -        <v>Coordinator = #objref</v> -        <v>Name = string() of type "oe_name@machine_type_timestamp"</v> -      </type> -      <desc> -        <p>Returns a printable string, which describe the transaction. The main purpose is to support debugging.</p> -      </desc> -    </func> -    <func> -      <name>get_parent_status(Coordinator) -> Status</name> -      <fsummary>Return the status of the parent transaction.</fsummary> -      <type> -        <v>Coordinator = #objref</v> -        <v>Status = atom()</v> -      </type> -      <desc> -        <p>Returns the status of the parent transaction -          associated with the target object. If the target object is a top-level -          transaction this operation is equivalent to <c>get_status/1</c> operation. </p> -        <p>Possible Status replies:</p> -        <list type="bulleted"> -          <item>'StatusCommitted'</item> -          <item>'StatusCommitting'</item> -          <item>'StatusMarkedRollback'</item> -          <item>'StatusRollingBack'</item> -          <item>'StatusRolledBack'</item> -          <item>'StatusActive'</item> -          <item>'StatusPrepared'</item> -          <item>'StatusUnknown'</item> -          <item>'StatusNoTransaction'</item> -          <item>'StatusPreparing'</item> -        </list> -      </desc> -    </func> -    <func> -      <name>get_status(Coordinator) -> Status</name> -      <fsummary>Return the status of the transaction associated with the target object</fsummary> -      <type> -        <v>Coordinator = #objref</v> -        <v>Status = atom()</v> -      </type> -      <desc> -        <p>Returns the status of the transaction associated with the target object.</p> -      </desc> -    </func> -    <func> -      <name>get_top_level_status(Coordinator) -> Status</name> -      <fsummary>Return the status of the top-level transaction associated with the target object</fsummary> -      <type> -        <v>Coordinator = #objref</v> -        <v>Status = atom()</v> -      </type> -      <desc> -        <p>Returns the status of the top-level transaction associated with the target object.</p> -      </desc> -    </func> -    <func> -      <name>hash_top_level_tran(Coordinator) -> Return</name> -      <fsummary>Return a hash code for the top-level transaction  associated with the target object</fsummary> -      <type> -        <v>Coordinator = #objref</v> -        <v>Return = integer()</v> -      </type> -      <desc> -        <p>Returns a hash code for the top-level transaction  -          associated with the target object. Equals the operation -          <c>hash_transaction/1</c> if the target object is a top-level transaction.</p> -      </desc> -    </func> -    <func> -      <name>hash_transaction(Coordinator) -> Return</name> -      <fsummary>Return a hash code for the transaction associated with the target object.</fsummary> -      <type> -        <v>Coordinator = #objref</v> -        <v>Return = integer()</v> -      </type> -      <desc> -        <p>Returns a hash code for the transaction associated with the target object.</p> -      </desc> -    </func> -    <func> -      <name>is_descendant_transaction(Coordinator, OtherCoordinator) -> Return</name> -      <fsummary>Return a boolean which indicates whether the transaction associated  with the target object is a descendant of the transaction associated with the parameter object</fsummary> -      <type> -        <v>Coordinator = #objref</v> -        <v>OtherCoordinator = #objref</v> -        <v>Return = Boolean</v> -      </type> -      <desc> -        <p>Returns true if the transaction associated with the target object is a  -          descendant of the transaction associated with the parameter object.</p> -      </desc> -    </func> -    <func> -      <name>is_same_transaction(Coordinator, OtherCoordinator) -> Return</name> -      <fsummary>Return true if the transaction associated with the target object is  related to the transaction associated with the parameter object</fsummary> -      <type> -        <v>Coordinator = #objref</v> -        <v>OtherCoordinator = #objref</v> -        <v>Return = Boolean</v> -      </type> -      <desc> -        <p>Returns true if the transaction associated with the target object is  -          related to the transaction associated with the parameter object.</p> -      </desc> -    </func> -    <func> -      <name>is_top_level_transaction(Coordinator) -> Return</name> -      <fsummary>Return true if the transaction associated with the target object is  a top-level transaction</fsummary> -      <type> -        <v>Coordinator = #objref</v> -        <v>Return = Boolean</v> -      </type> -      <desc> -        <p>Returns true if the transaction associated with the target object is  -          a top-level transaction.</p> -      </desc> -    </func> -    <func> -      <name>register_resource(Coordinator, Resource) -> RecoveryCoordinator</name> -      <fsummary>Register the parameter <c>Resource</c>object as a participant in the transaction associated with the target object</fsummary> -      <type> -        <v>Coordinator = #objref</v> -        <v>Resource = #objref</v> -        <v>RecoveryCoordinator = #objref</v> -      </type> -      <desc> -        <p>This operation registers the parameter <c>Resource</c> object as a participant in the -          transaction associated with the target object. The <c>RecoveryCoordinator</c> returned -          by this operation can be used by this Resource during recovery.</p> -        <note> -          <p>The Resources will be called in FIFO-order when preparing or committing. -            Hence, be sure to register the Resources in the correct order.</p> -        </note> -        <p>Raises exception:</p> -        <list type="bulleted"> -          <item>'Inactive' - if target transaction has already been prepared.</item> -        </list> -      </desc> -    </func> -    <func> -      <name>register_subtran_aware(Coordinator, SubtransactionAwareResource) -> Return</name> -      <fsummary>Register the parameter <c>SubtransactionAwareResource</c>object such that it will be notified when the transaction, associated wit the target object,  has committed or rolled back</fsummary> -      <type> -        <v>Coordinator = #objref</v> -        <v>Return = ok</v> -      </type> -      <desc> -        <p>This operation registers the parameter <c>SubtransactionAwareResource</c> object such that -          it will be notified when the transaction, associated wit the target object,  -          has committed or rolled back.</p> -        <note> -          <p>The Resources will be called in FIFO-order. -            Hence, be sure to register the Resources in the correct order.</p> -        </note> -      </desc> -    </func> -    <func> -      <name>rollback_only(Coordinator) -> Return</name> -      <fsummary>Modify the transaction associated with the target object so the only possible outcome is to rollback the transaction</fsummary> -      <type> -        <v>Coordinator = #objref</v> -        <v>Return = ok</v> -      </type> -      <desc> -        <p>The transaction associated with the target object is modified so the only -          possible outcome is to rollback the transaction.</p> -      </desc> -    </func> -  </funcs> -   -</erlref> - diff --git a/lib/cosTransactions/doc/src/CosTransactions_RecoveryCoordinator.xml b/lib/cosTransactions/doc/src/CosTransactions_RecoveryCoordinator.xml deleted file mode 100644 index 2d61f815a3..0000000000 --- a/lib/cosTransactions/doc/src/CosTransactions_RecoveryCoordinator.xml +++ /dev/null @@ -1,82 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<!DOCTYPE erlref SYSTEM "erlref.dtd"> - -<erlref> -  <header> -    <copyright> -      <year>1999</year><year>2016</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. -     -    </legalnotice> - -    <title>CosTransactions_RecoveryCoordinator</title> -    <prepared></prepared> -    <responsible></responsible> -    <docno></docno> -    <approved></approved> -    <checked></checked> -    <date>1999-04-12</date> -    <rev>PA1</rev> -  </header> -  <module>CosTransactions_RecoveryCoordinator</module> -  <modulesummary>This module implements the OMG CosTransactions::RecoveryCoordinator interface.</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> -  </description> -  <funcs> -    <func> -      <name>replay_completion(RecoveryCoordinator, Timeout, Resource) -> Return</name> -      <fsummary>Return the current status of the transaction</fsummary> -      <type> -        <v>RecoveryCoordinator = #objref</v> -        <v>Timeout = integer(), milliseconds | 'infinity'</v> -        <v>Resource = #objref</v> -        <v>Return = Status | {'EXCEPTION', E}</v> -        <v>E = #'CosTransactions_NotPrepared'{}</v> -        <v>Status = atom()</v> -      </type> -      <desc> -        <p>The <c>RecoveryCoordinator</c> object is returned by the operation -          <c>CosTransactions_Coordinator:register_resource/3</c>. The <c>replay_completion/2</c> -          may only be used by the registered Resource and returns the current status -          of the transaction. The operation is used when recovering after a failure.</p> -        <p>Possible Status replies:</p> -        <list type="bulleted"> -          <item>'StatusCommitted'</item> -          <item>'StatusCommitting'</item> -          <item>'StatusMarkedRollback'</item> -          <item>'StatusRollingBack'</item> -          <item>'StatusRolledBack'</item> -          <item>'StatusActive'</item> -          <item>'StatusPrepared'</item> -          <item>'StatusUnknown'</item> -          <item>'StatusNoTransaction'</item> -          <item>'StatusPreparing'</item> -        </list> -        <warning> -          <p><em>replay_completion/3</em> is blocking and may cause dead-lock if a child -            calls this function at the same time as its parent invokes an operation -            on the child. Dead-lock will not occur if the timeout has any value except 'infinity'.</p> -          <p>If the call is external incoming (intra-ORB) the timeout will not be activated. -            Hence, similar action must be taken if the Resource resides on another vendors ORB.</p> -        </warning> -      </desc> -    </func> -  </funcs> -   -</erlref> - diff --git a/lib/cosTransactions/doc/src/CosTransactions_Resource.xml b/lib/cosTransactions/doc/src/CosTransactions_Resource.xml deleted file mode 100644 index 40006b55d9..0000000000 --- a/lib/cosTransactions/doc/src/CosTransactions_Resource.xml +++ /dev/null @@ -1,129 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<!DOCTYPE erlref SYSTEM "erlref.dtd"> - -<erlref> -  <header> -    <copyright> -      <year>1999</year><year>2016</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. -     -    </legalnotice> - -    <title>CosTransactions_Resource</title> -    <prepared></prepared> -    <docno></docno> -    <checked></checked> -    <date>1999-04-12</date> -    <rev>PA1</rev> -  </header> -  <module>CosTransactions_Resource</module> -  <modulesummary>This module implements the OMG CosTransactions::Resource interface.</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> -  </description> -  <funcs> -    <func> -      <name>commit(Resource) -> Return</name> -      <fsummary>Instruct the target object to commit the transaction</fsummary> -      <type> -        <v>Resource = #objref</v> -        <v>Return = ok | {'EXCEPTION', E}</v> -        <v>E = #'CosTransactions_NotPrepared'{} | #'CosTransactions_HeuristicRollback'{} | #'CosTransactions_HeuristicMixed'{} | #'CosTransactions_HeuristicHazard'{}</v> -      </type> -      <desc> -        <p>This operation instructs the Resource to commit all changes made as a part of the transaction.</p> -        <p>The Resource can raise:</p> -        <list type="bulleted"> -          <item>Heuristic Exception - if a Heuristic decision is made which differ -           from the true outcome of the transaction. The Resource must remember -           the Heuristic outcome until the <c>forget</c> operation is performed.</item> -        </list> -      </desc> -    </func> -    <func> -      <name>commit_one_phase(Resource) -> Return</name> -      <fsummary>Instruct the target object to commit the transaction</fsummary> -      <type> -        <v>Resource = #objref</v> -        <v>Return = ok | {'EXCEPTION', E}</v> -        <v>E = #'CosTransactions_HeuristicHazard'{} | #'CosTransactions_TransactionRolledBack'{}</v> -      </type> -      <desc> -        <p>If possible, the Resource should commit all changes made as part of the transaction, -          else it should raise the TRANSACTION_ROLLEDBACK exception.  -          This operation can only be used if the Resource is the only child of its parent.</p> -      </desc> -    </func> -    <func> -      <name>forget(Resource) -> Return</name> -      <fsummary>Instruct the target object to forget any heuristic decisions</fsummary> -      <type> -        <v>Resource = #objref</v> -        <v>Return = ok</v> -      </type> -      <desc> -        <p>This operation informs the Resource that it is safe to forget any Heuristic -          decisions and the knowledge of the transaction.</p> -      </desc> -    </func> -    <func> -      <name>prepare(Resource) -> Return</name> -      <fsummary>Instruct the target object to begin the two-phase commit protocol</fsummary> -      <type> -        <v>Resource = #objref</v> -        <v>Return = Vote | {'EXCEPTION', E}</v> -        <v>Vote = 'VoteReadOnly' | 'VoteCommit' | 'VoteRollback'</v> -        <v>E = #'CosTransactions_HeuristicMixed'{} | #'CosTransactions_HeuristicHazard'{}</v> -      </type> -      <desc> -        <p>This operation is invoked on the Resource to begin the two-phase commit protocol.</p> -        <p>The Resource can reply:</p> -        <list type="bulleted"> -          <item>'VoteReadOnly' - if no persistent data has been modified by the transaction.  -           The Resource can forget all knowledge of the transaction. </item> -          <item>'VoteCommit' - if the Resource has been prepared and is able to write all the -           data needed to commit the transaction to stable storage.</item> -          <item>'VoteRollback' - under any circumstances but must do so if none of the alternatives above -           are applicable.</item> -          <item>Heuristic Exception - if a Heuristic decision is made which differ -           from the true outcome of the transaction. The Resource must remember -           the Heuristic outcome until the <c>forget</c> operation is performed.</item> -        </list> -      </desc> -    </func> -    <func> -      <name>rollback(Resource) -> Return</name> -      <fsummary>Instruct the target object to rollback the transaction</fsummary> -      <type> -        <v>Resource = #objref</v> -        <v>Return = ok | {'EXCEPTION', E}</v> -        <v>E = #'CosTransactions_HeuristicCommit'{} | #'CosTransactions_HeuristicMixed'{} | #'CosTransactions_HeuristicHazard'{}</v> -      </type> -      <desc> -        <p>This operation instructs the Resource to rollback all changes made as a part of the transaction.</p> -        <p>The Resource can raise:</p> -        <list type="bulleted"> -          <item>Heuristic Exception - if a Heuristic decision is made which differ -           from the true outcome of the transaction. The Resource must remember -           the Heuristic outcome until the <c>forget</c> operation is performed.</item> -        </list> -      </desc> -    </func> -  </funcs> -   -</erlref> - diff --git a/lib/cosTransactions/doc/src/CosTransactions_SubtransactionAwareResource.xml b/lib/cosTransactions/doc/src/CosTransactions_SubtransactionAwareResource.xml deleted file mode 100644 index 30102d18d9..0000000000 --- a/lib/cosTransactions/doc/src/CosTransactions_SubtransactionAwareResource.xml +++ /dev/null @@ -1,75 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<!DOCTYPE erlref SYSTEM "erlref.dtd"> - -<erlref> -  <header> -    <copyright> -      <year>1999</year><year>2016</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. -     -    </legalnotice> - -    <title>CosTransactions_SubtransactionAwareResource</title> -    <prepared></prepared> -    <docno></docno> -    <checked></checked> -    <date>1999-04-12</date> -    <rev>PA1</rev> -  </header> -  <module>CosTransactions_SubtransactionAwareResource</module> -  <modulesummary>This module implements the OMG CosTransactions::SubtransactionAwareResource interface.</modulesummary> -  <description> -    <p>This interface inherits the CosTransactions::Resource interface. Hence,  -      it must also support all operations defined in the Resource interface.</p> -    <p>To get access to the record definitions for the structures use:      <br></br> -<c>-include_lib("cosTransactions/include/CosTransactions.hrl").</c></p> -  </description> -  <funcs> -    <func> -      <name>commit_subtransaction(SubtransactionAwareResource, Coordinator) -> Return</name> -      <fsummary>Notify the target object that the transaction has committed</fsummary> -      <type> -        <v>SubtransactionAwareResource = #objref</v> -        <v>Coordinator = #objref</v> -        <v>Return = ok</v> -      </type> -      <desc> -        <p>If the <c>SubtransactionAwareResource</c> have been registered with a <em>subtransaction</em> -          using the operation <c>CosTransactions_Coordinator:register_subtran_aware/2</c>, -          it will be notified when the transaction has committed.</p> -        <note> -          <p>The results of a committed subtransaction are relative to the completion of its ancestor -            transactions, that is, these results can be undone if any ancestor transaction is rolled back.</p> -        </note> -      </desc> -    </func> -    <func> -      <name>rollback_subtransaction(SubtransactionAwareResource) -> Return</name> -      <fsummary>Notify the target object that the transaction has been rolled back</fsummary> -      <type> -        <v>SubtransactionAwareResource = #objref</v> -        <v>Return = ok</v> -      </type> -      <desc> -        <p>If the <c>SubtransactionAwareResource</c> have been registered with a transactions -          using the operation <c>CosTransactions_Coordinator:register_subtran_aware/2</c> -          it will be notified when the transaction has rolled back.</p> -      </desc> -    </func> -  </funcs> -   -</erlref> - diff --git a/lib/cosTransactions/doc/src/CosTransactions_Synchronization.xml b/lib/cosTransactions/doc/src/CosTransactions_Synchronization.xml deleted file mode 100644 index c21e7c559d..0000000000 --- a/lib/cosTransactions/doc/src/CosTransactions_Synchronization.xml +++ /dev/null @@ -1,70 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<!DOCTYPE erlref SYSTEM "erlref.dtd"> - -<erlref> -  <header> -    <copyright> -      <year>1999</year> -      <year>2016</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_Synchronization</title> -    <prepared>Niclas Eklund</prepared> -    <responsible>Niclas Eklund</responsible> -    <docno></docno> -    <approved>Niclas Eklund</approved> -    <checked></checked> -    <date>1999-04-12</date> -    <rev>PA1</rev> -  </header> -  <module>CosTransactions_Synchronization</module> -  <modulesummary>This module implements the OMG CosTransactions::Synchronization interface.</modulesummary> -  <description> -    <p>To get access to the record definitions for the structures use:      <br></br> -<c>-include_lib("cosTransactions/CosTransactions.hrl").</c></p> -  </description> -  <funcs> -    <func> -      <name>before_completion(Synchronization) -> Return</name> -      <fsummary>Notify the target object that the transaction is about to enter the prepare phase</fsummary> -      <type> -        <v>Synchronization = #objref</v> -        <v>Return = ok</v> -      </type> -      <desc> -        <p>If the target object is a transaction using the operation <c>register_synchronization/2</c> -          it will be notified to perform necessary processing prior to the prepare phase.</p> -      </desc> -    </func> -    <func> -      <name>after_completion(Synchronization) -> Return</name> -      <fsummary>Notify the target object that the transaction is completed</fsummary> -      <type> -        <v>Synchronization = #objref</v> -        <v>Return = ok</v> -      </type> -      <desc> -        <p>If the target object is a transaction using the operation <c>register_synchronization/2</c> -          it will be notified to perform necessary processing after terminating the transaction.</p> -      </desc> -    </func> -  </funcs> -   -</erlref> - diff --git a/lib/cosTransactions/doc/src/CosTransactions_Terminator.xml b/lib/cosTransactions/doc/src/CosTransactions_Terminator.xml deleted file mode 100644 index f75f4d912d..0000000000 --- a/lib/cosTransactions/doc/src/CosTransactions_Terminator.xml +++ /dev/null @@ -1,73 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<!DOCTYPE erlref SYSTEM "erlref.dtd"> - -<erlref> -  <header> -    <copyright> -      <year>1999</year> -      <year>2016</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_Terminator</title> -    <prepared>Niclas Eklund</prepared> -    <responsible>Niclas Eklund</responsible> -    <docno></docno> -    <approved>Niclas Eklund</approved> -    <checked></checked> -    <date>1999-04-12</date> -    <rev>PA1</rev> -  </header> -  <module>CosTransactions_Terminator</module> -  <modulesummary>This module implements the OMG CosTransactions::Terminator interface.</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> -  </description> -  <funcs> -    <func> -      <name>commit(Terminator, ReportHeuristics) -> Return</name> -      <fsummary>Try to commit a transaction</fsummary> -      <type> -        <v>Terminator = #objref</v> -        <v>ReportHeuristics = boolean()</v> -        <v>Return =  ok | {'EXCEPTION', E}</v> -        <v>E = #'CosTransactions_HeuristicMixed'{} | #'CosTransactions_HeuristicHazrd'{} | #'CosTransactions_TransactionRolledBack'{}</v> -      </type> -      <desc> -        <p>This operation initiates the two-phase commit protocol. If the transaction has not been marked -          <c>'rollback only'</c> and all the participants agree to commit, the operation terminates normally. Otherwise, -          the TransactionRolledBack is raised. If the parameter <c>ReportHeuristics</c> is true and inconsistent -          outcomes by raising an Heuristic Exception.</p> -      </desc> -    </func> -    <func> -      <name>rollback(Terminator) -> Return</name> -      <fsummary>Rollback a transaction</fsummary> -      <type> -        <v>Terminator = #objref</v> -        <v>Return = ok</v> -      </type> -      <desc> -        <p>This operation roles back the transaction. </p> -      </desc> -    </func> -  </funcs> -   -</erlref> - diff --git a/lib/cosTransactions/doc/src/CosTransactions_TransactionFactory.xml b/lib/cosTransactions/doc/src/CosTransactions_TransactionFactory.xml deleted file mode 100644 index c4469ef850..0000000000 --- a/lib/cosTransactions/doc/src/CosTransactions_TransactionFactory.xml +++ /dev/null @@ -1,64 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<!DOCTYPE erlref SYSTEM "erlref.dtd"> - -<erlref> -  <header> -    <copyright> -      <year>1999</year> -      <year>2016</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_TransactionFactory</title> -    <prepared></prepared> -    <responsible></responsible> -    <docno></docno> -    <approved></approved> -    <checked></checked> -    <date>1999-04-12</date> -    <rev>PA1</rev> -  </header> -  <module>CosTransactions_TransactionFactory</module> -  <modulesummary>This module implements the OMG CosTransactions::TransactionFactory interface.</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> -  </description> -  <funcs> -    <func> -      <name>create(TransactionFactory, Timeout) -> Control</name> -      <fsummary>Create a new top-level transaction</fsummary> -      <type> -        <v>TransactionFactory = #objref</v> -        <v>Timeout = integer()</v> -        <v>Control = #objref</v> -      </type> -      <desc> -        <p>This operation creates a new top-level transaction.</p> -        <p>The <c>Timeout</c> argument can be:</p> -        <list type="bulleted"> -          <item>0 - no timeout.</item> -          <item>N (integer() > 0) -  the transaction will be subject to being rolled back -           if it does not complete before N seconds have elapsed.</item> -        </list> -      </desc> -    </func> -  </funcs> -   -</erlref> - diff --git a/lib/cosTransactions/doc/src/CosTransactions_TransactionalObject.xml b/lib/cosTransactions/doc/src/CosTransactions_TransactionalObject.xml deleted file mode 100644 index 319da2bd16..0000000000 --- a/lib/cosTransactions/doc/src/CosTransactions_TransactionalObject.xml +++ /dev/null @@ -1,43 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<!DOCTYPE erlref SYSTEM "erlref.dtd"> - -<erlref> -  <header> -    <copyright> -      <year>1999</year><year>2016</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. -     -    </legalnotice> - -    <title>CosTransactions_TransactionalObject</title> -    <prepared></prepared> -    <docno></docno> -    <checked></checked> -    <date>1999-04-12</date> -    <rev>PA1</rev> -  </header> -  <module>CosTransactions_TransactionalObject</module> -  <modulesummary>This module implements the OMG CosTransactions::TransactionalObject interface.</modulesummary> -  <description> -    <p>To get access to the record definitions for the structures use:      <br></br> -<c>-include_lib("cosTransactions/CosTransactions.hrl").</c></p> -    <p>The TransactionalObject interface is used by an object to indicate that it is transactional. -      By supporting this interface, an object indicates that it wants the transaction context associated with  -      the client to be associated with all operation on its interface. No operations are defined.</p> -  </description> -   -</erlref> - diff --git a/lib/cosTransactions/doc/src/Makefile b/lib/cosTransactions/doc/src/Makefile deleted file mode 100644 index b70d7647b1..0000000000 --- a/lib/cosTransactions/doc/src/Makefile +++ /dev/null @@ -1,147 +0,0 @@ -# -# %CopyrightBegin% -#  -# Copyright Ericsson AB 1999-2016. All Rights Reserved. -#  -# 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. -#  -# %CopyrightEnd% -# -# -include $(ERL_TOP)/make/target.mk -include $(ERL_TOP)/make/$(TARGET)/otp.mk - -# ---------------------------------------------------- -# Application version -# ---------------------------------------------------- -include ../../vsn.mk -VSN=$(COSTRANSACTIONS_VSN) -APPLICATION=cosTransactions - -# ---------------------------------------------------- -# Release directory specification -# ---------------------------------------------------- -RELSYSDIR = $(RELEASE_PATH)/lib/$(APPLICATION)-$(VSN) - -# ---------------------------------------------------- -# Target Specs -# ---------------------------------------------------- -XML_APPLICATION_FILES = ref_man.xml -XML_REF3_FILES = \ -	cosTransactions.xml \ -	CosTransactions_Control.xml \ -	CosTransactions_Coordinator.xml \ -	CosTransactions_RecoveryCoordinator.xml \ -	CosTransactions_Resource.xml \ -	CosTransactions_SubtransactionAwareResource.xml \ -	CosTransactions_Terminator.xml \ -	CosTransactions_TransactionFactory.xml -#	CosTransactions_Synchronization.xml - -XML_PART_FILES = \ -	part.xml \ -	part_notes.xml -XML_CHAPTER_FILES = \ -	ch_contents.xml \ -	ch_introduction.xml \ -	ch_install.xml \ -	ch_example.xml \ -	ch_skeletons.xml \ -	notes.xml - -BOOK_FILES = book.xml - -XML_FILES = $(BOOK_FILES) $(XML_APPLICATION_FILES) $(XML_REF3_FILES) \ -            $(XML_PART_FILES) $(XML_CHAPTER_FILES)  - -TECHNICAL_DESCR_FILES =  - -GIF_FILES = \ -	book.gif \ -	notes.gif \ -	ref_man.gif \ -	user_guide.gif - -PS_FILES =  - -# ---------------------------------------------------- - -INTERNAL_HTML_FILES = $(TECHNICAL_DESCR_FILES:%.xml=$(HTMLDIR)/%.html) - -HTML_FILES = $(XML_APPLICATION_FILES:%.xml=$(HTMLDIR)/%.html) \ -	$(XML_PART_FILES:%.xml=$(HTMLDIR)/%.html) - -INFO_FILE = ../../info -EXTRA_FILES = summary.html.src \ -	$(DEFAULT_GIF_FILES) \ -	$(DEFAULT_HTML_FILES) \ -	$(XML_REF3_FILES:%.xml=$(HTMLDIR)/%.html) \ -	$(XML_CHAPTER_FILES:%.xml=$(HTMLDIR)/%.html) - -MAN3_FILES = $(XML_REF3_FILES:%.xml=$(MAN3DIR)/%.3) - -HTML_REF_MAN_FILE = $(HTMLDIR)/index.html - -TOP_PDF_FILE = $(PDFDIR)/$(APPLICATION)-$(VSN).pdf - -# ---------------------------------------------------- -# FLAGS  -# ---------------------------------------------------- -XML_FLAGS +=  -DVIPS_FLAGS +=  - -# ---------------------------------------------------- -# Targets -# ---------------------------------------------------- -$(HTMLDIR)/%.gif: %.gif -	$(INSTALL_DATA) $< $@ - -docs: pdf html man - -$(TOP_PDF_FILE): $(XML_FILES) - -pdf: $(TOP_PDF_FILE) - -html: gifs $(HTML_REF_MAN_FILE) - -clean clean_docs: -	rm -rf $(HTMLDIR)/* -	rm -f $(MAN3DIR)/* -	rm -f $(TOP_PDF_FILE) $(TOP_PDF_FILE:%.pdf=%.fo) -	rm -f errs core *~ - -man: $(MAN3_FILES) - -gifs: $(GIF_FILES:%=$(HTMLDIR)/%) - -$(INDEX_TARGET): $(INDEX_SRC) -	sed -e 's;%VSN%;$(VSN);' $(INDEX_SRC) > $(INDEX_TARGET) - -debug opt:  - -# ---------------------------------------------------- -# Release Target -# ----------------------------------------------------  -include $(ERL_TOP)/make/otp_release_targets.mk - -release_docs_spec: docs -	$(INSTALL_DIR) "$(RELSYSDIR)/doc/pdf" -	$(INSTALL_DATA) $(TOP_PDF_FILE) "$(RELSYSDIR)/doc/pdf" -	$(INSTALL_DIR) "$(RELSYSDIR)/doc/html" -	$(INSTALL_DATA) $(HTMLDIR)/* \ -		"$(RELSYSDIR)/doc/html" -	$(INSTALL_DATA) $(INFO_FILE) "$(RELSYSDIR)" -	$(INSTALL_DIR) "$(RELEASE_PATH)/man/man3" -	$(INSTALL_DATA) $(MAN3DIR)/* "$(RELEASE_PATH)/man/man3" - -release_spec: diff --git a/lib/cosTransactions/doc/src/book.gif b/lib/cosTransactions/doc/src/book.gifBinary files differ deleted file mode 100644 index 94b3868792..0000000000 --- a/lib/cosTransactions/doc/src/book.gif +++ /dev/null diff --git a/lib/cosTransactions/doc/src/book.xml b/lib/cosTransactions/doc/src/book.xml deleted file mode 100644 index 33a8c323bb..0000000000 --- a/lib/cosTransactions/doc/src/book.xml +++ /dev/null @@ -1,49 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<!DOCTYPE book SYSTEM "book.dtd"> - -<book xmlns:xi="http://www.w3.org/2001/XInclude"> -  <header titlestyle="normal"> -    <copyright> -      <year>1999</year><year>2016</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. -     -    </legalnotice> - -    <title>cosTransactions</title> -    <prepared>Niclas Eklund</prepared> -    <docno></docno> -    <date>1999-04-14</date> -    <rev>2.0</rev> -  </header> -  <insidecover> -  </insidecover> -  <pagetext>cosTransactions</pagetext> -  <preamble> -    <contents level="2"></contents> -  </preamble> -  <parts lift="no"> -    <xi:include href="part.xml"/> -  </parts> -  <applications> -    <xi:include href="ref_man.xml"/> -  </applications> -  <releasenotes> -    <xi:include href="notes.xml"/> -  </releasenotes> -  <listofterms></listofterms> -  <index></index> -</book> - diff --git a/lib/cosTransactions/doc/src/ch_contents.xml b/lib/cosTransactions/doc/src/ch_contents.xml deleted file mode 100644 index 9b2832a032..0000000000 --- a/lib/cosTransactions/doc/src/ch_contents.xml +++ /dev/null @@ -1,75 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<!DOCTYPE chapter SYSTEM "chapter.dtd"> - -<chapter> -  <header> -    <copyright> -      <year>1999</year><year>2016</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. -     -    </legalnotice> - -    <title>The cosTransactions Application</title> -    <prepared>Niclas Eklund</prepared> -    <docno></docno> -    <date>1999-04-14</date> -    <rev>B</rev> -    <file>ch_contents.xml</file> -  </header> - -  <section> -    <title>Content Overview</title> -    <p>The cosTransactions documentation is divided into three sections: -      </p> -    <list type="bulleted"> -      <item> -        <p>PART ONE - The User's Guide   -                    <br></br> -Description of the cosTransactions Application including  -          services and a small tutorial demonstrating  -          the development of a simple service.</p> -      </item> -      <item> -        <p>PART TWO - Release Notes -                    <br></br> -A concise history of cosTransactions.</p> -      </item> -      <item> -        <p>PART THREE - The Reference Manual -                    <br></br> - A quick reference guide, including a -          brief description, to all the functions available in cosTransactions.</p> -      </item> -    </list> -  </section> - -  <section> -    <title>Brief Description of the User's Guide</title> -    <p>The User's Guide  contains the following parts:</p> -    <list type="bulleted"> -      <item> -        <p>cosTransactions overview</p> -      </item> -      <item> -        <p>cosTransactions installation</p> -      </item> -      <item> -        <p>A tutorial example</p> -      </item> -    </list> -  </section> -</chapter> - diff --git a/lib/cosTransactions/doc/src/ch_example.xml b/lib/cosTransactions/doc/src/ch_example.xml deleted file mode 100644 index a2451e5fbc..0000000000 --- a/lib/cosTransactions/doc/src/ch_example.xml +++ /dev/null @@ -1,283 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<!DOCTYPE chapter SYSTEM "chapter.dtd"> - -<chapter> -  <header> -    <copyright> -      <year>1999</year><year>2016</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. - -    </legalnotice> - -    <title>cosTransactions Examples</title> -    <prepared></prepared> -    <docno></docno> -    <date>1999-04-27</date> -    <rev>A</rev> -    <file>ch_example.xml</file> -  </header> - -  <section> -    <title>A Tutorial on How to Create a Simple Service</title> - -    <section> -      <title>Interface design</title> -      <p>To use the cosTransactions application <em>participants</em> must be implemented.  -        There are two types of participants: </p> -      <list type="bulleted"> -        <item><seealso marker="CosTransactions_Resource">CosTransactions_Resource</seealso> - operations used to commit or rollback resources.</item> -        <item><seealso marker="CosTransactions_SubtransactionAwareResource">CosTransactions_SubtransactionAwareResource</seealso> -  -         operations used when the resources want to be notified when a subtransaction commits.  -         This interface inherits the CosTransactions_Resource</item> -      </list> -      <p>The interfaces for these participants are defined in <em>CosTransactions.idl</em></p> -    </section> - -    <section> -      <title>Generating a Participant Interface</title> -      <p>We start by creating an interface which inherits from <em>CosTransactions::Resource</em>. Hence,  -        we must also implement all operations defined in the Resource interface. The IDL-file could look like: </p> -      <code type="c"><![CDATA[ -#ifndef _OWNRESOURCEIMPL_IDL -#define _OWNRESOURCEIMPL_IDL -#include <CosTransactions.idl> - -module ownResourceImpl { - -  interface ownInterface:CosTransactions::Resource { - -    void ownFunctions(in any NeededArguments) -       raises(Systemexceptions,OwnExceptions); - -  }; -}; - -#endif -      ]]></code> -      <p>Run the IDL compiler on this file by calling the <c>ic:gen/1</c> function.  -        This will produce the API named <c>ownResourceImpl_ownInterface.erl</c>. -        After generating the API stubs and the server skeletons it is time to  -        implement the servers and if no special options are sent  -        to the IDl compiler the file name is <c>ownResourceImpl_ownInterface_impl.erl</c>.</p> -    </section> - -    <section> -      <title>Implementation of Participant interface</title> -      <p>If the participant is intended to be a plain Resource, we must implement the following operations:</p> -      <list type="bulleted"> -        <item><c>prepare/1</c> - this operation is invoked on the Resource to begin the two-phase commit protocol.</item> -        <item><c>rollback/1</c> - this operation instructs the Resource to rollback all changes made as a part of the transaction. </item> -        <item><c>commit/1</c> - this operation instructs the Resource to commit all changes made as a part of the transaction.</item> -        <item><c>commit_one_phase/1</c> - if possible, the Resource should commit all changes made as part of the transaction.  -         This operation can only be used if the Resource is the only child of its parent. </item> -        <item><c>forget/1</c> - this operation informs the Resource that it is safe to forget any  -        <term id="Heuristic decisions"><termdef>Heuristic decisions is a unilateral decision by a participant to commit -              or rollback without receiving the true outcome of the transaction from its parent's coordinator.</termdef></term> -              and the knowledge of the transaction.</item> -        <item><c>ownFunctions</c> - all application specific operations.</item> -      </list> -      <p>If the participant wants to be notified when a subtransaction commits, we must also implement the following operations  -        (besides the operations above):</p> -      <list type="bulleted"> -        <item><c>commit_subtransaction/2</c> - if the <c>SubtransactionAwareResource</c> have been registered  -         with a transactions using the operation <c>CosTransactions_Coordinator:register_subtran_aware/2</c> it will  -         be notified when the transaction has -         committed. </item> -        <item><c>rollback_subtransaction/1</c> - if the <c>SubtransactionAwareResource</c> have been registered  -         with a transactions using the operation <c>CosTransactions_Coordinator:register_subtran_aware/2</c> -         it will be notified when the transaction has -         rolled back. </item> -      </list> -      <note> -        <p>The results of a committed subtransaction are relative to the completion of its ancestor transactions,  -          that is, these results can be undone if any ancestor transaction is rolled back. </p> -      </note> -    </section> - -    <section> -      <title>Participant Operations Behavior</title> -      <p>Each application participant must behave in a certain way to ensure that the two-phase commit protocol -        can complete the transactions correctly.</p> - -      <section> -        <title>prepare</title> -        <p>This operation ask the participant to vote on the outcome of the transaction. Possible replies are:</p> -        <list type="bulleted"> -          <item><em>'VoteReadOnly'</em> - if no data associated with the transaction has been modified VoteReadOnly may be returned. -           The Resource can forget all knowledge of the transaction and terminate.</item> -          <item><em>'VoteCommit'</em> - if the Resource is able to write all the data needed to commit the transaction to a stable storage, -           VoteCommit may be returned. The Resource will then wait until it is informed of the outcome of the transaction. -           The Resource may, however, make a unilateral decision (Heuristic) to commit or rollback changes associated  -           with the transaction. When the Resource is informed of the true outcome (rollback/commit) and it is equal to -           the Heuristic decision the Resource just return 'ok'. But, if there is a mismatch and the commit-operation is irreversible, -           the Resource must raise a <seealso marker="CosTransactions_Resource">Heuristic Exception</seealso> and wait  -           until the <c>forget</c> operation is invoked. The Heuristic Decision must be recorded in stable storage.</item> -          <item><em>'VoteRollback'</em> - the Resource may vote VoteRollback under any circumstances. -           The Resource can forget all knowledge of the transaction and terminate.</item> -        </list> -        <note> -          <p>Before replying to the prepare operation, the Resource must record the prepare state, the reference of its -            superior <seealso marker="CosTransactions_RecoveryCoordinator">RecoveryCoordinator</seealso> in stable storage. -            The RecoveryCoordinator is obtained when registering as a participant in a transaction.</p> -        </note> -      </section> - -      <section> -        <title>rollback</title> -        <p>The Resource should, if necessary, rollback all changes made as part of the transaction. If the Resource is not aware of the -          transaction it should do nothing, e.g., recovered after a failure and have no data in stable storage. Heuristic Decisions -          must be handled as described above.</p> -      </section> - -      <section> -        <title>commit</title> -        <p>The Resource should, if necessary, commit all changes made as part of the transaction. If the Resource is not aware of the -          transaction it should do nothing, e.g., recovered after a failure and have no data in stable storage. Heuristic Decisions -          must be handled as described above.</p> -      </section> - -      <section> -        <title>commit_one_phase</title> -        <p>If possible, the Resource should commit all changes made as part of the transaction. If it cannot, it should raise the -          TRANSACTION_ROLLEDBACK exception. This operation can only be used if the Resource is the only child of its parent. -          If a failure occurs the completion of the operation must be retried when the failure is repaired. Heuristic Decisions -          must be handled as described above.</p> -      </section> - -      <section> -        <title>forget</title> -        <p>If the Resource raised a Heuristic Exception to <c>commit</c>, <c>rollback</c> or <c>commit_one_phase</c> this operation -          will be performed. The Resource can forget all knowledge of the transaction and terminate.</p> -      </section> - -      <section> -        <title>commit_subtransaction</title> -        <p>If the <c>SubtransactionAwareResource</c> have been registered with a <em>subtransaction</em> -          using the operation <c>CosTransactions_Coordinator:register_subtran_aware/2</c> -          it will be notified when the transaction has committed. The Resource may raise the exception -          <c>'TRANSACTION_ROLLEDBACK'</c>.</p> -        <note> -          <p>The result of a committed subtransaction is relative to the completion of its ancestor -            transactions, that is, these results can be undone if any ancestor transaction is rolled back.</p> -        </note> -      </section> - -      <section> -        <title>rollback_subtransaction</title> -        <p>If the <c>SubtransactionAwareResource</c> have been registered with a <em>subtransaction</em> -          using the operation <c>CosTransactions_Coordinator:register_subtran_aware/2</c> -          it will be notified when the subtransaction has rolled back.</p> -      </section> -    </section> - -    <section> -      <title>How to Run Everything</title> -      <p>Below is a short transcript on how to run cosTransactions. </p> -      <code type="none"> - -%% Start Mnesia and Orber -mnesia:delete_schema([node()]), -mnesia:create_schema([node()]), -orber:install([node()]), -application:start(mnesia), -application:start(orber), - -%% Register CosTransactions in the IFR. -'oe_CosTransactions':'oe_register'(),  - -%% Register the application specific Resource implementations -%% in the IFR. -'oe_ownResourceImpl':'oe_register'(),  - -%%-- Set parameters -- -%% Timeout can be either 0 (no timeout) or an integer N > 0. -%% The later state that the transaction should be rolled  -%% back if the transaction have not completed within N seconds. -TimeOut = 0, - -%% Do we want the transaction to report Heuristic Exceptions? -%% This variable must be boolean and indicates the way the -%% Terminator should behave. -Heuristics = true, - -%% Start the cosTransactions application. -cosTransactions:start(),  %% or application:start(cosTransactions), - -%% Start a factory using the default configuration -TrFac = cosTransactions:start_factory(), -%% ... or use configuration parameters. -TrFac = cosTransactions:start_factory([{typecheck, false}, {hash_max, 3013}]), - -%% Create a new top-level transaction. -Control = 'CosTransactions_TransactionFactory':create(TrFac, TimeOut), - -%% Retrieve the Coordinator and Terminator object references from -%% the Control Object. -Term = 'CosTransactions_Control':get_terminator(Control), -Coord = 'CosTransactions_Control':get_coordinator(Control), - -%% Create two SubTransactions with the root-Coordinator as parent. -SubCont1 = 'CosTransactions_Coordinator':create_subtransaction(Coord), -SubCont2 = 'CosTransactions_Coordinator':create_subtransaction(Coord), - -%% Retrieve the Coordinator references from the Control Objects. -SubCoord1 = 'CosTransactions_Control':get_coordinator(SubCont1), -SubCoord2 = 'CosTransactions_Control':get_coordinator(SubCont2), - -%% Create application Resources. We can, for example, start the Resources  -%% our selves or look them up in the naming service. This is application -%% specific. -Res1 = ... -Res2 = ... -Res3 = ... -Res4 = ... - -%% Register Resources with respective Coordinator. Each call returns -%% a RecoveryCoordinator object reference. -RC1 = 'CosTransactions_Coordinator':register_resource(SubCoord1, Res1), -RC2 = 'CosTransactions_Coordinator':register_resource(SubCoord1, Res2), -RC3 = 'CosTransactions_Coordinator':register_resource(SubCoord2, Res3), -RC4 = 'CosTransactions_Coordinator':register_resource(SubCoord2, Res4), - -%% Register Resource 4 with SubCoordinator 1 so that the Resource will be  -%% informed when the SubCoordinator commits or roll-back. -'CosTransactions_Coordinator':register_subtran_aware(SubCoord1, Res4), - -%% We are now ready to try to commit the transaction. The second argument -%% must be a boolean -Outcome = (catch 'CosTransactions_Terminator':commit(Term, Heuristics)), -      </code> -      <note> -        <p>For the cosTransaction application to be able to recognize if a Resource is -          dead or in the process of restarting the Resource must be started as persistent, -          e.g., 'OwnResource':oe_create_link(Env, [{regname, {global, RegName}}, {persistent, true}]). -          For more information see the Orber documentation.</p> -      </note> -      <p>The outcome of the transaction can be:</p> -      <list type="bulleted"> -        <item>ok - the transaction was successfully committed.</item> -        <item>{'EXCEPTION', HeuristicExc} - at least one participant made a -         Heuristic decision or, due to a failure, one or more participants -         where unreachable.</item> -        <item>{'EXCEPTION', #'TRANSACTION_ROLLEDBACK'{}} -  -         the transaction was successfully rolled back.</item> -        <item>Any system exception -  -         the transaction failed with unknown reason.</item> -      </list> -    </section> -  </section> -</chapter> - diff --git a/lib/cosTransactions/doc/src/ch_install.xml b/lib/cosTransactions/doc/src/ch_install.xml deleted file mode 100644 index 4270c320b5..0000000000 --- a/lib/cosTransactions/doc/src/ch_install.xml +++ /dev/null @@ -1,104 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<!DOCTYPE chapter SYSTEM "chapter.dtd"> - -<chapter> -  <header> -    <copyright> -      <year>1999</year><year>2016</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. -     -    </legalnotice> - -    <title>Installing cosTransactions</title> -    <prepared></prepared> -    <docno></docno> -    <date>1999-04-20</date> -    <rev></rev> -    <file>ch_install.xml</file> -</header> - -  <section> -    <title>Installation Process </title> -    <p>This chapter describes how to install  -      <seealso marker="cosTransactions">cosTransactions</seealso>  -      in an Erlang Environment. -      </p> - -    <section> -      <title>Preparation</title> -      <p>Before starting the installation process for cosTransactions, -        the application Orber must be running.</p> -      <p>The cosTransactions application must be able to log progress to disk. The log files are -        created in the current directory as "oe_name@machine_type_timestamp". Hence, <c>read</c> and  -        <c>write</c> rights must be granted. If the transaction completes in an orderly fashion the  -        logfiles are removed, but not if an error, which demands human intervention, occur.</p> -    </section> - -    <section> -      <title>Configuration</title> -      <p>When using the Transaction Service the <c>cosTransactions</c> application  -        must be started using either <c>cosTransactions:start()</c> or  -        <c>application:start(cosTransactions)</c>. -        </p> -      <p>The following application configuration parameters exist:</p> -      <list type="bulleted"> -        <item><c>maxRetries</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.</item> -        <item><c>comFailWait</c> - default is 5000 milliseconds, i.e., before the application -         retries to contact unreachable transaction participants the application wait <c>Time</c> milliseconds.</item> -      </list> -      <p>Then the <seealso marker="CosTransactions_TransactionFactory">Transaction Factory</seealso> -        must be started:</p> -      <list type="bulleted"> -        <item><c>cosTransactions:start_factory()</c> - starts and returns a reference to a factory using default configuration parameters.</item> -        <item><c>cosTransactions:start_factory(Options)</c> - starts and returns a reference to a factory using given configuration parameters.</item> -      </list> -      <p>The following options exist: -        </p> -      <list type="bulleted"> -        <item><c>{hash_max, HashValue}</c> -  -         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><c>{allow_subtr, Boolean}</c> - -         If set to true it is possible to create <seealso marker="CosTransactions_Coordinator">subtransactions</seealso>. -         Default is <c>true</c>.</item> -        <item><c>{typecheck, Boolean}</c> - -         If set to to true all transaction operation's arguments will be type-checked. -         Default is <c>true</c>.</item> -        <item><c>{tty, Boolean}</c> -   -         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><c>{logfile, FileName}</c> - -         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 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> -      <p>The Factory is now ready to use. For a more detailed description see <seealso marker="ch_example">Examples</seealso>. -        </p> -    </section> -  </section> -</chapter> - diff --git a/lib/cosTransactions/doc/src/ch_introduction.xml b/lib/cosTransactions/doc/src/ch_introduction.xml deleted file mode 100644 index 43d25360bc..0000000000 --- a/lib/cosTransactions/doc/src/ch_introduction.xml +++ /dev/null @@ -1,65 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<!DOCTYPE chapter SYSTEM "chapter.dtd"> - -<chapter> -  <header> -    <copyright> -      <year>1999</year><year>2016</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. -     -    </legalnotice> - -    <title>Introduction to cosTransactions</title> -    <prepared>Niclas Eklund</prepared> -    <docno></docno> -    <date>1999-04-26</date> -    <rev></rev> -    <file>ch_introduction.xml</file> -</header> - -  <section> -    <title>Overview</title> -    <p>The cosTransactions application is a Transaction Service compliant with the <url href="http://www.omg.org">OMG</url>  -      Transaction Service CosTransactions 1.1. -      </p> - -    <section> -      <title>Purpose and Dependencies</title> -      <p><em>cosTransactions</em> is dependent on  <em>Orber version 3.0.1</em> or later(see the Orber -        documentation), which provides CORBA functionality in an Erlang environment.</p> -      <p><em>cosTransactions</em> is dependent on  <em>supervisor/stdlib-1.7</em> or later.</p> -      <p>Basically, cosTransaction implements a <em>two-phase commit protocol</em> and allows objects running -        on different platforms to participate in a transaction.</p> -    </section> - -    <section> -      <title>Prerequisites</title> -      <p>To fully understand the concepts presented in the -        documentation, it is recommended that the user is familiar -        with distributed programming, CORBA and the Orber application. -        </p> -      <p>Recommended reading includes <em>CORBA, Fundamentals and Programming - Jon Siegel</em> and <em>Open Telecom Platform Documentation Set</em>. It is also helpful to  have read -        <em>Concurrent Programming in Erlang</em> and, for example, <em>Transaction Processing: concepts and techniques - Jim Gray, Andreas Reuter</em>.</p> -      <note> -        <p>The cosTransaction application is compliant with the OMG CosTransactions specification 1.1. Using -          other vendors transaction service, compliant with the OMG CosTransactions specification 1.0, may -          not work since the <c>'TRANSACTION_REQUIRED', 'TRANSACTION_ROLLEDBACK'</c> and <c>'INVALID_TRANSACTION'</c> -          exceptions have been redefined to be system exceptions, i.e., used to be transaction-specific ('CosTransactions_Exc').</p> -      </note> -    </section> -  </section> -</chapter> - diff --git a/lib/cosTransactions/doc/src/ch_skeletons.xml b/lib/cosTransactions/doc/src/ch_skeletons.xml deleted file mode 100644 index e101cff5da..0000000000 --- a/lib/cosTransactions/doc/src/ch_skeletons.xml +++ /dev/null @@ -1,214 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<!DOCTYPE chapter SYSTEM "chapter.dtd"> - -<chapter> -  <header> -    <copyright> -      <year>1999</year><year>2016</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. -     -    </legalnotice> - -    <title>Resource Skeletons</title> -    <prepared>Niclas Eklund</prepared> -    <docno></docno> -    <date>1999-04-29</date> -    <rev></rev> -    <file>ch_skeletons.xml</file> -  </header> - -  <section> -    <title>Resource Skeletons</title> -    <p>This chapter provides a skeleton for application Resources. For more information -      see the Orber documentation.</p> -    <code type="none"> -%%%----------------------------------------------------------- -%%% File    : Module_Interface_impl.erl -%%% Author  :  -%%% Purpose :  -%%% Created :  -%%%----------------------------------------------------------- -  --module('Module_Interface_impl'). -  -%%--------------- INCLUDES ----------------------------------- --include_lib("orber/include/corba.hrl"). --include_lib("cosTransactions/include/CosTransactions.hrl"). - -%%--------------- EXPORTS------------------------------------- -%%- Inherit from CosTransactions::Resource ------------------- --export([prepare/2,  -         rollback/2,  -         commit/2,  -         commit_one_phase/2,  -         forget/2]). - -%%- Inherit from CosTransactions::SubtransactionAwareResource  --export([commit_subtransaction/3, -         rollback_subtransaction/2]). -  -%%--------------- gen_server specific ------------------------ --export([init/1, terminate/2, code_change/3, handle_info/2]). -  -%%------------------------------------------------------------ -%% function : gen_server specific -%%------------------------------------------------------------ -init(Env) -> -    %% 'trap_exit' optional -    process_flag(trap_exit,true), - -    %%--- Possible replies --- -    %% Reply and await next request -    {ok, State}. - -    %% Reply and if no more requests within Time the special  -    %% timeout message should be handled in the  -    %% Module_Interface_impl:handle_info/2 call-back function (use the  -    %% IC option {{handle_info, "Module::Interface"}, true}). -    {ok, State, TimeOut}. - -     %% Return ignore in order to inform the parent, especially if it is a  -     %% supervisor, that the server, as an example, did not start in  -     %% accordance with the configuration data.  -     ignore. - -     %% If the initializing procedure fails, the reason  -     %% is supplied as StopReason. -     {stop, StopReason}. - - -terminate(Reason, State) -> -    ok. - -code_change(OldVsn, State, Extra) -> -    {ok, NewState}. - -%% If use IC option {{handle_info, "Module::Interface"}, true} -handle_info(Info, State) -> -     %%--- Possible replies --- -     %% Await the next invocation. -     {noreply, State}. -     %% Stop with Reason. -     {stop, Reason, State}. - -  -%%- Inherit from CosTransactions::Resource ------------------- -prepare(State) -> - -    %%% Do application specific actions here %%% - -    %%-- Reply: -- -    %% If no data related to the transaction changed. -    {reply, 'VoteReadOnly', State} -    %% .. or (for example):  -    {stop, normal, 'VoteReadOnly', State}. - -    %% If able to commit -    {reply, 'VoteCommit', State} - -    %% If not able to commit -    {reply, 'VoteRollback', State} -    %% .. or (for example):  -    {stop, normal, 'VoteRollback', State}. - -rollback(State) -> - -    %%% Do application specific actions here %%% - -    %%-- Reply: -- -    %% If able to rollback successfully -    {reply, ok, State} -    %% .. or (for example):  -    {stop, normal, ok, State}. - -    %% If Heuristic Decision. Raise exception: -    corba:raise(#'CosTransactions_HeuristicMixed' {}) -    corba:raise(#'CosTransactions_HeuristicHazard' {}) -    corba:raise(#'CosTransactions_HeuristicCommit'{}) - - -commit(State) -> - -    %%% Do application specific actions here %%% - -    %%-- Reply: -- -    %% If able to commit successfully -    {reply, ok, State} -    %% .. or (for example):  -    {stop, normal, ok, State}. - -    %% If the prepare operation never been invoked: -    corba:raise(#'CosTransactions_NotPrepared'{}) - -    %% If Heuristic Decision. Raise exception: -    corba:raise(#'CosTransactions_HeuristicMixed' {}) -    corba:raise(#'CosTransactions_HeuristicHazard' {}) -    corba:raise(#'CosTransactions_HeuristicRollback'{}) - -  -commit_one_phase(State) -> - -    %%% Do application specific actions here %%% - -    %%-- Reply: -- -    %% If able to commit successfully -    {reply, ok, State} -    %% .. or (for example):  -    {stop, normal, ok, State}. - -    %% If fails. Raise exception: -    corba:raise(#'CosTransactions_HeuristicHazard' {}) - -    %% If able to rollback successfully -    corba:raise(#'CosTransactions_TransactionRolledBack' {}) - -  -forget(State) -> - -    %%% Do application specific actions here %%% - -    %%-- Reply: -- -    {reply, ok, State}. -    %% .. or (for example):  -    {stop, normal, ok, State}. -   - - -%%%%%% If the Resource is also supposed to be a     %%%%%% -%%%%%% SubtransactionAwareResource implement these. %%%%%% - -%%- Inherit from CosTransactions::SubtransactionAwareResource -commit_subtransaction(State, Parent) -> -    %%% Do application specific actions here %%% - -    %%-- Reply: -- -    {reply, ok, State}. -    %% .. or (for example):  -    {stop, normal, ok, State}. - -rollback_subtransaction(State) -> -    %%% Do application specific actions here %%% - -    %%-- Reply: -- -    {reply, ok, State}. -    %% .. or (for example):  -    {stop, normal, ok, State}. -  -%%--------------- END OF MODULE ------------------------------ -    </code> -  </section> -</chapter> - diff --git a/lib/cosTransactions/doc/src/cosTransactions.xml b/lib/cosTransactions/doc/src/cosTransactions.xml deleted file mode 100644 index 772baaf18a..0000000000 --- a/lib/cosTransactions/doc/src/cosTransactions.xml +++ /dev/null @@ -1,142 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<!DOCTYPE erlref SYSTEM "erlref.dtd"> - -<erlref> -  <header> -    <copyright> -      <year>1999</year> -      <year>2016</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> - diff --git a/lib/cosTransactions/doc/src/fascicules.xml b/lib/cosTransactions/doc/src/fascicules.xml deleted file mode 100644 index 37feca543f..0000000000 --- a/lib/cosTransactions/doc/src/fascicules.xml +++ /dev/null @@ -1,18 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<!DOCTYPE fascicules SYSTEM "fascicules.dtd"> - -<fascicules> -  <fascicule file="part" href="part_frame.html" entry="no"> -    User's Guide -  </fascicule> -  <fascicule file="ref_man" href="ref_man_frame.html" entry="yes"> -    Reference Manual -  </fascicule> -  <fascicule file="part_notes" href="part_notes_frame.html" entry="no"> -    Release Notes -  </fascicule> -  <fascicule file="" href="../../../../doc/print.html" entry="no"> -    Off-Print -  </fascicule> -</fascicules> - diff --git a/lib/cosTransactions/doc/src/notes.gif b/lib/cosTransactions/doc/src/notes.gifBinary files differ deleted file mode 100644 index e000cca26a..0000000000 --- a/lib/cosTransactions/doc/src/notes.gif +++ /dev/null diff --git a/lib/cosTransactions/doc/src/notes.xml b/lib/cosTransactions/doc/src/notes.xml deleted file mode 100644 index 85ace1208b..0000000000 --- a/lib/cosTransactions/doc/src/notes.xml +++ /dev/null @@ -1,392 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<!DOCTYPE chapter SYSTEM "chapter.dtd"> - -<chapter> -  <header> -    <copyright> -      <year>1999</year><year>2016</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. - -    </legalnotice> - -    <title>cosTransactions Release Notes</title> -    <prepared>Niclas Eklund</prepared> -    <responsible>Niclas Eklund</responsible> -    <docno></docno> -    <approved></approved> -    <checked></checked> -    <date>99-04-14</date> -    <rev>A</rev> -    <file>notes.xml</file> -  </header> - -  <section><title>cosTransactions 1.3.2</title> - -    <section><title>Improvements and New Features</title> -      <list> -        <item> -          <p> -	    Internal changes</p> -          <p> -	    Own Id: OTP-13551</p> -        </item> -      </list> -    </section> - -</section> - -<section><title>cosTransactions 1.3.1</title> - -    <section><title>Improvements and New Features</title> -      <list> -        <item> -	    <p> Suppress Dialyzer warnings. </p> -          <p> -	    Own Id: OTP-12862</p> -        </item> -      </list> -    </section> - -</section> - -<section><title>cosTransactions 1.3</title> - -    <section><title>Improvements and New Features</title> -      <list> -        <item> -	    <p> Remove the usage of erlang:now() from all Corba -	    applications and use the new rand module instead of -	    random. </p> -          <p> -	    Own Id: OTP-12687</p> -        </item> -      </list> -    </section> - -</section> - -<section><title>cosTransactions 1.2.14</title> - -    <section><title>Improvements and New Features</title> -      <list> -        <item> -	    <p> The default encoding of Erlang files has been changed -	    from ISO-8859-1 to UTF-8. </p> <p> The encoding of XML -	    files has also been changed to UTF-8. </p> -          <p> -	    Own Id: OTP-10907</p> -        </item> -      </list> -    </section> - -</section> - -<section><title>cosTransactions 1.2.13</title> - -    <section><title>Improvements and New Features</title> -      <list> -        <item> -          <p> -	    Misc build updates</p> -          <p> -	    Own Id: OTP-10784</p> -        </item> -      </list> -    </section> - -</section> - -<section><title>cosTransactions 1.2.12</title> - -    <section><title>Improvements and New Features</title> -      <list> -        <item> -	    <p>Erlang/OTP can now be built using parallel make if you -	    limit the number of jobs, for instance using '<c>make -	    -j6</c>' or '<c>make -j10</c>'. '<c>make -j</c>' does not -	    work at the moment because of some missing -	    dependencies.</p> -          <p> -	    Own Id: OTP-9451</p> -        </item> -      </list> -    </section> - -</section> - -<section> -    <title>cosTransactions 1.2.11</title> -    <section> -      <title>Improvements and New Features</title> -      <list type="bulleted"> -        <item> -          <p> -            Removed superfluous usage of shy in the documentation since it can cause problem if -            a buggy tool is used.</p> -          <p> -            Own Id: OTP-9319 Aux Id:</p> -        </item> -      </list> -    </section> -  </section> - -  <section> -    <title>cosTransactions 1.2.10</title> -    <section> -      <title>Improvements and New Features</title> -      <list type="bulleted"> -        <item> -          <p> -            Test suites published.</p> -          <p> -            Own Id: OTP-8543 Aux Id:</p> -        </item> -      </list> -    </section> -    <section> -      <title>Fixed Bugs and Malfunctions</title> -      <list type="bulleted"> -        <item> -          <p>Added missing trailing bracket to define in hrl-file.</p> -          <p>Own id: OTP-8489 Aux Id:</p> -        </item> -      </list> -    </section> -  </section> - -  <section> -    <title>cosTransactions 1.2.9</title> - -    <section> -      <title>Fixed Bugs and Malfunctions</title> -      <list type="bulleted"> -        <item> -          <p>The documentation EIX file was not generated.</p> -          <p>Own id: OTP-8355 Aux Id:</p> -        </item> -      </list> -    </section> -  </section> - -  <section> -    <title>cosTransactions 1.2.8</title> - -    <section> -      <title>Improvements and New Features</title> -      <list type="bulleted"> -        <item> -          <p> -            The documentation is now built with open source tools (xsltproc and fop)  -            that exists on most platforms. One visible change is that the frames are removed.</p> -          <p> -            Own Id: OTP-8201 Aux Id:</p> -        </item> -      </list> -    </section> -  </section> - -  <section> -    <title>cosTransactions 1.2.7</title> - -    <section> -      <title>Improvements and New Features</title> -      <list type="bulleted"> -        <item> -          <p>Obsolete guards, e.g. record vs is_record, has been changed -             to avoid compiler warnings.</p> -          <p>Own id: OTP-7987</p> -        </item> -      </list> -    </section> -  </section> - -  <section> -    <title>cosTransactions 1.2.6</title> - -    <section> -      <title>Improvements and New Features</title> -      <list type="bulleted"> -        <item> -          <p>Updated file headers.</p> -          <p>Own id: OTP-7837</p> -        </item> -      </list> -    </section> -  </section> - -  <section> -    <title>cosTransactions 1.2.5</title> - -    <section> -      <title>Improvements and New Features</title> -      <list type="bulleted"> -        <item> -          <p>Documentation source included in open source releases.</p> -          <p>Own id: OTP-7595</p> -        </item> -      </list> -    </section> -  </section> - -  <section> -    <title>cosTransactions 1.2.4</title> - -    <section> -      <title>Improvements and New Features</title> -      <list type="bulleted"> -        <item> -          <p>Updated file headers.</p> -          <p>Own id: OTP-7011</p> -        </item> -      </list> -    </section> -  </section> - -  <section> -    <title>cosTransactions 1.2.3</title> - -    <section> -      <title>Improvements and New Features</title> -      <list type="bulleted"> -        <item> -          <p>The documentation source has been converted from SGML to XML.</p> -          <p>Own id: OTP-6754 Aux Id: </p> -        </item> -      </list> -    </section> -  </section> - -  <section> -    <title>cosTransactions 1.2.2</title> - -    <section> -      <title>Improvements and New Features</title> -      <list type="bulleted"> -        <item> -          <p>Minor Makefile changes.</p> -          <p>Own id: OTP-6701 Aux Id: </p> -        </item> -      </list> -    </section> -  </section> - -  <section> -    <title>cosTransactions 1.2.1</title> - -    <section> -      <title>Improvements and New Features</title> -      <list type="bulleted"> -        <item> -          <p>Removed some unused code.</p> -          <p>Own id: OTP-6527 Aux Id: </p> -        </item> -      </list> -    </section> -  </section> - -  <section> -    <title>cosTransactions 1.2</title> - -    <section> -      <title>Improvements and New Features</title> -      <list type="bulleted"> -        <item> -          <p>The stub/skeleton-files generated by IC have been improved, -            i.e., depending on the IDL-files, reduced the size of the -            erl- and beam-files and decreased dependencies off Orber's -            Interface Repository. It is necessary to re-compile all IDL-files -            and use COS-applications, including Orber, compiled with -            IC-4.2.</p> -          <p>Own id: OTP-4576</p> -        </item> -      </list> -    </section> -  </section> - -  <section> -    <title>cosTransactions 1.1.2</title> - -    <section> -      <title>Improvements and New Features</title> -      <list type="bulleted"> -        <item> -          <p>To avoid un-necessary Heuristic decisions cosTransactions now -            recognize more systems exceptions.</p> -          <p>Own Id: OTP-4485</p> -        </item> -      </list> -    </section> -  </section> - -  <section> -    <title>cosTransactions 1.1.1.1</title> - -    <section> -      <title>Improvements and New Features</title> -      <list type="bulleted"> -        <item> -          <p>Updated internal documentation.</p> -        </item> -      </list> -    </section> -  </section> - -  <section> -    <title>cosTransactions 1.1.1</title> - -    <section> -      <title>Improvements and New Features</title> -      <list type="bulleted"> -        <item> -          <p>cosTransactions is now able to handle upgrade properly.</p> -          <p>Own Id: -</p> -        </item> -        <item> -          <p>The cosTransactions factory now accepts <c>maxRetries</c> and  -            <c>comFailWait</c> options, which overrides the configuration parameters.</p> -          <p>Own Id: -</p> -        </item> -      </list> -    </section> - -    <section> -      <title>Incompatibilities</title> -      <list type="bulleted"> -        <item> -          <p>The configuration parameters <c>comm_failure_wait</c> and <c>max_retries</c> -            changed to <c>maxRetries</c> and <c>comFailWait</c>. The default value for  -            <c>maxRetries</c> have been raised from 20 to 40.</p> -          <p>Own Id: -</p> -        </item> -      </list> -    </section> -  </section> - -  <section> -    <title>cosTransactions 1.1</title> - -    <section> -      <title>Improvements and New Features</title> -      <list type="bulleted"> -        <item> -          <p>First release of the cosTransactions application.</p> -          <p>Own Id: OTP-1741</p> -        </item> -      </list> -    </section> -  </section> -</chapter> - diff --git a/lib/cosTransactions/doc/src/part.xml b/lib/cosTransactions/doc/src/part.xml deleted file mode 100644 index 6777d7d979..0000000000 --- a/lib/cosTransactions/doc/src/part.xml +++ /dev/null @@ -1,41 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<!DOCTYPE part SYSTEM "part.dtd"> - -<part xmlns:xi="http://www.w3.org/2001/XInclude"> -  <header> -    <copyright> -      <year>1999</year><year>2016</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. -     -    </legalnotice> - -    <title>cosTransactions User's Guide</title> -    <prepared>Niclas Eklund</prepared> -    <docno></docno> -    <date>1999-04-20</date> -    <rev>2.2</rev> -  </header> -  <description> -    <p>The <em>cosTransactions</em> application is an Erlang implementation -      of the OMG CORBA Transaction Service.</p> -  </description> -  <xi:include href="ch_contents.xml"/> -  <xi:include href="ch_introduction.xml"/> -  <xi:include href="ch_install.xml"/> -  <xi:include href="ch_example.xml"/> -  <xi:include href="ch_skeletons.xml"/> -</part> - diff --git a/lib/cosTransactions/doc/src/part_notes.xml b/lib/cosTransactions/doc/src/part_notes.xml deleted file mode 100644 index 48cc04aa4c..0000000000 --- a/lib/cosTransactions/doc/src/part_notes.xml +++ /dev/null @@ -1,37 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<!DOCTYPE part SYSTEM "part.dtd"> - -<part xmlns:xi="http://www.w3.org/2001/XInclude"> -  <header> -    <copyright> -      <year>1999</year><year>2016</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. -     -    </legalnotice> - -    <title>cosTransactions Release Notes</title> -    <prepared></prepared> -    <docno></docno> -    <date>1999-04-14</date> -    <rev>2.0</rev> -  </header> -  <description> -    <p>The cosTransactions Application is an Erlang implementation of the OMG -      CORBA Transaction Service.</p> -  </description> -  <xi:include href="notes.xml"/> -</part> - diff --git a/lib/cosTransactions/doc/src/ref_man.gif b/lib/cosTransactions/doc/src/ref_man.gifBinary files differ deleted file mode 100644 index b13c4efd53..0000000000 --- a/lib/cosTransactions/doc/src/ref_man.gif +++ /dev/null diff --git a/lib/cosTransactions/doc/src/ref_man.xml b/lib/cosTransactions/doc/src/ref_man.xml deleted file mode 100644 index 9d296967b3..0000000000 --- a/lib/cosTransactions/doc/src/ref_man.xml +++ /dev/null @@ -1,44 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<!DOCTYPE application SYSTEM "application.dtd"> - -<application xmlns:xi="http://www.w3.org/2001/XInclude"> -  <header> -    <copyright> -      <year>1999</year><year>2016</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. -     -    </legalnotice> - -    <title>cosTransactions Reference Manual</title> -    <prepared>Niclas Eklund</prepared> -    <docno></docno> -    <date>1999-04-14</date> -    <rev>2.0</rev> -  </header> -  <description> -    <p>The <em>cosTransactions</em> application is an Erlang implementation -      of the OMG CORBA Transaction Service.</p> -  </description> -  <xi:include href="cosTransactions.xml"/> -  <xi:include href="CosTransactions_Control.xml"/> -  <xi:include href="CosTransactions_Coordinator.xml"/> -  <xi:include href="CosTransactions_RecoveryCoordinator.xml"/> -  <xi:include href="CosTransactions_Resource.xml"/> -  <xi:include href="CosTransactions_SubtransactionAwareResource.xml"/> -  <xi:include href="CosTransactions_Terminator.xml"/> -  <xi:include href="CosTransactions_TransactionFactory.xml"/> -</application> - diff --git a/lib/cosTransactions/doc/src/summary.html.src b/lib/cosTransactions/doc/src/summary.html.src deleted file mode 100644 index 8fb7d6ea20..0000000000 --- a/lib/cosTransactions/doc/src/summary.html.src +++ /dev/null @@ -1 +0,0 @@ -Orber OMG Transaction Service
\ No newline at end of file diff --git a/lib/cosTransactions/doc/src/user_guide.gif b/lib/cosTransactions/doc/src/user_guide.gifBinary files differ deleted file mode 100644 index e6275a803d..0000000000 --- a/lib/cosTransactions/doc/src/user_guide.gif +++ /dev/null diff --git a/lib/cosTransactions/ebin/.gitignore b/lib/cosTransactions/ebin/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 --- a/lib/cosTransactions/ebin/.gitignore +++ /dev/null diff --git a/lib/cosTransactions/examples/Makefile b/lib/cosTransactions/examples/Makefile deleted file mode 100644 index 57a51f5932..0000000000 --- a/lib/cosTransactions/examples/Makefile +++ /dev/null @@ -1,158 +0,0 @@ -# -# %CopyrightBegin% -#  -# Copyright Ericsson AB 1999-2016. All Rights Reserved. -#  -# 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. -#  -# %CopyrightEnd% -# -# -include $(ERL_TOP)/make/target.mk - -EBIN= ../ebin - -include $(ERL_TOP)/make/$(TARGET)/otp.mk - -# ---------------------------------------------------- -# Application version -# ---------------------------------------------------- -include ../vsn.mk -VSN=$(COSTRANSACTIONS_VSN) - -# ---------------------------------------------------- -# Release directory specification -# ---------------------------------------------------- -RELSYSDIR = $(RELEASE_PATH)/lib/cosTransactions-$(VSN) - -# ---------------------------------------------------- -# Target Specs -# ---------------------------------------------------- - -INETRC_EXAMPLE = \ -#        inetrc - -IDL_FILES = \ -#        hotel.idl \ -#        travelAgency.idl - -GEN_ERL_MODULES =  \ -#        oe_travelAgency \ -#	travelAgency_book \ - -MODULES= \ -#        travelAgency_book_impl \ - -GEN_HRL_FILES = \ -#        oe_travelAgency.hrl \ -#	travelAgency_book.hrl - -HRL_FILES=  - -ERL_FILES= $(MODULES:%=%.erl) - -JAVA_CLASSES = \ -#	HotelResource - -JAVA_FILES= $(JAVA_CLASSES:%=%.java) -CLASS_FILES= $(JAVA_CLASSES:%=%.class) - -TARGET_FILES = \ -        $(GEN_ERL_MODULES:%=$(EBIN)/%.$(EMULATOR)) \ -        $(MODULES:%=$(EBIN)/%.$(EMULATOR)) - - -ifeq ($(findstring sparc-sun-solaris2, $(TARGET)),sparc-sun-solaris2) -    JAVA_TARGET=java -endif - -# ---------------------------------------------------- -# PROGRAMS -# ---------------------------------------------------- -JAVA_IDL = idl -LOCAL_CLASSPATH = $(ERL_TOP)/lib/cosTransactions/priv:$(ERL_TOP)/lib/cosTransactions/examples/java_output:$(ERL_TOP)/lib/cosTransactions/src:$(ERL_TOP)/lib/cosTransactions/examples:$(ERL_TOP)/lib/cosTransactions/examples/java_output/hotel - -# ---------------------------------------------------- -# FLAGS -# ---------------------------------------------------- -ERL_IDL_FLAGS += -pa /clearcase/otp/libraries/cosTransactions/ebin -pa /clearcase/otp/libraries/ic/ebin -# includes from other directories than ../include . -ERL_COMPILE_FLAGS += \ -	$(ERL_IDL_FLAGS) \ -	-pa /clearcase/otp/libraries/cosTransactions -I/clearcase/otp/libraries/cosTransactions -YRL_FLAGS =  - -JAVA_OPTIONS = -classpath ../priv:/opt/local/pgm/OrbixWeb2.0.1 - -# ---------------------------------------------------- -# Targets -# ---------------------------------------------------- -tests debug opt: $(TARGET_FILES) $(JAVA_TARGET) - -java: 	java_costransactions_idl java_objects  -#	java_hotel_idl - -clean:	 -	rm -f $(TARGET_FILES) $(GEN_ERL_MODULES:%=%.erl) $(GEN_HRL_FILES) $(CLASS_FILES) -	rm -rf java_costransactions_idl -	rm -rf java_output/* -	rm -f errs core *~ -#	rm -rf java_hotel_idl - -docs: - -java_costransactions_idl: -	$(JAVA_IDL) ../src/CosTransactions.idl -	@if [ -d java_output ]; then \ -		echo "compiling java classes for CosTransactions ... This will take a while!!"; \ -		CLASSPATH="${CLASSPATH}:${LOCAL_CLASSPATH}"; \ -		export CLASSPATH;\ -		(cd java_output/CosTransactions; $(JAVA) *.java;); \ -	fi -	@touch java_costransactions_idl - -#java_hotel_idl: -#	$(JAVA_IDL) hotel.idl -#	@if [ -d java_output ]; then \ -#		echo "compiling java classes for hotel ..."; \ -#		CLASSPATH="${CLASSPATH}:${LOCAL_CLASSPATH}"; \ -#		export CLASSPATH;\ -#		(cd java_output/hotel; $(JAVA) *.java;); \ -#	fi -#	@touch java_hotel_idl - -#java_objects: -#	@if [ -d java_output ]; then \ -#		echo "compiling java example files ..."; \ -#		CLASSPATH="${CLASSPATH}:${LOCAL_CLASSPATH}"; \ -#		export CLASSPATH;\ -#		$(JAVA) *.java; \ -#	fi -#	@touch java_hotel_resource - -#oe_travelAgency.erl: travelAgency.idl -#	erlc $(ERL_IDL_FLAGS) travelAgency.idl - -# ---------------------------------------------------- -# Release Target -# ----------------------------------------------------  -include $(ERL_TOP)/make/otp_release_targets.mk - - -release_spec: opt -	$(INSTALL_DIR) "$(RELSYSDIR)/examples" -	$(INSTALL_DATA) $(ERL_FILES) $(JAVA_FILES) $(IDL_FILES) "$(RELSYSDIR)/examples" -	$(INSTALL_DATA) $(INETRC_EXAMPLE) "$(RELSYSDIR)/examples" -	@tar cf - java_output | (cd $(RELSYSDIR); tar xf -) - -release_docs_spec: diff --git a/lib/cosTransactions/include/.gitignore b/lib/cosTransactions/include/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 --- a/lib/cosTransactions/include/.gitignore +++ /dev/null diff --git a/lib/cosTransactions/info b/lib/cosTransactions/info deleted file mode 100644 index e5d7c53ac0..0000000000 --- a/lib/cosTransactions/info +++ /dev/null @@ -1,2 +0,0 @@ -group: orb -short: Orber OMG Transaction Service diff --git a/lib/cosTransactions/priv/.gitignore b/lib/cosTransactions/priv/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 --- a/lib/cosTransactions/priv/.gitignore +++ /dev/null diff --git a/lib/cosTransactions/src/CosTransactions.cfg b/lib/cosTransactions/src/CosTransactions.cfg deleted file mode 100644 index 05709d21cf..0000000000 --- a/lib/cosTransactions/src/CosTransactions.cfg +++ /dev/null @@ -1,15 +0,0 @@ -{this, "CosTransactions::Coordinator"}. -{this, "CosTransactions::RecoveryCoordinator"}. -{this, "CosTransactions::Terminator"}. -{this, "CosTransactions::Control"}. -{this, "CosTransactions::Resource"}. -{this, "CosTransactions::TransactionFactory"}. -{{handle_info, "CosTransactions::Terminator"}, true}. -{{handle_info, "CosTransactions::TransactionFactory"}, true}. -{this, "ETraP::Server"}. -{{handle_info, "ETraP::Server"}, true}. -{{impl, "CosTransactions::Coordinator"}, "ETraP_Server_impl"}. -{{impl, "CosTransactions::RecoveryCoordinator"}, "ETraP_Server_impl"}. -{{impl, "CosTransactions::Control"}, "ETraP_Server_impl"}. -{{impl, "CosTransactions::Resource"}, "ETraP_Server_impl"}. -{timeout,"CosTransactions::RecoveryCoordinator"}. diff --git a/lib/cosTransactions/src/CosTransactions.idl b/lib/cosTransactions/src/CosTransactions.idl deleted file mode 100644 index 11ec5cbf5b..0000000000 --- a/lib/cosTransactions/src/CosTransactions.idl +++ /dev/null @@ -1,193 +0,0 @@ -#ifndef _COSTRANSACTIONS_IDL -#define _COSTRANSACTIONS_IDL - -#pragma prefix "omg.org" - -module CosTransactions {  - -// DATATYPES  -  enum Status {  -    StatusActive, -    StatusMarkedRollback, -    StatusPrepared, -    StatusCommitted, -    StatusRolledBack, -    StatusUnknown, -    StatusNoTransaction, -    StatusPreparing, -    StatusCommitting, -    StatusRollingBack -  };  -   -  enum Vote {  -    VoteCommit, -    VoteRollback,  -    VoteReadOnly  -  }; - -  // Forward references for interfaces defined later in module  -  interface Control;  -  interface Terminator;  -  interface Coordinator;  -  interface Resource;  -  interface RecoveryCoordinator;  -  interface SubtransactionAwareResource;  -  interface TransactionFactory; -  interface TransactionalObject;  -  //  interface Synchronization; - -  // Structure definitions -  struct otid_t { -    long formatID; /*format identifier. 0 is OSI TP */ -    long bqual_length; -    sequence <octet> tid; -  }; -  struct TransIdentity { -    Coordinator coord; -    Terminator term; -    otid_t otid; -  }; -  struct PropagationContext { -    unsigned long timeout; -    TransIdentity current; -    sequence <TransIdentity> parents; -    any implementation_specific_data; -  }; -  //  interface Current; -   -  // Standard exceptions -  // Defined in orber/include/corba.hrl -  //  exception TransactionRequired {}; -  //  exception TransactionRolledBack {}; -  //  exception InvalidTransaction {}; -   -  // Heuristic exceptions -  exception HeuristicRollback {};  -  exception HeuristicCommit {};  -  exception HeuristicMixed {};  -  exception HeuristicHazard {};  - -  // Exception from Orb operations -  exception WrongTransaction {}; - -  // Other transaction-specific exceptions  -  exception SubtransactionsUnavailable {};  -  exception NotSubtransaction {};  -  exception Inactive {};  -  exception NotPrepared {};  -  exception NoTransaction {};  -  exception InvalidControl {};  -  exception Unavailable {};  -  exception SynchronizationUnavailable {}; - -  interface TransactionFactory {  -    Control create(in unsigned long time_out);  -    Control recreate(in PropagationContext ctx);  -  };  -   -  interface Control {  -    Terminator get_terminator()  -      raises(Unavailable);  -    Coordinator get_coordinator()  -      raises(Unavailable);  -  };  -   -  interface Terminator { -    void commit(in boolean report_heuristics)  -      raises( HeuristicMixed,  -	      HeuristicHazard );  -    void rollback();  -  };  -   -  interface Coordinator { - -    Status get_status(); -    Status get_parent_status(); -    Status get_top_level_status(); - -    boolean is_same_transaction(in Coordinator tc); -    boolean is_related_transaction(in Coordinator tc); -    boolean is_ancestor_transaction(in Coordinator tc); -    boolean is_descendant_transaction(in Coordinator tc); -    boolean is_top_level_transaction(); -     -    unsigned long hash_transaction(); -    unsigned long hash_top_level_tran(); -     -    RecoveryCoordinator register_resource(in Resource r) -      raises(Inactive); -     -//     void register_synchronization (in Synchronization sync) -//       raises(Inactive, SynchronizationUnavailable); -     -    void register_subtran_aware(in SubtransactionAwareResource r) -      raises(Inactive, NotSubtransaction); -     -    void rollback_only() -      raises(Inactive); -     -    string get_transaction_name(); -    Control create_subtransaction() -      raises(SubtransactionsUnavailable, Inactive); - -    PropagationContext get_txcontext () -      raises(Unavailable); -  }; - - -  interface RecoveryCoordinator {  -    Status replay_completion(in Resource r)  -      raises(NotPrepared);  -  };  -   -  interface Resource {  -    Vote prepare() -      raises(HeuristicMixed, -	     HeuristicHazard); -    void rollback()  -      raises( HeuristicCommit,  -	      HeuristicMixed,  -	      HeuristicHazard );  -    void commit()  -      raises( NotPrepared,  -	      HeuristicRollback,  -	      HeuristicMixed,  -	      HeuristicHazard );  -    void commit_one_phase()  -      raises( HeuristicHazard, -	      HeuristicRollback,  -	      HeuristicMixed);  -    void forget();  -  };  -   -//   interface TransactionalObject {  -//   };  -   -//   interface Synchronization : TransactionalObject { -//     void before_completion(); -//     void after_completion(in CosTransactions::Status status); -//   }; - -  interface SubtransactionAwareResource : Resource { -    void commit_subtransaction(in Coordinator parent);  -    void rollback_subtransaction();  -  };  -  -}; // End of CosTransactions Module - -module ETraP {  - -  // interface Server -    interface Server : -	CosTransactions::Coordinator, CosTransactions::Resource, -	CosTransactions::RecoveryCoordinator, CosTransactions::Control { -    }; -//     interface Server : -// 	CosTransactions::Coordinator, CosTransactions::Resource, -// 	CosTransactions::RecoveryCoordinator, CosTransactions::Control, -// 	CosTransactions::Synchronization { -//     }; -     -}; // End of ETraP Module - -#endif diff --git a/lib/cosTransactions/src/CosTransactions_Terminator_impl.erl b/lib/cosTransactions/src/CosTransactions_Terminator_impl.erl deleted file mode 100644 index d995eb64e4..0000000000 --- a/lib/cosTransactions/src/CosTransactions_Terminator_impl.erl +++ /dev/null @@ -1,363 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%%  -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%%  -%% 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. -%%  -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File    : CosTransactions_Terminator_impl.erl -%% Purpose : Support operations to commit or roll-back a transaction. -%%---------------------------------------------------------------------- - --module('CosTransactions_Terminator_impl'). - -%%--------------- INCLUDES ----------------------------------- --include_lib("orber/include/corba.hrl"). -%% Local --include_lib("ETraP_Common.hrl"). --include_lib("CosTransactions.hrl"). - -%%--------------- IMPORTS------------------------------------- --import(etrap_logmgr, [log_safe/2, get_next/2]). - -%%--------------- EXPORTS------------------------------------- -%%-compile(export_all). --export([commit/3, rollback/2]). --export([init/1, terminate/2]). --export([handle_call/3, handle_cast/2, handle_info/2, code_change/3]). - -%%--------------- LOCAL DATA --------------------------------- -%-record(terminator, {reg_resources, rollback_only, regname, coordinator}). - -%%------------------------------------------------------------ -%% function : init, terminate -%% Arguments:  -%% Returns  :  -%% Effect   : Functions demanded by the module ic. Used to initiate -%%            and terminate a gen_server. -%%------------------------------------------------------------ - -init(State) -> -    process_flag(trap_exit,true), -    case catch start_object(State) of -	{'EXIT', Reason} -> -	    %% Happens when, for example, we encounter an  -	    %% error when reading from the log file. -	    {stop, Reason}; -	Other -> -	    Other -    end. - -start_object(State) -> -    case catch file:read_file_info(?tr_get_terminator(State)) of -	{error, enoent} ->  -	    %% File does not exist. It's the first time. No restart. -	    ?debug_print("Terminator:init(~p)~n", [?tr_get_terminator(State)]), -	    etrap_logmgr:start(?tr_get_terminator(State)), -	    {ok, State, ?tr_get_timeout(State)}; -	{error, Reason} -> % File exist but error occurred. -	    ?tr_error_msg("CosTransactions_Terminator( ~p ) Cannot open log file: ~p~n", -			  [?tr_get_terminator(State), Reason]), -	    {stop, {error, "unable_to_open_log"}}; -	_ -> % File exists, perform restart. -	    etrap_logmgr:start(?tr_get_terminator(State)), -	    ?debug_print("RESTART Terminator:init(~p)~n",  -			 [?tr_get_terminator(State)]), -	    do_restart(State, get_next(?tr_get_terminator(State), start), init) -    end. - - -terminate(Reason, State) -> -    ?debug_print("STOP ~p   ~p~n", [?tr_get_terminator(State), Reason]), -    case Reason of -	normal ->  -	    %% normal termination. Transaction completed.  -	    log_safe(?tr_get_terminator(State), done), -	    etrap_logmgr:stop(?tr_get_terminator(State)), -	    file:delete(?tr_get_terminator(State)), -	    ok; -	_ -> -	    ok -    end. - -%%------------------------------------------------------------ -%% function : handle_call, handle_cast, handle_info, code_change -%% Arguments:  -%% Returns  :  -%% Effect   : Functions demanded by the module ic.  -%%------------------------------------------------------------ - -code_change(_OldVsn, State, _Extra) -> -    {ok, State}. - -handle_call(_,_, State) -> -    {noreply, State}. - - -handle_cast(_, State) -> -    {noreply, State}. -     - -handle_info(Info, State) -> -    ?debug_print("Terminator:handle_info(~p)~n", [Info]), -    Pid = self(), -    case Info of -	timeout -> -	    ?tr_error_msg("Object( ~p ) timeout. Rolling back.~n", -			  [?tr_get_terminator(State)]), -            {stop, normal, State}; -        {suicide, Pid} -> -            {stop, normal, State}; -        _-> -            {noreply, State} -    end. - -%%------------------------------------------------------------ -%% function : commit -%% Arguments: Self  - its own object reference. -%%            State - Gen-Server State -%%            Heuristics - boolean; report heuristic decisions? -%% Returns  : ok - equal to void -%% Effect   :  -%% Exception: HeuristicMixed  - Highest priority -%%            HeuristicHazard - Lowest  priority -%%------------------------------------------------------------ - -commit(_Self, State, _Heuristics) when ?tr_is_retransmit(State) -> -    ?debug_print("Terminator:commit() recalled.~n", []), -    {stop, normal, ?tr_get_reportH(State), State}; -commit(Self, State, Heuristics) -> -    ?debug_print("Terminator:commit() called.~n", []), -    NewState = ?tr_set_reportH(State, Heuristics), -    log_safe(?tr_get_terminator(NewState), {init_commit, NewState}), -    transmit(Self, NewState, Heuristics). - - -transmit(Self, State, Heuristics) -> -    case catch 'ETraP_Common':try_timeout(?tr_get_alarm(State)) of -        false -> -%	    catch 'ETraP_Server':before_completion(?tr_get_etrap(State)), -	    case catch 'CosTransactions_Resource':prepare(?tr_get_etrap(State)) of -		'VoteCommit' -> -		    evaluate_answer(Self, State, Heuristics,  -				    'ETraP_Common':try_timeout(?tr_get_alarm(State))); -		'VoteRollback' -> -		    {stop, normal,  -		     {'EXCEPTION',  -		      #'TRANSACTION_ROLLEDBACK'{completion_status=?COMPLETED_YES}},  -		     State}; -		'VoteReadOnly' -> -		    {stop, normal, ok, State}; -		{'EXCEPTION', E} when is_record(E,'CosTransactions_HeuristicMixed'), -				      Heuristics==true-> -		    catch 'ETraP_Server':forget(?tr_get_etrap(State)), -		    {stop, normal, {'EXCEPTION', E}, State}; -		{'EXCEPTION', E} when is_record(E,'CosTransactions_HeuristicHazard'), -				      Heuristics==true-> -		    catch 'ETraP_Server':forget(?tr_get_etrap(State)), -		    {stop, normal, {'EXCEPTION', E}, State}; -		{'EXCEPTION', E} when is_record(E,'CosTransactions_HeuristicMixed') -> -		    catch 'ETraP_Server':forget(?tr_get_etrap(State)), -		    {stop, normal,  -		     {'EXCEPTION',#'TRANSACTION_ROLLEDBACK'{completion_status=?COMPLETED_YES}}, -		     State}; -		{'EXCEPTION', E} when is_record(E,'CosTransactions_HeuristicHazard') -> -		    catch 'ETraP_Server':forget(?tr_get_etrap(State)), -		    {stop, normal,  -		     {'EXCEPTION', #'TRANSACTION_ROLLEDBACK'{completion_status=?COMPLETED_YES}}, -		     State}; -		Other -> -		    ?tr_error_msg("Coordinator:prepare( ~p ) failed. REASON ~p~n",  -				  [?tr_get_etrap(State), Other]), -		    {stop, normal,  -		     {'EXCEPTION',  -		      #'TRANSACTION_ROLLEDBACK'{completion_status=?COMPLETED_YES}},  -		     State} -	    end; -	_ -> -	    %% Timeout, rollback. -	    log_safe(?tr_get_terminator(State), rolled_back), -	    catch 'ETraP_Server':rollback(?tr_get_etrap(State)), -%	    catch 'ETraP_Server':after_completion(?tr_get_etrap(State), -%						  'StatusRolledBack'), -	    {stop, normal,  -	     {'EXCEPTION', #'TRANSACTION_ROLLEDBACK'{completion_status=?COMPLETED_YES}},  -	     State} -    end. - -evaluate_answer(Self, State, Heuristics, false) -> -    evaluate_answer(Self, State, Heuristics, commit); -evaluate_answer(Self, State, Heuristics, true) -> -    evaluate_answer(Self, State, Heuristics, rollback); -evaluate_answer(_Self, State, Heuristics, Vote) -> -    case catch 'ETraP_Common':send_stubborn('ETraP_Server', Vote,  -					    ?tr_get_etrap(State),  -					    ?tr_get_maxR(State),  -					    ?tr_get_maxW(State)) of -	ok -> -	    ?eval_debug_fun({_Self, commit_ok1}, State), -	    log_safe(?tr_get_terminator(State), committed), -	    ?eval_debug_fun({_Self, commit_ok2}, State), -%	    catch 'ETraP_Server':after_completion(?tr_get_etrap(State), -%						  'StatusCommitted'), -	    {stop, normal, ok, State}; -	{'EXCEPTION', E} when Heuristics == true andalso -			      is_record(E,'CosTransactions_HeuristicMixed') -> -	    log_safe(?tr_get_terminator(State), {heuristic, State, E}), -	    ?eval_debug_fun({_Self, commit_heuristic1}, State), -	    catch 'ETraP_Server':forget(?tr_get_etrap(State)), -%	    catch 'ETraP_Server':after_completion(?tr_get_etrap(State), -%						  'StatusRolledBack'), -	    {stop, normal, {'EXCEPTION', E}, State}; -	{'EXCEPTION', E} when Heuristics == true andalso -			      is_record(E, 'CosTransactions_HeuristicHazard') -> -	    log_safe(?tr_get_terminator(State), {heuristic, State, E}), -	    catch 'ETraP_Server':forget(?tr_get_etrap(State)), -%	    catch 'ETraP_Server':after_completion(?tr_get_etrap(State), -%						  'StatusRolledBack'), -	    {stop, normal, {'EXCEPTION', E}, State}; -	{'EXCEPTION', E} when is_record(E, 'OBJECT_NOT_EXIST') -> -	    log_safe(?tr_get_terminator(State), rolled_back), -	    {stop, normal, {'EXCEPTION', ?tr_hazard}, State}; -	{'EXCEPTION', E} when is_record(E, 'TRANSACTION_ROLLEDBACK') -> -	    log_safe(?tr_get_terminator(State), rolled_back), -%	    catch 'ETraP_Server':after_completion(?tr_get_etrap(State), -%						  'StatusRolledBack'), -	    {stop, normal, {'EXCEPTION', E}, State}; -	{'EXCEPTION', E} when is_record(E, 'CosTransactions_HeuristicCommit') -> -	    catch 'ETraP_Server':forget(?tr_get_etrap(State)), -%	    catch 'ETraP_Server':after_completion(?tr_get_etrap(State), -%						  'StatusRolledBack'), -	    {stop, normal, ok, State}; -	{'EXCEPTION', E} when is_record(E, 'CosTransactions_HeuristicRollback') -> -	    catch 'ETraP_Server':forget(?tr_get_etrap(State)), -%	    catch 'ETraP_Server':after_completion(?tr_get_etrap(State), -%						  'StatusCommitted'), -	    {stop, normal,  -	     {'EXCEPTION',  -	      #'TRANSACTION_ROLLEDBACK'{completion_status=?COMPLETED_YES}},  -	     State}; -	_Other when Heuristics == true -> -	    log_safe(?tr_get_terminator(State), rolled_back), -%	    catch 'ETraP_Server':after_completion(?tr_get_etrap(State), -%						  'StatusRolledBack'), -	    {stop, normal, {'EXCEPTION', ?tr_hazard}, State}; -	_Other -> -	    log_safe(?tr_get_terminator(State), rolled_back), -%	    catch 'ETraP_Server':after_completion(?tr_get_etrap(State), -%						  'StatusRolledBack'), -	    {stop, normal, ok, State} -    end. - -%%-----------------------------------------------------------% -%% function : rollback -%% Arguments: Self  - its own object reference. -%%            State - Gen-Server State -%% Returns  : ok - equal to void -%% Effect   :  -%%------------------------------------------------------------ - -rollback(_Self, State) -> -    ?debug_print("Terminator:rollback() called.~n", []), -    log_safe(?tr_get_terminator(State), rolled_back), -    catch 'ETraP_Server':rollback(?tr_get_etrap(State)), -    {stop, normal, ok, State}. - -%%-----------------------------------------------------------% -%% function : do_restart -%% Arguments: State - server context -%% Returns  :  -%% Effect   :  -%%------------------------------------------------------------ - -%% No data in file. Commit never initiated so we rollback (presumed rollback. -do_restart(State, eof, init) ->  -    log_safe(?tr_get_terminator(State), rolled_back), -    catch 'ETraP_Server':rollback(?tr_get_etrap(State)), -%    catch 'ETraP_Server':after_completion(?tr_get_etrap(State),  'StatusRolledBack'), -    self() ! {suicide, self()}, -    {ok, State}; - -do_restart(State, {error, Reason}, _) -> -    ?tr_error_msg("CosTransactions_Terminator (~p) failed. Cannot read log file: ~p~n", -		  [?tr_get_terminator(State), Reason]), -    {stop, Reason}; -do_restart(State, eof, Phase) -> -    ?debug_print("Terminator:do_restart(~p)~n", [Phase]), -    case Phase of -	committed -> -	    {ok, ?tr_set_reportH(State, ok)}; -	rolled_back -> -	    self() ! {suicide, self()}, -	    {ok, State}; -        init_commit -> -	    case catch corba_object:non_existent(?tr_get_etrap(State)) of -		true -> -		    self() ! {suicide, self()}, -		    {ok, State}; -		_-> -		    case transmit(false, State, ?tr_get_reportH(State)) of -			{stop, normal, ok, NewState} -> -			    {ok, NewState}; -			{stop, normal,  -			 {'EXCEPTION', #'TRANSACTION_ROLLEDBACK'{completion_status=?COMPLETED_YES}},  -			 NewState} -> -			    self() ! {suicide, self()}, -			    {ok, NewState}; -			{stop, normal, {'EXCEPTION', Exc}, NewState} -> -			    if -				?tr_dont_reportH(State) -> -				    self() ! {suicide, self()}, -				    {ok, NewState}; -				true -> -				    {ok, ?tr_set_reportH(NewState, Exc)} -			    end -		    end -	    end; -        {heuristic, Exc} -> -	    catch 'ETraP_Server':forget(?tr_get_etrap(State)), -%	    catch 'ETraP_Server':after_completion(?tr_get_etrap(State), -%						  'StatusRolledBack'), -	    if -		?tr_dont_reportH(State) -> -		    self() ! {suicide, self()}, -		    {ok, State}; -		true -> -		    {ok, ?tr_set_reportH(State, {'EXCEPTION',Exc})} -	    end -    end; -%% All done. -do_restart(State, {done, _Cursor}, _Phase) -> -    ?debug_print("Terminator:do_restart(~p)~n", [_Phase]), -    self() ! {suicide, self()}, -    {ok, State}; -do_restart(State, {rolled_back, Cursor}, _Phase) -> -    ?debug_print("Terminator:do_restart(~p)~n", [_Phase]), -    do_restart(State, get_next(?tr_get_terminator(State), Cursor), rolled_back); -do_restart(State, {committed, Cursor}, _Phase) -> -    ?debug_print("Terminator:do_restart(~p)~n", [_Phase]), -    do_restart(State, get_next(?tr_get_terminator(State), Cursor), committed); -do_restart(State, {{heuristic, SavedState, Exc}, Cursor}, _Phase) -> -    ?debug_print("Terminator:do_restart(~p)~n", [_Phase]), -    do_restart(SavedState, get_next(?tr_get_terminator(State), Cursor),  -	       {heuristic, Exc}); -do_restart(State, {{init_commit, SavedState}, Cursor}, _) -> -    ?debug_print("Terminator:do_restart(~p)~n", [init_commit]), -    do_restart(SavedState, get_next(?tr_get_terminator(State), Cursor), init_commit). - -%%--------------- END OF MODULE ------------------------------ diff --git a/lib/cosTransactions/src/CosTransactions_TransactionFactory_impl.erl b/lib/cosTransactions/src/CosTransactions_TransactionFactory_impl.erl deleted file mode 100644 index e24bcb9a04..0000000000 --- a/lib/cosTransactions/src/CosTransactions_TransactionFactory_impl.erl +++ /dev/null @@ -1,180 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%%  -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%%  -%% 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. -%%  -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File    : CosTransactions_TransactionFactory_impl.erl -%% Purpose : Is provided to allow the transaction originator to begin -%%           a transaction. -%%---------------------------------------------------------------------- - --module('CosTransactions_TransactionFactory_impl'). - -%%--------------- INCLUDES ----------------------------------- --include_lib("orber/include/corba.hrl"). - -%% Local --include_lib("ETraP_Common.hrl"). --include_lib("CosTransactions.hrl"). -%%--------------- IMPORTS------------------------------------- --import('ETraP_Common', [get_option/3]). - -%%--------------- EXPORTS------------------------------------- --export([create/3, recreate/3, init/1, terminate/2]). --export([handle_call/3, handle_cast/2, handle_info/2, code_change/3]). - -%%--------------- LOCAL DATA --------------------------------- --record(factory, {hashMax, subtrOK, typeCheck, maxRetries, comFailWait}). - -%%--------------- LOCAL DEFINITIONS -------------------------- - -%%------------------------------------------------------------ -%% function : init -%% Arguments:  -%% Returns  :  -%% Effect   : Functions demanded by the module ic. Used to initiate -%%            a gen_server. -%%------------------------------------------------------------ - -init(Options) when is_list(Options) -> -    ?debug_print("Factory:init(~p)~n", [Options]), -    process_flag(trap_exit,true), -    DefaultValues  = [{maxRetries, ?tr_max_retries}, -		     {comFailWait, ?tr_comm_failure_wait}|?tr_FAC_DEF], -    Hash           = get_option(hash_max, Options, DefaultValues), -    SubtrOK        = get_option(allow_subtr, Options, DefaultValues), -    TypeCheck      = get_option(typecheck, Options, DefaultValues), -    TTY            = get_option(tty, Options, DefaultValues), -    LogFile        = get_option(logfile, Options, DefaultValues), -    MaxRetries     = get_option(maxRetries, Options, DefaultValues), -    ComFailWait    = get_option(comFailWait, Options, DefaultValues), -    error_logger:tty(TTY), -    case LogFile of -	false -> -	    ok; -	_-> -	    error_logger:logfile({open, LogFile}) -    end, -    {ok, #factory{typeCheck = TypeCheck, hashMax = Hash, subtrOK = SubtrOK, -		  maxRetries = MaxRetries, comFailWait = ComFailWait}}; - -init(Options) -> -    ?tr_error_msg("TransactionFactory~nBad argument: ~p~n", [Options]), -    corba:raise(?tr_badparam). -     - -%%------------------------------------------------------------ -%% function : terminate -%% Arguments:  -%% Returns  :  -%% Effect   : Function demanded by the module ic. Used to  -%%            terminate a gen_server. -%%------------------------------------------------------------ - -terminate(_Reason, _State) -> -    ?debug_print("Factory:terminate(~p)~n", [_Reason]), -    ok. - -%%------------------------------------------------------------ -%% function : handle_call, handle_cast, handle_info, code_change -%% Arguments:  -%% Returns  :  -%% Effect   : Functions demanded by the module ic.  -%%------------------------------------------------------------ - -code_change(_OldVsn, State, _Extra) -> -    {ok, State}. - -handle_call(_,_, State) -> -    {noreply, State}. - - -handle_cast(_, State) -> -    {noreply, State}. -     - -handle_info({'EXIT',_From,shutdown}, State) -> -    ?debug_print("Factory:handle_info(~p)~n", [shutdown]), -    {stop, shutdown, State}; -handle_info(_Info, State) -> -    ?debug_print("Factory:handle_info(~p)~n", [_Info]), -    {noreply, State}. - -%%------------------------------------------------------------ -%% function : create -%% Arguments: TimeOut - rollback the transaction after TimeOut  -%%            seconds. If 0 no timeout. -%% Returns  : a Control object -%% Effect   : Creates a new top-level transaction. The Control -%%            can be used to manage or control participation -%%            in the new transaction. Used for direct context -%%            management. -%%------------------------------------------------------------ - -create(_Self, State, TimeOut) when is_integer(TimeOut) -> -    %% Generate objectnames. -    ETraPName    = 'ETraP_Common':create_name("root"), -    TermName     = 'ETraP_Common':create_name("term"), -    EState       = ?tr_create_context(ETraPName, TermName, -				      State#factory.typeCheck,  -				      State#factory.hashMax,  -				      State#factory.subtrOK, -				      State#factory.maxRetries, -				      State#factory.comFailWait), - -    case TimeOut of -	0 -> -	    ETraP = ?tr_start_child(?SUP_ETRAP(EState)), -	    {reply, ETraP, State}; -	_ -> -	    if -		TimeOut > 0 -> -		    TimeStampSec = erlang:monotonic_time(seconds), -		    EState2 = ?tr_set_alarm(EState, TimeStampSec+TimeOut), -		    EState3 = ?tr_set_timeout(EState2, TimeOut*1000), -		    ETraP = ?tr_start_child(?SUP_ETRAP(EState3)), -		    {reply, ETraP, State}; -		true -> -		    ?tr_error_msg("TransactionFactory:create( Integer >= 0 )~nBad argument. Not an integer.~n", []), -		    corba:raise(?tr_badparam) -	    end -    end; - -create(_Self, _State, _TimeOut) -> -    ?tr_error_msg("TransactionFactory:create( Integer >= 0 )~nBad argument. Not an integer.~n", []), -    corba:raise(?tr_badparam). - - -%%------------------------------------------------------------ -%% function : recreate -%% Arguments: PropagationContext -%% Returns  : a Control object -%% Effect   :  -%%------------------------------------------------------------ - --spec recreate(_, _, _) -> no_return(). -recreate(_Self, _State, #'CosTransactions_PropagationContext'{current = _C}) -> -    corba:raise(#'NO_IMPLEMENT'{completion_status=?COMPLETED_YES}). -%recreate(Self, State, #'CosTransactions_PropagationContext'{current = C}) -> -%    {reply, C#'CosTransactions_TransIdentity'.coord, State}. - - -%%--------------- END OF MODULE ------------------------------ - diff --git a/lib/cosTransactions/src/ETraP_Common.erl b/lib/cosTransactions/src/ETraP_Common.erl deleted file mode 100644 index a5f2bf4831..0000000000 --- a/lib/cosTransactions/src/ETraP_Common.erl +++ /dev/null @@ -1,187 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%%  -%% Copyright Ericsson AB 1999-2015. All Rights Reserved. -%%  -%% 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. -%%  -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File    : ETraP_Common.erl -%% Purpose :  -%%---------------------------------------------------------------------- - --module('ETraP_Common'). - -%%--------------- INCLUDES ---------------------------------- --include_lib("orber/include/corba.hrl"). --include_lib("orber/include/ifr_types.hrl"). -%% Local --include_lib("ETraP_Common.hrl"). --include_lib("CosTransactions.hrl"). - -%%--------------- EXPORTS ----------------------------------- --export([try_timeout/1,  -	 get_option/3,  -	 create_name/2,  -	 create_name/1, -	 is_debug_compiled/0, -	 send_stubborn/5, -	 create_link/3]). - -%%--------------- DEFINITIONS OF CONSTANTS ------------------ -%%------------------------------------------------------------ -%% function : create_link -%% Arguments: Module - which Module to call -%%            Env/ARgList - ordinary oe_create arguments. -%% Returns  :  -%% Exception:  -%% Effect   : Necessary since we want the supervisor to be a  -%%            'simple_one_for_one'. Otherwise, using for example, -%%            'one_for_one', we have to call supervisor:delete_child -%%            to remove the childs startspecification from the  -%%            supervisors internal state. -%%------------------------------------------------------------ -create_link(Module, Env, ArgList) -> -    Module:oe_create_link(Env, ArgList). - -%%------------------------------------------------------------ -%% function : get_option -%% Arguments:  -%% Returns  :  -%% Exception:  -%% Effect   :  -%%------------------------------------------------------------ - -get_option(Key, OptionList, DefaultList) -> -    case lists:keysearch(Key, 1, OptionList) of -        {value,{Key,Value}} -> -            Value; -        _ -> -            case lists:keysearch(Key, 1, DefaultList) of -                {value,{Key,Value}} -> -                    Value; -                _-> -                    {error, "Invalid option"} -            end -    end. -%%------------------------------------------------------------ -%% function : create_name/2 -%% Arguments:  -%% Returns  :  -%% Exception:  -%% Effect   :  -%%------------------------------------------------------------ -  -create_name(Name,Type) -> -    Time = erlang:system_time(), -    Unique = erlang:unique_integer([positive]), -    lists:concat(['oe_',node(),'_',Type,'_',Name,'_',Time,'_',Unique]). -  -%%------------------------------------------------------------ -%% function : create_name/1 -%% Arguments:  -%% Returns  :  -%% Exception:  -%% Effect   :  -%%------------------------------------------------------------ -  -create_name(Type) -> -    Time = erlang:system_time(), -    Unique = erlang:unique_integer([positive]), -    lists:concat(['oe_',node(),'_',Type,'_',Time,'_',Unique]). - -%%------------------------------------------------------------ -%% function : try_timeout -%% Arguments: Id - name of the timeoutSrv server. -%% Returns  : Boolean -%% Exception:  -%% Effect   :  -%%------------------------------------------------------------ - -try_timeout(TimeoutAt) -> -    case TimeoutAt of -	infinity -> -	    false; -	_-> -	    TimeSec = erlang:monotonic_time(seconds), -	    if  -		TimeSec < TimeoutAt -> -		    false; -		true -> -		    true -	    end -    end. - -%%------------------------------------------------------------ -%% function : send_stubborn -%% Arguments: M - module -%%            F - function -%%            A - arguments -%%            MaxR - Maximum no retries -%%            Wait - sleep Wait seconds before next try. -%% Returns  : see effect -%% Exception:  -%% Effect   : Retries repeatedly until anything else besides -%%            'EXIT', 'COMM_FAILURE' or 'OBJECT_NOT_EXIST' -%%------------------------------------------------------------ - -send_stubborn(M, F, A, MaxR, Wait) when is_list(A) -> -    send_stubborn(M, F, A, MaxR, Wait, 0); -send_stubborn(M, F, A, MaxR, Wait) -> -    send_stubborn(M, F, [A], MaxR, Wait, 0). -send_stubborn(M, F, A, MaxR, _Wait, MaxR) -> -    ?tr_error_msg("~p:~p( ~p ) failed!! Tried ~p times.~n", [M,F,A,MaxR]), -    corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}); -send_stubborn(M, F, A, MaxR, Wait, Times) -> -    ?debug_print("~p:~p(~p)  # of retries: ~p~n", [M,F,A, Times]),     -    case catch apply(M,F,A) of -	{'EXCEPTION', E} when is_record(E, 'COMM_FAILURE')-> -	    NewTimes = Times +1, -	    timer:sleep(Wait), -	    send_stubborn(M, F, A, MaxR, Wait, NewTimes); -	{'EXCEPTION', E} when is_record(E, 'TRANSIENT')-> -	    NewTimes = Times +1, -	    timer:sleep(Wait), -	    send_stubborn(M, F, A, MaxR, Wait, NewTimes); -	{'EXCEPTION', E} when is_record(E, 'TIMEOUT')-> -	    NewTimes = Times +1, -	    timer:sleep(Wait), -	    send_stubborn(M, F, A, MaxR, Wait, NewTimes); -	{'EXIT', _} -> -	    NewTimes = Times +1, -	    timer:sleep(Wait), -	    send_stubborn(M, F, A, MaxR, Wait, NewTimes); -	Other -> -	    ?debug_print("~p:~p(~p) Resulted in: ~p~n", [M,F,A, Other]),     -	    Other -    end. - -%%------------------------------------------------------------ -%% function : is_debug_compiled -%% Arguments:  -%% Returns  :  -%% Exception:  -%% Effect   :  -%%------------------------------------------------------------ - --ifdef(debug). -    is_debug_compiled() -> true. --else. -    is_debug_compiled() -> false. --endif. - -%%--------------- END OF MODULE ------------------------------ diff --git a/lib/cosTransactions/src/ETraP_Common.hrl b/lib/cosTransactions/src/ETraP_Common.hrl deleted file mode 100644 index 906e984a5b..0000000000 --- a/lib/cosTransactions/src/ETraP_Common.hrl +++ /dev/null @@ -1,341 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% 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. -%% -%% %CopyrightEnd% -%% -%% -%%--------------------------------------------------------------------- -%% File    : ETraP_Common.hrl -%% Purpose :  -%%--------------------------------------------------------------------- - --ifndef(ETRAP_COMMON_HRL). --define(ETRAP_COMMON_HRL, true). - -%%--------------- INCLUDES --------------------------------------------- --include_lib("orber/include/corba.hrl"). --include_lib("cosTransactions/include/CosTransactions.hrl"). - -%%-------- CONSTANTS --------------------------------------------------- -%% Timeouts --define(tr_comm_failure_wait,  -	case catch application:get_env(cosTransactions, comFailWait) of -	    {ok, _Time} when is_integer(_Time) -> -		_Time; -	    _ -> -		5000 -	end). - --define(tr_max_retries,  -	case catch application:get_env(cosTransactions, maxRetries) of -	    {ok, _Max} when is_integer(_Max) -> -		_Max; -	    _ -> -		40 -	end).  - -%% Exceptions -% Heuristic --define(tr_mixed,  -	#'CosTransactions_HeuristicMixed' {}). --define(tr_hazard,  -	#'CosTransactions_HeuristicHazard' {}). --define(tr_commit,  -	#'CosTransactions_HeuristicCommit' {}). --define(tr_rollback,  -	#'CosTransactions_HeuristicRollback' {}). -%% Standard --define(tr_subunavailable, -	#'CosTransactions_SubtransactionsUnavailable' {}). --define(tr_unavailable, -	#'CosTransactions_Unavailable' {}). --define(tr_unprepared,  -	#'CosTransactions_NotPrepared' {}). --define(tr_inactive,  -	#'CosTransactions_Inactive' {}). --define(tr_nosync, -	#'CosTransactions_SynchronizationUnavailable' {}). --define(tr_badparam,  -	#'BAD_PARAM'{completion_status=?COMPLETED_NO}). --define(tr_NotSubtr, -	#'CosTransactions_NotSubtransaction' {}). - -%% TypeID:s --define(tr_Terminator,  -	'CosTransactions_Terminator':typeID()). --define(tr_Coordinator,  -	'CosTransactions_Coordinator':typeID()). --define(tr_Control,  -	'CosTransactions_Control':typeID()). --define(tr_RecoveryCoordinator,  -	'CosTransactions_RecoveryCoordinator':typeID()). --define(tr_SubtransactionAwareResource, -	'CosTransactions_SubtransactionAwareResource':typeID()). --define(tr_Synchronization, -	'CosTransactions_Synchronization':typeID()). --define(tr_Resource,  -	'CosTransactions_Resource':typeID()). --define(tr_ETraP,  -	'ETraP_Server':typeID()). --define(tr_TransactionalObject,  -	'CosTransactions_TransactionalObject':typeID()). - - -%%-------- MISC -------------------------------------------------------- - --define(tr_error_msg(Txt, Arg), -error_logger:error_msg("============ CosTransactions ==============~n" -		       Txt -		       "===========================================~n", -		       Arg)). - - --define(tr_NIL_OBJ_REF, corba:create_nil_objref()). - --define(tr_FAC_DEF, [{hash_max, 1013}, -		     {allow_subtr, true}, -		     {typecheck, true}, -		     {tty, false}, -		     {logfile, false}]). - - -%%-------- Supervisor child-specs ------------------------------------ --define(FACTORY_NAME,    oe_cosTransactionsFactory). --define(SUPERVISOR_NAME, cosTransactions_sup). --define(SUP_FLAG,        {simple_one_for_one,50,10}). - --define(SUP_FAC(Env),  -	['CosTransactions_TransactionFactory',Env,  -	 [{sup_child, true}, {regname, {local, ?FACTORY_NAME}}]]). - --define(SUP_ETRAP(Env),  -	['ETraP_Server', Env,  -	 [{sup_child, true}, {persistent, true},  -	  {regname, {global, ?tr_get_etrap(Env)}}]]). - --define(SUP_TERMINATOR(Env), -	['CosTransactions_Terminator', Env,  -	 [{sup_child, true}, {persistent, true},  -	  {regname, {global, ?tr_get_etrap(Env)}}]]). - --define(SUP_CHILD,  -	{"oe_child", -	 {'ETraP_Common',create_link, []}, -	  transient,100000,worker, -	 ['ETraP_Common', -	  'ETraP_Server_impl',  -	  'ETraP_Server', -	  'CosTransactions_Terminator_impl',  -	  'CosTransactions_Terminator', -	  'CosTransactions_TransactionFactory_impl',  -	  'CosTransactions_TransactionFactory']}). - - --define(tr_start_child(SPEC), -	case supervisor:start_child(?SUPERVISOR_NAME, SPEC) of -            {ok, Pid, Obj} when is_pid(Pid) -> -		Obj; -            _Other-> -		corba:raise(?tr_badparam) -        end). - --define(tr_start_child_pid(SPEC), -	supervisor:start_child(?SUPERVISOR_NAME, SPEC)). - --define(tr_terminate_child(Child), -	supervisor:terminate_child(?SUPERVISOR_NAME, Child)). - --define(tr_delete_child(Child), -	supervisor:delete_child(?SUPERVISOR_NAME, Child)). - -%%-------- DATASTRUCTURES ---------------------------------------------- -%% tr_*_*  --record(context, {terminator, etrap, recCoord, alarm = infinity,  -		  timeout = infinity, parents=[], trid, typeCheck, -		  sub_tr_allowed, hashMax, local, rollback=false, -		  reportH, maxRetries, comFailWait}). - - -%%-------- FUNS -------------------------------------------------------- --define(tr_IS_MEMBER(Obj),  -	fun(X) -> -		case catch corba_object:is_equivalent(Obj, X) of -		    true -> -			true; -		    _ -> -			false -		end -	end). - -%% Managing conditional debug functions --define(is_debug_compiled, 'ETraP_Common':is_debug_compiled()). --define(set_debug_context(L, C), -	etrap_test_lib:set_debug_context(L, C, ?FILE, ?LINE)).	 - - --ifdef(debug). --define(put_debug_data(Key, Data), erlang:put(Key, Data)). --define(get_debug_data(Key), erlang:get(Key)). --define(eval_debug_fun(I, E), -	etrap_test_lib:eval_debug_fun(I, E, ?FILE, ?LINE)). --define(activate_debug_fun(I, F, C), -	etrap_test_lib:activate_debug_fun(I, F, C, ?FILE, ?LINE)). --define(deactivate_debug_fun(I), -	etrap_test_lib:deactivate_debug_fun(I, ?FILE, ?LINE)). --define(debug_print(F,A), -	io:format("[LINE: ~p] "++F,[?LINE]++A)). --define(scratch_debug_fun,  -	etrap_test_lib:scratch_debug_fun()). --else. --define(put_debug_data(Key, Data), ok). --define(get_debug_data(Key), ok). --define(eval_debug_fun(I, E), ok). --define(activate_debug_fun(I, F, C), ok). --define(deactivate_debug_fun(I), ok). --define(debug_print(F,A), ok). --define(scratch_debug_fun, ok). --endif.     - - -%%-------- CONSTRUCTORS ------------------------------------------------ - --define(tr_create_context(ETraP, Terminator, TypeCheck, HM, SubtrOK, MaxRetries, -			  ComFailWait), -	#context{etrap = ETraP, terminator  = Terminator, typeCheck = TypeCheck,  -		 hashMax = HM, sub_tr_allowed = SubtrOK, maxRetries = MaxRetries, -		 comFailWait = ComFailWait}). - - -%%-------- MISC -------------------------------------------------------- --define(tr_notimeout(Context),  -	'ETraP_Common':try_timeout(Context#context.alarm) == false). --define(tr_is_root(Context), Context#context.parents == []). --define(tr_dont_reportH(Context), Context#context.reportH == false). --define(tr_is_retransmit(Context),  -	Context#context.reportH =/= undefined, -	Context#context.reportH =/= true, -	Context#context.reportH =/= false). - -%%-------- SELECTORS --------------------------------------------------- - --define(tr_get_reportH(Context),  -	Context#context.reportH). - --define(tr_get_rollback(Context),  -	Context#context.rollback). - --define(tr_get_subTraOK(Context),  -	Context#context.sub_tr_allowed). - --define(tr_get_hashMax(Context),  -	Context#context.hashMax). - --define(tr_get_local(Context),  -	Context#context.local). - --define(tr_get_trid(Context),  -	Context#context.trid). - --define(tr_get_typeCheck(Context),  -	Context#context.typeCheck). - --define(tr_get_recCoord(Context),  -	Context#context.recCoord). - --define(tr_get_alarm(Context),  -	Context#context.alarm). - --define(tr_get_timeout(Context),  -	Context#context.timeout). - --define(tr_get_etrap(Context),  -	Context#context.etrap). - --define(tr_get_terminator(Context),  -	Context#context.terminator). - --define(tr_get_id(Context),  -	Context#context.self). - --define(tr_get_maxW(Context),  -	Context#context.comFailWait). - --define(tr_get_maxR(Context),  -	Context#context.maxRetries). - --define(tr_get_parents(Context),  -	Context#context.parents). - --define(tr_get_parent(Context),  -	lists:nth(1, Context#context.parents)). - -%%-------- MODIFIERS --------------------------------------------------- - --define(tr_set_reportH(Context, Bool),  -	Context#context{reportH = Bool}). - --define(tr_set_rollback(Context, Bool),  -	Context#context{rollback = Bool}). - --define(tr_set_subTraOK(Context, Bool),  -	Context#context{sub_tr_allowed = Bool}). - --define(tr_set_hashMax(Context, HM),  -	Context#context{hashMax = HM}). - --define(tr_reset_local(Context),  -	Context#context{local = undefined}). - --define(tr_set_local(Context, Local),  -	Context#context{local = Local}). - --define(tr_set_trid(Context, TRID),  -	Context#context{trid = TRID}). - --define(tr_set_typeCheck(Context, Bool),  -	Context#context{typeCheck = Bool}). - --define(tr_set_id(Context, ID),  -	Context#context{self = ID}). - --define(tr_set_parents(Context, Parents),  -	Context#context{parents = Parents}). - --define(tr_add_parent(Context, Parent),  -	Context#context{parents = [Parent] ++ Context#context.parents}). - --define(tr_set_recCoord(Context, R),  -	Context#context{recCoord = R}). - --define(tr_set_alarm(Context, EC),  -	Context#context{alarm = EC}). - --define(tr_set_timeout(Context, T),  -	Context#context{timeout = T}). - --define(tr_set_etrap(Context, ETraP),  -	Context#context{etrap = ETraP}). - --define(tr_set_terminator(Context, T),  -	Context#context{terminator = T}). - --endif. -  -%%-------------- EOF --------------------------------------------------- - - diff --git a/lib/cosTransactions/src/ETraP_Server_impl.erl b/lib/cosTransactions/src/ETraP_Server_impl.erl deleted file mode 100644 index 5c7b5f6350..0000000000 --- a/lib/cosTransactions/src/ETraP_Server_impl.erl +++ /dev/null @@ -1,1745 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%%  -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%%  -%% 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. -%%  -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File    : ETraP_Server_impl.erl -%% Purpose :  -%%---------------------------------------------------------------------- -%% GENERAL CODE COMMENTS: -%% ###################### -%% TypeChecking incoming arguments: -%% -------------------------------- -%% We allow the user to configure the system so that external calls -%% (not CosTransactions calls) may be typechecked or not when calling -%% for example 'replay_completion'. With typecheck the user will get -%% instant feedback. But since 'is_a' add quiet a lot extra overhead  -%% if the object is located on a remote ORB. Hence, it is up to the -%% user to decide; speed vs. "safety". -%% -%% Log behavior -%% ------------ -%% Log files are created in the current directory, which is why the  -%% application requires read/write rights for current directory. The -%% file name looks like: -%% "oe_nonode@nohost_subc_1429872479809947099_438" (the two last parts are -%% erlang:system_time() and erlang:unique_integer([positive])) -%% It is equal to what the object is started as, i.e., {regname, {global, X}}. -%%  -%% If the application is unable to read the log it will exit and the  -%% supervisor definitions (found in ETraP_Common.hrl) determines how -%% many times we will retry. If it's impossible to read the log it's -%% considered as a disaster, i.e., user intervention is needed. -%%  -%% If an Object is unreachable when a Coordinator is trying to inform -%% of the true outcome of the transaction the application will retry N -%% times with T seconds wait in between. If it's still impossible to  -%% reach the object it's considered as a disaster, i.e., user  -%% intervention is needed. -%%  -%%---------------------------------------------------------------------- - --module('ETraP_Server_impl'). - -%%--------------- INCLUDES ----------------------------------- --include_lib("orber/include/corba.hrl"). - -%% Local --include_lib("cosTransactions/src/ETraP_Common.hrl"). --include_lib("cosTransactions/include/CosTransactions.hrl"). - - -%%--------------- IMPORTS------------------------------------- --import('ETraP_Common', [try_timeout/1]). - -%%--------------- EXPORTS------------------------------------- -%%--------------- Inherit from CosTransactions::Resource ---- --export([prepare/2,  -	 rollback/2,  -	 commit/2,  -	 commit_one_phase/2,  -	 forget/2]). - -%%--------------- Inherit from CosTransactions::Control ----- --export([get_terminator/2,  -	 get_coordinator/2]). - -%%----- Inherit from CosTransactions::RecoveryCoordinator --- --export([replay_completion/3]). - -%%--------------- Inherit from CosTransactions::Coordinator - --export([create_subtransaction/2, -	 get_txcontext/2, -	 get_transaction_name/2,  -	 get_parent_status/2,  -	 get_status/2,  -	 get_top_level_status/2, -	 hash_top_level_tran/2, -	 hash_transaction/2, -	 is_ancestor_transaction/3,  -	 is_descendant_transaction/3, -	 is_related_transaction/3, -	 is_same_transaction/3,  -	 is_top_level_transaction/2,  -	 register_resource/3,  -	 register_subtran_aware/3,  -	 register_synchronization/3, -	 rollback_only/2]). - -%%--------- Inherit from CosTransactions::Synchronization --- -%-export([before_completion/2, -%	 after_completion/3]). - - -%%--------------- gen_server specific ------------------------ --export([init/1, terminate/2]). --export([handle_call/3, handle_cast/2, handle_info/2, code_change/3]). - - - -%%--------------- LOCAL DATA --------------------------------- --record(exc,  -	{rollback   = false, -	 mixed      = false, -	 hazard     = false, -	 unprepared = false, -	 commit     = false}). - -%%--------------- LOCAL DEFINITIONS -------------------------- - -%%--------------- MISC MACROS -------------------------------- --define(etr_log(Log, Data),    etrap_logmgr:log_safe(Log, Data)). --define(etr_read(Log, Cursor), etrap_logmgr:get_next(Log, Cursor)). - --record(coord,  -	{status,           %% Status of the transaction.  -	 members = [],     %% List of registred resources. -	 votedCommit = [], %% List of the ones that voted commit. -	 raisedHeuristic = [], %% The members which raised an Heur. exc. -	 subAw = [],       %% Resorces which want to be informed  of outcome. -	 sync = [], -	 exc = void, -	 self, -	 etsR}). - -%% Selectors --define(etr_get_status(L),     L#coord.status). --define(etr_get_members(L),    lists:reverse(L#coord.members)). --define(etr_get_vc(L),         lists:reverse(L#coord.votedCommit)). --define(etr_get_raisedH(L),    lists:reverse(L#coord.raisedHeuristic)). --define(etr_get_exc(L),        L#coord.exc). --define(etr_get_subAw(L),      lists:reverse(L#coord.subAw)). --define(etr_get_sync(L),       lists:reverse(L#coord.sync)). --define(etr_get_self(L),       L#coord.self). --define(etr_get_etsR(L),       L#coord.etsR). --define(etr_get_init(Env),     #coord{}). --define(etr_get_exc_init(),    #exc{}). -%% Modifiers --define(etr_set_status(L, D),  L#coord{status = D}). --define(etr_set_members(L, D), L#coord{members = D}). --define(etr_add_member(L, D),  L#coord{members = [D|L#coord.members]}). --define(etr_set_vc(L, D),      L#coord{votedCommit = D}). --define(etr_add_vc(L, D),      L#coord{votedCommit = [D|L#coord.votedCommit]}). --define(etr_remove_vc(L, D),   L#coord{votedCommit = -				       lists:delete(D, ?etr_get_vc(L))}). --define(etr_set_raisedH(L, D), L#coord{raisedHeuristic = [D]}). --define(etr_add_raisedH(L, D), L#coord{raisedHeuristic =  -				       [D|L#coord.raisedHeuristic]}). --define(etr_remove_raisedH(L, D), L#coord{raisedHeuristic = -					  lists:delete(D, ?etr_get_raisedH(L))}). --define(etr_set_exc(L, D),     L#coord{exc = D}). --define(etr_set_subAw(L, D),   L#coord{subAw = [D]}). --define(etr_add_subAw(L, D),   L#coord{subAw = [D|L#coord.subAw]}). --define(etr_remove_subAw(L, D), L#coord{subAw = -					lists:delete(D,?etr_get_subAw(L))}). --define(etr_set_sync(L, D),    L#coord{sync = [D]}). --define(etr_add_sync(L, D),    L#coord{sync = [D|L#coord.sync]}). --define(etr_remove_sync(L, D), L#coord{sync = lists:delete(D,?etr_get_sync(L))}). --define(etr_set_self(L, D),    L#coord{self = D}). --define(etr_set_etsR(L, D),    L#coord{etsR = D}). - - -%%------------------------------------------------------------ -%% function : init, terminate -%% Arguments:  -%% Returns  :  -%% Effect   : Functions demanded by the module ic. -%%------------------------------------------------------------ - -init(Env) -> -    process_flag(trap_exit,true), -    case catch start_object(Env) of -	{'EXIT', Reason} -> -	    %% Happens when, for example, we encounter an  -	    %% error when reading from the log file. -	    {stop, Reason}; -	{'EXCEPTION', E} -> -	    self() ! {suicide, self()}, -	    corba:raise(E); -	Other -> -	    Other -    end. - - - -terminate(Reason, {Env, _Local}) -> -    ?debug_print("STOP ~p   ~p~n", [?tr_get_etrap(Env), Reason]), -    case Reason of -	normal ->  -	    %% normal termination. Transaction completed. -	    etrap_logmgr:stop(?tr_get_etrap(Env)), -	    file:delete(?tr_get_etrap(Env)), -	    ok; -	_ -> -	    ?tr_error_msg("Object(~p) terminated abnormal.~n",[?tr_get_etrap(Env)]), -	    ok -    end. - - -%%------------------------------------------------------------ -%% function : handle_call, handle_cast, handle_info, code_change -%% Arguments:  -%% Returns  :  -%% Effect   : Functions demanded by the gen_server module.  -%%------------------------------------------------------------ - -code_change(_OldVsn, State, _Extra) -> -    {ok, State}. - -handle_call(_,_, State) -> -    {noreply, State}. - -handle_cast(_, State) -> -    {noreply, State}. - - -handle_info(Info, {Env, Local}) -> -    ?debug_print("ETraP_Server:handle_info(~p)~n", [Info]), -    Pid = self(), -    case Info of -	timeout -> -	    ?tr_error_msg("Object( ~p ) timeout. Rolling back.~n", -			  [?tr_get_etrap(Env)]), -            {stop, normal, {Env, Local}}; -        {suicide, Pid} -> -            {stop, normal, {Env, Local}}; -        _-> -            {noreply, {Env, Local}} -    end. - - -%%--------------- Inherit from CosTransactions::Control ----- -%%-----------------------------------------------------------% -%% function : get_terminator -%% Arguments: Self  - its own object reference. -%%            State - Gen-Server State -%% Returns  : a Terminator object reference. -%% Effect   : Supports operations for termination of a transaction -%%------------------------------------------------------------ - -get_terminator(Self, {Env, Local}) -> -    %% Only allows the root-coordinator to export the termonator. -    %% The reason for this is that only the root-coordinator is allowed -    %% to initiate termination of a transaction. This is however possible -    %% to change and add restictions elsewhere, i.e. to verify if the -    %% commit or rollback call is ok. -    case catch ?tr_get_parents(Env) of -	[] -> % No parents, it's a root-coordinator. -	    % Create terminators environment. -	    TEnv = ?tr_set_etrap(Env, Self), -	    T = ?tr_start_child(?SUP_TERMINATOR(TEnv)), -	    {reply, T, {Env, Local}, ?tr_get_timeout(TEnv)}; -	_ -> -	    corba:raise(?tr_unavailable) -    end. - -%%-----------------------------------------------------------% -%% function : get_coordinator -%% Arguments: Self  - its own object reference. -%%            State - Gen-Server State -%% Returns  : a Coordinator object reference. The OMG specification -%%            states that a object reference must be returned. -%% Effect   : Supports operations needed by resources to participate -%%            in the transaction. -%%------------------------------------------------------------ - -get_coordinator(Self, State) -> -    {reply, Self, State}. - -%%----- Inherit from CosTransactions::RecoveryCoordinator --- -%%-----------------------------------------------------------% -%% function : replay_completion -%% Arguments: -%% Returns  : Status -%% Effect   : Provides a hint to the Coordinator that the commit -%%            or rollback operations have not been performed on -%%            the resource. -%%------------------------------------------------------------ - -replay_completion(_Self, {Env, Local}, Resource) -> -    type_check(?tr_get_typeCheck(Env), ?tr_Resource, -	       "RecoveryCoordinator:replay_completion", Resource), -    case ?etr_get_status(Local) of -	'StatusActive' -> -	    corba:raise(?tr_unprepared); -	Status -> -	    case lists:any(?tr_IS_MEMBER(Resource), ?etr_get_members(Local)) of -		true -> -		    {reply, Status, {Env, Local}}; -		_ -> -		    corba:raise(#'NO_PERMISSION'{completion_status=?COMPLETED_YES}) -	    end -    end. - -%%--------------- Inherit from CosTransactions::Resource ---- -%%-----------------------------------------------------------% -%% function : prepare -%% Arguments:  -%% Returns  : a Vote -%% Effect   : Is invoked to begin the two-phase-commit on the -%%            resource. -%%------------------------------------------------------------ - -prepare(_Self, {Env, Local}) ->     -    %% Set status as prepared. No new Resources are allowed to register. -    NewL = ?etr_set_status(Local, 'StatusPrepared'), - -    ?eval_debug_fun({?tr_get_etrap(Env), root_delay}, Env), - -    case catch send_prepare(?etr_get_members(NewL),  -			    ?tr_get_alarm(Env)) of -	readOnly ->  -	    %% All voted ReadOnly, done. No need to log. -	    {stop, normal, 'VoteReadOnly', {Env, NewL}}; -	%% Replace the reply above if allow synchronization -%	    case ?etr_get_sync(Local) of -%		[] -> -%		    {stop, normal, 'VoteReadOnly', {Env, NewL}}; -%		_ -> -%		    {reply, 'VoteReadOnly', {Env, NewL}} -%	    end; -	{commit, VC} ->  -	    %% All voted Commit. -	    NewL2 = ?etr_set_vc(NewL, VC), -	    case catch try_timeout(?tr_get_alarm(Env)) of -		false ->  -		    case ?etr_log(?tr_get_etrap(Env), {pre_vote, commit, NewL2}) of -			ok -> -			    ?eval_debug_fun({?tr_get_etrap(Env), prepare1}, Env), -			    {reply, 'VoteCommit', {Env, NewL2}}; -			_-> -			    %% Cannot log. Better to be safe than sorry; do rollback. -			    %% However, try to log rollback. -			    ?etr_log(?tr_get_etrap(Env),{pre_vote, rollback, NewL2}), -			    send_decision({Env, NewL2}, 'VoteRollback', rollback) -		    end; -		_->  -		    ?etr_log(?tr_get_etrap(Env), -			     {pre_vote, rollback, NewL2}), -		    %% timeout, reply rollback. -		    send_decision({Env, NewL2}, 'VoteRollback', rollback) -	    end; -	{rollback, VC} ->  -	    %% Rollback vote received.  -	    %% Send rollback to commit voters. -	    N2 = ?etr_set_vc(NewL, VC), -	    NewL2 = ?etr_set_status(N2,'StatusRolledBack'),  -	    ?etr_log(?tr_get_etrap(Env), {pre_vote, rollback, NewL2}), -	    send_decision({Env, NewL2}, 'VoteRollback', rollback); -	{'EXCEPTION', E, VC, Obj} -> -	    NewL2 = case is_heuristic(E) of -				true -> -			    N2 = ?etr_set_vc(NewL, VC), -			    N3 = ?etr_set_exc(N2, E), -			    ?etr_set_raisedH(N3, Obj); -			_-> -			    ?etr_set_vc(NewL, VC) -		    end, -	    ?etr_log(?tr_get_etrap(Env),{pre_vote,rollback, NewL2}), -	    ?eval_debug_fun({?tr_get_etrap(Env), prepare2}, Env),	     -	    send_decision({Env, NewL2}, {'EXCEPTION', E}, rollback); -	{failed, VC} -> -	    NewL2 = ?etr_set_vc(NewL, VC), -	    ?etr_log(?tr_get_etrap(Env),{pre_vote, rollback, NewL2}), -	    send_decision({Env, NewL2},  -			  {'EXCEPTION', ?tr_hazard}, rollback) -    end. - - -%%-----------------------------------------------------------% -%% function : rollback -%% Arguments: Self - the servers own objref. -%%            {Env, Local} - the servers internal state. -%% Returns  : ok -%% Effect   : Rollback the transaction. If its status is -%%            "StatusRolledBack", this is not the first -%%            rollback call to this server. Might occur if -%%            the parent coordinator just recoeverd from a crasch. -%% Exception: HeuristicCommit, HeuristicMixed, HeuristicHazard -%%------------------------------------------------------------ - -rollback(Self, {Env, Local}) -> -    case ?etr_get_status(Local) of -	'StatusRolledBack' -> -	    case ?etr_get_exc(Local) of -		void -> -		    {stop, normal, ok, {Env, Local}}; -		%% Replace the reply above if allow synchronization -		    %% Rolled back successfullly earlier. -%		    case ?etr_get_sync(Local) of -%			[] -> -%			    {stop, normal, ok, {Env, Local}}; -%			_ -> -%			    {reply, ok, {Env, Local}} -%		    end; -		E -> -		    %% Already rolledback with heuristic decision -		    corba:raise(E) -	    end; -	'StatusPrepared' -> -	    NewL = ?etr_set_status(Local, 'StatusRolledBack'), -	    ?eval_debug_fun({?tr_get_etrap(Env), rollback}, Env), -	    ?etr_log(?tr_get_etrap(Env), rollback), -	    ?eval_debug_fun({?tr_get_etrap(Env), rollback2}, Env), -	    send_decision({Env, NewL}, ok, rollback); -	'StatusActive' -> -	    NewL = ?etr_set_status(Local, 'StatusRolledBack'), -	    ?etr_log(?tr_get_etrap(Env), {rollback, NewL}),	     -	    send_info(?etr_get_members(NewL), 'CosTransactions_Resource', rollback), -	    notify_subtrAware(rollback, ?etr_get_subAw(NewL), Self), -	    {stop, normal, ok, {Env, NewL}} -%% Replace the reply above if allow synchronization -%	    case ?etr_get_sync(Local) of -%		[] -> -%		    {stop, normal, ok, {NewEnv, NewL}}; -%		_ -> -%		    {reply, ok, {NewEnv, NewL}} -%	    end; -    end. - - -%%-----------------------------------------------------------% -%% function : commit -%% Arguments: Self - the servers own objref. -%%            {Env, Local} - the servers internal state. -%% Returns  : ok -%% Effect   : Commit the transaction. -%% Exception: HeuristicRollback, HeuristicMixed, HeuristicHazard, -%%            NotPrepared -%%------------------------------------------------------------ - -commit(_Self, {Env, Local}) -> -    case ?etr_get_status(Local) of -	'StatusPrepared' ->  -	    ?eval_debug_fun({?tr_get_etrap(Env), commit}, Env), -	    NewL = ?etr_set_status(Local, 'StatusCommitted'), -	    ?etr_log(?tr_get_etrap(Env),commit), -	    ?eval_debug_fun({?tr_get_etrap(Env), commit2}, Env), -	    send_decision({Env, NewL}, ok, commit); -	'StatusCommitted' -> -	    case ?etr_get_exc(Local) of -		void -> -		    {stop, normal, ok, {Env, Local}}; -		%% Replace the reply above if allow synchronization -%		    case ?etr_get_sync(Local) of -%			[] -> -%			    {stop, normal, ok, {Env, Local}}; -%			_ -> -%			    {reply, ok, {Env, Local}} -%		    end; -		E-> -		    corba:raise(E) -	    end; -	_ ->  -	    corba:raise(?tr_unprepared) -    end. - -%%-----------------------------------------------------------% -%% function : commit_one_phase -%% Arguments: Self - the servers own objref. -%%            {Env, Local} - the servers internal state. -%% Returns  : ok -%% Effect   : Commit the transaction using one-phase commit. -%%            Use ONLY when there is only one registered Resource. -%% Exception: HeuristicRollback, HeuristicMixed, HeuristicHazard, -%%            TRANSACTION_ROLLEDBACK -%%------------------------------------------------------------ - -commit_one_phase(_Self, {Env, Local}) -> -    case ?etr_get_members(Local) of -	[Resource] -> -	    case ?etr_get_status(Local) of -		'StatusActive' -> -		    %% Set status as prepared. No new Resources are allowed to register. -		    NewL = ?etr_set_status(Local, 'StatusPrepared'), -		    ?eval_debug_fun({?tr_get_etrap(Env), onePC}, Env), -		    case try_timeout(?tr_get_alarm(Env)) of -			false ->  -			    case catch 'CosTransactions_Resource':prepare(Resource) of -				'VoteCommit' -> -				    case try_timeout(?tr_get_alarm(Env)) of -					false ->  -					    send_decision({Env, NewL}, ok, commit, [Resource]); -					_->  -					    %% Timeout, rollback.  -					    send_decision({Env, NewL},  -							  {'EXCEPTION',  -							   #'TRANSACTION_ROLLEDBACK'{completion_status=?COMPLETED_YES}},  -							  rollback, [Resource]) -				    end; -				'VoteRollback' -> -				    {stop, normal,  -				     {'EXCEPTION',  -				      #'TRANSACTION_ROLLEDBACK'{completion_status=?COMPLETED_YES}},  -				     {Env, NewL}}; -				'VoteReadOnly' -> -				    {stop, normal, ok, {Env, NewL}}; -				{'EXCEPTION', E}  -				when is_record(E, 'CosTransactions_HeuristicMixed') -> -				    {reply, {'EXCEPTION', E}, {Env, NewL}}; -				{'EXCEPTION', E}  -				when is_record(E, 'CosTransactions_HeuristicHazard') -> -				    {reply, {'EXCEPTION', E}, {Env, NewL}}; -				Other -> -				    ?tr_error_msg("Coordinator:prepare( ~p ) failed. REASON ~p~n",  -						  [Resource, Other]), -				    {stop, normal,  -				     {'EXCEPTION',  -				      #'TRANSACTION_ROLLEDBACK'{completion_status=?COMPLETED_YES}},  -				     {Env, NewL}} -			    end; -			_-> -			    NewL2 = ?etr_set_status(NewL, 'StatusRolledBack'), -			    send_info(Resource, 'CosTransactions_Resource', rollback), -			    {stop, normal,  -			     {'EXCEPTION', #'TRANSACTION_ROLLEDBACK'{completion_status=?COMPLETED_YES}},  -			     {Env, NewL2}} -			%% Replace the reply above if allow synchronization -%			    case ?etr_get_sync(NewL2) of -%				[] -> -%				    send_info(Resource, 'CosTransactions_Resource', rollback), -%				    {stop, normal,  -%				     {'EXCEPTION', #'TRANSACTION_ROLLEDBACK'{completion_status=?COMPLETED_YES}},  -%				     {Env, NewL2}}; -%				_ -> -%				    send_info(Resource, 'CosTransactions_Resource', rollback), -%				    {reply,  -%				     {'EXCEPTION', #'TRANSACTION_ROLLEDBACK'{completion_status=?COMPLETED_YES}},  -%				     {Env, NewL2}} -%			    end -		    end; -		_ -> -		    case evaluate_status(?etr_get_status(Local)) of -			commit -> -			    test_exc(set_exception(?etr_get_exc_init(),  -						   ?etr_get_exc(Local)), -				     commit, ok, {Env, Local}); -			_-> -			    test_exc(set_exception(?etr_get_exc_init(), -						   ?etr_get_exc(Local)), -				     rollback,  -				     {'EXCEPTION', #'TRANSACTION_ROLLEDBACK'{completion_status=?COMPLETED_YES}},  -				     {Env, Local}) -		    end -	    end; -	_-> -	    {reply, {'EXCEPTION', #'NO_PERMISSION'{completion_status=?COMPLETED_NO}},  -	     {Env, Local}} -    end. - -%%-----------------------------------------------------------% -%% function : forget -%% Arguments: Self  - the servers own objref. -%%            State - the servers internal state. -%% Returns  : ok -%% Effect   : The resource can forget all knowledge about the -%%            transaction. Terminate this server. -%%------------------------------------------------------------ - -forget(_Self, {Env, Local}) -> -    ?etr_log(?tr_get_etrap(Env), forget_phase), -    send_forget(?etr_get_raisedH(Local), ?tr_get_etrap(Env)), -    {stop, normal, ok, {Env, ?etr_set_exc(Local, void)}}. -%% Replace the reply above if allow synchronization -%    case ?etr_get_sync(Local) of -%	[] -> -%	    {stop, normal, ok, {Env, ?etr_set_exc(Local, void)}}; -%	_ -> -%	    {reply, ok, {Env, ?etr_set_exc(Local, void)}} -%    end. - -%%--------------- Inherrit from CosTransactions::Coordinator - -  -%%-----------------------------------------------------------% -%% function : get_status -%% Arguments: Self  - its own object reference. -%%            State - Gen-Server State -%% Returns  : Status -%% Effect   : Returns the status of the transaction associated -%%            with the target object. -%%------------------------------------------------------------ - -get_status(_Self, {Env, Local}) -> -    {reply, ?etr_get_status(Local), {Env, Local}}. - - -%%-----------------------------------------------------------% -%% function : get_parent_status -%% Arguments: Self  - its own object reference. -%%            State - Gen-Server State -%% Returns  : Status -%% Effect   : Returns the status of the parent transaction -%%            associated with the target object. If top-level -%%            transaction equal to get_status. -%%------------------------------------------------------------ - -get_parent_status(_Self, {Env, Local}) -> -    case catch ?tr_get_parents(Env) of -	[] -> -	    {reply, ?etr_get_status(Local), {Env, Local}}; -	[Parent|_] -> -	    case catch 'CosTransactions_Coordinator':get_status(Parent) of -		{'EXCEPTION', _E} ->  -		    corba:raise(?tr_unavailable); -		{'EXIT', _} ->  -		    corba:raise(?tr_unavailable); -		Status -> -		    {reply, Status, {Env, Local}} -	    end -    end. - - -%%-----------------------------------------------------------% -%% function : get_top_level_status -%% Arguments: Self  - its own object reference. -%%            State - Gen-Server State -%% Returns  : Status -%% Effect   : Returns the status of the top-level transaction -%%            associated with the target object. If top-level -%%            transaction equal to get_status. -%%------------------------------------------------------------ - -get_top_level_status(_Self, {Env, Local}) -> -    case catch ?tr_get_parents(Env) of -	[] -> -	    {reply, ?etr_get_status(Local), {Env, Local}}; -	Ancestrors -> -	    case catch 'CosTransactions_Coordinator':get_status(lists:last(Ancestrors)) of -		{'EXCEPTION', _E} -> -		    corba:raise(?tr_unavailable); -		{'EXIT', _} -> -		    corba:raise(?tr_unavailable); -		Status -> -		    {reply, Status, {Env, Local}} -	    end -    end. - - -%%-----------------------------------------------------------% -%% function : is_same_transaction -%% Arguments: Self  - its own object reference. -%%            State - Gen-Server State -%%            Coordinator object reference -%% Returns  : boolean -%% Effect   :  -%%------------------------------------------------------------ - -is_same_transaction(Self, {Env, Local}, Coordinator) -> -    type_check(?tr_get_typeCheck(Env), ?tr_Coordinator, -	       "Coordinator:is_same_transaction", Coordinator), -    {reply, corba_object:is_equivalent(Self, Coordinator), {Env, Local}}. - -%%------------------------------------------------------------ -%% function : is_related_transaction -%% Arguments: Self  - its own object reference. -%%            State - Gen-Server State -%%            Coordinator object reference -%% Returns  : boolean -%% Effect   : -%%------------------------------------------------------------ - --spec is_related_transaction(_, _, _) -> no_return(). -is_related_transaction(_Self, {_Env, _Local}, _Coordinator) -> -    corba:raise(#'NO_IMPLEMENT'{completion_status=?COMPLETED_YES}). -%    type_check(?tr_get_typeCheck(Env), ?tr_Coordinator, -%	       "Coordinator:is_related_transaction", Coordinator), -%    {reply, false, {Env, Local}}. - - -%%------------------------------------------------------------ -%% function : is_ancestor_transaction -%%            Coordinator object reference -%% Returns  : boolean -%% Effect   : -%%------------------------------------------------------------ - --spec is_ancestor_transaction(_, _, _) -> no_return(). -is_ancestor_transaction(_Self, {_Env, _Local}, _Coordinator) -> -    corba:raise(#'NO_IMPLEMENT'{completion_status=?COMPLETED_YES}). -%    type_check(?tr_get_typeCheck(Env), ?tr_Coordinator, -%	       "Coordinator:is_ancestor_transaction", Coordinator), -%    {reply, false, {Env, Local}}. - - -%%-----------------------------------------------------------% -%% function : is_descendant_transaction -%% Arguments: Self  - its own object reference. -%%            State - Gen-Server State -%%            Coordinator object reference -%% Returns  : boolean -%% Effect   : -%%------------------------------------------------------------ - -is_descendant_transaction(Self, {Env, Local}, Coordinator) -> -    type_check(?tr_get_typeCheck(Env), ?tr_Coordinator, -	       "Coordinator:is_descendant_transaction", Coordinator), -    {reply,  -     lists:any(?tr_IS_MEMBER(Coordinator), [Self|?tr_get_parents(Env)]),  -     {Env, Local}}. - -%%-----------------------------------------------------------% -%% function : is_top_level_transaction -%% Arguments: Self  - its own object reference. -%%            State - Gen-Server State -%% Returns  : boolean -%% Effect   : -%%------------------------------------------------------------ - -is_top_level_transaction(_Self, {Env, Local}) -> -     case catch ?tr_get_parents(Env) of -	[] -> -	     {reply, true, {Env, Local}}; -	 _ -> -	     {reply, false, {Env, Local}} -     end. - -%%-----------------------------------------------------------% -%% function : hash_transaction -%% Arguments: Self  - its own object reference. -%%            State - Gen-Server State -%% Returns  : hash code -%% Effect   : Returns a hash code for the transaction associated -%%            with the target object. -%%------------------------------------------------------------ - -hash_transaction(Self, {Env, Local}) -> -    {reply, corba_object:hash(Self, ?tr_get_hashMax(Env)), {Env, Local}}. - - -%%-----------------------------------------------------------% -%% function : hash_top_level_tran -%% Arguments: Self  - its own object reference. -%%            State - Gen-Server State -%% Returns  : hash code -%% Effect   : Returns a hash code for the top-level transaction  -%%            associated with the target object. Equals  -%%            hash_transaction if it's a top-level transaction. -%%------------------------------------------------------------ - -hash_top_level_tran(Self, {Env, Local}) -> -    case ?tr_get_parents(Env) of -	[] -> -	    {reply,  -	     corba_object:hash(Self, ?tr_get_hashMax(Env)),  -	     {Env, Local}}; -	Ancestrors -> -	    case catch corba_object:hash(lists:last(Ancestrors),  -					 ?tr_get_hashMax(Env)) of -		{'EXCEPTION', _E} ->  -		    corba:raise(?tr_unavailable); -		Hash -> -		    {reply, Hash, {Env, Local}} -	    end -    end. - - - -%%-----------------------------------------------------------% -%% function : register_resource -%% Arguments: Self  - its own object reference. -%%            State - Gen-Server State -%%            Resource object reference -%% Returns  : RecoveryCoordinator (can be used during recovery) -%% Effect   : Registers the specified resource as as participant -%%            in the transaction associated with the target object. -%% Exception: Inactive - Is prepared or terminated. -%%------------------------------------------------------------ - -register_resource(Self, {Env, Local}, Resource) -> -    type_check(?tr_get_typeCheck(Env), ?tr_Resource, -	       "Coordinator:register_resource", Resource), -    case ?etr_get_status(Local) of -	'StatusActive' -> % ok to register the Resource. -	    NewLocal = ?etr_add_member(Local, Resource), -	    RecoveryCoord = corba:create_subobject_key(Self, ?tr_get_etrap(Env)), -	    {reply, RecoveryCoord, {Env, NewLocal}, ?tr_get_timeout(Env)}; -	_-> % Not active anymore. New members not ok. -	    corba:raise(?tr_inactive) -    end. - -	 - -%%-----------------------------------------------------------% -%% function : register_subtran_aware -%% Arguments: Self  - its own object reference. -%%            State - Gen-Server State -%%            SubTransactionAwareResource object reference -%% Returns  : - -%% Effect   : Registers the specified object such that it -%%            will be notified when the subtransaction has  -%%            commited or rolled back. -%%------------------------------------------------------------ - -register_subtran_aware(Self, {Env, Local}, SubTrAwareResource) -> -    case ?tr_get_parents(Env) of -	[] -> -	    corba:raise(?tr_NotSubtr); -	_-> -	    type_check(?tr_get_typeCheck(Env), ?tr_SubtransactionAwareResource, -		       "Coordinator:register_subtran_aware", SubTrAwareResource), -	    NewL = ?etr_add_subAw(Local, SubTrAwareResource), -	    {reply, ok, {Env, ?etr_set_self(NewL, Self)},  -	     ?tr_get_timeout(Env)} -    end. - -%%-----------------------------------------------------------% -%% function : register_synchronization -%% Arguments: Self  - its own object reference. -%%            State - Gen-Server State -%%            Synchronization -%% Returns  : - -%% Effect   :  -%%------------------------------------------------------------ - --spec register_synchronization(_, _, _) -> no_return(). -register_synchronization(_Self, {_Env, _Local}, _Synchronization) -> -    corba:raise(#'CosTransactions_SynchronizationUnavailable'{}). - -%register_synchronization(Self, {Env, Local}, Synchronization) -> -%    type_check(?tr_get_typeCheck(Env), ?tr_Synchronization, -%	       "Coordinator:register_synchronization", Synchronization), -%    case ?etr_get_status(Local) of -%	'StatusActive' -> -%	    case catch ?tr_get_parents(Env) of -%		[] -> -%		    {reply, ok, {Env, ?etr_add_sync(Local, Synchronization)},  -%		     ?tr_get_timeout(Env)}; -%		[Parent|_] -> -%		    case catch 'ETraP_Server':register_synchronization(Parent, Self) of -%			{'EXCEPTION', E} -> -%			    corba:raise(E); -%			ok -> -%			    {reply, ok, {Env, ?etr_add_sync(Local, Synchronization)},  -%			     ?tr_get_timeout(Env)}; -%			What -> -%			    corba:raise(#'COMM_FAILURE'{completion_status=?COMPLETED_MAYBE}) -%		    end -%	    end; -%	_ -> -%	    corba:raise(?tr_inactive) -%    end. - -%%-----------------------------------------------------------% -%% function : rollback_only -%% Arguments: Self  - its own object reference. -%%            State - Gen-Server State -%% Returns  : - -%% Effect   : The transaction associated with the target object -%%            is modified so that rollback IS the result. -%%------------------------------------------------------------ - -rollback_only(Self, {Env, Local}) -> -    case ?etr_get_status(Local) of -	'StatusActive' -> -	    NewL = ?etr_set_status(Local, 'StatusRolledBack'), -	    NewEnv = ?tr_set_rollback(Env, true), -	    ?etr_log(?tr_get_etrap(Env),{rollback, NewL}), -	    send_info(?etr_get_members(NewL), 'CosTransactions_Resource', rollback), -	    notify_subtrAware(rollback, ?etr_get_subAw(NewL), Self), -	    {stop, normal, ok, {NewEnv, NewL}}; -%% Replace the reply above if allow synchronization -%	    case ?etr_get_sync(Local) of -%		[] -> -%		    {stop, normal, ok, {NewEnv, NewL}}; -%		_ -> -%		    {reply, ok, {NewEnv, NewL}} -%	    end; -	_ -> -	    corba:raise(?tr_inactive) -    end. - -%%-----------------------------------------------------------% -%% function : get_transaction_name -%% Arguments: Self  - its own object reference. -%%            State - Gen-Server State -%% Returns  : string - which describes the transaction associated  -%%                     with the target object. -%% Effect   : Intended for debugging. -%%------------------------------------------------------------ - -get_transaction_name(_Self, {Env, Local}) -> -    {reply, ?tr_get_etrap(Env), {Env, Local}}. - -%%-----------------------------------------------------------% -%% function : create_subtransaction -%% Arguments: Self  - its own object reference. -%%            State - Gen-Server State -%% Returns  : A control object if subtransactions are allowed, -%%            otherwise an exception is raised. -%% Effect   : A new subtransaction is created whos parent is -%%            the transaction associated with the target object. -%% Exception: SubtransactionUnavailabe - no support for nested -%%                                       transactions. -%%            Inactive - already been prepared. -%%------------------------------------------------------------ - -create_subtransaction(Self, {Env, Local}) -> -    case ?etr_get_status(Local) of -	'StatusActive' -> -	    case ?tr_get_subTraOK(Env) of -		true -> -		    ETraPName = 'ETraP_Common':create_name("subc"), -		    Tname   = 'ETraP_Common':create_name("subt"), -		     -		    %% Create context for the new object. -		    State   = ?tr_create_context(ETraPName, Tname,  -						 ?tr_get_typeCheck(Env),  -						 ?tr_get_hashMax(Env),  -						 ?tr_get_subTraOK(Env), -						 ?tr_get_maxR(Env), -						 ?tr_get_maxW(Env)), - - -		    State2  = ?tr_add_parent(State, Self), -		     -		    State3  = ?tr_set_alarm(State2, ?tr_get_alarm(Env)), - -		    State4  = ?tr_set_timeout(State3, ?tr_get_timeout(Env)), - -		    Control = ?tr_start_child(?SUP_ETRAP(State4)), -		    %% Set the SubCoordinator object reference and register it as participant. -		    SubCoord = 'CosTransactions_Control':get_coordinator(Control), -		    NewLocal = ?etr_add_member(Local, SubCoord), -		    {reply, Control, {Env, NewLocal}, ?tr_get_timeout(Env)}; -		_ -> -		    %% subtransactions not allowed, raise exception. -		    corba:raise(?tr_subunavailable) -	    end; -	_-> -	    corba:raise(?tr_inactive) -    end. - -%%-----------------------------------------------------------% -%% function : get_txcontext -%% Arguments:  -%% Returns  : PropagationContext -%% Effect   :  -%%------------------------------------------------------------ - --spec get_txcontext(_, _) -> no_return(). -get_txcontext(_Self, {_Env, _Local}) -> -    corba:raise(#'CosTransactions_Unavailable'{}). - -%get_txcontext(Self, {Env, Local}) -> -%    Otid = #'CosTransactions_otid_t'{formatID=0,  -%				     bqual_length=0,  -%				     tid=[corba_object:hash(Self,  -%							   ?tr_get_hashMax(Env))]}, -%    TrIDs = create_TransIdentities(?tr_get_parents(Env), Env, [], Otid), -%    C=case ?tr_get_parents(Env) of -%	  [] -> -%	      #'CosTransactions_TransIdentity'{coord=Self,  -%					       term=?tr_get_terminator(Env),  -%					       otid=Otid}; -%	  _-> -%	      #'CosTransactions_TransIdentity'{coord=Self,  -%					       term=?tr_NIL_OBJ_REF,  -%					       otid=Otid} -%      end, -%    case ?tr_get_timeout(Env) of -%	infinity -> -%	    #'CosTransactions_PropagationContext'{timeout=0,  -%						  current= C,  -%						  parents=TrIDs}; -%	T -> -%	    #'CosTransactions_PropagationContext'{timeout=T/1000,  -%						  current= C,  -%						  parents=TrIDs} -%    end. - -%create_TransIdentities([], _, Parents, _) -> Parents; -%create_TransIdentities([Phead|Ptail], Env, Parents, Otid) -> -%    NO=Otid#'CosTransactions_TransIdentity'{otid= -%					    corba_object:hash(Phead,  -%							      ?tr_get_hashMax(Env))}, -%    create_TransIdentities([Phead|Ptail], Env, Parents++ -%			   [#'CosTransactions_TransIdentity'{coord=Phead,  -%							     term=?tr_NIL_OBJ_REF,  -%							     otid=NO}],  -%			   Otid). - - -%%--------- Inherit from CosTransactions::Synchronization --- - -%%-----------------------------------------------------------% -%% function : before_completion -%% Arguments:  -%% Returns  :  -%% Effect   :  -%%------------------------------------------------------------ - -%before_completion(Self, {Env, Local}) -> -%    send_info(?etr_get_sync(Local),  -%	      'CosTransactions_Synchronization', before_completion), -%    {reply, ok, {Env, Local}}. - -%%-----------------------------------------------------------% -%% function : after_completion -%% Arguments:  -%% Returns  :  -%% Effect   :  -%%------------------------------------------------------------ - -%after_completion(Self, {Env, Local}, Status) -> -%    send_info(?etr_get_sync(Local), Status, -%	      'CosTransactions_Synchronization', after_completion), -%    {stop, normal, ok, {Env, Local}}. - -%%--------------- IMPLEMENTATION SPECIFIC ------------------- -%%-----------------------------------------------------------% -%% function : start_object -%% Arguments:  -%% Returns  : EXIT, EXCEPTION, or {ok, State} -%% Effect   : used by init/1 only. -%%------------------------------------------------------------ - -start_object(Env)-> -    ?put_debug_data(self, Env), -    Local = ?etr_get_init(Env), -    LogName = ?tr_get_etrap(Env), -    case catch file:read_file_info(LogName) of -	{error, enoent} ->  -	    %% File does not exist. It's the first time. No restart. -	    ?debug_print("ETraP_Server:init(~p)~n",[?tr_get_etrap(Env)]), -	    etrap_logmgr:start(LogName), -	    {ok,  -	     {Env, ?etr_set_status(Local, 'StatusActive')},  -	     ?tr_get_timeout(Env)}; -	{error, Reason} ->  -	    %% File exist but error occurred. -	    ?tr_error_msg("Control (~p) Cannot open log file: ~p~n", -			  [LogName, Reason]), -	    {stop, "unable_to_open_log"}; -	_ ->  -	    %% File exists, perform restart. -	    etrap_logmgr:start(LogName), -	    ?debug_print("RESTART ~p~n", [?tr_get_etrap(Env)]), -	    prepare_restart({Env, ?etr_set_status(Local, 'StatusUnknown')}, -			    ?etr_read(?tr_get_etrap(Env), start)) -    end. - - -%%-----------------------------------------------------------% -%% function : send_prepare -%% Arguments: List of registred resources.  -%% Returns  : ok - equal to void -%% Effect   : calls send_prepare/3, which sends a prepare call -%% to resources participating in the transaction and then collect  -%% their votes. send_prepare will block until -%% it recieves a reply from the resource. -%%------------------------------------------------------------ - -send_prepare(RegResources, Alarm) -> -    send_prepare(RegResources, [], Alarm). - -% All voted ReadOnly. We are done. -send_prepare([], [], _) ->  -    readOnly; - -% All voted commit (VC) or ReadOnly. -send_prepare([], VC, Alarm) ->  -    case catch try_timeout(Alarm) of -	false ->  -	    {commit, VC}; -	_->  -	    {rollback, VC} -    end; - -send_prepare([Rhead|Rtail], VC, Alarm) -> -    ?debug_print("send_prepare()~n",[]), -    case catch 'CosTransactions_Resource':prepare(Rhead) of -	'VoteCommit' -> -	    case catch try_timeout(Alarm) of -		false ->  -		    _Env = ?get_debug_data(self), -		    ?eval_debug_fun({?tr_get_etrap(_Env), send_prepare}, _Env), -		    send_prepare(Rtail, VC++[Rhead], Alarm); -		_->  -		    %% Timeout, rollback. However, the resource did vote  -		    %% commit. Add it to the list. -		    send_info(Rtail, 'CosTransactions_Resource', rollback), -		    {rollback, VC++[Rhead]} -	    end; -	'VoteRollback' -> -	    %% Don't care about timeout since we voted rollback. -	    %% A rollback received. No need for more prepare-calls. -	    %% See OMG 10-51, Transaction Service:v1.0  -	    send_info(Rtail, 'CosTransactions_Resource', rollback), -	    {rollback, VC}; -	'VoteReadOnly' -> -	    case catch try_timeout(Alarm) of -		false -> -		    send_prepare(Rtail, VC, Alarm); -		_->  -		    %% timeout, reply rollback. -		    send_info(Rtail, 'CosTransactions_Resource', rollback), -		    {rollback, VC} -	    end; -	{'EXCEPTION',E} when is_record(E, 'TIMEOUT') -> -	    ?tr_error_msg("Coordinator:prepare( ~p )~nObject unreachable.~n", -			  [Rhead]), -	    %% Since we use presumed abort we will rollback the transaction. -	    send_info(Rtail, 'CosTransactions_Resource', rollback), -	    {rollback, VC}; -	{'EXCEPTION',E} when is_record(E, 'TRANSIENT') -> -	    ?tr_error_msg("Coordinator:prepare( ~p )~nObject unreachable.~n", -			  [Rhead]), -	    %% Since we use presumed abort we will rollback the transaction. -	    send_info(Rtail, 'CosTransactions_Resource', rollback), -	    {rollback, VC}; -	{'EXCEPTION',E} when is_record(E, 'COMM_FAILURE') -> -	    ?tr_error_msg("Coordinator:prepare( ~p )~nObject unreachable.~n", -			  [Rhead]), -	    %% Since we use presumed abort we will rollback the transaction. -	    send_info(Rtail, 'CosTransactions_Resource', rollback), -	    {rollback, VC}; -	{'EXCEPTION', E} when is_record(E, 'OBJECT_NOT_EXIST') -> -	    ?tr_error_msg("Coordinator:prepare( ~p )~nObject unreachable.~n", -			  [Rhead]), -	    send_info(Rtail, 'CosTransactions_Resource', rollback), -	    {rollback, VC}; -	{'EXCEPTION', Exc} -> -	    ?tr_error_msg("Coordinator:prepare( ~p )~nThe Object raised exception: ~p~n",  -			  [Rhead, Exc]), -	    send_info(Rtail, 'CosTransactions_Resource', rollback), -	    %% This can occur if a subtransaction get one or more  -	    %% "VoteCommit" followed by a "VoteRollback".  -	    %% The subtransaction then do a send_decision(rollback), -	    %% which can generate Heuristic decisions. Must rollback  -	    %% since at least one participant voted rollback. -	    {'EXCEPTION', Exc, VC, Rhead};  -	Other -> -	    ?tr_error_msg("Coordinator:prepare( ~p ) failed. REASON ~p~n",  -			  [Rhead, Other]), -	    send_info(Rtail, 'CosTransactions_Resource', rollback), -	    {failed, VC} -    end. - -%%-----------------------------------------------------------% -%% function : type_check -%% Arguments: Bool - perform typecheck? -%%            ID   - Type it should be. -%%            Func - Name of the function (for error_msg) -%%            Obj  - objectrefernce to test. -%% Returns  : 'ok' or raises exception. -%% Effect   :  -%%------------------------------------------------------------ -type_check(false, _, _, _) -> -    ok; -type_check(_, ID, Func, Obj) -> -    case catch corba_object:is_a(Obj,ID) of -	true -> -	    ok; -	_ -> -	    ?tr_error_msg("~p( ~p )  Bad argument!!~n", [Func, Obj]), -	    corba:raise(?tr_badparam) -    end. - -%%-----------------------------------------------------------% -%% function : is_heuristic -%% Arguments: Exception -%% Returns  : boolean -%% Effect   : Returns true if the exception is a heuristic exc. -%%------------------------------------------------------------ - -is_heuristic(E) when is_record(E, 'CosTransactions_HeuristicMixed')    -> true; -is_heuristic(E) when is_record(E, 'CosTransactions_HeuristicHazard')   -> true; -is_heuristic(E) when is_record(E, 'CosTransactions_HeuristicCommit')   -> true; -is_heuristic(E) when is_record(E, 'CosTransactions_HeuristicRollback') -> true; -is_heuristic(_)            -> false. - -%%-----------------------------------------------------------% -%% function : exception_set -%% Arguments: Genserver state -%% Returns  :  -%% Effect   : Used when restarting. -%%------------------------------------------------------------ - -exception_set({Env,Local}) -> -    case ?etr_get_exc(Local) of -	void -> -	    self() ! {suicide, self()}, -	    {ok, {Env, Local}}; -	_ -> -	    {ok, {Env, Local}} -    end. - -%%-----------------------------------------------------------% -%% function : set_exception -%% Arguments: Locally defined #exc{} -%%            Heuristic mixed or hazard Exeption -%% Returns  : Altered locally defined #exc{} -%% Effect   : Set the correct tuple member to true. -%%------------------------------------------------------------ - -set_exception(Exc, E) when is_record(E, 'CosTransactions_HeuristicMixed')  ->  -    Exc#exc{mixed  = true}; -set_exception(Exc, E) when is_record(E, 'CosTransactions_HeuristicHazard') ->  -    Exc#exc{hazard = true}; -set_exception(Exc, _)            -> Exc. - -%%-----------------------------------------------------------% -%% function : send_forget  -%% Arguments:  -%% Returns  :  -%% Effect   :  -%%------------------------------------------------------------ - -send_forget([], _) -> ok; -send_forget([Rhead|Rtail], LogName) -> -    ?debug_print("send_forget()~n",[]), -    _Env = ?get_debug_data(self), -    case catch 'CosTransactions_Resource':forget(Rhead) of -	ok -> -	    ?eval_debug_fun({?tr_get_etrap(_Env), send_forget1}, _Env), -	    ?etr_log(LogName, {forgotten, Rhead}), -	    ?eval_debug_fun({?tr_get_etrap(_Env), send_forget2}, _Env), -	    send_forget(Rtail, LogName); -	Other -> -	    ?tr_error_msg("CosTransactions_Coordinator failed sending forget to  ~p~nREASON: ~p~n", -			  [Rhead, Other]), -	    ?eval_debug_fun({?tr_get_etrap(_Env), send_forget3}, _Env), -	    ?etr_log(LogName, {not_forgotten, Rhead}), -	    ?eval_debug_fun({?tr_get_etrap(_Env), send_forget4}, _Env), -	    send_forget(Rtail, LogName) -    end. - -%%-----------------------------------------------------------% -%% function : send_decision  -%% Arguments: List of registred resources which vote commit. -%%            Vote - the outcome of the transaction. -%% Returns  : ok - equal to void -%% Effect   : Inform those who voted commit of the outcome. -%% They who voted rollback already knows the outcome. -%% They who voted ReadOnly are not affected. -%%------------------------------------------------------------ - -%%-- Adding extra parameters -send_decision({Env, Local}, Reply, Vote) -> -    send_decision({Env, Local}, Reply, ?etr_get_vc(Local), Vote, #exc{}, [], 0). -send_decision({Env, Local}, Reply, Vote, VC) -> -    send_decision({Env, Local}, Reply, VC, Vote, #exc{}, [], 0). -send_decision(State, no_reply, VC, Vote, Exc) -> -    send_decision(State, no_reply, VC, Vote, Exc, [], 0). - -%%-- Decision sent to all members. Do not reply (used when restarting). -send_decision({Env, Local}, no_reply, [], _, #exc{mixed = true}, [], _) ->  -    {Env, ?etr_set_exc(Local, ?tr_mixed)}; -send_decision({Env, Local}, no_reply, [], _, #exc{hazard = true}, [], _) ->  -    {Env, ?etr_set_exc(Local, ?tr_hazard)}; -send_decision({Env, Local}, no_reply, [], _, _, [], _) ->  -    {Env, Local}; -send_decision({Env, Local}, no_reply, [], Vote, Exc, Failed, Times) ->  -    case ?tr_get_maxR(Env) of -	Times -> -	    ?tr_error_msg("MAJOR ERROR, failed sending commit decision to: ~p. Tried ~p times.", [Failed,Times]), -	    {Env, ?etr_set_exc(Local, ?tr_hazard)}; -	_-> -	    timer:sleep(?tr_get_maxW(Env)), -	    NewTimes = Times+1, -	    send_decision({Env, Local}, no_reply, Failed, Vote, Exc, [], NewTimes) -    end; -%%-- end special cases. - -%% Decision sent to all members. Test exceptions. -send_decision({Env, Local}, Reply, [], Vote, Exc, [], _) ->  -    notify_subtrAware(Vote, ?etr_get_subAw(Local), ?etr_get_self(Local)), -    test_exc(Exc, Vote, Reply, {Env, Local}); -%% Decision not sent to all members (one or more failed). Retry. -send_decision({Env, Local}, Reply, [], Vote, Exc, Failed, Times) ->  -    case ?tr_get_maxR(Env) of -	Times -> -	    ?tr_error_msg("MAJOR ERROR, failed sending commit decision to: ~p. Tried ~p times.", [Failed,Times]), -	    notify_subtrAware(Vote, ?etr_get_subAw(Local), ?etr_get_self(Local)), -	    test_exc(Exc#exc{hazard = true}, Vote, Reply, {Env, Local}); -	_-> -	    NewTimes = Times+1, -	    timer:sleep(?tr_get_maxW(Env)), -	    send_decision({Env, Local}, Reply, Failed, Vote, Exc, [], NewTimes) -    end; - -send_decision({Env, Local}, Reply, [Rhead|Rtail], Vote, Exc, Failed, Times) -> -    ?debug_print("Coordinator:send_decision(~p) Try: ~p~n",[Vote, Times]), -    case catch 'CosTransactions_Resource':Vote(Rhead) of -        ok -> -	    ?etr_log(?tr_get_etrap(Env),{sent, Rhead}), -            send_decision({Env, Local}, Reply, Rtail, Vote, Exc, Failed, Times); -        {'EXCEPTION', E} when Vote == commit andalso -			      is_record(E, 'CosTransactions_NotPrepared') -> -	    ?debug_print("send_decision resource unprepared~n",[]), -            case catch 'CosTransactions_Resource':prepare(Rhead) of -                'VoteCommit' -> -                    send_decision({Env, Local}, Reply, [Rhead|Rtail], Vote, Exc, Failed, Times); -		'VoteRollback' -> -                    send_decision({Env, Local}, Reply, Rtail, Vote, Exc#exc{mixed = true}, Failed, Times); -		{'EXCEPTION', E} -> -		    {SetExc, NewL, DidFail} =  -			evaluate_answer(E, Rhead, Vote, Exc,  -					?tr_get_etrap(Env), Local), -		    send_decision({Env, NewL}, Reply, Rtail, Vote, SetExc, DidFail++Failed, Times) -            end; -	{'EXCEPTION', E} -> -	    {SetExc, NewL, DidFail} =  -		evaluate_answer(E, Rhead, Vote, Exc, ?tr_get_etrap(Env), Local), -	    ?tr_error_msg("Resource:~p( ~p )~nRaised Exception: ~p~n", -			  [Vote, Rhead, E]), -	    send_decision({Env, NewL}, Reply, Rtail, Vote, SetExc, DidFail++Failed, Times); -	{'EXIT', _} -> -	    send_decision({Env, Local}, Reply, Rtail,  -			  Vote, Exc, [Rhead|Failed], Times); -	Other -> -	    ?tr_error_msg("Resource:~p( ~p ) failed.~nREASON: ~p~n",  -			  [Vote, Rhead, Other]), -	    case catch corba_object:non_existent(Rhead) of -		true when Vote == commit -> -		    %% Presumed rollback -		    send_decision({Env, Local}, Reply, Rtail, Vote,  -				  Exc#exc{mixed = true}, Failed, Times); -		true -> -		    %% Presumed rollback -		    send_decision({Env, Local}, Reply, Rtail, Vote,  -				  Exc#exc{hazard = true}, Failed, Times); -		_ -> -		    send_decision({Env, Local}, Reply, Rtail,  -				  Vote, Exc, [Rhead|Failed], Times) -	    end -    end. - -%%-----------------------------------------------------------% -%% function : notify_subtrAware,  -%% Arguments:  -%% Returns  :  -%% Effect   : Invoke an operation on a list of objects. We don't -%%            care about return values or exceptions. -%%------------------------------------------------------------ - -notify_subtrAware(commit, Resources, Self) -> -    send_info(Resources, Self,  -	      'CosTransactions_SubtransactionAwareResource', -	      commit_subtransaction); -notify_subtrAware(_, Resources, _) -> -    send_info(Resources, 'CosTransactions_SubtransactionAwareResource', -	      rollback_subtransaction). - -%%-----------------------------------------------------------% -%% function : send_info -%% Arguments: ObjectList - List of object refernces to call. -%%            M - Module -%%            F - Function -%%            (Arg - required arguments) -%% Returns  : ok -%% Effect   : A lightweight function to be used when we don't -%%            "care" about the return value. -%%------------------------------------------------------------ - -send_info([], _, _, _) -> -    ok; -send_info([Rhead|Rtail], Arg, M, F) -> -    ?debug_print("~p( ~p )~n",[F, Arg]), -    case catch M:F(Rhead, Arg) of -	{'EXIT',R} -> -	    ?tr_error_msg("~p:~p(~p, ~p) returned {'EXIT',~p}", [M,F,Rhead,Arg,R]); -	{'EXCEPTION',E} -> -	    ?tr_error_msg("~p:~p(~p, ~p) returned {'EXCEPTION',~p}", [M,F,Rhead,Arg,E]); -	_-> -	    ok -    end, -    send_info(Rtail, Arg, M, F). - -send_info([], _, _) ->  -    ok; -send_info([Rhead|Rtail], M, F) -> -    ?debug_print("~p( )~n",[F]), -    case catch M:F(Rhead) of -	{'EXIT',R} -> -	    ?tr_error_msg("~p:~p(~p) returned {'EXIT',~p}", [M,F,Rhead,R]); -	{'EXCEPTION',E} -> -	    ?tr_error_msg("~p:~p(~p) returned {'EXCEPTION',~p}", [M,F,Rhead,E]); -	_-> -	    ok -    end, -    send_info(Rtail, M, F). -     -%%-----------------------------------------------------------% -%% function : evaluate_answer -%% Arguments:  -%% Returns  :  -%% Effect   : Check what kind of exception we received. -%%------------------------------------------------------------ - -evaluate_answer(E, Rhead, _Vote, Exc, Log, Local)  -  when is_record(E, 'CosTransactions_HeuristicMixed') -> -    ?etr_log(Log, {heuristic, {Rhead, E}}), -    {Exc#exc{mixed = true}, ?etr_add_raisedH(Local, Rhead), []}; -evaluate_answer(E, Rhead, _Vote, Exc, Log, Local) -  when is_record(E, 'CosTransactions_HeuristicHazard') -> -    ?etr_log(Log, {heuristic, {Rhead, E}}), -    {Exc#exc{hazard = true}, ?etr_add_raisedH(Local, Rhead), []}; -evaluate_answer(E, Rhead, Vote, Exc, Log, Local) -  when is_record(E, 'CosTransactions_HeuristicCommit') -> -    case Vote of -	commit -> -	    ?etr_log(Log, {heuristic, {Rhead, E}}), -	    {Exc, ?etr_add_raisedH(Local, Rhead), []}; -	_-> -	    ?etr_log(Log, {heuristic, {Rhead, ?tr_mixed}}), -	    {Exc#exc{mixed = true}, ?etr_add_raisedH(Local, Rhead), []} -    end; -evaluate_answer(E, Rhead, Vote, Exc, Log, Local)  -  when is_record(E, 'CosTransactions_HeuristicRollback')-> -    case Vote of -	rollback -> -	    ?etr_log(Log, {heuristic, {Rhead, ?tr_rollback}}), -	    {Exc, ?etr_add_raisedH(Local, Rhead), []}; -	_-> -	    ?etr_log(Log, {heuristic, {Rhead, ?tr_mixed}}), -	    {Exc#exc{mixed = true}, ?etr_add_raisedH(Local, Rhead), []} -    end; -evaluate_answer(E, Rhead, Vote, Exc, Log, Local)  -  when Vote == commit andalso is_record(E, 'TRANSACTION_ROLLEDBACK') -> -    ?etr_log(Log, {heuristic, {Rhead, ?tr_mixed}}), -    {Exc#exc{mixed = true}, ?etr_add_raisedH(Local, Rhead), []}; -evaluate_answer(E, Rhead, Vote, Exc, Log, Local) when is_record(E, 'TIMEOUT') -> -    ?tr_error_msg("Coordinator:~p( ~p ) Object unreachable.~nReason: ~p~n", -		  [Vote, Rhead, E]), -    case catch corba_object:non_existent(Rhead) of -	true -> -	    %% Since we have presumed abort, the child will -	    %% assume rollback if this server do not exist any more. -	    ?etr_log(Log, {heuristic, {Rhead, ?tr_hazard}}), -	    {Exc#exc{hazard = true}, Local, []}; -	_ -> -	    {Exc, Local, [Rhead]} -    end; -evaluate_answer(E, Rhead, Vote, Exc, Log, Local) when is_record(E, 'TRANSIENT') -> -    ?tr_error_msg("Coordinator:~p( ~p ) Object unreachable.~nReason: ~p~n", -		  [Vote, Rhead, E]), -    case catch corba_object:non_existent(Rhead) of -	true -> -	    %% Since we have presumed abort, the child will -	    %% assume rollback if this server do not exist any more. -	    ?etr_log(Log, {heuristic, {Rhead, ?tr_hazard}}), -	    {Exc#exc{hazard = true}, Local, []}; -	_ -> -	    {Exc, Local, [Rhead]} -    end; -evaluate_answer(E, Rhead, Vote, Exc, Log, Local) when is_record(E, 'COMM_FAILURE') -> -    ?tr_error_msg("Coordinator:~p( ~p ) Object unreachable.~nReason: ~p~n", -		  [Vote, Rhead, E]), -    case catch corba_object:non_existent(Rhead) of -	true -> -	    %% Since we have presumed abort, the child will -	    %% assume rollback if this server do not exist any more. -	    ?etr_log(Log, {heuristic, {Rhead, ?tr_hazard}}), -	    {Exc#exc{hazard = true}, Local, []}; -	_ -> -	    {Exc, Local, [Rhead]} -    end; -evaluate_answer(E, Rhead, Vote, Exc, Log, Local)when is_record(E, 'OBJECT_NOT_EXIST') -> -    ?tr_error_msg("Coordinator:~p( ~p ) Object unreachable.~nReason: ~p~n", -		  [Vote, Rhead, E]), -    %% Since we have presumed abort, the child will -    %% assume rollback if this server do not exist any more. -    ?etr_log(Log, {heuristic, {Rhead, ?tr_hazard}}), -    {Exc#exc{hazard = true}, Local, []}; -evaluate_answer(Unknown, Rhead, Vote, Exc, _Log, Local)-> -    ?tr_error_msg("Coordinator:~p( ~p ). Unknown reply: ~p.~n",  -		  [Vote, Rhead, Unknown]), -    {Exc, Local, []}. - - -%%-----------------------------------------------------------% -%% function : test_exc -%% Arguments: Exc   - instance of #exc{} locally declared. -%%            Vote  - 'rollback' or 'commit' -%%            Reply - If no exceptions this is the default reply. -%%            State - genserver state -%% Returns  :  -%% Effect   : Raise the correct exception or simply reply to -%%            the genserver. NOTE that the testing for exceptions -%%            differs if we are performing a rollback or commit. -%%            Check if Mixed first; takes priority over Hazard. -%%            HeuristicRollback and VoteCommit together give  -%%            HeuristicMixed -%%            HeuristicCommit and VoteRollback together give -%%            HeuristicMixed -%%------------------------------------------------------------ - -test_exc(#exc{mixed = true}, _, _, {Env, Local}) -> -    {reply, {'EXCEPTION', ?tr_mixed}, {Env, ?etr_set_exc(Local, ?tr_mixed)}}; -% Left out for now to avoid dialyzer warning. -%test_exc(#exc{rollback = true}, commit, _, {Env, Local}) -> -%    {reply, {'EXCEPTION', ?tr_mixed}, {Env, ?etr_set_exc(Local, ?tr_mixed)}}; -% Left out for now to avoid dialyzer warning. -%test_exc(#exc{commit = true}, rollback, _, {Env, Local}) -> -%    {reply, {'EXCEPTION', ?tr_mixed}, {Env, ?etr_set_exc(Local, ?tr_mixed)}}; -test_exc(#exc{hazard = true}, _, _, {Env, Local}) -> -    {reply, {'EXCEPTION', ?tr_hazard}, {Env, ?etr_set_exc(Local, ?tr_hazard)}}; -test_exc(_, _, {'EXCEPTION', E}, {Env, Local})  -  when is_record(E, 'TRANSACTION_ROLLEDBACK')-> -    {stop, normal, {'EXCEPTION', E}, {Env, Local}}; -%% Replace the case above if allow synchronization -%test_exc(_, _, {'EXCEPTION', E}, {Env, Local})  -%  when record(E, 'TRANSACTION_ROLLEDBACK')-> -%    case ?etr_get_sync(Local) of -%	[] -> -%	    {stop, normal, {'EXCEPTION', E}, {Env, Local}}; -%	_-> -%	    {reply, {'EXCEPTION', E}, {Env, Local}} -%    end; -test_exc(_, _, {'EXCEPTION', E}, State) -> -    {reply, {'EXCEPTION', E}, State}; -test_exc(_, _, Reply, {Env, Local}) -> -    {stop, normal, Reply, {Env, Local}}. -%% Replace the case above if allow synchronization -%test_exc(_, _, Reply, {Env, Local}) -> -%    case ?etr_get_sync(Local) of -%	[] -> -%	    {stop, normal, Reply, {Env, Local}}; -%	_ -> -%	    {reply, Reply, {Env, Local}} -%    end. -	 -%%-----------------------------------------------------------% -%% function : evaluate_status -%% Arguments:  -%% Returns  :  -%% Effect   :  -%%------------------------------------------------------------ - -evaluate_status(Status) -> - case Status of -     'StatusCommitted'      -> commit; -     'StatusCommitting'     -> commit; -     'StatusMarkedRollback' -> rollback; -     'StatusRollingBack'    -> rollback; -     'StatusRolledBack'     -> rollback; -     'StatusActive'         -> rollback; -     'StatusPrepared'       -> rollback; -     'StatusUnknown'        -> rollback; -     'StatusNoTransaction'  -> rollback; -     'StatusPreparing'      -> rollback; -     _-> rollback - end. - - -%%-----------------------------------------------------------% -%% function : prepare_restart -%% Arguments:  -%% Returns  :  -%% Effect   :  -%%------------------------------------------------------------ - -%% The file contains no data. The coordinator crashed before -%% a prepare-call was made. Presumed rollback. -prepare_restart(State, eof) ->  -    ?debug_print("prepare_restart: eof, init~n",[]), -    self() ! {suicide, self()}, -    {ok, State}; -%% Collected all necessary votes. Do commit_restart. -prepare_restart({Env, _}, {{pre_vote, _Vote, Data}, Cursor}) -> -    ?debug_print("prepare_restart: pre_vote( ~p )~n",[_Vote]), -    if -	?tr_is_root(Env) -> -	    commit_restart({Env, Data},  -			   ?etr_read(?tr_get_etrap(Env), Cursor), root); -	true ->	 -	    commit_restart({Env, Data},  -			   ?etr_read(?tr_get_etrap(Env), Cursor), subCoord) -    end; -%% 'rollback' called without 'prepare'. This case occurs if the Coordinator -%% crashes when send_info or notify_subtrAware. -prepare_restart({Env, _}, {{rollback, NewL}, _Cursor}) -> -    ?debug_print("prepare_restart: pre_vote( rollback )~n",[]), -    send_info(?etr_get_members(NewL), 'CosTransactions_Resource', rollback), -    notify_subtrAware(rollback, ?etr_get_subAw(NewL), ?etr_get_self(NewL)), -    self() ! {suicide, self()}, -    {ok, {Env, NewL}}; -%% Something is wrong in the log. -prepare_restart(_, _) -> -    ?tr_error_msg("Internal log read failed:~n", []), -    {stop, {error, "restart failed"}}. - -%%-----------------------------------------------------------% -%% function : commit_restart -%% Arguments: Env - server context -%% Returns  :  -%% Effect   :  -%%------------------------------------------------------------ -commit_restart({Env, Local}, Data, Phase) -> -    Exc = set_exception(#exc{}, ?etr_get_exc(Local)), -    commit_restart({Env, Local}, Data, Phase, Exc). - -%% Normal case. No errors no exceptions. -commit_restart({Env, Local}, {{sent, Obj}, Cursor}, Vote, Exc) -> -    ?debug_print("commit_restart: sent~n",[]), -    commit_restart({Env, ?etr_remove_vc(Local, Obj)},  -		   ?etr_read(?tr_get_etrap(Env), Cursor), Vote, Exc); -commit_restart({Env, Local}, {{heuristic, {Obj,E}}, Cursor}, Vote, Exc) -> -    ?debug_print("commit_restart: heuristic    ~p~n",[E]), -    NewExc = set_exception(Exc, E), -    commit_restart({Env, ?etr_add_raisedH(Local, Obj)}, -		   ?etr_read(?tr_get_etrap(Env), Cursor), Vote, NewExc); - - -%% --- cases which only can occure once in the log ------------ - -%% The file contains no data. The coordinator crashed before -%% a decision was made. Causes rollback. -commit_restart({E, L}, eof, root, Exc) ->  -    ?debug_print("commit_restart: eof init (root only)~n",[]), -    {Env, Local} = send_decision({E, L}, no_reply, ?etr_get_vc(L),  -				 rollback, Exc), -    exception_set({Env, Local}); -%% Replace the reply above if allow synchronization -%    case ?etr_get_sync(Local) of -%	[] -> -%	    exception_set({Env, Local}); -%	SynchObjs -> -%	    {ok, {Env, Local}} -%    end; - - -%% Passed the prepare_restart. Not received a commit decision from the -%% parent. -commit_restart({E, L}, eof, subCoord, Exc) ->  -    ?debug_print("commit_restart: eof init (subcoord only)~n",[]), -    case catch corba_object:non_existent(?tr_get_parent(E)) of -	true -> -	    %% Presumed rollback. -	    {Env, Local} = send_decision({E, L}, no_reply, ?etr_get_vc(L),  -					 rollback, Exc), -	    self() ! {suicide, self()}, -	    {ok, {Env, Local}}; -%% Replace the reply above if allow synchronization -%	    case ?etr_get_sync(Local) of -%		[] -> -%		    self() ! {suicide, self()}, -%		    {ok, {Env, Local}}; -%		SynchObjs -> -%		    case ?tr_get_parents(Env) of -%			[] -> -%			    send_info(SynchObjs, ?etr_get_status(Local), -%				      'CosTransactions_Synchronization', after_completion); -%			_-> -%			    ok -%		    end, -%		    self() ! {suicide, self()}, -%		    {ok, {Env, Local}} -%	    end; -	_-> -	    {ok, {E, L}} -    end; - -commit_restart({Env, Local}, eof, Vote, Exc) ->  -    ?debug_print("commit_restart: eof    VOTE: ~p~n",[Vote]), -    case ?etr_get_vc(Local) of -	[] -> -	    ?debug_print("commit_restart: all sent, test exc~n",[]), -            exception_set({Env, Local}); -	VC -> -	    ?debug_print("commit_restart: note done. send more~n",[]), -	    State = send_decision({Env, Local}, no_reply, VC, Vote, Exc), -	    exception_set(State) -    end; - -%% Decision made, i.e. rollback or commit. -commit_restart({Env, Local}, {rollback, Cursor}, _Phase, Exc) -> -    ?debug_print("commit_restart: decided rollback~n",[]), -    commit_restart({Env, ?etr_set_status(Local, 'StatusRolledBack')},  -		   ?etr_read(?tr_get_etrap(Env), Cursor), rollback, Exc); -commit_restart({Env, Local}, {commit, Cursor}, _Phase, Exc) -> -    ?debug_print("commit_restart: decided commit~n",[]), -    commit_restart({Env, ?etr_set_status(Local, 'StatusCommitted')},  -		   ?etr_read(?tr_get_etrap(Env), Cursor), commit, Exc); -commit_restart({Env, Local}, {forget_phase, Cursor}, _, _) -> -    ?debug_print("commit_restart: start sending forget~n",[]), -    forget_restart({Env, Local}, ?etr_read(?tr_get_etrap(Env), Cursor)); - -commit_restart({_Env, _Local}, _R, _, _) -> -    ?debug_print("RESTART FAIL: ~p~n",[_R]), -    ?tr_error_msg("Internal log read failed:~n", []), -    exit("restart failed"). - -%%-----------------------------------------------------------% -%% function : forget_restart -%% Arguments: {Env, Local} - server context -%% Returns  :  -%% Effect   :  -%%------------------------------------------------------------ - -%% Exception logged. Test if we issued a 'forget()' to the Resource. -forget_restart({Env, Local}, eof) -> -    case ?etr_get_raisedH(Local) of -	[] -> -	    ?debug_print("forget_restart: all done~n",[]); -	Left -> -	    ?debug_print("forget_restart: not done. send more~n",[]), -	    send_forget(Left, ?tr_get_etrap(Env)) -    end, -    self() ! {suicide, self()}, -    {ok, {Env, Local}}; -%% Replace the reply above if allow synchronization -%    case ?etr_get_sync(Local) of -%	[] -> -%	    self() ! {suicide, self()}, -%	    {ok, {Env, Local}}; -%	SynchObjs -> -%	    case ?tr_get_parents(Env) of -%		[] -> -%		    send_info(SynchObjs, ?etr_get_status(Local), -%			      'CosTransactions_Synchronization', after_completion), -%		    self() ! {suicide, self()}, -%		    {ok, {Env, Local}}; -%		_-> -%		    {ok, {Env, Local}} -%	    end -%    end; -forget_restart({Env, Local}, {{forgotten, Obj}, Cursor}) -> -    ?debug_print("forget_restart: forgotten  heuristic~n",[]), -    NewL = ?etr_remove_raisedH(Local, Obj), -    forget_restart({Env, NewL}, ?etr_read(?tr_get_etrap(Env), Cursor)); -forget_restart({Env, Local}, {{not_forgotten, Obj}, Cursor}) -> -    ?debug_print("forget_restart: not_forgotten~n",[]), -    NewL = ?etr_remove_raisedH(Local, Obj), -    send_forget([Obj], dummy), -    forget_restart({Env, NewL}, ?etr_read(?tr_get_etrap(Env), Cursor)). - -%%--------------- END OF MODULE ------------------------------ diff --git a/lib/cosTransactions/src/Makefile b/lib/cosTransactions/src/Makefile deleted file mode 100644 index 4cc1e487c2..0000000000 --- a/lib/cosTransactions/src/Makefile +++ /dev/null @@ -1,181 +0,0 @@ -# -# %CopyrightBegin% -#  -# Copyright Ericsson AB 1999-2016. All Rights Reserved. -#  -# 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. -#  -# %CopyrightEnd% -# -# -include $(ERL_TOP)/make/target.mk -EBIN=../ebin - -ifeq ($(TYPE),debug) -ERL_COMPILE_FLAGS += -Ddebug -W -endif - -include $(ERL_TOP)/make/$(TARGET)/otp.mk - -# ---------------------------------------------------- -# Application version -# ---------------------------------------------------- -include ../vsn.mk -VSN=$(COSTRANSACTIONS_VSN) - -# ---------------------------------------------------- -# Release directory specification -# ---------------------------------------------------- -RELSYSDIR = $(RELEASE_PATH)/lib/cosTransactions-$(VSN) -# ---------------------------------------------------- -# Target Specs -# ---------------------------------------------------- - -MODULES = \ -	ETraP_Common \ -	etrap_logmgr \ -	ETraP_Server_impl \ -	CosTransactions_Terminator_impl \ -	CosTransactions_TransactionFactory_impl \ -	cosTransactions - -ERL_FILES = $(MODULES:%=%.erl)  -HRL_FILES = \ -	ETraP_Common.hrl - -GEN_ERL_FILES =  \ -	oe_CosTransactions.erl \ -	CosTransactions_Control.erl \ -	CosTransactions_Coordinator.erl \ -	CosTransactions_HeuristicCommit.erl \ -	CosTransactions_HeuristicHazard.erl \ -	CosTransactions_HeuristicMixed.erl \ -	CosTransactions_HeuristicRollback.erl \ -	CosTransactions_Inactive.erl \ -	CosTransactions_InvalidControl.erl \ -	CosTransactions_NoTransaction.erl \ -	CosTransactions_NotPrepared.erl \ -	CosTransactions_NotSubtransaction.erl \ -	CosTransactions_RecoveryCoordinator.erl \ -	CosTransactions_Resource.erl \ -	CosTransactions_SubtransactionAwareResource.erl \ -	CosTransactions_SubtransactionsUnavailable.erl \ -	CosTransactions_Terminator.erl \ -	CosTransactions_TransactionFactory.erl \ -	CosTransactions_Unavailable.erl \ -	CosTransactions_SynchronizationUnavailable.erl \ -	CosTransactions_TransIdentity.erl \ -	CosTransactions_PropagationContext.erl \ -	CosTransactions_otid_t.erl \ -	CosTransactions_WrongTransaction.erl \ -	ETraP_Server.erl -#	CosTransactions_Synchronization.erl \ - -EXTERNAL_INC_PATH = ../include - -GEN_HRL_FILES = \ -	oe_CosTransactions.hrl \ -	CosTransactions.hrl \ -	CosTransactions_Control.hrl \ -	CosTransactions_Coordinator.hrl \ -	CosTransactions_RecoveryCoordinator.hrl \ -	CosTransactions_Resource.hrl \ -	CosTransactions_SubtransactionAwareResource.hrl \ -	CosTransactions_Terminator.hrl \ -	CosTransactions_TransactionFactory.hrl \ -	ETraP.hrl \ -	ETraP_Server.hrl -#	CosTransactions_Synchronization.hrl \ - -EXTERNAL_GEN_HRL_FILES = $(GEN_HRL_FILES:%=$(EXTERNAL_INC_PATH)/%) - -GEN_FILES = $(GEN_ERL_FILES) $(EXTERNAL_GEN_HRL_FILES) - -TARGET_FILES = \ -	$(GEN_ERL_FILES:%.erl=$(EBIN)/%.$(EMULATOR)) \ -	$(MODULES:%=$(EBIN)/%.$(EMULATOR))  - -IDL_FILE = \ -	CosTransactions.idl - -APPUP_FILE = cosTransactions.appup -APPUP_SRC = $(APPUP_FILE).src -APPUP_TARGET = $(EBIN)/$(APPUP_FILE) - -APP_FILE = cosTransactions.app -APP_SRC = $(APP_FILE).src -APP_TARGET = $(EBIN)/$(APP_FILE) - -# ---------------------------------------------------- -# FLAGS -# ---------------------------------------------------- -ERL_IDL_FLAGS += -pa $(ERL_TOP)/lib/cosTransactions/ebin \ -	-pa $(ERL_TOP)/lib/ic/ebin\ -	-pa $(ERL_TOP)/lib/orber/ebin - -# The -pa option is just used temporary until erlc can handle  -# includes from other directories than ../include . -ERL_COMPILE_FLAGS += \ -	$(ERL_IDL_FLAGS) \ -	-I$(ERL_TOP)/lib/cosTransactions/include \ -	-I$(ERL_TOP)/lib/orber/include \ -	+'{parse_transform,sys_pre_attributes}' \ -	+'{attribute,insert,app_vsn,"cosTransactions_$(COSTRANSACTIONS_VSN)"}'  - - -# ---------------------------------------------------- -# Targets -# ---------------------------------------------------- -opt: $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET) - -debug: -	@${MAKE} TYPE=debug - -clean: -	rm -f $(TARGET_FILES) $(GEN_FILES) $(APP_TARGET) $(APPUP_TARGET) IDL-GENERATED -	rm -f errs core *~ - -$(APP_TARGET): $(APP_SRC) -	$(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $(APP_SRC) > $(APP_TARGET) - -$(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk -	$(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ - -docs: - -# ---------------------------------------------------- -# Special Build Targets -# ---------------------------------------------------- -IDL-GENERATED: CosTransactions.idl -	$(gen_verbose)erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosTransactions.cfg"}' CosTransactions.idl -	$(V_at)mv $(GEN_HRL_FILES) $(EXTERNAL_INC_PATH) -	$(V_at)>IDL-GENERATED - -$(GEN_FILES): IDL-GENERATED - -$(TARGET_FILES): IDL-GENERATED - -# ---------------------------------------------------- -# Release Target -# ----------------------------------------------------  -include $(ERL_TOP)/make/otp_release_targets.mk - -release_spec: opt -	$(INSTALL_DIR) "$(RELSYSDIR)/ebin" -	$(INSTALL_DATA) $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET) "$(RELSYSDIR)/ebin" -	$(INSTALL_DIR) "$(RELSYSDIR)/src" -	$(INSTALL_DATA) $(ERL_FILES) $(HRL_FILES) $(GEN_ERL_FILES) $(IDL_FILE) "$(RELSYSDIR)/src" -	$(INSTALL_DIR) "$(RELSYSDIR)/include" -	$(INSTALL_DATA) $(EXTERNAL_GEN_HRL_FILES) "$(RELSYSDIR)/include" - -release_docs_spec: diff --git a/lib/cosTransactions/src/cosTransactions.app.src b/lib/cosTransactions/src/cosTransactions.app.src deleted file mode 100644 index 074d82f487..0000000000 --- a/lib/cosTransactions/src/cosTransactions.app.src +++ /dev/null @@ -1,44 +0,0 @@ -{application, cosTransactions, - [{description, "The Erlang CosTransactions application"}, -  {vsn, "%VSN%"}, -  {modules, -       [ -	etrap_logmgr, -	'ETraP_Server_impl', -        'CosTransactions_Terminator_impl', -	'CosTransactions_TransactionFactory_impl', -	'ETraP_Common', -	oe_CosTransactions, -	'CosTransactions_Control', -	'CosTransactions_Coordinator', -	'CosTransactions_HeuristicCommit', -	'CosTransactions_HeuristicHazard', -	'CosTransactions_HeuristicMixed', -	'CosTransactions_HeuristicRollback', -	'CosTransactions_Inactive', -	'CosTransactions_InvalidControl', -	'CosTransactions_NoTransaction', -	'CosTransactions_NotPrepared', -	'CosTransactions_NotSubtransaction', -	'CosTransactions_RecoveryCoordinator', -	'CosTransactions_Resource', -	'CosTransactions_SubtransactionAwareResource', -	'CosTransactions_SubtransactionsUnavailable', -	'CosTransactions_Terminator', -	'CosTransactions_TransactionFactory', -	'CosTransactions_Unavailable', -	'CosTransactions_SynchronizationUnavailable', -	'CosTransactions_TransIdentity', -	'CosTransactions_PropagationContext', -	'CosTransactions_otid_t', -	'CosTransactions_WrongTransaction', -	'ETraP_Server', -	cosTransactions -       ] -  }, -  {registered, [cosTransactions_sup, oe_cosTransactionsFactory]}, -  {applications, [orber, stdlib, kernel]}, -  {env, []}, -  {mod, {cosTransactions, []}}, -  {runtime_dependencies, ["stdlib-2.0","orber-3.6.27","kernel-3.0","erts-7.0"]} -]}. diff --git a/lib/cosTransactions/src/cosTransactions.appup.src b/lib/cosTransactions/src/cosTransactions.appup.src deleted file mode 100644 index f3eead4a0c..0000000000 --- a/lib/cosTransactions/src/cosTransactions.appup.src +++ /dev/null @@ -1,6 +0,0 @@ -{"%VSN%", - [ - ], - [ - ] -}. diff --git a/lib/cosTransactions/src/cosTransactions.erl b/lib/cosTransactions/src/cosTransactions.erl deleted file mode 100644 index 60e5fff46d..0000000000 --- a/lib/cosTransactions/src/cosTransactions.erl +++ /dev/null @@ -1,116 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%%  -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%%  -%% 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. -%%  -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File    : cosTransactions.erl -%% Purpose : Initialize the 'cosTransactions' application -%%---------------------------------------------------------------------- - --module(cosTransactions). - -%%--------------- INCLUDES ----------------------------------- -%% Local --include_lib("ETraP_Common.hrl"). --include_lib("CosTransactions.hrl"). -%%--------------- EXPORTS------------------------------------- -%% cosTransactions API external --export([start/0, stop/0, start_factory/1, start_factory/0, stop_factory/1]). - -%% Application callbacks --export([start/2, init/1, stop/1]). - -%%------------------------------------------------------------ -%% function : start/stop -%% Arguments:  -%% Returns  :  -%% Effect   : Starts or stops the cosTRansaction application. -%%------------------------------------------------------------ - -start() -> -    application:start(cosTransactions). -stop() -> -    application:stop(cosTransactions). - -%%------------------------------------------------------------ -%% function : start_factory  -%% Arguments: none or an argumentlist which by default is defined -%%            in ETraP_Common.hrl, i.e., '?tr_FAC_DEF' -%% Returns  : ObjectRef | {'EXCEPTION', _} | {'EXIT', Reason} -%% Effect   : Starts a CosTransactions_TransactionFactory -%%------------------------------------------------------------ - -start_factory() -> -    ?tr_start_child(?SUP_FAC(?tr_FAC_DEF)). -     -start_factory(Args) when is_list(Args) -> -    ?tr_start_child(?SUP_FAC(Args)); -start_factory(Args) -> -    ?tr_error_msg("applications:start( ~p ) failed. Bad parameters~n", [Args]), -    exit("applications:start failed. Bad parameters"). - -%%------------------------------------------------------------ -%% function : stop_factory  -%% Arguments: Factory Object Reference -%% Returns  : ok | {'EXCEPTION', _} -%% Effect   :  -%%------------------------------------------------------------ - -stop_factory(Fac)-> -    corba:dispose(Fac). - -%%------------------------------------------------------------ -%% function : start -%% Arguments: Type - see module application -%%            Arg  - see module application -%% Returns  :  -%% Effect   : Module callback for application -%%------------------------------------------------------------ - -start(_, _) -> -    supervisor:start_link({local, ?SUPERVISOR_NAME}, cosTransactions, app_init). - - -%%------------------------------------------------------------ -%% function : stop -%% Arguments: Arg - see module application -%% Returns  :  -%% Effect   : Module callback for application -%%------------------------------------------------------------ - -stop(_) -> -    ok. - -%%------------------------------------------------------------ -%% function : init -%% Arguments:  -%% Returns  :  -%% Effect   :  -%%------------------------------------------------------------ - -%% Starting using create_factory/X -init(own_init) -> -    {ok,{?SUP_FLAG, [?SUP_CHILD]}}; -%% When starting as an application. -init(app_init) -> -    {ok,{?SUP_FLAG, [?SUP_CHILD]}}. - - -%%--------------- END OF MODULE ------------------------------ diff --git a/lib/cosTransactions/src/etrap_logmgr.erl b/lib/cosTransactions/src/etrap_logmgr.erl deleted file mode 100644 index a5d9affe7d..0000000000 --- a/lib/cosTransactions/src/etrap_logmgr.erl +++ /dev/null @@ -1,201 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%%  -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%%  -%% 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. -%%  -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File    : etrap_logmgr.erl -%% Purpose : Make it easier to use disk_log. -%%---------------------------------------------------------------------- - --module(etrap_logmgr). - -%%--------------- INCLUDES ----------------------------------- -%% Local --include_lib("ETraP_Common.hrl"). -%%--------------- IMPORTS------------------------------------- -%%--------------- EXPORTS------------------------------------- --export([start/1, stop/1, log_safe/2, log_lazy/2, get_next/2]). - - -%%------------------------------------------------------------ -%% function : start -%% Arguments: LogName   - name of the disk_log. -%% Returns  :  -%% Effect   : creating linked log -%%------------------------------------------------------------ - -start(LogName) ->   -    case catch disk_log:open([{name, LogName},  -			      {file, LogName},  -			      {type, halt}, -			      {size, infinity}]) of -        {ok, LogName} -> -            ok; -        {error, Reason} -> -	    ?tr_error_msg("Initiating internal log failed: ~p", [Reason]), -	    exit({error, Reason}); -	{repaired, LogName, {recovered, _Rec}, {badbytes, _Bad}} -> -            ok; -	Other -> -	    ?tr_error_msg("Initiating internal log failed: ~p", [Other]), -	    exit({error, Other}) -    end. - -%%------------------------------------------------------------ -%% function : stop -%% Arguments: LogName - name of the disk_log. -%% Returns  :  -%% Effect   :  -%%------------------------------------------------------------ - -stop(LogName) -> -    case catch disk_log:close(LogName) of -        ok -> -            ok; -        {error, Reason} -> -	    ?tr_error_msg("Stopping internal log failed: ~p", [Reason]), -	    {error, Reason}; -	Other -> -	    ?tr_error_msg("Stopping internal log failed: ~p", [Other]), -	    {error, Other} -    end. -     - -%%------------------------------------------------------------ -%% function : log_safe -%% Arguments: LogName -  name of the disk_log. If 'dummy' is -%%            used nothing should be logged. Reason, reuse code. -%%            LogRecord - record to store in the log. -%% Returns  :  -%% Effect   : Writes a logrecord and synchronizes to make sure -%%            that the record is stored. -%%------------------------------------------------------------ - -log_safe(dummy, _) -> -    ok; -log_safe(LogName, LogRecord) -> -    case write_safe(LogName, LogRecord) of -	ok -> -	    ok; -	_ -> -	    %% We have to catch the exit because in some cases -	    %% it's not possible to abort action in the 2PC-protocol. -	    case catch start(LogName) of -		ok -> -		    write_safe(LogName, LogRecord); -		{'EXIT', Reason} -> -		    {error, Reason} -	    end -    end. - - -write_safe(LogName, LogRecord) -> -    case catch disk_log:log(LogName, LogRecord) of -        ok -> % wrote to kernel successfully -            case catch disk_log:sync(LogName) of -		ok -> % Written to disk successfully -		    ok; -		{error, Reason} -> -		    ?tr_error_msg("Internal log write failed: ~p   ~p", -				  [Reason, LogName]), -		    {error, Reason}; -		Other ->  -		    ?tr_error_msg("Internal log write failed: ~p   ~p", -				  [Other, LogName]), -		    {error, Other} -	    end; -	{error, Reason} -> -	    ?tr_error_msg("Internal log write failed: ~p   ~p", [Reason, LogName]), -	    {error, Reason}; -	Other -> -	    ?tr_error_msg("Internal log write failed: ~p   ~p", [Other, LogName]), -	    {error, Other} -    end. - - -%%------------------------------------------------------------ -%% function : log_lazy -%% Arguments: LogName -  name of the disk_log. If 'dummy' is -%%            used nothing should be logged. Reason, reuse code. -%%            LogRecord - record to store in the log.  -%% Returns  :  -%% Effect   : Writes a logrecord. The record may be lost. -%%------------------------------------------------------------ - -log_lazy(dummy, _LogRecord) -> -    ok; -log_lazy(LogName, LogRecord) -> -    case write_lazy(LogName, LogRecord) of -	ok -> -	    ok; -	_ -> -	    %% We have to catch the exit because in some cases -	    %% it's not possible to abort action in the 2PC-protocol. -	    case catch start(LogName) of -		ok -> -		    write_lazy(LogName, LogRecord); -		{'EXIT', Reason} -> -		    {error, Reason} -	    end -    end. - -write_lazy(LogName, LogRecord) -> -    case catch disk_log:log(LogName, LogRecord) of -        ok ->   -	    %% wrote to kernel successfully -            ok; -        {error, Reason} ->  -	    %% Write to kernel failed with Reason -	    ?tr_error_msg("Internal log write failed: ~p", [Reason]), -	    {error, Reason}; -	Other ->  -	    %% unknown message received. -	    ?tr_error_msg("Internal log write failed: ~p", [Other]), -	    {error, Other} -    end. - - -%%------------------------------------------------------------ -%% function : get_next -%% Arguments: LogName -  name of the disk_log. -%%            Cursor - place to read from. -%% Returns  : {Cursor, LogRecs} - A cursor and up to N logrecords. -%%            eof - the atom 'eof', indicating logfile empty.  -%%            {error, Reason} - error. -%% Effect   :  -%% Purpose  : Used when performing a REDO scan -%%------------------------------------------------------------ - -get_next(LogName, Cursor) -> -    case catch disk_log:chunk(LogName, Cursor, 1) of -	{NewCursor, [Data]} -> -	    {Data, NewCursor}; -	eof -> -	    eof; -	{error, Reason} -> -	    ?tr_error_msg("Internal log '~p' read failed: ~p", -		      [LogName, Reason]), -	    exit({error, Reason}); -	_Other -> -	    ?tr_error_msg("Internal log '~p' read failed: 'log_corrupt'", [LogName]), -	    exit({error, "log_corrupt"}) -    end. - -%%--------------- END OF MODULE ------------------------------ diff --git a/lib/cosTransactions/test/Makefile b/lib/cosTransactions/test/Makefile deleted file mode 100644 index 58199248d1..0000000000 --- a/lib/cosTransactions/test/Makefile +++ /dev/null @@ -1,151 +0,0 @@ -# -# %CopyrightBegin% -#  -# Copyright Ericsson AB 1999-2016. All Rights Reserved. -#  -# 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. -#  -# %CopyrightEnd% -# -# -include $(ERL_TOP)/make/target.mk -include $(ERL_TOP)/make/$(TARGET)/otp.mk - -#ifeq ($(TYPE),debug) -#ERL_COMPILE_FLAGS += -Ddebug -W -#endif - -# ---------------------------------------------------- -# Application version -# ---------------------------------------------------- -include ../vsn.mk -VSN=$(COSTRANSACTIONS_VSN) -# ---------------------------------------------------- -# Release directory specification -# ---------------------------------------------------- -RELSYSDIR = $(RELEASE_PATH)/cosTransactions_test - -# ---------------------------------------------------- -# Target Specs -# ---------------------------------------------------- -TEST_SPEC_FILE = cosTransactions.spec -COVER_FILE = cosTransactions.cover - - -IDL_FILES = \ -	etrap_test.idl - -IDLOUTDIR = idl_output - -MODULES =  \ -	transactions_SUITE \ -	etrap_test_server_impl \ -	etrap_test_lib \ -	generated_SUITE - -GEN_MODULES = \ -	oe_etrap_test \ -	etrap_test_server - -GEN_HRL_FILES = \ -	oe_etrap_test.hrl \ -	etrap_test_server.hrl - -ERL_FILES = $(MODULES:%=%.erl) - -HRL_FILES = \ -	etrap_test_lib.hrl - -GEN_FILES = \ -	$(GEN_HRL_FILES:%=$(IDLOUTDIR)/%) \ -	$(GEN_MODULES:%=$(IDLOUTDIR)/%.erl)  - -GEN_TARGET_FILES = $(GEN_MODULES:%=$(IDLOUTDIR)/%.$(EMULATOR)) - -SUITE_TARGET_FILES = $(MODULES:%=%.$(EMULATOR)) - -TARGET_FILES = \ -	$(GEN_TARGET_FILES) \ -	$(SUITE_TARGET_FILES) - - -# ---------------------------------------------------- -# PROGRAMS -# ---------------------------------------------------- -LOCAL_CLASSPATH = $(ERL_TOP)/lib/cosTransactions/priv:$(ERL_TOP)/lib/cosTransactions/test -# ---------------------------------------------------- -# FLAGS -# ---------------------------------------------------- -ERL_IDL_FLAGS += -pa $(ERL_TOP)/lib/cosTransactions/ebin\ -	-pa $(ERL_TOP)/lib/orber/ebin \ -	-pa $(ERL_TOP)/lib/ic/ebin - -ERL_COMPILE_FLAGS +=  \ -	$(ERL_IDL_FLAGS) \ -	-pa $(ERL_TOP)/lib/orber/include \ -	-pa $(ERL_TOP)/lib/cosTransactions/ebin \ -	-pa $(ERL_TOP)/lib/cosTransactions/test/idl_output \ -	-I$(ERL_TOP)/lib/orber/include \ -	-I$(ERL_TOP)/lib/cosTransactions \ -	-I$(ERL_TOP)/lib/cosTransactions/test/$(IDLOUTDIR) - -# ---------------------------------------------------- -# Targets -# ---------------------------------------------------- - - -tests debug opt: $(TARGET_FILES) - -clean: -	rm -f idl_output/* -	rm -f $(TARGET_FILES)  -	rm -f errs core *~ - -#debug: -#	@${MAKE} TYPE=debug - -docs: - -# ---------------------------------------------------- -# Special Targets -# ---------------------------------------------------- - -IDL-GENERATED: etrap_test.idl -	erlc $(ERL_IDL_FLAGS) -o$(IDLOUTDIR) \ -                +'{cfgfile,"etrap_test.cfg"}' etrap_test.idl -	>IDL-GENERATED - -$(GEN_FILES): IDL-GENERATED - -$(TARGET_FILES): IDL-GENERATED - -# ---------------------------------------------------- -# Release Targets -# ----------------------------------------------------  -# We don't copy generated intermediate erlang and hrl files - -include $(ERL_TOP)/make/otp_release_targets.mk - -release_spec:  - -release_docs_spec: - -release_tests_spec: tests -	$(INSTALL_DIR) "$(RELSYSDIR)" -	$(INSTALL_DATA) $(IDL_FILES)  $(TEST_SPEC_FILE) \ -		$(COVER_FILE) $(ERL_FILES) $(HRL_FILES) "$(RELSYSDIR)" -	$(INSTALL_DATA) $(SUITE_TARGET_FILES) "$(RELSYSDIR)" -	$(INSTALL_DIR) "$(RELSYSDIR)/$(IDLOUTDIR)" -	$(INSTALL_DATA) $(GEN_TARGET_FILES) $(GEN_FILES) \ -		"$(RELSYSDIR)/$(IDLOUTDIR)" - diff --git a/lib/cosTransactions/test/cosTransactions.cover b/lib/cosTransactions/test/cosTransactions.cover deleted file mode 100644 index b27bae999d..0000000000 --- a/lib/cosTransactions/test/cosTransactions.cover +++ /dev/null @@ -1,2 +0,0 @@ -{incl_app,cosTransactions,details}. - diff --git a/lib/cosTransactions/test/cosTransactions.spec b/lib/cosTransactions/test/cosTransactions.spec deleted file mode 100644 index 9918c8ca16..0000000000 --- a/lib/cosTransactions/test/cosTransactions.spec +++ /dev/null @@ -1 +0,0 @@ -{suites,"../cosTransactions_test",all}. diff --git a/lib/cosTransactions/test/etrap_test.cfg b/lib/cosTransactions/test/etrap_test.cfg deleted file mode 100644 index a2bc7d3fb7..0000000000 --- a/lib/cosTransactions/test/etrap_test.cfg +++ /dev/null @@ -1,21 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% 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. -%% -%% %CopyrightEnd% -%% -{this, "etrap_test::server"}. -{{handle_info, "etrap_test::server"}, true}. diff --git a/lib/cosTransactions/test/etrap_test.idl b/lib/cosTransactions/test/etrap_test.idl deleted file mode 100644 index 7379115be7..0000000000 --- a/lib/cosTransactions/test/etrap_test.idl +++ /dev/null @@ -1,39 +0,0 @@ -// -// %CopyrightBegin% -// -// Copyright Ericsson AB 1999-2016. All Rights Reserved. -// -// 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. -// -// %CopyrightEnd% -// - -#ifndef _TEST_IDL -#define _TEST_IDL -#include <../src/CosTransactions.idl> -module etrap_test {  - -  // interface server -  interface server : -    CosTransactions::Coordinator, CosTransactions::SubtransactionAwareResource,  -    CosTransactions::RecoveryCoordinator, CosTransactions::Control { -  }; -//   interface Server : -//     CosTransactions::Coordinator, CosTransactions::SubtransactionAwareResource,  -//     CosTransactions::RecoveryCoordinator, CosTransactions::Control, -//     CosTransactions::Synchronization { -//   }; - -}; // End of test Module - -#endif diff --git a/lib/cosTransactions/test/etrap_test_lib.erl b/lib/cosTransactions/test/etrap_test_lib.erl deleted file mode 100644 index e8d8c3a429..0000000000 --- a/lib/cosTransactions/test/etrap_test_lib.erl +++ /dev/null @@ -1,126 +0,0 @@ -%% -%% %CopyrightBegin% -%%  -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%%  -%% 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. -%%  -%% %CopyrightEnd% -%% -%% - --module(etrap_test_lib). - -%%--------------- INCLUDES --------------------------------------------- --include("etrap_test_lib.hrl"). --include_lib("cosTransactions/src/ETraP_Common.hrl"). - -%%--------------- EXPORTS ---------------------------------------------- --export([scratch_debug_fun/0, -	 activate_debug_fun/5, -	 update_debug_info/1, -	 deactivate_debug_fun/3, -	 eval_debug_fun/4, -	 set_debug_context/4]). - -%%--------------- CONSTANTS/DEFINITIONS -------------------------------- --define(DEBUG_TAB, etrap_debug). --record(debug_info, {id, function, type, file, line}). - -%%--------------- DEBUG FUNCTIONS -------------------------------------- -%% Managing conditional debug functions -%% -%% The main idea with the debug_fun's is to allow test programs -%% to control the internal behaviour of CosTransactions.  -%% -%% First should calls to ?eval_debug_fun be inserted at well -%% defined places in CosTransaction's code. E.g. in critical situations -%% of startup, transaction commit, backups etc. -%% -%% Then compile CosTransactions with the compiler option 'debug'. -%% -%% In test programs ?activate_debug_fun should be called -%% in order to bind a fun to the debug identifier stated -%% in the call to ?eval_debug_fun. - -scratch_debug_fun() -> -    catch ets:delete(?DEBUG_TAB), -    ets:new(?DEBUG_TAB, -	    [set, public, named_table, {keypos, 2}]). - -activate_debug_fun(FunId, Fun, Type, File, Line) -> -    io:format("Activiating ~p   RETRIES: ~p  WAIT: ~p~n",  -	      [FunId, ?tr_max_retries, ?tr_comm_failure_wait]), -    Info = #debug_info{id = FunId, -                       function = Fun, -                       type = Type, -                       file = File, -                       line = Line}, -    update_debug_info(Info). - -update_debug_info(Info) -> -    case catch ets:insert(?DEBUG_TAB, Info) of -        {'EXIT', _} -> -            scratch_debug_fun(), -            ets:insert(?DEBUG_TAB, Info); -        _ -> -            ok -    end, -    ok. - -deactivate_debug_fun(FunId, _File, _Line) -> -    catch ets:delete(?DEBUG_TAB, FunId), -    ok. - -eval_debug_fun(FunId, Env, File, Line) -> -    case catch ets:lookup(?DEBUG_TAB, FunId) of -        [] -> -            ok; -        [Info] -> -            Fun = Info#debug_info.function, -            case Info#debug_info.type of -		transient -> -		    deactivate_debug_fun(FunId, File, Line); -		_-> -		    ok -	    end, -	    io:format("Running debug fun ~p:~p (LINE: ~p)~n", [File, FunId, Line]), -	    Fun(Env); -	{'EXIT', _R} ->  -	    ok     -    end. - - -set_debug_context([], [], _, _)-> ok; -set_debug_context([], _, _, _)-> -    ets:delete(?DEBUG_TAB), -    exit("failed transactions_SUITE. Bad configuration."); -set_debug_context(_, [], _, _)-> -    ets:delete(?DEBUG_TAB), -    exit("failed transactions_SUITE Bad configuration."); -set_debug_context([RHead|RTail], [CHead|CTail], File, Line)-> -    write_context(RHead, CHead, File, Line), -    set_debug_context(RTail, CTail, File, Line). - -write_context(_Resource, [], _, _)-> ok; -write_context(Resource, [{Func, Fun, Type}|PTail], File, Line)-> -    etrap_test_lib:activate_debug_fun({Resource, Func},  -				      Fun, Type,  -				      File, Line), -    write_context(Resource, PTail, File, Line); -write_context(_,_, _, _) -> -    ets:delete(?DEBUG_TAB), -    exit("failed transactions_SUITE. Bad configuration."). - - -%%--------------- END OF MODULE ---------------------------------------- diff --git a/lib/cosTransactions/test/etrap_test_lib.hrl b/lib/cosTransactions/test/etrap_test_lib.hrl deleted file mode 100644 index 6fe61a4d45..0000000000 --- a/lib/cosTransactions/test/etrap_test_lib.hrl +++ /dev/null @@ -1,101 +0,0 @@ -%% -%% %CopyrightBegin% -%%  -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%%  -%% 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. -%%  -%% %CopyrightEnd% -%% -%% - --ifndef(ETRAP_TEST_LIB_HRL). --define(ETRAP_TEST_LIB_HRL, true). - --define(match(ExpectedRes, Expr, Msg), -	fun() -> -	       AcTuAlReS = (catch (Expr)), -	       case AcTuAlReS of -		   ExpectedRes -> -		       io:format("~n------ CORRECT RESULT ------~n~p~n~p~n", -				 [AcTuAlReS, Msg]), -		       ok; -		   _ -> -		       io:format("~n###### ERROR ERROR ######~n~p~n~p~n", -				 [AcTuAlReS, Msg]), -		       exit(AcTuAlReS) -	       end -       end()). - --define(match_inverse(NotExpectedRes, Expr, Msg), -	fun() -> -		AcTuAlReS = (catch (Expr)), -	       case AcTuAlReS of -		   NotExpectedRes -> -		       io:format("~n###### ERROR ERROR ######~n ~p~n~p~n", -				 [AcTuAlReS, Msg]), -		       exit(AcTuAlReS); -		   _ -> -		       io:format("~n------ CORRECT RESULT ------~n~p~n~p~n", -				 [AcTuAlReS, Msg]), -		       ok -	       end -       end()). - - --define(crash_and_recover, fun(_Env)-> exit(crash_and_burn) end). - --define(crash_no_recovery, fun(Env)-> throw({stop,normal,{Env,state}}) end). - --define(delay(Time), fun(_Id) -> timer:sleep(Time*1000) end). - --define(TIMEOUT,        4). --define(SUP_TEST(Env, Name),  -	['etrap_test_server', Env,  -	 [{sup_child, true}, {persistent, true},  -	  {regname, {global, Name}}]]). - --define(no_context, [[],[],[], []]). --define(nop, []). --define(delay_transient(Tag, Ti), -	[{Tag, ?delay(Ti), transient}]). --define(crash_transient(Tag), -	[{Tag, ?crash_and_recover, transient}]). --define(crash_permanent(Tag), -	[{Tag, ?crash_no_recovery, permanent}]). - -%%----------------------------------------------------------- -%% Definition of 'Resource' action. -%%                         function  action  reply -%%----------------------------------------------------------- -%% raise #'CosTransactions_HeuristicMixed' {} --define(rollback_mix,     [{rollback, exc, ?tr_mixed}]). --define(commit_mix,       [{commit,   exc, ?tr_mixed}]). --define(prepare_mix,      [{prepare,  exc, ?tr_mixed}]). -%% raise #'CosTransactions_HeuristicRollback' {} --define(rollback_rb,      [{rollback, exc, ?tr_rollback}]). --define(commit_rb,        [{commit,   exc, ?tr_rollback}]). -%% raise #'CosTransactions_HeuristicCommit' {} --define(rollback_cm,      [{rollback, exc, ?tr_commit}]). --define(commit_cm,        [{commit,   exc, ?tr_commit}]). -%% delay reply --define(rollback_delay,   [{rollback, delay, ?TIMEOUT*2}]). --define(commit_delay,     [{commit,   delay, ?TIMEOUT*2}]). --define(prepare_delay,    [{prepare,  delay, ?TIMEOUT*2}]). -%% other reply than default --define(prepare_commit,   [{prepare,  reply, 'VoteCommit'}]). --define(prepare_rollback, [{prepare,  stop_reply, 'VoteRollback'}]). - --endif. - -%%-------------- EOF --------------------------------------------------- diff --git a/lib/cosTransactions/test/etrap_test_server_impl.erl b/lib/cosTransactions/test/etrap_test_server_impl.erl deleted file mode 100644 index 8a244b42c7..0000000000 --- a/lib/cosTransactions/test/etrap_test_server_impl.erl +++ /dev/null @@ -1,211 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% 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. -%% -%% %CopyrightEnd% -%% -%% --module(etrap_test_server_impl). - -%%--------------- INCLUDES ----------------------------------- --include_lib("orber/include/corba.hrl"). --include_lib("orber/include/ifr_types.hrl"). -%% Local --include_lib("cosTransactions/src/ETraP_Common.hrl"). --include_lib("cosTransactions/include/CosTransactions.hrl"). -%%--------------- IMPORTS------------------------------------- -%%--------------- EXPORTS------------------------------------- --export([prepare/2,  -	 rollback/2,  -	 commit/2,  -	 commit_one_phase/2,  -	 forget/2, -%	 before_completion/2, -%	 after_completion/3, -	 commit_subtransaction/3, -	 rollback_subtransaction/2]). - - -%%--------------- gen_server specific ------------------------ --export([init/1, terminate/2]). --export([handle_call/3, handle_cast/2, handle_info/2, code_change/3]). - -%%------------------------------------------------------------ -%% function : init, terminate -%%------------------------------------------------------------ -init(State) -> -    process_flag(trap_exit,true), -    io:format("etrap_test_server:init ~p~n", [State]), -    ?debug_print("STARTING etrap_test_server( ~p )~n", [State]), -    {ok, State}. - -terminate(Reason, _State) -> -    io:format("etrap_test_server:terminate ~p~n", [Reason]), -    ?debug_print("STOPREASON etrap_test_server( ~p )~n", [Reason]), -    ok. - -code_change(_OldVsn, State, _Extra) -> -    {ok, State}. -handle_call(_,_, State) -> -    {noreply, State}. -handle_cast(_, State) -> -    {noreply, State}. -handle_info(_Info, State) -> -    {noreply, State}. - -%%-- Inherit from CosTransactions::SubtransactionAwareResource -- -prepare(_Self, State) ->     -    case ?is_debug_compiled of -	true -> -	    io:format("etrap_test_server:prepare ~p~n", [State]); -	_-> -	    ok -    end, -%    ?debug_print("etrap_test_server:prepare ~p~n", [State]), -    action(prepare, State, {reply, 'VoteCommit', State}). - -rollback(_Self, State) -> -    case ?is_debug_compiled of -	true -> -	    io:format("etrap_test_server:rollback ~p~n", [State]); -	_-> -	    ok -    end, -%    ?debug_print("etrap_test_server:rollback ~p~n", [State]), -    case sync_test(State) of -	true -> -	    action(rollback, State, {reply, ok, State}); -	_-> -	    action(rollback, State, {stop, normal, ok, State}) -    end. - -commit(_Self, State) -> -    case ?is_debug_compiled of -	true -> -	    io:format("etrap_test_server:commit ~p~n", [State]); -	_-> -	    ok -    end, -%    ?debug_print("etrap_test_server:commit ~p~n", [State]), -    case sync_test(State) of -	true -> -	    action(commit, State, {reply, ok, State}); -	_-> -	    action(commit, State, {stop, normal, ok, State}) -    end. - -commit_one_phase(_Self, State) -> -    case ?is_debug_compiled of -	true -> -	    io:format("etrap_test_server:commit_one_phase ~p~n", [State]); -	_-> -	    ok -    end, -%    ?debug_print("etrap_test_server:commit_one_phase ~p~n", [State]), -    case sync_test(State) of -	true -> -	    {reply, ok, State}; -	_-> -	    {stop, normal, ok, State} -    end. - -forget(_Self, State) -> -    case ?is_debug_compiled of -	true -> -	    io:format("etrap_test_server:forget ~p~n", [State]); -	_-> -	    ok -    end, -%    ?debug_print("etrap_test_server:forget ~p~n", [State]), -    case sync_test(State) of -	true -> -	    {reply, ok, State}; -	_-> -	    {stop, normal, ok, State} -    end. - -commit_subtransaction(_Self, State, Parent) -> -    case ?is_debug_compiled of -	true -> -	    io:format("etrap_test_server:commit_subtransaction( ~p )~n", [Parent]); -	_-> -	    ok -    end, -%    ?debug_print("etrap_test_server:commit_subtransaction( ~p )~n", [Parent]), -    {reply, ok, State}. -rollback_subtransaction(_Self, State) -> -    case ?is_debug_compiled of -	true -> -	    io:format("etrap_test_server:rollback_subtransaction()~n", []); -	_-> -	    ok -    end, -%    ?debug_print("etrap_test_server:rollback_subtransaction()~n", []), -    {reply, ok, State}. - -%before_completion(_Self, State) -> -%    case ?is_debug_compiled of -%	true -> -%	    io:format("etrap_test_server:before_completion()~n", []); -%	_-> -%	    ok -%    end, -%%    ?debug_print("etrap_test_server:before_completion()~n", []), -%    {reply, ok, State}. -%after_completion(_Self, State, Status) -> -%    case ?is_debug_compiled of -%	true -> -%	    io:format("etrap_test_server:after_completion( ~p )~n", [Status]); -%	_-> -%	    ok -%    end, -%%    ?debug_print("etrap_test_server:after_completion( ~p )~n", [Status]), -%    {stop, normal, ok, State}. - -%%--------------- LOCAL FUNCTIONS ---------------------------- -action(Key, State, Default) -> -    case catch lists:keysearch(Key, 1, State) of -        {value,{Key, stop_reply, R}} -> -	    case sync_test(State) of -		true -> -		    {reply, R, State}; -		_-> -		    {stop, normal, R, State} -	    end; -        {value,{Key, reply, R}} -> -	    {reply, R, State}; -        {value,{Key, exc, E}} -> -	    corba:raise(E); -        {value,{Key, delay, Time}} -> -            timer:sleep(Time*1000), -	    Default; -        {value,{Key,Value}} -> -            Value; -        _ -> -	    Default -    end. - -sync_test(State) -> -    case catch lists:keysearch(sync, 1, State) of -        {value,{sync, true}} -> -	    true; -        _ -> -	    false -    end. - - -%%--------------- END OF MODULE ------------------------------ - diff --git a/lib/cosTransactions/test/generated_SUITE.erl b/lib/cosTransactions/test/generated_SUITE.erl deleted file mode 100644 index 52b850b189..0000000000 --- a/lib/cosTransactions/test/generated_SUITE.erl +++ /dev/null @@ -1,543 +0,0 @@ -%%----------------------------------------------------------------- -%% -%% %CopyrightBegin% -%%  -%% Copyright Ericsson AB 2004-2016. All Rights Reserved. -%%  -%% 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. -%%  -%% %CopyrightEnd% -%% -%% -%%----------------------------------------------------------------- -%% File    : generated_SUITE.erl -%% Purpose :  -%% Created : 27 Jan 2004 -%%----------------------------------------------------------------- - --module(generated_SUITE). - --include_lib("common_test/include/ct.hrl"). --include_lib("orber/include/corba.hrl"). - --define(default_timeout, test_server:minutes(3)). - --define(match(ExpectedRes, Expr), -        fun() -> -		AcTuAlReS = (catch (Expr)), -		case AcTuAlReS of -		    ExpectedRes -> -			AcTuAlReS; -		    _ -> -			io:format("###### ERROR ERROR ######~n~p~n", -				  [AcTuAlReS]), -			exit(AcTuAlReS) -		end -	end()). - --define(nomatch(Not, Expr), -        fun() -> -		AcTuAlReS = (catch (Expr)), -		case AcTuAlReS of -		    Not -> -			io:format("###### ERROR ERROR ######~n~p~n", -				  [AcTuAlReS]), -			exit(AcTuAlReS); -		    _ -> -			AcTuAlReS -		end -	end()). - - --define(checktc(_Op), -        fun(TC) -> -		case orber_tc:check_tc(TC) of -		    false -> -			io:format("###### ERROR ERROR ######~n~p - ~p~n", [Op, TC]), -			exit(TC); -		    true -> -			true -		end -	end). - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1,  -	 init_per_group/2,end_per_group/2]). - -%%----------------------------------------------------------------- -%% Internal exports -%%----------------------------------------------------------------- --compile(export_all). - -%%----------------------------------------------------------------- -%% Func: all/1 -%% Args:  -%% Returns:  -%%----------------------------------------------------------------- -suite() -> [{ct_hooks,[ts_install_cth]}]. - -all() ->  -    ['CosTransactions_Control', -     'CosTransactions_Coordinator', -     'CosTransactions_HeuristicCommit', -     'CosTransactions_HeuristicHazard', -     'CosTransactions_HeuristicMixed', -     'CosTransactions_HeuristicRollback', -     'CosTransactions_Inactive', -     'CosTransactions_InvalidControl', -     'CosTransactions_NoTransaction', -     'CosTransactions_NotPrepared', -     'CosTransactions_NotSubtransaction', -     'CosTransactions_RecoveryCoordinator', -     'CosTransactions_Resource', -     'CosTransactions_SubtransactionAwareResource', -     'CosTransactions_SubtransactionsUnavailable', -     'CosTransactions_Terminator', -     'CosTransactions_TransactionFactory', -     'CosTransactions_Unavailable', -     'CosTransactions_SynchronizationUnavailable', -     'CosTransactions_TransIdentity', -     'CosTransactions_PropagationContext', -     'CosTransactions_otid_t', -     'CosTransactions_WrongTransaction', 'ETraP_Server']. - -groups() ->  -    []. - -init_per_suite(Config) -> -    Config. - -end_per_suite(_Config) -> -    ok. - -init_per_group(_GroupName, Config) -> -    Config. - -end_per_group(_GroupName, Config) -> -    Config. - - -%%----------------------------------------------------------------- -%% Init and cleanup functions. -%%----------------------------------------------------------------- -init_per_testcase(_Case, Config) -> -    Dog=test_server:timetrap(?default_timeout), -    [{watchdog, Dog}|Config]. - -end_per_testcase(_Case, Config) -> -    Dog = proplists:get_value(watchdog, Config), -    test_server:timetrap_cancel(Dog), -    ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_HeuristicCommit' -%% Description:  -%%----------------------------------------------------------------- -'CosTransactions_HeuristicCommit'(_) -> -    ?match(true, orber_tc:check_tc('CosTransactions_HeuristicCommit':tc())), -    ?match("IDL:omg.org/CosTransactions/HeuristicCommit:1.0",  -	   'CosTransactions_HeuristicCommit':id()), -    ?match("CosTransactions_HeuristicCommit",  -	   'CosTransactions_HeuristicCommit':name()), -    ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_HeuristicHazard' -%% Description:  -%%----------------------------------------------------------------- -'CosTransactions_HeuristicHazard'(_) -> -    ?match(true, orber_tc:check_tc('CosTransactions_HeuristicHazard':tc())), -    ?match("IDL:omg.org/CosTransactions/HeuristicHazard:1.0",  -	   'CosTransactions_HeuristicHazard':id()), -    ?match("CosTransactions_HeuristicHazard",  -	   'CosTransactions_HeuristicHazard':name()), -    ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_HeuristicMixed' -%% Description:  -%%----------------------------------------------------------------- -'CosTransactions_HeuristicMixed'(_) -> -    ?match(true, orber_tc:check_tc('CosTransactions_HeuristicMixed':tc())), -    ?match("IDL:omg.org/CosTransactions/HeuristicMixed:1.0",  -	   'CosTransactions_HeuristicMixed':id()), -    ?match("CosTransactions_HeuristicMixed",  -	   'CosTransactions_HeuristicMixed':name()), -    ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_HeuristicRollback' -%% Description:  -%%----------------------------------------------------------------- -'CosTransactions_HeuristicRollback'(_) -> -    ?match(true, orber_tc:check_tc('CosTransactions_HeuristicRollback':tc())), -    ?match("IDL:omg.org/CosTransactions/HeuristicRollback:1.0",  -	   'CosTransactions_HeuristicRollback':id()), -    ?match("CosTransactions_HeuristicRollback",  -	   'CosTransactions_HeuristicRollback':name()), -    ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_Inactive' -%% Description:  -%%----------------------------------------------------------------- -'CosTransactions_Inactive'(_) -> -    ?match(true, orber_tc:check_tc('CosTransactions_Inactive':tc())), -    ?match("IDL:omg.org/CosTransactions/Inactive:1.0",  -	   'CosTransactions_Inactive':id()), -    ?match("CosTransactions_Inactive",  -	   'CosTransactions_Inactive':name()), -    ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_InvalidControl' -%% Description:  -%%----------------------------------------------------------------- -'CosTransactions_InvalidControl'(_) -> -    ?match(true, orber_tc:check_tc('CosTransactions_InvalidControl':tc())), -    ?match("IDL:omg.org/CosTransactions/InvalidControl:1.0",  -	   'CosTransactions_InvalidControl':id()), -    ?match("CosTransactions_InvalidControl",  -	   'CosTransactions_InvalidControl':name()), -    ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_NoTransaction' -%% Description:  -%%----------------------------------------------------------------- -'CosTransactions_NoTransaction'(_) -> -    ?match(true, orber_tc:check_tc('CosTransactions_NoTransaction':tc())), -    ?match("IDL:omg.org/CosTransactions/NoTransaction:1.0",  -	   'CosTransactions_NoTransaction':id()), -    ?match("CosTransactions_NoTransaction",  -	   'CosTransactions_NoTransaction':name()), -    ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_NotPrepared' -%% Description:  -%%----------------------------------------------------------------- -'CosTransactions_NotPrepared'(_) -> -    ?match(true, orber_tc:check_tc('CosTransactions_NotPrepared':tc())), -    ?match("IDL:omg.org/CosTransactions/NotPrepared:1.0",  -	   'CosTransactions_NotPrepared':id()), -    ?match("CosTransactions_NotPrepared",  -	   'CosTransactions_NotPrepared':name()), -    ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_NotSubtransaction' -%% Description:  -%%----------------------------------------------------------------- -'CosTransactions_NotSubtransaction'(_) -> -    ?match(true, orber_tc:check_tc('CosTransactions_NotSubtransaction':tc())), -    ?match("IDL:omg.org/CosTransactions/NotSubtransaction:1.0",  -	   'CosTransactions_NotSubtransaction':id()), -    ?match("CosTransactions_NotSubtransaction",  -	   'CosTransactions_NotSubtransaction':name()), -    ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_SubtransactionsUnavailable' -%% Description:  -%%----------------------------------------------------------------- -'CosTransactions_SubtransactionsUnavailable'(_) -> -    ?match(true, orber_tc:check_tc('CosTransactions_SubtransactionsUnavailable':tc())), -    ?match("IDL:omg.org/CosTransactions/SubtransactionsUnavailable:1.0",  -	   'CosTransactions_SubtransactionsUnavailable':id()), -    ?match("CosTransactions_SubtransactionsUnavailable",  -	   'CosTransactions_SubtransactionsUnavailable':name()), -    ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_Unavailable' -%% Description:  -%%----------------------------------------------------------------- -'CosTransactions_Unavailable'(_) -> -    ?match(true, orber_tc:check_tc('CosTransactions_Unavailable':tc())), -    ?match("IDL:omg.org/CosTransactions/Unavailable:1.0",  -	   'CosTransactions_Unavailable':id()), -    ?match("CosTransactions_Unavailable",  -	   'CosTransactions_Unavailable':name()), -    ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_SynchronizationUnavailable' -%% Description:  -%%----------------------------------------------------------------- -'CosTransactions_SynchronizationUnavailable'(_) -> -    ?match(true, orber_tc:check_tc('CosTransactions_SynchronizationUnavailable':tc())), -    ?match("IDL:omg.org/CosTransactions/SynchronizationUnavailable:1.0",  -	   'CosTransactions_SynchronizationUnavailable':id()), -    ?match("CosTransactions_SynchronizationUnavailable",  -	   'CosTransactions_SynchronizationUnavailable':name()), -    ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_TransIdentity' -%% Description:  -%%----------------------------------------------------------------- -'CosTransactions_TransIdentity'(_) -> -    ?match(true, orber_tc:check_tc('CosTransactions_TransIdentity':tc())), -    ?match("IDL:omg.org/CosTransactions/TransIdentity:1.0",  -	   'CosTransactions_TransIdentity':id()), -    ?match("CosTransactions_TransIdentity",  -	   'CosTransactions_TransIdentity':name()), -    ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_PropagationContext' -%% Description:  -%%----------------------------------------------------------------- -'CosTransactions_PropagationContext'(_) -> -    ?match(true, orber_tc:check_tc('CosTransactions_PropagationContext':tc())), -    ?match("IDL:omg.org/CosTransactions/PropagationContext:1.0",  -	   'CosTransactions_PropagationContext':id()), -    ?match("CosTransactions_PropagationContext",  -	   'CosTransactions_PropagationContext':name()), -    ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_otid_t' -%% Description:  -%%----------------------------------------------------------------- -'CosTransactions_otid_t'(_) -> -    ?match(true, orber_tc:check_tc('CosTransactions_otid_t':tc())), -    ?match("IDL:omg.org/CosTransactions/otid_t:1.0",  -	   'CosTransactions_otid_t':id()), -    ?match("CosTransactions_otid_t",  -	   'CosTransactions_otid_t':name()), -    ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_WrongTransaction' -%% Description:  -%%----------------------------------------------------------------- -'CosTransactions_WrongTransaction'(_) -> -    ?match(true, orber_tc:check_tc('CosTransactions_WrongTransaction':tc())), -    ?match("IDL:omg.org/CosTransactions/WrongTransaction:1.0",  -	   'CosTransactions_WrongTransaction':id()), -    ?match("CosTransactions_WrongTransaction",  -	   'CosTransactions_WrongTransaction':name()), -    ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_Control' -%% Description:  -%%----------------------------------------------------------------- -'CosTransactions_Control'(_) -> -    ?nomatch(undefined, 'CosTransactions_Control':oe_tc(get_terminator)), -    ?nomatch(undefined, 'CosTransactions_Control':oe_tc(get_coordinator)), -    ?match(undefined, 'CosTransactions_Control':oe_tc(undefined)), -    ?match([_|_], 'CosTransactions_Control':oe_get_interface()), -    ?match("IDL:omg.org/CosTransactions/Control:1.0",  -	   'CosTransactions_Control':typeID()), -    check_tc('CosTransactions_Control':oe_get_interface()), -    ?match(true, 'CosTransactions_Control':oe_is_a('CosTransactions_Control':typeID())), -    ?match(false, 'CosTransactions_Control':oe_is_a("wrong")), -    ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_Coordinator' -%% Description:  -%%----------------------------------------------------------------- -'CosTransactions_Coordinator'(_) -> -    ?nomatch(undefined, 'CosTransactions_Coordinator':oe_tc(get_status)), -    ?nomatch(undefined, 'CosTransactions_Coordinator':oe_tc(get_parent_status)), -    ?nomatch(undefined, 'CosTransactions_Coordinator':oe_tc(get_top_level_status)), -    ?nomatch(undefined, 'CosTransactions_Coordinator':oe_tc(is_same_transaction)), -    ?nomatch(undefined, 'CosTransactions_Coordinator':oe_tc(is_related_transaction)), -    ?nomatch(undefined, 'CosTransactions_Coordinator':oe_tc(is_ancestor_transaction)), -    ?nomatch(undefined, 'CosTransactions_Coordinator':oe_tc(is_descendant_transaction)), -    ?nomatch(undefined, 'CosTransactions_Coordinator':oe_tc(is_top_level_transaction)), -    ?nomatch(undefined, 'CosTransactions_Coordinator':oe_tc(hash_transaction)), -    ?nomatch(undefined, 'CosTransactions_Coordinator':oe_tc(hash_top_level_tran)), -    ?nomatch(undefined, 'CosTransactions_Coordinator':oe_tc(register_resource)), -    ?nomatch(undefined, 'CosTransactions_Coordinator':oe_tc(register_subtran_aware)), -    ?nomatch(undefined, 'CosTransactions_Coordinator':oe_tc(rollback_only)), -    ?nomatch(undefined, 'CosTransactions_Coordinator':oe_tc(get_transaction_name)), -    ?nomatch(undefined, 'CosTransactions_Coordinator':oe_tc(create_subtransaction)), -    ?nomatch(undefined, 'CosTransactions_Coordinator':oe_tc(get_txcontext)), -    ?match(undefined, 'CosTransactions_Coordinator':oe_tc(undefined)), -    ?match([_|_], 'CosTransactions_Coordinator':oe_get_interface()), -    ?match("IDL:omg.org/CosTransactions/Coordinator:1.0",  -	   'CosTransactions_Coordinator':typeID()), -    check_tc('CosTransactions_Coordinator':oe_get_interface()), -    ?match(true, 'CosTransactions_Coordinator':oe_is_a('CosTransactions_Coordinator':typeID())), -    ?match(false, 'CosTransactions_Coordinator':oe_is_a("wrong")), -    ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_RecoveryCoordinator' -%% Description:  -%%----------------------------------------------------------------- -'CosTransactions_RecoveryCoordinator'(_) -> -    ?nomatch(undefined, 'CosTransactions_RecoveryCoordinator':oe_tc(replay_completion)), -    ?match(undefined, 'CosTransactions_RecoveryCoordinator':oe_tc(undefined)), -    ?match([_|_], 'CosTransactions_RecoveryCoordinator':oe_get_interface()), -    ?match("IDL:omg.org/CosTransactions/RecoveryCoordinator:1.0",  -	   'CosTransactions_RecoveryCoordinator':typeID()), -    check_tc('CosTransactions_RecoveryCoordinator':oe_get_interface()), -    ?match(true, 'CosTransactions_RecoveryCoordinator':oe_is_a('CosTransactions_RecoveryCoordinator':typeID())), -    ?match(false, 'CosTransactions_RecoveryCoordinator':oe_is_a("wrong")), -    ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_Resource' -%% Description:  -%%----------------------------------------------------------------- -'CosTransactions_Resource'(_) -> -    ?nomatch(undefined, 'CosTransactions_Resource':oe_tc(prepare)), -    ?nomatch(undefined, 'CosTransactions_Resource':oe_tc(rollback)), -    ?nomatch(undefined, 'CosTransactions_Resource':oe_tc(commit)), -    ?nomatch(undefined, 'CosTransactions_Resource':oe_tc(commit_one_phase)), -    ?nomatch(undefined, 'CosTransactions_Resource':oe_tc(forget)), -    ?match(undefined, 'CosTransactions_Resource':oe_tc(undefined)), -    ?match([_|_], 'CosTransactions_Resource':oe_get_interface()), -    ?match("IDL:omg.org/CosTransactions/Resource:1.0",  -	   'CosTransactions_Resource':typeID()), -    check_tc('CosTransactions_Resource':oe_get_interface()), -    ?match(true, 'CosTransactions_Resource':oe_is_a('CosTransactions_Resource':typeID())), -    ?match(false, 'CosTransactions_Resource':oe_is_a("wrong")), -    ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_SubtransactionAwareResource' -%% Description:  -%%----------------------------------------------------------------- -'CosTransactions_SubtransactionAwareResource'(_) -> -    ?nomatch(undefined, 'CosTransactions_SubtransactionAwareResource':oe_tc(commit_subtransaction)), -    ?nomatch(undefined, 'CosTransactions_SubtransactionAwareResource':oe_tc(rollback_subtransaction)), -    ?nomatch(undefined, 'CosTransactions_SubtransactionAwareResource':oe_tc(prepare)), -    ?nomatch(undefined, 'CosTransactions_SubtransactionAwareResource':oe_tc(rollback)), -    ?nomatch(undefined, 'CosTransactions_SubtransactionAwareResource':oe_tc(commit)), -    ?nomatch(undefined, 'CosTransactions_SubtransactionAwareResource':oe_tc(commit_one_phase)), -    ?nomatch(undefined, 'CosTransactions_SubtransactionAwareResource':oe_tc(forget)), -    ?match(undefined, 'CosTransactions_SubtransactionAwareResource':oe_tc(undefined)), -    ?match([_|_], 'CosTransactions_SubtransactionAwareResource':oe_get_interface()), -    ?match("IDL:omg.org/CosTransactions/SubtransactionAwareResource:1.0",  -	   'CosTransactions_SubtransactionAwareResource':typeID()), -    check_tc('CosTransactions_SubtransactionAwareResource':oe_get_interface()), -    ?match(true, 'CosTransactions_SubtransactionAwareResource':oe_is_a('CosTransactions_SubtransactionAwareResource':typeID())), -    ?match(true, 'CosTransactions_SubtransactionAwareResource':oe_is_a('CosTransactions_Resource':typeID())), -    ?match(false, 'CosTransactions_SubtransactionAwareResource':oe_is_a("wrong")), -    ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_Terminator' -%% Description:  -%%----------------------------------------------------------------- -'CosTransactions_Terminator'(_) -> -    ?nomatch(undefined, 'CosTransactions_Terminator':oe_tc(commit)), -    ?nomatch(undefined, 'CosTransactions_Terminator':oe_tc(rollback)), -    ?match(undefined, 'CosTransactions_Terminator':oe_tc(undefined)), -    ?match([_|_], 'CosTransactions_Terminator':oe_get_interface()), -    ?match("IDL:omg.org/CosTransactions/Terminator:1.0",  -	   'CosTransactions_Terminator':typeID()), -    check_tc('CosTransactions_Terminator':oe_get_interface()), -    ?match(true, 'CosTransactions_Terminator':oe_is_a('CosTransactions_Terminator':typeID())), -    ?match(false, 'CosTransactions_Terminator':oe_is_a("wrong")), -    ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_TransactionFactory' -%% Description:  -%%----------------------------------------------------------------- -'CosTransactions_TransactionFactory'(_) -> -    ?nomatch(undefined, 'CosTransactions_TransactionFactory':oe_tc(create)), -    ?nomatch(undefined, 'CosTransactions_TransactionFactory':oe_tc(recreate)), -    ?match(undefined, 'CosTransactions_TransactionFactory':oe_tc(undefined)), -    ?match([_|_], 'CosTransactions_TransactionFactory':oe_get_interface()), -    ?match("IDL:omg.org/CosTransactions/TransactionFactory:1.0",  -	   'CosTransactions_TransactionFactory':typeID()), -    check_tc('CosTransactions_TransactionFactory':oe_get_interface()), -    ?match(true, 'CosTransactions_TransactionFactory':oe_is_a('CosTransactions_TransactionFactory':typeID())), -    ?match(false, 'CosTransactions_TransactionFactory':oe_is_a("wrong")), -    ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'ETraP_Server' -%% Description:  -%%----------------------------------------------------------------- -'ETraP_Server'(_) -> -    ?nomatch(undefined, 'ETraP_Server':oe_tc(get_status)), -    ?nomatch(undefined, 'ETraP_Server':oe_tc(get_parent_status)), -    ?nomatch(undefined, 'ETraP_Server':oe_tc(get_top_level_status)), -    ?nomatch(undefined, 'ETraP_Server':oe_tc(is_same_transaction)), -    ?nomatch(undefined, 'ETraP_Server':oe_tc(is_related_transaction)), -    ?nomatch(undefined, 'ETraP_Server':oe_tc(is_ancestor_transaction)), -    ?nomatch(undefined, 'ETraP_Server':oe_tc(is_descendant_transaction)), -    ?nomatch(undefined, 'ETraP_Server':oe_tc(is_top_level_transaction)), -    ?nomatch(undefined, 'ETraP_Server':oe_tc(hash_transaction)), -    ?nomatch(undefined, 'ETraP_Server':oe_tc(hash_top_level_tran)), -    ?nomatch(undefined, 'ETraP_Server':oe_tc(register_resource)), -    ?nomatch(undefined, 'ETraP_Server':oe_tc(register_subtran_aware)), -    ?nomatch(undefined, 'ETraP_Server':oe_tc(rollback_only)), -    ?nomatch(undefined, 'ETraP_Server':oe_tc(get_transaction_name)), -    ?nomatch(undefined, 'ETraP_Server':oe_tc(create_subtransaction)), -    ?nomatch(undefined, 'ETraP_Server':oe_tc(get_txcontext)), -    ?nomatch(undefined, 'ETraP_Server':oe_tc(prepare)), -    ?nomatch(undefined, 'ETraP_Server':oe_tc(rollback)), -    ?nomatch(undefined, 'ETraP_Server':oe_tc(commit)), -    ?nomatch(undefined, 'ETraP_Server':oe_tc(commit_one_phase)), -    ?nomatch(undefined, 'ETraP_Server':oe_tc(forget)), -    ?nomatch(undefined, 'ETraP_Server':oe_tc(replay_completion)), -    ?nomatch(undefined, 'ETraP_Server':oe_tc(get_terminator)), -    ?nomatch(undefined, 'ETraP_Server':oe_tc(get_coordinator)), -    ?match(undefined, 'ETraP_Server':oe_tc(undefined)), -    ?match([_|_], 'ETraP_Server':oe_get_interface()), -    ?match("IDL:omg.org/ETraP/Server:1.0",  -	   'ETraP_Server':typeID()), -    check_tc('ETraP_Server':oe_get_interface()), -    ?match(true, 'ETraP_Server':oe_is_a('ETraP_Server':typeID())), -    ?match(true, 'ETraP_Server':oe_is_a('CosTransactions_Coordinator':typeID())), -    ?match(true, 'ETraP_Server':oe_is_a('CosTransactions_Resource':typeID())), -    ?match(true, 'ETraP_Server':oe_is_a('CosTransactions_RecoveryCoordinator':typeID())), -    ?match(true, 'ETraP_Server':oe_is_a('CosTransactions_Control':typeID())), -    ?match(false, 'ETraP_Server':oe_is_a("wrong")), -    ok. - - -%%----------------------------------------------------------------- -%% MISC functions -%%----------------------------------------------------------------- -check_tc([]) -> -    ok; -check_tc([{Op, {RetType, InParameters, OutParameters}}|T]) -> -    io:format("checked - ~s~n", [Op]), -    lists:all(?checktc(Op), [RetType|InParameters]), -    lists:all(?checktc(Op), OutParameters), -    check_tc(T). -     -     diff --git a/lib/cosTransactions/test/transactions_SUITE.erl b/lib/cosTransactions/test/transactions_SUITE.erl deleted file mode 100644 index 00753a4e6e..0000000000 --- a/lib/cosTransactions/test/transactions_SUITE.erl +++ /dev/null @@ -1,396 +0,0 @@ -%% -%% %CopyrightBegin% -%%  -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%%  -%% 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. -%%  -%% %CopyrightEnd% -%% -%% --module(transactions_SUITE). - -%%--------------- INCLUDES ----------------------------------- --include_lib("orber/include/corba.hrl"). --include_lib("orber/include/ifr_types.hrl"). - -%% Local --include_lib("cosTransactions/src/ETraP_Common.hrl"). --include_lib("cosTransactions/include/CosTransactions.hrl"). --include("etrap_test_lib.hrl"). -  --include_lib("common_test/include/ct.hrl"). - --define(default_timeout, test_server:minutes(20)). - - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, cases/0, -	 init_per_suite/1, end_per_suite/1, resource_api/1, etrap_api/1, -	 init_per_testcase/2, end_per_testcase/2, app_test/1]). -  -%%----------------------------------------------------------------- -%% Func: all/1 -%% Args:  -%% Returns:  -%%----------------------------------------------------------------- -suite() -> [{ct_hooks,[ts_install_cth]}]. - -all() ->  -    cases(). - -groups() ->  -    []. - -init_per_group(_GroupName, Config) -> -    Config. - -end_per_group(_GroupName, Config) -> -    Config. - - -cases() ->  -    [etrap_api, resource_api, app_test]. -	 -%%----------------------------------------------------------------- -%% Init and cleanup functions. -%%----------------------------------------------------------------- -init_per_testcase(_Case, Config) -> -    Path = code:which(?MODULE), -    code:add_pathz(filename:join(filename:dirname(Path), "idl_output")), -    'oe_CosTransactions':'oe_register'(),  -    'oe_etrap_test':'oe_register'(),  -    Dog=test_server:timetrap(?default_timeout), -    [{watchdog, Dog}|Config]. - - -end_per_testcase(_Case, Config) -> -    'oe_etrap_test':'oe_unregister'(),  -    'oe_CosTransactions':'oe_unregister'(),  -    Path = code:which(?MODULE), -    code:del_path(filename:join(filename:dirname(Path), "idl_output")), -    Dog = proplists:get_value(watchdog, Config), -    test_server:timetrap_cancel(Dog), -    ok. - -init_per_suite(Config) -> -    mnesia:delete_schema([node()]), -    mnesia:create_schema([node()]), -    orber:install([node()]), -    application:start(mnesia), -    application:start(orber), -    if -        is_list(Config) -> -	    Config; -        true -> -            exit("Config not a list") -    end. -  -end_per_suite(Config) -> -    application:stop(orber), -    application:stop(mnesia), -    mnesia:delete_schema([node()]), -    Config. -  -%%----------------------------------------------------------------- -%%  Tests app file -%%----------------------------------------------------------------- -app_test(_Config) -> -    ok=test_server:app_test(cosTransactions), -    ok. - -%%----------------------------------------------------------------- -%%  API tests  -%%----------------------------------------------------------------- -etrap_api(_Config) -> -    ?match(ok, application:start(cosTransactions), -		 "Starting the cosTransactions application"), -    TrFac = cosTransactions:start_factory(), -    %% Start a new transaction: -    %%      RootCoord -    %%      /       \ -    %% SubCoord1  SubCoord2 -    Control = 'CosTransactions_TransactionFactory':create(TrFac, 0), -    Term = 'CosTransactions_Control':get_terminator(Control), -    Coord = 'CosTransactions_Control':get_coordinator(Control), -    SubCont1 = 'CosTransactions_Coordinator':create_subtransaction(Coord), -    SubCont2 = 'CosTransactions_Coordinator':create_subtransaction(Coord), -    SubCoord1 = 'CosTransactions_Control':get_coordinator(SubCont1), -    SubCoord2 = 'CosTransactions_Control':get_coordinator(SubCont2), - - -    %%------ Test CosTransactions::Coordinator ------ -    ?match(true,  -		 'CosTransactions_Coordinator':is_same_transaction(Coord, Coord), -		 "'CosTransactions_Coordinator':is_same_transaction"), -    ?match(false,  -		 'CosTransactions_Coordinator':is_same_transaction(Coord, SubCoord1), -		 "'CosTransactions_Coordinator':is_same_transaction"), -    ?match(true,  -		 'CosTransactions_Coordinator':is_descendant_transaction(Coord, Coord), -		 "'CosTransactions_Coordinator':is_descendant_transaction"), -    ?match(false,  -		 'CosTransactions_Coordinator':is_descendant_transaction(Coord, SubCoord1), -		 "'CosTransactions_Coordinator':is_descendant_transaction"), -    ?match(true,  -		 'CosTransactions_Coordinator':is_descendant_transaction(SubCoord1, Coord), -		 "'CosTransactions_Coordinator':is_descendant_transaction"), -    ?match(false,  -		 'CosTransactions_Coordinator':is_descendant_transaction(SubCoord1, SubCoord2), -		 "'CosTransactions_Coordinator':is_descendant_transaction"), -    ?match(true,  -		 'CosTransactions_Coordinator':is_top_level_transaction(Coord), -		 "'CosTransactions_Coordinator':is_top_level_transaction"), -    ?match(false,  -		 'CosTransactions_Coordinator':is_top_level_transaction(SubCoord2), -		 "'CosTransactions_Coordinator':is_top_level_transaction"), - -    RootHash  = 'CosTransactions_Coordinator':hash_transaction(Coord), -    RepeatHash= 'CosTransactions_Coordinator':hash_transaction(Coord), -    RootHash2 = 'CosTransactions_Coordinator':hash_top_level_tran(SubCoord1), -    RootHash3 = 'CosTransactions_Coordinator':hash_top_level_tran(Coord), -    _SubHash   = 'CosTransactions_Coordinator':hash_transaction(SubCoord2), -    ?match(RootHash, RepeatHash, -		 "'CosTransactions_Coordinator':hash_transaction"), -    ?match(RootHash, RootHash2, -		 "'CosTransactions_Coordinator':hash_top_level_tran"), -    ?match(RootHash, RootHash3, -		 "'CosTransactions_Coordinator':hash_top_level_tran"), -%    ?match_inverse(RootHash, SubHash, -%		 "'CosTransactions_Coordinator':hash_transaction"), - -    ?match('StatusActive',  -		 'CosTransactions_Coordinator':get_status(Coord), -		 "'CosTransactions_Coordinator':get_status"), -    ?match('StatusActive',  -		 'CosTransactions_Coordinator':get_status(SubCoord1), -		 "'CosTransactions_Coordinator':get_status"), -    ?match('StatusActive',  -		 'CosTransactions_Coordinator':get_parent_status(Coord), -		 "'CosTransactions_Coordinator':get_parent_status"), -    ?match('StatusActive',  -		 'CosTransactions_Coordinator':get_parent_status(SubCoord1), -		 "'CosTransactions_Coordinator':get_parent_status"), -    ?match('StatusActive',  -		 'CosTransactions_Coordinator':get_top_level_status(Coord), -		 "'CosTransactions_Coordinator':get_top_level_status"), -    ?match('StatusActive',  -		 'CosTransactions_Coordinator':get_top_level_status(SubCoord1), -		 "'CosTransactions_Coordinator':get_top_level_status"), - -    %% Create a CosTransactions::Resource to experiments with. -    %% Start a new transaction: -    %%      RootCoord -    %%      /       \ -    %% SubCoord1  SubCoord2 -    %%    / -    %% Resource -    N1 = 'ETraP_Common':create_name("test"), -    O1 = etrap_test_server:oe_create(?nop, {global, N1}), -    _RC1 = 'CosTransactions_Coordinator':register_resource(SubCoord1, O1), -%    'CosTransactions_Coordinator':register_synchronization(SubCoord1, O1), - -    ?match('VoteCommit', -		 'CosTransactions_Resource':prepare(SubCoord1), -		 "'CosTransactions_Coordinator':prepare"), -    %% The Transaction are no longer in 'StatusActive' state. No new -    %% "members" allowed. -    ?match('StatusPrepared', -		 'CosTransactions_Coordinator':get_status(SubCoord1), -		 "'CosTransactions_Coordinator':get_status"), -%    ?match({'EXCEPTION', ?tr_inactive}, -%		 'CosTransactions_Coordinator':register_synchronization(SubCoord1, O1), -%		 "'CosTransactions_Coordinator':register_synchronization"), -    ?match({'EXCEPTION', ?tr_inactive}, -		 'CosTransactions_Coordinator':register_resource(SubCoord1, O1), -		 "'CosTransactions_Coordinator':register_resource"), -    ?match({'EXCEPTION', ?tr_inactive}, -		 'CosTransactions_Coordinator':create_subtransaction(SubCoord1), -		 "'CosTransactions_Coordinator':create_subtransaction"), - -    catch corba:dispose(SubCoord1), -    catch corba:dispose(SubCoord2), -    catch corba:dispose(SubCont1), -    catch corba:dispose(SubCont2), -    catch corba:dispose(Term), -    catch corba:dispose(Control), -    catch corba:dispose(Coord), -    catch corba:dispose(O1), - -    cosTransactions:stop_factory(TrFac), -    application:stop(cosTransactions), -    ok. - -%%----------------------------------------------------------------- -%%  API tests  -%%----------------------------------------------------------------- -resource_api(_Config) -> -    ?match(ok, application:start(cosTransactions), -		 "Starting the cosTransactions application"), -    TrFac = cosTransactions:start_factory([{typecheck, true}]), - -    ?match({'EXCEPTION', #'TRANSACTION_ROLLEDBACK'{completion_status=?COMPLETED_YES}}, -		 run(TrFac, 0, {?nop, ?nop, ?nop, ?prepare_rollback}), -		 "TESTCASE #1: Prepare rollback Resource 4"), -    ?match({'EXCEPTION', ?tr_mixed}, -		 run(TrFac, 0, {?nop, ?nop, ?commit_mix, ?nop}), -		 "TESTCASE #2: Heuristic Mixed exception Resource 3"), -    ?match(ok,  -		 run(TrFac, 0, {?nop, ?nop, ?nop, ?nop}), -		 "TESTCASE #3: Normal completion. No errors."), -    ?match(ok, -		 run(TrFac, 0, {?nop, ?nop, ?nop, ?commit_cm}), -		 "TESTCASE #4: Heuristic Commit Exception Resource 4"), -    ?match({'EXCEPTION', #'TRANSACTION_ROLLEDBACK'{completion_status=?COMPLETED_YES}}, -		 run(TrFac, 0, {?nop, ?rollback_rb, ?nop, ?prepare_rollback}), -		 "TESTCASE #5: Heuristic Rollbac Resource 2, Resource 4 reply 'VoteRollback'"), -    ?match({'EXCEPTION', #'TRANSACTION_ROLLEDBACK'{completion_status=?COMPLETED_YES}}, -		 run(TrFac, 0, {?nop, ?nop, ?prepare_rollback, ?rollback_rb}), -		 "TESTCASE #6: Heuristic Rollbac Resource 4, Resource 3 reply 'VoteRollback'"), -    ?match(ok, -		 run(TrFac, 0, {?nop, ?nop, ?commit_delay, ?nop}), -		 "TESTCASE #7: Resource 3 delay during commit. No timeout."), -    ?match(ok, -		 run(TrFac, 0, {?nop, ?nop, ?prepare_delay, ?nop}), -		 "TESTCASE #8: Resource 3 delay during prepare. No timeout."), -    ?match(ok, -		 run(TrFac, ?TIMEOUT, {?nop, ?commit_delay, ?nop, ?nop}), -		 "TESTCASE #9: Resource 3 delay during commit. Timeout."), -    ?match({'EXCEPTION', #'TRANSACTION_ROLLEDBACK'{completion_status=?COMPLETED_YES}}, -		 run(TrFac, ?TIMEOUT, {?nop, ?prepare_delay, ?nop, ?nop}), -		 "TESTCASE #10: Resource 3 delay during prepare. Timeout."), -    case ?is_debug_compiled of -	true -> -	    %% Testing the Coordinators (root and sub). -	    ?match(ok, -			 run(TrFac, 0, {?nop, ?nop, ?nop, ?nop, [?nop, ?nop,?crash_transient(commit), ?nop]}), -			 "TESTCASE #11: SubCoord 3 crash transient during commit."), -	    ?match({'EXCEPTION', #'TRANSACTION_ROLLEDBACK'{}}, -			 run(TrFac, 0, {?nop, ?nop, ?nop, ?nop, [?nop, ?nop,?crash_transient(send_prepare), ?nop]}), -			 "TESTCASE #12: SubCoord 3 crash transient during send prepare."), -	    ?match({'EXCEPTION', ?tr_hazard}, -			 run(TrFac, 0, {?nop, ?nop, ?nop, ?nop, [?nop, ?nop,?crash_permanent(commit), ?nop]}), -			 "TESTCASE #13: SubCoord 3 crash permanent during commit."), -	    ?match({'EXCEPTION', #'TRANSACTION_ROLLEDBACK'{}}, -			 run(TrFac, 0, {?nop, ?nop, ?nop, ?nop, [?nop, ?nop,?crash_permanent(send_prepare), ?nop]}), -			 "TESTCASE #14: SubCoord 3 crash permanent during prepare."), -	    ?match({'EXCEPTION', #'TRANSACTION_ROLLEDBACK'{}}, -			 run(TrFac, 0, {?nop, ?nop, ?nop, ?nop, [?nop, ?crash_transient(send_prepare), ?crash_transient(commit), ?nop]}), -			 "TESTCASE #15: SubCoord 2 crash transient during prepare. SubCoord 3 crash transient during commit"), -	    ?match({'EXCEPTION', #'TRANSACTION_ROLLEDBACK'{completion_status=?COMPLETED_YES}}, -			 run(TrFac, 0, {?nop, ?nop, ?nop, ?nop, [?crash_transient(send_prepare), ?nop, ?nop, ?nop]}), -			 "TESTCASE #16: RootCoord crash transient during send prepare."), -	    ?match({'EXCEPTION', #'TRANSACTION_ROLLEDBACK'{}}, -			 run(TrFac, 0, {?nop, ?nop, ?nop, ?nop, [?nop, ?crash_transient(prepare1), ?nop, ?nop]}), -			 "TESTCASE #17: SubCoord 1 crash transient during prepare1."), -	    ?match({'EXCEPTION', ?tr_mixed},  -			 run(TrFac, 0, {?nop, ?prepare_mix, ?nop, ?nop, [?nop, ?nop, ?crash_transient(prepare2), ?nop]}), -			 "TESTCASE #18: SubCoord 3 crash transient during prepare2. Resource 2 raise Heuristic Mixed during prepare"), -	    ?match({'EXCEPTION', ?tr_mixed}, -			 run(TrFac, 0, {?nop, ?commit_mix, ?nop, ?nop, [?nop, ?nop, ?crash_transient(commit2), ?nop]}), -			 "TESTCASE #19: Resource 2 raise Heurist mixed during commit. SubCoord crash transient commit2"), -	    ?match({'EXCEPTION', ?tr_mixed}, -			 run(TrFac, 0, {?nop, ?rollback_cm, ?nop, ?prepare_rollback, [?nop, ?crash_transient(rollback2), ?nop, ?nop]}), -			 "TESTCASE #20: Resource 2 raise Heuristic Commit during rollback. Resource 4 'VoteRollback'. SubCoord 2 crash transient rollback2."), -	    ?match({'EXCEPTION', ?tr_mixed}, -			 run(TrFac, 0, {?nop, ?nop, ?nop, ?commit_mix, [?nop, ?nop, ?crash_transient(send_forget1), ?nop]}), -			 "TESTCASE #21: Resource 4 raise Heuristic Mixed during commit. SubCoord 2 crash transient send_forget1."), -	    ?match({'EXCEPTION', ?tr_mixed},  -			 run(TrFac, 0, {?nop, ?nop, ?nop, ?commit_mix, [?crash_transient(send_forget1), ?nop, ?nop, ?nop]}), -			 "TESTCASE #22: Resource 4 raise Heuristic Mixed during commit. Root Coord crash transient send_forget1."), -	    ?match({'EXCEPTION', ?tr_mixed},  -			 run(TrFac, 0, {?nop, ?nop, ?nop, ?commit_mix, [?crash_transient(send_forget3), ?nop, ?crash_transient(send_forget1), ?nop]}), -			 "TESTCASE #23: Resource 4 raise Heuristic Mixed during commit. Root Coord crash transient send_forget3. SubCoord 3 crash transient send_forget1."), -		 ?match({'EXCEPTION', #'TRANSACTION_ROLLEDBACK'{completion_status=?COMPLETED_YES}}, -			 run(TrFac, ?TIMEOUT, {?nop, ?nop, ?nop, ?nop, [?delay_transient(root_delay, ?TIMEOUT*2), ?nop, ?nop, ?nop]}), -			 "TESTCASE #24: Delay RootCoord. Timeout."), -	    %% Testing the Terminator. -	    ?match({'EXCEPTION', ?tr_mixed}, -			 run(TrFac, ?TIMEOUT, {?nop, ?prepare_mix, ?nop, ?nop, [?nop, ?nop, ?nop, ?crash_transient(commit_heuristic1)]}), -			 "TESTCASE #25: Terminator crash transient after received and logged Heuristic mix."), -	    ?match(ok, -			 run(TrFac, ?TIMEOUT, {?nop, ?nop, ?nop, ?nop, [?nop, ?nop, ?nop, ?crash_transient(commit_ok2)]}), -			 "TESTCASE #26: Terminator crash transient after received and logged 'ok'."); -	_ -> -	    ok -    end, - -    cosTransactions:stop_factory(TrFac), -    application:stop(cosTransactions), -    ok. -  -%%----------------------------------------------------------------- -%% Internal functions -%%----------------------------------------------------------------- - -run(TrFac, Time, Spec) -> -    Control = 'CosTransactions_TransactionFactory':create(TrFac, Time), -    Term = 'CosTransactions_Control':get_terminator(Control), -    Coord = 'CosTransactions_Control':get_coordinator(Control), -    SubCont1 = 'CosTransactions_Coordinator':create_subtransaction(Coord), -    SubCont2 = 'CosTransactions_Coordinator':create_subtransaction(Coord), -    SubCoord1 = 'CosTransactions_Control':get_coordinator(SubCont1), -    SubCoord2 = 'CosTransactions_Control':get_coordinator(SubCont2), -    %% Start resources/participants. -    {O1, O2, O3, O4, Ctx} = start_resources(Spec), - -    %% Get generated names to use for debugging. -    CoordN = 'CosTransactions_Coordinator':get_transaction_name(Coord), -    SubC1N = 'CosTransactions_Coordinator':get_transaction_name(SubCoord1), -    SubC2N = 'CosTransactions_Coordinator':get_transaction_name(SubCoord2), - -   ?set_debug_context([CoordN, SubC1N, SubC2N, Term], Ctx), - -    %% Register the resources as participants. -    _RC1 = 'CosTransactions_Coordinator':register_resource(SubCoord1, O1), -    _RC2 = 'CosTransactions_Coordinator':register_resource(SubCoord1, O2), -    _RC3 = 'CosTransactions_Coordinator':register_resource(SubCoord2, O3), -    _RC4 = 'CosTransactions_Coordinator':register_resource(SubCoord2, O4), - -    'CosTransactions_Coordinator':register_subtran_aware(SubCoord1, O4), -%    'CosTransactions_Coordinator':register_synchronization(SubCoord1, O2), - -%    Reply = (catch 'CosTransactions_Terminator':commit(Term, true)), -    Reply = (catch 'ETraP_Common':send_stubborn('CosTransactions_Terminator', -						commit, [Term, true], -						?tr_max_retries, -						?tr_comm_failure_wait)), - -    catch corba:dispose(SubCoord1), -    catch corba:dispose(SubCoord2), -    catch corba:dispose(SubCont1), -    catch corba:dispose(SubCont2), -    catch corba:dispose(Term), -    catch corba:dispose(Control), -    catch corba:dispose(Coord), -    catch corba:dispose(O1), -    catch corba:dispose(O2), -    catch corba:dispose(O3), -    catch corba:dispose(O4), -    Reply. - -start_resources({A1, A2, A3, A4})-> -    start_resources({A1, A2, A3, A4, ?no_context}); -start_resources({A1, A2, A3, A4, Ctx})-> -    N1 = 'ETraP_Common':create_name("test"), -    N2 = 'ETraP_Common':create_name("test"), -    N3 = 'ETraP_Common':create_name("test"), -    N4 = 'ETraP_Common':create_name("test"), -    {_,_,O1} = supervisor:start_child(?SUPERVISOR_NAME, ?SUP_TEST(A1, N1)), -    {_,_,O2} = supervisor:start_child(?SUPERVISOR_NAME, ?SUP_TEST(A2, N2)), -%    {_,_,O2} = supervisor:start_child(?SUPERVISOR_NAME, ?SUP_TEST([{sync,true}|A2], N2)), -    {_,_,O3} = supervisor:start_child(?SUPERVISOR_NAME, ?SUP_TEST(A3, N3)), -    {_,_,O4} = supervisor:start_child(?SUPERVISOR_NAME, ?SUP_TEST(A4, N4)), -    {O1, O2, O3, O4, Ctx}. diff --git a/lib/cosTransactions/vsn.mk b/lib/cosTransactions/vsn.mk deleted file mode 100644 index ab163d83c2..0000000000 --- a/lib/cosTransactions/vsn.mk +++ /dev/null @@ -1 +0,0 @@ -COSTRANSACTIONS_VSN = 1.3.2 | 
