[mapguide-commits] r5966 - in trunk/MgDev:
Common/MapGuideCommon/Services Common/PlatformBase/Services
Server/src/Services/Feature
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Tue Jul 5 05:18:40 EDT 2011
Author: hubu
Date: 2011-07-05 02:18:40 -0700 (Tue, 05 Jul 2011)
New Revision: 5966
Added:
trunk/MgDev/Server/src/Services/Feature/OpAddSavePoint.cpp
trunk/MgDev/Server/src/Services/Feature/OpAddSavePoint.h
trunk/MgDev/Server/src/Services/Feature/OpReleaseSavePoint.cpp
trunk/MgDev/Server/src/Services/Feature/OpReleaseSavePoint.h
trunk/MgDev/Server/src/Services/Feature/OpRollbackSavePoint.cpp
trunk/MgDev/Server/src/Services/Feature/OpRollbackSavePoint.h
Modified:
trunk/MgDev/Common/MapGuideCommon/Services/ProxyFeatureService.cpp
trunk/MgDev/Common/MapGuideCommon/Services/ProxyFeatureService.h
trunk/MgDev/Common/MapGuideCommon/Services/ProxyFeatureTransaction.cpp
trunk/MgDev/Common/MapGuideCommon/Services/ProxyFeatureTransaction.h
trunk/MgDev/Common/PlatformBase/Services/FeatureDefs.h
trunk/MgDev/Common/PlatformBase/Services/FeatureService.h
trunk/MgDev/Common/PlatformBase/Services/Transaction.h
trunk/MgDev/Server/src/Services/Feature/FeatureOperationFactory.cpp
trunk/MgDev/Server/src/Services/Feature/Makefile.am
trunk/MgDev/Server/src/Services/Feature/ServerFeatureService.cpp
trunk/MgDev/Server/src/Services/Feature/ServerFeatureService.h
trunk/MgDev/Server/src/Services/Feature/ServerFeatureService.vcproj
trunk/MgDev/Server/src/Services/Feature/ServerFeatureService.vcxproj
trunk/MgDev/Server/src/Services/Feature/ServerFeatureService.vcxproj.filters
trunk/MgDev/Server/src/Services/Feature/ServerFeatureServiceBuild.cpp
trunk/MgDev/Server/src/Services/Feature/ServerFeatureTransaction.cpp
trunk/MgDev/Server/src/Services/Feature/ServerFeatureTransaction.h
trunk/MgDev/Server/src/Services/Feature/ServerFeatureTransactionPool.cpp
trunk/MgDev/Server/src/Services/Feature/ServerFeatureTransactionPool.h
Log:
On behalf of Sam Wang.
This submission is the first part of implementing RFC 114: Extend MapGuide API
to Support Save Points.
Three new interface methods have been added to MgTransaction interface as
proposed in the RFC. All the concrete class that inherits this interface
currently provides corresponding implementation.
In order that the new API can be called from both MG server API and MG web API,
we add three corresponding methods in MgFeatureService interface. These three
methods are almost the same with that of MgTransaction, except that they pass in
a transaction id to idetify which transaction they will operate on.
Modified: trunk/MgDev/Common/MapGuideCommon/Services/ProxyFeatureService.cpp
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/Services/ProxyFeatureService.cpp 2011-07-04 07:16:15 UTC (rev 5965)
+++ trunk/MgDev/Common/MapGuideCommon/Services/ProxyFeatureService.cpp 2011-07-05 09:18:40 UTC (rev 5966)
@@ -1840,3 +1840,60 @@
return (bool)cmd.GetReturnValue().val.m_i8;
}
+
+//////////////////////////////////////////////////////////////////
+STRING MgProxyFeatureService::AddSavePoint(CREFSTRING transactionId, CREFSTRING suggestName)
+{
+ MgCommand cmd;
+ cmd.ExecuteCommand(m_connProp, // Connection
+ MgCommand::knString, // Return type expected
+ MgFeatureServiceOpId::AddSavePoint_Id, // Command Code
+ 2, // No of arguments
+ Feature_Service, // Service Id
+ BUILD_VERSION(1,0,0), // Operation version
+ MgCommand::knString, &transactionId, // Argument#1
+ MgCommand::knString, &suggestName, // Argument#2
+ MgCommand::knNone); // End of argument
+
+ SetWarning(cmd.GetWarningObject());
+ STRING retVal = *(cmd.GetReturnValue().val.m_str);
+
+ delete cmd.GetReturnValue().val.m_str;
+ return retVal;
+}
+
+//////////////////////////////////////////////////////////////////
+bool MgProxyFeatureService::RollbackSavePoint(CREFSTRING transactionId, CREFSTRING savePointName)
+{
+ MgCommand cmd;
+ cmd.ExecuteCommand(m_connProp, // Connection
+ MgCommand::knInt8, // Return type expected
+ MgFeatureServiceOpId::RollbackSavePoint_Id, // Command Code
+ 2, // No of arguments
+ Feature_Service, // Service Id
+ BUILD_VERSION(1,0,0), // Operation version
+ MgCommand::knString, &transactionId, // Argument#1
+ MgCommand::knString, &savePointName, // Argument#2
+ MgCommand::knNone); // End of argument
+
+ SetWarning(cmd.GetWarningObject());
+ return cmd.GetReturnValue().val.m_i8;
+}
+
+//////////////////////////////////////////////////////////////////
+bool MgProxyFeatureService::ReleaseSavePoint(CREFSTRING transactionId, CREFSTRING savePointName)
+{
+ MgCommand cmd;
+ cmd.ExecuteCommand(m_connProp, // Connection
+ MgCommand::knInt8, // Return type expected
+ MgFeatureServiceOpId::ReleaseSavePoint_Id, // Command Code
+ 2, // No of arguments
+ Feature_Service, // Service Id
+ BUILD_VERSION(1,0,0), // Operation version
+ MgCommand::knString, &transactionId, // Argument#1
+ MgCommand::knString, &savePointName, // Argument#2
+ MgCommand::knNone); // End of argument
+
+ SetWarning(cmd.GetWarningObject());
+ return cmd.GetReturnValue().val.m_i8;
+}
Modified: trunk/MgDev/Common/MapGuideCommon/Services/ProxyFeatureService.h
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/Services/ProxyFeatureService.h 2011-07-04 07:16:15 UTC (rev 5965)
+++ trunk/MgDev/Common/MapGuideCommon/Services/ProxyFeatureService.h 2011-07-05 09:18:40 UTC (rev 5966)
@@ -1285,6 +1285,15 @@
// Rollback the transaction specified by the transaction id.
bool RollbackTransaction(CREFSTRING transactionId);
+ //Add save point
+ STRING AddSavePoint(CREFSTRING transactionId, CREFSTRING suggestName);
+
+ //Roll back to a save point
+ bool RollbackSavePoint(CREFSTRING transactionId, CREFSTRING savePointName);
+
+ //Release a save point
+ bool ReleaseSavePoint(CREFSTRING transactionId, CREFSTRING savePointName);
+
protected:
//////////////////////////////////////////////////////////////////
Modified: trunk/MgDev/Common/MapGuideCommon/Services/ProxyFeatureTransaction.cpp
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/Services/ProxyFeatureTransaction.cpp 2011-07-04 07:16:15 UTC (rev 5965)
+++ trunk/MgDev/Common/MapGuideCommon/Services/ProxyFeatureTransaction.cpp 2011-07-05 09:18:40 UTC (rev 5966)
@@ -70,6 +70,24 @@
m_service->RollbackTransaction(m_transactionId);
}
+STRING MgProxyFeatureTransaction::AddSavePoint(CREFSTRING suggestName)
+{
+ CHECKNULL(m_service, L"MgProxyFeatureTransaction.AddSavePoint");
+ return m_service->AddSavePoint(m_transactionId, suggestName);
+}
+
+void MgProxyFeatureTransaction::ReleaseSavePoint(CREFSTRING savePointName)
+{
+ CHECKNULL(m_service, L"MgProxyFeatureTransaction.ReleaseSavePoint");
+ m_service->ReleaseSavePoint(m_transactionId, savePointName);
+}
+
+void MgProxyFeatureTransaction::Rollback(CREFSTRING savePointName)
+{
+ CHECKNULL(m_service, L"MgProxyFeatureTransaction.Rollback");
+ m_service->ReleaseSavePoint(m_transactionId, savePointName);
+}
+
//////////////////////////////////////////////////////////////////
///<summary>
/// Serialize data to TCP/IP stream
Modified: trunk/MgDev/Common/MapGuideCommon/Services/ProxyFeatureTransaction.h
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/Services/ProxyFeatureTransaction.h 2011-07-04 07:16:15 UTC (rev 5965)
+++ trunk/MgDev/Common/MapGuideCommon/Services/ProxyFeatureTransaction.h 2011-07-05 09:18:40 UTC (rev 5966)
@@ -46,7 +46,37 @@
///
virtual void Rollback();
+ /// \brief
+ /// Create a save point in this transaction.
+ ///
+ /// \param suggestName
+ /// Suggested save point name.
+ ///
+ /// \returns
+ /// The actual name used
+ virtual STRING AddSavePoint(CREFSTRING suggestName);
+
/// \brief
+ /// Release a specific save point.
+ ///
+ /// \param savePointName
+ /// Save point name.
+ ///
+ /// \returns
+ /// Returns nothing
+ virtual void ReleaseSavePoint(CREFSTRING savePointName);
+
+ /// \brief
+ /// Rollback the transaction to a specified save point.
+ ///
+ /// \param savePointName
+ /// Save point name.
+ ///
+ /// \returns
+ /// Returns nothing
+ virtual void Rollback(CREFSTRING savePointName);
+
+ /// \brief
/// Get the identifier of feature source associated with the transaction.
///
/// \return
Modified: trunk/MgDev/Common/PlatformBase/Services/FeatureDefs.h
===================================================================
--- trunk/MgDev/Common/PlatformBase/Services/FeatureDefs.h 2011-07-04 07:16:15 UTC (rev 5965)
+++ trunk/MgDev/Common/PlatformBase/Services/FeatureDefs.h 2011-07-05 09:18:40 UTC (rev 5966)
@@ -74,7 +74,9 @@
static const int UpdateFeaturesWithTransaction_Id = 0x1111ED2B;
static const int ExecuteSqlNonQueryWithTransaction_Id = 0x1111ED2C;
static const int ExecuteSqlQueryWithTransaction_Id = 0x1111ED2D;
-
+ static const int AddSavePoint_Id = 0x1111ED2E;
+ static const int RollbackSavePoint_Id = 0x1111ED2F;
+ static const int ReleaseSavePoint_Id = 0x1111ED30;
};
/// \endcond
Modified: trunk/MgDev/Common/PlatformBase/Services/FeatureService.h
===================================================================
--- trunk/MgDev/Common/PlatformBase/Services/FeatureService.h 2011-07-04 07:16:15 UTC (rev 5965)
+++ trunk/MgDev/Common/PlatformBase/Services/FeatureService.h 2011-07-05 09:18:40 UTC (rev 5966)
@@ -1756,6 +1756,15 @@
// Rollback the transaction specified by the transaction id.
virtual bool RollbackTransaction(CREFSTRING transactionId) = 0;
+ //Add save point
+ virtual STRING AddSavePoint(CREFSTRING transactionId, CREFSTRING suggestName) = 0;
+
+ //Roll back to a save point
+ virtual bool RollbackSavePoint(CREFSTRING transactionId, CREFSTRING savePointName) = 0;
+
+ //Release a save point
+ virtual bool ReleaseSavePoint(CREFSTRING transactionId, CREFSTRING savePointName) = 0;
+
////////////////////////////////////////////////////////////////////////////////////////////////
/// \brief
/// Executes the SQL SELECT statement on the specified feature
Modified: trunk/MgDev/Common/PlatformBase/Services/Transaction.h
===================================================================
--- trunk/MgDev/Common/PlatformBase/Services/Transaction.h 2011-07-04 07:16:15 UTC (rev 5965)
+++ trunk/MgDev/Common/PlatformBase/Services/Transaction.h 2011-07-05 09:18:40 UTC (rev 5966)
@@ -44,6 +44,37 @@
///
virtual MgResourceIdentifier* GetFeatureSource() = 0;
+ /// \brief
+ /// Create a save point in this transaction.
+ ///
+ /// \param suggestName
+ /// Suggested save point name.
+ ///
+ /// \returns
+ /// The actual name used
+ virtual STRING AddSavePoint(CREFSTRING suggestName) = 0;
+
+ /// \brief
+ /// Release a specific save point.
+ ///
+ /// \param savePointName
+ /// Save point name.
+ ///
+ /// \returns
+ /// Returns nothing
+
+ virtual void ReleaseSavePoint(CREFSTRING savePointName) = 0;
+
+ /// \brief
+ /// Rollback the transaction to a specified save point.
+ ///
+ /// \param savePointName
+ /// Save point name.
+ ///
+ /// \returns
+ /// Returns nothing
+ virtual void Rollback(CREFSTRING savePointName) = 0;
+
protected:
/////////////////////////////////////////////////////////////////
Modified: trunk/MgDev/Server/src/Services/Feature/FeatureOperationFactory.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/FeatureOperationFactory.cpp 2011-07-04 07:16:15 UTC (rev 5965)
+++ trunk/MgDev/Server/src/Services/Feature/FeatureOperationFactory.cpp 2011-07-05 09:18:40 UTC (rev 5966)
@@ -19,6 +19,7 @@
#include "FeatureOperationFactory.h"
#include "FeatureOperation.h"
+#include "OpAddSavePoint.h"
#include "OpApplySchema.h"
#include "OpDescribeSchema.h"
#include "OpDescribeSchemaAsXml.h"
@@ -28,6 +29,8 @@
#include "OpGetConnectionPropertyValues.h"
#include "OpGetFeatureProviders.h"
#include "OpGetSpatialContexts.h"
+#include "OpRollbackSavePoint.h"
+#include "OpReleaseSavePoint.h"
#include "OpSelectFeatures.h"
#include "OpSelectFeaturesSpatial.h"
#include "OpTestConnection.h"
@@ -609,6 +612,42 @@
}
break;
+ case MgFeatureServiceOpId::AddSavePoint_Id:
+ switch (VERSION_NO_PHASE(operationVersion))
+ {
+ case VERSION_SUPPORTED(1,0):
+ handler.reset(new MgOpAddSavePoint());
+ break;
+ default:
+ throw new MgInvalidOperationVersionException(
+ L"MgFeatureOperationFactory.GetOperation", __LINE__, __WFILE__, NULL, L"", NULL);
+ }
+ break;
+
+ case MgFeatureServiceOpId::RollbackSavePoint_Id:
+ switch (VERSION_NO_PHASE(operationVersion))
+ {
+ case VERSION_SUPPORTED(1,0):
+ handler.reset(new MgOpRollbackSavePoint());
+ break;
+ default:
+ throw new MgInvalidOperationVersionException(
+ L"MgFeatureOperationFactory.GetOperation", __LINE__, __WFILE__, NULL, L"", NULL);
+ }
+ break;
+
+ case MgFeatureServiceOpId::ReleaseSavePoint_Id:
+ switch (VERSION_NO_PHASE(operationVersion))
+ {
+ case VERSION_SUPPORTED(1,0):
+ handler.reset(new MgOpReleaseSavePoint());
+ break;
+ default:
+ throw new MgInvalidOperationVersionException(
+ L"MgFeatureOperationFactory.GetOperation", __LINE__, __WFILE__, NULL, L"", NULL);
+ }
+ break;
+
default:
throw new MgInvalidOperationException(
L"MgFeatureOperationFactory.GetOperation", __LINE__, __WFILE__, NULL, L"", NULL);
Modified: trunk/MgDev/Server/src/Services/Feature/Makefile.am
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/Makefile.am 2011-07-04 07:16:15 UTC (rev 5965)
+++ trunk/MgDev/Server/src/Services/Feature/Makefile.am 2011-07-05 09:18:40 UTC (rev 5966)
@@ -36,6 +36,7 @@
FeatureOperationFactory.cpp \
FeatureServiceHandler.cpp \
GwsConnectionPool.cpp \
+ OpAddSavePoint.cpp \
OpApplySchema.cpp \
OpCreateFeatureSource.cpp \
OpDescribeSchema.cpp \
@@ -47,6 +48,8 @@
OpGetFdoCacheInfo.cpp \
OpGetFeatureProviders.cpp \
OpGetIdentityProperties.cpp \
+ OpReleaseSavePoint.cpp \
+ OpRollbackSavePoint.cpp \
OpGetSpatialContexts.cpp \
OpSelectFeatures.cpp \
OpSelectFeaturesSpatial.cpp \
@@ -127,6 +130,7 @@
FeatureServiceHandler.h \
ServerFeatureService.h \
GwsConnectionPool.h \
+ OpAddSavePoint.h \
OpApplySchema.h \
OpCreateFeatureSource.h \
OpDescribeSchema.h \
@@ -139,6 +143,8 @@
OpGetFeatureProviders.h \
OpGetSpatialContexts.h \
OpGetIdentityProperties.h \
+ OpReleaseSavePoint.h \
+ OpRollbackSavePoint.h \
OpSelectFeatures.h \
OpSelectFeaturesSpatial.h \
OpTestConnection.h \
Added: trunk/MgDev/Server/src/Services/Feature/OpAddSavePoint.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/OpAddSavePoint.cpp (rev 0)
+++ trunk/MgDev/Server/src/Services/Feature/OpAddSavePoint.cpp 2011-07-05 09:18:40 UTC (rev 5966)
@@ -0,0 +1,117 @@
+//
+// Copyright (C) 2004-2011 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library 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
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#include "ServerFeatureServiceDefs.h"
+#include "OpAddSavePoint.h"
+#include "ServerFeatureService.h"
+#include "LogManager.h"
+
+
+///----------------------------------------------------------------------------
+/// <summary>
+/// Constructs the object.
+/// </summary>
+///----------------------------------------------------------------------------
+MgOpAddSavePoint::MgOpAddSavePoint()
+{
+}
+
+
+///----------------------------------------------------------------------------
+/// <summary>
+/// Destructs the object.
+/// </summary>
+///----------------------------------------------------------------------------
+MgOpAddSavePoint::~MgOpAddSavePoint()
+{
+}
+
+
+///----------------------------------------------------------------------------
+/// <summary>
+/// Executes the operation.
+/// </summary>
+///
+/// <exceptions>
+/// MgException
+/// </exceptions>
+///----------------------------------------------------------------------------
+void MgOpAddSavePoint::Execute()
+{
+ ACE_DEBUG((LM_DEBUG, ACE_TEXT(" (%t) MgOpAddSavePoint::Execute()\n")));
+
+ MG_LOG_OPERATION_MESSAGE(L"AddSavePoint");
+
+ MG_FEATURE_SERVICE_TRY()
+
+ MG_LOG_OPERATION_MESSAGE_INIT(m_packet.m_OperationVersion, m_packet.m_NumArguments);
+
+ ACE_ASSERT(m_stream != NULL);
+
+ if (2 == m_packet.m_NumArguments)
+ {
+
+ STRING transactionID;
+ STRING suggestName;
+
+ m_stream->GetString(transactionID);
+ m_stream->GetString(suggestName);
+
+ BeginExecution();
+
+ MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
+ MG_LOG_OPERATION_MESSAGE_ADD_STRING(transactionID);
+ MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+ MG_LOG_OPERATION_MESSAGE_ADD_STRING(suggestName);
+ MG_LOG_OPERATION_MESSAGE_PARAMETERS_END();
+
+ Validate();
+
+ // Execute the operation
+ STRING name = m_service->AddSavePoint(transactionID, suggestName);
+
+ // Write the response
+ EndExecution(name);
+ }
+ else
+ {
+ MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
+ MG_LOG_OPERATION_MESSAGE_PARAMETERS_END();
+ }
+
+ if (!m_argsRead)
+ {
+ throw new MgOperationProcessingException(L"MgOpAddSavePoint.Execute",
+ __LINE__, __WFILE__, NULL, L"", NULL);
+ }
+
+ // Successful operation
+ MG_LOG_OPERATION_MESSAGE_ADD_STRING(MgResources::Success.c_str());
+
+ MG_FEATURE_SERVICE_CATCH(L"MgOpAddSavePoint.Execute")
+
+ if (mgException != NULL)
+ {
+ // Failed operation
+ MG_LOG_OPERATION_MESSAGE_ADD_STRING(MgResources::Failure.c_str());
+ }
+
+ // Add access log entry for operation
+ MG_LOG_OPERATION_MESSAGE_ACCESS_ENTRY();
+
+ MG_FEATURE_SERVICE_THROW()
+}
Added: trunk/MgDev/Server/src/Services/Feature/OpAddSavePoint.h
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/OpAddSavePoint.h (rev 0)
+++ trunk/MgDev/Server/src/Services/Feature/OpAddSavePoint.h 2011-07-05 09:18:40 UTC (rev 5966)
@@ -0,0 +1,33 @@
+//
+// Copyright (C) 2004-2011 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library 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
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#ifndef MG_OP_ADDSAVEPOINT_H
+#define MG_OP_ADDSAVEPOINT_H
+
+#include "FeatureOperation.h"
+
+class MgOpAddSavePoint : public MgFeatureOperation
+{
+ public:
+ MgOpAddSavePoint();
+ virtual ~MgOpAddSavePoint();
+
+ public:
+ virtual void Execute();
+};
+
+#endif
Added: trunk/MgDev/Server/src/Services/Feature/OpReleaseSavePoint.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/OpReleaseSavePoint.cpp (rev 0)
+++ trunk/MgDev/Server/src/Services/Feature/OpReleaseSavePoint.cpp 2011-07-05 09:18:40 UTC (rev 5966)
@@ -0,0 +1,117 @@
+//
+// Copyright (C) 2004-2011 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library 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
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#include "ServerFeatureServiceDefs.h"
+#include "OpReleaseSavePoint.h"
+#include "ServerFeatureService.h"
+#include "LogManager.h"
+
+
+///----------------------------------------------------------------------------
+/// <summary>
+/// Constructs the object.
+/// </summary>
+///----------------------------------------------------------------------------
+MgOpReleaseSavePoint::MgOpReleaseSavePoint()
+{
+}
+
+
+///----------------------------------------------------------------------------
+/// <summary>
+/// Destructs the object.
+/// </summary>
+///----------------------------------------------------------------------------
+MgOpReleaseSavePoint::~MgOpReleaseSavePoint()
+{
+}
+
+
+///----------------------------------------------------------------------------
+/// <summary>
+/// Executes the operation.
+/// </summary>
+///
+/// <exceptions>
+/// MgException
+/// </exceptions>
+///----------------------------------------------------------------------------
+void MgOpReleaseSavePoint::Execute()
+{
+ ACE_DEBUG((LM_DEBUG, ACE_TEXT(" (%t) MgOpReleaseSavePoint::Execute()\n")));
+
+ MG_LOG_OPERATION_MESSAGE(L"ReleaseSavePoint");
+
+ MG_FEATURE_SERVICE_TRY()
+
+ MG_LOG_OPERATION_MESSAGE_INIT(m_packet.m_OperationVersion, m_packet.m_NumArguments);
+
+ ACE_ASSERT(m_stream != NULL);
+
+ if (2 == m_packet.m_NumArguments)
+ {
+
+ STRING transactionID;
+ STRING savePointName;
+
+ m_stream->GetString(transactionID);
+ m_stream->GetString(savePointName);
+
+ BeginExecution();
+
+ MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
+ MG_LOG_OPERATION_MESSAGE_ADD_STRING(transactionID);
+ MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+ MG_LOG_OPERATION_MESSAGE_ADD_STRING(savePointName);
+ MG_LOG_OPERATION_MESSAGE_PARAMETERS_END();
+
+ Validate();
+
+ // Execute the operation
+ bool bSuccess = m_service->ReleaseSavePoint(transactionID, savePointName);
+
+ // Write the response
+ EndExecution(bSuccess);
+ }
+ else
+ {
+ MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
+ MG_LOG_OPERATION_MESSAGE_PARAMETERS_END();
+ }
+
+ if (!m_argsRead)
+ {
+ throw new MgOperationProcessingException(L"MgOpReleaseSavePoint.Execute",
+ __LINE__, __WFILE__, NULL, L"", NULL);
+ }
+
+ // Successful operation
+ MG_LOG_OPERATION_MESSAGE_ADD_STRING(MgResources::Success.c_str());
+
+ MG_FEATURE_SERVICE_CATCH(L"MgOpReleaseSavePoint.Execute")
+
+ if (mgException != NULL)
+ {
+ // Failed operation
+ MG_LOG_OPERATION_MESSAGE_ADD_STRING(MgResources::Failure.c_str());
+ }
+
+ // Add access log entry for operation
+ MG_LOG_OPERATION_MESSAGE_ACCESS_ENTRY();
+
+ MG_FEATURE_SERVICE_THROW()
+}
Added: trunk/MgDev/Server/src/Services/Feature/OpReleaseSavePoint.h
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/OpReleaseSavePoint.h (rev 0)
+++ trunk/MgDev/Server/src/Services/Feature/OpReleaseSavePoint.h 2011-07-05 09:18:40 UTC (rev 5966)
@@ -0,0 +1,32 @@
+//
+// Copyright (C) 2004-2011 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library 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
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#ifndef MG_OP_RELEASESAVEPOINT_H
+#define MG_OP_RELEASESAVEPOINT_H
+
+#include "FeatureOperation.h"
+
+class MgOpReleaseSavePoint : public MgFeatureOperation
+{
+ public:
+ MgOpReleaseSavePoint();
+ virtual ~MgOpReleaseSavePoint();
+
+ public:
+ virtual void Execute();
+};
+#endif
Added: trunk/MgDev/Server/src/Services/Feature/OpRollbackSavePoint.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/OpRollbackSavePoint.cpp (rev 0)
+++ trunk/MgDev/Server/src/Services/Feature/OpRollbackSavePoint.cpp 2011-07-05 09:18:40 UTC (rev 5966)
@@ -0,0 +1,117 @@
+//
+// Copyright (C) 2004-2011 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library 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
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#include "ServerFeatureServiceDefs.h"
+#include "OpRollbackSavePoint.h"
+#include "ServerFeatureService.h"
+#include "LogManager.h"
+
+
+///----------------------------------------------------------------------------
+/// <summary>
+/// Constructs the object.
+/// </summary>
+///----------------------------------------------------------------------------
+MgOpRollbackSavePoint::MgOpRollbackSavePoint()
+{
+}
+
+
+///----------------------------------------------------------------------------
+/// <summary>
+/// Destructs the object.
+/// </summary>
+///----------------------------------------------------------------------------
+MgOpRollbackSavePoint::~MgOpRollbackSavePoint()
+{
+}
+
+
+///----------------------------------------------------------------------------
+/// <summary>
+/// Executes the operation.
+/// </summary>
+///
+/// <exceptions>
+/// MgException
+/// </exceptions>
+///----------------------------------------------------------------------------
+void MgOpRollbackSavePoint::Execute()
+{
+ ACE_DEBUG((LM_DEBUG, ACE_TEXT(" (%t) MgOpRollbackSavePoint::Execute()\n")));
+
+ MG_LOG_OPERATION_MESSAGE(L"RollbackSavePoint");
+
+ MG_FEATURE_SERVICE_TRY()
+
+ MG_LOG_OPERATION_MESSAGE_INIT(m_packet.m_OperationVersion, m_packet.m_NumArguments);
+
+ ACE_ASSERT(m_stream != NULL);
+
+ if (2 == m_packet.m_NumArguments)
+ {
+
+ STRING transactionID;
+ STRING savePointName;
+
+ m_stream->GetString(transactionID);
+ m_stream->GetString(savePointName);
+
+ BeginExecution();
+
+ MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
+ MG_LOG_OPERATION_MESSAGE_ADD_STRING(transactionID);
+ MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+ MG_LOG_OPERATION_MESSAGE_ADD_STRING(savePointName);
+ MG_LOG_OPERATION_MESSAGE_PARAMETERS_END();
+
+ Validate();
+
+ // Execute the operation
+ bool bSuccess = m_service->RollbackSavePoint(transactionID, savePointName);
+
+ // Write the response
+ EndExecution(bSuccess);
+ }
+ else
+ {
+ MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
+ MG_LOG_OPERATION_MESSAGE_PARAMETERS_END();
+ }
+
+ if (!m_argsRead)
+ {
+ throw new MgOperationProcessingException(L"MgOpRollbackSavePoint.Execute",
+ __LINE__, __WFILE__, NULL, L"", NULL);
+ }
+
+ // Successful operation
+ MG_LOG_OPERATION_MESSAGE_ADD_STRING(MgResources::Success.c_str());
+
+ MG_FEATURE_SERVICE_CATCH(L"MgOpRollbackSavePoint.Execute")
+
+ if (mgException != NULL)
+ {
+ // Failed operation
+ MG_LOG_OPERATION_MESSAGE_ADD_STRING(MgResources::Failure.c_str());
+ }
+
+ // Add access log entry for operation
+ MG_LOG_OPERATION_MESSAGE_ACCESS_ENTRY();
+
+ MG_FEATURE_SERVICE_THROW()
+}
Added: trunk/MgDev/Server/src/Services/Feature/OpRollbackSavePoint.h
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/OpRollbackSavePoint.h (rev 0)
+++ trunk/MgDev/Server/src/Services/Feature/OpRollbackSavePoint.h 2011-07-05 09:18:40 UTC (rev 5966)
@@ -0,0 +1,32 @@
+//
+// Copyright (C) 2004-2011 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library 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
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#ifndef MG_OP_ROLLBACKSAVEPOINT_H
+#define MG_OP_ROLLBACKSAVEPOINT_H
+
+#include "FeatureOperation.h"
+
+class MgOpRollbackSavePoint : public MgFeatureOperation
+{
+ public:
+ MgOpRollbackSavePoint();
+ virtual ~MgOpRollbackSavePoint();
+
+ public:
+ virtual void Execute();
+};
+#endif
Modified: trunk/MgDev/Server/src/Services/Feature/ServerFeatureService.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/ServerFeatureService.cpp 2011-07-04 07:16:15 UTC (rev 5965)
+++ trunk/MgDev/Server/src/Services/Feature/ServerFeatureService.cpp 2011-07-05 09:18:40 UTC (rev 5966)
@@ -2126,7 +2126,62 @@
return bResult;
}
+///////////////////////////////////////////////////////////////////////////
+STRING MgServerFeatureService::AddSavePoint(CREFSTRING transactionId, CREFSTRING suggestName)
+{
+ MG_LOG_TRACE_ENTRY(L"MgServerFeatureService::AddSavePoint()");
+ STRING resultName;
+
+ MG_FEATURE_SERVICE_TRY()
+
+ MgServerFeatureTransactionPool* transactionPool = MgServerFeatureTransactionPool::GetInstance();
+ CHECKNULL(transactionPool, L"MgServerFeatureService.AddSavePoint");
+
+ resultName = transactionPool->AddSavePoint(transactionId, suggestName);
+ MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerFeatureService.AddSavePoint")
+
+ return resultName;
+}
+
+bool MgServerFeatureService::RollbackSavePoint(CREFSTRING transactionId, CREFSTRING savePointName)
+{
+ MG_LOG_TRACE_ENTRY(L"MgServerFeatureService::RollbackSavePoint()");
+
+ bool bResult = false;
+
+ MG_FEATURE_SERVICE_TRY()
+
+ MgServerFeatureTransactionPool* transactionPool = MgServerFeatureTransactionPool::GetInstance();
+ CHECKNULL(transactionPool, L"MgServerFeatureService.RollbackSavePoint");
+
+ bResult = transactionPool->RollbackSavePoint(transactionId, savePointName);
+
+ MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerFeatureService.RollbackSavePoint")
+
+ return bResult;
+}
+
+///////////////////////////////////////////////////////////////////////////
+bool MgServerFeatureService::ReleaseSavePoint(CREFSTRING transactionId, CREFSTRING savePointName)
+{
+ MG_LOG_TRACE_ENTRY(L"MgServerFeatureService::ReleaseSavePoint()");
+
+ bool bResult = false;
+
+ MG_FEATURE_SERVICE_TRY()
+
+ MgServerFeatureTransactionPool* transactionPool = MgServerFeatureTransactionPool::GetInstance();
+ CHECKNULL(transactionPool, L"MgServerFeatureService.ReleaseSavePoint");
+
+ bResult = transactionPool->ReleaseSavePoint(transactionId, savePointName);
+
+ MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerFeatureService.ReleaseSavePoint")
+
+ return bResult;
+}
+
+
//////////////////////////////////////////////////////////////////
/// <summary>
/// Gets the FDO cache information for the server
Modified: trunk/MgDev/Server/src/Services/Feature/ServerFeatureService.h
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/ServerFeatureService.h 2011-07-04 07:16:15 UTC (rev 5965)
+++ trunk/MgDev/Server/src/Services/Feature/ServerFeatureService.h 2011-07-05 09:18:40 UTC (rev 5966)
@@ -1035,6 +1035,15 @@
// Rollback the transaction specified by the transaction id.
bool RollbackTransaction(CREFSTRING transactionId);
+ //Add save point
+ STRING AddSavePoint(CREFSTRING transactionId, CREFSTRING suggestName);
+
+ //Roll back to a save point
+ bool RollbackSavePoint(CREFSTRING transactionId, CREFSTRING savePointName);
+
+ //Release a save point
+ bool ReleaseSavePoint(CREFSTRING transactionId, CREFSTRING savePointName);
+
private:
unsigned StringHasher(FdoString* pszString);
Modified: trunk/MgDev/Server/src/Services/Feature/ServerFeatureService.vcproj
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/ServerFeatureService.vcproj 2011-07-04 07:16:15 UTC (rev 5965)
+++ trunk/MgDev/Server/src/Services/Feature/ServerFeatureService.vcproj 2011-07-05 09:18:40 UTC (rev 5966)
@@ -466,8 +466,47 @@
<File
RelativePath=".\OpApplySchema.h"
>
+ <File
+ RelativePath=".\OpAddSavePoint.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|x64"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|x64"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
</File>
<File
+ RelativePath=".\OpAddSavePoint.h"
+ >
+ </File>
+ <File
RelativePath=".\OpBeginTransaction.cpp"
>
<FileConfiguration
@@ -1588,6 +1627,85 @@
>
</File>
<File
+ RelativePath=".\OpReleaseSavePoint.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|x64"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|x64"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\OpReleaseSavePoint.h"
+ >
+ <File
+ RelativePath=".\OpRollbackSavePoint.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|x64"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|x64"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\OpRollbackSavePoint.h"
+ >
+ </File>
+ <File
RelativePath=".\OpRollbackTransaction.cpp"
>
<FileConfiguration
Modified: trunk/MgDev/Server/src/Services/Feature/ServerFeatureService.vcxproj
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/ServerFeatureService.vcxproj 2011-07-04 07:16:15 UTC (rev 5965)
+++ trunk/MgDev/Server/src/Services/Feature/ServerFeatureService.vcxproj 2011-07-05 09:18:40 UTC (rev 5966)
@@ -217,6 +217,12 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
+ <ClCompile Include="OpAddSavePoint.cpp">
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+ </ClCompile>
<ClCompile Include="OpApplySchema.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
@@ -391,6 +397,18 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
+ <ClCompile Include="OpReleaseSavePoint.cpp">
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+ </ClCompile>
+ <ClCompile Include="OpRollbackSavePoint.cpp">
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+ </ClCompile>
<ClCompile Include="OpRollbackTransaction.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
@@ -760,6 +778,7 @@
<ItemGroup>
<ClInclude Include="FeatureOperation.h" />
<ClInclude Include="FeatureOperationFactory.h" />
+ <ClInclude Include="OpAddSavePoint.h" />
<ClInclude Include="OpApplySchema.h" />
<ClInclude Include="OpBeginTransaction.h" />
<ClInclude Include="OpCloseDataReader.h" />
@@ -789,6 +808,8 @@
<ClInclude Include="OpGetSpatialContexts.h" />
<ClInclude Include="OpGetSqlRows.h" />
<ClInclude Include="OpGetWfsFeature.h" />
+ <ClInclude Include="OpReleaseSavePoint.h" />
+ <ClInclude Include="OpRollbackSavePoint.h" />
<ClInclude Include="OpRollbackTransaction.h" />
<ClInclude Include="OpSchemaToXml.h" />
<ClInclude Include="OpSelectFeatures.h" />
Modified: trunk/MgDev/Server/src/Services/Feature/ServerFeatureService.vcxproj.filters
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/ServerFeatureService.vcxproj.filters 2011-07-04 07:16:15 UTC (rev 5965)
+++ trunk/MgDev/Server/src/Services/Feature/ServerFeatureService.vcxproj.filters 2011-07-05 09:18:40 UTC (rev 5966)
@@ -12,6 +12,9 @@
<ClCompile Include="FeatureOperationFactory.cpp">
<Filter>Ops</Filter>
</ClCompile>
+ <ClCompile Include="OpAddSavePoint.cpp">
+ <Filter>Ops</Filter>
+ </ClCompile>
<ClCompile Include="OpApplySchema.cpp">
<Filter>Ops</Filter>
</ClCompile>
@@ -99,6 +102,12 @@
<ClCompile Include="OpGetWfsFeature.cpp">
<Filter>Ops</Filter>
</ClCompile>
+ <ClCompile Include="OpReleaseSavePoint.cpp">
+ <Filter>Ops</Filter>
+ </ClCompile>
+ <ClCompile Include="OpRollbackSavePoint.cpp">
+ <Filter>Ops</Filter>
+ </ClCompile>
<ClCompile Include="OpRollbackTransaction.cpp">
<Filter>Ops</Filter>
</ClCompile>
@@ -186,6 +195,9 @@
<ClInclude Include="FeatureOperationFactory.h">
<Filter>Ops</Filter>
</ClInclude>
+ <ClInclude Include="OpAddSavePoint.h">
+ <Filter>Ops</Filter>
+ </ClInclude>
<ClInclude Include="OpApplySchema.h">
<Filter>Ops</Filter>
</ClInclude>
@@ -273,6 +285,12 @@
<ClInclude Include="OpGetWfsFeature.h">
<Filter>Ops</Filter>
</ClInclude>
+ <ClInclude Include="OpRollbackSavePoint.h">
+ <Filter>Ops</Filter>
+ </ClInclude>
+ <ClInclude Include="OpReleaseSavePoint.h">
+ <Filter>Ops</Filter>
+ </ClInclude>
<ClInclude Include="OpRollbackTransaction.h">
<Filter>Ops</Filter>
</ClInclude>
Modified: trunk/MgDev/Server/src/Services/Feature/ServerFeatureServiceBuild.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/ServerFeatureServiceBuild.cpp 2011-07-04 07:16:15 UTC (rev 5965)
+++ trunk/MgDev/Server/src/Services/Feature/ServerFeatureServiceBuild.cpp 2011-07-05 09:18:40 UTC (rev 5966)
@@ -18,6 +18,7 @@
#include "FeatureOperation.cpp"
#include "FeatureOperationFactory.cpp"
#include "FeatureServiceHandler.cpp"
+#include "OpAddSavePoint.cpp"
#include "OpApplySchema.cpp"
#include "OpCreateFeatureSource.cpp"
#include "OpDescribeSchema.cpp"
@@ -29,6 +30,8 @@
#include "OpGetFdoCacheInfo.cpp"
#include "OpGetFeatureProviders.cpp"
#include "OpGetSpatialContexts.cpp"
+#include "OpReleaseSavePoint.cpp"
+#include "OpRollbackSavePoint.cpp"
#include "OpSelectFeatures.cpp"
#include "OpSelectFeaturesSpatial.cpp"
#include "OpTestConnection.cpp"
Modified: trunk/MgDev/Server/src/Services/Feature/ServerFeatureTransaction.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/ServerFeatureTransaction.cpp 2011-07-04 07:16:15 UTC (rev 5965)
+++ trunk/MgDev/Server/src/Services/Feature/ServerFeatureTransaction.cpp 2011-07-05 09:18:40 UTC (rev 5966)
@@ -70,6 +70,43 @@
Close();
}
+STRING MgServerFeatureTransaction::AddSavePoint(CREFSTRING suggestName)
+{
+ if (m_bIsClosed) // Has already been closed through Commit, Rollback or SetTimeout.
+ {
+ return L"";
+ }
+
+ CHECKNULL(m_fdoTransaction, L"MgServerFeatureTransaction.AddSavePoint")
+
+ STRING retStr = m_fdoTransaction->AddSavePoint(suggestName.c_str());
+ return retStr;
+}
+
+void MgServerFeatureTransaction::ReleaseSavePoint(CREFSTRING savePointName)
+{
+ if (m_bIsClosed) // Has already been closed through Commit, Rollback or SetTimeout.
+ {
+ return;
+ }
+
+ CHECKNULL(m_fdoTransaction, L"MgServerFeatureTransaction.AddSavePoint")
+
+ m_fdoTransaction->ReleaseSavePoint(savePointName.c_str());
+}
+
+void MgServerFeatureTransaction::Rollback(CREFSTRING savePointName)
+{
+ if (m_bIsClosed) // Has already been closed through Commit, Rollback or SetTimeout.
+ {
+ return;
+ }
+
+ CHECKNULL(m_fdoTransaction, L"MgServerFeatureTransaction.AddSavePoint")
+
+ m_fdoTransaction->Rollback(savePointName.c_str());
+}
+
void MgServerFeatureTransaction::Serialize(MgStream* stream)
{
bool operationCompleted = false;
Modified: trunk/MgDev/Server/src/Services/Feature/ServerFeatureTransaction.h
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/ServerFeatureTransaction.h 2011-07-04 07:16:15 UTC (rev 5965)
+++ trunk/MgDev/Server/src/Services/Feature/ServerFeatureTransaction.h 2011-07-05 09:18:40 UTC (rev 5966)
@@ -37,7 +37,37 @@
///
virtual void Commit();
+ /// \brief
+ /// Create a save point in this transaction.
+ ///
+ /// \param suggestName
+ /// Suggested save point name.
+ ///
+ /// \returns
+ /// The actual name used
+ virtual STRING AddSavePoint(CREFSTRING suggestName);
+
/// \brief
+ /// Release a specific save point.
+ ///
+ /// \param savePointName
+ /// Save point name.
+ ///
+ /// \returns
+ /// Returns nothing
+ virtual void ReleaseSavePoint(CREFSTRING savePointName);
+
+ /// \brief
+ /// Rollback the transaction to a specified save point.
+ ///
+ /// \param savePointName
+ /// Save point name.
+ ///
+ /// \returns
+ /// Returns nothing
+ virtual void Rollback(CREFSTRING savePointName);
+
+ /// \brief
/// Rollback the transaction.
///
virtual void Rollback();
Modified: trunk/MgDev/Server/src/Services/Feature/ServerFeatureTransactionPool.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/ServerFeatureTransactionPool.cpp 2011-07-04 07:16:15 UTC (rev 5965)
+++ trunk/MgDev/Server/src/Services/Feature/ServerFeatureTransactionPool.cpp 2011-07-05 09:18:40 UTC (rev 5966)
@@ -172,6 +172,56 @@
return RemoveTransaction(transactionId);
}
+STRING MgServerFeatureTransactionPool::AddSavePoint(CREFSTRING transactionId, CREFSTRING suggestName)
+{
+ Ptr<MgServerFeatureTransaction> tran = GetTransaction(transactionId);
+ STRING resultName;
+ if (NULL != tran.p)
+ {
+ resultName = tran->AddSavePoint(suggestName);
+ }
+
+ return resultName;
+}
+
+bool MgServerFeatureTransactionPool::RollbackSavePoint(CREFSTRING transactionId, CREFSTRING savePointName)
+{
+ Ptr<MgServerFeatureTransaction> tran = GetTransaction(transactionId);
+ bool bResult = false;
+
+ MG_FEATURE_SERVICE_TRY()
+ if (NULL != tran.p)
+ {
+ tran->Rollback(savePointName);
+ }
+ MG_FEATURE_SERVICE_CATCH(L"MgServerFeatureTransactionPool.RollbackSavePoint")
+
+ if(mgException == NULL)
+ {
+ bResult = true;
+ }
+ return bResult;
+}
+
+bool MgServerFeatureTransactionPool::ReleaseSavePoint(CREFSTRING transactionId, CREFSTRING savePointName)
+{
+ Ptr<MgServerFeatureTransaction> tran = GetTransaction(transactionId);
+ bool bResult = false;
+
+ MG_FEATURE_SERVICE_TRY()
+ if (NULL != tran.p)
+ {
+ tran->ReleaseSavePoint(savePointName);
+ }
+ MG_FEATURE_SERVICE_CATCH(L"MgServerFeatureTransactionPool.ReleaseSavePoint")
+
+ if(mgException == NULL)
+ {
+ bResult = true;
+ }
+ return bResult;
+}
+
STRING MgServerFeatureTransactionPool::AddTransaction(MgServerFeatureTransaction* featTransaction)
{
ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, sm_mutex, L""));
Modified: trunk/MgDev/Server/src/Services/Feature/ServerFeatureTransactionPool.h
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/ServerFeatureTransactionPool.h 2011-07-04 07:16:15 UTC (rev 5965)
+++ trunk/MgDev/Server/src/Services/Feature/ServerFeatureTransactionPool.h 2011-07-05 09:18:40 UTC (rev 5966)
@@ -67,6 +67,12 @@
void ValidateTimeout(CREFSTRING transactionId);
+ STRING AddSavePoint(CREFSTRING transactionId, CREFSTRING suggestName);
+
+ bool RollbackSavePoint(CREFSTRING transactionId, CREFSTRING savePointName);
+
+ bool ReleaseSavePoint(CREFSTRING transactionId, CREFSTRING savePointName);
+
private:
MgServerFeatureTransactionPool();
More information about the mapguide-commits
mailing list