dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] CVS: pnetlib/System.EnterpriseServices/Compensati


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnetlib/System.EnterpriseServices/CompensatingResourceManager ApplicationCrmEnabledAttribute.cs, NONE, 1.1 Clerk.cs, NONE, 1.1 ClerkInfo.cs, NONE, 1.1 ClerkMonitor.cs, NONE, 1.1 Compensator.cs, NONE, 1.1 CompensatorOptions.cs, NONE, 1.1 LogRecord.cs, NONE, 1.1 LogRecordFlags.cs, NONE, 1.1 Makefile, NONE, 1.1 TransactionState.cs, NONE, 1.1
Date: Sun, 21 Sep 2003 03:56:42 -0400

Update of 
/cvsroot/dotgnu-pnet/pnetlib/System.EnterpriseServices/CompensatingResourceManager
In directory 
subversions:/tmp/cvs-serv23168/System.EnterpriseServices/CompensatingResourceManager

Added Files:
        ApplicationCrmEnabledAttribute.cs Clerk.cs ClerkInfo.cs 
        ClerkMonitor.cs Compensator.cs CompensatorOptions.cs 
        LogRecord.cs LogRecordFlags.cs Makefile TransactionState.cs 
Log Message:


Check in an implementation of "System.EnterpriseServices".


--- NEW FILE ---
/*
 * ApplicationCrmEnabledAttribute.cs - Implementation of the
 *                      "System.EnterpriseServices.CompensatingResourceManager."
 *                      "ApplicationCrmEnabledAttribute" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.EnterpriseServices.CompensatingResourceManager
{

using System.Runtime.InteropServices;

#if !ECMA_COMPAT
[ComVisible(false)]
#endif
#if CONFIG_COM_INTEROP
[ProgId("System.EnterpriseServices.Crm.ApplicationCrmEnabledAttribute")]
#endif
[AttributeUsage(AttributeTargets.Assembly, Inherited=true)]
public sealed class ApplicationCrmEnabledAttribute : Attribute
{
        // Internal state.
        private bool val;

        // Constructors.
        public ApplicationCrmEnabledAttribute() : this(true) {}
        public ApplicationCrmEnabledAttribute(bool val)
                        {
                                this.val = val;
                        }

        // Get this attribute's value.
        public bool Value
                        {
                                get
                                {
                                        return val;
                                }
                        }

}; // class ApplicationCrmEnabledAttribute

}; // namespace System.EnterpriseServices.CompensatingResourceManager

--- NEW FILE ---
/*
 * Clerk.cs - Implementation of the
 *                      "System.EnterpriseServices.CompensatingResourceManager."
 *                      "Clerk" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.EnterpriseServices.CompensatingResourceManager
{

public sealed class Clerk
{
        // Internal state.
        internal String activityId;
        internal String compensator;
        internal String description;
        internal String instanceId;
        internal CompensatorOptions flags;
        private String transactionUOW;
        private int count;

        // Constructors.
        public Clerk(String compensator, String description,
                                 CompensatorOptions flags)
                        {
                                this.compensator = compensator;
                                this.description = description;
                                this.flags = flags;
                        }
        public Clerk(Type compensator, String description,
                                 CompensatorOptions flags)
                        {
                                this.compensator = 
compensator.AssemblyQualifiedName;
                                this.description = description;
                                this.flags = flags;
                        }

        // Destructor.
        ~Clerk()
                        {
                                // Nothing to do here in this implementation.
                        }

        // Get the number of log records.
        public int LogRecordCount
                        {
                                get
                                {
                                        return count;
                                }
                        }

        // Get the GUI that represents the transaction unit of work.
        public String TransactionUOW
                        {
                                get
                                {
                                        return transactionUOW;
                                }
                        }

        // Force all log records to disk.
        public void ForceLog()
                        {
                                // Nothing to do in this implemenation.
                        }

        // Force the transaction to immediately abort.
        public void ForceTransactionToAbort()
                        {
                                // Nothing to do in this implemenation.
                        }

        // Forget the last log record.
        public void ForgetLogRecord()
                        {
                                // Nothing to do in this implemenation.
                        }

        // Write a log record.
        public void WriteLogRecord(Object record)
                        {
                                ++count;
                        }

}; // class Clerk

}; // namespace System.EnterpriseServices.CompensatingResourceManager

--- NEW FILE ---
/*
 * ClerkInfo.cs - Implementation of the
 *                      "System.EnterpriseServices.CompensatingResourceManager."
 *                      "ClerkInfo" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.EnterpriseServices.CompensatingResourceManager
{

public sealed class ClerkInfo
{
        // Internal state.
        private Clerk clerk;

        // Constructor.
        internal ClerkInfo(Clerk clerk)
                        {
                                this.clerk = clerk;
                        }

        // Destructor
        ~ClerkInfo() {}

        // Get this object's properties.
        public String ActivityId
                        {
                                get
                                {
                                        return clerk.activityId;
                                }
                        }
        public Clerk Clerk
                        {
                                get
                                {
                                        return clerk;
                                }
                        }
        public String Compensator
                        {
                                get
                                {
                                        return clerk.compensator;
                                }
                        }
        public String Description
                        {
                                get
                                {
                                        return clerk.description;
                                }
                        }
        public String InstanceId
                        {
                                get
                                {
                                        return clerk.instanceId;
                                }
                        }
        public String TransactionUOW
                        {
                                get
                                {
                                        return clerk.TransactionUOW;
                                }
                        }

}; // class ClerkInfo

}; // namespace System.EnterpriseServices.CompensatingResourceManager

--- NEW FILE ---
/*
 * ClerkMonitor.cs - Implementation of the
 *                      "System.EnterpriseServices.CompensatingResourceManager."
 *                      "ClerkMonitor" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.EnterpriseServices.CompensatingResourceManager
{

using System.Collections;

public sealed class ClerkMonitor : IEnumerable
{
        // Internal state.
        private Hashtable list;

        // Constructor.
        public ClerkMonitor()
                        {
                                list = new Hashtable();
                        }

        // Destructor.
        ~ClerkMonitor()
                        {
                                // Nothing to do in this implementation.
                        }

        // Get the number of clerks within this monitor.
        public int Count
                        {
                                get
                                {
                                        return list.Count;
                                }
                        }

        // Get a clerk at a particular position.
        public ClerkInfo this[String index]
                        {
                                get
                                {
                                        return (ClerkInfo)(list[index]);
                                }
                        }
        public ClerkInfo this[int index]
                        {
                                get
                                {
                                        return (ClerkInfo)(list[index]);
                                }
                        }

        // Populate the monitor from the system.
        public void Populate()
                        {
                                // Nothing to do in this implementation.
                        }

        // Enumerate over the elements in this collection.
        public IEnumerator GetEnumerator()
                        {
                                return new 
ClerkMonitorEnumerator(list.GetEnumerator());
                        }

        // Enumerator for this class.
        private sealed class ClerkMonitorEnumerator : IEnumerator
        {
                // Internal state.
                private IDictionaryEnumerator e;

                // Constructor.
                public ClerkMonitorEnumerator(IDictionaryEnumerator e)
                                {
                                        this.e = e;
                                }

                // Implement the IEnumerator interface.
                public bool MoveNext()
                                {
                                        return e.MoveNext();
                                }
                public void Reset()
                                {
                                        e.Reset();
                                }
                public Object Current
                                {
                                        get
                                        {
                                                return e.Value;
                                        }
                                }

        }; // class ClerkMonitorEnumerator

}; // class ClerkMonitor

}; // namespace System.EnterpriseServices.CompensatingResourceManager

--- NEW FILE ---
/*
 * Compensator.cs - Implementation of the
 *                      "System.EnterpriseServices.CompensatingResourceManager."
 *                      "Compensator" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.EnterpriseServices.CompensatingResourceManager
{

public class Compensator : ServicedComponent
{
        // Internal state.
        private Clerk clerk;

        // Constructor.
        public Compensator() {}

        // Get the clerk associated with this compensator.
        public Clerk Clerk
                        {
                                get
                                {
                                        return clerk;
                                }
                        }

        // Send a log record during the abort phase.
        public virtual bool AbortRecord(LogRecord rec)
                        {
                                // Nothing to do in the base class.
                                return false;
                        }

        // Begin the abort phase.
        public virtual void BeginAbort(bool fRecovery)
                        {
                                // Nothing to do in the base class.
                        }

        // Begin the commit phase.
        public virtual void BeginCommit(bool fRecovery)
                        {
                                // Nothing to do in the base class.
                        }

        // Begin the prepare phase.
        public virtual void BeginPrepare()
                        {
                                // Nothing to do in the base class.
                        }

        // Send a log record during the commit phase.
        public virtual bool CommitRecord(LogRecord rec)
                        {
                                // Nothing to do in the base class.
                                return false;
                        }

        // End the abort phase.
        public virtual void EndAbort()
                        {
                                // Nothing to do in the base class.
                        }

        // End the commit phase.
        public virtual void EndCommit()
                        {
                                // Nothing to do in the base class.
                        }

        // End the prepare phase.
        public virtual bool EndPrepare()
                        {
                                // Nothing to do in the base class.
                                return true;
                        }

        // Send a log record during the prepare phase.
        public virtual bool PrepareRecord(LogRecord rec)
                        {
                                // Nothing to do in the base class.
                                return false;
                        }

}; // class Compensator

}; // namespace System.EnterpriseServices.CompensatingResourceManager

--- NEW FILE ---
/*
 * CompensatorOptions.cs - Implementation of the
 *                      "System.EnterpriseServices.CompensatingResourceManager."
 *                      "CompensatorOptions" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.EnterpriseServices.CompensatingResourceManager
{

[Flags]
public enum CompensatorOptions
{
        PreparePhase                    = 0x0001,
        CommitPhase                             = 0x0002,
        AbortPhase                              = 0x0004,
        AllPhases                               = 0x0007,
        FailIfInDoubtsRemain    = 0x0010,

}; // enum CompensatorOptions

}; // namespace System.EnterpriseServices.CompensatingResourceManager

--- NEW FILE ---
/*
 * LogRecord.cs - Implementation of the
 *                      "System.EnterpriseServices.CompensatingResourceManager."
 *                      "LogRecord" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.EnterpriseServices.CompensatingResourceManager
{

public sealed class LogRecord
{
        // Internal state.
        private LogRecordFlags flags;
        private Object record;
        private int sequence;

        // Constructor.
        internal LogRecord(LogRecordFlags flags, Object record, int sequence)
                        {
                                this.flags = flags;
                                this.record = record;
                                this.sequence = sequence;
                        }

        // Get this object's properties.
        public LogRecordFlags Flags
                        {
                                get
                                {
                                        return flags;
                                }
                        }
        public Object Record
                        {
                                get
                                {
                                        return record;
                                }
                        }
        public int Sequence
                        {
                                get
                                {
                                        return sequence;
                                }
                        }

}; // class LogRecord

}; // namespace System.EnterpriseServices.CompensatingResourceManager

--- NEW FILE ---
/*
 * LogRecordFlags.cs - Implementation of the
 *                      "System.EnterpriseServices.CompensatingResourceManager."
 *                      "LogRecordFlags" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.EnterpriseServices.CompensatingResourceManager
{

[Flags]
public enum LogRecordFlags
{
        ForgetTarget                    = 0x0001,
        WrittenDuringPrepare    = 0x0002,
        WrittenDuringCommit             = 0x0004,
        WrittenDuringAbort              = 0x0008,
        WrittenDuringReplay             = 0x0020,
        WrittenDurringRecovery  = 0x0010,       // Mis-spelt on purpose!
        ReplayInProgress                = 0x0040,

}; // enum LogRecordFlags

}; // namespace System.EnterpriseServices.CompensatingResourceManager

--- NEW FILE ---

all:
        (cd ..;make)

clean:
        (cd ..;make clean)

--- NEW FILE ---
/*
 * LogRecordFlags.cs - Implementation of the
 *                      "System.EnterpriseServices.CompensatingResourceManager."
 *                      "TransactionState" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.EnterpriseServices.CompensatingResourceManager
{

public enum TransactionState
{
        Active          = 0,
        Committed       = 1,
        Aborted         = 2,
        Indoubt         = 3

}; // enum TransactionState

}; // namespace System.EnterpriseServices.CompensatingResourceManager





reply via email to

[Prev in Thread] Current Thread [Next in Thread]