From: Oliver Kurth Date: Fri, 9 Nov 2018 21:22:25 +0000 (-0800) Subject: Remove Common Agent Framework (CAF) from Tools - Linux Changes X-Git-Tag: stable-11.0.0~312 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ce5e473e61d488a0f9cc79a4896562ab5e6f4409;p=thirdparty%2Fopen-vm-tools.git Remove Common Agent Framework (CAF) from Tools - Linux Changes The CAF files have been removed from VMWare Tools and the open-vm-tools source. --- diff --git a/open-vm-tools/Makefile.am b/open-vm-tools/Makefile.am index c79cc6df3..893b224de 100644 --- a/open-vm-tools/Makefile.am +++ b/open-vm-tools/Makefile.am @@ -65,15 +65,6 @@ if WITH_KERNEL_MODULES endif SUBDIRS += docs -if ENABLE_CAF - SUBDIRS += common-agent/Cpp/Framework - SUBDIRS += common-agent/Cpp/ManagementAgent - SUBDIRS += common-agent/Cpp/Communication - SUBDIRS += common-agent/Cpp/ProviderFx - SUBDIRS += common-agent/Cpp/InternalProviders - SUBDIRS += common-agent/input - SUBDIRS += common-agent/etc -endif if HAVE_UDEV SUBDIRS += udev diff --git a/open-vm-tools/common-agent/Cpp/Communication/Makefile.am b/open-vm-tools/common-agent/Cpp/Communication/Makefile.am deleted file mode 100644 index ece6a9438..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Makefile.am +++ /dev/null @@ -1,241 +0,0 @@ -################################################################################ -### Copyright (C) 2016 VMware, Inc. All rights reserved. -### -### This program is free software; you can redistribute it and/or modify -### it under the terms of version 2 of the GNU General Public License as -### published by the Free Software Foundation. -### -### 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -################################################################################ - -AUTOMAKE_OPTIONS = subdir-objects -subsysdir = @CAF_SUBSYS_DIR@ -subsys_LTLIBRARIES = -cafbindir = @CAF_PME_BIN_DIR@ -cafbin_PROGRAMS = -caflibdir = @CAF_PME_LIB_DIR@ -caflib_LTLIBRARIES = -caflib_LTLIBRARIES += libCommAmqpIntegration.la - -libCommAmqpIntegration_la_SOURCES= -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/AMQChannel.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/AMQChannelManager.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/AMQCommand.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/AMQConnection.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/AMQUtil.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/Address.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/AmqpAuthPlain.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/AmqpChannel.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/AmqpCommon.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/AmqpConnection.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/AmqpUtil.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/BlockingRpcContinuation.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/CAmqpAuthMechanism.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/CAmqpChannel.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/CAmqpConnection.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/CAmqpFrame.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/CertInfo.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/CommandAssembler.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/ConnectionFactoryImpl.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/ConnectionWeakReference.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/ConsumerDispatcher.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/ConsumerWorkService.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/amqpClient.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/amqpImpl/AMQExceptions.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/amqpImpl/AMQPImpl.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/amqpImpl/AmqpClientImpl.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/amqpImpl/AmqpContentHeadersImpl.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/amqpImpl/BasicAckMethod.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/amqpImpl/BasicCancelMethod.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/amqpImpl/BasicCancelOkMethod.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/amqpImpl/BasicConsumeMethod.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/amqpImpl/BasicConsumeOkMethod.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/amqpImpl/BasicDeliverMethod.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/amqpImpl/BasicGetEmptyMethod.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/amqpImpl/BasicGetMethod.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/amqpImpl/BasicGetOkMethod.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/amqpImpl/BasicProperties.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/amqpImpl/BasicPublishMethod.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/amqpImpl/BasicQosMethod.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/amqpImpl/BasicQosOkMethod.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/amqpImpl/BasicRecoverMethod.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/amqpImpl/BasicRecoverOkMethod.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/amqpImpl/BasicRejectMethod.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/amqpImpl/BasicReturnMethod.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/amqpImpl/ChannelCloseMethod.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/amqpImpl/ChannelCloseOkFromServerMethod.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/amqpImpl/ChannelCloseOkMethod.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/amqpImpl/ChannelOpenOkMethod.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/amqpImpl/EnvelopeImpl.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/amqpImpl/ExchangeDeclareMethod.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/amqpImpl/ExchangeDeclareOkMethod.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/amqpImpl/ExchangeDeleteMethod.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/amqpImpl/ExchangeDeleteOkMethod.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/amqpImpl/FieldImpl.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/amqpImpl/GetResponseImpl.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/amqpImpl/QueueBindMethod.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/amqpImpl/QueueBindOkMethod.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/amqpImpl/QueueDeclareMethod.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/amqpImpl/QueueDeclareOkMethod.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/amqpImpl/QueueDeleteMethod.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/amqpImpl/QueueDeleteOkMethod.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/amqpImpl/QueuePurgeMethod.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/amqpImpl/QueuePurgeOkMethod.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/amqpImpl/QueueUnbindMethod.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpClient/amqpImpl/QueueUnbindOkMethod.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpCore/AbstractConnectionFactory.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpCore/AmqpHeaderMapper.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpCore/AmqpIntegrationExceptions.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpCore/AmqpMessageListenerSource.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpCore/AmqpOutboundEndpoint.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpCore/AutoChannelClose.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpCore/BindingImpl.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpCore/BlockingQueueConsumer.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpCore/CachedChannelHandler.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpCore/CachingConnectionFactory.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpCore/ChannelCachingConnectionProxy.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpCore/CompositeConnectionListener.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpCore/DefaultAmqpHeaderMapper.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpCore/ExchangeImpl.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpCore/HeaderUtils.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpCore/QueueImpl.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpCore/RabbitAdmin.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpCore/RabbitTemplate.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpCore/SimpleConnection.cpp -libCommAmqpIntegration_la_SOURCES += amqpCore/src/amqpCore/SimpleMessageListenerContainer.cpp - -libCommAmqpIntegration_la_CPPFLAGS = -libCommAmqpIntegration_la_CPPFLAGS += @GLIB2_CPPFLAGS@ -libCommAmqpIntegration_la_CPPFLAGS += @LOG4CPP_CPPFLAGS@ -libCommAmqpIntegration_la_CPPFLAGS += @SSL_CPPFLAGS@ -libCommAmqpIntegration_la_CPPFLAGS += @LIBRABBITMQ_CPPFLAGS@ - -libCommAmqpIntegration_la_CPPFLAGS += -I$(top_srcdir)/common-agent/Cpp/Framework/Framework/include -libCommAmqpIntegration_la_CPPFLAGS += -I$(top_srcdir)/common-agent/Cpp/Communication/amqpListener/include -libCommAmqpIntegration_la_CPPFLAGS += -I$(top_srcdir)/common-agent/Cpp/Communication/amqpCore/include -libCommAmqpIntegration_la_LIBADD = -libCommAmqpIntegration_la_LIBADD += @GLIB2_LIBS@ -libCommAmqpIntegration_la_LIBADD += @LOG4CPP_LIBS@ -libCommAmqpIntegration_la_LIBADD += @SSL_LIBS@ -libCommAmqpIntegration_la_LIBADD += -ldl -libCommAmqpIntegration_la_LIBADD += @LIBRABBITMQ_LIBS@ -libCommAmqpIntegration_la_LIBADD += ../Framework/libFramework.la - -libCommAmqpIntegration_la_LDFLAGS = -shared - -subsys_LTLIBRARIES += libCommAmqpIntegrationSubsys.la -libCommAmqpIntegrationSubsys_la_LDFLAGS = @CAF_SUBSYS_LDFLAGS@ - -libCommAmqpIntegrationSubsys_la_SOURCES= -libCommAmqpIntegrationSubsys_la_SOURCES += Subsystems/amqpIntegration/src/AmqpInboundChannelAdapterInstance.cpp -libCommAmqpIntegrationSubsys_la_SOURCES += Subsystems/amqpIntegration/src/AmqpOutboundEndpointInstance.cpp -libCommAmqpIntegrationSubsys_la_SOURCES += Subsystems/amqpIntegration/src/BindingInstance.cpp -libCommAmqpIntegrationSubsys_la_SOURCES += Subsystems/amqpIntegration/src/CachingConnectionFactoryObj.cpp -libCommAmqpIntegrationSubsys_la_SOURCES += Subsystems/amqpIntegration/src/ExchangeInstance.cpp -libCommAmqpIntegrationSubsys_la_SOURCES += Subsystems/amqpIntegration/src/IntegrationObjects.cpp -libCommAmqpIntegrationSubsys_la_SOURCES += Subsystems/amqpIntegration/src/QueueInstance.cpp -libCommAmqpIntegrationSubsys_la_SOURCES += Subsystems/amqpIntegration/src/RabbitAdminInstance.cpp -libCommAmqpIntegrationSubsys_la_SOURCES += Subsystems/amqpIntegration/src/RabbitTemplateInstance.cpp -libCommAmqpIntegrationSubsys_la_SOURCES += Subsystems/amqpIntegration/src/SecureCachingConnectionFactoryObj.cpp -libCommAmqpIntegrationSubsys_la_SOURCES += Subsystems/amqpIntegration/src/amqpIntegration.cpp - -libCommAmqpIntegrationSubsys_la_CPPFLAGS = -libCommAmqpIntegrationSubsys_la_CPPFLAGS += @GLIB2_CPPFLAGS@ -libCommAmqpIntegrationSubsys_la_CPPFLAGS += @LOG4CPP_CPPFLAGS@ -libCommAmqpIntegrationSubsys_la_CPPFLAGS += @SSL_CPPFLAGS@ -libCommAmqpIntegrationSubsys_la_CPPFLAGS += @LIBRABBITMQ_CPPFLAGS@ - -libCommAmqpIntegrationSubsys_la_CPPFLAGS += -I$(top_srcdir)/common-agent/Cpp/Framework/Framework/include -libCommAmqpIntegrationSubsys_la_CPPFLAGS += -I$(top_srcdir)/common-agent/Cpp/Communication/amqpListener/include -libCommAmqpIntegrationSubsys_la_CPPFLAGS += -I$(top_srcdir)/common-agent/Cpp/Communication/amqpCore/include -libCommAmqpIntegrationSubsys_la_LIBADD = -libCommAmqpIntegrationSubsys_la_LIBADD += @GLIB2_LIBS@ -libCommAmqpIntegrationSubsys_la_LIBADD += @LOG4CPP_LIBS@ -libCommAmqpIntegrationSubsys_la_LIBADD += @SSL_LIBS@ -libCommAmqpIntegrationSubsys_la_LIBADD += -ldl -libCommAmqpIntegrationSubsys_la_LIBADD += @LIBRABBITMQ_LIBS@ -libCommAmqpIntegrationSubsys_la_LIBADD += ../Framework/libFramework.la -libCommAmqpIntegrationSubsys_la_LIBADD += ../Communication/libCommAmqpIntegration.la - -libCommAmqpIntegrationSubsys_la_LDFLAGS += -shared - -cafbin_PROGRAMS += CommAmqpListener - -CommAmqpListener_SOURCES= -CommAmqpListener_SOURCES += amqpListener/src/AmqpListenerWorker.cpp -CommAmqpListener_SOURCES += amqpListener/src/amqpListenerMain.cpp - -CommAmqpListener_CPPFLAGS = -CommAmqpListener_CPPFLAGS += @GLIB2_CPPFLAGS@ -CommAmqpListener_CPPFLAGS += @LOG4CPP_CPPFLAGS@ -CommAmqpListener_CPPFLAGS += @SSL_CPPFLAGS@ -CommAmqpListener_CPPFLAGS += @LIBRABBITMQ_CPPFLAGS@ - -CommAmqpListener_CPPFLAGS += -I$(top_srcdir)/common-agent/Cpp/Framework/Framework/include -CommAmqpListener_CPPFLAGS += -I$(top_srcdir)/common-agent/Cpp/Communication/amqpListener/include -CommAmqpListener_CPPFLAGS += -I$(top_srcdir)/common-agent/Cpp/Communication/amqpCore/include -CommAmqpListener_LDADD = -CommAmqpListener_LDADD += @GLIB2_LIBS@ -CommAmqpListener_LDADD += @LOG4CPP_LIBS@ -CommAmqpListener_LDADD += @SSL_LIBS@ -CommAmqpListener_LDADD += -ldl -CommAmqpListener_LDADD += @LIBRABBITMQ_LIBS@ -CommAmqpListener_LDADD += ../Framework/libFramework.la -CommAmqpListener_LDADD += ../Communication/libCommAmqpIntegration.la - -subsys_LTLIBRARIES += libCommIntegrationSubsys.la -libCommIntegrationSubsys_la_LDFLAGS = @CAF_SUBSYS_LDFLAGS@ - -libCommIntegrationSubsys_la_SOURCES= -libCommIntegrationSubsys_la_SOURCES += Subsystems/commIntegration/src/CCmsMessage.cpp -libCommIntegrationSubsys_la_SOURCES += Subsystems/commIntegration/src/CCmsMessageAttachments.cpp -libCommIntegrationSubsys_la_SOURCES += Subsystems/commIntegration/src/CCmsMessageTransformer.cpp -libCommIntegrationSubsys_la_SOURCES += Subsystems/commIntegration/src/CCmsMessageTransformerInstance.cpp -libCommIntegrationSubsys_la_SOURCES += Subsystems/commIntegration/src/CCmsMessageUtils.cpp -libCommIntegrationSubsys_la_SOURCES += Subsystems/commIntegration/src/CEventTopicCalculatorInstance.cpp -libCommIntegrationSubsys_la_SOURCES += Subsystems/commIntegration/src/CIncomingMessageHandler.cpp -libCommIntegrationSubsys_la_SOURCES += Subsystems/commIntegration/src/CIncomingMessageHandlerInstance.cpp -libCommIntegrationSubsys_la_SOURCES += Subsystems/commIntegration/src/CMessageDeliveryRecord.cpp -libCommIntegrationSubsys_la_SOURCES += Subsystems/commIntegration/src/CMessagePartDescriptor.cpp -libCommIntegrationSubsys_la_SOURCES += Subsystems/commIntegration/src/CMessagePartDescriptorCalculator.cpp -libCommIntegrationSubsys_la_SOURCES += Subsystems/commIntegration/src/CMessagePartDescriptorSourceRecord.cpp -libCommIntegrationSubsys_la_SOURCES += Subsystems/commIntegration/src/CMessagePartRecord.cpp -libCommIntegrationSubsys_la_SOURCES += Subsystems/commIntegration/src/CMessagePartsBuilder.cpp -libCommIntegrationSubsys_la_SOURCES += Subsystems/commIntegration/src/CMessagePartsHeader.cpp -libCommIntegrationSubsys_la_SOURCES += Subsystems/commIntegration/src/CMessagePartsParser.cpp -libCommIntegrationSubsys_la_SOURCES += Subsystems/commIntegration/src/COutgoingMessageHandler.cpp -libCommIntegrationSubsys_la_SOURCES += Subsystems/commIntegration/src/CProtocolHeaderEnricher.cpp -libCommIntegrationSubsys_la_SOURCES += Subsystems/commIntegration/src/CProtocolHeaderEnricherInstance.cpp -libCommIntegrationSubsys_la_SOURCES += Subsystems/commIntegration/src/CReplyToCacher.cpp -libCommIntegrationSubsys_la_SOURCES += Subsystems/commIntegration/src/CReplyToCacherInstance.cpp -libCommIntegrationSubsys_la_SOURCES += Subsystems/commIntegration/src/CReplyToResolverInstance.cpp -libCommIntegrationSubsys_la_SOURCES += Subsystems/commIntegration/src/commIntegration.cpp - -libCommIntegrationSubsys_la_CPPFLAGS = -libCommIntegrationSubsys_la_CPPFLAGS += @GLIB2_CPPFLAGS@ -libCommIntegrationSubsys_la_CPPFLAGS += @LOG4CPP_CPPFLAGS@ -libCommIntegrationSubsys_la_CPPFLAGS += @SSL_CPPFLAGS@ -libCommIntegrationSubsys_la_CPPFLAGS += @LIBRABBITMQ_CPPFLAGS@ - -libCommIntegrationSubsys_la_CPPFLAGS += -I$(top_srcdir)/common-agent/Cpp/Framework/Framework/include -libCommIntegrationSubsys_la_CPPFLAGS += -I$(top_srcdir)/common-agent/Cpp/Communication/amqpListener/include -libCommIntegrationSubsys_la_CPPFLAGS += -I$(top_srcdir)/common-agent/Cpp/Communication/amqpCore/include -libCommIntegrationSubsys_la_CPPFLAGS += -I$(top_srcdir)/common-agent/Cpp/Communication/Subsystems/commIntegration/include -libCommIntegrationSubsys_la_LIBADD = -libCommIntegrationSubsys_la_LIBADD += @GLIB2_LIBS@ -libCommIntegrationSubsys_la_LIBADD += @LOG4CPP_LIBS@ -libCommIntegrationSubsys_la_LIBADD += @SSL_LIBS@ -libCommIntegrationSubsys_la_LIBADD += -ldl -libCommIntegrationSubsys_la_LIBADD += @LIBRABBITMQ_LIBS@ -libCommIntegrationSubsys_la_LIBADD += ../Framework/libFramework.la -libCommIntegrationSubsys_la_LIBADD += ../Communication/libCommAmqpIntegration.la - -libCommIntegrationSubsys_la_LDFLAGS += -shared - diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/AmqpInboundChannelAdapterInstance.cpp b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/AmqpInboundChannelAdapterInstance.cpp deleted file mode 100644 index cc78a45e8..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/AmqpInboundChannelAdapterInstance.cpp +++ /dev/null @@ -1,276 +0,0 @@ -/* - * Created on: Aug 7, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Common/IAppContext.h" -#include "IBean.h" -#include "Integration/Core/CErrorHandler.h" -#include "Integration/Core/CMessageHandler.h" -#include "Integration/Core/CSimpleAsyncTaskExecutor.h" -#include "Integration/Core/CSourcePollingChannelAdapter.h" -#include "Integration/Dependencies/CPollerMetadata.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntegrationAppContext.h" -#include "Integration/IIntegrationObject.h" -#include "amqpCore/AmqpHeaderMapper.h" -#include "amqpCore/AmqpMessageListenerSource.h" -#include "amqpClient/api/ConnectionFactory.h" -#include "amqpCore/DefaultAmqpHeaderMapper.h" -#include "amqpCore/Queue.h" -#include "Common/CCafRegex.h" -#include "Exception/CCafException.h" -#include "AmqpInboundChannelAdapterInstance.h" - - -using namespace Caf::AmqpIntegration; - -AmqpInboundChannelAdapterInstance::AmqpInboundChannelAdapterInstance() : - _isInitialized(false), - _isRunning(false), - _ackModeProp(ACKNOWLEDGEMODE_AUTO), - _connectionFactoryProp("connectionFactory"), - _autoStartupProp(true), - _phaseProp(G_MAXINT32), - _prefetchCountProp(1), - _receiveTimeoutProp(1000), - _recoveryIntervalProp(5000), - _txSizeProp(1), - CAF_CM_INIT_LOG("AmqpInboundChannelAdapterInstance") { -} - -AmqpInboundChannelAdapterInstance::~AmqpInboundChannelAdapterInstance() { -} - -void AmqpInboundChannelAdapterInstance::initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection) { - CAF_CM_FUNCNAME("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - - std::string prop = configSection->findOptionalAttribute("id"); - if (prop.length()) { - _idProp = prop; - } else { - _idProp = "AmqpInboundChannelAdapter-"; - _idProp += CStringUtils::createRandomUuid(); - } - _channelProp = configSection->findRequiredAttribute("channel"); - _queueProp = configSection->findRequiredAttribute("queue-name"); - prop = configSection->findOptionalAttribute("acknowledge-mode"); - if (prop.length()) { - if (prop == "NONE") { - _ackModeProp = ACKNOWLEDGEMODE_NONE; - } else if (prop == "AUTO") { - _ackModeProp = ACKNOWLEDGEMODE_AUTO; - } else if (prop == "MANUAL") { - CAF_CM_EXCEPTIONEX_VA0( - InvalidArgumentException, - 0, - "acknowledge-mode MANUAL is not supported"); - //_ackModeProp = ACKNOWLEDGEMODE_MANUAL; - } else { - CAF_CM_EXCEPTIONEX_VA1( - InvalidArgumentException, - 0, - "invalid acknowledge-mode '%s'", - prop.c_str()); - } - } - prop = configSection->findOptionalAttribute("connection-factory"); - if (prop.length()) { - _connectionFactoryProp = prop; - } - _errorChannelProp = configSection->findRequiredAttribute("error-channel"); - _mappedRequestHeadersProp = configSection->findOptionalAttribute("mapped-request-headers"); - prop = configSection->findOptionalAttribute("auto-startup"); - if (prop.length()) { - if (prop == "true") { - _autoStartupProp = true; - } else if (prop == "false") { - _autoStartupProp = false; - } else { - CAF_CM_EXCEPTIONEX_VA1( - InvalidArgumentException, - 0, - "invalid auto-startup '%s'", - prop.c_str()); - } - } - prop = configSection->findOptionalAttribute("phase"); - if (prop.length()) { - _phaseProp = CStringConv::fromString(prop); - } - prop = configSection->findOptionalAttribute("prefetch-count"); - if (prop.length()) { - _prefetchCountProp = CStringConv::fromString(prop); - } - prop = configSection->findOptionalAttribute("receive-timeout"); - if (prop.length()) { - _receiveTimeoutProp = CStringConv::fromString(prop); - } - prop = configSection->findOptionalAttribute("recovery-interval"); - if (prop.length()) { - _recoveryIntervalProp = CStringConv::fromString(prop); - } - prop = configSection->findOptionalAttribute("tx-size"); - if (prop.length()) { - _txSizeProp = CStringConv::fromString(prop); - } - - _isInitialized = true; -} - -std::string AmqpInboundChannelAdapterInstance::getId() const { - CAF_CM_FUNCNAME_VALIDATE("getId"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _idProp; -} - -void AmqpInboundChannelAdapterInstance::wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver) { - CAF_CM_FUNCNAME("wire"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(appContext); - CAF_CM_VALIDATE_INTERFACE(channelResolver); - - CCafRegex qRegEx; - qRegEx.initialize("^\\#\\{(?P.+)\\}$"); - Cdeqstr matchName = qRegEx.matchName(_queueProp, "name"); - if (matchName.size()) { - std::string queueRef = matchName.front(); - CAF_CM_LOG_DEBUG_VA1("Resolving queue object reference '%s'", queueRef.c_str()); - SmartPtrIIntegrationObject obj = _intAppContext->getIntegrationObject(queueRef); - SmartPtrQueue queueObj; - queueObj.QueryInterface(obj, false); - if (queueObj) { - _queueProp = queueObj->getName(); - CAF_CM_LOG_DEBUG_VA2( - "Queue object reference '%s' resolved to AMQP queue name '%s'", - queueRef.c_str(), - _queueProp.c_str()); - } else { - CAF_CM_EXCEPTIONEX_VA1( - NoSuchInterfaceException, - 0, - "Integration object '%s' is not of type Queue.", - queueRef.c_str()); - } - } - - SmartPtrAmqpHeaderMapper headerMapper; - if (_mappedRequestHeadersProp.length()) { - SmartPtrDefaultAmqpHeaderMapper defaultHeaderMapper; - defaultHeaderMapper.CreateInstance(); - defaultHeaderMapper->init(_mappedRequestHeadersProp); - headerMapper = defaultHeaderMapper; - } - - SmartPtrCPollerMetadata pollerMetadata; - pollerMetadata.CreateInstance(); - pollerMetadata->putMaxMessagesPerPoll(_txSizeProp); - pollerMetadata->putFixedRate(50); - - SmartPtrAmqpMessageListenerSource listenerSource; - listenerSource.CreateInstance(); - listenerSource->init(headerMapper, pollerMetadata); - - _listenerContainer.CreateInstance(); - _listenerContainer->setAcknowledgeMode(_ackModeProp); - SmartPtrIBean bean = appContext->getBean(_connectionFactoryProp); - SmartPtrConnectionFactory connectionFactory; - connectionFactory.QueryInterface(bean, false); - if (!connectionFactory) { - CAF_CM_EXCEPTIONEX_VA1( - NoSuchInterfaceException, - 0, - "Bean '%s' is not a ConnectionFactory", - _connectionFactoryProp.c_str()); - } - _listenerContainer->setConnectionFactory(connectionFactory); - _listenerContainer->setPrefetchCount(_prefetchCountProp); - _listenerContainer->setQueue(_queueProp); - _listenerContainer->setReceiveTimeout(_receiveTimeoutProp); - _listenerContainer->setRecoveryInterval(_recoveryIntervalProp); - _listenerContainer->setTxSize(_txSizeProp); - _listenerContainer->setMessagerListener(listenerSource); - _listenerContainer->init(); - - SmartPtrCErrorHandler errorHandler; - errorHandler.CreateInstance(); - errorHandler->initialize( - channelResolver, - channelResolver->resolveChannelName(_errorChannelProp)); - - SmartPtrCMessageHandler messageHandler; - messageHandler.CreateInstance(); - messageHandler->initialize( - _idProp, - channelResolver->resolveChannelName(_channelProp), - SmartPtrICafObject()); - - SmartPtrCSourcePollingChannelAdapter sourcePollingChannelAdapter; - sourcePollingChannelAdapter.CreateInstance(); - sourcePollingChannelAdapter->initialize( - messageHandler, - listenerSource, - errorHandler); - - SmartPtrCSimpleAsyncTaskExecutor simpleAsyncTaskExecutor; - simpleAsyncTaskExecutor.CreateInstance(); - simpleAsyncTaskExecutor->initialize( - sourcePollingChannelAdapter, - errorHandler); - _taskExecutor = simpleAsyncTaskExecutor; - - _intAppContext = NULL; -} - -void AmqpInboundChannelAdapterInstance::setIntegrationAppContext( - SmartPtrIIntegrationAppContext context) { - CAF_CM_FUNCNAME_VALIDATE("setIntegrationAppContext"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(context); - _intAppContext = context; -} - -bool AmqpInboundChannelAdapterInstance::isAutoStartup() const { - CAF_CM_FUNCNAME_VALIDATE("isAutoStartup"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _autoStartupProp; -} - -void AmqpInboundChannelAdapterInstance::start(const uint32 timeoutMs) { - CAF_CM_FUNCNAME_VALIDATE("start"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - _listenerContainer->start(timeoutMs); - _taskExecutor->execute(timeoutMs); - _isRunning = true; -} - -void AmqpInboundChannelAdapterInstance::stop(const uint32 timeoutMs) { - CAF_CM_FUNCNAME_VALIDATE("stop"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - _listenerContainer->stop(timeoutMs); - _taskExecutor->cancel(timeoutMs); -} - -bool AmqpInboundChannelAdapterInstance::isRunning() const { - CAF_CM_FUNCNAME_VALIDATE("isRunning"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _isRunning; -} - -int32 AmqpInboundChannelAdapterInstance::getPhase() const { - CAF_CM_FUNCNAME_VALIDATE("getPhase"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _phaseProp; -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/AmqpInboundChannelAdapterInstance.h b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/AmqpInboundChannelAdapterInstance.h deleted file mode 100644 index c601a702a..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/AmqpInboundChannelAdapterInstance.h +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Created on: Aug 7, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AmqpInboundChannelAdapterInstance_h -#define AmqpInboundChannelAdapterInstance_h - - -#include "Integration/IIntegrationAppContextAware.h" - -#include "Common/IAppContext.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntegrationAppContext.h" -#include "Integration/ITaskExecutor.h" -#include "amqpCore/SimpleMessageListenerContainer.h" -#include "Integration/IIntegrationComponentInstance.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/IPhased.h" -#include "Integration/ISmartLifecycle.h" - -namespace Caf { namespace AmqpIntegration { - -/** - * @ingroup IntObj - * @brief Adapter that receives messages from an AMQP queue, converts them into - * integration messages, and sends the results to a Message Channel. - *

- *

- * Example context file declaration:
- *
- * 
- *
- * 
- * 
- *
- * 
- *
- *	
- *

- * XML attribute definitions: - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
AttributeDescription
idoptional Unique id for this adapter.
channelrequired The channel to which messages should be sent.
queue-namerequired The AMQP queue from which messaged should be consumed.
acknowledge-modeoptional Acknowledgment mode (NONE, AUTO, MANUAL). Defaults to AUTO.
connection-factoryoptional Bean reference to the RabbitMQ ConnectionFactory. Defaults to 'connectionFactory'
error-channelrequired Message channel to which error messages should be sent.
mapped-request-headersoptional A regular expression indicating which AMQP headers will be mapped into message headers.
auto-startupoptional Specifies if the adapter is to start automatically. If 'false', the adapter must be started programatically. Defaults to 'true'.
phaseoptional Specifies the phase in which the adapter should be started. By default this value is G_MAXINT32 meaning that this adapter will start as late as possible.
prefetch-countoptional Tells the AMQP broker how many messages to send to the the consumer in a single request. Defaults to 1.
receive-timeoutoptional Receive timeout in milliseconds. Defaults to 1000.
recovery-intervaloptional Specifies the interval between broker connection recovery attempts in milliseconds. Defaults to 5000.
tx-sizeoptional Tells the adapter how many messages to process in a single batch. This should be less than or equal to to prefetch-count. Defaults to 1.
- */ -class AmqpInboundChannelAdapterInstance : - public IIntegrationObject, - public IIntegrationComponentInstance, - public IIntegrationAppContextAware, - public ISmartLifecycle, - public IPhased { - CAF_BEGIN_QI() - CAF_QI_ENTRY(IIntegrationObject) - CAF_QI_ENTRY(IIntegrationComponentInstance) - CAF_QI_ENTRY(IIntegrationAppContextAware) - CAF_QI_ENTRY(ILifecycle) - CAF_QI_ENTRY(ISmartLifecycle) - CAF_QI_ENTRY(IPhased) - CAF_END_QI() -public: - AmqpInboundChannelAdapterInstance(); - virtual ~AmqpInboundChannelAdapterInstance(); - -public: // IIntegrationObject - void initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection); - - std::string getId() const; - -public: // IIntegrationComponentInstance - void wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver); - -public: // IIntegrationAppContextAware - void setIntegrationAppContext( - SmartPtrIIntegrationAppContext context); - -public: // ISmartLifecycle - bool isAutoStartup() const; - -public: // ILifecycle - void start(const uint32 timeoutMs); - void stop(const uint32 timeoutMs); - bool isRunning() const; - -public: // IPhased - int32 getPhase() const; - -private: - bool _isInitialized; - bool _isRunning; - SmartPtrIIntegrationAppContext _intAppContext; - SmartPtrSimpleMessageListenerContainer _listenerContainer; - SmartPtrITaskExecutor _taskExecutor; - - std::string _idProp; - std::string _channelProp; - std::string _queueProp; - AcknowledgeMode _ackModeProp; - std::string _connectionFactoryProp; - std::string _errorChannelProp; - std::string _mappedRequestHeadersProp; - bool _autoStartupProp; - int32 _phaseProp; - uint32 _prefetchCountProp; - uint32 _receiveTimeoutProp; - uint32 _recoveryIntervalProp; - uint32 _txSizeProp; - - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(AmqpInboundChannelAdapterInstance); -}; -CAF_DECLARE_SMART_QI_POINTER(AmqpInboundChannelAdapterInstance); - -}} - -#endif /* AmqpInboundChannelAdapterInstance_h */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/AmqpOutboundEndpointInstance.cpp b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/AmqpOutboundEndpointInstance.cpp deleted file mode 100644 index 9f1b8526e..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/AmqpOutboundEndpointInstance.cpp +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Created on: Jul 16, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "amqpCore/AmqpOutboundEndpoint.h" -#include "Common/IAppContext.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntegrationAppContext.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/IMessageChannel.h" -#include "amqpCore/AmqpTemplate.h" -#include "Exception/CCafException.h" -#include "Common/IAppConfig.h" -#include "AmqpOutboundEndpointInstance.h" - -using namespace Caf::AmqpIntegration; - -AmqpOutboundEndpointInstance::AmqpOutboundEndpointInstance() : - _isInitialized(false), - _isRunning(false), - CAF_CM_INIT_LOG("AmqpOutboundEndpointInstance") { -} - -AmqpOutboundEndpointInstance::~AmqpOutboundEndpointInstance() { -} - -void AmqpOutboundEndpointInstance::initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection) { - _id = configSection->findOptionalAttribute("id"); - if (!_id.length()) { - _id = CStringUtils::createRandomUuid(); - } - _configSection = configSection; - _isInitialized = true; -} - -std::string AmqpOutboundEndpointInstance::getId() const { - return _id; -} - -void AmqpOutboundEndpointInstance::setIntegrationAppContext( - SmartPtrIIntegrationAppContext context) { - _context = context; -} - - -void AmqpOutboundEndpointInstance::wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver) { - CAF_CM_FUNCNAME("wire"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - const SmartPtrIMessageChannel errorMessageChannel = - channelResolver->resolveChannelName("errorChannel"); - - std::string elementVal = _configSection->findOptionalAttribute("amqp-template"); - if (!elementVal.length()) { - elementVal = "amqpTemplate"; - CAF_CM_LOG_DEBUG_VA0("Using default amqp-template reference value 'amqpTemplate'"); - } - SmartPtrIIntegrationObject amqpTemplateObj = _context->getIntegrationObject(elementVal); - SmartPtrAmqpTemplate amqpTemplate; - amqpTemplate.QueryInterface(amqpTemplateObj, false); - if (!amqpTemplate) { - CAF_CM_EXCEPTIONEX_VA1( - NoSuchInterfaceException, - 0, - "Bean '%s' is not of type AmqpTemplate", - elementVal.c_str()); - } - - SmartPtrIAppConfig appConfig = getAppConfig(); - SmartPtrAmqpOutboundEndpoint outboundEndpoint; - outboundEndpoint.CreateInstance(); - elementVal = _configSection->findOptionalAttribute("exchange-name"); - outboundEndpoint->setExchangeName(appConfig->resolveValue(elementVal)); - elementVal = _configSection->findOptionalAttribute("exchange-name-expression"); - outboundEndpoint->setExchangeNameExpression(elementVal); - elementVal = _configSection->findOptionalAttribute("routing-key"); - outboundEndpoint->setRoutingKey(appConfig->resolveValue(elementVal)); - elementVal = _configSection->findOptionalAttribute("routing-key-expression"); - outboundEndpoint->setRoutingKeyExpression(elementVal); - elementVal = _configSection->findOptionalAttribute("mapped-request-headers"); - outboundEndpoint->setMappedRequestHeadersExpression(appConfig->resolveValue(elementVal)); - outboundEndpoint->init( - amqpTemplate, - appConfig, - appContext); - - elementVal = _configSection->findRequiredAttribute("channel"); - SmartPtrIMessageChannel inputChannel = channelResolver->resolveChannelName(elementVal); - SmartPtrIIntegrationObject inputChannelObj; - inputChannelObj.QueryInterface(inputChannel); - - - _messagingTemplate.CreateInstance(); - _messagingTemplate->initialize( - channelResolver, - inputChannelObj, - errorMessageChannel, - SmartPtrIMessageChannel(), - outboundEndpoint); -} - -void AmqpOutboundEndpointInstance::start(const uint32 timeoutMs) { - CAF_CM_FUNCNAME("start"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_ASSERT(!_isRunning); - _isRunning = true; - _messagingTemplate->start(0); -} - -void AmqpOutboundEndpointInstance::stop(const uint32 timeoutMs) { - CAF_CM_FUNCNAME("stop"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_ASSERT(_isRunning); - _isRunning = false; - _messagingTemplate->stop(0); -} - -bool AmqpOutboundEndpointInstance::isRunning() const { - return _isRunning; -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/AmqpOutboundEndpointInstance.h b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/AmqpOutboundEndpointInstance.h deleted file mode 100644 index 902b6ed94..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/AmqpOutboundEndpointInstance.h +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Created on: Jul 16, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AMQPOUTBOUNDENDPOINTINSTANCE_H_ -#define AMQPOUTBOUNDENDPOINTINSTANCE_H_ - - -#include "Integration/IIntegrationAppContextAware.h" - -#include "Common/IAppContext.h" -#include "Integration/Core/CMessagingTemplate.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntegrationAppContext.h" -#include "Integration/IIntegrationComponentInstance.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/ILifecycle.h" - -namespace Caf { namespace AmqpIntegration { - -/** - * @ingroup IntObj - * @brief An Integration Object implementing Caf::AmqpIntegration::AmqpOutboundEndpoint - *

- *

- * Example context file declaration:
- *
- * 
- *
- * 
- *
- * 
- *	
- *

- * XML attribute definitions: - * - * - * - * - * - * - * - * - * - *
AttributeDescription
channelrequired The channel supplying messages to be sent.
exchange-nameThe name of the exchange to publish to. - * Either exchange-name or exchange-name-expression must be specified.
exchange-name-expressionThe name of the exchange to publish to resolved by calling an IExpressionInvoker object. - * Either exchange-name or exchange-name-expression must be specified.
routing-keyThe routing key for the message. - * Either routing-key or routing-key-expression must be specified.
routing-key-expressionThe routing key for the message resolved by calling an IExpressionInvoker object. - * Either routing-key or routing-key-expression must be specified.
mapped-request-headersoptional A regular expression used to transmit user-defined headers along with the message. - *
- */ -class AmqpOutboundEndpointInstance : - public IIntegrationObject, - public IIntegrationComponentInstance, - public IIntegrationAppContextAware, - public ILifecycle { - CAF_BEGIN_QI() - CAF_QI_ENTRY(IIntegrationObject) - CAF_QI_ENTRY(IIntegrationComponentInstance) - CAF_QI_ENTRY(IIntegrationAppContextAware) - CAF_QI_ENTRY(ILifecycle) - CAF_END_QI() - -public: - AmqpOutboundEndpointInstance(); - virtual ~AmqpOutboundEndpointInstance(); - -public: // IIntegrationObject - void initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection); - - std::string getId() const; - -public: // IIntegrationComponentInstance - void wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver); - -public: // IIntegrationAppContextAware - void setIntegrationAppContext( - SmartPtrIIntegrationAppContext context); - -public: // ILifecycle - void start(const uint32 timeoutMs); - void stop(const uint32 timeoutMs); - bool isRunning() const; - -private: - bool _isInitialized; - bool _isRunning; - std::string _id; - SmartPtrIDocument _configSection; - SmartPtrCMessagingTemplate _messagingTemplate; - SmartPtrIIntegrationAppContext _context; - - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(AmqpOutboundEndpointInstance); -}; -CAF_DECLARE_SMART_QI_POINTER(AmqpOutboundEndpointInstance); - -}} -#endif /* AMQPOUTBOUNDENDPOINTINSTANCE_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/BindingInstance.cpp b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/BindingInstance.cpp deleted file mode 100644 index 67fbc4396..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/BindingInstance.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Created on: Jun 15, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Integration/IDocument.h" -#include "amqpCore/Binding.h" -#include "Exception/CCafException.h" -#include "BindingInstance.h" - -using namespace Caf::AmqpIntegration; - -BindingInstance::BindingInstance() : - CAF_CM_INIT("BindingInstance") { - _id = CStringUtils::createRandomUuid(); -} - -BindingInstance::~BindingInstance() { -} - -void BindingInstance::initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection) { - CAF_CM_FUNCNAME("initialize"); - CAF_CM_EXCEPTIONEX_VA0( - UnsupportedOperationException, - 0, - "Binding init from xml not supported"); -} - -std::string BindingInstance::getId() const { - return _id; -} - -void BindingInstance::setBindingInternal(SmartPtrBinding binding) { - _binding = binding; -} - -std::string BindingInstance::getQueue() const { - return _binding->getQueue(); -} - -std::string BindingInstance::getExchange() const { - return _binding->getExchange(); -} - -std::string BindingInstance::getRoutingKey() const { - return _binding->getRoutingKey(); -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/BindingInstance.h b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/BindingInstance.h deleted file mode 100644 index 41df621fa..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/BindingInstance.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Created on: Jun 15, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef BINDINGINSTANCE_H_ -#define BINDINGINSTANCE_H_ - -#include "Integration/IIntegrationObject.h" -#include "Integration/IDocument.h" -#include "amqpCore/Binding.h" -#include "amqpCore/BindingInternal.h" - -namespace Caf { namespace AmqpIntegration { - -/** - * @ingroup IntObj - * @brief An Integration Object implementing Caf::AmqpIntegration::Binding - *

- * Currently this object is only created indirectly through rabbit-binding - * declarations in exchange declarations. - */ -class BindingInstance : - public IIntegrationObject, - public BindingInternal, - public Binding { - CAF_BEGIN_QI() - CAF_QI_ENTRY(IIntegrationObject) - CAF_QI_ENTRY(BindingInternal) - CAF_QI_ENTRY(Binding) - CAF_END_QI() - -public: - BindingInstance(); - virtual ~BindingInstance(); - -public: // IIntegrationObject - void initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection); - - std::string getId() const; - -public: // BindingInternal - void setBindingInternal(SmartPtrBinding binding); - -public: // Binding - std::string getQueue() const; - std::string getExchange() const; - std::string getRoutingKey() const; - -private: - std::string _id; - SmartPtrBinding _binding; - - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(BindingInstance); -}; -CAF_DECLARE_SMART_QI_POINTER(BindingInstance); - -}} - -#endif /* BINDINGINSTANCE_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/CachingConnectionFactoryObj.cpp b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/CachingConnectionFactoryObj.cpp deleted file mode 100644 index 421904d4e..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/CachingConnectionFactoryObj.cpp +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Created on: Jun 4, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Doc/PersistenceDoc/CPersistenceProtocolDoc.h" -#include "amqpCore/CachingConnectionFactory.h" -#include "amqpClient/api/Connection.h" -#include "amqpCore/ConnectionListener.h" -#include "Exception/CCafException.h" -#include "CachingConnectionFactoryObj.h" - -using namespace Caf::AmqpIntegration; - -CachingConnectionFactoryObj::CachingConnectionFactoryObj() : - CAF_CM_INIT_LOG("CachingConnectionFactoryObj") { -} - -CachingConnectionFactoryObj::~CachingConnectionFactoryObj() { -} - -void CachingConnectionFactoryObj::initializeBean( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties) { - CAF_CM_FUNCNAME("initializeBean"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_factory); - CAF_CM_VALIDATE_STL_EMPTY(ctorArgs); - - const std::string persistenceDir = AppConfigUtils::getRequiredString( - "persistence_dir"); - const SmartPtrCPersistenceProtocolDoc persistenceProtocol = - CPersistenceUtils::loadPersistenceProtocol(persistenceDir); - - if (persistenceProtocol.IsNull()) { - CAF_CM_EXCEPTIONEX_VA1(IllegalStateException, ERROR_INVALID_STATE, - "Persistence protocol is empty... Comm must be configured - %s", - persistenceDir.c_str()); - } - - UriUtils::SUriRecord uri; - UriUtils::parseUriString(persistenceProtocol->getUri(), uri); - - const std::string vhost = UriUtils::findOptParameter(uri, "vhost", - AppConfigUtils::getRequiredString("communication_amqp", "vhost")); - const std::string connectionTimeout = UriUtils::findOptParameter(uri, "connection_timeout", - CStringConv::toString( - AppConfigUtils::getRequiredUint32("communication_amqp", "connection_timeout"))); - const std::string connectionRetries = UriUtils::findOptParameter(uri, "connection_retries", - CStringConv::toString( - AppConfigUtils::getRequiredUint32("communication_amqp", "connection_retries"))); - const std::string connectionSecondsToWait = UriUtils::findOptParameter(uri, "connection_seconds_to_wait", - CStringConv::toString( - AppConfigUtils::getRequiredUint32("communication_amqp", "connection_seconds_to_wait"))); - const std::string channelCacheSize = UriUtils::findOptParameter(uri, "channel_cache_size", - CStringConv::toString( - AppConfigUtils::getRequiredUint32("communication_amqp", "channel_cache_size"))); - - CAF_CM_VALIDATE_STRING(uri.protocol); - CAF_CM_VALIDATE_STRING(uri.host); - CAF_CM_VALIDATE_STRING(uri.portStr); - CAF_CM_VALIDATE_STRING(vhost); - - SmartPtrCachingConnectionFactory factory; - factory.CreateInstance(); - factory->init(); - factory->setProtocol(uri.protocol); - factory->setHost(uri.host); - factory->setPort(uri.port); - factory->setVirtualHost(vhost); - if (!uri.username.empty()) { - factory->setUsername(uri.username); - } - if (!uri.password.empty()) { - factory->setPassword(uri.password); - } - if (!connectionTimeout.empty()) { - factory->setConnectionTimeout(CStringConv::fromString(connectionTimeout)); - } - if (!connectionRetries.empty()) { - factory->setRetries(CStringConv::fromString(connectionRetries)); - } - if (!connectionSecondsToWait.empty()) { - factory->setSecondsToWait( - CStringConv::fromString(connectionSecondsToWait)); - } - if (!channelCacheSize.empty()) { - factory->setChannelCacheSize(CStringConv::fromString(channelCacheSize)); - } - - _factory = factory; -} - -void CachingConnectionFactoryObj::terminateBean() { - CAF_CM_FUNCNAME("terminateBean"); - try { - if (_factory) { - _factory->destroy(); - } - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_CRIT_CAFEXCEPTION - ; - CAF_CM_CLEAREXCEPTION; -} - -SmartPtrConnection CachingConnectionFactoryObj::createConnection() { - CAF_CM_FUNCNAME_VALIDATE("createConnection"); - CAF_CM_PRECOND_ISINITIALIZED(_factory); - return _factory->createConnection(); -} - -std::string CachingConnectionFactoryObj::getProtocol() { - CAF_CM_FUNCNAME_VALIDATE("getProtocol"); - CAF_CM_PRECOND_ISINITIALIZED(_factory); - return _factory->getProtocol(); -} - -std::string CachingConnectionFactoryObj::getHost() { - CAF_CM_FUNCNAME_VALIDATE("getHost"); - CAF_CM_PRECOND_ISINITIALIZED(_factory); - return _factory->getHost(); -} - -uint32 CachingConnectionFactoryObj::getPort() { - CAF_CM_FUNCNAME_VALIDATE("getPort"); - CAF_CM_PRECOND_ISINITIALIZED(_factory); - return _factory->getPort(); -} - -std::string CachingConnectionFactoryObj::getVirtualHost() { - CAF_CM_FUNCNAME_VALIDATE("getVirtualHost"); - CAF_CM_PRECOND_ISINITIALIZED(_factory); - return _factory->getVirtualHost(); -} - -std::string CachingConnectionFactoryObj::getUsername() { - CAF_CM_FUNCNAME_VALIDATE("getUsername"); - CAF_CM_PRECOND_ISINITIALIZED(_factory); - return _factory->getUsername(); -} - -std::string CachingConnectionFactoryObj::getPassword() { - CAF_CM_FUNCNAME_VALIDATE("getPassword"); - CAF_CM_PRECOND_ISINITIALIZED(_factory); - return _factory->getPassword(); -} - -std::string CachingConnectionFactoryObj::getCaCertPath() { - CAF_CM_FUNCNAME_VALIDATE("getCaCertPath"); - CAF_CM_PRECOND_ISINITIALIZED(_factory); - return _factory->getCaCertPath(); -} - -std::string CachingConnectionFactoryObj::getClientCertPath() { - CAF_CM_FUNCNAME_VALIDATE("getClientCertPath"); - CAF_CM_PRECOND_ISINITIALIZED(_factory); - return _factory->getClientCertPath(); -} - -std::string CachingConnectionFactoryObj::getClientKeyPath() { - CAF_CM_FUNCNAME_VALIDATE("getClientKeyPath"); - CAF_CM_PRECOND_ISINITIALIZED(_factory); - return _factory->getClientKeyPath(); -} - -uint16 CachingConnectionFactoryObj::getRetries() { - CAF_CM_FUNCNAME_VALIDATE("getRetries"); - CAF_CM_PRECOND_ISINITIALIZED(_factory); - return _factory->getRetries(); -} - -uint16 CachingConnectionFactoryObj::getSecondsToWait() { - CAF_CM_FUNCNAME_VALIDATE("getSecondsToWait"); - CAF_CM_PRECOND_ISINITIALIZED(_factory); - return _factory->getSecondsToWait(); -} - -void CachingConnectionFactoryObj::addConnectionListener( - const SmartPtrConnectionListener& listener) { - CAF_CM_FUNCNAME_VALIDATE("addConnectionListener"); - CAF_CM_PRECOND_ISINITIALIZED(_factory); - _factory->addConnectionListener(listener); -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/CachingConnectionFactoryObj.h b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/CachingConnectionFactoryObj.h deleted file mode 100644 index 77cfd5978..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/CachingConnectionFactoryObj.h +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Created on: Jun 4, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CACHINGCONNECTIONFACTORYOBJ_H_ -#define CACHINGCONNECTIONFACTORYOBJ_H_ - -#include "IBean.h" - -#include "amqpCore/CachingConnectionFactory.h" -#include "amqpClient/api/Connection.h" -#include "amqpCore/ConnectionListener.h" - -namespace Caf { namespace AmqpIntegration { - -/** - * @ingroup IntObj - * @brief An implementation of Caf::AmqpIntegration::ConnectionFactory that returns - * the same connections from all calls, ignores calls to - * Caf::AmqpClient::Connection::close and caches Caf::AmqpClient::Channel. - *

- * By default, only one channel will be cached, with additional requested channels - * being created and disposed on demand. Consider raising the cache size in - * high-concurrency environments. - *

- * NOTE: This factory requires explicit closing of all channels obtained from its - * shared connection. Failure to close channels will disable channel reuse. - *

- * CachingConnectionFactory objects are created by inserting the following into - * the application context: - *

- *
- * \
- * 	\
- * 	\
- * 	\
- * \
- * 
- * Properties: - * - * - * - * - * - * - * - * - * - * - * - * - *
PropertyDescription
hostThe broker host. By default the machine's host name (or localhost - * if the host name cannot be determined).
portThe broker port. By default AmqpClient::DEFAULT_AMQP_PORT
virtualHostThe virtual host on the broker. By default AmqpClient::DEFAULT_VHOST
connectionTimeoutThe connection timeout in milliseconds. A value of zero means - * to wait indefinitely. By default 10 seconds.
channelCacheSizeThe number of channels to cache. By default 1.
- */ -class CachingConnectionFactoryObj : - public TCafSubSystemObjectRoot, - public IBean, - public ConnectionFactory - { - CAF_DECLARE_OBJECT_IDENTIFIER(_sObjIdAmqpCachingConnectionFactory) - - CAF_BEGIN_INTERFACE_MAP(CachingConnectionFactoryObj) - CAF_INTERFACE_ENTRY(IBean) - CAF_INTERFACE_ENTRY(ConnectionFactory) - CAF_END_INTERFACE_MAP() - -public: - CachingConnectionFactoryObj(); - virtual ~CachingConnectionFactoryObj(); - -public: // IBean - void initializeBean( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties); - - void terminateBean(); - -public: // ConnectionFactory - SmartPtrConnection createConnection(); - std::string getProtocol(); - std::string getHost(); - uint32 getPort(); - std::string getVirtualHost(); - std::string getUsername(); - std::string getPassword(); - std::string getCaCertPath(); - std::string getClientCertPath(); - std::string getClientKeyPath(); - uint16 getRetries(); - uint16 getSecondsToWait(); - void addConnectionListener(const SmartPtrConnectionListener& listener); - -private: - SmartPtrCachingConnectionFactory _factory; - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CachingConnectionFactoryObj); -}; - -}} - -#endif /* CACHINGCONNECTIONFACTORYOBJ_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/ExchangeInstance.cpp b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/ExchangeInstance.cpp deleted file mode 100644 index 61b29fa59..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/ExchangeInstance.cpp +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Created on: Jun 14, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Integration/IDocument.h" -#include "amqpCore/Binding.h" -#include "Exception/CCafException.h" -#include "Common/IAppConfig.h" -#include "ExchangeInstance.h" -#include "BindingInstance.h" - -using namespace Caf::AmqpIntegration; - -ExchangeInstance::ExchangeInstance() : - CAF_CM_INIT_LOG("ExchangeInstance") { -} - -ExchangeInstance::~ExchangeInstance() { -} - -void ExchangeInstance::initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection) { - CAF_CM_FUNCNAME("initialize"); - - _id = CStringUtils::createRandomUuid(); - - SmartPtrIAppConfig appConfig = getAppConfig(); - - const std::string exchange = appConfig->resolveValue(configSection->findRequiredAttribute("name")); - const std::string durableStr = configSection->findOptionalAttribute("durable"); - if (durableStr.length()) { - if ((durableStr != "true") && (durableStr != "false")) { - CAF_CM_EXCEPTIONEX_VA3( - InvalidArgumentException, - 0, - "Invalid 'durable' value (%s) for %s '%s'. " - "Value must be either 'true' or 'false'.", - durableStr.c_str(), - configSection->getName().c_str(), - exchange.c_str()); - } - } - const bool durable = !durableStr.length() || (durableStr == "true"); - - if (configSection->getName() == "rabbit-direct-exchange") { - _exchange = createDirectExchange(exchange, durable); - } else if (configSection->getName() == "rabbit-topic-exchange") { - _exchange = createTopicExchange(exchange, durable); - } else if (configSection->getName() == "rabbit-headers-exchange") { - _exchange = createHeadersExchange(exchange, durable); - } else if (configSection->getName() == "rabbit-fanout-exchange") { - _exchange = createFanoutExchange(exchange, durable); - } else { - CAF_CM_EXCEPTIONEX_VA1( - InvalidArgumentException, - 0, - "Invalid exchange type (%s)", - configSection->getName().c_str()); - } - - SmartPtrIDocument bindingsSection = configSection->findOptionalChild("rabbit-bindings"); - if (bindingsSection) { - IDocument::SmartPtrCChildCollection bindingSections = - bindingsSection->getAllChildren(); - for (TSmartConstMapIterator bindingSection(*bindingSections); - bindingSection; - bindingSection++) { - if (bindingSection->getName() != "rabbit-binding") { - CAF_CM_EXCEPTIONEX_VA2( - InvalidArgumentException, - 0, - "Invalid tag (%s) found in bindings section of " - "exchange declaration (name=%s)", - bindingSection->getName().c_str(), - exchange.c_str()); - } - const std::string queue = appConfig->resolveValue(bindingSection->findRequiredAttribute("queue")); - const std::string key = appConfig->resolveValue(bindingSection->findRequiredAttribute("key")); - CAF_CM_LOG_DEBUG_VA3( - "Adding binding declaration [queue id=%s][exchange name=%s][key=%s]", - queue.c_str(), - exchange.c_str(), - key.c_str()); - SmartPtrBindingInstance binding; - binding.CreateInstance(); - binding->setBindingInternal(createBinding(queue, exchange, key)); - _bindings.push_back(binding); - } - } -} - -std::string ExchangeInstance::getId() const { - return _id; -} - -std::string ExchangeInstance::getName() const { - return _exchange->getName(); -} - -std::string ExchangeInstance::getType() const { - return _exchange->getType(); -} - -bool ExchangeInstance::isDurable() const { - return _exchange->isDurable(); -} - -std::deque ExchangeInstance::getEmbeddedBindings() const { - return _bindings; -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/ExchangeInstance.h b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/ExchangeInstance.h deleted file mode 100644 index 7cd310c0d..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/ExchangeInstance.h +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Created on: Jun 14, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef EXCHANGEINSTANCE_H_ -#define EXCHANGEINSTANCE_H_ - - -#include "Integration/IIntegrationObject.h" - -#include "Integration/IDocument.h" -#include "Integration/IIntegrationAppContext.h" -#include "amqpCore/Binding.h" -#include "amqpCore/Exchange.h" -#include "amqpCore/ExchangeInternal.h" - -namespace Caf { namespace AmqpIntegration { - -/** - * @ingroup IntObj - * @brief An Integration Object implementing Caf::AmqpIntegration::Exchange - *

- * %Exchange to queue bindings are also declared as part of an exchange declaration. - *

- * Example context file declarations: - *

- * Direct exchange: - *

- * 
- *    
- *    
- * 
- * 
- * Topic exchange: - *
- * 
- *    
- *    
- * 
- * 
- * Other exchange types are rabbit-headers-exchange and - * rabbit-fanout-exchange. - *

- * %Exchange XML attribute definitions: - * - * - * - * - * - * - *
AttributeDescription
namerequired The AMQP name of the exchange. This is the name that - * will be sent in the Exchange.Declare AMQP method.
durableoptional true to declare a durable exchange else false.
- * %Binding XML attribute definitions: - * - * - * - * - * - * - *
AttributeDescription
queuerequired The id of the queue integration object to bind to the exchange.
keyrequired The routing key for the binding. - * The format is specific to the type of exchange.
- */ -class ExchangeInstance : - public IIntegrationObject, - public ExchangeInternal, - public Exchange -{ - CAF_BEGIN_QI() - CAF_QI_ENTRY(IIntegrationObject) - CAF_QI_ENTRY(ExchangeInternal) - CAF_QI_ENTRY(Exchange) - CAF_END_QI() - -public: - ExchangeInstance(); - virtual ~ExchangeInstance(); - -public: // IIntegrationObject - void initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection); - - std::string getId() const; - -public: // Exchange - std::string getName() const; - std::string getType() const; - bool isDurable() const; - -public: // ExchangeInternal - std::deque getEmbeddedBindings() const; - -private: - std::string _id; - SmartPtrIIntegrationAppContext _integrationAppContext; - SmartPtrExchange _exchange; - std::deque _bindings; - - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(ExchangeInstance); -}; -CAF_DECLARE_SMART_QI_POINTER(ExchangeInstance); - -}} - -#endif /* EXCHANGEINSTANCE_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/IntegrationObjects.cpp b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/IntegrationObjects.cpp deleted file mode 100644 index 4667fb9c1..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/IntegrationObjects.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Created on: Jun 14, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Integration/IDocument.h" -#include "Integration/IIntegrationObject.h" -#include "Exception/CCafException.h" -#include "IntegrationObjects.h" -#include "RabbitTemplateInstance.h" -#include "RabbitAdminInstance.h" -#include "ExchangeInstance.h" -#include "QueueInstance.h" -#include "AmqpOutboundEndpointInstance.h" -#include "AmqpInboundChannelAdapterInstance.h" - -using namespace Caf::AmqpIntegration; - -IntegrationObjects::IntegrationObjects() : - CAF_CM_INIT("IntegrationObjects") { -} - -IntegrationObjects::~IntegrationObjects() { -} - -void IntegrationObjects::initializeBean( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties) { - CAF_CM_FUNCNAME_VALIDATE("initializeBean"); - CAF_CM_VALIDATE_STL_EMPTY(ctorArgs); - CAF_CM_VALIDATE_STL_EMPTY(properties); - _ctorArgs = ctorArgs; - _properties = properties; -} - -void IntegrationObjects::terminateBean() { -} - -bool IntegrationObjects::isResponsible( - const SmartPtrIDocument& configSection) const { - CAF_CM_FUNCNAME_VALIDATE("isResponsible"); - CAF_CM_VALIDATE_INTERFACE(configSection); - - const std::string name = configSection->getName(); - return (name.compare("rabbit-template") == 0) - || (name.compare("rabbit-admin") == 0) - || (name.compare("rabbit-direct-exchange") == 0) - || (name.compare("rabbit-topic-exchange") == 0) - || (name.compare("rabbit-headers-exchange") == 0) - || (name.compare("rabbit-fanout-exchange") == 0) - || (name.compare("rabbit-queue") == 0) - || (name.compare("rabbit-outbound-channel-adapter") == 0) - || (name.compare("rabbit-inbound-channel-adapter") == 0); -} - -SmartPtrIIntegrationObject IntegrationObjects::createObject( - const SmartPtrIDocument& configSection) const { - CAF_CM_FUNCNAME("createObject"); - CAF_CM_VALIDATE_INTERFACE(configSection); - - SmartPtrIIntegrationObject rc; - const std::string name = configSection->getName(); - if (name.compare("rabbit-template") == 0) { - SmartPtrRabbitTemplateInstance object; - object.CreateInstance(); - rc = object; - } else if (name.compare("rabbit-admin") == 0) { - SmartPtrRabbitAdminInstance object; - object.CreateInstance(); - rc = object; - } else if ((name.compare("rabbit-direct-exchange") == 0) - || (name.compare("rabbit-topic-exchange") == 0) - || (name.compare("rabbit-headers-exchange") == 0) - || (name.compare("rabbit-fanout-exchange") == 0)) { - SmartPtrExchangeInstance object; - object.CreateInstance(); - rc = object; - } else if (name.compare("rabbit-queue") == 0) { - SmartPtrQueueInstance object; - object.CreateInstance(); - rc = object; - } else if (name.compare("rabbit-outbound-channel-adapter") == 0) { - SmartPtrAmqpOutboundEndpointInstance object; - object.CreateInstance(); - rc = object; - } else if (name.compare("rabbit-inbound-channel-adapter") == 0) { - SmartPtrAmqpInboundChannelAdapterInstance object; - object.CreateInstance(); - rc = object; - } else { - CAF_CM_EXCEPTION_VA1(E_INVALIDARG, "Unknown name - %s", name.c_str()); - } - - rc->initialize(_ctorArgs, _properties, configSection); - return rc; -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/IntegrationObjects.h b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/IntegrationObjects.h deleted file mode 100644 index 5e9a1b185..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/IntegrationObjects.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Created on: Jun 14, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef INTEGRATIONOBJECTS_H_ -#define INTEGRATIONOBJECTS_H_ - - -#include "IBean.h" - -#include "Integration/IDocument.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/IIntegrationComponent.h" - -namespace Caf { namespace AmqpIntegration { - -/** - * @ingroup IntObjImpl - * @brief The bean responsible for creating all of the AMQP integration objects. - *

- * All applications using AMQP integration must include this definition in the - * application context: - *

- * \
- * 
- */ -class IntegrationObjects : - public TCafSubSystemObjectRoot, - public IBean, - public IIntegrationComponent { -public: - CAF_DECLARE_OBJECT_IDENTIFIER(_sObjIdIntegrationObjects) - - CAF_BEGIN_INTERFACE_MAP(IntegrationObjects) - CAF_INTERFACE_ENTRY(IBean) - CAF_INTERFACE_ENTRY(IIntegrationComponent) - CAF_END_INTERFACE_MAP() - -public: - IntegrationObjects(); - virtual ~IntegrationObjects(); - -public: // IBean - void initializeBean( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties); - - void terminateBean(); - -public: // IIntegrationComponent - bool isResponsible( - const SmartPtrIDocument& configSection) const; - - SmartPtrIIntegrationObject createObject( - const SmartPtrIDocument& configSection) const; - -private: - IBean::Cargs _ctorArgs; - IBean::Cprops _properties; - -private: - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(IntegrationObjects); -}; - -}} - -#endif /* INTEGRATIONOBJECTS_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/QueueInstance.cpp b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/QueueInstance.cpp deleted file mode 100644 index 463a696a9..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/QueueInstance.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Created on: Jun 14, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Integration/IDocument.h" -#include "amqpCore/Queue.h" -#include "Exception/CCafException.h" -#include "Common/IAppConfig.h" -#include "QueueInstance.h" - -using namespace Caf::AmqpIntegration; - -QueueInstance::QueueInstance() : - CAF_CM_INIT("QueueInstance") { -} - -QueueInstance::~QueueInstance() { -} - -void QueueInstance::initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection) { - CAF_CM_FUNCNAME("initialize"); - _id = configSection->findRequiredAttribute("id"); - SmartPtrIAppConfig appConfig = getAppConfig(); - const std::string name = appConfig->resolveValue(configSection->findOptionalAttribute("name")); - const std::string durable = configSection->findOptionalAttribute("durable"); - const std::string exclusive = configSection->findOptionalAttribute("exclusive"); - const std::string autoDelete = configSection->findOptionalAttribute("auto-delete"); - - if (durable.length() && ((durable != "true") && (durable != "false"))) { - CAF_CM_EXCEPTIONEX_VA2( - InvalidArgumentException, - 0, - "queue id (%s): 'durable' must be 'true' or 'false', not '%s'", - _id.c_str(), - durable.c_str()); - } - if (exclusive.length() && ((exclusive != "true") && (exclusive != "false"))) { - CAF_CM_EXCEPTIONEX_VA2( - InvalidArgumentException, - 0, - "queue id (%s): 'exclusive' must be 'true' or 'false', not '%s'", - _id.c_str(), - exclusive.c_str()); - } - if (autoDelete.length() && ((autoDelete != "true") && (autoDelete != "false"))) { - CAF_CM_EXCEPTIONEX_VA2( - InvalidArgumentException, - 0, - "queue id (%s): 'auto-delete' must be 'true' or 'false', not '%s'", - _id.c_str(), - autoDelete.c_str()); - } - - if (name.length()) { - const bool durableFlag = durable.length() ? durable == "true" : false; - const bool exclusiveFlag = exclusive.length() ? exclusive == "true" : false; - const bool autoDeleteFlag = autoDelete.length() ? autoDelete == "true" : false; - _queue = createQueue(name, durableFlag, exclusiveFlag, autoDeleteFlag); - } else { - if ((durable == "true") || (exclusive == "false") || (autoDelete == "false")) { - CAF_CM_EXCEPTIONEX_VA1( - InvalidArgumentException, - 0, - "Anonymous queue (%s) cannot specify durable='true', exclusive='false', " - "or auto-delete='false'", - _id.c_str()); - } - _queue = createQueue("", false, true, true); - } -} - -std::string QueueInstance::getId() const { - return _id; -} - -void QueueInstance::setQueueInternal(SmartPtrQueue queue) { - _queue = queue; -} - -std::string QueueInstance::getName() const { - return _queue->getName(); -} - -bool QueueInstance::isDurable() const { - return _queue->isDurable(); -} - -bool QueueInstance::isExclusive() const { - return _queue->isExclusive(); -} - -bool QueueInstance::isAutoDelete() const { - return _queue->isAutoDelete(); -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/QueueInstance.h b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/QueueInstance.h deleted file mode 100644 index 9a2552a64..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/QueueInstance.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Created on: Jun 14, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef QUEUEINSTANCE_H_ -#define QUEUEINSTANCE_H_ - -#include "Integration/IIntegrationObject.h" -#include "Integration/IDocument.h" -#include "amqpCore/Queue.h" -#include "amqpCore/QueueInternal.h" - -namespace Caf { namespace AmqpIntegration { - -/** - * @ingroup IntObj - * @brief An Integration Object implementing Caf::AmqpIntegration::Queue - *

- * Example context file declarations: - *

- * Named queue: - *

- * 
- * 
- * Anonymous queue: - *
- * 
- * 
- *

- * XML attribute definitions: - * - * - * - * - * - * - * - * - * - * - * - *
AttributeDescription
idrequired The id of the integration object. - * All integration objects that reference queues must do so by their id.
nameoptional The AMQP name of the queue. This is the name that - * will be sent in the Queue.Declare AMQP method. It does not need to match the - * id. To declare an anonymous (server-named) queue, leave this attribute - * out of the declaration. Do not set name to blank.
durableoptional true to declare a durable queue else false.
exclusiveoptional true to declare the queue exclusive to the connection - * else false.
auto-deleteoptional true to declare that the queue be deleted when it is no - * longer in use else false.
- * NOTE: Anonymous queues are automatically declared as non-durable, exclusive - * and auto-delete. They cannot be declared otherwise. - */ -class QueueInstance : - public IIntegrationObject, - public QueueInternal, - public Queue -{ - CAF_BEGIN_QI() - CAF_QI_ENTRY(IIntegrationObject) - CAF_QI_ENTRY(QueueInternal) - CAF_QI_ENTRY(Queue) - CAF_END_QI() - -public: - QueueInstance(); - virtual ~QueueInstance(); - -public: // IIntegrationObject - void initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection); - - std::string getId() const; - -public: // QueueInternal - void setQueueInternal(SmartPtrQueue queue); - -public: // Queue - std::string getName() const; - bool isDurable() const; - bool isExclusive() const; - bool isAutoDelete() const; - -private: - std::string _id; - SmartPtrQueue _queue; - - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(QueueInstance); -}; -CAF_DECLARE_SMART_QI_POINTER(QueueInstance); - -}} - -#endif /* QUEUEINSTANCE_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/RabbitAdminInstance.cpp b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/RabbitAdminInstance.cpp deleted file mode 100644 index 823ee7db8..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/RabbitAdminInstance.cpp +++ /dev/null @@ -1,235 +0,0 @@ -/* - * Created on: Jun 12, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Common/IAppContext.h" -#include "IBean.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntegrationAppContext.h" -#include "Integration/IIntegrationObject.h" -#include "amqpCore/Binding.h" -#include "amqpCore/BindingInternal.h" -#include "amqpClient/api/ConnectionFactory.h" -#include "amqpCore/Exchange.h" -#include "amqpCore/ExchangeInternal.h" -#include "amqpCore/Queue.h" -#include "amqpCore/QueueInternal.h" -#include "RabbitAdminInstance.h" - -using namespace Caf::AmqpIntegration; - -RabbitAdminInstance::RabbitAdminInstance() : - _isRunning(false), - CAF_CM_INIT_LOG("RabbitAdminInstance") { -} - -RabbitAdminInstance::~RabbitAdminInstance() { -} - -void RabbitAdminInstance::initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection) { - _id = configSection->findOptionalAttribute("id"); - if (!_id.length()) { - _id = "RabbitAdminInstance-"; - _id += CStringUtils::createRandomUuid(); - } - _connectionFactoryId = configSection->findRequiredAttribute("connection-factory"); - _admin.CreateInstance(); -} - -std::string RabbitAdminInstance::getId() const { - return _id; -} - -void RabbitAdminInstance::wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver) { - CAF_CM_FUNCNAME_VALIDATE("wire"); - CAF_CM_VALIDATE_INTERFACE(appContext); - _appContext = appContext; -} - -void RabbitAdminInstance::setIntegrationAppContext(SmartPtrIIntegrationAppContext context) { - CAF_CM_FUNCNAME_VALIDATE("setIntegrationAppContext"); - CAF_CM_VALIDATE_INTERFACE(context); - _integrationAppContext = context; -} - -void RabbitAdminInstance::start(const uint32 timeoutMs) { - CAF_CM_FUNCNAME("start"); - - SmartPtrIBean factoryBean = _appContext->getBean(_connectionFactoryId); - SmartPtrConnectionFactory connectionFactory; - connectionFactory.QueryInterface(factoryBean, true); - _admin->init(connectionFactory); - - try { - CAF_CM_VALIDATE_INTERFACE(_integrationAppContext); - CAF_CM_LOG_DEBUG_VA0("Initializing exchange/queue/binding declarations"); - - std::deque queues; - IIntegrationAppContext::SmartPtrCObjectCollection objs = - _integrationAppContext->getIntegrationObjects(Queue::IIDOF()); - CAF_CM_LOG_DEBUG_VA1("Declaring %d queues", objs->size()); - if (objs->size()) { - for (TSmartConstIterator obj(*objs); - obj; - obj++) { - SmartPtrQueue queue; - queue.QueryInterface(*obj); - if (queue->getName().length()) { - CAF_CM_LOG_DEBUG_VA1("Declaring queue - %s", queue->getName().c_str()); - _admin->declareQueue(queue); - } else { - CAF_CM_LOG_DEBUG_VA0("Declaring anonymous queue"); - SmartPtrQueue anonQueue = _admin->declareQueue(); - SmartPtrQueueInternal queueInt; - queueInt.QueryInterface(queue); - queueInt->setQueueInternal(anonQueue); - } - queues.push_back(queue); - } - } - - std::deque exchanges; - std::deque bindings; - objs = _integrationAppContext->getIntegrationObjects(Exchange::IIDOF()); - CAF_CM_LOG_DEBUG_VA1("Declaring %d exchanges", objs->size()); - if (objs->size()) { - for (TSmartConstIterator obj(*objs); - obj; - obj++) { - SmartPtrExchange exchange; - exchange.QueryInterface(*obj); - _admin->declareExchange(exchange); - exchanges.push_back(exchange); - - SmartPtrExchangeInternal exchangeInternal; - exchangeInternal.QueryInterface(exchange); - std::deque embeddedBindings = exchangeInternal->getEmbeddedBindings(); - - bindings.insert( - bindings.end(), - embeddedBindings.begin(), - embeddedBindings.end()); - } - } - - objs = _integrationAppContext->getIntegrationObjects(Binding::IIDOF()); - if (objs->size()) { - for (TSmartConstIterator obj(*objs); - obj; - obj++) { - SmartPtrBinding binding; - binding.QueryInterface(*obj); - bindings.push_back(binding); - } - } - - CAF_CM_LOG_DEBUG_VA1("Declaring %d bindings", bindings.size()); - for (TSmartConstIterator > binding(bindings); - binding; - binding++) { - SmartPtrIIntegrationObject obj = - _integrationAppContext->getIntegrationObject(binding->getQueue()); - - // resolve the queue id to a queue name and replace the binding object - SmartPtrQueue queue; - queue.QueryInterface(obj); - SmartPtrBindingInternal bindingInternal; - bindingInternal.QueryInterface(*binding); - bindingInternal->setBindingInternal( - createBinding( - queue->getName(), - binding->getExchange(), - binding->getRoutingKey())); - - // declare the binding - _admin->declareBinding(*binding); - } - } - CAF_CM_CATCH_ALL; - if (CAF_CM_ISEXCEPTION) { - _admin->term(); - _admin = NULL; - } - CAF_CM_THROWEXCEPTION; - _isRunning = true; -} - -void RabbitAdminInstance::stop(const uint32 timeoutMs) { - if (_isRunning) { - _isRunning = false; - _admin->term(); - } - _admin = NULL; -} - -bool RabbitAdminInstance::isRunning() const { - return _isRunning; -} - -void RabbitAdminInstance::declareExchange(SmartPtrExchange exchange) { - CAF_CM_FUNCNAME_VALIDATE("declareExchange"); - CAF_CM_VALIDATE_BOOL(isRunning()); - _admin->declareExchange(exchange); -} - -bool RabbitAdminInstance::deleteExchange(const std::string& exchange) { - CAF_CM_FUNCNAME_VALIDATE("deleteExchange"); - CAF_CM_VALIDATE_BOOL(isRunning()); - return _admin->deleteExchange(exchange); -} - -SmartPtrQueue RabbitAdminInstance::declareQueue() { - CAF_CM_FUNCNAME_VALIDATE("declareQueue"); - CAF_CM_VALIDATE_BOOL(isRunning()); - return _admin->declareQueue(); -} - -void RabbitAdminInstance::declareQueue(SmartPtrQueue queue) { - CAF_CM_FUNCNAME_VALIDATE("declareQueue"); - CAF_CM_VALIDATE_BOOL(isRunning()); - _admin->declareQueue(queue); -} - -bool RabbitAdminInstance::deleteQueue(const std::string& queue) { - CAF_CM_FUNCNAME_VALIDATE("deleteQueue"); - CAF_CM_VALIDATE_BOOL(isRunning()); - return _admin->deleteQueue(queue); -} - -void RabbitAdminInstance::deleteQueue( - const std::string& queue, - const bool unused, - const bool empty) { - CAF_CM_FUNCNAME_VALIDATE("deleteQueue"); - CAF_CM_VALIDATE_BOOL(isRunning()); - return _admin->deleteQueue(queue, unused, empty); -} - -void RabbitAdminInstance::purgeQueue(const std::string& queue) { - CAF_CM_FUNCNAME_VALIDATE("purgeQueue"); - CAF_CM_VALIDATE_BOOL(isRunning()); - return _admin->purgeQueue(queue); -} - -void RabbitAdminInstance::declareBinding(SmartPtrBinding binding) { - CAF_CM_FUNCNAME_VALIDATE("declareBinding"); - CAF_CM_VALIDATE_BOOL(isRunning()); - return _admin->declareBinding(binding); -} - -void RabbitAdminInstance::removeBinding(SmartPtrBinding binding) { - CAF_CM_FUNCNAME_VALIDATE("removeBinding"); - CAF_CM_VALIDATE_BOOL(isRunning()); - return _admin->removeBinding(binding); -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/RabbitAdminInstance.h b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/RabbitAdminInstance.h deleted file mode 100644 index d9cde9b82..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/RabbitAdminInstance.h +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Created on: Jun 12, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef RABBITADMININSTANCE_H_ -#define RABBITADMININSTANCE_H_ - - -#include "Integration/IIntegrationAppContextAware.h" - -#include "Common/IAppContext.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntegrationAppContext.h" -#include "amqpCore/Binding.h" -#include "amqpCore/Exchange.h" -#include "amqpCore/Queue.h" -#include "amqpCore/RabbitAdmin.h" -#include "Integration/IIntegrationComponentInstance.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/ILifecycle.h" - -namespace Caf { namespace AmqpIntegration { - -/** - * @ingroup IntObj - * @brief An Integration Object implementing Caf::AmqpIntegration::AmqpAdmin - *

- *

- * Example context file declaration:
- *
- * 
- * 
- *

- * XML attribute definitions: - * - * - * - * - * - *
AttributeDescription
idoptional The id of the integration object
connection-factoryrequired The id of the ConnectionFactory bean
- */ -class RabbitAdminInstance : - public IIntegrationObject, - public IIntegrationComponentInstance, - public ILifecycle, - public IIntegrationAppContextAware, - public AmqpAdmin -{ - CAF_BEGIN_QI() - CAF_QI_ENTRY(IIntegrationObject) - CAF_QI_ENTRY(IIntegrationComponentInstance) - CAF_QI_ENTRY(ILifecycle) - CAF_QI_ENTRY(IIntegrationAppContextAware) - CAF_QI_ENTRY(AmqpAdmin) - CAF_END_QI() - -public: - RabbitAdminInstance(); - virtual ~RabbitAdminInstance(); - -public: // IIntegrationObject - void initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection); - - std::string getId() const; - -public: // IIntegrationComponentInstance - void wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver); - -public: // ILifecycle - void start(const uint32 timeoutMs); - void stop(const uint32 timeoutMs); - bool isRunning() const; - -public: // IIntegrationAppContextAware - void setIntegrationAppContext( - SmartPtrIIntegrationAppContext context); - -public: // AmqpAdmin - void declareExchange(SmartPtrExchange exchange); - - bool deleteExchange(const std::string& exchange); - - SmartPtrQueue declareQueue(); - - void declareQueue(SmartPtrQueue queue); - - bool deleteQueue(const std::string& queue); - - void deleteQueue( - const std::string& queue, - const bool unused, - const bool empty); - - void purgeQueue(const std::string& queue); - - void declareBinding(SmartPtrBinding binding); - - void removeBinding(SmartPtrBinding binding); - -private: - bool _isRunning; - std::string _id; - std::string _connectionFactoryId; - SmartPtrRabbitAdmin _admin; - SmartPtrIAppContext _appContext; - SmartPtrIIntegrationAppContext _integrationAppContext; - - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(RabbitAdminInstance); -}; -CAF_DECLARE_SMART_QI_POINTER(RabbitAdminInstance); - -}} - -#endif /* RABBITADMININSTANCE_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/RabbitTemplateInstance.cpp b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/RabbitTemplateInstance.cpp deleted file mode 100644 index a5f0b7413..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/RabbitTemplateInstance.cpp +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Created on: Jun 12, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Common/IAppContext.h" -#include "IBean.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "amqpCore/AmqpHeaderMapper.h" -#include "amqpCore/AmqpTemplate.h" -#include "amqpClient/api/ConnectionFactory.h" -#include "Common/IAppConfig.h" -#include "RabbitTemplateInstance.h" - -using namespace Caf::AmqpIntegration; - -RabbitTemplateInstance::RabbitTemplateInstance() : - _isWired(false), - CAF_CM_INIT_LOG("RabbitTemplateInstance") { -} - -RabbitTemplateInstance::~RabbitTemplateInstance() { -} - -void RabbitTemplateInstance::initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection) { - _id = configSection->findOptionalAttribute("id"); - if (!_id.length()) { - _id = CStringUtils::createRandomUuid(); - } - _configSection = configSection; -} - -std::string RabbitTemplateInstance::getId() const { - return _id; -} - -void RabbitTemplateInstance::wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver) { - CAF_CM_FUNCNAME_VALIDATE("wire"); - CAF_CM_VALIDATE_INTERFACE(_configSection); - - const std::string connectionFactoryId = _configSection->findRequiredAttribute("connection-factory"); - SmartPtrIBean factoryBean = appContext->getBean(connectionFactoryId); - SmartPtrConnectionFactory connectionFactory; - connectionFactory.QueryInterface(factoryBean, true); - - SmartPtrIAppConfig appConfig = getAppConfig(); - - _template.CreateInstance(); - std::string param = _configSection->findOptionalAttribute("exchange"); - if (param.length()) { - CAF_CM_LOG_DEBUG_VA1("Setting exchange='%s'", param.c_str()); - _template->setExchange(appConfig->resolveValue(param)); - } - param = _configSection->findOptionalAttribute("queue"); - if (param.length()) { - CAF_CM_LOG_DEBUG_VA1("Setting queue='%s'", param.c_str()); - _template->setQueue(appConfig->resolveValue(param)); - } - param = _configSection->findOptionalAttribute("routing-key"); - if (param.length()) { - CAF_CM_LOG_DEBUG_VA1("Setting routing-key='%s'", param.c_str()); - _template->setRoutingKey(appConfig->resolveValue(param)); - } - param = _configSection->findOptionalAttribute("reply_timeout"); - if (param.length()) { - param = appConfig->resolveValue(param); - uint32 timeout = CStringConv::fromString(param); - CAF_CM_LOG_DEBUG_VA1("Setting reply_timeout=%d", timeout); - _template->setReplyTimeout(timeout); - } - - _template->init(connectionFactory); - _isWired = true; - _configSection = NULL; -} - -void RabbitTemplateInstance::start(const uint32 timeoutMs) { -} - -void RabbitTemplateInstance::stop(const uint32 timeoutMs) { - if (_isWired) { - _template->term(); - } - _template = NULL; - _isWired = false; -} - -bool RabbitTemplateInstance::isRunning() const { - return (_isWired && !_template.IsNull()); -} - -void RabbitTemplateInstance::send( - SmartPtrIIntMessage message, - SmartPtrAmqpHeaderMapper headerMapper) { - CAF_CM_FUNCNAME_VALIDATE("send"); - CAF_CM_VALIDATE_BOOL(isRunning()); - _template->send(message, headerMapper); -} - -void RabbitTemplateInstance::send( - const std::string& routingKey, - SmartPtrIIntMessage message, - SmartPtrAmqpHeaderMapper headerMapper) { - CAF_CM_FUNCNAME_VALIDATE("send"); - CAF_CM_VALIDATE_BOOL(isRunning()); - _template->send(routingKey, message, headerMapper); -} - -void RabbitTemplateInstance::send( - const std::string& exchange, - const std::string& routingKey, - SmartPtrIIntMessage message, - SmartPtrAmqpHeaderMapper headerMapper) { - CAF_CM_FUNCNAME_VALIDATE("send"); - CAF_CM_VALIDATE_BOOL(isRunning()); - _template->send(exchange, routingKey, message, headerMapper); -} - -SmartPtrIIntMessage RabbitTemplateInstance::receive( - SmartPtrAmqpHeaderMapper headerMapper) { - CAF_CM_FUNCNAME_VALIDATE("receive"); - CAF_CM_VALIDATE_BOOL(isRunning()); - return _template->receive(headerMapper); -} - -SmartPtrIIntMessage RabbitTemplateInstance::receive( - const std::string& queueName, - SmartPtrAmqpHeaderMapper headerMapper) { - CAF_CM_FUNCNAME_VALIDATE("receive"); - CAF_CM_VALIDATE_BOOL(isRunning()); - return _template->receive(queueName, headerMapper); -} - -SmartPtrIIntMessage RabbitTemplateInstance::sendAndReceive( - SmartPtrIIntMessage message, - SmartPtrAmqpHeaderMapper requestHeaderMapper, - SmartPtrAmqpHeaderMapper responseHeaderMapper) { - CAF_CM_FUNCNAME_VALIDATE("sendAndReceive"); - CAF_CM_VALIDATE_BOOL(isRunning()); - return _template->sendAndReceive( - message, - requestHeaderMapper, - responseHeaderMapper); -} - -SmartPtrIIntMessage RabbitTemplateInstance::sendAndReceive( - const std::string& routingKey, - SmartPtrIIntMessage message, - SmartPtrAmqpHeaderMapper requestHeaderMapper, - SmartPtrAmqpHeaderMapper responseHeaderMapper) { - CAF_CM_FUNCNAME_VALIDATE("sendAndReceive"); - CAF_CM_VALIDATE_BOOL(isRunning()); - return _template->sendAndReceive( - routingKey, - message, - requestHeaderMapper, - responseHeaderMapper); -} - -SmartPtrIIntMessage RabbitTemplateInstance::sendAndReceive( - const std::string& exchange, - const std::string& routingKey, - SmartPtrIIntMessage message, - SmartPtrAmqpHeaderMapper requestHeaderMapper, - SmartPtrAmqpHeaderMapper responseHeaderMapper) { - CAF_CM_FUNCNAME_VALIDATE("sendAndReceive"); - CAF_CM_VALIDATE_BOOL(isRunning()); - return _template->sendAndReceive( - exchange, - routingKey, - message, - requestHeaderMapper, - responseHeaderMapper); -} - -gpointer RabbitTemplateInstance::execute(SmartPtrExecutor executor, gpointer data) { - CAF_CM_FUNCNAME_VALIDATE("execute"); - CAF_CM_VALIDATE_BOOL(isRunning()); - return _template->execute(executor, data); -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/RabbitTemplateInstance.h b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/RabbitTemplateInstance.h deleted file mode 100644 index 39debf169..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/RabbitTemplateInstance.h +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Created on: Jun 12, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef RABBITTEMPLATEINSTANCE_H_ -#define RABBITTEMPLATEINSTANCE_H_ - - -#include "Integration/IIntegrationComponentInstance.h" - -#include "Common/IAppContext.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "amqpCore/AmqpHeaderMapper.h" -#include "amqpCore/AmqpTemplate.h" -#include "amqpCore/RabbitTemplate.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/ILifecycle.h" - -namespace Caf { namespace AmqpIntegration { - -CAF_DECLARE_CLASS_AND_IMPQI_POINTER(RabbitTemplateInstance); - -/** - * @ingroup IntObj - * @brief An Integration Object implementing Caf::AmqpIntegration::AmqpTemplate - *

- *

- * Example context file declaration:
- *
- * 
- * 
- *

- * XML attribute definitions: - * - * - * - * - * - * - * - * - * - * - * - *
AttributeDescription
idoptional The id of the integration object
connection-factoryrequired The id of the ConnectionFactory bean
exchangeoptional The name of the exchange to use by default
queueoptional The id of the queue to use by default. The queue name comes from - * the queue object with the given id.
routing-keyoptional The routing-key to use by default
reply_timeoutoptional The number of milliseconds to wait for a response when using - * sendAndReceive methods. This is an unsigned value. A value of zero indicates - * wait indefinitely.
- */ -class RabbitTemplateInstance : - public IIntegrationObject, - public IIntegrationComponentInstance, - public ILifecycle, - public AmqpTemplate -{ - CAF_BEGIN_QI() - CAF_QI_ENTRY(IIntegrationObject) - CAF_QI_ENTRY(IIntegrationComponentInstance) - CAF_QI_ENTRY(ILifecycle) - CAF_QI_ENTRY(AmqpTemplate) - CAF_END_QI() - -public: - RabbitTemplateInstance(); - virtual ~RabbitTemplateInstance(); - -public: // IIntegrationObject - void initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection); - - std::string getId() const; - -public: // IIntegrationComponentInstance - void wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver); - -public: // ILifecycle - void start(const uint32 timeoutMs); - void stop(const uint32 timeoutMs); - bool isRunning() const; - -public: // AmqpTemplate - void send( - SmartPtrIIntMessage message, - SmartPtrAmqpHeaderMapper headerMapper = SmartPtrAmqpHeaderMapper()); - - void send( - const std::string& routingKey, - SmartPtrIIntMessage message, - SmartPtrAmqpHeaderMapper headerMapper = SmartPtrAmqpHeaderMapper()); - - void send( - const std::string& exchange, - const std::string& routingKey, - SmartPtrIIntMessage message, - SmartPtrAmqpHeaderMapper headerMapper = SmartPtrAmqpHeaderMapper()); - - SmartPtrIIntMessage receive( - SmartPtrAmqpHeaderMapper headerMapper = SmartPtrAmqpHeaderMapper()); - - SmartPtrIIntMessage receive( - const std::string& queueName, - SmartPtrAmqpHeaderMapper headerMapper = SmartPtrAmqpHeaderMapper()); - - SmartPtrIIntMessage sendAndReceive( - SmartPtrIIntMessage message, - SmartPtrAmqpHeaderMapper requestHeaderMapper = SmartPtrAmqpHeaderMapper(), - SmartPtrAmqpHeaderMapper responseHeaderMapper = SmartPtrAmqpHeaderMapper()); - - SmartPtrIIntMessage sendAndReceive( - const std::string& routingKey, - SmartPtrIIntMessage message, - SmartPtrAmqpHeaderMapper requestHeaderMapper = SmartPtrAmqpHeaderMapper(), - SmartPtrAmqpHeaderMapper responseHeaderMapper = SmartPtrAmqpHeaderMapper()); - - SmartPtrIIntMessage sendAndReceive( - const std::string& exchange, - const std::string& routingKey, - SmartPtrIIntMessage message, - SmartPtrAmqpHeaderMapper requestHeaderMapper = SmartPtrAmqpHeaderMapper(), - SmartPtrAmqpHeaderMapper responseHeaderMapper = SmartPtrAmqpHeaderMapper()); - - gpointer execute(SmartPtrExecutor executor, gpointer data); - -private: - bool _isWired; - std::string _id; - SmartPtrIDocument _configSection; - SmartPtrRabbitTemplate _template; - - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(RabbitTemplateInstance); -}; - -}} - -#endif /* RABBITTEMPLATEINSTANCE_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/SecureCachingConnectionFactoryObj.cpp b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/SecureCachingConnectionFactoryObj.cpp deleted file mode 100644 index 6a7854ce9..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/SecureCachingConnectionFactoryObj.cpp +++ /dev/null @@ -1,204 +0,0 @@ -/* - * Created on: Jun 4, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Doc/PersistenceDoc/CCertPathCollectionDoc.h" -#include "Doc/PersistenceDoc/CLocalSecurityDoc.h" -#include "Doc/PersistenceDoc/CPersistenceDoc.h" -#include "Doc/PersistenceDoc/CPersistenceProtocolDoc.h" -#include "amqpCore/CachingConnectionFactory.h" -#include "amqpClient/api/Connection.h" -#include "amqpCore/ConnectionListener.h" -#include "SecureCachingConnectionFactoryObj.h" - -using namespace Caf::AmqpIntegration; - -SecureCachingConnectionFactoryObj::SecureCachingConnectionFactoryObj() : - CAF_CM_INIT_LOG("SecureCachingConnectionFactoryObj") { -} - -SecureCachingConnectionFactoryObj::~SecureCachingConnectionFactoryObj() { -} - -void SecureCachingConnectionFactoryObj::initializeBean( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties) { - CAF_CM_FUNCNAME_VALIDATE("initializeBean"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_factory); - CAF_CM_VALIDATE_STL_EMPTY(ctorArgs); - - const std::string persistenceDir = - AppConfigUtils::getRequiredString("persistence_dir"); - - const SmartPtrCPersistenceDoc persistence = - CPersistenceUtils::loadPersistence(persistenceDir); - CAF_CM_VALIDATE_SMARTPTR(persistence); - - const SmartPtrCPersistenceProtocolDoc amqpBroker = - CPersistenceUtils::loadPersistenceProtocol(persistence->getPersistenceProtocolCollection()); - CAF_CM_VALIDATE_SMARTPTR(amqpBroker); - - const SmartPtrCCertPathCollectionDoc tlsCertPathCollection = amqpBroker->getTlsCertPathCollection(); - CAF_CM_VALIDATE_SMARTPTR(tlsCertPathCollection); - - const SmartPtrCLocalSecurityDoc localSecurity = persistence->getLocalSecurity(); - CAF_CM_VALIDATE_SMARTPTR(localSecurity); - - UriUtils::SUriRecord uri; - UriUtils::parseUriString(amqpBroker->getUri(), uri); - - const std::string vhost = UriUtils::findOptParameter(uri, "vhost", - AppConfigUtils::getRequiredString("communication_amqp", "vhost")); - const std::string connectionTimeout = UriUtils::findOptParameter(uri, "connection_timeout", - CStringConv::toString( - AppConfigUtils::getRequiredUint32("communication_amqp", "connection_timeout"))); - const std::string connectionRetries = UriUtils::findOptParameter(uri, "connection_retries", - CStringConv::toString( - AppConfigUtils::getRequiredUint32("communication_amqp", "connection_retries"))); - const std::string connectionSecondsToWait = UriUtils::findOptParameter(uri, "connection_seconds_to_wait", - CStringConv::toString( - AppConfigUtils::getRequiredUint32("communication_amqp", "connection_seconds_to_wait"))); - const std::string channelCacheSize = UriUtils::findOptParameter(uri, "channel_cache_size", - CStringConv::toString( - AppConfigUtils::getRequiredUint32("communication_amqp", "channel_cache_size"))); - - const std::deque tlsCertPathCollectionInner = tlsCertPathCollection->getCertPath(); - CAF_CM_VALIDATE_STL(tlsCertPathCollectionInner); - CAF_CM_VALIDATE_BOOL(tlsCertPathCollectionInner.size() == 1); - const std::string caCertPath = tlsCertPathCollectionInner.front(); - - CAF_CM_VALIDATE_STRING(uri.protocol); - CAF_CM_VALIDATE_STRING(uri.host); - CAF_CM_VALIDATE_STRING(uri.portStr); - CAF_CM_VALIDATE_STRING(vhost); - - CAF_CM_VALIDATE_STRING(caCertPath); - CAF_CM_VALIDATE_STRING(localSecurity->getCertPath()); - CAF_CM_VALIDATE_STRING(localSecurity->getPrivateKeyPath()); - - SmartPtrCachingConnectionFactory factory; - factory.CreateInstance(); - factory->init(); - factory->setProtocol(uri.protocol); - factory->setHost(uri.host); - factory->setPort(uri.port); - factory->setVirtualHost(vhost); - factory->setCaCertPath(caCertPath); - factory->setClientCertPath(localSecurity->getCertPath()); - factory->setClientKeyPath(localSecurity->getPrivateKeyPath()); - if (! uri.username.empty()) { - factory->setUsername(uri.username); - } - if (! uri.password.empty()) { - factory->setPassword(uri.password); - } - if (! connectionTimeout.empty()) { - factory->setConnectionTimeout(CStringConv::fromString(connectionTimeout)); - } - if (! connectionRetries.empty()) { - factory->setRetries(CStringConv::fromString(connectionRetries)); - } - if (! connectionSecondsToWait.empty()) { - factory->setSecondsToWait(CStringConv::fromString(connectionSecondsToWait)); - } - if (! channelCacheSize.empty()) { - factory->setChannelCacheSize(CStringConv::fromString(channelCacheSize)); - } - - _factory = factory; -} - -void SecureCachingConnectionFactoryObj::terminateBean() { - CAF_CM_FUNCNAME("terminateBean"); - try { - if (_factory) { - _factory->destroy(); - } - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_CLEAREXCEPTION; -} - -SmartPtrConnection SecureCachingConnectionFactoryObj::createConnection() { - CAF_CM_FUNCNAME_VALIDATE("createConnection"); - CAF_CM_PRECOND_ISINITIALIZED(_factory); - return _factory->createConnection(); -} - -std::string SecureCachingConnectionFactoryObj::getProtocol() { - CAF_CM_FUNCNAME_VALIDATE("getProtocol"); - CAF_CM_PRECOND_ISINITIALIZED(_factory); - return _factory->getProtocol(); -} - -std::string SecureCachingConnectionFactoryObj::getHost() { - CAF_CM_FUNCNAME_VALIDATE("getHost"); - CAF_CM_PRECOND_ISINITIALIZED(_factory); - return _factory->getHost(); -} - -uint32 SecureCachingConnectionFactoryObj::getPort() { - CAF_CM_FUNCNAME_VALIDATE("getPort"); - CAF_CM_PRECOND_ISINITIALIZED(_factory); - return _factory->getPort(); -} - -std::string SecureCachingConnectionFactoryObj::getVirtualHost() { - CAF_CM_FUNCNAME_VALIDATE("getVirtualHost"); - CAF_CM_PRECOND_ISINITIALIZED(_factory); - return _factory->getVirtualHost(); -} - -std::string SecureCachingConnectionFactoryObj::getUsername() { - CAF_CM_FUNCNAME_VALIDATE("getUsername"); - CAF_CM_PRECOND_ISINITIALIZED(_factory); - return _factory->getUsername(); -} - -std::string SecureCachingConnectionFactoryObj::getPassword() { - CAF_CM_FUNCNAME_VALIDATE("getPassword"); - CAF_CM_PRECOND_ISINITIALIZED(_factory); - return _factory->getPassword(); -} - -std::string SecureCachingConnectionFactoryObj::getCaCertPath() { - CAF_CM_FUNCNAME_VALIDATE("getCaCertPath"); - CAF_CM_PRECOND_ISINITIALIZED(_factory); - return _factory->getCaCertPath(); -} - -std::string SecureCachingConnectionFactoryObj::getClientCertPath() { - CAF_CM_FUNCNAME_VALIDATE("getClientCertPath"); - CAF_CM_PRECOND_ISINITIALIZED(_factory); - return _factory->getClientCertPath(); -} - -std::string SecureCachingConnectionFactoryObj::getClientKeyPath() { - CAF_CM_FUNCNAME_VALIDATE("getClientKeyPath"); - CAF_CM_PRECOND_ISINITIALIZED(_factory); - return _factory->getClientKeyPath(); -} - -uint16 SecureCachingConnectionFactoryObj::getRetries() { - CAF_CM_FUNCNAME_VALIDATE("getRetries"); - CAF_CM_PRECOND_ISINITIALIZED(_factory); - return _factory->getRetries(); -} - -uint16 SecureCachingConnectionFactoryObj::getSecondsToWait() { - CAF_CM_FUNCNAME_VALIDATE("getSecondsToWait"); - CAF_CM_PRECOND_ISINITIALIZED(_factory); - return _factory->getSecondsToWait(); -} - -void SecureCachingConnectionFactoryObj::addConnectionListener(const SmartPtrConnectionListener& listener) { - CAF_CM_FUNCNAME_VALIDATE("addConnectionListener"); - CAF_CM_PRECOND_ISINITIALIZED(_factory); - _factory->addConnectionListener(listener); -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/SecureCachingConnectionFactoryObj.h b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/SecureCachingConnectionFactoryObj.h deleted file mode 100644 index 0ac9e3693..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/SecureCachingConnectionFactoryObj.h +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Created on: Jun 4, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef SECURECACHINGCONNECTIONFACTORYOBJ_H_ -#define SECURECACHINGCONNECTIONFACTORYOBJ_H_ - -#include "IBean.h" - -#include "amqpCore/CachingConnectionFactory.h" -#include "amqpClient/api/Connection.h" -#include "amqpCore/ConnectionListener.h" - -namespace Caf { namespace AmqpIntegration { - -/** - * @ingroup IntObj - * @brief An implementation of Caf::AmqpIntegration::SecureConnectionFactory that returns - * the same connections from all calls, ignores calls to - * Caf::AmqpClient::Connection::close and caches Caf::AmqpClient::Channel. - *

- * By default, only one channel will be cached, with additional requested channels - * being created and disposed on demand. Consider raising the cache size in - * high-concurrency environments. - *

- * NOTE: This factory requires explicit closing of all channels obtained from its - * shared connection. Failure to close channels will disable channel reuse. - *

- * SecureCachingConnectionFactory objects are created by inserting the following into - * the application context: - *

- *
- * \
- * 	\
- * 	\
- * 	\
- * \
- * 
- * Properties: - * - * - * - * - * - * - * - * - * - * - * - * - *
PropertyDescription
hostThe broker host. By default the machine's host name (or localhost - * if the host name cannot be determined).
portThe broker port. By default AmqpClient::DEFAULT_AMQP_PORT
virtualHostThe virtual host on the broker. By default AmqpClient::DEFAULT_VHOST
connectionTimeoutThe connection timeout in milliseconds. A value of zero means - * to wait indefinitely. By default 10 seconds.
channelCacheSizeThe number of channels to cache. By default 1.
- */ -class SecureCachingConnectionFactoryObj : - public TCafSubSystemObjectRoot, - public IBean, - public ConnectionFactory - { - CAF_DECLARE_OBJECT_IDENTIFIER(_sObjIdAmqpSecureCachingConnectionFactory) - - CAF_BEGIN_INTERFACE_MAP(SecureCachingConnectionFactoryObj) - CAF_INTERFACE_ENTRY(IBean) - CAF_INTERFACE_ENTRY(ConnectionFactory) - CAF_END_INTERFACE_MAP() - -public: - SecureCachingConnectionFactoryObj(); - virtual ~SecureCachingConnectionFactoryObj(); - -public: // IBean - void initializeBean( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties); - - void terminateBean(); - -public: // ConnectionFactory - SmartPtrConnection createConnection(); - std::string getProtocol(); - std::string getHost(); - uint32 getPort(); - std::string getVirtualHost(); - std::string getUsername(); - std::string getPassword(); - std::string getCaCertPath(); - std::string getClientCertPath(); - std::string getClientKeyPath(); - uint16 getRetries(); - uint16 getSecondsToWait(); - void addConnectionListener(const SmartPtrConnectionListener& listener); - -private: - SmartPtrCachingConnectionFactory _factory; - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(SecureCachingConnectionFactoryObj); -}; - -}} - -#endif /* SECURECACHINGCONNECTIONFACTORYOBJ_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/amqpIntegration.cpp b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/amqpIntegration.cpp deleted file mode 100644 index 74600d7c3..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/amqpIntegration.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Created on: May 24, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "CachingConnectionFactoryObj.h" -#include "SecureCachingConnectionFactoryObj.h" -#include "IntegrationObjects.h" - -namespace Caf { - -/** @brief CAF AMQP Integration */ -namespace AmqpIntegration { - const char* _sObjIdAmqpCachingConnectionFactory = "com.vmware.caf.comm.integration.amqp.caching.connection.factory"; - const char* _sObjIdAmqpSecureCachingConnectionFactory = "com.vmware.caf.comm.integration.amqp.secure.caching.connection.factory"; - const char* _sObjIdIntegrationObjects = "com.vmware.caf.comm.integration.objects"; -}} - -CEcmSubSystemModule _Module; - -using namespace Caf::AmqpIntegration; - -CAF_BEGIN_OBJECT_MAP(ObjectMap) - CAF_OBJECT_ENTRY(CachingConnectionFactoryObj) - CAF_OBJECT_ENTRY(SecureCachingConnectionFactoryObj) - CAF_OBJECT_ENTRY(IntegrationObjects) -CAF_END_OBJECT_MAP() - -CAF_DECLARE_SUBSYSTEM_EXPORTS() - -extern "C" BOOL APIENTRY DllMain(HINSTANCE hModule, uint32 dwReason, LPVOID) -{ - try { - if (DLL_PROCESS_ATTACH == dwReason) - { - // initialize the sub-system module - _Module.Init(ObjectMap, hModule); - } - else if (DLL_PROCESS_DETACH == dwReason) - { - // Terminate the sub-system module - _Module.Term(); - } - } catch (std::runtime_error) { - ::exit(2); - } catch (...) { - ::exit(2); - } - - return TRUE; -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/amqpIntegrationDefines.h b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/amqpIntegrationDefines.h deleted file mode 100644 index ff3da4cb1..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/amqpIntegrationDefines.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Created on: May 25, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AMQPINTEGRATIONDEFINES_H_ -#define AMQPINTEGRATIONDEFINES_H_ - -namespace Caf { - -/** @brief CAF AMQP Integration */ -namespace AmqpIntegration { - /** @brief CachingConnectionFactory bean subsystem id */ - extern const char* _sObjIdAmqpCachingConnectionFactory; - - /** @brief CachingConnectionFactory bean subsystem id */ - extern const char* _sObjIdAmqpSecureCachingConnectionFactory; - - /** @brief Integration object aggregator bean subsystem id */ - extern const char* _sObjIdIntegrationObjects; -}} - -#endif /* AMQPINTEGRATIONDEFINES_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/stdafx.h b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/stdafx.h deleted file mode 100644 index ce0b5f7da..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/amqpIntegration/src/stdafx.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Created on: May 24, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef STDAFX_H_ -#define STDAFX_H_ - -#include -#include -#include "../../../amqpCore/src/amqpCore/amqpIntegrationCoreLink.h" -#include "amqpIntegrationDefines.h" - -/** - * @defgroup IntObj Integration Objects - * Documentation for the Integration Objects that can be declare in an - * application context file. - *

- * The #Caf::AmqpIntegration::CachingConnectionFactoryObj bean has it's own bean definition in the - * application context: - *

- * \
- * 
- *

- * All other integration objects are accessed through the IntegrationObjects bean: - *

- * \
- * 
- */ - -/** - * @defgroup IntObjImpl Integration Object Implementation - * Documentation for the implementation of the integration objects. - *

- * These classes and methods cannot be used directly by application code. - */ - -/** - * @mainpage - * The CAF AMQP Integration Library provides integration components that enable - * AMQP message channels, endpoints and gateways to be wired into integration-enabled - * applications. - */ - -#endif /* STDAFX_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/include/CCmsMessage.h b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/include/CCmsMessage.h deleted file mode 100644 index f15de055c..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/include/CCmsMessage.h +++ /dev/null @@ -1,233 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CCmsMessage_h_ -#define CCmsMessage_h_ - -#include - -#include "Memory/DynamicArray/DynamicArrayInc.h" - -namespace Caf { - -class CCmsMessage { -public: - CCmsMessage(); - virtual ~CCmsMessage(); - -public: - void initialize( - const std::string& appId, - const std::string& pmeId); - -public: - void signBufferToBuffer( - const SmartPtrCDynamicByteArray& inputBuffer, - SmartPtrCDynamicByteArray& outputBuffer) const; - - void verifyBufferToBuffer( - const SmartPtrCDynamicByteArray& inputBuffer, - SmartPtrCDynamicByteArray& outputBuffer) const; - - void encryptBufferToBuffer( - const SmartPtrCDynamicByteArray& inputBuffer, - SmartPtrCDynamicByteArray& outputBuffer) const; - - void decryptBufferToBuffer( - const SmartPtrCDynamicByteArray& inputBuffer, - SmartPtrCDynamicByteArray& outputBuffer) const; - - void compressBufferToBuffer( - const SmartPtrCDynamicByteArray& inputBuffer, - SmartPtrCDynamicByteArray& outputBuffer) const; - - void uncompressBufferToBuffer( - const SmartPtrCDynamicByteArray& inputBuffer, - SmartPtrCDynamicByteArray& outputBuffer) const; - -public: - void signBufferToFile( - const SmartPtrCDynamicByteArray& inputBuffer, - const std::string& outputPath) const; - - void verifyBufferToFile( - const SmartPtrCDynamicByteArray& inputBuffer, - const std::string& outputPath) const; - - void encryptBufferToFile( - const SmartPtrCDynamicByteArray& inputBuffer, - const std::string& outputPath) const; - - void decryptBufferToFile( - const SmartPtrCDynamicByteArray& inputBuffer, - const std::string& outputPath) const; - - void compressBufferToFile( - const SmartPtrCDynamicByteArray& inputBuffer, - const std::string& outputPath) const; - - void uncompressBufferToFile( - const SmartPtrCDynamicByteArray& inputBuffer, - const std::string& outputPath) const; - -public: - void signFileToBuffer( - const std::string& inputPath, - SmartPtrCDynamicByteArray& outputBuffer) const; - - void verifyFileToBuffer( - const std::string& inputPath, - SmartPtrCDynamicByteArray& outputBuffer) const; - - void encryptFileToBuffer( - const std::string& inputPath, - SmartPtrCDynamicByteArray& outputBuffer) const; - - void decryptFileToBuffer( - const std::string& inputPath, - SmartPtrCDynamicByteArray& outputBuffer) const; - - void compressFileToBuffer( - const std::string& inputPath, - SmartPtrCDynamicByteArray& outputBuffer) const; - - void uncompressFileToBuffer( - const std::string& inputPath, - SmartPtrCDynamicByteArray& outputBuffer) const; - -public: - void signFileToFile( - const std::string& inputPath, - const std::string& outputPath) const; - - void verifyFileToFile( - const std::string& inputPath, - const std::string& outputPath) const; - - void encryptFileToFile( - const std::string& inputPath, - const std::string& outputPath) const; - - void decryptFileToFile( - const std::string& inputPath, - const std::string& outputPath) const; - - void compressFileToFile( - const std::string& inputPath, - const std::string& outputPath) const; - - void uncompressFileToFile( - const std::string& inputPath, - const std::string& outputPath) const; - -private: - void sign( - const SmartPtrCDynamicByteArray& inputBuffer, - const std::string& inputPath, - SmartPtrCDynamicByteArray& outputBuffer, - const std::string& outputPath) const; - - void verify( - const SmartPtrCDynamicByteArray& inputBuffer, - const std::string& inputPath, - SmartPtrCDynamicByteArray& outputBuffer, - const std::string& outputPath) const; - - void encrypt( - const SmartPtrCDynamicByteArray& inputBuffer, - const std::string& inputPath, - SmartPtrCDynamicByteArray& outputBuffer, - const std::string& outputPath) const; - - void decrypt( - const SmartPtrCDynamicByteArray& inputBuffer, - const std::string& inputPath, - SmartPtrCDynamicByteArray& outputBuffer, - const std::string& outputPath) const; - - void compress( - const SmartPtrCDynamicByteArray& inputBuffer, - const std::string& inputPath, - SmartPtrCDynamicByteArray& outputBuffer, - const std::string& outputPath) const; - - void uncompress( - const SmartPtrCDynamicByteArray& inputBuffer, - const std::string& inputPath, - SmartPtrCDynamicByteArray& outputBuffer, - const std::string& outputPath) const; - -private: - void checkCrlf( - const std::string& funcName, - const std::string& direction, - const SmartPtrCDynamicByteArray& buffer, - const std::string& path) const; - - void checkCrlf( - const std::string& funcName, - const std::string& direction, - const SmartPtrCDynamicByteArray& buffer) const; - - void checkCrlf( - const std::string& funcName, - const std::string& direction, - const std::string& path) const; - -private: - std::string getReqDirPath( - const std::string& directory, - const std::string& subdir, - const std::string& subdir1 = std::string()) const; - - std::string getReqFilePath( - const std::string& directory, - const std::string& filename) const; - - Cdeqstr getReqFilePaths( - const std::string& directory, - const std::string& subdir) const; - - std::string getReqRmtCertsDir( - const std::string& appId, - const std::string& pmeId) const; - - void getExistingDir( - const std::string& parentDir, - const std::string& childDir, - std::string& result, - std::string& errDirs) const; - -private: - bool _isInitialized; - - EVP_CIPHER* _cipher; - std::string _persistenceDir; - - std::string _nullPath; - SmartPtrCDynamicByteArray _nullBuffer; - - std::string _encryptPublicKeyPath; - std::string _decryptPublicKeyPath; - std::string _decryptPrivateKeyPath; - std::string _signPublicKeyPath; - std::string _signPrivateKeyPath; - Cdeqstr _caCertificatePaths; - - bool _checkCrlf; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CCmsMessage); -}; - -CAF_DECLARE_SMART_POINTER(CCmsMessage); - -} - -#endif // #ifndef CCmsMessage_h_ diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/include/CCmsMessageAttachments.h b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/include/CCmsMessageAttachments.h deleted file mode 100644 index ec1787a0a..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/include/CCmsMessageAttachments.h +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Author: bwilliams - * Created: July 3, 2015 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CCmsMessageAttachments_h_ -#define CCmsMessageAttachments_h_ - - - -#include "CCmsMessage.h" -#include "Doc/CafCoreTypesDoc/CAttachmentDoc.h" - -namespace Caf { - -class CCmsMessageAttachments { -public: - CCmsMessageAttachments(); - virtual ~CCmsMessageAttachments(); - -public: - void initialize( - const SmartPtrCCmsMessage& cmsMessage); - -public: - void enforceSecurityOnAttachments( - const std::deque& attachmentCollection, - const bool isSigningEnforced, - const bool isEncryptionEnforced) const; - - std::deque encryptAndSignAttachments( - const std::deque& sourceAttachmentCollection) const; - - SmartPtrCAttachmentDoc encryptAndSignAttachment( - const std::string& sourceAttachmentPath, - const SmartPtrCAttachmentDoc& sourceAttachment, - const std::map& uriParameters = std::map()) const; - - std::deque decryptAndVerifyAttachments( - const std::deque& sourceAttachmentCollection) const; - - SmartPtrCAttachmentDoc decryptAndVerifyAttachment( - const std::string& sourceAttachmentPath, - const SmartPtrCAttachmentDoc& sourceAttachment, - const std::map& uriParameters) const; - -private: - void signAttachment( - const std::string& sourceAttachmentPath, - const SmartPtrCAttachmentDoc& sourceAttachment, - const std::map& uriParameters, - std::string& destAttachmentPath, - SmartPtrCAttachmentDoc& destAttachment) const; - - void verifyAttachment( - const std::string& sourceAttachmentPath, - const SmartPtrCAttachmentDoc& sourceAttachment, - const std::map& uriParameters, - std::string& destAttachmentPath, - SmartPtrCAttachmentDoc& destAttachment) const; - - void encryptAttachment( - const std::string& sourceAttachmentPath, - const SmartPtrCAttachmentDoc& sourceAttachment, - const std::map& uriParameters, - std::string& destAttachmentPath, - SmartPtrCAttachmentDoc& destAttachment) const; - - void decryptAttachment( - const std::string& sourceAttachmentPath, - const SmartPtrCAttachmentDoc& sourceAttachment, - const std::map& uriParameters, - std::string& destAttachmentPath, - SmartPtrCAttachmentDoc& destAttachment) const; - -private: - void removeStr( - std::string& sourceStr, - const std::string& strToRemove) const; - - void enforceSigning( - const bool isSigningEnforced, - const SmartPtrCAttachmentDoc& attachment) const; - - void enforceEncryption( - const bool isEncryptionEnforced, - const SmartPtrCAttachmentDoc& attachment) const; - -private: - bool _isInitialized; - - SmartPtrCCmsMessage _cmsMessage; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CCmsMessageAttachments); -}; - -CAF_DECLARE_SMART_POINTER(CCmsMessageAttachments); - -} - -#endif // #ifndef CCmsMessageAttachments_h_ diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/include/CMessageDeliveryRecord.h b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/include/CMessageDeliveryRecord.h deleted file mode 100644 index 92a023ebf..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/include/CMessageDeliveryRecord.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Created on: Nov 26, 2014 - * Author: bwilliams - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CMessageDeliveryRecord_h -#define CMessageDeliveryRecord_h - - -#include "CMessagePartDescriptorSourceRecord.h" -#include "Integration/IIntMessage.h" - -namespace Caf { - -class CMessageDeliveryRecord { -public: - CMessageDeliveryRecord(); - virtual ~CMessageDeliveryRecord(); - -public: - void initialize( - const UUID& correlationId, - const uint32 numberOfParts, - const uint32 startingPartNumber, - const std::deque& messagePartSources, - const IIntMessage::SmartPtrCHeaders& messageHeaders); - -public: - UUID getCorrelationId() const; - - std::string getCorrelationIdStr() const; - - uint32 getNumberOfParts() const; - - uint32 getStartingPartNumber() const; - - std::deque getMessagePartSources() const; - - IIntMessage::SmartPtrCHeaders getMessageHeaders() const; - -private: - bool _isInitialized; - UUID _correlationId; - uint32 _numberOfParts; - uint32 _startingPartNumber; - std::deque _messagePartSources; - IIntMessage::SmartPtrCHeaders _messageHeaders; - -private: - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(CMessageDeliveryRecord); -}; - -CAF_DECLARE_SMART_POINTER(CMessageDeliveryRecord); - -} - -#endif /* CMessageDeliveryRecord_h */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/include/CMessagePartDescriptor.h b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/include/CMessagePartDescriptor.h deleted file mode 100644 index 42f366cac..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/include/CMessagePartDescriptor.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Created on: Nov 19, 2014 - * Author: bwilliams - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CMessagePartDescriptor_h -#define CMessagePartDescriptor_h - - -#include "Memory/DynamicArray/DynamicArrayInc.h" - -namespace Caf { - -class CMessagePartDescriptor; -CAF_DECLARE_SMART_POINTER(CMessagePartDescriptor); - -/** - * Class that emits and parses message parts header blocks.
- */ -class CMessagePartDescriptor { -public: - /** - * Converts the BLOCK_SIZE data in a ByteBuffer into a MessagePartsHeader - *

- * The incoming ByteBuffer position will be modified. - * @param buffer ByteBuffer to convert - * @return a MessagePartsHeader - */ - static SmartPtrCMessagePartDescriptor fromByteBuffer(SmartPtrCDynamicByteArray& buffer); - - /** - * Converts a byte array into a MessagePartsHeader - * @param blockData byte array to convert - * @return a MessagePartsHeader - */ - static SmartPtrCMessagePartDescriptor fromArray(SmartPtrCDynamicByteArray& blockData); - - static SmartPtrCDynamicByteArray toArray(const uint16 attachmentNumber, - const uint32 partNumber, const uint32 dataSize, const uint32 dataOffset); - -public: - CMessagePartDescriptor(); - virtual ~CMessagePartDescriptor(); - -public: - /** - * @param correlationId the correlation id - * @param numberOfParts the total number of parts - */ - void initialize( - const uint16 attachmentNumber, - const uint32 partNumber, - const uint32 dataSize, - const uint32 dataOffset); - - /** - * @return the attachmentNumber - */ - uint16 getAttachmentNumber() const; - std::string getAttachmentNumberStr() const; - - /** - * @return the partNumber - */ - uint32 getPartNumber() const; - - /** - * @return the dataSize - */ - uint32 getDataSize() const; - - /** - * @return the dataOffset - */ - uint32 getDataOffset() const; - -public: - /** - * The BLOCK_SIZE field stores the size of a MessagePartsHeader in byte array form.
- */ - static const uint32 BLOCK_SIZE = 20; - static const byte CAF_MSG_VERSION = 1; - -private: - static const byte RESERVED = (byte)0xcd; - -private: - bool _isInitialized; - uint16 _attachmentNumber; - uint32 _partNumber; - uint32 _dataSize; - uint32 _dataOffset; - -private: - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(CMessagePartDescriptor); -}; - -} - -#endif /* CMessagePartDescriptor_h */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/include/CMessagePartDescriptorSourceRecord.h b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/include/CMessagePartDescriptorSourceRecord.h deleted file mode 100644 index c29e818f4..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/include/CMessagePartDescriptorSourceRecord.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Created on: Nov 26, 2014 - * Author: bwilliams - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CMessagePartDescriptorSourceRecord_h -#define CMessagePartDescriptorSourceRecord_h - -namespace Caf { - -class CMessagePartDescriptorSourceRecord { -public: - CMessagePartDescriptorSourceRecord(); - virtual ~CMessagePartDescriptorSourceRecord(); - -public: - void initialize( - const uint16 attachmentNumber, - const std::string filePath, - const uint32 dataOffset, - const uint32 dataLength); - -public: - uint16 getAttachmentNumber() const; - - std::string getFilePath() const; - - uint32 getDataOffset() const; - - uint32 getDataLength() const; - -private: - bool _isInitialized; - uint16 _attachmentNumber; - std::string _filePath; - uint32 _dataOffset; - uint32 _dataLength; - -private: - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(CMessagePartDescriptorSourceRecord); -}; - -CAF_DECLARE_SMART_POINTER(CMessagePartDescriptorSourceRecord); - -} - -#endif /* CMessagePartDescriptorSourceRecord_h */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/include/CMessagePartRecord.h b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/include/CMessagePartRecord.h deleted file mode 100644 index 59a5e51fe..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/include/CMessagePartRecord.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Created on: Nov 26, 2014 - * Author: bwilliams - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CMessagePartRecord_h -#define CMessagePartRecord_h - -namespace Caf { - -class CMessagePartRecord { -public: - CMessagePartRecord(); - virtual ~CMessagePartRecord(); - -public: - void initialize( - const uint16 attachmentNumber, - const std::string filePath, - const uint64 dataOffset, - const uint64 dataLength); - -public: - uint16 getAttachmentNumber() const; - - std::string getFilePath() const; - - uint64 getDataOffset() const; - - uint64 getDataLength() const; - - void setAttachmentNumber(const uint16 attachmentNumber); - - void setFilePath(const std::string& filePath); - - void setDataOffset(const uint64 dataOffset); - - void setDataLength(const uint64 dataLength); - -private: - bool _isInitialized; - uint16 _attachmentNumber; - std::string _filePath; - uint64 _dataOffset; - uint64 _dataLength; - -private: - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(CMessagePartRecord); -}; - -CAF_DECLARE_SMART_POINTER(CMessagePartRecord); - -} - -#endif /* CMessagePartRecord_h */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/include/CMessagePartsHeader.h b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/include/CMessagePartsHeader.h deleted file mode 100644 index 12a4cb2e4..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/include/CMessagePartsHeader.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Created on: Nov 19, 2014 - * Author: bwilliams - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CMessagePartsHeader_h -#define CMessagePartsHeader_h - - -#include "Memory/DynamicArray/DynamicArrayInc.h" - -namespace Caf { - -class CMessagePartsHeader; -CAF_DECLARE_SMART_POINTER(CMessagePartsHeader); - -/** - * Class that emits and parses message parts header blocks.
- */ -class CMessagePartsHeader { -public: - /** - * Converts the BLOCK_SIZE data in a ByteBuffer into a MessagePartsHeader - *

- * The incoming ByteBuffer position will be modified. - * @param buffer ByteBuffer to convert - * @return a MessagePartsHeader - */ - static SmartPtrCMessagePartsHeader fromByteBuffer(SmartPtrCDynamicByteArray& buffer); - - /** - * Converts a byte array into a MessagePartsHeader - * @param blockData byte array to convert - * @return a MessagePartsHeader - */ - static SmartPtrCMessagePartsHeader fromArray(SmartPtrCDynamicByteArray& blockData); - - static SmartPtrCDynamicByteArray toArray(const UUID correlationId, - const uint32 numberOfParts); - -public: - CMessagePartsHeader(); - virtual ~CMessagePartsHeader(); - -public: - /** - * @param correlationId the correlation id - * @param numberOfParts the total number of parts - */ - void initialize( - const UUID correlationId, - const uint32 numberOfParts); - - /** - * @return the correlationId - */ - UUID getCorrelationId() const; - std::string getCorrelationIdStr() const; - - /** - * @return the numberOfParts - */ - uint32 getNumberOfParts() const; - -public: - /** - * The BLOCK_SIZE field stores the size of a MessagePartsHeader in byte array form.
- */ - static const uint32 BLOCK_SIZE = 24; - static const byte CAF_MSG_VERSION = 1; - -private: - static const byte RESERVED1 = (byte)0xcd; - static const byte RESERVED2 = (byte)0xcd; - static const byte RESERVED3 = (byte)0xcd; - -private: - bool _isInitialized; - UUID _correlationId; - uint32 _numberOfParts; - -private: - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(CMessagePartsHeader); -}; - -} - -#endif /* CMessagePartsHeader_h */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/include/ReplyToResolver.h b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/include/ReplyToResolver.h deleted file mode 100644 index ed2e174ce..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/include/ReplyToResolver.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Created on: Aug 16, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef ReplyToResolver_h -#define ReplyToResolver_h - - -#include "ICafObject.h" - -#include "Integration/IIntMessage.h" - -namespace Caf { -struct __declspec(novtable) ReplyToResolver : public ICafObject { - CAF_DECL_UUID("4D306795-4475-4D2C-BEF0-0ADE28843BBC") - - virtual std::string cacheReplyTo(const SmartPtrIIntMessage& message) = 0; - - virtual std::string lookupReplyTo(const SmartPtrIIntMessage& message) = 0; -}; -CAF_DECLARE_SMART_INTERFACE_POINTER(ReplyToResolver); -} -#endif /* ReplyToResolver_h */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CCmsMessage.cpp b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CCmsMessage.cpp deleted file mode 100644 index 70ca9dd32..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CCmsMessage.cpp +++ /dev/null @@ -1,915 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Memory/DynamicArray/DynamicArrayInc.h" -#include "CCmsMessage.h" -#include "Exception/CCafException.h" -#include "CCmsMessageUtils.h" -#include - -using namespace Caf; - -CCmsMessage::CCmsMessage() : - _isInitialized(false), - _cipher(NULL), - _checkCrlf(false), - CAF_CM_INIT_LOG("CCmsMessage") { -} - -CCmsMessage::~CCmsMessage() { -} - -void CCmsMessage::initialize( - const std::string& appId, - const std::string& pmeId) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(appId); - CAF_CM_VALIDATE_STRING(pmeId); - - SSL_library_init(); - SSL_load_error_strings(); - - _persistenceDir = AppConfigUtils::getRequiredString("persistence_dir"); - - const std::string locDir = getReqDirPath(_persistenceDir, "local"); - const std::string locPublicKeyPath = getReqFilePath(locDir, "cert.pem"); - const std::string locPrivateKeyPath = getReqFilePath(locDir, "privateKey.pem"); - - const std::string rmtCertsDir = getReqRmtCertsDir(appId, pmeId); - const std::string rmtPublicKeyPath = getReqFilePath(rmtCertsDir, "cmsCert.pem"); - const std::string rmtCmsCipherNamePath = getReqFilePath(rmtCertsDir, "cmsCipherName.txt"); - const std::string rmtCipherName = FileSystemUtils::loadTextFile(rmtCmsCipherNamePath); - - _caCertificatePaths = getReqFilePaths(rmtCertsDir, "cmsCertCollection"); - - _cipher = const_cast(EVP_get_cipherbyname(rmtCipherName.c_str())); - CAF_CM_VALIDATE_PTR(_cipher); - - _encryptPublicKeyPath = rmtPublicKeyPath; - _decryptPublicKeyPath = rmtPublicKeyPath; - _decryptPrivateKeyPath = locPrivateKeyPath; - _signPublicKeyPath = locPublicKeyPath; - _signPrivateKeyPath = locPrivateKeyPath; - - CAF_CM_LOG_DEBUG_VA1("Initializing - rmtCipherName: %s", rmtCipherName.c_str()); - CAF_CM_LOG_DEBUG_VA1("Initializing - encryptPublicKeyPath: %s", _encryptPublicKeyPath.c_str()); - CAF_CM_LOG_DEBUG_VA1("Initializing - decryptPublicKeyPath: %s", _decryptPublicKeyPath.c_str()); - CAF_CM_LOG_DEBUG_VA1("Initializing - decryptPrivateKeyPath: %s", _decryptPrivateKeyPath.c_str()); - CAF_CM_LOG_DEBUG_VA1("Initializing - signPublicKeyPath: %s", _signPublicKeyPath.c_str()); - CAF_CM_LOG_DEBUG_VA1("Initializing - signPrivateKeyPath: %s", _signPrivateKeyPath.c_str()); - CAF_CM_LOG_DEBUG_VA2("Initializing - caCertificatePath: %s, %s", rmtCertsDir.c_str(), "cmsCertCollection"); - - _checkCrlf = AppConfigUtils::getOptionalBoolean("security", "check_crlf"); - - _isInitialized = true; -} - -void CCmsMessage::signBufferToBuffer( - const SmartPtrCDynamicByteArray& inputBuffer, - SmartPtrCDynamicByteArray& outputBuffer) const { - CAF_CM_FUNCNAME_VALIDATE("signBufferToBuffer"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_SMARTPTR(inputBuffer); - - CAF_CM_LOG_DEBUG_VA1("%s", CAF_CM_GET_FUNCNAME); - - outputBuffer.CreateInstance(); - sign(inputBuffer, _nullPath, outputBuffer, _nullPath); -} - -void CCmsMessage::verifyBufferToBuffer( - const SmartPtrCDynamicByteArray& inputBuffer, - SmartPtrCDynamicByteArray& outputBuffer) const { - CAF_CM_FUNCNAME_VALIDATE("verifyBufferToBuffer"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_SMARTPTR(inputBuffer); - - CAF_CM_LOG_DEBUG_VA1("%s", CAF_CM_GET_FUNCNAME); - - outputBuffer.CreateInstance(); - verify(inputBuffer, _nullPath, outputBuffer, _nullPath); -} - -void CCmsMessage::encryptBufferToBuffer( - const SmartPtrCDynamicByteArray& inputBuffer, - SmartPtrCDynamicByteArray& outputBuffer) const { - CAF_CM_FUNCNAME_VALIDATE("encryptBufferToBuffer"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_SMARTPTR(inputBuffer); - - CAF_CM_LOG_DEBUG_VA1("%s", CAF_CM_GET_FUNCNAME); - - outputBuffer.CreateInstance(); - encrypt(inputBuffer, _nullPath, outputBuffer, _nullPath); -} - -void CCmsMessage::decryptBufferToBuffer( - const SmartPtrCDynamicByteArray& inputBuffer, - SmartPtrCDynamicByteArray& outputBuffer) const { - CAF_CM_FUNCNAME_VALIDATE("decryptBufferToBuffer"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_SMARTPTR(inputBuffer); - - CAF_CM_LOG_DEBUG_VA1("%s", CAF_CM_GET_FUNCNAME); - - outputBuffer.CreateInstance(); - decrypt(inputBuffer, _nullPath, outputBuffer, _nullPath); -} - -void CCmsMessage::compressBufferToBuffer( - const SmartPtrCDynamicByteArray& inputBuffer, - SmartPtrCDynamicByteArray& outputBuffer) const { - CAF_CM_FUNCNAME_VALIDATE("compressBufferToBuffer"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_SMARTPTR(inputBuffer); - - CAF_CM_LOG_DEBUG_VA1("%s", CAF_CM_GET_FUNCNAME); - - outputBuffer.CreateInstance(); - compress(inputBuffer, _nullPath, outputBuffer, _nullPath); -} - -void CCmsMessage::uncompressBufferToBuffer( - const SmartPtrCDynamicByteArray& inputBuffer, - SmartPtrCDynamicByteArray& outputBuffer) const { - CAF_CM_FUNCNAME_VALIDATE("uncompressBufferToBuffer"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_SMARTPTR(inputBuffer); - - CAF_CM_LOG_DEBUG_VA1("%s", CAF_CM_GET_FUNCNAME); - - outputBuffer.CreateInstance(); - uncompress(inputBuffer, _nullPath, outputBuffer, _nullPath); -} - -void CCmsMessage::signBufferToFile( - const SmartPtrCDynamicByteArray& inputBuffer, - const std::string& outputPath) const { - CAF_CM_FUNCNAME_VALIDATE("signBufferToFile"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_SMARTPTR(inputBuffer); - CAF_CM_VALIDATE_STRING(outputPath); - - CAF_CM_LOG_DEBUG_VA2("%s - %s", CAF_CM_GET_FUNCNAME, outputPath.c_str()); - - SmartPtrCDynamicByteArray nullBuffer; - sign(inputBuffer, _nullPath, nullBuffer, outputPath); -} - -void CCmsMessage::verifyBufferToFile( - const SmartPtrCDynamicByteArray& inputBuffer, - const std::string& outputPath) const { - CAF_CM_FUNCNAME_VALIDATE("verifyBufferToFile"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_SMARTPTR(inputBuffer); - CAF_CM_VALIDATE_STRING(outputPath); - - CAF_CM_LOG_DEBUG_VA2("%s - %s", CAF_CM_GET_FUNCNAME, outputPath.c_str()); - - SmartPtrCDynamicByteArray nullBuffer; - verify(inputBuffer, _nullPath, nullBuffer, outputPath); -} - -void CCmsMessage::encryptBufferToFile( - const SmartPtrCDynamicByteArray& inputBuffer, - const std::string& outputPath) const { - CAF_CM_FUNCNAME_VALIDATE("encryptBufferToFile"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_SMARTPTR(inputBuffer); - CAF_CM_VALIDATE_STRING(outputPath); - - CAF_CM_LOG_DEBUG_VA2("%s - %s", CAF_CM_GET_FUNCNAME, outputPath.c_str()); - - SmartPtrCDynamicByteArray nullBuffer; - encrypt(inputBuffer, _nullPath, nullBuffer, outputPath); -} - -void CCmsMessage::decryptBufferToFile( - const SmartPtrCDynamicByteArray& inputBuffer, - const std::string& outputPath) const { - CAF_CM_FUNCNAME_VALIDATE("decryptBufferToFile"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_SMARTPTR(inputBuffer); - CAF_CM_VALIDATE_STRING(outputPath); - - CAF_CM_LOG_DEBUG_VA2("%s - %s", CAF_CM_GET_FUNCNAME, outputPath.c_str()); - - SmartPtrCDynamicByteArray nullBuffer; - decrypt(inputBuffer, _nullPath, nullBuffer, outputPath); -} - -void CCmsMessage::compressBufferToFile( - const SmartPtrCDynamicByteArray& inputBuffer, - const std::string& outputPath) const { - CAF_CM_FUNCNAME_VALIDATE("compressBufferToFile"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_SMARTPTR(inputBuffer); - CAF_CM_VALIDATE_STRING(outputPath); - - CAF_CM_LOG_DEBUG_VA2("%s - %s", CAF_CM_GET_FUNCNAME, outputPath.c_str()); - - SmartPtrCDynamicByteArray nullBuffer; - compress(inputBuffer, _nullPath, nullBuffer, outputPath); -} - -void CCmsMessage::uncompressBufferToFile( - const SmartPtrCDynamicByteArray& inputBuffer, - const std::string& outputPath) const { - CAF_CM_FUNCNAME_VALIDATE("uncompressBufferToFile"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_SMARTPTR(inputBuffer); - CAF_CM_VALIDATE_STRING(outputPath); - - CAF_CM_LOG_DEBUG_VA2("%s - %s", CAF_CM_GET_FUNCNAME, outputPath.c_str()); - - SmartPtrCDynamicByteArray nullBuffer; - uncompress(inputBuffer, _nullPath, nullBuffer, outputPath); -} - -void CCmsMessage::signFileToBuffer( - const std::string& inputPath, - SmartPtrCDynamicByteArray& outputBuffer) const { - CAF_CM_FUNCNAME_VALIDATE("signFileToBuffer"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(inputPath); - - CAF_CM_LOG_DEBUG_VA2("%s - %s", CAF_CM_GET_FUNCNAME, inputPath.c_str()); - - outputBuffer.CreateInstance(); - sign(_nullBuffer, inputPath, outputBuffer, _nullPath); -} - -void CCmsMessage::verifyFileToBuffer( - const std::string& inputPath, - SmartPtrCDynamicByteArray& outputBuffer) const { - CAF_CM_FUNCNAME_VALIDATE("verifyFileToBuffer"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(inputPath); - - CAF_CM_LOG_DEBUG_VA2("%s - %s", CAF_CM_GET_FUNCNAME, inputPath.c_str()); - - outputBuffer.CreateInstance(); - verify(_nullBuffer, inputPath, outputBuffer, _nullPath); -} - -void CCmsMessage::encryptFileToBuffer( - const std::string& inputPath, - SmartPtrCDynamicByteArray& outputBuffer) const { - CAF_CM_FUNCNAME_VALIDATE("encryptFileToBuffer"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(inputPath); - - CAF_CM_LOG_DEBUG_VA2("%s - %s", CAF_CM_GET_FUNCNAME, inputPath.c_str()); - - outputBuffer.CreateInstance(); - encrypt(_nullBuffer, inputPath, outputBuffer, _nullPath); -} - -void CCmsMessage::decryptFileToBuffer( - const std::string& inputPath, - SmartPtrCDynamicByteArray& outputBuffer) const { - CAF_CM_FUNCNAME_VALIDATE("decryptFileToBuffer"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(inputPath); - - CAF_CM_LOG_DEBUG_VA2("%s - %s", CAF_CM_GET_FUNCNAME, inputPath.c_str()); - - outputBuffer.CreateInstance(); - decrypt(_nullBuffer, inputPath, outputBuffer, _nullPath); -} - -void CCmsMessage::compressFileToBuffer( - const std::string& inputPath, - SmartPtrCDynamicByteArray& outputBuffer) const { - CAF_CM_FUNCNAME_VALIDATE("compressFileToBuffer"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(inputPath); - - CAF_CM_LOG_DEBUG_VA2("%s - %s", CAF_CM_GET_FUNCNAME, inputPath.c_str()); - - outputBuffer.CreateInstance(); - compress(_nullBuffer, inputPath, outputBuffer, _nullPath); -} - -void CCmsMessage::uncompressFileToBuffer( - const std::string& inputPath, - SmartPtrCDynamicByteArray& outputBuffer) const { - CAF_CM_FUNCNAME_VALIDATE("uncompressFileToBuffer"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(inputPath); - - CAF_CM_LOG_DEBUG_VA2("%s - %s", CAF_CM_GET_FUNCNAME, inputPath.c_str()); - - outputBuffer.CreateInstance(); - uncompress(_nullBuffer, inputPath, outputBuffer, _nullPath); -} - -void CCmsMessage::signFileToFile( - const std::string& inputPath, - const std::string& outputPath) const { - CAF_CM_FUNCNAME_VALIDATE("signFileToFile"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(inputPath); - CAF_CM_VALIDATE_STRING(outputPath); - - CAF_CM_LOG_DEBUG_VA3("%s - %s, %s", CAF_CM_GET_FUNCNAME, inputPath.c_str(), - outputPath.c_str()); - - SmartPtrCDynamicByteArray nullBuffer; - sign(_nullBuffer, inputPath, nullBuffer, outputPath); -} - -void CCmsMessage::verifyFileToFile( - const std::string& inputPath, - const std::string& outputPath) const { - CAF_CM_FUNCNAME_VALIDATE("verifyFileToFile"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(inputPath); - CAF_CM_VALIDATE_STRING(outputPath); - - CAF_CM_LOG_DEBUG_VA3("%s - %s, %s", CAF_CM_GET_FUNCNAME, inputPath.c_str(), - outputPath.c_str()); - - SmartPtrCDynamicByteArray nullBuffer; - verify(_nullBuffer, inputPath, nullBuffer, outputPath); -} - -void CCmsMessage::encryptFileToFile( - const std::string& inputPath, - const std::string& outputPath) const { - CAF_CM_FUNCNAME_VALIDATE("encryptFileToFile"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(inputPath); - CAF_CM_VALIDATE_STRING(outputPath); - - CAF_CM_LOG_DEBUG_VA3("%s - %s, %s", CAF_CM_GET_FUNCNAME, inputPath.c_str(), - outputPath.c_str()); - - SmartPtrCDynamicByteArray nullBuffer; - encrypt(_nullBuffer, inputPath, nullBuffer, outputPath); -} - -void CCmsMessage::decryptFileToFile( - const std::string& inputPath, - const std::string& outputPath) const { - CAF_CM_FUNCNAME_VALIDATE("decryptFileToFile"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(inputPath); - CAF_CM_VALIDATE_STRING(outputPath); - - CAF_CM_LOG_DEBUG_VA3("%s - %s, %s", CAF_CM_GET_FUNCNAME, inputPath.c_str(), - outputPath.c_str()); - - SmartPtrCDynamicByteArray nullBuffer; - decrypt(_nullBuffer, inputPath, nullBuffer, outputPath); -} - -void CCmsMessage::compressFileToFile( - const std::string& inputPath, - const std::string& outputPath) const { - CAF_CM_FUNCNAME_VALIDATE("compressFileToFile"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(inputPath); - CAF_CM_VALIDATE_STRING(outputPath); - - CAF_CM_LOG_DEBUG_VA3("%s - %s, %s", CAF_CM_GET_FUNCNAME, inputPath.c_str(), - outputPath.c_str()); - - SmartPtrCDynamicByteArray nullBuffer; - compress(_nullBuffer, inputPath, nullBuffer, outputPath); -} - -void CCmsMessage::uncompressFileToFile( - const std::string& inputPath, - const std::string& outputPath) const { - CAF_CM_FUNCNAME_VALIDATE("uncompressFileToFile"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(inputPath); - CAF_CM_VALIDATE_STRING(outputPath); - - CAF_CM_LOG_DEBUG_VA3("%s - %s, %s", CAF_CM_GET_FUNCNAME, inputPath.c_str(), - outputPath.c_str()); - - SmartPtrCDynamicByteArray nullBuffer; - uncompress(_nullBuffer, inputPath, nullBuffer, outputPath); -} - -void CCmsMessage::sign( - const SmartPtrCDynamicByteArray& inputBuffer, - const std::string& inputPath, - SmartPtrCDynamicByteArray& outputBuffer, - const std::string& outputPath) const { - CAF_CM_FUNCNAME("sign"); - - checkCrlf(CAF_CM_GET_FUNCNAME, "input", inputBuffer, inputPath); - - const uint32 flags = CMS_STREAM | CMS_BINARY; - - BIO* signPublicKeyBio = NULL; - BIO* signPrivateKeyBio = NULL; - X509* signPublicKey = NULL; - EVP_PKEY* signPrivateKey = NULL; - - BIO* outputBio = NULL; - BIO* inputBufferBio = NULL; - CMS_ContentInfo* contentInfo = NULL; - try { - signPublicKeyBio = CCmsMessageUtils::inputFileToBio(_signPublicKeyPath); - signPrivateKeyBio = CCmsMessageUtils::inputFileToBio(_signPrivateKeyPath); - - signPublicKey = CCmsMessageUtils::bioToX509(signPublicKeyBio); - // Casting to void to ignore return value and eliminate compiler warning - (void) BIO_reset(signPublicKeyBio); - signPrivateKey = CCmsMessageUtils::bioToPrivateKey(signPrivateKeyBio); - - inputBufferBio = CCmsMessageUtils::inputToBio(inputBuffer, inputPath); - - contentInfo = CMS_sign(signPublicKey, signPrivateKey, NULL, inputBufferBio, - flags); - if (! contentInfo) { - CCmsMessageUtils::logSslErrors(); - CAF_CM_EXCEPTION_VA0(E_FAIL, "CMS_sign Failed"); - } - - outputBio = CCmsMessageUtils::outputToBio(outputBuffer, outputPath); - - /* Write out S/MIME message */ - if (! SMIME_write_CMS(outputBio, contentInfo, inputBufferBio, flags)) { - CCmsMessageUtils::logSslErrors(); - CAF_CM_EXCEPTION_VA1(E_FAIL, - "SMIME_write_CMS Failed - %s", outputPath.c_str()); - } - - CCmsMessageUtils::bioToOutput(outputBio, outputBuffer, outputPath); - } - CAF_CM_CATCH_CAF - CAF_CM_CATCH_DEFAULT; - - CCmsMessageUtils::free(contentInfo); - CCmsMessageUtils::free(signPublicKey); - CCmsMessageUtils::free(signPrivateKey); - CCmsMessageUtils::free(inputBufferBio); - CCmsMessageUtils::free(outputBio); - CCmsMessageUtils::free(signPublicKeyBio); - CCmsMessageUtils::free(signPrivateKeyBio); - - CAF_CM_THROWEXCEPTION; - - checkCrlf(CAF_CM_GET_FUNCNAME, "output", outputBuffer, outputPath); -} - -void CCmsMessage::verify( - const SmartPtrCDynamicByteArray& inputBuffer, - const std::string& inputPath, - SmartPtrCDynamicByteArray& outputBuffer, - const std::string& outputPath) const { - CAF_CM_FUNCNAME("verify"); - - checkCrlf(CAF_CM_GET_FUNCNAME, "input", inputBuffer, inputPath); - - std::deque caCertBios; - std::deque caCertX509s; - X509_STORE* caCertStore = NULL; - - BIO* inputBufferBio = NULL; - BIO* inputParsedBio = NULL; - BIO* outputBio = NULL; - CMS_ContentInfo* contentInfo = NULL; - try { - caCertBios = CCmsMessageUtils::inputFilesToBio(_caCertificatePaths); - caCertX509s = CCmsMessageUtils::biosToX509(caCertBios); - caCertStore = CCmsMessageUtils::createX509Store(caCertX509s); - - /* - * X509_STORE_free will free up recipient Store and its contents so set - * caCerts to NULL so it isn't freed up twice. - */ - caCertX509s.clear(); - - inputBufferBio = CCmsMessageUtils::inputToBio(inputBuffer, inputPath); - - /* parse message */ - contentInfo = SMIME_read_CMS(inputBufferBio, &inputParsedBio); - if (! contentInfo) { - CCmsMessageUtils::logSslErrors(); - CAF_CM_EXCEPTION_VA0(E_FAIL, "SMIME_read_CMS Failed"); - } - - outputBio = CCmsMessageUtils::outputToBio(outputBuffer, outputPath); - - if (! CMS_verify(contentInfo, NULL, caCertStore, inputParsedBio, outputBio, 0)) { - CCmsMessageUtils::logSslErrors(); - CAF_CM_EXCEPTION_VA0(E_FAIL, "CMS_verify Failed"); - } - - CCmsMessageUtils::bioToOutput(outputBio, outputBuffer, outputPath); - } - CAF_CM_CATCH_CAF - CAF_CM_CATCH_DEFAULT; - - CCmsMessageUtils::free(contentInfo); - CCmsMessageUtils::free(caCertX509s); - CCmsMessageUtils::free(caCertStore); - CCmsMessageUtils::free(inputBufferBio); - CCmsMessageUtils::free(outputBio); - CCmsMessageUtils::free(inputParsedBio); - CCmsMessageUtils::free(caCertBios); - - CAF_CM_THROWEXCEPTION; - - checkCrlf(CAF_CM_GET_FUNCNAME, "output", outputBuffer, outputPath); -} - -void CCmsMessage::encrypt( - const SmartPtrCDynamicByteArray& inputBuffer, - const std::string& inputPath, - SmartPtrCDynamicByteArray& outputBuffer, - const std::string& outputPath) const { - CAF_CM_FUNCNAME("encrypt"); - - checkCrlf(CAF_CM_GET_FUNCNAME, "input", inputBuffer, inputPath); - - const uint32 flags = CMS_STREAM | CMS_BINARY; - - BIO* encryptPublicKeyBio = NULL; - X509* encryptPublicKey = NULL; - STACK_OF(X509)* encryptPublicKeyStack = NULL; - - BIO* outputBio = NULL; - BIO* inputBufferBio = NULL; - CMS_ContentInfo* contentInfo = NULL; - try { - encryptPublicKeyBio = CCmsMessageUtils::inputFileToBio(_encryptPublicKeyPath); - encryptPublicKey = CCmsMessageUtils::bioToX509(encryptPublicKeyBio); - encryptPublicKeyStack = CCmsMessageUtils::createX509Stack(encryptPublicKey); - - /* - * sk_X509_pop_free will CCmsMessageUtils::free up recipient STACK and its contents so set - * encryptPublicKey to NULL so it isn't freed up twice. - */ - encryptPublicKey = NULL; - - inputBufferBio = CCmsMessageUtils::inputToBio(inputBuffer, inputPath); - - /* encrypt content */ - contentInfo = CMS_encrypt(encryptPublicKeyStack, inputBufferBio, _cipher, flags); - if (! contentInfo) { - CCmsMessageUtils::logSslErrors(); - CAF_CM_EXCEPTION_VA0(E_FAIL, "CMS_encrypt Failed"); - } - - outputBio = CCmsMessageUtils::outputToBio(outputBuffer, outputPath); - - /* Write out S/MIME message */ - if (! SMIME_write_CMS(outputBio, contentInfo, inputBufferBio, flags)) { - CCmsMessageUtils::logSslErrors(); - CAF_CM_EXCEPTION_VA0(E_FAIL, "SMIME_write_CMS Failed"); - } - - CCmsMessageUtils::bioToOutput(outputBio, outputBuffer, outputPath); - } - CAF_CM_CATCH_CAF - CAF_CM_CATCH_DEFAULT; - - CCmsMessageUtils::free(contentInfo); - CCmsMessageUtils::free(encryptPublicKey); - CCmsMessageUtils::free(encryptPublicKeyStack); - CCmsMessageUtils::free(inputBufferBio); - CCmsMessageUtils::free(outputBio); - CCmsMessageUtils::free(encryptPublicKeyBio); - - CAF_CM_THROWEXCEPTION; - - checkCrlf(CAF_CM_GET_FUNCNAME, "output", outputBuffer, outputPath); -} - -void CCmsMessage::decrypt( - const SmartPtrCDynamicByteArray& inputBuffer, - const std::string& inputPath, - SmartPtrCDynamicByteArray& outputBuffer, - const std::string& outputPath) const { - CAF_CM_FUNCNAME("decrypt"); - - checkCrlf(CAF_CM_GET_FUNCNAME, "input", inputBuffer, inputPath); - - BIO* decryptPublicKeyBio = NULL; - BIO* decryptPrivateKeyBio = NULL; - X509* decryptPublicKey = NULL; - EVP_PKEY* decryptPrivateKey = NULL; - - BIO* outputBio = NULL; - BIO* inputBufferBio = NULL; - CMS_ContentInfo* contentInfo = NULL; - try { - decryptPublicKeyBio = CCmsMessageUtils::inputFileToBio(_decryptPublicKeyPath); - decryptPrivateKeyBio = CCmsMessageUtils::inputFileToBio(_decryptPrivateKeyPath); - - decryptPublicKey = CCmsMessageUtils::bioToX509(decryptPublicKeyBio); - decryptPrivateKey = CCmsMessageUtils::bioToPrivateKey(decryptPrivateKeyBio); - - inputBufferBio = CCmsMessageUtils::inputToBio(inputBuffer, inputPath); - - contentInfo = SMIME_read_CMS(inputBufferBio, NULL); - if (! contentInfo) { - CCmsMessageUtils::logSslErrors(); - CAF_CM_EXCEPTION_VA0(E_FAIL, "SMIME_read_CMS Failed"); - } - - outputBio = CCmsMessageUtils::outputToBio(outputBuffer, outputPath); - - if (!CMS_decrypt(contentInfo, decryptPrivateKey, decryptPublicKey, - NULL, outputBio, 0)) { - CCmsMessageUtils::logSslErrors(); - CAF_CM_EXCEPTION_VA0(E_FAIL, "CMS_decrypt Failed"); - } - - CCmsMessageUtils::bioToOutput(outputBio, outputBuffer, outputPath); - } - CAF_CM_CATCH_CAF - CAF_CM_CATCH_DEFAULT; - - CCmsMessageUtils::free(contentInfo); - CCmsMessageUtils::free(decryptPublicKey); - CCmsMessageUtils::free(decryptPrivateKey); - CCmsMessageUtils::free(inputBufferBio); - CCmsMessageUtils::free(outputBio); - CCmsMessageUtils::free(decryptPublicKeyBio); - CCmsMessageUtils::free(decryptPrivateKeyBio); - - CAF_CM_THROWEXCEPTION; - - checkCrlf(CAF_CM_GET_FUNCNAME, "output", outputBuffer, outputPath); -} - -void CCmsMessage::compress( - const SmartPtrCDynamicByteArray& inputBuffer, - const std::string& inputPath, - SmartPtrCDynamicByteArray& outputBuffer, - const std::string& outputPath) const { - CAF_CM_FUNCNAME("compress"); - - checkCrlf(CAF_CM_GET_FUNCNAME, "input", inputBuffer, inputPath); - - BIO* inputBufferBio = NULL; - BIO* outputBio = NULL; - CMS_ContentInfo* contentInfo = NULL; - try { - inputBufferBio = CCmsMessageUtils::inputToBio(inputBuffer, inputPath); - - /* parse message */ - contentInfo = CMS_compress(inputBufferBio, NID_zlib_compression, - CMS_STREAM | CMS_BINARY); - if (! contentInfo) { - CCmsMessageUtils::logSslErrors(); - CAF_CM_EXCEPTION_VA0(E_FAIL, "CMS_compress Failed"); - } - - outputBio = CCmsMessageUtils::outputToBio(outputBuffer, outputPath); - - /* Write out S/MIME message */ - if (! SMIME_write_CMS(outputBio, contentInfo, inputBufferBio, CMS_STREAM)) { - CCmsMessageUtils::logSslErrors(); - CAF_CM_EXCEPTION_VA0(E_FAIL, "SMIME_write_CMS Failed"); - } - - CCmsMessageUtils::bioToOutput(outputBio, outputBuffer, outputPath); - } - CAF_CM_CATCH_CAF - CAF_CM_CATCH_DEFAULT; - - CCmsMessageUtils::free(contentInfo); - CCmsMessageUtils::free(inputBufferBio); - CCmsMessageUtils::free(outputBio); - - CAF_CM_THROWEXCEPTION; - - checkCrlf(CAF_CM_GET_FUNCNAME, "output", outputBuffer, outputPath); -} - -void CCmsMessage::uncompress( - const SmartPtrCDynamicByteArray& inputBuffer, - const std::string& inputPath, - SmartPtrCDynamicByteArray& outputBuffer, - const std::string& outputPath) const { - CAF_CM_FUNCNAME("uncompress"); - - checkCrlf(CAF_CM_GET_FUNCNAME, "input", inputBuffer, inputPath); - - BIO* inputBufferBio = NULL; - BIO* outputBio = NULL; - CMS_ContentInfo* contentInfo = NULL; - try { - inputBufferBio = CCmsMessageUtils::inputToBio(inputBuffer, inputPath); - - /* parse message */ - contentInfo = SMIME_read_CMS(inputBufferBio, NULL); - if (! contentInfo) { - CCmsMessageUtils::logSslErrors(); - CAF_CM_EXCEPTION_VA0(E_FAIL, "SMIME_read_CMS Failed"); - } - - outputBio = CCmsMessageUtils::outputToBio(outputBuffer, outputPath); - - if (! CMS_uncompress(contentInfo, outputBio, NULL, 0)) { - CCmsMessageUtils::logSslErrors(); - CAF_CM_EXCEPTION_VA0(E_FAIL, "CMS_uncompress Failed"); - } - - CCmsMessageUtils::bioToOutput(outputBio, outputBuffer, outputPath); - } - CAF_CM_CATCH_CAF - CAF_CM_CATCH_DEFAULT; - - CCmsMessageUtils::free(contentInfo); - CCmsMessageUtils::free(inputBufferBio); - CCmsMessageUtils::free(outputBio); - - CAF_CM_THROWEXCEPTION; - - checkCrlf(CAF_CM_GET_FUNCNAME, "output", outputBuffer, outputPath); -} - -void CCmsMessage::checkCrlf( - const std::string& funcName, - const std::string& direction, - const SmartPtrCDynamicByteArray& buffer, - const std::string& path) const { - CAF_CM_FUNCNAME("checkCrlf"); - CAF_CM_VALIDATE_STRING(funcName); - CAF_CM_VALIDATE_STRING(direction); - - if (_checkCrlf) { - if (! buffer.IsNull()) { - checkCrlf(funcName, direction, buffer); - } else if (! path.empty()) { - checkCrlf(funcName, direction, path); - } else { - CAF_CM_EXCEPTION_VA0(E_FAIL, "Must provide buffer or path"); - } - } -} - -void CCmsMessage::checkCrlf( - const std::string& funcName, - const std::string& direction, - const SmartPtrCDynamicByteArray& buffer) const { - CAF_CM_FUNCNAME("checkCrlf(buffer)"); - CAF_CM_VALIDATE_STRING(funcName); - CAF_CM_VALIDATE_STRING(direction); - CAF_CM_VALIDATE_SMARTPTR(buffer); - - bool isFnd = false; - for (uint32 i = 0; ! isFnd && (i < buffer->getElementCount()); i++) { - if (buffer->getAt(i) == '\r') { - CAF_CM_EXCEPTION_VA2(E_FAIL, "Found CRLF - func: %s, dir: %s", - funcName.c_str(), direction.c_str()); - } - } -} - -void CCmsMessage::checkCrlf( - const std::string& funcName, - const std::string& direction, - const std::string& path) const { - CAF_CM_FUNCNAME("checkCrlf(path)"); - CAF_CM_VALIDATE_STRING(funcName); - CAF_CM_VALIDATE_STRING(direction); - CAF_CM_VALIDATE_STRING(path); - - std::ifstream ifs(path.c_str()); - if(!ifs) { - CAF_CM_EXCEPTION_VA1(E_FAIL, "Failed to open file - %s", path.c_str()); - } - - std::istream::sentry se(ifs, true); - std::streambuf* sb = ifs.rdbuf(); - - char c = '\0'; - bool isFnd = false; - while (! isFnd && ! ifs.eof() && (c != EOF)) { - c = sb->sbumpc(); - if (c == '\r') { - CAF_CM_EXCEPTION_VA3(E_FAIL, "Found CRLF - func: %s, dir: %s, path: %s", - funcName.c_str(), direction.c_str(), path.c_str()); - } - } -} - -std::string CCmsMessage::getReqDirPath( - const std::string& directory, - const std::string& subdir, - const std::string& subdir1) const { - CAF_CM_FUNCNAME("getReqFilePath"); - CAF_CM_VALIDATE_STRING(directory); - CAF_CM_VALIDATE_STRING(subdir); - - std::string rc; - if (subdir1.empty()) { - rc = FileSystemUtils::buildPath(directory, subdir); - } else { - rc = FileSystemUtils::buildPath(directory, subdir, subdir1); - } - - if (! FileSystemUtils::doesDirectoryExist(rc)) { - CAF_CM_EXCEPTION_VA1(ERROR_FILE_NOT_FOUND, - "Directory does not exist - %s", rc.c_str()); - } - - return rc; -} - -std::string CCmsMessage::getReqFilePath( - const std::string& directory, - const std::string& filename) const { - CAF_CM_FUNCNAME("getReqFilePath"); - CAF_CM_VALIDATE_STRING(directory); - CAF_CM_VALIDATE_STRING(filename); - - const std::string rc = FileSystemUtils::buildPath(directory, filename); - if (! FileSystemUtils::doesFileExist(rc)) { - CAF_CM_EXCEPTION_VA1(ERROR_FILE_NOT_FOUND, - "File does not exist - %s", rc.c_str()); - } - - return rc; -} - -Cdeqstr CCmsMessage::getReqFilePaths( - const std::string& directory, - const std::string& subdir) const { - CAF_CM_FUNCNAME_VALIDATE("getReqFilePaths"); - CAF_CM_VALIDATE_STRING(directory); - CAF_CM_VALIDATE_STRING(subdir); - - const std::string dirPath = getReqDirPath(directory, subdir); - - FileSystemUtils::DirectoryItems dirItems = FileSystemUtils::itemsInDirectory( - dirPath, FileSystemUtils::REGEX_MATCH_ALL); - - Cdeqstr rc; - const FileSystemUtils::Files files = dirItems.files; - for (TConstIterator fileIter(files); fileIter; fileIter++) { - const std::string filename = *fileIter; - const std::string filePath = FileSystemUtils::buildPath( - dirPath, filename); - - rc.push_back(filePath); - } - - return rc; -} - -std::string CCmsMessage::getReqRmtCertsDir( - const std::string& appId, - const std::string& pmeId) const { - CAF_CM_FUNCNAME("getReqRmtCertsDir"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(appId); - CAF_CM_VALIDATE_STRING(pmeId); - - const std::string rmtCertsDir = getReqDirPath(_persistenceDir, "remote"); - const std::string pmeIdLower = CStringUtils::toLower(pmeId); - const std::string appIdLower = CStringUtils::toLower(appId); - const std::string pmeIdUpper = CStringUtils::toUpper(pmeId); - const std::string appIdUpper = CStringUtils::toUpper(appId); - - std::string rc; - std::string errDirs; - getExistingDir(rmtCertsDir, pmeIdLower, rc, errDirs); - getExistingDir(rmtCertsDir, appIdLower, rc, errDirs); - getExistingDir(rmtCertsDir, pmeIdUpper, rc, errDirs); - getExistingDir(rmtCertsDir, appIdUpper, rc, errDirs); - getExistingDir(rmtCertsDir, "remote_default", rc, errDirs); - - if (rc.empty()) { - CAF_CM_EXCEPTION_VA1(ERROR_FILE_NOT_FOUND, - "Remote directories do not exist - %s", errDirs.c_str()); - } - - return rc; -} - -void CCmsMessage::getExistingDir( - const std::string& parentDir, - const std::string& childDir, - std::string& result, - std::string& errDirs) const { - CAF_CM_FUNCNAME_VALIDATE("getExistingDir"); - CAF_CM_VALIDATE_STRING(parentDir); - CAF_CM_VALIDATE_STRING(childDir); - - if (result.empty()) { - const std::string finalDir = FileSystemUtils::buildPath(parentDir, childDir); - errDirs += finalDir + ", "; - if (FileSystemUtils::doesDirectoryExist(finalDir)) { - result = finalDir; - } - } -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CCmsMessageAttachments.cpp b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CCmsMessageAttachments.cpp deleted file mode 100644 index 7bdc579ba..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CCmsMessageAttachments.cpp +++ /dev/null @@ -1,377 +0,0 @@ -/* - * Author: bwilliams - * Created: July 3, 2015 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Doc/DocUtils/EnumConvertersXml.h" -#include "Doc/CafCoreTypesDoc/CafCoreTypesDocTypes.h" -#include "Doc/CafCoreTypesDoc/CafCoreTypesDocTypes.h" - -#include "CCmsMessage.h" -#include "Doc/CafCoreTypesDoc/CAttachmentDoc.h" -#include "CCmsMessageAttachments.h" -#include "Exception/CCafException.h" - -using namespace Caf; - -CCmsMessageAttachments::CCmsMessageAttachments() : - _isInitialized(false), - CAF_CM_INIT_LOG("CCmsMessageAttachments") { -} - -CCmsMessageAttachments::~CCmsMessageAttachments() { -} - -void CCmsMessageAttachments::initialize( - const SmartPtrCCmsMessage& cmsMessage) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_SMARTPTR(cmsMessage); - - _cmsMessage = cmsMessage; - - _isInitialized = true; -} - -std::deque CCmsMessageAttachments::encryptAndSignAttachments( - const std::deque& sourceAttachmentCollection) const { - CAF_CM_FUNCNAME("encryptAndSignAttachments"); - // sourceAttachmentCollection is optional - - std::deque rc; - for (TConstIterator > sourceAttachmentIter(sourceAttachmentCollection); - sourceAttachmentIter; sourceAttachmentIter++) { - const SmartPtrCAttachmentDoc sourceAttachment = *sourceAttachmentIter; - - UriUtils::SUriRecord sourceUriRecord; - UriUtils::parseUriString(sourceAttachment->getUri(), sourceUriRecord); - - if ((sourceUriRecord.protocol.compare("file") == 0) - && !sourceAttachment->getIsReference()) { - UriUtils::SFileUriRecord sourceFileUriRecord; - UriUtils::parseFileAddress(sourceUriRecord.address, sourceFileUriRecord); - const std::string sourceAttachmentPath = sourceFileUriRecord.path; - - if (!FileSystemUtils::doesFileExist(sourceAttachmentPath)) { - CAF_CM_EXCEPTION_VA1(ERROR_FILE_NOT_FOUND, - "File not found - %s", sourceAttachmentPath.c_str()); - } - - const SmartPtrCAttachmentDoc destAttachment = encryptAndSignAttachment( - sourceAttachmentPath, sourceAttachment, sourceUriRecord.parameters); - - rc.push_back(destAttachment); - } else { - rc.push_back(sourceAttachment); - } - } - - return rc; -} - -void CCmsMessageAttachments::enforceSecurityOnAttachments( - const std::deque& attachmentCollection, - const bool isSigningEnforced, - const bool isEncryptionEnforced) const { - CAF_CM_FUNCNAME("enforceSecurityOnAttachments"); - - for (TConstIterator > attachmentIter(attachmentCollection); - attachmentIter; attachmentIter++) { - const SmartPtrCAttachmentDoc attachment = *attachmentIter; - - const CMS_POLICY cmsPolicy = attachment->getCmsPolicy(); - switch(cmsPolicy) { - case CMS_POLICY_NONE: - enforceSigning(isSigningEnforced, attachment); - enforceEncryption(isEncryptionEnforced, attachment); - break; - case CMS_POLICY_CAF_ENCRYPTED: - enforceSigning(isSigningEnforced, attachment); - break; - case CMS_POLICY_CAF_SIGNED: - enforceEncryption(isEncryptionEnforced, attachment); - break; - case CMS_POLICY_APP_ENCRYPTED: - enforceSigning(isSigningEnforced, attachment); - break; - case CMS_POLICY_APP_SIGNED: - enforceEncryption(isEncryptionEnforced, attachment); - break; - case CMS_POLICY_CAF_ENCRYPTED_AND_SIGNED: - case CMS_POLICY_APP_ENCRYPTED_AND_SIGNED: - break; - default: - CAF_CM_EXCEPTIONEX_VA1(InvalidArgumentException, E_INVALIDARG, - "Unknown CMS Policy - %d", static_cast(cmsPolicy)); - } - } -} - -SmartPtrCAttachmentDoc CCmsMessageAttachments::encryptAndSignAttachment( - const std::string& sourceAttachmentPath, - const SmartPtrCAttachmentDoc& sourceAttachment, - const std::map& uriParameters) const { - CAF_CM_FUNCNAME("encryptAndSignAttachment"); - CAF_CM_VALIDATE_STRING(sourceAttachmentPath); - CAF_CM_VALIDATE_SMARTPTR(sourceAttachment); - - SmartPtrCAttachmentDoc destAttachment = sourceAttachment; - - std::string destAttachmentPath; - std::string sourceAttachmentPathTmp = sourceAttachmentPath; - SmartPtrCAttachmentDoc sourceAttachmentTmp = sourceAttachment; - - const CMS_POLICY cmsPolicy = sourceAttachmentTmp->getCmsPolicy(); - switch(cmsPolicy) { - case CMS_POLICY_CAF_ENCRYPTED: - encryptAttachment(sourceAttachmentPathTmp, sourceAttachmentTmp, - uriParameters, destAttachmentPath, destAttachment); - break; - case CMS_POLICY_CAF_SIGNED: - signAttachment(sourceAttachmentPathTmp, sourceAttachmentTmp, - uriParameters, destAttachmentPath, destAttachment); - break; - case CMS_POLICY_CAF_ENCRYPTED_AND_SIGNED: - encryptAttachment(sourceAttachmentPathTmp, sourceAttachmentTmp, - uriParameters, destAttachmentPath, destAttachment); - - sourceAttachmentPathTmp = destAttachmentPath; - sourceAttachmentTmp = destAttachment; - - signAttachment(sourceAttachmentPathTmp, sourceAttachmentTmp, - uriParameters, destAttachmentPath, destAttachment); - break; - case CMS_POLICY_NONE: - case CMS_POLICY_APP_ENCRYPTED: - case CMS_POLICY_APP_SIGNED: - case CMS_POLICY_APP_ENCRYPTED_AND_SIGNED: - CAF_CM_LOG_DEBUG_VA1("Passthrough CMS Policy - %s", - EnumConvertersXml::convertCmsPolicyToString(cmsPolicy).c_str()) - break; - default: - CAF_CM_EXCEPTIONEX_VA1(InvalidArgumentException, E_INVALIDARG, - "Unknown CMS Policy - %d", static_cast(cmsPolicy)); - } - - return destAttachment; -} - -std::deque CCmsMessageAttachments::decryptAndVerifyAttachments( - const std::deque& sourceAttachmentCollection) const { - CAF_CM_FUNCNAME("decryptAndVerifyAttachments"); - // sourceAttachmentCollection is optional - - std::deque rc; - for (TConstIterator > sourceAttachmentIter(sourceAttachmentCollection); - sourceAttachmentIter; sourceAttachmentIter++) { - const SmartPtrCAttachmentDoc sourceAttachment = *sourceAttachmentIter; - - UriUtils::SUriRecord sourceUriRecord; - UriUtils::parseUriString(sourceAttachment->getUri(), sourceUriRecord); - - if ((sourceUriRecord.protocol.compare("file") == 0) - && !sourceAttachment->getIsReference()) { - UriUtils::SFileUriRecord sourceFileUriRecord; - UriUtils::parseFileAddress(sourceUriRecord.address, sourceFileUriRecord); - const std::string sourceAttachmentPath = sourceFileUriRecord.path; - - if (!FileSystemUtils::doesFileExist(sourceAttachmentPath)) { - CAF_CM_EXCEPTION_VA1(ERROR_FILE_NOT_FOUND, - "File not found - %s", sourceAttachmentPath.c_str()); - } - - const SmartPtrCAttachmentDoc destAttachment = decryptAndVerifyAttachment( - sourceAttachmentPath, sourceAttachment, sourceUriRecord.parameters); - - rc.push_back(destAttachment); - } else { - rc.push_back(sourceAttachment); - } - } - - return rc; -} - -SmartPtrCAttachmentDoc CCmsMessageAttachments::decryptAndVerifyAttachment( - const std::string& sourceAttachmentPath, - const SmartPtrCAttachmentDoc& sourceAttachment, - const std::map& uriParameters) const { - CAF_CM_FUNCNAME("decryptAndVerifyAttachment"); - CAF_CM_VALIDATE_STRING(sourceAttachmentPath); - CAF_CM_VALIDATE_SMARTPTR(sourceAttachment); - - SmartPtrCAttachmentDoc destAttachment = sourceAttachment; - - std::string destAttachmentPath; - std::string sourceAttachmentPathTmp = sourceAttachmentPath; - SmartPtrCAttachmentDoc sourceAttachmentTmp = sourceAttachment; - - const CMS_POLICY cmsPolicy = sourceAttachmentTmp->getCmsPolicy(); - switch(cmsPolicy) { - case CMS_POLICY_CAF_ENCRYPTED: - decryptAttachment(sourceAttachmentPathTmp, sourceAttachmentTmp, - uriParameters, destAttachmentPath, destAttachment); - break; - case CMS_POLICY_CAF_SIGNED: - verifyAttachment(sourceAttachmentPathTmp, sourceAttachmentTmp, - uriParameters, destAttachmentPath, destAttachment); - break; - case CMS_POLICY_CAF_ENCRYPTED_AND_SIGNED: - verifyAttachment(sourceAttachmentPathTmp, sourceAttachmentTmp, - uriParameters, destAttachmentPath, destAttachment); - - sourceAttachmentPathTmp = destAttachmentPath; - sourceAttachmentTmp = destAttachment; - - decryptAttachment(sourceAttachmentPathTmp, sourceAttachmentTmp, - uriParameters, destAttachmentPath, destAttachment); - break; - case CMS_POLICY_NONE: - case CMS_POLICY_APP_ENCRYPTED: - case CMS_POLICY_APP_SIGNED: - case CMS_POLICY_APP_ENCRYPTED_AND_SIGNED: - CAF_CM_LOG_DEBUG_VA1("Passthrough CMS Policy - %s", - EnumConvertersXml::convertCmsPolicyToString(cmsPolicy).c_str()) - break; - default: - CAF_CM_EXCEPTIONEX_VA1(InvalidArgumentException, E_INVALIDARG, - "Unknown CMS Policy - %d", static_cast(cmsPolicy)); - } - - return destAttachment; -} - -void CCmsMessageAttachments::signAttachment( - const std::string& sourceAttachmentPath, - const SmartPtrCAttachmentDoc& sourceAttachment, - const std::map& uriParameters, - std::string& destAttachmentPath, - SmartPtrCAttachmentDoc& destAttachment) const { - CAF_CM_FUNCNAME_VALIDATE("signAttachment"); - CAF_CM_VALIDATE_STRING(sourceAttachmentPath); - CAF_CM_VALIDATE_SMARTPTR(sourceAttachment); - - destAttachmentPath = sourceAttachmentPath + "_signed"; - _cmsMessage->signFileToFile(sourceAttachmentPath, destAttachmentPath); - - const std::string attachmentUri = UriUtils::appendParameters( - destAttachmentPath, uriParameters); - - destAttachment.CreateInstance(); - destAttachment->initialize(sourceAttachment->getName(), sourceAttachment->getType(), - "file:///" + attachmentUri, sourceAttachment->getIsReference(), - sourceAttachment->getCmsPolicy()); -} - -void CCmsMessageAttachments::verifyAttachment( - const std::string& sourceAttachmentPath, - const SmartPtrCAttachmentDoc& sourceAttachment, - const std::map& uriParameters, - std::string& destAttachmentPath, - SmartPtrCAttachmentDoc& destAttachment) const { - CAF_CM_FUNCNAME_VALIDATE("verifyAttachment"); - CAF_CM_VALIDATE_STRING(sourceAttachmentPath); - CAF_CM_VALIDATE_SMARTPTR(sourceAttachment); - - destAttachmentPath = sourceAttachmentPath + "_verified"; - removeStr(destAttachmentPath, "_signed"); - - _cmsMessage->verifyFileToFile(sourceAttachmentPath, destAttachmentPath); - - const std::string attachmentUri = UriUtils::appendParameters( - destAttachmentPath, uriParameters); - - destAttachment.CreateInstance(); - destAttachment->initialize(sourceAttachment->getName(), sourceAttachment->getType(), - "file:///" + attachmentUri, sourceAttachment->getIsReference(), - sourceAttachment->getCmsPolicy()); -} - -void CCmsMessageAttachments::encryptAttachment( - const std::string& sourceAttachmentPath, - const SmartPtrCAttachmentDoc& sourceAttachment, - const std::map& uriParameters, - std::string& destAttachmentPath, - SmartPtrCAttachmentDoc& destAttachment) const { - CAF_CM_FUNCNAME_VALIDATE("encryptAttachment"); - CAF_CM_VALIDATE_STRING(sourceAttachmentPath); - CAF_CM_VALIDATE_SMARTPTR(sourceAttachment); - - destAttachmentPath = sourceAttachmentPath + "_encrypted"; - _cmsMessage->encryptFileToFile(sourceAttachmentPath, destAttachmentPath); - - const std::string attachmentUri = UriUtils::appendParameters( - destAttachmentPath, uriParameters); - - destAttachment.CreateInstance(); - destAttachment->initialize(sourceAttachment->getName(), sourceAttachment->getType(), - "file:///" + attachmentUri, sourceAttachment->getIsReference(), - sourceAttachment->getCmsPolicy()); -} - -void CCmsMessageAttachments::decryptAttachment( - const std::string& sourceAttachmentPath, - const SmartPtrCAttachmentDoc& sourceAttachment, - const std::map& uriParameters, - std::string& destAttachmentPath, - SmartPtrCAttachmentDoc& destAttachment) const { - CAF_CM_FUNCNAME_VALIDATE("decryptAttachment"); - CAF_CM_VALIDATE_STRING(sourceAttachmentPath); - CAF_CM_VALIDATE_SMARTPTR(sourceAttachment); - - destAttachmentPath = sourceAttachmentPath + "_decrypted"; - removeStr(destAttachmentPath, "_encrypted"); - - _cmsMessage->decryptFileToFile(sourceAttachmentPath, destAttachmentPath); - - const std::string attachmentUri = UriUtils::appendParameters( - destAttachmentPath, uriParameters); - - destAttachment.CreateInstance(); - destAttachment->initialize(sourceAttachment->getName(), sourceAttachment->getType(), - "file:///" + attachmentUri, sourceAttachment->getIsReference(), - sourceAttachment->getCmsPolicy()); -} - -void CCmsMessageAttachments::removeStr( - std::string& sourceStr, - const std::string& strToRemove) const { - CAF_CM_FUNCNAME_VALIDATE("removeStr"); - CAF_CM_VALIDATE_STRING(sourceStr); - CAF_CM_VALIDATE_STRING(strToRemove); - - const size_t index = sourceStr.find(strToRemove); - if (index != std::string::npos) { - sourceStr.erase(index, strToRemove.length()); - } -} - -void CCmsMessageAttachments::enforceSigning( - const bool isSigningEnforced, - const SmartPtrCAttachmentDoc& attachment) const { - CAF_CM_FUNCNAME("enforceSigning"); - CAF_CM_VALIDATE_SMARTPTR(attachment); - - if (isSigningEnforced) { - CAF_CM_EXCEPTION_VA2(E_FAIL, - "Attachment must be signed - name: %s, uri: %s", - attachment->getName().c_str(), attachment->getUri().c_str()); - } -} - -void CCmsMessageAttachments::enforceEncryption( - const bool isEncryptionEnforced, - const SmartPtrCAttachmentDoc& attachment) const { - CAF_CM_FUNCNAME("enforceEncryption"); - CAF_CM_VALIDATE_SMARTPTR(attachment); - - if (isEncryptionEnforced) { - CAF_CM_EXCEPTION_VA2(E_FAIL, - "Attachment must be encrypted - name: %s, uri: %s", - attachment->getName().c_str(), attachment->getUri().c_str()); - } -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CCmsMessageTransformer.cpp b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CCmsMessageTransformer.cpp deleted file mode 100644 index 1c66f7d35..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CCmsMessageTransformer.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Integration/IDocument.h" -#include "Integration/IIntegrationObject.h" -#include "CCmsMessageTransformer.h" - -using namespace Caf; - -CCmsMessageTransformer::CCmsMessageTransformer() : - _isInitialized(false), - CAF_CM_INIT("CCmsMessageTransformer") { -} - -CCmsMessageTransformer::~CCmsMessageTransformer() { -} - -void CCmsMessageTransformer::initializeBean( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties) { - CAF_CM_FUNCNAME_VALIDATE("initializeBean"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STL_EMPTY(ctorArgs); - - _ctorArgs = ctorArgs; - _properties = properties; - initialize(); -} - -void CCmsMessageTransformer::terminateBean() { -} - -void CCmsMessageTransformer::initialize() { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - _isInitialized = true; -} - -bool CCmsMessageTransformer::isResponsible( - const SmartPtrIDocument& configSection) const { - CAF_CM_FUNCNAME_VALIDATE("isResponsible"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - - return false; -} - -SmartPtrIIntegrationObject CCmsMessageTransformer::createObject( - const SmartPtrIDocument& configSection) const { - CAF_CM_FUNCNAME_VALIDATE("createObject"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - - SmartPtrIIntegrationObject rc; - rc.CreateInstance(_sObjIdCommIntegrationCmsMessageTransformerInstance); - rc->initialize(_ctorArgs, _properties, configSection); - - return rc; -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CCmsMessageTransformer.h b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CCmsMessageTransformer.h deleted file mode 100644 index d0ca7fd9c..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CCmsMessageTransformer.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CCmsMessageTransformer_h_ -#define CCmsMessageTransformer_h_ - - -#include "IBean.h" - -#include "Integration/IDocument.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/IIntegrationComponent.h" - -namespace Caf { - -/// Sends responses/errors back to the client. -class CCmsMessageTransformer : - public TCafSubSystemObjectRoot, - public IBean, - public IIntegrationComponent { -public: - CCmsMessageTransformer(); - virtual ~CCmsMessageTransformer(); - - CAF_DECLARE_OBJECT_IDENTIFIER(_sObjIdCommIntegrationCmsMessageTransformer) - - CAF_BEGIN_INTERFACE_MAP(CCmsMessageTransformer) - CAF_INTERFACE_ENTRY(IBean) - CAF_INTERFACE_ENTRY(IIntegrationComponent) - CAF_END_INTERFACE_MAP() - -public: - virtual void initialize(); - -public: // IBean - virtual void initializeBean(const IBean::Cargs& ctorArgs, const IBean::Cprops& properties); - - virtual void terminateBean(); - -public: // IIntegrationComponent - bool isResponsible( - const SmartPtrIDocument& configSection) const; - - SmartPtrIIntegrationObject createObject( - const SmartPtrIDocument& configSection) const; - -private: - bool _isInitialized; - IBean::Cargs _ctorArgs; - IBean::Cprops _properties; - -private: - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(CCmsMessageTransformer); -}; - -} - -#endif // #ifndef CCmsMessageTransformer_h_ diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CCmsMessageTransformerInstance.cpp b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CCmsMessageTransformerInstance.cpp deleted file mode 100644 index bbd93b89d..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CCmsMessageTransformerInstance.cpp +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Integration/Caf/CBeanPropertiesHelper.h" -#include "Integration/Caf/CCafMessageHeaders.h" -#include "CCmsMessage.h" -#include "CCmsMessageAttachments.h" -#include "Common/IAppContext.h" -#include "Doc/CafCoreTypesDoc/CAttachmentDoc.h" -#include "Doc/PayloadEnvelopeDoc/CPayloadEnvelopeDoc.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "Exception/CCafException.h" -#include "CCmsMessageTransformerInstance.h" -#include "Integration/Caf/CCafMessageCreator.h" -#include "Integration/Caf/CCafMessagePayloadParser.h" - -using namespace Caf; - -CCmsMessageTransformerInstance::CCmsMessageTransformerInstance() : - _isInitialized(false), - _isSigningEnforced(true), - _isEncryptionEnforced(true), - CAF_CM_INIT("CCmsMessageTransformerInstance") { -} - -CCmsMessageTransformerInstance::~CCmsMessageTransformerInstance() { -} - -void CCmsMessageTransformerInstance::initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - - const SmartPtrCBeanPropertiesHelper beanProperties = - CBeanPropertiesHelper::create(properties); - - _id = configSection->findRequiredAttribute("id"); - const std::string cmsPolicyStr = beanProperties->getRequiredString("cmsPolicy"); - - _isSigningEnforced = beanProperties->getRequiredBool("isSigningEnforced"); - _isEncryptionEnforced = beanProperties->getRequiredBool("isEncryptionEnforced"); - - _workingDirectory = AppConfigUtils::getRequiredString("communication_amqp", - _sConfigWorkingDir); - - _isInitialized = true; -} - -std::string CCmsMessageTransformerInstance::getId() const { - CAF_CM_FUNCNAME_VALIDATE("getId"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _id; -} - -void CCmsMessageTransformerInstance::wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver) { - CAF_CM_FUNCNAME_VALIDATE("wire"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(appContext); - CAF_CM_VALIDATE_INTERFACE(channelResolver); -} - -SmartPtrIIntMessage CCmsMessageTransformerInstance::transformMessage( - const SmartPtrIIntMessage& message) { - CAF_CM_FUNCNAME("transformMessage"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_SMARTPTR(message); - - SmartPtrCCafMessageHeaders cafMessageHeaders = - CCafMessageHeaders::create(message->getHeaders()); - const std::string msgFlow = cafMessageHeaders->getFlowDirection(); - - const SmartPtrCPayloadEnvelopeDoc payloadEnvelope = - CCafMessagePayloadParser::getPayloadEnvelope(message->getPayload()); - - SmartPtrCCmsMessage cmsMessage; - cmsMessage.CreateInstance(); - cmsMessage->initialize( - BasePlatform::UuidToString(payloadEnvelope->getClientId()), - payloadEnvelope->getPmeId()); - - SmartPtrCCmsMessageAttachments cmsMessageAttachments; - cmsMessageAttachments.CreateInstance(); - cmsMessageAttachments->initialize(cmsMessage); - - SmartPtrIIntMessage rc; - if (msgFlow.compare("OUTGOING") == 0) { - rc = createOutgoingPayload(message->getHeaders(), payloadEnvelope, cmsMessageAttachments); - } else if (msgFlow.compare("INCOMING") == 0) { - rc = createIncomingPayload(message->getHeaders(), payloadEnvelope, cmsMessageAttachments); - } else { - CAF_CM_EXCEPTION_VA1(E_FAIL, - "Invalid msgflow header value: %s", msgFlow.c_str()); - } - - return rc; -} - -SmartPtrIIntMessage CCmsMessageTransformerInstance::createOutgoingPayload( - const IIntMessage::SmartPtrCHeaders& headers, - const SmartPtrCPayloadEnvelopeDoc& payloadEnvelope, - const SmartPtrCCmsMessageAttachments& cmsMessageAttachments) const { - CAF_CM_FUNCNAME_VALIDATE("createOutgoingPayload"); - CAF_CM_VALIDATE_SMARTPTR(headers); - CAF_CM_VALIDATE_SMARTPTR(payloadEnvelope); - CAF_CM_VALIDATE_SMARTPTR(cmsMessageAttachments); - - const std::deque attachmentCollection = - payloadEnvelope->getAttachmentCollection()->getAttachment(); - const std::deque attachmentCollectionCms = - cmsMessageAttachments->encryptAndSignAttachments(attachmentCollection); - - return CCafMessageCreator::createPayloadEnvelope( - payloadEnvelope, attachmentCollectionCms, headers); -} - -SmartPtrIIntMessage CCmsMessageTransformerInstance::createIncomingPayload( - const IIntMessage::SmartPtrCHeaders& headers, - const SmartPtrCPayloadEnvelopeDoc& payloadEnvelope, - const SmartPtrCCmsMessageAttachments& cmsMessageAttachments) const { - CAF_CM_FUNCNAME_VALIDATE("createIncomingPayload"); - CAF_CM_VALIDATE_SMARTPTR(headers); - CAF_CM_VALIDATE_SMARTPTR(payloadEnvelope); - CAF_CM_VALIDATE_SMARTPTR(cmsMessageAttachments); - - // Get the attachment collection out of the payload. - const std::deque attachmentCollectionCms = - payloadEnvelope->getAttachmentCollection()->getAttachment(); - - // Make sure the attachments meet the minimum security bar. - cmsMessageAttachments->enforceSecurityOnAttachments(attachmentCollectionCms, - _isSigningEnforced, _isEncryptionEnforced); - - // Decrypt/verify the attachments. - const std::deque attachmentCollection = - cmsMessageAttachments->decryptAndVerifyAttachments(attachmentCollectionCms); - - return CCafMessageCreator::createPayloadEnvelope( - payloadEnvelope, attachmentCollection, headers); -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CCmsMessageTransformerInstance.h b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CCmsMessageTransformerInstance.h deleted file mode 100644 index 293f424c3..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CCmsMessageTransformerInstance.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CCmsMessageTransformerInstance_h_ -#define CCmsMessageTransformerInstance_h_ - -#include - -#include "CCmsMessageAttachments.h" -#include "Common/IAppContext.h" -#include "Doc/PayloadEnvelopeDoc/CPayloadEnvelopeDoc.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" - -#include "Integration/IIntegrationComponentInstance.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/ITransformer.h" - -namespace Caf { - -class CCmsMessageTransformerInstance : - public TCafSubSystemObjectRoot, - public IIntegrationObject, - public IIntegrationComponentInstance, - public ITransformer { -public: - CCmsMessageTransformerInstance(); - virtual ~CCmsMessageTransformerInstance(); - - CAF_DECLARE_OBJECT_IDENTIFIER(_sObjIdCommIntegrationCmsMessageTransformerInstance) - - CAF_BEGIN_INTERFACE_MAP(CCmsMessageTransformerInstance) - CAF_INTERFACE_ENTRY(IIntegrationObject) - CAF_INTERFACE_ENTRY(IIntegrationComponentInstance) - CAF_INTERFACE_ENTRY(ITransformer) - CAF_END_INTERFACE_MAP() - -public: // IIntegrationObject - void initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection); - - std::string getId() const; - -public: // IIntegrationComponentInstance - void wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver); - -public: // ITransformer - SmartPtrIIntMessage transformMessage( - const SmartPtrIIntMessage& message); - -private: - SmartPtrIIntMessage createOutgoingPayload( - const IIntMessage::SmartPtrCHeaders& headers, - const SmartPtrCPayloadEnvelopeDoc& payloadEnvelope, - const SmartPtrCCmsMessageAttachments& cmsMessageAttachments) const; - - SmartPtrIIntMessage createIncomingPayload( - const IIntMessage::SmartPtrCHeaders& headers, - const SmartPtrCPayloadEnvelopeDoc& payloadEnvelope, - const SmartPtrCCmsMessageAttachments& cmsMessageAttachments) const; - -private: - bool _isInitialized; - std::string _id; - - std::string _workingDirectory; - bool _isSigningEnforced; - bool _isEncryptionEnforced; - -private: - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(CCmsMessageTransformerInstance); -}; - -} - -#endif // #ifndef CCmsMessageTransformerInstance_h_ diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CCmsMessageUtils.cpp b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CCmsMessageUtils.cpp deleted file mode 100644 index 5eaf92ee8..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CCmsMessageUtils.cpp +++ /dev/null @@ -1,361 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Memory/DynamicArray/DynamicArrayInc.h" -#include "Exception/CCafException.h" -#include "CCmsMessageUtils.h" - -using namespace Caf; - -BIO* CCmsMessageUtils::inputBufferToBio( - const SmartPtrCDynamicByteArray& inputBuffer) { - CAF_CM_STATIC_FUNC("CCmsMessageUtils", "inputBufferToBio"); - CAF_CM_VALIDATE_SMARTPTR(inputBuffer); - - BIO* rc = BIO_new_mem_buf( - inputBuffer->getNonConstPtr(), static_cast(inputBuffer->getByteCount())); - if (! rc) { - logSslErrors(); - CAF_CM_EXCEPTION_VA0(E_FAIL, "BIO_new_mem_buf Failed"); - } - - return rc; -} - -std::deque CCmsMessageUtils::inputFilesToBio( - const Cdeqstr& inputFileCollection) { - CAF_CM_STATIC_FUNC_VALIDATE("CCmsMessageUtils", "inputFilesToBio"); - CAF_CM_VALIDATE_STL(inputFileCollection); - - std::deque rc; - for (TConstIterator elemIter(inputFileCollection); elemIter; elemIter++) { - const std::string elem = *elemIter; - rc.push_back(inputFileToBio(elem)); - } - - return rc; -} - -BIO* CCmsMessageUtils::inputFileToBio( - const std::string& inputFile) { - CAF_CM_STATIC_FUNC("CCmsMessageUtils", "inputFileToBio"); - CAF_CM_VALIDATE_STRING(inputFile); - - BIO* rc = BIO_new_file(inputFile.c_str(), "r"); - if (! rc) { - logSslErrors(); - CAF_CM_EXCEPTION_VA1(E_FAIL, - "BIO_new_file Failed - %s", inputFile.c_str()); - } - - return rc; -} - -BIO* CCmsMessageUtils::inputToBio( - const SmartPtrCDynamicByteArray& inputBuffer, - const std::string& inputPath) { - CAF_CM_STATIC_FUNC("CCmsMessageUtils", "inputToBio"); - - BIO* rc = NULL; - if (! inputBuffer.IsNull()) { - rc = inputBufferToBio(inputBuffer); - } else if (! inputPath.empty()) { - rc = inputFileToBio(inputPath); - } else { - CAF_CM_EXCEPTION_VA0(E_FAIL, "Must provide buffer or filename"); - } - - return rc; -} - -BIO* CCmsMessageUtils::outputPathToBio( - const std::string& outputPath) { - CAF_CM_STATIC_FUNC("CCmsMessageUtils", "outputPathToBio"); - CAF_CM_VALIDATE_STRING(outputPath); - - BIO* rc = BIO_new_file(outputPath.c_str(), "w"); - if (! rc) { - logSslErrors(); - CAF_CM_EXCEPTION_VA1(E_FAIL, - "BIO_new_file Failed - %s", outputPath.c_str()); - } - - return rc; -} - -BIO* CCmsMessageUtils::outputToBio( - const SmartPtrCDynamicByteArray& outputBuffer, - const std::string& outputPath) { - CAF_CM_STATIC_FUNC("CCmsMessageUtils", "outputToBio"); - - BIO* rc = NULL; - if (! outputBuffer.IsNull()) { - rc = createWriteBio(); - } else if (! outputPath.empty()) { - rc = outputPathToBio(outputPath); - } else { - CAF_CM_EXCEPTION_VA0(E_FAIL, "Must provide buffer or filename"); - } - - return rc; -} - -void CCmsMessageUtils::bioToOutput( - BIO* bio, - SmartPtrCDynamicByteArray& outputBuffer, - const std::string& outputPath) { - CAF_CM_STATIC_FUNC("CCmsMessageUtils", "bioToOutput"); - CAF_CM_VALIDATE_PTR(bio); - - if (! outputBuffer.IsNull()) { - bioToOutputBuffer(bio, outputBuffer); - } else if (! outputPath.empty()) { - bioToOutputFile(bio, outputPath); - } else { - CAF_CM_EXCEPTION_VA0(E_FAIL, "Must provide buffer or filename"); - } -} - -void CCmsMessageUtils::bioToOutputBuffer( - BIO* bio, - SmartPtrCDynamicByteArray& outputBuffer) { - CAF_CM_STATIC_FUNC_VALIDATE("CCmsMessageUtils", "bioToOutputBuffer"); - CAF_CM_VALIDATE_PTR(bio); - - BUF_MEM* bptr = NULL; - BIO_get_mem_ptr(bio, &bptr); - - // Casting to void to ignore return value and eliminate compiler warning - (void) BIO_set_close(bio, BIO_NOCLOSE); /* So BIO_free() leaves BUF_MEM alone */ - - outputBuffer.CreateInstance(); - outputBuffer->allocateBytes(bptr->length); - outputBuffer->memCpy(bptr->data, bptr->length); -} - -void CCmsMessageUtils::bioToOutputFile( - BIO* bio, - const std::string& outputPath) { - CAF_CM_STATIC_FUNC_VALIDATE("CCmsMessageUtils", "bioToOutputFile"); - CAF_CM_VALIDATE_PTR(bio); - CAF_CM_VALIDATE_STRING(outputPath); -} - -std::deque CCmsMessageUtils::biosToX509( - std::deque bioCollection) { - CAF_CM_STATIC_FUNC_VALIDATE("CCmsMessageUtils", "biosToX509"); - CAF_CM_VALIDATE_STL(bioCollection); - - std::deque rc; - for (TConstIterator > elemIter(bioCollection); elemIter; elemIter++) { - BIO* elem = *elemIter; - rc.push_back(bioToX509(elem)); - } - - return rc; -} - -X509* CCmsMessageUtils::bioToX509( - BIO* bio) { - CAF_CM_STATIC_FUNC("CCmsMessageUtils", "bioToX509"); - CAF_CM_VALIDATE_PTR(bio); - - X509* rc = PEM_read_bio_X509(bio, NULL, 0, NULL); - if (! rc) { - logSslErrors(); - CAF_CM_EXCEPTION_VA0(E_FAIL, "PEM_read_bio_X509 Failed"); - } - - return rc; -} - -EVP_PKEY* CCmsMessageUtils::bioToPrivateKey( - BIO* bio) { - CAF_CM_STATIC_FUNC("CCmsMessageUtils", "bioToPrivateKey"); - CAF_CM_VALIDATE_PTR(bio); - - EVP_PKEY* rc = PEM_read_bio_PrivateKey(bio, NULL, 0, NULL); - if (! rc) { - logSslErrors(); - CAF_CM_EXCEPTION_VA0(E_FAIL, "PEM_read_bio_PrivateKey Failed"); - } - - return rc; -} - -const SSL_METHOD* CCmsMessageUtils::protocolToSslMethod( - const std::string& protocol) { - CAF_CM_STATIC_FUNC("CCmsMessageUtils", "protocolToSslMethod"); - CAF_CM_VALIDATE_STRING(protocol); - - const SSL_METHOD* rc; - if (protocol.compare("TLSv1_2") == 0) { - rc = TLSv1_2_method(); - } else { - CAF_CM_EXCEPTION_VA1(E_FAIL, - "Unknown protocol - %s", protocol.c_str()); - } - - return rc; -} - -BIO* CCmsMessageUtils::createWriteBio() { - CAF_CM_STATIC_FUNC("CCmsMessageUtils", "createWriteBio"); - - BIO* rc = BIO_new(BIO_s_mem()); - if (! rc) { - logSslErrors(); - CAF_CM_EXCEPTION_VA0(E_FAIL, "BIO_new Failed"); - } - - return rc; -} - -STACK_OF(X509)* CCmsMessageUtils::createX509Stack( - X509* x509, - X509* x5091, - X509* x5092) { - CAF_CM_STATIC_FUNC("CCmsMessageUtils", "createX509Stack"); - CAF_CM_VALIDATE_PTR(x509); - - /* Create recipient STACK and add recipient cert to it */ - STACK_OF(X509)* rc = sk_X509_new_null(); - if (! rc) { - logSslErrors(); - CAF_CM_EXCEPTION_VA0(E_FAIL, "sk_X509_new_nuss Failed"); - } - - if (!sk_X509_push(rc, x509)) { - logSslErrors(); - CAF_CM_EXCEPTION_VA0(E_FAIL, "sk_X509_push Failed"); - } - - if (x5091) { - if (!sk_X509_push(rc, x5091)) { - logSslErrors(); - CAF_CM_EXCEPTION_VA0(E_FAIL, "sk_X509_push Failed"); - } - } - - if (x5092) { - if (!sk_X509_push(rc, x5092)) { - logSslErrors(); - CAF_CM_EXCEPTION_VA0(E_FAIL, "sk_X509_push Failed"); - } - } - - return rc; -} - -X509_STORE* CCmsMessageUtils::createX509Store( - std::deque x509Collection) { - CAF_CM_STATIC_FUNC("CCmsMessageUtils", "createX509Store"); - CAF_CM_VALIDATE_STL(x509Collection); - - X509_STORE* rc = X509_STORE_new(); - if (! rc) { - logSslErrors(); - CAF_CM_EXCEPTION_VA0(E_FAIL, "X509_STORE_new Failed"); - } - - for (TConstIterator > elemIter(x509Collection); elemIter; elemIter++) { - X509* elem = *elemIter; - if (!X509_STORE_add_cert(rc, elem)) { - logSslErrors(); - CAF_CM_EXCEPTION_VA0(E_FAIL, "X509_STORE_add_cert Failed"); - } - } - - return rc; -} - -void CCmsMessageUtils::free( - CMS_ContentInfo* contentInfo) { - if (contentInfo) { - CMS_ContentInfo_free(contentInfo); - } -} - -void CCmsMessageUtils::free( - std::deque x509Collection) { - for (TConstIterator > elemIter(x509Collection); elemIter; elemIter++) { - X509* elem = *elemIter; - free(elem); - } -} - -void CCmsMessageUtils::free( - X509* x509) { - if (x509) { - X509_free(x509); - } -} - -void CCmsMessageUtils::free( - STACK_OF(X509)* x509Stack) { - if (x509Stack) { - sk_X509_pop_free(x509Stack, X509_free); - } -} - -void CCmsMessageUtils::free( - std::deque bioCollection) { - for (TConstIterator > elemIter(bioCollection); elemIter; elemIter++) { - BIO* elem = *elemIter; - free(elem); - } -} - -void CCmsMessageUtils::free( - BIO* bio) { - if (bio) { - BIO_vfree(bio); - } -} - -void CCmsMessageUtils::free( - X509_STORE* x509Store) { - if (x509Store) { - X509_STORE_free(x509Store); - } -} - -void CCmsMessageUtils::free( - EVP_PKEY* privateKey) { - if (privateKey) { - EVP_PKEY_free(privateKey); - } -} - -void CCmsMessageUtils::logSslErrors() { - CAF_CM_STATIC_FUNC_LOG_ONLY("CCmsMessageUtils", "logSslErrors"); - - int32 sslErrorCode = ERR_get_error(); - while (sslErrorCode != 0) { - const char* sslErrorStr = ERR_error_string(sslErrorCode, NULL); - CAF_CM_LOG_WARN_VA2("SSL Error - code: %d, str: %s", sslErrorCode, sslErrorStr); - sslErrorCode = ERR_get_error(); - } -} - -void CCmsMessageUtils::logCiphers( - const std::string& prefix, - const SSL* ssl) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CCmsMessageUtils", "logCiphers"); - CAF_CM_VALIDATE_STRING(prefix); - CAF_CM_VALIDATE_PTR(ssl); - - int32 index = 0; - const char* cipher = SSL_get_cipher_list(ssl, index); - while (cipher != NULL) { - CAF_CM_LOG_DEBUG_VA3( - "%s - index: %d, str: %s", prefix.c_str(), index, cipher); - cipher = SSL_get_cipher_list(ssl, index++); - } -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CCmsMessageUtils.h b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CCmsMessageUtils.h deleted file mode 100644 index b37e7e125..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CCmsMessageUtils.h +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CCmsMessageUtil_h_ -#define CCmsMessageUtil_h_ - -#include - -#include "Memory/DynamicArray/DynamicArrayInc.h" -#include -#include -#include -#include -#include -#include -#include - -namespace Caf { - -class CCmsMessageUtils { -public: // Convert - static BIO* inputBufferToBio( - const SmartPtrCDynamicByteArray& inputBuffer); - - static std::deque inputFilesToBio( - const Cdeqstr& inputFileCollection); - - static BIO* inputFileToBio( - const std::string& inputFile); - - static BIO* inputToBio( - const SmartPtrCDynamicByteArray& inputBuffer, - const std::string& inputPath); - - static BIO* outputPathToBio( - const std::string& outputPath); - - static BIO* outputToBio( - const SmartPtrCDynamicByteArray& outputBuffer, - const std::string& outputPath); - - static void bioToOutput( - BIO* bio, - SmartPtrCDynamicByteArray& outputBuffer, - const std::string& outputPath); - - static void bioToOutputBuffer( - BIO* bio, - SmartPtrCDynamicByteArray& outputBuffer); - - static void bioToOutputFile( - BIO* bio, - const std::string& outputPath); - - static std::deque biosToX509( - std::deque bioCollection); - - static X509* bioToX509( - BIO* bio); - - static EVP_PKEY* bioToPrivateKey( - BIO* bio); - - static const SSL_METHOD* protocolToSslMethod( - const std::string& protocol); - -public: // Create - static BIO* createWriteBio(); - - static STACK_OF(X509)* createX509Stack( - X509* x509, - X509* x5091 = NULL, - X509* x5092 = NULL); - - static X509_STORE* createX509Store( - std::deque x509Collection); - -public: // Free - static void free( - CMS_ContentInfo* contentInfo); - - static void free( - X509* x509); - - static void free( - std::deque x509Collection); - - static void free( - STACK_OF(X509)* x509Stack); - - static void free( - BIO* bio); - - static void free( - std::deque bioCollection); - - static void free( - X509_STORE* x509Store); - - static void free( - EVP_PKEY* privateKey); - -public: // Log - static void logSslErrors(); - - static void logCiphers( - const std::string& prefix, - const SSL* ssl); - -private: - CAF_CM_DECLARE_NOCREATE(CCmsMessageUtils); -}; - -} - -#endif // #ifndef CCmsMessageUtil_h_ diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CEventTopicCalculatorInstance.cpp b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CEventTopicCalculatorInstance.cpp deleted file mode 100644 index dd543d98e..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CEventTopicCalculatorInstance.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Created on: Aug 16, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Integration/Caf/CCafMessagePayload.h" -#include "Doc/ResponseDoc/CEventKeyDoc.h" -#include "Doc/ResponseDoc/CManifestDoc.h" -#include "IVariant.h" -#include "Integration/IIntMessage.h" -#include "Common/CCafRegex.h" -#include "Exception/CCafException.h" -#include "CEventTopicCalculatorInstance.h" - -using namespace Caf; - -CEventTopicCalculatorInstance::CEventTopicCalculatorInstance() : - _isInitialized(false), - CAF_CM_INIT("CEventTopicCalculatorInstance") { - CAF_CM_INIT_THREADSAFE; -} - -CEventTopicCalculatorInstance::~CEventTopicCalculatorInstance() { -} - -void CEventTopicCalculatorInstance::initializeBean( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties) { - CAF_CM_FUNCNAME_VALIDATE("initializeBean"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - _isInitialized = true; -} - -void CEventTopicCalculatorInstance::terminateBean() { -} - -SmartPtrIVariant CEventTopicCalculatorInstance::invokeExpression( - const std::string& methodName, - const Cdeqstr& methodParams, - const SmartPtrIIntMessage& message) { - CAF_CM_FUNCNAME("invokeEspression"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_ASSERT(!methodParams.size()); - SmartPtrIVariant result; - - if (methodName == "getTopic") { - result = getTopic(message); - } else { - CAF_CM_EXCEPTIONEX_VA1( - NoSuchMethodException, - 0, - "Method '%s' is not supported by this invoker", - methodName.c_str()); - } - return result; -} - -SmartPtrIVariant CEventTopicCalculatorInstance::getTopic( - const SmartPtrIIntMessage& message) { - CAF_CM_FUNCNAME_VALIDATE("getTopic"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - const SmartPtrCCafMessagePayload cafMessagePayload = - CCafMessagePayload::create(message->getPayload()); - - const SmartPtrCManifestDoc manifest = cafMessagePayload->getManifest(); - - const std::deque eventKeyCollection = - cafMessagePayload->getEventKeyCollection(); - - CCafRegex replaceDots; - replaceDots.initialize("\\."); - - std::stringstream topicBld; - topicBld << "caf.event." - << replaceDots.replaceLiteral(manifest->getClassName(), "_") - << '.' - << replaceDots.replaceLiteral(manifest->getClassNamespace(), "_") - << '.' - << replaceDots.replaceLiteral(manifest->getClassVersion(), "_"); - for (TConstIterator > key(eventKeyCollection); key; key++) { - const SmartPtrCEventKeyDoc eventKey = *key; - topicBld << '.' << replaceDots.replaceLiteral(eventKey->getValue(), "_"); - } - - return CVariant::createString(topicBld.str()); -} - diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CEventTopicCalculatorInstance.h b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CEventTopicCalculatorInstance.h deleted file mode 100644 index 7cf443614..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CEventTopicCalculatorInstance.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Created on: Aug 16, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CEventTopicCalculatorInstance_h -#define CEventTopicCalculatorInstance_h - - -#include "IBean.h" - -#include "IVariant.h" -#include "Integration/IIntMessage.h" -#include "Integration/IExpressionInvoker.h" - -namespace Caf { - -class CEventTopicCalculatorInstance : - public TCafSubSystemObjectRoot, - public IBean, - public IExpressionInvoker { -public: - CEventTopicCalculatorInstance(); - virtual ~CEventTopicCalculatorInstance(); - - CAF_DECLARE_OBJECT_IDENTIFIER(_sObjIdCommIntegrationEventTopicCalculator) - - CAF_BEGIN_INTERFACE_MAP(CEventTopicCalculatorInstance) - CAF_INTERFACE_ENTRY(IBean) - CAF_INTERFACE_ENTRY(IExpressionInvoker) - CAF_END_INTERFACE_MAP() - -public: // IBean - void initializeBean( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties); - - void terminateBean(); - -public: // IExpressionInvoker - SmartPtrIVariant invokeExpression( - const std::string& methodName, - const Cdeqstr& methodParams, - const SmartPtrIIntMessage& message); - -private: - SmartPtrIVariant getTopic( - const SmartPtrIIntMessage& message); - -private: - bool _isInitialized; - CAF_CM_CREATE; - CAF_CM_CREATE_THREADSAFE; - CAF_CM_DECLARE_NOCOPY(CEventTopicCalculatorInstance); -}; - -} - -#endif /* CEventTopicCalculatorInstance_h */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CIncomingMessageHandler.cpp b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CIncomingMessageHandler.cpp deleted file mode 100644 index b704745a5..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CIncomingMessageHandler.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Integration/IDocument.h" -#include "Integration/IIntegrationObject.h" -#include "CIncomingMessageHandler.h" - -using namespace Caf; - -CIncomingMessageHandler::CIncomingMessageHandler() : - _isInitialized(false), - CAF_CM_INIT("CIncomingMessageHandler") { -} - -CIncomingMessageHandler::~CIncomingMessageHandler() { -} - -void CIncomingMessageHandler::initializeBean( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties) { - CAF_CM_FUNCNAME_VALIDATE("initializeBean"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STL_EMPTY(ctorArgs); - CAF_CM_VALIDATE_STL_EMPTY(properties); - - _ctorArgs = ctorArgs; - _properties = properties; - initialize(); -} - -void CIncomingMessageHandler::terminateBean() { -} - -void CIncomingMessageHandler::initialize() { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - _isInitialized = true; -} - -bool CIncomingMessageHandler::isResponsible( - const SmartPtrIDocument& configSection) const { - CAF_CM_FUNCNAME_VALIDATE("isResponsible"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - - return false; -} - -SmartPtrIIntegrationObject CIncomingMessageHandler::createObject( - const SmartPtrIDocument& configSection) const { - CAF_CM_FUNCNAME_VALIDATE("createObject"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - - SmartPtrIIntegrationObject rc; - rc.CreateInstance(_sObjIdCommIntegrationIncomingMessageHandlerInstance); - rc->initialize(_ctorArgs, _properties, configSection); - - return rc; -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CIncomingMessageHandler.h b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CIncomingMessageHandler.h deleted file mode 100644 index 5e1318ddf..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CIncomingMessageHandler.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CIncomingMessageHandler_h_ -#define CIncomingMessageHandler_h_ - - -#include "IBean.h" - -#include "Integration/IDocument.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/IIntegrationComponent.h" - -namespace Caf { - -/// Sends responses/errors back to the client. -class CIncomingMessageHandler : - public TCafSubSystemObjectRoot, - public IBean, - public IIntegrationComponent { -public: - CIncomingMessageHandler(); - virtual ~CIncomingMessageHandler(); - - CAF_DECLARE_OBJECT_IDENTIFIER(_sObjIdCommIntegrationIncomingMessageHandler) - - CAF_BEGIN_INTERFACE_MAP(CIncomingMessageHandler) - CAF_INTERFACE_ENTRY(IBean) - CAF_INTERFACE_ENTRY(IIntegrationComponent) - CAF_END_INTERFACE_MAP() - -public: - virtual void initialize(); - -public: // IBean - virtual void initializeBean(const IBean::Cargs& ctorArgs, const IBean::Cprops& properties); - - virtual void terminateBean(); - -public: // IIntegrationComponent - bool isResponsible( - const SmartPtrIDocument& configSection) const; - - SmartPtrIIntegrationObject createObject( - const SmartPtrIDocument& configSection) const; - -private: - bool _isInitialized; - IBean::Cargs _ctorArgs; - IBean::Cprops _properties; - -private: - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(CIncomingMessageHandler); -}; - -} - -#endif // #ifndef CIncomingMessageHandler_h_ diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CIncomingMessageHandlerInstance.cpp b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CIncomingMessageHandlerInstance.cpp deleted file mode 100644 index d08f50f87..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CIncomingMessageHandlerInstance.cpp +++ /dev/null @@ -1,261 +0,0 @@ -/* - * Created on: Aug 16, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Integration/Caf/CCafMessageHeadersWriter.h" -#include "CMessagePartDescriptor.h" -#include "Common/IAppContext.h" -#include "Doc/CafCoreTypesDoc/CAttachmentDoc.h" -#include "Doc/PayloadEnvelopeDoc/CPayloadEnvelopeDoc.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "Memory/DynamicArray/DynamicArrayInc.h" -#include "CIncomingMessageHandlerInstance.h" -#include "CMessagePartsHeader.h" -#include "Integration/Core/MessageHeaders.h" -#include "Integration/Caf/CCafMessageCreator.h" -#include "Integration/Caf/CCafMessagePayloadParser.h" -#include "Integration/Caf/CCafMessagePayload.h" -#include "Integration/Core/CMessageHeaderUtils.h" - -using namespace Caf; - -CIncomingMessageHandlerInstance::CIncomingMessageHandlerInstance() : - _isInitialized(false), - CAF_CM_INIT_LOG("CIncomingMessageHandlerInstance") { -} - -CIncomingMessageHandlerInstance::~CIncomingMessageHandlerInstance() { -} - -void CIncomingMessageHandlerInstance::initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - _id = configSection->findRequiredAttribute("id"); - _isInitialized = true; -} - -std::string CIncomingMessageHandlerInstance::getId() const { - CAF_CM_FUNCNAME_VALIDATE("getId"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _id; -} - -void CIncomingMessageHandlerInstance::wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver) { - CAF_CM_FUNCNAME_VALIDATE("wire"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(appContext); -} - -SmartPtrIIntMessage CIncomingMessageHandlerInstance::transformMessage( - const SmartPtrIIntMessage& message) { - CAF_CM_FUNCNAME_VALIDATE("transformMessage"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(message); - - SmartPtrIIntMessage newMessage = handleMessage(message); - - return newMessage; -} -/** - * Processes an incoming message - *

- * Pre-processes an incoming message and:
- * (1) determines if it is a duplicate message
- * (2) determines if it is a stand-alone message or part of a larger message - * (chunking)
- * (3) enhances the message headers with internal information
- * (4) caches the message's replyTo information
- *

- * This method will return null if the message cannot be processed as - * is. This is the case if the message is a chunk of a larger message. When - * all of the chunks are assembled then the assembled message will be - * returned. - *

- * This component interacts with the MessageDeliveryStateRecorder in the - * case of message receipts. If a message receipt needs to be generated, a - * record will be added to the MessageDeliveryStateRecorder which will - * produce and send the receipt. - *

- * If the message is a duplicate it will be marked as such and returned so - * that logic in the context file can do something with it if desired. - * - * @param message incoming message - * @return the incoming message if it can be processed on its own or null if - * not - */ -SmartPtrIIntMessage CIncomingMessageHandlerInstance::handleMessage( - const SmartPtrIIntMessage& message) { - CAF_CM_STATIC_FUNC_VALIDATE("CIncomingMessageHandlerInstance", "handleMessage"); - CAF_CM_VALIDATE_INTERFACE(message); - - const std::string workingDir = - AppConfigUtils::getRequiredString("communication_amqp", _sConfigWorkingDir); - - CMessageHeaderUtils::log(message->getHeaders()); - - SmartPtrIIntMessage rc; - if (CMessageHeaderUtils::getBoolOpt( - message->getHeaders(), MessageHeaders::_sMULTIPART)) { - rc = getAssembledMessage(message, workingDir); - } else { - rc = message; - } - return rc; -} - -SmartPtrIIntMessage CIncomingMessageHandlerInstance::getAssembledMessage( - const SmartPtrIIntMessage& message, - const std::string& workingDir) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CIncomingMessageHandlerInstance", "getAssembledMessage"); - CAF_CM_VALIDATE_INTERFACE(message); - CAF_CM_VALIDATE_STRING(workingDir); - - const std::string correlationId = processMessage(message, workingDir); - - const std::string messageDir = FileSystemUtils::buildPath( - workingDir, correlationId); - const std::string manifestFile = FileSystemUtils::buildPath(messageDir, "0.part"); - CAF_CM_LOG_DEBUG_VA1("Reconstructing manifest - %s", manifestFile.c_str()); - - const SmartPtrCDynamicByteArray payload = - CCafMessagePayload::createBufferFromFile(manifestFile); - const SmartPtrCPayloadEnvelopeDoc payloadEnvelope = - CCafMessagePayloadParser::getPayloadEnvelope(payload); - - const std::deque attachmentDocs = - payloadEnvelope->getAttachmentCollection()->getAttachment(); - - // refactor the local attachments to point to the transferred - // attachments - std::deque refactoredAttachments; - if (!attachmentDocs.empty()) { - if (!attachmentDocs.empty()) { - CAF_CM_LOG_DEBUG_VA2( - "Refactoring attachments - correlationId: %s, numAttachments: %d", - correlationId.c_str(), attachmentDocs.size()); - for (TConstIterator > attachmentIter(attachmentDocs); - attachmentIter; attachmentIter++) { - const SmartPtrCAttachmentDoc attachment = *attachmentIter; - const std::string attachmentName = attachment->getName(); - const std::string attachmentUri = attachment->getUri(); - - UriUtils::SUriRecord uriRecord; - UriUtils::parseUriString(attachmentUri, uriRecord); - - CAF_CM_LOG_DEBUG_VA3("Parsed URI - Uri: %s, protocol: %s, address: %s", - attachmentUri.c_str(), uriRecord.protocol.c_str(), - uriRecord.address.c_str()); - - if(uriRecord.protocol.compare("attachment") == 0) { - const std::string uriPath = uriRecord.address; - const std::string::size_type slashPos = uriPath.find('/'); - const std::string attNumStr = uriPath.substr(slashPos + 1); - - const std::string attFile = FileSystemUtils::buildPath( - messageDir, attNumStr + ".part"); - const std::string attUri = UriUtils::appendParameters( - attFile, uriRecord.parameters); - - SmartPtrCAttachmentDoc refactoredAttachment; - refactoredAttachment.CreateInstance(); - refactoredAttachment->initialize(attachment->getName(), - attachment->getType(), "file:///" + attUri, false, - attachment->getCmsPolicy()); - refactoredAttachments.push_back(refactoredAttachment); - - CAF_CM_LOG_DEBUG_VA3( - "Adding refactored attachment - name: %s, type: %s, uri: %s", - refactoredAttachment->getName().c_str(), - refactoredAttachment->getType().c_str(), - refactoredAttachment->getUri().c_str()); - } else { - refactoredAttachments.push_back(attachment); - } - } - } - } - - SmartPtrIIntMessage newMessage; - if (refactoredAttachments.empty()) { - newMessage = CCafMessageCreator::create( - payload, refactoredAttachments, message->getHeaders()); - } else { - const SmartPtrCCafMessageHeadersWriter cafMessageHeadersWriter = - CCafMessageHeadersWriter::create(); - cafMessageHeadersWriter->insertString( - MessageHeaders::_sMULTIPART_WORKING_DIR, messageDir); - - newMessage = CCafMessageCreator::createPayloadEnvelope( - payloadEnvelope, refactoredAttachments, - cafMessageHeadersWriter->getHeaders(), message->getHeaders()); - } - - return newMessage; -} - -std::string CIncomingMessageHandlerInstance::processMessage( - const SmartPtrIIntMessage& message, - const std::string& workingDir) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CIncomingMessageHandlerInstance", "processMessage"); - CAF_CM_VALIDATE_INTERFACE(message); - CAF_CM_VALIDATE_STRING(workingDir); - - SmartPtrCDynamicByteArray payload = message->getPayload(); - payload->resetCurrentPos(); - - CAF_CM_LOG_DEBUG_VA1("Processing payload - byteCount: %d", - payload->getByteCount()); - - const std::string payloadPath = FileSystemUtils::buildPath(FileSystemUtils::getTmpDir(), "payload.out"); - FileSystemUtils::saveByteFile(payloadPath, payload->getPtr(), payload->getByteCount()); - - SmartPtrCMessagePartsHeader header = - CMessagePartsHeader::fromByteBuffer(payload); - CAF_CM_LOG_DEBUG_VA3( - "Processing message parts - version: %d, correlationId: %s, numberOfParts: %d", - CMessagePartsHeader::CAF_MSG_VERSION, header->getCorrelationIdStr().c_str(), - header->getNumberOfParts()); - - const std::string messageDir = FileSystemUtils::buildPath( - workingDir, header->getCorrelationIdStr()); - if (!FileSystemUtils::doesFileExist(messageDir)) { - CAF_CM_LOG_DEBUG_VA1("Creating directory - %s", messageDir.c_str()); - FileSystemUtils::createDirectory(messageDir); - } - - while (payload->getByteCountFromCurrentPos() > 0) { - SmartPtrCMessagePartDescriptor partDescriptor = CMessagePartDescriptor::fromByteBuffer(payload); - CAF_CM_LOG_DEBUG_VA5( - "Processing message parts descriptor - version: %d, attachmentNumber: %d, partNumber: %d, dataSize: %d, dataOffset: %d", - CMessagePartDescriptor::CAF_MSG_VERSION, partDescriptor->getAttachmentNumber(), - partDescriptor->getPartNumber(), partDescriptor->getDataSize(), partDescriptor->getDataOffset()); - - const std::string attachmentFile = FileSystemUtils::buildPath( - messageDir, partDescriptor->getAttachmentNumberStr() + ".part"); - - SmartPtrCDynamicByteArray partBuffer; - partBuffer.CreateInstance(); - partBuffer->allocateBytes(partDescriptor->getDataSize()); - partBuffer->memCpy(payload->getPtrAtCurrentPos(), partDescriptor->getDataSize()); - partBuffer->incrementCurrentPos(static_cast(partDescriptor->getDataOffset())); - - payload->incrementCurrentPos(partDescriptor->getDataSize()); - - FileSystemUtils::saveByteFile(attachmentFile, partBuffer->getPtrAtCurrentPos(), partBuffer->getByteCountFromCurrentPos()); - } - - return header->getCorrelationIdStr(); -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CIncomingMessageHandlerInstance.h b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CIncomingMessageHandlerInstance.h deleted file mode 100644 index 89f101401..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CIncomingMessageHandlerInstance.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Created on: Aug 16, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CIncomingMessageHandlerInstance_h -#define CIncomingMessageHandlerInstance_h - - - -#include "Integration/IIntegrationComponentInstance.h" - -#include "Common/IAppContext.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/ITransformer.h" - -namespace Caf { - -class CIncomingMessageHandlerInstance : - public TCafSubSystemObjectRoot, - public IIntegrationObject, - public IIntegrationComponentInstance, - public ITransformer { -public: - CIncomingMessageHandlerInstance(); - virtual ~CIncomingMessageHandlerInstance(); - - CAF_DECLARE_OBJECT_IDENTIFIER(_sObjIdCommIntegrationIncomingMessageHandlerInstance) - - CAF_BEGIN_INTERFACE_MAP(CIncomingMessageHandlerInstance) - CAF_INTERFACE_ENTRY(IIntegrationObject) - CAF_INTERFACE_ENTRY(IIntegrationComponentInstance) - CAF_INTERFACE_ENTRY(ITransformer) - CAF_END_INTERFACE_MAP() - -public: // IIntegrationObject - void initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection); - - std::string getId() const; - -public: // IIntegrationComponentInstance - void wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver); - -public: // ITransformer - SmartPtrIIntMessage transformMessage( - const SmartPtrIIntMessage& message); - -private: - static SmartPtrIIntMessage handleMessage( - const SmartPtrIIntMessage& message); - - static SmartPtrIIntMessage getAssembledMessage( - const SmartPtrIIntMessage& message, - const std::string& workingDir); - - static std::string processMessage( - const SmartPtrIIntMessage& message, - const std::string& workingDir); - -private: - bool _isInitialized; - std::string _id; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CIncomingMessageHandlerInstance); -}; -CAF_DECLARE_SMART_QI_POINTER(CIncomingMessageHandlerInstance); -} - -#endif /* CIncomingMessageHandlerInstance_h */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CMessageDeliveryRecord.cpp b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CMessageDeliveryRecord.cpp deleted file mode 100644 index 305f7d86e..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CMessageDeliveryRecord.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Created on: Nov 26, 2014 - * Author: bwilliams - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "CMessagePartDescriptorSourceRecord.h" -#include "Integration/IIntMessage.h" -#include "CMessageDeliveryRecord.h" - -using namespace Caf; - -CMessageDeliveryRecord::CMessageDeliveryRecord() : - _isInitialized(false), - _correlationId(CAFCOMMON_GUID_NULL), - _numberOfParts(0), - _startingPartNumber(0), - CAF_CM_INIT("CMessageDeliveryRecord") { -} - -CMessageDeliveryRecord::~CMessageDeliveryRecord() { -} - -void CMessageDeliveryRecord::initialize( - const UUID& correlationId, - const uint32 numberOfParts, - const uint32 startingPartNumber, - const std::deque& messagePartSources, - const IIntMessage::SmartPtrCHeaders& messageHeaders) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - - _correlationId = correlationId; - _numberOfParts = numberOfParts; - _startingPartNumber = startingPartNumber; - _messagePartSources = messagePartSources; - _messageHeaders = messageHeaders; - - _isInitialized = true; -} - -UUID CMessageDeliveryRecord::getCorrelationId() const { - CAF_CM_FUNCNAME_VALIDATE("getCorrelationId"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _correlationId; -} - -std::string CMessageDeliveryRecord::getCorrelationIdStr() const { - CAF_CM_FUNCNAME_VALIDATE("getCorrelationId"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return BasePlatform::UuidToString(_correlationId); -} - -uint32 CMessageDeliveryRecord::getNumberOfParts() const { - CAF_CM_FUNCNAME_VALIDATE("getNumberOfParts"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _numberOfParts; -} - -uint32 CMessageDeliveryRecord::getStartingPartNumber() const { - CAF_CM_FUNCNAME_VALIDATE("getStartingPartNumber"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _startingPartNumber; -} - -std::deque CMessageDeliveryRecord::getMessagePartSources() const { - CAF_CM_FUNCNAME_VALIDATE("getMessagePartSources"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _messagePartSources; -} - -IIntMessage::SmartPtrCHeaders CMessageDeliveryRecord::getMessageHeaders() const { - CAF_CM_FUNCNAME_VALIDATE("getMessageHeaders"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _messageHeaders; -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CMessagePartDescriptor.cpp b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CMessagePartDescriptor.cpp deleted file mode 100644 index b869246e4..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CMessagePartDescriptor.cpp +++ /dev/null @@ -1,172 +0,0 @@ -/* Created on: Nov 19, 2014 - * Author: bwilliams - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Memory/DynamicArray/DynamicArrayInc.h" -#include "CMessagePartDescriptor.h" -#include "Exception/CCafException.h" - -using namespace Caf; - -/** - * Converts the BLOCK_SIZE data in a ByteBuffer into a MessagePartsDescriptor - *

- * The incoming ByteBuffer position will be modified. - * @param buffer ByteBuffer to convert - * @return a MessagePartsDescriptor - */ -SmartPtrCMessagePartDescriptor CMessagePartDescriptor::fromByteBuffer( - SmartPtrCDynamicByteArray& buffer) { - CAF_CM_STATIC_FUNC("CMessagePartDescriptor", "fromByteBuffer"); - CAF_CM_VALIDATE_SMARTPTR(buffer); - - if (buffer->getByteCountFromCurrentPos() < BLOCK_SIZE) { - CAF_CM_EXCEPTION_VA2(E_INVALIDARG, - "Input data block is too small - rem: %d, tot: %d", - buffer->getByteCountFromCurrentPos(), buffer->getByteCount()); - } - - SmartPtrCDynamicByteArray data; - data.CreateInstance(); - data->allocateBytes(BLOCK_SIZE); - data->memCpy(buffer->getPtrAtCurrentPos(), BLOCK_SIZE); - - buffer->incrementCurrentPos(BLOCK_SIZE); - return fromArray(data); -} - -/** - * Converts a byte array into a MessagePartsDescriptor - * @param blockData byte array to convert - * @return a MessagePartsDescriptor - */ -SmartPtrCMessagePartDescriptor CMessagePartDescriptor::fromArray( - SmartPtrCDynamicByteArray& buffer) { - CAF_CM_STATIC_FUNC("CMessagePartDescriptor", "fromArray"); - CAF_CM_VALIDATE_SMARTPTR(buffer); - - if (buffer->getByteCount() < BLOCK_SIZE) { - CAF_CM_EXCEPTION_VA1(E_INVALIDARG, "Input data block is too small - %d", - buffer->getByteCount()); - } - - if (CMessagePartsParser::getByte(buffer) != CAF_MSG_VERSION) { - CAF_CM_EXCEPTION_VA0(E_INVALIDARG, "Input data block version is incorrect"); - } - - const byte resvd = CMessagePartsParser::getByte(buffer); - if (resvd != RESERVED) { - CAF_CM_EXCEPTION_VA0(E_INVALIDARG, "Input data block reserved bits are incorrect"); - } - - const uint16 attachmentNumber = CMessagePartsParser::getUint16(buffer); - const uint32 partNumber = CMessagePartsParser::getUint32(buffer); - const uint32 dataSize = CMessagePartsParser::getUint32(buffer); - const uint32 dataOffset = CMessagePartsParser::getUint32(buffer); - buffer->verify(); - - SmartPtrCMessagePartDescriptor messagePartsDescriptor; - messagePartsDescriptor.CreateInstance(); - messagePartsDescriptor->initialize( - attachmentNumber, partNumber, dataSize, dataOffset); - - return messagePartsDescriptor; -} - -SmartPtrCDynamicByteArray CMessagePartDescriptor::toArray( - const uint16 attachmentNumber, - const uint32 partNumber, - const uint32 dataSize, - const uint32 dataOffset) { - SmartPtrCDynamicByteArray buffer; - buffer.CreateInstance(); - buffer->allocateBytes(BLOCK_SIZE); - - CMessagePartsBuilder::put(CAF_MSG_VERSION, buffer); - CMessagePartsBuilder::put(RESERVED, buffer); - CMessagePartsBuilder::put(attachmentNumber, buffer); - CMessagePartsBuilder::put(partNumber, buffer); - CMessagePartsBuilder::put(dataSize, buffer); - CMessagePartsBuilder::put(dataOffset, buffer); - buffer->verify(); - - return buffer; -} - -CMessagePartDescriptor::CMessagePartDescriptor() : - _isInitialized(false), - _attachmentNumber(0), - _partNumber(0), - _dataSize(0), - _dataOffset(0), - CAF_CM_INIT("CMessagePartDescriptor") { -} - -CMessagePartDescriptor::~CMessagePartDescriptor() { -} - -void CMessagePartDescriptor::initialize( - const uint16 attachmentNumber, - const uint32 partNumber, - const uint32 dataSize, - const uint32 dataOffset) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - - this->_attachmentNumber = attachmentNumber; - this->_partNumber = partNumber; - this->_dataSize = dataSize; - this->_dataOffset = dataOffset; - _isInitialized = true; -} - -/** - * @return the attachmentNumber - */ -uint16 CMessagePartDescriptor::getAttachmentNumber() const { - CAF_CM_FUNCNAME_VALIDATE("getAttachmentNumber"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _attachmentNumber; -} - -std::string CMessagePartDescriptor::getAttachmentNumberStr() const { - CAF_CM_FUNCNAME_VALIDATE("getAttachmentNumber"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return CStringConv::toString(_attachmentNumber); -} - -/** - * @return the partNumber - */ -uint32 CMessagePartDescriptor::getPartNumber() const { - CAF_CM_FUNCNAME_VALIDATE("getPartNumber"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _partNumber; -} - -/** - * @return the dataSize - */ -uint32 CMessagePartDescriptor::getDataSize() const { - CAF_CM_FUNCNAME_VALIDATE("getDataSize"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _dataSize; -} - -/** - * @return the dataOffset - */ -uint32 CMessagePartDescriptor::getDataOffset() const { - CAF_CM_FUNCNAME_VALIDATE("getDataOffset"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _dataOffset; -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CMessagePartDescriptorCalculator.cpp b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CMessagePartDescriptorCalculator.cpp deleted file mode 100644 index c287225c1..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CMessagePartDescriptorCalculator.cpp +++ /dev/null @@ -1,218 +0,0 @@ -/* - * Created on: Nov 19, 2014 - * Author: bwilliams - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "CMessagePartDescriptorSourceRecord.h" -#include "CMessagePartRecord.h" -#include "Doc/CafCoreTypesDoc/CAttachmentDoc.h" -#include "Doc/PayloadEnvelopeDoc/CPayloadEnvelopeDoc.h" -#include "Memory/DynamicArray/DynamicArrayInc.h" -#include "Exception/CCafException.h" -#include "CMessagePartDescriptorCalculator.h" -#include "Integration/Caf/CCafMessagePayloadParser.h" -#include "Integration/Caf/CCafMessagePayload.h" -#include "Integration/Caf/CCafMessageCreator.h" - -using namespace Caf; - -uint32 CMessagePartDescriptorCalculator::getMaxPartSize() { - return AppConfigUtils::getRequiredUint32("communication_amqp", "max_part_size"); -} - -std::deque CMessagePartDescriptorCalculator::calculateSourcePartRecords( - const SmartPtrCDynamicByteArray& payload) { - CAF_CM_STATIC_FUNC_VALIDATE("CMessagePartDescriptorCalculator", "calculateSourcePartRecords"); - CAF_CM_VALIDATE_SMARTPTR(payload); - - const std::string workingDirectory = AppConfigUtils::getRequiredString("communication_amqp", - _sConfigWorkingDir); - - return refactorMessageIntoPartRecords(workingDirectory, payload); -} - -/* - * Parse the local file attachments and message body into records - * reflecting the full size of each part. - */ -std::deque CMessagePartDescriptorCalculator::refactorMessageIntoPartRecords( - const std::string& workingDirectory, - const SmartPtrCDynamicByteArray& payload) { - CAF_CM_STATIC_FUNC_LOG("CMessagePartDescriptorCalculator", "refactorMessageIntoPartRecords"); - CAF_CM_VALIDATE_STRING(workingDirectory); - CAF_CM_VALIDATE_SMARTPTR(payload); - // attachmentCollectionDoc is optional - - const SmartPtrCPayloadEnvelopeDoc payloadEnvelope = - CCafMessagePayloadParser::getPayloadEnvelope(payload); - - const std::deque sourceAttachments = - payloadEnvelope->getAttachmentCollection()->getAttachment(); - - // Scan the attachment collection and create part records for - // any local file attachments that need to be transmitted. - std::deque messageParts; - std::deque refactoredAttachments; - if (!sourceAttachments.empty()) { - int16 attachmentNumber = 1; - for (TConstIterator > sourceAttachmentIter(sourceAttachments); - sourceAttachmentIter; sourceAttachmentIter++) { - const SmartPtrCAttachmentDoc attachment = *sourceAttachmentIter; - - UriUtils::SUriRecord uriRecord; - UriUtils::parseUriString(attachment->getUri(), uriRecord); - - if ((uriRecord.protocol.compare("file") == 0) && !attachment->getIsReference()) { - CAF_CM_LOG_DEBUG_VA1("Processing local file attachment - uri: %s", - attachment->getUri().c_str()); - - UriUtils::SFileUriRecord fileUriRecord; - UriUtils::parseFileAddress(uriRecord.address, fileUriRecord); - const std::string attachmentPath = fileUriRecord.path; - - if (!FileSystemUtils::doesFileExist(attachmentPath)) { - CAF_CM_EXCEPTION_VA1(ERROR_FILE_NOT_FOUND, - "File not found - %s", attachmentPath.c_str()); - } - - const int64 fileSize = FileSystemUtils::getFileSize(attachmentPath); - CAF_CM_LOG_DEBUG_VA2("Processing local file attachment - file: %s, size: %d", - attachmentPath.c_str(), fileSize); - - SmartPtrCMessagePartRecord messagePart; - messagePart.CreateInstance(); - messagePart->initialize(attachmentNumber, attachmentPath, 0, fileSize); - messageParts.push_back(messagePart); - - const std::string newAttachmentUri = UriUtils::appendParameters( - "attachment:/" + CStringConv::toString(attachmentNumber), - uriRecord.parameters); - - CAF_CM_LOG_DEBUG_VA1("New attachment URI - %s", newAttachmentUri.c_str()); - - SmartPtrCAttachmentDoc attachmentNew; - attachmentNew.CreateInstance(); - attachmentNew->initialize(attachment->getName(), attachment->getType(), - newAttachmentUri, attachment->getIsReference(), - attachment->getCmsPolicy()); - - refactoredAttachments.push_back(attachmentNew); - ++attachmentNumber; - } else { - refactoredAttachments.push_back(attachment); - } - } - } - - // If there are local file attachments to send then rebuild the message - // with the refactored attribute collection. - SmartPtrCDynamicByteArray payloadNew = payload; - if (!messageParts.empty()) { - payloadNew = CCafMessageCreator::createPayloadEnvelope( - payloadEnvelope, refactoredAttachments)->getPayload(); - } - - // Does the payload itself need to be split? - // If it is larger than max_part_size OR if there are transmitted attachments then 'yes' - const std::string newPayload = - CStringUtils::trim(CCafMessagePayload::saveToStr(payloadNew)); - if ((newPayload.length() > getMaxPartSize()) || ! messageParts.empty()) { - // Save the new payload to a file - const std::string requestIdStr = - BasePlatform::UuidToString(payloadEnvelope->getRequestId()); - const std::string payloadFileName = requestIdStr + "-payload.xml"; - const std::string payloadFile = FileSystemUtils::buildPath( - workingDirectory, payloadFileName); - FileSystemUtils::saveTextFile(payloadFile, newPayload); - - SmartPtrCMessagePartRecord messagePart; - messagePart.CreateInstance(); - messagePart->initialize(0, payloadFile, 0, newPayload.length()); - - messageParts.push_back(messagePart); - } - - // If there are MessagePartRecords then split them apart into - // MessagePartSourceRecords and return them else there is no - // splitting required. - if (!messageParts.empty()) { - return splitMessagePartRecords(messageParts); - } else { - return std::deque(); - } -} - -/* - * Split the message part records such that all parts will contain - * at most max_part_size bytes. - */ -std::deque CMessagePartDescriptorCalculator::splitMessagePartRecords( - std::deque& messageParts) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CMessagePartDescriptorCalculator", "splitMessagePartRecords"); - CAF_CM_VALIDATE_STL(messageParts); - - if (CAF_CM_IS_LOG_DEBUG_ENABLED) { - CAF_CM_LOG_DEBUG_VA0("Message part records"); - for (TConstIterator > messagePartIter(messageParts); - messagePartIter; messagePartIter++) { - const SmartPtrCMessagePartRecord messagePart = *messagePartIter; - CAF_CM_LOG_DEBUG_VA4( - "Message part - attachmentNumber: %d, filePath: %s, dataLength: %d, dataOffset: %d", - messagePart->getAttachmentNumber(), messagePart->getFilePath().c_str(), - messagePart->getDataLength(), messagePart->getDataOffset()); - } - } - - std::deque packedSourceRecords; - - uint64 currentPartSize = 0; - std::deque::iterator messagePartIter = messageParts.begin(); - while (messagePartIter != messageParts.end()) { - const SmartPtrCMessagePartRecord messagePart = *messagePartIter; - - const uint64 availablePartBytes = - messagePart->getDataLength() > LONG_MAX - ? LONG_MAX : messagePart->getDataLength(); - const uint64 fillBytes = MIN(getMaxPartSize() - currentPartSize, availablePartBytes); - - SmartPtrCMessagePartDescriptorSourceRecord sourceRecord; - sourceRecord.CreateInstance(); - sourceRecord->initialize(messagePart->getAttachmentNumber(), - messagePart->getFilePath(), static_cast(messagePart->getDataOffset()), static_cast(fillBytes)); - - packedSourceRecords.push_back(sourceRecord); - - currentPartSize += fillBytes; - messagePart->setDataOffset(messagePart->getDataOffset() + fillBytes); - messagePart->setDataLength(messagePart->getDataLength() - fillBytes); - if (messagePart->getDataLength() == 0) { - messagePartIter = messageParts.erase(messagePartIter); - } else { - ++messagePartIter; - } - - if (currentPartSize == getMaxPartSize()) { - currentPartSize = 0; - } - } - - if (CAF_CM_IS_LOG_DEBUG_ENABLED) { - CAF_CM_LOG_DEBUG_VA0("Split message part descriptor source records"); - for (TConstIterator > packedSourceRecordIter(packedSourceRecords); - packedSourceRecordIter; packedSourceRecordIter++) { - const SmartPtrCMessagePartDescriptorSourceRecord packedSourceRecord = - *packedSourceRecordIter; - CAF_CM_LOG_DEBUG_VA4( - "Packed source - attachmentNumber: %d, filePath: %s, dataLength: %d, dataOffset: %d", - packedSourceRecord->getAttachmentNumber(), - packedSourceRecord->getFilePath().c_str(), - packedSourceRecord->getDataLength(), packedSourceRecord->getDataOffset()); - } - } - - return packedSourceRecords; -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CMessagePartDescriptorCalculator.h b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CMessagePartDescriptorCalculator.h deleted file mode 100644 index f98505aee..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CMessagePartDescriptorCalculator.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Created on: Nov 19, 2014 - * Author: bwilliams - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CMessagePartDescriptorCalculator_h -#define CMessagePartDescriptorCalculator_h - - -#include "CMessagePartDescriptorSourceRecord.h" -#include "CMessagePartRecord.h" -#include "Memory/DynamicArray/DynamicArrayInc.h" - -namespace Caf { - -class CMessagePartDescriptorCalculator { -public: - static uint32 getMaxPartSize(); - - static std::deque calculateSourcePartRecords( - const SmartPtrCDynamicByteArray& payload); - -private: - static std::deque refactorMessageIntoPartRecords( - const std::string& workingDirectory, - const SmartPtrCDynamicByteArray& payload); - - static std::deque splitMessagePartRecords( - std::deque& messageParts); - -private: - CAF_CM_DECLARE_NOCREATE(CMessagePartDescriptorCalculator); -}; - -} - -#endif /* CMessagePartDescriptorCalculator_h */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CMessagePartDescriptorSourceRecord.cpp b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CMessagePartDescriptorSourceRecord.cpp deleted file mode 100644 index 8ae20a8d5..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CMessagePartDescriptorSourceRecord.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Created on: Nov 26, 2014 - * Author: bwilliams - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "CMessagePartDescriptorSourceRecord.h" - -using namespace Caf; - -CMessagePartDescriptorSourceRecord::CMessagePartDescriptorSourceRecord() : - _isInitialized(false), - _attachmentNumber(0), - _dataOffset(0), - _dataLength(0), - CAF_CM_INIT("CMessagePartDescriptorSourceRecord") { -} - -CMessagePartDescriptorSourceRecord::~CMessagePartDescriptorSourceRecord() { -} - -void CMessagePartDescriptorSourceRecord::initialize( - const uint16 attachmentNumber, - const std::string filePath, - const uint32 dataOffset, - const uint32 dataLength) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - - _attachmentNumber = attachmentNumber; - _filePath = filePath; - _dataOffset = dataOffset; - _dataLength = dataLength; - _isInitialized = true; -} - -uint16 CMessagePartDescriptorSourceRecord::getAttachmentNumber() const { - CAF_CM_FUNCNAME_VALIDATE("getAttachmentNumber"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _attachmentNumber; -} - -std::string CMessagePartDescriptorSourceRecord::getFilePath() const { - CAF_CM_FUNCNAME_VALIDATE("getFilePath"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _filePath; -} - -uint32 CMessagePartDescriptorSourceRecord::getDataOffset() const { - CAF_CM_FUNCNAME_VALIDATE("getDataOffset"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _dataOffset; -} - -uint32 CMessagePartDescriptorSourceRecord::getDataLength() const { - CAF_CM_FUNCNAME_VALIDATE("getDataLength"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _dataLength; -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CMessagePartRecord.cpp b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CMessagePartRecord.cpp deleted file mode 100644 index ab6fc505f..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CMessagePartRecord.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Created on: Nov 26, 2014 - * Author: bwilliams - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "CMessagePartRecord.h" - -using namespace Caf; - -CMessagePartRecord::CMessagePartRecord() : - _isInitialized(false), - _attachmentNumber(0), - _dataOffset(0), - _dataLength(0), - CAF_CM_INIT("CMessagePartRecord") { -} - -CMessagePartRecord::~CMessagePartRecord() { -} - -void CMessagePartRecord::initialize( - const uint16 attachmentNumber, - const std::string filePath, - const uint64 dataOffset, - const uint64 dataLength) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - - _attachmentNumber = attachmentNumber; - _filePath = filePath; - _dataOffset = dataOffset; - _dataLength = dataLength; - _isInitialized = true; -} - -uint16 CMessagePartRecord::getAttachmentNumber() const { - CAF_CM_FUNCNAME_VALIDATE("getAttachmentNumber"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _attachmentNumber; -} - -std::string CMessagePartRecord::getFilePath() const { - CAF_CM_FUNCNAME_VALIDATE("getFilePath"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _filePath; -} - -uint64 CMessagePartRecord::getDataOffset() const { - CAF_CM_FUNCNAME_VALIDATE("getDataOffset"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _dataOffset; -} - -uint64 CMessagePartRecord::getDataLength() const { - CAF_CM_FUNCNAME_VALIDATE("getDataLength"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _dataLength; -} - -void CMessagePartRecord::setAttachmentNumber(const uint16 attachmentNumber) { - CAF_CM_FUNCNAME_VALIDATE("setAttachmentNumber"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - _attachmentNumber = attachmentNumber; -} - -void CMessagePartRecord::setFilePath(const std::string& filePath) { - CAF_CM_FUNCNAME_VALIDATE("setFilePath"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - _filePath = filePath; -} - -void CMessagePartRecord::setDataOffset(const uint64 dataOffset) { - CAF_CM_FUNCNAME_VALIDATE("setDataOffset"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - _dataOffset = dataOffset; -} - -void CMessagePartRecord::setDataLength(const uint64 dataLength) { - CAF_CM_FUNCNAME_VALIDATE("setDataLength"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - _dataLength = dataLength; -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CMessagePartsBuilder.cpp b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CMessagePartsBuilder.cpp deleted file mode 100644 index 6ba733e73..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CMessagePartsBuilder.cpp +++ /dev/null @@ -1,114 +0,0 @@ -/* Created on: Nov 19, 2014 - * Author: bwilliams - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Memory/DynamicArray/DynamicArrayInc.h" -#include "CMessagePartsBuilder.h" - -using namespace Caf; - -void CMessagePartsBuilder::put( - const byte value, - SmartPtrCDynamicByteArray& buffer) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CMessagePartsBuilder", "put(byte)"); - CAF_CM_VALIDATE_SMARTPTR(buffer); - -// const size_t currentPos = buffer->getByteCount() - buffer->getByteCountFromCurrentPos(); - - buffer->memAppend(&value, sizeof(value)); - -// CAF_CM_LOG_DEBUG_VA2("buffer - pos: %d, val: %02x", currentPos, value); -} - -void CMessagePartsBuilder::put( - const uint16 value, - SmartPtrCDynamicByteArray& buffer) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CMessagePartsBuilder", "put(uint16)"); - CAF_CM_VALIDATE_SMARTPTR(buffer); - -// const size_t currentPos = buffer->getByteCount() - buffer->getByteCountFromCurrentPos(); - - byte buf[2]; - buf[0] = value >> 8; - buf[1] = value >> 0; - putBytes(buf, 2, buffer); - -// CAF_CM_LOG_DEBUG_VA4("buffer - pos: %d, val: %04x, buf: %02x %02x", currentPos, value, buf[0], buf[1]); -} - -void CMessagePartsBuilder::put( - const uint32 value, - SmartPtrCDynamicByteArray& buffer) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CMessagePartsBuilder", "put(uint32)"); - CAF_CM_VALIDATE_SMARTPTR(buffer); - -// const size_t currentPos = buffer->getByteCount() - buffer->getByteCountFromCurrentPos(); - - byte buf[4]; - buf[0] = value >> 24; - buf[1] = value >> 16; - buf[2] = value >> 8; - buf[3] = value >> 0; - putBytes(buf, 4, buffer); - -// CAF_CM_LOG_DEBUG_VA6("buffer - pos: %d, val: %08x, buf: %02x %02x %02x %02x", currentPos, value, buf[0], buf[1], buf[2], buf[3]); -} - -void CMessagePartsBuilder::put( - const uint64 value, - SmartPtrCDynamicByteArray& buffer) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CMessagePartsBuilder", "put(uint64)"); - CAF_CM_VALIDATE_SMARTPTR(buffer); - -// const size_t currentPos = buffer->getByteCount() - buffer->getByteCountFromCurrentPos(); - - byte buf[8]; -#ifdef WIN32 -#pragma warning(push) -#pragma warning(disable: 4244) -#endif - buf[0] = value >> 56; - buf[1] = value >> 48; - buf[2] = value >> 40; - buf[3] = value >> 32; - buf[4] = value >> 24; - buf[5] = value >> 16; - buf[6] = value >> 8; - buf[7] = value >> 0; -#ifdef WIN32 -#pragma warning(pop) -#endif - putBytes(buf, 8, buffer); - -// CAF_CM_LOG_DEBUG_VA6("buffer - pos: %d, val: %016x, buf: %02x %02x %02x %02x", currentPos, value, buf[0], buf[1], buf[2], buf[3]); -// CAF_CM_LOG_DEBUG_VA6("buffer - pos: %d, val: %016x, buf: %02x %02x %02x %02x", currentPos, value, buf[4], buf[5], buf[6], buf[7]); -} - -void CMessagePartsBuilder::put( - const UUID value, - SmartPtrCDynamicByteArray& buffer) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CMessagePartsBuilder", "put(UUID)"); - CAF_CM_VALIDATE_SMARTPTR(buffer); - - put(static_cast(value.Data1), buffer); - put(static_cast(value.Data2), buffer); - put(static_cast(value.Data3), buffer); - putBytes(value.Data4, 8, buffer); -} - -void CMessagePartsBuilder::putBytes( - const byte* buf, - const uint32 bufLen, - SmartPtrCDynamicByteArray& buffer) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CMessagePartsBuilder", "putBytes"); - CAF_CM_VALIDATE_PTR(buf); - CAF_CM_VALIDATE_SMARTPTR(buffer); - - for (uint32 index = 0; index < bufLen; index++) { - buffer->memAppend(&buf[index], sizeof(buf[index])); - } -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CMessagePartsBuilder.h b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CMessagePartsBuilder.h deleted file mode 100644 index 2e801e27c..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CMessagePartsBuilder.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Created on: Nov 19, 2014 - * Author: bwilliams - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CMessagePartsBuilder_h -#define CMessagePartsBuilder_h - - -#include "Memory/DynamicArray/DynamicArrayInc.h" - -namespace Caf { - -/** - * Class that emits and parses message parts header blocks.
- */ -class CMessagePartsBuilder { -public: - static void put(const byte value, SmartPtrCDynamicByteArray& buffer); - static void put(const uint16 value, SmartPtrCDynamicByteArray& buffer); - static void put(const uint32 value, SmartPtrCDynamicByteArray& buffer); - static void put(const uint64 value, SmartPtrCDynamicByteArray& buffer); - static void put(const GUID value, SmartPtrCDynamicByteArray& buffer); - -private: - static void putBytes(const byte* buf, const uint32 bufLen, - SmartPtrCDynamicByteArray& buffer); - -private: - CAF_CM_DECLARE_NOCREATE(CMessagePartsBuilder); -}; - -} - -#endif /* CMessagePartsBuilder_h */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CMessagePartsHeader.cpp b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CMessagePartsHeader.cpp deleted file mode 100644 index 1232fc024..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CMessagePartsHeader.cpp +++ /dev/null @@ -1,154 +0,0 @@ -/* Created on: Nov 19, 2014 - * Author: bwilliams - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Memory/DynamicArray/DynamicArrayInc.h" -#include "CMessagePartsHeader.h" -#include "Exception/CCafException.h" - -using namespace Caf; - -/** - * Converts the BLOCK_SIZE data in a ByteBuffer into a MessagePartsHeader - *

- * The incoming ByteBuffer position will be modified. - * @param buffer ByteBuffer to convert - * @return a MessagePartsHeader - */ -SmartPtrCMessagePartsHeader CMessagePartsHeader::fromByteBuffer( - SmartPtrCDynamicByteArray& buffer) { - CAF_CM_STATIC_FUNC_LOG("CMessagePartsHeader", "fromByteBuffer"); - CAF_CM_VALIDATE_SMARTPTR(buffer); - - if (buffer->getByteCountFromCurrentPos() < BLOCK_SIZE) { - CAF_CM_EXCEPTION_VA2(E_INVALIDARG, - "Input data block is too small - rem: %d, tot: %d", - buffer->getByteCountFromCurrentPos(), buffer->getByteCount()); - } - - SmartPtrCDynamicByteArray data; - data.CreateInstance(); - data->allocateBytes(BLOCK_SIZE); - data->memCpy(buffer->getPtrAtCurrentPos(), BLOCK_SIZE); - - buffer->incrementCurrentPos(BLOCK_SIZE); - - return fromArray(data); -} - -/** - * Converts a byte array into a MessagePartsHeader - * @param blockData byte array to convert - * @return a MessagePartsHeader - */ -SmartPtrCMessagePartsHeader CMessagePartsHeader::fromArray( - SmartPtrCDynamicByteArray& buffer) { - CAF_CM_STATIC_FUNC_LOG("CMessagePartsHeader", "fromArray"); - CAF_CM_VALIDATE_SMARTPTR(buffer); - - if (buffer->getByteCount() < BLOCK_SIZE) { - CAF_CM_EXCEPTION_VA1(E_INVALIDARG, "Input data block is too small - %d", - buffer->getByteCount()); - } - - const int32 version = CMessagePartsParser::getByte(buffer); - if (version != CAF_MSG_VERSION) { - CAF_CM_EXCEPTION_VA2(E_INVALIDARG, "Input data block version is incorrect: %d != %d", version, CAF_MSG_VERSION); - } - - const byte resvd1 = CMessagePartsParser::getByte(buffer); - const byte resvd2 = CMessagePartsParser::getByte(buffer); - const byte resvd3 = CMessagePartsParser::getByte(buffer); - if (resvd1 != RESERVED1 || resvd2 != RESERVED2 || resvd3 != RESERVED3) { - CAF_CM_EXCEPTION_VA0(E_INVALIDARG, "Input data block reserved bits are incorrect"); - } - - const UUID correlationId = CMessagePartsParser::getGuid(buffer); - const uint32 numberOfParts = CMessagePartsParser::getUint32(buffer); - buffer->verify(); - - SmartPtrCMessagePartsHeader messagePartsHeader; - messagePartsHeader.CreateInstance(); - messagePartsHeader->initialize(correlationId, numberOfParts); - - return messagePartsHeader; -} - -/** - * Create a byte array representation of a descriptor block - * @param correlationId the correlation id - * @param numberOfParts the number of message parts - * @return the byte array containing the encoded data - */ -SmartPtrCDynamicByteArray CMessagePartsHeader::toArray( - const UUID correlationId, - const uint32 numberOfParts) { - SmartPtrCDynamicByteArray buffer; - buffer.CreateInstance(); - buffer->allocateBytes(BLOCK_SIZE); - - CMessagePartsBuilder::put(CAF_MSG_VERSION, buffer); - CMessagePartsBuilder::put(RESERVED1, buffer); - CMessagePartsBuilder::put(RESERVED2, buffer); - CMessagePartsBuilder::put(RESERVED3, buffer); - CMessagePartsBuilder::put(correlationId, buffer); - CMessagePartsBuilder::put(numberOfParts, buffer); - buffer->verify(); - - return buffer; -} - -CMessagePartsHeader::CMessagePartsHeader() : - _isInitialized(false), - _correlationId(CAFCOMMON_GUID_NULL), - _numberOfParts(0), - CAF_CM_INIT("CMessagePartsHeader") { -} - -CMessagePartsHeader::~CMessagePartsHeader() { -} - -void CMessagePartsHeader::initialize( - const UUID correlationId, - const uint32 numberOfParts) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - - this->_correlationId = correlationId; - this->_numberOfParts = numberOfParts; - _isInitialized = true; -} - -/** - * @return the correlationId - */ -UUID CMessagePartsHeader::getCorrelationId() const { - CAF_CM_FUNCNAME_VALIDATE("getCorrelationId"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _correlationId; -} - -/** - * @return the correlationId - */ -std::string CMessagePartsHeader::getCorrelationIdStr() const { - CAF_CM_FUNCNAME_VALIDATE("getCorrelationId"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return BasePlatform::UuidToString(_correlationId); -} - -/** - * @return the numberOfParts - */ -uint32 CMessagePartsHeader::getNumberOfParts() const { - CAF_CM_FUNCNAME_VALIDATE("getNumberOfParts"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _numberOfParts; -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CMessagePartsParser.cpp b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CMessagePartsParser.cpp deleted file mode 100644 index d8a80ae73..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CMessagePartsParser.cpp +++ /dev/null @@ -1,164 +0,0 @@ -/* Created on: Nov 19, 2014 - * Author: bwilliams - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Memory/DynamicArray/DynamicArrayInc.h" -#include "CMessagePartsParser.h" - -using namespace Caf; - -byte CMessagePartsParser::getByte(SmartPtrCDynamicByteArray& buffer) { - CAF_CM_STATIC_FUNC_VALIDATE("CMessagePartsParser", "getByte"); - CAF_CM_VALIDATE_SMARTPTR(buffer); - -// const size_t currentPos = buffer->getByteCount() - buffer->getByteCountFromCurrentPos(); - - const byte rc = buffer->getAtCurrentPos(); - buffer->incrementCurrentPos(1); - -// CAF_CM_LOG_DEBUG_VA2("buffer - pos: %d, val: %02x", currentPos, rc); - - return rc; -} - -uint16 CMessagePartsParser::getUint16(SmartPtrCDynamicByteArray& buffer) { - CAF_CM_STATIC_FUNC_VALIDATE("CMessagePartsParser", "getUint16"); - CAF_CM_VALIDATE_SMARTPTR(buffer); - -// const size_t currentPos = buffer->getByteCount() - buffer->getByteCountFromCurrentPos(); - - byte buf[2]; - buf[0] = buffer->getAtCurrentPos(); - buffer->incrementCurrentPos(1); - buf[1] = buffer->getAtCurrentPos(); - buffer->incrementCurrentPos(1); - - // Little and Big Endian - //const uint16 val = (buf[0]<<0) | (buf[1]<<8); - const uint16 val = (buf[0]<<8) | (buf[1]<<0); - -// CAF_CM_LOG_DEBUG_VA4("buffer - pos: %d, val: %04x, buf: %02x %02x", currentPos, val, buf[0], buf[1]); - - return val; -} - -uint32 CMessagePartsParser::getUint32(SmartPtrCDynamicByteArray& buffer) { - CAF_CM_STATIC_FUNC_VALIDATE("CMessagePartsParser", "getUint32"); - CAF_CM_VALIDATE_SMARTPTR(buffer); - -// const size_t currentPos = buffer->getByteCount() - buffer->getByteCountFromCurrentPos(); - - byte buf[4]; - buf[0] = buffer->getAtCurrentPos(); - buffer->incrementCurrentPos(1); - buf[1] = buffer->getAtCurrentPos(); - buffer->incrementCurrentPos(1); - buf[2] = buffer->getAtCurrentPos(); - buffer->incrementCurrentPos(1); - buf[3] = buffer->getAtCurrentPos(); - buffer->incrementCurrentPos(1); - - // Little and Big Endian - //const uint32 val = (buf[0]<<0) | (buf[1]<<8) | (buf[2]<<16) | (buf[3]<<24); - const uint32 val = (buf[0]<<24) | (buf[1]<<16) | (buf[2]<<8) | (buf[3]<<0); - -// CAF_CM_LOG_DEBUG_VA6("buffer - pos: %d, val: %08x, buf: %02x %02x %02x %02x", currentPos, val, buf[0], buf[1], buf[2], buf[3]); - - return val; -} - -uint64 CMessagePartsParser::getUint64(SmartPtrCDynamicByteArray& buffer) { - CAF_CM_STATIC_FUNC_VALIDATE("CMessagePartsParser", "getUint64"); - CAF_CM_VALIDATE_SMARTPTR(buffer); - -// const size_t currentPos = buffer->getByteCount() - buffer->getByteCountFromCurrentPos(); - - byte buf[8]; - buf[0] = buffer->getAtCurrentPos(); - buffer->incrementCurrentPos(1); - buf[1] = buffer->getAtCurrentPos(); - buffer->incrementCurrentPos(1); - buf[2] = buffer->getAtCurrentPos(); - buffer->incrementCurrentPos(1); - buf[3] = buffer->getAtCurrentPos(); - buffer->incrementCurrentPos(1); - buf[4] = buffer->getAtCurrentPos(); - buffer->incrementCurrentPos(1); - buf[5] = buffer->getAtCurrentPos(); - buffer->incrementCurrentPos(1); - buf[6] = buffer->getAtCurrentPos(); - buffer->incrementCurrentPos(1); - buf[7] = buffer->getAtCurrentPos(); - buffer->incrementCurrentPos(1); - - // Little and Big Endian -// const uint64 val = -// (buf[0]<<0) -// | (buf[1]<<8) -// | (buf[2]<<16) -// | (buf[3]<<24) -// | (static_cast(buf[4])<<32) -// | (static_cast(buf[5])<<40) -// | (static_cast(buf[6])<<48) -// | (static_cast(buf[7])<<56); - const uint64 val = - (static_cast(buf[0])<<56) - | (static_cast(buf[1])<<48) - | (static_cast(buf[2])<<40) - | (static_cast(buf[3])<<32) - | (buf[4]<<24) - | (buf[5]<<16) - | (buf[6]<<8) - | (buf[7]<<0); - -// CAF_CM_LOG_DEBUG_VA6("buffer - pos: %d, val: %016x, buf: %02x %02x %02x %02x", currentPos, val, buf[0], buf[1], buf[2], buf[3]); -// CAF_CM_LOG_DEBUG_VA6("buffer - pos: %d, val: %016x, buf: %02x %02x %02x %02x", currentPos, val, buf[4], buf[5], buf[6], buf[7]); - - return val; -} - -UUID CMessagePartsParser::getGuid(SmartPtrCDynamicByteArray& buffer) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CMessagePartsParser", "getGuid"); - CAF_CM_VALIDATE_SMARTPTR(buffer); - - UUID guid; - guid.Data1 = getUint32(buffer); - guid.Data2 = getUint16(buffer); - guid.Data3 = getUint16(buffer); - get8Bytes(buffer, guid.Data4); - - CAF_CM_LOG_DEBUG_VA1("guid - %s", BasePlatform::UuidToString(guid).c_str()); - - return guid; -} - -void CMessagePartsParser::get8Bytes(SmartPtrCDynamicByteArray& buffer, byte* buf) { - CAF_CM_STATIC_FUNC_VALIDATE("CMessagePartsParser", "get8Bytes"); - CAF_CM_VALIDATE_SMARTPTR(buffer); - -// const size_t currentPos = buffer->getByteCount() - buffer->getByteCountFromCurrentPos(); - - buf[0] = buffer->getAtCurrentPos(); - buffer->incrementCurrentPos(1); - buf[1] = buffer->getAtCurrentPos(); - buffer->incrementCurrentPos(1); - buf[2] = buffer->getAtCurrentPos(); - buffer->incrementCurrentPos(1); - buf[3] = buffer->getAtCurrentPos(); - buffer->incrementCurrentPos(1); - buf[4] = buffer->getAtCurrentPos(); - buffer->incrementCurrentPos(1); - buf[5] = buffer->getAtCurrentPos(); - buffer->incrementCurrentPos(1); - buf[6] = buffer->getAtCurrentPos(); - buffer->incrementCurrentPos(1); - buf[7] = buffer->getAtCurrentPos(); - buffer->incrementCurrentPos(1); - -// CAF_CM_LOG_DEBUG_VA5("buffer - pos: %d, buf: %02x %02x %02x %02x", currentPos, buf[0], buf[1], buf[2], buf[3]); -// CAF_CM_LOG_DEBUG_VA5("buffer - pos: %d, buf: %02x %02x %02x %02x", currentPos, buf[4], buf[5], buf[6], buf[7]); -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CMessagePartsParser.h b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CMessagePartsParser.h deleted file mode 100644 index 91ef0b504..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CMessagePartsParser.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Created on: Nov 19, 2014 - * Author: bwilliams - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CMessagePartsParser_h -#define CMessagePartsParser_h - - -#include "Memory/DynamicArray/DynamicArrayInc.h" - -namespace Caf { - -/** - * Class that emits and parses message parts header blocks.
- */ -class CMessagePartsParser { -public: - static byte getByte(SmartPtrCDynamicByteArray& buffer); - static uint16 getUint16(SmartPtrCDynamicByteArray& buffer); - static uint32 getUint32(SmartPtrCDynamicByteArray& buffer); - static uint64 getUint64(SmartPtrCDynamicByteArray& buffer); - static UUID getGuid(SmartPtrCDynamicByteArray& buffer); - static void get8Bytes(SmartPtrCDynamicByteArray& buffer, byte* data); - -private: - CAF_CM_DECLARE_NOCREATE(CMessagePartsParser); -}; - -} - -#endif /* CMessagePartsParser_h */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/COutgoingMessageHandler.cpp b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/COutgoingMessageHandler.cpp deleted file mode 100644 index df799d4e3..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/COutgoingMessageHandler.cpp +++ /dev/null @@ -1,260 +0,0 @@ -/* - * Created on: Nov 25, 2014 - * Author: bwilliams - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "CMessageDeliveryRecord.h" -#include "CMessagePartDescriptorSourceRecord.h" -#include "Doc/PayloadEnvelopeDoc/CPayloadEnvelopeDoc.h" -#include "Integration/Core/CIntMessage.h" -#include "Integration/IIntMessage.h" -#include "Memory/DynamicArray/DynamicArrayInc.h" -#include "Integration/Core/CIntMessageHeaders.h" -#include "Exception/CCafException.h" -#include "COutgoingMessageHandler.h" -#include "CMessagePartsHeader.h" -#include "CMessagePartDescriptor.h" -#include "amqpCore/DefaultAmqpHeaderMapper.h" -#include "Integration/Caf/CCafMessagePayloadParser.h" -#include "Integration/Core/CMessageHeaderUtils.h" -#include "Integration/Core/MessageHeaders.h" -#include "Integration/Core/CMessageHeaderUtils.h" - -#include - -using namespace Caf; - -COutgoingMessageHandler::COutgoingMessageHandler() : - _isInitialized(false), - CAF_CM_INIT_LOG("COutgoingMessageHandler") { -} - -COutgoingMessageHandler::~COutgoingMessageHandler() { -} - -void COutgoingMessageHandler::initializeBean( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties) { - CAF_CM_FUNCNAME_VALIDATE("initializeBean"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STL_EMPTY(ctorArgs); - CAF_CM_VALIDATE_STL_EMPTY(properties); - - _isInitialized = true; -} - -void COutgoingMessageHandler::terminateBean() { -} - -/** - * Handles the incoming management request message - *

- * Incoming messages are checked for local attachments that need to be transmitted. - * If the resulting message would be too large to transmit then multiple message - * records are created and stored for the {@link OutgoingMessageProducer} to handle. If the - * message is small enough to fit in a single transmission then it will be returned - * from this handler if a message receipt is not requested. - * - * @param message the incoming management request message - * @return null if the message must be transmitted as multiple parts or the message itself if it can be transmitted as is - */ -SmartPtrIIntMessage COutgoingMessageHandler::processMessage( - const SmartPtrIIntMessage& message) { - CAF_CM_FUNCNAME("processMessage"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(message); - - SmartPtrIIntMessage rc; - - const SmartPtrCPayloadEnvelopeDoc payloadEnvelope = - CCafMessagePayloadParser::getPayloadEnvelope(message->getPayload()); - - // Touch up the outgoing message headers first so that they are - // preserved through the rest of the system. - IIntMessage::SmartPtrCHeaders headers = message->getHeaders(); - - std::deque messagePartSourceRecords = - CMessagePartDescriptorCalculator::calculateSourcePartRecords(message->getPayload()); - if (messagePartSourceRecords.empty()) { - rc = augmentHeaders(false, message); - } else { - // Message splitting required. Iterate the message parts and group them - // such that each group of parts will fill maxPartSize bytes when transmitted. - std::deque deliveryRecords; - const uint32 maxPartSize = CMessagePartDescriptorCalculator::getMaxPartSize(); - const std::string correlationIdStr = CStringUtils::createRandomUuid(); - - UUID correlationId; - BasePlatform::UuidFromString(correlationIdStr.c_str(), correlationId); - - uint32 startPartNumber = 1; - uint32 currentPartSize = 0; - std::deque deliveryParts; - for (TConstIterator > sourceRecordIter(messagePartSourceRecords); - sourceRecordIter; sourceRecordIter++) { - const SmartPtrCMessagePartDescriptorSourceRecord sourceRecord = *sourceRecordIter; - deliveryParts.push_back(sourceRecord); - currentPartSize += sourceRecord->getDataLength(); - if (currentPartSize == maxPartSize) { - if (CAF_CM_IS_LOG_DEBUG_ENABLED) { - CAF_CM_LOG_DEBUG_VA5( - "Adding message delivery record [size=%d][totalNumParts=%d][startPartNum=%d][parts=%d][correlationId=%s]", - currentPartSize, messagePartSourceRecords.size(), - startPartNumber, deliveryParts.size(), correlationIdStr.c_str()); - } - - SmartPtrCMessageDeliveryRecord deliveryRecord; - deliveryRecord.CreateInstance(); - deliveryRecord->initialize(correlationId, - static_cast(messagePartSourceRecords.size()), - startPartNumber, deliveryParts, message->getHeaders()); - - deliveryRecords.push_back(deliveryRecord); - - startPartNumber += static_cast(deliveryParts.size()); - deliveryParts.clear(); - currentPartSize = 0; - } else if (currentPartSize > maxPartSize) { - CAF_CM_EXCEPTION_VA2(ERROR_BUFFER_OVERFLOW, - "Buffer overflow - currentPartSize: %d, maxPartSize: %d", - currentPartSize, maxPartSize); - } - } - - if (currentPartSize > 0) { - if (CAF_CM_IS_LOG_DEBUG_ENABLED) { - CAF_CM_LOG_DEBUG_VA5( - "Adding message delivery record [size=%d][totalNumParts=%d][startPartNum=%d][parts=%d][correlationId=%s]", - currentPartSize, messagePartSourceRecords.size(), - startPartNumber, deliveryParts.size(), correlationIdStr.c_str()); - } - - SmartPtrCMessageDeliveryRecord deliveryRecord; - deliveryRecord.CreateInstance(); - deliveryRecord->initialize(correlationId, - static_cast(messagePartSourceRecords.size()), - startPartNumber, deliveryParts, message->getHeaders()); - - deliveryRecords.push_back(deliveryRecord); - } - - if (deliveryRecords.size() != 1) { - CAF_CM_EXCEPTION_VA1(ERROR_NOT_SUPPORTED, - "Currently supports only one delivery record (i.e. no chunking) - size: %d", - deliveryRecords.size()); - } - - const SmartPtrIIntMessage newMessage = rehydrateMultiPartMessage( - deliveryRecords.back(), IIntMessage::SmartPtrCHeaders()); - rc = augmentHeaders(true, newMessage); - } - - CMessageHeaderUtils::log(rc->getHeaders()); - - return rc; -} - -SmartPtrIIntMessage COutgoingMessageHandler::rehydrateMultiPartMessage( - const SmartPtrCMessageDeliveryRecord& deliveryRecord, - const IIntMessage::SmartPtrCHeaders& addlHeaders) { - CAF_CM_STATIC_FUNC_LOG("COutgoingMessageHandler", "rehydrateMultiPartMessage"); - CAF_CM_VALIDATE_SMARTPTR(deliveryRecord); - // addlHeaders are optional - - uint32 payloadSize = CMessagePartsHeader::BLOCK_SIZE; - const std::deque sourceRecords = deliveryRecord->getMessagePartSources(); - for (TConstIterator > sourceRecordIter(sourceRecords); - sourceRecordIter; sourceRecordIter++) { - const SmartPtrCMessagePartDescriptorSourceRecord sourceRecord = *sourceRecordIter; - payloadSize += CMessagePartDescriptor::BLOCK_SIZE + sourceRecord->getDataLength(); - } - - SmartPtrCDynamicByteArray payload; - payload.CreateInstance(); - payload->allocateBytes(payloadSize); - - const SmartPtrCDynamicByteArray partsHeader = CMessagePartsHeader::toArray( - deliveryRecord->getCorrelationId(), deliveryRecord->getNumberOfParts()); - payload->memAppend(partsHeader->getPtr(), partsHeader->getByteCount()); - - uint32 partNumber = deliveryRecord->getStartingPartNumber(); - if (CAF_CM_IS_LOG_DEBUG_ENABLED) { - CAF_CM_LOG_DEBUG_VA3("[# sourceRecords=%d][payloadSize=%d][startingPartNumber=%d]", - sourceRecords.size(), payloadSize, partNumber); - } - - for (TConstIterator > sourceRecordIter(sourceRecords); - sourceRecordIter; sourceRecordIter++) { - const SmartPtrCMessagePartDescriptorSourceRecord sourceRecord = *sourceRecordIter; - - const SmartPtrCDynamicByteArray partDescriptor = CMessagePartDescriptor::toArray( - sourceRecord->getAttachmentNumber(), partNumber++, sourceRecord->getDataLength(), - sourceRecord->getDataOffset()); - payload->memAppend(partDescriptor->getPtr(), partDescriptor->getByteCount()); - - CAF_CM_LOG_DEBUG_VA3("Reading from file - file: %s, len: %d, offset: %d", - sourceRecord->getFilePath().c_str(), sourceRecord->getDataLength(), - sourceRecord->getDataOffset()); - - std::ifstream file(sourceRecord->getFilePath().c_str(), std::ios::binary); - try { - if (!file.is_open()) { - CAF_CM_EXCEPTION_VA1(ERROR_FILE_NOT_FOUND, - "Could not open binary file - %s", sourceRecord->getFilePath().c_str()); - } - - file.seekg(sourceRecord->getDataOffset(), std::ios::beg); - file.read(reinterpret_cast(payload->getNonConstPtrAtCurrentPos()), - sourceRecord->getDataLength()); - payload->verify(); - if (! file) { - CAF_CM_EXCEPTION_VA3(ERROR_BUFFER_OVERFLOW, - "Did not read full contents - file: %s, requested: %d, read: %d", - sourceRecord->getFilePath().c_str(), sourceRecord->getDataLength(), - file.gcount()); - } - - payload->incrementCurrentPos(sourceRecord->getDataLength()); - } - CAF_CM_CATCH_ALL; - file.close(); - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_THROWEXCEPTION; - } - - SmartPtrCIntMessage rc; - rc.CreateInstance(); - rc->initialize(payload, deliveryRecord->getMessageHeaders(), addlHeaders); - - return rc; -} - -SmartPtrIIntMessage COutgoingMessageHandler::augmentHeaders( - const bool isMultiPart, - const SmartPtrIIntMessage& message) { - CAF_CM_STATIC_FUNC_VALIDATE("COutgoingMessageHandler", "augmentHeaders"); - CAF_CM_VALIDATE_INTERFACE(message); - - std::string contentType; - if (isMultiPart) { - contentType = "application/octet-stream"; - } else { - contentType = "text/plain"; - } - - CIntMessageHeaders messageHeaders; - messageHeaders.insertBool(MessageHeaders::_sMULTIPART, isMultiPart); - messageHeaders.insertString(AmqpIntegration::DefaultAmqpHeaderMapper::CONTENT_TYPE, - contentType); - - SmartPtrCIntMessage messageImpl; - messageImpl.CreateInstance(); - messageImpl->initialize(message->getPayload(), messageHeaders.getHeaders(), - message->getHeaders()); - - return messageImpl; -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/COutgoingMessageHandler.h b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/COutgoingMessageHandler.h deleted file mode 100644 index 284ce865e..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/COutgoingMessageHandler.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Created on: Nov 25, 2014 - * Author: bwilliams - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef COutgoingMessageHandler_h -#define COutgoingMessageHandler_h - - -#include "IBean.h" - -#include "CMessageDeliveryRecord.h" -#include "Integration/IIntMessage.h" -#include "Integration/IMessageProcessor.h" - -using namespace Caf; - -class COutgoingMessageHandler : - public TCafSubSystemObjectRoot, - public IBean, - public IMessageProcessor { -public: - COutgoingMessageHandler(); - virtual ~COutgoingMessageHandler(); - - CAF_DECLARE_OBJECT_IDENTIFIER(_sObjIdCommIntegrationOutgoingMessageHandler) - - CAF_BEGIN_INTERFACE_MAP(COutgoingMessageHandler) - CAF_INTERFACE_ENTRY(IBean) - CAF_INTERFACE_ENTRY(IMessageProcessor) - CAF_END_INTERFACE_MAP() - -public: // IBean - virtual void initializeBean( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties); - - virtual void terminateBean(); - -public: // IMessageProcessor - SmartPtrIIntMessage processMessage( - const SmartPtrIIntMessage& message); - -private: - static SmartPtrIIntMessage rehydrateMultiPartMessage( - const SmartPtrCMessageDeliveryRecord& deliveryRecord, - const IIntMessage::SmartPtrCHeaders& addlHeaders); - - static SmartPtrIIntMessage augmentHeaders( - const bool isMultiPart, - const SmartPtrIIntMessage& message); - -private: - bool _isInitialized; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(COutgoingMessageHandler); -}; - -#endif /* COutgoingMessageHandler_h */ - diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CProtocolHeaderEnricher.cpp b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CProtocolHeaderEnricher.cpp deleted file mode 100644 index 3c344e9ae..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CProtocolHeaderEnricher.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Integration/IDocument.h" -#include "Integration/IIntegrationObject.h" -#include "CProtocolHeaderEnricher.h" - -using namespace Caf; - -CProtocolHeaderEnricher::CProtocolHeaderEnricher() : - _isInitialized(false), - CAF_CM_INIT("CProtocolHeaderEnricher") { -} - -CProtocolHeaderEnricher::~CProtocolHeaderEnricher() { -} - -void CProtocolHeaderEnricher::initializeBean( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties) { - CAF_CM_FUNCNAME_VALIDATE("initializeBean"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STL_EMPTY(ctorArgs); - - _ctorArgs = ctorArgs; - _properties = properties; - initialize(); -} - -void CProtocolHeaderEnricher::terminateBean() { -} - -void CProtocolHeaderEnricher::initialize() { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - _isInitialized = true; -} - -bool CProtocolHeaderEnricher::isResponsible( - const SmartPtrIDocument& configSection) const { - CAF_CM_FUNCNAME_VALIDATE("isResponsible"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - - return false; -} - -SmartPtrIIntegrationObject CProtocolHeaderEnricher::createObject( - const SmartPtrIDocument& configSection) const { - CAF_CM_FUNCNAME_VALIDATE("createObject"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - - SmartPtrIIntegrationObject rc; - rc.CreateInstance(_sObjIdCommIntegrationProtocolHeaderEnricherInstance); - rc->initialize(_ctorArgs, _properties, configSection); - - return rc; -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CProtocolHeaderEnricher.h b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CProtocolHeaderEnricher.h deleted file mode 100644 index 60149a62b..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CProtocolHeaderEnricher.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CProtocolHeaderEnricher_h_ -#define CProtocolHeaderEnricher_h_ - - -#include "IBean.h" - -#include "Integration/IDocument.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/IIntegrationComponent.h" - -namespace Caf { - -/// Sends responses/errors back to the client. -class CProtocolHeaderEnricher : - public TCafSubSystemObjectRoot, - public IBean, - public IIntegrationComponent { -public: - CProtocolHeaderEnricher(); - virtual ~CProtocolHeaderEnricher(); - - CAF_DECLARE_OBJECT_IDENTIFIER(_sObjIdCommIntegrationProtocolHeaderEnricher) - - CAF_BEGIN_INTERFACE_MAP(CProtocolHeaderEnricher) - CAF_INTERFACE_ENTRY(IBean) - CAF_INTERFACE_ENTRY(IIntegrationComponent) - CAF_END_INTERFACE_MAP() - -public: - virtual void initialize(); - -public: // IBean - virtual void initializeBean(const IBean::Cargs& ctorArgs, const IBean::Cprops& properties); - - virtual void terminateBean(); - -public: // IIntegrationComponent - bool isResponsible( - const SmartPtrIDocument& configSection) const; - - SmartPtrIIntegrationObject createObject( - const SmartPtrIDocument& configSection) const; - -private: - bool _isInitialized; - IBean::Cargs _ctorArgs; - IBean::Cprops _properties; - -private: - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(CProtocolHeaderEnricher); -}; - -} - -#endif // #ifndef CProtocolHeaderEnricher_h_ diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CProtocolHeaderEnricherInstance.cpp b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CProtocolHeaderEnricherInstance.cpp deleted file mode 100644 index 442678b28..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CProtocolHeaderEnricherInstance.cpp +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Created on: Aug 16, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Integration/Caf/CCafMessageHeadersWriter.h" -#include "Common/IAppContext.h" -#include "Doc/CafCoreTypesDoc/CProtocolCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CProtocolDoc.h" -#include "Doc/PayloadEnvelopeDoc/CPayloadEnvelopeDoc.h" -#include "Integration/Core/CIntMessage.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "Exception/CCafException.h" -#include "CProtocolHeaderEnricherInstance.h" -#include "Integration/Caf/CCafMessagePayloadParser.h" - -using namespace Caf; - -CProtocolHeaderEnricherInstance::CProtocolHeaderEnricherInstance() : - _isInitialized(false), - CAF_CM_INIT_LOG("CProtocolHeaderEnricherInstance") { -} - -CProtocolHeaderEnricherInstance::~CProtocolHeaderEnricherInstance() { -} - -void CProtocolHeaderEnricherInstance::initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - _id = configSection->findRequiredAttribute("id"); - _isInitialized = true; -} - -std::string CProtocolHeaderEnricherInstance::getId() const { - CAF_CM_FUNCNAME_VALIDATE("getId"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _id; -} - -void CProtocolHeaderEnricherInstance::wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver) { - CAF_CM_FUNCNAME_VALIDATE("wire"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(appContext); -} - -SmartPtrIIntMessage CProtocolHeaderEnricherInstance::transformMessage( - const SmartPtrIIntMessage& message) { - CAF_CM_FUNCNAME_VALIDATE("transformMessage"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - const SmartPtrCPayloadEnvelopeDoc payloadEnvelope = - CCafMessagePayloadParser::getPayloadEnvelope(message->getPayload()); - - const SmartPtrCProtocolDoc protocol = findProtocol(payloadEnvelope); - - UriUtils::SUriRecord uriRecord; - UriUtils::parseUriString(protocol->getUri(), uriRecord); - - SmartPtrCCafMessageHeadersWriter messageHeadersWriter = - CCafMessageHeadersWriter::create(); - messageHeadersWriter->setProtocol(uriRecord.protocol); - messageHeadersWriter->setProtocolAddress(uriRecord.address); - - CAF_CM_LOG_DEBUG_VA2( - "Enhanced the headers - protocol: \"%s\", connStr: \"%s\"", - uriRecord.protocol.c_str(), uriRecord.address.c_str()); - - SmartPtrCIntMessage messageImpl; - messageImpl.CreateInstance(); - messageImpl->initialize(message->getPayload(), - messageHeadersWriter->getHeaders(), message->getHeaders()); - - return messageImpl; -} - -SmartPtrCProtocolDoc CProtocolHeaderEnricherInstance::findProtocol( - const SmartPtrCPayloadEnvelopeDoc& payloadEnvelope) const { - CAF_CM_FUNCNAME("findProtocol"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_SMARTPTR(payloadEnvelope); - - const SmartPtrCProtocolCollectionDoc protocolCollectionDoc = - payloadEnvelope->getProtocolCollection(); - CAF_CM_VALIDATE_SMARTPTR(protocolCollectionDoc); - - const std::deque protocolCollection = - protocolCollectionDoc->getProtocol(); - - if (protocolCollection.size() != 1) { - CAF_CM_EXCEPTION_VA1(E_NOTIMPL, - "Multiple protocols are not yet supported - %d", - protocolCollection.size()); - } - - return *(protocolCollection.begin()); -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CProtocolHeaderEnricherInstance.h b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CProtocolHeaderEnricherInstance.h deleted file mode 100644 index ca0438c9f..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CProtocolHeaderEnricherInstance.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Created on: Aug 16, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CProtocolHeaderEnricherInstance_h -#define CProtocolHeaderEnricherInstance_h - - - -#include "Integration/IIntegrationComponentInstance.h" - -#include "Common/IAppContext.h" -#include "Doc/CafCoreTypesDoc/CProtocolDoc.h" -#include "Doc/PayloadEnvelopeDoc/CPayloadEnvelopeDoc.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/ITransformer.h" - -namespace Caf { - -class CProtocolHeaderEnricherInstance : - public TCafSubSystemObjectRoot, - public IIntegrationObject, - public IIntegrationComponentInstance, - public ITransformer { -public: - CProtocolHeaderEnricherInstance(); - virtual ~CProtocolHeaderEnricherInstance(); - - CAF_DECLARE_OBJECT_IDENTIFIER(_sObjIdCommIntegrationProtocolHeaderEnricherInstance) - - CAF_BEGIN_INTERFACE_MAP(CProtocolHeaderEnricherInstance) - CAF_INTERFACE_ENTRY(IIntegrationObject) - CAF_INTERFACE_ENTRY(IIntegrationComponentInstance) - CAF_INTERFACE_ENTRY(ITransformer) - CAF_END_INTERFACE_MAP() - -public: // IIntegrationObject - void initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection); - - std::string getId() const; - -public: // IIntegrationComponentInstance - void wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver); - -public: // ITransformer - SmartPtrIIntMessage transformMessage( - const SmartPtrIIntMessage& message); - -private: - SmartPtrCProtocolDoc findProtocol( - const SmartPtrCPayloadEnvelopeDoc& payloadEnvelope) const; - -private: - bool _isInitialized; - std::string _id; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CProtocolHeaderEnricherInstance); -}; - -} - -#endif /* CProtocolHeaderEnricherInstance_h */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CReplyToCacher.cpp b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CReplyToCacher.cpp deleted file mode 100644 index 006b88faa..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CReplyToCacher.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Integration/IDocument.h" -#include "Integration/IIntegrationObject.h" -#include "CReplyToCacher.h" - -using namespace Caf; - -CReplyToCacher::CReplyToCacher() : - _isInitialized(false), - CAF_CM_INIT("CReplyToCacher") { -} - -CReplyToCacher::~CReplyToCacher() { -} - -void CReplyToCacher::initializeBean( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties) { - CAF_CM_FUNCNAME_VALIDATE("initializeBean"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STL_EMPTY(ctorArgs); - CAF_CM_VALIDATE_STL_EMPTY(properties); - - _ctorArgs = ctorArgs; - _properties = properties; - initialize(); -} - -void CReplyToCacher::terminateBean() { -} - -void CReplyToCacher::initialize() { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - _isInitialized = true; -} - -bool CReplyToCacher::isResponsible( - const SmartPtrIDocument& configSection) const { - CAF_CM_FUNCNAME_VALIDATE("isResponsible"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - - return false; -} - -SmartPtrIIntegrationObject CReplyToCacher::createObject( - const SmartPtrIDocument& configSection) const { - CAF_CM_FUNCNAME_VALIDATE("createObject"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - - SmartPtrIIntegrationObject rc; - rc.CreateInstance(_sObjIdCommIntegrationReplyToCacherInstance); - rc->initialize(_ctorArgs, _properties, configSection); - - return rc; -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CReplyToCacher.h b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CReplyToCacher.h deleted file mode 100644 index 018990f31..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CReplyToCacher.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CReplyToCacher_h_ -#define CReplyToCacher_h_ - - -#include "IBean.h" - -#include "Integration/IDocument.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/IIntegrationComponent.h" - -namespace Caf { - -/// Sends responses/errors back to the client. -class CReplyToCacher : - public TCafSubSystemObjectRoot, - public IBean, - public IIntegrationComponent { -public: - CReplyToCacher(); - virtual ~CReplyToCacher(); - - CAF_DECLARE_OBJECT_IDENTIFIER(_sObjIdCommIntegrationReplyToCacher) - - CAF_BEGIN_INTERFACE_MAP(CReplyToCacher) - CAF_INTERFACE_ENTRY(IBean) - CAF_INTERFACE_ENTRY(IIntegrationComponent) - CAF_END_INTERFACE_MAP() - -public: - virtual void initialize(); - -public: // IBean - virtual void initializeBean(const IBean::Cargs& ctorArgs, const IBean::Cprops& properties); - - virtual void terminateBean(); - -public: // IIntegrationComponent - bool isResponsible( - const SmartPtrIDocument& configSection) const; - - SmartPtrIIntegrationObject createObject( - const SmartPtrIDocument& configSection) const; - -private: - bool _isInitialized; - IBean::Cargs _ctorArgs; - IBean::Cprops _properties; - -private: - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(CReplyToCacher); -}; - -} - -#endif // #ifndef CReplyToCacher_h_ diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CReplyToCacherInstance.cpp b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CReplyToCacherInstance.cpp deleted file mode 100644 index 27f58c8a7..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CReplyToCacherInstance.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Created on: Aug 16, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Common/IAppContext.h" -#include "IBean.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "Exception/CCafException.h" -#include "CReplyToCacherInstance.h" - -using namespace Caf; - -CReplyToCacherInstance::CReplyToCacherInstance() : - _isInitialized(false), - CAF_CM_INIT("CReplyToCacherInstance") { -} - -CReplyToCacherInstance::~CReplyToCacherInstance() { -} - -void CReplyToCacherInstance::initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - _id = configSection->findRequiredAttribute("id"); - _replyToResolverId = configSection->findRequiredAttribute("reply-to-resolver"); - _isInitialized = true; -} - -std::string CReplyToCacherInstance::getId() const { - CAF_CM_FUNCNAME_VALIDATE("getId"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _id; -} - -void CReplyToCacherInstance::wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver) { - CAF_CM_FUNCNAME("wire"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(appContext); - SmartPtrIBean replyToResolverBean = appContext->getBean(_replyToResolverId); - _replyToResolver.QueryInterface(replyToResolverBean, false); - if (!_replyToResolver) { - CAF_CM_EXCEPTIONEX_VA1(NoSuchInterfaceException, 0, - "Bean '%s' is not a ReplyToResolver", _replyToResolverId.c_str()); - } -} - -SmartPtrIIntMessage CReplyToCacherInstance::transformMessage( - const SmartPtrIIntMessage& message) { - CAF_CM_FUNCNAME_VALIDATE("transformMessage"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(message); - - _replyToResolver->cacheReplyTo(message); - - return message; -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CReplyToCacherInstance.h b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CReplyToCacherInstance.h deleted file mode 100644 index ccd2db264..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CReplyToCacherInstance.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Created on: Aug 16, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CReplyToCacherInstance_h -#define CReplyToCacherInstance_h - - - -#include "Integration/IIntegrationComponentInstance.h" - -#include "Common/IAppContext.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "ReplyToResolver.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/ITransformer.h" - -namespace Caf { - -class CReplyToCacherInstance : - public TCafSubSystemObjectRoot, - public IIntegrationObject, - public IIntegrationComponentInstance, - public ITransformer { -public: - CReplyToCacherInstance(); - virtual ~CReplyToCacherInstance(); - - CAF_DECLARE_OBJECT_IDENTIFIER(_sObjIdCommIntegrationReplyToCacherInstance) - - CAF_BEGIN_INTERFACE_MAP(CReplyToCacherInstance) - CAF_INTERFACE_ENTRY(IIntegrationObject) - CAF_INTERFACE_ENTRY(IIntegrationComponentInstance) - CAF_INTERFACE_ENTRY(ITransformer) - CAF_END_INTERFACE_MAP() - -public: // IIntegrationObject - void initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection); - - std::string getId() const; - -public: // IIntegrationComponentInstance - void wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver); - -public: // ITransformer - SmartPtrIIntMessage transformMessage( - const SmartPtrIIntMessage& message); - -private: - bool _isInitialized; - std::string _id; - std::string _replyToResolverId; - SmartPtrReplyToResolver _replyToResolver; - -private: - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(CReplyToCacherInstance); -}; - -} - -#endif /* CReplyToCacherInstance_h */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CReplyToResolverInstance.cpp b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CReplyToResolverInstance.cpp deleted file mode 100644 index 2adfbc478..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CReplyToResolverInstance.cpp +++ /dev/null @@ -1,196 +0,0 @@ -/* - * Created on: Aug 16, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Integration/Caf/CCafMessageHeaders.h" -#include "Doc/PayloadEnvelopeDoc/CPayloadEnvelopeDoc.h" -#include "IVariant.h" -#include "Integration/IIntMessage.h" -#include "Exception/CCafException.h" -#include "CReplyToResolverInstance.h" -#include "amqpCore/DefaultAmqpHeaderMapper.h" -#include "Integration/Caf/CCafMessagePayloadParser.h" - -using namespace Caf; - -CReplyToResolverInstance::CReplyToResolverInstance() : - _isInitialized(false), - CAF_CM_INIT_LOG("CReplyToResolverInstance") { - CAF_CM_INIT_THREADSAFE; -} - -CReplyToResolverInstance::~CReplyToResolverInstance() { -} - -void CReplyToResolverInstance::initializeBean( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties) { - CAF_CM_FUNCNAME_VALIDATE("initializeBean"); - CAF_CM_LOCK_UNLOCK; - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - - // Read cache map into memory - loadCache(); - - _isInitialized = true; -} - -void CReplyToResolverInstance::terminateBean() { - persistCache(); -} - -std::string CReplyToResolverInstance::cacheReplyTo( - const SmartPtrIIntMessage& message) { - CAF_CM_FUNCNAME("cacheReplyTo"); - CAF_CM_LOCK_UNLOCK; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - const SmartPtrCPayloadEnvelopeDoc payloadEnvelope = - CCafMessagePayloadParser::getPayloadEnvelope(message->getPayload()); - - const SmartPtrCCafMessageHeaders cafMessageHeaders = - CCafMessageHeaders::create(message->getHeaders()); - const std::string replyTo = cafMessageHeaders->getOptionalStr( - AmqpIntegration::DefaultAmqpHeaderMapper::REPLY_TO); - - if (! replyTo.empty()) { - const UUID requestId = payloadEnvelope->getRequestId(); - const std::string requestIdStr = BasePlatform::UuidToString(requestId); - CAF_CM_LOG_DEBUG_VA2( - "Caching replyTo: [reqId=%s][replyTo=%s]", - requestIdStr.c_str(), - replyTo.c_str()); - _replyToAddresses.insert(std::make_pair(requestId, replyTo)); - } else { - CAF_CM_EXCEPTIONEX_VA1( - NoSuchElementException, - 0, - "Message does not have a '%s' header.", - AmqpIntegration::DefaultAmqpHeaderMapper::REPLY_TO.c_str()); - } - return replyTo; -} - -std::string CReplyToResolverInstance::lookupReplyTo( - const SmartPtrIIntMessage& message) { - CAF_CM_FUNCNAME("lookupReplyTo"); - CAF_CM_LOCK_UNLOCK; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - std::string replyTo; - - const SmartPtrCPayloadEnvelopeDoc payloadEnvelope = - CCafMessagePayloadParser::getPayloadEnvelope(message->getPayload()); - - const SmartPtrCCafMessageHeaders cafMessageHeaders = - CCafMessageHeaders::create(message->getHeaders()); - - const UUID requestId = payloadEnvelope->getRequestId(); - AddressMap::iterator replyToIter = _replyToAddresses.find(requestId); - if (replyToIter != _replyToAddresses.end()) { - replyTo = replyToIter->second; - _replyToAddresses.erase(replyToIter); - } else { - const std::string requestIdStr = BasePlatform::UuidToString(requestId); - CAF_CM_EXCEPTIONEX_VA1( - NoSuchElementException, - 0, - "Request id %s was not found in the address collection.", - requestIdStr.c_str()); - } - return replyTo; -} - -SmartPtrIVariant CReplyToResolverInstance::invokeExpression( - const std::string& methodName, - const Cdeqstr& methodParams, - const SmartPtrIIntMessage& message) { - CAF_CM_FUNCNAME("invokeExpression"); - CAF_CM_LOCK_UNLOCK; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_ASSERT(!methodParams.size()); - SmartPtrIVariant result; - - if (methodName == "lookupReplyTo") { - result = CVariant::createString(lookupReplyTo(message)); - } else { - CAF_CM_EXCEPTIONEX_VA1( - NoSuchMethodException, - 0, - "Method '%s' is not supported by this invoker", - methodName.c_str()); - } - return result; -} - -inline std::string CReplyToResolverInstance::getResolverCacheFilePath() -{ - return AppConfigUtils::getRequiredString("communication_amqp", "resolver_cache_file"); -} - -/* - * private methods - * - */ -void CReplyToResolverInstance::loadCache() { - CAF_CM_FUNCNAME_VALIDATE("loadCache"); - CAF_CM_LOCK_UNLOCK; - - //const std::string cacheFilePath = AppConfigUtils::getRequiredString("communication_amqp", "resolver_cache_file"); - const std::string cacheFilePath = getResolverCacheFilePath(); - const std::string cacheDirPath = FileSystemUtils::getDirname(cacheFilePath); - if (! FileSystemUtils::doesDirectoryExist(cacheDirPath)) { - FileSystemUtils::createDirectory(cacheDirPath); - } - if (FileSystemUtils::doesFileExist(cacheFilePath)) { - - const std::deque fileContents = FileSystemUtils::loadTextFileIntoColl(cacheFilePath); - for(TConstIterator > fileLineIter(fileContents); fileLineIter; fileLineIter++) { - //const std::string fileLine = *fileLineIter; - const Cdeqstr fileLineTokens = CStringUtils::split(*fileLineIter, ' '); - - CAF_CM_LOG_DEBUG_VA2("cache entry - reqId: %s, addr: %s", - fileLineTokens[0].c_str(), fileLineTokens[1].c_str()); - if (fileLineTokens.size() == 2) { - UUID reqId; - BasePlatform::UuidFromString(fileLineTokens[0].c_str(), reqId); - _replyToAddresses.insert(std::make_pair(reqId, fileLineTokens[1])); - } - } - - } else { - CAF_CM_LOG_DEBUG_VA1("resolver cache is not available - resolverCache: %s", cacheFilePath.c_str()); - } - -} - -void CReplyToResolverInstance::persistCache() { - CAF_CM_FUNCNAME_VALIDATE("persistCache"); - CAF_CM_LOCK_UNLOCK; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - //const std::string cacheFilePath = AppConfigUtils::getRequiredString("communication_amqp", "resolver_cache_file"); - const std::string cacheFilePath = getResolverCacheFilePath(); - std::stringstream contents; - //contents.str(""); - for (AddressMap::const_iterator replyToIter = _replyToAddresses.begin(); - replyToIter != _replyToAddresses.end(); ++replyToIter) { - - std::string reqIdStr = BasePlatform::UuidToString(replyToIter->first); - contents << reqIdStr << " " << replyToIter->second << std::endl; - CAF_CM_LOG_DEBUG_VA2("caching entry - reqId: %s, addr: %s", - reqIdStr.c_str(), replyToIter->second.c_str()); - } - if (contents.str().length() > 0) { - CAF_CM_LOG_DEBUG_VA0("Caching resolver map."); - FileSystemUtils::saveTextFile(cacheFilePath, contents.str()); - } - - -} - diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CReplyToResolverInstance.h b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CReplyToResolverInstance.h deleted file mode 100644 index 3d24fcb93..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/CReplyToResolverInstance.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Created on: Aug 16, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CReplyToResolverInstance_h -#define CReplyToResolverInstance_h - -#include "IBean.h" -#include "IVariant.h" -#include "ReplyToResolver.h" -#include "Integration/IIntMessage.h" -#include "Integration/IExpressionInvoker.h" - -namespace Caf { - -class CReplyToResolverInstance : - public TCafSubSystemObjectRoot, - public IBean, - public ReplyToResolver, - public IExpressionInvoker { -public: - CReplyToResolverInstance(); - virtual ~CReplyToResolverInstance(); - - CAF_DECLARE_OBJECT_IDENTIFIER(_sObjIdCommIntegrationReplyToResolver) - - CAF_BEGIN_INTERFACE_MAP(CReplyToResolverInstance) - CAF_INTERFACE_ENTRY(IBean) - CAF_INTERFACE_ENTRY(ReplyToResolver) - CAF_INTERFACE_ENTRY(IExpressionInvoker) - CAF_END_INTERFACE_MAP() - -public: // IBean - void initializeBean( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties); - - void terminateBean(); - -public: // ReplyToResolver - std::string cacheReplyTo(const SmartPtrIIntMessage& message); - - std::string lookupReplyTo(const SmartPtrIIntMessage& message); - - static std::string getResolverCacheFilePath(); - -private: // ReplyToResolver - void loadCache(); - void persistCache(); - -public: // IExpressionInvoker - SmartPtrIVariant invokeExpression( - const std::string& methodName, - const Cdeqstr& methodParams, - const SmartPtrIIntMessage& message); - -private: - bool _isInitialized; - typedef std::map AddressMap; - AddressMap _replyToAddresses; - CAF_CM_CREATE; - CAF_CM_CREATE_THREADSAFE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CReplyToResolverInstance); -}; -} - -#endif /* CReplyToResolverInstance_h */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/commIntegration.cpp b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/commIntegration.cpp deleted file mode 100644 index cbba3ff22..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/commIntegration.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Created on: Aug 16, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "CCmsMessageTransformer.h" -#include "CCmsMessageTransformerInstance.h" -#include "CEventTopicCalculatorInstance.h" -#include "CIncomingMessageHandler.h" -#include "CIncomingMessageHandlerInstance.h" -#include "COutgoingMessageHandler.h" -#include "CProtocolHeaderEnricher.h" -#include "CProtocolHeaderEnricherInstance.h" -#include "CReplyToCacher.h" -#include "CReplyToCacherInstance.h" -#include "CReplyToResolverInstance.h" - -namespace Caf { - const char* _sObjIdCommIntegrationCmsMessageTransformer = "com.vmware.caf.comm.integration.cmsmessagetransformer"; - const char* _sObjIdCommIntegrationCmsMessageTransformerInstance = "com.vmware.caf.comm.integration.cmsmessagetransformerinstance"; - const char* _sObjIdCommIntegrationEventTopicCalculator = "com.vmware.caf.comm.integration.eventtopiccalculator"; - const char* _sObjIdCommIntegrationIncomingMessageHandler = "com.vmware.caf.comm.integration.incomingmessagehandler"; - const char* _sObjIdCommIntegrationIncomingMessageHandlerInstance = "com.vmware.caf.comm.integration.incomingmessagehandlerinstance"; - const char* _sObjIdCommIntegrationOutgoingMessageHandler = "com.vmware.caf.comm.integration.outgoingmessagehandler"; - const char* _sObjIdCommIntegrationProtocolHeaderEnricher = "com.vmware.caf.comm.integration.protocolheaderenricher"; - const char* _sObjIdCommIntegrationProtocolHeaderEnricherInstance = "com.vmware.caf.comm.integration.protocolheaderenricherinstance"; - const char* _sObjIdCommIntegrationReplyToCacher = "com.vmware.caf.comm.integration.replytocacher"; - const char* _sObjIdCommIntegrationReplyToCacherInstance = "com.vmware.caf.comm.integration.replytocacherinstance"; - const char* _sObjIdCommIntegrationReplyToResolver = "com.vmware.caf.comm.integration.replytoresolver"; -} - -CEcmSubSystemModule _Module; - -using namespace Caf; - -CAF_BEGIN_OBJECT_MAP(ObjectMap) - CAF_OBJECT_ENTRY(CCmsMessageTransformer) - CAF_OBJECT_ENTRY(CCmsMessageTransformerInstance) - CAF_OBJECT_ENTRY(CEventTopicCalculatorInstance) - CAF_OBJECT_ENTRY(CIncomingMessageHandler) - CAF_OBJECT_ENTRY(CIncomingMessageHandlerInstance) - CAF_OBJECT_ENTRY(COutgoingMessageHandler) - CAF_OBJECT_ENTRY(CProtocolHeaderEnricher) - CAF_OBJECT_ENTRY(CProtocolHeaderEnricherInstance) - CAF_OBJECT_ENTRY(CReplyToCacher) - CAF_OBJECT_ENTRY(CReplyToCacherInstance) - CAF_OBJECT_ENTRY(CReplyToResolverInstance) -CAF_END_OBJECT_MAP() - -CAF_DECLARE_SUBSYSTEM_EXPORTS() - -extern "C" BOOL APIENTRY DllMain(HINSTANCE hModule, uint32 dwReason, LPVOID) -{ - try { - if (DLL_PROCESS_ATTACH == dwReason) - { - // initialize the sub-system module - _Module.Init(ObjectMap, hModule); - } - else if (DLL_PROCESS_DETACH == dwReason) - { - // Terminate the sub-system module - _Module.Term(); - } - } catch (std::runtime_error) { - ::exit(2); - } catch (...) { - ::exit(2); - } - - return TRUE; -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/commIntegrationDefines.h b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/commIntegrationDefines.h deleted file mode 100644 index e5d2df8ce..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/commIntegrationDefines.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Created on: Aug 16, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef commIntegrationDefines_h -#define commIntegrationDefines_h - -namespace Caf { - - extern const char* _sObjIdCommIntegrationCmsMessageTransformer; - extern const char* _sObjIdCommIntegrationCmsMessageTransformerInstance; - extern const char* _sObjIdCommIntegrationEventTopicCalculator; - extern const char* _sObjIdCommIntegrationIncomingMessageHandler; - extern const char* _sObjIdCommIntegrationIncomingMessageHandlerInstance; - extern const char* _sObjIdCommIntegrationOutgoingMessageHandler; - extern const char* _sObjIdCommIntegrationProtocolHeaderEnricher; - extern const char* _sObjIdCommIntegrationProtocolHeaderEnricherInstance; - extern const char* _sObjIdCommIntegrationReplyToCacher; - extern const char* _sObjIdCommIntegrationReplyToCacherInstance; - extern const char* _sObjIdCommIntegrationReplyToResolver; -} - -#endif /* commIntegrationDefines_h */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/stdafx.h b/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/stdafx.h deleted file mode 100644 index 83cd6fca7..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/Subsystems/commIntegration/src/stdafx.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Created on: Aug 16, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef stdafx_h -#define stdafx_h - -#include -#include -#include "../../../amqpCore/src/amqpCore/amqpIntegrationCoreLink.h" -#include "commIntegrationDefines.h" - -#include -#include "CMessagePartsParser.h" -#include "CMessagePartsBuilder.h" -#include "CMessagePartDescriptorCalculator.h" -#include "CCmsMessageUtils.h" - -#endif /* stdafx_h */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/AMQChannel.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/AMQChannel.h deleted file mode 100644 index ae34055cd..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/AMQChannel.h +++ /dev/null @@ -1,265 +0,0 @@ -/* - * Created on: May 2, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AMQCHANNEL_H_ -#define AMQCHANNEL_H_ - -#include "amqpClient/TCopyOnWriteContainer.h" -#include "amqpClient/CAmqpChannel.h" -#include "amqpClient/amqpImpl/BasicProperties.h" -#include "Common/CAutoMutex.h" -#include "Exception/CCafException.h" -#include "Memory/DynamicArray/DynamicArrayInc.h" -#include "amqpClient/AMQCommand.h" -#include "amqpClient/ConsumerDispatcher.h" -#include "amqpClient/ConsumerWorkService.h" -#include "amqpClient/IConnectionInt.h" -#include "amqpClient/IRpcContinuation.h" -#include "amqpClient/amqpImpl/IServerMethod.h" -#include "amqpClient/api/AmqpMethods.h" -#include "amqpClient/api/Consumer.h" -#include "amqpClient/api/GetResponse.h" -#include "amqpClient/api/ReturnListener.h" -#include "amqpClient/api/amqpClient.h" -#include "Common/CThreadSignal.h" -#include "amqpClient/api/Channel.h" - -namespace Caf { namespace AmqpClient { - -class AMQChannel; -CAF_DECLARE_SMART_POINTER(AMQChannel); - -/** - * @author mdonahue - * @ingroup AmqpApiImpl - * @remark LIBRARY IMPLEMENTATION - NOT PART OF THE PUBLIC API - * @brief Concrete implementation of a Channel object representing an AMQP channel. - */ -class AMQChannel : public Channel { -public: - AMQChannel(); - virtual ~AMQChannel(); - - /** - * @brief Initializer - * @param connection the owning connection - * @param workService the work service to add channel tasks to - */ - void init( - const SmartPtrIConnectionInt& connection, - const SmartPtrConsumerWorkService& workService); - - /** - * @brief Notification of connection closure - *

- * Called by the AMQChannelManager to notify the channel that the parent connect - * has closed for the supplied reason. - * @param exception the reason for the closure - */ - void notifyConnectionClosed(SmartPtrCCafException& exception); - - /** - * @brief Close the channel with the given reason - * @param exception reason for closure - */ - void close(SmartPtrCCafException& exception); - -public: // Channel - uint16 getChannelNumber(); - - void close(); - - bool isOpen(); - -public: // Basic - void basicAck( - const uint64 deliveryTag, - const bool ackMultiple); - - SmartPtrGetResponse basicGet( - const std::string& queue, - const bool noAck); - - void basicPublish( - const std::string& exchange, - const std::string& routingKey, - const AmqpContentHeaders::SmartPtrBasicProperties& properties, - const SmartPtrCDynamicByteArray& body); - - void basicPublish( - const std::string& exchange, - const std::string& routingKey, - const bool mandatory, - const bool immediate, - const AmqpContentHeaders::SmartPtrBasicProperties& properties, - const SmartPtrCDynamicByteArray& body); - - AmqpMethods::Basic::SmartPtrConsumeOk basicConsume( - const std::string& queue, - const SmartPtrConsumer& consumer); - - AmqpMethods::Basic::SmartPtrConsumeOk basicConsume( - const std::string& queue, - const bool noAck, - const SmartPtrConsumer& consumer); - - AmqpMethods::Basic::SmartPtrConsumeOk basicConsume( - const std::string& queue, - const std::string& consumerTag, - const bool noAck, - const bool noLocal, - const bool exclusive, - const SmartPtrConsumer& consumer, - const SmartPtrTable& arguments = SmartPtrTable()); - - AmqpMethods::Basic::SmartPtrCancelOk basicCancel( - const std::string& consumerTag); - - AmqpMethods::Basic::SmartPtrRecoverOk basicRecover( - const bool requeue); - - AmqpMethods::Basic::SmartPtrQosOk basicQos( - const uint32 prefetchSize, - const uint32 prefetchCount, - const bool global); - - void basicReject( - const uint64 deliveryTag, - const bool requeue); - -public: // Exchange - AmqpMethods::Exchange::SmartPtrDeclareOk exchangeDeclare( - const std::string& exchange, - const std::string& type, - const bool durable = false, - const SmartPtrTable& arguments = SmartPtrTable()); - - AmqpMethods::Exchange::SmartPtrDeleteOk exchangeDelete( - const std::string& exchange, - const bool ifUnused); - -public: // Queue - AmqpMethods::Queue::SmartPtrDeclareOk queueDeclare(); - - AmqpMethods::Queue::SmartPtrDeclareOk queueDeclare( - const std::string& queue, - const bool durable, - const bool exclusive, - const bool autoDelete, - const SmartPtrTable& arguments = SmartPtrTable()); - - AmqpMethods::Queue::SmartPtrDeclareOk queueDeclarePassive( - const std::string& queue); - - AmqpMethods::Queue::SmartPtrDeleteOk queueDelete( - const std::string& queue, - const bool ifUnused, - const bool ifEmpty); - - AmqpMethods::Queue::SmartPtrPurgeOk queuePurge( - const std::string& queue); - - AmqpMethods::Queue::SmartPtrBindOk queueBind( - const std::string& queue, - const std::string& exchange, - const std::string& routingKey, - const SmartPtrTable& arguments = SmartPtrTable()); - - AmqpMethods::Queue::SmartPtrUnbindOk queueUnbind( - const std::string& queue, - const std::string& exchange, - const std::string& routingKey, - const SmartPtrTable& arguments = SmartPtrTable()); - - void addReturnListener( - const SmartPtrReturnListener& listener); - - bool removeReturnListener( - const SmartPtrReturnListener& listener); - -private: - bool taskHandler(); - - void handleCompleteInboundCommand(const SmartPtrAMQCommand& command); - - bool processAsync(const SmartPtrAMQCommand& command); - - void ensureIsOpen(); - - SmartPtrAMQCommand execRpc(const SmartPtrIServerMethod& method); - - SmartPtrIRpcContinuation nextOutstandingRpc(); - - void transmit(const SmartPtrIServerMethod& method); - - void channelCloseByServerShutdown(const AmqpMethods::Channel::SmartPtrClose& closeMethod); - - void callReturnListeners(const SmartPtrAMQCommand& command); - -private: - /* - * This class hooks the channel into the worker service - * thread pool for channel inbound AMQP frame processing - */ - class ChannelTask : public CManagedThreadPool::IThreadTask { - public: - ChannelTask(); - - virtual ~ChannelTask(); - - /* - * Initialize the thread task - * channel is the pointer to the parent channel - */ - void init(SmartPtrAMQChannel channel); - - /* - * Thread pool task execution callback - * - * Calls through to the channel to do the actual work - * returns 'true' if the thread pool should remove this task - * returns 'false' if the thread pool should requeue this task - */ - bool run(); - - private: - SmartPtrAMQChannel _channel; - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(ChannelTask); - }; - CAF_DECLARE_SMART_POINTER(ChannelTask); - -private: - static const uint8 DEBUGLOG_FLAG_ENTRYEXIT; - static const uint8 DEBUGLOG_FLAG_AMQP; - - bool _isInitialized; - volatile bool _isOpen; - uint8 _debugLogFlags; - SmartPtrIConnectionInt _connection; - SmartPtrConsumerWorkService _workService; - SmartPtrConsumerDispatcher _dispatcher; - uint16 _channelNumber; - SmartPtrCAmqpChannel _channelHandle; - SmartPtrAMQCommand _command; - SmartPtrIRpcContinuation _activeRpc; - SmartPtrCAutoMutex _channelMutex; - CThreadSignal _channelSignal; - - typedef std::deque ReturnListenerCollection; - typedef TCopyOnWriteContainer CowReturnListenerCollection; - CowReturnListenerCollection _returnListeners; - - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_CREATE_THREADSAFE; - CAF_CM_DECLARE_NOCOPY(AMQChannel); -}; - -}} - -#endif /* AMQCHANNEL_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/AMQChannelManager.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/AMQChannelManager.h deleted file mode 100644 index 97666910d..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/AMQChannelManager.h +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Created on: May 7, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AMQCHANNELMANAGER_H_ -#define AMQCHANNELMANAGER_H_ - - - -#include "Exception/CCafException.h" -#include "amqpClient/AMQChannel.h" -#include "amqpClient/ConsumerWorkService.h" -#include "amqpClient/api/Channel.h" - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApiImpl - * @remark LIBRARY IMPLEMENTATION - NOT PART OF THE PUBLIC API - * @brief Manages a set of channels for a connection. - * Channels are indexed by channel number (1.._channelMax). - */ -class AMQChannelManager { -public: - AMQChannelManager(); - virtual ~AMQChannelManager(); - -public: - /** - * @brief Initialize the manager to control channelMax channels. - * @param workService the service (thread pool) to run the channels in - */ - void init(const SmartPtrConsumerWorkService& workService); - - /** - * @brief Create a new channel - * @param connection The controlling #Caf::AmqpClient::IConnectionInt connection - * @return the new Channel - */ - SmartPtrChannel createChannel(const SmartPtrIConnectionInt& connection); - - /** - * @brief Return an existing channel on this connection. - * @param channelNumber the number of the required channel - * @return the #Caf::AmqpClient::Channel interface to the channel if it exists else - * throws an exception - */ - SmartPtrChannel getChannel(const uint16 channelNumber); - - /** - * @brief Return the number of open channels - * @return the number of open channels - */ - size_t getOpenChannelCount(); - - /** - * @brief Notify all channels that the connection is closed and the reason for it - * @param shutdownException the exception (reason) for the closure - */ - void notifyConnectionClose(SmartPtrCCafException& shutdownException); - - /** - * @brief Close achannel with the supplied reason - * @param channelNumber the channel to close - * @param reason the reason for closure - */ - void closeChannel(const uint16 channelNumber, SmartPtrCCafException& reason); - - /** - * @brief Remove a channel from management - * @param channelNumber channel number - */ - void removeChannel(const uint16 channelNumber); - -private: - typedef std::map ChannelMap; - - bool _isInitialized; - ChannelMap _channelMap; - SmartPtrConsumerWorkService _workService; - - CAF_CM_CREATE; - CAF_CM_CREATE_THREADSAFE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(AMQChannelManager); -}; -CAF_DECLARE_SMART_POINTER(AMQChannelManager); - -}} - -#endif /* AMQCHANNELMANAGER_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/AMQCommand.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/AMQCommand.h deleted file mode 100644 index 76f471164..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/AMQCommand.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Created on: May 9, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AMQCOMMAND_H_ -#define AMQCOMMAND_H_ - - - -#include "Memory/DynamicArray/DynamicArrayInc.h" -#include "amqpClient/CAmqpFrame.h" -#include "amqpClient/CommandAssembler.h" -#include "amqpClient/amqpImpl/IContentHeader.h" -#include "amqpClient/amqpImpl/IMethod.h" - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApiImpl - * @remark LIBRARY IMPLEMENTATION - NOT PART OF THE PUBLIC API - * @brief This class represents an AMQP command - *

- * This class wraps up the method, content header and body information for an - * incoming AMQP command. - */ -class AMQCommand { -public: - AMQCommand(); - virtual ~AMQCommand(); - - /** - * @brief Prepare the object for frame processing - */ - void init(); - - /** - * @brief Process an AMQP frame - * @param frame amqp frame data - */ - bool handleFrame(const SmartPtrCAmqpFrame& frame); - - /** - * @brief Return the body if available - * @return the body's raw bytes if available or a null object - */ - SmartPtrCDynamicByteArray getContentBody(); - - /** - * @brief Return the content header if available - * @return the IContentHeader if available or a - * null object - */ - SmartPtrIContentHeader getContentHeader(); - - /** - * @brief Return the method - * @return the IMethod object interface representing the method. - * QueryInterface must be used to get to the actual method object - */ - SmartPtrIMethod getMethod(); - -private: - SmartPtrCommandAssembler _assembler; - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(AMQCommand); -}; -CAF_DECLARE_SMART_POINTER(AMQCommand); - -}} - -#endif /* AMQCOMMAND_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/AMQConnection.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/AMQConnection.h deleted file mode 100644 index ed71324f6..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/AMQConnection.h +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Created on: May 2, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AMQCONNECTION_H_ -#define AMQCONNECTION_H_ - - -#include "Common/CThreadSignal.h" - -#include "amqpClient/CAmqpChannel.h" -#include "Common/CManagedThreadPool.h" -#include "amqpClient/AMQChannelManager.h" -#include "amqpClient/CAmqpAuthMechanism.h" -#include "amqpClient/CAmqpConnection.h" -#include "amqpClient/ConnectionWeakReference.h" -#include "amqpClient/ConsumerWorkService.h" -#include "amqpClient/api/Address.h" -#include "amqpClient/api/CertInfo.h" -#include "amqpClient/api/Channel.h" -#include "amqpClient/IConnectionInt.h" -#include "amqpClient/api/Connection.h" - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApiImpl - * @remark LIBRARY IMPLEMENTATION - NOT PART OF THE PUBLIC API - * @brief Concrete class representing and managing an AMQP connection to a broker. - *

- * To create a broker connection, use a ConnectionFactory created - * by calling #createConnectionFactory - */ -class AMQConnection : public Connection, public IConnectionInt { -public: - AMQConnection(); - virtual ~AMQConnection(); - -public: - /** - * @brief Initialize the connection. - * @param username name used to establish connection - * @param password for username - * @param address info needed to establish connection - * @param certInfo info needed to establish a secure connection - * @param requestedFrameMax max size of frame - * @param requestedChannelMax max number of channels - * @param requestedHeartbeat hearbeat in seconds - * @param connectionTimeout connection timeout in milliseconds - * @param consumerThreadCount number of consumer threads - */ - void init( - const std::string username, - const std::string password, - const SmartPtrAddress& address, - const SmartPtrCertInfo& certInfo, - const uint32 requestedFrameMax, - const uint32 requestedChannelMax, - const uint32 requestedHeartbeat, - const uint32 connectionTimeout, - const uint32 consumerThreadCount, - const uint16 retries, - const uint16 secondsToWait); - - /** - * @brief Start up the connection. - */ - void start(); - - -public: // Connection - SmartPtrChannel createChannel(); - - void closeChannel(const SmartPtrChannel& channel); - - void close(); - - bool isOpen(); - -public: // IConnectionInt - AMQPStatus amqpConnectionOpenChannel(SmartPtrCAmqpChannel& channel); - - void notifyChannelClosedByServer(const uint16 channelNumber); - - void channelCloseChannel(Channel *channel); - -private: - void initConnection(); - - static void closeChannel( - const bool isRunning, - const SmartPtrAMQChannelManager channelManager, - const SmartPtrChannel& channel); - - static SmartPtrChannel createChannel( - const bool isRunning, - const SmartPtrAMQChannelManager& channelManager, - const SmartPtrConnectionWeakReference& weakReferenceSelf); - - static void* threadFunc(void* context); - - void threadWorker(); - -private: - bool _isInitialized; - volatile bool _isRunning; - volatile bool _shouldShutdown; - bool _wasCloseCalled; - GThread* _thread; - CThreadSignal _connectionSignal; - SmartPtrAddress _address; - SmartPtrCertInfo _certInfo; - uint32 _connectionTimeout; - SmartPtrCAmqpConnection _connectionHandle; - uint32 _requestedFrameMax; - uint32 _requestedChannelMax; - uint32 _requestedHeartbeat; - uint16 _retries; - uint16 _secondsToWait; - SmartPtrCAmqpAuthMechanism _authMechanism; - SmartPtrAMQChannelManager _channelManager; - SmartPtrConnectionWeakReference _weakReferenceSelf; - SmartPtrCManagedThreadPool _threadPool; - SmartPtrConsumerWorkService _workService; - - CAF_CM_CREATE; - CAF_CM_CREATE_THREADSAFE; - CAF_CM_CREATE_LOG; - CAF_THREADSIGNAL_CREATE; - CAF_CM_DECLARE_NOCOPY(AMQConnection); -}; - -CAF_DECLARE_SMART_POINTER(AMQConnection); - -}} - -#endif /* AMQCONNECTION_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/AmqpClientLink.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/AmqpClientLink.h deleted file mode 100644 index 1b432bf36..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/AmqpClientLink.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Author: bwilliams - * Created: 10/19/2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AMQP_CLIENTLINK_H_ -#define AMQP_CLIENTLINK_H_ - -#ifndef AMQPCLIENT_LINKAGE - #ifdef WIN32 - #ifdef AMQP_CLIENT - #define AMQPCLIENT_LINKAGE __declspec(dllexport) - #else - #define AMQPCLIENT_LINKAGE __declspec(dllimport) - #endif - #else - #define AMQPCLIENT_LINKAGE - #endif -#endif - -#endif /* AMQP_CLIENTLINK_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/BlockingRpcContinuation.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/BlockingRpcContinuation.h deleted file mode 100644 index 2c0d2db55..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/BlockingRpcContinuation.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Created on: May 15, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef BLOCKINGRPCCONTINUATION_H_ -#define BLOCKINGRPCCONTINUATION_H_ - - - -#include "amqpClient/IRpcContinuation.h" - -#include "Exception/CCafException.h" -#include "amqpClient/AMQCommand.h" - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApiImpl - * @brief A IRpcContinuation that blocks until the response is received. - * @remark LIBRARY IMPLEMENTATION - NOT PART OF THE PUBLIC API - */ -class BlockingRpcContinuation : public IRpcContinuation { -public: - BlockingRpcContinuation(); - virtual ~BlockingRpcContinuation(); - - /** - * @brief Initialize the object - */ - void init(); - - /** - * @brief Waits indefinately for a response to an AMQP method call - * @retval null if an error occured. In this case call getException to get the exception - * @retval non-null AMQCommand response - */ - SmartPtrAMQCommand getReply(); - - /** - * @brief Waits for a time for a response to an AMQP method call - * @param timeout time in milliseconds to wait for a response - * @retval null if an error occured. In this case call getException to get the exception - * @retval non-null AMQCommand response - */ - SmartPtrAMQCommand getReply(uint32 timeout); - - /** - * @brief Returns the exception that occured if getReply returns null. - * @return the exception. The returned exception will have its reference count increased. - */ - SmartPtrCCafException getException(); - -public: // IRpcContinuation - void handleCommand(const SmartPtrAMQCommand& command); - - void handleAbort(SmartPtrCCafException exception); - -private: - bool _isInitialized; - TBlockingCell _blocker; - SmartPtrCCafException _exception; - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(BlockingRpcContinuation); -}; -CAF_DECLARE_SMART_POINTER(BlockingRpcContinuation); - -}} - -#endif /* BLOCKINGRPCCONTINUATION_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/CAmqpAuthMechanism.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/CAmqpAuthMechanism.h deleted file mode 100644 index 035ed91e1..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/CAmqpAuthMechanism.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Created on: May 7, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AMQPCLIENT_CAMQPAUTHMECHANISM_H_ -#define AMQPCLIENT_CAMQPAUTHMECHANISM_H_ - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApiImpl - * @remark LIBRARY IMPLEMENTATION - NOT PART OF THE PUBLIC API - * @brief Manages a set of channels for a connection. - * Channels are indexed by channel number (1.._channelMax). - */ -class CAmqpAuthMechanism { -public: - CAmqpAuthMechanism(); - virtual ~CAmqpAuthMechanism(); - -public: - AMQPStatus createClient( - const std::string& username, - const std::string& password); - - std::string getUsername() const; - std::string getPassword() const; - -private: - std::string _username; - std::string _password; - - CAF_CM_CREATE; - CAF_CM_CREATE_THREADSAFE; - CAF_CM_DECLARE_NOCOPY(CAmqpAuthMechanism); -}; -CAF_DECLARE_SMART_POINTER(CAmqpAuthMechanism); - -}} - -#endif /* AMQPCLIENT_CAMQPAUTHMECHANISM_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/CAmqpChannel.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/CAmqpChannel.h deleted file mode 100644 index 80d8cc016..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/CAmqpChannel.h +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Created on: May 7, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AMQPCLIENT_CAMQPCHANNEL_H_ -#define AMQPCLIENT_CAMQPCHANNEL_H_ - - -#include "Memory/DynamicArray/DynamicArrayInc.h" -#include "amqpClient/CAmqpConnection.h" -#include "amqpClient/CAmqpFrame.h" - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApiImpl - * @remark LIBRARY IMPLEMENTATION - NOT PART OF THE PUBLIC API - * @brief Manages a set of channels for a connection. - * Channels are indexed by channel number (1.._channelMax). - */ -class CAmqpChannel { -public: - CAmqpChannel(); - virtual ~CAmqpChannel(); - - void initialize( - const SmartPtrCAmqpConnection& connection, - const amqp_channel_t& channel); - -public: - AMQPStatus close(); - - AMQPStatus closeOk(); - - AMQPStatus receive( - SmartPtrCAmqpFrame& frame, - int32 timeout); - - AMQPStatus getId( - uint16 *id); - - AMQPStatus basicAck( - const uint64 deliveryTag, - const bool multiple); - - AMQPStatus basicCancel( - const std::string& consumerTag, - const bool noWait); - - AMQPStatus basicConsume( - const std::string& queue, - const std::string& consumerTag, - const bool noLocal, - const bool noAck, - const bool exclusive, - const bool noWait, - const amqp_table_t *arguments); - - AMQPStatus basicGet( - const std::string& queue, - const bool noAck); - - AMQPStatus basicPublish( - const std::string& exchange, - const std::string& routingKey, - const bool mandatory, - const bool immediate, - const amqp_basic_properties_t *basicProps, - const SmartPtrCDynamicByteArray& body); - - AMQPStatus basicRecover( - const bool requeue); - - AMQPStatus basicQos( - const uint32 prefetchSize, - const uint16 prefetchCount, - bool global); - - AMQPStatus exchangeDeclare( - const std::string& exchange, - const std::string& type, - const bool passive, - const bool durable, - const bool noWait, - const amqp_table_t *arguments); - - AMQPStatus exchangeDelete( - const std::string& exchange, - const bool ifUnused, - const bool noWait); - - AMQPStatus queueBind( - const std::string& queue, - const std::string& exchange, - const std::string& routingKey, - const bool noWait, - const amqp_table_t *arguments); - - AMQPStatus queueDeclare( - const std::string& queue, - const bool passive, - const bool durable, - const bool exclusive, - const bool autoDelete, - const bool noWait, - const amqp_table_t *arguments); - - AMQPStatus queueDelete( - const std::string& queue, - const bool ifUnused, - const bool ifEmpty, - const bool noWait); - - AMQPStatus queuePurge( - const std::string& queue, - const bool noWait); - - AMQPStatus queueUnbind( - const std::string& queue, - const std::string& exchange, - const std::string& bindingKey, - const amqp_table_t *arguments); - -private: - bool _isInitialized; - SmartPtrCAmqpConnection _connection; - amqp_channel_t _channel; - - CAF_CM_CREATE; - CAF_CM_CREATE_THREADSAFE; - CAF_CM_DECLARE_NOCOPY(CAmqpChannel); -}; - -}} - -#endif /* AMQPCLIENT_CAMQPCHANNEL_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/CAmqpConnection.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/CAmqpConnection.h deleted file mode 100644 index 07e01cd1f..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/CAmqpConnection.h +++ /dev/null @@ -1,254 +0,0 @@ -/* - * Created on: May 7, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AMQPCLIENT_CAMQPCONNECTION_H_ -#define AMQPCLIENT_CAMQPCONNECTION_H_ - - -#include "amqpClient/CAmqpChannel.h" -#include "Memory/DynamicArray/DynamicArrayInc.h" -#include "amqpClient/CAmqpAuthMechanism.h" -#include "amqpClient/CAmqpFrame.h" -#include "amqpClient/api/Address.h" -#include "amqpClient/api/CertInfo.h" - -namespace Caf { namespace AmqpClient { - -/** Connection states. */ -typedef enum { - AMQP_STATE_INITIALIZED = 0, /*!< New connection. */ - AMQP_STATE_CONNECTING, /*!< Connection in progress. */ - AMQP_STATE_CONNECTED, /*!< Connected. */ - AMQP_STATE_DISCONNECTING, /*!< Disconnection in process. */ - AMQP_STATE_DISCONNECTED, /*!< Disconnected. */ -} AMQPConnectionState; - -/** - * @author mdonahue - * @ingroup AmqpApiImpl - * @remark LIBRARY IMPLEMENTATION - NOT PART OF THE PUBLIC API - * @brief Manages a set of channels for a connection. - * Channels are indexed by channel number (1.._channelMax). - */ -class CAmqpConnection { -private: - typedef std::deque CAmqpFrames; - typedef std::map CChannelFrames; - CAF_DECLARE_SMART_POINTER(CChannelFrames); - - typedef std::set COpenChannels; - CAF_DECLARE_SMART_POINTER(COpenChannels); - -public: - CAmqpConnection(); - virtual ~CAmqpConnection(); - -public: - AMQPStatus connectionCreate( - const SmartPtrAddress& address, - const SmartPtrCAmqpAuthMechanism& auth, - const SmartPtrCertInfo& certInfo, - const uint16 channelMax, - const uint32 frameMax, - const uint16 heartbeat, - const uint16 retries, - const uint16 secondsToWait); - - AMQPStatus connectionConnect( - const int32 flags); - - AMQPStatus connectionClose(); - - AMQPStatus connectionProcessIO(); - - AMQPStatus connectionWaitForIO( - const int32 timeout); - - AMQPStatus connectionGetState( - AMQPConnectionState *state); - - AMQPStatus connectionGetMaxChannels( - uint16 *channels); - - AMQPStatus connectionGetMaxFrameSize( - uint32 *frameSize); - - AMQPStatus connectionGetHeartbeatInterval( - uint16 *interval); - - AMQPStatus connectionGetLastError( - const char **error); - - AMQPStatus channelOpen( - SmartPtrCAmqpChannel& chan); - - AMQPStatus channelClose( - const amqp_channel_t& channel); - - AMQPStatus channelCloseOk( - const amqp_channel_t& channel); - - AMQPStatus receive( - const amqp_channel_t& channel, - SmartPtrCAmqpFrame& frame, - const int32 timeout); - - AMQPStatus basicAck( - const amqp_channel_t& channel, - const uint64 deliveryTag, - const bool multiple); - - AMQPStatus basicCancel( - const amqp_channel_t& channel, - const std::string& consumerTag, - const bool noWait); - - AMQPStatus basicConsume( - const amqp_channel_t& channel, - const std::string& queue, - const std::string& consumerTag, - const bool noLocal, - const bool noAck, - const bool exclusive, - const bool noWait, - const amqp_table_t *arguments); - - AMQPStatus basicGet( - const amqp_channel_t& channel, - const std::string& queue, - const bool noAck); - - AMQPStatus basicPublish( - const amqp_channel_t& channel, - const std::string& exchange, - const std::string& routingKey, - const bool mandatory, - const bool immediate, - const amqp_basic_properties_t *basicProps, - const SmartPtrCDynamicByteArray& body); - - AMQPStatus basicRecover( - const amqp_channel_t& channel, - const bool requeue); - - AMQPStatus basicQos( - const amqp_channel_t& channel, - const uint32 prefetchSize, - const uint16 prefetchCount, - const bool global); - - AMQPStatus exchangeDeclare( - const amqp_channel_t& channel, - const std::string& exchange, - const std::string& type, - const bool passive, - const bool durable, - const bool noWait, - const amqp_table_t *arguments); - - AMQPStatus exchangeDelete( - const amqp_channel_t& channel, - const std::string& exchange, - const bool ifUnused, - const bool noWait); - - AMQPStatus queueBind( - const amqp_channel_t& channel, - const std::string& queue, - const std::string& exchange, - const std::string& routingKey, - const bool noWait, - const amqp_table_t *arguments); - - AMQPStatus queueDeclare( - const amqp_channel_t& channel, - const std::string& queue, - const bool passive, - const bool durable, - const bool exclusive, - const bool autoDelete, - const bool noWait, - const amqp_table_t *arguments); - - AMQPStatus queueDelete( - const amqp_channel_t& channel, - const std::string& queue, - const bool ifUnused, - const bool ifEmpty, - const bool noWait); - - AMQPStatus queuePurge( - const amqp_channel_t& channel, - const std::string& queue, - const bool noWait); - - AMQPStatus queueUnbind( - const amqp_channel_t& channel, - const std::string& queue, - const std::string& exchange, - const std::string& routingKey, - const amqp_table_t *arguments); - -private: - AMQPStatus createConnection(); - AMQPStatus createSslConnection(); - - AMQPStatus connectConnection(); - - AMQPStatus closeConnection(); - - AMQPStatus closeChannel( - const amqp_channel_t& channel); - - int32 receiveFrame( - const amqp_connection_state_t& connectionState, - SmartPtrCAmqpFrame& frame) const; - - void addFrames( - const CAmqpFrames& frames, - const SmartPtrCChannelFrames& channelFrames) const; - - bool isDataAvail( - const amqp_connection_state_t& connectionState) const; - - void validateOpenChannel( - const amqp_channel_t& channel) const; - - void restartListener( - const std::string& reason) const; - -private: - amqp_connection_state_t _connectionState; - amqp_socket_t* _socket; - amqp_channel_t _curChannel; - AMQPConnectionState _connectionStateEnum; - bool _isConnectionLost; - int32 _lastStatus; - - SmartPtrCAmqpAuthMechanism _auth; - uint16 _channelMax; - uint32 _frameMax; - uint16 _heartbeat; - uint16 _retries; - uint16 _secondsToWait; - SmartPtrAddress _address; - SmartPtrCertInfo _certInfo; - SmartPtrCChannelFrames _channelFrames; - - Csetstr _cachedStrings; - COpenChannels _openChannels; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_THREADSAFE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CAmqpConnection); -}; - -}} - -#endif /* AMQPCLIENT_CAMQPCONNECTION_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/CAmqpFrame.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/CAmqpFrame.h deleted file mode 100644 index a0d48a2b8..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/CAmqpFrame.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Created on: May 7, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AMQPCLIENT_CAMQPFRAME_H_ -#define AMQPCLIENT_CAMQPFRAME_H_ - -#include "amqp.h" - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApiImpl - * @remark LIBRARY IMPLEMENTATION - NOT PART OF THE PUBLIC API - * @brief Manages a set of channels for a connection. - * Channels are indexed by channel number (1.._channelMax). - */ -class CAmqpFrame { -public: - CAmqpFrame(); - virtual ~CAmqpFrame(); - -public: - void initialize( - const amqp_frame_t& frame); - - uint8_t getFrameType() const; - amqp_channel_t getChannel() const; - - const amqp_method_t* const getPayloadAsMethod() const; - - uint16_t getHeaderClassId() const; - uint64_t getHeaderBodySize() const; - const amqp_basic_properties_t* const getHeaderProperties() const; - - const amqp_bytes_t* const getBodyFragment() const; - - void log(const std::string& prefix) const; - -private: - bool _isInitialized; - - uint8_t _frameType; - amqp_channel_t _channel; - - amqp_method_t _method; - - uint16_t _propertiesClassId; - uint64_t _propertiesBodySize; - amqp_basic_properties_t* _propertiesDecoded; - - amqp_bytes_t _bodyFragment; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CAmqpFrame); -}; -CAF_DECLARE_SMART_POINTER(CAmqpFrame); - -}} - -#endif /* AMQPCLIENT_CAMQPFRAME_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/CommandAssembler.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/CommandAssembler.h deleted file mode 100644 index f59821189..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/CommandAssembler.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Created on: May 9, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef COMMANDASSEMBLER_H_ -#define COMMANDASSEMBLER_H_ - - -#include "Memory/DynamicArray/DynamicArrayInc.h" -#include "amqpClient/CAmqpFrame.h" -#include "amqpClient/amqpImpl/IContentHeader.h" -#include "amqpClient/amqpImpl/IMethod.h" - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApiImpl - * @remark LIBRARY IMPLEMENTATION - NOT PART OF THE PUBLIC API - * @brief A class that manages the assembly of AMQP frames into a complete AMQP method - */ -class CommandAssembler { -public: - CommandAssembler(); - virtual ~CommandAssembler(); - - /** - * @brief Initialize the object - */ - void init(); - - /** - * @brief Process the AMQP frame - * @param frame AMQP frame - * @retval true all of the frames have been received and the AMQP method is complete - * @retval false more frames are required to complete the AMQP method - */ - bool handleFrame(const SmartPtrCAmqpFrame& frame); - - /** - * @brief Return the completion status of the method - * @retval true all frames have been received and the AMQP method is complete - * @retval false more frames are required to complete the AMQP method - */ - bool isComplete(); - - /** - * @brief Return the Method - * @return the interface to the Method. QueryInterface to the appropriate - * derived type based on the class ID and method ID. - */ - SmartPtrIMethod getMethod(); - - /** - * @brief Return the ContentHeader - * @return the interface to the ContentHeader. QueryInterface to the appropriate - * derived type based on the class ID. - */ - SmartPtrIContentHeader getContentHeader(); - - /** - * @brief Return the method body - * @return the method body data as raw bytes - */ - SmartPtrCDynamicByteArray getContentBody(); - -private: - typedef enum { - EXPECTING_METHOD, - EXPECTING_CONTENT_HEADER, - EXPECTING_CONTENT_BODY, - COMPLETE - } CAState; - - typedef std::deque CBodyCollection; - -private: - void consumeBodyFrame(const SmartPtrCAmqpFrame& frame); - void consumeHeaderFrame(const SmartPtrCAmqpFrame& frame); - void consumeMethodFrame(const SmartPtrCAmqpFrame& frame); - void updateContentBodyState(); - void appendBodyFragment(const amqp_bytes_t * const fragment); - SmartPtrCDynamicByteArray coalesceContentBody(); - -private: - bool _isInitialized; - CAState _state; - SmartPtrIMethod _method; - SmartPtrIContentHeader _contentHeader; - uint32 _remainingBodyBytes; - CBodyCollection _bodyCollection; - uint32 _bodyLength; - - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(CommandAssembler); -}; -CAF_DECLARE_SMART_POINTER(CommandAssembler); - -}} -#endif /* COMMANDASSEMBLER_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/ConnectionFactoryImpl.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/ConnectionFactoryImpl.h deleted file mode 100644 index b982462c7..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/ConnectionFactoryImpl.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Created on: May 2, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CONNECTIONFACTORYIMPL_H_ -#define CONNECTIONFACTORYIMPL_H_ - -#include "amqpClient/api/ConnectionFactory.h" -#include "amqpClient/api/Address.h" -#include "amqpClient/api/CertInfo.h" -#include "amqpClient/api/Connection.h" - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApiImpl - * @remark LIBRARY IMPLEMENTATION - NOT PART OF THE PUBLIC API - * @brief Implementation of ConnectionFactory - */ -class ConnectionFactoryImpl : public ConnectionFactory { -public: - ConnectionFactoryImpl(); - virtual ~ConnectionFactoryImpl(); - -public: // ConectionFactory - std::string getProtocol() const; - void setProtocol(const std::string& host); - std::string getHost() const; - void setHost(const std::string& host); - uint32 getPort() const; - void setPort(const uint32 port); - std::string getVirtualHost() const; - void setVirtualHost(const std::string& virtualHost); - std::string getUsername() const; - void setUsername(const std::string& username); - std::string getPassword() const; - void setPassword(const std::string& password); - std::string getCaCertPath() const; - void setCaCertPath(const std::string& caCertPath); - std::string getClientCertPath() const; - void setClientCertPath(const std::string& clientCertPath); - std::string getClientKeyPath() const; - void setClientKeyPath(const std::string& clientKeyPath); - uint32 getRequestedChannelMax() const; - void setRequestedChannelMax(const uint32 requestedChannelMax); - uint32 getRequestedFrameMax() const; - void setRequestedFrameMax(const uint32 requestedFrameMax); - uint32 getRequestedHeartbeat() const; - void setRequestedHeartbeat(const uint32 requestedHeartbeat); - uint32 getConnectionTimeout() const; - void setConnectionTimeout(const uint32 connectionTimeout); - uint32 getConsumerThreadCount() const; - void setConsumerThreadCount(const uint32 threadCount); - uint16 getRetries() const; - void setRetries(const uint16 retries); - uint16 getSecondsToWait() const; - void setSecondsToWait(const uint16 seconds); - - SmartPtrConnection newConnection(); - SmartPtrConnection newConnection( - const SmartPtrAddress& address, - const SmartPtrCertInfo& certInfo); - -private: - uint32 portOrDefault(const uint32 port) const; - -private: - std::string _protocol; - std::string _host; - uint32 _port; - std::string _virtualHost; - std::string _username; - std::string _password; - std::string _caCertPath; - std::string _clientCertPath; - std::string _clientKeyPath; - uint32 _requestedChannelMax; - uint32 _requestedFrameMax; - uint32 _requestedHeartbeat; - uint32 _connectionTimeout; - uint32 _consumerThreadCount; - uint16 _retries; - uint16 _secondsToWait; - - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(ConnectionFactoryImpl); -}; -CAF_DECLARE_SMART_POINTER(ConnectionFactoryImpl); - -}} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/ConnectionWeakReference.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/ConnectionWeakReference.h deleted file mode 100644 index 2b680342b..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/ConnectionWeakReference.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Created on: May 7, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CONNECTIONWEAKREFERENCE_H_ -#define CONNECTIONWEAKREFERENCE_H_ - - -#include "amqpClient/IConnectionInt.h" -#include "amqpClient/CAmqpChannel.h" - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApiImpl - * @remark LIBRARY IMPLEMENTATION - NOT PART OF THE PUBLIC API - * @brief This class manages a weak reference to a IConnectionInt object. - *

- * The channel manager needs a reference to its connection. The connection object - * has a reference to the channel manager. To break this reference cycle the channel - * manager will be handed weak references to the connection. - */ -class ConnectionWeakReference : public IConnectionInt { -public: - ConnectionWeakReference(); - virtual ~ConnectionWeakReference(); - -public: - /** - * @brief Sets the weakly referenced object - * @param connection the weakly referenced object - */ - void setReference(IConnectionInt* connection); - - /** - * @brief Clears the weakly referenced object. - * - * Calls to any Connection method on this object will result in a thrown - * exception after this method has been called. - */ - void clearReference(); - -public: // IConnectionInt - AMQPStatus amqpConnectionOpenChannel(SmartPtrCAmqpChannel& channel); - - void notifyChannelClosedByServer(const uint16 channelNumber); - - void channelCloseChannel(Channel *channel); - -private: - IConnectionInt* _connection; - CAF_CM_CREATE; - CAF_CM_CREATE_THREADSAFE; - CAF_CM_DECLARE_NOCOPY(ConnectionWeakReference); -}; -CAF_DECLARE_SMART_POINTER(ConnectionWeakReference); - -}} - -#endif /* CONNECTIONWEAKREFERENCE_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/ConsumerDispatcher.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/ConsumerDispatcher.h deleted file mode 100644 index cc0dde985..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/ConsumerDispatcher.h +++ /dev/null @@ -1,208 +0,0 @@ -/* - * Created on: May 21, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CONSUMERDISPATCHER_H_ -#define CONSUMERDISPATCHER_H_ - - - -#include "ICafObject.h" - -#include "amqpClient/amqpImpl/BasicProperties.h" -#include "Exception/CCafException.h" -#include "Memory/DynamicArray/DynamicArrayInc.h" -#include "amqpClient/ConsumerWorkService.h" -#include "amqpClient/api/Consumer.h" -#include "amqpClient/api/Envelope.h" - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApiImpl - * @remark LIBRARY IMPLEMENTATION - NOT PART OF THE PUBLIC API - * @brief Dispatches notifications to a {@link Consumer} on an internally-managed work pool. - *

- * Each {@link Channel} has a single {@link ConsumerDispatcher}, but the work pool may be - * shared with other channels, typically those on the name {@link AMQConnection}. - */ -class ConsumerDispatcher { -public: - ConsumerDispatcher(); - virtual ~ConsumerDispatcher(); - - /** - * @brief Initialize the object - * @param workService work service providing a work pool for dispatching notifications - */ - void init( - const SmartPtrConsumerWorkService& workService); - - /** - * @brief Prepare for shutdown of all consumers on this channel - */ - void quiesce(); - - /** - * @brief Lock the dispatcher - *

- * Place a lock on the dispatcher. All threads attemping to call the dispatcher will - * be blocked until unlock is called. - */ - void lock(); - - /** - * @brief unlock the dispatcher - *

- * Remove the lock on the dispatcher. - */ - void unlock(); - - /** - * @brief Adds a consumer to the dispatcher - * @param consumerTag consumer tag - * @param consumer consumer object - */ - void addConsumer( - const std::string& consumerTag, - const SmartPtrConsumer& consumer); - - /** - * @brief Removes a consumer from the dispatcher - * @param consumerTag consumer tag - */ - void removeConsumer( - const std::string& consumerTag); - - /** - * @brief Retrieves a consumer from the dispatcher - * @param consumerTag consumer tag - * @return the consumer or null if not found - */ - SmartPtrConsumer getConsumer( - const std::string& consumerTag); - - /** - * @brief Handle basic.consume-ok - * @param consumerTag consumer tag - */ - void handleConsumeOk( - const std::string& consumerTag); - - /** - * @brief Handle basic.cancel-ok - * @param consumerTag consumer tag - */ - void handleCancelOk( - const std::string& consumerTag); - - /** - * @brief Handle basic.recover-ok - */ - void handleRecoverOk(); - - /** - * @brief Handle basic.delivery - * @param consumerTag consumer tag - * @param envelope message envelope - * @param properties message properties and headers - * @param body message body - */ - void handleDelivery( - const std::string& consumerTag, - const SmartPtrEnvelope& envelope, - const AmqpContentHeaders::SmartPtrBasicProperties& properties, - const SmartPtrCDynamicByteArray& body); - - /** - * @brief Handle a channel shutdown event - * @param exception reason for the shutdown - */ - void handleShutdown(SmartPtrCCafException exception); - -private: // Task support - typedef enum { - DISPATCH_ITEM_METHOD_HANDLE_CONSUME_OK, - DISPATCH_ITEM_METHOD_HANDLE_CANCEL_OK, - DISPATCH_ITEM_METHOD_HANDLE_RECOVER_OK, - DISPATCH_ITEM_METHOD_HANDLE_DELIVERY, - DISPATCH_ITEM_METHOD_TERMINATE - } DispatchItemMethod; - - class DispatcherWorkItem : public ICafObject { - public: - DispatcherWorkItem(); - - void init( - const DispatchItemMethod method); - - void init( - const DispatchItemMethod method, - const SmartPtrEnvelope& envelope, - const AmqpContentHeaders::SmartPtrBasicProperties& properties, - const SmartPtrCDynamicByteArray& body); - - DispatchItemMethod getMethod() const; - SmartPtrEnvelope getEnvelope() const; - AmqpContentHeaders::SmartPtrBasicProperties getProperties() const; - SmartPtrCDynamicByteArray getBody() const; - - private: - DispatchItemMethod _method; - SmartPtrEnvelope _envelope; - AmqpContentHeaders::SmartPtrBasicProperties _properties; - SmartPtrCDynamicByteArray _body; - }; - CAF_DECLARE_SMART_POINTER(DispatcherWorkItem); - - class DispatcherTask : public CManagedThreadPool::IThreadTask { - public: - DispatcherTask(); - ~DispatcherTask(); - - void init( - const std::string& consumerTag, - const SmartPtrConsumer& consumer); - - void term(); - - void addWorkItem(const SmartPtrDispatcherWorkItem& workItem); - - bool run(); - - private: - static void FreeWorkItem(gpointer data); - - private: - std::string _consumerTag; - SmartPtrConsumer _consumer; - GAsyncQueue *_workItemQueue; - }; - CAF_DECLARE_SMART_POINTER(DispatcherTask); - -private: - typedef std::pair ConsumerItem; - typedef std::map ConsumerMap; - - ConsumerItem getConsumerItem(const std::string& consumerTag); - -private: - bool _isInitialized; - volatile bool _isShuttingDown; - SmartPtrConsumerWorkService _workService; - ConsumerMap _consumers; - - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_CREATE_THREADSAFE; - CAF_CM_DECLARE_NOCOPY(ConsumerDispatcher); -}; -CAF_DECLARE_SMART_POINTER(ConsumerDispatcher); - -}} - -#endif /* CONSUMERDISPATCHER_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/ConsumerWorkService.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/ConsumerWorkService.h deleted file mode 100644 index bb981f0f9..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/ConsumerWorkService.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Created on: May 9, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CONSUMERWORKSERVICE_H_ -#define CONSUMERWORKSERVICE_H_ - - -#include "Common/CManagedThreadPool.h" - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApiImpl - * @remark LIBRARY IMPLEMENTATION - NOT PART OF THE PUBLIC API - * @brief This class wraps a thread pool for executing channel worker threads - */ -class ConsumerWorkService { -public: - ConsumerWorkService(); - virtual ~ConsumerWorkService(); - - /** - * @brief Initializer - * @param threadPool the thread pool used to execute channel threads - */ - void init(const SmartPtrCManagedThreadPool& threadPool); - - /** - * @brief Add a worker thread to the pool - * @param task the task to add - */ - void addWork(const CManagedThreadPool::SmartPtrIThreadTask& task); - - /** - * @brief Respond to a connection-closed notification by terminating the thread pool - */ - void notifyConnectionClosed(); - -private: - bool _isInitialized; - SmartPtrCManagedThreadPool _threadPool; - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(ConsumerWorkService); -}; -CAF_DECLARE_SMART_POINTER(ConsumerWorkService); - -}} - -#endif /* CONSUMERWORKSERVICE_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/IConnectionInt.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/IConnectionInt.h deleted file mode 100644 index 37ea3e874..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/IConnectionInt.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Created on: May 8, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef ICONNECTIONINT_H_ -#define ICONNECTIONINT_H_ - -#include "ICafObject.h" - -#include "amqpClient/CAmqpChannel.h" -#include "amqpClient/api/Channel.h" - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApiImpl - * @remark LIBRARY IMPLEMENTATION - NOT PART OF THE PUBLIC API - * @brief This interface abstracts the calls to AMQP_ConnectionXXX c-api calls - *

- * AMQConnection objects pass weak references to themselves to AMQChannel objects - * allowing them to make calls against the channel that require the connection handle. - */ -struct __declspec(novtable) IConnectionInt : public ICafObject { - - /** - * @brief Pass-through for the AMQP_ConnectionOpenChannel call - * @param channel the channel handle to be returned - * @return the AMQPStatus of the call. If AMQP_ERROR_OK then - * channel will be set to a valid channel handle. - */ - virtual AMQPStatus amqpConnectionOpenChannel(SmartPtrCAmqpChannel& channel) = 0; - - /** - * @brief Callback to notify the connection that a channel has been closed. This - * is in reponse to the server sending a channel.close method. - * @param channelNumber the channel number - */ - virtual void notifyChannelClosedByServer(const uint16 channelNumber) = 0; - - /** - * @brief Callback to notify the connection that a channel is being - * requested to close. - * @param channel Channel to close - */ - virtual void channelCloseChannel(Channel *channel) = 0; - -}; -CAF_DECLARE_SMART_INTERFACE_POINTER(IConnectionInt); - -}} - -#endif /* ICONNECTIONINT_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/IRpcContinuation.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/IRpcContinuation.h deleted file mode 100644 index b9175c391..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/IRpcContinuation.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Created on: May 15, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef IRPCCONTINUATION_H_ -#define IRPCCONTINUATION_H_ - - -#include "ICafObject.h" - -#include "Exception/CCafException.h" -#include "amqpClient/AMQCommand.h" - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApiImpl - * @remark LIBRARY IMPLEMENTATION - NOT PART OF THE PUBLIC API - * @brief Interface for RPC worker objects - *

- * The channel worker thread will assemble incoming AMQP frames an then process - * the compiled frames as an AMQCommand object. If the command object belongs - * to an outstanding RPC call, that call will receive the command for processing. - */ -struct __declspec(novtable) IRpcContinuation : public ICafObject { - /** - * @brief Process the received AMQP command - * @param command the AMQCommand command object - */ - virtual void handleCommand(const SmartPtrAMQCommand& command) = 0; - - /** - * @brief Abort the command for the reason supplied - * @param exception the reason as an exception - */ - virtual void handleAbort(SmartPtrCCafException exception) = 0; -}; -CAF_DECLARE_SMART_INTERFACE_POINTER(IRpcContinuation); - -}} - - -#endif /* IRPCCONTINUATION_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/TCopyOnWriteContainer.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/TCopyOnWriteContainer.h deleted file mode 100644 index fc469c0a0..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/TCopyOnWriteContainer.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Created on: May 21, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef TCOPYONWRITECONTAINER_H_ -#define TCOPYONWRITECONTAINER_H_ - -namespace Caf { namespace AmqpClient { - -/** - * @ingroup AmqpApiImpl - * @remark LIBRARY IMPLEMENTATION - NOT PART OF THE PUBLIC API - * @brief An STL container wrapper that implements copy-on-write semantics - */ -template -class TCopyOnWriteContainer { -public: - typedef TCafSmartPtr > SmartPtrContainer; - - TCopyOnWriteContainer() { - _container.CreateInstance(); - } - - SmartPtrContainer getAll() { - return _container; - } - - void add(const ValueType& value) { - SmartPtrContainer newContainer; - newContainer.CreateInstance(); - newContainer->insert( - newContainer->begin(), - _container->begin(), - _container->end()); - newContainer->push_back(value); - _container = newContainer; - } - - bool remove(const ValueType& value) { - bool found = false; - SmartPtrContainer newContainer; - newContainer.CreateInstance(); - SmartPtrContainer currContainer = _container; - for (typename Container::const_iterator iter = currContainer->begin(); - iter != currContainer->end(); - ++iter) { - if (*iter == value) { - found = true; - } else { - newContainer->push_back(*iter); - } - } - - if (found) { - _container = newContainer; - } - return found; - } - - void clear() { - _container.CreateInstance(); - } - -private: - SmartPtrContainer _container; -}; - -}} - -#endif /* TCOPYONWRITECONTAINER_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/BasicAckMethod.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/BasicAckMethod.h deleted file mode 100644 index 20d02c9d7..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/BasicAckMethod.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Created on: May 16, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef BASICACKMETHOD_H_ -#define BASICACKMETHOD_H_ - -#include "amqpClient/amqpImpl/IServerMethod.h" -#include "amqpClient/CAmqpChannel.h" - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApiImpl - * @remark LIBRARY IMPLEMENTATION - NOT PART OF THE PUBLIC API - * @brief Implementation of AMQP basic.ack - */ -class BasicAckMethod :public IServerMethod { -public: - BasicAckMethod(); - virtual ~BasicAckMethod(); - - /** - * @brief Initialize the method - * @param deliveryTag delivery tag - * @param ackMultiple acknowledge multiple flag - */ - void init( - const uint64 deliveryTag, - const bool ackMultiple); - -public: // IServerMethod - std::string getMethodName() const; - - AMQPStatus send(const SmartPtrCAmqpChannel& channel); - -private: - bool _isInitialized; - uint64 _deliveryTag; - bool _ackMultiple; - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(BasicAckMethod); -}; -CAF_DECLARE_SMART_POINTER(BasicAckMethod); - -}} - -#endif /* BASICACKMETHOD_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/BasicCancelMethod.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/BasicCancelMethod.h deleted file mode 100644 index 2c4ed6d0c..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/BasicCancelMethod.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Created on: May 21, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef BASICCANCELMETHOD_H_ -#define BASICCANCELMETHOD_H_ - -#include "amqpClient/amqpImpl/IServerMethod.h" -#include "amqpClient/CAmqpChannel.h" - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApiImpl - * @remark LIBRARY IMPLEMENTATION - NOT PART OF THE PUBLIC API - * @brief Implementation of AMQP basic.cancel - */ -class BasicCancelMethod : public IServerMethod { -public: - BasicCancelMethod(); - virtual ~BasicCancelMethod(); - - /** - * @brief Initialize the method - * @param consumerTag the consumer tag associated with the consumer - */ - void init( - const std::string& consumerTag); - -public: // IServerMethod - std::string getMethodName() const; - - AMQPStatus send(const SmartPtrCAmqpChannel& channel); - -private: - bool _isInitialized; - std::string _consumerTag; - - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(BasicCancelMethod); -}; -CAF_DECLARE_SMART_POINTER(BasicCancelMethod); - -}} - -#endif /* BASICCANCELMETHOD_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/BasicConsumeMethod.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/BasicConsumeMethod.h deleted file mode 100644 index 0192eb0e0..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/BasicConsumeMethod.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Created on: May 21, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef BASICCONSUMEMETHOD_H_ -#define BASICCONSUMEMETHOD_H_ - -#include "amqpClient/amqpImpl/IServerMethod.h" -#include "amqpClient/CAmqpChannel.h" -#include "amqpClient/api/amqpClient.h" - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApiImpl - * @remark LIBRARY IMPLEMENTATION - NOT PART OF THE PUBLIC API - * @brief Implementation of AMQP basic.consume - */ -class BasicConsumeMethod : public IServerMethod { -public: - BasicConsumeMethod(); - virtual ~BasicConsumeMethod(); - - /** - * @brief Initialize the method - * @param queue queue name - * @param consumerTag consumer tag (or blank for server-generated tag) - * @param noLocal do not send messages to the connection that published them - * @param noAck no acknowledgement needed - * @param exclusive request exclusive consumer access to the queue - * @param arguments additional call arguments - */ - void init( - const std::string& queue, - const std::string& consumerTag, - const bool noLocal, - const bool noAck, - const bool exclusive, - const SmartPtrTable& arguments); - -public: // IServerMethod - std::string getMethodName() const; - - AMQPStatus send(const SmartPtrCAmqpChannel& channel); - -private: - bool _isInitialized; - std::string _queue; - std::string _consumerTag; - bool _noLocal; - bool _noAck; - bool _exclusive; - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(BasicConsumeMethod); -}; -CAF_DECLARE_SMART_POINTER(BasicConsumeMethod); - -}} - -#endif /* BASICCONSUMEMETHOD_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/BasicGetMethod.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/BasicGetMethod.h deleted file mode 100644 index d934c6643..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/BasicGetMethod.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Created on: May 16, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef BASICGETMETHOD_H_ -#define BASICGETMETHOD_H_ - -#include "amqpClient/amqpImpl/IServerMethod.h" -#include "amqpClient/CAmqpChannel.h" - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApiImpl - * @remark LIBRARY IMPLEMENTATION - NOT PART OF THE PUBLIC API - * @brief Implementation of AMQP basic.get - */ -class BasicGetMethod : public IServerMethod { -public: - BasicGetMethod(); - virtual ~BasicGetMethod(); - - /** - * @brief Initialize the method - * @param queue queue name - * @param noAck no acknowledgement (manual acknowledgement) fag - */ - void init( - const std::string& queue, - const bool noAck); - -public: // IServerMethod - std::string getMethodName() const; - - AMQPStatus send(const SmartPtrCAmqpChannel& channel); - -private: - bool _isInitialized; - std::string _queue; - bool _noAck; - - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(BasicGetMethod); -}; -CAF_DECLARE_SMART_POINTER(BasicGetMethod); - -}} - -#endif /* BASICGETMETHOD_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/BasicProperties.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/BasicProperties.h deleted file mode 100644 index 42f657378..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/BasicProperties.h +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Created on: May 11, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef BASICPROPERTIES_H_ -#define BASICPROPERTIES_H_ - -#include "amqpClient/api/amqpClient.h" -#include "amqpClient/amqpImpl/IContentHeader.h" -#include "amqpClient/CAmqpFrame.h" -#include "amqpClient/api/AmqpContentHeaders.h" - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApiImpl - * @remark LIBRARY IMPLEMENTATION - NOT PART OF THE PUBLIC API - * @brief Implementation of AMQP basic properties - */ -class BasicProperties : - public AmqpContentHeaders::BasicProperties, - public IContentHeader { - CAF_DECL_UUID("db3dbcd6-f241-47ff-b17c-d5cf6addabf8") - - CAF_BEGIN_QI() - CAF_QI_ENTRY(AmqpContentHeaders::BasicProperties) - CAF_QI_ENTRY(IContentHeader) - CAF_QI_ENTRY(BasicProperties) - CAF_END_QI() -public: - BasicProperties(); - virtual ~BasicProperties(); - - /** - * @brief Initialize the properties - *

- * This version creates an object with no properties. Call the setXXX methods - * to add properties. - */ - void init(); - - /** - * @brief Initialize the properties - *

- * Set the flags property to the binary 'or' (|) of - * BASIC_PROPERTY_XXXX_FLAG constants representing the fields present. - *

- * Use 0, std::string() or - * SmartPtrTable() to skip initialization of fields not included - * in the object. - */ - void init( - const uint32 flags, - const std::string& contentType, - const std::string& contentEncoding, - const SmartPtrTable& headers, - const uint8 deliveryMode, - const uint8 priority, - const std::string& correlationId, - const std::string& replyTo, - const std::string& expiration, - const std::string& messageId, - const uint64 timestamp, - const std::string& type, - const std::string& userId, - const std::string& appId, - const std::string& clusterId); - - /** - * @brief Converts this class instance into a c-api amqp_basic_properties_t struct. - *

- * The pointers in the c-api struct point at member of this class. This class instance - * must be realized as int32 as the return properties is in use. - * @param properties the c-api properties structure to be filled out - */ - void getAsApiProperties(amqp_basic_properties_t& properties); - -public: // IContentHeader - void init(const SmartPtrCAmqpFrame& frame); - - uint64 getBodySize(); - -public: // AmqpProperties::BasicProperties, - bool areHeadersAvailable(); - uint32 getFlags(); - std::string getContentType(); - void setContentType(const std::string& contentType); - std::string getContentEncoding(); - void setContentEncoding(const std::string& contentEncoding); - SmartPtrTable getHeaders(); - void setHeaders(const SmartPtrTable& headers); - uint8 getDeliveryMode(); - void setDeliveryMode(const uint8 deliveryMode); - uint8 getPriority(); - void setPriority(const uint8 priority); - std::string getCorrelationId(); - void setCorrelationId(const std::string& correlationId); - std::string getReplyTo(); - void setReplyTo(const std::string& replyTo); - std::string getExpiration(); - void setExpiration(const std::string& expiration); - std::string getMessageId(); - void setMessageId(const std::string& messageId); - uint64 getTimestamp(); - void setTimestamp(const uint64 timestamp); - std::string getType(); - void setType(const std::string& type); - std::string getUserId(); - void setUserId(const std::string& userId); - std::string getAppId(); - void setAppId(const std::string& appId); - std::string getClusterId(); - void setClusterId(const std::string& clusterId); - -public: // IAmqpContentHeader - uint16 getClassId(); - - std::string getClassName(); - -private: - void ValidatePropertyIsSet( - const uint32 flag, - const char* propertyName); - -private: - bool _isInitialized; - uint32 _flags; - uint64 _bodySize; - std::string _contentType; - std::string _contentEncoding; - SmartPtrTable _headers; - uint8 _deliveryMode; - uint8 _priority; - std::string _correlationId; - std::string _replyTo; - std::string _expiration; - std::string _messageId; - uint64 _timestamp; - std::string _type; - std::string _userId; - std::string _appId; - std::string _clusterId; - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(BasicProperties); -}; -CAF_DECLARE_SMART_QI_POINTER(BasicProperties); - -}} - -#endif /* BASICPROPERTIES_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/BasicPublishMethod.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/BasicPublishMethod.h deleted file mode 100644 index 65a9a0d73..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/BasicPublishMethod.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Created on: May 15, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef BASICPUBLISHMETHOD_H_ -#define BASICPUBLISHMETHOD_H_ - -#include "amqpClient/amqpImpl/IServerMethod.h" -#include "amqpClient/CAmqpChannel.h" -#include "amqpClient/amqpImpl/BasicProperties.h" -#include "Memory/DynamicArray/DynamicArrayInc.h" - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApiImpl - * @remark LIBRARY IMPLEMENTATION - NOT PART OF THE PUBLIC API - * @brief Implementation of AMQP basic.publish - */ -class BasicPublishMethod : public IServerMethod { -public: - BasicPublishMethod(); - virtual ~BasicPublishMethod(); - - /** - * @brief Initialize the method - * @param exchange exchange name - * @param routingKey routing key - * @param mandatory mandatory delivery flag - * @param immediate immediate delivery flag - * @param properties message properties - * @param body message body raw bytes - */ - void init( - const std::string& exchange, - const std::string& routingKey, - bool mandatory, - bool immediate, - const AmqpContentHeaders::SmartPtrBasicProperties& properties, - const SmartPtrCDynamicByteArray& body); - -public: // IServerMethod - std::string getMethodName() const; - - AMQPStatus send(const SmartPtrCAmqpChannel& channel); - -private: - bool _isInitialized; - std::string _exchange; - std::string _routingKey; - bool _mandatory; - bool _immediate; - AmqpContentHeaders::SmartPtrBasicProperties _properties; - SmartPtrCDynamicByteArray _body; - - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(BasicPublishMethod); -}; -CAF_DECLARE_SMART_POINTER(BasicPublishMethod); - -}} - -#endif /* BASICPUBLISHMETHOD_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/BasicQosMethod.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/BasicQosMethod.h deleted file mode 100644 index 54ee3b385..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/BasicQosMethod.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Created on: May 22, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef BASICQOSMETHOD_H_ -#define BASICQOSMETHOD_H_ - - -#include "amqpClient/amqpImpl/IServerMethod.h" - -#include "amqpClient/CAmqpChannel.h" - -namespace Caf { namespace AmqpClient { -/** - * @author mdonahue - * @ingroup AmqpApiImpl - * @remark LIBRARY IMPLEMENTATION - NOT PART OF THE PUBLIC API - * @brief Implementation of AMQP basic.qos - */ -class BasicQosMethod : public IServerMethod { -public: - BasicQosMethod(); - virtual ~BasicQosMethod(); - - /** - * @brief Initialize the method - * @param prefetchSize prefetch window in octets - * @param prefetchCount prefetch windows in messages - * @param global apply to entire connection - */ - void init( - const uint32 prefetchSize, - const uint16 prefetchCount, - const bool global); - -public: // IServerMethod - std::string getMethodName() const; - - AMQPStatus send(const SmartPtrCAmqpChannel& channel); - -private: - bool _isInitialized; - uint32 _prefetchSize; - uint16 _prefetchCount; - bool _global; - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(BasicQosMethod); - -}; -CAF_DECLARE_SMART_POINTER(BasicQosMethod); - -}} - -#endif /* BASICQOSMETHOD_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/BasicRecoverMethod.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/BasicRecoverMethod.h deleted file mode 100644 index 45083cd7a..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/BasicRecoverMethod.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Created on: May 21, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef BASICRECOVERMETHOD_H_ -#define BASICRECOVERMETHOD_H_ - -#include "amqpClient/amqpImpl/IServerMethod.h" -#include "amqpClient/CAmqpChannel.h" - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApiImpl - * @remark LIBRARY IMPLEMENTATION - NOT PART OF THE PUBLIC API - * @brief Implementation of AMQP basic.recover - */ -class BasicRecoverMethod : public IServerMethod { -public: - BasicRecoverMethod(); - virtual ~BasicRecoverMethod(); - - /** - * @brief Initialize the method - * @param requeue if false, the message will be redelivered to the - * original receipient. If true, the server will attempt to requeue - * the message, potentially delivering it to an alternative subscriber. - */ - void init( - const bool requeue); - -public: // IServerMethod - std::string getMethodName() const; - - AMQPStatus send(const SmartPtrCAmqpChannel& channel); - -private: - bool _isInitialized; - bool _requeue; - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(BasicRecoverMethod); - -}; -CAF_DECLARE_SMART_POINTER(BasicRecoverMethod); - -}} - -#endif /* BASICRECOVERMETHOD_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/BasicRejectMethod.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/BasicRejectMethod.h deleted file mode 100644 index 297430353..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/BasicRejectMethod.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Created on: Aug 1, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef BASICREJECTMETHOD_H_ -#define BASICREJECTMETHOD_H_ - - -#include "amqpClient/amqpImpl/IServerMethod.h" - -#include "amqpClient/CAmqpChannel.h" - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApiImpl - * @remark LIBRARY IMPLEMENTATION - NOT PART OF THE PUBLIC API - * @brief Implementation of AMQP basic.Reject - */ -class BasicRejectMethod : public IServerMethod { -public: - BasicRejectMethod(); - virtual ~BasicRejectMethod(); - - /** - * @brief Initialize the method - * @param deliveryTag delivery tag - * @param requeue requeue flag - */ - void init( - const uint64 deliveryTag, - const bool requeue); - -public: // IServerMethod - std::string getMethodName() const; - - AMQPStatus send(const SmartPtrCAmqpChannel& channel); - -private: - bool _isInitialized; - uint64 _deliveryTag; - bool _requeue; - - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(BasicRejectMethod); -}; -CAF_DECLARE_SMART_POINTER(BasicRejectMethod); - -}} - -#endif /* BASICREJECTMETHOD_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/ChannelCloseOkMethod.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/ChannelCloseOkMethod.h deleted file mode 100644 index fe1570162..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/ChannelCloseOkMethod.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Created on: May 17, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CHANNELCLOSEOKMETHOD_H_ -#define CHANNELCLOSEOKMETHOD_H_ - -#include "amqpClient/amqpImpl/IServerMethod.h" -#include "amqpClient/CAmqpChannel.h" - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApiImpl - * @remark LIBRARY IMPLEMENTATION - NOT PART OF THE PUBLIC API - * @brief Implementatin of AMQP channel.close-ok - */ -class ChannelCloseOkMethod :public IServerMethod { -public: - ChannelCloseOkMethod(); - virtual ~ChannelCloseOkMethod(); - - /** - * Initialize the method - */ - void init(); - -public: // IServerMethod - std::string getMethodName() const; - - AMQPStatus send(const SmartPtrCAmqpChannel& channel); - -private: - bool _isInitialized; - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(ChannelCloseOkMethod); -}; -CAF_DECLARE_SMART_POINTER(ChannelCloseOkMethod); - -}} - -#endif /* CHANNELCLOSEOKMETHOD_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/EnvelopeImpl.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/EnvelopeImpl.h deleted file mode 100644 index 6b1d8c12a..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/EnvelopeImpl.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Created on: May 16, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef ENVELOPEIMPL_H_ -#define ENVELOPEIMPL_H_ - -#include "amqpClient/api/Envelope.h" - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApiImpl - * @remark LIBRARY IMPLEMENTATION - NOT PART OF THE PUBLIC API - * @brief Implementation of Envelope - */ -class EnvelopeImpl : public Envelope { -public: - EnvelopeImpl(); - virtual ~EnvelopeImpl(); - - /** - * @brief Initialize the object - * @param deliveryTag delivery tag - * @param redelivered redelivered flag - * @param exchange exchange name - * @param routingKey routing key - */ - void init( - const uint64 deliveryTag, - const bool redelivered, - const std::string& exchange, - const std::string& routingKey); - -public: // Envelope - uint64 getDeliveryTag(); - bool getRedelivered(); - std::string getExchange(); - std::string getRoutingKey(); - -private: - bool _isInitialized; - uint64 _deliveryTag; - bool _redelivered; - std::string _exchange; - std::string _routingKey; - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(EnvelopeImpl); -}; -CAF_DECLARE_SMART_POINTER(EnvelopeImpl); - -}} - -#endif /* ENVELOPEIMPL_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/ExchangeDeclareMethod.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/ExchangeDeclareMethod.h deleted file mode 100644 index 76a2e70ab..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/ExchangeDeclareMethod.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Created on: May 16, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef EXCHANGEDECLAREMETHOD_H_ -#define EXCHANGEDECLAREMETHOD_H_ - -#include "amqpClient/amqpImpl/IServerMethod.h" -#include "amqpClient/CAmqpChannel.h" -#include "amqpClient/api/amqpClient.h" - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApiImpl - * @remark LIBRARY IMPLEMENTATION - NOT PART OF THE PUBLIC API - * @brief Implementation of AMQP exchange.declare - */ -class ExchangeDeclareMethod : public IServerMethod { -public: - ExchangeDeclareMethod(); - virtual ~ExchangeDeclareMethod(); - - /** - * @brief Initializes the method - * @param exchange exchange name - * @param type exchange type - * @param passive passive mode call - * @param durable request a durable exchange - * @param arguments declaration arguments - */ - void init( - const std::string& exchange, - const std::string& type, - const bool passive, - const bool durable, - const SmartPtrTable& arguments); - -public: // IServerMethod - std::string getMethodName() const; - - AMQPStatus send(const SmartPtrCAmqpChannel& channel); - -private: - bool _isInitialized; - std::string _exchange; - std::string _type; - bool _passive; - bool _durable; - - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(ExchangeDeclareMethod); -}; -CAF_DECLARE_SMART_POINTER(ExchangeDeclareMethod); - -}} -#endif /* EXCHANGEDECLAREMETHOD_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/ExchangeDeleteMethod.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/ExchangeDeleteMethod.h deleted file mode 100644 index 2a77c7918..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/ExchangeDeleteMethod.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Created on: May 16, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef EXCHANGEDELETEMETHOD_H_ -#define EXCHANGEDELETEMETHOD_H_ - -#include "amqpClient/amqpImpl/IServerMethod.h" -#include "amqpClient/CAmqpChannel.h" - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApiImpl - * @remark LIBRARY IMPLEMENTATION - NOT PART OF THE PUBLIC API - * @brief Implementation of AMQP exchange.delete - */ -class ExchangeDeleteMethod : public IServerMethod { -public: - ExchangeDeleteMethod(); - virtual ~ExchangeDeleteMethod(); - - /** - * @brief Initializes the method - * @param exchange exchange name - * @param ifUnused delete only if unused flag - */ - void init( - const std::string& exchange, - const bool ifUnused); - -public: // IServerMethod - std::string getMethodName() const; - - AMQPStatus send(const SmartPtrCAmqpChannel& channel); - -private: - bool _isInitialized; - std::string _exchange; - bool _ifUnused; - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(ExchangeDeleteMethod); - -}; -CAF_DECLARE_SMART_POINTER(ExchangeDeleteMethod); - -}} - -#endif /* EXCHANGEDELETEMETHOD_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/FieldImpl.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/FieldImpl.h deleted file mode 100644 index ca02c2922..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/FieldImpl.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Created on: May 11, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef FIELDIMPL_H_ -#define FIELDIMPL_H_ - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApiImpl - * @remark LIBRARY IMPLEMENTATION - NOT PART OF THE PUBLIC API - * @brief Implementation of a Field object - */ -class FieldImpl : public Field { -public: - FieldImpl(); - virtual ~FieldImpl(); - -public: // Field - AmqpFieldType getAmqpType() const; - - GVariant* getValue() const; - - void setTypeAndValue(AmqpFieldType type, GVariant *value); - -private: - AmqpFieldType _type; - GVariant *_value; - CAF_CM_DECLARE_NOCOPY(FieldImpl); -}; -CAF_DECLARE_SMART_POINTER(FieldImpl); - -}} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/GetResponseImpl.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/GetResponseImpl.h deleted file mode 100644 index a9c29e075..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/GetResponseImpl.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Created on: May 16, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef GETRESPONSEIMPL_H_ -#define GETRESPONSEIMPL_H_ - -#include "amqpClient/amqpImpl/BasicProperties.h" -#include "Memory/DynamicArray/DynamicArrayInc.h" -#include "amqpClient/api/Envelope.h" -#include "amqpClient/api/GetResponse.h" - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApiImpl - * @remark LIBRARY IMPLEMENTATION - NOT PART OF THE PUBLIC API - * @brief Impelementation of the GetResponse interface - *

- * A class to bundle together the information from a received message. The content is - * packaged into an Envelope, BasicProperties and the body for easier consumption as - * a single unit. - */ -class GetResponseImpl : public GetResponse { -public: - GetResponseImpl(); - virtual ~GetResponseImpl(); - - /** - * @brief Object initializer - * @param envelope the message envelope - * @param properties the messsage properties - * @param body the message body in raw bytes - * @param messageCount the number of messages remaining in the queue - */ - void init( - const SmartPtrEnvelope& envelope, - const AmqpContentHeaders::SmartPtrBasicProperties& properties, - const SmartPtrCDynamicByteArray& body, - const uint32 messageCount); - -public: // GetResponse - SmartPtrEnvelope getEnvelope(); - AmqpContentHeaders::SmartPtrBasicProperties getProperties(); - SmartPtrCDynamicByteArray getBody(); - uint32 getMessageCount(); - -private: - bool _isInitialized; - SmartPtrEnvelope _envelope; - AmqpContentHeaders::SmartPtrBasicProperties _properties; - SmartPtrCDynamicByteArray _body; - uint32 _messageCount; - - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(GetResponseImpl); -}; -CAF_DECLARE_SMART_POINTER(GetResponseImpl); - -}} - -#endif /* GETRESPONSEIMPL_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/IContentHeader.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/IContentHeader.h deleted file mode 100644 index d65479323..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/IContentHeader.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Created on: May 11, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef ICONTENTHEADER_H_ -#define ICONTENTHEADER_H_ - -#include "amqpClient/CAmqpFrame.h" -#include "amqpClient/api/ContentHeader.h" - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApiImpl - * @remark LIBRARY IMPLEMENTATION - NOT PART OF THE PUBLIC API - * @brief Base interface for AMQP content header implementation objects - */ -struct __declspec(novtable) IContentHeader : public ContentHeader { - CAF_DECL_UUID("04068590-3083-446E-83AE-DACD90C0F470") - - /** - * @brief Initialize the header object from c-api properties data - * @param properties the properties data - */ - virtual void init(const SmartPtrCAmqpFrame& frame) = 0; - - /** - * @brief Return the expected method body data size - * @return the expected body size - */ - virtual uint64 getBodySize() = 0; -}; -CAF_DECLARE_SMART_INTERFACE_POINTER(IContentHeader); - -}} - -#endif /* ICONTENTHEADER_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/IMethod.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/IMethod.h deleted file mode 100644 index c2070b477..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/IMethod.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Created on: May 10, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef IMETHOD_H_ -#define IMETHOD_H_ - -#include "amqpClient/api/Method.h" - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApiImpl - * @remark LIBRARY IMPLEMENTATION - NOT PART OF THE PUBLIC API - * @brief Base interface for AMQP method implementation objects - */ -struct __declspec(novtable) IMethod : public Method { - CAF_DECL_UUID("08ba9874-b34c-4afe-bfdc-a12fffaefddb") - - /** - * @brief Initialize the object from c-api method data - * @param method the method data - */ - virtual void init(const amqp_method_t * const method) = 0; - - /** - * @retval true if the method expects a content header - * @retval false if the method does not expect a content header - */ - virtual bool hasContent() = 0; -}; -CAF_DECLARE_SMART_INTERFACE_POINTER(IMethod); - -}} - -#endif /* IMETHOD_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/IServerMethod.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/IServerMethod.h deleted file mode 100644 index ae0e982ac..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/IServerMethod.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Created on: May 15, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef ISERVERMETHOD_H_ -#define ISERVERMETHOD_H_ - - -#include "ICafObject.h" - -#include "amqpClient/CAmqpChannel.h" - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApiImpl - * @remark LIBRARY IMPLEMENTATION - NOT PART OF THE PUBLIC API - * @brief Base interface for server methods - */ -struct __declspec(novtable) IServerMethod : public ICafObject { - CAF_DECL_UUID("ce585a8d-8b49-4312-b356-6f612142b154") - - /** - * Return the method name - * @return the method name - */ - virtual std::string getMethodName() const = 0; - - /** - * Sends the command to the server - * @param channel AMQP channel - * @return the c-api AMQPStatus of the call - */ - virtual AMQPStatus send(const SmartPtrCAmqpChannel& channel) = 0; -}; -CAF_DECLARE_SMART_INTERFACE_POINTER(IServerMethod); - -}} - -#endif /* ISERVERMETHOD_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/QueueBindMethod.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/QueueBindMethod.h deleted file mode 100644 index fb7f4cf4c..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/QueueBindMethod.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Created on: May 16, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef QUEUEBINDMETHOD_H_ -#define QUEUEBINDMETHOD_H_ - -#include "amqpClient/amqpImpl/IServerMethod.h" -#include "amqpClient/CAmqpChannel.h" -#include "amqpClient/api/amqpClient.h" - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApiImpl - * @remark LIBRARY IMPLEMENTATION - NOT PART OF THE PUBLIC API - * @brief Implementation of AMQP queue.bind - */ -class QueueBindMethod : public IServerMethod { -public: - QueueBindMethod(); - virtual ~QueueBindMethod(); - - /** - * @brief Initialize the method - * @param queue queue name - * @param exchange exchange name - * @param routingKey routing key - * @param arguments binding arguments - */ - void init( - const std::string& queue, - const std::string& exchange, - const std::string& routingKey, - const SmartPtrTable& arguments); - -public: // IServerMethod - std::string getMethodName() const; - - AMQPStatus send(const SmartPtrCAmqpChannel& channel); - -private: - bool _isInitialized; - std::string _queue; - std::string _exchange; - std::string _routingKey; - - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(QueueBindMethod); -}; -CAF_DECLARE_SMART_POINTER(QueueBindMethod); - -}} - -#endif /* QUEUEBINDMETHOD_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/QueueDeclareMethod.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/QueueDeclareMethod.h deleted file mode 100644 index 545508140..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/QueueDeclareMethod.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Created on: May 10, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef QUEUEDECLAREMETHOD_H_ -#define QUEUEDECLAREMETHOD_H_ - -#include "amqpClient/amqpImpl/IServerMethod.h" -#include "amqpClient/CAmqpChannel.h" -#include "amqpClient/api/amqpClient.h" - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApiImpl - * @remark LIBRARY IMPLEMENTATION - NOT PART OF THE PUBLIC API - * @brief Implementation of AMQP queue.declare - */ -class QueueDeclareMethod : - public IServerMethod { -public: - QueueDeclareMethod(); - virtual ~QueueDeclareMethod(); - - /** - * @brief Initialize the method using defaults - *

- * The defaults are: - * - * - * - * - * - * - * - * - *
ParameterValue
queueblank - the server will generate a queue name
durablefalse - the queue will not be durable
exclusivetrue - the queue will be exclusive to this conenction
autoDeletetrue - the queue will be deleted when no longer used
- */ - void init(); - - /** - * @brief Initialize the method - * @param queue queue name - * @param durable durable queue flag - * @param exclusive exclusive queue flag - * @param autoDelete delete when no longer in use flag - * @param arguments method arguments - */ - void init( - const std::string& queue, - bool durable, - bool exclusive, - bool autoDelete, - const SmartPtrTable& arguments); - - /** - * @brief Initialize the method in passive mode - * @param queue queue name - */ - void initPassive( - const std::string& queue); - -public: // IServerMethod - std::string getMethodName() const; - - AMQPStatus send(const SmartPtrCAmqpChannel& channel); - -private: - bool _isInitialized; - std::string _queue; - bool _passive; - bool _durable; - bool _exclusive; - bool _autoDelete; - bool _noWait; - - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(QueueDeclareMethod); -}; -CAF_DECLARE_SMART_POINTER(QueueDeclareMethod); - -}} - -#endif /* QUEUEDECLAREMETHOD_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/QueueDeleteMethod.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/QueueDeleteMethod.h deleted file mode 100644 index cdb0ea323..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/QueueDeleteMethod.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Created on: May 16, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef QUEUEDELETEMETHOD_H_ -#define QUEUEDELETEMETHOD_H_ - -#include "amqpClient/amqpImpl/IServerMethod.h" -#include "amqpClient/CAmqpChannel.h" - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApiImpl - * @remark LIBRARY IMPLEMENTATION - NOT PART OF THE PUBLIC API - * @brief Implementation of AMQP queue.delete - */ -class QueueDeleteMethod : public IServerMethod { -public: - QueueDeleteMethod(); - virtual ~QueueDeleteMethod(); - - /** - * @brief Initialize the method - * @param queue queue name - * @param ifUnused delete if queue is not in use flag - * @param ifEmpty delete is queue is empty flag - */ - void init( - const std::string& queue, - const bool ifUnused, - const bool ifEmpty); - -public: // IServerMethod - std::string getMethodName() const; - - AMQPStatus send(const SmartPtrCAmqpChannel& channel); - -private: - bool _isInitialized; - std::string _queue; - bool _ifUnused; - bool _ifEmpty; - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(QueueDeleteMethod); - -}; -CAF_DECLARE_SMART_POINTER(QueueDeleteMethod); - -}} - -#endif /* QUEUEDELETEMETHOD_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/QueuePurgeMethod.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/QueuePurgeMethod.h deleted file mode 100644 index 750e9be15..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/QueuePurgeMethod.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Created on: May 16, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef QUEUEPURGEMETHOD_H_ -#define QUEUEPURGEMETHOD_H_ - - -#include "amqpClient/amqpImpl/IServerMethod.h" - -#include "amqpClient/CAmqpChannel.h" - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApiImpl - * @remark LIBRARY IMPLEMENTATION - NOT PART OF THE PUBLIC API - * @brief Implementation of AMQP queue.purge - */ -class QueuePurgeMethod : public IServerMethod { -public: - QueuePurgeMethod(); - virtual ~QueuePurgeMethod(); - - /** - * @brief Initialize the method - * @param queue queue name - */ - void init( - const std::string& queue); - -public: // IServerMethod - std::string getMethodName() const; - - AMQPStatus send(const SmartPtrCAmqpChannel& channel); - -private: - bool _isInitialized; - std::string _queue; - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(QueuePurgeMethod); - -}; -CAF_DECLARE_SMART_POINTER(QueuePurgeMethod); - -}} - -#endif /* QUEUEPURGEMETHOD_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/QueueUnbindMethod.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/QueueUnbindMethod.h deleted file mode 100644 index dc65ce730..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/amqpImpl/QueueUnbindMethod.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Created on: May 16, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef QUEUEUNBINDMETHOD_H_ -#define QUEUEUNBINDMETHOD_H_ - - -#include "amqpClient/amqpImpl/IServerMethod.h" - -#include "amqpClient/CAmqpChannel.h" -#include "amqpClient/api/amqpClient.h" - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApiImpl - * @remark LIBRARY IMPLEMENTATION - NOT PART OF THE PUBLIC API - * @brief Implementation of AMQP queue.unbind - */ -class QueueUnbindMethod : public IServerMethod { -public: - QueueUnbindMethod(); - virtual ~QueueUnbindMethod(); - - /** - * @brief Initialize the method - * @param queue queue name - * @param exchange exchange name - * @param routingKey routing key - * @param arguments method arguments - */ - void init( - const std::string& queue, - const std::string& exchange, - const std::string& routingKey, - const SmartPtrTable& arguments); - -public: // IServerMethod - std::string getMethodName() const; - - AMQPStatus send(const SmartPtrCAmqpChannel& channel); - -private: - bool _isInitialized; - std::string _queue; - std::string _exchange; - std::string _routingKey; - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(QueueUnbindMethod); - -}; -CAF_DECLARE_SMART_POINTER(QueueUnbindMethod); - -}} - -#endif /* QUEUEUNBINDMETHOD_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/api/AMQExceptions.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/api/AMQExceptions.h deleted file mode 100644 index ecf794354..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/api/AMQExceptions.h +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Created on: May 3, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AMQPCLIENTAPI_AMQEXCEPTIONS_H_ -#define AMQPCLIENTAPI_AMQEXCEPTIONS_H_ - -#include "Exception/CCafException.h" -#include "amqpClient/AmqpClientLink.h" - -#define AMQP_CM_DECLARE_EXCEPTION_CLASS(_exclass_) \ -class AMQPCLIENT_LINKAGE _exclass_ : public Caf::CCafException { \ -public: \ - _exclass_(); \ - virtual ~_exclass_(); \ - void throwSelf(); \ - void throwAddRefedSelf(); \ -private: \ - _exclass_(const _exclass_ &); \ - _exclass_ & operator=(const _exclass_ &); \ -}; \ -typedef TCafSmartPtr<_exclass_, TCafObject<_exclass_> > SmartPtr##_exclass_ - -#define AMQP_CM_DEFINE_EXCEPTION_CLASS(_exclass_) \ - _exclass_::_exclass_() : CCafException( #_exclass_ ) {} \ - _exclass_::~_exclass_() {} \ - void _exclass_::throwSelf() { throw this; } \ - void _exclass_::throwAddRefedSelf() { this->AddRef(); throw this; } - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @brief Exceptions defined by this library - */ -namespace AmqpExceptions { - -/** @brief Unmapped AMQP exception */ -//AMQP_CM_DECLARE_EXCEPTION_CLASS(AmqpException); -class AMQPCLIENT_LINKAGE AmqpException : public Caf::CCafException { -public: - AmqpException(); - virtual ~AmqpException(); - void throwSelf(); - void throwAddRefedSelf(); -private: - AmqpException(const AmqpException &); - AmqpException & operator=(const AmqpException &); -}; -typedef TCafSmartPtr > SmartPtrAmqpException; - -/** @brief AMQP_ERROR_TIMEOUT exception */ -AMQP_CM_DECLARE_EXCEPTION_CLASS(AmqpTimeoutException); - -/** @brief AMQP_ERROR_NO_MEMORY exception */ -AMQP_CM_DECLARE_EXCEPTION_CLASS(AmqpNoMemoryException); - -/** @brief AMQP_ERROR_INVALID_HANDLE exception */ -AMQP_CM_DECLARE_EXCEPTION_CLASS(AmqpInvalidHandleException); - -/** @brief AMQP_ERROR_INVALID_ARGUMENT exception */ -AMQP_CM_DECLARE_EXCEPTION_CLASS(AmqpInvalidArgumentException); - -/** @brief AMQP_ERROR_WRONG_STATE exception */ -AMQP_CM_DECLARE_EXCEPTION_CLASS(AmqpWrongStateException); - -/** @brief AMQP_ERROR_TOO_MANY_CHANNELS exception */ -AMQP_CM_DECLARE_EXCEPTION_CLASS(AmqpTooManyChannelsException); - -/** @brief AMQP_ERROR_QUEUE_FULL exception */ -AMQP_CM_DECLARE_EXCEPTION_CLASS(AmqpQueueFullException); - -/** @brief AMQP_ERROR_FRAME_TOO_LARGE exception */ -AMQP_CM_DECLARE_EXCEPTION_CLASS(AmqpFrameTooLargeException); - -/** @brief AMQP_ERROR_IO_ERROR exception */ -AMQP_CM_DECLARE_EXCEPTION_CLASS(AmqpIoErrorException); - -/** @brief AMQP_ERROR_PROTOCOL_ERROR exception */ -AMQP_CM_DECLARE_EXCEPTION_CLASS(AmqpProtocolErrorException); - -/** @brief AMQP_ERROR_UNIMPLEMENTED exception */ -AMQP_CM_DECLARE_EXCEPTION_CLASS(AmqpUnimplementedException); - -/** @brief AMQP_ERROR_IO_INTERRUPTED exception */ -AMQP_CM_DECLARE_EXCEPTION_CLASS(AmqpIoInterruptedException); - -// Processing exceptions - -/** @brief Unexpected frame */ -AMQP_CM_DECLARE_EXCEPTION_CLASS(UnexpectedFrameException); - -/** @brief Unknown class or method */ -AMQP_CM_DECLARE_EXCEPTION_CLASS(UnknownClassOrMethodException); - -/** @brief Connection is closed */ -AMQP_CM_DECLARE_EXCEPTION_CLASS(ConnectionClosedException); - -/** @brief Channel is closed */ -AMQP_CM_DECLARE_EXCEPTION_CLASS(ChannelClosedException); - -/** @brief Connection closed because of an error */ -AMQP_CM_DECLARE_EXCEPTION_CLASS(ConnectionUnexpectedCloseException); - -/** @brief Connection closed because of an I/O error */ -AMQP_CM_DECLARE_EXCEPTION_CLASS(ConnectionClosedByIOException); - -/** @brief Channel closed by server because of an error */ -AMQP_CM_DECLARE_EXCEPTION_CLASS(ChannelClosedByServerException); - -/** @brief Channel closed by the application because it is shutting down */ -AMQP_CM_DECLARE_EXCEPTION_CLASS(ChannelClosedByShutdownException); - -/** @brief Channel closed by the application user under normal circumstances */ -AMQP_CM_DECLARE_EXCEPTION_CLASS(ChannelClosedByUserException); - -}}} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/api/Address.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/api/Address.h deleted file mode 100644 index 5dd81e44c..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/api/Address.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Created on: May 4, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AMQPCLIENTAPI_ADDRESS_H_ -#define AMQPCLIENTAPI_ADDRESS_H_ - -namespace Caf { namespace AmqpClient { - -/** Supported Protocols */ -typedef enum { - PROTOCOL_AMQP = 0, - PROTOCOL_AMQPS, - PROTOCOL_TUNNEL -} Protocol; - -/** - * @author mdonahue - * @brief A representation of a broker network address - */ -class Address { -public: - Address(); - virtual ~Address(); - -public: - /** - * @brief Construct an address from a protocol, host name, and port number - * @param protocol the communication protocol (tcp, ssl, etc.) - * @param host the host name or dotted ip address - * @param port the port number - */ - void initialize( - const std::string& protocol, - const std::string& host, - const uint32& port, - const std::string& virtualHost = std::string()); - - /** - * @return the protocol - */ - Protocol getProtocol() const; - - /** - * @return the protocol - */ - std::string getProtocolStr() const; - - /** - * @return the host name - */ - std::string getHost() const; - - /** - * @return the port number - */ - uint32 getPort() const; - - std::string getVirtualHost() const; - - std::string toString() const; - -private: - Protocol translateProtocol( - const std::string& protocol, - const std::string& host) const; - -private: - bool _isInitialized; - std::string _protocolStr; - Protocol _protocol; - std::string _host; - uint32 _port; - std::string _virtualHost; - std::string _toString; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(Address); -}; -CAF_DECLARE_SMART_POINTER(Address); - -}} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/api/AmqpContentHeaders.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/api/AmqpContentHeaders.h deleted file mode 100644 index 9001b9b83..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/api/AmqpContentHeaders.h +++ /dev/null @@ -1,201 +0,0 @@ -/* - * Created on: May 14, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AMQPCLIENTAPI_AMQPCONTENTHEADERS_H_ -#define AMQPCLIENTAPI_AMQPCONTENTHEADERS_H_ - -#include "amqpClient/api/amqpClient.h" -#include "amqpClient/amqpImpl/BasicProperties.h" - -namespace Caf { namespace AmqpClient { - -/** - * @ingroup AmqpApi - * @brief AMQP content header objects */ -namespace AmqpContentHeaders { - -/** @brief content type property is present */ -extern AMQPCLIENT_LINKAGE const uint32 BASIC_PROPERTY_CONTENT_TYPE_FLAG; -/** @brief content encoding property is present */ -extern AMQPCLIENT_LINKAGE const uint32 BASIC_PROPERTY_CONTENT_ENCODING_FLAG; -/** @brief headers are present */ -extern AMQPCLIENT_LINKAGE const uint32 BASIC_PROPERTY_HEADERS_FLAG; -/** @brief delivery mode property is present */ -extern AMQPCLIENT_LINKAGE const uint32 BASIC_PROPERTY_DEVLIVERY_MODE_FLAG; -/** @brief priority property is present */ -extern AMQPCLIENT_LINKAGE const uint32 BASIC_PROPERTY_PRIORITY_FLAG; -/** @brief correlation id property is present */ -extern AMQPCLIENT_LINKAGE const uint32 BASIC_PROPERTY_CORRELATION_ID_FLAG; -/** @brief reply to property is present */ -extern AMQPCLIENT_LINKAGE const uint32 BASIC_PROPERTY_REPLY_TO_FLAG; -/** @brief expiration property is present */ -extern AMQPCLIENT_LINKAGE const uint32 BASIC_PROPERTY_EXPIRATION_FLAG; -/** @brief message id property is present */ -extern AMQPCLIENT_LINKAGE const uint32 BASIC_PROPERTY_MESSAGE_ID_FLAG; -/** @brief timestamp property is present */ -extern AMQPCLIENT_LINKAGE const uint32 BASIC_PROPERTY_TIMESTAMP_FLAG; -/** @brief type property is present */ -extern AMQPCLIENT_LINKAGE const uint32 BASIC_PROPERTY_TYPE_FLAG; -/** @brief user id property is present */ -extern AMQPCLIENT_LINKAGE const uint32 BASIC_PROPERTY_USER_ID_FLAG; -/** @brief app id property is present */ -extern AMQPCLIENT_LINKAGE const uint32 BASIC_PROPERTY_APP_ID_FLAG; -/** @brief cluster id property is present */ -extern AMQPCLIENT_LINKAGE const uint32 BASIC_PROPERTY_CLUSTER_ID_FLAG; - -/** - * @author mdonahue - * @ingroup AmqpApi - * @brief Basic properties class - *

- * Review the AMQP protocol documentation for more information. - */ -struct __declspec(novtable) BasicProperties : public ContentHeader { - CAF_DECL_UUID("A6DEE271-36C7-4B46-8EA8-F1F0E3493FC4") - - /** @return are the headers available? */ - virtual bool areHeadersAvailable() = 0; - - /** - * @remark - * Use the binary 'and' (&) to test the flags against the - * BASIC_PROPERTY_XXXXX_FLAGS - * @return the bits representing the properties present in the object - */ - virtual uint32 getFlags() = 0; - - /** @return the content type */ - virtual std::string getContentType() = 0; - - /** @brief Set the content type */ - virtual void setContentType(const std::string& contentType) = 0; - - /** @return the content encoding */ - virtual std::string getContentEncoding() = 0; - - /** @brief Set the content encoding */ - virtual void setContentEncoding(const std::string& contentEncoding) = 0; - - /** @return the message headers */ - virtual SmartPtrTable getHeaders() = 0; - - /** @brief Set the headers */ - virtual void setHeaders(const SmartPtrTable& headers) = 0; - - /** @return the delivery mode */ - virtual uint8 getDeliveryMode() = 0; - - /** @brief Set the delivery mode */ - virtual void setDeliveryMode(const uint8 deliveryMode) = 0; - - /** @return the priority */ - virtual uint8 getPriority() = 0; - - /** @brief Set the priority */ - virtual void setPriority(const uint8 priority) = 0; - - /** @return the correlation id */ - virtual std::string getCorrelationId() = 0; - - /** @brief Set the correlation id */ - virtual void setCorrelationId(const std::string& correlationId) = 0; - - /** @return the reply to */ - virtual std::string getReplyTo() = 0; - - /** @brief Set the reply to */ - virtual void setReplyTo(const std::string& replyTo) = 0; - - /** @return the expiration */ - virtual std::string getExpiration() = 0; - - /** @brief Set the expiration */ - virtual void setExpiration(const std::string& expiration) = 0; - - /** @return the message id */ - virtual std::string getMessageId() = 0; - - /** @brief Set the message id */ - virtual void setMessageId(const std::string& messageId) = 0; - - /** @return the timestamp */ - virtual uint64 getTimestamp() = 0; - - /** @brief Set the timestamp */ - virtual void setTimestamp(const uint64 timestamp) = 0; - - /** @return the type */ - virtual std::string getType() = 0; - - /** @brief set the type */ - virtual void setType(const std::string& type) = 0; - - /** @return the user id */ - virtual std::string getUserId() = 0; - - /** @brief Set the user id */ - virtual void setUserId(const std::string& userId) = 0; - - /** @return the app id */ - virtual std::string getAppId() = 0; - - /** @brief Set the app id */ - virtual void setAppId(const std::string& appId) = 0; - - /** @return the cluster id */ - virtual std::string getClusterId() = 0; - - /** @brief Set the cluster id */ - virtual void setClusterId(const std::string& clusterId) = 0; -}; -CAF_DECLARE_SMART_POINTER(BasicProperties); - -/** - * @author mdonahue - * @ingroup AmqpApi - * @brief Create a #Caf::AmqpClient::AmqpContentHeaders::BasicProperties object to be - * sent with a message. - *

- * The object is created with no fields set. You must call the setXXX - * methods before publishing the message. - * @return an unpopulated basic properties object - */ -SmartPtrBasicProperties AMQPCLIENT_LINKAGE createBasicProperties(); - -/** - * @author mdonahue - * @ingroup AmqpApi - * @brief Create an object containing #Caf::AmqpClient::AmqpContentHeaders::BasicProperties - * to be sent with a message - *

- * Set the flags property to the binary 'or' (|) of - * BASIC_PROPERTY_XXXX_FLAG constants representing the fields present. - *

- * Use 0, std::string() or - * SmartPtrTable() to skip initialization of fields not included - * in the object. - * @return a basic properties object - */ -SmartPtrBasicProperties AMQPCLIENT_LINKAGE createBasicProperties( - const uint32 flags, - const std::string& contentType, - const std::string& contentEncoding, - const SmartPtrTable& headers, - const uint8 deliveryMode, - const uint8 priority, - const std::string& correlationId, - const std::string& replyTo, - const std::string& expiration, - const std::string& messageId, - const uint64 timestamp, - const std::string& type, - const std::string& userId, - const std::string& appId, - const std::string& clusterId); -}}} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/api/AmqpMethods.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/api/AmqpMethods.h deleted file mode 100644 index 5a6c63be5..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/api/AmqpMethods.h +++ /dev/null @@ -1,299 +0,0 @@ -/* - * Created on: May 10, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AMQPCLIENTAPI_AMQPMETHODS_H_ -#define AMQPCLIENTAPI_AMQPMETHODS_H_ - -#include "amqpClient/api/Method.h" - -namespace Caf { namespace AmqpClient { namespace AmqpMethods { - -#if (1) // basic -/** - * @brief AMQP Basic methods - * @ingroup AmqpApi - */ -namespace Basic { - -/** - * @ingroup AmqpApi - * @brief Interface representing the basic.get-ok method parameters - */ -struct __declspec(novtable) GetOk : public Method { - CAF_DECL_UUID("A3CD4488-B600-4AC6-9513-03021AC06345") - - /** @return the delivery tag used for basic.ack calls */ - virtual uint64 getDeliveryTag() = 0; - - /** - * @retval true if the message was redelivered - * @retval false if the message has not been redlivered - */ - virtual bool getRedelivered() = 0; - - /** @return the name of the exchange supplying the message */ - virtual std::string getExchange() = 0; - - /** @return the message's routing key */ - virtual std::string getRoutingKey() = 0; - - /** @return the number of messages remaining in the queue */ - virtual uint32 getMessageCount() = 0; -}; -CAF_DECLARE_SMART_INTERFACE_POINTER(GetOk); - -/** - * @ingroup AmqpApi - * @brief Interface representing the basic.get-empty method parameters - */ -struct __declspec(novtable) GetEmpty : public Method { - CAF_DECL_UUID("6bcd3e9e-e2b1-4824-b455-acad073737c5") -}; -CAF_DECLARE_SMART_INTERFACE_POINTER(GetEmpty); - -/** - * @ingroup AmqpApi - * @brief Interface representing the basic.consume-ok method parameters - */ -struct __declspec(novtable) ConsumeOk : public Method { - CAF_DECL_UUID("29E385DA-37FB-48E4-9F6D-463555C9DDDC") - - virtual std::string getConsumerTag() = 0; -}; -CAF_DECLARE_SMART_INTERFACE_POINTER(ConsumeOk); - -/** - * @ingroup AmqpApi - * @brief Interface representing the basic.deliver method parameters - */ -struct __declspec(novtable) Deliver : public Method { - CAF_DECL_UUID("2AD74C5E-CC9D-4A6C-9738-DA836BC25FCA") - - /** @return the consumer tag associated with the consumer */ - virtual std::string getConsumerTag() = 0; - - /** @return the delivery tag used for basic.ack calls */ - virtual uint64 getDeliveryTag() = 0; - - /** - * @retval true if the message was redelivered - * @retval false if the message has not been redlivered - */ - virtual bool getRedelivered() = 0; - - /** @return the name of the exchange supplying the message */ - virtual std::string getExchange() = 0; - - /** @return the message's routing key */ - virtual std::string getRoutingKey() = 0; -}; -CAF_DECLARE_SMART_INTERFACE_POINTER(Deliver); - -/** - * @ingroup AmqpApi - * @brief Interface representing the basic.consume-ok method parameters - */ -struct __declspec(novtable) CancelOk : public Method { - CAF_DECL_UUID("759CEE2C-FDA5-4A2A-BFE0-617A879D05BF") - - /** @return the consumer tag associated with the consumer */ - virtual std::string getConsumerTag() = 0; -}; -CAF_DECLARE_SMART_INTERFACE_POINTER(CancelOk); - -/** - * @ingroup AmqpApi - * @brief Interface representing the basic.return method parameters - */ -struct __declspec(novtable) Return : public Method { - CAF_DECL_UUID("000A440E-AEE4-418E-B9A0-9857F5C20283") - - /** @return the reply code */ - virtual uint16 getReplyCode() = 0; - - /** @return the reply text */ - virtual std::string getReplyText() = 0; - - /** @return the exchnage name */ - virtual std::string getExchange() = 0; - - /** @return the routing key */ - virtual std::string getRoutingKey() = 0; -}; -CAF_DECLARE_SMART_INTERFACE_POINTER(Return); - -/** - * @ingroup AmqpApi - * @brief Interface representing the basic.recover-ok method parameters - */ -struct __declspec(novtable) RecoverOk : public Method { - CAF_DECL_UUID("DF71DC22-B65C-44FC-A0F4-EFAC181E2F69") -}; -CAF_DECLARE_SMART_INTERFACE_POINTER(RecoverOk); - -/** - * @ingroup AmqpApi - * @brief Interface representing the basic.qos-ok method - */ -struct __declspec(novtable) QosOk : public Method { - CAF_DECL_UUID("D5710B1C-DE05-42F5-9695-95364C1D9468") -}; -CAF_DECLARE_SMART_INTERFACE_POINTER(QosOk); - -} // namespace Basic -#endif - -#if (1) // channel -/** - * @ingroup AmqpApi - * @brief AMQP Channel methods - */ -namespace Channel { - -/** - * @ingroup AmqpApi - * @brief Interface representing the channel.open-ok method parameters - */ -struct __declspec(novtable) OpenOk : public Method { - CAF_DECL_UUID("4c027f40-db11-4a72-ac2e-cc8da89035cb") -}; -CAF_DECLARE_SMART_INTERFACE_POINTER(OpenOk); - -/** - * @ingroup AmqpApi - * @brief Interface representing the channel.close method parameters - */ -struct __declspec(novtable) Close : public Method { - CAF_DECL_UUID("45d0c75f-ff48-4552-9a83-498efa5f6ad2") - - /** @return the reply code */ - virtual uint16 getReplyCode() = 0; - - /** @return the reply text */ - virtual std::string getReplyText() = 0; - - /** @return the class id of the method that caused the close */ - virtual uint16 getClassId() = 0; - - /** @return the method id of the method that caused the close */ - virtual uint16 getMethodId() = 0; -}; -CAF_DECLARE_SMART_INTERFACE_POINTER(Close); - -/** - * @ingroup AmqpApi - * @brief Interface representing the channel.close-ok method parameters - */ -struct __declspec(novtable) CloseOk : public Method { - CAF_DECL_UUID("DAF11BD3-06B6-4FA4-AC80-2B0959D2297D") -}; -CAF_DECLARE_SMART_INTERFACE_POINTER(CloseOk); - -} // namespace Channel -#endif - -#if (1) // exchange -/** - * @ingroup AmqpApi - * @brief AMQP Exchange methods - */ -namespace Exchange { - -/** - * @ingroup AmqpApi - * @brief Interface representing the exchange.declare-ok method parameters - */ -struct __declspec(novtable) DeclareOk : public Method { - CAF_DECL_UUID("e54d9fff-7905-4e18-b1e8-090279a5cffe") -}; -CAF_DECLARE_SMART_INTERFACE_POINTER(DeclareOk); - -/** - * @ingroup AmqpApi - * @brief Interface representing the exchange.delete-ok method parameters - */ -struct __declspec(novtable) DeleteOk : public Method { - CAF_DECL_UUID("9f13d0fb-1bdd-473a-873a-58e948bc256c") -}; -CAF_DECLARE_SMART_INTERFACE_POINTER(DeleteOk); - -} // namespace Exchange -#endif - -#if (1) // queue -/** - * @ingroup AmqpApi - * @brief AMQP Queue methods - */ -namespace Queue { - -/** - * @ingroup AmqpApi - * @brief Interface representing the queue.declare-ok method parameters - */ -struct __declspec(novtable) DeclareOk : public Method { - CAF_DECL_UUID("EB96E48E-DF40-4D5F-A41F-7F4EBEBE2BE1") - - /** @return the name of the queue */ - virtual std::string getQueueName() = 0; - - /** @return the number of messages in the queue */ - virtual uint32 getMessageCount() = 0; - - /** @return the number of active consumers for the queue */ - virtual uint32 getConsumerCount() = 0; -}; -CAF_DECLARE_SMART_INTERFACE_POINTER(DeclareOk); - -/** - * @ingroup AmqpApi - * @brief Interface representing the queue.delete-ok method parameters - */ -struct __declspec(novtable) DeleteOk : public Method { - CAF_DECL_UUID("34f4b342-7ab0-44d5-b007-4eec141a4435") - - /** @return the number of messages deleted */ - virtual uint32 getMessageCount() = 0; -}; -CAF_DECLARE_SMART_INTERFACE_POINTER(DeleteOk); - -/** - * @ingroup AmqpApi - * @brief Interface representing the queue.delete-ok method parameters - */ -struct __declspec(novtable) PurgeOk : public Method { - CAF_DECL_UUID("63bcf694-5ac3-4067-8134-659133986099") - - /** @return the number of messages deleted */ - virtual uint32 getMessageCount() = 0; -}; -CAF_DECLARE_SMART_INTERFACE_POINTER(PurgeOk); - -/** - * @ingroup AmqpApi - * @brief Interface representing the queue.bind-ok method parameters - */ -struct __declspec(novtable) BindOk : public Method { - CAF_DECL_UUID("1a60c168-24d1-4184-a5ec-fcf9fca70994") -}; -CAF_DECLARE_SMART_INTERFACE_POINTER(BindOk); - -/** - * @ingroup AmqpApi - * @brief Interface representing the queue.unbind-ok method parameters - */ -struct __declspec(novtable) UnbindOk : public Method { - CAF_DECL_UUID("edf78de1-eee4-44c0-9051-e4f6ee80c0a2") -}; -CAF_DECLARE_SMART_INTERFACE_POINTER(UnbindOk); - -} // namespace Queue -#endif - -}}} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/api/CertInfo.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/api/CertInfo.h deleted file mode 100644 index 2b756ea97..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/api/CertInfo.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Created on: May 4, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AMQPCLIENTAPI_CERTINFO_H_ -#define AMQPCLIENTAPI_CERTINFO_H_ - -namespace Caf { namespace AmqpClient { - -/** - * @author bwilliams - * @brief A representation of Cert Info - */ -class CertInfo { -public: - CertInfo(); - virtual ~CertInfo(); - -public: - void initialize( - const std::string& caCertPath, - const std::string& clientCertPath, - const std::string& clientKeyPath); - - std::string getCaCertPath() const; - - std::string getClientCertPath() const; - - std::string getClientKeyPath() const; - -private: - bool _isInitialized; - std::string _caCertPath; - std::string _clientCertPath; - std::string _clientKeyPath; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CertInfo); -}; -CAF_DECLARE_SMART_POINTER(CertInfo); - -}} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/api/Channel.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/api/Channel.h deleted file mode 100644 index eaab84ac5..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/api/Channel.h +++ /dev/null @@ -1,441 +0,0 @@ -/* - * Created on: May 2, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AMQPCLIENTAPI_CHANNEL_H_ -#define AMQPCLIENTAPI_CHANNEL_H_ - - -#include "ICafObject.h" - -#include "amqpClient/amqpImpl/BasicProperties.h" -#include "Memory/DynamicArray/DynamicArrayInc.h" -#include "amqpClient/api/AmqpMethods.h" -#include "amqpClient/api/Consumer.h" -#include "amqpClient/api/GetResponse.h" -#include "amqpClient/api/ReturnListener.h" -#include "amqpClient/api/amqpClient.h" -#include "amqpClient/api/AmqpContentHeaders.h" - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApi - * @brief Interface to an AMQP channel - */ -struct __declspec(novtable) Channel : public ICafObject { - - /** @return the channel number */ - virtual uint16 getChannelNumber() = 0; - - /** @brief Closes the channel */ - virtual void close() = 0; - - /** - * @brief Returns the state of the channel - * @retval true the Channel is open - * @retval false the Channel is closed - */ - virtual bool isOpen() = 0; - - /** - * @brief Acknowledge on or more messages - *

- * Acknowledges one or more messages delivered via the Deliver or - * Get-Ok methods. The client can ask to confirm a single message or a set of - * messages up to and including a specific message. - * - * @param deliveryTag the message's delivery tag - * @param ackMultiple acknowledge multiple messages

- * If set to true, the delivery tag is treated as "up to and - * including", so that the client can acknowledge multiple messages with a single - * method. If set to false, the delivery tag refers to a single - * message. If the multiple field is true, and the delivery tag - * is 0, the server will acknowledge all outstanding messages. - */ - virtual void basicAck( - const uint64 deliveryTag, - const bool ackMultiple) = 0; - - /** - * @brief Provides a direct access to the messages in a queue - *

- * This method provides a direct access to the messages in a queue using a - * synchronous dialogue that is designed for specific types of application where - * synchronous functionality is more important than performance. - * - * @param queue the queue name - * @param noAck no acknowledgment needed. If true, the server does not - * expect acknowledgements for messages. That is, when a message is delivered to the client - * the server assumes the delivery will succeed and immediately dequeues it. This - * functionality may increase performance but at the cost of reliability. Messages can get - * lost if a client dies before they are delivered to the application. - * @return message as a GetResponse object or - * a null object if there is no message available. - */ - virtual SmartPtrGetResponse basicGet( - const std::string& queue, - const bool noAck) = 0; - - /** - * @brief Publishes a message to a specific exchange - *

- * This method publishes a message to a specific exchange. The message will be routed - * to queues as defined by the exchange configuration and distributed to any active - * consumers when the transaction, if any, is committed. - * @param exchange specifies the name of the exchange to publish to. The exchange - * name can be empty, meaning the default exchange. - * @param routingKey specifies the routing key for the message. - * @param properties specifies a #Caf::AmqpClient::AmqpContentHeaders::BasicProperties - * object containing properties and headers to publish with the message. - * @param body specifies the message body in raw bytes. - */ - virtual void basicPublish( - const std::string& exchange, - const std::string& routingKey, - const AmqpContentHeaders::SmartPtrBasicProperties& properties, - const SmartPtrCDynamicByteArray& body) = 0; - - /** - * @brief Publishes a message to a specific exchange - *

- * This method publishes a message to a specific exchange with control over the - * mandatory and immediate bits. - * The message will be routed to queues as defined by the exchange configuration and - * distributed to any active consumers when the transaction, if any, is committed. - * @param exchange specifies the name of the exchange to publish to. The exchange - * name can be empty, meaning the default exchange. - * @param routingKey specifies the routing key for the message. - * @param mandatory specifies how the server is to react if the message cannot be routed - * to a queue. If true, the server will return an unroutable message - * with a Return method. If false, the server silently drops the - * message. - * @param immediate specifies how the server is to react if the message cannot be routed - * to a queue consumer immediately. If true, the server will return an - * undeliverable message with a Return method. If false, - * the server will queue the message, but with no guarantee that it will ever be - * consumed. - * @param properties specifies a #Caf::AmqpClient::AmqpContentHeaders::BasicProperties - * object containing properties and headers to publish with the message. - * @param body specifies the message body in raw bytes. - */ - virtual void basicPublish( - const std::string& exchange, - const std::string& routingKey, - const bool mandatory, - const bool immediate, - const AmqpContentHeaders::SmartPtrBasicProperties& properties, - const SmartPtrCDynamicByteArray& body) = 0; - - /** - * @brief Starts a queue consumer - *

- * This method asks the server to start a 'consumer', which is a transient request for - * messages from a specific queue. Consumers last as int32 as the channel they were - * declared on, or until the client cancels them.
- * The arguments noAck, noLocal and - * exclusive are false and the server will - * genearate the consumer tag. - * @param queue queue name - * @param consumer an interface to the consumer object - * @return a #Caf::AmqpClient::AmqpMethods::Basic::ConsumeOk object containing - * the results of the call if successful - */ - virtual AmqpMethods::Basic::SmartPtrConsumeOk basicConsume( - const std::string& queue, - const SmartPtrConsumer& consumer) = 0; - - /** - * @brief Starts a queue consumer - *

- * This method asks the server to start a 'consumer', which is a transient request for - * messages from a specific queue. Consumers last as int32 as the channel they were - * declared on, or until the client cancels them.
- * The arguments noLocal and exclusive are - * false and the server will genearate the consumer tag. - * @param queue queue name - * @param noAck no acknowledgment needed. If true, the server does not - * expect acknowledgements for messages. That is, when a message is delivered to the client - * the server assumes the delivery will succeed and immediately dequeues it. This - * functionality may increase performance but at the cost of reliability. Messages can get - * lost if a client dies before they are delivered to the application. - * @param consumer an interface to the consumer object - * @return a #Caf::AmqpClient::AmqpMethods::Basic::ConsumeOk object containing - * the results of the call if successful - */ - virtual AmqpMethods::Basic::SmartPtrConsumeOk basicConsume( - const std::string& queue, - const bool noAck, - const SmartPtrConsumer& consumer) = 0; - - /** - * @brief Starts a queue consumer - *

- * This method asks the server to start a 'consumer', which is a transient request for - * messages from a specific queue. Consumers last as int32 as the channel they were - * declared on, or until the client cancels them. - * @param queue queue name - * @param consumerTag consumer tag (or blank to specify server-generated tag) - * @param noAck acknowledgement flag - * @param noLocal do not send messages to the connection that published them - * @param exclusive request exclusive consumer access to the queue - * @param consumer an interface to the consumer object - * @param arguments a set of arguments for the declaration. The syntax of these - * arguments depends on the server implementation. - * @return a #Caf::AmqpClient::AmqpMethods::Basic::ConsumeOk object containing - * the results of the call if successful - */ - virtual AmqpMethods::Basic::SmartPtrConsumeOk basicConsume( - const std::string& queue, - const std::string& consumerTag, - const bool noAck, - const bool noLocal, - const bool exclusive, - const SmartPtrConsumer& consumer, - const SmartPtrTable& arguments = SmartPtrTable()) = 0; - - /** - * @brief Cancels a consumer - *

- * This method cancels a consumer. This does not affect already delivered messages, - * but it does mean the server will not send any more messages for that consumer. - * The client may receive an arbitrary number of messages in between sending the cancel - * method and receiving the cancel.ok reply. - * @param consumerTag consumer tag to cancel - * @return a #Caf::AmqpClient::AmqpMethods::Basic::CancelOk object containing - * the results of the call if successful - */ - virtual AmqpMethods::Basic::SmartPtrCancelOk basicCancel( - const std::string& consumerTag) = 0; - - /** - * @brief Redeliver unacknowledged messages - *

- * This method asks the server to redeliver all unacknowledged message on the channel. - * Zero or more messages may be redelivered. - * @param requeue if false then the message will be redelivered to - * the original receipient. If true then the server will attempt to - * requeue the message, potentially delivering it to an alternate subscriber. - * @return a #Caf::AmqpClient::AmqpMethods::Basic::RecoverOk object containing the - * results of the call if successful - */ - virtual AmqpMethods::Basic::SmartPtrRecoverOk basicRecover( - const bool requeue) = 0; - - /** - * @brief Specifies quality of service - *

- * This method requests a specific quality of service. The QoS can be specified for - * the current channel or for all channels on the connection. The particular properties - * and semantics of a qos method always depend on the content class semantics. - * @param prefetchSize prefetch window in octets. The client can request that messages - * be sent in advance so that when the client finishes processing a message, - * the following message is already help locally, rather than needing to be sent down - * the channel. Prefetching gives a performance improvement. This field specifies the - * prefetch window size in octets. The server will send a message in advance if it is - * equal to or smaller in size than the available prefetch size (and also falls into - * other prefetch limits). May be set to zero, meaning 'no specific limit', although - * other prefetch limits may still apply. The prefetch-size is ignored if the no-ack - * option is set. - * @param prefetchCount prefetch window in messages. This field may be used in combination - * with the prefetchSize field; a message will only be sent in advance if both - * prefetch windows (and those at the channel and connection level) allow it. The - * prefetch-count is ignored if the no-ack option is set. - * @param global apply to entire connection - * @return - */ - virtual AmqpMethods::Basic::SmartPtrQosOk basicQos( - const uint32 prefetchSize, - const uint32 prefetchCount, - const bool global) = 0; - - /** - * @brief Reject an incoming message - *

- * This method allows a client to reject a message. It can be used to interrupt and - * cancel large incoming messages, or return un-treatable messages to their original - * queue. - * @param deliveryTag the delivery tag of the message - * @param requeue if true, the server will attempt to requeue - * the message. If false or the requeue attempt fails the - * message is discarded or dead-lettered. - */ - virtual void basicReject( - const uint64 deliveryTag, - const bool requeue) = 0; - - /** - * @brief Creates an exchange - *

- * This method creates an exchange if it does not already exist, and if the exchange - * exists, verifies that it is of the correct and expected class. - * @param exchange exchange name - * @param type exchange type - * @param durable request a durable exchange - * @param arguments a set of agrguments for the declaration. The syntax of these - * arguments depends on the server implementation. - * @return a #Caf::AmqpClient::AmqpMethods::Exchange::DeclareOk object containing - * the results of the call if successful - */ - virtual AmqpMethods::Exchange::SmartPtrDeclareOk exchangeDeclare( - const std::string& exchange, - const std::string& type, - const bool durable = false, - const SmartPtrTable& arguments = SmartPtrTable()) = 0; - - /** - * @brief Deletes an exchange - *

- * This method deletes an exchange. When an exchange is deleted all queue bindings on - * the exchange are cancelled. - * @param exchange exchange name - * @param ifUnused delete only if unused. If true, the server - * will only delete the exchange if it has no queue bindings. If the exchange has - * queue bindings the server does not delete it but raises a channel exception - * instead. - * @return a #Caf::AmqpClient::AmqpMethods::Exchange::DeleteOk object containing - * the results of the call if successful - */ - virtual AmqpMethods::Exchange::SmartPtrDeleteOk exchangeDelete( - const std::string& exchange, - const bool ifUnused) = 0; - - /** - * @brief Creates a queue using default parameters - *

- * The defaults are: - * - * - * - * - * - * - * - * - *
ParameterValue
queueblank - the server will generate a queue name
durablefalse - the queue will not be durable
exclusivetrue - the queue will be exclusive to this conenction
autoDeletetrue - the queue will be deleted when no longer used
- * @return a #Caf::AmqpClient::AmqpMethods::Queue::DeclareOk object containing - * the results of the call if successful. This object must be examined to retrieve - * the name of the queue generated by the server. - */ - virtual AmqpMethods::Queue::SmartPtrDeclareOk queueDeclare() = 0; - - /** - * @brief Creates or checks a queue - *

- * @param queue queue name. If blank the server will generate a name. - * @param durable request a durable queue - * @param exclusive request an exclusive queue - * @param autoDelete request that the queue be deleted when no longer in use - * @param arguments a set of agrguments for the declaration. The syntax of these - * arguments depends on the server implementation. - * @return a #Caf::AmqpClient::AmqpMethods::Queue::DeclareOk object containing - * the results of the call if successful. This object must be examined to retrieve - * the name of the queue generated by the server if the queue name was blank in - * the call. - */ - virtual AmqpMethods::Queue::SmartPtrDeclareOk queueDeclare( - const std::string& queue, - const bool durable, - const bool exclusive, - const bool autoDelete, - const SmartPtrTable& arguments = SmartPtrTable()) = 0; - - /** - * @brief Declare a queue passively; i.e. check if it exists. - *

- * @param queue queue name. - */ - virtual AmqpMethods::Queue::SmartPtrDeclareOk queueDeclarePassive( - const std::string& queue) = 0; - - /** - * @brief Deletes a queue - *

- * This method deletes a queue. When a queue is deleted any pending messages are - * sent to a dead­-letter queue if this is defined in the server configuration, - * and all consumers on the queue are cancelled. - * @param queue queue name - * @param ifUnused delete only if unused. If true, the server - * will only delete the queue if it has no consumers. If the queue has consumers the - * server does does not delete it but raises a channel exception instead. - * @param ifEmpty delete only if empty. If true, the server will - * only delete the queue if it has no messages. If the queue has messages the - * server does does not delete it but raises a channel exception instead. - * @return a #Caf::AmqpClient::AmqpMethods::Queue::DeleteOk object containing the - * result of the call if successful. - */ - virtual AmqpMethods::Queue::SmartPtrDeleteOk queueDelete( - const std::string& queue, - const bool ifUnused, - const bool ifEmpty) = 0; - - /** - * @brief Purges a queue - *

- * This method removes all messages from a queue which are not awaiting - * acknowledgment. - * @param queue queue name - * @return a #Caf::AmqpClient::AmqpMethods::Queue::PurgeOk containing the result - * of the call if successful. - */ - virtual AmqpMethods::Queue::SmartPtrPurgeOk queuePurge( - const std::string& queue) = 0; - - /** - * @brief Binds a queue to an exchange - *

- * This method binds a queue to an exchange. Until a queue is bound it will not - * receive any messages. - * @param queue queue name - * @param exchange exchange name - * @param routingKey message routing key - * @param arguments a set of agrguments for the binding. The syntax of these - * arguments depends on the server implementation. - * @return a #Caf::AmqpClient::AmqpMethods::Queue::BindOk containing the result - * of the call if successful. - */ - virtual AmqpMethods::Queue::SmartPtrBindOk queueBind( - const std::string& queue, - const std::string& exchange, - const std::string& routingKey, - const SmartPtrTable& arguments = SmartPtrTable()) = 0; - - /** - * @brief Unbinds a queue from an exchange - * @param queue queue name - * @param exchange exchange name - * @param routingKey message routing key - * @param arguments a set of agrguments for the binding. The syntax of these - * arguments depends on the server implementation. - * @return a #Caf::AmqpClient::AmqpMethods::Queue::UnbindOk containing the result - * of the call if successful. - */ - virtual AmqpMethods::Queue::SmartPtrUnbindOk queueUnbind( - const std::string& queue, - const std::string& exchange, - const std::string& routingKey, - const SmartPtrTable& arguments = SmartPtrTable()) = 0; - - /** - * @brief Adds a {@link ReturnListener} to the channel - * @param listener the {@link ReturnListener} object to add - */ - virtual void addReturnListener( - const SmartPtrReturnListener& listener) = 0; - - /** - * @brief Removes a {@link ReturnListener} from the channel - * @param listener the {@link ReturnListener} to remove - */ - virtual bool removeReturnListener( - const SmartPtrReturnListener& listener) = 0; -}; -CAF_DECLARE_SMART_INTERFACE_POINTER(Channel); - -}} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/api/Connection.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/api/Connection.h deleted file mode 100644 index c486607b5..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/api/Connection.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Created on: May 2, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AMQPCLIENTAPI_CONNECTION_H_ -#define AMQPCLIENTAPI_CONNECTION_H_ - - -#include "ICafObject.h" - -#include "amqpClient/api/Channel.h" - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApi - * @brief Interface to an AMQP connection. - */ -struct __declspec(novtable) Connection : public ICafObject { - /** - * @brief Create a new channel - * @return a Channel - */ - virtual SmartPtrChannel createChannel() = 0; - - /** - * @brief Close a channel - * @param channel the Channel to close - */ - virtual void closeChannel(const SmartPtrChannel& channel) = 0; - - /** - * @brief Closes the connection and its channels - */ - virtual void close() = 0; - - /** - * @brief Return the state of the connection - * @retval true the connection is open - * @retval false the connection is closed - */ - virtual bool isOpen() = 0; -}; - -CAF_DECLARE_SMART_INTERFACE_POINTER(Connection); - -}} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/api/ConnectionFactory.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/api/ConnectionFactory.h deleted file mode 100644 index 205465c1b..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/api/ConnectionFactory.h +++ /dev/null @@ -1,232 +0,0 @@ -/* - * Created on: May 4, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AMQPCLIENTAPI_CONNECTIONFACTORY_H_ -#define AMQPCLIENTAPI_CONNECTIONFACTORY_H_ - -#include "ICafObject.h" - -#include "amqpClient/api/Address.h" -#include "amqpClient/api/CertInfo.h" -#include "amqpClient/api/Connection.h" - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApi - * @brief Interface to a convenience factory class to facilitate opening a - * #Caf::AmqpClient::Connection to an AMQP broker. - *

- * ConnectionFactories are creating using the #Caf::AmqpClient::createConnectionFactory method. - */ -struct __declspec(novtable) ConnectionFactory : public ICafObject { - - /** - * @return the default protocol to use for connections - */ - virtual std::string getProtocol() const = 0; - - /** - * @brief Set the default protocol for connections - * @param protocol the default protocol for connections - */ - virtual void setProtocol(const std::string& protocol) = 0; - - /** - * @return the default host to use for connections - */ - virtual std::string getHost() const = 0; - - /** - * @brief Set the default host for connections - * @param host the default host for connections - */ - virtual void setHost(const std::string& host) = 0; - - /** - * @return the default port to use for connections - */ - virtual uint32 getPort() const = 0; - - /** - * @brief Set the default port for connections - * @param port the default port for connections - */ - virtual void setPort(const uint32 port) = 0; - - /** - * @return the default virtual host to use for connections - */ - virtual std::string getVirtualHost() const = 0; - - /** - * @brief Set the default virtual host for connections - * @param virtualHost the default virtual host for connections - */ - virtual void setVirtualHost(const std::string& virtualHost) = 0; - - /** - * @return the default user name to use for connections - */ - virtual std::string getUsername() const = 0; - - /** - * @brief Set the default user name for connections - * @param username the default user name for connections - */ - virtual void setUsername(const std::string& username) = 0; - - /** - * @return the default password to use for connections - */ - virtual std::string getPassword() const = 0; - - /** - * @brief Set the default password for connections - * @param password the default password for connections - */ - virtual void setPassword(const std::string& password) = 0; - - /** - * @return the default CaCertPath to use for connections - */ - virtual std::string getCaCertPath() const = 0; - - /** - * @brief Set the default CaCertPath for connections - * @param caCertPath the default CaCertPath for connections - */ - virtual void setCaCertPath(const std::string& caCertPath) = 0; - - /** - * @return the default ClientCertPath to use for connections - */ - virtual std::string getClientCertPath() const = 0; - - /** - * @brief Set the default ClientCertPath for connections - * @param clientCertPath the default ClientCertPath for connections - */ - virtual void setClientCertPath(const std::string& clientCertPath) = 0; - - /** - * @return the default ClientKeyPath to use for connections - */ - virtual std::string getClientKeyPath() const = 0; - - /** - * @brief Set the default ClientKeyPath for connections - * @param clientKeyPath the default ClientKeyPath for connections - */ - virtual void setClientKeyPath(const std::string& clientKeyPath) = 0; - - /** - * @return the initially requested maximum channel number; zero for unlimited - */ - virtual uint32 getRequestedChannelMax() const = 0; - - /** - * @brief Set the requested maximum channel number - * @param requestedChannelMax the initially requested maximum channel number; zero for unlimited - */ - virtual void setRequestedChannelMax(const uint32 requestedChannelMax) = 0; - - /** - * @return the initially requested maximum frame size; zero for unlimited - */ - virtual uint32 getRequestedFrameMax() const = 0; - - /** - * @brief Set the requested maximum frame size - * @param requestedFrameMax the initially requested maximum frame size; zero for unlimited - */ - virtual void setRequestedFrameMax(const uint32 requestedFrameMax) = 0; - - /** - * @return the initially requested heartbeat interval, in seconds; zero for none - */ - virtual uint32 getRequestedHeartbeat() const = 0; - - /** - * @brief Set the requested heartbeat interval - * @param requestedHeartbeat the initially requested heartbeat interval, in seconds; zero for none - */ - virtual void setRequestedHeartbeat(const uint32 requestedHeartbeat) = 0; - - /** - * @return the connection timeout, in milliseconds; zero for infinite - */ - virtual uint32 getConnectionTimeout() const = 0; - - /** - * @brief Set the connection timeout - * @param connectionTimeout connection establishment timeout in milliseconds; zero for infinite - */ - virtual void setConnectionTimeout(const uint32 connectionTimeout) = 0; - - /** - * @return the number of connection consumer processing threads - */ - virtual uint32 getConsumerThreadCount() const = 0; - - /** - * @brief Set the number of connection consumer processing threads - * @param threadCount the number of connection consumer processing threads - */ - virtual void setConsumerThreadCount(const uint32 threadCount) = 0; - - /** - * @return the number of connection retries - */ - virtual uint16 getRetries() const = 0; - - /** - * @brief Set the number of connection retries - * @param retries the number of connection retries - */ - virtual void setRetries(const uint16 retries) = 0; - - /** - * @return the number of connection seconds to wait - */ - virtual uint16 getSecondsToWait() const = 0; - - /** - * @brief Set the number of connection retries - * @param seconds the number of connection seconds to wait - */ - virtual void setSecondsToWait(const uint16 seconds) = 0; - - /** - * @brief Create a new broker connection - * @return a #Caf::AmqpClient::Connection interface to the connection - */ - virtual SmartPtrConnection newConnection() = 0; - - /** - * @brief Create a new broker connection - * @param address broker address to try - * @return a #Caf::AmqpClient::Connection interface to the connection - */ - virtual SmartPtrConnection newConnection( - const SmartPtrAddress& address, - const SmartPtrCertInfo& certInfo) = 0; -}; - -CAF_DECLARE_SMART_INTERFACE_POINTER(ConnectionFactory); - -/** - * @ingroup AmqpApi - * @brief Create a new #Caf::AmqpClient::ConnectionFactory - * @return a #Caf::AmqpClient::ConnectionFactory interface to a new connection factory - */ -SmartPtrConnectionFactory AMQPCLIENT_LINKAGE createConnectionFactory(); - -}} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/api/Consumer.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/api/Consumer.h deleted file mode 100644 index 99478d12c..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/api/Consumer.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Created on: May 21, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CONSUMER_H_ -#define CONSUMER_H_ - -#include "ICafObject.h" - -#include "amqpClient/amqpImpl/BasicProperties.h" -#include "Exception/CCafException.h" -#include "Memory/DynamicArray/DynamicArrayInc.h" -#include "amqpClient/api/Envelope.h" -#include "amqpClient/api/AmqpContentHeaders.h" - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApi - * @brief Interface for application callback objects to receive notifications and messages - * from a queue by subscription. - *

- * The methods of this interface are invoked in a dispatch thread which is separate from the - * {@link Connection}'s thread. This allows {@link Consumer}s to call {@link Channel} or - * {@link Connection} methods without causing a deadlock. - */ -struct __declspec(novtable) Consumer : public ICafObject { - - /** - * @brief Called when the consumer is registered by a call to any of the - * {@link Channel#basicConsume} methods - * @param consumerTag the consumer tag associated with the consumer - */ - virtual void handleConsumeOk( - const std::string& consumerTag) = 0; - - /** - * @brief Called when the consumer is cancelled by a call to {@link Channel#basicCancel}. - * @param consumerTag the consumer tag associated with the consumer - */ - virtual void handleCancelOk( - const std::string& consumerTag) = 0; - - /** - * @brief Called when a basic.recover-ok is received. - * @param consumerTag the consumer tag associated with the consumer - */ - virtual void handleRecoverOk( - const std::string& consumerTag) = 0; - - /** - * @brief Called when a basic.deliver is received for this consumer. - * @param consumerTag the consumer tag associated with the consumer - * @param envelope message envelope - * @param properties message properties and headers - * @param body message body - */ - virtual void handleDelivery( - const std::string& consumerTag, - const SmartPtrEnvelope& envelope, - const AmqpContentHeaders::SmartPtrBasicProperties& properties, - const SmartPtrCDynamicByteArray& body) = 0; - - /** - * @brief Called when the channel has been shut down. - * @param consumerTag the consumer tag associated with the consumer - * @param reason the reason for the shut down - */ - virtual void handleShutdown( - const std::string& consumerTag, - SmartPtrCCafException& reason) = 0; -}; -CAF_DECLARE_SMART_INTERFACE_POINTER(Consumer); - -}} - -#endif /* CONSUMER_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/api/ContentHeader.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/api/ContentHeader.h deleted file mode 100644 index 51b274444..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/api/ContentHeader.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Created on: May 11, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AMQPCLIENTAPI_CONTENTHEADER_H_ -#define AMQPCLIENTAPI_CONTENTHEADER_H_ - - -#include "ICafObject.h" - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApi - * @brief Base interface for all AMQP content headers - */ -struct __declspec(novtable) ContentHeader : public ICafObject { - - /** @return the content header class id */ - virtual uint16 getClassId() = 0; - - /** @return the content header friendly class name */ - virtual std::string getClassName() = 0; -}; -CAF_DECLARE_SMART_INTERFACE_POINTER(ContentHeader); - -}} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/api/Envelope.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/api/Envelope.h deleted file mode 100644 index 28098daf5..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/api/Envelope.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Created on: May 16, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AMQPCLIENTAPI_ENVELOPE_H_ -#define AMQPCLIENTAPI_ENVELOPE_H_ - - -#include "ICafObject.h" - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApi - * @brief An interface to objects that group together basic.get-ok message properties - */ -struct __declspec(novtable) Envelope : public ICafObject { - CAF_DECL_UUID("ce68d68a-6973-49e2-a003-cb4474624f5c") - - /** @return the delivery tag */ - virtual uint64 getDeliveryTag() = 0; - - /** - * @retval true if the message was redelivered - * @retval false if the message has not been redelivered - */ - virtual bool getRedelivered() = 0; - - /** @return the name of the exchange supplying the message */ - virtual std::string getExchange() = 0; - - /** @return the message's routing key */ - virtual std::string getRoutingKey() = 0; -}; -CAF_DECLARE_SMART_INTERFACE_POINTER(Envelope); - -}} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/api/GetResponse.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/api/GetResponse.h deleted file mode 100644 index 5e8dc783a..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/api/GetResponse.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Created on: May 16, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AMQPCLIENTAPI_GETRESPONSE_H_ -#define AMQPCLIENTAPI_GETRESPONSE_H_ - -#include "ICafObject.h" - -#include "amqpClient/amqpImpl/BasicProperties.h" -#include "Memory/DynamicArray/DynamicArrayInc.h" -#include "amqpClient/api/Envelope.h" -#include "amqpClient/api/AmqpContentHeaders.h" - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApi - * @brief Interface representing the bundling of basic.get messages into a nicer form - */ -struct __declspec(novtable) GetResponse : public ICafObject { - CAF_DECL_UUID("c8bda284-7eea-46e1-b9c3-791310d69b04") - - /** @return the message envelope information (#Caf::AmqpClient::Envelope) */ - virtual SmartPtrEnvelope getEnvelope() = 0; - - /** @return the message properties (#Caf::AmqpClient::AmqpContentHeaders::BasicProperties) */ - virtual AmqpContentHeaders::SmartPtrBasicProperties getProperties() = 0; - - /** @return the message body raw bytes */ - virtual SmartPtrCDynamicByteArray getBody() = 0; - - /** @return the number of messages in the queue */ - virtual uint32 getMessageCount() = 0; -}; -CAF_DECLARE_SMART_INTERFACE_POINTER(GetResponse); - -}} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/api/Method.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/api/Method.h deleted file mode 100644 index c97eb35bb..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/api/Method.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Created on: May 10, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AMQPCLIENTAPI_METHOD_H_ -#define AMQPCLIENTAPI_METHOD_H_ - - -#include "ICafObject.h" - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApi - * @brief Base interface to AMQP methods - */ -struct __declspec(novtable) Method : public ICafObject { - - /** @return the method's class ID */ - virtual uint16 getProtocolClassId() = 0; - - /** @return the method's method ID */ - virtual uint16 getProtocolMethodId() = 0; - - /** @return the method's friendly name */ - virtual std::string getProtocolMethodName() = 0; -}; -CAF_DECLARE_SMART_INTERFACE_POINTER(Method); - -}} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/api/ReturnListener.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/api/ReturnListener.h deleted file mode 100644 index d4ff5212f..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/api/ReturnListener.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Created on: May 21, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef RETURNLISTENER_H_ -#define RETURNLISTENER_H_ - -#include "ICafObject.h" - -#include "amqpClient/amqpImpl/BasicProperties.h" -#include "Memory/DynamicArray/DynamicArrayInc.h" -#include "amqpClient/api/AmqpContentHeaders.h" - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApi - * @brief Interface for objects that will be notified of failed message deliveries - *

- * When {@link Channel#basicPublish} is used with the mandatory and/or immediate - * flags set and the message cannot be delivered, the server will response with a - * basic.return method call. {@link ReturnListener}s can monitor - * these failed messages. - */ -struct __declspec(novtable) ReturnListener : public ICafObject { - CAF_DECL_UUID("FEB38A27-6338-4BDB-AA0E-527322A2393B") - - /** - * @brief Callback receiving the failed message - * @param replyCode server reply code - * @param replyText server reply text - * @param exchange exchange on which error occured - * @param routingKey routing key for the message that failed - * @param properties original message properties - * @param body original message body - */ - virtual void handleReturn( - const uint16 replyCode, - const std::string& replyText, - const std::string& exchange, - const std::string& routingKey, - const AmqpContentHeaders::SmartPtrBasicProperties& properties, - const SmartPtrCDynamicByteArray& body) = 0; -}; -CAF_DECLARE_SMART_INTERFACE_POINTER(ReturnListener); - -}} - -#endif /* RETURNLISTENER_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/api/amqpClient.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/api/amqpClient.h deleted file mode 100644 index 7616b04ec..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpClient/api/amqpClient.h +++ /dev/null @@ -1,286 +0,0 @@ -/* - * Created on: May 3, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AMQPCLIENTAPI_H_ -#define AMQPCLIENTAPI_H_ - -#include "amqpClient/AmqpClientLink.h" -#include "ICafObject.h" - -/** - * @defgroup AmqpApi AMQP API - * Documentaiton for the classes, methods and constants that can be - * used directly by applications to work with the AMQP protocol as a client. - */ -namespace Caf { namespace AmqpClient { - -/** Default user name */ -extern const char* DEFAULT_USER; - -/** Default password */ -extern const char* DEFAULT_PASS; - -/** Default virtual host */ -extern const char* DEFAULT_VHOST; - -/** Default protocol */ -extern const char* DEFAULT_PROTOCOL; - -/** Default host */ -extern const char* DEFAULT_HOST; - -/** Default maximum channel number; zero for maximum */ -static const uint32 DEFAULT_CHANNEL_MAX = 0; - -/** Default maximum frame size; zero for maximum */ -static const uint32 DEFAULT_FRAME_MAX = 131072; - -/** Default maximum heartbeat rate; zero for none */ -static const uint32 DEFAULT_HEARTBEAT = 0; - -/** 'Use the default port' port */ -static const uint32 USE_DEFAULT_PORT = UINT_MAX; - -/** The default non-ssl port */ -static const uint32 DEFAULT_AMQP_PORT = 5672; - -/** The default ssl port */ -static const uint32 DEFAULT_AMQP_SSL_PORT = 5671; - -/** The default connection timeout; zero means wait indefinately */ -static const uint32 DEFAULT_CONNECTION_TIMEOUT = 0; - -/** The default number of connection consumer threads */ -static const uint32 DEFAULT_CONSUMER_THREAD_COUNT = 10; - -/** The default number of basic.deliver messages to process in a single run of a channel consumer thread */ -static const uint32 DEFAULT_CONSUMER_THREAD_MAX_DELIVERY_COUNT = 100; - -/** The default number of times a connection open will be retried*/ -static const uint16 DEFAULT_CONNECTION_RETRIES = 5; - -/** The default number of seconds we will wait for each connection open attempt. 0 means wait indefinitely*/ -static const uint16 DEFAULT_CONNECTION_SECONDS_TO_WAIT = 30; - -/** - * @author mdonahue - * @brief Object that maps a c-api AMQP field into a lifetime-managed GVariant - */ -struct __declspec(novtable) Field : public ICafObject { - /** - * @brief Field value types - */ - typedef enum { - /** @brief internal value representing Not Set */ - AMQP_FIELD_TYPE_NOTSET, - /** @brief boolean */ - AMQP_FIELD_TYPE_BOOLEAN, - /** @brief signed 8-bit integer */ - AMQP_FIELD_TYPE_I8, - /** @brief unsigned 8-bit integer */ - AMQP_FIELD_TYPE_U8, - /** @brief signed 16-bit integer */ - AMQP_FIELD_TYPE_I16, - /** @brief unsigned 16-bit integer */ - AMQP_FIELD_TYPE_U16, - /** @brief signed 32-bit integer */ - AMQP_FIELD_TYPE_I32, - /** @brief unsigned 32-bit integer */ - AMQP_FIELD_TYPE_U32, - /** @brief signed 64-bit integer */ - AMQP_FIELD_TYPE_I64, - /** @brief unsigned 64-bit integer */ - AMQP_FIELD_TYPE_U64, - /** @brief 32-bit float */ - AMQP_FIELD_TYPE_F32, - /** @brief 64-bit double */ - AMQP_FIELD_TYPE_F64, - /** @brief UTF8-encoded text */ - AMQP_FIELD_TYPE_UTF8, - /** @brief NOT SUPPORTED */ - AMQP_FIELD_TYPE_ARRAY, - /** @brief NOT SUPPORTED */ - AMQP_FIELD_TYPE_BYTES, - /** @brief NOT SUPPORTED */ - AMQP_FIELD_TYPE_DECIMAL, - /** @brief NOT SUPPORTED */ - AMQP_FIELD_TYPE_TIMESTAMP, - /** @brief NOT SUPPORTED */ - AMQP_FIELD_TYPE_TABLE, - /** @brief NOT SUPPORTED */ - AMQP_FIELD_TYPE_VOID - } AmqpFieldType; - - /** - * @return the field type - */ - virtual AmqpFieldType getAmqpType() const = 0; - /** - * @return the field value as a GVariant - */ - virtual GVariant* getValue() const = 0; - /** - * @brief Set the field type and value - * @param type field type - * @param value field value. DO NOT increment the reference count - * before calling this method. This object will take ownership of - * the GVariant and will call g_variant_unref upon value reassignment or destruction. - */ - virtual void setTypeAndValue(AmqpFieldType type, GVariant *value) = 0; -}; -CAF_DECLARE_SMART_INTERFACE_POINTER(Field); -/** @brief A map of field names to field objects */ -typedef std::map Table; -CAF_DECLARE_SMART_POINTER(Table); - -/** - * @brief Add a boolean value to a field table - * @param key the field key - * @param val the value - * @param table the table to insert the field into - */ -void AMQPCLIENT_LINKAGE tableAddBoolean( - const std::string key, - const bool val, - SmartPtrTable& table); - -/** - * @brief Add a signed 8-bit value to a field table - * @param key the field key - * @param val the value - * @param table the table to insert the field into - */ -void AMQPCLIENT_LINKAGE tableAddInt8( - const std::string key, - const int8 val, - SmartPtrTable& table); - -/** - * @brief Add a unsigned 8-bit value to a field table - * @param key the field key - * @param val the value - * @param table the table to insert the field into - */ -void AMQPCLIENT_LINKAGE tableAddUint8( - const std::string key, - const uint8 val, - SmartPtrTable& table); - -/** - * @brief Add a signed 16-bit value to a field table - * @param key the field key - * @param val the value - * @param table the table to insert the field into - */ -void AMQPCLIENT_LINKAGE tableAddInt16( - const std::string key, - const int16 val, - SmartPtrTable& table); - -/** - * @brief Add a unsigned 16-bit value to a field table - * @param key the field key - * @param val the value - * @param table the table to insert the field into - */ -void AMQPCLIENT_LINKAGE tableAddUint16( - const std::string key, - const uint16 val, - SmartPtrTable& table); - -/** - * @brief Add a signed 32-bit value to a field table - * @param key the field key - * @param val the value - * @param table the table to insert the field into - */ -void AMQPCLIENT_LINKAGE tableAddInt32( - const std::string key, - const int32 val, - SmartPtrTable& table); - -/** - * @brief Add a unsigned 32-bit value to a field table - * @param key the field key - * @param val the value - * @param table the table to insert the field into - */ -void AMQPCLIENT_LINKAGE tableAddUint32( - const std::string key, - const uint32 val, - SmartPtrTable& table); - -/** - * @brief Add a signed 64-bit value to a field table - * @param key the field key - * @param val the value - * @param table the table to insert the field into - */ -void AMQPCLIENT_LINKAGE tableAddInt64( - const std::string key, - const int64 val, - SmartPtrTable& table); - -/** - * @brief Add a unsigned 64-bit value to a field table - * @param key the field key - * @param val the value - * @param table the table to insert the field into - */ -void AMQPCLIENT_LINKAGE tableAddUint64( - const std::string key, - const uint64 val, - SmartPtrTable& table); - -/** - * @brief Add a float value to a field table - * @param key the field key - * @param val the value - * @param table the table to insert the field into - */ -void AMQPCLIENT_LINKAGE tableAddFloat( - const std::string key, - const float val, - SmartPtrTable& table); - -/** - * @brief Add a double value to a field table - * @param key the field key - * @param val the value - * @param table the table to insert the field into - */ -void AMQPCLIENT_LINKAGE tableAddDouble( - const std::string key, - const double val, - SmartPtrTable& table); - -/** - * @brief Add UTF8-encoded text to a field table - * @param key the field key - * @param val the value - * @param table the table to insert the field into - */ -void AMQPCLIENT_LINKAGE tableAddUtf8( - const std::string key, - const std::string& val, - SmartPtrTable& table); - -/** - * @brief Add a time stamp (unsigned 64-bit integer) to a field table - * @param key the field key - * @param val the value - * @param table the table to insert the field into - */ -void AMQPCLIENT_LINKAGE tableAddTimestamp( - const std::string key, - const uint64 val, - SmartPtrTable& table); -}} - -#include "amqpClient/api/AMQExceptions.h" - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/AbstractConnectionFactory.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/AbstractConnectionFactory.h deleted file mode 100644 index 33972c653..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/AbstractConnectionFactory.h +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Created on: May 24, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AMQPINTEGRATIONCORE_ABSTRACTCONNECTIONFACTORY_H_ -#define AMQPINTEGRATIONCORE_ABSTRACTCONNECTIONFACTORY_H_ - -#include "amqpCore/ConnectionFactory.h" -#include "amqpClient/api/ConnectionFactory.h" -#include "amqpClient/api/Connection.h" -#include "amqpCore/CompositeConnectionListener.h" -#include "amqpCore/ConnectionListener.h" - -namespace Caf { namespace AmqpIntegration { - -class AMQPINTEGRATIONCORE_LINKAGE AbstractConnectionFactory : public ConnectionFactory { -public: - AbstractConnectionFactory(); - virtual ~AbstractConnectionFactory(); - - /** - * @brief Initialize the connection factory - * @param amqpConnectionFactory the underlying Caf::AmqpClient::ConnectionFactory object - */ - void init(const AmqpClient::SmartPtrConnectionFactory& amqpConnectionFactory); - - virtual void setConnectionListeners(const std::deque& listeners); - - /** - * @brief Set the default protocol for connections - * @param protocol the default protocol for connections - */ - void setProtocol(const std::string& protocol); - - /** - * @brief Set the default host for connections - * @param host the default host for connections - */ - void setHost(const std::string& host); - - /** - * @brief Set the default port for connections - * @param port the default port for connections - */ - void setPort(const uint32 port); - - /** - * @brief Set the default host for connections - * @param virtualHost the default host for connections - */ - void setVirtualHost(const std::string& virtualHost); - - /** - * @brief Set the default user name for connections - * @param username the default user name for connections - */ - void setUsername(const std::string& username); - - /** - * @brief Set the default password for connections - * @param password the default password for connections - */ - void setPassword(const std::string& password); - - /** - * @brief Set the default CaCertPath for connections - * @param caCertPath the default CaCertPath for connections - */ - void setCaCertPath(const std::string& caCertPath); - - /** - * @brief Set the default ClientCertPath for connections - * @param clientCertPath the default ClientCertPath for connections - */ - void setClientCertPath(const std::string& clientCertPath); - - /** - * @brief Set the default ClientKeyPath for connections - * @param clientKeyPath the default ClientKeyPath for connections - */ - void setClientKeyPath(const std::string& clientKeyPath); - - /** - * @brief Set the number of connection retries - * @param retries - */ - void setRetries(const uint16 retries); - - /** - * @brief Set the wait period in seconds - * @param seconds - */ - void setSecondsToWait(const uint16 seconds); - - /** - * @brief Set the connection timeout - * @param connectionTimeout connection establishment timeout in milliseconds; zero for infinite - */ - void setConnectionTimeout(const uint32 connectionTimeout); - -public: // ConnectionFactory - virtual SmartPtrConnection createConnection() = 0; - std::string getProtocol(); - std::string getHost(); - uint32 getPort(); - std::string getVirtualHost(); - std::string getUsername(); - std::string getPassword(); - std::string getCaCertPath(); - std::string getClientCertPath(); - std::string getClientKeyPath(); - uint16 getRetries(); - uint16 getSecondsToWait(); - virtual void addConnectionListener(const SmartPtrConnectionListener& listener); - -protected: - std::string getDefaultProtocol(); - - std::string getDefaultHostName(); - - SmartPtrConnection createBareConnection(); - - SmartPtrConnectionListener getConnectionListener(); - -private: - bool _isInitialized; - AmqpClient::SmartPtrConnectionFactory _amqpConnectionFactory; - SmartPtrCompositeConnectionListener _connectionListener; - - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(AbstractConnectionFactory); -}; -CAF_DECLARE_SMART_POINTER(AbstractConnectionFactory); - -}} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/AmqpAdmin.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/AmqpAdmin.h deleted file mode 100644 index 532b67dbf..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/AmqpAdmin.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Created on: Jun 12, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AMQPINTEGRATIONCORE_AMQPADMIN_H_ -#define AMQPINTEGRATIONCORE_AMQPADMIN_H_ - - - -#include "ICafObject.h" - -#include "amqpCore/Binding.h" -#include "amqpCore/Exchange.h" -#include "amqpCore/Queue.h" - -namespace Caf { namespace AmqpIntegration { - -/** - * @brief Specifies a basic set of AMQP administrative operations for AMQP > 0.8 - */ -struct __declspec(novtable) AmqpAdmin : public ICafObject { - CAF_DECL_UUID("B10A94BC-0CC7-476F-A38A-2794CF98D74C") - - /** - * @brief Declare an exchange - * @param exchange the exchange (#Caf::AmqpIntegration::Exchange) to declare - */ - virtual void declareExchange(SmartPtrExchange exchange) = 0; - - /** - * @brief Delete an exchange - * @param exchange the name of the exchange - * @retval true the exchange existed and was deleted - * @retval false the exchange did not exists or could not be deleted - */ - virtual bool deleteExchange(const std::string& exchange) = 0; - - /** - * @brief Declare a queue whose name is automatically generated. - *

- * The queue is created with durable=false, exclusive=true and auto-delete=true. - * @return the created queue. Call #Caf::AmqpIntegration::Queue::getName to - * get the server-generated name of the queue. - */ - virtual SmartPtrQueue declareQueue() = 0; - - /** - * @brief Declare a queue - * @param queue the queue to declare - */ - virtual void declareQueue(SmartPtrQueue queue) = 0; - - /** - * @brief Delete a queue without regard for whether it is in use or has messages in it - * @param queue the name of the queue - * @retval true the queue existed and was deleted - * @retval false the queue did not exist or could not be deleted - */ - virtual bool deleteQueue(const std::string& queue) = 0; - - /** - * @brief Delete a queue - * @param queue the name of the queue - * @param unused true if the queue should be deleted only if not in use - * @param empty true if the queue shoudl be deleted only if empty - */ - virtual void deleteQueue( - const std::string& queue, - const bool unused, - const bool empty) = 0; - - /** - * @brief Purges the contents of a queue - * @param queue the name of the queue - */ - virtual void purgeQueue(const std::string& queue) = 0; - - /** - * @brief Declare a binding of a queue to an exchange - * @param binding the binding information - */ - virtual void declareBinding(SmartPtrBinding binding) = 0; - - /** - * @brief Remove a binding of a queue to an exchange - * @param binding the binding information - */ - virtual void removeBinding(SmartPtrBinding binding) = 0; -}; -CAF_DECLARE_SMART_INTERFACE_POINTER(AmqpAdmin); - -}} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/AmqpHeaderMapper.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/AmqpHeaderMapper.h deleted file mode 100644 index 8d6bf32ee..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/AmqpHeaderMapper.h +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Created on: Jun 6, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AMQPINTEGRATIONCORE_AMQPHEADERMAPPER_H_ -#define AMQPINTEGRATIONCORE_AMQPHEADERMAPPER_H_ - - -#include "ICafObject.h" - -#include "amqpClient/amqpImpl/BasicProperties.h" -#include "Integration/IIntMessage.h" -#include "amqpClient/api/Envelope.h" - -namespace Caf { namespace AmqpIntegration { - -/** - * @brief This interface is used by objects that map AMQP headers to integration message - * headers and vice versa. - */ -struct __declspec(novtable) AMQPINTEGRATIONCORE_LINKAGE -AmqpHeaderMapper : public ICafObject { - CAF_DECL_UUID("5A292DD4-C3CC-4556-9809-90027C13EFA5") - - /* - * @brief Return the collection of AMQP headers from an integration message. - * @param headers the integration message headers - * @return the AMQP headers - */ - virtual AmqpClient::AmqpContentHeaders::SmartPtrBasicProperties - fromHeaders(IIntMessage::SmartPtrCHeaders headers) = 0; - - /** - * @brief Return the collection of integration message headers from an AMQP message. - * @param properties the AMQP message properties (#Caf::AmqpClient::AmqpContentHeaders::BasicProperties). - * @param envelope the AMQP message envelope (#Caf::AmqpClient::Envelope). - * @return the filtered set of headers as integration message headers - */ - virtual IIntMessage::SmartPtrCHeaders - toHeaders( - AmqpClient::AmqpContentHeaders::SmartPtrBasicProperties properties, - AmqpClient::SmartPtrEnvelope envelope) = 0; - - /** - * @brief Return the filtered collection of integration message headers from an integration message. - * @param headers the input set of message headers - * @return the filtered set of headers as integration message headers - */ - virtual IIntMessage::SmartPtrCHeaders - filterHeaders( - IIntMessage::SmartPtrCHeaders headers) = 0; - - /** @brief AMQP header prefix */ - static const std::string PREFIX; - - /** @brief AMQP application id header */ - static const std::string APP_ID; - - /** @brief AMQP cluster id header */ - static const std::string CLUSTER_ID; - - /** @brief AMQP content encoding header */ - static const std::string CONTENT_ENCODING; - - /** @brief AMQP content length hedaer */ - static const std::string CONTENT_LENGTH; - - /** @brief AMQP content type header */ - static const std::string CONTENT_TYPE; - - /** @brief AMQP correlation id header */ - static const std::string CORRELATION_ID; - - /** @brief AMQP delivery mode header */ - static const std::string DELIVERY_MODE; - - /** @brief AMQP delivery tag header */ - static const std::string DELIVERY_TAG; - - /** @brief AMQP expiration header */ - static const std::string EXPIRATION; - - /** @brief AMQP message count header */ - static const std::string MESSAGE_COUNT; - - /** @brief AMQP message id header */ - static const std::string MESSAGE_ID; - - /** @brief AMQP received exchange header */ - static const std::string RECEIVED_EXCHANGE; - - /** @brief AMQP routing key header */ - static const std::string RECEIVED_ROUTING_KEY; - - /** @brief AMQP redelivered header */ - static const std::string REDELIVERED; - - /** @brief AMQP reply to header */ - static const std::string REPLY_TO; - - /** @brief AMQP timestamp header */ - static const std::string TIMESTAMP; - - /** @brief AMQP type header */ - static const std::string TYPE; - - /** @brief AMQP user id header */ - static const std::string USER_ID; -}; -CAF_DECLARE_SMART_INTERFACE_POINTER(AmqpHeaderMapper); - -}} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/AmqpMessageListenerSource.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/AmqpMessageListenerSource.h deleted file mode 100644 index 3011c043b..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/AmqpMessageListenerSource.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Created on: Aug 7, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AmqpMessageListenerSource_h -#define AmqpMessageListenerSource_h - -#include "Integration/Dependencies/CPollerMetadata.h" -#include "Integration/IIntMessage.h" -#include "amqpCore/AmqpHeaderMapper.h" -#include "amqpCore/MessageListener.h" -#include "Integration/Core/CAbstractPollableChannel.h" - -namespace Caf { namespace AmqpIntegration { - -class AMQPINTEGRATIONCORE_LINKAGE AmqpMessageListenerSource : - public CAbstractPollableChannel, - public MessageListener { -public: - AmqpMessageListenerSource(); - virtual ~AmqpMessageListenerSource(); - - void init( - const SmartPtrAmqpHeaderMapper& headerMapper, - const SmartPtrCPollerMetadata& pollerMetadata); - -public: // MessageListener - void onMessage(const SmartPtrIIntMessage& message); - -private: // CAbstractPollableChannel - bool doSend( - const SmartPtrIIntMessage& message, - int32 timeout); - - SmartPtrIIntMessage doReceive(const int32 timeout); - -private: - static void QueueItemDestroyFunc(gpointer data); - -private: - bool _isInitialized; - std::string _id; - GAsyncQueue *_messageQueue; - SmartPtrAmqpHeaderMapper _headerMapper; - - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(AmqpMessageListenerSource); -}; -CAF_DECLARE_SMART_POINTER(AmqpMessageListenerSource); - -}} - -#endif /* AmqpMessageListenerSource_h */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/AmqpOutboundEndpoint.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/AmqpOutboundEndpoint.h deleted file mode 100644 index 193ca2d43..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/AmqpOutboundEndpoint.h +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Created on: Jul 16, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AMQPINTEGRATIONCORE_AMQPOUTBOUNDENDPOINT_H_ -#define AMQPINTEGRATIONCORE_AMQPOUTBOUNDENDPOINT_H_ - - - -#include "Integration/IMessageHandler.h" - -#include "Common/IAppConfig.h" -#include "Common/IAppContext.h" -#include "Integration/Core/CExpressionHandler.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IIntMessage.h" -#include "Integration/IMessageChannel.h" -#include "amqpCore/AmqpHeaderMapper.h" -#include "amqpCore/AmqpTemplate.h" - -namespace Caf { namespace AmqpIntegration { - -/** - * @ingroup IntObjImpl - * @brief Adapter that converts and sends Messages to an AMQP exchange - */ -class AMQPINTEGRATIONCORE_LINKAGE AmqpOutboundEndpoint : public IMessageHandler { - CAF_BEGIN_QI() - CAF_QI_ENTRY(IMessageHandler) - CAF_END_QI() - -public: - AmqpOutboundEndpoint(); - virtual ~AmqpOutboundEndpoint(); - - /** - * @brief Initialize this object - * @param amqpTemplate the #Caf::AmqpIntegration::AmqpTemplate used to - * send and receive messages - * @param appConfig the application configuration object - * @param appContext the application context object - */ - void init( - SmartPtrAmqpTemplate amqpTemplate, - SmartPtrIAppConfig appConfig, - SmartPtrIAppContext appContext); - - /** - * @brief Set the name of the AMQP exchange - * @param exchangeName the name of the exchange - */ - void setExchangeName(const std::string& exchangeName); - - /** - * @brief Set the name of the AMQP exchange as an expression of message information - * @param exchangeNameExpression the exchange name expression - */ - void setExchangeNameExpression(const std::string& exchangeNameExpression); - - /** - * @brief Set the routing key - * @param routingKey the routing key - */ - void setRoutingKey(const std::string& routingKey); - - /** - * @brief Set the routing key as an expression of message information - * @param routingKeyExpression the routing key expression - */ - void setRoutingKeyExpression(const std::string& routingKeyExpression); - - /** - * @brief Set the regular expression mapping of headers to send along with the message - *

- * AMQP headers (amqp_XXXX) are always automatically mapped to their AMQP - * BasicProperties counterparts. This expression controls which additional headers - * are sent along with the message. - * @param expression header mapping expression - */ - void setMappedRequestHeadersExpression(const std::string& expression); - - /** - * @brief Set the expects reply flag. - * @param expectReply true if a reply is expected else false - */ - void setExpectReply(const bool expectReply); - - /** - * @brief Set the requires reply flag. - * @param requiresReply true if a reply is required else false - */ - void setRequiresReply(const bool requiresReply); - - /** - * @brief Set the friendly name of this instance. - * @param name the instance name - */ - void setComponentName(const std::string& name); - - /** - * @brief Set the channel resolver object - * @param channelResolver the channel resolver - */ - void setChannelResolver(SmartPtrIChannelResolver channelResolver); - -public: // IMessageHandler - UUID getHandlerId() const; - - void handleMessage(const SmartPtrIIntMessage& message); - - SmartPtrIIntMessage getSavedMessage() const; - - void clearSavedMessage(); - -private: - SmartPtrIIntMessage handleRequestMessage(SmartPtrIIntMessage requestMessage); - - void handleResult( - SmartPtrIIntMessage resultMessage, - IIntMessage::SmartPtrCHeaders requestHeaders); - - void send( - const std::string& exchangeName, - const std::string& routingKey, - SmartPtrIIntMessage requestMessage); - - SmartPtrIIntMessage sendAndReceive( - const std::string& exchangeName, - const std::string& routingKey, - SmartPtrIIntMessage requestMessage); - - SmartPtrIIntMessage createReplyMessage( - SmartPtrIIntMessage reply, - IIntMessage::SmartPtrCHeaders requestHeaders); - - void sendReplyMessage( - SmartPtrIIntMessage reply, - const std::string& replyChannelHeaderValue); - -private: - bool _isInitialized; - UUID _id; - std::string _componentName; - SmartPtrAmqpTemplate _amqpTemplate; - bool _expectReply; - bool _requiresReply; - std::string _exchangeName; - std::string _exchangeNameExpression; - std::string _routingKey; - std::string _routingKeyExpression; - std::string _requestHeaderMapperExpression; - SmartPtrIChannelResolver _channelResolver; - SmartPtrIMessageChannel _outputChannel; - SmartPtrCExpressionHandler _exchangeNameHandler; - SmartPtrCExpressionHandler _routingKeyHandler; - SmartPtrAmqpHeaderMapper _requestHeaderMapper; - SmartPtrAmqpHeaderMapper _responseHeaderMapper; - - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(AmqpOutboundEndpoint); -}; -CAF_DECLARE_SMART_QI_POINTER(AmqpOutboundEndpoint); - -}} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/AmqpTemplate.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/AmqpTemplate.h deleted file mode 100644 index 2cb7da5ba..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/AmqpTemplate.h +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Created on: May 25, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AMQPINTEGRATIONCORE_AMQPTEMPLATE_H_ -#define AMQPINTEGRATIONCORE_AMQPTEMPLATE_H_ - - - -#include "ICafObject.h" - -#include "Integration/IIntMessage.h" -#include "amqpClient/api/Channel.h" -#include "amqpCore/AmqpHeaderMapper.h" - -namespace Caf { namespace AmqpIntegration { - -/** - * @brief Specifies a basic set of AMQP operations. - *

- * Provides synchronous send and receive methods as well as a generic executor - * through a callback to a provided object. - */ -struct __declspec(novtable) AmqpTemplate : public ICafObject { - CAF_DECL_UUID("B79DDF8E-B302-4576-9D96-DC413C76392C") - - /** - * @brief Send a message to a default exchange with a default routing key. - * @param message a message to send - * @param headerMapper optional header mapper to use in place of the standard mapper - */ - virtual void send( - SmartPtrIIntMessage message, - SmartPtrAmqpHeaderMapper headerMapper = SmartPtrAmqpHeaderMapper()) = 0; - - /** - * @brief Send a message to a default exchange with a routing key. - * @param routingKey the routing key - * @param message a message to send - * @param headerMapper optional header mapper to use in place of the standard mapper - */ - virtual void send( - const std::string& routingKey, - SmartPtrIIntMessage message, - SmartPtrAmqpHeaderMapper headerMapper = SmartPtrAmqpHeaderMapper()) = 0; - - /** - * @brief Send a message to an exchange with a routing key. - * @param exchange the name of the exchange - * @param routingKey the routing key - * @param message a message to send - * @param headerMapper optional header mapper to use in place of the standard mapper - */ - virtual void send( - const std::string& exchange, - const std::string& routingKey, - SmartPtrIIntMessage message, - SmartPtrAmqpHeaderMapper headerMapper = SmartPtrAmqpHeaderMapper()) = 0; - - /** - * @brief Receive a message if there is one from a default queue. - *

- * Returns immediately, possibly with a null value. - * @param headerMapper optional header mapper to use in place of the standard mapper - */ - virtual SmartPtrIIntMessage receive( - SmartPtrAmqpHeaderMapper headerMapper = SmartPtrAmqpHeaderMapper()) = 0; - - /** - * @brief Receive a message if there is one from a specific queue. - *

- * Returns immediately, possibly with a null value. - * @param queueName the name of the queue - * @param headerMapper optional header mapper to use in place of the standard mapper - */ - virtual SmartPtrIIntMessage receive( - const std::string& queueName, - SmartPtrAmqpHeaderMapper headerMapper = SmartPtrAmqpHeaderMapper()) = 0; - - /** - * @brief Basic RPC pattern. - *

- * Send a message to a default exchange with a default routing key and attempt to - * receive a response. The implementation will create a temporary anonymous queue - * to receive the response and will use the repy-to header to notify the recipient - * of the response routing. - * @param message a message to send - * @param requestHeaderMapper optional header mapper to use in place of the standard mapper on the outgoing message - * @param responseHeaderMapper optional header mapper to use in place of the standard mapper on the incoming message - */ - virtual SmartPtrIIntMessage sendAndReceive( - SmartPtrIIntMessage message, - SmartPtrAmqpHeaderMapper requestHeaderMapper = SmartPtrAmqpHeaderMapper(), - SmartPtrAmqpHeaderMapper responseHeaderMapper = SmartPtrAmqpHeaderMapper()) = 0; - - /** - * @brief Basic RPC pattern. - *

- * Send a message to a default exchange with a specific routing key and attempt to - * receive a response. The implementation will create a temporary anonymous queue - * to receive the response and will use the repy-to header to notify the recipient - * of the response routing. - * @param routingKey the routing key - * @param message a message to send - * @param requestHeaderMapper optional header mapper to use in place of the standard mapper on the outgoing message - * @param responseHeaderMapper optional header mapper to use in place of the standard mapper on the incoming message - */ - virtual SmartPtrIIntMessage sendAndReceive( - const std::string& routingKey, - SmartPtrIIntMessage message, - SmartPtrAmqpHeaderMapper requestHeaderMapper = SmartPtrAmqpHeaderMapper(), - SmartPtrAmqpHeaderMapper responseHeaderMapper = SmartPtrAmqpHeaderMapper()) = 0; - - /** - * @brief Basic RPC pattern. - *

- * Send a message to a specific exchange with a specific routing key and attempt to - * receive a response. The implementation will create a temporary anonymous queue - * to receive the response and will use the repy-to header to notify the recipient - * of the response routing. - * @param exchange the name of the exchange - * @param routingKey the routing key - * @param message a message to send - * @param requestHeaderMapper optional header mapper to use in place of the standard mapper on the outgoing message - * @param responseHeaderMapper optional header mapper to use in place of the standard mapper on the incoming message - */ - virtual SmartPtrIIntMessage sendAndReceive( - const std::string& exchange, - const std::string& routingKey, - SmartPtrIIntMessage message, - SmartPtrAmqpHeaderMapper requestHeaderMapper = SmartPtrAmqpHeaderMapper(), - SmartPtrAmqpHeaderMapper responseHeaderMapper = SmartPtrAmqpHeaderMapper()) = 0; - - /** - * @brief Interface to objects used to execute arbitrary AMQP commands - *

- * This interface provides a mechanism to execute arbitrary AMQP commands. Implement - * a class based on this interface with the logic required to support the desired - * AMQP operation. The template will call this object with a channel on which - * to execute the command. - * @param channel the AMQP channel (Caf::AmqpClient::Channel in the - * CAF AMQP Client Library API documentation.) - * @param data user-specific data required to perform the operation - * @return a pointer to a user-specified object representing the result of the - * operation. - */ - struct Executor : public ICafObject { - virtual gpointer execute(AmqpClient::SmartPtrChannel channel, gpointer data) = 0; - }; - CAF_DECLARE_SMART_POINTER(Executor); - - /** - * @brief Execute an arbitrary AMQP operation - * @see #Caf::AmqpIntegration::AmqpTemplate::Executor - * @param executor the object used to execute the AMQP operation - * @param data user-specific data required to perform the operation - * @return a pointer to a user-specified object representing the result of the - * operation. - */ - virtual gpointer execute(SmartPtrExecutor executor, gpointer data) = 0; -}; -CAF_DECLARE_SMART_INTERFACE_POINTER(AmqpTemplate); - -}} - -#endif /* AMQPINTEGRATIONCORE_AMQPTEMPLATE_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/Binding.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/Binding.h deleted file mode 100644 index 00103c6fb..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/Binding.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Created on: Jun 13, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AMQPINTEGRATIONCORE_BINDING_H_ -#define AMQPINTEGRATIONCORE_BINDING_H_ - - -#include "ICafObject.h" - -namespace Caf { namespace AmqpIntegration { - -/** - * @brief Simple container collecting information to describe a queue binding. Used in conjunction with RabbitAdmin. - *

- * Use #Caf::AmqpIntegration::createBinding to create a binding. - */ -struct __declspec(novtable) Binding : public ICafObject { - CAF_DECL_UUID("A6067BE6-18C1-4D50-BB2F-AB9E49EA2111") - - /** @return the queue name */ - virtual std::string getQueue() const = 0; - - /** @return the exchange name */ - virtual std::string getExchange() const = 0; - - /** @return the routing key */ - virtual std::string getRoutingKey() const = 0; -}; -CAF_DECLARE_SMART_INTERFACE_POINTER(Binding); - -}} - -#endif /* AMQPINTEGRATIONCORE_BINDING_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/BindingImpl.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/BindingImpl.h deleted file mode 100644 index 8f1fb196f..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/BindingImpl.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Created on: Jun 14, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AMQPINTEGRATIONCORE_BINDINGIMPL_H_ -#define AMQPINTEGRATIONCORE_BINDINGIMPL_H_ - -namespace Caf { namespace AmqpIntegration { - -/** - * @brief Implementations of the #Caf::AmqpIntegration::Binding interface. - */ -class AMQPINTEGRATIONCORE_LINKAGE BindingImpl : public Binding { -public: - BindingImpl(); - virtual ~BindingImpl(); - - /** - * @brief initialize the object - * @param queue the name of the queue - * @param exchange the name of the exchange - * @param routingKey the routing key - */ - void init( - const std::string queue, - const std::string exchange, - const std::string routingKey); - - std::string getQueue() const; - - std::string getExchange() const; - - std::string getRoutingKey() const; - -private: - std::string _queue; - std::string _exchange; - std::string _routingKey; - CAF_CM_DECLARE_NOCOPY(BindingImpl); -}; -CAF_DECLARE_SMART_POINTER(BindingImpl); - -}} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/BindingInternal.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/BindingInternal.h deleted file mode 100644 index 36e890861..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/BindingInternal.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Created on: Jun 15, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AMQPINTEGRATIONCORE_BINDINGINTERNAL_H_ -#define AMQPINTEGRATIONCORE_BINDINGINTERNAL_H_ - - -#include "ICafObject.h" - -#include "amqpCore/Binding.h" - -namespace Caf { namespace AmqpIntegration { - -/** - * @ingroup IntObjImpl - * @brief Interface allowing for internal management of binding integration objects - */ -struct __declspec(novtable) BindingInternal : public ICafObject { - CAF_DECL_UUID("23D0079E-93F8-4C06-BD33-F0E795506FB2") - - /** - * @brief Sets the delegated Binding object - * @param binding the delegated binding - */ - virtual void setBindingInternal(SmartPtrBinding binding) = 0; -}; -CAF_DECLARE_SMART_INTERFACE_POINTER(BindingInternal); - -}} -#endif /* AMQPINTEGRATIONCORE_BINDINGINTERNAL_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/BlockingQueueConsumer.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/BlockingQueueConsumer.h deleted file mode 100644 index b6f45a2a6..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/BlockingQueueConsumer.h +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Created on: Jul 30, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AMQPINTEGRATIONCORE_BLOCKINGQUEUECONSUMER_H_ -#define AMQPINTEGRATIONCORE_BLOCKINGQUEUECONSUMER_H_ - -#include "ICafObject.h" - -#include "amqpClient/amqpImpl/BasicProperties.h" -#include "Common/CAutoRecMutex.h" -#include "Exception/CCafException.h" -#include "Integration/IIntMessage.h" -#include "Memory/DynamicArray/DynamicArrayInc.h" -#include "amqpClient/api/Channel.h" -#include "amqpClient/api/Envelope.h" -#include "amqpCore/AmqpHeaderMapper.h" -#include "amqpClient/api/Connection.h" -#include "amqpCore/ConnectionFactory.h" -#include "Integration/ILifecycle.h" - -namespace Caf { namespace AmqpIntegration { - -// Forward-declare -class BlockingQueueConsumer; -CAF_DECLARE_SMART_POINTER(BlockingQueueConsumer) - -/** - * @ingroup IntObjImpl - * @brief Specialized consumer encapsulating knowledge of the broker connections and having its own lifecycle - */ -class AMQPINTEGRATIONCORE_LINKAGE BlockingQueueConsumer : - public ILifecycle { -public: - BlockingQueueConsumer(); - virtual ~BlockingQueueConsumer(); - - /** - * @brief object initializer - * @param connectionFactory connection factory object - * @param headerMapper header mapper object to map incoming headers - * @param acknowledgeMode message acknowledgement mode - * @param prefetchCount if acknowledgeMode is AUTO or MANUAL this - * message prefetch count value will be sent to the broker via the basic.qos method. - * @param queue the queue to consume - */ - void init( - SmartPtrConnectionFactory connectionFactory, - SmartPtrAmqpHeaderMapper headerMapper, - AcknowledgeMode acknowledgeMode, - uint32 prefetchCount, - const std::string& queue); - - /** - * @retval the underlying channel - */ - AmqpClient::SmartPtrChannel getChannel(); - - /** - * @retval the AMQP consumer tag(s) - */ - std::string getConsumerTag(); - - /** - * @brief Wait for the next message delivery and return it - *

- * This is a blocking call and will return only when a message has been delivered - * or the consumer is canceled. In the case of cancellation NULL will be returned. - * @retval the next message or NULL - */ - SmartPtrIIntMessage nextMessage(); - - /** - * @brief Wait for the next message delivery and return it - *

- * This is a non-blocking call and will return when a message has been delivered - * within the timeout specified or if the consumer is canceled. - * @param timeout the timeout in milliseconds - * @retval the next message or NULL - */ - SmartPtrIIntMessage nextMessage(int32 timeout); - - /** - * @brief Acknowledges unacknowledged messages - *

- * Sends a basic.ack for messages that have been delivered. This method only - * sends a basic.ack if the acknowledge mode flag is set to ACKNOWLEDGEMODE_AUTO. - */ - bool commitIfNecessary(); - - /** - * @brief Rejects unacknowledged messaages - *

- * Sends a basic.reject for messages that have been delivered. This method only - * sends a basic.reject if the acknowledge mode flag is set to ACKNOWLEDGEMODE_AUTO. - * @param ex the application exception necessitating a rollback - */ - void rollbackOnExceptionIfNecessary(SmartPtrCCafException& ex); - -public: - void start(const uint32 timeoutMs); - void stop(const uint32 timeoutMs); - bool isRunning() const; - -private: - class InternalConsumer : public AmqpClient::Consumer { - public: - InternalConsumer(); - virtual ~InternalConsumer(); - - void init( - BlockingQueueConsumer* parent); - - public: - void handleConsumeOk( - const std::string& consumerTag); - - void handleCancelOk( - const std::string& consumerTag); - - void handleRecoverOk( - const std::string& consumerTag); - - void handleDelivery( - const std::string& consumerTag, - const AmqpClient::SmartPtrEnvelope& envelope, - const AmqpClient::AmqpContentHeaders::SmartPtrBasicProperties& properties, - const SmartPtrCDynamicByteArray& body); - - void handleShutdown( - const std::string& consumerTag, - SmartPtrCCafException& reason); - - std::string getConsumerTag(); - - private: - SmartPtrBlockingQueueConsumer _parent; - AmqpClient::SmartPtrChannel _channel; - std::string _consumerTag; - GAsyncQueue *_deliveryQueue; - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(InternalConsumer); - }; - CAF_DECLARE_SMART_POINTER(InternalConsumer); - -private: - struct Delivery : public ICafObject { - AmqpClient::SmartPtrEnvelope envelope; - AmqpClient::AmqpContentHeaders::SmartPtrBasicProperties properties; - SmartPtrCDynamicByteArray body; - }; - CAF_DECLARE_SMART_POINTER(Delivery); - -private: - void checkShutdown(); - - SmartPtrIIntMessage handle(SmartPtrDelivery delivery); - - static void destroyQueueItem(gpointer data); - -private: - friend class InternalConsumer; - - bool _isInitialized; - volatile bool _isRunning; - volatile bool _isCanceled; - std::set _deliveryTags; - SmartPtrInternalConsumer _consumer; - SmartPtrCAutoRecMutex _parentLock; - SmartPtrCCafException _shutdownException; - GAsyncQueue *_deliveryQueue; - SmartPtrConnectionFactory _connectionFactory; - SmartPtrConnection _connection; - AmqpClient::SmartPtrChannel _channel; - SmartPtrAmqpHeaderMapper _headerMapper; - AcknowledgeMode _acknowledgeMode; - uint32 _prefetchCount; - std::string _queue; - - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(BlockingQueueConsumer); -}; - -}} - -#endif /* AMQPINTEGRATIONCORE_BLOCKINGQUEUECONSUMER_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/CachingConnectionFactory.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/CachingConnectionFactory.h deleted file mode 100644 index c399069d6..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/CachingConnectionFactory.h +++ /dev/null @@ -1,269 +0,0 @@ -/* - * Created on: May 25, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CACHINGCONNECTIONFACTORY_H_ -#define CACHINGCONNECTIONFACTORY_H_ - -#include "amqpClient/amqpImpl/BasicProperties.h" -#include "Common/CAutoRecMutex.h" -#include "Exception/CCafException.h" -#include "Memory/DynamicArray/DynamicArrayInc.h" -#include "amqpClient/api/AmqpMethods.h" -#include "amqpClient/api/Channel.h" -#include "amqpClient/api/Consumer.h" -#include "amqpClient/api/GetResponse.h" -#include "amqpClient/api/ReturnListener.h" -#include "amqpClient/api/amqpClient.h" -#include "amqpCore/ChannelProxy.h" -#include "amqpClient/api/Connection.h" -#include "amqpClient/api/ConnectionFactory.h" -#include "amqpCore/ConnectionListener.h" -#include "amqpCore/AbstractConnectionFactory.h" -#include "amqpCore/ConnectionProxy.h" - -namespace Caf { namespace AmqpIntegration { - -/** - * @ingroup IntObjImpl - * @brief Implementation of the CachingConnectionFactory Integration Object - */ -class AMQPINTEGRATIONCORE_LINKAGE CachingConnectionFactory : - public AbstractConnectionFactory { -public: - CachingConnectionFactory(); - virtual ~CachingConnectionFactory(); - - void init(); - - void init(const std::string& protocol, const std::string& host, const uint32 port); - - void init(const std::string& protocol, const std::string& host); - - void init(const uint32 port); - - void init(const AmqpClient::SmartPtrConnectionFactory& amqpConnectionFactory); - - void destroy(); - - uint32 getChannelCacheSize(); - - AmqpClient::SmartPtrChannel getChannel(); - - void setConnectionListeners(const std::deque& listeners); - - void setChannelCacheSize(uint32 cacheSize); - -public: // ConnectionFactory - SmartPtrConnection createConnection(); - - void addConnectionListener(const SmartPtrConnectionListener& listener); - -private: - typedef std::deque ProxyDeque; - CAF_DECLARE_SMART_POINTER(ProxyDeque); - - void reset(); - - SmartPtrChannelProxy newCachedChannelProxy(); - - AmqpClient::SmartPtrChannel createBareChannel(); - -private: - class ChannelCachingConnectionProxy : public ConnectionProxy { - public: - ChannelCachingConnectionProxy(); - virtual ~ChannelCachingConnectionProxy(); - - public: - void init( - SmartPtrConnection connection, - CachingConnectionFactory *parent); - - void destroy(); - - public: // ConnectionProxy - SmartPtrConnection getTargetConnection(); - - public: // Connection - AmqpClient::SmartPtrChannel createChannel(); - void close(); - bool isOpen(); - - public: - AmqpClient::SmartPtrChannel createBareChannel(); - - private: - SmartPtrConnection _target; - CachingConnectionFactory *_parent; - - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(ChannelCachingConnectionProxy); - }; - CAF_DECLARE_SMART_POINTER(ChannelCachingConnectionProxy); - friend class ChannelCachingConnectionProxy; - - class CachedChannelHandler : public ChannelProxy { - public: - CachedChannelHandler(); - virtual ~CachedChannelHandler(); - - void init( - CachingConnectionFactory *parent, - AmqpClient::SmartPtrChannel channel); - - private: - void logicalClose(); - - void physicalClose(); - - void checkChannel(); - - void postProcessCall(SmartPtrCCafException exception); - - public: // ChannelProxy - AmqpClient::SmartPtrChannel getTargetChannel(); - - public: // Channel - uint16 getChannelNumber(); - - void close(); - - bool isOpen(); - - void basicAck( - const uint64 deliveryTag, - const bool ackMultiple); - - AmqpClient::SmartPtrGetResponse basicGet( - const std::string& queue, - const bool noAck); - - void basicPublish( - const std::string& exchange, - const std::string& routingKey, - const AmqpClient::AmqpContentHeaders::SmartPtrBasicProperties& properties, - const SmartPtrCDynamicByteArray& body); - - void basicPublish( - const std::string& exchange, - const std::string& routingKey, - const bool mandatory, - const bool immediate, - const AmqpClient::AmqpContentHeaders::SmartPtrBasicProperties& properties, - const SmartPtrCDynamicByteArray& body); - - AmqpClient::AmqpMethods::Basic::SmartPtrConsumeOk basicConsume( - const std::string& queue, - const AmqpClient::SmartPtrConsumer& consumer); - - AmqpClient::AmqpMethods::Basic::SmartPtrConsumeOk basicConsume( - const std::string& queue, - const bool noAck, - const AmqpClient::SmartPtrConsumer& consumer); - - AmqpClient::AmqpMethods::Basic::SmartPtrConsumeOk basicConsume( - const std::string& queue, - const std::string& consumerTag, - const bool noAck, - const bool noLocal, - const bool exclusive, - const AmqpClient::SmartPtrConsumer& consumer, - const AmqpClient::SmartPtrTable& arguments = AmqpClient::SmartPtrTable()); - - AmqpClient::AmqpMethods::Basic::SmartPtrCancelOk basicCancel( - const std::string& consumerTag); - - AmqpClient::AmqpMethods::Basic::SmartPtrRecoverOk basicRecover( - const bool requeue); - - AmqpClient::AmqpMethods::Basic::SmartPtrQosOk basicQos( - const uint32 prefetchSize, - const uint32 prefetchCount, - const bool global); - - void basicReject( - const uint64 deliveryTag, - const bool requeue); - - AmqpClient::AmqpMethods::Exchange::SmartPtrDeclareOk exchangeDeclare( - const std::string& exchange, - const std::string& type, - const bool durable = false, - const AmqpClient::SmartPtrTable& arguments = AmqpClient::SmartPtrTable()); - - AmqpClient::AmqpMethods::Exchange::SmartPtrDeleteOk exchangeDelete( - const std::string& exchange, - const bool ifUnused); - - AmqpClient::AmqpMethods::Queue::SmartPtrDeclareOk queueDeclare(); - - AmqpClient::AmqpMethods::Queue::SmartPtrDeclareOk queueDeclare( - const std::string& queue, - const bool durable, - const bool exclusive, - const bool autoDelete, - const AmqpClient::SmartPtrTable& arguments = AmqpClient::SmartPtrTable()); - - AmqpClient::AmqpMethods::Queue::SmartPtrDeclareOk queueDeclarePassive( - const std::string& queue); - - AmqpClient::AmqpMethods::Queue::SmartPtrDeleteOk queueDelete( - const std::string& queue, - const bool ifUnused, - const bool ifEmpty); - - AmqpClient::AmqpMethods::Queue::SmartPtrPurgeOk queuePurge( - const std::string& queue); - - AmqpClient::AmqpMethods::Queue::SmartPtrBindOk queueBind( - const std::string& queue, - const std::string& exchange, - const std::string& routingKey, - const AmqpClient::SmartPtrTable& arguments = AmqpClient::SmartPtrTable()); - - AmqpClient::AmqpMethods::Queue::SmartPtrUnbindOk queueUnbind( - const std::string& queue, - const std::string& exchange, - const std::string& routingKey, - const AmqpClient::SmartPtrTable& arguments = AmqpClient::SmartPtrTable()); - - void addReturnListener( - const AmqpClient::SmartPtrReturnListener& listener); - - bool removeReturnListener( - const AmqpClient::SmartPtrReturnListener& listener); - - private: - CachingConnectionFactory *_parent; - AmqpClient::SmartPtrChannel _channel; - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_CREATE_THREADSAFE; - CAF_CM_DECLARE_NOCOPY(CachedChannelHandler); - }; - CAF_DECLARE_SMART_POINTER(CachedChannelHandler); - friend class CachedChannelHandler; - -private: - bool _isInitialized; - bool _isActive; - SmartPtrCAutoRecMutex _connectionMonitor; - SmartPtrChannelCachingConnectionProxy _connection; - uint32 _channelCacheSize; - SmartPtrProxyDeque _cachedChannels; - SmartPtrCAutoRecMutex _cachedChannelsMonitor; - - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CachingConnectionFactory); -}; -CAF_DECLARE_SMART_POINTER(CachingConnectionFactory); - -}} - -#endif /* CACHINGCONNECTIONFACTORY_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/ChannelProxy.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/ChannelProxy.h deleted file mode 100644 index 907a4773a..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/ChannelProxy.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Created on: May 29, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CHANNELPROXY_H_ -#define CHANNELPROXY_H_ - - -#include "amqpClient/api/Channel.h" - -namespace Caf { namespace AmqpIntegration { - -/** - * @ingroup IntObjImpl - * @brief Interface on objects used to proxy channel objects for the various - * connection objects. - */ -struct __declspec(novtable) ChannelProxy : public AmqpClient::Channel { - - /** - * @brief Return the proxied Channel object - * @return the proxied channel - */ - virtual AmqpClient::SmartPtrChannel getTargetChannel() = 0; -}; -CAF_DECLARE_SMART_INTERFACE_POINTER(ChannelProxy); - -}} - -#endif /* CHANNELPROXY_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/CompositeConnectionListener.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/CompositeConnectionListener.h deleted file mode 100644 index 90edfbd00..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/CompositeConnectionListener.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Created on: Jun 2, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef COMPOSITECONNECTIONLISTENER_H_ -#define COMPOSITECONNECTIONLISTENER_H_ - -#include "amqpClient/api/Connection.h" -#include "amqpCore/ConnectionListener.h" - -namespace Caf { namespace AmqpIntegration { - -/** - * @ingroup IntObjImpl - * @brief Implementation of ConnectionListener that notifies multiple delegates - */ -class AMQPINTEGRATIONCORE_LINKAGE CompositeConnectionListener : public ConnectionListener { -public: - CompositeConnectionListener(); - virtual ~CompositeConnectionListener(); - - typedef std::deque ListenerDeque; - - /** - * @brief Set the delegate collection - * @param delegates the collection of ConnectionListener delegates - */ - void setDelegates(const ListenerDeque& delegates); - - /** - * @brief Add a delegate to the collection - * @param delegate the ConnectionListener delegate to add - */ - void addDelegate(const SmartPtrConnectionListener& delegate); - -public: // ConnectionListener - void onCreate(const SmartPtrConnection& connection); - void onClose(const SmartPtrConnection& connection); - -private: - ListenerDeque _delegates; - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CompositeConnectionListener); -}; -CAF_DECLARE_SMART_POINTER(CompositeConnectionListener); - -}} - -#endif /* COMPOSITECONNECTIONLISTENER_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/Connection.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/Connection.h deleted file mode 100644 index 0b5b2de10..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/Connection.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Created on: May 24, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AMQPINTEGRATIONCORE_CONNECTION_H_ -#define AMQPINTEGRATIONCORE_CONNECTION_H_ - - -#include "ICafObject.h" - -#include "amqpClient/api/Channel.h" - -namespace Caf { namespace AmqpIntegration { - -/** - * @ingroup IntObjImpl - * @brief An interface for Caf::AmqpIntegration connection objects - */ -struct __declspec(novtable) Connection : public ICafObject { - - /** - * @brief Create a {@link AmqpClient::Channel Channel}. - */ - virtual AmqpClient::SmartPtrChannel createChannel() = 0; - - /** - * @brief Close the connection - */ - virtual void close() = 0; - - /** - * @brief Check the connection's status - * @retval true the connection is open - * @retval false the connection is closed - */ - virtual bool isOpen() = 0; -}; -CAF_DECLARE_SMART_INTERFACE_POINTER(Connection); - -}} - -#endif /* AMQPINTEGRATIONCORE_CONNECTION_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/ConnectionFactory.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/ConnectionFactory.h deleted file mode 100644 index 7f40c00ac..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/ConnectionFactory.h +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Created on: May 24, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AMQPINTEGRATIONCORE_CONNECTIONFACTORY_H_ -#define AMQPINTEGRATIONCORE_CONNECTIONFACTORY_H_ - -#include "amqpClient/api/Connection.h" -#include "amqpCore/ConnectionListener.h" - -namespace Caf { namespace AmqpIntegration { - -/** - * @ingroup IntObjImpl - * @brief Interface for connection factory implementations - */ -struct __declspec(novtable) ConnectionFactory : ICafObject { - CAF_DECL_UUID("D2420BC6-240C-4EAC-8518-E86A93A40035") - - /** - * @return a new Connection - */ - virtual SmartPtrConnection createConnection() = 0; - - /** - * @return the default protocol to use for connections - */ - virtual std::string getProtocol() = 0; - - /** - * @return the default host to use for connections - */ - virtual std::string getHost() = 0; - - /** - * @return the default port to use for connections - */ - virtual uint32 getPort() = 0; - - /** - * @return the default virtual host to use for connections - */ - virtual std::string getVirtualHost() = 0; - - /** - * @return the default user name to use for connections - */ - virtual std::string getUsername() = 0; - - /** - * @return the default password to use for connections - */ - virtual std::string getPassword() = 0; - - /** - * @return the default path to the CA Cert - */ - virtual std::string getCaCertPath() = 0; - - /** - * @return the default path to the Client Cert - */ - virtual std::string getClientCertPath() = 0; - - /** - * @return the default path to the Client Key - */ - virtual std::string getClientKeyPath() = 0; - - /** - * @return the number of connection retries - */ - virtual uint16 getRetries() = 0; - - /** - * @return the number of connection seconds to wait - */ - virtual uint16 getSecondsToWait() = 0; - - /** - * @brief Add a connection create/close callback - * @param listener ConnectionListener callback - */ - virtual void addConnectionListener(const SmartPtrConnectionListener& listener) = 0; -}; -CAF_DECLARE_SMART_INTERFACE_POINTER(ConnectionFactory); - -}} - -#endif /* AMQPINTEGRATIONCORE_CONNECTIONFACTORY_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/ConnectionListener.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/ConnectionListener.h deleted file mode 100644 index d34590c59..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/ConnectionListener.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Created on: Jun 2, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AMQPINTEGRATIONCORE_CONNECTIONLISTENER_H_ -#define AMQPINTEGRATIONCORE_CONNECTIONLISTENER_H_ - -#include "ICafObject.h" - -#include "amqpCore/Connection.h" - -namespace Caf { namespace AmqpIntegration { - -/** - * @ingroup IntObjImpl - * @brief Connection event notification callback interface - */ -struct __declspec(novtable) ConnectionListener : public ICafObject { - CAF_DECL_UUID("8F249C38-CF91-4553-9C68-3D714626A7EC") - - /** - * @brief Connection created event - * @param connection the Connection that has been created - */ - virtual void onCreate(const SmartPtrConnection& connection) = 0; - - /** - * @brief Connection closed event - * @param connection the Connection that has been closed - */ - virtual void onClose(const SmartPtrConnection& connection) = 0; -}; -CAF_DECLARE_SMART_INTERFACE_POINTER(ConnectionListener); - -}} - -#endif /* AMQPINTEGRATIONCORE_CONNECTIONLISTENER_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/ConnectionProxy.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/ConnectionProxy.h deleted file mode 100644 index 3dcb70d9b..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/ConnectionProxy.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Created on: May 25, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AMQPINTEGRATIONCORE_CONNECTIONPROXY_H_ -#define AMQPINTEGRATIONCORE_CONNECTIONPROXY_H_ - -#include "amqpClient/api/Connection.h" - -namespace Caf { namespace AmqpIntegration { - -/** - * @ingroup IntObjImpl - * @brief Interface on objects used to proxy connection objects for the various - * connection factories. - */ -struct __declspec(novtable) ConnectionProxy : public Connection { - - /** - * @brief Return the proxied Connection object - * @return the proxied connection - */ - virtual SmartPtrConnection getTargetConnection() = 0; -}; -CAF_DECLARE_SMART_INTERFACE_POINTER(ConnectionProxy); - -}} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/DefaultAmqpHeaderMapper.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/DefaultAmqpHeaderMapper.h deleted file mode 100644 index efc71aca8..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/DefaultAmqpHeaderMapper.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Created on: Jun 6, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AMQPINTEGRATIONCORE_DEFAULTAMQPHEADERMAPPER_H_ -#define AMQPINTEGRATIONCORE_DEFAULTAMQPHEADERMAPPER_H_ - -#include "amqpClient/amqpImpl/BasicProperties.h" -#include "Common/CCafRegex.h" -#include "Integration/IIntMessage.h" -#include "amqpClient/api/Envelope.h" -#include "amqpCore/AmqpHeaderMapper.h" - -namespace Caf { namespace AmqpIntegration { - -/** - * @brief This class is used to map AMQP headers to integration message - * headers and vice versa. - *

- * This class maps headers between the AMQP message protocol and the internal - * integration object message protocol. By default, standard AMQP headers are mapped and - * internal and user-defined headers are not. An optional regular expression can be - * supplied to allow user-defined headers to be mapped from integration messages - * to AMQP. - */ -class AMQPINTEGRATIONCORE_LINKAGE DefaultAmqpHeaderMapper : public AmqpHeaderMapper { -public: - DefaultAmqpHeaderMapper(); - virtual ~DefaultAmqpHeaderMapper(); - - /** - * @brief Object initializer - * @param userHeaderRegex the regular expression to apply to the integration - * message header keys. Those that match are mapped to the AMQP message headers. - */ - void init(const std::string& userHeaderRegex = std::string()); - - virtual AmqpClient::AmqpContentHeaders::SmartPtrBasicProperties - fromHeaders(IIntMessage::SmartPtrCHeaders headers); - - virtual IIntMessage::SmartPtrCHeaders - toHeaders( - AmqpClient::AmqpContentHeaders::SmartPtrBasicProperties properties, - AmqpClient::SmartPtrEnvelope envelope); - - virtual IIntMessage::SmartPtrCHeaders - filterHeaders( - IIntMessage::SmartPtrCHeaders headers); - -private: - bool _isInitialized; - SmartPtrCCafRegex _userHeaderRegex; - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(DefaultAmqpHeaderMapper); -}; -CAF_DECLARE_SMART_POINTER(DefaultAmqpHeaderMapper); - -}} - -#endif /* AMQPINTEGRATIONCORE_DEFAULTAMQPHEADERMAPPER_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/Exchange.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/Exchange.h deleted file mode 100644 index a935ce446..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/Exchange.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Created on: Jun 12, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AMQPINTEGRATIONCORE_EXCHANGE_H_ -#define AMQPINTEGRATIONCORE_EXCHANGE_H_ - - -#include "ICafObject.h" - -namespace Caf { namespace AmqpIntegration { - -/** - * @brief Constants representing the exchange types returned by #Caf::AmqpIntegration::Exchange::getType - */ -struct AMQPINTEGRATIONCORE_LINKAGE ExchangeTypes { - /** @brief direct exchange */ - static const char *DIRECT; - /** @brief topic exchange */ - static const char *TOPIC; - /** @brief headers exchange */ - static const char *HEADERS; - /** @brief fanoout exchange */ - static const char *FANOUT; -}; - -/** - * @brief Simple container collecting information to describe an exchange. Used in conjunction with RabbitAdmin. - *

- * Use #Caf::AmqpIntegration::createDirectExchange, #Caf::AmqpIntegration::createTopicExchange, - * #Caf::AmqpIntegration::createHeadersExchange or #Caf::AmqpIntegration::createFanoutExchange - * to create an exchange. - */ -struct __declspec(novtable) Exchange : public ICafObject { - CAF_DECL_UUID("0F93E16B-E12D-4D00-8DB8-163D57BE2078") - - /** @return the name of the exchange */ - virtual std::string getName() const = 0; - - /** @return the exchange type @see #Caf::AmqpIntegration::ExchangeTypes */ - virtual std::string getType() const = 0; - - /** - * @retval true the exchange is durable - * @retval false the exchange is not durable - */ - virtual bool isDurable() const = 0; -}; -CAF_DECLARE_SMART_INTERFACE_POINTER(Exchange); - -}} - -#endif /* AMQPINTEGRATIONCORE_EXCHANGE_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/ExchangeImpl.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/ExchangeImpl.h deleted file mode 100644 index fa6e83451..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/ExchangeImpl.h +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Created on: Jun 14, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AMQPINTEGRATIONCORE_EXCHANGEIMPL_H_ -#define AMQPINTEGRATIONCORE_EXCHANGEIMPL_H_ - -namespace Caf { namespace AmqpIntegration { - -/** - * @brief Base class for implementations of the #Caf::AmqpIntegration::Exchange interface - */ -class AMQPINTEGRATIONCORE_LINKAGE AbstractExchange : public Exchange { -public: - AbstractExchange(); - virtual ~AbstractExchange(); - - /** - * @brief initalize the object - * @param name exchange name - * @param isDurable true if the exchange is durable else false - */ - void init( - const std::string& name, - const bool isDurable); - - virtual std::string getName() const; - virtual std::string getType() const = 0; - virtual bool isDurable() const; - -private: - std::string _name; - bool _isDurable; - CAF_CM_DECLARE_NOCOPY(AbstractExchange); -}; - -/** - * @brief Implementation of the #Caf::AmqpIntegration::Exchange interface for direct exchanges - */ -class DirectExchange : public AbstractExchange { -public: - DirectExchange(); - - /** - * @brief initalize the object - * @param name exchange name - * @param durable true if the exchange is durable else false - */ - void init( - const std::string name, - const bool durable); - - virtual std::string getType() const; - CAF_CM_DECLARE_NOCOPY(DirectExchange); -}; -CAF_DECLARE_SMART_POINTER(DirectExchange); - -/** - * @brief Implementation of the #Caf::AmqpIntegration::Exchange interface for topic exchanges - */ -class TopicExchange : public AbstractExchange { -public: - TopicExchange(); - - /** - * @brief initalize the object - * @param name exchange name - * @param durable true if the exchange is durable else false - */ - void init( - const std::string name, - const bool durable); - - virtual std::string getType() const; - CAF_CM_DECLARE_NOCOPY(TopicExchange); -}; -CAF_DECLARE_SMART_POINTER(TopicExchange); - -/** - * @brief Implementation of the #Caf::AmqpIntegration::Exchange interface for headers exchanges - */ -class HeadersExchange : public AbstractExchange { -public: - HeadersExchange(); - - /** - * @brief initalize the object - * @param name exchange name - * @param durable true if the exchange is durable else false - */ - void init( - const std::string name, - const bool durable); - - virtual std::string getType() const; - CAF_CM_DECLARE_NOCOPY(HeadersExchange); -}; -CAF_DECLARE_SMART_POINTER(HeadersExchange); - -/** - * @brief Implementation of the #Caf::AmqpIntegration::Exchange interface for fanout exchanges - */ -class FanoutExchange : public AbstractExchange { -public: - FanoutExchange(); - - /** - * @brief initalize the object - * @param name exchange name - * @param durable true if the exchange is durable else false - */ - void init( - const std::string name, - const bool durable); - - virtual std::string getType() const; - CAF_CM_DECLARE_NOCOPY(FanoutExchange); -}; -CAF_DECLARE_SMART_POINTER(FanoutExchange); - -}} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/ExchangeInternal.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/ExchangeInternal.h deleted file mode 100644 index 89ec599bf..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/ExchangeInternal.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Created on: Jun 14, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AMQPINTEGRATIONCORE_EXCHANGEINTERNAL_H_ -#define AMQPINTEGRATIONCORE_EXCHANGEINTERNAL_H_ - - -#include "ICafObject.h" - -#include "amqpCore/Binding.h" - -namespace Caf { namespace AmqpIntegration { - -/** - * @ingroup IntObjImpl - * @brief Interface allowing for internal management of exchange integration objects - */ -struct __declspec(novtable) ExchangeInternal : public ICafObject { - CAF_DECL_UUID("5373AD13-2103-4FC4-A581-9D6D454F02A3") - - /** - * @brief Return the bindings defined as part of the exchange definition - * @return the collection of bindings - */ - virtual std::deque getEmbeddedBindings() const = 0; -}; -CAF_DECLARE_SMART_INTERFACE_POINTER(ExchangeInternal); - -}} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/MessageListener.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/MessageListener.h deleted file mode 100644 index d5704ec3d..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/MessageListener.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Created on: Aug 2, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AMQPINTEGRATIONCORE_MESSAGELISTENER_H_ -#define AMQPINTEGRATIONCORE_MESSAGELISTENER_H_ - - -#include "ICafObject.h" - -#include "Integration/IIntMessage.h" - -namespace Caf { namespace AmqpIntegration { - -struct __declspec(novtable) MessageListener : public ICafObject { - CAF_DECL_UUID("5B2B7C47-ACEF-4FB1-97A0-1594D05AB4D9") - - virtual void onMessage(const SmartPtrIIntMessage& message) = 0; -}; -CAF_DECLARE_SMART_INTERFACE_POINTER(MessageListener); - -}} - -#endif /* AMQPINTEGRATIONCORE_MESSAGELISTENER_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/Queue.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/Queue.h deleted file mode 100644 index 0f05ffa87..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/Queue.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Created on: Jun 13, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AMQPINTEGRATIONCORE_QUEUE_H_ -#define AMQPINTEGRATIONCORE_QUEUE_H_ - - -#include "ICafObject.h" - -namespace Caf { namespace AmqpIntegration { - -/** - * @brief Simple container collecting information to describe a queue. Used in conjunction with RabbitAdmin. - *

- * Use #Caf::AmqpIntegration::createQueue to create a queue. - */ -struct __declspec(novtable) Queue : public ICafObject { - CAF_DECL_UUID("082088AD-ECA3-4591-986F-8D9AFEDDEE7D") - - /** @return the name of the queue */ - virtual std::string getName() const = 0; - - /** - * @retval true the queue is durable - * @retval false the queue is not durable - */ - virtual bool isDurable() const = 0; - - /** - * @retval true the queue is exclusive to the connection - * @retval false the queue is not exclusive to the connection - */ - virtual bool isExclusive() const = 0; - - /** - * @retval true the server should delete the queue when it is no longer in use - * @retval false the server should not delete the queue when it is no longer in use - */ - virtual bool isAutoDelete() const = 0; -}; -CAF_DECLARE_SMART_INTERFACE_POINTER(Queue); - -}} - -#endif /* AMQPINTEGRATIONCORE_QUEUE_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/QueueImpl.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/QueueImpl.h deleted file mode 100644 index 3a3096c09..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/QueueImpl.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Created on: Jun 14, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AMQPINTEGRATIONCORE_QUEUEIMPL_H_ -#define AMQPINTEGRATIONCORE_QUEUEIMPL_H_ - -namespace Caf { namespace AmqpIntegration { - -/** - * @brief Implementation of the #Caf::AmqpIntegration::Queue interface. - */ -class AMQPINTEGRATIONCORE_LINKAGE QueueImpl : public Queue { -public: - QueueImpl(); - virtual ~QueueImpl(); - - /** - * @brief initialize the object - *

- * durable will be set to true; - * exclusive and autoDelete will be set to false. - * @param name queue name - */ - void init(const std::string& name); - - /** - * @brief initialize the object - *

- * exclusive and autoDelete will be set to false. - * @param name queue name - * @param durable true to make the queue durable else false - */ - void init( - const std::string& name, - const bool durable); - - /** - * @brief initialize the object - * @param name queue name - * @param durable true to make the queue durable else false - * @param exclusive true to make the queue exclusive else false - * @param autoDelete true to make the queue auto-delete else false - */ - void init( - const std::string& name, - const bool durable, - const bool exclusive, - const bool autoDelete); - - std::string getName() const; - - bool isDurable() const; - - bool isExclusive() const; - - bool isAutoDelete() const; - -private: - std::string _name; - bool _durable; - bool _exclusive; - bool _autoDelete; - CAF_CM_DECLARE_NOCOPY(QueueImpl); -}; -CAF_DECLARE_SMART_POINTER(QueueImpl); - -}} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/QueueInternal.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/QueueInternal.h deleted file mode 100644 index 14abc9649..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/QueueInternal.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Created on: Jun 14, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AMQPINTEGRATIONCORE_QUEUEINTERNAL_H_ -#define AMQPINTEGRATIONCORE_QUEUEINTERNAL_H_ - - -#include "ICafObject.h" - -#include "amqpCore/Queue.h" - -namespace Caf { namespace AmqpIntegration { - -/** - * @ingroup IntObjImpl - * @brief Interface allowing for internal management of queue integration objects - */ -struct __declspec(novtable) QueueInternal : public ICafObject { - CAF_DECL_UUID("E15F4DA8-C4DC-4813-82B9-1B15C69915D1") - - /** - * @brief Sets the delegated Queue object - * @param queue the delegated queue - */ - virtual void setQueueInternal(SmartPtrQueue queue) = 0; -}; -CAF_DECLARE_SMART_INTERFACE_POINTER(QueueInternal); - -}} -#endif diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/RabbitAdmin.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/RabbitAdmin.h deleted file mode 100644 index 72d78c905..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/RabbitAdmin.h +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Created on: Jun 12, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AMQPINTEGRATIONCORE_RABBITADMIN_H_ -#define AMQPINTEGRATIONCORE_RABBITADMIN_H_ - -#include "amqpClient/api/Channel.h" -#include "amqpCore/Binding.h" -#include "amqpClient/api/ConnectionFactory.h" -#include "amqpCore/Exchange.h" -#include "amqpCore/Queue.h" -#include "amqpCore/RabbitTemplate.h" -#include "amqpCore/AmqpAdmin.h" - -namespace Caf { namespace AmqpIntegration { - -/** - * @ingroup IntObjImpl - * @brief Implementation of the RabbitAdmin Integration Object - */ -class AMQPINTEGRATIONCORE_LINKAGE RabbitAdmin : public AmqpAdmin { -public: - RabbitAdmin(); - virtual ~RabbitAdmin(); - - void init(SmartPtrConnectionFactory connectionFactory); - - void term(); - -public: // AmqpAdmin - void declareExchange(SmartPtrExchange exchange); - - bool deleteExchange(const std::string& exchange); - - SmartPtrQueue declareQueue(); - - void declareQueue(SmartPtrQueue queue); - - bool deleteQueue(const std::string& queue); - - void deleteQueue( - const std::string& queue, - const bool unused, - const bool empty); - - void purgeQueue(const std::string& queue); - - void declareBinding(SmartPtrBinding binding); - - void removeBinding(SmartPtrBinding binding); - -private: // Executors - class DeclareExchangeExecutor : public AmqpTemplate::Executor { - public: - gpointer execute(AmqpClient::SmartPtrChannel channel, gpointer data); - }; - CAF_DECLARE_SMART_POINTER(DeclareExchangeExecutor); - - class DeleteExchangeExecutor : public AmqpTemplate::Executor { - gpointer execute(AmqpClient::SmartPtrChannel channel, gpointer data); - }; - CAF_DECLARE_SMART_POINTER(DeleteExchangeExecutor); - - class DeclareQueueExecutor : public AmqpTemplate::Executor { - gpointer execute(AmqpClient::SmartPtrChannel channel, gpointer data); - }; - CAF_DECLARE_SMART_POINTER(DeclareQueueExecutor); - - class DeleteQueueExecutor : public AmqpTemplate::Executor { - gpointer execute(AmqpClient::SmartPtrChannel channel, gpointer data); - }; - CAF_DECLARE_SMART_POINTER(DeleteQueueExecutor); - - class DeleteQueueExExecutor : public AmqpTemplate::Executor { - gpointer execute(AmqpClient::SmartPtrChannel channel, gpointer data); - }; - CAF_DECLARE_SMART_POINTER(DeleteQueueExExecutor); - - class PurgeQueueExecutor : public AmqpTemplate::Executor { - gpointer execute(AmqpClient::SmartPtrChannel channel, gpointer data); - }; - CAF_DECLARE_SMART_POINTER(PurgeQueueExecutor); - - class DeclareBindingExecutor : public AmqpTemplate::Executor { - gpointer execute(AmqpClient::SmartPtrChannel channel, gpointer data); - }; - CAF_DECLARE_SMART_POINTER(DeclareBindingExecutor); - - class RemoveBindingExecutor : public AmqpTemplate::Executor { - gpointer execute(AmqpClient::SmartPtrChannel channel, gpointer data); - }; - CAF_DECLARE_SMART_POINTER(RemoveBindingExecutor); - -private: - bool _isInitialized; - SmartPtrRabbitTemplate _rabbitTemplate; - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(RabbitAdmin); -}; - -CAF_DECLARE_SMART_POINTER(RabbitAdmin); - -}} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/RabbitTemplate.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/RabbitTemplate.h deleted file mode 100644 index ace26c6ac..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/RabbitTemplate.h +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Created on: Jun 5, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AMQPINTEGRATIONCORE_RABBITTEMPLATE_H_ -#define AMQPINTEGRATIONCORE_RABBITTEMPLATE_H_ - -#include "amqpClient/amqpImpl/BasicProperties.h" -#include "Exception/CCafException.h" -#include "Integration/IIntMessage.h" -#include "Memory/DynamicArray/DynamicArrayInc.h" -#include "amqpClient/api/Channel.h" -#include "amqpClient/api/Envelope.h" -#include "amqpCore/AmqpHeaderMapper.h" -#include "amqpCore/AmqpTemplate.h" -#include "amqpClient/api/Connection.h" -#include "amqpCore/ConnectionFactory.h" - -namespace Caf { namespace AmqpIntegration { - -/** - * @ingroup IntObjImpl - * @brief Implementation of the RabbitTemplate Integration Object - */ -class AMQPINTEGRATIONCORE_LINKAGE RabbitTemplate : public AmqpTemplate { -public: - RabbitTemplate(); - virtual ~RabbitTemplate(); - - void init(SmartPtrConnectionFactory connectionFactory); - - void term(); - - void setExchange(const std::string& exchange); - - void setRoutingKey(const std::string& routingKey); - - void setQueue(const std::string& queue); - - void setReplyTimeout(const uint32 replyTimeout); - - void setHeaderMapper(const SmartPtrAmqpHeaderMapper& headerMapper); - -public: // AmqpTemplate - void send( - SmartPtrIIntMessage message, - SmartPtrAmqpHeaderMapper headerMapper = SmartPtrAmqpHeaderMapper()); - - void send( - const std::string& routingKey, - SmartPtrIIntMessage message, - SmartPtrAmqpHeaderMapper headerMapper = SmartPtrAmqpHeaderMapper()); - - void send( - const std::string& exchange, - const std::string& routingKey, - SmartPtrIIntMessage message, - SmartPtrAmqpHeaderMapper headerMapper = SmartPtrAmqpHeaderMapper()); - - SmartPtrIIntMessage receive( - SmartPtrAmqpHeaderMapper headerMapper = SmartPtrAmqpHeaderMapper()); - - SmartPtrIIntMessage receive( - const std::string& queueName, - SmartPtrAmqpHeaderMapper headerMapper = SmartPtrAmqpHeaderMapper()); - - SmartPtrIIntMessage sendAndReceive( - SmartPtrIIntMessage message, - SmartPtrAmqpHeaderMapper requestHeaderMapper = SmartPtrAmqpHeaderMapper(), - SmartPtrAmqpHeaderMapper responseHeaderMapper = SmartPtrAmqpHeaderMapper()); - - SmartPtrIIntMessage sendAndReceive( - const std::string& routingKey, - SmartPtrIIntMessage message, - SmartPtrAmqpHeaderMapper requestHeaderMapper = SmartPtrAmqpHeaderMapper(), - SmartPtrAmqpHeaderMapper responseHeaderMapper = SmartPtrAmqpHeaderMapper()); - - SmartPtrIIntMessage sendAndReceive( - const std::string& exchange, - const std::string& routingKey, - SmartPtrIIntMessage message, - SmartPtrAmqpHeaderMapper requestHeaderMapper = SmartPtrAmqpHeaderMapper(), - SmartPtrAmqpHeaderMapper responseHeaderMapper = SmartPtrAmqpHeaderMapper()); - - gpointer execute(SmartPtrExecutor executor, gpointer data); - -private: - void doSend( - AmqpClient::SmartPtrChannel channel, - const std::string& exchange, - const std::string& routingKey, - SmartPtrIIntMessage message, - SmartPtrAmqpHeaderMapper headerMapper = SmartPtrAmqpHeaderMapper()); - - SmartPtrIIntMessage doSendAndReceive( - AmqpClient::SmartPtrChannel channel, - const std::string& exchange, - const std::string& routingKey, - SmartPtrIIntMessage message, - SmartPtrAmqpHeaderMapper requestHeaderMapper = SmartPtrAmqpHeaderMapper(), - SmartPtrAmqpHeaderMapper responseHeaderMapper = SmartPtrAmqpHeaderMapper()); - -private: - typedef TBlockingCell SynchronousHandoff; - CAF_DECLARE_SMART_POINTER(SynchronousHandoff); - - class DefaultConsumer : public AmqpClient::Consumer { - public: - DefaultConsumer(); - virtual ~DefaultConsumer(); - - void init( - SmartPtrAmqpHeaderMapper mapper, - SmartPtrSynchronousHandoff handoff); - - void handleConsumeOk( - const std::string& consumerTag); - - void handleCancelOk( - const std::string& consumerTag); - - void handleRecoverOk( - const std::string& consumerTag); - - void handleDelivery( - const std::string& consumerTag, - const AmqpClient::SmartPtrEnvelope& envelope, - const AmqpClient::AmqpContentHeaders::SmartPtrBasicProperties& properties, - const SmartPtrCDynamicByteArray& body); - - void handleShutdown( - const std::string& consumerTag, - SmartPtrCCafException& reason); - - private: - SmartPtrAmqpHeaderMapper _mapper; - SmartPtrSynchronousHandoff _handoff; - }; - CAF_DECLARE_SMART_POINTER(DefaultConsumer); - -private: - static std::string DEFAULT_EXCHANGE; - static std::string DEFAULT_ROUTING_KEY; - static int32 DEFAULT_REPLY_TIMEOUT; - -private: - bool _isInitialized; - std::string _exchange; - std::string _routingKey; - std::string _queue; - uint32 _replyTimeout; - SmartPtrConnectionFactory _connectionFactory; - SmartPtrConnection _connection; - SmartPtrAmqpHeaderMapper _headerMapper; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(RabbitTemplate); -}; -CAF_DECLARE_SMART_POINTER(RabbitTemplate); - -}} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/SimpleConnection.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/SimpleConnection.h deleted file mode 100644 index fa897a536..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/SimpleConnection.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Created on: May 25, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AMQPINTEGRATIONCORE_SIMPLECONNECTION_H_ -#define AMQPINTEGRATIONCORE_SIMPLECONNECTION_H_ - -#include "amqpClient/api/Channel.h" -#include "amqpClient/api/Connection.h" -#include "amqpCore/Connection.h" - -namespace Caf { namespace AmqpIntegration { - -/** - * @ingroup IntObjImpl - * @brief A simple object that wraps a AmqpClient::Connection and exposes - * it as an AmqpIntegration::Connection. - */ -class AMQPINTEGRATIONCORE_LINKAGE SimpleConnection : public Connection { -public: - SimpleConnection(); - virtual ~SimpleConnection(); - - /** - * @brief Initialize the object with the given AmqpClient::Connection - * @param delegate the wrapped AmqpClient::Connection - */ - void init(const AmqpClient::SmartPtrConnection& delegate); - -public: // Connection - AmqpClient::SmartPtrChannel createChannel(); - void close(); - bool isOpen(); - -private: - AmqpClient::SmartPtrConnection _delegate; - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(SimpleConnection); -}; -CAF_DECLARE_SMART_POINTER(SimpleConnection); - -}} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/SimpleMessageListenerContainer.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/SimpleMessageListenerContainer.h deleted file mode 100644 index ddf3d6c9a..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/include/amqpCore/SimpleMessageListenerContainer.h +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Created on: Aug 1, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef SIMPLEMESSAGELISTENERCONTAINER_H_ -#define SIMPLEMESSAGELISTENERCONTAINER_H_ - - - -#include "Integration/IErrorHandler.h" - -#include "Exception/CCafException.h" -#include "Integration/Core/CSimpleAsyncTaskExecutor.h" -#include "Integration/IIntMessage.h" -#include "Integration/IThrowable.h" -#include "amqpClient/api/Channel.h" -#include "amqpCore/BlockingQueueConsumer.h" -#include "amqpClient/api/ConnectionFactory.h" -#include "amqpCore/MessageListener.h" -#include "Integration/ILifecycle.h" -#include "Integration/IRunnable.h" - -namespace Caf { namespace AmqpIntegration { - -/** - * @ingroup IntObjImpl - * @brief A simple message listener used by channels to retrieve messages - *

- * This container manages message acknowledgment, broker connection recoverability and - * other aspects of consuming from queues. - */ -class AMQPINTEGRATIONCORE_LINKAGE SimpleMessageListenerContainer : - public ILifecycle { -public: - SimpleMessageListenerContainer(); - virtual ~SimpleMessageListenerContainer(); - - /** - * @brief initialize the object - */ - void init(); - - /** - * @brief initialize the object - * @param connectionFactory the ConnectionFactory - */ - void init( - SmartPtrConnectionFactory connectionFactory); - -public: - /** - * @brief Set the message acknowledgment mode - * @param acknowledgeMode acknowledgment mode - */ - void setAcknowledgeMode(AcknowledgeMode acknowledgeMode); - - void setPrefetchCount(const uint32 prefetchCount); - - void setReceiveTimeout(const uint32 receiveTimeout); - - void setRecoveryInterval(const uint32 recoveryInterval); - - void setTxSize(const uint32 txSize); - - void setQueue(const std::string& queue); - - void setConnectionFactory(SmartPtrConnectionFactory connectionFactory); - - void setMessagerListener(SmartPtrMessageListener messageListener); - - SmartPtrMessageListener getMessageListener(); - -public: // ILifecycle - void start(const uint32 timeoutMs); - - void stop(const uint32 timeoutMs); - - bool isRunning() const; - -private: - void validateConfig(); - - bool isActive(); - - bool receiveAndExecute(SmartPtrBlockingQueueConsumer consumer); - - void executeListener( - AmqpClient::SmartPtrChannel channel, - SmartPtrIIntMessage message); - - void doInvokeListener( - SmartPtrIIntMessage message); - - void restart(); - -private: - typedef TBlockingCell StartupExceptionHandoff; - CAF_DECLARE_SMART_POINTER(StartupExceptionHandoff); - -private: - class AsyncMessageProcessingConsumer : - public IRunnable, - public IErrorHandler { - public: - AsyncMessageProcessingConsumer(); - ~AsyncMessageProcessingConsumer(); - void init( - SimpleMessageListenerContainer *parent, - SmartPtrBlockingQueueConsumer consumer, - SmartPtrStartupExceptionHandoff startupException, - const uint32 timeout, - const uint32 recoveryInterval); - void run(); - void cancel(); - void handleError( - const SmartPtrIThrowable& throwable, - const SmartPtrIIntMessage& message) const; - - private: - void handleStartupFailure(); - - private: - SimpleMessageListenerContainer *_parent; - SmartPtrBlockingQueueConsumer _consumer; - SmartPtrStartupExceptionHandoff _startupException; - uint32 _timeout; - uint32 _recoveryInterval; - bool _isCanceled; - - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(AsyncMessageProcessingConsumer); - }; - CAF_DECLARE_SMART_POINTER(AsyncMessageProcessingConsumer); - -private: - bool _isInitialized; - volatile bool _isRunning; - volatile bool _isActive; - bool _debugTrace; - SmartPtrBlockingQueueConsumer _consumer; - SmartPtrCSimpleAsyncTaskExecutor _executor; - SmartPtrStartupExceptionHandoff _startupException; - - SmartPtrConnectionFactory _connectionFactory; - SmartPtrMessageListener _messageListener; - std::string _queue; - AcknowledgeMode _acknowledgeMode; - uint32 _receiveTimeout; - uint32 _prefetchCount; - uint32 _txSize; - uint32 _recoveryInterval; - - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(SimpleMessageListenerContainer); -}; -CAF_DECLARE_SMART_POINTER(SimpleMessageListenerContainer); - -}} - -#endif /* SIMPLEMESSAGELISTENERCONTAINER_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/AMQChannel.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/AMQChannel.cpp deleted file mode 100644 index 63d059357..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/AMQChannel.cpp +++ /dev/null @@ -1,1249 +0,0 @@ -/* - * Created on: May 2, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "amqpClient/CAmqpChannel.h" -#include "amqpClient/amqpImpl/BasicProperties.h" -#include "Memory/DynamicArray/DynamicArrayInc.h" -#include "amqpClient/AMQCommand.h" -#include "amqpClient/BlockingRpcContinuation.h" -#include "amqpClient/CAmqpFrame.h" -#include "amqpClient/ConsumerWorkService.h" -#include "amqpClient/IConnectionInt.h" -#include "amqpClient/IRpcContinuation.h" -#include "amqpClient/TCopyOnWriteContainer.h" -#include "amqpClient/amqpImpl/BasicAckMethod.h" -#include "amqpClient/amqpImpl/BasicCancelMethod.h" -#include "amqpClient/amqpImpl/BasicConsumeMethod.h" -#include "amqpClient/amqpImpl/BasicGetMethod.h" -#include "amqpClient/amqpImpl/BasicPublishMethod.h" -#include "amqpClient/amqpImpl/BasicQosMethod.h" -#include "amqpClient/amqpImpl/BasicRecoverMethod.h" -#include "amqpClient/amqpImpl/BasicRejectMethod.h" -#include "amqpClient/amqpImpl/ChannelCloseOkMethod.h" -#include "amqpClient/amqpImpl/EnvelopeImpl.h" -#include "amqpClient/amqpImpl/ExchangeDeclareMethod.h" -#include "amqpClient/amqpImpl/ExchangeDeleteMethod.h" -#include "amqpClient/amqpImpl/GetResponseImpl.h" -#include "amqpClient/amqpImpl/IContentHeader.h" -#include "amqpClient/amqpImpl/IMethod.h" -#include "amqpClient/amqpImpl/IServerMethod.h" -#include "amqpClient/amqpImpl/QueueBindMethod.h" -#include "amqpClient/amqpImpl/QueueDeclareMethod.h" -#include "amqpClient/amqpImpl/QueueDeleteMethod.h" -#include "amqpClient/amqpImpl/QueuePurgeMethod.h" -#include "amqpClient/amqpImpl/QueueUnbindMethod.h" -#include "amqpClient/api/AmqpMethods.h" -#include "amqpClient/api/Consumer.h" -#include "amqpClient/api/GetResponse.h" -#include "amqpClient/api/ReturnListener.h" -#include "amqpClient/api/amqpClient.h" -#include "amqpClient/AMQChannel.h" -#include "Exception/CCafException.h" -#include "Common/IAppConfig.h" -#include "AMQUtil.h" - -using namespace Caf::AmqpClient; - -const uint8 AMQChannel::DEBUGLOG_FLAG_ENTRYEXIT = 0x01; -const uint8 AMQChannel::DEBUGLOG_FLAG_AMQP = 0x02; - -#define AMQCHANNEL_ENTRY \ - if (_debugLogFlags & DEBUGLOG_FLAG_ENTRYEXIT) { CAF_CM_LOG_DEBUG_VA0("entry"); } - -#define AMQCHANNEL_EXIT \ - if (_debugLogFlags & DEBUGLOG_FLAG_ENTRYEXIT) { CAF_CM_LOG_DEBUG_VA0("exit"); } - -#if (1) // init -AMQChannel::AMQChannel() : - _isInitialized(false), - _isOpen(false), - _debugLogFlags(0), - _channelNumber(0), - CAF_CM_INIT_LOG("AMQChannel") { - CAF_CM_INIT_THREADSAFE; - _channelMutex.CreateInstance(); - _channelMutex->initialize(); -} - -AMQChannel::~AMQChannel() { - if (_channelHandle) { - AmqpChannel::AMQP_ChannelClose(_channelHandle); - } -} - -void AMQChannel::init( - const SmartPtrIConnectionInt& connection, - const SmartPtrConsumerWorkService& workService) { - CAF_CM_FUNCNAME("init"); - CAF_CM_LOCK_UNLOCK; - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(connection); - CAF_CM_VALIDATE_SMARTPTR(workService); - - uint32 debugFlags = 0; - if (getAppConfig()->getUint32( - "AMQChannel", - "debugLogFlags", - debugFlags, - IConfigParams::PARAM_OPTIONAL)) { - _debugLogFlags = debugFlags; - } - - AMQCHANNEL_ENTRY; - _connection = connection; - _workService = workService; - _channelSignal.initialize("channelSignal"); - _dispatcher.CreateInstance(); - _dispatcher->init(_workService); - - // Sequence is important here. Once amqpConnectionOpenChannel is called the - // channel.open method will be sent. Therefore we must have an _activeRpc - // registered to handle the channel.open-ok response BEFORE activating the - // _channelTask. - - // Create the _activeRpc to listen for channel-open.ok - SmartPtrBlockingRpcContinuation continuation; - continuation.CreateInstance(); - continuation->init(); - _activeRpc = continuation; - - // Open the channel - AMQUtil::checkAmqpStatus( - _connection->amqpConnectionOpenChannel(_channelHandle), - "_connection->amqpConnectionOpenChannel"); - AMQUtil::checkAmqpStatus( - AmqpChannel::AMQP_ChannelGetId(_channelHandle, &_channelNumber), - "AmqpChannel::AMQP_ChannelGetId"); - - // Set up AMQP frame processing - _command.CreateInstance(); - _command->init(); - SmartPtrChannelTask channelTask; - channelTask.CreateInstance(); - channelTask->init(this); - _workService->addWork(channelTask); - - // Wait for the channel-open.ok response - SmartPtrAMQCommand command; - { - CAF_CM_UNLOCK_LOCK; - command = continuation->getReply(); - } - CAF_CM_VALIDATE_SMARTPTR(command); - AmqpMethods::Channel::SmartPtrOpenOk openOk; - openOk.QueryInterface(command->getMethod(), false); - if (!openOk) { - CAF_CM_EXCEPTIONEX_VA1( - IllegalStateException, - 0, - "Expected to receive channel.open-ok but received " - "%s instead. This channel cannot be used.", - command->getMethod()->getProtocolMethodName().c_str()); - } - - if (_debugLogFlags & DEBUGLOG_FLAG_AMQP) { - CAF_CM_LOG_DEBUG_VA1("channel #%d is open", _channelNumber); - } - _isOpen = true; - _isInitialized = true; - AMQCHANNEL_EXIT; -} - -uint16 AMQChannel::getChannelNumber() { - CAF_CM_FUNCNAME_VALIDATE("getChannelNumber"); - CAF_CM_LOCK_UNLOCK; - AMQCHANNEL_ENTRY; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - ensureIsOpen(); - AMQCHANNEL_EXIT; - return _channelNumber; -} - -bool AMQChannel::isOpen() { - CAF_CM_LOCK_UNLOCK; - return _isOpen; -} - -void AMQChannel::close() { - CAF_CM_FUNCNAME_VALIDATE("close"); - AMQCHANNEL_ENTRY; - _connection->channelCloseChannel(this); - AMQCHANNEL_EXIT; -} - -void AMQChannel::notifyConnectionClosed(SmartPtrCCafException& exception) { - CAF_CM_FUNCNAME_VALIDATE("notifyConnectionClosed"); - AMQCHANNEL_ENTRY - close(exception); - AMQCHANNEL_EXIT; -} - -void AMQChannel::close(SmartPtrCCafException& exception) { - CAF_CM_FUNCNAME_VALIDATE("close"); - CAF_CM_LOCK_UNLOCK; - AMQCHANNEL_ENTRY - if (_debugLogFlags & DEBUGLOG_FLAG_AMQP) { - CAF_CM_LOG_DEBUG_VA1("Closing channel #%d", _channelNumber); - } - if (_isOpen) { - _isOpen = false; - _dispatcher->quiesce(); - - SmartPtrIRpcContinuation activeRpc; - { - CAF_CM_UNLOCK_LOCK; - activeRpc = nextOutstandingRpc(); - } - if (activeRpc) { - activeRpc->handleAbort(exception); - } - if (_dispatcher) { - _dispatcher->handleShutdown(exception); - } - AMQPStatus status = AmqpChannel::AMQP_ChannelClose(_channelHandle); - if (status != AMQP_ERROR_OK) { - CAF_CM_LOG_WARN_VA2( - "channel #%d closed with API code %d", - _channelNumber, - status); - } - } - AMQCHANNEL_EXIT; -} -#endif - -#if (1) // basic -void AMQChannel::basicAck( - const uint64 deliveryTag, - const bool ackMultiple) { - CAF_CM_FUNCNAME_VALIDATE("basicAck"); - AMQCHANNEL_ENTRY; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - SmartPtrBasicAckMethod method; - method.CreateInstance(); - method->init(deliveryTag, ackMultiple); - transmit(method); - AMQCHANNEL_EXIT; -} - -SmartPtrGetResponse AMQChannel::basicGet( - const std::string& queue, - const bool noAck) { - CAF_CM_FUNCNAME("basicGet"); - AMQCHANNEL_ENTRY; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - SmartPtrBasicGetMethod method; - method.CreateInstance(); - method->init(queue, noAck); - SmartPtrAMQCommand reply = execRpc(method); - SmartPtrIMethod replyMethod = reply->getMethod(); - - SmartPtrGetResponseImpl getResponse; - AmqpMethods::Basic::SmartPtrGetOk getOk; - getOk.QueryInterface(replyMethod, false); - if (getOk) { - AmqpContentHeaders::SmartPtrBasicProperties properties; - SmartPtrIContentHeader contentHeader = reply->getContentHeader(); - if (contentHeader) { - properties.QueryInterface(contentHeader, false); - if (!properties) { - CAF_CM_EXCEPTIONEX_VA1( - NoSuchInterfaceException, - 0, - "Expected a basic properties content header. Received '%s'. " - "Please report this bug.", - contentHeader->getClassName().c_str()); - } - } - - SmartPtrEnvelopeImpl envelope; - envelope.CreateInstance(); - envelope->init( - getOk->getDeliveryTag(), - getOk->getRedelivered(), - getOk->getExchange(), - getOk->getRoutingKey()); - getResponse.CreateInstance(); - getResponse->init( - envelope, - properties, - reply->getContentBody(), - getOk->getMessageCount()); - } else { - AmqpMethods::Basic::SmartPtrGetEmpty getEmpty; - getEmpty.QueryInterface(replyMethod, false); - if(!getEmpty) { - CAF_CM_EXCEPTIONEX_VA2( - NoSuchInterfaceException, - 0, - "Expected a basic.get-ok or basic.get-empty response. Received '%s'. " - "Please report this bug.", - method->getMethodName().c_str(), - replyMethod->getProtocolMethodName().c_str()); - } - } - AMQCHANNEL_EXIT; - return getResponse; -} - -void AMQChannel::basicPublish( - const std::string& exchange, - const std::string& routingKey, - const AmqpContentHeaders::SmartPtrBasicProperties& properties, - const SmartPtrCDynamicByteArray& body) { - basicPublish( - exchange, - routingKey, - false, - false, - properties, - body); -} - -void AMQChannel::basicPublish( - const std::string& exchange, - const std::string& routingKey, - const bool mandatory, - const bool immediate, - const AmqpContentHeaders::SmartPtrBasicProperties& properties, - const SmartPtrCDynamicByteArray& body) { - CAF_CM_FUNCNAME_VALIDATE("basicPublish"); - AMQCHANNEL_ENTRY; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - SmartPtrBasicPublishMethod method; - method.CreateInstance(); - method->init( - exchange, - routingKey, - mandatory, - immediate, - properties, - body); - transmit(method); - AMQCHANNEL_EXIT; -} - -AmqpMethods::Basic::SmartPtrConsumeOk AMQChannel::basicConsume( - const std::string& queue, - const SmartPtrConsumer& consumer) { - return basicConsume(queue, false, consumer); -} - -AmqpMethods::Basic::SmartPtrConsumeOk AMQChannel::basicConsume( - const std::string& queue, - const bool noAck, - const SmartPtrConsumer& consumer) { - return basicConsume(queue, "", noAck, false, false, consumer); -} - -AmqpMethods::Basic::SmartPtrConsumeOk AMQChannel::basicConsume( - const std::string& queue, - const std::string& consumerTag, - const bool noAck, - const bool noLocal, - const bool exclusive, - const SmartPtrConsumer& consumer, - const SmartPtrTable& arguments) { - CAF_CM_FUNCNAME("basicConsume"); - AMQCHANNEL_ENTRY; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - AmqpMethods::Basic::SmartPtrConsumeOk consumeOk; - // Put a lock on the dispatcher. - // DO NOT FORGET TO UNLOCK IT NO MATTER WHAT! - _dispatcher->lock(); - try { - SmartPtrBasicConsumeMethod method; - method.CreateInstance(); - method->init(queue, consumerTag, noLocal, noAck, exclusive, arguments); - SmartPtrAMQCommand reply = execRpc(method); - SmartPtrIMethod replyMethod = reply->getMethod(); - consumeOk.QueryInterface(replyMethod, false); - if (consumeOk) { - const std::string& consumerTagActual = consumeOk->getConsumerTag(); - _dispatcher->addConsumer(consumerTagActual, consumer); - _dispatcher->handleConsumeOk(consumerTagActual); - } else { - CAF_CM_EXCEPTIONEX_VA1( - NoSuchInterfaceException, - 0, - "Expected a basic.consume-ok response. Received '%s'. " - "Please report this bug.", - replyMethod->getProtocolMethodName().c_str()); - } - } - CAF_CM_CATCH_ALL; - _dispatcher->unlock(); - CAF_CM_THROWEXCEPTION; - AMQCHANNEL_EXIT; - return consumeOk; -} - -AmqpMethods::Basic::SmartPtrCancelOk AMQChannel::basicCancel( - const std::string& consumerTag) { - CAF_CM_FUNCNAME("basicCancel"); - AMQCHANNEL_ENTRY; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - AmqpMethods::Basic::SmartPtrCancelOk cancelOk; - SmartPtrConsumer originalConsumer = _dispatcher->getConsumer(consumerTag); - if (originalConsumer) { - SmartPtrBasicCancelMethod method; - method.CreateInstance(); - method->init(consumerTag); - SmartPtrAMQCommand reply = execRpc(method); - SmartPtrIMethod replyMethod = reply->getMethod(); - cancelOk.QueryInterface(replyMethod, false); - if (cancelOk) { - try { - _dispatcher->handleCancelOk(consumerTag); - } - CAF_CM_CATCH_ALL; - _dispatcher->removeConsumer(consumerTag); - CAF_CM_THROWEXCEPTION; - } else { - CAF_CM_EXCEPTIONEX_VA1( - NoSuchInterfaceException, - 0, - "Expected a basic.cancel-ok response. Received '%s'. " - "Please report this bug.", - replyMethod->getProtocolMethodName().c_str()); - } - } else { - CAF_CM_EXCEPTIONEX_VA1( - NoSuchElementException, - 0, - "No such consumer tag '%s'", - consumerTag.c_str()); - } - AMQCHANNEL_EXIT; - return cancelOk; -} - -AmqpMethods::Basic::SmartPtrRecoverOk AMQChannel::basicRecover( - const bool requeue) { - CAF_CM_FUNCNAME("basicRecover"); - AMQCHANNEL_ENTRY; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - AmqpMethods::Basic::SmartPtrRecoverOk recoverOk; - SmartPtrBasicRecoverMethod method; - method.CreateInstance(); - method->init(requeue); - SmartPtrAMQCommand reply = execRpc(method); - SmartPtrIMethod replyMethod = reply->getMethod(); - recoverOk.QueryInterface(replyMethod, false); - if (recoverOk) { - _dispatcher->handleRecoverOk(); - } else { - CAF_CM_EXCEPTIONEX_VA1( - NoSuchInterfaceException, - 0, - "Expected a basic.recover-ok response. Received '%s'. " - "Please report this bug.", - replyMethod->getProtocolMethodName().c_str()); - } - AMQCHANNEL_EXIT; - return recoverOk; -} - -AmqpMethods::Basic::SmartPtrQosOk AMQChannel::basicQos( - const uint32 prefetchSize, - const uint32 prefetchCount, - const bool global) { - CAF_CM_FUNCNAME("basicQos"); - AMQCHANNEL_ENTRY; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - SmartPtrBasicQosMethod method; - method.CreateInstance(); - method->init(prefetchSize, prefetchCount, global); - SmartPtrAMQCommand reply = execRpc(method); - AmqpMethods::Basic::SmartPtrQosOk qosOk; - SmartPtrIMethod replyMethod = reply->getMethod(); - qosOk.QueryInterface(replyMethod, false); - if (!qosOk) { - CAF_CM_EXCEPTIONEX_VA1( - NoSuchInterfaceException, - 0, - "Expected a basic.qos-ok response. Received '%s'. " - "Please report this bug.", - replyMethod->getProtocolMethodName().c_str()); - } - AMQCHANNEL_EXIT; - return qosOk; -} - -void AMQChannel::basicReject( - const uint64 deliveryTag, - const bool requeue) { - CAF_CM_FUNCNAME_VALIDATE("basicReject"); - AMQCHANNEL_ENTRY; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - SmartPtrBasicRejectMethod method; - method.CreateInstance(); - method->init(deliveryTag, requeue); - transmit(method); - AMQCHANNEL_EXIT; -} -#endif - -#if (1) // exchange -AmqpMethods::Exchange::SmartPtrDeclareOk AMQChannel::exchangeDeclare( - const std::string& exchange, - const std::string& type, - const bool durable, - const SmartPtrTable& arguments) { - CAF_CM_FUNCNAME("exchangeDeclare"); - AMQCHANNEL_ENTRY; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - SmartPtrExchangeDeclareMethod method; - method.CreateInstance(); - method->init(exchange, type, false, durable, arguments); - SmartPtrAMQCommand reply = execRpc(method); - AmqpMethods::Exchange::SmartPtrDeclareOk declareOk; - SmartPtrIMethod replyMethod = reply->getMethod(); - declareOk.QueryInterface(replyMethod, false); - if (!declareOk) { - CAF_CM_EXCEPTIONEX_VA1( - NoSuchInterfaceException, - 0, - "Expected a exchange.declare-ok response. Received '%s'. " - "Please report this bug.", - replyMethod->getProtocolMethodName().c_str()); - } - AMQCHANNEL_EXIT; - return declareOk; -} - -AmqpMethods::Exchange::SmartPtrDeleteOk AMQChannel::exchangeDelete( - const std::string& exchange, - const bool ifUnused) { - CAF_CM_FUNCNAME("exchangeDelete"); - AMQCHANNEL_ENTRY; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - SmartPtrExchangeDeleteMethod method; - method.CreateInstance(); - method->init(exchange, ifUnused); - SmartPtrAMQCommand reply = execRpc(method); - AmqpMethods::Exchange::SmartPtrDeleteOk deleteOk; - SmartPtrIMethod replyMethod = reply->getMethod(); - deleteOk.QueryInterface(replyMethod, false); - if (!deleteOk) { - CAF_CM_EXCEPTIONEX_VA1( - NoSuchInterfaceException, - 0, - "Expected a exchange.delete-ok response. Received '%s'. " - "Please report this bug.", - replyMethod->getProtocolMethodName().c_str()); - } - AMQCHANNEL_EXIT; - return deleteOk; -} - -#endif - -#if (1) // queue -AmqpMethods::Queue::SmartPtrDeclareOk AMQChannel::queueDeclare() { - return queueDeclare( - "", - false, - true, - true); -} - -AmqpMethods::Queue::SmartPtrDeclareOk AMQChannel::queueDeclare( - const std::string& queue, - const bool durable, - const bool exclusive, - const bool autoDelete, - const SmartPtrTable& arguments) { - CAF_CM_FUNCNAME("queueDeclare"); - AMQCHANNEL_ENTRY; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - SmartPtrQueueDeclareMethod method; - method.CreateInstance(); - method->init(queue, durable, exclusive, autoDelete, arguments); - SmartPtrAMQCommand reply = execRpc(method); - AmqpMethods::Queue::SmartPtrDeclareOk declareOk; - SmartPtrIMethod replyMethod = reply->getMethod(); - declareOk.QueryInterface(replyMethod, false); - if (!declareOk) { - CAF_CM_EXCEPTIONEX_VA1( - NoSuchInterfaceException, - 0, - "Expected a queue.declare-ok response. Received '%s'. " - "Please report this bug.", - replyMethod->getProtocolMethodName().c_str()); - } - AMQCHANNEL_EXIT; - return declareOk; -} - -AmqpMethods::Queue::SmartPtrDeclareOk AMQChannel::queueDeclarePassive( - const std::string& queue) { - CAF_CM_FUNCNAME("queueDeclarePassive"); - AMQCHANNEL_ENTRY; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - SmartPtrQueueDeclareMethod method; - method.CreateInstance(); - method->initPassive(queue); - SmartPtrAMQCommand reply = execRpc(method); - AmqpMethods::Queue::SmartPtrDeclareOk declareOk; - SmartPtrIMethod replyMethod = reply->getMethod(); - declareOk.QueryInterface(replyMethod, false); - if (!declareOk) { - CAF_CM_EXCEPTIONEX_VA1( - NoSuchInterfaceException, - 0, - "Expected a queue.declare-ok response. Received '%s'. " - "Please report this bug.", - replyMethod->getProtocolMethodName().c_str()); - } - AMQCHANNEL_EXIT; - return declareOk; -} - -AmqpMethods::Queue::SmartPtrDeleteOk AMQChannel::queueDelete( - const std::string& queue, - const bool ifUnused, - const bool ifEmpty) { - CAF_CM_FUNCNAME("queueDelete"); - AMQCHANNEL_ENTRY; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - SmartPtrQueueDeleteMethod method; - method.CreateInstance(); - method->init(queue, ifUnused, ifEmpty); - SmartPtrAMQCommand reply = execRpc(method); - AmqpMethods::Queue::SmartPtrDeleteOk deleteOk; - SmartPtrIMethod replyMethod = reply->getMethod(); - deleteOk.QueryInterface(replyMethod, false); - if (!deleteOk) { - CAF_CM_EXCEPTIONEX_VA1( - NoSuchInterfaceException, - 0, - "Expected a queue.delete-ok response. Received '%s'. " - "Please report this bug.", - replyMethod->getProtocolMethodName().c_str()); - } - AMQCHANNEL_EXIT; - return deleteOk; -} - -AmqpMethods::Queue::SmartPtrPurgeOk AMQChannel::queuePurge( - const std::string& queue) { - CAF_CM_FUNCNAME("queuePurge"); - AMQCHANNEL_ENTRY; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - SmartPtrQueuePurgeMethod method; - method.CreateInstance(); - method->init(queue); - SmartPtrAMQCommand reply = execRpc(method); - AmqpMethods::Queue::SmartPtrPurgeOk purgeOk; - SmartPtrIMethod replyMethod = reply->getMethod(); - purgeOk.QueryInterface(replyMethod, false); - if (!purgeOk) { - CAF_CM_EXCEPTIONEX_VA1( - NoSuchInterfaceException, - 0, - "Expected a queue.purge-ok response. Received '%s'. " - "Please report this bug.", - replyMethod->getProtocolMethodName().c_str()); - } - AMQCHANNEL_EXIT; - return purgeOk; -} - -AmqpMethods::Queue::SmartPtrBindOk AMQChannel::queueBind( - const std::string& queue, - const std::string& exchange, - const std::string& routingKey, - const SmartPtrTable& arguments) { - CAF_CM_FUNCNAME("queueBind"); - AMQCHANNEL_ENTRY; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - SmartPtrQueueBindMethod method; - method.CreateInstance(); - method->init(queue, exchange, routingKey, arguments); - SmartPtrAMQCommand reply = execRpc(method); - AmqpMethods::Queue::SmartPtrBindOk bindOk; - SmartPtrIMethod replyMethod = reply->getMethod(); - bindOk.QueryInterface(replyMethod, false); - if (!bindOk) { - CAF_CM_EXCEPTIONEX_VA1( - NoSuchInterfaceException, - 0, - "Expected a queue.bind-ok response. Received '%s'. " - "Please report this bug.", - replyMethod->getProtocolMethodName().c_str()); - } - AMQCHANNEL_EXIT; - return bindOk; -} - -AmqpMethods::Queue::SmartPtrUnbindOk AMQChannel::queueUnbind( - const std::string& queue, - const std::string& exchange, - const std::string& routingKey, - const SmartPtrTable& arguments) { - CAF_CM_FUNCNAME("queueUnbind"); - AMQCHANNEL_ENTRY; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - SmartPtrQueueUnbindMethod method; - method.CreateInstance(); - method->init(queue, exchange, routingKey, arguments); - SmartPtrAMQCommand reply = execRpc(method); - AmqpMethods::Queue::SmartPtrUnbindOk unbindOk; - SmartPtrIMethod replyMethod = reply->getMethod(); - unbindOk.QueryInterface(replyMethod, false); - if (!unbindOk) { - CAF_CM_EXCEPTIONEX_VA1( - NoSuchInterfaceException, - 0, - "Expected a queue.unbind-ok response. Received '%s'. " - "Please report this bug.", - replyMethod->getProtocolMethodName().c_str()); - } - AMQCHANNEL_EXIT; - return unbindOk; -} -#endif -#if (1) // ReturnListener -void AMQChannel::addReturnListener( - const SmartPtrReturnListener& listener) { - CAF_CM_FUNCNAME_VALIDATE("addReturnListener"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_LOCK_UNLOCK; - _returnListeners.add(listener); -} - -bool AMQChannel::removeReturnListener( - const SmartPtrReturnListener& listener) { - CAF_CM_FUNCNAME_VALIDATE("removeReturnListener"); - CAF_CM_LOCK_UNLOCK; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _returnListeners.remove(listener); -} -#endif - -#if (1) // processing -/* - * Worker thread execution callback. - * Check for an incoming frame and if one exists, process it. - * This method is also called during init() and it waiting for the - * channel.open-ok. While establishing the connection we may get timeout errors - * because the broker is down. In that case retry the connection for the allotted - * time before giving up. - */ -bool AMQChannel::taskHandler() { - CAF_CM_FUNCNAME("taskHandler"); - CAF_CM_LOCK_UNLOCK; - - try { - uint32 frameCount = 0; - AMQPStatus status = AMQP_ERROR_OK; - SmartPtrCAmqpFrame frame; - while (_channelHandle && (frameCount < 1000)) { - SmartPtrCAmqpChannel channelHandle = _channelHandle; - { - CAF_CM_UNLOCK_LOCK; - status = AmqpChannel::AMQP_ChannelReceive(channelHandle, frame, 0); - } - if (frame) { - ++frameCount; - try { - SmartPtrAMQCommand command = _command; - if (command->handleFrame(frame)) { - _command.CreateInstance(); - _command->init(); - handleCompleteInboundCommand(command); - } - } - CAF_CM_CATCH_ALL; - if (CAF_CM_ISEXCEPTION) { - CAF_CM_LOG_CRIT_VA1("channel #%d", _channelNumber); - CAF_CM_LOG_CRIT_CAFEXCEPTION; - - // Throw away the current command - _command.CreateInstance(); - _command->init(); - - // Abort any outstanding rpc - SmartPtrIRpcContinuation rpc; - { - CAF_CM_UNLOCK_LOCK; - rpc = nextOutstandingRpc(); - } - if (rpc) { - SmartPtrCCafException exception = CAF_CM_GETEXCEPTION; - rpc->handleAbort(exception); - } - CAF_CM_CLEAREXCEPTION; - } - } else if ((status == AMQP_ERROR_TIMEOUT) || (status == AMQP_ERROR_IO_INTERRUPTED)) { - break; - } else { - AMQUtil::checkAmqpStatus(status, "AmqpChannel::AMQP_ChannelReceive"); - } - } - } - CAF_CM_CATCH_ALL; - if (CAF_CM_ISEXCEPTION) { - CAF_CM_LOG_CRIT_VA1("channel #%d", _channelNumber); - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_CLEAREXCEPTION; - } - - // If we get here and the _channelHandle is NULL then - // the channel is closed. If so, return 'true'. - // - // If the _channelHandle is still good, return 'false' and let - // this task run again. - return (_channelHandle == NULL); -} - -/* - * A complete inbound AMQP command is available for processing. - */ -void AMQChannel::handleCompleteInboundCommand(const SmartPtrAMQCommand& command) { - CAF_CM_FUNCNAME("handleCompleteInboundCommand"); - // No LOCK_UNLOCK because there aren't any members to protect and because - // this routine makes a blocking call. - AMQCHANNEL_ENTRY; - // Check with asyn processing first - if (!processAsync(command)) { - // Command was not handled so must be part of an outstanding - // RPC call. Get the outstanding RPC call and have it process - // it. - // - // The outstanding RPC call may have been aborted because we are - // closing. That is the only time the RPC object should be null - // when in this method - SmartPtrIRpcContinuation rpc = nextOutstandingRpc(); - if (rpc) { - rpc->handleCommand(command); - } else if (isOpen()) { - CAF_CM_EXCEPTIONEX_VA3( - NullPointerException, - 0, - "[command=%s, class_id: 0x%08x, method_id: 0x%08x] nextOutstandingRpc() returned NULL and the channel is open. " - "This should never happen. Please report this bug.", - command->getMethod()->getProtocolMethodName().c_str(), - command->getMethod()->getProtocolClassId(), - command->getMethod()->getProtocolMethodId()); - } - } - AMQCHANNEL_EXIT; -} - -/* - * First line of incomming command processing. This method handles - * non-RPC commands such as channel.close, basic.deliver, basic.recover, etc. - */ -bool AMQChannel::processAsync(const SmartPtrAMQCommand& command) { - CAF_CM_FUNCNAME("processAsync"); - CAF_CM_LOCK_UNLOCK; - AMQCHANNEL_ENTRY; - bool commandHandled = false; - const amqp_method_number_t amqpMethodId = - (command->getMethod()->getProtocolClassId() << 16) | - command->getMethod()->getProtocolMethodId(); - - if (_debugLogFlags & DEBUGLOG_FLAG_AMQP) { - CAF_CM_LOG_DEBUG_VA4( - "Method [channel=%d][class id=0x%04X][method id=0x%04X][name=%s]", - _channelNumber, - command->getMethod()->getProtocolClassId(), - command->getMethod()->getProtocolMethodId(), - command->getMethod()->getProtocolMethodName().c_str()); - } - - if (amqpMethodId == AMQP_CHANNEL_OPEN_OK_METHOD) { - // no-op. let it pass through - } - else if (amqpMethodId == AMQP_CHANNEL_CLOSE_METHOD) { - // first order of business - stop the dispatcher from handling incoming messages - _dispatcher->quiesce(); - - AmqpMethods::Channel::SmartPtrClose chClose; - chClose.QueryInterface(command->getMethod(), false); - if (chClose) { - if (_debugLogFlags & DEBUGLOG_FLAG_AMQP) { - CAF_CM_LOG_INFO_VA5( - "channel.close %s [channel=%d][code=0x%04X][class id=0x%04X][method id=0x%04X]", - chClose->getReplyText().c_str(), - _channelNumber, - chClose->getReplyCode(), - chClose->getClassId(), - chClose->getMethodId()); - } - } else { - // Okay - very weird but we need to keep on going... - CAF_CM_LOG_CRIT_VA0( - "Received AMQP_CHANNEL_CLOSE_METHOD but method object " - "is not a AmqpMethods::Channel::Close instance. Please report " - "this bug."); - } - { - CAF_CM_UNLOCK_LOCK; - channelCloseByServerShutdown(chClose); - } - commandHandled = true; - } else if (amqpMethodId == AMQP_CHANNEL_CLOSE_OK_METHOD) { - _channelHandle = AMQP_HANDLE_INVALID; - commandHandled = true; - } else if (isOpen()) { - try { - SmartPtrIMethod method = command->getMethod(); - SmartPtrIContentHeader contentHeader = command->getContentHeader(); - switch (amqpMethodId) { - case AMQP_BASIC_DELIVER_METHOD: - { - commandHandled = true; - AmqpMethods::Basic::SmartPtrDeliver deliverMethod; - deliverMethod.QueryInterface(method, false); - if (deliverMethod) { - SmartPtrEnvelopeImpl envelope; - envelope.CreateInstance(); - envelope->init( - deliverMethod->getDeliveryTag(), - deliverMethod->getRedelivered(), - deliverMethod->getExchange(), - deliverMethod->getRoutingKey()); - - AmqpContentHeaders::SmartPtrBasicProperties properties; - if (contentHeader) { - properties.QueryInterface(contentHeader, false); - if (!properties) { - CAF_CM_EXCEPTIONEX_VA1( - NoSuchInterfaceException, - 0, - "Expected a basic properties content header. Received '%s'. " - "Please report this bug.", - contentHeader->getClassName().c_str()); - } - } - _dispatcher->handleDelivery( - deliverMethod->getConsumerTag(), - envelope, - properties, - command->getContentBody()); - } else { - CAF_CM_EXCEPTIONEX_VA0( - IllegalStateException, - 0, - "Received AMQP_BASIC_DELIVER_METHOD but the method object " - "is not a AmqpClient::AmqpMethods::Basic::Deliver instance. " - "Please report this bug."); - } - } - break; - - case AMQP_BASIC_RETURN_METHOD: - callReturnListeners(command); - commandHandled = true; - break; - } - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_CRIT_CAFEXCEPTION; - if (CAF_CM_ISEXCEPTION) { - // discard the command - commandHandled = true; - } - CAF_CM_CLEAREXCEPTION; - } else { - // We are shutting down so the inbound command should be - // discarded per spec. 'Consume' it by returning true. - if (_debugLogFlags & DEBUGLOG_FLAG_AMQP) { - CAF_CM_LOG_INFO_VA0("isOpen() is false. Discarding command."); - } - commandHandled = true; - } - AMQCHANNEL_EXIT; - return commandHandled; -} - -/* - * Checks the _isOpen flag and throws an exception if the - * channel is closed. - */ -void AMQChannel::ensureIsOpen() { - CAF_CM_FUNCNAME("ensureIsOpen"); - CAF_CM_LOCK_UNLOCK; - AMQCHANNEL_ENTRY; - if (!isOpen()) { - CAF_CM_EXCEPTIONEX_VA0( - AmqpExceptions::ChannelClosedException, - 0, - "Attempt to use closed channel"); - } - AMQCHANNEL_EXIT; -} - -/* - * Execute a synchronous call such as basic.get, queue.declare, exchange.delete, - * etc. The AMQP synchronous calls are all executed through this mechanism. - */ -SmartPtrAMQCommand AMQChannel::execRpc(const SmartPtrIServerMethod& method) { - CAF_CM_FUNCNAME("execRpc"); - AMQCHANNEL_ENTRY; - SmartPtrBlockingRpcContinuation rpc; - try { - CAF_CM_LOCK_UNLOCK1(_channelMutex); - CAF_CM_LOCK_UNLOCK; - - ensureIsOpen(); - - const std::string methodName = method->getMethodName(); - rpc.CreateInstance(); - rpc->init(); - - // Wait for the current rpc to finish - while (_activeRpc) { - { - CAF_CM_UNLOCK_LOCK; - _channelSignal.waitOrTimeout(_channelMutex, 0); - } - } - - // indicate the new active RPC call - _activeRpc = rpc; - - if (_debugLogFlags & DEBUGLOG_FLAG_AMQP) { - CAF_CM_LOG_DEBUG_VA2( - "[channel=%d] Sending AMQP method %s", - _channelNumber, - method->getMethodName().c_str()); - } - - // send the call to the server - AMQUtil::checkAmqpStatus( - method->send(_channelHandle), - methodName.c_str()); - } - CAF_CM_CATCH_ALL; - CAF_CM_THROWEXCEPTION; - - // Check the reply. If null there should be - // a reason (exception) explaining why the call failed. - // This getReply() doesn't need to be in a UNLOCK_LOCK because the LOCK_UNLOCK - // was scoped by the try. - SmartPtrAMQCommand reply = rpc->getReply(); - CAF_CM_LOG_DEBUG_VA1("RPC reply - %s", (reply.IsNull() ? "NULL" : reply->getMethod()->getProtocolMethodName().c_str())); - AMQCHANNEL_EXIT; - if (!reply) { - SmartPtrCCafException exception = rpc->getException(); - if (exception) { - exception->throwAddRefedSelf(); - } else { - CAF_CM_EXCEPTIONEX_VA0( - IllegalStateException, - 0, - "AMQP reply was not returned and no exception (reason) was provided."); - } - } - return reply; -} - -/* - * Retrieve the outstanding RPC call. This method interacts with the execRpc() - * method indirectly through the _channelMutex and _channelSignal. - * The execRpc() call blocks until the current RPC call is handled by the thread - * running the taskHandler (which eventually calls handleCompleteInboundCommand()) - * which calls this. - * - * When handleCompleteInboundCommand() gets the outstanding RPC to handle the command, - * the _activeRpc member is cleared and _channelSignal is signaled thus freeing - * the execRpc() call to execute its RPC. - */ -SmartPtrIRpcContinuation AMQChannel::nextOutstandingRpc() { - CAF_CM_FUNCNAME_VALIDATE("nextOutstandingRpc"); - - CAF_CM_LOCK_UNLOCK1(_channelMutex); - CAF_CM_LOCK_UNLOCK; - - SmartPtrIRpcContinuation result = _activeRpc; - _activeRpc = NULL; - _channelSignal.signal(); - AMQCHANNEL_EXIT; - return result; -} - -/* - * Transmit an AMQP method to the server - */ -void AMQChannel::transmit(const SmartPtrIServerMethod& method) { - CAF_CM_FUNCNAME_VALIDATE("transmit"); - CAF_CM_LOCK_UNLOCK; - AMQCHANNEL_ENTRY; - CAF_CM_VALIDATE_SMARTPTR(method); - if (_debugLogFlags & DEBUGLOG_FLAG_AMQP) { - CAF_CM_LOG_DEBUG_VA2( - "[channel=%d] Sending AMQP method %s", - _channelNumber, - method->getMethodName().c_str()); - } - AMQUtil::checkAmqpStatus(method->send(_channelHandle)); - AMQCHANNEL_EXIT; -} - -/* - * This method is called when we have received a channel.close method - * from the server. Respond with a channel.close-ok method then - * abort the outstanding RPC (if any) with the exception (reason) for the abort. - */ -void AMQChannel::channelCloseByServerShutdown( - const AmqpMethods::Channel::SmartPtrClose& closeMethod) { - CAF_CM_FUNCNAME("channelCloseByServerShutdown"); - AMQCHANNEL_ENTRY; - try { - CAF_CM_LOCK_UNLOCK1(_channelMutex); - CAF_CM_LOCK_UNLOCK; - - _isOpen = false; - _dispatcher->quiesce(); - - // Send channel.close-ok - SmartPtrChannelCloseOkMethod method; - method.CreateInstance(); - method->init(); - transmit(method); - - // Create the reason for the shutdown. - AmqpExceptions::SmartPtrChannelClosedByServerException exception; - try { - exception.CreateInstance(); - - // We *should* have received a Channel::Close method BUT you can - // never be too careful... - if (closeMethod) { - exception->populateVA( - closeMethod->getReplyCode(), - _cm_className_, - _cm_funcName_, - "channel.close %s [channel=%d][code=0x%04X][class id=0x%04X][method id=0x%04X]", - closeMethod->getReplyText().c_str(), - _channelNumber, - closeMethod->getReplyCode(), - closeMethod->getClassId(), - closeMethod->getMethodId()); - } else { - exception->populate( - "channel.close - no other information available", - 0, - _cm_className_, - _cm_funcName_); - } - - // Abort the outstanding rpc if any - if (_activeRpc) { - SmartPtrIRpcContinuation rpc = _activeRpc; - _activeRpc = NULL; - rpc->handleAbort(exception); - } - - // Notify the dispatcher - _dispatcher->handleShutdown(exception); - } - CAF_CM_CATCH_ALL; - - // Tear down - AmqpChannel::AMQP_ChannelClose(_channelHandle); - _channelHandle = AMQP_HANDLE_INVALID; - - // Remove this channel from management - _connection->notifyChannelClosedByServer(_channelNumber); - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_CLEAREXCEPTION; - AMQCHANNEL_EXIT; -} - -void AMQChannel::callReturnListeners(const SmartPtrAMQCommand& command) { - CAF_CM_FUNCNAME("callReturnListeners"); - CAF_CM_LOCK_UNLOCK; - try { - AmqpMethods::Basic::SmartPtrReturn basicReturn; - basicReturn.QueryInterface(command->getMethod(), false); - if (basicReturn) { - CowReturnListenerCollection::SmartPtrContainer listeners = - _returnListeners.getAll(); - AmqpContentHeaders::SmartPtrBasicProperties properties; - properties.QueryInterface(command->getContentHeader(), false); - if (properties) { - for (TSmartIterator listener(*listeners); - listener; - listener++) { - listener->handleReturn( - basicReturn->getReplyCode(), - basicReturn->getReplyText(), - basicReturn->getExchange(), - basicReturn->getRoutingKey(), - properties, - command->getContentBody()); - } - } else { - CAF_CM_EXCEPTIONEX_VA1( - NoSuchInterfaceException, - 0, - "Expected content header to be a basic.properties object. Instead it is " - "a '%s' object. Please report this bug.", - command->getContentHeader()->getClassName().c_str()); - } - } else { - CAF_CM_EXCEPTIONEX_VA1( - NoSuchInterfaceException, - 0, - "Expected command to be a basic.return command. Instead it is a " - "'%s' command. Please report this bug.", - command->getMethod()->getProtocolMethodName().c_str()); - } - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_CLEAREXCEPTION; -} - -#endif - -#if (1) // ChannelTask -AMQChannel::ChannelTask::ChannelTask() : - CAF_CM_INIT("AMQChannel::ChannelTask") { -} - -AMQChannel::ChannelTask::~ChannelTask() { -} - -void AMQChannel::ChannelTask::init(SmartPtrAMQChannel channel) { - CAF_CM_FUNCNAME_VALIDATE("init"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_channel); - CAF_CM_VALIDATE_PTR(channel); - _channel = channel; -} - -bool AMQChannel::ChannelTask::run() { - CAF_CM_FUNCNAME_VALIDATE("run"); - CAF_CM_PRECOND_ISINITIALIZED(_channel); - return _channel->taskHandler(); -} -#endif diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/AMQChannelManager.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/AMQChannelManager.cpp deleted file mode 100644 index adf9e71eb..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/AMQChannelManager.cpp +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Created on: May 7, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "amqpClient/AMQChannel.h" -#include "amqpClient/ConsumerWorkService.h" -#include "amqpClient/api/Channel.h" -#include "amqpClient/AMQChannelManager.h" -#include "Exception/CCafException.h" - -using namespace Caf::AmqpClient; - -AMQChannelManager::AMQChannelManager() : - _isInitialized(false), - CAF_CM_INIT_LOG("AMQChannelManager") { - CAF_CM_INIT_THREADSAFE; -} - -AMQChannelManager::~AMQChannelManager() { -} - -void AMQChannelManager::init(const SmartPtrConsumerWorkService& workService) { - CAF_CM_FUNCNAME_VALIDATE("init"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_PTR(workService); - _workService = workService; - _isInitialized = true; -} - -SmartPtrChannel AMQChannelManager::createChannel(const SmartPtrIConnectionInt& connection) { - CAF_CM_FUNCNAME("createChannel"); - CAF_CM_LOCK_UNLOCK; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(connection); - SmartPtrAMQChannel channel; - - channel.CreateInstance(); - - SmartPtrConsumerWorkService workService = _workService; - { - CAF_CM_UNLOCK_LOCK; - channel->init(connection, workService); - } - - const uint16 channelNumber = channel->getChannelNumber(); - if (_channelMap.insert(ChannelMap::value_type(channelNumber, channel)).second) { - - } else { - CAF_CM_EXCEPTIONEX_VA1( - DuplicateElementException, - 0, - "Channel number %d is already in use. This should never happen. " - "Please report this as a bug.", - channelNumber); - } - return channel; -} - -SmartPtrChannel AMQChannelManager::getChannel(const uint16 channelNumber) { - CAF_CM_FUNCNAME("getChannel"); - CAF_CM_LOCK_UNLOCK; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - SmartPtrChannel channel; - ChannelMap::const_iterator channelIter = _channelMap.find(channelNumber); - if (channelIter != _channelMap.end()) { - channel = (*channelIter).second; - } else { - CAF_CM_EXCEPTIONEX_VA1( - NoSuchElementException, - 0, - "Channel #%d does not exist.", - channelNumber); - } - return channel; -} - -size_t AMQChannelManager::getOpenChannelCount() { - CAF_CM_FUNCNAME_VALIDATE("getOpenChannelCount"); - CAF_CM_LOCK_UNLOCK; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _channelMap.size(); -} - -void AMQChannelManager::notifyConnectionClose(SmartPtrCCafException& shutdownException) { - CAF_CM_FUNCNAME("notifyConnectionClose"); - CAF_CM_LOCK_UNLOCK; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - try { - _workService->notifyConnectionClosed(); - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_CLEAREXCEPTION; - - for (TSmartMapIterator channel(_channelMap); channel; channel++) { - try { - CAF_CM_UNLOCK_LOCK; - channel->notifyConnectionClosed(shutdownException); - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_CLEAREXCEPTION; - } - _channelMap.clear(); -} - -void AMQChannelManager::closeChannel(const uint16 channelNumber, SmartPtrCCafException& reason) { - CAF_CM_FUNCNAME("closeChannel"); - CAF_CM_LOCK_UNLOCK; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - ChannelMap::iterator channel = _channelMap.find(channelNumber); - if (channel != _channelMap.end()) { - { - CAF_CM_UNLOCK_LOCK; - channel->second->close(reason); - } - _channelMap.erase(channel); - } else { - CAF_CM_EXCEPTIONEX_VA1( - NoSuchElementException, - 0, - "Channel #%d is not in the channel manager", - channelNumber); - } -} - -void AMQChannelManager::removeChannel(const uint16 channelNumber) { - CAF_CM_FUNCNAME("removeChannel"); - CAF_CM_LOCK_UNLOCK; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - ChannelMap::iterator channel = _channelMap.find(channelNumber); - if (channel != _channelMap.end()) { - _channelMap.erase(channel); - } else { - CAF_CM_EXCEPTIONEX_VA1( - NoSuchElementException, - 0, - "Channel #%d is not in the channel manager", - channelNumber); - } -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/AMQCommand.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/AMQCommand.cpp deleted file mode 100644 index 79c3358f3..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/AMQCommand.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Created on: May 9, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Memory/DynamicArray/DynamicArrayInc.h" -#include "amqpClient/CAmqpFrame.h" -#include "amqpClient/amqpImpl/IContentHeader.h" -#include "amqpClient/amqpImpl/IMethod.h" -#include "amqpClient/AMQCommand.h" - -using namespace Caf::AmqpClient; - -AMQCommand::AMQCommand() : - CAF_CM_INIT("AMQCommand") { -} - -AMQCommand::~AMQCommand() { -} - -void AMQCommand::init() { - CAF_CM_FUNCNAME_VALIDATE("init"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_assembler); - _assembler.CreateInstance(); - _assembler->init(); -} - -bool AMQCommand::handleFrame(const SmartPtrCAmqpFrame& frame) { - CAF_CM_FUNCNAME_VALIDATE("handleFrame"); - CAF_CM_PRECOND_ISINITIALIZED(_assembler); - return _assembler->handleFrame(frame); -} - -SmartPtrCDynamicByteArray AMQCommand::getContentBody() { - CAF_CM_FUNCNAME_VALIDATE("getContentBody"); - CAF_CM_PRECOND_ISINITIALIZED(_assembler); - return _assembler->getContentBody(); -} - -SmartPtrIContentHeader AMQCommand::getContentHeader() { - CAF_CM_FUNCNAME_VALIDATE("getContentHeader"); - CAF_CM_PRECOND_ISINITIALIZED(_assembler); - return _assembler->getContentHeader(); -} - -SmartPtrIMethod AMQCommand::getMethod() { - CAF_CM_FUNCNAME_VALIDATE("getMethod"); - CAF_CM_PRECOND_ISINITIALIZED(_assembler); - return _assembler->getMethod(); -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/AMQConnection.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/AMQConnection.cpp deleted file mode 100644 index 0be9d60cb..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/AMQConnection.cpp +++ /dev/null @@ -1,492 +0,0 @@ -/* - * Created on: May 2, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "amqpClient/CAmqpChannel.h" -#include "amqpClient/AMQChannelManager.h" -#include "amqpClient/CAmqpConnection.h" -#include "amqpClient/ConnectionWeakReference.h" -#include "amqpClient/api/Address.h" -#include "amqpClient/api/CertInfo.h" -#include "amqpClient/api/Channel.h" -#include "amqpClient/AMQConnection.h" -#include "Exception/CCafException.h" -#include "AMQUtil.h" - -using namespace Caf::AmqpClient; - -AMQConnection::AMQConnection() : - _isInitialized(false), - _isRunning(false), - _shouldShutdown(false), - _wasCloseCalled(false), - _thread(NULL), - _connectionTimeout(0), - _requestedFrameMax(0), - _requestedChannelMax(0), - _requestedHeartbeat(0), - _retries(0), - _secondsToWait(0), - CAF_CM_INIT_LOG("AMQConnection") { - CAF_CM_FUNCNAME("AMQPConnection()"); - CAF_CM_INIT_THREADSAFE; - try { - CAF_THREADSIGNAL_INIT; - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_CLEAREXCEPTION; -} - -AMQConnection::~AMQConnection() { - CAF_CM_FUNCNAME_VALIDATE("~AMQConnection()"); - if (_weakReferenceSelf) { - _weakReferenceSelf->clearReference(); - _weakReferenceSelf = NULL; - } - - if (_connectionHandle && !_wasCloseCalled) { - CAF_CM_LOG_CRIT_VA0( - "close() has not been called on this connection. " - "You *** MUST *** call close() on a connection before releasing it."); - } - - if (_connectionHandle) { - AmqpConnection::AMQP_ConnectionClose(_connectionHandle); - } -} - -void AMQConnection::init( - const std::string username, - const std::string password, - const SmartPtrAddress& address, - const SmartPtrCertInfo& certInfo, - const uint32 requestedFrameMax, - const uint32 requestedChannelMax, - const uint32 requestedHeartbeat, - const uint32 connectionTimeout, - const uint32 consumerThreadCount, - const uint16 retries, - const uint16 secondsToWait) { - CAF_CM_FUNCNAME_VALIDATE("init"); - CAF_CM_LOCK_UNLOCK; - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(username); - // password is optional (e.g. AMQP Tunnel) - CAF_CM_VALIDATE_SMARTPTR(address); - // other parameters do not require validation - - CAF_CM_LOG_DEBUG_VA1( - "Creating AuthPlain credential for user %s", - username.c_str()); - AMQPStatus status = AmqpAuthPlain::AMQP_AuthPlainCreateClient( - _authMechanism, - username, - password); - AMQUtil::checkAmqpStatus(status, "AmqpAuthPlain::AMQP_AuthPlainCreateClient"); - - _address = address; - _certInfo = certInfo; - _requestedFrameMax = requestedFrameMax; - _requestedChannelMax = requestedChannelMax; - _requestedHeartbeat = requestedHeartbeat; - _retries = retries; - _secondsToWait = secondsToWait; - - initConnection(); - _connectionTimeout = connectionTimeout; - _connectionSignal.initialize("connectionSignal"); - _weakReferenceSelf.CreateInstance(); - _weakReferenceSelf->setReference(this); - - _threadPool.CreateInstance(); - _threadPool->init(address->toString(), consumerThreadCount, 100); - - _workService.CreateInstance(); - _workService->init(_threadPool); - _isInitialized = true; -} - -void AMQConnection::start() { - CAF_CM_FUNCNAME("start"); - CAF_CM_LOCK_UNLOCK; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_BOOL(!_isRunning); - - bool rc = false; - GThread* thread = _thread; - uint32 connectionTimeout = _connectionTimeout; - { - CAF_CM_UNLOCK_LOCK; - CAF_THREADSIGNAL_LOCK_UNLOCK; - thread = CThreadUtils::startJoinable(threadFunc, this); - rc = _connectionSignal.waitOrTimeout(CAF_THREADSIGNAL_MUTEX, connectionTimeout); - } - _thread = thread; - - if (rc) { - try { - uint16 channelMax = 0; - AMQUtil::checkAmqpStatus( - AmqpConnection::AMQP_ConnectionGetMaxChannels(_connectionHandle, &channelMax), - "AmqpConnection::AMQP_ConnectionGetMaxChannels"); - uint32 frameMax = 0; - AMQUtil::checkAmqpStatus( - AmqpConnection::AMQP_ConnectionGetMaxFrameSize(_connectionHandle, &frameMax), - "AmqpConnection::AMQP_ConnectionGetMaxFrameSize"); - uint16 heartbeat = 0; - AMQUtil::checkAmqpStatus( - AmqpConnection::AMQP_ConnectionGetHeartbeatInterval(_connectionHandle, &heartbeat), - "AMQUtil::checkAmqpStatus"); - CAF_CM_LOG_DEBUG_VA3( - "Tuned connection [chMax=%d][frameMax=%d][hbeat=%d]", - channelMax, - frameMax, - heartbeat); - _channelManager.CreateInstance(); - _channelManager->init(_workService); - } - CAF_CM_CATCH_ALL - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_THROWEXCEPTION; - } else { - CAF_CM_LOG_DEBUG_VA1("Need to shutdown due to start issue: %d", rc); - _shouldShutdown = true; - - SmartPtrCCafException threadException; - GThread* thread = _thread; - { - CAF_CM_UNLOCK_LOCK; - threadException = - static_cast(g_thread_join(thread)); - } - - _thread = NULL; - - if (threadException) { - threadException->throwAddRefedSelf(); - } else { - CAF_CM_EXCEPTIONEX_VA1( - AmqpExceptions::AmqpTimeoutException, - 0, - "Timed out trying to connect to %s", - _address->toString().c_str()); - } - } -} - -SmartPtrChannel AMQConnection::createChannel() { - CAF_CM_FUNCNAME_VALIDATE("createChannel"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - bool isRunning; - SmartPtrAMQChannelManager channelManager; - SmartPtrConnectionWeakReference weakReferenceSelf; - { - CAF_CM_LOCK_UNLOCK; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - isRunning = _isRunning; - channelManager = _channelManager; - weakReferenceSelf = _weakReferenceSelf; - } - - return createChannel(isRunning, channelManager, weakReferenceSelf); -} - -void AMQConnection::closeChannel(const SmartPtrChannel& channel) { - CAF_CM_FUNCNAME_VALIDATE("closeChannel"); - CAF_CM_VALIDATE_SMARTPTR(channel); - - bool isRunning; - SmartPtrAMQChannelManager channelManager; - { - CAF_CM_LOCK_UNLOCK; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - isRunning = _isRunning; - channelManager = _channelManager; - } - - closeChannel(isRunning, channelManager, channel); -} - -void AMQConnection::close() { - CAF_CM_FUNCNAME_VALIDATE("close"); - CAF_CM_LOCK_UNLOCK; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - _wasCloseCalled = true; - if (_isRunning) { - CAF_CM_LOG_DEBUG_VA0("Need to shutdown becaue the connection is closing"); - _shouldShutdown = true; - _weakReferenceSelf->clearReference(); - _weakReferenceSelf = NULL; - - _workService->notifyConnectionClosed(); - - if (NULL != _thread) { - GThread* thread = _thread; - { - CAF_CM_UNLOCK_LOCK; - g_thread_join(thread); - } - - _thread = NULL; - } - - { - CAF_CM_UNLOCK_LOCK; - while (_channelManager->getOpenChannelCount()) { - CThreadUtils::sleep(100); - } - } - } -} - -bool AMQConnection::isOpen() { - CAF_CM_FUNCNAME_VALIDATE("isOpen"); - CAF_CM_LOCK_UNLOCK; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return (_isRunning && !_shouldShutdown); -} - -AMQPStatus AMQConnection::amqpConnectionOpenChannel(SmartPtrCAmqpChannel& channel) { - CAF_CM_FUNCNAME_VALIDATE("amqpConnectionOpenChannel"); - CAF_CM_LOCK_UNLOCK; - CAF_CM_LOG_DEBUG_VA0("calling AmqpConnection::AMQP_ConnectionOpenChannel"); - AMQPStatus status = AmqpConnection::AMQP_ConnectionOpenChannel(_connectionHandle, channel); - if (status == AMQP_ERROR_OK) { - uint16 id = 0; - AmqpChannel::AMQP_ChannelGetId(channel, &id); - CAF_CM_LOG_DEBUG_VA1("created channel #%d", id); - } else { - CAF_CM_LOG_DEBUG_VA1("failed to create channel. status=%d", status); - } - return status; -} - -void AMQConnection::notifyChannelClosedByServer(const uint16 channelNumber) { - CAF_CM_LOCK_UNLOCK; - _channelManager->removeChannel(channelNumber); -} - -void AMQConnection::channelCloseChannel(Channel *channel) { - CAF_CM_FUNCNAME_VALIDATE("channelCloseChannel"); - CAF_CM_VALIDATE_PTR(channel); - closeChannel(channel); -} - -void AMQConnection::initConnection() { - CAF_CM_FUNCNAME_VALIDATE("initConnection"); - CAF_CM_LOCK_UNLOCK; - CAF_CM_LOG_DEBUG_VA3( - "Creating connection " - "[reqChMax=%d][reqFrameMax=%d][reqHB=%d]", - _requestedChannelMax, - _requestedFrameMax, - _requestedHeartbeat); - AMQPStatus status = AmqpConnection::AMQP_ConnectionCreate( - _connectionHandle, - _address, - _authMechanism, - _certInfo, - _requestedChannelMax, - _requestedFrameMax, - _requestedHeartbeat, - _retries, - _secondsToWait); - AMQUtil::checkAmqpStatus(status, "AmqpConnection::AMQP_ConnectionCreate"); -} - -void AMQConnection::closeChannel( - const bool isRunning, - const SmartPtrAMQChannelManager channelManager, - const SmartPtrChannel& channel) { - CAF_CM_STATIC_FUNC("AMQConnection", "closeChannel"); - CAF_CM_VALIDATE_SMARTPTR(channelManager); - CAF_CM_VALIDATE_SMARTPTR(channel); - - if (isRunning) { - if (channel->isOpen()) { - const uint16 channelNumber = channel->getChannelNumber(); - SmartPtrCCafException reason; - try { - AmqpExceptions::SmartPtrChannelClosedByUserException exception; - exception.CreateInstance(); - reason = exception.GetNonAddRefedInterface(); - reason->populate( - "Closed by user", - 0, - _cm_className_, - _cm_funcName_); - - channelManager->closeChannel(channelNumber, reason); - } - CAF_CM_CATCH_ALL; - } - } else { - CAF_CM_EXCEPTIONEX_VA0( - IllegalStateException, - 0, - "The connection is closed"); - } -} - -SmartPtrChannel AMQConnection::createChannel( - const bool isRunning, - const SmartPtrAMQChannelManager& channelManager, - const SmartPtrConnectionWeakReference& weakReferenceSelf) { - CAF_CM_STATIC_FUNC("AMQConnection", "createChannel"); - - if (!isRunning) { - CAF_CM_EXCEPTIONEX_VA0( - AmqpExceptions::ConnectionClosedException, - 0, - "The connection is closed"); - } - - return channelManager->createChannel(weakReferenceSelf); -} - -void* AMQConnection::threadFunc(void* context) { - CAF_CM_STATIC_FUNC("AMQConnection", "threadFunc"); - try { - CAF_CM_VALIDATE_PTR(context); - SmartPtrAMQConnection self = (AMQConnection*)context; - self->threadWorker(); - } - CAF_CM_CATCH_ALL; - - return CAF_CM_GETEXCEPTION; -} - -void AMQConnection::threadWorker() { - CAF_CM_FUNCNAME("threadWorker"); - CAF_CM_LOCK_UNLOCK; - - try { - CAF_CM_LOG_DEBUG_VA1( - "Connecting to %s", - _address->toString().c_str()); - - AMQPStatus status = AMQP_ERROR_OK; - SmartPtrCAmqpConnection connectionHandle = _connectionHandle; - { - CAF_CM_UNLOCK_LOCK; - status = AmqpConnection::AMQP_ConnectionConnect( - connectionHandle, - AMQP_CONNECTION_FLAG_CLOSE_SOCKET); - } - AMQUtil::checkAmqpStatus(status, "AmqpConnection::AMQP_ConnectionConnect"); - - AMQPConnectionState state; - status = AmqpConnection::AMQP_ConnectionGetState( - _connectionHandle, - &state); - AMQUtil::checkAmqpStatus(status, "AmqpConnection::AMQP_ConnectionGetState"); - - while (!_shouldShutdown && (AMQP_STATE_CONNECTED != state)) { - status = AmqpConnection::AMQP_ConnectionProcessIO(_connectionHandle); - switch (status) { - case AMQP_ERROR_OK: - break; - - case AMQP_ERROR_IO_ERROR: - { - const char *err = NULL; - AmqpConnection::AMQP_ConnectionGetLastError(_connectionHandle, &err); - CAF_CM_LOG_WARN_VA2( - "Connection to [%s] failed: %s", - _address->toString().c_str(), - err); - _connectionHandle = AMQP_HANDLE_INVALID; - CThreadUtils::sleep(250); - initConnection(); - AMQPStatus status = AmqpConnection::AMQP_ConnectionConnect( - _connectionHandle, - AMQP_CONNECTION_FLAG_CLOSE_SOCKET); - AMQUtil::checkAmqpStatus(status, "AmqpConnection::AMQP_ConnectionConnect"); - } - break; - - default: - { - const char *err = NULL; - AmqpConnection::AMQP_ConnectionGetLastError(_connectionHandle, &err); - AMQUtil::checkAmqpStatus(status, err); - } - break; - } - - status = AmqpConnection::AMQP_ConnectionGetState( - _connectionHandle, - &state); - AMQUtil::checkAmqpStatus( - status, - "AmqpConnection::AMQP_ConnectionGetState"); - } - - if (!_shouldShutdown && (AMQP_STATE_CONNECTED == state)) { - { - CAF_THREADSIGNAL_LOCK_UNLOCK; - _isRunning = true; - _connectionSignal.signal(); - } - - while (!_shouldShutdown && AMQP_STATE_CONNECTED == state) { - SmartPtrCAmqpConnection connectionHandle = _connectionHandle; - { - CAF_CM_UNLOCK_LOCK; - status = AmqpConnection::AMQP_ConnectionWaitForIO(connectionHandle, 200); - status = AmqpConnection::AMQP_ConnectionProcessIO(connectionHandle); - status = AmqpConnection::AMQP_ConnectionGetState(connectionHandle, &state); - } - } - - _isRunning = false; - CAF_CM_LOG_DEBUG_VA2( - "IO loop has stopped. " - "[_shouldShutdown=%d][state=%d]", - _shouldShutdown, - state); - - SmartPtrCCafException shutdownException; - try { - if (_shouldShutdown) { - AmqpExceptions::SmartPtrChannelClosedByShutdownException exception; - exception.CreateInstance(); - shutdownException = exception.GetNonAddRefedInterface(); - shutdownException->populate( - "Normal application shutdown", - 0, - _cm_className_, - _cm_funcName_); - } else { - const char* error = NULL; - AmqpConnection::AMQP_ConnectionGetLastError(_connectionHandle, &error); - AmqpExceptions::SmartPtrConnectionClosedByIOException exception; - exception.CreateInstance(); - shutdownException = exception.GetNonAddRefedInterface(); - shutdownException->populate( - error, - 0, - _cm_className_, - _cm_funcName_); - } - { - CAF_CM_UNLOCK_LOCK; - _channelManager->notifyConnectionClose(shutdownException); - } - AmqpConnection::AMQP_ConnectionClose(_connectionHandle); - _connectionHandle = AMQP_HANDLE_INVALID; - } - CAF_CM_CATCH_ALL; - } - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_THROWEXCEPTION; -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/AMQUtil.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/AMQUtil.cpp deleted file mode 100644 index 417699cef..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/AMQUtil.cpp +++ /dev/null @@ -1,304 +0,0 @@ -/* - * Created on: May 3, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "amqpClient/amqpImpl/FieldImpl.h" -#include "amqpClient/api/amqpClient.h" -#include "Exception/CCafException.h" -#include "AMQUtil.h" - -using namespace Caf::AmqpClient; -using namespace Caf::AmqpClient::AmqpExceptions; - -void AMQUtil::checkAmqpStatus( - const AMQPStatus status, - const char* message) { - CAF_CM_STATIC_FUNC("AMQUtil", "checkAmqpStatus"); - - const char* exMsg = message ? message : ""; - - switch (status) { - case AMQP_ERROR_OK: - break; - case AMQP_ERROR_TIMEOUT: - CAF_CM_EXCEPTIONEX_VA0(AmqpTimeoutException, 0, exMsg); - break; - case AMQP_ERROR_NO_MEMORY: - CAF_CM_EXCEPTIONEX_VA0(AmqpNoMemoryException, 0, exMsg); - break; - case AMQP_ERROR_INVALID_HANDLE: - CAF_CM_EXCEPTIONEX_VA0(AmqpInvalidHandleException, 0, exMsg); - break; - case AMQP_ERROR_INVALID_ARGUMENT: - CAF_CM_EXCEPTIONEX_VA0(AmqpInvalidArgumentException, 0, exMsg); - break; - case AMQP_ERROR_WRONG_STATE: - CAF_CM_EXCEPTIONEX_VA0(AmqpWrongStateException, 0, exMsg); - break; - case AMQP_ERROR_TOO_MANY_CHANNELS: - CAF_CM_EXCEPTIONEX_VA0(AmqpTooManyChannelsException, 0, exMsg); - break; - case AMQP_ERROR_QUEUE_FULL: - CAF_CM_EXCEPTIONEX_VA0(AmqpQueueFullException, 0, exMsg); - break; - case AMQP_ERROR_FRAME_TOO_LARGE: - CAF_CM_EXCEPTIONEX_VA0(AmqpFrameTooLargeException, 0, exMsg); - break; - case AMQP_ERROR_IO_ERROR: - CAF_CM_EXCEPTIONEX_VA0(AmqpIoErrorException, 0, exMsg); - break; - case AMQP_ERROR_PROTOCOL_ERROR: - CAF_CM_EXCEPTIONEX_VA0(AmqpProtocolErrorException, 0, exMsg); - break; - case AMQP_ERROR_UNIMPLEMENTED: - CAF_CM_EXCEPTIONEX_VA0(AmqpUnimplementedException, 0, exMsg); - break; - case AMQP_ERROR_IO_INTERRUPTED: - CAF_CM_EXCEPTIONEX_VA0(AmqpIoInterruptedException, 0, exMsg); - break; - default: - CAF_CM_EXCEPTIONEX_VA0(AmqpException, status, exMsg); - break; - } -} - -std::string AMQUtil::amqpBytesToString(const amqp_bytes_t * const amqpBytes) { - CAF_CM_STATIC_FUNC_VALIDATE("AMQUtil", "amqpBytesToString"); - CAF_CM_VALIDATE_PTR(amqpBytes); - - CDynamicCharArray buf; - buf.allocateBytes(amqpBytes->len); - buf.memCpy(amqpBytes->bytes, amqpBytes->len); - return buf.getPtr(); -} - -SmartPtrTable AMQUtil::amqpApiTableToTableObj(const amqp_table_t * const amqpTable) { - CAF_CM_STATIC_FUNC_LOG("AMQUtil", "amqpApiTableToTableObj"); - CAF_CM_VALIDATE_PTR(amqpTable); - SmartPtrTable table; - table.CreateInstance(); - for (int32 idx = 0; idx < amqpTable->num_entries; ++idx) { - amqp_table_entry_t *entry = &amqpTable->entries[idx]; - CAF_CM_VALIDATE_PTR(entry); - std::string key = amqpBytesToString(&entry->key); - SmartPtrFieldImpl field; - field.CreateInstance(); - switch (entry->value.kind) { - case AMQP_FIELD_KIND_BOOLEAN: - field->setTypeAndValue( - Field::AMQP_FIELD_TYPE_BOOLEAN, - g_variant_new_boolean(entry->value.value.boolean)); - break; - case AMQP_FIELD_KIND_I8: - field->setTypeAndValue( - Field::AMQP_FIELD_TYPE_I8, - g_variant_new_byte(entry->value.value.i8)); - break; - case AMQP_FIELD_KIND_U8: - field->setTypeAndValue( - Field::AMQP_FIELD_TYPE_U8, - g_variant_new_byte(entry->value.value.i8)); - break; - case AMQP_FIELD_KIND_I16: - field->setTypeAndValue( - Field::AMQP_FIELD_TYPE_I16, - g_variant_new_int16(entry->value.value.i16)); - break; - case AMQP_FIELD_KIND_U16: - field->setTypeAndValue( - Field::AMQP_FIELD_TYPE_U16, - g_variant_new_uint16(entry->value.value.u16)); - break; - case AMQP_FIELD_KIND_I32: - field->setTypeAndValue( - Field::AMQP_FIELD_TYPE_I32, - g_variant_new_int32(entry->value.value.i32)); - break; - case AMQP_FIELD_KIND_U32: - field->setTypeAndValue( - Field::AMQP_FIELD_TYPE_U32, - g_variant_new_uint32(entry->value.value.u32)); - break; - case AMQP_FIELD_KIND_I64: - field->setTypeAndValue( - Field::AMQP_FIELD_TYPE_I64, - g_variant_new_int64(entry->value.value.i64)); - break; - case AMQP_FIELD_KIND_U64: - field->setTypeAndValue( - Field::AMQP_FIELD_TYPE_U64, - g_variant_new_uint64(entry->value.value.u64)); - break; - case AMQP_FIELD_KIND_F32: - field->setTypeAndValue( - Field::AMQP_FIELD_TYPE_F32, - g_variant_new_double(entry->value.value.f32)); - break; - case AMQP_FIELD_KIND_F64: - field->setTypeAndValue( - Field::AMQP_FIELD_TYPE_F32, - g_variant_new_double(entry->value.value.f64)); - break; - case AMQP_FIELD_KIND_UTF8: - { - const std::string value = amqpBytesToString(&entry->value.value.bytes); - field->setTypeAndValue( - Field::AMQP_FIELD_TYPE_UTF8, - g_variant_new_string(value.c_str())); - } - break; - case AMQP_FIELD_KIND_TIMESTAMP: - field->setTypeAndValue( - Field::AMQP_FIELD_TYPE_TIMESTAMP, - g_variant_new_uint64(entry->value.value.u64)); - break; - - // Type not currently supported - case AMQP_FIELD_KIND_ARRAY: - case AMQP_FIELD_KIND_BYTES: - case AMQP_FIELD_KIND_DECIMAL: - case AMQP_FIELD_KIND_TABLE: - case AMQP_FIELD_KIND_VOID: - field = NULL; - CAF_CM_LOG_ERROR_VA2( - "AMQP field %s type %d is not supported", - key.c_str(), - entry->value.kind); - break; - default: - field = NULL; - CAF_CM_LOG_ERROR_VA2( - "AMQP field %s type %d is unknown", - key.c_str(), - entry->value.kind); - break; - } - - if (field) { - if (!table->insert(std::make_pair(key, field)).second) { - CAF_CM_EXCEPTIONEX_VA1( - DuplicateElementException, - 0, - "Duplicate field '%s' detected", - key.c_str()); - } - } - } - return table; -} - -void AMQUtil::amqpTableObjToApiTable(const SmartPtrTable& table, amqp_table_t& apiTable) { - CAF_CM_STATIC_FUNC_LOG("AMQUtil", "amqpTableObjToApiTable"); - CAF_CM_VALIDATE_SMARTPTR(table); - - memset(&apiTable, 0, sizeof(apiTable)); - apiTable.num_entries = static_cast(table->size()); - apiTable.entries = - reinterpret_cast(AmqpCommon::AMQP_Calloc( - apiTable.num_entries, - sizeof(*apiTable.entries))); - CAF_CM_VALIDATE_PTR(apiTable.entries); - try { - int32 idx = 0; - for (TSmartConstMapIterator tableEntry(*table); - tableEntry; - tableEntry++, idx++) { - amqp_table_entry_t *apiEntry = &apiTable.entries[idx]; - apiEntry->key = amqp_cstring_bytes(tableEntry.getKey().c_str()); - const SmartPtrField& field = *tableEntry; - GVariant *variant = field->getValue(); - - switch (field->getAmqpType()) { - case Field::AMQP_FIELD_TYPE_NOTSET: - CAF_CM_EXCEPTIONEX_VA1( - IllegalStateException, - 0, - "Table entry '%s' has a value type of AMQP_FIELD_TYPE_NOTSET", - tableEntry.getKey().c_str()); - break; - case Field::AMQP_FIELD_TYPE_BOOLEAN: - apiEntry->value.kind = AMQP_FIELD_KIND_BOOLEAN; - apiEntry->value.value.boolean = g_variant_get_boolean(variant); - break; - case Field::AMQP_FIELD_TYPE_I8: - apiEntry->value.kind = AMQP_FIELD_KIND_I8; - apiEntry->value.value.i8 = g_variant_get_byte(variant); - break; - case Field::AMQP_FIELD_TYPE_U8: - apiEntry->value.kind = AMQP_FIELD_KIND_U8; - apiEntry->value.value.u8 = g_variant_get_byte(variant); - break; - case Field::AMQP_FIELD_TYPE_I16: - apiEntry->value.kind = AMQP_FIELD_KIND_I16; - apiEntry->value.value.i16 = g_variant_get_int16(variant); - break; - case Field::AMQP_FIELD_TYPE_U16: - apiEntry->value.kind = AMQP_FIELD_KIND_U16; - apiEntry->value.value.u16 = g_variant_get_uint16(variant); - break; - case Field::AMQP_FIELD_TYPE_I32: - apiEntry->value.kind = AMQP_FIELD_KIND_I32; - apiEntry->value.value.i32 = g_variant_get_int32(variant); - break; - case Field::AMQP_FIELD_TYPE_U32: - apiEntry->value.kind = AMQP_FIELD_KIND_U32; - apiEntry->value.value.u32 = g_variant_get_uint32(variant); - break; - case Field::AMQP_FIELD_TYPE_I64: - apiEntry->value.kind = AMQP_FIELD_KIND_I64; - apiEntry->value.value.i64 = g_variant_get_int64(variant); - break; - case Field::AMQP_FIELD_TYPE_U64: - apiEntry->value.kind = AMQP_FIELD_KIND_U64; - apiEntry->value.value.u64 = g_variant_get_uint64(variant); - break; - case Field::AMQP_FIELD_TYPE_F32: - apiEntry->value.kind = AMQP_FIELD_KIND_F32; - apiEntry->value.value.f32 = static_cast(g_variant_get_double(variant)); - break; - case Field::AMQP_FIELD_TYPE_F64: - apiEntry->value.kind = AMQP_FIELD_KIND_F64; - apiEntry->value.value.f64 = g_variant_get_double(variant); - break; - case Field::AMQP_FIELD_TYPE_UTF8: - apiEntry->value.kind = AMQP_FIELD_KIND_UTF8; - apiEntry->value.value.bytes = - amqp_cstring_bytes(g_variant_get_string(variant, NULL)); - break; - case Field::AMQP_FIELD_TYPE_TIMESTAMP: - apiEntry->value.kind = AMQP_FIELD_KIND_TIMESTAMP; - apiEntry->value.value.u64 = g_variant_get_uint64(variant); - break; - case Field::AMQP_FIELD_TYPE_ARRAY: - case Field::AMQP_FIELD_TYPE_BYTES: - case Field::AMQP_FIELD_TYPE_DECIMAL: - case Field::AMQP_FIELD_TYPE_TABLE: - case Field::AMQP_FIELD_TYPE_VOID: - default: - CAF_CM_LOG_ERROR_VA2( - "AMQP field %s type %d is not supported", - tableEntry.getKey().c_str(), - field->getAmqpType()); - break; - } - } - } - CAF_CM_CATCH_ALL; - if (CAF_CM_ISEXCEPTION) { - amqpFreeApiTable(&apiTable); - memset(&apiTable, 0, sizeof(apiTable)); - } - CAF_CM_THROWEXCEPTION; -} - -void AMQUtil::amqpFreeApiTable(amqp_table_t *table) { - if (table) { - AmqpCommon::AMQP_Free(table->entries); - memset(table, 0, sizeof(*table)); - } -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/AMQUtil.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/AMQUtil.h deleted file mode 100644 index d211bb70e..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/AMQUtil.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Created on: May 3, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AMQUTIL_H_ -#define AMQUTIL_H_ - - -#include "amqpClient/api/amqpClient.h" - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApiImpl - * @remark LIBRARY IMPLEMENTATION - NOT PART OF THE PUBLIC API - * @brief A collection of helpers for dealing with AMQP and the underlying amqp library. - */ -namespace AMQUtil { - /** - * @brief Check an AMQPStatus and throw an exception if the status is not AMQP_ERROR_OK - * @param status AMQPStatus returned from amqp library calls - * @param message Optional message text to add to thrown exception - */ - void checkAmqpStatus( - const AMQPStatus status, - const char* message = NULL); - - /** - * @brief Convert an amqp_bytes_t array to a std::string - * @param amqpBytes Raw string bytes - * @return conversion to string - */ - std::string amqpBytesToString(const amqp_bytes_t * const amqpBytes); - - /** - * @brief Convert an amqp_table_t to a smart Table object - * @param amqpTable Raw table bytes - * @return convertion to a smart Table object - */ - SmartPtrTable amqpApiTableToTableObj(const amqp_table_t * const amqpTable); - - /** - * @brief Convert a smart Table object to an amqp_table_t struct - * The caller is responsible for cleaning up the table by calling amqpFreeApiTable() - * @param table smart Table object source - * @param apiTable amqp_table_t output struct - */ - void amqpTableObjToApiTable(const SmartPtrTable& table, amqp_table_t& apiTable); - - /** - * @brief Clean up the memory used by a amqp_table_t - * @param table table to free - */ - void amqpFreeApiTable(amqp_table_t *table); -} - -}} - -#endif /* AMQUTIL_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/Address.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/Address.cpp deleted file mode 100644 index 6875a207f..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/Address.cpp +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Created on: May 2, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "amqpClient/api/Address.h" -#include "Exception/CCafException.h" - -using namespace Caf::AmqpClient; - -Address::Address() : - _isInitialized(false), - _protocol(PROTOCOL_AMQP), - _port(UINT_MAX), - CAF_CM_INIT_LOG("Address") {} - -Address::~Address() {} - -void Address::initialize( - const std::string& protocol, - const std::string& host, - const uint32& port, - const std::string& virtualHost) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(protocol); - CAF_CM_VALIDATE_STRING(host); - - _protocol = translateProtocol(protocol, host); - - _protocolStr = protocol; - _host = host; - _port = port; - _virtualHost = virtualHost; - - std::stringstream builder; - builder << _protocolStr << ":" - << "host=" << _host << "," - << "port=" << _port << "," - << "virtualhost=" << _virtualHost; - _toString = builder.str(); - - _isInitialized = true; -} - -/** - * @return the protocol - */ -Protocol Address::getProtocol() const { - CAF_CM_FUNCNAME_VALIDATE("getProtocol"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _protocol; -} - -/** - * @return the protocol - */ -std::string Address::getProtocolStr() const { - CAF_CM_FUNCNAME_VALIDATE("getProtocol"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _protocolStr; -} - -/** - * @return the host name - */ -std::string Address::getHost() const { - CAF_CM_FUNCNAME_VALIDATE("getHost"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _host; -} - -/** - * @return the port number - */ -uint32 Address::getPort() const { - CAF_CM_FUNCNAME_VALIDATE("getPort"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _port; -} - -std::string Address::getVirtualHost() const { - CAF_CM_FUNCNAME_VALIDATE("getVirtualHost"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _virtualHost; -} - -std::string Address::toString() const { - CAF_CM_FUNCNAME_VALIDATE("toString"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _toString; -} - -Protocol Address::translateProtocol( - const std::string& protocol, - const std::string& host) const { - CAF_CM_FUNCNAME("translateProtocol"); - CAF_CM_VALIDATE_STRING(protocol); - CAF_CM_VALIDATE_STRING(host); - - Protocol rc = PROTOCOL_AMQP; - if (protocol.compare("amqp") == 0) { - rc = PROTOCOL_AMQP; - CAF_CM_LOG_DEBUG_VA1( - "Parsed amqp protocol - host: %s", host.c_str()); - } else if (protocol.compare("amqps") == 0) { - rc = PROTOCOL_AMQPS; - CAF_CM_EXCEPTION_VA0(E_FAIL, - "amqps protocol not yet supported"); - } else if (protocol.compare("tunnel") == 0) { - if ((host.compare("localhost") == 0) || (host.compare("127.0.0.1") == 0)) { - rc = PROTOCOL_TUNNEL; - CAF_CM_LOG_DEBUG_VA1( - "Parsed tunnel protocol - host: %s", host.c_str()); - } else { - CAF_CM_EXCEPTION_VA1(E_FAIL, - "Tunnel protocol only supports localhost - %s", host.c_str()); - } - } else { - CAF_CM_EXCEPTION_VA1(E_FAIL, - "Unknown protocol - %s", protocol.c_str()); - } - - return rc; -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/AmqpAuthPlain.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/AmqpAuthPlain.cpp deleted file mode 100644 index e2341a198..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/AmqpAuthPlain.cpp +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Created on: May 2, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "amqpClient/CAmqpAuthMechanism.h" -#include "AmqpAuthPlain.h" -#include "AmqpUtil.h" - -using namespace Caf::AmqpClient; - -AMQPStatus AmqpAuthPlain::AMQP_AuthPlainCreateClient( - SmartPtrCAmqpAuthMechanism& mech, - const std::string& username, - const std::string& password) { - CAF_CM_STATIC_FUNC_VALIDATE("AmqpAuthPlain", "AMQP_AuthPlainCreateClient"); - CAF_CM_VALIDATE_STRING(username); - // password is optional - - mech.CreateInstance(); - return mech->createClient(username, password); -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/AmqpAuthPlain.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/AmqpAuthPlain.h deleted file mode 100644 index 186454506..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/AmqpAuthPlain.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Created on: Oct 7, 2014 - * Author: bwilliams - * - * Copyright (C) 2014-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AMQPCORE_AMQPAUTHPLAIN_H_ -#define AMQPCORE_AMQPAUTHPLAIN_H_ - - -#include "amqpClient/CAmqpAuthMechanism.h" - -namespace Caf { namespace AmqpClient { - -#define SHA256_HASH_LEN 32 - -class AmqpAuthPlain { -public: - static AMQPStatus AMQP_AuthPlainCreateClient( - SmartPtrCAmqpAuthMechanism& pMech, - const std::string& username, - const std::string& password); - -private: - CAF_CM_DECLARE_NOCREATE (AmqpAuthPlain); -}; - -}} - -#endif /* AMQPCORE_AMQPAUTHPLAIN_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/AmqpChannel.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/AmqpChannel.cpp deleted file mode 100644 index c58bd0def..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/AmqpChannel.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Created on: May 2, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "amqpClient/CAmqpChannel.h" -#include "amqpClient/CAmqpFrame.h" -#include "AmqpChannel.h" -#include "AmqpUtil.h" - -using namespace Caf::AmqpClient; - -AMQPStatus AmqpChannel::AMQP_ChannelClose( - const SmartPtrCAmqpChannel& channel) { - CAF_CM_STATIC_FUNC_VALIDATE("AmqpChannel", "AMQP_ChannelClose"); - CAF_CM_VALIDATE_SMARTPTR(channel); - - return channel->close(); -} - -AMQPStatus AmqpChannel::AMQP_ChannelCloseOk( - const SmartPtrCAmqpChannel& channel) { - CAF_CM_STATIC_FUNC_VALIDATE("AmqpChannel", "AMQP_ChannelCloseOk"); - CAF_CM_VALIDATE_SMARTPTR(channel); - - return channel->closeOk(); -} - -AMQPStatus AmqpChannel::AMQP_ChannelReceive( - const SmartPtrCAmqpChannel& channel, - SmartPtrCAmqpFrame& frame, - const int32 timeout) { - CAF_CM_STATIC_FUNC_VALIDATE("AmqpChannel", "AMQP_ChannelReceive"); - CAF_CM_VALIDATE_SMARTPTR(channel); - - return channel->receive(frame, timeout); -} - -AMQPStatus AmqpChannel::AMQP_ChannelGetId( - const SmartPtrCAmqpChannel& channel, - uint16 *id) { - CAF_CM_STATIC_FUNC_VALIDATE("AmqpChannel", "AMQP_ChannelGetId"); - CAF_CM_VALIDATE_SMARTPTR(channel); - CAF_CM_VALIDATE_PTR(id); - - return channel->getId(id); -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/AmqpChannel.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/AmqpChannel.h deleted file mode 100644 index f38b15977..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/AmqpChannel.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Created on: Oct 7, 2014 - * Author: bwilliams - * - * Copyright (C) 2014-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AMQPCORE_AMQPCHANNEL_H_ -#define AMQPCORE_AMQPCHANNEL_H_ - -#include "AmqpCommon.h" - -#include "amqpClient/CAmqpChannel.h" -#include "amqpClient/CAmqpFrame.h" - -namespace Caf { namespace AmqpClient { - -/** AMQP channel state. */ -typedef enum AMQPChannelState { - AMQP_CHANNEL_OPEN = 0, AMQP_CHANNEL_WAITING_FOR_CLOSE_OK, AMQP_CHANNEL_CLOSED -} AMQPChannelState; - -class AmqpChannel { -public: - static AMQPStatus AMQP_ChannelClose( - const SmartPtrCAmqpChannel& chan); - - static AMQPStatus AMQP_ChannelCloseOk( - const SmartPtrCAmqpChannel& chan); - - static AMQPStatus AMQP_ChannelReceive( - const SmartPtrCAmqpChannel& chan, - SmartPtrCAmqpFrame& frame, - const int32 timeout); - - static AMQPStatus AMQP_ChannelGetId( - const SmartPtrCAmqpChannel& chan, - uint16 *id); - -private: - CAF_CM_DECLARE_NOCREATE (AmqpChannel); -}; - -} -} - -#endif /* AMQPCORE_CHANNEL_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/AmqpCommon.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/AmqpCommon.cpp deleted file mode 100644 index ffeb98b2a..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/AmqpCommon.cpp +++ /dev/null @@ -1,275 +0,0 @@ -/* - * Created on: May 2, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "Exception/CCafException.h" -#include "AmqpCommon.h" - -using namespace Caf::AmqpClient; - -void* AmqpCommon::AMQP_Calloc( - size_t nmemb, - size_t size) { - return calloc(nmemb, size); -} - -void AmqpCommon::AMQP_Free( - void *ptr) { - CAF_CM_STATIC_FUNC_VALIDATE("AmqpCommon", "AMQP_Free"); - CAF_CM_VALIDATE_PTR(ptr); - free(ptr); -} - -int32 AmqpCommon::sendMethod( - const amqp_connection_state_t& connectionState, - const amqp_channel_t& channel, - const amqp_method_number_t& methodId, - void *decodedMethod) { - return validateStatus( - "amqp_send_method - " + CStringConv::toString(methodId), - amqp_send_method( - connectionState, - channel, - methodId, - decodedMethod)); -} - -int32 AmqpCommon::validateStatusRequired( - const std::string& msg, - const int32 status) { - CAF_CM_STATIC_FUNC_LOG("AmqpCommon", "validateStatus"); - CAF_CM_VALIDATE_STRING(msg); - - if (status < 0) { - CAF_CM_EXCEPTION_VA2(E_FAIL, "%s: %s", - msg.c_str(), amqp_error_string2(status)); - } - - return status; -} - -int32 AmqpCommon::validateStatus( - const std::string& msg, - const int32 status) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("AmqpCommon", "validateStatus"); - CAF_CM_VALIDATE_STRING(msg); - - if (status < 0) { - CAF_CM_LOG_WARN_VA2("%s: %s", - msg.c_str(), amqp_error_string2(status)); - } - - return status; -} - -int32 AmqpCommon::validateRpcReply( - const std::string& msg, - const amqp_rpc_reply_t& rpcReply) { - CAF_CM_STATIC_FUNC_LOG("AmqpCommon", "validateRpcReply"); - CAF_CM_VALIDATE_STRING(msg); - - int32 status = 0; - switch (rpcReply.reply_type) { - case AMQP_RESPONSE_NORMAL: - break; - - case AMQP_RESPONSE_NONE: - CAF_CM_EXCEPTION_VA1(E_FAIL, "%s: missing RPC reply type!", msg.c_str()); - break; - - case AMQP_RESPONSE_LIBRARY_EXCEPTION: - status = rpcReply.library_error; - CAF_CM_LOG_WARN_VA2("%s: %s", msg.c_str(), - amqp_error_string2(rpcReply.library_error)); - break; - - case AMQP_RESPONSE_SERVER_EXCEPTION: - switch (rpcReply.reply.id) { - case AMQP_CONNECTION_CLOSE_METHOD: { - amqp_connection_close_t *reply = - reinterpret_cast(rpcReply.reply.decoded); - - CAF_CM_EXCEPTION_VA4(E_FAIL, - "%s: server connection error %d, message: %.*s", msg.c_str(), - reply->reply_code, reply->reply_text.len, - static_cast(reply->reply_text.bytes)); - - break; - } - case AMQP_CHANNEL_CLOSE_METHOD: { - amqp_connection_close_t *reply = - reinterpret_cast(rpcReply.reply.decoded); - - CAF_CM_EXCEPTION_VA4(E_FAIL, - "%s: server channel error %d, message: %.*s", msg.c_str(), - reply->reply_code, reply->reply_text.len, - static_cast(reply->reply_text.bytes)); - break; - } - default: - CAF_CM_EXCEPTION_VA2(E_FAIL, - "%s: unknown server error, method id 0x%08X", msg.c_str(), - rpcReply.reply.id); - break; - } - break; - } - - return status; -} - -void AmqpCommon::strToAmqpBytes( - const std::string& src, - amqp_bytes_t& dest, - Csetstr& cachedStrings) { - if (src.empty()) { - dest.len = 0; - dest.bytes = NULL; - } else { - dest = amqp_cstring_bytes(getString(src, cachedStrings).c_str()); - } -} - -const std::string& AmqpCommon::getString( - const std::string& src, - Csetstr& cachedStrings) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("AmqpCommon", "getString"); - CAF_CM_VALIDATE_STRING(src); - - if (cachedStrings.end() == cachedStrings.find(src)) { - cachedStrings.insert(src); - } - - return *(cachedStrings.find(src)); -} - -void AmqpCommon::boolToAmqpBool( - const bool src, - amqp_boolean_t& dest) { - dest = src ? TRUE : FALSE; -} - -void AmqpCommon::cpTableSafely( - const amqp_table_t* src, - amqp_table_t& dest) { - dest = (NULL == src ? amqp_empty_table : *src); -} - -void AmqpCommon::dumpMessageBody( - const void *buffer, - const size_t bufferLen) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("AmqpCommon", "dumpMessageBody"); - CAF_CM_VALIDATE_PTR(buffer); - - unsigned char *buf = (unsigned char *) buffer; - int32 count = 0; - int32 numinrow = 0; - int32 chs[16]; - int32 oldchs[16] = {0}; - int32 showed_dots = 0; - size_t i; - - for (i = 0; i < bufferLen; i++) { - int32 ch = buf[i]; - - if (numinrow == 16) { - int32 i; - - if (rowsEqual(oldchs, chs)) { - if (!showed_dots) { - showed_dots = 1; - CAF_CM_LOG_DEBUG_VA0( - " .. .. .. .. .. .. .. .. : .. .. .. .. .. .. .. .."); - } - } else { - showed_dots = 0; - dumpRow(count, numinrow, chs); - } - - for (i=0; i<16; i++) { - oldchs[i] = chs[i]; - } - - numinrow = 0; - } - - count++; - chs[numinrow++] = ch; - } - - dumpRow(count, numinrow, chs); - - if (numinrow != 0) { - printf("%08dX:\n", count); - } -} - -bool AmqpCommon::rowsEqual( - int32 *row1, - int32 *row2) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("AmqpCommon", "rowsEqual"); - CAF_CM_VALIDATE_PTR(row1); - CAF_CM_VALIDATE_PTR(row2); - - int32 i = 0; - for (; (i < 16) && (row1[i] == row2[i]); i++) {} - return (i == 15); -} - -void AmqpCommon::dumpRow( - const int32 count, - const int32 numinrow, - const int32 *chs) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("AmqpCommon", "dumpRow"); - CAF_CM_VALIDATE_PTR(chs); - - static const int32 BUFF_SIZE = 100; - char buff[BUFF_SIZE]; - std::string msg; - -#ifdef WIN32 - sprintf_s(buff, BUFF_SIZE, "%08lX:", count - numinrow); -#else - snprintf(buff, BUFF_SIZE, "%08dX:", count - numinrow); -#endif - msg += buff; - - if (numinrow > 0) { - for (int32 i = 0; i < numinrow; i++) { - if (i == 8) { - msg += " :"; - } -#ifdef WIN32 - sprintf_s(buff, BUFF_SIZE, " %02X", chs[i]); -#else - snprintf(buff, BUFF_SIZE, " %02X", chs[i]); -#endif - msg += buff; - } - for (int32 i = numinrow; i < 16; i++) { - if (i == 8) { - msg += " :"; - } - msg += " "; - } - msg += " "; - for (int32 i = 0; i < numinrow; i++) { - if (isprint(chs[i])) { -#ifdef WIN32 - sprintf_s(buff, BUFF_SIZE, "%c", chs[i]); -#else - snprintf(buff, BUFF_SIZE, "%c", chs[i]); -#endif - msg += buff; - } else { - msg += "."; - } - } - } - - CAF_CM_LOG_DEBUG_VA1("row: %s", msg.c_str()); -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/AmqpCommon.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/AmqpCommon.h deleted file mode 100644 index 22cc0b0e9..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/AmqpCommon.h +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Created on: Oct 7, 2014 - * Author: bwilliams - * - * Copyright (C) 2014-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AMQPCORE_AMQPCOMMON_H_ -#define AMQPCORE_AMQPCOMMON_H_ - -namespace Caf { namespace AmqpClient { - -/** AMQP status codes. */ -typedef enum { - AMQP_ERROR_OK = 0, /**< AMQP_ERROR_OK */ - AMQP_ERROR_TIMEOUT, /**< AMQP_ERROR_TIMEOUT */ - AMQP_ERROR_NO_MEMORY, /**< AMQP_ERROR_NO_MEMORY */ - AMQP_ERROR_INVALID_HANDLE, /**< AMQP_ERROR_INVALID_HANDLE */ - AMQP_ERROR_INVALID_ARGUMENT, /**< AMQP_ERROR_INVALID_ARGUMENT */ - AMQP_ERROR_WRONG_STATE, /**< AMQP_ERROR_WRONG_STATE */ - AMQP_ERROR_TOO_MANY_CHANNELS, /**< AMQP_ERROR_TOO_MANY_CHANNELS */ - AMQP_ERROR_QUEUE_FULL, /**< AMQP_ERROR_QUEUE_FULL */ - AMQP_ERROR_FRAME_TOO_LARGE, /**< AMQP_ERROR_FRAME_TOO_LARGE */ - AMQP_ERROR_IO_ERROR, /**< AMQP_ERROR_IO_ERROR */ - AMQP_ERROR_PROTOCOL_ERROR, /**< AMQP_ERROR_PROTOCOL_ERROR */ - AMQP_ERROR_UNIMPLEMENTED, /**< AMQP_ERROR_UNIMPLEMENTED */ - AMQP_ERROR_IO_INTERRUPTED, /**< AMQP_ERROR_IO_INTERRUPTED */ - AMQP_ERROR_MAX, /**< AMQP_ERROR_MAX */ -} AMQPStatus; - -class AmqpCommon { -public: - static void *AMQP_Calloc( - size_t nmemb, size_t size); - - static void AMQP_Free(void *ptr); - - static int32 sendMethod( - const amqp_connection_state_t& connectionState, - const amqp_channel_t& channel, - const amqp_method_number_t& methodId, - void *decodedMethod); - - static int32 validateStatusRequired( - const std::string& msg, - const int32 status); - - static int32 validateStatus( - const std::string& msg, - const int32 status); - - static int32 validateRpcReply( - const std::string& msg, - const amqp_rpc_reply_t& rpcReply); - - static void strToAmqpBytes( - const std::string& src, - amqp_bytes_t& dest, - Csetstr& cachedStrings); - - static void boolToAmqpBool( - const bool src, - amqp_boolean_t& dest); - - static void cpTableSafely( - const amqp_table_t* src, - amqp_table_t& dest); - - static void dumpMessageBody( - const void *buffer, - const size_t bufferLen); - -private: - static bool rowsEqual( - int32 *row1, - int32 *row2); - - static void dumpRow( - const int32 count, - const int32 numinrow, - const int32 *chs); - - static const std::string& getString( - const std::string& src, - Csetstr& cachedStrings); - -private: - CAF_CM_DECLARE_NOCREATE (AmqpCommon); -}; - -}} - -#endif /* AMQPCORE_AMQPCOMMON_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/AmqpConnection.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/AmqpConnection.cpp deleted file mode 100644 index 7b68af283..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/AmqpConnection.cpp +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Created on: May 2, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "amqpClient/CAmqpChannel.h" -#include "amqpClient/CAmqpAuthMechanism.h" -#include "amqpClient/CAmqpConnection.h" -#include "amqpClient/api/Address.h" -#include "amqpClient/api/CertInfo.h" -#include "AmqpConnection.h" - -using namespace Caf::AmqpClient; - -AMQPStatus AmqpConnection::AMQP_ConnectionCreate( - SmartPtrCAmqpConnection& conn, - const SmartPtrAddress& address, - const SmartPtrCAmqpAuthMechanism& auth, - const SmartPtrCertInfo& certInfo, - const uint16 channelMax, - const uint32 frameMax, - const uint16 heartbeat, - const uint16 retries, - const uint16 secondsToWait) { - CAF_CM_STATIC_FUNC_VALIDATE("AmqpConnection", "AMQP_ConnectionCreate"); - CAF_CM_VALIDATE_SMARTPTR(address); - CAF_CM_VALIDATE_SMARTPTR(auth); - - conn.CreateInstance(); - return conn->connectionCreate(address, auth, certInfo, - channelMax, frameMax, heartbeat, retries, secondsToWait); -} - -AMQPStatus AmqpConnection::AMQP_ConnectionConnect( - const SmartPtrCAmqpConnection& conn, - const int32 flags) { - CAF_CM_STATIC_FUNC_VALIDATE("AmqpConnection", "AMQP_ConnectionConnect"); - CAF_CM_VALIDATE_SMARTPTR(conn); - - return conn->connectionConnect(flags); -} - -AMQPStatus AmqpConnection::AMQP_ConnectionOpenChannel( - const SmartPtrCAmqpConnection& conn, - SmartPtrCAmqpChannel& chan) { - CAF_CM_STATIC_FUNC_VALIDATE("AmqpConnection", "AMQP_ConnectionOpenChannel"); - CAF_CM_VALIDATE_SMARTPTR(conn); - - return conn->channelOpen(chan); -} - -AMQPStatus AmqpConnection::AMQP_ConnectionClose( - const SmartPtrCAmqpConnection& conn) { - CAF_CM_STATIC_FUNC_VALIDATE("AmqpConnection", "AMQP_ConnectionClose"); - CAF_CM_VALIDATE_SMARTPTR(conn); - - return conn->connectionClose(); -} - -AMQPStatus AmqpConnection::AMQP_ConnectionProcessIO( - const SmartPtrCAmqpConnection& conn) { - CAF_CM_STATIC_FUNC_VALIDATE("AmqpConnection", "AMQP_ConnectionProcessIO"); - CAF_CM_VALIDATE_SMARTPTR(conn); - - return conn->connectionProcessIO(); -} - -AMQPStatus AmqpConnection::AMQP_ConnectionWaitForIO( - const SmartPtrCAmqpConnection& conn, - const int32 timeout) { - CAF_CM_STATIC_FUNC_VALIDATE("AmqpConnection", "AMQP_ConnectionWaitForIO"); - CAF_CM_VALIDATE_SMARTPTR(conn); - - return conn->connectionWaitForIO(timeout); -} - -AMQPStatus AmqpConnection::AMQP_ConnectionGetState( - const SmartPtrCAmqpConnection& conn, - AMQPConnectionState *state) { - CAF_CM_STATIC_FUNC_VALIDATE("AmqpConnection", "AMQP_ConnectionGetState"); - CAF_CM_VALIDATE_SMARTPTR(conn); - CAF_CM_VALIDATE_PTR(state); - - return conn->connectionGetState(state); -} - -AMQPStatus AmqpConnection::AMQP_ConnectionGetMaxChannels( - const SmartPtrCAmqpConnection& conn, - uint16 *channels) { - CAF_CM_STATIC_FUNC_VALIDATE("AmqpConnection", "AMQP_ConnectionGetMaxChannels"); - CAF_CM_VALIDATE_SMARTPTR(conn); - CAF_CM_VALIDATE_PTR(channels); - - return conn->connectionGetMaxChannels(channels); -} - -AMQPStatus AmqpConnection::AMQP_ConnectionGetMaxFrameSize( - const SmartPtrCAmqpConnection& conn, - uint32 *frameSize) { - CAF_CM_STATIC_FUNC_VALIDATE("AmqpConnection", "AMQP_ConnectionGetMaxFrameSize"); - CAF_CM_VALIDATE_SMARTPTR(conn); - CAF_CM_VALIDATE_PTR(frameSize); - - return conn->connectionGetMaxFrameSize(frameSize); -} - -AMQPStatus AmqpConnection::AMQP_ConnectionGetHeartbeatInterval( - const SmartPtrCAmqpConnection& conn, - uint16 *interval) { - CAF_CM_STATIC_FUNC_VALIDATE("AmqpConnection", "AMQP_ConnectionGetHeartbeatInterval"); - CAF_CM_VALIDATE_SMARTPTR(conn); - CAF_CM_VALIDATE_PTR(interval); - - return conn->connectionGetHeartbeatInterval(interval); -} - -AMQPStatus AmqpConnection::AMQP_ConnectionGetLastError( - const SmartPtrCAmqpConnection& conn, - const char **error) { - CAF_CM_STATIC_FUNC_VALIDATE("AmqpConnection", "AMQP_ConnectionGetLastError"); - CAF_CM_VALIDATE_SMARTPTR(conn); - CAF_CM_VALIDATE_PTR(error); - - return conn->connectionGetLastError(error); -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/AmqpConnection.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/AmqpConnection.h deleted file mode 100644 index fe802f6ca..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/AmqpConnection.h +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Created on: Oct 7, 2014 - * Author: bwilliams - * - * Copyright (C) 2014-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AMQPCORE_AMQPCONNECTION_H_ -#define AMQPCORE_AMQPCONNECTION_H_ - -#include "amqpClient/CAmqpChannel.h" -#include "amqpClient/CAmqpAuthMechanism.h" -#include "amqpClient/CAmqpConnection.h" -#include "amqpClient/api/Address.h" -#include "amqpClient/api/CertInfo.h" - -namespace Caf { namespace AmqpClient { - -/** Default maximum number of channels. */ -static const uint16 AMQP_CHANNEL_MAX_DEFAULT = 0; /* Unlimited. */ - -/** Default maximum frame size. */ -static const uint32 AMQP_FRAME_MAX_DEFAULT = 131072; /* 128kB */ - -/** Default heartbeat frequency. */ -static const uint16 AMQP_HEARTBEAT_DEFAULT = 0; /* No heartbeat. */ - -/** AMQP connection internal state details. */ -typedef enum AMQPConnectionInternalState { - AMQP_CONNECTION_INITIALIZED = 0, - AMQP_CONNECTION_CONNECTING, - AMQP_CONNECTION_WAITING_FOR_START, - AMQP_CONNECTION_WAITING_FOR_SECURE, - AMQP_CONNECTION_WAITING_FOR_TUNE, - AMQP_CONNECTION_WAITING_FOR_OPEN_OK, - AMQP_CONNECTION_OPEN, - AMQP_CONNECTION_WAITING_FOR_CLOSE_OK, - AMQP_CONNECTION_SENT_CLOSE_OK, - AMQP_CONNECTION_CLOSED -} AMQPConnectionInternalState; - -/** Close the socket when the connection is closed. */ -#define AMQP_CONNECTION_FLAG_CLOSE_SOCKET (1 << 0) -/** Don't lock the connection against multi-threaded applications. */ -#define AMQP_CONNECTION_FLAG_NO_LOCK (1 << 1) -/** Don't retry I/O when interrupted by signals. */ -#define AMQP_CONNECTION_FLAG_NO_IO_RETRY (1 << 2) - -/** Mode to poll the socket. */ -typedef enum { - AMQP_WANT_READ = 0x1, /*!< Poll socket for readability. */ - AMQP_WANT_WRITE = 0x2, /*!< Poll socket for writability. */ - AMQP_POLL_NO_IO_RETRY = 0x4, /*!< Don't retry I/O on EINTR. */ -} AMQPPollFlags; - -class AmqpConnection { -public: - static AMQPStatus AMQP_ConnectionCreate( - SmartPtrCAmqpConnection& pConn, - const SmartPtrAddress& address, - const SmartPtrCAmqpAuthMechanism& auth, - const SmartPtrCertInfo& certInfo, - const uint16 channelMax, - const uint32 frameMax, - const uint16 heartbeat, - const uint16 retries, - const uint16 secondsToWait); - - static AMQPStatus AMQP_ConnectionConnect( - const SmartPtrCAmqpConnection& conn, - const int32 flags); - - static AMQPStatus AMQP_ConnectionOpenChannel( - const SmartPtrCAmqpConnection& conn, - SmartPtrCAmqpChannel& chan); - - static AMQPStatus AMQP_ConnectionClose( - const SmartPtrCAmqpConnection& conn); - - static AMQPStatus AMQP_ConnectionProcessIO( - const SmartPtrCAmqpConnection& conn); - - static AMQPStatus AMQP_ConnectionWaitForIO( - const SmartPtrCAmqpConnection& conn, - const int32 timeout); - - static AMQPStatus AMQP_ConnectionGetState( - const SmartPtrCAmqpConnection& conn, - AMQPConnectionState *state); - - static AMQPStatus AMQP_ConnectionGetMaxChannels( - const SmartPtrCAmqpConnection& conn, - uint16 *channels); - - static AMQPStatus AMQP_ConnectionGetMaxFrameSize( - const SmartPtrCAmqpConnection& conn, - uint32 *frameSize); - - static AMQPStatus AMQP_ConnectionGetHeartbeatInterval( - const SmartPtrCAmqpConnection& conn, - uint16 *interval); - - static AMQPStatus AMQP_ConnectionGetLastError( - const SmartPtrCAmqpConnection& conn, - const char **error); - -private: - CAF_CM_DECLARE_NOCREATE (AmqpConnection); -}; - -} -} - -#endif /* AMQPCORE_AMQPCONNECTION_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/AmqpUtil.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/AmqpUtil.cpp deleted file mode 100644 index 577bee01c..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/AmqpUtil.cpp +++ /dev/null @@ -1,203 +0,0 @@ -/* - * Created on: May 2, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "amqpClient/CAmqpChannel.h" -#include "Memory/DynamicArray/DynamicArrayInc.h" -#include "AmqpUtil.h" - -using namespace Caf::AmqpClient; - -AMQPStatus AmqpUtil::AMQP_BasicAck( - const SmartPtrCAmqpChannel& channel, - const uint64 deliveryTag, - const bool multiple) { - CAF_CM_STATIC_FUNC_VALIDATE("AmqpUtil", "AMQP_BasicAck"); - CAF_CM_VALIDATE_SMARTPTR(channel); - - return channel->basicAck(deliveryTag, multiple); -} - -AMQPStatus AmqpUtil::AMQP_BasicCancel( - const SmartPtrCAmqpChannel& channel, - const std::string& consumerTag, - const bool noWait) { - CAF_CM_STATIC_FUNC_VALIDATE("AmqpUtil", "AMQP_BasicCancel"); - CAF_CM_VALIDATE_SMARTPTR(channel); - CAF_CM_VALIDATE_STRING(consumerTag); - - return channel->basicCancel(consumerTag, noWait); -} - -AMQPStatus AmqpUtil::AMQP_BasicConsume( - const SmartPtrCAmqpChannel& channel, - const std::string& queue, - const std::string& consumerTag, - const bool noLocal, - const bool noAck, - const bool exclusive, - const bool noWait, - const amqp_table_t *arguments) { - CAF_CM_STATIC_FUNC_VALIDATE("AmqpUtil", "AMQP_BasicConsume"); - CAF_CM_VALIDATE_SMARTPTR(channel); - CAF_CM_VALIDATE_STRING(queue); - - return channel->basicConsume(queue, consumerTag, noLocal, noAck, - exclusive, noWait, arguments); -} - -AMQPStatus AmqpUtil::AMQP_BasicGet( - const SmartPtrCAmqpChannel& channel, - const std::string& queue, - const bool noAck) { - CAF_CM_STATIC_FUNC_VALIDATE("AmqpUtil", "AMQP_BasicGet"); - CAF_CM_VALIDATE_SMARTPTR(channel); - CAF_CM_VALIDATE_STRING(queue); - - return channel->basicGet(queue, noAck); -} - -AMQPStatus AmqpUtil::AMQP_BasicPublish( - const SmartPtrCAmqpChannel& channel, - const std::string& exchange, - const std::string& routingKey, - const bool mandatory, - const bool immediate, - const amqp_basic_properties_t *basicProps, - const SmartPtrCDynamicByteArray& body) { - CAF_CM_STATIC_FUNC_VALIDATE("AmqpUtil", "AMQP_BasicPublish"); - CAF_CM_VALIDATE_SMARTPTR(channel); - CAF_CM_VALIDATE_STRING(exchange); - CAF_CM_VALIDATE_STRING(routingKey); - CAF_CM_VALIDATE_PTR(basicProps); - CAF_CM_VALIDATE_SMARTPTR(body); - - return channel->basicPublish(exchange, routingKey, mandatory, - immediate, basicProps, body); -} - -AMQPStatus AmqpUtil::AMQP_BasicRecover( - const SmartPtrCAmqpChannel& channel, - const bool requeue) { - CAF_CM_STATIC_FUNC_VALIDATE("AmqpUtil", "AMQP_BasicRecover"); - CAF_CM_VALIDATE_SMARTPTR(channel); - - return channel->basicRecover(requeue); -} - -AMQPStatus AmqpUtil::AMQP_BasicQos( - const SmartPtrCAmqpChannel& channel, - const uint32 prefetchSize, - const uint16 prefetchCount, - const bool global) { - CAF_CM_STATIC_FUNC_VALIDATE("AmqpUtil", "AMQP_BasicQos"); - CAF_CM_VALIDATE_SMARTPTR(channel); - - return channel->basicQos(prefetchSize, prefetchCount, global); -} - -AMQPStatus AmqpUtil::AMQP_ExchangeDeclare( - const SmartPtrCAmqpChannel& channel, - const std::string& exchange, - const std::string& type, - const bool passive, - const bool durable, - const bool noWait, - const amqp_table_t *arguments) { - CAF_CM_STATIC_FUNC_VALIDATE("AmqpUtil", "AMQP_ExchangeDeclare"); - CAF_CM_VALIDATE_SMARTPTR(channel); - CAF_CM_VALIDATE_STRING(exchange); - CAF_CM_VALIDATE_STRING(type); - - return channel->exchangeDeclare(exchange, type, passive, durable, - noWait, arguments); -} - -AMQPStatus AmqpUtil::AMQP_ExchangeDelete( - const SmartPtrCAmqpChannel& channel, - const std::string& exchange, - const bool ifUnused, - const bool noWait) { - CAF_CM_STATIC_FUNC_VALIDATE("AmqpUtil", "AMQP_ExchangeDelete"); - CAF_CM_VALIDATE_SMARTPTR(channel); - CAF_CM_VALIDATE_STRING(exchange); - - return channel->exchangeDelete(exchange, ifUnused, noWait); -} - -AMQPStatus AmqpUtil::AMQP_QueueBind( - const SmartPtrCAmqpChannel& channel, - const std::string& queue, - const std::string& exchange, - const std::string& routingKey, - const bool noWait, - const amqp_table_t *arguments) { - CAF_CM_STATIC_FUNC_VALIDATE("AmqpUtil", "AMQP_QueueBind"); - CAF_CM_VALIDATE_SMARTPTR(channel); - CAF_CM_VALIDATE_STRING(queue); - CAF_CM_VALIDATE_STRING(exchange); - CAF_CM_VALIDATE_STRING(routingKey); - - return channel->queueBind(queue, exchange, routingKey, noWait, arguments); -} - -AMQPStatus AmqpUtil::AMQP_QueueDeclare( - const SmartPtrCAmqpChannel& channel, - const std::string& queue, - const bool passive, - const bool durable, - const bool exclusive, - const bool autoDelete, - const bool noWait, - const amqp_table_t *arguments) { - CAF_CM_STATIC_FUNC_VALIDATE("AmqpUtil", "AMQP_QueueDeclare"); - CAF_CM_VALIDATE_SMARTPTR(channel); - CAF_CM_VALIDATE_STRING(queue); - - return channel->queueDeclare(queue, passive, durable, exclusive, - autoDelete, noWait, arguments); -} - -AMQPStatus AmqpUtil::AMQP_QueueDelete( - const SmartPtrCAmqpChannel& channel, - const std::string& queue, - const bool ifUnused, - const bool ifEmpty, - const bool noWait) { - CAF_CM_STATIC_FUNC_VALIDATE("AmqpUtil", "AMQP_QueueDelete"); - CAF_CM_VALIDATE_SMARTPTR(channel); - CAF_CM_VALIDATE_STRING(queue); - - return channel->queueDelete(queue, ifUnused, ifEmpty, noWait); -} - -AMQPStatus AmqpUtil::AMQP_QueuePurge( - const SmartPtrCAmqpChannel& channel, - const std::string& queue, - const bool noWait) { - CAF_CM_STATIC_FUNC_VALIDATE("AmqpUtil", "AMQP_QueuePurge"); - CAF_CM_VALIDATE_SMARTPTR(channel); - CAF_CM_VALIDATE_STRING(queue); - - return channel->queuePurge(queue, noWait); -} - -AMQPStatus AmqpUtil::AMQP_QueueUnbind( - const SmartPtrCAmqpChannel& channel, - const std::string& queue, - const std::string& exchange, - const std::string& bindingKey, - const amqp_table_t *arguments) { - CAF_CM_STATIC_FUNC_VALIDATE("AmqpUtil", "AMQP_QueueUnbind"); - CAF_CM_VALIDATE_SMARTPTR(channel); - CAF_CM_VALIDATE_STRING(queue); - CAF_CM_VALIDATE_STRING(exchange); - CAF_CM_VALIDATE_STRING(bindingKey); - - return channel->queueUnbind(queue, exchange, bindingKey, arguments); -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/AmqpUtil.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/AmqpUtil.h deleted file mode 100644 index 8cae791ba..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/AmqpUtil.h +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Created on: Oct 7, 2014 - * Author: bwilliams - * - * Copyright (C) 2014-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AMQPCORE_AMQPUTIL_H_ -#define AMQPCORE_AMQPUTIL_H_ - -#include "amqpClient/CAmqpChannel.h" -#include "Memory/DynamicArray/DynamicArrayInc.h" - -namespace Caf { namespace AmqpClient { - -class AmqpUtil { -public: - static AMQPStatus AMQP_BasicAck( - const SmartPtrCAmqpChannel& channel, - const uint64 deliveryTag, - const bool multiple); - - static AMQPStatus AMQP_BasicCancel( - const SmartPtrCAmqpChannel& channel, - const std::string& consumerTag, - const bool noWait); - - static AMQPStatus AMQP_BasicConsume( - const SmartPtrCAmqpChannel& channel, - const std::string& queue, - const std::string& consumerTag, - const bool noLocal, - const bool noAck, - const bool exclusive, - const bool noWait, - const amqp_table_t *arguments); - - static AMQPStatus AMQP_BasicGet( - const SmartPtrCAmqpChannel& channel, - const std::string& queue, - const bool noAck); - - static AMQPStatus AMQP_BasicPublish( - const SmartPtrCAmqpChannel& channel, - const std::string& exchange, - const std::string& routingKey, - const bool mandatory, - const bool immediate, - const amqp_basic_properties_t *basicProps, - const SmartPtrCDynamicByteArray& body); - - static AMQPStatus AMQP_BasicRecover( - const SmartPtrCAmqpChannel& channel, - const bool requeue); - - static AMQPStatus AMQP_BasicQos( - const SmartPtrCAmqpChannel& channel, - const uint32 prefetchSize, - const uint16 prefetchCount, - bool global); - - static AMQPStatus AMQP_ExchangeDeclare( - const SmartPtrCAmqpChannel& channel, - const std::string& exchange, - const std::string& type, - const bool passive, - const bool durable, - const bool noWait, - const amqp_table_t *arguments); - - static AMQPStatus AMQP_ExchangeDelete( - const SmartPtrCAmqpChannel& channel, - const std::string& exchange, - const bool ifUnused, - const bool noWait); - - static AMQPStatus AMQP_QueueBind( - const SmartPtrCAmqpChannel& channel, - const std::string& queue, - const std::string& exchange, - const std::string& routingKey, - const bool noWait, - const amqp_table_t *arguments); - - static AMQPStatus AMQP_QueueDeclare( - const SmartPtrCAmqpChannel& channel, - const std::string& queue, - const bool passive, - const bool durable, - const bool exclusive, - const bool autoDelete, - const bool noWait, - const amqp_table_t *arguments); - - static AMQPStatus AMQP_QueueDelete( - const SmartPtrCAmqpChannel& channel, - const std::string& queue, - const bool ifUnused, - const bool ifEmpty, - const bool noWait); - - static AMQPStatus AMQP_QueuePurge( - const SmartPtrCAmqpChannel& channel, - const std::string& queue, - const bool noWait); - - static AMQPStatus AMQP_QueueUnbind( - const SmartPtrCAmqpChannel& channel, - const std::string& queue, - const std::string& exchange, - const std::string& bindingKey, - const amqp_table_t *arguments); - -private: - CAF_CM_DECLARE_NOCREATE (AmqpUtil); -}; - -}} - -#endif /* AMQPCORE_AMQPUTIL_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/BlockingRpcContinuation.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/BlockingRpcContinuation.cpp deleted file mode 100644 index e5a1e78e8..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/BlockingRpcContinuation.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Created on: May 15, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Exception/CCafException.h" -#include "amqpClient/AMQCommand.h" -#include "amqpClient/BlockingRpcContinuation.h" - -using namespace Caf::AmqpClient; - -BlockingRpcContinuation::BlockingRpcContinuation() : - _isInitialized(false), - CAF_CM_INIT("BlockingRpcContinuation") { -} - -BlockingRpcContinuation::~BlockingRpcContinuation() { -} - -void BlockingRpcContinuation::init() { - CAF_CM_FUNCNAME_VALIDATE("init"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - _isInitialized = true; -} - -SmartPtrAMQCommand BlockingRpcContinuation::getReply() { - CAF_CM_FUNCNAME_VALIDATE("getReply"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _blocker.get(); -} - -SmartPtrAMQCommand BlockingRpcContinuation::getReply(uint32 timeout) { - CAF_CM_FUNCNAME_VALIDATE("getReply"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _blocker.get(timeout); -} - -SmartPtrCCafException BlockingRpcContinuation::getException() { - CAF_CM_FUNCNAME_VALIDATE("getException"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _exception; -} -void BlockingRpcContinuation::handleCommand(const SmartPtrAMQCommand& command) { - CAF_CM_FUNCNAME_VALIDATE("handleCommand"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - _blocker.set(command); -} - -void BlockingRpcContinuation::handleAbort(SmartPtrCCafException exception) { - CAF_CM_FUNCNAME_VALIDATE("handleAbort"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - _exception = exception; - _blocker.set(NULL); -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/CAmqpAuthMechanism.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/CAmqpAuthMechanism.cpp deleted file mode 100644 index 9cc1d957c..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/CAmqpAuthMechanism.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Created on: May 7, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "amqpClient/CAmqpAuthMechanism.h" - -using namespace Caf::AmqpClient; - -CAmqpAuthMechanism::CAmqpAuthMechanism() : - CAF_CM_INIT("CAmqpAuthMechanism") { - CAF_CM_INIT_THREADSAFE; -} - -CAmqpAuthMechanism::~CAmqpAuthMechanism() { -} - -AMQPStatus CAmqpAuthMechanism::createClient( - const std::string& username, - const std::string& password) { - CAF_CM_FUNCNAME_VALIDATE("createClient"); - CAF_CM_VALIDATE_STRING(username); - // password is optional - - _username = username; - _password = password; - - return AMQP_ERROR_OK; -} - -std::string CAmqpAuthMechanism::getUsername() const { - CAF_CM_FUNCNAME_VALIDATE("getUsername"); - CAF_CM_VALIDATE_STRING(_username); - return _username; -} - -std::string CAmqpAuthMechanism::getPassword() const { - // password is optional - return _password; -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/CAmqpChannel.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/CAmqpChannel.cpp deleted file mode 100644 index fdfefa551..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/CAmqpChannel.cpp +++ /dev/null @@ -1,253 +0,0 @@ -/* - * Created on: May 7, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Memory/DynamicArray/DynamicArrayInc.h" -#include "amqpClient/CAmqpConnection.h" -#include "amqpClient/CAmqpFrame.h" -#include "amqpClient/CAmqpChannel.h" - -using namespace Caf::AmqpClient; - -CAmqpChannel::CAmqpChannel() : - _isInitialized(false), - _channel(0), - CAF_CM_INIT("CAmqpChannel") { - CAF_CM_INIT_THREADSAFE; -} - -CAmqpChannel::~CAmqpChannel() { -} - -void CAmqpChannel::initialize( - const SmartPtrCAmqpConnection& connection, - const amqp_channel_t& channel) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_SMARTPTR(connection); - - _connection = connection; - _channel = channel; - _isInitialized = true; -} - -AMQPStatus CAmqpChannel::close() { - AMQPStatus rc = AMQP_ERROR_OK; - if (_isInitialized) { - rc = _connection->channelClose(_channel); - - _connection = NULL; - _channel = 0; - _isInitialized = false; - } - - return rc; -} - -AMQPStatus CAmqpChannel::closeOk() { - CAF_CM_FUNCNAME_VALIDATE("closeOk"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _connection->channelCloseOk(_channel); -} - -AMQPStatus CAmqpChannel::receive( - SmartPtrCAmqpFrame& frame, - int32 timeout) { - CAF_CM_FUNCNAME_VALIDATE("receive"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _connection->receive(_channel, frame, timeout); -} - -AMQPStatus CAmqpChannel::getId( - uint16 *id) { - CAF_CM_FUNCNAME_VALIDATE("getId"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_PTR(id); - - *id = _channel; - - return AMQP_ERROR_OK; -} - -AMQPStatus CAmqpChannel::basicAck( - const uint64 deliveryTag, - const bool multiple) { - CAF_CM_FUNCNAME_VALIDATE("basicAck"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _connection->basicAck(_channel, deliveryTag, multiple); -} - -AMQPStatus CAmqpChannel::basicCancel( - const std::string& consumerTag, - const bool noWait) { - CAF_CM_FUNCNAME_VALIDATE("basicCancel"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(consumerTag); - - return _connection->basicCancel(_channel, consumerTag, noWait); -} - -AMQPStatus CAmqpChannel::basicConsume( - const std::string& queue, - const std::string& consumerTag, - const bool noLocal, - const bool noAck, - const bool exclusive, - const bool noWait, - const amqp_table_t *arguments) { - CAF_CM_FUNCNAME_VALIDATE("basicConsume"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(queue); - - return _connection->basicConsume(_channel, queue, consumerTag, - noLocal, noAck, exclusive, noWait, arguments); -} - -AMQPStatus CAmqpChannel::basicGet( - const std::string& queue, - const bool noAck) { - CAF_CM_FUNCNAME_VALIDATE("basicGet"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(queue); - - return _connection->basicGet(_channel, queue, noAck); -} - -AMQPStatus CAmqpChannel::basicPublish( - const std::string& exchange, - const std::string& routingKey, - const bool mandatory, - const bool immediate, - const amqp_basic_properties_t *basicProps, - const SmartPtrCDynamicByteArray& body) { - CAF_CM_FUNCNAME_VALIDATE("basicPublish"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(exchange); - CAF_CM_VALIDATE_STRING(routingKey); - CAF_CM_VALIDATE_PTR(basicProps); - CAF_CM_VALIDATE_SMARTPTR(body); - - return _connection->basicPublish(_channel, exchange, routingKey, - mandatory, immediate, basicProps, body); -} - -AMQPStatus CAmqpChannel::basicRecover( - const bool requeue) { - CAF_CM_FUNCNAME_VALIDATE("basicRecover"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _connection->basicRecover(_channel, requeue); -} - -AMQPStatus CAmqpChannel::basicQos( - const uint32 prefetchSize, - const uint16 prefetchCount, - const bool global) { - CAF_CM_FUNCNAME_VALIDATE("basicQos"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _connection->basicQos(_channel, prefetchSize, prefetchCount, global); -} - -AMQPStatus CAmqpChannel::exchangeDeclare( - const std::string& exchange, - const std::string& type, - const bool passive, - const bool durable, - const bool noWait, - const amqp_table_t *arguments) { - CAF_CM_FUNCNAME_VALIDATE("exchangeDeclare"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(exchange); - CAF_CM_VALIDATE_STRING(type); - - return _connection->exchangeDeclare(_channel, exchange, type, passive, - durable, noWait, arguments); -} - -AMQPStatus CAmqpChannel::exchangeDelete( - const std::string& exchange, - const bool ifUnused, - const bool noWait) { - CAF_CM_FUNCNAME_VALIDATE("exchangeDelete"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(exchange); - - return _connection->exchangeDelete(_channel, exchange, ifUnused, noWait); -} - -AMQPStatus CAmqpChannel::queueBind( - const std::string& queue, - const std::string& exchange, - const std::string& routingKey, - const bool noWait, - const amqp_table_t *arguments) { - CAF_CM_FUNCNAME_VALIDATE("queueBind"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(queue); - CAF_CM_VALIDATE_STRING(exchange); - CAF_CM_VALIDATE_STRING(routingKey); - - return _connection->queueBind(_channel, queue, exchange, routingKey, - noWait, arguments); -} - -AMQPStatus CAmqpChannel::queueDeclare( - const std::string& queue, - const bool passive, - const bool durable, - const bool exclusive, - const bool autoDelete, - const bool noWait, - const amqp_table_t *arguments) { - CAF_CM_FUNCNAME_VALIDATE("queueDeclare"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(queue); - - return _connection->queueDeclare(_channel, queue, passive, durable, - exclusive, autoDelete, noWait, arguments); -} - -AMQPStatus CAmqpChannel::queueDelete( - const std::string& queue, - const bool ifUnused, - const bool ifEmpty, - const bool noWait) { - CAF_CM_FUNCNAME_VALIDATE("queueDelete"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(queue); - - return _connection->queueDelete(_channel, queue, ifUnused, ifEmpty, noWait); -} - -AMQPStatus CAmqpChannel::queuePurge( - const std::string& queue, - const bool noWait) { - CAF_CM_FUNCNAME_VALIDATE("queuePurge"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(queue); - - return _connection->queuePurge(_channel, queue, noWait); -} - -AMQPStatus CAmqpChannel::queueUnbind( - const std::string& queue, - const std::string& exchange, - const std::string& bindingKey, - const amqp_table_t *arguments) { - CAF_CM_FUNCNAME_VALIDATE("queueUnbind"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(queue); - CAF_CM_VALIDATE_STRING(exchange); - CAF_CM_VALIDATE_STRING(bindingKey); - - return _connection->queueUnbind(_channel, queue, exchange, bindingKey, arguments); -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/CAmqpConnection.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/CAmqpConnection.cpp deleted file mode 100644 index 8541a3adb..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/CAmqpConnection.cpp +++ /dev/null @@ -1,1059 +0,0 @@ -/* - * Created on: May 7, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "amqpClient/CAmqpChannel.h" -#include "Memory/DynamicArray/DynamicArrayInc.h" -#include "amqpClient/CAmqpAuthMechanism.h" -#include "amqpClient/CAmqpFrame.h" -#include "amqpClient/api/Address.h" -#include "amqpClient/api/CertInfo.h" -#include "amqpClient/CAmqpConnection.h" -#include "Exception/CCafException.h" - -using namespace Caf::AmqpClient; - -CAmqpConnection::CAmqpConnection() : - _connectionState(NULL), - _socket(NULL), - _curChannel(0), - _connectionStateEnum(AMQP_STATE_DISCONNECTED), - _isConnectionLost(false), - _lastStatus(0), - _channelMax(0), - _frameMax(0), - _heartbeat(0), - _retries(0), - _secondsToWait(0), - CAF_CM_INIT_LOG("CAmqpConnection") { - CAF_CM_INIT_THREADSAFE; -} - -CAmqpConnection::~CAmqpConnection() { - CAF_CM_LOCK_UNLOCK; - if (NULL != _connectionState) { - closeConnection(); - } -} - -AMQPStatus CAmqpConnection::connectionCreate( - const SmartPtrAddress& address, - const SmartPtrCAmqpAuthMechanism& auth, - const SmartPtrCertInfo& certInfo, - const uint16 channelMax, - const uint32 frameMax, - const uint16 heartbeat, - const uint16 retries, - const uint16 secondsToWait) { - CAF_CM_FUNCNAME("connectionCreate"); - CAF_CM_VALIDATE_SMARTPTR(address); - CAF_CM_VALIDATE_SMARTPTR(auth); - - CAF_CM_LOCK_UNLOCK; - - _address = address; - _auth = auth; - _certInfo = certInfo; - _channelMax = channelMax; - _frameMax = frameMax; - _heartbeat = heartbeat; - _channelFrames.CreateInstance(); - _retries = retries; - _secondsToWait = secondsToWait; - - AMQPStatus rc = AMQP_ERROR_OK; - switch(_address->getProtocol()) { - case PROTOCOL_AMQP: - rc = createConnection(); - break; - case PROTOCOL_AMQPS: - rc = createSslConnection(); - break; - case PROTOCOL_TUNNEL: - rc = createSslConnection(); - break; - default: - CAF_CM_EXCEPTION_VA1(E_FAIL, - "Unknown protocol - %d", _address->getProtocol()); - } - - return rc; -} - -AMQPStatus CAmqpConnection::connectionConnect( - const int32 flags) { - CAF_CM_LOCK_UNLOCK; - return connectConnection(); -} - -AMQPStatus CAmqpConnection::connectionClose() { - CAF_CM_LOCK_UNLOCK; - return closeConnection(); -} - -AMQPStatus CAmqpConnection::connectionProcessIO() { - //TODO: Is this call necessary anymore? - return AMQP_ERROR_OK; -} - -AMQPStatus CAmqpConnection::connectionWaitForIO( - int32 timeout) { - CAF_CM_FUNCNAME_VALIDATE("connectionWaitForIO"); - - CAF_CM_LOCK_UNLOCK; - CAF_CM_VALIDATE_PTR(_connectionState); - CAF_CM_VALIDATE_BOOL(_connectionStateEnum == AMQP_STATE_CONNECTED); - - AMQPStatus rc = AMQP_ERROR_TIMEOUT; - if (isDataAvail(_connectionState)) { - rc = AMQP_ERROR_OK; - } else { - if (timeout > 0) { - { - CAF_CM_UNLOCK_LOCK; - CThreadUtils::sleep(timeout); - } - if (isDataAvail(_connectionState)) { - rc = AMQP_ERROR_OK; - } - } - } - - return rc; -} - -AMQPStatus CAmqpConnection::connectionGetState( - AMQPConnectionState *state) { - CAF_CM_FUNCNAME_VALIDATE("connectionGetState"); - CAF_CM_VALIDATE_PTR(state); - - CAF_CM_LOCK_UNLOCK; - CAF_CM_VALIDATE_PTR(_connectionState); - CAF_CM_VALIDATE_BOOL(_connectionStateEnum == AMQP_STATE_CONNECTED); - - *state = _connectionStateEnum; - - return AMQP_ERROR_OK; -} - -AMQPStatus CAmqpConnection::connectionGetMaxChannels( - uint16 *channels) { - CAF_CM_FUNCNAME_VALIDATE("connectionGetMaxChannels"); - CAF_CM_VALIDATE_PTR(channels); - - CAF_CM_LOCK_UNLOCK; - CAF_CM_VALIDATE_PTR(_connectionState); - CAF_CM_VALIDATE_BOOL(_connectionStateEnum == AMQP_STATE_CONNECTED); - - *channels = amqp_get_channel_max(_connectionState); - - return AMQP_ERROR_OK; -} - -AMQPStatus CAmqpConnection::connectionGetMaxFrameSize( - uint32 *frameSize) { - CAF_CM_FUNCNAME_VALIDATE("connectionGetMaxFrameSize"); - CAF_CM_VALIDATE_PTR(frameSize); - - CAF_CM_LOCK_UNLOCK; - CAF_CM_VALIDATE_PTR(_connectionState); - CAF_CM_VALIDATE_BOOL(_connectionStateEnum == AMQP_STATE_CONNECTED); - - *frameSize = amqp_get_frame_max(_connectionState); - - return AMQP_ERROR_OK; -} - -AMQPStatus CAmqpConnection::connectionGetHeartbeatInterval( - uint16 *interval) { - CAF_CM_FUNCNAME_VALIDATE("connectionGetHeartbeatInterval"); - CAF_CM_VALIDATE_PTR(interval); - - CAF_CM_LOCK_UNLOCK; - CAF_CM_VALIDATE_PTR(_connectionState); - CAF_CM_VALIDATE_BOOL(_connectionStateEnum == AMQP_STATE_CONNECTED); - - *interval = amqp_get_heartbeat(_connectionState); - - return AMQP_ERROR_OK; -} - -AMQPStatus CAmqpConnection::connectionGetLastError( - const char **error) { - CAF_CM_FUNCNAME_VALIDATE("connectionGetLastError"); - CAF_CM_VALIDATE_PTR(error); - - CAF_CM_LOCK_UNLOCK; - - *error = amqp_error_string2(_lastStatus); - - return AMQP_ERROR_OK; -} - -AMQPStatus CAmqpConnection::channelClose( - const amqp_channel_t& channel) { - CAF_CM_FUNCNAME_VALIDATE("channelClose"); - - CAF_CM_LOCK_UNLOCK; - CAF_CM_VALIDATE_PTR(_connectionState); - CAF_CM_VALIDATE_BOOL(_connectionStateEnum == AMQP_STATE_CONNECTED); - validateOpenChannel(channel); - - _openChannels.erase(channel); - - return closeChannel(channel); -} - -AMQPStatus CAmqpConnection::channelCloseOk( - const amqp_channel_t& channel) { - CAF_CM_FUNCNAME_VALIDATE("channelCloseOk"); - - CAF_CM_LOCK_UNLOCK; - CAF_CM_VALIDATE_PTR(_connectionState); - CAF_CM_VALIDATE_BOOL(_connectionStateEnum == AMQP_STATE_CONNECTED); - validateOpenChannel(channel); - - amqp_channel_close_ok_t method = {}; - AmqpCommon::sendMethod(_connectionState, channel, - AMQP_CHANNEL_CLOSE_OK_METHOD, &method); - - return AMQP_ERROR_OK; -} - -AMQPStatus CAmqpConnection::receive( - const amqp_channel_t& channel, - SmartPtrCAmqpFrame& frame, - const int32 timeout) { - CAF_CM_FUNCNAME_VALIDATE("receive"); - - frame = SmartPtrCAmqpFrame(); - AMQPStatus rc = AMQP_ERROR_OK; - - CAF_CM_LOCK_UNLOCK; - CAF_CM_VALIDATE_PTR(_connectionState); - CAF_CM_VALIDATE_BOOL(_connectionStateEnum == AMQP_STATE_CONNECTED); - validateOpenChannel(channel); - - //amqp_maybe_release_buffers(_connectionState); - - int32 status = AMQP_STATUS_OK; - CChannelFrames::iterator iter = _channelFrames->find(channel); - if ((_channelFrames->end() == iter) || iter->second.empty()) { - CAmqpFrames frames; - SmartPtrCAmqpFrame frame; - status = receiveFrame(_connectionState, frame); - if ((AMQP_STATUS_TIMEOUT == status) && (timeout > 0)) { - CAF_CM_UNLOCK_LOCK; - CThreadUtils::sleep(timeout); - } - - while (AMQP_STATUS_OK == status) { - CAF_CM_VALIDATE_SMARTPTR(frame); - frames.push_back(frame); - status = receiveFrame(_connectionState, frame); - } - _lastStatus = status; - - addFrames(frames, _channelFrames); - } - - switch (status) { - case AMQP_STATUS_OK: - case AMQP_STATUS_TIMEOUT: { - iter = _channelFrames->find(channel); - if ((_channelFrames->end() == iter) || iter->second.empty()) { - rc = AMQP_ERROR_TIMEOUT; - } else { - frame = iter->second.front(); - iter->second.pop_front(); - } - } - break; - - case AMQP_STATUS_CONNECTION_CLOSED: { - if (! _isConnectionLost) { - CAF_CM_LOG_ERROR_VA1("Connection closed... restarting listener - %s", - amqp_error_string2(status)); - _isConnectionLost = true; - restartListener(amqp_error_string2(status)); - } - rc = AMQP_ERROR_IO_INTERRUPTED; - } - break; - - case AMQP_STATUS_SOCKET_ERROR: { // Enhance the logic to restart listener after certain number of errors. - if (! _isConnectionLost) { - CAF_CM_LOG_ERROR_VA1("SOCKET_ERROR... restarting listener - %s", - amqp_error_string2(status)); - _isConnectionLost = true; - restartListener(amqp_error_string2(status)); - } - rc = AMQP_ERROR_IO_INTERRUPTED; - } - break; - - default: { - CAF_CM_LOG_ERROR_VA1("Received error status - %s", - amqp_error_string2(status)); - } - break; - } - - if (! frame.IsNull()) { - frame->log("Returned"); - } - - return rc; -} - -AMQPStatus CAmqpConnection::channelOpen( - SmartPtrCAmqpChannel& chan) { - CAF_CM_FUNCNAME("channelOpen"); - - CAF_CM_LOCK_UNLOCK; - CAF_CM_VALIDATE_PTR(_connectionState); - CAF_CM_VALIDATE_BOOL(_connectionStateEnum == AMQP_STATE_CONNECTED); - - _curChannel++; - const amqp_channel_t channel = _curChannel; - - CAF_CM_LOG_DEBUG_VA1("Calling amqp_channel_open - %d", channel); - - amqp_channel_open_t method = {}; - method.out_of_band = amqp_empty_bytes; - AmqpCommon::sendMethod(_connectionState, channel, - AMQP_CHANNEL_OPEN_METHOD, &method); - - chan.CreateInstance(); - chan->initialize(this, channel); - - if (! _openChannels.insert(channel).second) { - CAF_CM_EXCEPTION_VA1(E_FAIL, - "Inserted duplicated channel - %d", channel); - } - - return AMQP_ERROR_OK; -} - -AMQPStatus CAmqpConnection::basicAck( - const amqp_channel_t& channel, - const uint64 deliveryTag, - const bool multiple) { - CAF_CM_FUNCNAME_VALIDATE("basicAck"); - - CAF_CM_LOG_DEBUG_VA1( - "Calling amqp_basic_ack - channel: %d", channel); - - CAF_CM_LOCK_UNLOCK; - CAF_CM_VALIDATE_PTR(_connectionState); - CAF_CM_VALIDATE_BOOL(_connectionStateEnum == AMQP_STATE_CONNECTED); - validateOpenChannel(channel); - - _lastStatus = AmqpCommon::validateStatus( - "amqp_basic_ack", - amqp_basic_ack( - _connectionState, - channel, - deliveryTag, - multiple ? TRUE : FALSE)); - - return AMQP_ERROR_OK; -} - -AMQPStatus CAmqpConnection::basicCancel( - const amqp_channel_t& channel, - const std::string& consumerTag, - const bool noWait) { - CAF_CM_FUNCNAME_VALIDATE("basicCancel"); - CAF_CM_VALIDATE_STRING(consumerTag); - - CAF_CM_LOG_DEBUG_VA2( - "Calling amqp_basic_cancel - channel: %d, consumerTag: %s", - channel, consumerTag.c_str()); - - CAF_CM_LOCK_UNLOCK; - CAF_CM_VALIDATE_PTR(_connectionState); - CAF_CM_VALIDATE_BOOL(_connectionStateEnum == AMQP_STATE_CONNECTED); - validateOpenChannel(channel); - - amqp_basic_cancel_t method = {}; - AmqpCommon::strToAmqpBytes(consumerTag, method.consumer_tag, _cachedStrings); - AmqpCommon::boolToAmqpBool(noWait, method.nowait); - AmqpCommon::sendMethod(_connectionState, channel, - AMQP_BASIC_CANCEL_METHOD, &method); - - return AMQP_ERROR_OK; -} - -AMQPStatus CAmqpConnection::basicConsume( - const amqp_channel_t& channel, - const std::string& queue, - const std::string& consumerTag, - const bool noLocal, - const bool noAck, - const bool exclusive, - const bool noWait, - const amqp_table_t *arguments) { - CAF_CM_FUNCNAME_VALIDATE("basicConsume"); - CAF_CM_VALIDATE_STRING(queue); - - CAF_CM_LOG_DEBUG_VA3( - "Calling amqp_basic_consume - channel: %d, queue: %s, consumerTag: %s", - channel, queue.c_str(), - (consumerTag.empty() ? "NULL" : consumerTag.c_str())); - - CAF_CM_LOCK_UNLOCK; - CAF_CM_VALIDATE_PTR(_connectionState); - CAF_CM_VALIDATE_BOOL(_connectionStateEnum == AMQP_STATE_CONNECTED); - validateOpenChannel(channel); - - amqp_basic_consume_t method = {}; - AmqpCommon::strToAmqpBytes(queue, method.queue, _cachedStrings); - AmqpCommon::strToAmqpBytes(consumerTag, method.consumer_tag, _cachedStrings); - AmqpCommon::boolToAmqpBool(noLocal, method.no_local); - AmqpCommon::boolToAmqpBool(noAck, method.no_ack); - AmqpCommon::boolToAmqpBool(exclusive, method.exclusive); - AmqpCommon::boolToAmqpBool(noWait, method.nowait); - AmqpCommon::cpTableSafely(arguments, method.arguments); - AmqpCommon::sendMethod(_connectionState, channel, - AMQP_BASIC_CONSUME_METHOD, &method); - - return AMQP_ERROR_OK; -} - -AMQPStatus CAmqpConnection::basicGet( - const amqp_channel_t& channel, - const std::string& queue, - const bool noAck) { - CAF_CM_FUNCNAME_VALIDATE("basicGet"); - CAF_CM_VALIDATE_STRING(queue); - - CAF_CM_LOG_DEBUG_VA2( - "Calling amqp_basic_get - channel: %d, queue: %s", - channel, queue.c_str()); - - CAF_CM_LOCK_UNLOCK; - CAF_CM_VALIDATE_PTR(_connectionState); - CAF_CM_VALIDATE_BOOL(_connectionStateEnum == AMQP_STATE_CONNECTED); - validateOpenChannel(channel); - - AmqpCommon::validateRpcReply( - "amqp_basic_get", - amqp_basic_get( - _connectionState, - channel, - amqp_cstring_bytes(queue.c_str()), - noAck ? TRUE : FALSE)); - - return AMQP_ERROR_OK; -} - -AMQPStatus CAmqpConnection::basicPublish( - const amqp_channel_t& channel, - const std::string& exchange, - const std::string& routingKey, - const bool mandatory, - const bool immediate, - const amqp_basic_properties_t *basicProps, - const SmartPtrCDynamicByteArray& body) { - CAF_CM_FUNCNAME_VALIDATE("basicPublish"); - CAF_CM_VALIDATE_STRING(exchange); - CAF_CM_VALIDATE_STRING(routingKey); - CAF_CM_VALIDATE_PTR(basicProps); - CAF_CM_VALIDATE_SMARTPTR(body); - - CAF_CM_LOG_DEBUG_VA3( - "Calling amqp_basic_publish - channel: %d, exchange: %s, routingKey: %s", - channel, exchange.c_str(), routingKey.c_str()); - - CAF_CM_LOCK_UNLOCK; - CAF_CM_VALIDATE_PTR(_connectionState); - CAF_CM_VALIDATE_BOOL(_connectionStateEnum == AMQP_STATE_CONNECTED); - validateOpenChannel(channel); - - amqp_bytes_t bodyRaw; - bodyRaw.bytes = body->getNonConstPtr(); - bodyRaw.len = body->getByteCount(); - - _lastStatus = AmqpCommon::validateStatus( - "amqp_basic_publish", - amqp_basic_publish( - _connectionState, - channel, - amqp_cstring_bytes(exchange.c_str()), - amqp_cstring_bytes(routingKey.c_str()), - mandatory ? TRUE : FALSE, - immediate ? TRUE : FALSE, - basicProps, - bodyRaw)); - - return AMQP_ERROR_OK; -} - -AMQPStatus CAmqpConnection::basicRecover( - const amqp_channel_t& channel, - const bool requeue) { - CAF_CM_FUNCNAME_VALIDATE("basicRecover"); - - CAF_CM_LOG_DEBUG_VA1( - "Calling amqp_basic_recover - channel: %d", channel); - - CAF_CM_LOCK_UNLOCK; - CAF_CM_VALIDATE_PTR(_connectionState); - CAF_CM_VALIDATE_BOOL(_connectionStateEnum == AMQP_STATE_CONNECTED); - validateOpenChannel(channel); - - amqp_basic_recover_t method = {}; - AmqpCommon::boolToAmqpBool(requeue, method.requeue); - AmqpCommon::sendMethod(_connectionState, channel, - AMQP_BASIC_RECOVER_METHOD, &method); - - return AMQP_ERROR_OK; -} - -AMQPStatus CAmqpConnection::basicQos( - const amqp_channel_t& channel, - const uint32 prefetchSize, - const uint16 prefetchCount, - const bool global) { - CAF_CM_FUNCNAME_VALIDATE("basicQos"); - - CAF_CM_LOG_DEBUG_VA1( - "Calling amqp_basic_qos - channel: %d", channel); - - CAF_CM_LOCK_UNLOCK; - CAF_CM_VALIDATE_PTR(_connectionState); - CAF_CM_VALIDATE_BOOL(_connectionStateEnum == AMQP_STATE_CONNECTED); - validateOpenChannel(channel); - - amqp_basic_qos_t method = {}; - method.prefetch_size = prefetchSize; - method.prefetch_count = prefetchCount; - AmqpCommon::boolToAmqpBool(global, method.global); - AmqpCommon::sendMethod(_connectionState, channel, - AMQP_BASIC_QOS_METHOD, &method); - - return AMQP_ERROR_OK; -} - -AMQPStatus CAmqpConnection::exchangeDeclare( - const amqp_channel_t& channel, - const std::string& exchange, - const std::string& type, - const bool passive, - const bool durable, - const bool noWait, - const amqp_table_t *arguments) { - CAF_CM_FUNCNAME_VALIDATE("exchangeDeclare"); - CAF_CM_VALIDATE_STRING(exchange); - CAF_CM_VALIDATE_STRING(type); - - CAF_CM_LOG_DEBUG_VA3( - "Calling amqp_exchange_declare - channel: %d, exchange: %s, type: %s", - channel, exchange.c_str(), type.c_str()); - - CAF_CM_LOCK_UNLOCK; - CAF_CM_VALIDATE_PTR(_connectionState); - CAF_CM_VALIDATE_BOOL(_connectionStateEnum == AMQP_STATE_CONNECTED); - validateOpenChannel(channel); - - const bool autoDelete = false; - - amqp_exchange_declare_t method = {}; - AmqpCommon::strToAmqpBytes(exchange, method.exchange, _cachedStrings); - AmqpCommon::strToAmqpBytes(type, method.type, _cachedStrings); - AmqpCommon::boolToAmqpBool(passive, method.passive); - AmqpCommon::boolToAmqpBool(durable, method.durable); - AmqpCommon::boolToAmqpBool(noWait, method.nowait); - AmqpCommon::cpTableSafely(arguments, method.arguments); - AmqpCommon::boolToAmqpBool(autoDelete, method.auto_delete); - AmqpCommon::sendMethod(_connectionState, channel, - AMQP_EXCHANGE_DECLARE_METHOD, &method); - - return AMQP_ERROR_OK; -} - -AMQPStatus CAmqpConnection::exchangeDelete( - const amqp_channel_t& channel, - const std::string& exchange, - const bool ifUnused, - const bool noWait) { - CAF_CM_FUNCNAME_VALIDATE("exchangeDelete"); - CAF_CM_VALIDATE_STRING(exchange); - - CAF_CM_LOG_DEBUG_VA2( - "Calling amqp_exchange_delete - channel: %d, exchange: %s", - channel, exchange.c_str()); - - CAF_CM_LOCK_UNLOCK; - CAF_CM_VALIDATE_PTR(_connectionState); - CAF_CM_VALIDATE_BOOL(_connectionStateEnum == AMQP_STATE_CONNECTED); - validateOpenChannel(channel); - - amqp_exchange_delete_t method = {}; - AmqpCommon::strToAmqpBytes(exchange, method.exchange, _cachedStrings); - AmqpCommon::boolToAmqpBool(ifUnused, method.if_unused); - AmqpCommon::boolToAmqpBool(noWait, method.nowait); - AmqpCommon::sendMethod(_connectionState, channel, - AMQP_EXCHANGE_DELETE_METHOD, &method); - - return AMQP_ERROR_OK; -} - -AMQPStatus CAmqpConnection::queueBind( - const amqp_channel_t& channel, - const std::string& queue, - const std::string& exchange, - const std::string& routingKey, - const bool noWait, - const amqp_table_t *arguments) { - CAF_CM_FUNCNAME_VALIDATE("queueBind"); - CAF_CM_VALIDATE_STRING(queue); - CAF_CM_VALIDATE_STRING(exchange); - CAF_CM_VALIDATE_STRING(routingKey); - - CAF_CM_LOG_DEBUG_VA4( - "Calling amqp_queue_bind - channel: %d, queue: %s, exchange: %s, routingKey: %s", - channel, queue.c_str(), exchange.c_str(), routingKey.c_str()); - - CAF_CM_LOCK_UNLOCK; - CAF_CM_VALIDATE_PTR(_connectionState); - CAF_CM_VALIDATE_BOOL(_connectionStateEnum == AMQP_STATE_CONNECTED); - CAF_CM_VALIDATE_BOOL(_address->getProtocol() != PROTOCOL_TUNNEL); - validateOpenChannel(channel); - - amqp_queue_bind_t method = {}; - AmqpCommon::strToAmqpBytes(queue, method.queue, _cachedStrings); - AmqpCommon::strToAmqpBytes(exchange, method.exchange, _cachedStrings); - AmqpCommon::strToAmqpBytes(routingKey, method.routing_key, _cachedStrings); - AmqpCommon::boolToAmqpBool(noWait, method.nowait); - AmqpCommon::cpTableSafely(arguments, method.arguments); - AmqpCommon::sendMethod(_connectionState, channel, - AMQP_QUEUE_BIND_METHOD, &method); - - return AMQP_ERROR_OK; -} - -AMQPStatus CAmqpConnection::queueDeclare( - const amqp_channel_t& channel, - const std::string& queue, - const bool passive, - const bool durable, - const bool exclusive, - const bool autoDelete, - const bool noWait, - const amqp_table_t *arguments) { - CAF_CM_FUNCNAME_VALIDATE("queueDeclare"); - CAF_CM_VALIDATE_STRING(queue); - - CAF_CM_LOG_DEBUG_VA2( - "Calling amqp_queue_declare - channel: %d, queue: %s", - channel, queue.c_str()); - - CAF_CM_LOCK_UNLOCK; - CAF_CM_VALIDATE_PTR(_connectionState); - CAF_CM_VALIDATE_BOOL(_connectionStateEnum == AMQP_STATE_CONNECTED); - CAF_CM_VALIDATE_BOOL(_address->getProtocol() != PROTOCOL_TUNNEL); - validateOpenChannel(channel); - - amqp_queue_declare_t method = {}; - AmqpCommon::strToAmqpBytes(queue, method.queue, _cachedStrings); - AmqpCommon::boolToAmqpBool(passive, method.passive); - AmqpCommon::boolToAmqpBool(durable, method.durable); - AmqpCommon::boolToAmqpBool(exclusive, method.exclusive); - AmqpCommon::boolToAmqpBool(autoDelete, method.auto_delete); - AmqpCommon::boolToAmqpBool(noWait, method.nowait); - AmqpCommon::cpTableSafely(arguments, method.arguments); - AmqpCommon::sendMethod(_connectionState, channel, - AMQP_QUEUE_DECLARE_METHOD, &method); - - return AMQP_ERROR_OK; -} - -AMQPStatus CAmqpConnection::queueDelete( - const amqp_channel_t& channel, - const std::string& queue, - const bool ifUnused, - const bool ifEmpty, - const bool noWait) { - CAF_CM_FUNCNAME_VALIDATE("queueDelete"); - CAF_CM_VALIDATE_STRING(queue); - - CAF_CM_LOG_DEBUG_VA2( - "Calling amqp_queue_delete - channel: %d, queue: %s", - channel, queue.c_str()); - - CAF_CM_LOCK_UNLOCK; - CAF_CM_VALIDATE_PTR(_connectionState); - CAF_CM_VALIDATE_BOOL(_connectionStateEnum == AMQP_STATE_CONNECTED); - CAF_CM_VALIDATE_BOOL(_address->getProtocol() != PROTOCOL_TUNNEL); - validateOpenChannel(channel); - - amqp_queue_delete_t method = {}; - AmqpCommon::strToAmqpBytes(queue, method.queue, _cachedStrings); - AmqpCommon::boolToAmqpBool(ifUnused, method.if_unused); - AmqpCommon::boolToAmqpBool(ifEmpty, method.if_empty); - AmqpCommon::boolToAmqpBool(noWait, method.nowait); - AmqpCommon::sendMethod(_connectionState, channel, - AMQP_QUEUE_DELETE_METHOD, &method); - - return AMQP_ERROR_OK; -} - -AMQPStatus CAmqpConnection::queuePurge( - const amqp_channel_t& channel, - const std::string& queue, - const bool noWait) { - CAF_CM_FUNCNAME_VALIDATE("queuePurge"); - CAF_CM_VALIDATE_STRING(queue); - - CAF_CM_LOG_DEBUG_VA2( - "Calling amqp_queue_purge - channel: %d, queue: %s", - channel, queue.c_str()); - - CAF_CM_LOCK_UNLOCK; - CAF_CM_VALIDATE_PTR(_connectionState); - CAF_CM_VALIDATE_BOOL(_connectionStateEnum == AMQP_STATE_CONNECTED); - validateOpenChannel(channel); - - amqp_queue_purge_t method = {}; - AmqpCommon::strToAmqpBytes(queue, method.queue, _cachedStrings); - AmqpCommon::boolToAmqpBool(noWait, method.nowait); - AmqpCommon::sendMethod(_connectionState, channel, - AMQP_QUEUE_PURGE_METHOD, &method); - - return AMQP_ERROR_OK; -} - -AMQPStatus CAmqpConnection::queueUnbind( - const amqp_channel_t& channel, - const std::string& queue, - const std::string& exchange, - const std::string& routingKey, - const amqp_table_t *arguments) { - CAF_CM_FUNCNAME_VALIDATE("queueUnbind"); - CAF_CM_VALIDATE_STRING(queue); - CAF_CM_VALIDATE_STRING(exchange); - CAF_CM_VALIDATE_STRING(routingKey); - - CAF_CM_LOG_DEBUG_VA4( - "Calling amqp_queue_unbind - channel: %d, queue: %s, exchange: %s, routingKey: %s", - channel, queue.c_str(), exchange.c_str(), routingKey.c_str()); - - CAF_CM_LOCK_UNLOCK; - CAF_CM_VALIDATE_PTR(_connectionState); - CAF_CM_VALIDATE_BOOL(_connectionStateEnum == AMQP_STATE_CONNECTED); - CAF_CM_VALIDATE_BOOL(_address->getProtocol() != PROTOCOL_TUNNEL); - validateOpenChannel(channel); - - amqp_queue_unbind_t method = {}; - AmqpCommon::strToAmqpBytes(queue, method.queue, _cachedStrings); - AmqpCommon::strToAmqpBytes(exchange, method.exchange, _cachedStrings); - AmqpCommon::strToAmqpBytes(routingKey, method.routing_key, _cachedStrings); - AmqpCommon::cpTableSafely(arguments, method.arguments); - AmqpCommon::sendMethod(_connectionState, channel, - AMQP_QUEUE_UNBIND_METHOD, &method); - - return AMQP_ERROR_OK; -} - -AMQPStatus CAmqpConnection::createConnection() { - CAF_CM_FUNCNAME_VALIDATE("createConnection"); - CAF_CM_VALIDATE_NULLPTR(_connectionState); - CAF_CM_VALIDATE_NULLPTR(_socket); - CAF_CM_VALIDATE_BOOL(_connectionStateEnum == AMQP_STATE_DISCONNECTED); - - CAF_CM_LOG_DEBUG_VA0( - "Calling amqp_new_connection/amqp_tcp_socket_new"); - - _connectionState = amqp_new_connection(); - CAF_CM_VALIDATE_PTR(_connectionState); - - _socket = amqp_tcp_socket_new(_connectionState); - CAF_CM_VALIDATE_PTR(_socket); - - _connectionStateEnum = AMQP_STATE_INITIALIZED; - - return AMQP_ERROR_OK; -} - -AMQPStatus CAmqpConnection::createSslConnection() { - CAF_CM_FUNCNAME_VALIDATE("createSslConnection"); - CAF_CM_VALIDATE_NULLPTR(_connectionState); - CAF_CM_VALIDATE_NULLPTR(_socket); - CAF_CM_VALIDATE_BOOL(_connectionStateEnum == AMQP_STATE_DISCONNECTED); - CAF_CM_VALIDATE_SMARTPTR(_certInfo); - - CAF_CM_LOG_DEBUG_VA0( - "Calling amqp_new_connection/amqp_ssl_socket_new"); - - _connectionState = amqp_new_connection(); - CAF_CM_VALIDATE_PTR(_connectionState); - - _socket = amqp_ssl_socket_new(_connectionState); - CAF_CM_VALIDATE_PTR(_socket); - - CAF_CM_LOG_DEBUG_VA0( - "Disable peer verification (amqp_ssl_socket_set_verify_peer)"); - - amqp_ssl_socket_set_verify_peer(_socket, false); - - CAF_CM_LOG_DEBUG_VA0( - "Disable hostname verification (amqp_ssl_socket_set_verify_hostname)"); - - amqp_ssl_socket_set_verify_hostname(_socket, false); - - CAF_CM_LOG_DEBUG_VA0( - "Setting ssl protocol >= 1.2 (amqp_ssl_socket_set_ssl_versions)"); - - amqp_ssl_socket_set_ssl_versions (_socket, AMQP_TLSv1_2, AMQP_TLSvLATEST); - - CAF_CM_LOG_DEBUG_VA1( - "Calling amqp_ssl_socket_set_cacert - caCertPath: %s", - _certInfo->getCaCertPath().c_str()); - - _lastStatus = AmqpCommon::validateStatusRequired( - "amqp_ssl_socket_set_cacert", - amqp_ssl_socket_set_cacert( - _socket, - _certInfo->getCaCertPath().c_str())); - - CAF_CM_LOG_DEBUG_VA2( - "Calling amqp_ssl_socket_set_key - clientCert: %s, clientKey: %s", - _certInfo->getClientCertPath().c_str(), _certInfo->getClientKeyPath().c_str()); - - _lastStatus = AmqpCommon::validateStatusRequired( - "amqp_ssl_socket_set_key", - amqp_ssl_socket_set_key( - _socket, - _certInfo->getClientCertPath().c_str(), - _certInfo->getClientKeyPath().c_str())); - - _connectionStateEnum = AMQP_STATE_INITIALIZED; - - return AMQP_ERROR_OK; -} - -AMQPStatus CAmqpConnection::connectConnection() { - CAF_CM_FUNCNAME("connectConnection"); - CAF_CM_VALIDATE_PTR(_connectionState); - CAF_CM_VALIDATE_PTR(_socket); - CAF_CM_VALIDATE_SMARTPTR(_address); - CAF_CM_VALIDATE_SMARTPTR(_auth); - CAF_CM_VALIDATE_BOOL(_connectionStateEnum == AMQP_STATE_INITIALIZED); - - CAF_CM_LOG_DEBUG_VA3( - "Calling amqp_socket_open_noblock - protocol: %s, host: %s, port: %d", - _address->getProtocolStr().c_str(), _address->getHost().c_str(), - _address->getPort()); - - struct timeval timeout; - struct timeval *pTimeout = NULL; - - if (_secondsToWait) { - memset(&timeout, 0, sizeof(timeval)); - timeout.tv_sec = _secondsToWait; - pTimeout = &timeout; - } - - uint16 retries = _retries; - do { - CAF_CM_LOG_DEBUG_VA2( - "Calling amqp_socket_open_noblock - retries: %d, wait: %d", - retries, _secondsToWait); - if (retries == 1 ) { - // Throw an exception if the last attempt fails - _lastStatus = AmqpCommon::validateStatusRequired( - "amqp_socket_open_noblock", - amqp_socket_open_noblock( - _socket, - _address->getHost().c_str(), - _address->getPort(), - pTimeout)); - } - else { - _lastStatus = AmqpCommon::validateStatus( - "amqp_socket_open_noblock", - amqp_socket_open_noblock( - _socket, - _address->getHost().c_str(), - _address->getPort(), - pTimeout)); - } - } while (_lastStatus != AMQP_STATUS_OK && --retries); - - CAF_CM_LOG_DEBUG_VA2( - "Calling amqp_login - virtualHost: %s, username: %s", - _address->getVirtualHost().c_str(), _auth->getUsername().c_str()); - - _lastStatus = AmqpCommon::validateRpcReply( - "amqp_login", - amqp_login( - _connectionState, - _address->getVirtualHost().c_str(), - _channelMax, - _frameMax, - _heartbeat, - AMQP_SASL_METHOD_PLAIN, - _auth->getUsername().c_str(), - _auth->getPassword().empty() ? "" :_auth->getPassword().c_str())); - - CAF_CM_LOG_DEBUG_VA2( - "Called amqp_login - virtualHost: %s, username: %s", - _address->getVirtualHost().c_str(), _auth->getUsername().c_str()); - - if (0 == _lastStatus) { - _connectionStateEnum = AMQP_STATE_CONNECTED; - } else { - CAF_CM_EXCEPTION_VA3(E_FAIL, - "Failed to login - error: %s, vhost: %s, username: %s", - amqp_error_string2(_lastStatus), - _address->getVirtualHost().c_str(), - _auth->getUsername().c_str()); - } - - return AMQP_ERROR_OK; -} - -AMQPStatus CAmqpConnection::closeConnection() { - CAF_CM_FUNCNAME_VALIDATE("closeConnection"); - - if ((_connectionStateEnum == AMQP_STATE_INITIALIZED) || - (_connectionStateEnum == AMQP_STATE_CONNECTING) || - (_connectionStateEnum == AMQP_STATE_CONNECTED)) { - CAF_CM_VALIDATE_SMARTPTR(_address); - CAF_CM_VALIDATE_PTR(_connectionState); - - CAF_CM_LOG_DEBUG_VA4( - "Calling amqp_connection_close/amqp_destroy_connection - protocol: %s, host: %s, port: %d, virtualHost: %s", - _address->getProtocolStr().c_str(), _address->getHost().c_str(), - _address->getPort(), _address->getVirtualHost().c_str()); - - for (COpenChannels::const_iterator iter = _openChannels.begin(); - iter != _openChannels.end(); iter++) { - const amqp_channel_t channel = *iter; - closeChannel(channel); - } - - AmqpCommon::validateRpcReply( - "amqp_connection_close", - amqp_connection_close(_connectionState, AMQP_REPLY_SUCCESS)); - - _lastStatus = AmqpCommon::validateStatus( - "amqp_destroy_connection", - amqp_destroy_connection(_connectionState)); - } - - _connectionState = NULL; - _socket = NULL; - _curChannel = 0; - _connectionStateEnum = AMQP_STATE_DISCONNECTED; - _channelFrames = NULL; - _openChannels.clear(); - - return AMQP_ERROR_OK; -} - -AMQPStatus CAmqpConnection::closeChannel( - const amqp_channel_t& channel) { - CAF_CM_FUNCNAME_VALIDATE("closeChannel"); - CAF_CM_VALIDATE_PTR(_connectionState); - CAF_CM_VALIDATE_BOOL(_connectionStateEnum == AMQP_STATE_CONNECTED); - - CAF_CM_LOG_DEBUG_VA1("Calling amqp_channel_close - channel: %d", channel); - - AmqpCommon::validateRpcReply( - "amqp_channel_close", - amqp_channel_close( - _connectionState, - channel, - AMQP_REPLY_SUCCESS)); - - return AMQP_ERROR_OK; -} - -int32 CAmqpConnection::receiveFrame( - const amqp_connection_state_t& connectionState, - SmartPtrCAmqpFrame& frame) const { - CAF_CM_FUNCNAME_VALIDATE("receiveFrame"); - CAF_CM_VALIDATE_PTR(connectionState); - - frame = SmartPtrCAmqpFrame(); - - timeval tv; - tv.tv_sec = 0; - tv.tv_usec = 0; - - amqp_frame_t decoded_frame; - int32 status = amqp_simple_wait_frame_noblock( - connectionState, - &decoded_frame, - &tv); - - if (AMQP_STATUS_OK == status) { - frame.CreateInstance(); - frame->initialize(decoded_frame); - frame->log("Received"); - - if (AMQP_FRAME_METHOD == frame->getFrameType()) { - const amqp_method_t* amqpMethod = frame->getPayloadAsMethod(); - if (AMQP_CONNECTION_CLOSE_METHOD == amqpMethod->id) { - status = AMQP_STATUS_CONNECTION_CLOSED; - } - } - } - - return status; -} - -void CAmqpConnection::addFrames( - const CAmqpFrames& frames, - const SmartPtrCChannelFrames& channelFrames) const { - for (CAmqpFrames::const_iterator iter = frames.begin(); - iter != frames.end(); iter++) { - const SmartPtrCAmqpFrame frame = *iter; - - CChannelFrames::iterator fndIter = channelFrames->find(frame->getChannel()); - if (channelFrames->end() == fndIter) { - channelFrames->insert(std::make_pair( - frame->getChannel(), CAmqpFrames())); - fndIter = channelFrames->find(frame->getChannel()); - } - fndIter->second.push_back(frame); - } -} - -void CAmqpConnection::validateOpenChannel( - const amqp_channel_t& channel) const { - CAF_CM_FUNCNAME("validateOpenChannel"); - - if (_openChannels.end() == _openChannels.find(channel)) { - CAF_CM_EXCEPTION_VA1(E_FAIL, - "Channel not found - %d", channel); - } -} - -bool CAmqpConnection::isDataAvail( - const amqp_connection_state_t& connectionState) const { - CAF_CM_FUNCNAME_VALIDATE("isDataAvail"); - CAF_CM_VALIDATE_PTR(connectionState); - - return (amqp_frames_enqueued(connectionState)) || - (amqp_data_in_buffer(connectionState)); -} - -void CAmqpConnection::restartListener( - const std::string& reason) const { - CAF_CM_FUNCNAME_VALIDATE("restartListener"); - CAF_CM_VALIDATE_STRING(reason); - - const std::string monitorDir = AppConfigUtils::getRequiredString("monitor_dir"); - const std::string monitorDirExp = CStringUtils::expandEnv(monitorDir); - - FileSystemUtils::saveTextFile(monitorDirExp, "restartListener.txt", reason); -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/CAmqpFrame.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/CAmqpFrame.cpp deleted file mode 100644 index 0d9149b79..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/CAmqpFrame.cpp +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Created on: May 7, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "amqpClient/CAmqpFrame.h" - -using namespace Caf::AmqpClient; - -CAmqpFrame::CAmqpFrame() : - _isInitialized(false), - _frameType(0), - _channel(0), - _propertiesClassId(0), - _propertiesBodySize(0), - _propertiesDecoded(NULL), - CAF_CM_INIT_LOG("CAmqpFrame") { - _method.decoded = NULL; - _method.id = 0; - _bodyFragment.bytes = NULL; - _bodyFragment.len = 0; -} - -CAmqpFrame::~CAmqpFrame() { -} - -void CAmqpFrame::initialize( - const amqp_frame_t& frame) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - - _channel = frame.channel; - _frameType = frame.frame_type; - - switch (_frameType) { - case AMQP_FRAME_METHOD: { - _method = frame.payload.method; - } - break; - - case AMQP_FRAME_HEADER: { - _propertiesClassId = frame.payload.properties.class_id; - _propertiesBodySize = frame.payload.properties.body_size; - CAF_CM_VALIDATE_NOTZERO(static_cast(_propertiesBodySize)); - CAF_CM_VALIDATE_PTR(frame.payload.properties.decoded); - - _propertiesDecoded = static_cast( - frame.payload.properties.decoded); - } - break; - - case AMQP_FRAME_BODY: { - _bodyFragment = frame.payload.body_fragment; - } - break; - - default: - CAF_CM_LOG_ERROR_VA1("Unknown frame type - %d", frame.frame_type); - } - - _isInitialized = true; -} - -uint8_t CAmqpFrame::getFrameType() const { - CAF_CM_FUNCNAME_VALIDATE("getFrameType"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _frameType; -} - -amqp_channel_t CAmqpFrame::getChannel() const { - CAF_CM_FUNCNAME_VALIDATE("getChannel"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _channel; -} - -const amqp_method_t* const CAmqpFrame::getPayloadAsMethod() const { - CAF_CM_FUNCNAME_VALIDATE("getPayloadAsMethod"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_BOOL(_frameType == AMQP_FRAME_METHOD); - return &_method; -} - -uint16_t CAmqpFrame::getHeaderClassId() const { - CAF_CM_FUNCNAME_VALIDATE("getHeaderClassId"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_BOOL(_frameType == AMQP_FRAME_HEADER); - return _propertiesClassId; -} - -uint64_t CAmqpFrame::getHeaderBodySize() const { - CAF_CM_FUNCNAME_VALIDATE("getHeaderBodySize"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_BOOL(_frameType == AMQP_FRAME_HEADER); - return _propertiesBodySize; -} - -const amqp_basic_properties_t* const CAmqpFrame::getHeaderProperties() const { - CAF_CM_FUNCNAME_VALIDATE("getPayloadAsMethod"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_BOOL(_frameType == AMQP_FRAME_HEADER); - return _propertiesDecoded; -} - -const amqp_bytes_t* const CAmqpFrame::getBodyFragment() const { - CAF_CM_FUNCNAME_VALIDATE("getBodyFragment"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_BOOL(_frameType == AMQP_FRAME_BODY); - return &_bodyFragment; -} - -void CAmqpFrame::log( - const std::string& prefix) const { - CAF_CM_FUNCNAME_VALIDATE("log"); - CAF_CM_VALIDATE_STRING(prefix); - - switch (_frameType) { - case AMQP_FRAME_METHOD: - CAF_CM_LOG_DEBUG_VA4( - "%s - type: AMQP_FRAME_METHOD, channel: %d, methodId: 0x%08x, methodName: %s", - prefix.c_str(), _channel, _method.id, - amqp_method_name(_method.id)); - break; - - case AMQP_FRAME_HEADER: - CAF_CM_LOG_DEBUG_VA4( - "%s - type: AMQP_FRAME_HEADER, channel: %d, classId: 0x%04x, bodySize: %d", - prefix.c_str(), _channel, _propertiesClassId, - _propertiesBodySize); - break; - - case AMQP_FRAME_BODY: - CAF_CM_LOG_DEBUG_VA3( - "%s - type: AMQP_FRAME_BODY, channel: %d, bodyLen: %d", - prefix.c_str(), _channel, _bodyFragment.len); -// AmqpCommon::dumpMessageBody(_bodyFragment.bytes, _bodyFragment.len); - break; - - default: - CAF_CM_LOG_ERROR_VA1("Unknown frame type - %d", _frameType); - } -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/CertInfo.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/CertInfo.cpp deleted file mode 100644 index cd031b3de..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/CertInfo.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Created on: May 2, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "amqpClient/api/CertInfo.h" - -using namespace Caf::AmqpClient; - -CertInfo::CertInfo() : - _isInitialized(false), - CAF_CM_INIT_LOG("CertInfo") {} - -CertInfo::~CertInfo() {} - -void CertInfo::initialize( - const std::string& caCertPath, - const std::string& clientCertPath, - const std::string& clientKeyPath) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(caCertPath); - CAF_CM_VALIDATE_STRING(clientCertPath); - CAF_CM_VALIDATE_STRING(clientKeyPath); - - _caCertPath = caCertPath; - _clientCertPath = clientCertPath; - _clientKeyPath = clientKeyPath; - - _isInitialized = true; -} - -std::string CertInfo::getCaCertPath() const { - CAF_CM_FUNCNAME_VALIDATE("getCaCertPath"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _caCertPath; -} - -std::string CertInfo::getClientCertPath() const { - CAF_CM_FUNCNAME_VALIDATE("getClientCertPath"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _clientCertPath; -} - -std::string CertInfo::getClientKeyPath() const { - CAF_CM_FUNCNAME_VALIDATE("getClientKeyPath"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _clientKeyPath; -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/CommandAssembler.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/CommandAssembler.cpp deleted file mode 100644 index 657b6dcfe..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/CommandAssembler.cpp +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Created on: May 9, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ -#include "stdafx.h" - -#include "Memory/DynamicArray/DynamicArrayInc.h" -#include "amqpClient/CAmqpFrame.h" -#include "amqpClient/amqpImpl/IContentHeader.h" -#include "amqpClient/amqpImpl/IMethod.h" -#include "amqpClient/CommandAssembler.h" -#include "Exception/CCafException.h" - -using namespace Caf::AmqpClient; - -CommandAssembler::CommandAssembler() : - _isInitialized(false), - _state(EXPECTING_METHOD), - _remainingBodyBytes(0), - _bodyLength(0), - CAF_CM_INIT("CommandAssembler") { -} - -CommandAssembler::~CommandAssembler() { -} - -void CommandAssembler::init() { - CAF_CM_FUNCNAME_VALIDATE("init"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - _isInitialized = true; -} - -bool CommandAssembler::handleFrame(const SmartPtrCAmqpFrame& frame) { - CAF_CM_FUNCNAME("handleFrame"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_PTR(frame); - - switch (_state) { - case EXPECTING_METHOD: - consumeMethodFrame(frame); - break; - - case EXPECTING_CONTENT_HEADER: - consumeHeaderFrame(frame); - break; - - case EXPECTING_CONTENT_BODY: - consumeBodyFrame(frame); - break; - - default: - CAF_CM_EXCEPTIONEX_VA2( - IllegalStateException, - 0, - "Bad command state [channel=%d][state=%d]", - frame->getChannel(), - _state); - break; - } - return isComplete(); -} - -bool CommandAssembler::isComplete() { - CAF_CM_FUNCNAME_VALIDATE("isComplete"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return (_state == COMPLETE); -} - -SmartPtrIMethod CommandAssembler::getMethod() { - CAF_CM_FUNCNAME_VALIDATE("getMethod"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _method; -} - -SmartPtrCDynamicByteArray CommandAssembler::getContentBody() { - CAF_CM_FUNCNAME_VALIDATE("getContentBody"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return coalesceContentBody(); -} - -SmartPtrIContentHeader CommandAssembler::getContentHeader() { - CAF_CM_FUNCNAME_VALIDATE("getContentHeader"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _contentHeader; -} - -void CommandAssembler::consumeBodyFrame(const SmartPtrCAmqpFrame& frame) { - CAF_CM_FUNCNAME("consumeBodyFrame"); - if (frame->getFrameType() == AMQP_FRAME_BODY) { - const amqp_bytes_t * const fragment = frame->getBodyFragment(); - _remainingBodyBytes -= static_cast(fragment->len); - updateContentBodyState(); - appendBodyFragment(fragment); - } else { - CAF_CM_EXCEPTIONEX_VA1( - AmqpExceptions::UnexpectedFrameException, - 0, - "Expected an AMQP body frame. Received type %d", - frame->getFrameType()); - } -} - -void CommandAssembler::consumeHeaderFrame(const SmartPtrCAmqpFrame& frame) { - CAF_CM_FUNCNAME("consumeHeaderFrame"); - if (frame->getFrameType() == AMQP_FRAME_HEADER) { - _contentHeader = AMQPImpl::headerFromFrame(frame); - _remainingBodyBytes = static_cast(_contentHeader->getBodySize()); - updateContentBodyState(); - } else { - CAF_CM_EXCEPTIONEX_VA1( - AmqpExceptions::UnexpectedFrameException, - 0, - "Expected an AMQP header frame. Received type %d", - frame->getFrameType()); - } -} - -void CommandAssembler::consumeMethodFrame(const SmartPtrCAmqpFrame& frame) { - CAF_CM_FUNCNAME("consumeMethodFrame"); - if (frame->getFrameType() == AMQP_FRAME_METHOD) { - _method = AMQPImpl::methodFromFrame(frame->getPayloadAsMethod()); - _state = _method->hasContent() ? EXPECTING_CONTENT_HEADER : COMPLETE; - } else { - CAF_CM_EXCEPTIONEX_VA1( - AmqpExceptions::UnexpectedFrameException, - 0, - "Expected an AMQP method frame. Received type %d", - frame->getFrameType()); - } -} - -void CommandAssembler::updateContentBodyState() { - _state = (_remainingBodyBytes > 0) ? EXPECTING_CONTENT_BODY : COMPLETE; -} - -void CommandAssembler::appendBodyFragment(const amqp_bytes_t * const fragment) { - if (fragment && fragment->len) { - SmartPtrCDynamicByteArray fragmentData; - fragmentData.CreateInstance(); - fragmentData->allocateBytes(fragment->len); - fragmentData->memCpy(fragment->bytes, fragment->len); - _bodyCollection.push_back(fragmentData); - _bodyLength += static_cast(fragment->len); - } -} - -SmartPtrCDynamicByteArray CommandAssembler::coalesceContentBody() { - SmartPtrCDynamicByteArray body; - body.CreateInstance(); - if (_bodyLength) { - if (_bodyCollection.size() == 1) { - body = _bodyCollection.front(); - } else { - body->allocateBytes(_bodyLength); - for (TSmartIterator fragment(_bodyCollection); - fragment; - fragment++) { - body->memAppend(fragment->getPtr(), fragment->getByteCount()); - *fragment = NULL; - } - } - _bodyCollection.clear(); - _bodyCollection.push_back(body); - } - return body; -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/ConnectionFactoryImpl.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/ConnectionFactoryImpl.cpp deleted file mode 100644 index b4782b3c0..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/ConnectionFactoryImpl.cpp +++ /dev/null @@ -1,214 +0,0 @@ -/* - * Created on: May 2, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "amqpClient/AMQConnection.h" -#include "amqpClient/api/Address.h" -#include "amqpClient/api/CertInfo.h" -#include "amqpClient/api/Connection.h" -#include "amqpClient/api/ConnectionFactory.h" -#include "amqpClient/ConnectionFactoryImpl.h" - -using namespace Caf::AmqpClient; - -SmartPtrConnectionFactory AMQPCLIENT_LINKAGE Caf::AmqpClient::createConnectionFactory() { - SmartPtrConnectionFactoryImpl factory; - factory.CreateInstance(); - return factory; -} - -ConnectionFactoryImpl::ConnectionFactoryImpl() : - _protocol(DEFAULT_PROTOCOL), - _host(DEFAULT_HOST), - _port(USE_DEFAULT_PORT), - _virtualHost(DEFAULT_VHOST), - _username(DEFAULT_USER), - _password(DEFAULT_PASS), - _requestedChannelMax(DEFAULT_CHANNEL_MAX), - _requestedFrameMax(DEFAULT_FRAME_MAX), - _requestedHeartbeat(DEFAULT_HEARTBEAT), - _connectionTimeout(DEFAULT_CONNECTION_TIMEOUT), - _consumerThreadCount(DEFAULT_CONSUMER_THREAD_COUNT), - _retries(DEFAULT_CONNECTION_RETRIES), - _secondsToWait(DEFAULT_CONNECTION_SECONDS_TO_WAIT), - CAF_CM_INIT("ConnectionFactoryImpl") { -} - -ConnectionFactoryImpl::~ConnectionFactoryImpl() { -} - -std::string ConnectionFactoryImpl::getProtocol() const { - return _protocol; -} - -void ConnectionFactoryImpl::setProtocol(const std::string& protocol) { - _protocol = protocol; -} - -std::string ConnectionFactoryImpl::getHost() const { - return _host; -} - -void ConnectionFactoryImpl::setHost(const std::string& host) { - _host = host; -} - -uint32 ConnectionFactoryImpl::getPort() const { - return portOrDefault(_port); -} - -void ConnectionFactoryImpl::setPort(const uint32 port) { - _port = port; -} - -std::string ConnectionFactoryImpl::getVirtualHost() const { - return _virtualHost; -} - -void ConnectionFactoryImpl::setVirtualHost(const std::string& virtualHost) { - _virtualHost = virtualHost; -} - -std::string ConnectionFactoryImpl::getUsername() const { - return _username; -} - -void ConnectionFactoryImpl::setUsername(const std::string& username) { - _username = username; -} - -std::string ConnectionFactoryImpl::getPassword() const { - return _password; -} - -void ConnectionFactoryImpl::setPassword(const std::string& password) { - _password = password; -} - -std::string ConnectionFactoryImpl::getCaCertPath() const { - return _caCertPath; -} - -void ConnectionFactoryImpl::setCaCertPath(const std::string& caCertPath) { - _caCertPath = caCertPath; -} - -std::string ConnectionFactoryImpl::getClientCertPath() const { - return _clientCertPath; -} - -void ConnectionFactoryImpl::setClientCertPath(const std::string& clientCertPath) { - _clientCertPath = clientCertPath; -} - -std::string ConnectionFactoryImpl::getClientKeyPath() const { - return _clientKeyPath; -} - -void ConnectionFactoryImpl::setClientKeyPath(const std::string& clientKeyPath) { - _clientKeyPath = clientKeyPath; -} - -uint32 ConnectionFactoryImpl::getRequestedChannelMax() const { - return _requestedChannelMax; -} - -void ConnectionFactoryImpl::setRequestedChannelMax(const uint32 requestedChannelMax) { - _requestedChannelMax = requestedChannelMax; -} - -uint32 ConnectionFactoryImpl::getRequestedFrameMax() const { - return _requestedFrameMax; -} - -void ConnectionFactoryImpl::setRequestedFrameMax(const uint32 requestedFrameMax) { - _requestedFrameMax = requestedFrameMax; -} - -uint32 ConnectionFactoryImpl::getRequestedHeartbeat() const { - return _requestedHeartbeat; -} - -void ConnectionFactoryImpl::setRequestedHeartbeat(const uint32 requestedHeartbeat) { - _requestedHeartbeat = requestedHeartbeat; -} - -uint32 ConnectionFactoryImpl::getConnectionTimeout() const { - return _connectionTimeout; -} - -void ConnectionFactoryImpl::setConnectionTimeout(const uint32 connectionTimeout) { - _connectionTimeout = connectionTimeout; -} - -uint32 ConnectionFactoryImpl::getConsumerThreadCount() const { - return _consumerThreadCount; -} - -void ConnectionFactoryImpl::setConsumerThreadCount(const uint32 threadCount) { - CAF_CM_FUNCNAME_VALIDATE("setConsumerThreadCount"); - CAF_CM_VALIDATE_NOTZERO(threadCount); - _consumerThreadCount = threadCount; -} - -uint16 ConnectionFactoryImpl::getRetries() const { - return _retries; -} - -void ConnectionFactoryImpl::setRetries(const uint16 retries) { - _retries = retries; -} - -uint16 ConnectionFactoryImpl::getSecondsToWait() const { - return _secondsToWait; -} - -void ConnectionFactoryImpl::setSecondsToWait(const uint16 seconds) { - _secondsToWait = seconds; -} - -SmartPtrConnection ConnectionFactoryImpl::newConnection() { - SmartPtrAddress address; - address.CreateInstance(); - address->initialize(getProtocol(), getHost(), getPort(), getVirtualHost()); - - SmartPtrCertInfo certInfo; - if (! getCaCertPath().empty() && - ! getClientCertPath().empty() && - ! getClientKeyPath().empty()) { - certInfo.CreateInstance(); - certInfo->initialize(getCaCertPath(), getClientCertPath(), getClientKeyPath()); - } - - return newConnection(address, certInfo); -} - -SmartPtrConnection ConnectionFactoryImpl::newConnection( - const SmartPtrAddress& address, - const SmartPtrCertInfo& certInfo) { - SmartPtrAMQConnection conn; - conn.CreateInstance(); - conn->init( - _username, - _password, - address, - certInfo, - _requestedFrameMax, - _requestedChannelMax, - _requestedHeartbeat, - _connectionTimeout, - _consumerThreadCount, - _retries, - _secondsToWait); - conn->start(); - return conn; -} - -uint32 ConnectionFactoryImpl::portOrDefault(const uint32 port) const { - return (USE_DEFAULT_PORT == port) ? DEFAULT_AMQP_PORT : port; -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/ConnectionWeakReference.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/ConnectionWeakReference.cpp deleted file mode 100644 index cac13c682..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/ConnectionWeakReference.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Created on: May 7, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "amqpClient/CAmqpChannel.h" -#include "amqpClient/ConnectionWeakReference.h" -#include "Exception/CCafException.h" - -using namespace Caf::AmqpClient; - -ConnectionWeakReference::ConnectionWeakReference() : - _connection(NULL), - CAF_CM_INIT("ConnectionWeakReference") { - CAF_CM_INIT_THREADSAFE; -} - -ConnectionWeakReference::~ConnectionWeakReference() { -} - -void ConnectionWeakReference::setReference(IConnectionInt* connection) { - CAF_CM_FUNCNAME_VALIDATE("setReference"); - CAF_CM_VALIDATE_PTR(connection); - CAF_CM_LOCK_UNLOCK; - _connection = connection; -} - -void ConnectionWeakReference::clearReference() { - CAF_CM_LOCK_UNLOCK; - _connection = NULL; -} - -AMQPStatus ConnectionWeakReference::amqpConnectionOpenChannel(SmartPtrCAmqpChannel& channel) { - CAF_CM_FUNCNAME("amqpConnectionOpenChannel"); - CAF_CM_LOCK_UNLOCK; - AMQPStatus status = AMQP_ERROR_OK; - if (_connection) { - status = _connection->amqpConnectionOpenChannel(channel); - } else { - CAF_CM_EXCEPTIONEX_VA0( - NullPointerException, - 0, - "The weak reference is not set"); - } - return status; -} - -void ConnectionWeakReference::notifyChannelClosedByServer(const uint16 channelNumber) { - CAF_CM_FUNCNAME("notifyChannelClosedByServer"); - CAF_CM_LOCK_UNLOCK; - if (_connection) { - _connection->notifyChannelClosedByServer(channelNumber); - } else { - CAF_CM_EXCEPTIONEX_VA0( - NullPointerException, - 0, - "The weak reference is not set"); - } -} - -void ConnectionWeakReference::channelCloseChannel(Channel *channel) { - // It's okay for the weak reference to be unset in this call - if (_connection) { - _connection->channelCloseChannel(channel); - } -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/ConsumerDispatcher.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/ConsumerDispatcher.cpp deleted file mode 100644 index bb30fb631..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/ConsumerDispatcher.cpp +++ /dev/null @@ -1,341 +0,0 @@ -/* - * Created on: May 21, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "amqpClient/amqpImpl/BasicProperties.h" -#include "Memory/DynamicArray/DynamicArrayInc.h" -#include "amqpClient/ConsumerWorkService.h" -#include "amqpClient/api/Consumer.h" -#include "amqpClient/api/Envelope.h" -#include "amqpClient/ConsumerDispatcher.h" -#include "Exception/CCafException.h" - -using namespace Caf::AmqpClient; - -ConsumerDispatcher::ConsumerDispatcher() : - _isInitialized(false), - _isShuttingDown(false), - CAF_CM_INIT_LOG("ConsumerDispatcher") { - CAF_CM_INIT_THREADSAFE; -} - -ConsumerDispatcher::~ConsumerDispatcher() { -} - -void ConsumerDispatcher::init(const SmartPtrConsumerWorkService& workService) { - CAF_CM_FUNCNAME_VALIDATE("init"); - CAF_CM_LOCK_UNLOCK; - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_SMARTPTR(workService); - _workService = workService; - _isInitialized = true; -} - -void ConsumerDispatcher::quiesce() { - CAF_CM_LOCK_UNLOCK; - _isShuttingDown = true; -} - -void ConsumerDispatcher::lock() { - CAF_CM_LOCK; -} - -void ConsumerDispatcher::unlock() { - CAF_CM_UNLOCK; -} - -void ConsumerDispatcher::addConsumer( - const std::string& consumerTag, - const SmartPtrConsumer& consumer) { - CAF_CM_FUNCNAME("addConsumer"); - CAF_CM_LOCK_UNLOCK; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(consumerTag); - CAF_CM_VALIDATE_SMARTPTR(consumer); - - SmartPtrDispatcherTask consumerTask; - consumerTask.CreateInstance(); - consumerTask->init(consumerTag, consumer); - if (_consumers.insert( - ConsumerMap::value_type( - consumerTag, - ConsumerItem(consumer, consumerTask))).second) { - _workService->addWork(consumerTask); - } else { - CAF_CM_EXCEPTIONEX_VA1( - DuplicateElementException, - 0, - "A consumer with consumer tag '%s' is already registered", - consumerTag.c_str()); - } -} - -void ConsumerDispatcher::removeConsumer( - const std::string& consumerTag) { - CAF_CM_FUNCNAME_VALIDATE("removeConsumer"); - CAF_CM_LOCK_UNLOCK; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(consumerTag); - - ConsumerMap::iterator consumer = _consumers.find(consumerTag); - if (consumer != _consumers.end()) { - (consumer->second).second->term(); - _consumers.erase(consumer); - } -} - -SmartPtrConsumer ConsumerDispatcher::getConsumer( - const std::string& consumerTag) { - CAF_CM_FUNCNAME_VALIDATE("getConsumer"); - CAF_CM_LOCK_UNLOCK; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(consumerTag); - SmartPtrConsumer result; - ConsumerMap::iterator consumer = _consumers.find(consumerTag); - if (consumer != _consumers.end()) { - result = (consumer->second).first; - } - return result; -} - -void ConsumerDispatcher::handleShutdown(SmartPtrCCafException exception) { - CAF_CM_FUNCNAME("handleShutdown"); - CAF_CM_LOCK_UNLOCK; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - for (TMapIterator consumerItem(_consumers); - consumerItem; - consumerItem++) { - try { - consumerItem->second->term(); - consumerItem->first->handleShutdown(consumerItem.getKey(), exception); - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_CLEAREXCEPTION; - } - _consumers.clear(); -} - -void ConsumerDispatcher::handleConsumeOk(const std::string& consumerTag) { - CAF_CM_FUNCNAME("handleConsumeOk"); - CAF_CM_LOCK_UNLOCK; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - try { - if (!_isShuttingDown) { - SmartPtrDispatcherWorkItem workItem; - workItem.CreateInstance(); - workItem->init(DISPATCH_ITEM_METHOD_HANDLE_CONSUME_OK); - getConsumerItem(consumerTag).second->addWorkItem(workItem); - } - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_THROWEXCEPTION; -} - -void ConsumerDispatcher::handleCancelOk(const std::string& consumerTag) { - CAF_CM_FUNCNAME("handleCancelOk"); - CAF_CM_LOCK_UNLOCK; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - try { - if (!_isShuttingDown) { - SmartPtrDispatcherWorkItem workItem; - workItem.CreateInstance(); - workItem->init(DISPATCH_ITEM_METHOD_HANDLE_CANCEL_OK); - getConsumerItem(consumerTag).second->addWorkItem(workItem); - } - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_THROWEXCEPTION; -} - -void ConsumerDispatcher::handleRecoverOk() { - CAF_CM_FUNCNAME("handleRecoverOk"); - CAF_CM_LOCK_UNLOCK; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - try { - if (!_isShuttingDown) { - for (TMapIterator consumerItem(_consumers); - consumerItem; - consumerItem++) { - if (!_isShuttingDown) { - SmartPtrDispatcherWorkItem workItem; - workItem.CreateInstance(); - workItem->init(DISPATCH_ITEM_METHOD_HANDLE_RECOVER_OK); - consumerItem->second->addWorkItem(workItem); - } - } - } - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_THROWEXCEPTION; -} - -void ConsumerDispatcher::handleDelivery( - const std::string& consumerTag, - const SmartPtrEnvelope& envelope, - const AmqpContentHeaders::SmartPtrBasicProperties& properties, - const SmartPtrCDynamicByteArray& body) { - CAF_CM_FUNCNAME("handleDelivery"); - CAF_CM_LOCK_UNLOCK; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - try { - if (!_isShuttingDown) { - SmartPtrDispatcherWorkItem workItem; - workItem.CreateInstance(); - workItem->init( - DISPATCH_ITEM_METHOD_HANDLE_DELIVERY, - envelope, - properties, - body); - getConsumerItem(consumerTag).second->addWorkItem(workItem); - } - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_THROWEXCEPTION; -} - -ConsumerDispatcher::ConsumerItem ConsumerDispatcher::getConsumerItem(const std::string& consumerTag) { - CAF_CM_FUNCNAME("getConsumerItem"); - ConsumerMap::const_iterator consumerItem = _consumers.find(consumerTag); - if (consumerItem == _consumers.end()) { - CAF_CM_EXCEPTIONEX_VA1( - NoSuchElementException, - 0, - "Consumer '%s' is not in the collection", - consumerTag.c_str()); - } - return consumerItem->second; -} - -#if (1) // DispatcherWorkItem -ConsumerDispatcher::DispatcherWorkItem::DispatcherWorkItem() : - _method(DISPATCH_ITEM_METHOD_TERMINATE) { -} - -void ConsumerDispatcher::DispatcherWorkItem::init( - const DispatchItemMethod method) { - _method = method; -} - -void ConsumerDispatcher::DispatcherWorkItem::init( - const DispatchItemMethod method, - const SmartPtrEnvelope& envelope, - const AmqpContentHeaders::SmartPtrBasicProperties& properties, - const SmartPtrCDynamicByteArray& body) { - _method = method; - _envelope = envelope; - _properties = properties; - _body = body; -} - -ConsumerDispatcher::DispatchItemMethod ConsumerDispatcher::DispatcherWorkItem::getMethod() const { - return _method; -} - -SmartPtrEnvelope ConsumerDispatcher::DispatcherWorkItem::getEnvelope() const { - return _envelope; -} - -AmqpContentHeaders::SmartPtrBasicProperties ConsumerDispatcher::DispatcherWorkItem::getProperties() const { - return _properties; -} - -SmartPtrCDynamicByteArray ConsumerDispatcher::DispatcherWorkItem::getBody() const { - return _body; -} -#endif - -#if (1) // DispatcherTask -ConsumerDispatcher::DispatcherTask::DispatcherTask() : - _workItemQueue(NULL) { -} - -ConsumerDispatcher::DispatcherTask::~DispatcherTask() { - if (_workItemQueue) { - g_async_queue_unref(_workItemQueue); - } -} - -void ConsumerDispatcher::DispatcherTask::init( - const std::string& consumerTag, - const SmartPtrConsumer& consumer) { - _consumerTag = consumerTag; - _consumer = consumer; - _workItemQueue = g_async_queue_new_full(FreeWorkItem); -} - -void ConsumerDispatcher::DispatcherTask::term() { - SmartPtrDispatcherWorkItem workItem; - workItem.CreateInstance(); - workItem->init(DISPATCH_ITEM_METHOD_TERMINATE); - addWorkItem(workItem); -} - -void ConsumerDispatcher::DispatcherTask::addWorkItem( - const ConsumerDispatcher::SmartPtrDispatcherWorkItem& workItem) { - g_async_queue_push(_workItemQueue, workItem.GetAddRefedInterface()); -} - -bool ConsumerDispatcher::DispatcherTask::run() { - uint32 itemsProcessed = 0; - bool isTerminated = false; - - gpointer data = g_async_queue_try_pop(_workItemQueue); - while (data) { - DispatcherWorkItem *workItemPtr = - reinterpret_cast(data); - SmartPtrDispatcherWorkItem workItem(workItemPtr); - workItemPtr->Release(); - data = NULL; - - switch (workItem->getMethod()) { - case DISPATCH_ITEM_METHOD_HANDLE_CONSUME_OK: - _consumer->handleConsumeOk(_consumerTag); - break; - - case DISPATCH_ITEM_METHOD_HANDLE_CANCEL_OK: - _consumer->handleCancelOk(_consumerTag); - break; - - case DISPATCH_ITEM_METHOD_HANDLE_RECOVER_OK: - _consumer->handleRecoverOk(_consumerTag); - break; - - case DISPATCH_ITEM_METHOD_HANDLE_DELIVERY: - _consumer->handleDelivery( - _consumerTag, - workItemPtr->getEnvelope(), - workItemPtr->getProperties(), - workItemPtr->getBody()); - break; - - case DISPATCH_ITEM_METHOD_TERMINATE: - isTerminated = true; - break; - } - - if (!isTerminated && (++itemsProcessed < DEFAULT_CONSUMER_THREAD_MAX_DELIVERY_COUNT)) { - data = g_async_queue_try_pop(_workItemQueue); - } - } - - return isTerminated; -} - -void ConsumerDispatcher::DispatcherTask::FreeWorkItem(gpointer data) { - CAF_CM_STATIC_FUNC_LOG_ONLY("ConsumerDispatcher::DispatcherTask","FreeWorkItem"); - DispatcherWorkItem *workItemPtr = - reinterpret_cast(data); - CAF_CM_LOG_DEBUG_VA1("Clearing workItem [method=%d]", workItemPtr->getMethod()); - workItemPtr->Release(); -} -#endif diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/ConsumerWorkService.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/ConsumerWorkService.cpp deleted file mode 100644 index f5533596a..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/ConsumerWorkService.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Created on: May 9, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Common/CManagedThreadPool.h" -#include "amqpClient/ConsumerWorkService.h" - -using namespace Caf::AmqpClient; - -ConsumerWorkService::ConsumerWorkService() : - _isInitialized(false), - CAF_CM_INIT_LOG("ConsumerWorkService") { -} - -ConsumerWorkService::~ConsumerWorkService() { - CAF_CM_FUNCNAME("~ConsumerWorkService"); - try { - if (_threadPool) { - _threadPool->term(); - } - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_CLEAREXCEPTION; -} - -void ConsumerWorkService::init(const SmartPtrCManagedThreadPool& threadPool) { - CAF_CM_FUNCNAME_VALIDATE("init"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_threadPool); - _threadPool = threadPool; -} - -void ConsumerWorkService::addWork(const CManagedThreadPool::SmartPtrIThreadTask& task) { - CAF_CM_FUNCNAME_VALIDATE("addWork"); - CAF_CM_PRECOND_ISINITIALIZED(_threadPool); - _threadPool->enqueue(task); -} - -void ConsumerWorkService::notifyConnectionClosed() { - if (!_threadPool.IsNull()) { - _threadPool->term(); - _threadPool = NULL; - } -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpClient.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpClient.cpp deleted file mode 100644 index 1792279d1..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpClient.cpp +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Created on: May 2, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "amqpClient/api/amqpClient.h" - -namespace Caf { -namespace AmqpClient { - const char* DEFAULT_USER = "guest"; - const char* DEFAULT_PASS ="guest"; - const char* DEFAULT_VHOST = "/"; - const char* DEFAULT_PROTOCOL = "amqp"; - const char* DEFAULT_HOST = "localhost"; -}} - -#ifdef WIN32 -extern "C" BOOL APIENTRY DllMain(HINSTANCE hModule, uint32 dwReason, LPVOID) -{ - return TRUE; -} -#endif - -/** - * @todo Make number of frames processed per thread slice configurable - * @todo Make # threads in the connection thrad pool configurable - * @todo Make thread pool refresh rate configurable - * @todo Create stats module so we can figure out how to turn performance - */ -class amqpClientTodo { -}; diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/AMQExceptions.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/AMQExceptions.cpp deleted file mode 100644 index fbf74bde0..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/AMQExceptions.cpp +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Created on: May 3, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "amqpClient/api/AMQExceptions.h" - -using namespace Caf::AmqpClient::AmqpExceptions; - -AMQP_CM_DEFINE_EXCEPTION_CLASS(AmqpException); -AMQP_CM_DEFINE_EXCEPTION_CLASS(AmqpTimeoutException); -AMQP_CM_DEFINE_EXCEPTION_CLASS(AmqpNoMemoryException); -AMQP_CM_DEFINE_EXCEPTION_CLASS(AmqpInvalidHandleException); -AMQP_CM_DEFINE_EXCEPTION_CLASS(AmqpInvalidArgumentException); -AMQP_CM_DEFINE_EXCEPTION_CLASS(AmqpWrongStateException); -AMQP_CM_DEFINE_EXCEPTION_CLASS(AmqpTooManyChannelsException); -AMQP_CM_DEFINE_EXCEPTION_CLASS(AmqpQueueFullException); -AMQP_CM_DEFINE_EXCEPTION_CLASS(AmqpFrameTooLargeException); -AMQP_CM_DEFINE_EXCEPTION_CLASS(AmqpIoErrorException); -AMQP_CM_DEFINE_EXCEPTION_CLASS(AmqpProtocolErrorException); -AMQP_CM_DEFINE_EXCEPTION_CLASS(AmqpUnimplementedException); -AMQP_CM_DEFINE_EXCEPTION_CLASS(AmqpIoInterruptedException); -AMQP_CM_DEFINE_EXCEPTION_CLASS(UnexpectedFrameException); -AMQP_CM_DEFINE_EXCEPTION_CLASS(UnknownClassOrMethodException); -AMQP_CM_DEFINE_EXCEPTION_CLASS(ConnectionClosedException); -AMQP_CM_DEFINE_EXCEPTION_CLASS(ChannelClosedException); -AMQP_CM_DEFINE_EXCEPTION_CLASS(ConnectionUnexpectedCloseException); -AMQP_CM_DEFINE_EXCEPTION_CLASS(ConnectionClosedByIOException); -AMQP_CM_DEFINE_EXCEPTION_CLASS(ChannelClosedByServerException); -AMQP_CM_DEFINE_EXCEPTION_CLASS(ChannelClosedByShutdownException); -AMQP_CM_DEFINE_EXCEPTION_CLASS(ChannelClosedByUserException); diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/AMQPImpl.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/AMQPImpl.cpp deleted file mode 100644 index f4abf6f6a..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/AMQPImpl.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Created on: May 10, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "amqpClient/amqpImpl/BasicProperties.h" -#include "amqpClient/CAmqpFrame.h" -#include "amqpClient/amqpImpl/IContentHeader.h" -#include "amqpClient/amqpImpl/IMethod.h" -#include "Exception/CCafException.h" -#include "AMQPImpl.h" -#include "amqpImplInt.h" - -namespace Caf { namespace AmqpClient { -typedef Caf::AmqpClient::SmartPtrIMethod (*FN_CREATOR)(); -typedef std::map MethodCreatorMap; -typedef MethodCreatorMap::value_type creatorEntry; -}} - -using namespace Caf::AmqpClient; - -const creatorEntry creatorEntries[] = { - creatorEntry(AMQP_BASIC_GET_OK_METHOD, BasicGetOkMethod::Creator), - creatorEntry(AMQP_BASIC_GET_EMPTY_METHOD, BasicGetEmptyMethod::Creator), - creatorEntry(AMQP_BASIC_CONSUME_OK_METHOD, BasicConsumeOkMethod::Creator), - creatorEntry(AMQP_BASIC_DELIVER_METHOD, BasicDeliverMethod::Creator), - creatorEntry(AMQP_BASIC_CANCEL_OK_METHOD, BasicCancelOkMethod::Creator), - creatorEntry(AMQP_BASIC_RETURN_METHOD, BasicReturnMethod::Creator), - creatorEntry(AMQP_BASIC_RECOVER_OK_METHOD, BasicRecoverOkMethod::Creator), - creatorEntry(AMQP_BASIC_QOS_OK_METHOD, BasicQosOkMethod::Creator), - creatorEntry(AMQP_CHANNEL_OPEN_OK_METHOD, ChannelOpenOkMethod::Creator), - creatorEntry(AMQP_CHANNEL_CLOSE_OK_METHOD, ChannelCloseOkFromServerMethod::Creator), - creatorEntry(AMQP_CHANNEL_CLOSE_METHOD, ChannelCloseMethod::Creator), - creatorEntry(AMQP_EXCHANGE_DECLARE_OK_METHOD, ExchangeDeclareOkMethod::Creator), - creatorEntry(AMQP_EXCHANGE_DELETE_OK_METHOD, ExchangeDeleteOkMethod::Creator), - creatorEntry(AMQP_QUEUE_DECLARE_OK_METHOD, QueueDeclareOkMethod::Creator), - creatorEntry(AMQP_QUEUE_DELETE_OK_METHOD, QueueDeleteOkMethod::Creator), - creatorEntry(AMQP_QUEUE_PURGE_OK_METHOD, QueuePurgeOkMethod::Creator), - creatorEntry(AMQP_QUEUE_BIND_OK_METHOD, QueueBindOkMethod::Creator), - creatorEntry(AMQP_QUEUE_UNBIND_OK_METHOD, QueueUnbindOkMethod::Creator) - }; - -const MethodCreatorMap creatorMap( - creatorEntries, - creatorEntries + (sizeof(creatorEntries)/sizeof(creatorEntries[0]))); - -SmartPtrIMethod AMQPImpl::methodFromFrame(const amqp_method_t * const method) { - CAF_CM_STATIC_FUNC("AMQPImpl", "methodFromFrame"); - CAF_CM_VALIDATE_PTR(method); - - SmartPtrIMethod methodObj; - MethodCreatorMap::const_iterator methodCreator = creatorMap.find(method->id); - if (methodCreator != creatorMap.end()) { - methodObj = (*(methodCreator->second))(); - } else { - const uint16 classId = (uint16)((method->id & 0xffff0000) >> 16); - const uint16 methodId = (uint16)(method->id & 0x0000ffff); - CAF_CM_EXCEPTIONEX_VA2( - AmqpExceptions::UnknownClassOrMethodException, - 0, - "[class=0x%04X][id=0x%04X]", - classId, - methodId); - } - methodObj->init(method); - return methodObj; -} - -SmartPtrIContentHeader AMQPImpl::headerFromFrame( - const SmartPtrCAmqpFrame& frame) { - CAF_CM_STATIC_FUNC("AMQPImpl", "headerFromFrame"); - CAF_CM_VALIDATE_PTR(frame); - - SmartPtrIContentHeader header; - if (frame->getHeaderClassId() == AMQP_BASIC_CLASS) { - SmartPtrBasicProperties propsObj; - propsObj.CreateInstance(); - propsObj->init(frame); - header = propsObj; - } else { - CAF_CM_EXCEPTIONEX_VA1( - AmqpExceptions::UnknownClassOrMethodException, - 0, - "[class=0x%04X]", - frame->getHeaderClassId()); - } - - return header; -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/AMQPImpl.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/AMQPImpl.h deleted file mode 100644 index 274727588..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/AMQPImpl.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Created on: May 10, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AMQPIMPL_H_ -#define AMQPIMPL_H_ - - -#include "amqpClient/amqpImpl/IContentHeader.h" -#include "amqpClient/amqpImpl/IMethod.h" - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApiImpl - * @remark LIBRARY IMPLEMENTATION - NOT PART OF THE PUBLIC API - * @brief A set of helpers to convert c-api data structures into C++ objects - */ -class AMQPImpl { -public: - /** - * @brief Convert a c-api method structure into the appropriate IMethod object - * @param method c-api method data - * @return IMethod object - */ - static SmartPtrIMethod methodFromFrame(const amqp_method_t * const method); - - /** - * @brief Convert a c-api properties structure into the appropriate IContentHedaer object - * @param properties c-api properties data - * @return IContentHeader object - */ - static SmartPtrIContentHeader headerFromFrame(const SmartPtrCAmqpFrame& frame); -}; - -}} - -#endif /* AMQPIMPL_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/AmqpClientImpl.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/AmqpClientImpl.cpp deleted file mode 100644 index d3b25d282..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/AmqpClientImpl.cpp +++ /dev/null @@ -1,181 +0,0 @@ -/* - * Created on: May 16, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "amqpClient/amqpImpl/FieldImpl.h" -#include "amqpClient/api/amqpClient.h" -#include "Exception/CCafException.h" - -using namespace Caf; -using namespace Caf::AmqpClient; - -void tableAddField( - const std::string key, - const AmqpClient::Field::AmqpFieldType type, - GVariant* variant, - AmqpClient::SmartPtrTable& table) { - CAF_CM_STATIC_FUNC_LOG("AmqpClient", "tableAddField"); - CAF_CM_VALIDATE_STRING(key); - CAF_CM_VALIDATE_PTR(variant); - CAF_CM_VALIDATE_SMARTPTR(table); - - AmqpClient::SmartPtrFieldImpl field; - field.CreateInstance(); - field->setTypeAndValue(type, variant); - if (!table->insert(std::make_pair(key, field)).second) { - g_variant_unref(variant); - CAF_CM_EXCEPTIONEX_VA1( - DuplicateElementException, - 0, - "Duplicate table entry '%s'", - key.c_str()); - } -} - -void AmqpClient::tableAddBoolean( - const std::string key, - const bool val, - SmartPtrTable& table) { - tableAddField( - key, - AmqpClient::Field::AMQP_FIELD_TYPE_BOOLEAN, - g_variant_new_boolean(val), - table); -} - -void AmqpClient::tableAddInt8( - const std::string key, - const int8 val, - SmartPtrTable& table) { - tableAddField( - key, - AmqpClient::Field::AMQP_FIELD_TYPE_I8, - g_variant_new_byte(val), - table); -} - -void AmqpClient::tableAddUint8( - const std::string key, - const uint8 val, - SmartPtrTable& table) { - tableAddField( - key, - AmqpClient::Field::AMQP_FIELD_TYPE_U8, - g_variant_new_byte(val), - table); -} - -void AmqpClient::tableAddInt16( - const std::string key, - const int16 val, - SmartPtrTable& table) { - tableAddField( - key, - AmqpClient::Field::AMQP_FIELD_TYPE_I16, - g_variant_new_int16(val), - table); -} - -void AmqpClient::tableAddUint16( - const std::string key, - const uint16 val, - SmartPtrTable& table) { - tableAddField( - key, - AmqpClient::Field::AMQP_FIELD_TYPE_U16, - g_variant_new_uint16(val), - table); -} - -void AmqpClient::tableAddInt32( - const std::string key, - const int32 val, - SmartPtrTable& table) { - tableAddField( - key, - AmqpClient::Field::AMQP_FIELD_TYPE_I32, - g_variant_new_int32(val), - table); -} - -void AmqpClient::tableAddUint32( - const std::string key, - const uint32 val, - SmartPtrTable& table) { - tableAddField( - key, - AmqpClient::Field::AMQP_FIELD_TYPE_U32, - g_variant_new_uint32(val), - table); -} - -void AmqpClient::tableAddInt64( - const std::string key, - const int64 val, - SmartPtrTable& table) { - tableAddField( - key, - AmqpClient::Field::AMQP_FIELD_TYPE_I64, - g_variant_new_int64(val), - table); -} - -void AmqpClient::tableAddUint64( - const std::string key, - const uint64 val, - SmartPtrTable& table) { - tableAddField( - key, - AmqpClient::Field::AMQP_FIELD_TYPE_U64, - g_variant_new_uint64(val), - table); -} - -void AmqpClient::tableAddFloat( - const std::string key, - const float val, - SmartPtrTable& table) { - tableAddField( - key, - AmqpClient::Field::AMQP_FIELD_TYPE_F32, - g_variant_new_double(val), - table); -} - -void AmqpClient::tableAddDouble( - const std::string key, - const double val, - SmartPtrTable& table) { - tableAddField( - key, - AmqpClient::Field::AMQP_FIELD_TYPE_F64, - g_variant_new_double(val), - table); -} - -void AmqpClient::tableAddUtf8( - const std::string key, - const std::string& val, - SmartPtrTable& table) { - tableAddField( - key, - AmqpClient::Field::AMQP_FIELD_TYPE_UTF8, - g_variant_new_string(val.c_str()), - table); -} - -void AmqpClient::tableAddTimestamp( - const std::string key, - const uint64 val, - SmartPtrTable& table) { - tableAddField( - key, - AmqpClient::Field::AMQP_FIELD_TYPE_TIMESTAMP, - g_variant_new_uint64(val), - table); -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/AmqpContentHeadersImpl.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/AmqpContentHeadersImpl.cpp deleted file mode 100644 index 0fc59888c..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/AmqpContentHeadersImpl.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Created on: May 15, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "amqpClient/amqpImpl/BasicProperties.h" -#include "amqpClient/api/amqpClient.h" - -using namespace Caf::AmqpClient; - -const uint32 AmqpContentHeaders::BASIC_PROPERTY_CONTENT_TYPE_FLAG = 0x8000; -const uint32 AmqpContentHeaders::BASIC_PROPERTY_CONTENT_ENCODING_FLAG = 0x4000; -const uint32 AmqpContentHeaders::BASIC_PROPERTY_HEADERS_FLAG = 0x2000; -const uint32 AmqpContentHeaders::BASIC_PROPERTY_DEVLIVERY_MODE_FLAG = 0x1000; -const uint32 AmqpContentHeaders::BASIC_PROPERTY_PRIORITY_FLAG = 0x800; -const uint32 AmqpContentHeaders::BASIC_PROPERTY_CORRELATION_ID_FLAG = 0x400; -const uint32 AmqpContentHeaders::BASIC_PROPERTY_REPLY_TO_FLAG = 0x200; -const uint32 AmqpContentHeaders::BASIC_PROPERTY_EXPIRATION_FLAG = 0x100; -const uint32 AmqpContentHeaders::BASIC_PROPERTY_MESSAGE_ID_FLAG = 0x80; -const uint32 AmqpContentHeaders::BASIC_PROPERTY_TIMESTAMP_FLAG = 0x40; -const uint32 AmqpContentHeaders::BASIC_PROPERTY_TYPE_FLAG = 0x20; -const uint32 AmqpContentHeaders::BASIC_PROPERTY_USER_ID_FLAG = 0x10; -const uint32 AmqpContentHeaders::BASIC_PROPERTY_APP_ID_FLAG = 0x8; -const uint32 AmqpContentHeaders::BASIC_PROPERTY_CLUSTER_ID_FLAG = 0x4; - -AmqpContentHeaders::SmartPtrBasicProperties AmqpContentHeaders::createBasicProperties() { - Caf::AmqpClient::SmartPtrBasicProperties props; - props.CreateInstance(); - props->init(); - SmartPtrBasicProperties result; - result.QueryInterface(props); - return result; -} - -AmqpContentHeaders::SmartPtrBasicProperties AmqpContentHeaders::createBasicProperties( - const uint32 flags, - const std::string& contentType, - const std::string& contentEncoding, - const SmartPtrTable& headers, - const uint8 deliveryMode, - const uint8 priority, - const std::string& correlationId, - const std::string& replyTo, - const std::string& expiration, - const std::string& messageId, - const uint64 timestamp, - const std::string& type, - const std::string& userId, - const std::string& appId, - const std::string& clusterId) { - Caf::AmqpClient::SmartPtrBasicProperties props; - props.CreateInstance(); - props->init( - flags, - contentType, - contentEncoding, - headers, - deliveryMode, - priority, - correlationId, - replyTo, - expiration, - messageId, - timestamp, - type, - userId, - appId, - clusterId); - SmartPtrBasicProperties result; - result.QueryInterface(props); - return result; -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicAckMethod.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicAckMethod.cpp deleted file mode 100644 index 41e0b4353..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicAckMethod.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Created on: May 16, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "amqpClient/CAmqpChannel.h" -#include "amqpClient/amqpImpl/BasicAckMethod.h" - -using namespace Caf::AmqpClient; - -BasicAckMethod::BasicAckMethod() : - _isInitialized(false), - _deliveryTag(0), - _ackMultiple(false), - CAF_CM_INIT("BasicAckMethod") { -} - -BasicAckMethod::~BasicAckMethod() { -} - -void BasicAckMethod::init( - const uint64 deliveryTag, - const bool ackMultiple) { - CAF_CM_FUNCNAME_VALIDATE("init"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - _deliveryTag = deliveryTag; - _ackMultiple = ackMultiple; - _isInitialized = true; -} - -std::string BasicAckMethod::getMethodName() const { - return "basic.ack"; -} - -AMQPStatus BasicAckMethod::send(const SmartPtrCAmqpChannel& channel) { - CAF_CM_FUNCNAME_VALIDATE("send"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return AmqpUtil::AMQP_BasicAck( - channel, - _deliveryTag, - _ackMultiple); -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicCancelMethod.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicCancelMethod.cpp deleted file mode 100644 index d860d9acf..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicCancelMethod.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Created on: May 21, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "amqpClient/CAmqpChannel.h" -#include "amqpClient/amqpImpl/BasicCancelMethod.h" - -using namespace Caf::AmqpClient; - -BasicCancelMethod::BasicCancelMethod() : - _isInitialized(false), - CAF_CM_INIT("BasicCancelMethod") { -} - -BasicCancelMethod::~BasicCancelMethod() { -} - -void BasicCancelMethod::init( - const std::string& consumerTag) { - CAF_CM_FUNCNAME_VALIDATE("init"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - - _consumerTag = consumerTag; - _isInitialized = true; -} - -std::string BasicCancelMethod::getMethodName() const { - return "basic.cancel"; -} - -AMQPStatus BasicCancelMethod::send(const SmartPtrCAmqpChannel& channel) { - CAF_CM_FUNCNAME_VALIDATE("send"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return AmqpUtil::AMQP_BasicCancel(channel, _consumerTag, false); -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicCancelOkMethod.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicCancelOkMethod.cpp deleted file mode 100644 index 2f224ee1b..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicCancelOkMethod.cpp +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Created on: May 21, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "BasicCancelOkMethod.h" - -using namespace Caf::AmqpClient; - -BasicCancelOkMethod::BasicCancelOkMethod() : - CAF_CM_INIT("BasicCancelOkMethod") { -} - -BasicCancelOkMethod::~BasicCancelOkMethod() { -} - -void BasicCancelOkMethod::init(const amqp_method_t * const method) { - CAF_CM_FUNCNAME("init"); - CAF_CM_VALIDATE_PTR(method); - CAF_CM_ASSERT(AMQP_BASIC_CANCEL_OK_METHOD == method->id); - const amqp_basic_cancel_ok_t * const decoded = - reinterpret_cast(method->decoded); - _consumerTag = AMQUtil::amqpBytesToString(&decoded->consumer_tag); -} - -std::string BasicCancelOkMethod::getConsumerTag() { - return _consumerTag; -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicCancelOkMethod.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicCancelOkMethod.h deleted file mode 100644 index 0288a01a2..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicCancelOkMethod.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Created on: May 21, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef BASICCANCELOKMETHOD_H_ -#define BASICCANCELOKMETHOD_H_ - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApiImpl - * @remark LIBRARY IMPLEMENTATION - NOT PART OF THE PUBLIC API - * @brief Implementation of AMQP basic.cancel-ok - */ -class BasicCancelOkMethod : - public TMethodImpl, - public AmqpMethods::Basic::CancelOk { - METHOD_DECL( - AmqpMethods::Basic::CancelOk, - AMQP_BASIC_CANCEL_OK_METHOD, - "basic.cancel-ok", - false) - -public: - BasicCancelOkMethod(); - virtual ~BasicCancelOkMethod(); - -public: // IMethod - void init(const amqp_method_t * const method); - -public: // AmqpMethods::Basic::CancelOk - std::string getConsumerTag(); - -private: - std::string _consumerTag; - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(BasicCancelOkMethod); -}; -CAF_DECLARE_SMART_QI_POINTER(BasicCancelOkMethod); - -}} - -#endif /* BASICCANCELOKMETHOD_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicConsumeMethod.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicConsumeMethod.cpp deleted file mode 100644 index 55063d545..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicConsumeMethod.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Created on: May 21, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "amqpClient/CAmqpChannel.h" -#include "amqpClient/api/amqpClient.h" -#include "amqpClient/amqpImpl/BasicConsumeMethod.h" - -using namespace Caf::AmqpClient; - -BasicConsumeMethod::BasicConsumeMethod() : - _isInitialized(false), - _noLocal(false), - _noAck(false), - _exclusive(false), - CAF_CM_INIT("BasicConsumeMethod") { -} - -BasicConsumeMethod::~BasicConsumeMethod() { -} - -void BasicConsumeMethod::init( - const std::string& queue, - const std::string& consumerTag, - const bool noLocal, - const bool noAck, - const bool exclusive, - const SmartPtrTable& arguments) { - CAF_CM_FUNCNAME_VALIDATE("init"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - _queue = queue; - _consumerTag = consumerTag; - _noLocal = noLocal; - _noAck = noAck; - _exclusive = exclusive; - _isInitialized = true; -} - -std::string BasicConsumeMethod::getMethodName() const { - return "basic.consume"; -} - -AMQPStatus BasicConsumeMethod::send(const SmartPtrCAmqpChannel& channel) { - CAF_CM_FUNCNAME_VALIDATE("send"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return AmqpUtil::AMQP_BasicConsume( - channel, - _queue, - _consumerTag, - _noLocal, - _noAck, - _exclusive, - false, - NULL); -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicConsumeOkMethod.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicConsumeOkMethod.cpp deleted file mode 100644 index f0ce92314..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicConsumeOkMethod.cpp +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Created on: May 21, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "BasicConsumeOkMethod.h" - -using namespace Caf::AmqpClient; - -BasicConsumeOkMethod::BasicConsumeOkMethod() : - CAF_CM_INIT("BasicConsumeOkMethod") { -} - -BasicConsumeOkMethod::~BasicConsumeOkMethod() { -} - -void BasicConsumeOkMethod::init(const amqp_method_t * const method) { - CAF_CM_FUNCNAME("init"); - CAF_CM_VALIDATE_PTR(method); - CAF_CM_ASSERT(AMQP_BASIC_CONSUME_OK_METHOD == method->id); - const amqp_basic_consume_ok_t * const decoded = - reinterpret_cast(method->decoded); - _consumerTag = AMQUtil::amqpBytesToString(&decoded->consumer_tag); -} - -std::string BasicConsumeOkMethod::getConsumerTag() { - return _consumerTag; -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicConsumeOkMethod.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicConsumeOkMethod.h deleted file mode 100644 index 569d2fba4..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicConsumeOkMethod.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Created on: May 21, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef BASICCONSUMEOKMETHOD_H_ -#define BASICCONSUMEOKMETHOD_H_ - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApiImpl - * @remark LIBRARY IMPLEMENTATION - NOT PART OF THE PUBLIC API - * @brief Implementation of AMQP basic.consume-ok - */ -class BasicConsumeOkMethod : - public TMethodImpl, - public AmqpMethods::Basic::ConsumeOk { - METHOD_DECL( - AmqpMethods::Basic::ConsumeOk, - AMQP_BASIC_CONSUME_OK_METHOD, - "basic.consume-ok", - false) - -public: - BasicConsumeOkMethod(); - virtual ~BasicConsumeOkMethod(); - -public: // IMethod - void init(const amqp_method_t * const method); - -public: // AmqpMethods::Basic::ConsumeOk - std::string getConsumerTag(); - -private: - std::string _consumerTag; - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(BasicConsumeOkMethod); -}; -CAF_DECLARE_SMART_QI_POINTER(BasicConsumeOkMethod); - -}} - -#endif /* BASICCONSUMEOKMETHOD_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicDeliverMethod.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicDeliverMethod.cpp deleted file mode 100644 index 78148ee6c..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicDeliverMethod.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Created on: May 21, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "BasicDeliverMethod.h" - -using namespace Caf::AmqpClient; - -BasicDeliverMethod::BasicDeliverMethod() : - _deliveryTag(0), - _redelivered(false), - CAF_CM_INIT("BasicDeliverMethod") { -} - -BasicDeliverMethod::~BasicDeliverMethod() { -} - -void BasicDeliverMethod::init(const amqp_method_t * const method) { - CAF_CM_FUNCNAME("init"); - CAF_CM_VALIDATE_PTR(method); - CAF_CM_ASSERT(AMQP_BASIC_DELIVER_METHOD == method->id); - const amqp_basic_deliver_t * const decoded = - reinterpret_cast(method->decoded); - _consumerTag = AMQUtil::amqpBytesToString(&decoded->consumer_tag); - _deliveryTag = decoded->delivery_tag; - _exchange = AMQUtil::amqpBytesToString(&decoded->exchange); - _redelivered = decoded->redelivered; - _routingKey = AMQUtil::amqpBytesToString(&decoded->routing_key); -} - -std::string BasicDeliverMethod::getConsumerTag() { - return _consumerTag; -} - -uint64 BasicDeliverMethod::getDeliveryTag() { - return _deliveryTag; -} - -std::string BasicDeliverMethod::getExchange() { - return _exchange; -} - -bool BasicDeliverMethod::getRedelivered() { - return _redelivered; -} - -std::string BasicDeliverMethod::getRoutingKey() { - return _routingKey; -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicDeliverMethod.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicDeliverMethod.h deleted file mode 100644 index 415dce072..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicDeliverMethod.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Created on: May 21, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef BASICDELIVERMETHOD_H_ -#define BASICDELIVERMETHOD_H_ - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApiImpl - * @remark LIBRARY IMPLEMENTATION - NOT PART OF THE PUBLIC API - * @brief Implementation of AMQP basic.deliver - */ -class BasicDeliverMethod : - public TMethodImpl, - public AmqpMethods::Basic::Deliver { - METHOD_DECL( - AmqpMethods::Basic::Deliver, - AMQP_BASIC_DELIVER_METHOD, - "basic.deliver", - true) - -public: - BasicDeliverMethod(); - virtual ~BasicDeliverMethod(); - -public: // IMethod - void init(const amqp_method_t * const method); - -public: // AmqpMethods::Basic::Deliver - std::string getConsumerTag(); - uint64 getDeliveryTag(); - std::string getExchange(); - bool getRedelivered(); - std::string getRoutingKey(); - -private: - std::string _consumerTag; - uint64 _deliveryTag; - std::string _exchange; - bool _redelivered; - std::string _routingKey; - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(BasicDeliverMethod); -}; -CAF_DECLARE_SMART_QI_POINTER(BasicDeliverMethod); - -}} - -#endif /* BASICDELIVERMETHOD_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicGetEmptyMethod.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicGetEmptyMethod.cpp deleted file mode 100644 index c4a805fd4..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicGetEmptyMethod.cpp +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Created on: May 16, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "BasicGetEmptyMethod.h" - -using namespace Caf::AmqpClient; - -BasicGetEmptyMethod::BasicGetEmptyMethod() : - CAF_CM_INIT("BasicGetEmptyMethod") { -} - -BasicGetEmptyMethod::~BasicGetEmptyMethod() { -} - -void BasicGetEmptyMethod::init(const amqp_method_t * const method) { - CAF_CM_FUNCNAME("init"); - CAF_CM_VALIDATE_PTR(method); - CAF_CM_ASSERT(AMQP_BASIC_GET_EMPTY_METHOD == method->id); -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicGetEmptyMethod.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicGetEmptyMethod.h deleted file mode 100644 index f9bfeb527..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicGetEmptyMethod.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Created on: May 16, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef BASICGETEMPTYMETHOD_H_ -#define BASICGETEMPTYMETHOD_H_ - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApiImpl - * @remark LIBRARY IMPLEMENTATION - NOT PART OF THE PUBLIC API - * @brief Implementation of AMQP basic.get-empty - */ -class BasicGetEmptyMethod : - public TMethodImpl, - public AmqpMethods::Basic::GetEmpty { - METHOD_DECL( - AmqpMethods::Basic::GetEmpty, - AMQP_BASIC_GET_EMPTY_METHOD, - "basic.get-empty", - false) - -public: - BasicGetEmptyMethod(); - virtual ~BasicGetEmptyMethod(); - -public: // IMethod - void init(const amqp_method_t * const method); - -public: // AmqpMethods::Basic::GetEmpty - -private: - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(BasicGetEmptyMethod); -}; -CAF_DECLARE_SMART_QI_POINTER(BasicGetEmptyMethod); - -}} - -#endif /* BASICGETEMPTYMETHOD_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicGetMethod.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicGetMethod.cpp deleted file mode 100644 index 47d981b66..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicGetMethod.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Created on: May 16, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "amqpClient/CAmqpChannel.h" -#include "amqpClient/amqpImpl/BasicGetMethod.h" - -using namespace Caf::AmqpClient; - -BasicGetMethod::BasicGetMethod() : - _isInitialized(false), - _noAck(false), - CAF_CM_INIT("BasicGetMethod") { -} - -BasicGetMethod::~BasicGetMethod() { -} - -void BasicGetMethod::init( - const std::string& queue, - const bool noAck) { - CAF_CM_FUNCNAME_VALIDATE("init"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - - _queue = queue; - _noAck = noAck; - _isInitialized = true; -} - -std::string BasicGetMethod::getMethodName() const { - return "basic.get"; -} - -AMQPStatus BasicGetMethod::send(const SmartPtrCAmqpChannel& channel) { - CAF_CM_FUNCNAME_VALIDATE("send"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return AmqpUtil::AMQP_BasicGet(channel, _queue, _noAck); -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicGetOkMethod.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicGetOkMethod.cpp deleted file mode 100644 index 29081e379..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicGetOkMethod.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Created on: May 11, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "BasicGetOkMethod.h" - -using namespace Caf::AmqpClient; - -BasicGetOkMethod::BasicGetOkMethod() : - _deliveryTag(0), - _messageCount(0), - _redelivered(false), - CAF_CM_INIT("BasicGetOkMethod") { -} - -BasicGetOkMethod::~BasicGetOkMethod() { -} - -void BasicGetOkMethod::init(const amqp_method_t * const method) { - CAF_CM_FUNCNAME("init"); - CAF_CM_VALIDATE_PTR(method); - CAF_CM_ASSERT(AMQP_BASIC_GET_OK_METHOD == method->id); - const amqp_basic_get_ok_t * const decoded = - reinterpret_cast(method->decoded); - _deliveryTag = decoded->delivery_tag; - _exchange = AMQUtil::amqpBytesToString(&decoded->exchange); - _messageCount = decoded->message_count; - _redelivered = decoded->redelivered; - _routingKey = AMQUtil::amqpBytesToString(&decoded->routing_key); -} - -uint64 BasicGetOkMethod::getDeliveryTag() { - return _deliveryTag; -} - -std::string BasicGetOkMethod::getExchange() { - return _exchange; -} - -uint32 BasicGetOkMethod::getMessageCount() { - return _messageCount; -} - -bool BasicGetOkMethod::getRedelivered() { - return _redelivered; -} - -std::string BasicGetOkMethod::getRoutingKey() { - return _routingKey; -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicGetOkMethod.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicGetOkMethod.h deleted file mode 100644 index a41e981cb..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicGetOkMethod.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Created on: May 11, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef BASICGETOKMETHOD_H_ -#define BASICGETOKMETHOD_H_ - -#include "amqpClient/api/AmqpMethods.h" - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApiImpl - * @remark LIBRARY IMPLEMENTATION - NOT PART OF THE PUBLIC API - * @brief Implementation of AMQP basic.get-ok - */ -class BasicGetOkMethod : - public TMethodImpl, - public AmqpMethods::Basic::GetOk { - METHOD_DECL( - AmqpMethods::Basic::GetOk, - AMQP_BASIC_GET_OK_METHOD, - "basic.get-ok", - true) - -public: - BasicGetOkMethod(); - virtual ~BasicGetOkMethod(); - -public: // IMethod - void init(const amqp_method_t * const method); - -public: // AmqpMethods::Basic::GetOk - uint64 getDeliveryTag(); - std::string getExchange(); - uint32 getMessageCount(); - bool getRedelivered(); - std::string getRoutingKey(); - -private: - uint64 _deliveryTag; - std::string _exchange; - uint32 _messageCount; - bool _redelivered; - std::string _routingKey; - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(BasicGetOkMethod); -}; -CAF_DECLARE_SMART_QI_POINTER(BasicGetOkMethod); - -}} - -#endif /* BASICGETOKMETHOD_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicProperties.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicProperties.cpp deleted file mode 100644 index f0da9da5d..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicProperties.cpp +++ /dev/null @@ -1,488 +0,0 @@ -/* - * Created on: May 11, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "amqpClient/CAmqpFrame.h" -#include "amqpClient/api/amqpClient.h" -#include "Exception/CCafException.h" -#include "amqpClient/amqpImpl/BasicProperties.h" - -using namespace Caf::AmqpClient; - -BasicProperties::BasicProperties() : - _isInitialized(false), - _flags(0), - _bodySize(0), - _deliveryMode(0), - _priority(0), - _timestamp(0), - CAF_CM_INIT("BasicProperties") { -} - -BasicProperties::~BasicProperties() { -} - -void BasicProperties::init() { - _isInitialized = true; -} - -void BasicProperties::init( - const uint32 flags, - const std::string& contentType, - const std::string& contentEncoding, - const SmartPtrTable& headers, - const uint8 deliveryMode, - const uint8 priority, - const std::string& correlationId, - const std::string& replyTo, - const std::string& expiration, - const std::string& messageId, - const uint64 timestamp, - const std::string& type, - const std::string& userId, - const std::string& appId, - const std::string& clusterId) { - CAF_CM_FUNCNAME_VALIDATE("init"); - - _flags = flags; - if (flags & AmqpContentHeaders::BASIC_PROPERTY_CONTENT_TYPE_FLAG) { - CAF_CM_VALIDATE_STRING(contentType); - _contentType = contentType; - } - if (flags & AmqpContentHeaders::BASIC_PROPERTY_CONTENT_ENCODING_FLAG) { - CAF_CM_VALIDATE_STRING(contentEncoding); - _contentEncoding = contentEncoding; - } - if (flags & AmqpContentHeaders::BASIC_PROPERTY_HEADERS_FLAG) { - CAF_CM_VALIDATE_SMARTPTR(headers); - _headers = headers; - } - if (flags & AmqpContentHeaders::BASIC_PROPERTY_DEVLIVERY_MODE_FLAG) { - _deliveryMode = deliveryMode; - } - if (flags & AmqpContentHeaders::BASIC_PROPERTY_PRIORITY_FLAG) { - _priority = priority; - } - if (flags & AmqpContentHeaders::BASIC_PROPERTY_CORRELATION_ID_FLAG) { - _correlationId = correlationId; - } - if (flags & AmqpContentHeaders::BASIC_PROPERTY_REPLY_TO_FLAG) { - _replyTo = replyTo; - } - if (flags & AmqpContentHeaders::BASIC_PROPERTY_EXPIRATION_FLAG) { - _expiration = expiration; - } - if (flags & AmqpContentHeaders::BASIC_PROPERTY_MESSAGE_ID_FLAG) { - _messageId = messageId; - } - if (flags & AmqpContentHeaders::BASIC_PROPERTY_TIMESTAMP_FLAG) { - _timestamp = timestamp; - } - if (flags & AmqpContentHeaders::BASIC_PROPERTY_TYPE_FLAG) { - _type = type; - } - if (flags & AmqpContentHeaders::BASIC_PROPERTY_USER_ID_FLAG) { - _userId = userId; - } - if (flags & AmqpContentHeaders::BASIC_PROPERTY_APP_ID_FLAG) { - _appId = appId; - } - if (flags & AmqpContentHeaders::BASIC_PROPERTY_CLUSTER_ID_FLAG) { - _clusterId = clusterId; - } - _isInitialized = true; -} - -void BasicProperties::init(const SmartPtrCAmqpFrame& frame) { - CAF_CM_FUNCNAME("init"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_PTR(frame); - - if (frame->getFrameType() != AMQP_FRAME_HEADER) { - CAF_CM_EXCEPTIONEX_VA1( - AmqpExceptions::UnexpectedFrameException, - 0, - "Expected an AMQP header frame. Received type %d", - frame->getFrameType()); - } - - if (frame->getHeaderClassId() != AMQP_BASIC_CLASS) { - CAF_CM_EXCEPTIONEX_VA1( - AmqpExceptions::UnknownClassOrMethodException, - 0, - "[class=0x%04X]", - frame->getHeaderClassId()); - } - - const amqp_basic_properties_t * const decoded = frame->getHeaderProperties(); - _bodySize = frame->getHeaderBodySize(); - const amqp_flags_t flags = decoded->_flags; - - if (flags & AMQP_BASIC_CONTENT_TYPE_FLAG) { - _contentType = AMQUtil::amqpBytesToString(&decoded->content_type); - _flags |= AmqpContentHeaders::BASIC_PROPERTY_CONTENT_TYPE_FLAG; - } - if (flags & AMQP_BASIC_CONTENT_ENCODING_FLAG) { - _contentEncoding = AMQUtil::amqpBytesToString(&decoded->content_encoding); - _flags |= AmqpContentHeaders::BASIC_PROPERTY_CONTENT_ENCODING_FLAG; - } - if (flags & AMQP_BASIC_HEADERS_FLAG) { - _headers = AMQUtil::amqpApiTableToTableObj(&decoded->headers); - _flags |= AmqpContentHeaders::BASIC_PROPERTY_HEADERS_FLAG; - } - if (flags & AMQP_BASIC_DELIVERY_MODE_FLAG) { - _deliveryMode = decoded->delivery_mode; - _flags |= AmqpContentHeaders::BASIC_PROPERTY_DEVLIVERY_MODE_FLAG; - } - if (flags & AMQP_BASIC_PRIORITY_FLAG) { - _priority = decoded->priority; - _flags |= AmqpContentHeaders::BASIC_PROPERTY_PRIORITY_FLAG; - } - if (flags & AMQP_BASIC_CORRELATION_ID_FLAG) { - _correlationId = AMQUtil::amqpBytesToString(&decoded->correlation_id); - _flags |= AmqpContentHeaders::BASIC_PROPERTY_CORRELATION_ID_FLAG; - } - if (flags & AMQP_BASIC_REPLY_TO_FLAG) { - _replyTo = AMQUtil::amqpBytesToString(&decoded->reply_to); - _flags |= AmqpContentHeaders::BASIC_PROPERTY_REPLY_TO_FLAG; - } - if (flags & AMQP_BASIC_EXPIRATION_FLAG) { - _expiration = AMQUtil::amqpBytesToString(&decoded->expiration); - _flags |= AmqpContentHeaders::BASIC_PROPERTY_EXPIRATION_FLAG; - } - if (flags & AMQP_BASIC_MESSAGE_ID_FLAG) { - _messageId = AMQUtil::amqpBytesToString(&decoded->message_id); - _flags |= AmqpContentHeaders::BASIC_PROPERTY_MESSAGE_ID_FLAG; - } - if (flags & AMQP_BASIC_TIMESTAMP_FLAG) { - _timestamp = decoded->timestamp; - _flags |= AmqpContentHeaders::BASIC_PROPERTY_TIMESTAMP_FLAG; - } - if (flags & AMQP_BASIC_TYPE_FLAG) { - _type = AMQUtil::amqpBytesToString(&decoded->type); - _flags |= AmqpContentHeaders::BASIC_PROPERTY_TYPE_FLAG; - } - if (flags & AMQP_BASIC_USER_ID_FLAG) { - _userId = AMQUtil::amqpBytesToString(&decoded->user_id); - _flags |= AmqpContentHeaders::BASIC_PROPERTY_USER_ID_FLAG; - } - if (flags & AMQP_BASIC_APP_ID_FLAG) { - _appId = AMQUtil::amqpBytesToString(&decoded->app_id); - _flags |= AmqpContentHeaders::BASIC_PROPERTY_APP_ID_FLAG; - } - if (flags & AMQP_BASIC_CLUSTER_ID_FLAG) { - _clusterId = AMQUtil::amqpBytesToString(&decoded->cluster_id); - _flags |= AmqpContentHeaders::BASIC_PROPERTY_CLUSTER_ID_FLAG; - } - _isInitialized = true; -} - -bool BasicProperties::areHeadersAvailable() { - return (_flags & AmqpContentHeaders::BASIC_PROPERTY_HEADERS_FLAG); -} - -void BasicProperties::getAsApiProperties(amqp_basic_properties_t& properties) { - CAF_CM_FUNCNAME_VALIDATE("getAsApiProperties"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - memset(&properties, 0, sizeof(properties)); - if (_flags & AmqpContentHeaders::BASIC_PROPERTY_CONTENT_TYPE_FLAG) { - properties.content_type.len = _contentType.length(); - properties.content_type.bytes = const_cast(_contentType.c_str()); - properties._flags |= AMQP_BASIC_CONTENT_TYPE_FLAG; - } - if (_flags & AmqpContentHeaders::BASIC_PROPERTY_CONTENT_ENCODING_FLAG) { - properties.content_encoding.len = _contentEncoding.length(); - properties.content_encoding.bytes = const_cast(_contentEncoding.c_str()); - properties._flags |= AMQP_BASIC_CONTENT_ENCODING_FLAG; - } - if (_flags & AmqpContentHeaders::BASIC_PROPERTY_HEADERS_FLAG) { - AMQUtil::amqpTableObjToApiTable(_headers, properties.headers); - properties._flags |= AMQP_BASIC_HEADERS_FLAG; - } - if (_flags & AmqpContentHeaders::BASIC_PROPERTY_DEVLIVERY_MODE_FLAG) { - properties.delivery_mode = _deliveryMode; - properties._flags |= AMQP_BASIC_DELIVERY_MODE_FLAG; - } - if (_flags & AmqpContentHeaders::BASIC_PROPERTY_PRIORITY_FLAG) { - properties.priority = _priority; - properties._flags |= AMQP_BASIC_PRIORITY_FLAG; - } - if (_flags & AmqpContentHeaders::BASIC_PROPERTY_CORRELATION_ID_FLAG) { - properties.correlation_id.len = _correlationId.length(); - properties.correlation_id.bytes = const_cast(_correlationId.c_str()); - properties._flags |= AMQP_BASIC_CORRELATION_ID_FLAG; - } - if (_flags & AmqpContentHeaders::BASIC_PROPERTY_REPLY_TO_FLAG) { - properties.reply_to.len = _replyTo.length(); - properties.reply_to.bytes = const_cast(_replyTo.c_str()); - properties._flags |= AMQP_BASIC_REPLY_TO_FLAG; - } - if (_flags & AmqpContentHeaders::BASIC_PROPERTY_EXPIRATION_FLAG) { - properties.expiration.len = _expiration.length(); - properties.expiration.bytes = const_cast(_expiration.c_str()); - properties._flags |= AMQP_BASIC_EXPIRATION_FLAG; - } - if (_flags & AmqpContentHeaders::BASIC_PROPERTY_MESSAGE_ID_FLAG) { - properties.message_id.len = _messageId.length(); - properties.message_id.bytes = const_cast(_messageId.c_str()); - properties._flags |= AMQP_BASIC_MESSAGE_ID_FLAG; - } - if (_flags & AmqpContentHeaders::BASIC_PROPERTY_TIMESTAMP_FLAG) { - properties.timestamp = _timestamp; - properties._flags |= AMQP_BASIC_TIMESTAMP_FLAG; - } - if (_flags & AmqpContentHeaders::BASIC_PROPERTY_TYPE_FLAG) { - properties.type.len = _type.length(); - properties.type.bytes = const_cast(_type.c_str()); - properties._flags |= AMQP_BASIC_TYPE_FLAG; - } - if (_flags & AmqpContentHeaders::BASIC_PROPERTY_USER_ID_FLAG) { - properties.user_id.len = _userId.length(); - properties.user_id.bytes = const_cast(_userId.c_str()); - properties._flags |= AMQP_BASIC_USER_ID_FLAG; - } - if (_flags & AmqpContentHeaders::BASIC_PROPERTY_APP_ID_FLAG) { - properties.app_id.len = _appId.length(); - properties.app_id.bytes = const_cast(_appId.c_str()); - properties._flags |= AMQP_BASIC_APP_ID_FLAG; - } - if (_flags & AmqpContentHeaders::BASIC_PROPERTY_CLUSTER_ID_FLAG) { - properties.cluster_id.len = _clusterId.length(); - properties.cluster_id.bytes = const_cast(_clusterId.c_str()); - properties._flags |= AMQP_BASIC_CLUSTER_ID_FLAG; - } -} - -uint16 BasicProperties::getClassId() { - return AMQP_BASIC_CLASS; -} - -std::string BasicProperties::getClassName() { - return "basic"; -} - -uint64 BasicProperties::getBodySize() { - return _bodySize; -} - -uint32 BasicProperties::getFlags() { - CAF_CM_FUNCNAME_VALIDATE("getFlags"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _flags; -} - -std::string BasicProperties::getContentType() { - CAF_CM_FUNCNAME_VALIDATE("getContentType"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - ValidatePropertyIsSet( - AmqpContentHeaders::BASIC_PROPERTY_CONTENT_TYPE_FLAG, - "contentType"); - return _contentType; -} - -std::string BasicProperties::getContentEncoding() { - CAF_CM_FUNCNAME_VALIDATE("getContentType"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - ValidatePropertyIsSet( - AmqpContentHeaders::BASIC_PROPERTY_CONTENT_ENCODING_FLAG, - "contentEncoding"); - return _contentEncoding; -} - -SmartPtrTable BasicProperties::getHeaders() { - CAF_CM_FUNCNAME_VALIDATE("getHeaders"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - ValidatePropertyIsSet( - AmqpContentHeaders::BASIC_PROPERTY_HEADERS_FLAG, - "headers"); - return _headers; -} - -uint8 BasicProperties::getDeliveryMode() { - CAF_CM_FUNCNAME_VALIDATE("getDeliveryMode"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - ValidatePropertyIsSet( - AmqpContentHeaders::BASIC_PROPERTY_DEVLIVERY_MODE_FLAG, - "deliveryMode"); - return _deliveryMode; -} - -uint8 BasicProperties::getPriority() { - CAF_CM_FUNCNAME_VALIDATE("getPriority"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - ValidatePropertyIsSet( - AmqpContentHeaders::BASIC_PROPERTY_PRIORITY_FLAG, - "priority"); - return _priority; -} - -std::string BasicProperties::getCorrelationId() { - CAF_CM_FUNCNAME_VALIDATE("getCorrelationId"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - ValidatePropertyIsSet( - AmqpContentHeaders::BASIC_PROPERTY_CORRELATION_ID_FLAG, - "correlationId"); - return _correlationId; -} - -std::string BasicProperties::getReplyTo() { - CAF_CM_FUNCNAME_VALIDATE("getReplyTo"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - ValidatePropertyIsSet( - AmqpContentHeaders::BASIC_PROPERTY_REPLY_TO_FLAG, - "replyTo"); - return _replyTo; -} - -std::string BasicProperties::getExpiration() { - CAF_CM_FUNCNAME_VALIDATE("getExpiration"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - ValidatePropertyIsSet( - AmqpContentHeaders::BASIC_PROPERTY_EXPIRATION_FLAG, - "expiration"); - return _expiration; -} - -std::string BasicProperties::getMessageId() { - CAF_CM_FUNCNAME_VALIDATE("getMessageId"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - ValidatePropertyIsSet( - AmqpContentHeaders::BASIC_PROPERTY_MESSAGE_ID_FLAG, - "messageId"); - return _messageId; -} - -uint64 BasicProperties::getTimestamp() { - CAF_CM_FUNCNAME_VALIDATE("getTimestamp"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - ValidatePropertyIsSet( - AmqpContentHeaders::BASIC_PROPERTY_TIMESTAMP_FLAG, - "timestamp"); - return _timestamp; -} - -std::string BasicProperties::getType() { - CAF_CM_FUNCNAME_VALIDATE("getType"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - ValidatePropertyIsSet( - AmqpContentHeaders::BASIC_PROPERTY_TYPE_FLAG, - "type"); - return _type; -} - -std::string BasicProperties::getUserId() { - CAF_CM_FUNCNAME_VALIDATE("getUserId"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - ValidatePropertyIsSet( - AmqpContentHeaders::BASIC_PROPERTY_USER_ID_FLAG, - "userId"); - return _userId; -} - -std::string BasicProperties::getAppId() { - CAF_CM_FUNCNAME_VALIDATE("getAppId"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - ValidatePropertyIsSet( - AmqpContentHeaders::BASIC_PROPERTY_APP_ID_FLAG, - "appId"); - return _appId; -} - -std::string BasicProperties::getClusterId() { - CAF_CM_FUNCNAME_VALIDATE("getClusterId"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - ValidatePropertyIsSet( - AmqpContentHeaders::BASIC_PROPERTY_CLUSTER_ID_FLAG, - "clusterId"); - return _clusterId; -} - -void BasicProperties::setContentType(const std::string& contentType) { - _contentType = contentType; - _flags |= AmqpContentHeaders::BASIC_PROPERTY_CONTENT_TYPE_FLAG; -} - -void BasicProperties::setContentEncoding(const std::string& contentEncoding) { - _contentEncoding = contentEncoding; - _flags |= AmqpContentHeaders::BASIC_PROPERTY_CONTENT_ENCODING_FLAG; -} - -void BasicProperties::setHeaders(const SmartPtrTable& headers) { - if (headers) { - _headers = headers; - _flags |= AmqpContentHeaders::BASIC_PROPERTY_HEADERS_FLAG; - } -} - -void BasicProperties::setDeliveryMode(const uint8 deliveryMode) { - _deliveryMode = deliveryMode; - _flags |= AmqpContentHeaders::BASIC_PROPERTY_DEVLIVERY_MODE_FLAG; -} - -void BasicProperties::setPriority(const uint8 priority) { - _priority = priority; - _flags |= AmqpContentHeaders::BASIC_PROPERTY_PRIORITY_FLAG; -} - -void BasicProperties::setCorrelationId(const std::string& correlationId) { - _correlationId = correlationId; - _flags |= AmqpContentHeaders::BASIC_PROPERTY_CORRELATION_ID_FLAG; -} - -void BasicProperties::setReplyTo(const std::string& replyTo) { - _replyTo = replyTo; - _flags |= AmqpContentHeaders::BASIC_PROPERTY_REPLY_TO_FLAG; -} - -void BasicProperties::setExpiration(const std::string& expiration) { - _expiration = expiration; - _flags |= AmqpContentHeaders::BASIC_PROPERTY_EXPIRATION_FLAG; -} - -void BasicProperties::setMessageId(const std::string& messageId) { - _messageId = messageId; - _flags |= AmqpContentHeaders::BASIC_PROPERTY_MESSAGE_ID_FLAG; -} - -void BasicProperties::setTimestamp(const uint64 timestamp) { - _timestamp = timestamp; - _flags |= AmqpContentHeaders::BASIC_PROPERTY_TIMESTAMP_FLAG; -} - -void BasicProperties::setType(const std::string& type) { - _type = type; - _flags |= AmqpContentHeaders::BASIC_PROPERTY_TYPE_FLAG; -} - -void BasicProperties::setUserId(const std::string& userId) { - _userId = userId; - _flags |= AmqpContentHeaders::BASIC_PROPERTY_USER_ID_FLAG; -} - -void BasicProperties::setAppId(const std::string& appId) { - _appId = appId; - _flags |= AmqpContentHeaders::BASIC_PROPERTY_APP_ID_FLAG; -} - -void BasicProperties::setClusterId(const std::string& clusterId) { - _clusterId = clusterId; - _flags |= AmqpContentHeaders::BASIC_PROPERTY_CLUSTER_ID_FLAG; -} - -void BasicProperties::ValidatePropertyIsSet( - const uint32 flag, - const char* propertyName) { - CAF_CM_FUNCNAME("ValidatePropertyIsSet"); - if (!(_flags & flag)) { - CAF_CM_EXCEPTIONEX_VA1( - NoSuchElementException, - 0, - "The property '%s' is not set", - propertyName); - } -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicPublishMethod.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicPublishMethod.cpp deleted file mode 100644 index 634cc03c4..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicPublishMethod.cpp +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Created on: May 15, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "amqpClient/CAmqpChannel.h" -#include "amqpClient/amqpImpl/BasicProperties.h" -#include "Memory/DynamicArray/DynamicArrayInc.h" -#include "amqpClient/amqpImpl/BasicPublishMethod.h" - -using namespace Caf::AmqpClient; - -struct MethodBodyFreeData { - SmartPtrCDynamicByteArray body; -}; - -BasicPublishMethod::BasicPublishMethod() : - _isInitialized(false), - _mandatory(false), - _immediate(false), - CAF_CM_INIT("BasicPublishMethod") { -} - -BasicPublishMethod::~BasicPublishMethod() { -} - -void BasicPublishMethod::init( - const std::string& exchange, - const std::string& routingKey, - bool mandatory, - bool immediate, - const AmqpContentHeaders::SmartPtrBasicProperties& properties, - const SmartPtrCDynamicByteArray& body) { - CAF_CM_FUNCNAME_VALIDATE("init"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - _exchange = exchange; - _routingKey = routingKey; - _mandatory = mandatory; - _immediate = immediate; - _properties = properties; - _body = body; - _isInitialized = true; -} - -std::string BasicPublishMethod::getMethodName() const { - return "basic.publish"; -} - -AMQPStatus BasicPublishMethod::send(const SmartPtrCAmqpChannel& channel) { - CAF_CM_FUNCNAME("send"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - AMQPStatus status = AMQP_ERROR_OK; - - amqp_basic_properties_t properties; - try { - if (_properties) { - SmartPtrBasicProperties propertiesClass; - propertiesClass.QueryInterface(_properties); - propertiesClass->getAsApiProperties(properties); - } else { - memset(&properties, 0, sizeof(properties)); - } - - status = AmqpUtil::AMQP_BasicPublish( - channel, - _exchange, - _routingKey, - _mandatory, - _immediate, - &properties, - _body); - } - CAF_CM_CATCH_ALL; - if (properties.headers.entries) { - AMQUtil::amqpFreeApiTable(&properties.headers); - } - CAF_CM_THROWEXCEPTION; - return status; -} - - - - - - - - - - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicQosMethod.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicQosMethod.cpp deleted file mode 100644 index 79246edc6..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicQosMethod.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Created on: May 22, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "amqpClient/CAmqpChannel.h" -#include "amqpClient/amqpImpl/BasicQosMethod.h" - -using namespace Caf::AmqpClient; - -BasicQosMethod::BasicQosMethod() : - _isInitialized(false), - _prefetchSize(0), - _prefetchCount(0), - _global(false), - CAF_CM_INIT("BasicQosMethod") { -} - -BasicQosMethod::~BasicQosMethod() { -} - -void BasicQosMethod::init( - const uint32 prefetchSize, - const uint16 prefetchCount, - const bool global) { - CAF_CM_FUNCNAME_VALIDATE("init"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - _prefetchSize = prefetchSize; - _prefetchCount = prefetchCount; - _global = global; - _isInitialized = true; -} - -std::string BasicQosMethod::getMethodName() const { - return "basic.qos"; -} - -AMQPStatus BasicQosMethod::send(const SmartPtrCAmqpChannel& channel) { - CAF_CM_FUNCNAME_VALIDATE("send"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return AmqpUtil::AMQP_BasicQos( - channel, - _prefetchSize, - _prefetchCount, - _global); -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicQosOkMethod.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicQosOkMethod.cpp deleted file mode 100644 index 7d57ad382..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicQosOkMethod.cpp +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Created on: May 22, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "BasicQosOkMethod.h" - -using namespace Caf::AmqpClient; - -BasicQosOkMethod::BasicQosOkMethod() : - CAF_CM_INIT("BasicQosOkMethod") { -} - -BasicQosOkMethod::~BasicQosOkMethod() { -} - -void BasicQosOkMethod::init(const amqp_method_t * const method) { - CAF_CM_FUNCNAME("init"); - CAF_CM_VALIDATE_PTR(method); - CAF_CM_ASSERT(AMQP_BASIC_QOS_OK_METHOD == method->id); -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicQosOkMethod.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicQosOkMethod.h deleted file mode 100644 index 9e3b99165..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicQosOkMethod.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Created on: May 22, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef BASICQOSOKMETHOD_H_ -#define BASICQOSOKMETHOD_H_ - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApiImpl - * @remark LIBRARY IMPLEMENTATION - NOT PART OF THE PUBLIC API - * @brief Implementation of AMQP basic.qos-ok - */ -class BasicQosOkMethod : - public TMethodImpl, - public AmqpMethods::Basic::QosOk { - METHOD_DECL( - AmqpMethods::Basic::QosOk, - AMQP_BASIC_QOS_OK_METHOD, - "basic.qos-ok", - false) - -public: - BasicQosOkMethod(); - virtual ~BasicQosOkMethod(); - -public: // IMethod - void init(const amqp_method_t * const method); - -public: // AmqpMethods::Basic::QosOk - -private: - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(BasicQosOkMethod); -}; -CAF_DECLARE_SMART_QI_POINTER(BasicQosOkMethod); - -}} - -#endif /* BASICQOSOKMETHOD_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicRecoverMethod.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicRecoverMethod.cpp deleted file mode 100644 index 98349b36b..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicRecoverMethod.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Created on: May 21, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "amqpClient/CAmqpChannel.h" -#include "amqpClient/amqpImpl/BasicRecoverMethod.h" - -using namespace Caf::AmqpClient; - -BasicRecoverMethod::BasicRecoverMethod() : - _isInitialized(false), - _requeue(false), - CAF_CM_INIT("BasicRecoverMethod") { -} - -BasicRecoverMethod::~BasicRecoverMethod() { -} - -void BasicRecoverMethod::init( - const bool requeue) { - CAF_CM_FUNCNAME_VALIDATE("init"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - _requeue = requeue; - _isInitialized = true; -} - -std::string BasicRecoverMethod::getMethodName() const { - return "basic.recover"; -} - -AMQPStatus BasicRecoverMethod::send(const SmartPtrCAmqpChannel& channel) { - CAF_CM_FUNCNAME_VALIDATE("send"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return AmqpUtil::AMQP_BasicRecover( - channel, - _requeue); -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicRecoverOkMethod.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicRecoverOkMethod.cpp deleted file mode 100644 index b5ceea7e3..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicRecoverOkMethod.cpp +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Created on: May 21, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "BasicRecoverOkMethod.h" - -using namespace Caf::AmqpClient; - -BasicRecoverOkMethod::BasicRecoverOkMethod() : - CAF_CM_INIT("BasicRecoverOkMethod") { -} - -BasicRecoverOkMethod::~BasicRecoverOkMethod() { -} - -void BasicRecoverOkMethod::init(const amqp_method_t * const method) { - CAF_CM_FUNCNAME("init"); - CAF_CM_VALIDATE_PTR(method); - CAF_CM_ASSERT(AMQP_BASIC_RECOVER_OK_METHOD == method->id); -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicRecoverOkMethod.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicRecoverOkMethod.h deleted file mode 100644 index b58eec813..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicRecoverOkMethod.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Created on: May 21, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef BASICRECOVEROKMETHOD_H_ -#define BASICRECOVEROKMETHOD_H_ - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApiImpl - * @remark LIBRARY IMPLEMENTATION - NOT PART OF THE PUBLIC API - * @brief Implementation of AMQP basic.recover-ok - */ -class BasicRecoverOkMethod : - public TMethodImpl, - public AmqpMethods::Basic::RecoverOk { - METHOD_DECL( - AmqpMethods::Basic::RecoverOk, - AMQP_BASIC_RECOVER_OK_METHOD, - "basic.recover-ok", - false) - -public: - BasicRecoverOkMethod(); - virtual ~BasicRecoverOkMethod(); - -public: // IMethod - void init(const amqp_method_t * const method); - -public: // AmqpMethods::Basic::BasicRecoverOk - -private: - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(BasicRecoverOkMethod); -}; -CAF_DECLARE_SMART_QI_POINTER(BasicRecoverOkMethod); - -}} - -#endif /* BASICRECOVEROKMETHOD_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicRejectMethod.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicRejectMethod.cpp deleted file mode 100644 index 429aef42c..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicRejectMethod.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Created on: Aug 1, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "amqpClient/CAmqpChannel.h" -#include "amqpClient/amqpImpl/BasicRejectMethod.h" - -using namespace Caf::AmqpClient; - -BasicRejectMethod::BasicRejectMethod() : - _isInitialized(false), - _deliveryTag(0), - _requeue(false), - CAF_CM_INIT("BasicRejectMethod") { -} - -BasicRejectMethod::~BasicRejectMethod() { -} - -void BasicRejectMethod::init( - const uint64 deliveryTag, - const bool requeue) { - CAF_CM_FUNCNAME_VALIDATE("init"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - _deliveryTag = deliveryTag; - _requeue = requeue; - _isInitialized = true; -} - -std::string BasicRejectMethod::getMethodName() const { - return "basic.Reject"; -} - -AMQPStatus BasicRejectMethod::send(const SmartPtrCAmqpChannel& channel) { - CAF_CM_FUNCNAME_VALIDATE("send"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); -// return AMQP_BasicReject( -// channel, -// _deliveryTag, -// _requeue); - return AMQP_ERROR_UNIMPLEMENTED; -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicReturnMethod.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicReturnMethod.cpp deleted file mode 100644 index 320ae6f59..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicReturnMethod.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Created on: May 21, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "BasicReturnMethod.h" - -using namespace Caf::AmqpClient; - -BasicReturnMethod::BasicReturnMethod() : - _replyCode(0), - CAF_CM_INIT("BasicReturnMethod") { -} - -BasicReturnMethod::~BasicReturnMethod() { -} - -void BasicReturnMethod::init(const amqp_method_t * const method) { - CAF_CM_FUNCNAME("init"); - CAF_CM_VALIDATE_PTR(method); - CAF_CM_ASSERT(AMQP_BASIC_RETURN_METHOD == method->id); - const amqp_basic_return_t * const decoded = - reinterpret_cast(method->decoded); - _replyCode = decoded->reply_code; - _replyText = AMQUtil::amqpBytesToString(&decoded->reply_text); - _exchange = AMQUtil::amqpBytesToString(&decoded->exchange); - _routingKey = AMQUtil::amqpBytesToString(&decoded->routing_key); -} - -uint16 BasicReturnMethod::getReplyCode() { - return _replyCode; -} - -std::string BasicReturnMethod::getReplyText() { - return _replyText; -} - -std::string BasicReturnMethod::getExchange() { - return _exchange; -} - -std::string BasicReturnMethod::getRoutingKey() { - return _routingKey; -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicReturnMethod.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicReturnMethod.h deleted file mode 100644 index dd1f0e4fa..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/BasicReturnMethod.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Created on: May 21, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef BASICRETURNMETHOD_H_ -#define BASICRETURNMETHOD_H_ - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApiImpl - * @remark LIBRARY IMPLEMENTATION - NOT PART OF THE PUBLIC API - * @brief Implementation of AMQP basic.return - */ -class BasicReturnMethod : - public TMethodImpl, - public AmqpMethods::Basic::Return { - METHOD_DECL( - AmqpMethods::Basic::Return, - AMQP_BASIC_RETURN_METHOD, - "basic.return", - true) - -public: - BasicReturnMethod(); - virtual ~BasicReturnMethod(); - -public: // IMethod - void init(const amqp_method_t * const method); - -public: // AmqpMethods::Basic::Return - uint16 getReplyCode(); - std::string getReplyText(); - std::string getExchange(); - std::string getRoutingKey(); - -private: - uint16 _replyCode; - std::string _replyText; - std::string _exchange; - std::string _routingKey; - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(BasicReturnMethod); -}; -CAF_DECLARE_SMART_QI_POINTER(BasicReturnMethod); - -}} - -#endif /* BASICRETURNMETHOD_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/ChannelCloseMethod.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/ChannelCloseMethod.cpp deleted file mode 100644 index 9d5527394..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/ChannelCloseMethod.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Created on: May 17, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "ChannelCloseMethod.h" - -using namespace Caf::AmqpClient; - -ChannelCloseMethod::ChannelCloseMethod() : - _replyCode(0), - _classId(0), - _methodId(0), - CAF_CM_INIT("ChannelCloseMethod") { -} - -ChannelCloseMethod::~ChannelCloseMethod() { -} - -void ChannelCloseMethod::init(const amqp_method_t * const method) { - CAF_CM_FUNCNAME("init"); - CAF_CM_VALIDATE_PTR(method); - CAF_CM_ASSERT(AMQP_CHANNEL_CLOSE_METHOD == method->id); - const amqp_channel_close_t * const decoded = - reinterpret_cast(method->decoded); - _replyCode = decoded->reply_code; - _replyText = AMQUtil::amqpBytesToString(&decoded->reply_text); - _classId = decoded->class_id; - _methodId = decoded->method_id; -} - -uint16 ChannelCloseMethod::getReplyCode() { - return _replyCode; -} - -std::string ChannelCloseMethod::getReplyText() { - return _replyText; -} - -uint16 ChannelCloseMethod::getClassId() { - return _classId; -} - -uint16 ChannelCloseMethod::getMethodId() { - return _methodId; -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/ChannelCloseMethod.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/ChannelCloseMethod.h deleted file mode 100644 index be3d58a3a..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/ChannelCloseMethod.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Created on: May 17, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CHANNELCLOSEMETHOD_H_ -#define CHANNELCLOSEMETHOD_H_ - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApiImpl - * @remark LIBRARY IMPLEMENTATION - NOT PART OF THE PUBLIC API - * @brief Implementaiton of AMQP channel.close - */ -class ChannelCloseMethod : - public TMethodImpl, - public AmqpMethods::Channel::Close { - METHOD_DECL( - AmqpMethods::Channel::Close, - AMQP_CHANNEL_CLOSE_METHOD, - "channel.close", - false) - -public: - ChannelCloseMethod(); - virtual ~ChannelCloseMethod(); - -public: // IMethod - void init(const amqp_method_t * const method); - -public: // AmqpMethods::Channel::Close - uint16 getReplyCode(); - std::string getReplyText(); - uint16 getClassId(); - uint16 getMethodId(); - -private: - uint16 _replyCode; - std::string _replyText; - uint16 _classId; - uint16 _methodId; - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(ChannelCloseMethod); -}; -CAF_DECLARE_SMART_QI_POINTER(ChannelCloseMethod); - -}} - -#endif /* CHANNELCLOSEMETHOD_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/ChannelCloseOkFromServerMethod.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/ChannelCloseOkFromServerMethod.cpp deleted file mode 100644 index 40e7d46af..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/ChannelCloseOkFromServerMethod.cpp +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Created on: May 22, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "ChannelCloseOkFromServerMethod.h" - -using namespace Caf::AmqpClient; - -ChannelCloseOkFromServerMethod::ChannelCloseOkFromServerMethod() : - CAF_CM_INIT("ChannelCloseOkFromServerMethod") { -} - -ChannelCloseOkFromServerMethod::~ChannelCloseOkFromServerMethod() { -} - -void ChannelCloseOkFromServerMethod::init(const amqp_method_t * const method) { - CAF_CM_FUNCNAME("init"); - CAF_CM_VALIDATE_PTR(method); - CAF_CM_ASSERT(AMQP_CHANNEL_CLOSE_OK_METHOD == method->id); -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/ChannelCloseOkFromServerMethod.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/ChannelCloseOkFromServerMethod.h deleted file mode 100644 index f1e33e967..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/ChannelCloseOkFromServerMethod.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Created on: May 22, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CHANNELCLOSEOKFROMSERVERMETHOD_H_ -#define CHANNELCLOSEOKFROMSERVERMETHOD_H_ - -namespace Caf { namespace AmqpClient { -/** - * @author mdonahue - * @ingroup AmqpApiImpl - * @remark LIBRARY IMPLEMENTATION - NOT PART OF THE PUBLIC API - * @brief Implementation of AMQP channel.close-ok (received from server) - */ -class ChannelCloseOkFromServerMethod : - public TMethodImpl, - public AmqpMethods::Channel::CloseOk { - METHOD_DECL( - AmqpMethods::Channel::CloseOk, - AMQP_CHANNEL_CLOSE_OK_METHOD, - "channel.close-ok", - false) - -public: - ChannelCloseOkFromServerMethod(); - virtual ~ChannelCloseOkFromServerMethod(); - -public: // IMethod - void init(const amqp_method_t * const method); - -public: // AmqpMethods::Channel::CloseOk - -private: - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(ChannelCloseOkFromServerMethod); -}; -CAF_DECLARE_SMART_QI_POINTER(ChannelCloseOkFromServerMethod); - -}} - -#endif /* CHANNELCLOSEOKFROMSERVERMETHOD_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/ChannelCloseOkMethod.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/ChannelCloseOkMethod.cpp deleted file mode 100644 index 4f0a61160..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/ChannelCloseOkMethod.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Created on: May 17, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "amqpClient/CAmqpChannel.h" -#include "amqpClient/amqpImpl/ChannelCloseOkMethod.h" - -using namespace Caf::AmqpClient; - -ChannelCloseOkMethod::ChannelCloseOkMethod() : - _isInitialized(false), - CAF_CM_INIT("ChannelCloseOkMethod") { -} - -ChannelCloseOkMethod::~ChannelCloseOkMethod() { -} - -void ChannelCloseOkMethod::init() { - CAF_CM_FUNCNAME_VALIDATE("init"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - _isInitialized = true; -} - -std::string ChannelCloseOkMethod::getMethodName() const { - return "channel.close-ok"; -} - -AMQPStatus ChannelCloseOkMethod::send(const SmartPtrCAmqpChannel& channel) { - CAF_CM_FUNCNAME_VALIDATE("send"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return AmqpChannel::AMQP_ChannelCloseOk(channel); -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/ChannelOpenOkMethod.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/ChannelOpenOkMethod.cpp deleted file mode 100644 index 4eb4dd127..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/ChannelOpenOkMethod.cpp +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Created on: May 10, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Memory/DynamicArray/DynamicArrayInc.h" -#include "ChannelOpenOkMethod.h" - -using namespace Caf::AmqpClient; - -ChannelOpenOkMethod::ChannelOpenOkMethod() : - CAF_CM_INIT("ChannelOpenOkMethod") { -} - -ChannelOpenOkMethod::~ChannelOpenOkMethod() { -} - -void ChannelOpenOkMethod::init(const amqp_method_t * const method) { - CAF_CM_FUNCNAME("init"); - CAF_CM_VALIDATE_PTR(method); - CAF_CM_ASSERT(AMQP_CHANNEL_OPEN_OK_METHOD == method->id); - const amqp_bytes_t * const bytes = - reinterpret_cast(method->decoded); - _channelId.CreateInstance(); - if (bytes->len) { - _channelId->memCpy(bytes->bytes, bytes->len); - } -} - -SmartPtrCDynamicByteArray ChannelOpenOkMethod::getChannelId() { - return _channelId; -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/ChannelOpenOkMethod.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/ChannelOpenOkMethod.h deleted file mode 100644 index dc09de1c2..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/ChannelOpenOkMethod.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Created on: May 10, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CHANNELOPENOKMETHOD_H_ -#define CHANNELOPENOKMETHOD_H_ - - -#include "Memory/DynamicArray/DynamicArrayInc.h" - -namespace Caf { namespace AmqpClient { -/** - * @author mdonahue - * @ingroup AmqpApiImpl - * @remark LIBRARY IMPLEMENTATION - NOT PART OF THE PUBLIC API - * @brief Implementation of AMQP channel.open-ok - */ -class ChannelOpenOkMethod : - public TMethodImpl, - public AmqpMethods::Channel::OpenOk { - METHOD_DECL( - AmqpMethods::Channel::OpenOk, - AMQP_CHANNEL_OPEN_OK_METHOD, - "channel.open-ok", - false) - -public: - ChannelOpenOkMethod(); - virtual ~ChannelOpenOkMethod(); - -public: // IMethod - void init(const amqp_method_t * const method); - -public: // AmqpMethods::Channel::OpenOk - SmartPtrCDynamicByteArray getChannelId(); - -private: - SmartPtrCDynamicByteArray _channelId; - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(ChannelOpenOkMethod); -}; -CAF_DECLARE_SMART_QI_POINTER(ChannelOpenOkMethod); - -}} - -#endif /* CHANNELOPENOKMETHOD_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/EnvelopeImpl.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/EnvelopeImpl.cpp deleted file mode 100644 index c79c427bc..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/EnvelopeImpl.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Created on: May 16, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "amqpClient/amqpImpl/EnvelopeImpl.h" - -using namespace Caf::AmqpClient; - -EnvelopeImpl::EnvelopeImpl() : - _isInitialized(false), - _deliveryTag(0), - _redelivered(false), - CAF_CM_INIT("EnvelopeImpl") { -} - -EnvelopeImpl::~EnvelopeImpl() { -} - -void EnvelopeImpl::init( - const uint64 deliveryTag, - const bool redeliver, - const std::string& exchange, - const std::string& routingKey) { - _deliveryTag = deliveryTag; - _redelivered = redeliver; - _exchange = exchange; - _routingKey = routingKey; - _isInitialized = true; -} - -uint64 EnvelopeImpl::getDeliveryTag() { - CAF_CM_FUNCNAME_VALIDATE("getDeliveryTag"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _deliveryTag; -} - -bool EnvelopeImpl::getRedelivered() { - CAF_CM_FUNCNAME_VALIDATE("getRedelivered"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _redelivered; -} - -std::string EnvelopeImpl::getExchange() { - CAF_CM_FUNCNAME_VALIDATE("getExchange"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _exchange; -} - -std::string EnvelopeImpl::getRoutingKey() { - CAF_CM_FUNCNAME_VALIDATE("getRoutingKey"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _routingKey; -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/ExchangeDeclareMethod.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/ExchangeDeclareMethod.cpp deleted file mode 100644 index 750d21301..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/ExchangeDeclareMethod.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Created on: May 16, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "amqpClient/CAmqpChannel.h" -#include "amqpClient/api/amqpClient.h" -#include "amqpClient/amqpImpl/ExchangeDeclareMethod.h" - -using namespace Caf::AmqpClient; - -ExchangeDeclareMethod::ExchangeDeclareMethod() : - _isInitialized(false), - _passive(false), - _durable(false), - CAF_CM_INIT("ExchangeDeclareMethod") { -} - -ExchangeDeclareMethod::~ExchangeDeclareMethod() { -} - -void ExchangeDeclareMethod::init( - const std::string& exchange, - const std::string& type, - const bool passive, - const bool durable, - const SmartPtrTable& arguments) { - CAF_CM_FUNCNAME_VALIDATE("init"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - - _exchange = exchange; - _type = type; - _passive = false; - _durable = durable; - _isInitialized = true; -} - -std::string ExchangeDeclareMethod::getMethodName() const { - return "exchange.declare"; -} - -AMQPStatus ExchangeDeclareMethod::send(const SmartPtrCAmqpChannel& channel) { - CAF_CM_FUNCNAME_VALIDATE("send"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return AmqpUtil::AMQP_ExchangeDeclare( - channel, - _exchange, - _type, - false, - _durable, - false, - NULL); -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/ExchangeDeclareOkMethod.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/ExchangeDeclareOkMethod.cpp deleted file mode 100644 index 079a96b6e..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/ExchangeDeclareOkMethod.cpp +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Created on: May 16, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "ExchangeDeclareOkMethod.h" - -using namespace Caf::AmqpClient; - -ExchangeDeclareOkMethod::ExchangeDeclareOkMethod() : - CAF_CM_INIT("ExchangeDeclareOkMethod") { -} - -ExchangeDeclareOkMethod::~ExchangeDeclareOkMethod() { -} - -void ExchangeDeclareOkMethod::init(const amqp_method_t * const method) { - CAF_CM_FUNCNAME("init"); - CAF_CM_VALIDATE_PTR(method); - CAF_CM_ASSERT(AMQP_EXCHANGE_DECLARE_OK_METHOD == method->id); -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/ExchangeDeclareOkMethod.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/ExchangeDeclareOkMethod.h deleted file mode 100644 index 40313a83c..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/ExchangeDeclareOkMethod.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Created on: May 16, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef EXCHANGEDECLAREOKMETHOD_H_ -#define EXCHANGEDECLAREOKMETHOD_H_ - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApiImpl - * @remark LIBRARY IMPLEMENTATION - NOT PART OF THE PUBLIC API - * @brief Implementation of AMQP exchange.declare-ok - */ -class ExchangeDeclareOkMethod : - public TMethodImpl, - public AmqpMethods::Exchange::DeclareOk { - METHOD_DECL( - AmqpMethods::Exchange::DeclareOk, - AMQP_EXCHANGE_DECLARE_OK_METHOD, - "exchange.declare-ok", - false) - -public: - ExchangeDeclareOkMethod(); - virtual ~ExchangeDeclareOkMethod(); - -public: // IMethod - void init(const amqp_method_t * const method); - -public: // AmqpMethods::Queue::DeclareOk - -private: - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(ExchangeDeclareOkMethod); -}; -CAF_DECLARE_SMART_QI_POINTER(ExchangeDeclareOkMethod); - -}} - -#endif /* EXCHANGEDECLAREOKMETHOD_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/ExchangeDeleteMethod.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/ExchangeDeleteMethod.cpp deleted file mode 100644 index 90e9280d2..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/ExchangeDeleteMethod.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Created on: May 16, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "amqpClient/CAmqpChannel.h" -#include "amqpClient/amqpImpl/ExchangeDeleteMethod.h" - -using namespace Caf::AmqpClient; - -ExchangeDeleteMethod::ExchangeDeleteMethod() : - _isInitialized(false), - _ifUnused(false), - CAF_CM_INIT("ExchangeDeleteMethod") { -} - -ExchangeDeleteMethod::~ExchangeDeleteMethod() { -} - -void ExchangeDeleteMethod::init( - const std::string& exchange, - const bool ifUnused) { - CAF_CM_FUNCNAME_VALIDATE("init"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - _exchange = exchange; - _ifUnused = ifUnused; - _isInitialized = true; -} - -std::string ExchangeDeleteMethod::getMethodName() const { - return "exchange.delete"; -} - -AMQPStatus ExchangeDeleteMethod::send(const SmartPtrCAmqpChannel& channel) { - CAF_CM_FUNCNAME_VALIDATE("send"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return AmqpUtil::AMQP_ExchangeDelete( - channel, - _exchange, - _ifUnused, - false); -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/ExchangeDeleteOkMethod.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/ExchangeDeleteOkMethod.cpp deleted file mode 100644 index ba57792f3..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/ExchangeDeleteOkMethod.cpp +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Created on: May 16, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "ExchangeDeleteOkMethod.h" - -using namespace Caf::AmqpClient; - -ExchangeDeleteOkMethod::ExchangeDeleteOkMethod() : - CAF_CM_INIT("ExchangeDeleteOkMethod") { -} - -ExchangeDeleteOkMethod::~ExchangeDeleteOkMethod() { -} - -void ExchangeDeleteOkMethod::init(const amqp_method_t * const method) { - CAF_CM_FUNCNAME("init"); - CAF_CM_VALIDATE_PTR(method); - CAF_CM_ASSERT(AMQP_EXCHANGE_DELETE_OK_METHOD == method->id); -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/ExchangeDeleteOkMethod.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/ExchangeDeleteOkMethod.h deleted file mode 100644 index 72ef69275..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/ExchangeDeleteOkMethod.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Created on: May 16, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef EXCHANGEDELETEOKMETHOD_H_ -#define EXCHANGEDELETEOKMETHOD_H_ - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApiImpl - * @remark LIBRARY IMPLEMENTATION - NOT PART OF THE PUBLIC API - * @brief Implementation of AMQP exchange.delete-ok - */ -class ExchangeDeleteOkMethod : - public TMethodImpl, - public AmqpMethods::Exchange::DeleteOk { - METHOD_DECL( - AmqpMethods::Exchange::DeleteOk, - AMQP_EXCHANGE_DELETE_OK_METHOD, - "exchange.delete-ok", - false) - -public: - ExchangeDeleteOkMethod(); - virtual ~ExchangeDeleteOkMethod(); - -public: // IMethod - void init(const amqp_method_t * const method); - -public: // AmqpMethods::Queue::DeclareOk - -private: - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(ExchangeDeleteOkMethod); -}; -CAF_DECLARE_SMART_QI_POINTER(ExchangeDeleteOkMethod); - -}} - -#endif /* EXCHANGEDELETEOKMETHOD_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/FieldImpl.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/FieldImpl.cpp deleted file mode 100644 index ea9e484f2..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/FieldImpl.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Created on: May 11, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "amqpClient/amqpImpl/FieldImpl.h" - -using namespace Caf::AmqpClient; - -FieldImpl::FieldImpl() : - _type(AMQP_FIELD_TYPE_NOTSET), - _value(NULL) { -} - -FieldImpl::~FieldImpl() { - if (_value) { - g_variant_unref(_value); - } -} - -Field::AmqpFieldType FieldImpl::getAmqpType() const { - return _type; -} - -GVariant* FieldImpl::getValue() const { - return _value; -} - -void FieldImpl::setTypeAndValue(AmqpFieldType type, GVariant* value) { - if (_value) { - g_variant_unref(_value); - } - _type = type; - _value = g_variant_ref_sink(value); -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/GetResponseImpl.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/GetResponseImpl.cpp deleted file mode 100644 index 620243440..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/GetResponseImpl.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Created on: May 16, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "amqpClient/amqpImpl/BasicProperties.h" -#include "Memory/DynamicArray/DynamicArrayInc.h" -#include "amqpClient/api/Envelope.h" -#include "amqpClient/amqpImpl/GetResponseImpl.h" - -using namespace Caf::AmqpClient; - -GetResponseImpl::GetResponseImpl() : - _isInitialized(false), - _messageCount(0), - CAF_CM_INIT("GetResponseImpl") { -} - -GetResponseImpl::~GetResponseImpl() { -} - -void GetResponseImpl::init( - const SmartPtrEnvelope& envelope, - const AmqpContentHeaders::SmartPtrBasicProperties& properties, - const SmartPtrCDynamicByteArray& body, - const uint32 messageCount) { - CAF_CM_FUNCNAME_VALIDATE("init"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - _envelope = envelope; - _properties = properties; - _body = body; - _messageCount = messageCount; - _isInitialized = true; -} - -SmartPtrEnvelope GetResponseImpl::getEnvelope() { - CAF_CM_FUNCNAME_VALIDATE("getEnvelope"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _envelope; -} - -AmqpContentHeaders::SmartPtrBasicProperties GetResponseImpl::getProperties() { - CAF_CM_FUNCNAME_VALIDATE("getProperties"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _properties; -} - -SmartPtrCDynamicByteArray GetResponseImpl::getBody() { - CAF_CM_FUNCNAME_VALIDATE("getBody"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _body; -} - -uint32 GetResponseImpl::getMessageCount() { - CAF_CM_FUNCNAME_VALIDATE("getMessageCount"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _messageCount; -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/QueueBindMethod.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/QueueBindMethod.cpp deleted file mode 100644 index a5440b58b..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/QueueBindMethod.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Created on: May 16, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "amqpClient/CAmqpChannel.h" -#include "amqpClient/api/amqpClient.h" -#include "amqpClient/amqpImpl/QueueBindMethod.h" - -using namespace Caf::AmqpClient; - -QueueBindMethod::QueueBindMethod() : - _isInitialized(false), - CAF_CM_INIT("QueueBindMethod") { -} - -QueueBindMethod::~QueueBindMethod() { -} - -void QueueBindMethod::init( - const std::string& queue, - const std::string& exchange, - const std::string& routingKey, - const SmartPtrTable& arguments) { - CAF_CM_FUNCNAME_VALIDATE("init"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - - _queue = queue; - _exchange = exchange; - _routingKey = routingKey; - _isInitialized = true; -} - -std::string QueueBindMethod::getMethodName() const { - return "queue.bind"; -} - -AMQPStatus QueueBindMethod::send(const SmartPtrCAmqpChannel& channel) { - CAF_CM_FUNCNAME_VALIDATE("send"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return AmqpUtil::AMQP_QueueBind( - channel, - _queue, - _exchange, - _routingKey, - false, - NULL); -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/QueueBindOkMethod.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/QueueBindOkMethod.cpp deleted file mode 100644 index 8dc64ac4e..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/QueueBindOkMethod.cpp +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Created on: May 16, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "QueueBindOkMethod.h" - -using namespace Caf::AmqpClient; - -QueueBindOkMethod::QueueBindOkMethod() : - CAF_CM_INIT("QueueBindOkMethod") { -} - -QueueBindOkMethod::~QueueBindOkMethod() { -} - -void QueueBindOkMethod::init(const amqp_method_t * const method) { - CAF_CM_FUNCNAME("init"); - CAF_CM_VALIDATE_PTR(method); - CAF_CM_ASSERT(AMQP_QUEUE_BIND_OK_METHOD == method->id); -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/QueueBindOkMethod.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/QueueBindOkMethod.h deleted file mode 100644 index a5935854b..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/QueueBindOkMethod.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Created on: May 16, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef QUEUEBINDOKMETHOD_H_ -#define QUEUEBINDOKMETHOD_H_ - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApiImpl - * @remark LIBRARY IMPLEMENTATION - NOT PART OF THE PUBLIC API - * @brief Implementation of AMQP queue.bind-ok - */ -class QueueBindOkMethod : - public TMethodImpl, - public AmqpMethods::Queue::BindOk { - METHOD_DECL( - AmqpMethods::Queue::BindOk, - AMQP_QUEUE_BIND_OK_METHOD, - "queue.bind-ok", - false) - -public: - QueueBindOkMethod(); - virtual ~QueueBindOkMethod(); - -public: // IMethod - void init(const amqp_method_t * const method); - -public: // AmqpMethods::Queue::BindOk - -private: - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(QueueBindOkMethod); -}; -CAF_DECLARE_SMART_QI_POINTER(QueueBindOkMethod); - -}} - -#endif /* QUEUEBINDOKMETHOD_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/QueueDeclareMethod.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/QueueDeclareMethod.cpp deleted file mode 100644 index 99531142b..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/QueueDeclareMethod.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Created on: May 10, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "amqpClient/CAmqpChannel.h" -#include "amqpClient/api/amqpClient.h" -#include "amqpClient/amqpImpl/QueueDeclareMethod.h" - -using namespace Caf::AmqpClient; - -QueueDeclareMethod::QueueDeclareMethod() : - _isInitialized(false), - _passive(false), - _durable(false), - _exclusive(false), - _autoDelete(false), - _noWait(false), - CAF_CM_INIT("QueueDeclareMethod") { -} - -QueueDeclareMethod::~QueueDeclareMethod() { -} - -void QueueDeclareMethod::init() { - CAF_CM_FUNCNAME_VALIDATE("init"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - init( - "", - false, - true, - true, - SmartPtrTable()); -} - -void QueueDeclareMethod::init( - const std::string& queue, - bool durable, - bool exclusive, - bool autoDelete, - const SmartPtrTable& arguments) { - CAF_CM_FUNCNAME_VALIDATE("init"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - - _queue = queue; - _passive = false; - _durable = durable; - _exclusive = exclusive; - _autoDelete = autoDelete; - _noWait = false; - _isInitialized = true; -} - -void QueueDeclareMethod::initPassive( - const std::string& queue) { - CAF_CM_FUNCNAME_VALIDATE("initPassive"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - - _queue = queue; - _passive = true; - _noWait = false; - _isInitialized = true; -} - -std::string QueueDeclareMethod::getMethodName() const { - return "queue.declare"; -} - -AMQPStatus QueueDeclareMethod::send(const SmartPtrCAmqpChannel& channel) { - CAF_CM_FUNCNAME_VALIDATE("send"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return AmqpUtil::AMQP_QueueDeclare( - channel, - _queue, - _passive, - _durable, - _exclusive, - _autoDelete, - _noWait, - NULL); -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/QueueDeclareOkMethod.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/QueueDeclareOkMethod.cpp deleted file mode 100644 index 20c6eb1bc..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/QueueDeclareOkMethod.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Created on: May 11, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "QueueDeclareOkMethod.h" - -using namespace Caf::AmqpClient; - -QueueDeclareOkMethod::QueueDeclareOkMethod() : - _messageCount(0), - _consumerCount(0), - CAF_CM_INIT("QueueDeclareOkMethod") { -} - -QueueDeclareOkMethod::~QueueDeclareOkMethod() { -} - -void QueueDeclareOkMethod::init(const amqp_method_t * const method) { - CAF_CM_FUNCNAME("init"); - CAF_CM_VALIDATE_PTR(method); - CAF_CM_ASSERT(AMQP_QUEUE_DECLARE_OK_METHOD == method->id); - const amqp_queue_declare_ok_t * const decoded = - reinterpret_cast(method->decoded); - _queueName = AMQUtil::amqpBytesToString(&decoded->queue); - _messageCount = decoded->message_count; - _consumerCount = decoded->consumer_count; -} - -std::string QueueDeclareOkMethod::getQueueName() { - return _queueName; -} - -uint32 QueueDeclareOkMethod::getMessageCount() { - return _messageCount; -} - -uint32 QueueDeclareOkMethod::getConsumerCount() { - return _consumerCount; -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/QueueDeclareOkMethod.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/QueueDeclareOkMethod.h deleted file mode 100644 index 800694876..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/QueueDeclareOkMethod.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Created on: May 11, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef QUEUEDECLAREOKMETHOD_H_ -#define QUEUEDECLAREOKMETHOD_H_ - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApiImpl - * @remark LIBRARY IMPLEMENTATION - NOT PART OF THE PUBLIC API - * @brief Implementation of AMQP queue.declare-ok - */ -class QueueDeclareOkMethod : - public TMethodImpl, - public AmqpMethods::Queue::DeclareOk { - METHOD_DECL( - AmqpMethods::Queue::DeclareOk, - AMQP_QUEUE_DECLARE_OK_METHOD, - "queue.declare-ok", - false) - -public: - QueueDeclareOkMethod(); - virtual ~QueueDeclareOkMethod(); - -public: // IMethod - void init(const amqp_method_t * const method); - -public: // AmqpMethods::Queue::DeclareOk - std::string getQueueName(); - uint32 getMessageCount(); - uint32 getConsumerCount(); - -private: - std::string _queueName; - uint32 _messageCount; - uint32 _consumerCount; - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(QueueDeclareOkMethod); -}; -CAF_DECLARE_SMART_QI_POINTER(QueueDeclareOkMethod); - -}} - -#endif /* QUEUEDECLAREOKMETHOD_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/QueueDeleteMethod.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/QueueDeleteMethod.cpp deleted file mode 100644 index 7ef0db0d6..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/QueueDeleteMethod.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Created on: May 16, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "amqpClient/CAmqpChannel.h" -#include "amqpClient/amqpImpl/QueueDeleteMethod.h" - -using namespace Caf::AmqpClient; - -QueueDeleteMethod::QueueDeleteMethod() : - _isInitialized(false), - _ifUnused(false), - _ifEmpty(false), - CAF_CM_INIT("QueueDeleteMethod") { -} - -QueueDeleteMethod::~QueueDeleteMethod() { -} - -void QueueDeleteMethod::init( - const std::string& queue, - const bool ifUnused, - const bool ifEmpty) { - CAF_CM_FUNCNAME_VALIDATE("init"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - _queue = queue; - _ifUnused = ifUnused; - _ifEmpty = ifEmpty; - _isInitialized = true; -} - -std::string QueueDeleteMethod::getMethodName() const { - return "queue.delete"; -} - -AMQPStatus QueueDeleteMethod::send(const SmartPtrCAmqpChannel& channel) { - CAF_CM_FUNCNAME_VALIDATE("send"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return AmqpUtil::AMQP_QueueDelete( - channel, - _queue, - _ifUnused, - _ifEmpty, - false); -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/QueueDeleteOkMethod.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/QueueDeleteOkMethod.cpp deleted file mode 100644 index 581f037f4..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/QueueDeleteOkMethod.cpp +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Created on: May 16, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "QueueDeleteOkMethod.h" - -using namespace Caf::AmqpClient; - -QueueDeleteOkMethod::QueueDeleteOkMethod() : - _messageCount(0), - CAF_CM_INIT("QueueDeleteOkMethod") { -} - -QueueDeleteOkMethod::~QueueDeleteOkMethod() { -} - -void QueueDeleteOkMethod::init(const amqp_method_t * const method) { - CAF_CM_FUNCNAME("init"); - CAF_CM_VALIDATE_PTR(method); - CAF_CM_ASSERT(AMQP_QUEUE_DELETE_OK_METHOD == method->id); - const amqp_queue_delete_ok_t * const decoded = - reinterpret_cast(method->decoded); - _messageCount = decoded->message_count; -} - -uint32 QueueDeleteOkMethod::getMessageCount() { - return _messageCount; -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/QueueDeleteOkMethod.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/QueueDeleteOkMethod.h deleted file mode 100644 index 4593cde2e..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/QueueDeleteOkMethod.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Created on: May 16, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef QUEUEDELETEOKMETHOD_H_ -#define QUEUEDELETEOKMETHOD_H_ - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApiImpl - * @remark LIBRARY IMPLEMENTATION - NOT PART OF THE PUBLIC API - * @brief Implementation of AMQP queue.delete-ok - */ -class QueueDeleteOkMethod : - public TMethodImpl, - public AmqpMethods::Queue::DeleteOk { - METHOD_DECL( - AmqpMethods::Queue::DeleteOk, - AMQP_QUEUE_DELETE_OK_METHOD, - "queue.delete-ok", - false) - -public: - QueueDeleteOkMethod(); - virtual ~QueueDeleteOkMethod(); - -public: // IMethod - void init(const amqp_method_t * const method); - -public: // AmqpMethods::Queue::DeclareOk - uint32 getMessageCount(); - -private: - uint32 _messageCount; - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(QueueDeleteOkMethod); -}; -CAF_DECLARE_SMART_QI_POINTER(QueueDeleteOkMethod); - -}} - -#endif /* QUEUEDELETEOKMETHOD_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/QueuePurgeMethod.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/QueuePurgeMethod.cpp deleted file mode 100644 index 03e5e2b1a..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/QueuePurgeMethod.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Created on: May 16, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "amqpClient/CAmqpChannel.h" -#include "amqpClient/amqpImpl/QueuePurgeMethod.h" - -using namespace Caf::AmqpClient; - -QueuePurgeMethod::QueuePurgeMethod() : - _isInitialized(false), - CAF_CM_INIT("QueuePurgeMethod") { -} - -QueuePurgeMethod::~QueuePurgeMethod() { -} - -void QueuePurgeMethod::init( - const std::string& queue) { - CAF_CM_FUNCNAME_VALIDATE("init"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - _queue = queue; - _isInitialized = true; -} - -std::string QueuePurgeMethod::getMethodName() const { - return "queue.purge"; -} - -AMQPStatus QueuePurgeMethod::send(const SmartPtrCAmqpChannel& channel) { - CAF_CM_FUNCNAME_VALIDATE("send"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return AmqpUtil::AMQP_QueuePurge( - channel, - _queue, - false); -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/QueuePurgeOkMethod.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/QueuePurgeOkMethod.cpp deleted file mode 100644 index 640e323f5..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/QueuePurgeOkMethod.cpp +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Created on: May 16, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "QueuePurgeOkMethod.h" - -using namespace Caf::AmqpClient; - -QueuePurgeOkMethod::QueuePurgeOkMethod() : - _messageCount(0), - CAF_CM_INIT("QueuePurgeOkMethod") { -} - -QueuePurgeOkMethod::~QueuePurgeOkMethod() { -} - -void QueuePurgeOkMethod::init(const amqp_method_t * const method) { - CAF_CM_FUNCNAME("init"); - CAF_CM_VALIDATE_PTR(method); - CAF_CM_ASSERT(AMQP_QUEUE_PURGE_OK_METHOD == method->id); - const amqp_queue_purge_ok_t * const decoded = - reinterpret_cast(method->decoded); - _messageCount = decoded->message_count; -} - -uint32 QueuePurgeOkMethod::getMessageCount() { - return _messageCount; -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/QueuePurgeOkMethod.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/QueuePurgeOkMethod.h deleted file mode 100644 index a1faa37b3..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/QueuePurgeOkMethod.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Created on: May 16, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef QueuePurgeOKMETHOD_H_ -#define QueuePurgeOKMETHOD_H_ - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApiImpl - * @remark LIBRARY IMPLEMENTATION - NOT PART OF THE PUBLIC API - * @brief Implementation of AMQP queue.purge-ok - */ -class QueuePurgeOkMethod : - public TMethodImpl, - public AmqpMethods::Queue::PurgeOk { - METHOD_DECL( - AmqpMethods::Queue::PurgeOk, - AMQP_QUEUE_PURGE_OK_METHOD, - "queue.purge-ok", - false) - -public: - QueuePurgeOkMethod(); - virtual ~QueuePurgeOkMethod(); - -public: // IMethod - void init(const amqp_method_t * const method); - -public: // AmqpMethods::Queue::PurgeOk - uint32 getMessageCount(); - -private: - uint32 _messageCount; - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(QueuePurgeOkMethod); -}; -CAF_DECLARE_SMART_QI_POINTER(QueuePurgeOkMethod); - -}} - -#endif /* QueuePurgeOKMETHOD_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/QueueUnbindMethod.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/QueueUnbindMethod.cpp deleted file mode 100644 index f16e9af02..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/QueueUnbindMethod.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Created on: May 16, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "amqpClient/CAmqpChannel.h" -#include "amqpClient/api/amqpClient.h" -#include "amqpClient/amqpImpl/QueueUnbindMethod.h" - -using namespace Caf::AmqpClient; - -QueueUnbindMethod::QueueUnbindMethod() : - _isInitialized(false), - CAF_CM_INIT("QueueUnbindMethod") { -} - -QueueUnbindMethod::~QueueUnbindMethod() { -} - -void QueueUnbindMethod::init( - const std::string& queue, - const std::string& exchange, - const std::string& routingKey, - const SmartPtrTable& arguments) { - CAF_CM_FUNCNAME_VALIDATE("init"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - _queue = queue; - _exchange = exchange; - _routingKey = routingKey; - _isInitialized = true; -} - -std::string QueueUnbindMethod::getMethodName() const { - return "queue.unbind"; -} - -AMQPStatus QueueUnbindMethod::send(const SmartPtrCAmqpChannel& channel) { - CAF_CM_FUNCNAME_VALIDATE("send"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return AmqpUtil::AMQP_QueueUnbind( - channel, - _queue, - _exchange, - _routingKey, - NULL); -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/QueueUnbindOkMethod.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/QueueUnbindOkMethod.cpp deleted file mode 100644 index ab35454cb..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/QueueUnbindOkMethod.cpp +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Created on: May 16, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "QueueUnbindOkMethod.h" - -using namespace Caf::AmqpClient; - -QueueUnbindOkMethod::QueueUnbindOkMethod() : - CAF_CM_INIT("QueueUnbindOkMethod") { -} - -QueueUnbindOkMethod::~QueueUnbindOkMethod() { -} - -void QueueUnbindOkMethod::init(const amqp_method_t * const method) { - CAF_CM_FUNCNAME("init"); - CAF_CM_VALIDATE_PTR(method); - CAF_CM_ASSERT(AMQP_QUEUE_UNBIND_OK_METHOD == method->id); -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/QueueUnbindOkMethod.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/QueueUnbindOkMethod.h deleted file mode 100644 index 215bfe7ca..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/QueueUnbindOkMethod.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Created on: May 16, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef QUEUEUNBINDOKMETHOD_H_ -#define QUEUEUNBINDOKMETHOD_H_ - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApiImpl - * @remark LIBRARY IMPLEMENTATION - NOT PART OF THE PUBLIC API - * @brief Implementation of AMQP queue.ubind-ok - */ -class QueueUnbindOkMethod : - public TMethodImpl, - public AmqpMethods::Queue::UnbindOk { - METHOD_DECL( - AmqpMethods::Queue::UnbindOk, - AMQP_QUEUE_UNBIND_OK_METHOD, - "queue.unbind-ok", - false) - -public: - QueueUnbindOkMethod(); - virtual ~QueueUnbindOkMethod(); - -public: // IMethod - void init(const amqp_method_t * const method); - -public: // AmqpMethods::Queue::UnbindOk - -private: - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(QueueUnbindOkMethod); -}; -CAF_DECLARE_SMART_QI_POINTER(QueueUnbindOkMethod); - -}} - -#endif /* QUEUEUNBINDOKMETHOD_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/TMethodImpl.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/TMethodImpl.h deleted file mode 100644 index 0c327ec8c..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/TMethodImpl.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Created on: May 11, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef TMETHODIMPL_H_ -#define TMETHODIMPL_H_ - - -#include "amqpClient/amqpImpl/IMethod.h" - -namespace Caf { namespace AmqpClient { - -/** - * @author mdonahue - * @ingroup AmqpApiImpl - * @remark LIBRARY IMPLEMENTATION - NOT PART OF THE PUBLIC API - * @brief Template implementing the static creator function for AMQP method implementations - */ -template -class TMethodImpl : public IMethod { -public: - /** - * @brief Create the method object - * @return the method object - */ - static SmartPtrIMethod Creator(); -}; - -template -SmartPtrIMethod TMethodImpl::Creator() { - TCafSmartPtr > method; - method.CreateInstance(); - return method; -} - -}} - -#define METHOD_DECL(_amqpImpl_, _num_, _name_, _has_content_) \ - CAF_BEGIN_QI() \ - CAF_QI_ENTRY(IMethod) \ - CAF_QI_ENTRY(_amqpImpl_) \ - CAF_END_QI() \ - public: \ - bool hasContent() { \ - return _has_content_; \ - } \ - uint16 getProtocolClassId() { \ - return (uint16)((_num_ & 0xffff0000) >> 16); \ - } \ - \ - uint16 getProtocolMethodId() { \ - return (uint16)(_num_ & 0x0000ffff); \ - } \ - \ - virtual std::string getProtocolMethodName() { \ - return _name_; \ - } - -#endif /* TMETHODIMPL_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/amqpImplInt.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/amqpImplInt.h deleted file mode 100644 index c3ede0b9a..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/amqpImplInt.h +++ /dev/null @@ -1,40 +0,0 @@ - /* - * Created on: May 10, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AMQPMETHODIMPLINT_H_ -#define AMQPMETHODIMPLINT_H_ - -using namespace Caf::AmqpClient; - -#include "TMethodImpl.h" - -#include "AMQPImpl.h" - -#include "amqpClient/amqpImpl/BasicProperties.h" -#include "BasicGetOkMethod.h" -#include "BasicGetEmptyMethod.h" -#include "BasicConsumeOkMethod.h" -#include "BasicDeliverMethod.h" -#include "BasicCancelOkMethod.h" -#include "BasicReturnMethod.h" -#include "BasicRecoverOkMethod.h" -#include "BasicQosOkMethod.h" - -#include "ChannelOpenOkMethod.h" -#include "ChannelCloseMethod.h" -#include "ChannelCloseOkFromServerMethod.h" - -#include "ExchangeDeclareOkMethod.h" -#include "ExchangeDeleteOkMethod.h" - -#include "QueueDeclareOkMethod.h" -#include "QueueDeleteOkMethod.h" -#include "QueuePurgeOkMethod.h" -#include "QueueBindOkMethod.h" -#include "QueueUnbindOkMethod.h" - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/stdafx.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/stdafx.h deleted file mode 100644 index ea16853e6..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/amqpImpl/stdafx.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Created on: May 10, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AMQPIMPL_STDAFX_H_ -#define AMQPIMPL_STDAFX_H_ - -#include "../stdafx.h" -#include "../AMQUtil.h" -#include "amqpImplInt.h" - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/stdafx.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/stdafx.h deleted file mode 100644 index a354867f7..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpClient/stdafx.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Created on: May 2, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef STDAFX_H_ -#define STDAFX_H_ - -#include "amqpClient/AmqpClientLink.h" -#include - - -//extern "C" { -#include -#include -#include -//} - -#if !defined(sun) -#include -#include -#include -#endif /* !sun */ - -#define AMQP_HANDLE_INVALID NULL; - -// Forward-declare because the connection creates the channel -// and the channel hangs onto the connection. -namespace Caf { namespace AmqpClient { -CAF_DECLARE_CLASS_AND_SMART_POINTER(CAmqpConnection); -CAF_DECLARE_CLASS_AND_SMART_POINTER(CAmqpChannel); -}} - -#include "AmqpCommon.h" -#include "amqpClient/CAmqpChannel.h" - -#include "AmqpConnection.h" -#include "AmqpAuthPlain.h" -#include "AmqpChannel.h" -#include "AmqpUtil.h" -#include "amqpImpl/amqpImplInt.h" - -/** - * @defgroup AmqpApiImpl AMQP API Implementation - * Documentation for the implementation of the AMQP API. - *

- * These classes, methods and constants cannot be used directly by application code. - */ - -/** - * @mainpage - * Documentation of the CAF AMQP Client Library. - *

- * This library allows applications to interact with an AMQP broker as a - * client using first-class C++ objects representing AMQP entities and operations. - */ -#endif /* STDAFX_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/AbstractConnectionFactory.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/AbstractConnectionFactory.cpp deleted file mode 100644 index 87a1a5cd4..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/AbstractConnectionFactory.cpp +++ /dev/null @@ -1,207 +0,0 @@ -/* - * Created on: May 24, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "amqpClient/api/Connection.h" -#include "amqpCore/ConnectionListener.h" -#include "amqpCore/SimpleConnection.h" -#include "amqpCore/AbstractConnectionFactory.h" - -using namespace Caf::AmqpIntegration; - -AbstractConnectionFactory::AbstractConnectionFactory() : - _isInitialized(false), - CAF_CM_INIT("AbstractConnectionFactory") { -} - -AbstractConnectionFactory::~AbstractConnectionFactory() { -} - -void AbstractConnectionFactory::init( - const AmqpClient::SmartPtrConnectionFactory& amqpConnectionFactory) { - CAF_CM_FUNCNAME_VALIDATE("init"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_SMARTPTR(amqpConnectionFactory); - _amqpConnectionFactory = amqpConnectionFactory; - _connectionListener.CreateInstance(); - _isInitialized = true; -} - -void AbstractConnectionFactory::setProtocol(const std::string& protocol) { - CAF_CM_FUNCNAME_VALIDATE("setProtocol"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - _amqpConnectionFactory->setProtocol(protocol); -} - -void AbstractConnectionFactory::setHost(const std::string& host) { - CAF_CM_FUNCNAME_VALIDATE("setHost"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - _amqpConnectionFactory->setHost(host); -} - -void AbstractConnectionFactory::setPort(const uint32 port) { - CAF_CM_FUNCNAME_VALIDATE("setPort"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - _amqpConnectionFactory->setPort(port); -} - -void AbstractConnectionFactory::setVirtualHost(const std::string& virtualHost) { - CAF_CM_FUNCNAME_VALIDATE("setVirtualHost"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - _amqpConnectionFactory->setVirtualHost(virtualHost); -} - -void AbstractConnectionFactory::setUsername(const std::string& username) { - CAF_CM_FUNCNAME_VALIDATE("setUsername"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - _amqpConnectionFactory->setUsername(username); -} - -void AbstractConnectionFactory::setPassword(const std::string& password) { - CAF_CM_FUNCNAME_VALIDATE("setPassword"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - _amqpConnectionFactory->setPassword(password); -} - -void AbstractConnectionFactory::setCaCertPath(const std::string& caCertPath) { - CAF_CM_FUNCNAME_VALIDATE("setCaCertPath"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - _amqpConnectionFactory->setCaCertPath(caCertPath); -} - -void AbstractConnectionFactory::setClientCertPath(const std::string& clientCertPath) { - CAF_CM_FUNCNAME_VALIDATE("setClientCertPath"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - _amqpConnectionFactory->setClientCertPath(clientCertPath); -} - -void AbstractConnectionFactory::setClientKeyPath(const std::string& clientKeyPath) { - CAF_CM_FUNCNAME_VALIDATE("setClientKeyPath"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - _amqpConnectionFactory->setClientKeyPath(clientKeyPath); -} - -void AbstractConnectionFactory::setConnectionTimeout(const uint32 connectionTimeout) { - CAF_CM_FUNCNAME_VALIDATE("setConnectionTimeout"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - _amqpConnectionFactory->setConnectionTimeout(connectionTimeout); -} - -void AbstractConnectionFactory::setRetries(const uint16 retries) { - CAF_CM_FUNCNAME_VALIDATE("setRetries"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - _amqpConnectionFactory->setRetries(retries); -} - -void AbstractConnectionFactory::setSecondsToWait(const uint16 seconds) { - CAF_CM_FUNCNAME_VALIDATE("setSecondsToWait"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - _amqpConnectionFactory->setSecondsToWait(seconds); -} - -std::string AbstractConnectionFactory::getDefaultProtocol() { - return Caf::AmqpClient::DEFAULT_PROTOCOL; -} - -std::string AbstractConnectionFactory::getDefaultHostName() { - return g_get_host_name(); -} - -SmartPtrConnection AbstractConnectionFactory::createBareConnection() { - CAF_CM_FUNCNAME_VALIDATE("createBareConnection"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - SmartPtrSimpleConnection connection; - connection.CreateInstance(); - connection->init(_amqpConnectionFactory->newConnection()); - return connection; -} - -SmartPtrConnectionListener AbstractConnectionFactory::getConnectionListener() { - return _connectionListener; -} - - -void AbstractConnectionFactory::setConnectionListeners( - const std::deque& listeners) { - CAF_CM_FUNCNAME_VALIDATE("setConnectionListeners"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - _connectionListener->setDelegates(listeners); -} - -void AbstractConnectionFactory::addConnectionListener( - const SmartPtrConnectionListener& listener) { - CAF_CM_FUNCNAME_VALIDATE("addConnectionListener"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - _connectionListener->addDelegate(listener); -} - -std::string AbstractConnectionFactory::getProtocol() { - CAF_CM_FUNCNAME_VALIDATE("getProtocol"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _amqpConnectionFactory->getProtocol(); -} - -std::string AbstractConnectionFactory::getHost() { - CAF_CM_FUNCNAME_VALIDATE("getHost"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _amqpConnectionFactory->getHost(); -} - -uint32 AbstractConnectionFactory::getPort() { - CAF_CM_FUNCNAME_VALIDATE("getPort"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _amqpConnectionFactory->getPort(); -} - -std::string AbstractConnectionFactory::getVirtualHost() { - CAF_CM_FUNCNAME_VALIDATE("getVirtualHost"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _amqpConnectionFactory->getVirtualHost(); -} - -std::string AbstractConnectionFactory::getUsername() { - CAF_CM_FUNCNAME_VALIDATE("getUsername"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _amqpConnectionFactory->getUsername(); -} - -std::string AbstractConnectionFactory::getPassword() { - CAF_CM_FUNCNAME_VALIDATE("getPassword"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _amqpConnectionFactory->getPassword(); -} - -std::string AbstractConnectionFactory::getCaCertPath() { - CAF_CM_FUNCNAME_VALIDATE("getCaCertPath"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _amqpConnectionFactory->getCaCertPath(); -} - -std::string AbstractConnectionFactory::getClientCertPath() { - CAF_CM_FUNCNAME_VALIDATE("getClientCertPath"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _amqpConnectionFactory->getClientCertPath(); -} - -std::string AbstractConnectionFactory::getClientKeyPath() { - CAF_CM_FUNCNAME_VALIDATE("getClientKeyPath"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _amqpConnectionFactory->getClientKeyPath(); -} - -uint16 AbstractConnectionFactory::getRetries() { - CAF_CM_FUNCNAME_VALIDATE("getRetries"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _amqpConnectionFactory->getRetries(); -} - -uint16 AbstractConnectionFactory::getSecondsToWait() { - CAF_CM_FUNCNAME_VALIDATE("getSecondsToWait"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _amqpConnectionFactory->getSecondsToWait(); -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/AmqpHeaderMapper.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/AmqpHeaderMapper.cpp deleted file mode 100644 index 6482a4971..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/AmqpHeaderMapper.cpp +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Created on: Jun 6, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "amqpCore/AmqpHeaderMapper.h" - -using namespace Caf::AmqpIntegration; - -const std::string AmqpHeaderMapper::PREFIX = "amqp_"; -const std::string AmqpHeaderMapper::APP_ID = AmqpHeaderMapper::PREFIX + "appId"; -const std::string AmqpHeaderMapper::CLUSTER_ID = AmqpHeaderMapper::PREFIX + "clusterId"; -const std::string AmqpHeaderMapper::CONTENT_ENCODING = AmqpHeaderMapper::PREFIX + "contentEncoding"; -const std::string AmqpHeaderMapper::CONTENT_TYPE = AmqpHeaderMapper::PREFIX + "contentType"; -const std::string AmqpHeaderMapper::CORRELATION_ID = AmqpHeaderMapper::PREFIX + "correlationId"; -const std::string AmqpHeaderMapper::DELIVERY_MODE = AmqpHeaderMapper::PREFIX + "deliveryMode"; -const std::string AmqpHeaderMapper::DELIVERY_TAG = AmqpHeaderMapper::PREFIX + "deliveryTag"; -const std::string AmqpHeaderMapper::EXPIRATION = AmqpHeaderMapper::PREFIX + "expiration"; -const std::string AmqpHeaderMapper::MESSAGE_COUNT = AmqpHeaderMapper::PREFIX + "messageCount"; -const std::string AmqpHeaderMapper::MESSAGE_ID = AmqpHeaderMapper::PREFIX + "messageId"; -const std::string AmqpHeaderMapper::RECEIVED_EXCHANGE = AmqpHeaderMapper::PREFIX + "receivedExchange"; -const std::string AmqpHeaderMapper::RECEIVED_ROUTING_KEY = AmqpHeaderMapper::PREFIX + "receivedRoutingKey"; -const std::string AmqpHeaderMapper::REDELIVERED = AmqpHeaderMapper::PREFIX + "redelivered"; -const std::string AmqpHeaderMapper::REPLY_TO = AmqpHeaderMapper::PREFIX + "replyTo"; -const std::string AmqpHeaderMapper::TIMESTAMP = AmqpHeaderMapper::PREFIX + "timestamp"; -const std::string AmqpHeaderMapper::TYPE = AmqpHeaderMapper::PREFIX + "type"; -const std::string AmqpHeaderMapper::USER_ID = AmqpHeaderMapper::PREFIX + "userId"; - diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/AmqpIntegrationCoreDefines.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/AmqpIntegrationCoreDefines.h deleted file mode 100644 index 82e9c86d0..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/AmqpIntegrationCoreDefines.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Created on: Jul 31, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AMQPINTEGRATIONCOREDEFINES_H_ -#define AMQPINTEGRATIONCOREDEFINES_H_ - -namespace Caf { namespace AmqpIntegration { -/** - * @brief Message acknowledgment mode flags - */ -typedef enum { - /** @brief No acks will be sent. AMQP broker will assume all messages are acked. */ - ACKNOWLEDGEMODE_NONE, - - /** @brief The listener must acknowledge all messages by calling Channel.basicAck() */ - ACKNOWLEDGEMODE_MANUAL, - - /** @brief The container will acknowledge messages automatically. */ - ACKNOWLEDGEMODE_AUTO -} AcknowledgeMode; - -}} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/AmqpIntegrationCoreFunc.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/AmqpIntegrationCoreFunc.h deleted file mode 100644 index 66f078e8f..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/AmqpIntegrationCoreFunc.h +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Created on: Jun 15, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AMQPINTEGRATIONCOREFUNC_H_ -#define AMQPINTEGRATIONCOREFUNC_H_ - - - -#include "amqpCore/Binding.h" -#include "amqpCore/Exchange.h" -#include "amqpCore/Queue.h" - -namespace Caf { - -/** @brief CAF AMQP Integration */ -namespace AmqpIntegration { - -/** - * @brief Create a #Caf::AmqpIntegration::Queue object - *

- * durable will be set to true; - * exclusive and autoDelete will be set to false. - * @param name the name of the queue - * @return the queue object - */ -SmartPtrQueue AMQPINTEGRATIONCORE_LINKAGE createQueue( - const std::string& name); - -/** - * @brief Create a #Caf::AmqpIntegration::Queue object - *

- * exclusive and autoDelete will be set to false. - * @param name the name of the queue - * @param durable true to make the queue durable else false - * @return the queue object - */ -SmartPtrQueue AMQPINTEGRATIONCORE_LINKAGE createQueue( - const std::string& name, - const bool durable); - -/** - * @brief Create a #Caf::AmqpIntegration::Queue object - * @param name the name of the queue or blank for a server-generated name - * @param durable true to make the queue durable else false - * @param exclusive true to make the queue exclusive else false - * @param autoDelete true to make the queue auto-delete else false - * @return the queue object - */ -SmartPtrQueue AMQPINTEGRATIONCORE_LINKAGE createQueue( - const std::string& name, - const bool durable, - const bool exclusive, - const bool autoDelete); - - -/** - * @brief Create a #Caf::AmqpIntegration::Exchange object representing a direct exchange - * @param name the name of the exchange - * @param durable true to make the exchange durable else false - */ -SmartPtrExchange AMQPINTEGRATIONCORE_LINKAGE createDirectExchange( - const std::string& name, - const bool durable = true); - -/** - * @brief Create a #Caf::AmqpIntegration::Exchange object representing a topic exchange - * @param name the name of the exchange - * @param durable true to make the exchange durable else false - */ -SmartPtrExchange AMQPINTEGRATIONCORE_LINKAGE createTopicExchange( - const std::string& name, - const bool durable = true); - -/** - * @brief Create a #Caf::AmqpIntegration::Exchange object representing a headers exchange - * @param name the name of the exchange - * @param durable true to make the exchange durable else false - */ -SmartPtrExchange AMQPINTEGRATIONCORE_LINKAGE createHeadersExchange( - const std::string& name, - const bool durable = true); - -/** - * @brief Create a #Caf::AmqpIntegration::Exchange object representing a fanout exchange - * @param name the name of the exchange - * @param durable true to make the exchange durable else false - */ -SmartPtrExchange AMQPINTEGRATIONCORE_LINKAGE createFanoutExchange( - const std::string& name, - const bool durable = true); - -/** - * @brief Create a #Caf::AmqpIntegration::Binding object - * @param queue the queue name - * @param exchange the exchange name - * @param routingKey the routing key - */ -SmartPtrBinding AMQPINTEGRATIONCORE_LINKAGE createBinding( - const std::string queue, - const std::string exchange, - const std::string routingKey); - -}} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/AmqpIntegrationExceptions.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/AmqpIntegrationExceptions.cpp deleted file mode 100644 index ebd767c25..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/AmqpIntegrationExceptions.cpp +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Created on: Jul 18, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "AmqpIntegrationExceptions.h" - -using namespace Caf::AmqpIntegration::AmqpIntExceptions; - -AMQP_CM_DEFINE_EXCEPTION_CLASS(ReplyRequiredException); -AMQP_CM_DEFINE_EXCEPTION_CLASS(ChannelResolutionException); -AMQP_CM_DEFINE_EXCEPTION_CLASS(ExpressionResultNull); -AMQP_CM_DEFINE_EXCEPTION_CLASS(ExpressionResultWrongType); diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/AmqpIntegrationExceptions.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/AmqpIntegrationExceptions.h deleted file mode 100644 index 8fc67b283..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/AmqpIntegrationExceptions.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Created on: Jul 18, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AMQPINTEGRATIONCORE_AMQPINTEGRATIONEXCEPTIONS_H_ -#define AMQPINTEGRATIONCORE_AMQPINTEGRATIONEXCEPTIONS_H_ - -#include "amqpClient/api/AMQExceptions.h" - -namespace Caf { namespace AmqpIntegration { - -/** - * @brief Exceptions defined by this library - */ -namespace AmqpIntExceptions { - -/** @brief A reply was required but was not produced */ -AMQP_CM_DECLARE_EXCEPTION_CLASS(ReplyRequiredException); - -/** @brief Thrown by a ChannelResolver when it cannot resolve a channel name */ -AMQP_CM_DECLARE_EXCEPTION_CLASS(ChannelResolutionException); - -/** @brief Thrown if an expression failed to return a result */ -AMQP_CM_DECLARE_EXCEPTION_CLASS(ExpressionResultNull); - -/** @brief Thrown if an expression resolved to an incorrect result type */ -AMQP_CM_DECLARE_EXCEPTION_CLASS(ExpressionResultWrongType); - -}}} - -#endif /* AMQPINTEGRATIONCORE_AMQPINTEGRATIONEXCEPTIONS_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/AmqpMessageListenerSource.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/AmqpMessageListenerSource.cpp deleted file mode 100644 index 1c610ab9f..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/AmqpMessageListenerSource.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Created on: Aug 7, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Integration/Core/CIntMessage.h" -#include "Integration/Dependencies/CPollerMetadata.h" -#include "Integration/IIntMessage.h" -#include "amqpCore/AmqpHeaderMapper.h" -#include "amqpCore/AmqpMessageListenerSource.h" -#include "Exception/CCafException.h" - -using namespace Caf::AmqpIntegration; - -AmqpMessageListenerSource::AmqpMessageListenerSource() : - _isInitialized(false), - _messageQueue(NULL), - CAF_CM_INIT("AmqpMessageListenerSource") { -} - -AmqpMessageListenerSource::~AmqpMessageListenerSource() { -} - -void AmqpMessageListenerSource::init( - const SmartPtrAmqpHeaderMapper& headerMapper, - const SmartPtrCPollerMetadata& pollerMetadata) { - CAF_CM_FUNCNAME_VALIDATE("init"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_PTR(pollerMetadata); - // headerMapper is optional - - _headerMapper = headerMapper; - _messageQueue = g_async_queue_new_full(QueueItemDestroyFunc); - setPollerMetadata(pollerMetadata); - _isInitialized = true; -} -void AmqpMessageListenerSource::onMessage(const SmartPtrIIntMessage& message) { - CAF_CM_FUNCNAME_VALIDATE("onMessage"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(message); - - SmartPtrIIntMessage queuedMessage = message; - if (_headerMapper) { - SmartPtrCIntMessage filteredMessage; - filteredMessage.CreateInstance(); - filteredMessage->initialize( - queuedMessage->getPayload(), - _headerMapper->filterHeaders(queuedMessage->getHeaders()), - NULL); - queuedMessage = filteredMessage; - } - g_async_queue_push( - _messageQueue, - queuedMessage.GetAddRefedInterface()); -} - -bool AmqpMessageListenerSource::doSend( - const SmartPtrIIntMessage& message, - int32 timeout) { - CAF_CM_FUNCNAME("doSend"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_EXCEPTIONEX_VA1( - UnsupportedOperationException, - E_NOTIMPL, - "This is not a sending channel: %s", _id.c_str()); - return false; -} - -SmartPtrIIntMessage AmqpMessageListenerSource::doReceive(const int32 timeout) { - CAF_CM_FUNCNAME("doReceive"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - gpointer data = NULL; - if (timeout < 0) { - // blocking - CAF_CM_EXCEPTIONEX_VA1(UnsupportedOperationException, E_INVALIDARG, - "Infinite blocking is not supported for a polled channel: %s", _id.c_str()); - //data = g_async_queue_pop(_messageQueue); - } else if (timeout == 0) { - // immediate - data = g_async_queue_try_pop(_messageQueue); - } else { - // timed - guint64 microTimeout = static_cast(timeout) * 1000; - data = g_async_queue_timeout_pop(_messageQueue, microTimeout); - } - - SmartPtrIIntMessage message; - if (data) { - IIntMessage *messagePtr = reinterpret_cast(data); - message = messagePtr; - messagePtr->Release(); - } - return message; -} - -void AmqpMessageListenerSource::QueueItemDestroyFunc(gpointer data) { - reinterpret_cast(data)->Release(); -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/AmqpOutboundEndpoint.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/AmqpOutboundEndpoint.cpp deleted file mode 100644 index d9ee9f256..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/AmqpOutboundEndpoint.cpp +++ /dev/null @@ -1,297 +0,0 @@ -/* - * Created on: Jul 16, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Common/IAppConfig.h" -#include "Common/IAppContext.h" -#include "IVariant.h" -#include "Integration/Core/CIntMessage.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IIntMessage.h" -#include "Integration/IMessageChannel.h" -#include "amqpCore/AmqpTemplate.h" -#include "amqpCore/DefaultAmqpHeaderMapper.h" -#include "Exception/CCafException.h" -#include "amqpCore/AmqpOutboundEndpoint.h" -#include "Integration/Core/MessageHeaders.h" - -using namespace Caf::AmqpIntegration; - -AmqpOutboundEndpoint::AmqpOutboundEndpoint() : - _isInitialized(false), - _id(CAFCOMMON_GUID_NULL), - _expectReply(false), - _requiresReply(false), - CAF_CM_INIT("AmqpOutboundEndpoint") { -} - -AmqpOutboundEndpoint::~AmqpOutboundEndpoint() { -} - -void AmqpOutboundEndpoint::init( - SmartPtrAmqpTemplate amqpTemplate, - SmartPtrIAppConfig appConfig, - SmartPtrIAppContext appContext) { - CAF_CM_FUNCNAME("init"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_SMARTPTR(amqpTemplate); - CAF_CM_VALIDATE_SMARTPTR(appConfig); - CAF_CM_VALIDATE_SMARTPTR(appContext); - - _amqpTemplate = amqpTemplate; - if (!_exchangeName.length() && !_exchangeNameExpression.length()) { - CAF_CM_EXCEPTIONEX_VA0( - IllegalStateException, - 0, - "exchange-name or exchange-name-expression must be set before calling init()"); - } - if (!_routingKey.length() && !_routingKeyExpression.length()) { - CAF_CM_EXCEPTIONEX_VA0( - IllegalStateException, - 0, - "routing-key or routing-key-expression must be set before calling init()"); - } - ::UuidCreate(&_id); - - if (_exchangeNameExpression.length()) { - _exchangeNameHandler.CreateInstance(); - _exchangeNameHandler->init(appConfig, appContext, _exchangeNameExpression); - } - - if (_routingKeyExpression.length()) { - _routingKeyHandler.CreateInstance(); - _routingKeyHandler->init(appConfig, appContext, _routingKeyExpression); - } - - if (_requestHeaderMapperExpression.length()) { - SmartPtrDefaultAmqpHeaderMapper mapper; - mapper.CreateInstance(); - mapper->init(_requestHeaderMapperExpression); - _requestHeaderMapper = mapper; - } - - _isInitialized = true; -} - -void AmqpOutboundEndpoint::setExchangeName(const std::string& exchangeName) { - _exchangeName = exchangeName; -} - -void AmqpOutboundEndpoint::setExchangeNameExpression(const std::string& exchangeNameExpression) { - _exchangeNameExpression = exchangeNameExpression; -} - -void AmqpOutboundEndpoint::setRoutingKey(const std::string& routingKey) { - _routingKey = routingKey; -} - -void AmqpOutboundEndpoint::setRoutingKeyExpression(const std::string& routingKeyExpression) { - _routingKeyExpression = routingKeyExpression; -} -void AmqpOutboundEndpoint::setMappedRequestHeadersExpression(const std::string& expression) { - _requestHeaderMapperExpression = expression; -} - -void AmqpOutboundEndpoint::setExpectReply(const bool expectReply) { - _expectReply = expectReply; -} - -void AmqpOutboundEndpoint::setRequiresReply(const bool requiresReply) { - _requiresReply = requiresReply; -} - -void AmqpOutboundEndpoint::setComponentName(const std::string& name) { - _componentName = name; -} - -void AmqpOutboundEndpoint::setChannelResolver(SmartPtrIChannelResolver channelResolver) { - _channelResolver = channelResolver; -} - -UUID AmqpOutboundEndpoint::getHandlerId() const { - CAF_CM_FUNCNAME_VALIDATE("getHandlerId"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _id; -} - -void AmqpOutboundEndpoint::handleMessage(const SmartPtrIIntMessage& message) { - CAF_CM_FUNCNAME("handleMessage"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_SMARTPTR(message); - - SmartPtrIIntMessage result = handleRequestMessage(message); - if (result) { - IIntMessage::SmartPtrCHeaders requestHeaders = message->getHeaders(); - handleResult(result, requestHeaders); - } else if (_requiresReply) { - std::stringstream msg; - msg << "No reply produced by handler '"; - if (_componentName.length()) { - msg << _componentName; - } else { - msg << BasePlatform::UuidToString(_id); - } - msg << "', and its 'requiresReply' property is set to true."; - CAF_CM_EXCEPTIONEX_VA0( - AmqpIntExceptions::ReplyRequiredException, - 0, - msg.str().c_str()); - } -} - -SmartPtrIIntMessage AmqpOutboundEndpoint::getSavedMessage() const { - CAF_CM_FUNCNAME_VALIDATE("getSavedMessage"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return NULL; -} - -void AmqpOutboundEndpoint::clearSavedMessage() { - CAF_CM_FUNCNAME_VALIDATE("clearSavedMessage"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); -} - -SmartPtrIIntMessage AmqpOutboundEndpoint::handleRequestMessage( - SmartPtrIIntMessage requestMessage) { - SmartPtrIIntMessage reply; - std::string exchangeName = _exchangeName; - std::string routingKey = _routingKey; - if (_expectReply) { - reply = sendAndReceive(exchangeName, routingKey, requestMessage); - } else { - send(exchangeName, routingKey, requestMessage); - } - return reply; -} - -void AmqpOutboundEndpoint::handleResult( - SmartPtrIIntMessage resultMessage, - IIntMessage::SmartPtrCHeaders requestHeaders) { - SmartPtrIIntMessage reply = createReplyMessage(resultMessage, requestHeaders); - sendReplyMessage( - reply, - resultMessage->findRequiredHeader(MessageHeaders::_sREPLY_CHANNEL)->toString()); -} - -void AmqpOutboundEndpoint::send( - const std::string& exchangeName, - const std::string& routingKey, - SmartPtrIIntMessage requestMessage) { - CAF_CM_FUNCNAME("send"); - - std::string resolvedExchange = exchangeName; - std::string resolvedRoutingKey = routingKey; - SmartPtrIVariant evalResult; - if (_exchangeNameHandler) { - evalResult = _exchangeNameHandler->evaluate(requestMessage); - if (evalResult) { - resolvedExchange = evalResult->toString(); - } else { - CAF_CM_EXCEPTIONEX_VA0( - AmqpIntExceptions::ExpressionResultNull, - 0, - "The exchange name was not resolved"); - } - } - - if (_routingKeyHandler) { - evalResult = _routingKeyHandler->evaluate(requestMessage); - if (evalResult) { - resolvedRoutingKey = evalResult->toString(); - } else { - CAF_CM_EXCEPTIONEX_VA0( - AmqpIntExceptions::ExpressionResultNull, - 0, - "The routing key was not resolved"); - } - } - - _amqpTemplate->send( - resolvedExchange, - resolvedRoutingKey, - requestMessage, - _requestHeaderMapper); -} - -SmartPtrIIntMessage AmqpOutboundEndpoint::sendAndReceive( - const std::string& exchangeName, - const std::string& routingKey, - SmartPtrIIntMessage requestMessage) { - CAF_CM_FUNCNAME("sendAndReceive"); - - std::string resolvedExchange = exchangeName; - std::string resolvedRoutingKey = routingKey; - SmartPtrIVariant evalResult; - if (_exchangeNameHandler) { - evalResult = _exchangeNameHandler->evaluate(requestMessage); - if (evalResult) { - resolvedExchange = evalResult->toString(); - } else { - CAF_CM_EXCEPTIONEX_VA0( - AmqpIntExceptions::ExpressionResultNull, - 0, - "The exchange name was not resolved"); - } - } - - if (_routingKeyHandler) { - evalResult = _routingKeyHandler->evaluate(requestMessage); - if (evalResult) { - resolvedRoutingKey = evalResult->toString(); - } else { - CAF_CM_EXCEPTIONEX_VA0( - AmqpIntExceptions::ExpressionResultNull, - 0, - "The routing key was not resolved"); - } - } - - return _amqpTemplate->sendAndReceive( - resolvedExchange, - resolvedRoutingKey, - requestMessage, - _requestHeaderMapper, - _responseHeaderMapper); -} - -SmartPtrIIntMessage AmqpOutboundEndpoint::createReplyMessage( - SmartPtrIIntMessage reply, - IIntMessage::SmartPtrCHeaders requestHeaders) { - SmartPtrCIntMessage replyMessage; - replyMessage.CreateInstance(); - replyMessage->initialize( - reply->getPayload(), - reply->getHeaders(), - requestHeaders); - return replyMessage; -} - -void AmqpOutboundEndpoint::sendReplyMessage( - SmartPtrIIntMessage reply, - const std::string& replyChannelHeaderValue) { - CAF_CM_FUNCNAME("sendReplyMessage"); - - if (_outputChannel) { - _outputChannel->send(reply); - } else if (replyChannelHeaderValue.length()) { - if (_channelResolver) { - SmartPtrIMessageChannel channel = - _channelResolver->resolveChannelName(replyChannelHeaderValue); - channel->send(reply); - } else { - CAF_CM_EXCEPTIONEX_VA0( - AmqpIntExceptions::ChannelResolutionException, - 0, - "No ChannelResolver is available"); - } - } else { - CAF_CM_EXCEPTIONEX_VA0( - AmqpIntExceptions::ChannelResolutionException, - 0, - "No output-channel or replyChannel header available"); - } -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/AutoChannelClose.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/AutoChannelClose.cpp deleted file mode 100644 index c47a92009..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/AutoChannelClose.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Created on: Aug 7, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "amqpClient/api/Channel.h" -#include "AutoChannelClose.h" - -using namespace Caf::AmqpIntegration; - -AutoChannelClose::AutoChannelClose(AmqpClient::SmartPtrChannel channel) : - _channel(channel) {} - -AutoChannelClose::~AutoChannelClose() { - if (_channel) { - _channel->close(); - } -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/AutoChannelClose.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/AutoChannelClose.h deleted file mode 100644 index 8e0addac8..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/AutoChannelClose.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Created on: Jun 15, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AMQPINTEGRATIONCORE_AUTOCHANNELCLOSE_H_ -#define AMQPINTEGRATIONCORE_AUTOCHANNELCLOSE_H_ - - -#include "amqpClient/api/Channel.h" - -namespace Caf { namespace AmqpIntegration { - -/** - * @ingroup IntObjImpl - * @brief A helper class to automatically close a channel - *

- * This class is helpful to mimic try/catch/finally logic in the code. - * Simply declare an instance on the stack, initialized with the channel. - * When the instance goes out of scope it will close the channel. - */ -class AMQPINTEGRATIONCORE_LINKAGE AutoChannelClose { -public: - /** - * @brief Construct the instance with the given channel - * @param channel the channel to auto-close - */ - AutoChannelClose(AmqpClient::SmartPtrChannel channel); - ~AutoChannelClose(); - -private: - AmqpClient::SmartPtrChannel _channel; -}; - -}} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/BindingImpl.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/BindingImpl.cpp deleted file mode 100644 index d83e9bb66..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/BindingImpl.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Created on: Jun 14, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "amqpCore/Binding.h" -#include "amqpCore/BindingImpl.h" - -using namespace Caf::AmqpIntegration; - -BindingImpl::BindingImpl() { -} - -BindingImpl::~BindingImpl() { -} - -void BindingImpl::init( - const std::string queue, - const std::string exchange, - const std::string routingKey) { - _queue = queue; - _exchange = exchange; - _routingKey = routingKey; -} - -std::string BindingImpl::getQueue() const { - return _queue; -} - -std::string BindingImpl::getExchange() const { - return _exchange; -} - -std::string BindingImpl::getRoutingKey() const { - return _routingKey; -} - -SmartPtrBinding AMQPINTEGRATIONCORE_LINKAGE Caf::AmqpIntegration::createBinding( - const std::string queue, - const std::string exchange, - const std::string routingKey) { - SmartPtrBindingImpl binding; - binding.CreateInstance(); - binding->init(queue, exchange, routingKey); - return binding; -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/BlockingQueueConsumer.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/BlockingQueueConsumer.cpp deleted file mode 100644 index 662796d28..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/BlockingQueueConsumer.cpp +++ /dev/null @@ -1,455 +0,0 @@ -/* - * Created on: Jul 30, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "amqpClient/amqpImpl/BasicProperties.h" -#include "Integration/Core/CIntMessage.h" -#include "Integration/IIntMessage.h" -#include "Memory/DynamicArray/DynamicArrayInc.h" -#include "amqpClient/api/Channel.h" -#include "amqpClient/api/Envelope.h" -#include "amqpCore/AmqpHeaderMapper.h" -#include "amqpClient/api/ConnectionFactory.h" -#include "amqpCore/BlockingQueueConsumer.h" -#include "Integration/Core/CIntException.h" -#include "Exception/CCafException.h" - -using namespace Caf::AmqpIntegration; - -#if (1) // BlockingQueueConsumer -BlockingQueueConsumer::BlockingQueueConsumer() : - _isInitialized(false), - _isRunning(false), - _isCanceled(false), - _deliveryQueue(NULL), - _acknowledgeMode(ACKNOWLEDGEMODE_NONE), - _prefetchCount(0), - CAF_CM_INIT_LOG("BlockingQueueConsumer") { - _parentLock.CreateInstance(); - _parentLock->initialize(); -} - -BlockingQueueConsumer::~BlockingQueueConsumer() { - if (_deliveryQueue) { - g_async_queue_unref(_deliveryQueue); - } -} - -void BlockingQueueConsumer::init( - SmartPtrConnectionFactory connectionFactory, - SmartPtrAmqpHeaderMapper headerMapper, - AcknowledgeMode acknowledgeMode, - uint32 prefetchCount, - const std::string& queue) { - CAF_CM_FUNCNAME("init"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(connectionFactory); - CAF_CM_VALIDATE_INTERFACE(headerMapper); - CAF_CM_VALIDATE_STRING(queue); - - CAF_CM_ASSERT(acknowledgeMode != ACKNOWLEDGEMODE_MANUAL); - - _connectionFactory = connectionFactory; - _headerMapper = headerMapper; - _acknowledgeMode = acknowledgeMode; - _prefetchCount = prefetchCount; - _queue = queue; - _deliveryQueue = g_async_queue_new_full(destroyQueueItem); - _isInitialized = true; -} - -AmqpClient::SmartPtrChannel BlockingQueueConsumer::getChannel() { - CAF_CM_FUNCNAME("getChannel"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_ASSERT(_isRunning); - return _channel; -} - -std::string BlockingQueueConsumer::getConsumerTag() { - CAF_CM_FUNCNAME("getConsumerTag"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_ASSERT(_isRunning); - return _consumer->getConsumerTag(); -} - -SmartPtrIIntMessage BlockingQueueConsumer::nextMessage() { - CAF_CM_FUNCNAME("nextMessage"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_ASSERT(_isRunning); - - // simulate a blocking pop from the queue - gpointer data = g_async_queue_try_pop(_deliveryQueue); - while (!data && !_isCanceled) { - CThreadUtils::sleep(100); - data = g_async_queue_try_pop(_deliveryQueue); - } - - checkShutdown(); - SmartPtrIIntMessage message; - if (data) { - Delivery *deliveryPtr = reinterpret_cast(data); - SmartPtrDelivery delivery(deliveryPtr); - deliveryPtr->Release(); - message = handle(delivery); - } - return message; -} - -SmartPtrIIntMessage BlockingQueueConsumer::nextMessage(int32 timeout) { - CAF_CM_FUNCNAME("nextMessage"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_ASSERT(_isRunning); - - guint64 microTimeout = static_cast(timeout) * 1000; - gpointer data = g_async_queue_timeout_pop(_deliveryQueue, microTimeout); - - checkShutdown(); - SmartPtrIIntMessage message; - if (data) { - Delivery *deliveryPtr = reinterpret_cast(data); - SmartPtrDelivery delivery(deliveryPtr); - deliveryPtr->Release(); - message = handle(delivery); - } - return message; -} - -bool BlockingQueueConsumer::commitIfNecessary() { - CAF_CM_FUNCNAME("commitIfNecessary"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_ASSERT(_isRunning); - - bool result = false; - std::set deliveryTags; - { - CAF_CM_LOCK_UNLOCK1(_parentLock); - deliveryTags = _deliveryTags; - } - - try { - if (deliveryTags.size()) { - result = true; - if (_acknowledgeMode == ACKNOWLEDGEMODE_AUTO) { - std::set::const_reverse_iterator tag = deliveryTags.rbegin(); - CAF_CM_ASSERT(tag != deliveryTags.rend()); - CAF_CM_LOG_DEBUG_VA2( - "basicAck [tag=%Ld][tag count=%d]", - *tag, - deliveryTags.size()); - _channel->basicAck(*tag, true); - } - } - } - CAF_CM_CATCH_ALL; - { - CAF_CM_LOCK_UNLOCK1(_parentLock); - _deliveryTags.clear(); - } - CAF_CM_THROWEXCEPTION; - return result; -} - -void BlockingQueueConsumer::rollbackOnExceptionIfNecessary(SmartPtrCCafException& ex) { - CAF_CM_FUNCNAME("rollbackOnExceptionIfNecessary"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_ASSERT(_isRunning); - - if (_acknowledgeMode == ACKNOWLEDGEMODE_AUTO) { - std::set deliveryTags; - { - CAF_CM_LOCK_UNLOCK1(_parentLock); - deliveryTags = _deliveryTags; - } - - CAF_CM_LOG_DEBUG_VA2( - "Rejecting %d messages on app exception: %s", - deliveryTags.size(), - ex->getMsg().c_str()); - - try { - for (TConstIterator > tag(deliveryTags); tag; tag++) { -#ifdef FIXED - _channel->basicReject(*tag, true); -#endif - } - } - CAF_CM_CATCH_ALL; - { - CAF_CM_LOCK_UNLOCK1(_parentLock); - _deliveryTags.clear(); - } - if (CAF_CM_ISEXCEPTION) { - CAF_CM_LOG_ERROR_VA1( - "App exception overridden by rollback exception: " - "%s", - ex->getFullMsg().c_str()); - ex = NULL; - CAF_CM_THROWEXCEPTION; - } - } -} - -void BlockingQueueConsumer::checkShutdown() { - CAF_CM_LOCK_UNLOCK1(_parentLock); - if (_shutdownException) { - _shutdownException->throwAddRefedSelf(); - } -} - -void BlockingQueueConsumer::start(const uint32 timeoutMs) { - CAF_CM_FUNCNAME("start"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_ASSERT(!_isRunning); - - CAF_CM_LOG_DEBUG_VA0("Starting consumer"); - _isCanceled = false; - _connection = _connectionFactory->createConnection(); - _channel = _connection->createChannel(); - - try { - _consumer.CreateInstance(); - _consumer->init(this); - - // Set the prefetchCount if ack mode is not NONE (broker-auto) - if (_acknowledgeMode != ACKNOWLEDGEMODE_NONE) { - _channel->basicQos(0, _prefetchCount, false); - } - - if (_connectionFactory->getProtocol().compare("tunnel") != 0) { - // Verify that the queue exists - try { - _channel->queueDeclarePassive(_queue); - } catch (AmqpClient::AmqpExceptions::AmqpIoErrorException *ex) { - std::string exMsg = ex->getMsg(); - ex->Release(); - CAF_CM_EXCEPTIONEX_VA1( - FatalListenerStartupException, - 0, - "Cannot prepare queue for listener. " - "Either the queue does not exist or the broker will not allow us to use it. %s", - exMsg.c_str()); - } - } - CAF_CM_LOG_DEBUG_VA1("Starting on queue '%s'", _queue.c_str()); - _channel->basicConsume( - _queue, - _acknowledgeMode == ACKNOWLEDGEMODE_NONE, - _consumer); - CAF_CM_LOG_DEBUG_VA1("Started on queue '%s'", _queue.c_str()); - - _isRunning = true; - } - CAF_CM_CATCH_ALL; - if (CAF_CM_ISEXCEPTION) { - CAF_CM_LOG_CRIT_CAFEXCEPTION; - if (_channel) { - _channel->close(); - _channel = NULL; - } - if (_connection) { - _connection->close(); - _connection = NULL; - } - } - CAF_CM_THROWEXCEPTION; -} - -void BlockingQueueConsumer::stop(const uint32 timeoutMs) { - CAF_CM_FUNCNAME("stop"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - _isCanceled = true; - - try { - std::string consumerTag = _consumer ? _consumer->getConsumerTag() : std::string(); - if (_channel && consumerTag.length()) { - if (_channel->isOpen()) { - CAF_CM_LOG_DEBUG_VA1( - "Canceling consumer '%s'", - consumerTag.c_str()); - _channel->basicCancel(consumerTag); - - // If we are not using broker auto-ack then re-queue the messages - if (_acknowledgeMode != ACKNOWLEDGEMODE_NONE) { - _channel->basicRecover(true); - } - - // Wait for the cancelOk response - CAF_CM_LOG_DEBUG_VA0("Waiting for consumer handler to receive cancel.ok"); - uint64 start = CDateTimeUtils::getTimeMs(); - while (CDateTimeUtils::calcRemainingTime(start, timeoutMs)) { - gpointer data = g_async_queue_try_pop(_deliveryQueue); - if (data) { - Delivery *delivery = reinterpret_cast(data); - if (!delivery->envelope) { - break; - } - delivery->Release(); - } - } - } - } - } - CAF_CM_CATCH_ALL; - - SmartPtrCCafException savedException; - if (CAF_CM_ISEXCEPTION) { - savedException = CAF_CM_GETEXCEPTION; - CAF_CM_CLEAREXCEPTION; - } - - try { - if (_channel) { - _channel->close(); - _channel = NULL; - } - if (_connection) { - _connection->close(); - _connection = NULL; - } - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_CLEAREXCEPTION; - - _consumer = NULL; - _isRunning = false; - _isCanceled = false; - - if (_shutdownException) { - _shutdownException = NULL; - } - - { - CAF_CM_LOCK_UNLOCK1(_parentLock); - _deliveryTags.clear(); - } - - if (savedException) { - savedException->throwAddRefedSelf(); - } -} - -bool BlockingQueueConsumer::isRunning() const { - CAF_CM_FUNCNAME_VALIDATE("isRunning"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _isRunning; -} - -SmartPtrIIntMessage BlockingQueueConsumer::handle(SmartPtrDelivery delivery) { - CAF_CM_FUNCNAME_VALIDATE("handle"); - CAF_CM_VALIDATE_INTERFACE(delivery); - - IIntMessage::SmartPtrCHeaders headers = _headerMapper->toHeaders( - delivery->properties, - delivery->envelope); - SmartPtrCIntMessage message; - message.CreateInstance(); - message->initialize(delivery->body, headers, NULL); - { - CAF_CM_LOCK_UNLOCK1(_parentLock); - _deliveryTags.insert(delivery->envelope->getDeliveryTag()); - } - return message; -} - -void BlockingQueueConsumer::destroyQueueItem(gpointer data) { - reinterpret_cast(data)->Release(); -} -#endif - -#if (1) // BlockingQueueConsumer::InternalConsumer -BlockingQueueConsumer::InternalConsumer::InternalConsumer() : - _deliveryQueue(NULL), - CAF_CM_INIT_LOG("InternalConsumer") { -} - -BlockingQueueConsumer::InternalConsumer::~InternalConsumer() { - if (_deliveryQueue) { - g_async_queue_unref(_deliveryQueue); - } -} - -void BlockingQueueConsumer::InternalConsumer::init( - BlockingQueueConsumer* parent) { - CAF_CM_FUNCNAME_VALIDATE("init"); - CAF_CM_VALIDATE_PTR(parent); - _parent = parent; - _deliveryQueue = _parent->_deliveryQueue; - g_async_queue_ref(_deliveryQueue); -} - -void BlockingQueueConsumer::InternalConsumer::handleConsumeOk( - const std::string& consumerTag) { - CAF_CM_FUNCNAME_VALIDATE("handleConsumeOk"); - _consumerTag = consumerTag; - CAF_CM_LOG_DEBUG_VA1("Received ConsumeOk - consumer='%s'", _consumerTag.c_str()); -} - -void BlockingQueueConsumer::InternalConsumer::handleCancelOk( - const std::string& consumerTag) { - CAF_CM_FUNCNAME_VALIDATE("handleCancelOk"); - CAF_CM_LOG_DEBUG_VA1("Received CancelOk - consumer='%s'", consumerTag.c_str()); - BlockingQueueConsumer::SmartPtrDelivery delivery; - delivery.CreateInstance(); - g_async_queue_push( - _deliveryQueue, - delivery.GetAddRefedInterface()); -} - -void BlockingQueueConsumer::InternalConsumer::handleRecoverOk( - const std::string& consumerTag) { -} - -void BlockingQueueConsumer::InternalConsumer::handleDelivery( - const std::string& consumerTag, - const AmqpClient::SmartPtrEnvelope& envelope, - const AmqpClient::AmqpContentHeaders::SmartPtrBasicProperties& properties, - const SmartPtrCDynamicByteArray& body) { - CAF_CM_FUNCNAME_VALIDATE("handleDelivery"); - CAF_CM_VALIDATE_SMARTPTR(_parent); - - if (_parent->_isCanceled) { - CAF_CM_LOG_DEBUG_VA0("Received message but parent is canceled."); - } else { - BlockingQueueConsumer::SmartPtrDelivery delivery; - delivery.CreateInstance(); - delivery->envelope = envelope; - delivery->properties = properties; - delivery->body = body; - g_async_queue_push( - _deliveryQueue, - delivery.GetAddRefedInterface()); - if (CAF_CM_IS_LOG_DEBUG_ENABLED) { - CAF_CM_LOG_DEBUG_VA4( - "Received message [exchange='%s'][rk='%s'][tag=%Lu][len=%d]", - envelope->getExchange().c_str(), - envelope->getRoutingKey().c_str(), - envelope->getDeliveryTag(), - body->getByteCount()); - } - } -} - -void BlockingQueueConsumer::InternalConsumer::handleShutdown( - const std::string& consumerTag, - SmartPtrCCafException& reason) { - CAF_CM_FUNCNAME_VALIDATE("handleShutdown"); - CAF_CM_VALIDATE_SMARTPTR(_parent); - CAF_CM_LOG_DEBUG_VA1( - "Received shutdown signal - consumer='%s'", - consumerTag.c_str()); - CAF_CM_LOCK_UNLOCK1(_parent->_parentLock); - _parent->_shutdownException = reason; - _parent->_deliveryTags.clear(); - _parent = NULL; -} - -std::string BlockingQueueConsumer::InternalConsumer::getConsumerTag() { - return _consumerTag; -} -#endif diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/CachedChannelHandler.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/CachedChannelHandler.cpp deleted file mode 100644 index b2921c2c8..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/CachedChannelHandler.cpp +++ /dev/null @@ -1,382 +0,0 @@ -/* - * Created on: Jun 1, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "amqpClient/amqpImpl/BasicProperties.h" -#include "Exception/CCafException.h" -#include "Memory/DynamicArray/DynamicArrayInc.h" -#include "amqpClient/api/AmqpMethods.h" -#include "amqpClient/api/Channel.h" -#include "amqpClient/api/Consumer.h" -#include "amqpClient/api/GetResponse.h" -#include "amqpClient/api/ReturnListener.h" -#include "amqpClient/api/amqpClient.h" -#include "amqpCore/CachingConnectionFactory.h" - -using namespace Caf::AmqpIntegration; - -CachingConnectionFactory::CachedChannelHandler::CachedChannelHandler() : - _parent(NULL), - CAF_CM_INIT_LOG("CachingConnectionFactory::CachedChannelHandler") { - CAF_CM_INIT_THREADSAFE; -} - -CachingConnectionFactory::CachedChannelHandler::~CachedChannelHandler() { -} - -void CachingConnectionFactory::CachedChannelHandler::init( - CachingConnectionFactory *parent, - AmqpClient::SmartPtrChannel channel) { - CAF_CM_FUNCNAME_VALIDATE("init"); - CAF_CM_VALIDATE_PTR(parent); - CAF_CM_VALIDATE_SMARTPTR(channel); - - _parent = parent; - _channel = channel; -} - -void CachingConnectionFactory::CachedChannelHandler::logicalClose() { - if (_channel && !_channel->isOpen()) { - _channel = NULL; - } else { - // Allow for multiple close calls - if this channel is already - // in the cached channels container then noop else add it - // to the cached channel collection - TSmartConstIterator proxy(*(_parent->_cachedChannels)); - while (proxy) { - if (*proxy == this) { - break; - } - proxy++; - } - if (!proxy) { - _parent->_cachedChannels->push_back(this); - } - } -} - -void CachingConnectionFactory::CachedChannelHandler::physicalClose() { - if (_channel && _channel->isOpen()) { - _channel->close(); - _channel = NULL; - } -} - -void CachingConnectionFactory::CachedChannelHandler::checkChannel() { - if (!_channel || !_channel->isOpen()) { - _channel = _parent->createBareChannel(); - } -} - -void CachingConnectionFactory::CachedChannelHandler::postProcessCall(SmartPtrCCafException exception) { - CAF_CM_FUNCNAME_VALIDATE("postProcessCall"); - if (exception) { - if (!_channel || !_channel->isOpen()) { - CAF_CM_LOG_DEBUG_VA0("Detected closed channel on exception. Re-initializing"); - _channel = _parent->createBareChannel(); - } - exception->throwAddRefedSelf(); - } -} - -AmqpClient::SmartPtrChannel -CachingConnectionFactory::CachedChannelHandler::getTargetChannel() { - CAF_CM_LOCK_UNLOCK; - return _channel; -} - -void CachingConnectionFactory::CachedChannelHandler::close() { - CAF_CM_LOCK_UNLOCK; - bool shouldPhysicallyClose = true; - if (_parent->_isActive) { - CAF_CM_LOCK_UNLOCK1(_parent->_cachedChannelsMonitor); - if (_parent->_cachedChannels->size() < _parent->getChannelCacheSize()) { - logicalClose(); - shouldPhysicallyClose = false; - } - } - - if (shouldPhysicallyClose) { - physicalClose(); - } -} - -bool CachingConnectionFactory::CachedChannelHandler::isOpen() { - CAF_CM_LOCK_UNLOCK; - return (_channel && _channel->isOpen()); -} - -uint16 CachingConnectionFactory::CachedChannelHandler::getChannelNumber() { - CAF_CM_LOCK_UNLOCK; - checkChannel(); - return _channel->getChannelNumber(); -} - -void CachingConnectionFactory::CachedChannelHandler::basicAck( - const uint64 deliveryTag, - const bool ackMultiple) { - CAF_CM_FUNCNAME("basicAck"); - CAF_CM_LOCK_UNLOCK; - checkChannel(); - try { - _channel->basicAck(deliveryTag, ackMultiple); - } - CAF_CM_CATCH_ALL; - postProcessCall(CAF_CM_GETEXCEPTION); -} - -AmqpClient::SmartPtrGetResponse -CachingConnectionFactory::CachedChannelHandler::basicGet( - const std::string& queue, - const bool noAck) { - CAF_CM_FUNCNAME("basicAck"); - CAF_CM_LOCK_UNLOCK; - checkChannel(); - AmqpClient::SmartPtrGetResponse response; - try { - response = _channel->basicGet(queue, noAck); - } - CAF_CM_CATCH_ALL; - postProcessCall(CAF_CM_GETEXCEPTION); - return response; -} - -void CachingConnectionFactory::CachedChannelHandler::basicPublish( - const std::string& exchange, - const std::string& routingKey, - const AmqpClient::AmqpContentHeaders::SmartPtrBasicProperties& properties, - const SmartPtrCDynamicByteArray& body) { - CAF_CM_FUNCNAME("basicPublish"); - CAF_CM_LOCK_UNLOCK; - checkChannel(); - try { - _channel->basicPublish(exchange, routingKey, properties, body); - } - CAF_CM_CATCH_ALL; - postProcessCall(CAF_CM_GETEXCEPTION); -} - -void CachingConnectionFactory::CachedChannelHandler::basicPublish( - const std::string& exchange, - const std::string& routingKey, - const bool mandatory, - const bool immediate, - const AmqpClient::AmqpContentHeaders::SmartPtrBasicProperties& properties, - const SmartPtrCDynamicByteArray& body) { - CAF_CM_FUNCNAME("basicPublish"); - CAF_CM_LOCK_UNLOCK; - checkChannel(); - try { - _channel->basicPublish( - exchange, - routingKey, - mandatory, - immediate, - properties, - body); - } - CAF_CM_CATCH_ALL; - postProcessCall(CAF_CM_GETEXCEPTION); -} - -AmqpClient::AmqpMethods::Basic::SmartPtrConsumeOk -CachingConnectionFactory::CachedChannelHandler::basicConsume( - const std::string& queue, - const AmqpClient::SmartPtrConsumer& consumer) { - CAF_CM_FUNCNAME("basicConsume"); - CAF_CM_LOCK_UNLOCK; - checkChannel(); - AmqpClient::AmqpMethods::Basic::SmartPtrConsumeOk consumeOk; - try { - consumeOk = _channel->basicConsume(queue, consumer); - } - CAF_CM_CATCH_ALL; - postProcessCall(CAF_CM_GETEXCEPTION); - return consumeOk; -} - -AmqpClient::AmqpMethods::Basic::SmartPtrConsumeOk -CachingConnectionFactory::CachedChannelHandler::basicConsume( - const std::string& queue, - const bool noAck, - const AmqpClient::SmartPtrConsumer& consumer) { - CAF_CM_FUNCNAME("basicConsume"); - CAF_CM_LOCK_UNLOCK; - checkChannel(); - AmqpClient::AmqpMethods::Basic::SmartPtrConsumeOk consumeOk; - try { - consumeOk = _channel->basicConsume(queue, noAck, consumer); - } - CAF_CM_CATCH_ALL; - postProcessCall(CAF_CM_GETEXCEPTION); - return consumeOk; -} - -AmqpClient::AmqpMethods::Basic::SmartPtrConsumeOk -CachingConnectionFactory::CachedChannelHandler::basicConsume( - const std::string& queue, - const std::string& consumerTag, - const bool noAck, - const bool noLocal, - const bool exclusive, - const AmqpClient::SmartPtrConsumer& consumer, - const AmqpClient::SmartPtrTable& arguments) { - CAF_CM_FUNCNAME("basicConsume"); - CAF_CM_LOCK_UNLOCK; - checkChannel(); - AmqpClient::AmqpMethods::Basic::SmartPtrConsumeOk consumeOk; - try { - consumeOk = _channel->basicConsume( - queue, - consumerTag, - noAck, - noLocal, - exclusive, - consumer, - arguments); - } - CAF_CM_CATCH_ALL; - postProcessCall(CAF_CM_GETEXCEPTION); - return consumeOk; -} - -AmqpClient::AmqpMethods::Basic::SmartPtrCancelOk -CachingConnectionFactory::CachedChannelHandler::basicCancel( - const std::string& consumerTag) { - CAF_CM_FUNCNAME("basicCancel"); - CAF_CM_LOCK_UNLOCK; - checkChannel(); - AmqpClient::AmqpMethods::Basic::SmartPtrCancelOk cancelOk; - try { - cancelOk = _channel->basicCancel(consumerTag); - } - CAF_CM_CATCH_ALL; - postProcessCall(CAF_CM_GETEXCEPTION); - return cancelOk; -} - -AmqpClient::AmqpMethods::Basic::SmartPtrRecoverOk -CachingConnectionFactory::CachedChannelHandler::basicRecover( - const bool requeue) { - CAF_CM_FUNCNAME("basicRecover"); - CAF_CM_LOCK_UNLOCK; - checkChannel(); - AmqpClient::AmqpMethods::Basic::SmartPtrRecoverOk recoverOk; - try { - recoverOk = _channel->basicRecover(requeue); - } - CAF_CM_CATCH_ALL; - postProcessCall(CAF_CM_GETEXCEPTION); - return recoverOk; -} - -AmqpClient::AmqpMethods::Basic::SmartPtrQosOk -CachingConnectionFactory::CachedChannelHandler::basicQos( - const uint32 prefetchSize, - const uint32 prefetchCount, - const bool global) { - return _channel->basicQos(prefetchSize, prefetchCount, global); -} - -void CachingConnectionFactory::CachedChannelHandler::basicReject( - const uint64 deliveryTag, - const bool requeue) { - return _channel->basicReject(deliveryTag, requeue); -} - -AmqpClient::AmqpMethods::Exchange::SmartPtrDeclareOk -CachingConnectionFactory::CachedChannelHandler::exchangeDeclare( - const std::string& exchange, - const std::string& type, - const bool durable, - const AmqpClient::SmartPtrTable& arguments) { - return _channel->exchangeDeclare(exchange, type, durable, arguments); -} - -AmqpClient::AmqpMethods::Exchange::SmartPtrDeleteOk -CachingConnectionFactory::CachedChannelHandler::exchangeDelete( - const std::string& exchange, - const bool ifUnused) { - return _channel->exchangeDelete(exchange, ifUnused); -} - -AmqpClient::AmqpMethods::Queue::SmartPtrDeclareOk -CachingConnectionFactory::CachedChannelHandler::queueDeclare() { - return _channel->queueDeclare(); -} - -AmqpClient::AmqpMethods::Queue::SmartPtrDeclareOk -CachingConnectionFactory::CachedChannelHandler::queueDeclare( - const std::string& queue, - const bool durable, - const bool exclusive, - const bool autoDelete, - const AmqpClient::SmartPtrTable& arguments) { - return _channel->queueDeclare( - queue, - durable, - exclusive, - autoDelete, - arguments); -} - -AmqpClient::AmqpMethods::Queue::SmartPtrDeclareOk -CachingConnectionFactory::CachedChannelHandler::queueDeclarePassive( - const std::string& queue) { - return _channel->queueDeclarePassive(queue); -} - -AmqpClient::AmqpMethods::Queue::SmartPtrDeleteOk -CachingConnectionFactory::CachedChannelHandler::queueDelete( - const std::string& queue, - const bool ifUnused, - const bool ifEmpty) { - return _channel->queueDelete(queue, ifUnused, ifEmpty); -} - -AmqpClient::AmqpMethods::Queue::SmartPtrPurgeOk -CachingConnectionFactory::CachedChannelHandler::queuePurge( - const std::string& queue) { - return _channel->queuePurge(queue); -} - -AmqpClient::AmqpMethods::Queue::SmartPtrBindOk -CachingConnectionFactory::CachedChannelHandler::queueBind( - const std::string& queue, - const std::string& exchange, - const std::string& routingKey, - const AmqpClient::SmartPtrTable& arguments) { - return _channel->queueBind( - queue, - exchange, - routingKey, - arguments); -} - -AmqpClient::AmqpMethods::Queue::SmartPtrUnbindOk -CachingConnectionFactory::CachedChannelHandler::queueUnbind( - const std::string& queue, - const std::string& exchange, - const std::string& routingKey, - const AmqpClient::SmartPtrTable& arguments) { - return _channel->queueUnbind( - queue, - exchange, - routingKey, - arguments); -} - -void CachingConnectionFactory::CachedChannelHandler::addReturnListener( - const AmqpClient::SmartPtrReturnListener& listener) { - return _channel->addReturnListener(listener); -} - -bool CachingConnectionFactory::CachedChannelHandler::removeReturnListener( - const AmqpClient::SmartPtrReturnListener& listener) { - return _channel->removeReturnListener(listener); -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/CachingConnectionFactory.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/CachingConnectionFactory.cpp deleted file mode 100644 index dd562b70d..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/CachingConnectionFactory.cpp +++ /dev/null @@ -1,218 +0,0 @@ -/* - * Created on: May 25, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "amqpClient/api/Channel.h" -#include "amqpClient/api/Connection.h" -#include "amqpCore/ChannelProxy.h" -#include "amqpCore/ConnectionListener.h" -#include "amqpCore/CachingConnectionFactory.h" - -using namespace Caf::AmqpIntegration; - -CachingConnectionFactory::CachingConnectionFactory() : - _isInitialized(false), - _isActive(true), - _channelCacheSize(2), - CAF_CM_INIT_LOG("CachingConnectionFactory") { - _connectionMonitor.CreateInstance(); - _connectionMonitor->initialize(); - - _cachedChannelsMonitor.CreateInstance(); - _cachedChannelsMonitor->initialize(); -} - -CachingConnectionFactory::~CachingConnectionFactory() { - CAF_CM_FUNCNAME("~CachingConnectionFactory"); - if (_connection) { - try { - try { - _connection->close(); - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_CLEAREXCEPTION; - - if (_cachedChannels) { - CAF_CM_LOCK_UNLOCK1(_cachedChannelsMonitor); - _cachedChannels->clear(); - _cachedChannels = NULL; - } - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_CLEAREXCEPTION; - } -} - -void CachingConnectionFactory::init() { - init(std::string(),std::string()); -} - -void CachingConnectionFactory::init( - const std::string& protocol, - const std::string& host, - const uint32 port) { - CAF_CM_FUNCNAME_VALIDATE("init"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - AbstractConnectionFactory::init(AmqpClient::createConnectionFactory()); - setConnectionTimeout(10000); - std::string locProtocol = protocol; - if (locProtocol.empty()) { - locProtocol = getDefaultProtocol(); - } - std::string hostname = host; - if (hostname.empty()) { - hostname = getDefaultHostName(); - } - setHost(hostname); - setPort(port); - _cachedChannels.CreateInstance(); - _isInitialized = true; -} - -void CachingConnectionFactory::init( - const std::string& protocol, - const std::string& host) { - init(protocol, host, AmqpClient::DEFAULT_AMQP_PORT); -} - -void CachingConnectionFactory::init( - const uint32 port) { - init(std::string(), std::string(), port); -} - -void CachingConnectionFactory::init( - const AmqpClient::SmartPtrConnectionFactory& amqpConnectionFactory) { - CAF_CM_FUNCNAME_VALIDATE("init"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - AbstractConnectionFactory::init(amqpConnectionFactory); - _cachedChannels.CreateInstance(); - _isInitialized = true; -} - -void CachingConnectionFactory::destroy() { - CAF_CM_FUNCNAME_VALIDATE("destroy"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - // This method ends up calling reset() during _connection->destroy() which - // sets _connection to NULL. To prevent the wheels from disappearing from - // underneath the _connection, store a temporary reference to it. - SmartPtrChannelCachingConnectionProxy connectionRef = _connection; - CAF_CM_LOCK_UNLOCK1(_connectionMonitor); - if (_connection) { - _connection->destroy(); - _connection = NULL; - } - reset(); -} - -uint32 CachingConnectionFactory::getChannelCacheSize() { - return _channelCacheSize; -} - -AmqpClient::SmartPtrChannel CachingConnectionFactory::getChannel() { - CAF_CM_FUNCNAME_VALIDATE("getChannel"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - AmqpClient::SmartPtrChannel channel; - { - CAF_CM_LOCK_UNLOCK1(_cachedChannelsMonitor); - if (_cachedChannels->size()) { - channel = _cachedChannels->front(); - _cachedChannels->pop_front(); - } - } - if (channel) { - CAF_CM_LOG_DEBUG_VA1("found cached rabbit channel #%d", channel->getChannelNumber()); - } else { - channel = newCachedChannelProxy(); - } - return channel; -} - -void CachingConnectionFactory::setConnectionListeners( - const std::deque& listeners) { - CAF_CM_FUNCNAME_VALIDATE("setConnectionListeners"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - AbstractConnectionFactory::setConnectionListeners(listeners); - if (_connection) { - getConnectionListener()->onCreate(_connection); - } -} - -void CachingConnectionFactory::setChannelCacheSize(uint32 cacheSize) { - CAF_CM_FUNCNAME("setChannelCacheSize"); - CAF_CM_ASSERT(cacheSize >= 1); - _channelCacheSize = cacheSize; -} - -void CachingConnectionFactory::addConnectionListener( - const SmartPtrConnectionListener& listener) { - CAF_CM_FUNCNAME_VALIDATE("addConnectionListener"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_SMARTPTR(listener); - AbstractConnectionFactory::addConnectionListener(listener); - if (_connection) { - listener->onCreate(_connection); - } -} - -SmartPtrConnection CachingConnectionFactory::createConnection() { - CAF_CM_FUNCNAME_VALIDATE("createConnection"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_LOCK_UNLOCK1(_connectionMonitor); - if (!_connection) { - _connection.CreateInstance(); - _connection->init(createBareConnection(), this); - getConnectionListener()->onCreate(_connection); - } - return _connection; -} - -void CachingConnectionFactory::reset() { - CAF_CM_FUNCNAME("reset"); - _isActive = false; - CAF_CM_LOCK_UNLOCK1(_cachedChannelsMonitor); - for (TSmartIterator channel(*_cachedChannels); - channel; - channel++) { - try { - AmqpClient::SmartPtrChannel target = channel->getTargetChannel(); - if (target) { - target->close(); - } - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_CLEAREXCEPTION; - } - try { - _cachedChannels->clear(); - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_CLEAREXCEPTION; - _isActive = true; - _connection = NULL; -} - -SmartPtrChannelProxy CachingConnectionFactory::newCachedChannelProxy(){ - AmqpClient::SmartPtrChannel channel = createBareChannel(); - SmartPtrCachedChannelHandler proxy; - proxy.CreateInstance(); - proxy->init(this, channel); - return proxy; -} - -AmqpClient::SmartPtrChannel CachingConnectionFactory::createBareChannel() { - if (!_connection || !_connection->isOpen()) { - _connection = NULL; - createConnection(); - } - return _connection->createBareChannel(); -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/ChannelCachingConnectionProxy.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/ChannelCachingConnectionProxy.cpp deleted file mode 100644 index 33f385700..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/ChannelCachingConnectionProxy.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Created on: Jun 1, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "amqpClient/api/Channel.h" -#include "amqpClient/api/Connection.h" -#include "amqpCore/CachingConnectionFactory.h" - -using namespace Caf::AmqpIntegration; - -CachingConnectionFactory::ChannelCachingConnectionProxy::ChannelCachingConnectionProxy() : - _parent(NULL), - CAF_CM_INIT_LOG("CachingConnectionFactory::ChannelCachingConnectionProxy") { -} - -CachingConnectionFactory::ChannelCachingConnectionProxy::~ChannelCachingConnectionProxy() { - _target = NULL; - _parent = NULL; -} - -void CachingConnectionFactory::ChannelCachingConnectionProxy::init( - SmartPtrConnection connection, - CachingConnectionFactory *parent) { - _target = connection; - _parent = parent; -} - -void CachingConnectionFactory::ChannelCachingConnectionProxy::destroy() { - CAF_CM_FUNCNAME("destroy"); - if (_target) { - _parent->getConnectionListener()->onClose(_target); - try { - _target->close(); - } - CAF_CM_CATCH_ALL; - CAF_CM_CLEAREXCEPTION; - try { - _parent->reset(); - } - CAF_CM_CATCH_ALL; - CAF_CM_CLEAREXCEPTION; - } - _target = NULL; -} - -SmartPtrConnection CachingConnectionFactory::ChannelCachingConnectionProxy::getTargetConnection() { - return _target; -} - -AmqpClient::SmartPtrChannel CachingConnectionFactory::ChannelCachingConnectionProxy::createChannel() { - return _parent->getChannel(); -} - -void CachingConnectionFactory::ChannelCachingConnectionProxy::close() { -} - -bool CachingConnectionFactory::ChannelCachingConnectionProxy::isOpen() { - return _target && _target->isOpen(); -} - -AmqpClient::SmartPtrChannel CachingConnectionFactory::ChannelCachingConnectionProxy::createBareChannel() { - return _target->createChannel(); -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/CompositeConnectionListener.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/CompositeConnectionListener.cpp deleted file mode 100644 index 40e45dffb..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/CompositeConnectionListener.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Created on: Jun 2, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "amqpClient/api/Connection.h" -#include "amqpCore/CompositeConnectionListener.h" - -using namespace Caf::AmqpIntegration; - -CompositeConnectionListener::CompositeConnectionListener() : - CAF_CM_INIT_LOG("CompositeConnectionListener") { -} - -CompositeConnectionListener::~CompositeConnectionListener() { -} - -void CompositeConnectionListener::setDelegates( - const ListenerDeque& delegates) { - _delegates = delegates; -} - -void CompositeConnectionListener::addDelegate( - const SmartPtrConnectionListener& delegate) { - CAF_CM_FUNCNAME_VALIDATE("addDelegate"); - CAF_CM_VALIDATE_SMARTPTR(delegate); - _delegates.push_back(delegate); -} - -void CompositeConnectionListener::onCreate( - const SmartPtrConnection& connection) { - CAF_CM_FUNCNAME("onCreate"); - CAF_CM_VALIDATE_SMARTPTR(connection); - for (TSmartIterator delegate(_delegates); - delegate; - delegate++) { - try { - delegate->onCreate(connection); - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_CLEAREXCEPTION; - } -} - -void CompositeConnectionListener::onClose( - const SmartPtrConnection& connection) { - CAF_CM_FUNCNAME("onClose"); - CAF_CM_VALIDATE_SMARTPTR(connection); - for (TSmartIterator delegate(_delegates); - delegate; - delegate++) { - try { - delegate->onClose(connection); - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_CLEAREXCEPTION; - } -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/DefaultAmqpHeaderMapper.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/DefaultAmqpHeaderMapper.cpp deleted file mode 100644 index ff300153d..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/DefaultAmqpHeaderMapper.cpp +++ /dev/null @@ -1,293 +0,0 @@ -/* - * Created on: Jun 6, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "amqpClient/amqpImpl/BasicProperties.h" -#include "Common/CVariant.h" -#include "Integration/IIntMessage.h" -#include "amqpClient/api/Envelope.h" -#include "amqpClient/api/amqpClient.h" -#include "amqpCore/DefaultAmqpHeaderMapper.h" -#include "Integration/Core/CIntMessageHeaders.h" -#include "Exception/CCafException.h" -#include "HeaderUtils.h" - -using namespace Caf::AmqpIntegration; - -DefaultAmqpHeaderMapper::DefaultAmqpHeaderMapper() : - _isInitialized(false), - CAF_CM_INIT("DefaultAmqpHeaderMapper") { -} - -DefaultAmqpHeaderMapper::~DefaultAmqpHeaderMapper() { -} - -void DefaultAmqpHeaderMapper::init(const std::string& userHeaderRegex) { - CAF_CM_FUNCNAME_VALIDATE("init"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - - if (!userHeaderRegex.empty()) { - _userHeaderRegex.CreateInstance(); - _userHeaderRegex->initialize(userHeaderRegex); - } - - _isInitialized = true; -} - -AmqpClient::AmqpContentHeaders::SmartPtrBasicProperties -DefaultAmqpHeaderMapper::fromHeaders( - IIntMessage::SmartPtrCHeaders headers) { - CAF_CM_FUNCNAME("fromHeaders"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - AmqpClient::AmqpContentHeaders::SmartPtrBasicProperties properties; - properties = AmqpClient::AmqpContentHeaders::createBasicProperties(); - - SmartPtrCVariant variant; - variant = HeaderUtils::getHeaderString(headers, APP_ID); - if (variant) { - properties->setAppId(g_variant_get_string(variant->get(), NULL)); - } - variant = HeaderUtils::getHeaderString(headers, CONTENT_ENCODING); - if (variant) { - properties->setContentEncoding(g_variant_get_string(variant->get(), NULL)); - } else { - properties->setContentEncoding("UTF8"); - } - variant = HeaderUtils::getHeaderString(headers, CONTENT_TYPE); - if (variant) { - properties->setContentType(g_variant_get_string(variant->get(), NULL)); - } else { - properties->setContentType("text/plain"); - } - variant = HeaderUtils::getHeaderString(headers, CORRELATION_ID); - if (variant) { - properties->setCorrelationId(g_variant_get_string(variant->get(), NULL)); - } - variant = HeaderUtils::getHeaderUint8(headers, DELIVERY_MODE); - if (variant) { - properties->setDeliveryMode(g_variant_get_byte(variant->get())); - } - variant = HeaderUtils::getHeaderString(headers, EXPIRATION); - if (variant) { - properties->setExpiration(g_variant_get_string(variant->get(), NULL)); - } - variant = HeaderUtils::getHeaderString(headers, MESSAGE_ID); - if (variant) { - properties->setMessageId(g_variant_get_string(variant->get(), NULL)); - } - variant = HeaderUtils::getHeaderString(headers, REPLY_TO); - if (variant) { - properties->setReplyTo(g_variant_get_string(variant->get(), NULL)); - } - variant = HeaderUtils::getHeaderUint64(headers, TIMESTAMP); - if (variant) { - properties->setTimestamp(g_variant_get_uint64(variant->get())); - } - variant = HeaderUtils::getHeaderString(headers, TYPE); - if (variant) { - properties->setType(g_variant_get_string(variant->get(), NULL)); - } - variant = HeaderUtils::getHeaderString(headers, USER_ID); - if (variant) { - properties->setUserId(g_variant_get_string(variant->get(), NULL)); - } - - // map user-defined headers - if (_userHeaderRegex) { - AmqpClient::SmartPtrTable propertyHeaders; - propertyHeaders.CreateInstance(); - for (IIntMessage::CHeaders::const_iterator headerIter = headers->begin(); - headerIter != headers->end(); - headerIter++) { - const std::string headerName = headerIter->first; - if (_userHeaderRegex->isMatched(headerName)) { - const SmartPtrIVariant headerValue = headerIter->second.first; - CAF_CM_VALIDATE_SMARTPTR(headerValue); - GVariant *headerVal = headerValue->get(); - if (g_variant_is_of_type(headerVal, G_VARIANT_TYPE_STRING)) { - AmqpClient::tableAddUtf8( - headerName, - headerValue->toString(), - propertyHeaders); - } else if (g_variant_is_of_type(headerVal, G_VARIANT_TYPE_BOOLEAN)) { - AmqpClient::tableAddBoolean( - headerName, - g_variant_get_boolean(headerVal), - propertyHeaders); - } else if (g_variant_is_of_type(headerVal, G_VARIANT_TYPE_BYTE)) { - AmqpClient::tableAddUint8( - headerName, - g_variant_get_byte(headerVal), - propertyHeaders); - } else if (g_variant_is_of_type(headerVal, G_VARIANT_TYPE_INT16)) { - AmqpClient::tableAddInt16( - headerName, - g_variant_get_int16(headerVal), - propertyHeaders); - } else if (g_variant_is_of_type(headerVal, G_VARIANT_TYPE_UINT16)) { - AmqpClient::tableAddUint16( - headerName, - g_variant_get_uint16(headerVal), - propertyHeaders); - } else if (g_variant_is_of_type(headerVal, G_VARIANT_TYPE_INT32)) { - AmqpClient::tableAddInt32( - headerName, - g_variant_get_int32(headerVal), - propertyHeaders); - } else if (g_variant_is_of_type(headerVal, G_VARIANT_TYPE_UINT32)) { - AmqpClient::tableAddUint32( - headerName, - g_variant_get_uint32(headerVal), - propertyHeaders); - } else if (g_variant_is_of_type(headerVal, G_VARIANT_TYPE_INT64)) { - AmqpClient::tableAddInt64( - headerName, - g_variant_get_int64(headerVal), - propertyHeaders); - } else if (g_variant_is_of_type(headerVal, G_VARIANT_TYPE_UINT64)) { - AmqpClient::tableAddUint64( - headerName, - g_variant_get_uint64(headerVal), - propertyHeaders); - } else { - CAF_CM_EXCEPTIONEX_VA2( - InvalidArgumentException, - 0, - "Unsupported GVariant conversion. [name='%s'][type='%s']", - headerName.c_str(), - g_variant_get_type_string(headerVal)); - } - } - } - if (propertyHeaders->size()) { - properties->setHeaders(propertyHeaders); - } - } - return properties; -} - -IIntMessage::SmartPtrCHeaders - DefaultAmqpHeaderMapper::toHeaders( - AmqpClient::AmqpContentHeaders::SmartPtrBasicProperties properties, - AmqpClient::SmartPtrEnvelope envelope) { - CAF_CM_FUNCNAME_VALIDATE("toHeaders"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - CIntMessageHeaders messageHeaders; - messageHeaders.insertUint64(DELIVERY_TAG, envelope->getDeliveryTag()); - messageHeaders.insertString(RECEIVED_ROUTING_KEY, envelope->getRoutingKey()); - messageHeaders.insertBool(REDELIVERED, envelope->getRedelivered()); - - // The exchange name can be empty, meaning the default exchange - messageHeaders.insertStringOpt(RECEIVED_EXCHANGE, envelope->getExchange()); - - const uint32 flags = properties->getFlags(); - if (flags & AmqpClient::AmqpContentHeaders::BASIC_PROPERTY_APP_ID_FLAG) { - messageHeaders.insertString(APP_ID, properties->getAppId()); - } - if (flags & AmqpClient::AmqpContentHeaders::BASIC_PROPERTY_CONTENT_ENCODING_FLAG) { - messageHeaders.insertString(CONTENT_ENCODING, properties->getContentEncoding()); - } - if (flags & AmqpClient::AmqpContentHeaders::BASIC_PROPERTY_CONTENT_TYPE_FLAG) { - messageHeaders.insertString(CONTENT_TYPE, properties->getContentType()); - } - if (flags & AmqpClient::AmqpContentHeaders::BASIC_PROPERTY_CORRELATION_ID_FLAG) { - messageHeaders.insertString(CORRELATION_ID, properties->getCorrelationId()); - } - if (flags & AmqpClient::AmqpContentHeaders::BASIC_PROPERTY_DEVLIVERY_MODE_FLAG) { - messageHeaders.insertUint8(DELIVERY_MODE, properties->getDeliveryMode()); - } - if (flags & AmqpClient::AmqpContentHeaders::BASIC_PROPERTY_EXPIRATION_FLAG) { - messageHeaders.insertString(EXPIRATION, properties->getExpiration()); - } - if (flags & AmqpClient::AmqpContentHeaders::BASIC_PROPERTY_MESSAGE_ID_FLAG) { - messageHeaders.insertString(MESSAGE_ID, properties->getMessageId()); - } - if (flags & AmqpClient::AmqpContentHeaders::BASIC_PROPERTY_REPLY_TO_FLAG) { - messageHeaders.insertString(REPLY_TO, properties->getReplyTo()); - } - if (flags & AmqpClient::AmqpContentHeaders::BASIC_PROPERTY_TIMESTAMP_FLAG) { - messageHeaders.insertUint64(TIMESTAMP, properties->getTimestamp()); - } - if (flags & AmqpClient::AmqpContentHeaders::BASIC_PROPERTY_TYPE_FLAG) { - messageHeaders.insertString(TYPE, properties->getType()); - } - if (flags & AmqpClient::AmqpContentHeaders::BASIC_PROPERTY_USER_ID_FLAG) { - messageHeaders.insertString(USER_ID, properties->getUserId()); - } - if ((flags & AmqpClient::AmqpContentHeaders::BASIC_PROPERTY_HEADERS_FLAG) && - _userHeaderRegex) { - AmqpClient::SmartPtrTable table = properties->getHeaders(); - for (TSmartConstMapIterator field(*table); - field; - field++) { - const std::string fieldName = field.getKey(); - if (_userHeaderRegex->isMatched(fieldName)) { - GVariant *fieldVar = field->getValue(); - switch (field->getAmqpType()) { - case AmqpClient::Field::AMQP_FIELD_TYPE_UTF8: - messageHeaders.insertString(fieldName, g_variant_get_string(fieldVar, NULL)); - break; - case AmqpClient::Field::AMQP_FIELD_TYPE_BOOLEAN: - messageHeaders.insertBool(fieldName, g_variant_get_boolean(fieldVar)); - break; - case AmqpClient::Field::AMQP_FIELD_TYPE_I8: - case AmqpClient::Field::AMQP_FIELD_TYPE_U8: - messageHeaders.insertUint8(fieldName, g_variant_get_byte(fieldVar)); - break; - case AmqpClient::Field::AMQP_FIELD_TYPE_I16: - messageHeaders.insertInt16(fieldName, g_variant_get_int16(fieldVar)); - break; - case AmqpClient::Field::AMQP_FIELD_TYPE_U16: - messageHeaders.insertUint16(fieldName, g_variant_get_uint16(fieldVar)); - break; - case AmqpClient::Field::AMQP_FIELD_TYPE_I32: - messageHeaders.insertInt32(fieldName, g_variant_get_int32(fieldVar)); - break; - case AmqpClient::Field::AMQP_FIELD_TYPE_U32: - messageHeaders.insertUint32(fieldName, g_variant_get_uint32(fieldVar)); - break; - case AmqpClient::Field::AMQP_FIELD_TYPE_I64: - messageHeaders.insertInt64(fieldName, g_variant_get_int64(fieldVar)); - break; - case AmqpClient::Field::AMQP_FIELD_TYPE_U64: - case AmqpClient::Field::AMQP_FIELD_TYPE_TIMESTAMP: - messageHeaders.insertUint64(fieldName, g_variant_get_uint64(fieldVar)); - break; - default: - break; - } - } - } - } - - return messageHeaders.getHeaders(); -} - -IIntMessage::SmartPtrCHeaders DefaultAmqpHeaderMapper::filterHeaders( - IIntMessage::SmartPtrCHeaders headers) { - CAF_CM_FUNCNAME_VALIDATE("filterHeaders"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - IIntMessage::SmartPtrCHeaders filteredHeaders; - filteredHeaders.CreateInstance(); - - if (_userHeaderRegex) { - for (IIntMessage::CHeaders::const_iterator headerIter = headers->begin(); - headerIter != headers->end(); - headerIter++) { - const std::string headerName = headerIter->first; - if (_userHeaderRegex->isMatched(headerName)) { - filteredHeaders->insert( - IIntMessage::CHeaders::value_type( - headerName, - std::make_pair(headerIter->second.first, headerIter->second.second))); - } - } - } - return filteredHeaders; -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/ExchangeImpl.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/ExchangeImpl.cpp deleted file mode 100644 index 1ccdfbbba..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/ExchangeImpl.cpp +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Created on: Jun 14, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "amqpCore/Exchange.h" -#include "amqpCore/ExchangeImpl.h" - -using namespace Caf::AmqpIntegration; - -const char *ExchangeTypes::DIRECT = "direct"; -const char *ExchangeTypes::TOPIC = "topic"; -const char *ExchangeTypes::HEADERS = "headers"; -const char *ExchangeTypes::FANOUT = "fanout"; - -AbstractExchange::AbstractExchange() : - _isDurable(true) { -} - -AbstractExchange::~AbstractExchange() { -} - -void AbstractExchange::init( - const std::string& name, - const bool isDurable) { - _name = name; - _isDurable = isDurable; -} - -std::string AbstractExchange::getName() const { - return _name; -} - -bool AbstractExchange::isDurable() const { - return _isDurable; -} - -DirectExchange::DirectExchange() { -} - -void DirectExchange::init( - const std::string name, - const bool durable) { - AbstractExchange::init(name, durable); -} - -std::string DirectExchange::getType() const { - return ExchangeTypes::DIRECT; -} - -SmartPtrExchange AMQPINTEGRATIONCORE_LINKAGE Caf::AmqpIntegration::createDirectExchange( - const std::string& name, - const bool durable) { - SmartPtrDirectExchange exchange; - exchange.CreateInstance(); - exchange->init(name, durable); - return exchange; -} - -TopicExchange::TopicExchange() { -} - -void TopicExchange::init( - const std::string name, - const bool durable) { - AbstractExchange::init(name, durable); -} - -std::string TopicExchange::getType() const { - return ExchangeTypes::TOPIC; -} - -SmartPtrExchange AMQPINTEGRATIONCORE_LINKAGE Caf::AmqpIntegration::createTopicExchange( - const std::string& name, - const bool durable) { - SmartPtrTopicExchange exchange; - exchange.CreateInstance(); - exchange->init(name, durable); - return exchange; -} - -HeadersExchange::HeadersExchange() { -} - -void HeadersExchange::init( - const std::string name, - const bool durable) { - AbstractExchange::init(name, durable); -} - -std::string HeadersExchange::getType() const { - return ExchangeTypes::HEADERS; -} - -SmartPtrExchange AMQPINTEGRATIONCORE_LINKAGE Caf::AmqpIntegration::createHeadersExchange( - const std::string& name, - const bool durable) { - SmartPtrHeadersExchange exchange; - exchange.CreateInstance(); - exchange->init(name, durable); - return exchange; -} - -FanoutExchange::FanoutExchange() { -} - -void FanoutExchange::init( - const std::string name, - const bool durable) { - AbstractExchange::init(name, durable); -} - -std::string FanoutExchange::getType() const { - return ExchangeTypes::FANOUT; -} - -SmartPtrExchange AMQPINTEGRATIONCORE_LINKAGE Caf::AmqpIntegration::createFanoutExchange( - const std::string& name, - const bool durable) { - SmartPtrFanoutExchange exchange; - exchange.CreateInstance(); - exchange->init(name, durable); - return exchange; -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/HeaderUtils.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/HeaderUtils.cpp deleted file mode 100644 index dc015685c..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/HeaderUtils.cpp +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Created on: Jun 6, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Common/CVariant.h" -#include "Integration/IIntMessage.h" -#include "HeaderUtils.h" - -using namespace Caf::AmqpIntegration; - -SmartPtrCVariant HeaderUtils::getHeaderString( - const IIntMessage::SmartPtrCHeaders& headers, - const std::string& tag) { - SmartPtrCVariant variant; - IIntMessage::CHeaders::const_iterator header = - headers->find(tag); - if (header != headers->end()) { - variant = CVariant::createString(header->second.first->toString()); - } - return variant; -} - -SmartPtrCVariant HeaderUtils::getHeaderUint8( - const IIntMessage::SmartPtrCHeaders& headers, - const std::string& tag) { - SmartPtrCVariant variant; - IIntMessage::CHeaders::const_iterator header = - headers->find(tag); - if (header != headers->end()) { - if (g_variant_is_of_type(header->second.first->get(), G_VARIANT_TYPE_BYTE)) { - variant = CVariant::createUint8(g_variant_get_byte(header->second.first->get())); - } else { - variant = CVariant::createUint8( - CStringConv::fromString(header->second.first->toString())); - } - } - return variant; -} - -SmartPtrCVariant HeaderUtils::getHeaderUint16( - const IIntMessage::SmartPtrCHeaders& headers, - const std::string& tag) { - SmartPtrCVariant variant; - IIntMessage::CHeaders::const_iterator header = - headers->find(tag); - if (header != headers->end()) { - if (g_variant_is_of_type(header->second.first->get(), G_VARIANT_TYPE_UINT16)) { - variant = CVariant::createUint16(g_variant_get_uint16(header->second.first->get())); - } else { - variant = CVariant::createUint16( - CStringConv::fromString(header->second.first->toString())); - } - } - return variant; -} - -SmartPtrCVariant HeaderUtils::getHeaderUint32( - const IIntMessage::SmartPtrCHeaders& headers, - const std::string& tag) { - SmartPtrCVariant variant; - IIntMessage::CHeaders::const_iterator header = - headers->find(tag); - if (header != headers->end()) { - if (g_variant_is_of_type(header->second.first->get(), G_VARIANT_TYPE_UINT32)) { - variant = CVariant::createUint32(g_variant_get_uint32(header->second.first->get())); - } else { - variant = CVariant::createUint32( - CStringConv::fromString(header->second.first->toString())); - } - } - return variant; -} - -SmartPtrCVariant HeaderUtils::getHeaderUint64( - const IIntMessage::SmartPtrCHeaders& headers, - const std::string& tag) { - SmartPtrCVariant variant; - IIntMessage::CHeaders::const_iterator header = - headers->find(tag); - if (header != headers->end()) { - if (g_variant_is_of_type(header->second.first->get(), G_VARIANT_TYPE_UINT64)) { - variant = CVariant::createUint64(g_variant_get_uint64(header->second.first->get())); - } else { - variant = CVariant::createUint64( - CStringConv::fromString(header->second.first->toString())); - } - } - return variant; -} - -SmartPtrCVariant HeaderUtils::getHeaderBool( - const IIntMessage::SmartPtrCHeaders& headers, - const std::string& tag) { - SmartPtrCVariant variant; - IIntMessage::CHeaders::const_iterator header = - headers->find(tag); - if (header != headers->end()) { - if (g_variant_is_of_type(header->second.first->get(), G_VARIANT_TYPE_BOOLEAN)) { - variant = CVariant::createBool(g_variant_get_boolean(header->second.first->get())); - } else { - const std::string val = header->second.first->toString(); - variant = CVariant::createBool( - (val == "0") || - (g_ascii_strncasecmp(val.c_str(), "false", val.length()) == 0) - ? false : true); - } - } - return variant; -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/HeaderUtils.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/HeaderUtils.h deleted file mode 100644 index 09ffcda3c..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/HeaderUtils.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Created on: Jun 6, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AMQPINTEGRATIONCORE_HEADERUTILS_H_ -#define AMQPINTEGRATIONCORE_HEADERUTILS_H_ - -#include "Common/CVariant.h" -#include "Integration/IIntMessage.h" - -namespace Caf { namespace AmqpIntegration { - -/** - * @brief A collection of helper functions - */ -class AMQPINTEGRATIONCORE_LINKAGE HeaderUtils { -public: - /** - * @brief Extract a header value as text - * @param headers message headers - * @param tag value name - * @return the value as a variant String - */ - static SmartPtrCVariant getHeaderString( - const IIntMessage::SmartPtrCHeaders& headers, - const std::string& tag); - - /** - * @brief Extract a header value as an unsigned 8-bit integer - * @param headers message headers - * @param tag value name - * @return the value as a variant Uint8 - */ - static SmartPtrCVariant getHeaderUint8( - const IIntMessage::SmartPtrCHeaders& headers, - const std::string& tag); - - /** - * @brief Extract a header value as an unsigned 16-bit integer - * @param headers message headers - * @param tag value name - * @return the value as a variant Uint16 - */ - static SmartPtrCVariant getHeaderUint16( - const IIntMessage::SmartPtrCHeaders& headers, - const std::string& tag); - - /** - * @brief Extract a header value as an unsigned 32-bit integer - * @param headers message headers - * @param tag value name - * @return the value as a variant Uint32 - */ - static SmartPtrCVariant getHeaderUint32( - const IIntMessage::SmartPtrCHeaders& headers, - const std::string& tag); - - /** - * @brief Extract a header value as an unsigned 64-bit integer - * @param headers message headers - * @param tag value name - * @return the value as a variant Uint64 - */ - static SmartPtrCVariant getHeaderUint64( - const IIntMessage::SmartPtrCHeaders& headers, - const std::string& tag); - - /** - * @brief Extract a header value as a boolean - * @param headers message headers - * @param tag value name - * @return the value as a variant Bool - */ - static SmartPtrCVariant getHeaderBool( - const IIntMessage::SmartPtrCHeaders& headers, - const std::string& tag); -}; - -}} - -#endif /* AMQPINTEGRATIONCORE_HEADERUTILS_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/QueueImpl.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/QueueImpl.cpp deleted file mode 100644 index 828ddfd98..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/QueueImpl.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Created on: Jun 14, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "amqpCore/Queue.h" -#include "amqpCore/QueueImpl.h" - -using namespace Caf::AmqpIntegration; - -QueueImpl::QueueImpl() : - _durable(false), - _exclusive(false), - _autoDelete(false) { -} - -QueueImpl::~QueueImpl() { -} - -void QueueImpl::init(const std::string& name) { - init(name, true, false, false); -} - -void QueueImpl::init( - const std::string& name, - const bool durable) { - init(name, durable, false, false); -} - -void QueueImpl::init( - const std::string& name, - const bool durable, - const bool exclusive, - const bool autoDelete) { - _name = name; - _durable = durable; - _exclusive = exclusive; - _autoDelete = autoDelete; -} - -std::string QueueImpl::getName() const { - return _name; -} - -bool QueueImpl::isDurable() const { - return _durable; -} - -bool QueueImpl::isExclusive() const { - return _exclusive; -} - -bool QueueImpl::isAutoDelete() const { - return _autoDelete; -} - -SmartPtrQueue AMQPINTEGRATIONCORE_LINKAGE Caf::AmqpIntegration::createQueue( - const std::string& name) { - SmartPtrQueueImpl queue; - queue.CreateInstance(); - queue->init(name); - return queue; -} - -SmartPtrQueue AMQPINTEGRATIONCORE_LINKAGE Caf::AmqpIntegration::createQueue( - const std::string& name, - const bool durable) { - SmartPtrQueueImpl queue; - queue.CreateInstance(); - queue->init(name, durable); - return queue; -} - -SmartPtrQueue AMQPINTEGRATIONCORE_LINKAGE Caf::AmqpIntegration::createQueue( - const std::string& name, - const bool durable, - const bool exclusive, - const bool autoDelete) { - SmartPtrQueueImpl queue; - queue.CreateInstance(); - queue->init(name, durable, exclusive, autoDelete); - return queue; -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/RabbitAdmin.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/RabbitAdmin.cpp deleted file mode 100644 index 0acf40998..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/RabbitAdmin.cpp +++ /dev/null @@ -1,316 +0,0 @@ -/* - * Created on: Jun 12, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Common/CVariant.h" -#include "amqpClient/api/AmqpMethods.h" -#include "amqpClient/api/Channel.h" -#include "amqpCore/Binding.h" -#include "amqpClient/api/ConnectionFactory.h" -#include "amqpCore/Exchange.h" -#include "amqpCore/Queue.h" -#include "amqpCore/RabbitAdmin.h" - -using namespace Caf::AmqpIntegration; - -RabbitAdmin::RabbitAdmin() : - _isInitialized(false), - CAF_CM_INIT_LOG("RabbitAdmin") { -} - -RabbitAdmin::~RabbitAdmin() { - CAF_CM_FUNCNAME("~RabbitAdmin"); - try { - if (_rabbitTemplate) { - _rabbitTemplate->term(); - } - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_CLEAREXCEPTION; -} - -void RabbitAdmin::init(SmartPtrConnectionFactory connectionFactory) { - CAF_CM_FUNCNAME_VALIDATE("init"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_SMARTPTR(connectionFactory); - _rabbitTemplate.CreateInstance(); - _rabbitTemplate->init(connectionFactory); - _isInitialized = true; -} - -void RabbitAdmin::term() { - CAF_CM_FUNCNAME_VALIDATE("term"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - _rabbitTemplate->term(); - _rabbitTemplate = NULL; -} - -void RabbitAdmin::declareExchange(SmartPtrExchange exchange) { - CAF_CM_FUNCNAME_VALIDATE("declareExchange"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_SMARTPTR(exchange); - SmartPtrDeclareExchangeExecutor executor; - executor.CreateInstance(); - _rabbitTemplate->execute(executor, exchange.GetNonAddRefedInterface()); -} - -bool RabbitAdmin::deleteExchange(const std::string& exchange) { - CAF_CM_FUNCNAME_VALIDATE("deleteExchange"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(exchange); - SmartPtrDeleteExchangeExecutor executor; - executor.CreateInstance(); - gpointer result = _rabbitTemplate->execute( - executor, - const_cast(exchange.c_str())); - return result != NULL; -} - -SmartPtrQueue RabbitAdmin::declareQueue() { - CAF_CM_FUNCNAME_VALIDATE("declareQueue"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - SmartPtrDeclareQueueExecutor executor; - executor.CreateInstance(); - gpointer result = _rabbitTemplate->execute(executor, NULL); - CAF_CM_VALIDATE_PTR(result); - Queue *queuePtr = reinterpret_cast(result); - SmartPtrQueue queue(queuePtr); - queuePtr->Release(); - return queue; -} - -void RabbitAdmin::declareQueue(SmartPtrQueue queue) { - CAF_CM_FUNCNAME_VALIDATE("declareQueue"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - SmartPtrDeclareQueueExecutor executor; - executor.CreateInstance(); - _rabbitTemplate->execute(executor, queue.GetNonAddRefedInterface()); -} - -bool RabbitAdmin::deleteQueue(const std::string& queue) { - CAF_CM_FUNCNAME_VALIDATE("deleteQueue"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(queue); - SmartPtrDeleteQueueExecutor executor; - executor.CreateInstance(); - gpointer result = _rabbitTemplate->execute( - executor, - const_cast(queue.c_str())); - return result != NULL; -} - -void RabbitAdmin::deleteQueue( - const std::string& queue, - const bool unused, - const bool empty) { - CAF_CM_FUNCNAME_VALIDATE("deleteQueue"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(queue); - SmartPtrCVariant args[3]; - args[0] = CVariant::createString(queue); - args[1] = CVariant::createBool(unused); - args[2] = CVariant::createBool(empty); - SmartPtrDeleteQueueExExecutor executor; - executor.CreateInstance(); - _rabbitTemplate->execute(executor, args); -} - -void RabbitAdmin::purgeQueue(const std::string& queue) { - CAF_CM_FUNCNAME_VALIDATE("purgeQueue"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(queue); - SmartPtrPurgeQueueExecutor executor; - executor.CreateInstance(); - _rabbitTemplate->execute( - executor, - const_cast(queue.c_str())); -} - -void RabbitAdmin::declareBinding(SmartPtrBinding binding) { - CAF_CM_FUNCNAME_VALIDATE("declareBinding"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_SMARTPTR(binding); - SmartPtrDeclareBindingExecutor executor; - executor.CreateInstance(); - _rabbitTemplate->execute( - executor, - binding.GetNonAddRefedInterface()); -} - -void RabbitAdmin::removeBinding(SmartPtrBinding binding) { - CAF_CM_FUNCNAME_VALIDATE("removeBinding"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_SMARTPTR(binding); - SmartPtrRemoveBindingExecutor executor; - executor.CreateInstance(); - _rabbitTemplate->execute( - executor, - binding.GetNonAddRefedInterface()); -} - -gpointer RabbitAdmin::DeclareExchangeExecutor::execute( - AmqpClient::SmartPtrChannel channel, - gpointer data) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("RabbitAdmin::DeclareExchangeExecutor", "execute"); - CAF_CM_VALIDATE_SMARTPTR(channel); - CAF_CM_VALIDATE_PTR(data); - Exchange *exchange = reinterpret_cast(data); - CAF_CM_LOG_DEBUG_VA3( - "declaring exchange '%s' type '%s' durable=%d", - exchange->getName().c_str(), - exchange->getType().c_str(), - exchange->isDurable()); - channel->exchangeDeclare( - exchange->getName(), - exchange->getType(), - exchange->isDurable()); - return NULL; -} - -gpointer RabbitAdmin::DeleteExchangeExecutor::execute( - AmqpClient::SmartPtrChannel channel, - gpointer data) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("RabbitAdmin::DeleteExchangeExecutor", "execute"); - CAF_CM_VALIDATE_SMARTPTR(channel); - CAF_CM_VALIDATE_PTR(data); - const char *exchange = reinterpret_cast(data); - CAF_CM_LOG_DEBUG_VA1( - "deleting exchange '%s'", - exchange); - gpointer result = NULL; - try { - channel->exchangeDelete(exchange, false); - result = reinterpret_cast(0x01); - } catch (AmqpClient::AmqpExceptions::ChannelClosedByServerException *ex) { - ex->Release(); - } - return NULL; -} - -gpointer RabbitAdmin::DeclareQueueExecutor::execute( - AmqpClient::SmartPtrChannel channel, - gpointer data) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("RabbitAdmin::DeclareQueueExecutor", "execute"); - CAF_CM_VALIDATE_SMARTPTR(channel); - - gpointer result = NULL; - if (data) { - Queue *queue = reinterpret_cast(data); - const std::string queueName = queue->getName(); - if (queueName.find("amq.", 0) == 0) { - CAF_CM_LOG_ERROR_VA1( - "Cannot declare queue '%s' because it's name begins with 'amq.'", - queueName.c_str()); - } else { - CAF_CM_LOG_DEBUG_VA4( - "declaring queue '%s' [durable=%d][exclusive=%d][autoDelete=%d]", - queueName.c_str(), - queue->isDurable(), - queue->isExclusive(), - queue->isAutoDelete()); - - channel->queueDeclare( - queue->getName(), - queue->isDurable(), - queue->isExclusive(), - queue->isAutoDelete()); - } - } else { - AmqpClient::AmqpMethods::Queue::SmartPtrDeclareOk declareOk = - channel->queueDeclare(); - SmartPtrQueue queue = createQueue( - declareOk->getQueueName(), - false, - true, - true); - result = queue.GetAddRefedInterface(); - } - return result; -} - -gpointer RabbitAdmin::DeleteQueueExecutor::execute( - AmqpClient::SmartPtrChannel channel, - gpointer data) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("RabbitAdmin::DeleteQueueExecutor", "execute"); - CAF_CM_VALIDATE_SMARTPTR(channel); - CAF_CM_VALIDATE_PTR(data); - const char *queue = reinterpret_cast(data); - CAF_CM_LOG_DEBUG_VA1( - "deleting queue '%s'", - queue); - gpointer result = NULL; - try { - channel->queueDelete(queue, false, false); - result = reinterpret_cast(0x01); - } catch (AmqpClient::AmqpExceptions::ChannelClosedByServerException *ex) { - ex->Release(); - } - return result; -} - -gpointer RabbitAdmin::DeleteQueueExExecutor::execute( - AmqpClient::SmartPtrChannel channel, - gpointer data) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("RabbitAdmin::DeleteQueueExExecutor", "execute"); - CAF_CM_VALIDATE_SMARTPTR(channel); - CAF_CM_VALIDATE_PTR(data); - SmartPtrCVariant *args = reinterpret_cast(data); - CAF_CM_LOG_DEBUG_VA3( - "deleting queue '%s' [unused=%d][empty=%d]", - g_variant_get_string(args[0]->get(), NULL), - g_variant_get_boolean(args[1]->get()), - g_variant_get_boolean(args[2]->get())); - channel->queueDelete( - g_variant_get_string(args[0]->get(), NULL), - g_variant_get_boolean(args[1]->get()), - g_variant_get_boolean(args[2]->get())); - return NULL; -} - -gpointer RabbitAdmin::PurgeQueueExecutor::execute( - AmqpClient::SmartPtrChannel channel, - gpointer data) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("RabbitAdmin::PurgeQueueExecutor", "execute"); - CAF_CM_VALIDATE_SMARTPTR(channel); - CAF_CM_VALIDATE_PTR(data); - const char *queue = reinterpret_cast(data); - CAF_CM_LOG_DEBUG_VA1( - "purging queue '%s'", - queue); - channel->queuePurge(queue); - return NULL; -} - -gpointer RabbitAdmin::DeclareBindingExecutor::execute( - AmqpClient::SmartPtrChannel channel, - gpointer data) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("RabbitAdmin::DeclareBindingExecutor", "execute"); - CAF_CM_VALIDATE_SMARTPTR(channel); - CAF_CM_VALIDATE_PTR(data); - Binding *binding = reinterpret_cast(data); - channel->queueBind( - binding->getQueue(), - binding->getExchange(), - binding->getRoutingKey()); - return NULL; -} - -gpointer RabbitAdmin::RemoveBindingExecutor::execute( - AmqpClient::SmartPtrChannel channel, - gpointer data) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("RabbitAdmin::RemoveBindingExecutor", "execute"); - CAF_CM_VALIDATE_SMARTPTR(channel); - CAF_CM_VALIDATE_PTR(data); - Binding *binding = reinterpret_cast(data); - channel->queueUnbind( - binding->getQueue(), - binding->getExchange(), - binding->getRoutingKey()); - return NULL; -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/RabbitTemplate.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/RabbitTemplate.cpp deleted file mode 100644 index 2308d3643..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/RabbitTemplate.cpp +++ /dev/null @@ -1,339 +0,0 @@ -/* - * Created on: Jun 5, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "amqpClient/amqpImpl/BasicProperties.h" -#include "Integration/Core/CIntMessage.h" -#include "Integration/IIntMessage.h" -#include "Memory/DynamicArray/DynamicArrayInc.h" -#include "amqpClient/api/AmqpMethods.h" -#include "amqpClient/api/Channel.h" -#include "amqpClient/api/Envelope.h" -#include "amqpClient/api/GetResponse.h" -#include "amqpCore/AmqpHeaderMapper.h" -#include "amqpCore/AmqpTemplate.h" -#include "amqpClient/api/ConnectionFactory.h" -#include "amqpCore/DefaultAmqpHeaderMapper.h" -#include "amqpCore/RabbitTemplate.h" -#include "Exception/CCafException.h" -#include "AutoChannelClose.h" - -using namespace Caf::AmqpIntegration; - -std::string RabbitTemplate::DEFAULT_EXCHANGE = ""; -std::string RabbitTemplate::DEFAULT_ROUTING_KEY = ""; -int32 RabbitTemplate::DEFAULT_REPLY_TIMEOUT = 5000; - -RabbitTemplate::RabbitTemplate() : - _isInitialized(false), - _exchange(DEFAULT_EXCHANGE), - _routingKey(DEFAULT_ROUTING_KEY), - _replyTimeout(DEFAULT_REPLY_TIMEOUT), - CAF_CM_INIT_LOG("RabbitTemplate") { -} - -RabbitTemplate::~RabbitTemplate() { - CAF_CM_FUNCNAME("~RabbitTemplate"); - try { - term(); - } - CAF_CM_CATCH_ALL; - CAF_CM_CLEAREXCEPTION; -} - -void RabbitTemplate::init(SmartPtrConnectionFactory connectionFactory) { - CAF_CM_FUNCNAME_VALIDATE("init"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_SMARTPTR(connectionFactory); - SmartPtrDefaultAmqpHeaderMapper defaultMapper; - defaultMapper.CreateInstance(); - defaultMapper->init(); - _headerMapper = defaultMapper; - _connectionFactory = connectionFactory; - _connection = _connectionFactory->createConnection(); - _isInitialized = true; -} - -void RabbitTemplate::term() { - if (_connection) { - _connection->close(); - _connection = NULL; - } -} - -void RabbitTemplate::setExchange(const std::string& exchange) { - _exchange = exchange; -} - -void RabbitTemplate::setRoutingKey(const std::string& routingKey) { - _routingKey = routingKey; -} - -void RabbitTemplate::setQueue(const std::string& queue) { - _queue = queue; -} - -void RabbitTemplate::setReplyTimeout(const uint32 replyTimeout) { - _replyTimeout = replyTimeout; -} - -void RabbitTemplate::setHeaderMapper(const SmartPtrAmqpHeaderMapper& headerMapper) { - CAF_CM_FUNCNAME_VALIDATE("setHeaderMapper"); - CAF_CM_VALIDATE_SMARTPTR(headerMapper); - _headerMapper = headerMapper; -} - -void RabbitTemplate::send( - SmartPtrIIntMessage message, - SmartPtrAmqpHeaderMapper headerMapper) { - send( - _exchange, - _routingKey, - message, - headerMapper); -} - -void RabbitTemplate::send( - const std::string& routingKey, - SmartPtrIIntMessage message, - SmartPtrAmqpHeaderMapper headerMapper) { - send( - _exchange, - routingKey, - message, - headerMapper); -} - -void RabbitTemplate::send( - const std::string& exchange, - const std::string& routingKey, - SmartPtrIIntMessage message, - SmartPtrAmqpHeaderMapper headerMapper) { - CAF_CM_FUNCNAME_VALIDATE("send"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - AmqpClient::SmartPtrChannel channel = _connection->createChannel(); - AutoChannelClose closer(channel); - doSend(channel, exchange, routingKey, message, headerMapper); -} - -SmartPtrIIntMessage RabbitTemplate::receive(SmartPtrAmqpHeaderMapper headerMapper) { - return receive(_queue, headerMapper); -} - -SmartPtrIIntMessage RabbitTemplate::receive( - const std::string& queueName, - SmartPtrAmqpHeaderMapper headerMapper) { - CAF_CM_FUNCNAME_VALIDATE("receive"); - CAF_CM_VALIDATE_STRING(queueName); - - SmartPtrCIntMessage message; - AmqpClient::SmartPtrChannel channel = _connection->createChannel(); - AutoChannelClose closer(channel); - AmqpClient::SmartPtrGetResponse response = channel->basicGet(queueName, true); - if (response) { - if (!headerMapper) { - headerMapper = _headerMapper; - } - IIntMessage::SmartPtrCHeaders headers = - headerMapper->toHeaders( - response->getProperties(), - response->getEnvelope()); - message.CreateInstance(); - message->initialize(response->getBody(), headers, - IIntMessage::SmartPtrCHeaders()); - } - return message; -} - -SmartPtrIIntMessage RabbitTemplate::sendAndReceive( - SmartPtrIIntMessage message, - SmartPtrAmqpHeaderMapper requestHeaderMapper, - SmartPtrAmqpHeaderMapper responseHeaderMapper) { - return sendAndReceive( - _exchange, - _routingKey, - message, - requestHeaderMapper, - responseHeaderMapper); -} - -SmartPtrIIntMessage RabbitTemplate::sendAndReceive( - const std::string& routingKey, - SmartPtrIIntMessage message, - SmartPtrAmqpHeaderMapper requestHeaderMapper, - SmartPtrAmqpHeaderMapper responseHeaderMapper) { - return sendAndReceive( - _exchange, - routingKey, - message, - requestHeaderMapper, - responseHeaderMapper); -} - -SmartPtrIIntMessage RabbitTemplate::sendAndReceive( - const std::string& exchange, - const std::string& routingKey, - SmartPtrIIntMessage message, - SmartPtrAmqpHeaderMapper requestHeaderMapper, - SmartPtrAmqpHeaderMapper responseHeaderMapper) { - AmqpClient::SmartPtrChannel channel = _connection->createChannel(); - AutoChannelClose closer(channel); - return doSendAndReceive( - channel, - exchange, - routingKey, - message, - requestHeaderMapper, - responseHeaderMapper); -} - -gpointer RabbitTemplate::execute(SmartPtrExecutor executor, gpointer data) { - CAF_CM_FUNCNAME_VALIDATE("execute"); - CAF_CM_VALIDATE_INTERFACE(executor); - AmqpClient::SmartPtrChannel channel = _connection->createChannel(); - CAF_CM_VALIDATE_SMARTPTR(channel); - AutoChannelClose closer(channel); - return executor->execute(channel, data); -} - -void RabbitTemplate::doSend( - AmqpClient::SmartPtrChannel channel, - const std::string& exchange, - const std::string& routingKey, - SmartPtrIIntMessage message, - SmartPtrAmqpHeaderMapper headerMapper) { - CAF_CM_FUNCNAME_VALIDATE("doSend"); - CAF_CM_LOG_DEBUG_VA2( - "Publishing message on exchange [%s], routingKey= [%s]", - exchange.c_str(), - routingKey.c_str()); - - if (!headerMapper) { - headerMapper = _headerMapper; - } - - AmqpClient::AmqpContentHeaders::SmartPtrBasicProperties props = headerMapper->fromHeaders(message->getHeaders()); - channel->basicPublish( - exchange, - routingKey, - false, - false, - props, - message->getPayload()); -} - -SmartPtrIIntMessage RabbitTemplate::doSendAndReceive( - AmqpClient::SmartPtrChannel channel, - const std::string& exchange, - const std::string& routingKey, - SmartPtrIIntMessage message, - SmartPtrAmqpHeaderMapper requestHeaderMapper, - SmartPtrAmqpHeaderMapper responseHeaderMapper) { - CAF_CM_FUNCNAME("doSendAndReceive"); - - if (!requestHeaderMapper) { - requestHeaderMapper = _headerMapper; - } - if (!responseHeaderMapper) { - responseHeaderMapper = _headerMapper; - } - - IIntMessage::SmartPtrCHeaders headers = message->getHeaders(); - if (headers->find(AmqpHeaderMapper::REPLY_TO) != headers->end()) { - CAF_CM_EXCEPTIONEX_VA1( - IllegalStateException, - 0, - "Send-and-receive methods can only be used if the message " - "does not already have a %s property", - AmqpHeaderMapper::REPLY_TO.c_str()); - } - - // Declare a temporary queue and set the replyTo - AmqpClient::AmqpMethods::Queue::SmartPtrDeclareOk queueDeclareOk = - channel->queueDeclare(); - headers->insert( - std::make_pair( - AmqpHeaderMapper::REPLY_TO, - std::make_pair( - CVariant::createString(queueDeclareOk->getQueueName()), SmartPtrICafObject()))); - - // Create an inter-thread RPC mechanism to capture the response - SmartPtrSynchronousHandoff handoff; - handoff.CreateInstance(); - - // Spin up a consumer to wait for the response - SmartPtrDefaultConsumer consumer; - consumer.CreateInstance(); - consumer->init(responseHeaderMapper, handoff); - const std::string consumerTag = CStringUtils::createRandomUuid(); - const bool noAck = false; - const bool noLocal = true; - const bool exclusive = true; - AmqpClient::AmqpMethods::Basic::SmartPtrConsumeOk consumeOk = - channel->basicConsume( - queueDeclareOk->getQueueName(), - consumerTag, - noAck, - noLocal, - exclusive, - consumer); - - // Send the message - doSend(channel, exchange, routingKey, message, requestHeaderMapper); - - // Wait for the reply - SmartPtrIIntMessage reply = handoff->get(_replyTimeout); - - // Cancel the consumer - channel->basicCancel(consumerTag); - - return reply; -} - -RabbitTemplate::DefaultConsumer::DefaultConsumer() { -} - -RabbitTemplate::DefaultConsumer::~DefaultConsumer() { -} - -void RabbitTemplate::DefaultConsumer::init( - SmartPtrAmqpHeaderMapper mapper, - SmartPtrSynchronousHandoff handoff) { - _mapper = mapper; - _handoff = handoff; -} - -void RabbitTemplate::DefaultConsumer::handleDelivery( - const std::string& consumerTag, - const AmqpClient::SmartPtrEnvelope& envelope, - const AmqpClient::AmqpContentHeaders::SmartPtrBasicProperties& properties, - const SmartPtrCDynamicByteArray& body) { - const IIntMessage::SmartPtrCHeaders headers = - _mapper->toHeaders(properties, envelope); - SmartPtrCIntMessage message; - message.CreateInstance(); - message->initialize(body, headers, IIntMessage::SmartPtrCHeaders()); - _handoff->set(message); -} - -void RabbitTemplate::DefaultConsumer::handleConsumeOk( - const std::string& consumerTag) { -} - -void RabbitTemplate::DefaultConsumer::handleCancelOk( - const std::string& consumerTag) { -} - -void RabbitTemplate::DefaultConsumer::handleRecoverOk( - const std::string& consumerTag) { -} - -void RabbitTemplate::DefaultConsumer::handleShutdown( - const std::string& consumerTag, - SmartPtrCCafException& reason) { -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/SimpleConnection.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/SimpleConnection.cpp deleted file mode 100644 index f7ae62c4b..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/SimpleConnection.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Created on: May 25, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "amqpClient/api/Channel.h" -#include "amqpCore/SimpleConnection.h" - -using namespace Caf::AmqpIntegration; - -SimpleConnection::SimpleConnection() : - CAF_CM_INIT("SimpleConnection") { -} - -SimpleConnection::~SimpleConnection() { -} - -void SimpleConnection::init(const AmqpClient::SmartPtrConnection& delegate) { - CAF_CM_FUNCNAME_VALIDATE("init"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_delegate); - CAF_CM_VALIDATE_SMARTPTR(delegate); - _delegate = delegate; -} - -AmqpClient::SmartPtrChannel SimpleConnection::createChannel() { - CAF_CM_FUNCNAME_VALIDATE("createChannel"); - CAF_CM_PRECOND_ISINITIALIZED(_delegate); - return _delegate->createChannel(); -} - -void SimpleConnection::close() { - CAF_CM_FUNCNAME_VALIDATE("close"); - CAF_CM_PRECOND_ISINITIALIZED(_delegate); - _delegate->close(); -} - -bool SimpleConnection::isOpen() { - return _delegate && _delegate->isOpen(); -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/SimpleMessageListenerContainer.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/SimpleMessageListenerContainer.cpp deleted file mode 100644 index c05634965..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/SimpleMessageListenerContainer.cpp +++ /dev/null @@ -1,414 +0,0 @@ -/* - * Created on: Aug 1, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Integration/IIntMessage.h" -#include "Integration/IThrowable.h" -#include "amqpClient/api/Channel.h" -#include "amqpCore/BlockingQueueConsumer.h" -#include "amqpClient/api/ConnectionFactory.h" -#include "amqpCore/DefaultAmqpHeaderMapper.h" -#include "amqpCore/MessageListener.h" -#include "amqpCore/SimpleMessageListenerContainer.h" -#include "Integration/Core/CIntException.h" -#include "Exception/CCafException.h" - -using namespace Caf::AmqpIntegration; - -SimpleMessageListenerContainer::SimpleMessageListenerContainer() : - _isInitialized(false), - _isRunning(false), - _isActive(false), - _debugTrace(true), - _acknowledgeMode(ACKNOWLEDGEMODE_NONE), - _receiveTimeout(5000), - _prefetchCount(0), - _txSize(1), - _recoveryInterval(30000), - CAF_CM_INIT_LOG("SimpleMessageListenerContainer") { -} - -SimpleMessageListenerContainer::~SimpleMessageListenerContainer() { -} - -void SimpleMessageListenerContainer::init() { - init(_connectionFactory); -} - -void SimpleMessageListenerContainer::init( - SmartPtrConnectionFactory connectionFactory) { - CAF_CM_FUNCNAME_VALIDATE("init"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(_connectionFactory); - _connectionFactory = connectionFactory; - validateConfig(); - _isInitialized = true; - -} -void SimpleMessageListenerContainer::setAcknowledgeMode( - AcknowledgeMode acknowledgeMode) { - CAF_CM_FUNCNAME_VALIDATE("setAcknowledgeMode"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - _acknowledgeMode = acknowledgeMode; -} - -void SimpleMessageListenerContainer::setPrefetchCount( - const uint32 prefetchCount) { - CAF_CM_FUNCNAME_VALIDATE("setPrefetchCount"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - _prefetchCount = prefetchCount; -} - -void SimpleMessageListenerContainer::setReceiveTimeout( - const uint32 receiveTimeout) { - CAF_CM_FUNCNAME_VALIDATE("setReceiveTimeout"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_NOTZERO(receiveTimeout); - _receiveTimeout = receiveTimeout; -} - -void SimpleMessageListenerContainer::setRecoveryInterval( - const uint32 recoveryInterval) { - CAF_CM_FUNCNAME_VALIDATE("setRecoveryInterval"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_NOTZERO(recoveryInterval); - _recoveryInterval = recoveryInterval; -} - -void SimpleMessageListenerContainer::setTxSize( - const uint32 txSize) { - CAF_CM_FUNCNAME_VALIDATE("setTxSize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_NOTZERO(txSize); - _txSize = txSize; -} - -void SimpleMessageListenerContainer::setQueue( - const std::string& queue) { - CAF_CM_FUNCNAME_VALIDATE("setQueue"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(queue); - _queue = queue; -} - -void SimpleMessageListenerContainer::setConnectionFactory( - SmartPtrConnectionFactory connectionFactory) { - CAF_CM_FUNCNAME_VALIDATE("setConnectionFactory"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(connectionFactory); - _connectionFactory = connectionFactory; -} - -void SimpleMessageListenerContainer::setMessagerListener( - SmartPtrMessageListener messageListener) { - CAF_CM_FUNCNAME_VALIDATE("setMessageListener"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(messageListener); - _messageListener = messageListener; -} - -SmartPtrMessageListener SimpleMessageListenerContainer::getMessageListener() { - return _messageListener; -} - -void SimpleMessageListenerContainer::start(const uint32 timeout) { - CAF_CM_FUNCNAME("start"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_ASSERT(!_isRunning); - _isActive = true; - - CAF_CM_LOG_DEBUG_VA0("Starting Rabbit listener container"); - - _startupException.CreateInstance(); - - // There is no point in prefetching less than the transaction size because - // the consumer will stall since the broker will not receive an ack for delivered - // messages - const uint32 actualPrefetchCount = _prefetchCount > _txSize ? _prefetchCount : _txSize; - CAF_CM_LOG_DEBUG_VA3( - "Config: [prefetchCount=%d][txSize=%d][actualPrefetchCount=%d]", - _prefetchCount, - _txSize, - actualPrefetchCount); - - // At this level simply allow all headers to pass through. - // The message listener consuming the message will have - // an opportunity to filter the headers. - SmartPtrDefaultAmqpHeaderMapper headerMapper; - headerMapper.CreateInstance(); - headerMapper->init(".*"); - - _consumer.CreateInstance(); - _consumer->init( - _connectionFactory, - headerMapper, - _acknowledgeMode, - actualPrefetchCount, - _queue); - - SmartPtrAsyncMessageProcessingConsumer processor; - processor.CreateInstance(); - processor->init( - this, - _consumer, - _startupException, - timeout, - _recoveryInterval); - - _executor.CreateInstance(); - _executor->initialize(processor, processor); - _executor->execute(timeout); - - // Wait for the consumer to start or fail - const uint64 remainingTime = CDateTimeUtils::calcRemainingTime( - CDateTimeUtils::getTimeMs(), - timeout); - if (remainingTime) { - SmartPtrCCafException ex = _startupException->get(static_cast(remainingTime)); - if (ex) { - CAF_CM_LOG_CRIT_VA0("Fatal exception on listener startup"); - ex->throwAddRefedSelf(); - } - } else { - try { - _executor->cancel(timeout); - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_CLEAREXCEPTION; - CAF_CM_EXCEPTIONEX_VA0( - TimeoutException, - 0, - "The timeout value specified is not int32 enough to determine " - "if the consumer has started. Increase the timeout value."); - } - - _startupException = NULL; - _isRunning = true; -} - -void SimpleMessageListenerContainer::stop(const uint32 timeout) { - CAF_CM_FUNCNAME("stop"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - _isActive = false; - if (_isRunning) { - try { - _executor->cancel(timeout); - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_CLEAREXCEPTION; - } - _isRunning = false; -} - -bool SimpleMessageListenerContainer::isRunning() const { - CAF_CM_FUNCNAME_VALIDATE("isRunning"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _isRunning; -} - -void SimpleMessageListenerContainer::validateConfig() { - CAF_CM_FUNCNAME_VALIDATE("validateConfig"); - CAF_CM_VALIDATE_INTERFACE(_connectionFactory); - CAF_CM_VALIDATE_INTERFACE(_messageListener); - CAF_CM_VALIDATE_STRING(_queue); - CAF_CM_VALIDATE_NOTZERO(_receiveTimeout); - CAF_CM_VALIDATE_NOTZERO(_recoveryInterval); - CAF_CM_VALIDATE_NOTZERO(_txSize); -} - -bool SimpleMessageListenerContainer::isActive() { - return _isActive; -} - -bool SimpleMessageListenerContainer::receiveAndExecute( - SmartPtrBlockingQueueConsumer consumer) { - CAF_CM_FUNCNAME("receiveAndExecute"); - AmqpClient::SmartPtrChannel channel = _consumer->getChannel(); - for (uint32 i = 0; i < _txSize; ++i) { - if (_debugTrace) { - CAF_CM_LOG_DEBUG_VA0("Waiting for message from consumer"); - } - SmartPtrIIntMessage message = _consumer->nextMessage(_receiveTimeout); - if (!message) { - break; - } - - try { - executeListener(channel, message); - } - CAF_CM_CATCH_ALL; - if (CAF_CM_ISEXCEPTION) { - SmartPtrCCafException ex = CAF_CM_GETEXCEPTION; - CAF_CM_CLEAREXCEPTION; - _consumer->rollbackOnExceptionIfNecessary(ex); - ex->throwAddRefedSelf(); - } - } - - return _consumer->commitIfNecessary(); -} - -void SimpleMessageListenerContainer::executeListener( - AmqpClient::SmartPtrChannel channel, - SmartPtrIIntMessage message) { - doInvokeListener(message); -} - -void SimpleMessageListenerContainer::doInvokeListener( - SmartPtrIIntMessage message) { - CAF_CM_FUNCNAME("doInvokeListener"); - try { - _messageListener->onMessage(message); - } catch (ListenerExecutionFailedException *ex) { - // noop - let 'er rip - ex->throwSelf(); - } - CAF_CM_CATCH_ALL; - if (CAF_CM_ISEXCEPTION) { - const std::string orig = CAF_CM_EXCEPTION_GET_FULLMSG; - CAF_CM_CLEAREXCEPTION; - CAF_CM_EXCEPTIONEX_VA1( - ListenerExecutionFailedException, - 0, - "Listener threw exception: %s", - orig.c_str()); - } -} - -void SimpleMessageListenerContainer::restart() { - CAF_CM_FUNCNAME_VALIDATE("restart"); - CAF_CM_LOG_DEBUG_VA0("Restarting Rabbit listener container"); - _isRunning = false; - start(30000); -} - -#if (1) // AsyncMessageProcessingConsumer -SimpleMessageListenerContainer::AsyncMessageProcessingConsumer::AsyncMessageProcessingConsumer() : - _parent(NULL), - _timeout(0), - _recoveryInterval(0), - _isCanceled(false), - CAF_CM_INIT_LOG("SimpleMessageListenerContainer::AsyncMessageProcessingConsumer") { -} - -SimpleMessageListenerContainer::AsyncMessageProcessingConsumer::~AsyncMessageProcessingConsumer() { -} - -void SimpleMessageListenerContainer::AsyncMessageProcessingConsumer::init( - SimpleMessageListenerContainer *parent, - SmartPtrBlockingQueueConsumer consumer, - SmartPtrStartupExceptionHandoff startupException, - const uint32 timeout, - const uint32 recoveryInterval) { - _parent = parent; - _consumer = consumer; - _startupException = startupException; - _timeout = timeout; - _recoveryInterval = recoveryInterval; -} - -void SimpleMessageListenerContainer::AsyncMessageProcessingConsumer::run() { - CAF_CM_FUNCNAME("run"); - bool isAborted = false; - - try { - try { - _consumer->start(_timeout); - _startupException->set(NULL); - _startupException = NULL; - } catch (FatalListenerStartupException *ex) { - ex->throwSelf(); - } - CAF_CM_CATCH_ALL; - if (CAF_CM_ISEXCEPTION) { - _startupException->set(NULL); - _startupException = NULL; - CAF_CM_LOG_ERROR_CAFEXCEPTION; - handleStartupFailure(); - CAF_CM_THROWEXCEPTION; - } - - bool isContinuable = false; - while (!_isCanceled && (_parent->isActive() || isContinuable)) { - try { - isContinuable = _parent->receiveAndExecute(_consumer); - } catch (ListenerExecutionFailedException *ex) { - // ignore - _logger.log( - log4cpp::Priority::ERROR, - _cm_funcName_, - __LINE__, - ex); - ex->Release(); - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_ERROR_CAFEXCEPTION; - CAF_CM_THROWEXCEPTION; - } - } catch (FatalListenerStartupException *ex) { - CAF_CM_LOG_ERROR_VA1( - "Consumer received fatal exception on startup: %s", - ex->getFullMsg().c_str()); - ex->Release(); - isAborted = true; - } - CAF_CM_CATCH_ALL; - if (CAF_CM_ISEXCEPTION) { - CAF_CM_LOG_WARN_VA1( - "Consumer raised exception. Processing will restart if the connection " - "factory supports it. Exception: %s", - (CAF_CM_EXCEPTION_GET_FULLMSG).c_str()); - CAF_CM_CLEAREXCEPTION; - } - - if (_startupException) { - _startupException->set(NULL); - _startupException = NULL; - } - - if (_isCanceled) { - CAF_CM_LOG_DEBUG_VA0("Canceling due to TaskContainer->cancel()"); - } else { - if (!_parent->isActive() || isAborted) { - CAF_CM_LOG_DEBUG_VA0("Canceling consumer"); - try { - _consumer->stop(_timeout); - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_ERROR_CAFEXCEPTION; - CAF_CM_CLEAREXCEPTION; - - if (isAborted) { - CAF_CM_LOG_INFO_VA0("Stopping parent container because of aborted consumer"); - _parent->stop(_timeout); - } - } else { - CAF_CM_LOG_INFO_VA0("Restarting consumer"); - _parent->restart(); - } - } -} - -void SimpleMessageListenerContainer::AsyncMessageProcessingConsumer::cancel() { - _isCanceled = true; -} - -void SimpleMessageListenerContainer::AsyncMessageProcessingConsumer::handleError( - const SmartPtrIThrowable& throwable, - const SmartPtrIIntMessage& message) const { -} - -void SimpleMessageListenerContainer::AsyncMessageProcessingConsumer::handleStartupFailure() { - uint64 start = CDateTimeUtils::getTimeMs(); - while (!_isCanceled && CDateTimeUtils::calcRemainingTime(start, _recoveryInterval)) { - CThreadUtils::sleep(100); - } -} -#endif diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/amqpIntegrationCoreLink.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/amqpIntegrationCoreLink.h deleted file mode 100644 index a4e11abe4..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/amqpIntegrationCoreLink.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Created on: Jun 12, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AMQPINTEGRATIONCORELINK_H_ -#define AMQPINTEGRATIONCORELINK_H_ - -#ifndef AMQPINTEGRATIONCORE_LINKAGE - #ifdef WIN32 - #ifdef AMQP_CLIENT - #define AMQPINTEGRATIONCORE_LINKAGE __declspec(dllexport) - #else - #define AMQPINTEGRATIONCORE_LINKAGE __declspec(dllimport) - #endif - #else - #define AMQPINTEGRATIONCORE_LINKAGE - #endif -#endif - -#include "AmqpIntegrationCoreDefines.h" -#include "AmqpIntegrationCoreFunc.h" -#include "AmqpIntegrationExceptions.h" -#include "amqpCore/AmqpOutboundEndpoint.h" -#include "AutoChannelClose.h" -#include "HeaderUtils.h" - -#endif /* AMQPINTEGRATIONCORELINK_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/stdafx.h b/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/stdafx.h deleted file mode 100644 index 35338cdb2..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpCore/src/amqpCore/stdafx.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Created on: Jun 12, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef STDAFX_H_ -#define STDAFX_H_ - -#ifndef AMQPINTEGRATIONCORE_LINKAGE -#ifdef WIN32 -#define AMQPINTEGRATIONCORE_LINKAGE __declspec(dllexport) -#else -#define AMQPINTEGRATIONCORE_LINKAGE -#endif -#endif - -#include -#include -#include "AmqpIntegrationCoreFunc.h" -#include "AmqpIntegrationCoreDefines.h" -#include "AmqpIntegrationExceptions.h" - -#endif /* STDAFX_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpListener/include/AmqpListenerWorker.h b/open-vm-tools/common-agent/Cpp/Communication/amqpListener/include/AmqpListenerWorker.h deleted file mode 100644 index 52c9e9ef8..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpListener/include/AmqpListenerWorker.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Created on: Aug 20, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AmqpListenerWorker_h -#define AmqpListenerWorker_h - -#include "Common/CThreadSignal.h" -#include "Common/IWork.h" - -namespace Caf { - -class AmqpListenerWorker : - public IWork -{ -public: - AmqpListenerWorker(); - virtual ~AmqpListenerWorker(); - - void doWork(); - void stopWork(); - -private: - CThreadSignal _stopSignal; - CAF_THREADSIGNAL_CREATE; - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(AmqpListenerWorker); -}; -CAF_DECLARE_SMART_POINTER(AmqpListenerWorker); -} - -#endif /* AmqpListenerWorker_h */ diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpListener/src/AmqpListenerWorker.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpListener/src/AmqpListenerWorker.cpp deleted file mode 100644 index 0728a6eb2..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpListener/src/AmqpListenerWorker.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Created on: Aug 20, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ -// NOTE: windows.h defines macros for min and max. Specifying NOMINMAX to prevent -// macro definition. Must be specified before windows.h is included. -#define NOMINMAX - -#include "stdafx.h" - -#include "Integration/Core/CIntegrationAppContext.h" -#include "AmqpListenerWorker.h" -#include "Common/CLoggingUtils.h" -#include "amqpClient/api/AMQExceptions.h" - -using namespace Caf; - -AmqpListenerWorker::AmqpListenerWorker() : - CAF_CM_INIT_LOG("AmqpListenerWorker") { - CAF_THREADSIGNAL_INIT; - _stopSignal.initialize("AmqpListenerWorker::stopSignal"); -} - -AmqpListenerWorker::~AmqpListenerWorker() { -} - -void AmqpListenerWorker::doWork() { - CAF_CM_FUNCNAME("run"); - - const std::string monitorDir = AppConfigUtils::getRequiredString("monitor_dir"); - const std::string listenerConfiguredStage2Path = FileSystemUtils::buildPath( - monitorDir, "listenerConfiguredStage2.txt"); - if (FileSystemUtils::doesFileExist(listenerConfiguredStage2Path)) { - uint32 intShutdownTimeout = AppConfigUtils::getOptionalUint32( - "communication_amqp", - "shutdown_timeout"); - intShutdownTimeout = std::max(intShutdownTimeout, static_cast(5000)); - - SmartPtrCIntegrationAppContext intAppContext; - try { - CLoggingUtils::setStartupConfigFile( - AppConfigUtils::getRequiredString(_sAppConfigGlobalParamLogConfigFile), - AppConfigUtils::getRequiredString(_sAppConfigGlobalParamLogDir)); - - uint32 intStartupTimeout = AppConfigUtils::getOptionalUint32( - "communication_amqp", - "startup_timeout"); - intStartupTimeout = std::max(intStartupTimeout, static_cast(5000)); - - uint32 connectionRetryInterval = AppConfigUtils::getOptionalUint32( - "communication_amqp", - "connection_retry_interval"); - connectionRetryInterval = std::max(connectionRetryInterval, static_cast(5000)); - - bool isSignaled = false; - do { - try { - CAF_CM_LOG_DEBUG_VA0("***** Initializing context"); - intAppContext.CreateInstance(); - intAppContext->initialize( - intStartupTimeout, - AppConfigUtils::getRequiredString("communication_amqp", "context_file")); - CAF_CM_LOG_DEBUG_VA0("***** Started. Waiting for stop signal."); - { - CAF_THREADSIGNAL_LOCK_UNLOCK; - _stopSignal.wait(CAF_THREADSIGNAL_MUTEX, 0); - } - CAF_CM_LOG_DEBUG_VA0("***** Received stop signal."); - break; - } catch (AmqpClient::AmqpExceptions::AmqpTimeoutException *ex) { - _logger.log( - log4cpp::Priority::WARN, - _cm_funcName_, - __LINE__, - ex); - ex->Release(); - CThreadUtils::sleep(connectionRetryInterval); - } - CAF_CM_CATCH_ALL; - CAF_CM_THROWEXCEPTION; - { - CAF_THREADSIGNAL_LOCK_UNLOCK; - isSignaled = _stopSignal.waitOrTimeout(CAF_THREADSIGNAL_MUTEX, 100); - } - } while (!isSignaled); - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_CRIT_CAFEXCEPTION; - - try { - if (intAppContext) { - intAppContext->terminate(intShutdownTimeout); - } - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_THROWEXCEPTION; - } else { - CAF_CM_LOG_WARN_VA0("Listener not configured"); - } -} - -void AmqpListenerWorker::stopWork() { - CAF_CM_FUNCNAME_VALIDATE("stop"); - CAF_CM_LOG_DEBUG_VA0("***** Setting stop signal."); - _stopSignal.signal(); -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpListener/src/amqpListenerMain.cpp b/open-vm-tools/common-agent/Cpp/Communication/amqpListener/src/amqpListenerMain.cpp deleted file mode 100644 index a1ef73d88..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpListener/src/amqpListenerMain.cpp +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Created on: Aug 20, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "AmqpListenerWorker.h" -#include "Common/CLoggingUtils.h" -#include "Exception/CCafException.h" -#include "Common/IAppConfig.h" -#ifndef WIN32 -#include -#endif - -bool _gDaemonized = true; -bool _gSysLogInfos = false; -SmartPtrAmqpListenerWorker _gAmqpListenerWorker; - -using namespace Caf; - -#ifndef WIN32 -extern "C" void TermHandler(int32 signum); -#endif - -int32 main(int32 argc, char** argv) { - HRESULT hr = CafInitialize::init(); - if (hr != S_OK) { -#ifndef WIN32 - ::syslog(LOG_ERR, "CommAmqpListener: CafInitialize::init() failed 0x%08X.", hr); -#endif - ::fprintf(stderr, "CommAmqpListener: CafInitialize::init() failed 0x%08X\n", hr); - return 1; - } - - CafInitialize::serviceConfig(); - - CAF_CM_STATIC_FUNC_LOG( "CommAmqpListener", "main" ); - SmartPtrIAppConfig appConfig; - try { - std::string appConfigEnv; - CEnvironmentUtils::readEnvironmentVar("CAF_APPCONFIG", appConfigEnv); - if (appConfigEnv.empty()) { - Cdeqstr deqstr; - deqstr.push_back("cafenv-appconfig"); - deqstr.push_back("persistence-appconfig"); - deqstr.push_back("CommAmqpListener-appconfig"); - deqstr.push_back("custom-appconfig"); - appConfig = getAppConfig(deqstr); - } else { - appConfig = getAppConfig(); - } - } catch(CCafException *ex) { -#ifndef WIN32 - ::syslog( - LOG_ERR, - "CommAmqpListener: getAppConfig() failed . %s", - ex->getFullMsg().c_str()); -#endif - ::fprintf( - stderr, - "CommAmqpListener: getAppConfig() failed . %s\n", - ex->getFullMsg().c_str()); - ex->Release(); - } catch (std::exception ex) { -#ifndef WIN32 - ::syslog( - LOG_ERR, - "CommAmqpListener: getAppConfig() failed . %s", - ex.what()); -#endif - ::fprintf( - stderr, - "CommAmqpListener: getAppConfig() failed . %s\n", - ex.what()); - } catch (...) { -#ifndef WIN32 - ::syslog( - LOG_ERR, - "CommAmqpListener: getAppConfig() failed . unknown exception"); -#endif - ::fprintf( - stderr, - "CommAmqpListener: getAppConfig() failed . unknown exception\n"); - } - - if (!appConfig) { - CafInitialize::term(); - return 1; - } - - int32 iRc = 0; - - try { - _gAmqpListenerWorker.CreateInstance(); - - const uint32 maxStrLen = 4096; - if ((argc < 1) || (NULL == argv) || (NULL == argv[0]) || (::strnlen(argv[0], maxStrLen) >= maxStrLen)) { - CAF_CM_EXCEPTION_VA0(E_INVALIDARG, "argc/argv are invalid"); - } - -#ifdef WIN32 - CWinService::initialize(_gAmqpListenerWorker); - CWinService::execute(argc, argv); -#else - const std::string procPath(reinterpret_cast(argv[0])); - Cdeqstr parts = CStringUtils::split(procPath, G_DIR_SEPARATOR); - std::string procName = "CommAmqpListener"; - if (parts.size()) { - procName = parts.back(); - } - - CDaemonUtils::MakeDaemon( - argc, - argv, - procPath, - procName, - TermHandler, - _gDaemonized, - _gSysLogInfos); - - CLoggingUtils::setStartupConfigFile( - AppConfigUtils::getRequiredString(_sAppConfigGlobalParamLogConfigFile), - AppConfigUtils::getRequiredString(_sAppConfigGlobalParamLogDir)); - - _gAmqpListenerWorker->doWork(); -#endif - } - CAF_CM_CATCH_CAF - CAF_CM_CATCH_DEFAULT - CAF_CM_LOG_CRIT_CAFEXCEPTION; - - if (CAF_CM_ISEXCEPTION) { - const std::string msg = CAF_CM_EXCEPTION_GET_FULLMSG; -#ifndef WIN32 - ::syslog( - LOG_ERR, - "CommAmqpListener: %s", - msg.c_str()); -#endif - - ::fprintf( - stderr, - "CommAmqpListener: %s\n", - msg.c_str()); - iRc = 1; - } - CAF_CM_CLEAREXCEPTION; - _gAmqpListenerWorker = NULL; - CafInitialize::term(); - return iRc; -} - -extern "C" void TermHandler(int32 signum) { - CAF_CM_STATIC_FUNC_LOG_ONLY( "CommAmqpListener", "TermHandler" ); - - CAF_CM_ENTER { - switch (signum) { - case SIGTERM: - CAF_CM_LOG_INFO_VA0( "Received SIGTERM" ); - if (_gAmqpListenerWorker) { - _gAmqpListenerWorker->stopWork(); - } - break; - case SIGINT: - CAF_CM_LOG_INFO_VA0( "Received SIGINT" ); - if (_gAmqpListenerWorker) { - _gAmqpListenerWorker->stopWork(); - } - break; - default: - CAF_CM_LOG_ERROR_VA1( "Ignoring Unexpected signal %d", signum); - break; - } - } - CAF_CM_EXIT; -} diff --git a/open-vm-tools/common-agent/Cpp/Communication/amqpListener/src/stdafx.h b/open-vm-tools/common-agent/Cpp/Communication/amqpListener/src/stdafx.h deleted file mode 100644 index d56857bb5..000000000 --- a/open-vm-tools/common-agent/Cpp/Communication/amqpListener/src/stdafx.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Created on: Aug 20, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef stdafx_h -#define stdafx_h - -#include -#include - -#ifdef WIN32 -#include "CWinService.h" -#endif - - -#endif /* stdafx_h */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/BaseDefines.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/BaseDefines.h deleted file mode 100644 index e8636a64f..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/BaseDefines.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Author: mdonahue - * Created: Jan 12, 2011 - * - * Copyright (C) 2011-2018 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef SYS_INC_BASEDEFINES_H_ -#define SYS_INC_BASEDEFINES_H_ - -#ifdef ECM_SUB_SYSTEM -#error "The ECM_SUB_SYSTEM define has been deprecated. Use CAF_SUB_SYSTEM instead." -#endif - -#ifdef WIN32 -// Disable compiler warning 4275: non dll-interface used as base for dll-interface class -#pragma warning(disable: 4275) -#endif - -#include - -const gboolean GLIB_FALSE = (gboolean)0; -const gboolean GLIB_TRUE = !GLIB_FALSE; - -// Windows includes -#if defined( WIN32 ) - #ifndef WIN32_LEAN_AND_MEAN - #define WIN32_LEAN_AND_MEAN - #endif - - #ifndef _WIN32_WINNT - #define _WIN32_WINNT 0x0502 - #endif - - #include -#endif - -#include -#if defined( WIN32 ) - typedef __int8 int8; - typedef unsigned __int8 uint8; - typedef __int16 int16; - typedef unsigned __int16 uint16; - typedef __int32 int32; - typedef unsigned __int32 uint32; - typedef __int64 int64; - typedef unsigned __int64 uint64; - - struct timezone - { - int32 tz_minuteswest; - int32 tz_dsttime; - }; - -#else - #include - - typedef signed char int8; - typedef unsigned char uint8; - typedef int16_t int16; - typedef uint16_t uint16; - typedef int32_t int32; - typedef uint32_t uint32; - typedef int64_t int64; - typedef uint64_t uint64; -#endif - -#include -#include - -#include "BasePlatformLink.h" - -#endif /* SYS_INC_BASEDEFINES_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/BasePlatformInc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/BasePlatformInc.h deleted file mode 100644 index 3f8de88db..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/BasePlatformInc.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef BasePlatformInc_h_ -#define BasePlatformInc_h_ - -#ifndef BASEPLATFORM_LINKAGE - #ifdef WIN32 - #ifdef FRAMEWORK_BUILD - #define BASEPLATFORM_LINKAGE __declspec(dllexport) - #else - #define BASEPLATFORM_LINKAGE __declspec(dllimport) - #endif - #else - #define BASEPLATFORM_LINKAGE - #endif -#endif - -#include "PlatformTypes.h" -#include "PlatformDefines.h" -#include "PlatformErrors.h" -#include "PlatformIID.h" -#include "PlatformStringFunc.h" -#include "ICafObject.h" -#include "TCafObject.h" -#include "TCafQIObject.h" -#include "TCafSmartPtr.h" -#include "TCafStackObject.h" - -CAF_DECLARE_SMART_INTERFACE_POINTER(ICafObject); - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/BasePlatformLink.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/BasePlatformLink.h deleted file mode 100644 index d21ca9e4c..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/BasePlatformLink.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef BasePlatformLink_h_ -#define BasePlatformLink_h_ - -#include "BasePlatformInc.h" - -#include -#include -#include -#include -#include - -namespace Caf { - -// Basic string containers -typedef std::deque Cdeqstr; -typedef std::set Csetstr; -typedef std::vector Cvecstr; -typedef std::map Cmapstrstr; -typedef std::multimap Cmmapstrstr; -CAF_DECLARE_SMART_POINTER(Cdeqstr); -CAF_DECLARE_SMART_POINTER(Csetstr); -CAF_DECLARE_SMART_POINTER(Cvecstr); -CAF_DECLARE_SMART_POINTER(Cmapstrstr); -CAF_DECLARE_SMART_POINTER(Cmmapstrstr); - -// GUID containers -typedef std::vector Cvecguid; -typedef std::deque Cdeqguid; -CAF_DECLARE_SMART_POINTER(Cvecguid); -CAF_DECLARE_SMART_POINTER(Cdeqguid); - -struct SGuidLessThan -{ - bool operator()(const GUID clhs, const GUID crhs) const - { - return ::memcmp(&clhs, &crhs, sizeof(GUID)) < 0; - } -}; - -typedef std::set Csetguid; -CAF_DECLARE_SMART_POINTER(Csetguid); - -// class to extract first part of a pair -template -struct select1st -{ - typename T::first_type operator()(const T & p) const { return p.first; } -}; - -// template function to make use of select1st easy. -// T is a container whose value_type is a pair -template -select1st make_select1st(const T &) { return select1st(); }; - -// class to extract second part of a pair -template -struct select2nd -{ - typename T::second_type operator()(const T & p) const { return p.second; } -}; - -// template function to make use of select2nd easy. -// T is a container whose value_type is a pair -template -select2nd make_select2nd(const T &) { return select2nd(); }; - -} - -#ifdef WIN32 -#include "PlatformApi.h" -#endif - -#endif - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Collections.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Collections.h deleted file mode 100644 index 82a7f0e34..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Collections.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Author: mdonahue - * Created: Jan 25, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef ITERATORS_H_ -#define ITERATORS_H_ - -#include "../src/Collections/Iterators/IteratorsInc.h" -#include "../src/Collections/Graphs/GraphsInc.h" - -#endif /* ITERATORS_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Common/CApplicationContext.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Common/CApplicationContext.h deleted file mode 100644 index a3dca08b5..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Common/CApplicationContext.h +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Author: bwilliams - * Created: Jul 2009 - * - * Copyright (C) 2009-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CApplicationContext_h_ -#define CApplicationContext_h_ - - -#include "Common/IAppContext.h" - -#include "IBean.h" - -namespace Caf { - -CAF_DECLARE_CLASS_AND_SMART_POINTER( CApplicationContext); - -class COMMONAGGREGATOR_LINKAGE CApplicationContext : public IAppContext { -private: - // Bean constructor arguments - struct CBeanCtorArg { - typedef enum { - NOT_SET, - REFERENCE, - VALUE - } ARG_TYPE; - - CBeanCtorArg(const ARG_TYPE type, const std::string& value) : - _type(type), - _value(value) {} - - ARG_TYPE _type; - std::string _value; - }; - - // key=constructor-arg index - typedef std::map CBeanCtorArgCollection; - - struct CBeanNode { - CBeanNode() : - _isInitialized(false) {} - - std::string _id; - std::string _class; - SmartPtrIBean _bean; - CBeanCtorArgCollection _ctorArgs; - Cmapstrstr _properties; - bool _isInitialized; - }; - CAF_DECLARE_SMART_POINTER(CBeanNode); - - struct CBeanNodeLess { - bool operator()( - const SmartPtrCBeanNode& lhs, - const SmartPtrCBeanNode& rhs) const { - return std::less()(lhs->_id, rhs->_id); - } - }; - - typedef TEdgeListGraph CBeanGraph; - - // key=bean id - typedef std::map CBeanCollection; - -public: - CApplicationContext(); - virtual ~CApplicationContext(); - -public: - void initialize(); - void initialize(const Cdeqstr& filenameCollection); - - void terminate(); - - SmartPtrCBeans getBeans() const; - -public: // IApplicationContext - SmartPtrIBean getBean(const std::string& name) const; - -private: - bool m_isInitialized; - CBeanCollection _beanCollection; - CBeanGraph::ClistVertexEdges _beanTopologySort; - Cdeqstr _filenameCollection; - -private: - std::string getDefaultBeanConfigFile() const; - - void parseBeanConfig( - const std::string& beanConfigFile, - CBeanCollection& beanCollection) const; - - void createBeanGraph( - CBeanCollection& beanCollection, - CBeanGraph& beanGraph, - CBeanGraph::ClistVertexEdges& beanTopologySort) const; - - void initializeBeans( - CBeanCollection& beanCollection, - CBeanGraph::ClistVertexEdges& beanTopologySort) const; - - void terminateBeans(CBeanGraph::ClistVertexEdges& beanTopologySort) const; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CApplicationContext); -}; - -} - -#endif // #ifndef CApplicationContext_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Common/CAutoCondition.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Common/CAutoCondition.h deleted file mode 100644 index a03c511f0..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Common/CAutoCondition.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 29, 2014 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CAUTOCONDITION_H_ -#define CAUTOCONDITION_H_ - -#include "Common/CAutoCondition.h" - -#include "Common/CAutoMutex.h" - -namespace Caf { - -class COMMONAGGREGATOR_LINKAGE CAutoCondition { -public: - CAutoCondition(); - ~CAutoCondition(); - - void initialize(const std::string& name); - bool isInitialized() const; - - void close(); - - std::string getName() const; - - void signal(); - void wait(SmartPtrCAutoMutex& mutex); - bool waitUntil(SmartPtrCAutoMutex& mutex, gint64 endTime); - -private: - GCond _condition; - std::string _name; - bool _isInitialized; - -private: - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(CAutoCondition); -}; -CAF_DECLARE_SMART_POINTER(CAutoCondition); -} - -#endif /* CAUTOCONDITION_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Common/CAutoMutex.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Common/CAutoMutex.h deleted file mode 100644 index c5576c5a2..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Common/CAutoMutex.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 29, 2014 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CAUTOMUTEX_H_ -#define CAUTOMUTEX_H_ - -namespace Caf { - -class COMMONAGGREGATOR_LINKAGE CAutoMutex { -public: - CAutoMutex(); - ~CAutoMutex(); - - void initialize(); - bool isInitialized() const; - - void lock(const char* className = NULL, const char* funcName = NULL, const int32 lineNumber = 0); - void unlock(const char* className = NULL, const char* funcName = NULL, const int32 lineNumber = 0); - - GMutex* getNonConstPtr(); - -private: - GMutex _mutex; - bool _isInitialized; - -private: - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(CAutoMutex); -}; -CAF_DECLARE_SMART_POINTER(CAutoMutex); - -} - -#endif /* CAUTOMUTEX_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Common/CAutoRecMutex.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Common/CAutoRecMutex.h deleted file mode 100644 index f13f0c4ee..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Common/CAutoRecMutex.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 29, 2014 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CAUTORECMUTEX_H_ -#define CAUTORECMUTEX_H_ - -namespace Caf { - -class COMMONAGGREGATOR_LINKAGE CAutoRecMutex { -public: - CAutoRecMutex(); - ~CAutoRecMutex(); - - void initialize(); - bool isInitialized() const; - - void lock(const char* className = NULL, const char* funcName = NULL, const int32 lineNumber = 0); - void unlock(const char* className = NULL, const char* funcName = NULL, const int32 lineNumber = 0); - - GRecMutex* getNonConstPtr(); - -private: - GRecMutex _mutex; - bool _isInitialized; - -private: - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(CAutoRecMutex); -}; -CAF_DECLARE_SMART_POINTER(CAutoRecMutex); - -} - -#endif /* CAUTORECMUTEX_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Common/CCafRegex.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Common/CCafRegex.h deleted file mode 100644 index 23b4a86bb..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Common/CCafRegex.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Author: bwilliams - * Created: Jan 21, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CCAFREGEX_H_ -#define CCAFREGEX_H_ - -#include "Common/CCafRegex.h" - -namespace Caf { - -class COMMONAGGREGATOR_LINKAGE CCafRegex { -public: - CCafRegex(); - virtual ~CCafRegex(); - -public: - void initialize(const std::string& regex); - - bool isMatched(const std::string& source); - - std::map matchNames( - const std::string& source, - const std::set& names); - - std::deque matchName( - const std::string& source, - const std::string& name); - - std::string match( - const std::string& source, - const int32 matchNum); - - std::string replaceLiteral( - const std::string& source, - const std::string& replacement); - -public: - static std::string replaceLiteral( - const std::string& regex, - const std::string& source, - const std::string& replacement); - -private: - bool _isInitialized; - GRegex* _gRegex; - std::string _regex; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CCafRegex); -}; - -CAF_DECLARE_SMART_POINTER(CCafRegex); - -} - -#endif /* CCAFREGEX_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Common/CCmdLineOptions.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Common/CCmdLineOptions.h deleted file mode 100644 index 6ea7e3fbe..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Common/CCmdLineOptions.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Author: bwilliams - * Created: Jul 2009 - * - * Copyright (C) 2009-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CCmdLineOptions_h_ -#define CCmdLineOptions_h_ - -namespace Caf { - -class COMMONAGGREGATOR_LINKAGE CCmdLineOptions { -private: - typedef std::map CStringOptions; - typedef std::map CIntOptions; - typedef std::map CBoolOptions; - -public: - CCmdLineOptions(); - virtual ~CCmdLineOptions(); - -public: - void initialize(const std::string& cmdDescription, const uint32 maxOptions); - void parse(int32 argc, char* argv[]); - - void addStringOption(const std::string& longName, const char shortName, const std::string& optionDescription); - void addIntOption(const std::string& longName, const char shortName, const std::string& optionDescription); - void addBoolOption(const std::string& longName, const char shortName, const std::string& optionDescription); - - std::string findStringOption(const std::string& longName); - int32 findIntOption(const std::string& longName); - bool findBoolOption(const std::string& longName); - -private: - bool _isInitialized; - uint32 _optionCnt; - std::string _cmdDescription; - - uint32 _maxOptions; - GOptionEntry* _gOptions; - - CStringOptions _stringOptions; - CIntOptions _intOptions; - CBoolOptions _boolOptions; - - // Temporary for storing longNames and optionDescription for addFooOption() methods above. - std::vector _longNames, _optionDescriptions; - -private: - void checkOptionCnt( - const std::string& longName, - const uint32 optionCnt, - const uint32 maxOptions) const; - void populateOption( - GOptionEntry& optionEntry, - const std::string& longName, - const char shortName, - const std::string& optionDescription); - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CCmdLineOptions); -}; - -CAF_DECLARE_SMART_POINTER( CCmdLineOptions); - -} - -#endif // #ifndef CCmdLineOptions_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Common/CConfigParams.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Common/CConfigParams.h deleted file mode 100644 index 42fe2fa60..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Common/CConfigParams.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Author: mdonahue - * Created: Jan 17, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CCONFIGPARAMS_H_ -#define CCONFIGPARAMS_H_ - -#include "Common/IConfigParams.h" - -namespace Caf { - -/* - * This class wraps a GHashTable object where the key is a const char* and - * the value is a GVariant*. - * - * The key and value pointers inserted must exist for the lifetime of this object. - * Use the EKeyManagement and EValueMangement flags to control how this - * object destroys the contained hash table. - * - */ -class COMMONAGGREGATOR_LINKAGE CConfigParams : public IConfigParams { -public: - typedef enum { - EKeysUnmanaged, // Set if the caller will manage the lifetime of the keys - EKeysManaged // Set if this object is to detroy the keys upon destruction - } EKeyManagement; - - typedef enum { - EValuesUnmanaged, // Set if the caller will manage the lifetime of the values - EValuesManaged // Set if this object is to detroy the values upon destruction - } EValueManagement; - - CConfigParams(); - virtual ~CConfigParams(); - - void initialize( - const std::string& sectionName, - EKeyManagement keyManagement, - EValueManagement valueManagement); - -public: // IConfigParams - GVariant* lookup( - const char* key, - const EParamDisposition disposition = PARAM_REQUIRED) const; - - std::string getSectionName() const; - - void insert(const char* key, GVariant* value); - -private: - static void destroyKeyCallback(gpointer ptr); - static void destroyValueCallback(gpointer ptr); - -private: - std::string _sectionName; - GHashTable* _table; - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(CConfigParams); -}; - -CAF_DECLARE_SMART_POINTER(CConfigParams); - -} - -#endif /* CCONFIGPARAMS_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Common/CConfigParamsChain.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Common/CConfigParamsChain.h deleted file mode 100644 index 3e8d6b041..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Common/CConfigParamsChain.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Author: mdonahue - * Created: Jan 17, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CCONFIGPARAMSCHAIN_H_ -#define CCONFIGPARAMSCHAIN_H_ - -#include "Common/IConfigParams.h" - -#include "Common/CConfigParams.h" - -namespace Caf { - -class COMMONAGGREGATOR_LINKAGE CConfigParamsChain : public IConfigParams { -public: - CConfigParamsChain(); - virtual ~CConfigParamsChain(); - - void initialize(CConfigParams::EKeyManagement keyManagement, - CConfigParams::EValueManagement valueManagement, - const SmartPtrIConfigParams& baseParams); - - void insert(const char* key, GVariant* value); - -public: // IConfigParams - GVariant* lookup(const char* key, const EParamDisposition disposition = PARAM_REQUIRED) const; - - std::string getSectionName() const; - -private: - static void destroyValueCallback(gpointer ptr); - -private: - SmartPtrCConfigParams _theseParams; - SmartPtrIConfigParams _baseParams; - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(CConfigParamsChain); -}; - -CAF_DECLARE_SMART_POINTER(CConfigParamsChain); - -} - -#endif /* CCONFIGPARAMSCHAIN_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Common/CFileLock.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Common/CFileLock.h deleted file mode 100644 index e1d4655c4..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Common/CFileLock.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (C) 2004-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CFileLock_h_ -#define CFileLock_h_ - -namespace Caf { - -class COMMONAGGREGATOR_LINKAGE CFileLock -{ -public: - enum ELockLevel - { - UNLOCK, - SHARED_LOCK, - EXCLUSIVE_LOCK - }; - -public: - // Ctor - CFileLock(); - - // dtor - ~CFileLock(); - - // initialize the lock for the specified file - void initialize(int32 iFileDescriptor); - - // initialize the lock for the specified file - void initialize(const char * cszFileName, bool bCreateFile = true); - - // Set the lock to the specified scope - void setLockLevel(ELockLevel eLockLevel, bool bDowngradeLock = false); - - // Set the lock to the specified if possible - bool attemptSetLockLevel(ELockLevel eLockLevel, bool bDowngradeLock = false); - - // Get the current lock level - ELockLevel getLockLevel() const; - -private: - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(CFileLock); - - bool _isInitialized; - bool _isFileDescriptorLocal; - int32 _fileDescriptor; - ELockLevel _lockLevel; -}; - -CAF_DECLARE_SMART_POINTER(CFileLock); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Common/CIniFile.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Common/CIniFile.h deleted file mode 100644 index 8b08647a8..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Common/CIniFile.h +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Author: bwilliams - * Created: May 18, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CINIFILE_H_ -#define CINIFILE_H_ - - -#include "Common/CCafRegex.h" - -namespace Caf { - -class COMMONAGGREGATOR_LINKAGE CIniFile { -public: - struct SIniEntry { - std::string _name; - std::string _valueRaw; - std::string _valueExpanded; - }; - CAF_DECLARE_SMART_POINTER(SIniEntry); - - struct SIniSection { - std::string _sectionName; - std::deque _entryCollection; - }; - CAF_DECLARE_SMART_POINTER(SIniSection); - -public: - CIniFile(); - virtual ~CIniFile(); - -public: - void initialize(const std::string& configFilePath); - - std::deque getSectionCollection(); - - std::deque getEntryCollection( - const std::string& sectionName); - - SmartPtrSIniEntry findOptionalEntry( - const std::string& sectionName, - const std::string& keyName); - - SmartPtrSIniEntry findRequiredEntry( - const std::string& sectionName, - const std::string& keyName); - - std::string findOptionalString( - const std::string& sectionName, - const std::string& keyName); - - std::string findRequiredString( - const std::string& sectionName, - const std::string& keyName); - - std::string findOptionalRawString( - const std::string& sectionName, - const std::string& keyName); - - std::string findRequiredRawString( - const std::string& sectionName, - const std::string& keyName); - - void log(); - - void setValue( - const std::string& sectionName, - const std::string& keyName, - const std::string& value); - - void deleteValue( - const std::string& sectionName, - const std::string& keyName); - -private: - struct SReplacement { - SmartPtrCCafRegex _regex; - std::string _value; - }; - CAF_DECLARE_SMART_POINTER(SReplacement); - -private: - std::deque parse( - const std::string& configFilePath) const; - - SmartPtrSReplacement createReplacement( - const std::string& keyName, - const std::string& value) const; - - SmartPtrSIniEntry createIniEntry( - const std::string& keyName, - const std::string& valueRaw, - const std::string& valueExpanded) const; - - void parseValuePath( - const std::string& valuePath, - std::string& valueName, - std::string& valueValue); - -private: - bool _isInitialized; - std::string _configFilePath; - std::deque _sectionCollection; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CIniFile); -}; - -CAF_DECLARE_SMART_POINTER(CIniFile); - -} - -#endif /* CINIFILE_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Common/CLoggingSetter.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Common/CLoggingSetter.h deleted file mode 100644 index cd1a4a5b2..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Common/CLoggingSetter.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (C) 2004-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CLoggingSetter_h_ -#define CLoggingSetter_h_ - -namespace Caf { - -class COMMONAGGREGATOR_LINKAGE CLoggingSetter { -public: - CLoggingSetter(); - virtual ~CLoggingSetter(); - -public: - void initialize(const std::string& logDir); - -private: - bool _isInitialized; - bool _remapLoggingLocation; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CLoggingSetter); -}; - -CAF_DECLARE_SMART_POINTER(CLoggingSetter); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Common/CLoggingUtils.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Common/CLoggingUtils.h deleted file mode 100644 index 66bfc4e35..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Common/CLoggingUtils.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Author: bwilliams - * Created: Jan 21, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CLoggingUtils_H_ -#define CLoggingUtils_H_ - -#ifndef WIN32 -#include -#include "Common/CLoggingUtils.h" -#endif - -namespace Caf { - -class CLoggingUtils; -CAF_DECLARE_SMART_POINTER(CLoggingUtils); - -class COMMONAGGREGATOR_LINKAGE CLoggingUtils { -private: - typedef std::map PropertyMap; - -public: - static bool isConsoleAppenderUsed(); - static void setStartupConfigFile( - const std::string& configFile = "log4cpp_config", - const std::string& logDir = std::string()); - static std::string getConfigFile(); - static void resetConfigFile(); - static void setLogDir(const std::string& logDir); - -public: - CLoggingUtils(); - -private: - static SmartPtrCLoggingUtils getInstance(); - - static void loadConfig(const std::string& configFile); - - void loadProperties(); - -private: - static GRecMutex _sOpMutex; - static SmartPtrCLoggingUtils _sInstance; - - std::string _configFile; - PropertyMap _properties; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CLoggingUtils); -}; - -} - -#endif /* CLoggingUtils_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Common/CManagedThreadPool.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Common/CManagedThreadPool.h deleted file mode 100644 index 44362edfd..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Common/CManagedThreadPool.h +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Created on: May 9, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CMANAGEDTHREADPOOL_H_ -#define CMANAGEDTHREADPOOL_H_ - - -#include "ICafObject.h" - -namespace Caf { - -/** - * @author mdonahue - * @brief This class wraps a GThreadPool and makes it a bit more friendly to use. It - * also allows tasks to partially complete and be requeued. - * The shutdown behavior is to wait for all active tasks to finish. Inactive - * (unscheduled) tasks will be aborted. - */ -class COMMONAGGREGATOR_LINKAGE CManagedThreadPool { -public: - /** - * @brief Interface for task objects - */ - struct __declspec(novtable) IThreadTask : public ICafObject { - /** - * @brief execute task - * @retval true the task has completed its work and will be removed from the pool - * @retval false the task has not completed its work and will be requeued in the pool - */ - virtual bool run() = 0; - }; - CAF_DECLARE_SMART_INTERFACE_POINTER(IThreadTask); - typedef std::deque TaskDeque; - -public: - CManagedThreadPool(); - virtual ~CManagedThreadPool(); - - /** - * @brief initialize the thread pool - * @param poolName a friendly name for the pool to aid in debugging - * @param threadCount the number of task threads - * @param taskUpdateInterval optional task queue refresh rate in milliseconds - */ - void init( - const std::string& poolName, - uint32 threadCount, - uint32 taskUpdateInterval = 0); - - /** - * @brief terminate the thread pool - * All active tasks will be allowed to finish before this method returns - */ - void term(); - - /** - * @brief add a task to the pool - * @param task the task to add - */ - void enqueue(const SmartPtrIThreadTask& task); - - /** - * @brief add a collection of tasks to the pool - * @param tasks the tasks to add - */ - void enqueue(const TaskDeque& tasks); - - /** @brief A simple structure to report some statistics - * - */ - struct Stats { - /** The number of tasks under management */ - uint32 taskCount; - - /** The number of tasks waiting to be assigned to threads for execution */ - uint32 inactiveTaskCount; - - /** The number of tasks assigned to threads for execution */ - uint32 activeTaskCount; - - /** The number of tasks that have completed execution */ - uint32 completeTaskCount; - - /** The number of tasks that have executed but need to be requeued */ - uint32 incompleteTaskCount; - }; - - /** @return the current statistics */ - Stats getStats() const; - -private: - static gpointer poolWorkerFunc(gpointer context); - static void taskWorkerFunc(gpointer threadContext, gpointer NOT_USED); - -private: - void runPool(); - -private: - /** Default task update interval in milliseconds */ - static uint32 DEFAULT_TASK_UPDATE_INTERVAL; - -private: - bool _isInitialized; - volatile bool _isShuttingDown; - std::string _poolName; - GThreadPool *_threadPool; - typedef std::set TaskSet; - TaskSet _tasks; - GThread* _workerThread; - uint32 _taskUpdateInterval; - - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_CREATE_THREADSAFE; - CAF_CM_DECLARE_NOCOPY(CManagedThreadPool); -}; -CAF_DECLARE_SMART_POINTER(CManagedThreadPool); - -} - -#endif /* CMANAGEDTHREADPOOL_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Common/CThreadPool.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Common/CThreadPool.h deleted file mode 100644 index aace4677f..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Common/CThreadPool.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * CThreadPool.h - * - * Created on: May 9, 2012 - * Author: mdonahue - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CTHREADPOOL_H_ -#define CTHREADPOOL_H_ - - -#include "ICafObject.h" - -#include "Common/CManagedThreadPool.h" - -namespace Caf { - -/** - * @author mdonahue - * @brief This class wraps a GThreadPool and makes it a bit more friendly to use. - * This class wraps up a GThreadPool as a lifetime-managed object that can be shared. - * The shutdown behavior is to wait for all tasks to finish. - */ -class COMMONAGGREGATOR_LINKAGE CThreadPool { -public: - /** - * @brief This is the interface for tasks queued in this thread pool - */ - struct __declspec(novtable) IThreadTask : public ICafObject { - /** - * @brief execute task - * @param userData the userData passed into the thread pool init() method - */ - virtual void run(gpointer userData) = 0; - }; - CAF_DECLARE_SMART_INTERFACE_POINTER(IThreadTask); - -public: - CThreadPool(); - virtual ~CThreadPool(); - - /** - * @brief Initialize the thread pool - * @param userData opaque data to be passed to each thread - * @param maxThreads the number of threads to create - */ - void init(gpointer userData, gint maxThreads); - - /** - * @brief Terminate the thread pool - * All tasks will be allowed to finish before this method returns - */ - void term(); - - /** - * @brief Add a task to the thread pool - * @param task interface to the task to add - */ - void addTask(const SmartPtrIThreadTask& task); - -private: - static void ThreadFunc(gpointer data, gpointer userData); - -private: - bool _isInitialized; - GThreadPool *_threadPool; - gpointer _userData; - CAF_CM_CREATE; - CAF_CM_CREATE_THREADSAFE; - CAF_CM_DECLARE_NOCOPY(CThreadPool); -}; -CAF_DECLARE_SMART_POINTER(CThreadPool); - -} - -#endif /* CTHREADPOOL_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Common/CThreadSignal.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Common/CThreadSignal.h deleted file mode 100644 index 29d48aa4c..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Common/CThreadSignal.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Author: bwilliams - * Created: Jul 2009 - * - * Copyright (C) 2009-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CThreadSignal_h_ -#define CThreadSignal_h_ - -#include "Common/CThreadSignal.h" - -#include "Common/CAutoMutex.h" -#include "Common/CAutoCondition.h" - -namespace Caf { - -// Class-level thread safety macros -#define CAF_THREADSIGNAL_CREATE \ - private: \ - mutable SmartPtrCAutoMutex _threadsync_mutex_ - -#define CAF_THREADSIGNAL_INIT \ - _threadsync_mutex_.CreateInstance(); \ - _threadsync_mutex_->initialize() - -#define CAF_THREADSIGNAL_MUTEX \ - _threadsync_mutex_ - -#define CAF_THREADSIGNAL_LOCK_UNLOCK \ - Caf::CAutoMutexLockUnlock _threadsync_auto_lock(CAF_THREADSIGNAL_MUTEX) - -#define CAF_THREADSIGNAL_LOCK_UNLOCK_LOG \ - Caf::CAutoMutexLockUnlock _threadsync_auto_lock(CAF_THREADSIGNAL_MUTEX, CAF_CM_GET_CLASSNAME, CAF_CM_GET_FUNCNAME) - -class COMMONAGGREGATOR_LINKAGE CThreadSignal { -public: - CThreadSignal(); - virtual ~CThreadSignal(); - -public: - void initialize(const std::string& conditionName); - bool isInitialized() const; - void signal(); - void wait(SmartPtrCAutoMutex& mutex, const uint32 timeoutMs); - bool waitOrTimeout(SmartPtrCAutoMutex& mutex, const uint32 timeoutMs); - std::string getName() const; - void close(); - -private: - bool _isInitialized; - CAutoCondition _condition; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_THREADSAFE; - CAF_CM_DECLARE_NOCOPY(CThreadSignal); -}; - -CAF_DECLARE_SMART_POINTER( CThreadSignal); - -} - -#endif // #ifndef CThreadSignal_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Common/CVariant.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Common/CVariant.h deleted file mode 100644 index 7e40b5642..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Common/CVariant.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Created on: Jun 7, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CVARIANT_H_ -#define CVARIANT_H_ - - -#include "IVariant.h" - -namespace Caf { - -/** - * @brief A class that holds a GVariant* to manage its lifetime - */ -CAF_DECLARE_CLASS_AND_SMART_POINTER(CVariant); - -class COMMONAGGREGATOR_LINKAGE CVariant : public IVariant { -public: - CVariant(); - virtual ~CVariant(); - - void set(GVariant *variant); - -public: // IVariant - GVariant *get() const; - - std::string toString() const; - - bool isString() const; - bool isBool() const; - bool isUint8() const; - bool isInt16() const; - bool isUint16() const; - bool isInt32() const; - bool isUint32() const; - bool isInt64() const; - bool isUint64() const; - -public: - static SmartPtrCVariant createString(const std::string& value); - static SmartPtrCVariant createBool(const bool value); - static SmartPtrCVariant createUint8(const uint8 value); - static SmartPtrCVariant createInt16(const int16 value); - static SmartPtrCVariant createUint16(const uint16 value); - static SmartPtrCVariant createInt32(const int32 value); - static SmartPtrCVariant createUint32(const uint32 value); - static SmartPtrCVariant createInt64(const int64 value); - static SmartPtrCVariant createUint64(const uint64 value); - -private: - bool isType(const GVariantType * varType) const; - -private: - GVariant *_variant; - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(CVariant); -}; - -} - -#endif /* CVARIANT_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Common/IAppConfig.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Common/IAppConfig.h deleted file mode 100644 index 5eb3fc885..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Common/IAppConfig.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Author: mdonahue - * Created: Jan 19, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef IAPPCONFIG_H_ -#define IAPPCONFIG_H_ - -#include "Common/IConfigParams.h" - -#include "ICafObject.h" -#include "Common/IAppConfig.h" - -namespace Caf { - -struct __declspec(novtable) -IAppConfig : public ICafObject { - CAF_DECL_UUID("e57f2252-ce11-4d15-9338-aa928333f7a3") - - virtual SmartPtrIConfigParams getParameters(const std::string& sectionName) = 0; - - virtual bool getString( - const std::string& sectionName, - const std::string& parameterName, - std::string& value, - const IConfigParams::EParamDisposition disposition = IConfigParams::PARAM_REQUIRED) = 0; - - virtual bool getUint32( - const std::string& sectionName, - const std::string& parameterName, - uint32& value, - const IConfigParams::EParamDisposition disposition = IConfigParams::PARAM_REQUIRED) = 0; - - virtual bool getInt32( - const std::string& sectionName, - const std::string& parameterName, - int32& value, - const IConfigParams::EParamDisposition disposition = IConfigParams::PARAM_REQUIRED) = 0; - - virtual bool getBoolean( - const std::string& sectionName, - const std::string& parameterName, - bool& value, - const IConfigParams::EParamDisposition disposition = IConfigParams::PARAM_REQUIRED) = 0; - - virtual bool getGlobalString( - const std::string& parameterName, - std::string& value, - const IConfigParams::EParamDisposition disposition = IConfigParams::PARAM_REQUIRED) = 0; - - virtual bool getGlobalUint32( - const std::string& parameterName, - uint32& value, - const IConfigParams::EParamDisposition disposition = IConfigParams::PARAM_REQUIRED) = 0; - - virtual bool getGlobalInt32( - const std::string& parameterName, - int32& value, - const IConfigParams::EParamDisposition disposition = IConfigParams::PARAM_REQUIRED) = 0; - - virtual bool getGlobalBoolean( - const std::string& parameterName, - bool& value, - const IConfigParams::EParamDisposition disposition = IConfigParams::PARAM_REQUIRED) = 0; - - virtual std::string resolveValue(const std::string& value) = 0; -}; - -CAF_DECLARE_SMART_INTERFACE_POINTER(IAppConfig); - -SmartPtrIAppConfig COMMONAGGREGATOR_LINKAGE getAppConfig(); - -SmartPtrIAppConfig COMMONAGGREGATOR_LINKAGE getAppConfig(const std::string& configFile); - -SmartPtrIAppConfig COMMONAGGREGATOR_LINKAGE getAppConfig(const Cdeqstr& configFileCollection); - -SmartPtrIAppConfig COMMONAGGREGATOR_LINKAGE getAppConfigAppend(const std::string& configFile); - -SmartPtrIAppConfig COMMONAGGREGATOR_LINKAGE getAppConfigAppend(const Cdeqstr& configFileCollection); -} - -#endif /* IAPPCONFIG_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Common/IAppConfigWrite.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Common/IAppConfigWrite.h deleted file mode 100644 index f4b56cce6..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Common/IAppConfigWrite.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Author: bwilliams - * Created: Jan 28, 2015 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef IAPPCONFIGWRITE_H_ -#define IAPPCONFIGWRITE_H_ - -#include "Common/IAppConfigWrite.h" - -#include "ICafObject.h" - -namespace Caf { - -struct __declspec(novtable) -IAppConfigWrite : public ICafObject { - CAF_DECL_UUID("3cf708c6-b92d-46c3-83d8-edeccecf5ba4") - - virtual void setString( - const std::string& sectionName, - const std::string& parameterName, - const std::string& value) = 0; - - virtual void setUint32( - const std::string& sectionName, - const std::string& parameterName, - const uint32& value) = 0; - - virtual void setInt32( - const std::string& sectionName, - const std::string& parameterName, - const int32& value) = 0; - - virtual void setBoolean( - const std::string& sectionName, - const std::string& parameterName, - const bool& value) = 0; - - virtual void setGlobalString( - const std::string& parameterName, - const std::string& value) = 0; - - virtual void setGlobalUint32( - const std::string& parameterName, - const uint32& value) = 0; - - virtual void setGlobalInt32( - const std::string& parameterName, - const int32& value) = 0; - - virtual void setGlobalBoolean( - const std::string& parameterName, - const bool& value) = 0; -}; - -CAF_DECLARE_SMART_INTERFACE_POINTER(IAppConfigWrite); - -SmartPtrIAppConfigWrite COMMONAGGREGATOR_LINKAGE getAppConfigWrite(); - -SmartPtrIAppConfigWrite COMMONAGGREGATOR_LINKAGE getAppConfigWrite(const std::string& configFile); - -SmartPtrIAppConfigWrite COMMONAGGREGATOR_LINKAGE getAppConfigWrite(const Cdeqstr& configFileCollection); -} - -#endif /* IAPPCONFIGWRITE_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Common/IAppContext.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Common/IAppContext.h deleted file mode 100644 index 1f8decdbf..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Common/IAppContext.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Author: mdonahue - * Created: Jan 28, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef IAPPLICATIONCONTEXT_H_ -#define IAPPLICATIONCONTEXT_H_ - - - -#include "ICafObject.h" - -#include "IBean.h" - -namespace Caf { - -struct __declspec(novtable) -IAppContext : public ICafObject { - CAF_DECL_UUID("f1d65e47-0f12-4301-861c-6a8c90099dae") - - // key=bean id - typedef std::map CBeans; - CAF_DECLARE_SMART_POINTER(CBeans); - - virtual SmartPtrIBean getBean(const std::string& name) const = 0; -}; - -CAF_DECLARE_SMART_INTERFACE_POINTER(IAppContext); -} - -#endif /* IAPPLICATIONCONTEXT_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Common/IConfigParams.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Common/IConfigParams.h deleted file mode 100644 index eef9ccc70..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Common/IConfigParams.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Author: mdonahue - * Created: Jan 17, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef ICONFIGPARAMS_H_ -#define ICONFIGPARAMS_H_ - -#include "Common/IConfigParams.h" - -namespace Caf { - -struct __declspec(novtable) -IConfigParams : public ICafObject -{ - typedef enum { - PARAM_REQUIRED, - PARAM_OPTIONAL - } EParamDisposition; - - virtual GVariant* lookup( - const char* key, - const EParamDisposition disposition = PARAM_REQUIRED) const = 0; - - virtual std::string getSectionName() const = 0; - - virtual void insert(const char* key, GVariant* value) = 0; -}; - -CAF_DECLARE_SMART_INTERFACE_POINTER(IConfigParams); - -} - -#endif /* ICONFIGPARAMS_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Common/IWork.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Common/IWork.h deleted file mode 100644 index 950ea43ff..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Common/IWork.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Author: bwilliams - * Created: June 29, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef _CommonAggregator_IWork_h_ -#define _CommonAggregator_IWork_h_ - - -#include "ICafObject.h" - -namespace Caf { - -/// TODO - describe interface -struct __declspec(novtable) - IWork : public ICafObject { - CAF_DECL_UUID("76c269db-691f-439d-b47d-87ce55639c8f") - -public: // Read operations - virtual void doWork() = 0; - virtual void stopWork() = 0; -}; - -CAF_DECLARE_SMART_INTERFACE_POINTER(IWork); - -} - -#endif // #ifndef _CommonAggregator_IWork_h_ - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/CommonDefines.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/CommonDefines.h deleted file mode 100644 index c110e0bfa..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/CommonDefines.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Author: mdonahue - * Created: Jan 13, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef COMMON_SYS_INC_COMMONDEFINES_H_ -#define COMMON_SYS_INC_COMMONDEFINES_H_ - -#include - -namespace Caf { -} - -// Aggregator -#include "../src/Common/CommonAggregatorLink.h" - -//////////////////////////////////////////////////////////////////////// -// endian ordering repair macros -//////////////////////////////////////////////////////////////////////// -#define CAF_FIX_16BIT_ENDIAN(x) x = (((x) >> 8) & 0xff) | ((x) << 8) -#define CAF_FIX_32BIT_ENDIAN(x) x = (((x) >> 24) & 0xff) | (((x) >> 8) & 0xff00) | (((x) & 0xff00) << 8) | ((x) << 24) -#define CAF_FIX_64BIT_ENDIAN(x) x = (((x) >> 56) & 0xff) | (((x) >> 40) & 0xff00) | (((x) >> 24) & 0xff0000) | \ - (((x) >> 8) & 0xff000000) | (((x) & 0xff000000) << 8) | \ - (((x) & 0xff0000) << 24) | (((x) & 0xff00) << 40) | \ - ((x) << 56) - -#define CAF_FIX_GUID_ENDIAN(guid) CAF_FIX_32BIT_ENDIAN(guid.Data1); \ - CAF_FIX_16BIT_ENDIAN(guid.Data2); \ - CAF_FIX_16BIT_ENDIAN(guid.Data3) - -#endif /* COMMON_SYS_INC_COMMONDEFINES_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/CommonGlobals.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/CommonGlobals.h deleted file mode 100644 index 403017de7..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/CommonGlobals.h +++ /dev/null @@ -1,50 +0,0 @@ -#ifndef CommonGlobals_h_ -#define CommonGlobals_h_ - -#include "FrameworkLink.h" - -namespace Caf { - extern FRAMEWORK_LINKAGE const char* _sConfigTmpDir; - extern FRAMEWORK_LINKAGE const char* _sConfigInputDir; - extern FRAMEWORK_LINKAGE const char* _sConfigOutputDir; - extern FRAMEWORK_LINKAGE const char* _sConfigSchemaCacheDir; - extern FRAMEWORK_LINKAGE const char* _sConfigProviderRegDir; - extern FRAMEWORK_LINKAGE const char* _sConfigInstallDir; - extern FRAMEWORK_LINKAGE const char* _sConfigInvokersDir; - extern FRAMEWORK_LINKAGE const char* _sConfigProvidersDir; - extern FRAMEWORK_LINKAGE const char* _sConfigCommonPackagesDir; - extern FRAMEWORK_LINKAGE const char* _sConfigWorkingDir; - extern FRAMEWORK_LINKAGE const char* _sConfigPrivateKeyFile; - extern FRAMEWORK_LINKAGE const char* _sConfigCertFile; - - extern FRAMEWORK_LINKAGE const char* _sProviderHostArea; - extern FRAMEWORK_LINKAGE const char* _sManagementAgentArea; - - extern FRAMEWORK_LINKAGE const char* _sSchemaSummaryFilename; - extern FRAMEWORK_LINKAGE const char* _sProviderResponseFilename; - extern FRAMEWORK_LINKAGE const char* _sStdoutFilename; - extern FRAMEWORK_LINKAGE const char* _sStderrFilename; - - extern FRAMEWORK_LINKAGE const char* _sPayloadRequestFilename; - extern FRAMEWORK_LINKAGE const char* _sResponseFilename; - extern FRAMEWORK_LINKAGE const char* _sErrorResponseFilename; - extern FRAMEWORK_LINKAGE const char* _sProviderRequestFilename; - extern FRAMEWORK_LINKAGE const char* _sInfraErrFilename; - - // AppConfig common parameter names - extern FRAMEWORK_LINKAGE const char* _sAppConfigGlobalParamRootDir; - extern FRAMEWORK_LINKAGE const char* _sAppConfigGlobalParamDataDir; - extern FRAMEWORK_LINKAGE const char* _sAppConfigGlobalParamLogDir; - extern FRAMEWORK_LINKAGE const char* _sAppConfigGlobalParamLogConfigFile; - extern FRAMEWORK_LINKAGE const char* _sAppConfigGlobalParamInputDir; - extern FRAMEWORK_LINKAGE const char* _sAppConfigGlobalParamOutputDir; - extern FRAMEWORK_LINKAGE const char* _sAppConfigGlobalParamDbDir; - extern FRAMEWORK_LINKAGE const char* _sAppConfigGlobalThreadStackSizeKb; - - extern FRAMEWORK_LINKAGE const GUID CAFCOMMON_GUID_NULL; - - extern FRAMEWORK_LINKAGE const char* CAFCOMMON_PATH_DELIM; - extern FRAMEWORK_LINKAGE const char CAFCOMMON_PATH_DELIM_CHAR; -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CAddInCollectionDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CAddInCollectionDoc.h deleted file mode 100644 index 8584c77a3..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CAddInCollectionDoc.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CAddInCollectionDoc_h_ -#define CAddInCollectionDoc_h_ - -namespace Caf { - -/// A simple container for objects of type AddInCollection -class CAFCORETYPESDOC_LINKAGE CAddInCollectionDoc { -public: - CAddInCollectionDoc(); - virtual ~CAddInCollectionDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::deque addInCollection = std::deque()); - -public: - /// Accessor for the AddIn - std::deque getAddInCollection() const; - -private: - bool _isInitialized; - - std::deque _addInCollection; - -private: - CAF_CM_DECLARE_NOCOPY(CAddInCollectionDoc); -}; - -CAF_DECLARE_SMART_POINTER(CAddInCollectionDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CAddInsDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CAddInsDoc.h deleted file mode 100644 index c65b6de3d..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CAddInsDoc.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CAddInsDoc_h_ -#define CAddInsDoc_h_ - - -#include "Doc/CafCoreTypesDoc/CAddInCollectionDoc.h" - -namespace Caf { - -/// A simple container for objects of type AddIns -class CAFCORETYPESDOC_LINKAGE CAddInsDoc { -public: - CAddInsDoc(); - virtual ~CAddInsDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::deque addInCollection = std::deque()); - -public: - /// Accessor for the AddInCollection - std::deque getAddInCollection() const; - -private: - bool _isInitialized; - - std::deque _addInCollection; - -private: - CAF_CM_DECLARE_NOCOPY(CAddInsDoc); -}; - -CAF_DECLARE_SMART_POINTER(CAddInsDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CAttachmentCollectionDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CAttachmentCollectionDoc.h deleted file mode 100644 index 80004fe8d..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CAttachmentCollectionDoc.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CAttachmentCollectionDoc_h_ -#define CAttachmentCollectionDoc_h_ - - -#include "Doc/CafCoreTypesDoc/CAttachmentDoc.h" -#include "Doc/CafCoreTypesDoc/CInlineAttachmentDoc.h" - -namespace Caf { - -/// A simple container for objects of type AttachmentCollection -class CAFCORETYPESDOC_LINKAGE CAttachmentCollectionDoc { -public: - CAttachmentCollectionDoc(); - virtual ~CAttachmentCollectionDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::deque attachment = std::deque(), - const std::deque inlineAttachment = std::deque()); - -public: - /// Accessor for the Attachment - std::deque getAttachment() const; - - /// Accessor for the InlineAttachment - std::deque getInlineAttachment() const; - -private: - bool _isInitialized; - - std::deque _attachment; - std::deque _inlineAttachment; - -private: - CAF_CM_DECLARE_NOCOPY(CAttachmentCollectionDoc); -}; - -CAF_DECLARE_SMART_POINTER(CAttachmentCollectionDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CAttachmentDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CAttachmentDoc.h deleted file mode 100644 index 549f0b5a4..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CAttachmentDoc.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#ifndef CAttachmentDoc_h_ -#define CAttachmentDoc_h_ - -#include "Doc/CafCoreTypesDoc/CafCoreTypesDocTypes.h" - -namespace Caf { - -/// A simple container for objects of type Attachment -class CAFCORETYPESDOC_LINKAGE CAttachmentDoc { -public: - CAttachmentDoc(); - virtual ~CAttachmentDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::string name, - const std::string type, - const std::string uri, - const bool isReference, - const CMS_POLICY cmsPolicy = CMS_POLICY_CAF_ENCRYPTED_AND_SIGNED); - -public: - /// Accessor for the Name - std::string getName() const; - - /// Accessor for the Type - std::string getType() const; - - /// Accessor for the Uri - std::string getUri() const; - - /// Accessor for the IsReference - bool getIsReference() const; - - /// Accessor for the CMS Policy - CMS_POLICY getCmsPolicy() const; - -private: - bool _isInitialized; - - std::string _name; - std::string _type; - std::string _uri; - bool _isReference; - CMS_POLICY _cmsPolicy; - -private: - CAF_CM_DECLARE_NOCOPY(CAttachmentDoc); -}; - -CAF_DECLARE_SMART_POINTER(CAttachmentDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CAttachmentNameCollectionDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CAttachmentNameCollectionDoc.h deleted file mode 100644 index a48f5868c..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CAttachmentNameCollectionDoc.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CAttachmentNameCollectionDoc_h_ -#define CAttachmentNameCollectionDoc_h_ - -namespace Caf { - -/// A simple container for objects of type AttachmentNameCollection -class CAFCORETYPESDOC_LINKAGE CAttachmentNameCollectionDoc { -public: - CAttachmentNameCollectionDoc(); - virtual ~CAttachmentNameCollectionDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::deque name = std::deque()); - -public: - /// Accessor for the Name - std::deque getName() const; - -private: - bool _isInitialized; - - std::deque _name; - -private: - CAF_CM_DECLARE_NOCOPY(CAttachmentNameCollectionDoc); -}; - -CAF_DECLARE_SMART_POINTER(CAttachmentNameCollectionDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CAuthnAuthzCollectionDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CAuthnAuthzCollectionDoc.h deleted file mode 100644 index e65f2b399..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CAuthnAuthzCollectionDoc.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CAuthnAuthzCollectionDoc_h_ -#define CAuthnAuthzCollectionDoc_h_ - - -#include "Doc/CafCoreTypesDoc/CAuthnAuthzDoc.h" - -namespace Caf { - -/// Set of logging levels for different components -class CAFCORETYPESDOC_LINKAGE CAuthnAuthzCollectionDoc { -public: - CAuthnAuthzCollectionDoc(); - virtual ~CAuthnAuthzCollectionDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::deque authnAuthz = std::deque()); - -public: - /// Used to change the logging level for a specific component - std::deque getAuthnAuthz() const; - -private: - bool _isInitialized; - - std::deque _authnAuthz; - -private: - CAF_CM_DECLARE_NOCOPY(CAuthnAuthzCollectionDoc); -}; - -CAF_DECLARE_SMART_POINTER(CAuthnAuthzCollectionDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CAuthnAuthzDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CAuthnAuthzDoc.h deleted file mode 100644 index 3a8445a27..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CAuthnAuthzDoc.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Author: bwilliams - * Created: May 24, 2015 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#ifndef CAuthnAuthzDoc_h_ -#define CAuthnAuthzDoc_h_ - -namespace Caf { - -/// A simple container for objects of type AuthnAuthz -class CAFCORETYPESDOC_LINKAGE CAuthnAuthzDoc { -public: - CAuthnAuthzDoc(); - virtual ~CAuthnAuthzDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::string type, - const std::string value, - const std::string name = std::string(), - const int32 sequenceNumber = 0); - -public: - /// Accessor for the Type - std::string getType() const; - - /// Accessor for the Value - std::string getValue() const; - - /// Accessor for the Name - std::string getName() const; - - /// Accessor for the SequenceNumber - int32 getSequenceNumber() const; - -private: - bool _isInitialized; - - std::string _type; - std::string _value; - std::string _name; - int32 _sequenceNumber; - -private: - CAF_CM_DECLARE_NOCOPY(CAuthnAuthzDoc); -}; - -CAF_DECLARE_SMART_POINTER(CAuthnAuthzDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CClassFiltersDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CClassFiltersDoc.h deleted file mode 100644 index 5c73a2cb9..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CClassFiltersDoc.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CClassFiltersDoc_h_ -#define CClassFiltersDoc_h_ - -namespace Caf { - -/// A simple container for objects of type ClassFilters -class CAFCORETYPESDOC_LINKAGE CClassFiltersDoc { -public: - CClassFiltersDoc(); - virtual ~CClassFiltersDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::string dialect = std::string(), - const std::deque classFilter = std::deque()); - -public: - /// Accessor for the Dialect - std::string getDialect() const; - - /// Accessor for the ClassFilter - std::deque getClassFilter() const; - -private: - bool _isInitialized; - - std::string _dialect; - std::deque _classFilter; - -private: - CAF_CM_DECLARE_NOCOPY(CClassFiltersDoc); -}; - -CAF_DECLARE_SMART_POINTER(CClassFiltersDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CClassSpecifierDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CClassSpecifierDoc.h deleted file mode 100644 index cfbd93e4d..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CClassSpecifierDoc.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CClassSpecifierDoc_h_ -#define CClassSpecifierDoc_h_ - - -#include "Doc/CafCoreTypesDoc/CClassFiltersDoc.h" -#include "Doc/CafCoreTypesDoc/CFullyQualifiedClassGroupDoc.h" - -namespace Caf { - -/// A simple container for objects of type ClassSpecifier -class CAFCORETYPESDOC_LINKAGE CClassSpecifierDoc { -public: - CClassSpecifierDoc(); - virtual ~CClassSpecifierDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const SmartPtrCFullyQualifiedClassGroupDoc fullyQualifiedClass = SmartPtrCFullyQualifiedClassGroupDoc(), - const SmartPtrCClassFiltersDoc classFilters = SmartPtrCClassFiltersDoc()); - -public: - /// Accessor for the FullyQualifiedClass - SmartPtrCFullyQualifiedClassGroupDoc getFullyQualifiedClass() const; - - /// Accessor for the ClassFilters - SmartPtrCClassFiltersDoc getClassFilters() const; - -private: - bool _isInitialized; - - SmartPtrCFullyQualifiedClassGroupDoc _fullyQualifiedClass; - SmartPtrCClassFiltersDoc _classFilters; - -private: - CAF_CM_DECLARE_NOCOPY(CClassSpecifierDoc); -}; - -CAF_DECLARE_SMART_POINTER(CClassSpecifierDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CFullyQualifiedClassGroupDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CFullyQualifiedClassGroupDoc.h deleted file mode 100644 index c3c6ad273..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CFullyQualifiedClassGroupDoc.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CFullyQualifiedClassGroupDoc_h_ -#define CFullyQualifiedClassGroupDoc_h_ - -namespace Caf { - -/// A simple container for objects of type FullyQualifiedClassGroup -class CAFCORETYPESDOC_LINKAGE CFullyQualifiedClassGroupDoc { -public: - CFullyQualifiedClassGroupDoc(); - virtual ~CFullyQualifiedClassGroupDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::string classNamespace, - const std::string className, - const std::string classVersion); - -public: - /// Accessor for the ClassNamespace - std::string getClassNamespace() const; - - /// Accessor for the ClassName - std::string getClassName() const; - - /// Accessor for the ClassVersion - std::string getClassVersion() const; - -private: - bool _isInitialized; - - std::string _classNamespace; - std::string _className; - std::string _classVersion; - -private: - CAF_CM_DECLARE_NOCOPY(CFullyQualifiedClassGroupDoc); -}; - -CAF_DECLARE_SMART_POINTER(CFullyQualifiedClassGroupDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CInlineAttachmentCollectionDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CInlineAttachmentCollectionDoc.h deleted file mode 100644 index 89850f053..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CInlineAttachmentCollectionDoc.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CInlineAttachmentCollectionDoc_h_ -#define CInlineAttachmentCollectionDoc_h_ - - -#include "Doc/CafCoreTypesDoc/CInlineAttachmentDoc.h" - -namespace Caf { - -/// A simple container for objects of type InlineAttachmentCollection -class CAFCORETYPESDOC_LINKAGE CInlineAttachmentCollectionDoc { -public: - CInlineAttachmentCollectionDoc(); - virtual ~CInlineAttachmentCollectionDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::deque attachment = std::deque()); - -public: - /// Accessor for the InlineAttachment - std::deque getInlineAttachment() const; - -private: - bool _isInitialized; - - std::deque _attachment; - -private: - CAF_CM_DECLARE_NOCOPY(CInlineAttachmentCollectionDoc); -}; - -CAF_DECLARE_SMART_POINTER(CInlineAttachmentCollectionDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CInlineAttachmentDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CInlineAttachmentDoc.h deleted file mode 100644 index 719acd2f2..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CInlineAttachmentDoc.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CInlineAttachmentDoc_h_ -#define CInlineAttachmentDoc_h_ - -namespace Caf { - -/// A simple container for objects of type InlineAttachment -class CAFCORETYPESDOC_LINKAGE CInlineAttachmentDoc { -public: - CInlineAttachmentDoc(); - virtual ~CInlineAttachmentDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::string name, - const std::string type, - const std::string value); - -public: - /// Accessor for the Name - std::string getName() const; - - /// Accessor for the Type - std::string getType() const; - - /// Accessor for the Value - std::string getValue() const; - -private: - bool _isInitialized; - - std::string _name; - std::string _type; - std::string _value; - -private: - CAF_CM_DECLARE_NOCOPY(CInlineAttachmentDoc); -}; - -CAF_DECLARE_SMART_POINTER(CInlineAttachmentDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CLoggingLevelCollectionDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CLoggingLevelCollectionDoc.h deleted file mode 100644 index f86c18e76..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CLoggingLevelCollectionDoc.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CLoggingLevelCollectionDoc_h_ -#define CLoggingLevelCollectionDoc_h_ - - -#include "Doc/CafCoreTypesDoc/CLoggingLevelElemDoc.h" - -namespace Caf { - -/// Set of logging levels for different components -class CAFCORETYPESDOC_LINKAGE CLoggingLevelCollectionDoc { -public: - CLoggingLevelCollectionDoc(); - virtual ~CLoggingLevelCollectionDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::deque loggingLevel = std::deque()); - -public: - /// Used to change the logging level for a specific component - std::deque getLoggingLevel() const; - -private: - bool _isInitialized; - - std::deque _loggingLevel; - -private: - CAF_CM_DECLARE_NOCOPY(CLoggingLevelCollectionDoc); -}; - -CAF_DECLARE_SMART_POINTER(CLoggingLevelCollectionDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CLoggingLevelElemDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CLoggingLevelElemDoc.h deleted file mode 100644 index ab5788eeb..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CLoggingLevelElemDoc.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CLoggingLevelElemDoc_h_ -#define CLoggingLevelElemDoc_h_ - -#include "Doc/CafCoreTypesDoc/CafCoreTypesDocTypes.h" - -namespace Caf { - -/// Logging level for a component -class CAFCORETYPESDOC_LINKAGE CLoggingLevelElemDoc { -public: - CLoggingLevelElemDoc(); - virtual ~CLoggingLevelElemDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const LOGGINGCOMPONENT_TYPE component = LOGGINGCOMPONENT_NONE, - const LOGGINGLEVEL_TYPE level = LOGGINGLEVEL_NONE); - -public: - /// The logging level applies to this component - LOGGINGCOMPONENT_TYPE getComponent() const; - - /// Set the logging level to this value - LOGGINGLEVEL_TYPE getLevel() const; - -private: - LOGGINGCOMPONENT_TYPE _component; - LOGGINGLEVEL_TYPE _level; - - bool _isInitialized; - -private: - CAF_CM_DECLARE_NOCOPY(CLoggingLevelElemDoc); -}; - -CAF_DECLARE_SMART_POINTER(CLoggingLevelElemDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/COperationDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/COperationDoc.h deleted file mode 100644 index 2e685eca2..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/COperationDoc.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef COperationDoc_h_ -#define COperationDoc_h_ - - -#include "Doc/CafCoreTypesDoc/CParameterCollectionDoc.h" - -namespace Caf { - -/// A simple container for objects of type Operation -class CAFCORETYPESDOC_LINKAGE COperationDoc { -public: - COperationDoc(); - virtual ~COperationDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::string name, - const SmartPtrCParameterCollectionDoc parameterCollection = SmartPtrCParameterCollectionDoc()); - -public: - /// Accessor for the Name - std::string getName() const; - - /// Accessor for the ParameterCollection - SmartPtrCParameterCollectionDoc getParameterCollection() const; - -private: - bool _isInitialized; - - std::string _name; - SmartPtrCParameterCollectionDoc _parameterCollection; - -private: - CAF_CM_DECLARE_NOCOPY(COperationDoc); -}; - -CAF_DECLARE_SMART_POINTER(COperationDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CParameterCollectionDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CParameterCollectionDoc.h deleted file mode 100644 index d0ccc19be..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CParameterCollectionDoc.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CParameterCollectionDoc_h_ -#define CParameterCollectionDoc_h_ - - -#include "Doc/CafCoreTypesDoc/CRequestInstanceParameterDoc.h" -#include "Doc/CafCoreTypesDoc/CRequestParameterDoc.h" - -namespace Caf { - -/// A simple container for objects of type ParameterCollection -class CAFCORETYPESDOC_LINKAGE CParameterCollectionDoc { -public: - CParameterCollectionDoc(); - virtual ~CParameterCollectionDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::deque parameter = std::deque(), - const std::deque instanceParameter = std::deque()); - -public: - /// Accessor for the Parameter - std::deque getParameter() const; - - /// Accessor for the InstanceParameter - std::deque getInstanceParameter() const; - -private: - bool _isInitialized; - - std::deque _parameter; - std::deque _instanceParameter; - -private: - CAF_CM_DECLARE_NOCOPY(CParameterCollectionDoc); -}; - -CAF_DECLARE_SMART_POINTER(CParameterCollectionDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CPropertyCollectionDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CPropertyCollectionDoc.h deleted file mode 100644 index 62f445e30..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CPropertyCollectionDoc.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CPropertyCollectionDoc_h_ -#define CPropertyCollectionDoc_h_ - - -#include "Doc/CafCoreTypesDoc/CPropertyDoc.h" - -namespace Caf { - -/// A simple container for objects of type PropertyCollection -class CAFCORETYPESDOC_LINKAGE CPropertyCollectionDoc { -public: - CPropertyCollectionDoc(); - virtual ~CPropertyCollectionDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::deque property = std::deque()); - -public: - /// Accessor for the Property - std::deque getProperty() const; - -private: - bool _isInitialized; - - std::deque _property; - -private: - CAF_CM_DECLARE_NOCOPY(CPropertyCollectionDoc); -}; - -CAF_DECLARE_SMART_POINTER(CPropertyCollectionDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CPropertyDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CPropertyDoc.h deleted file mode 100644 index 10b4ea46b..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CPropertyDoc.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CPropertyDoc_h_ -#define CPropertyDoc_h_ - -#include "Doc/CafCoreTypesDoc/CafCoreTypesDocTypes.h" - -namespace Caf { - -/// A simple container for objects of type Property -class CAFCORETYPESDOC_LINKAGE CPropertyDoc { -public: - CPropertyDoc(); - virtual ~CPropertyDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::string name, - const PROPERTY_TYPE type, - const std::deque value = std::deque()); - -public: - /// Accessor for the Name - std::string getName() const; - - /// Accessor for the Type - PROPERTY_TYPE getType() const; - - /// Accessor for the Value - std::deque getValue() const; - -private: - PROPERTY_TYPE _type; - - bool _isInitialized; - std::string _name; - std::deque _value; - -private: - CAF_CM_DECLARE_NOCOPY(CPropertyDoc); -}; - -CAF_DECLARE_SMART_POINTER(CPropertyDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CProtocolCollectionDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CProtocolCollectionDoc.h deleted file mode 100644 index ad4abd4df..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CProtocolCollectionDoc.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CProtocolCollectionDoc_h_ -#define CProtocolCollectionDoc_h_ - - -#include "Doc/CafCoreTypesDoc/CProtocolDoc.h" - -namespace Caf { - -/// Set of protocol -class CAFCORETYPESDOC_LINKAGE CProtocolCollectionDoc { -public: - CProtocolCollectionDoc(); - virtual ~CProtocolCollectionDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::deque protocol = std::deque()); - -public: - /// Used to change the logging level for a specific component - std::deque getProtocol() const; - -private: - bool _isInitialized; - - std::deque _protocol; - -private: - CAF_CM_DECLARE_NOCOPY(CProtocolCollectionDoc); -}; - -CAF_DECLARE_SMART_POINTER(CProtocolCollectionDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CProtocolDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CProtocolDoc.h deleted file mode 100644 index 77814227e..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CProtocolDoc.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CProtocolDoc_h_ -#define CProtocolDoc_h_ - -namespace Caf { - -/// A simple container for objects of Protocol -class CAFCORETYPESDOC_LINKAGE CProtocolDoc { -public: - CProtocolDoc(); - virtual ~CProtocolDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::string uri, - const std::string name = std::string(), - const int32 sequenceNumber = 0); - -public: - /// Accessor for the Uri - std::string getUri() const; - - /// Accessor for the Name - std::string getName() const; - - /// Accessor for the Value - int32 getSequenceNumber() const; - -private: - int32 _sequenceNumber; - bool _isInitialized; - - std::string _uri; - std::string _name; - -private: - CAF_CM_DECLARE_NOCOPY(CProtocolDoc); -}; - -CAF_DECLARE_SMART_POINTER(CProtocolDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CRequestConfigDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CRequestConfigDoc.h deleted file mode 100644 index 1cce1a0ad..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CRequestConfigDoc.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CRequestConfigDoc_h_ -#define CRequestConfigDoc_h_ - - -#include "Doc/CafCoreTypesDoc/CAddInsDoc.h" -#include "Doc/CafCoreTypesDoc/CLoggingLevelCollectionDoc.h" - -namespace Caf { - -/// A simple container for objects of type RequestConfig -class CAFCORETYPESDOC_LINKAGE CRequestConfigDoc { -public: - CRequestConfigDoc(); - virtual ~CRequestConfigDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::string responseFormatType, - const SmartPtrCAddInsDoc requestProcessorAddIns = SmartPtrCAddInsDoc(), - const SmartPtrCAddInsDoc responseProcessorAddIns = SmartPtrCAddInsDoc(), - const SmartPtrCLoggingLevelCollectionDoc loggingLevelCollection = SmartPtrCLoggingLevelCollectionDoc()); - -public: - /// Accessor for the ResponseFormatType - std::string getResponseFormatType() const; - - /// Accessor for the RequestProcessorAddIns - SmartPtrCAddInsDoc getRequestProcessorAddIns() const; - - /// Accessor for the ResponseProcessorAddIns - SmartPtrCAddInsDoc getResponseProcessorAddIns() const; - - /// Accessor for the LoggingLevelCollection - SmartPtrCLoggingLevelCollectionDoc getLoggingLevelCollection() const; - -private: - bool _isInitialized; - - std::string _responseFormatType; - SmartPtrCAddInsDoc _requestProcessorAddIns; - SmartPtrCAddInsDoc _responseProcessorAddIns; - SmartPtrCLoggingLevelCollectionDoc _loggingLevelCollection; - -private: - CAF_CM_DECLARE_NOCOPY(CRequestConfigDoc); -}; - -CAF_DECLARE_SMART_POINTER(CRequestConfigDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CRequestHeaderDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CRequestHeaderDoc.h deleted file mode 100644 index 49dc87131..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CRequestHeaderDoc.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CRequestHeaderDoc_h_ -#define CRequestHeaderDoc_h_ - - -#include "Doc/CafCoreTypesDoc/CAuthnAuthzCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CPropertyCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CProtocolCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CRequestConfigDoc.h" - -namespace Caf { - -/// A simple container for objects of type RequestHeader -class CAFCORETYPESDOC_LINKAGE CRequestHeaderDoc { -public: - CRequestHeaderDoc(); - virtual ~CRequestHeaderDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const SmartPtrCRequestConfigDoc requestConfig, - const SmartPtrCAuthnAuthzCollectionDoc authnAuthzCollection = SmartPtrCAuthnAuthzCollectionDoc(), - const SmartPtrCProtocolCollectionDoc protocolCollection = SmartPtrCProtocolCollectionDoc(), - const SmartPtrCPropertyCollectionDoc echoPropertyBag = SmartPtrCPropertyCollectionDoc(), - const std::string version = "1.0", - const std::string createdDateTime = CDateTimeUtils::getCurrentDateTime(), - const UUID sessionId = CAFCOMMON_GUID_NULL); - -public: - /// Accessor for the RequestConfig - SmartPtrCRequestConfigDoc getRequestConfig() const; - - /// Accessor for the Authentication / Authorization Collection - SmartPtrCAuthnAuthzCollectionDoc getAuthnAuthzCollection() const; - - /// Accessor for the Protocol Collection - SmartPtrCProtocolCollectionDoc getProtocolCollection() const; - - /// Accessor for the EchoPropertyBag - SmartPtrCPropertyCollectionDoc getEchoPropertyBag() const; - - /// Accessor for the version - std::string getVersion() const; - - /// Accessor for the date/time when the request was created - std::string getCreatedDateTime() const; - - /// Accessor for the session ID - UUID getSessionId() const; - -private: - bool _isInitialized; - - SmartPtrCRequestConfigDoc _requestConfig; - SmartPtrCAuthnAuthzCollectionDoc _authnAuthzCollection; - SmartPtrCProtocolCollectionDoc _protocolCollection; - SmartPtrCPropertyCollectionDoc _echoPropertyBag; - std::string _version; - std::string _createdDateTime; - UUID _sessionId; - -private: - CAF_CM_DECLARE_NOCOPY(CRequestHeaderDoc); -}; - -CAF_DECLARE_SMART_POINTER(CRequestHeaderDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CRequestInstanceParameterDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CRequestInstanceParameterDoc.h deleted file mode 100644 index 06a78fba8..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CRequestInstanceParameterDoc.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CRequestInstanceParameterDoc_h_ -#define CRequestInstanceParameterDoc_h_ - -namespace Caf { - -/// A simple container for objects of type RequestInstanceParameter -class CAFCORETYPESDOC_LINKAGE CRequestInstanceParameterDoc { -public: - CRequestInstanceParameterDoc(); - virtual ~CRequestInstanceParameterDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::string name, - const std::string classNamespace, - const std::string className, - const std::string classVersion, - const std::deque value); - -public: - /// Accessor for the Name - std::string getName() const; - - /// Accessor for the ClassNamespace - std::string getClassNamespace() const; - - /// Accessor for the ClassName - std::string getClassName() const; - - /// Accessor for the ClassVersion - std::string getClassVersion() const; - - /// Accessor for the Value - std::deque getValue() const; - -private: - bool _isInitialized; - - std::string _name; - std::string _classNamespace; - std::string _className; - std::string _classVersion; - std::deque _value; - -private: - CAF_CM_DECLARE_NOCOPY(CRequestInstanceParameterDoc); -}; - -CAF_DECLARE_SMART_POINTER(CRequestInstanceParameterDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CRequestParameterDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CRequestParameterDoc.h deleted file mode 100644 index 009e26f7e..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CRequestParameterDoc.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CRequestParameterDoc_h_ -#define CRequestParameterDoc_h_ - -#include "Doc/CafCoreTypesDoc/CafCoreTypesDocTypes.h" - -namespace Caf { - -/// A simple container for objects of type RequestParameter -class CAFCORETYPESDOC_LINKAGE CRequestParameterDoc { -public: - CRequestParameterDoc(); - virtual ~CRequestParameterDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::string name, - const PARAMETER_TYPE type, - const std::deque value); - -public: - /// Accessor for the Name - std::string getName() const; - - /// Accessor for the Type - PARAMETER_TYPE getType() const; - - /// Accessor for the Value - std::deque getValue() const; - -private: - PARAMETER_TYPE _type; - - bool _isInitialized; - std::string _name; - std::deque _value; - -private: - CAF_CM_DECLARE_NOCOPY(CRequestParameterDoc); -}; - -CAF_DECLARE_SMART_POINTER(CRequestParameterDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CStatisticsDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CStatisticsDoc.h deleted file mode 100644 index 6143bf0e5..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CStatisticsDoc.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CStatisticsDoc_h_ -#define CStatisticsDoc_h_ - - -#include "Doc/CafCoreTypesDoc/CPropertyCollectionDoc.h" - -namespace Caf { - -/// A simple container for objects of type Statistics -class CAFCORETYPESDOC_LINKAGE CStatisticsDoc { -public: - CStatisticsDoc(); - virtual ~CStatisticsDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const SmartPtrCPropertyCollectionDoc propertyCollection, - const int32 providerJobNum, - const int32 providerJobTotal, - const int32 providerJobDurationSecs, - const int32 pmeNum, - const int32 pmeTotal, - const int32 pmeDurationSecs); - -public: - /// Accessor for the PropertyCollection - SmartPtrCPropertyCollectionDoc getPropertyCollection() const; - - /// Accessor for the ProviderJobNum - int32 getProviderJobNum() const; - - /// Accessor for the ProviderJobTotal - int32 getProviderJobTotal() const; - - /// Accessor for the ProviderJobDurationSecs - int32 getProviderJobDurationSecs() const; - - /// Accessor for the PmeNum - int32 getPmeNum() const; - - /// Accessor for the PmeTotal - int32 getPmeTotal() const; - - /// Accessor for the PmeDurationSecs - int32 getPmeDurationSecs() const; - -private: - SmartPtrCPropertyCollectionDoc _propertyCollection; - int32 _providerJobNum; - int32 _providerJobTotal; - int32 _providerJobDurationSecs; - int32 _pmeNum; - int32 _pmeTotal; - int32 _pmeDurationSecs; - bool _isInitialized; - -private: - CAF_CM_DECLARE_NOCOPY(CStatisticsDoc); -}; - -CAF_DECLARE_SMART_POINTER(CStatisticsDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CafCoreTypesDocLink.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CafCoreTypesDocLink.h deleted file mode 100644 index 064dcfef1..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CafCoreTypesDocLink.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Author: bwilliams - * Created: February 25, 2016 - * - * Copyright (C) 2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#ifndef CafCoreTypesDoc_Link_h_ -#define CafCoreTypesDoc_Link_h_ - -#ifndef CAFCORETYPESDOC_LINKAGE - #ifdef WIN32 - #ifdef FRAMEWORK_BUILD - #define CAFCORETYPESDOC_LINKAGE __declspec(dllexport) - #else - #define CAFCORETYPESDOC_LINKAGE __declspec(dllimport) - #endif - #else - #define CAFCORETYPESDOC_LINKAGE - #endif -#endif - - -#endif /* CafCoreTypesDoc_Link_h_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CafCoreTypesDocTypes.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CafCoreTypesDocTypes.h deleted file mode 100644 index 59a826141..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafCoreTypesDoc/CafCoreTypesDocTypes.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CAFCORETYPESDOCTYPES_H_ -#define CAFCORETYPESDOCTYPES_H_ - -#include "Doc/CafCoreTypesDoc/CafCoreTypesDocTypes.h" - -namespace Caf { - typedef enum { - PROPERTY_NONE, - PROPERTY_STRING, - PROPERTY_SINT32, - PROPERTY_UINT32, - PROPERTY_SINT64, - PROPERTY_UINT64, - PROPERTY_DECIMAL, - PROPERTY_DOUBLE, - PROPERTY_BOOLEAN, - PROPERTY_DATETIME - } PROPERTY_TYPE; - - typedef enum { - PARAMETER_NONE, - PARAMETER_STRING, - PARAMETER_SINT32, - PARAMETER_UINT32, - PARAMETER_SINT64, - PARAMETER_UINT64, - PARAMETER_DECIMAL, - PARAMETER_DOUBLE, - PARAMETER_BOOLEAN, - PARAMETER_DATETIME - } PARAMETER_TYPE; - - typedef enum { - LOGGINGLEVEL_NONE, - LOGGINGLEVEL_DEBUG, - LOGGINGLEVEL_INFO, - LOGGINGLEVEL_WARN, - LOGGINGLEVEL_ERROR, - LOGGINGLEVEL_CRITICAL - } LOGGINGLEVEL_TYPE; - - typedef enum { - LOGGINGCOMPONENT_NONE, - LOGGINGCOMPONENT_COMMUNICATIONS, - LOGGINGCOMPONENT_MANAGEMENTAGENT, - LOGGINGCOMPONENT_UINT32, - LOGGINGCOMPONENT_PROVIDERFRAMEWORK, - LOGGINGCOMPONENT_PROVIDER - } LOGGINGCOMPONENT_TYPE; - - typedef enum { - CMS_POLICY_NONE, - CMS_POLICY_CAF_ENCRYPTED, - CMS_POLICY_CAF_SIGNED, - CMS_POLICY_CAF_ENCRYPTED_AND_SIGNED, - CMS_POLICY_APP_SIGNED, - CMS_POLICY_APP_ENCRYPTED, - CMS_POLICY_APP_ENCRYPTED_AND_SIGNED - } CMS_POLICY; -} - -#endif /* CAFCORETYPESDOCTYPES_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafInstallRequestDoc/CFullPackageElemDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafInstallRequestDoc/CFullPackageElemDoc.h deleted file mode 100644 index 2d956eb8b..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafInstallRequestDoc/CFullPackageElemDoc.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CFullPackageElemDoc_h_ -#define CFullPackageElemDoc_h_ - - -#include "Doc/CafInstallRequestDoc/CPackageDefnDoc.h" - -namespace Caf { - -/// A simple container for objects of type FullPackageElem -class CAFINSTALLREQUESTDOC_LINKAGE CFullPackageElemDoc { -public: - CFullPackageElemDoc(); - virtual ~CFullPackageElemDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const int32 index, - const std::string packageNamespace, - const std::string packageName, - const std::string packageVersion, - const SmartPtrCPackageDefnDoc installPackage, - const SmartPtrCPackageDefnDoc uninstallPackage); - -public: - /// Accessor for the Index - int32 getIndex() const; - - /// Accessor for the PackageNamespace - std::string getPackageNamespace() const; - - /// Accessor for the PackageName - std::string getPackageName() const; - - /// Accessor for the PackageVersion - std::string getPackageVersion() const; - - /// Accessor for the InstallPackage - SmartPtrCPackageDefnDoc getInstallPackage() const; - - /// Accessor for the UninstallPackage - SmartPtrCPackageDefnDoc getUninstallPackage() const; - -private: - int32 _index; - std::string _packageNamespace; - std::string _packageName; - std::string _packageVersion; - SmartPtrCPackageDefnDoc _installPackage; - SmartPtrCPackageDefnDoc _uninstallPackage; - bool _isInitialized; - -private: - CAF_CM_DECLARE_NOCOPY(CFullPackageElemDoc); -}; - -CAF_DECLARE_SMART_POINTER(CFullPackageElemDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafInstallRequestDoc/CGetInventoryJobDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafInstallRequestDoc/CGetInventoryJobDoc.h deleted file mode 100644 index 452998cc2..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafInstallRequestDoc/CGetInventoryJobDoc.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CGetInventoryJobDoc_h_ -#define CGetInventoryJobDoc_h_ - -namespace Caf { - -/// A simple container for objects of type GetInventoryJob -class CAFINSTALLREQUESTDOC_LINKAGE CGetInventoryJobDoc { -public: - CGetInventoryJobDoc(); - virtual ~CGetInventoryJobDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const UUID jobId); - -public: - /// Accessor for the JobId - UUID getJobId() const; - -private: - UUID _jobId; - bool _isInitialized; - -private: - CAF_CM_DECLARE_NOCOPY(CGetInventoryJobDoc); -}; - -CAF_DECLARE_SMART_POINTER(CGetInventoryJobDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafInstallRequestDoc/CInstallBatchDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafInstallRequestDoc/CInstallBatchDoc.h deleted file mode 100644 index 1c00c10df..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafInstallRequestDoc/CInstallBatchDoc.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CInstallBatchDoc_h_ -#define CInstallBatchDoc_h_ - - -#include "Doc/CafInstallRequestDoc/CGetInventoryJobDoc.h" -#include "Doc/CafInstallRequestDoc/CInstallProviderJobDoc.h" -#include "Doc/CafInstallRequestDoc/CUninstallProviderJobDoc.h" - -namespace Caf { - -/// A simple container for objects of type InstallBatch -class CAFINSTALLREQUESTDOC_LINKAGE CInstallBatchDoc { -public: - CInstallBatchDoc(); - virtual ~CInstallBatchDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const SmartPtrCGetInventoryJobDoc getInventory, - const SmartPtrCInstallProviderJobDoc installProvider, - const SmartPtrCUninstallProviderJobDoc uninstallProvider); - -public: - /// Accessor for the GetInventory - SmartPtrCGetInventoryJobDoc getGetInventory() const; - - /// Accessor for the InstallProvider - SmartPtrCInstallProviderJobDoc getInstallProvider() const; - - /// Accessor for the UninstallProvider - SmartPtrCUninstallProviderJobDoc getUninstallProvider() const; - -private: - bool _isInitialized; - - SmartPtrCGetInventoryJobDoc _getInventory; - SmartPtrCInstallProviderJobDoc _installProvider; - SmartPtrCUninstallProviderJobDoc _uninstallProvider; - -private: - CAF_CM_DECLARE_NOCOPY(CInstallBatchDoc); -}; - -CAF_DECLARE_SMART_POINTER(CInstallBatchDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafInstallRequestDoc/CInstallPackageSpecDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafInstallRequestDoc/CInstallPackageSpecDoc.h deleted file mode 100644 index 1cc005849..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafInstallRequestDoc/CInstallPackageSpecDoc.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CInstallPackageSpecDoc_h_ -#define CInstallPackageSpecDoc_h_ - - -#include "Doc/CafCoreTypesDoc/CAttachmentCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CAttachmentNameCollectionDoc.h" - -namespace Caf { - -/// A simple container for objects of type InstallPackageSpec -class CAFINSTALLREQUESTDOC_LINKAGE CInstallPackageSpecDoc { -public: - CInstallPackageSpecDoc(); - virtual ~CInstallPackageSpecDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::string packageNamespace, - const std::string packageName, - const std::string packageVersion, - const std::string startupAttachmentName, - const std::string packageAttachmentName, - const SmartPtrCAttachmentNameCollectionDoc attachmentNameCollection, - const SmartPtrCAttachmentCollectionDoc attachmentCollection, - const std::string arguments); - -public: - /// Accessor for the PackageNamespace - std::string getPackageNamespace() const; - - /// Accessor for the PackageName - std::string getPackageName() const; - - /// Accessor for the PackageVersion - std::string getPackageVersion() const; - - /// Accessor for the StartupAttachmentName - std::string getStartupAttachmentName() const; - - /// Accessor for the PackageAttachmentName - std::string getPackageAttachmentName() const; - - /// Accessor for the AttachmentNameCollection - SmartPtrCAttachmentNameCollectionDoc getSupportingAttachmentNameCollection() const; - - /// Accessor for the AttachmentCollection - SmartPtrCAttachmentCollectionDoc getAttachmentCollection() const; - - /// Accessor for the Arguments - std::string getArguments() const; - -private: - bool _isInitialized; - - std::string _packageNamespace; - std::string _packageName; - std::string _packageVersion; - std::string _startupAttachmentName; - std::string _packageAttachmentName; - SmartPtrCAttachmentNameCollectionDoc _attachmentNameCollection; - SmartPtrCAttachmentCollectionDoc _attachmentCollection; - std::string _arguments; - -private: - CAF_CM_DECLARE_NOCOPY(CInstallPackageSpecDoc); -}; - -CAF_DECLARE_SMART_POINTER(CInstallPackageSpecDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafInstallRequestDoc/CInstallProviderJobDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafInstallRequestDoc/CInstallProviderJobDoc.h deleted file mode 100644 index 3d8fffc5e..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafInstallRequestDoc/CInstallProviderJobDoc.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CInstallProviderJobDoc_h_ -#define CInstallProviderJobDoc_h_ - - -#include "Doc/CafInstallRequestDoc/CFullPackageElemDoc.h" -#include "Doc/CafInstallRequestDoc/CafInstallRequestDocTypes.h" - -namespace Caf { - -/// A simple container for objects of type InstallProviderJob -class CAFINSTALLREQUESTDOC_LINKAGE CInstallProviderJobDoc { -public: - CInstallProviderJobDoc(); - virtual ~CInstallProviderJobDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const UUID clientId, - const UUID jobId, - const std::string providerNamespace, - const std::string providerName, - const std::string providerVersion, - const PACKAGE_OS_TYPE packageOSType, - const std::deque packageCollection); - -public: - /// Accessor for the ClientId - UUID getClientId() const; - - /// Accessor for the JobId - UUID getJobId() const; - - /// Accessor for the ProviderNamespace - std::string getProviderNamespace() const; - - /// Accessor for the ProviderName - std::string getProviderName() const; - - /// Accessor for the ProviderVersion - std::string getProviderVersion() const; - - /// Accessor for the PackageOSType - PACKAGE_OS_TYPE getPackageOSType() const; - - /// Accessor for the PackageVal - std::deque getPackageCollection() const; - -private: - UUID _clientId; - UUID _jobId; - std::string _providerNamespace; - std::string _providerName; - std::string _providerVersion; - PACKAGE_OS_TYPE _packageOSType; - std::deque _packageCollection; - bool _isInitialized; - -private: - CAF_CM_DECLARE_NOCOPY(CInstallProviderJobDoc); -}; - -CAF_DECLARE_SMART_POINTER(CInstallProviderJobDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafInstallRequestDoc/CInstallProviderSpecDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafInstallRequestDoc/CInstallProviderSpecDoc.h deleted file mode 100644 index 1b6020ce2..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafInstallRequestDoc/CInstallProviderSpecDoc.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CInstallProviderSpecDoc_h_ -#define CInstallProviderSpecDoc_h_ - - -#include "Doc/CafInstallRequestDoc/CMinPackageElemDoc.h" - -namespace Caf { - -/// A simple container for objects of type InstallProviderSpec -class CAFINSTALLREQUESTDOC_LINKAGE CInstallProviderSpecDoc { -public: - CInstallProviderSpecDoc(); - virtual ~CInstallProviderSpecDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const UUID clientId, - const std::string providerNamespace, - const std::string providerName, - const std::string providerVersion, - const std::deque packageCollection); - -public: - /// Accessor for the ClientId - UUID getClientId() const; - - /// Accessor for the ProviderNamespace - std::string getProviderNamespace() const; - - /// Accessor for the ProviderName - std::string getProviderName() const; - - /// Accessor for the ProviderVersion - std::string getProviderVersion() const; - - /// Accessor for the PackageVal - std::deque getPackageCollection() const; - -private: - UUID _clientId; - std::string _providerNamespace; - std::string _providerName; - std::string _providerVersion; - std::deque _packageCollection; - bool _isInitialized; - -private: - CAF_CM_DECLARE_NOCOPY(CInstallProviderSpecDoc); -}; - -CAF_DECLARE_SMART_POINTER(CInstallProviderSpecDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafInstallRequestDoc/CInstallRequestDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafInstallRequestDoc/CInstallRequestDoc.h deleted file mode 100644 index 2caf9a3e8..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafInstallRequestDoc/CInstallRequestDoc.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CInstallRequestDoc_h_ -#define CInstallRequestDoc_h_ - - -#include "Doc/CafCoreTypesDoc/CAttachmentCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CRequestHeaderDoc.h" -#include "Doc/CafInstallRequestDoc/CInstallBatchDoc.h" - -namespace Caf { - -/// A simple container for objects of type InstallRequest -class CAFINSTALLREQUESTDOC_LINKAGE CInstallRequestDoc { -public: - CInstallRequestDoc(); - virtual ~CInstallRequestDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const UUID clientId, - const UUID requestId, - const std::string pmeId, - const SmartPtrCRequestHeaderDoc requestHeader, - const SmartPtrCInstallBatchDoc batch, - const SmartPtrCAttachmentCollectionDoc attachmentCollection); - -public: - /// Accessor for the ClientId - UUID getClientId() const; - - /// Accessor for the RequestId - UUID getRequestId() const; - - /// Accessor for the PmeId - std::string getPmeId() const; - - /// Accessor for the RequestHeader - SmartPtrCRequestHeaderDoc getRequestHeader() const; - - /// Accessor for the Batch - SmartPtrCInstallBatchDoc getBatch() const; - - /// Accessor for the AttachmentCollection - SmartPtrCAttachmentCollectionDoc getAttachmentCollection() const; - -private: - UUID _clientId; - UUID _requestId; - std::string _pmeId; - SmartPtrCRequestHeaderDoc _requestHeader; - SmartPtrCInstallBatchDoc _batch; - SmartPtrCAttachmentCollectionDoc _attachmentCollection; - bool _isInitialized; - -private: - CAF_CM_DECLARE_NOCOPY(CInstallRequestDoc); -}; - -CAF_DECLARE_SMART_POINTER(CInstallRequestDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafInstallRequestDoc/CMinPackageElemDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafInstallRequestDoc/CMinPackageElemDoc.h deleted file mode 100644 index ea9ae0122..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafInstallRequestDoc/CMinPackageElemDoc.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CMinPackageElemDoc_h_ -#define CMinPackageElemDoc_h_ - -namespace Caf { - -/// A simple container for objects of type MinPackageElem -class CAFINSTALLREQUESTDOC_LINKAGE CMinPackageElemDoc { -public: - CMinPackageElemDoc(); - virtual ~CMinPackageElemDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const int32 index, - const std::string packageNamespace, - const std::string packageName, - const std::string packageVersion); - -public: - /// Accessor for the Index - int32 getIndex() const; - - /// Accessor for the PackageNamespace - std::string getPackageNamespace() const; - - /// Accessor for the PackageName - std::string getPackageName() const; - - /// Accessor for the PackageVersion - std::string getPackageVersion() const; - -private: - int32 _index; - std::string _packageNamespace; - std::string _packageName; - std::string _packageVersion; - bool _isInitialized; - -private: - CAF_CM_DECLARE_NOCOPY(CMinPackageElemDoc); -}; - -CAF_DECLARE_SMART_POINTER(CMinPackageElemDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafInstallRequestDoc/CPackageDefnDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafInstallRequestDoc/CPackageDefnDoc.h deleted file mode 100644 index bdcdbc87b..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafInstallRequestDoc/CPackageDefnDoc.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CPackageDefnDoc_h_ -#define CPackageDefnDoc_h_ - - -#include "Doc/CafCoreTypesDoc/CAttachmentNameCollectionDoc.h" - -namespace Caf { - -/// A simple container for objects of type PackageDefn -class CAFINSTALLREQUESTDOC_LINKAGE CPackageDefnDoc { -public: - CPackageDefnDoc(); - virtual ~CPackageDefnDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::string startupAttachmentName, - const std::string packageAttachmentName, - const SmartPtrCAttachmentNameCollectionDoc attachmentNameCollection, - const std::string arguments); - -public: - /// Accessor for the StartupAttachmentName - std::string getStartupAttachmentName() const; - - /// Accessor for the PackageAttachmentName - std::string getPackageAttachmentName() const; - - /// Accessor for the AttachmentNameCollection - SmartPtrCAttachmentNameCollectionDoc getSupportingAttachmentNameCollection() const; - - /// Accessor for the Arguments - std::string getArguments() const; - -private: - bool _isInitialized; - - std::string _startupAttachmentName; - std::string _packageAttachmentName; - SmartPtrCAttachmentNameCollectionDoc _attachmentNameCollection; - std::string _arguments; - -private: - CAF_CM_DECLARE_NOCOPY(CPackageDefnDoc); -}; - -CAF_DECLARE_SMART_POINTER(CPackageDefnDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafInstallRequestDoc/CUninstallProviderJobDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafInstallRequestDoc/CUninstallProviderJobDoc.h deleted file mode 100644 index 5162014ed..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafInstallRequestDoc/CUninstallProviderJobDoc.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CUninstallProviderJobDoc_h_ -#define CUninstallProviderJobDoc_h_ - -#include "Doc/CafInstallRequestDoc/CafInstallRequestDocTypes.h" - -namespace Caf { - -/// A simple container for objects of type UninstallProviderJob -class CAFINSTALLREQUESTDOC_LINKAGE CUninstallProviderJobDoc { -public: - CUninstallProviderJobDoc(); - virtual ~CUninstallProviderJobDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const UUID clientId, - const UUID jobId, - const std::string providerNamespace, - const std::string providerName, - const std::string providerVersion, - const PACKAGE_OS_TYPE packageOSType); - -public: - /// Accessor for the ClientId - UUID getClientId() const; - - /// Accessor for the JobId - UUID getJobId() const; - - /// Accessor for the ProviderNamespace - std::string getProviderNamespace() const; - - /// Accessor for the ProviderName - std::string getProviderName() const; - - /// Accessor for the ProviderVersion - std::string getProviderVersion() const; - - /// Accessor for the PackageOSType - PACKAGE_OS_TYPE getPackageOSType() const; - -private: - UUID _clientId; - UUID _jobId; - std::string _providerNamespace; - std::string _providerName; - std::string _providerVersion; - PACKAGE_OS_TYPE _packageOSType; - bool _isInitialized; - -private: - CAF_CM_DECLARE_NOCOPY(CUninstallProviderJobDoc); -}; - -CAF_DECLARE_SMART_POINTER(CUninstallProviderJobDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafInstallRequestDoc/CafInstallRequestDocLink.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafInstallRequestDoc/CafInstallRequestDocLink.h deleted file mode 100644 index 83dd480ac..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafInstallRequestDoc/CafInstallRequestDocLink.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Author: bwilliams - * Created: February 25, 2016 - * - * Copyright (C) 2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#ifndef CafInstallRequestDoc_Link_h_ -#define CafInstallRequestDoc_Link_h_ - -#ifndef CAFINSTALLREQUESTDOC_LINKAGE - #ifdef WIN32 - #ifdef FRAMEWORK_BUILD - #define CAFINSTALLREQUESTDOC_LINKAGE __declspec(dllexport) - #else - #define CAFINSTALLREQUESTDOC_LINKAGE __declspec(dllimport) - #endif - #else - #define CAFINSTALLREQUESTDOC_LINKAGE - #endif -#endif - - -#endif /* CafInstallRequestDoc_Link_h_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafInstallRequestDoc/CafInstallRequestDocTypes.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafInstallRequestDoc/CafInstallRequestDocTypes.h deleted file mode 100644 index 411387384..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/CafInstallRequestDoc/CafInstallRequestDocTypes.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CAFINSTALLREQUESTDOCTYPES_H_ -#define CAFINSTALLREQUESTDOCTYPES_H_ - -#include "Doc/CafInstallRequestDoc/CafInstallRequestDocTypes.h" - -namespace Caf { - typedef enum { - PACKAGE_OS_NONE, - PACKAGE_OS_ALL, - PACKAGE_OS_NIX, - PACKAGE_OS_WIN - } PACKAGE_OS_TYPE; -} - -#endif /* CAFINSTALLREQUESTTYPES_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DiagRequestDoc/CDiagRequestDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DiagRequestDoc/CDiagRequestDoc.h deleted file mode 100644 index 2a9bb61da..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DiagRequestDoc/CDiagRequestDoc.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CDiagRequestDoc_h_ -#define CDiagRequestDoc_h_ - - -#include "Doc/CafCoreTypesDoc/CRequestHeaderDoc.h" -#include "Doc/DiagTypesDoc/CDiagBatchDoc.h" - -namespace Caf { - -/// A simple container for objects of type DiagRequest -class DIAGREQUESTDOC_LINKAGE CDiagRequestDoc { -public: - CDiagRequestDoc(); - virtual ~CDiagRequestDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const UUID clientId, - const UUID requestId, - const std::string pmeId, - const SmartPtrCRequestHeaderDoc requestHeader, - const SmartPtrCDiagBatchDoc batch); - -public: - /// Accessor for the ClientId - UUID getClientId() const; - - /// Accessor for the RequestId - UUID getRequestId() const; - - /// Accessor for the PmeId - std::string getPmeId() const; - - /// Accessor for the RequestHeader - SmartPtrCRequestHeaderDoc getRequestHeader() const; - - /// Accessor for the Batch - SmartPtrCDiagBatchDoc getBatch() const; - -private: - UUID _clientId; - UUID _requestId; - std::string _pmeId; - SmartPtrCRequestHeaderDoc _requestHeader; - SmartPtrCDiagBatchDoc _batch; - bool _isInitialized; - -private: - CAF_CM_DECLARE_NOCOPY(CDiagRequestDoc); -}; - -CAF_DECLARE_SMART_POINTER(CDiagRequestDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DiagRequestDoc/DiagRequestDocLink.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DiagRequestDoc/DiagRequestDocLink.h deleted file mode 100644 index 3c6652829..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DiagRequestDoc/DiagRequestDocLink.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Author: bwilliams - * Created: February 25, 2016 - * - * Copyright (C) 2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#ifndef DiagRequestDoc_Link_h_ -#define DiagRequestDoc_Link_h_ - -#ifndef DIAGREQUESTDOC_LINKAGE - #ifdef WIN32 - #ifdef FRAMEWORK_BUILD - #define DIAGREQUESTDOC_LINKAGE __declspec(dllexport) - #else - #define DIAGREQUESTDOC_LINKAGE __declspec(dllimport) - #endif - #else - #define DIAGREQUESTDOC_LINKAGE - #endif -#endif - - -#endif /* DiagRequestDoc_Link_h_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DiagTypesDoc/CDiagBatchDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DiagTypesDoc/CDiagBatchDoc.h deleted file mode 100644 index 6483d732a..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DiagTypesDoc/CDiagBatchDoc.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CDiagBatchDoc_h_ -#define CDiagBatchDoc_h_ - - -#include "Doc/DiagTypesDoc/CDiagCollectInstancesDoc.h" -#include "Doc/DiagTypesDoc/CDiagDeleteValueCollectionDoc.h" -#include "Doc/DiagTypesDoc/CDiagSetValueCollectionDoc.h" - -namespace Caf { - -/// A simple container for objects of type DiagBatch -class DIAGTYPESDOC_LINKAGE CDiagBatchDoc { -public: - CDiagBatchDoc(); - virtual ~CDiagBatchDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const SmartPtrCDiagCollectInstancesDoc collectInstances, - const SmartPtrCDiagSetValueCollectionDoc setValueCollection, - const SmartPtrCDiagDeleteValueCollectionDoc deleteValueCollection); - -public: - /// Accessor for the CollectInstances - SmartPtrCDiagCollectInstancesDoc getCollectInstances() const; - - /// Accessor for the SetValueCollection - SmartPtrCDiagSetValueCollectionDoc getSetValueCollection() const; - - /// Accessor for the DeleteValueCollection - SmartPtrCDiagDeleteValueCollectionDoc getDeleteValueCollection() const; - -private: - bool _isInitialized; - - SmartPtrCDiagCollectInstancesDoc _collectInstances; - SmartPtrCDiagSetValueCollectionDoc _setValueCollection; - SmartPtrCDiagDeleteValueCollectionDoc _deleteValueCollection; - -private: - CAF_CM_DECLARE_NOCOPY(CDiagBatchDoc); -}; - -CAF_DECLARE_SMART_POINTER(CDiagBatchDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DiagTypesDoc/CDiagCollectInstancesDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DiagTypesDoc/CDiagCollectInstancesDoc.h deleted file mode 100644 index 2a403f130..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DiagTypesDoc/CDiagCollectInstancesDoc.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CDiagCollectInstancesDoc_h_ -#define CDiagCollectInstancesDoc_h_ - -namespace Caf { - -/// A simple container for objects of type DiagCollectInstances -class DIAGTYPESDOC_LINKAGE CDiagCollectInstancesDoc { -public: - CDiagCollectInstancesDoc(); - virtual ~CDiagCollectInstancesDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const UUID jobId); - -public: - /// Accessor for the JobId - UUID getJobId() const; - -private: - UUID _jobId; - bool _isInitialized; - -private: - CAF_CM_DECLARE_NOCOPY(CDiagCollectInstancesDoc); -}; - -CAF_DECLARE_SMART_POINTER(CDiagCollectInstancesDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DiagTypesDoc/CDiagDeleteValueCollectionDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DiagTypesDoc/CDiagDeleteValueCollectionDoc.h deleted file mode 100644 index cc96d89e5..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DiagTypesDoc/CDiagDeleteValueCollectionDoc.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CDiagDeleteValueCollectionDoc_h_ -#define CDiagDeleteValueCollectionDoc_h_ - - -#include "Doc/DiagTypesDoc/CDiagDeleteValueDoc.h" - -namespace Caf { - -/// A simple container for objects of type DiagDeleteValueCollection -class DIAGTYPESDOC_LINKAGE CDiagDeleteValueCollectionDoc { -public: - CDiagDeleteValueCollectionDoc(); - virtual ~CDiagDeleteValueCollectionDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::deque deleteValueCollection); - -public: - /// Accessor for the DeleteValue - std::deque getDeleteValueCollection() const; - -private: - bool _isInitialized; - - std::deque _deleteValueCollection; - -private: - CAF_CM_DECLARE_NOCOPY(CDiagDeleteValueCollectionDoc); -}; - -CAF_DECLARE_SMART_POINTER(CDiagDeleteValueCollectionDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DiagTypesDoc/CDiagDeleteValueDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DiagTypesDoc/CDiagDeleteValueDoc.h deleted file mode 100644 index 85e203a47..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DiagTypesDoc/CDiagDeleteValueDoc.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CDiagDeleteValueDoc_h_ -#define CDiagDeleteValueDoc_h_ - -namespace Caf { - -/// A simple container for objects of type DiagDeleteValue -class DIAGTYPESDOC_LINKAGE CDiagDeleteValueDoc { -public: - CDiagDeleteValueDoc(); - virtual ~CDiagDeleteValueDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const UUID jobId, - const std::string fileAlias, - const std::string valueName); - -public: - /// Accessor for the JobId - UUID getJobId() const; - - /// Accessor for the FileAlias - std::string getFileAlias() const; - - /// Accessor for the ValueName - std::string getValueName() const; - -private: - UUID _jobId; - std::string _fileAlias; - std::string _valueName; - bool _isInitialized; - -private: - CAF_CM_DECLARE_NOCOPY(CDiagDeleteValueDoc); -}; - -CAF_DECLARE_SMART_POINTER(CDiagDeleteValueDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DiagTypesDoc/CDiagSetValueCollectionDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DiagTypesDoc/CDiagSetValueCollectionDoc.h deleted file mode 100644 index ca5505fce..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DiagTypesDoc/CDiagSetValueCollectionDoc.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CDiagSetValueCollectionDoc_h_ -#define CDiagSetValueCollectionDoc_h_ - - -#include "Doc/DiagTypesDoc/CDiagSetValueDoc.h" - -namespace Caf { - -/// A simple container for objects of type DiagSetValueCollection -class DIAGTYPESDOC_LINKAGE CDiagSetValueCollectionDoc { -public: - CDiagSetValueCollectionDoc(); - virtual ~CDiagSetValueCollectionDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::deque setValueCollection); - -public: - /// Accessor for the SetValue - std::deque getSetValueCollection() const; - -private: - bool _isInitialized; - - std::deque _setValueCollection; - -private: - CAF_CM_DECLARE_NOCOPY(CDiagSetValueCollectionDoc); -}; - -CAF_DECLARE_SMART_POINTER(CDiagSetValueCollectionDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DiagTypesDoc/CDiagSetValueDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DiagTypesDoc/CDiagSetValueDoc.h deleted file mode 100644 index f07f04a68..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DiagTypesDoc/CDiagSetValueDoc.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CDiagSetValueDoc_h_ -#define CDiagSetValueDoc_h_ - - -#include "Doc/CafCoreTypesDoc/CPropertyDoc.h" - -namespace Caf { - -/// A simple container for objects of type DiagSetValue -class DIAGTYPESDOC_LINKAGE CDiagSetValueDoc { -public: - CDiagSetValueDoc(); - virtual ~CDiagSetValueDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const UUID jobId, - const std::string fileAlias, - const SmartPtrCPropertyDoc value); - -public: - /// Accessor for the JobId - UUID getJobId() const; - - /// Accessor for the FileAlias - std::string getFileAlias() const; - - /// Accessor for the Value - SmartPtrCPropertyDoc getValue() const; - -private: - UUID _jobId; - std::string _fileAlias; - SmartPtrCPropertyDoc _value; - bool _isInitialized; - -private: - CAF_CM_DECLARE_NOCOPY(CDiagSetValueDoc); -}; - -CAF_DECLARE_SMART_POINTER(CDiagSetValueDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DiagTypesDoc/DiagTypesDocLink.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DiagTypesDoc/DiagTypesDocLink.h deleted file mode 100644 index 493768505..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DiagTypesDoc/DiagTypesDocLink.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Author: bwilliams - * Created: February 25, 2016 - * - * Copyright (C) 2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#ifndef DiagTypesDoc_Link_h_ -#define DiagTypesDoc_Link_h_ - -#ifndef DIAGTYPESDOC_LINKAGE - #ifdef WIN32 - #ifdef FRAMEWORK_BUILD - #define DIAGTYPESDOC_LINKAGE __declspec(dllexport) - #else - #define DIAGTYPESDOC_LINKAGE __declspec(dllimport) - #endif - #else - #define DIAGTYPESDOC_LINKAGE - #endif -#endif - - -#endif /* DiagTypesDoc_Link_h_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocUtils/EnumConvertersXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocUtils/EnumConvertersXml.h deleted file mode 100644 index af074631c..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocUtils/EnumConvertersXml.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#ifndef EnumConvertersXml_h_ -#define EnumConvertersXml_h_ - -#include "Doc/CafCoreTypesDoc/CafCoreTypesDocTypes.h" -#include "Doc/CafInstallRequestDoc/CafInstallRequestDocTypes.h" -#include "Doc/SchemaTypesDoc/SchemaTypesDocTypes.h" - -namespace Caf { - - namespace EnumConvertersXml { - /// Converts the parameter type to a string - std::string DOCUTILS_LINKAGE convertParameterTypeToString( - const PARAMETER_TYPE parameterType); - - /// Converts the string to a parameter type - PARAMETER_TYPE DOCUTILS_LINKAGE convertStringToParameterType( - const std::string parameterType); - - /// Converts the property type to a string - std::string DOCUTILS_LINKAGE convertPropertyTypeToString( - const PROPERTY_TYPE propertyType); - - /// Converts the string to a property type - PROPERTY_TYPE DOCUTILS_LINKAGE convertStringToPropertyType( - const std::string propertyType); - - /// Converts the validator type to a string - std::string DOCUTILS_LINKAGE convertValidatorTypeToString( - const VALIDATOR_TYPE validatorType); - - /// Converts the string to a validator type - VALIDATOR_TYPE DOCUTILS_LINKAGE convertStringToValidatorType( - const std::string validatorType); - - /// Converts the operator type to a string - std::string DOCUTILS_LINKAGE convertOperatorTypeToString( - const OPERATOR_TYPE operatorType); - - /// Converts the string to a operator type - OPERATOR_TYPE DOCUTILS_LINKAGE convertStringToOperatorType( - const std::string operatorType); - - /// Converts the arity type to a string - std::string DOCUTILS_LINKAGE convertArityTypeToString( - const ARITY_TYPE arityType); - - /// Converts the string to an arity type - ARITY_TYPE DOCUTILS_LINKAGE convertStringToArityType( - const std::string arityType); - - /// Converts the parameter type to a string - std::string DOCUTILS_LINKAGE convertPackageOSTypeToString( - const PACKAGE_OS_TYPE packageOSType); - - /// Converts the string to a parameter type - PACKAGE_OS_TYPE DOCUTILS_LINKAGE convertStringToPackageOSType( - const std::string packageOSType); - - /// Converts the logging level enum type to a string - std::string DOCUTILS_LINKAGE convertLoggingLevelTypeToString( - const LOGGINGLEVEL_TYPE loggingLevelType); - - /// Converts the string to a logging level enum - LOGGINGLEVEL_TYPE DOCUTILS_LINKAGE convertStringToLoggingLevelType( - const std::string loggingLevelType); - - /// Converts the logging component enum type to a string - std::string DOCUTILS_LINKAGE convertLoggingComponentTypeToString( - const LOGGINGCOMPONENT_TYPE loggingComponentType); - - /// Converts the string to a logging component enum type - LOGGINGCOMPONENT_TYPE DOCUTILS_LINKAGE convertStringToLoggingComponentType( - const std::string loggingComponentType); - - std::string DOCUTILS_LINKAGE convertCmsPolicyToString( - const CMS_POLICY cmsPolicy); - - CMS_POLICY DOCUTILS_LINKAGE convertStringToCmsPolicy( - const std::string cmsPolicy); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/AddInCollectionXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/AddInCollectionXml.h deleted file mode 100644 index 658f1eff5..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/AddInCollectionXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef AddInCollectionXml_h_ -#define AddInCollectionXml_h_ - - -#include "Doc/CafCoreTypesDoc/CAddInCollectionDoc.h" - -#include "Doc/DocXml/CafCoreTypesXml/CafCoreTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the AddInCollection class to/from XML - namespace AddInCollectionXml { - - /// Adds the AddInCollectionDoc into the XML. - void CAFCORETYPESXML_LINKAGE add( - const SmartPtrCAddInCollectionDoc addInCollectionDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the AddInCollectionDoc from the XML. - SmartPtrCAddInCollectionDoc CAFCORETYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/AddInsXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/AddInsXml.h deleted file mode 100644 index 675d46001..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/AddInsXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef AddInsXml_h_ -#define AddInsXml_h_ - - -#include "Doc/CafCoreTypesDoc/CAddInsDoc.h" - -#include "Doc/DocXml/CafCoreTypesXml/CafCoreTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the AddIns class to/from XML - namespace AddInsXml { - - /// Adds the AddInsDoc into the XML. - void CAFCORETYPESXML_LINKAGE add( - const SmartPtrCAddInsDoc addInsDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the AddInsDoc from the XML. - SmartPtrCAddInsDoc CAFCORETYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/AttachmentCollectionXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/AttachmentCollectionXml.h deleted file mode 100644 index 78ec3f967..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/AttachmentCollectionXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef AttachmentCollectionXml_h_ -#define AttachmentCollectionXml_h_ - - -#include "Doc/CafCoreTypesDoc/CAttachmentCollectionDoc.h" - -#include "Doc/DocXml/CafCoreTypesXml/CafCoreTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the AttachmentCollection class to/from XML - namespace AttachmentCollectionXml { - - /// Adds the AttachmentCollectionDoc into the XML. - void CAFCORETYPESXML_LINKAGE add( - const SmartPtrCAttachmentCollectionDoc attachmentCollectionDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the AttachmentCollectionDoc from the XML. - SmartPtrCAttachmentCollectionDoc CAFCORETYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/AttachmentNameCollectionXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/AttachmentNameCollectionXml.h deleted file mode 100644 index 479202dad..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/AttachmentNameCollectionXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef AttachmentNameCollectionXml_h_ -#define AttachmentNameCollectionXml_h_ - - -#include "Doc/CafCoreTypesDoc/CAttachmentNameCollectionDoc.h" - -#include "Doc/DocXml/CafCoreTypesXml/CafCoreTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the AttachmentNameCollection class to/from XML - namespace AttachmentNameCollectionXml { - - /// Adds the AttachmentNameCollectionDoc into the XML. - void CAFCORETYPESXML_LINKAGE add( - const SmartPtrCAttachmentNameCollectionDoc attachmentNameCollectionDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the AttachmentNameCollectionDoc from the XML. - SmartPtrCAttachmentNameCollectionDoc CAFCORETYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/AttachmentXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/AttachmentXml.h deleted file mode 100644 index eee7cf6fb..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/AttachmentXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef AttachmentXml_h_ -#define AttachmentXml_h_ - - -#include "Doc/CafCoreTypesDoc/CAttachmentDoc.h" - -#include "Doc/DocXml/CafCoreTypesXml/CafCoreTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the Attachment class to/from XML - namespace AttachmentXml { - - /// Adds the AttachmentDoc into the XML. - void CAFCORETYPESXML_LINKAGE add( - const SmartPtrCAttachmentDoc attachmentDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the AttachmentDoc from the XML. - SmartPtrCAttachmentDoc CAFCORETYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/AuthnAuthzCollectionXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/AuthnAuthzCollectionXml.h deleted file mode 100644 index b2369dfca..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/AuthnAuthzCollectionXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef AuthnAuthzCollectionXml_h_ -#define AuthnAuthzCollectionXml_h_ - - -#include "Doc/CafCoreTypesDoc/CAuthnAuthzCollectionDoc.h" - -#include "Doc/DocXml/CafCoreTypesXml/CafCoreTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the AuthnAuthzCollection class to/from XML - namespace AuthnAuthzCollectionXml { - - /// Adds the AuthnAuthzCollectionDoc into the XML. - void CAFCORETYPESXML_LINKAGE add( - const SmartPtrCAuthnAuthzCollectionDoc authnAuthzCollectionDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the AuthnAuthzCollectionDoc from the XML. - SmartPtrCAuthnAuthzCollectionDoc CAFCORETYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/AuthnAuthzXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/AuthnAuthzXml.h deleted file mode 100644 index 74fdf444e..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/AuthnAuthzXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef AuthnAuthzXml_h_ -#define AuthnAuthzXml_h_ - - -#include "Doc/CafCoreTypesDoc/CAuthnAuthzDoc.h" - -#include "Doc/DocXml/CafCoreTypesXml/CafCoreTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the AuthnAuthz class to/from XML - namespace AuthnAuthzXml { - - /// Adds the AuthnAuthzDoc into the XML. - void CAFCORETYPESXML_LINKAGE add( - const SmartPtrCAuthnAuthzDoc authnAuthzDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the AuthnAuthzDoc from the XML. - SmartPtrCAuthnAuthzDoc CAFCORETYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/CafCoreTypesXmlLink.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/CafCoreTypesXmlLink.h deleted file mode 100644 index d951566da..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/CafCoreTypesXmlLink.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef CafCoreTypesXml_Link_h_ -#define CafCoreTypesXml_Link_h_ - -#ifndef CAFCORETYPESXML_LINKAGE - #ifdef WIN32 - #ifdef FRAMEWORK_BUILD - #define CAFCORETYPESXML_LINKAGE __declspec(dllexport) - #else - #define CAFCORETYPESXML_LINKAGE __declspec(dllimport) - #endif - #else - #define CAFCORETYPESXML_LINKAGE - #endif -#endif - - -#endif /* CafCoreTypesXml_Link_h_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/ClassFiltersXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/ClassFiltersXml.h deleted file mode 100644 index 972e307d5..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/ClassFiltersXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef ClassFiltersXml_h_ -#define ClassFiltersXml_h_ - - -#include "Doc/CafCoreTypesDoc/CClassFiltersDoc.h" - -#include "Doc/DocXml/CafCoreTypesXml/CafCoreTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the ClassFilters class to/from XML - namespace ClassFiltersXml { - - /// Adds the ClassFiltersDoc into the XML. - void CAFCORETYPESXML_LINKAGE add( - const SmartPtrCClassFiltersDoc classFiltersDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the ClassFiltersDoc from the XML. - SmartPtrCClassFiltersDoc CAFCORETYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/ClassSpecifierXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/ClassSpecifierXml.h deleted file mode 100644 index 41d79fc85..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/ClassSpecifierXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef ClassSpecifierXml_h_ -#define ClassSpecifierXml_h_ - - -#include "Doc/CafCoreTypesDoc/CClassSpecifierDoc.h" - -#include "Doc/DocXml/CafCoreTypesXml/CafCoreTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the ClassSpecifier class to/from XML - namespace ClassSpecifierXml { - - /// Adds the ClassSpecifierDoc into the XML. - void CAFCORETYPESXML_LINKAGE add( - const SmartPtrCClassSpecifierDoc classSpecifierDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the ClassSpecifierDoc from the XML. - SmartPtrCClassSpecifierDoc CAFCORETYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/FullyQualifiedClassGroupXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/FullyQualifiedClassGroupXml.h deleted file mode 100644 index 665f68e26..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/FullyQualifiedClassGroupXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef FullyQualifiedClassGroupXml_h_ -#define FullyQualifiedClassGroupXml_h_ - - -#include "Doc/CafCoreTypesDoc/CFullyQualifiedClassGroupDoc.h" - -#include "Doc/DocXml/CafCoreTypesXml/CafCoreTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the FullyQualifiedClassGroup class to/from XML - namespace FullyQualifiedClassGroupXml { - - /// Adds the FullyQualifiedClassGroupDoc into the XML. - void CAFCORETYPESXML_LINKAGE add( - const SmartPtrCFullyQualifiedClassGroupDoc fullyQualifiedClassGroupDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the FullyQualifiedClassGroupDoc from the XML. - SmartPtrCFullyQualifiedClassGroupDoc CAFCORETYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/LoggingLevelCollectionXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/LoggingLevelCollectionXml.h deleted file mode 100644 index 72c663ced..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/LoggingLevelCollectionXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef LoggingLevelCollectionXml_h_ -#define LoggingLevelCollectionXml_h_ - - -#include "Doc/CafCoreTypesDoc/CLoggingLevelCollectionDoc.h" - -#include "Doc/DocXml/CafCoreTypesXml/CafCoreTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the LoggingLevelCollection class to/from XML - namespace LoggingLevelCollectionXml { - - /// Adds the LoggingLevelCollectionDoc into the XML. - void CAFCORETYPESXML_LINKAGE add( - const SmartPtrCLoggingLevelCollectionDoc loggingLevelCollectionDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the LoggingLevelCollectionDoc from the XML. - SmartPtrCLoggingLevelCollectionDoc CAFCORETYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/LoggingLevelElemXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/LoggingLevelElemXml.h deleted file mode 100644 index 03f982df8..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/LoggingLevelElemXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef LoggingLevelElemXml_h_ -#define LoggingLevelElemXml_h_ - - -#include "Doc/CafCoreTypesDoc/CLoggingLevelElemDoc.h" - -#include "Doc/DocXml/CafCoreTypesXml/CafCoreTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the LoggingLevelElem class to/from XML - namespace LoggingLevelElemXml { - - /// Adds the LoggingLevelElemDoc into the XML. - void CAFCORETYPESXML_LINKAGE add( - const SmartPtrCLoggingLevelElemDoc loggingLevelElemDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the LoggingLevelElemDoc from the XML. - SmartPtrCLoggingLevelElemDoc CAFCORETYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/OperationXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/OperationXml.h deleted file mode 100644 index 3b04d6f7f..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/OperationXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef OperationXml_h_ -#define OperationXml_h_ - - -#include "Doc/CafCoreTypesDoc/COperationDoc.h" - -#include "Doc/DocXml/CafCoreTypesXml/CafCoreTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the Operation class to/from XML - namespace OperationXml { - - /// Adds the OperationDoc into the XML. - void CAFCORETYPESXML_LINKAGE add( - const SmartPtrCOperationDoc operationDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the OperationDoc from the XML. - SmartPtrCOperationDoc CAFCORETYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/ParameterCollectionXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/ParameterCollectionXml.h deleted file mode 100644 index a9f7b6ceb..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/ParameterCollectionXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef ParameterCollectionXml_h_ -#define ParameterCollectionXml_h_ - - -#include "Doc/CafCoreTypesDoc/CParameterCollectionDoc.h" - -#include "Doc/DocXml/CafCoreTypesXml/CafCoreTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the ParameterCollection class to/from XML - namespace ParameterCollectionXml { - - /// Adds the ParameterCollectionDoc into the XML. - void CAFCORETYPESXML_LINKAGE add( - const SmartPtrCParameterCollectionDoc parameterCollectionDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the ParameterCollectionDoc from the XML. - SmartPtrCParameterCollectionDoc CAFCORETYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/PropertyCollectionXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/PropertyCollectionXml.h deleted file mode 100644 index 8e5e7b88c..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/PropertyCollectionXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef PropertyCollectionXml_h_ -#define PropertyCollectionXml_h_ - - -#include "Doc/CafCoreTypesDoc/CPropertyCollectionDoc.h" - -#include "Doc/DocXml/CafCoreTypesXml/CafCoreTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the PropertyCollection class to/from XML - namespace PropertyCollectionXml { - - /// Adds the PropertyCollectionDoc into the XML. - void CAFCORETYPESXML_LINKAGE add( - const SmartPtrCPropertyCollectionDoc propertyCollectionDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the PropertyCollectionDoc from the XML. - SmartPtrCPropertyCollectionDoc CAFCORETYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/PropertyXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/PropertyXml.h deleted file mode 100644 index 57858933c..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/PropertyXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef PropertyXml_h_ -#define PropertyXml_h_ - - -#include "Doc/CafCoreTypesDoc/CPropertyDoc.h" - -#include "Doc/DocXml/CafCoreTypesXml/CafCoreTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the Property class to/from XML - namespace PropertyXml { - - /// Adds the PropertyDoc into the XML. - void CAFCORETYPESXML_LINKAGE add( - const SmartPtrCPropertyDoc propertyDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the PropertyDoc from the XML. - SmartPtrCPropertyDoc CAFCORETYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/ProtocolCollectionXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/ProtocolCollectionXml.h deleted file mode 100644 index 8ea8782a6..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/ProtocolCollectionXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef ProtocolCollectionXml_h_ -#define ProtocolCollectionXml_h_ - - -#include "Doc/CafCoreTypesDoc/CProtocolCollectionDoc.h" - -#include "Doc/DocXml/CafCoreTypesXml/CafCoreTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the ProtocolCollection class to/from XML - namespace ProtocolCollectionXml { - - /// Adds the ProtocolCollectionDoc into the XML. - void CAFCORETYPESXML_LINKAGE add( - const SmartPtrCProtocolCollectionDoc protocolCollectionDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the ProtocolCollectionDoc from the XML. - SmartPtrCProtocolCollectionDoc CAFCORETYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/ProtocolXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/ProtocolXml.h deleted file mode 100644 index 45d345633..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/ProtocolXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef ProtocolXml_h_ -#define ProtocolXml_h_ - - -#include "Doc/CafCoreTypesDoc/CProtocolDoc.h" - -#include "Doc/DocXml/CafCoreTypesXml/CafCoreTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the Protocol class to/from XML - namespace ProtocolXml { - - /// Adds the ProtocolDoc into the XML. - void CAFCORETYPESXML_LINKAGE add( - const SmartPtrCProtocolDoc protocolDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the ProtocolDoc from the XML. - SmartPtrCProtocolDoc CAFCORETYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/RequestConfigXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/RequestConfigXml.h deleted file mode 100644 index 488d67b53..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/RequestConfigXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef RequestConfigXml_h_ -#define RequestConfigXml_h_ - - -#include "Doc/CafCoreTypesDoc/CRequestConfigDoc.h" - -#include "Doc/DocXml/CafCoreTypesXml/CafCoreTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the RequestConfig class to/from XML - namespace RequestConfigXml { - - /// Adds the RequestConfigDoc into the XML. - void CAFCORETYPESXML_LINKAGE add( - const SmartPtrCRequestConfigDoc requestConfigDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the RequestConfigDoc from the XML. - SmartPtrCRequestConfigDoc CAFCORETYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/RequestHeaderXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/RequestHeaderXml.h deleted file mode 100644 index b1abe884e..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/RequestHeaderXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef RequestHeaderXml_h_ -#define RequestHeaderXml_h_ - - -#include "Doc/CafCoreTypesDoc/CRequestHeaderDoc.h" - -#include "Doc/DocXml/CafCoreTypesXml/CafCoreTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the RequestHeader class to/from XML - namespace RequestHeaderXml { - - /// Adds the RequestHeaderDoc into the XML. - void CAFCORETYPESXML_LINKAGE add( - const SmartPtrCRequestHeaderDoc requestHeaderDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the RequestHeaderDoc from the XML. - SmartPtrCRequestHeaderDoc CAFCORETYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/RequestInstanceParameterXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/RequestInstanceParameterXml.h deleted file mode 100644 index 7aae4c5e4..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/RequestInstanceParameterXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef RequestInstanceParameterXml_h_ -#define RequestInstanceParameterXml_h_ - - -#include "Doc/CafCoreTypesDoc/CRequestInstanceParameterDoc.h" - -#include "Doc/DocXml/CafCoreTypesXml/CafCoreTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the RequestInstanceParameter class to/from XML - namespace RequestInstanceParameterXml { - - /// Adds the RequestInstanceParameterDoc into the XML. - void CAFCORETYPESXML_LINKAGE add( - const SmartPtrCRequestInstanceParameterDoc requestInstanceParameterDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the RequestInstanceParameterDoc from the XML. - SmartPtrCRequestInstanceParameterDoc CAFCORETYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/RequestParameterXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/RequestParameterXml.h deleted file mode 100644 index 240edcdce..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/RequestParameterXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef RequestParameterXml_h_ -#define RequestParameterXml_h_ - - -#include "Doc/CafCoreTypesDoc/CRequestParameterDoc.h" - -#include "Doc/DocXml/CafCoreTypesXml/CafCoreTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the RequestParameter class to/from XML - namespace RequestParameterXml { - - /// Adds the RequestParameterDoc into the XML. - void CAFCORETYPESXML_LINKAGE add( - const SmartPtrCRequestParameterDoc requestParameterDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the RequestParameterDoc from the XML. - SmartPtrCRequestParameterDoc CAFCORETYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/RequestXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/RequestXml.h deleted file mode 100644 index 2e18d7ce2..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/RequestXml.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Author: bwilliams - * Created: Nov 21, 2014 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#ifndef RequestXml_h_ -#define RequestXml_h_ - - -#include "Xml/XmlUtils/CXmlElement.h" - -#include "Doc/DocXml/CafCoreTypesXml/CafCoreTypesXmlLink.h" - -namespace Caf { - - namespace RequestXml { - - SmartPtrCXmlElement CAFCORETYPESXML_LINKAGE parseString( - const std::string& xml, - const std::string& rootName); - - SmartPtrCXmlElement CAFCORETYPESXML_LINKAGE parseFile( - const std::string& xml, - const std::string& rootName); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/StatisticsXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/StatisticsXml.h deleted file mode 100644 index f967ddf20..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafCoreTypesXml/StatisticsXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef StatisticsXml_h_ -#define StatisticsXml_h_ - - -#include "Doc/CafCoreTypesDoc/CStatisticsDoc.h" - -#include "Doc/DocXml/CafCoreTypesXml/CafCoreTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the Statistics class to/from XML - namespace StatisticsXml { - - /// Adds the StatisticsDoc into the XML. - void CAFCORETYPESXML_LINKAGE add( - const SmartPtrCStatisticsDoc statisticsDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the StatisticsDoc from the XML. - SmartPtrCStatisticsDoc CAFCORETYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafInstallRequestXml/CafInstallRequestXmlLink.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafInstallRequestXml/CafInstallRequestXmlLink.h deleted file mode 100644 index 18fb92511..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafInstallRequestXml/CafInstallRequestXmlLink.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef CafInstallRequestXml_Link_h_ -#define CafInstallRequestXml_Link_h_ - -#ifndef CAFINSTALLREQUESTXML_LINKAGE - #ifdef WIN32 - #ifdef FRAMEWORK_BUILD - #define CAFINSTALLREQUESTXML_LINKAGE __declspec(dllexport) - #else - #define CAFINSTALLREQUESTXML_LINKAGE __declspec(dllimport) - #endif - #else - #define CAFINSTALLREQUESTXML_LINKAGE - #endif -#endif - - -#endif /* CafInstallRequestXml_Link_h_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafInstallRequestXml/CafInstallRequestXmlRoots.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafInstallRequestXml/CafInstallRequestXmlRoots.h deleted file mode 100644 index 8ac1f5ad3..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafInstallRequestXml/CafInstallRequestXmlRoots.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef CafInstallRequestXmlRoots_h_ -#define CafInstallRequestXmlRoots_h_ - - -#include "Doc/CafInstallRequestDoc/CInstallPackageSpecDoc.h" - -#include "Doc/DocXml/CafInstallRequestXml/CafInstallRequestXmlLink.h" -#include "Doc/CafInstallRequestDoc/CInstallProviderSpecDoc.h" -#include "Doc/CafInstallRequestDoc/CInstallRequestDoc.h" - -namespace Caf { - - namespace XmlRoots { - - /// Saves the InstallRequestDoc to a string. - std::string CAFINSTALLREQUESTXML_LINKAGE saveInstallRequestToString( - const SmartPtrCInstallRequestDoc installRequestDoc); - - /// Parses the InstallPackageSpecDoc from the string. - SmartPtrCInstallRequestDoc CAFINSTALLREQUESTXML_LINKAGE parseInstallRequestFromString( - const std::string xml); - - /// Saves the InstallRequestDoc to a file. - void CAFINSTALLREQUESTXML_LINKAGE saveInstallRequestToFile( - const SmartPtrCInstallRequestDoc installRequestDoc, - const std::string filePath); - - /// Parses the InstallPackageSpecDoc from the file. - SmartPtrCInstallRequestDoc CAFINSTALLREQUESTXML_LINKAGE parseInstallRequestFromFile( - const std::string filePath); - - /// Saves the InstallProviderSpecDoc to a string. - std::string CAFINSTALLREQUESTXML_LINKAGE saveInstallProviderSpecToString( - const SmartPtrCInstallProviderSpecDoc installProviderSpecDoc); - - /// Parses the InstallPackageSpecDoc from the string. - SmartPtrCInstallProviderSpecDoc CAFINSTALLREQUESTXML_LINKAGE parseInstallProviderSpecFromString( - const std::string xml); - - /// Saves the InstallProviderSpecDoc to a file. - void CAFINSTALLREQUESTXML_LINKAGE saveInstallProviderSpecToFile( - const SmartPtrCInstallProviderSpecDoc installProviderSpecDoc, - const std::string filePath); - - /// Parses the InstallPackageSpecDoc from the file. - SmartPtrCInstallProviderSpecDoc CAFINSTALLREQUESTXML_LINKAGE parseInstallProviderSpecFromFile( - const std::string filePath); - - /// Saves the InstallPackageSpecDoc to a string. - std::string CAFINSTALLREQUESTXML_LINKAGE saveInstallPackageSpecToString( - const SmartPtrCInstallPackageSpecDoc installPackageSpecDoc); - - /// Parses the InstallPackageSpecDoc from the string. - SmartPtrCInstallPackageSpecDoc CAFINSTALLREQUESTXML_LINKAGE parseInstallPackageSpecFromString( - const std::string xml); - - /// Saves the InstallPackageSpecDoc to a file. - void CAFINSTALLREQUESTXML_LINKAGE saveInstallPackageSpecToFile( - const SmartPtrCInstallPackageSpecDoc installPackageSpecDoc, - const std::string filePath); - - /// Parses the InstallPackageSpecDoc from the file. - SmartPtrCInstallPackageSpecDoc CAFINSTALLREQUESTXML_LINKAGE parseInstallPackageSpecFromFile( - const std::string filePath); - } -} - -#endif /* CafInstallRequestXmlRoots_h_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafInstallRequestXml/FullPackageElemXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafInstallRequestXml/FullPackageElemXml.h deleted file mode 100644 index ce50f3b1c..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafInstallRequestXml/FullPackageElemXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef FullPackageElemXml_h_ -#define FullPackageElemXml_h_ - - -#include "Doc/CafInstallRequestDoc/CFullPackageElemDoc.h" - -#include "Doc/DocXml/CafInstallRequestXml/CafInstallRequestXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the FullPackageElem class to/from XML - namespace FullPackageElemXml { - - /// Adds the FullPackageElemDoc into the XML. - void CAFINSTALLREQUESTXML_LINKAGE add( - const SmartPtrCFullPackageElemDoc fullPackageElemDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the FullPackageElemDoc from the XML. - SmartPtrCFullPackageElemDoc CAFINSTALLREQUESTXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafInstallRequestXml/GetInventoryJobXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafInstallRequestXml/GetInventoryJobXml.h deleted file mode 100644 index 9b5858de2..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafInstallRequestXml/GetInventoryJobXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef GetInventoryJobXml_h_ -#define GetInventoryJobXml_h_ - - -#include "Doc/CafInstallRequestDoc/CGetInventoryJobDoc.h" - -#include "Doc/DocXml/CafInstallRequestXml/CafInstallRequestXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the GetInventoryJob class to/from XML - namespace GetInventoryJobXml { - - /// Adds the GetInventoryJobDoc into the XML. - void CAFINSTALLREQUESTXML_LINKAGE add( - const SmartPtrCGetInventoryJobDoc getInventoryJobDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the GetInventoryJobDoc from the XML. - SmartPtrCGetInventoryJobDoc CAFINSTALLREQUESTXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafInstallRequestXml/InstallBatchXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafInstallRequestXml/InstallBatchXml.h deleted file mode 100644 index 179781b66..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafInstallRequestXml/InstallBatchXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef InstallBatchXml_h_ -#define InstallBatchXml_h_ - - -#include "Doc/CafInstallRequestDoc/CInstallBatchDoc.h" - -#include "Doc/DocXml/CafInstallRequestXml/CafInstallRequestXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the InstallBatch class to/from XML - namespace InstallBatchXml { - - /// Adds the InstallBatchDoc into the XML. - void CAFINSTALLREQUESTXML_LINKAGE add( - const SmartPtrCInstallBatchDoc installBatchDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the InstallBatchDoc from the XML. - SmartPtrCInstallBatchDoc CAFINSTALLREQUESTXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafInstallRequestXml/InstallPackageSpecXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafInstallRequestXml/InstallPackageSpecXml.h deleted file mode 100644 index cebc2b4d7..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafInstallRequestXml/InstallPackageSpecXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef InstallPackageSpecXml_h_ -#define InstallPackageSpecXml_h_ - - -#include "Doc/CafInstallRequestDoc/CInstallPackageSpecDoc.h" - -#include "Doc/DocXml/CafInstallRequestXml/CafInstallRequestXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the InstallPackageSpec class to/from XML - namespace InstallPackageSpecXml { - - /// Adds the InstallPackageSpecDoc into the XML. - void CAFINSTALLREQUESTXML_LINKAGE add( - const SmartPtrCInstallPackageSpecDoc installPackageSpecDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the InstallPackageSpecDoc from the XML. - SmartPtrCInstallPackageSpecDoc CAFINSTALLREQUESTXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafInstallRequestXml/InstallProviderJobXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafInstallRequestXml/InstallProviderJobXml.h deleted file mode 100644 index 89d88b445..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafInstallRequestXml/InstallProviderJobXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef InstallProviderJobXml_h_ -#define InstallProviderJobXml_h_ - - -#include "Doc/CafInstallRequestDoc/CInstallProviderJobDoc.h" - -#include "Doc/DocXml/CafInstallRequestXml/CafInstallRequestXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the InstallProviderJob class to/from XML - namespace InstallProviderJobXml { - - /// Adds the InstallProviderJobDoc into the XML. - void CAFINSTALLREQUESTXML_LINKAGE add( - const SmartPtrCInstallProviderJobDoc installProviderJobDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the InstallProviderJobDoc from the XML. - SmartPtrCInstallProviderJobDoc CAFINSTALLREQUESTXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafInstallRequestXml/InstallProviderSpecXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafInstallRequestXml/InstallProviderSpecXml.h deleted file mode 100644 index 88bd6841a..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafInstallRequestXml/InstallProviderSpecXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef InstallProviderSpecXml_h_ -#define InstallProviderSpecXml_h_ - - -#include "Doc/CafInstallRequestDoc/CInstallProviderSpecDoc.h" - -#include "Doc/DocXml/CafInstallRequestXml/CafInstallRequestXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the InstallProviderSpec class to/from XML - namespace InstallProviderSpecXml { - - /// Adds the InstallProviderSpecDoc into the XML. - void CAFINSTALLREQUESTXML_LINKAGE add( - const SmartPtrCInstallProviderSpecDoc installProviderSpecDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the InstallProviderSpecDoc from the XML. - SmartPtrCInstallProviderSpecDoc CAFINSTALLREQUESTXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafInstallRequestXml/InstallRequestXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafInstallRequestXml/InstallRequestXml.h deleted file mode 100644 index 6f1e8a110..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafInstallRequestXml/InstallRequestXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef InstallRequestXml_h_ -#define InstallRequestXml_h_ - - -#include "Doc/CafInstallRequestDoc/CInstallRequestDoc.h" - -#include "Doc/DocXml/CafInstallRequestXml/CafInstallRequestXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the InstallRequest class to/from XML - namespace InstallRequestXml { - - /// Adds the InstallRequestDoc into the XML. - void CAFINSTALLREQUESTXML_LINKAGE add( - const SmartPtrCInstallRequestDoc installRequestDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the InstallRequestDoc from the XML. - SmartPtrCInstallRequestDoc CAFINSTALLREQUESTXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafInstallRequestXml/MinPackageElemXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafInstallRequestXml/MinPackageElemXml.h deleted file mode 100644 index 77883d97c..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafInstallRequestXml/MinPackageElemXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef MinPackageElemXml_h_ -#define MinPackageElemXml_h_ - - -#include "Doc/CafInstallRequestDoc/CMinPackageElemDoc.h" - -#include "Doc/DocXml/CafInstallRequestXml/CafInstallRequestXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the MinPackageElem class to/from XML - namespace MinPackageElemXml { - - /// Adds the MinPackageElemDoc into the XML. - void CAFINSTALLREQUESTXML_LINKAGE add( - const SmartPtrCMinPackageElemDoc minPackageElemDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the MinPackageElemDoc from the XML. - SmartPtrCMinPackageElemDoc CAFINSTALLREQUESTXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafInstallRequestXml/PackageDefnXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafInstallRequestXml/PackageDefnXml.h deleted file mode 100644 index 4e0a39769..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafInstallRequestXml/PackageDefnXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef PackageDefnXml_h_ -#define PackageDefnXml_h_ - - -#include "Doc/CafInstallRequestDoc/CPackageDefnDoc.h" - -#include "Doc/DocXml/CafInstallRequestXml/CafInstallRequestXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the PackageDefn class to/from XML - namespace PackageDefnXml { - - /// Adds the PackageDefnDoc into the XML. - void CAFINSTALLREQUESTXML_LINKAGE add( - const SmartPtrCPackageDefnDoc packageDefnDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the PackageDefnDoc from the XML. - SmartPtrCPackageDefnDoc CAFINSTALLREQUESTXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafInstallRequestXml/UninstallProviderJobXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafInstallRequestXml/UninstallProviderJobXml.h deleted file mode 100644 index afd958eee..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/CafInstallRequestXml/UninstallProviderJobXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef UninstallProviderJobXml_h_ -#define UninstallProviderJobXml_h_ - - -#include "Doc/CafInstallRequestDoc/CUninstallProviderJobDoc.h" - -#include "Doc/DocXml/CafInstallRequestXml/CafInstallRequestXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the UninstallProviderJob class to/from XML - namespace UninstallProviderJobXml { - - /// Adds the UninstallProviderJobDoc into the XML. - void CAFINSTALLREQUESTXML_LINKAGE add( - const SmartPtrCUninstallProviderJobDoc uninstallProviderJobDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the UninstallProviderJobDoc from the XML. - SmartPtrCUninstallProviderJobDoc CAFINSTALLREQUESTXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/DiagRequestXml/DiagRequestXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/DiagRequestXml/DiagRequestXml.h deleted file mode 100644 index 84625b486..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/DiagRequestXml/DiagRequestXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef DiagRequestXml_h_ -#define DiagRequestXml_h_ - - -#include "Doc/DiagRequestDoc/CDiagRequestDoc.h" - -#include "Doc/DocXml/DiagRequestXml/DiagRequestXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the DiagRequest class to/from XML - namespace DiagRequestXml { - - /// Adds the DiagRequestDoc into the XML. - void DIAGREQUESTXML_LINKAGE add( - const SmartPtrCDiagRequestDoc diagRequestDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the DiagRequestDoc from the XML. - SmartPtrCDiagRequestDoc DIAGREQUESTXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/DiagRequestXml/DiagRequestXmlLink.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/DiagRequestXml/DiagRequestXmlLink.h deleted file mode 100644 index f73050c95..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/DiagRequestXml/DiagRequestXmlLink.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef DiagRequestXml_Link_h_ -#define DiagRequestXml_Link_h_ - -#ifndef DIAGREQUESTXML_LINKAGE - #ifdef WIN32 - #ifdef FRAMEWORK_BUILD - #define DIAGREQUESTXML_LINKAGE __declspec(dllexport) - #else - #define DIAGREQUESTXML_LINKAGE __declspec(dllimport) - #endif - #else - #define DIAGREQUESTXML_LINKAGE - #endif -#endif - - -#endif /* DiagRequestXml_Link_h_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/DiagRequestXml/DiagRequestXmlRoots.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/DiagRequestXml/DiagRequestXmlRoots.h deleted file mode 100644 index 4ddc782d4..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/DiagRequestXml/DiagRequestXmlRoots.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef DiagRequestXmlRoots_h_ -#define DiagRequestXmlRoots_h_ - - -#include "Doc/DiagRequestDoc/CDiagRequestDoc.h" - -#include "Doc/DocXml/DiagRequestXml/DiagRequestXmlLink.h" - -namespace Caf { - - namespace XmlRoots { - - /// Saves the DiagRequestDoc to a string. - std::string DIAGREQUESTXML_LINKAGE saveDiagRequestToString( - const SmartPtrCDiagRequestDoc diagRequestDoc); - - /// Parses the DiagRequestDoc from the string. - SmartPtrCDiagRequestDoc DIAGREQUESTXML_LINKAGE parseDiagRequestFromString( - const std::string xml); - - /// Saves the DiagRequestDoc to a file. - void DIAGREQUESTXML_LINKAGE saveDiagRequestToFile( - const SmartPtrCDiagRequestDoc diagRequestDoc, - const std::string filePath); - - /// Parses the DiagRequestDoc from the file. - SmartPtrCDiagRequestDoc DIAGREQUESTXML_LINKAGE parseDiagRequestFromFile( - const std::string filePath); - } -} - -#endif /* DiagRequestXmlRoots_h_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/DiagTypesXml/DiagBatchXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/DiagTypesXml/DiagBatchXml.h deleted file mode 100644 index d12a9bad8..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/DiagTypesXml/DiagBatchXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef DiagBatchXml_h_ -#define DiagBatchXml_h_ - - -#include "Doc/DiagTypesDoc/CDiagBatchDoc.h" - -#include "Doc/DocXml/DiagTypesXml/DiagTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the DiagBatch class to/from XML - namespace DiagBatchXml { - - /// Adds the DiagBatchDoc into the XML. - void DIAGTYPESXML_LINKAGE add( - const SmartPtrCDiagBatchDoc diagBatchDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the DiagBatchDoc from the XML. - SmartPtrCDiagBatchDoc DIAGTYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/DiagTypesXml/DiagCollectInstancesXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/DiagTypesXml/DiagCollectInstancesXml.h deleted file mode 100644 index 97430bab8..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/DiagTypesXml/DiagCollectInstancesXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef DiagCollectInstancesXml_h_ -#define DiagCollectInstancesXml_h_ - - -#include "Doc/DiagTypesDoc/CDiagCollectInstancesDoc.h" - -#include "Doc/DocXml/DiagTypesXml/DiagTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the DiagCollectInstances class to/from XML - namespace DiagCollectInstancesXml { - - /// Adds the DiagCollectInstancesDoc into the XML. - void DIAGTYPESXML_LINKAGE add( - const SmartPtrCDiagCollectInstancesDoc diagCollectInstancesDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the DiagCollectInstancesDoc from the XML. - SmartPtrCDiagCollectInstancesDoc DIAGTYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/DiagTypesXml/DiagDeleteValueCollectionXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/DiagTypesXml/DiagDeleteValueCollectionXml.h deleted file mode 100644 index 0835538b0..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/DiagTypesXml/DiagDeleteValueCollectionXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef DiagDeleteValueCollectionXml_h_ -#define DiagDeleteValueCollectionXml_h_ - - -#include "Doc/DiagTypesDoc/CDiagDeleteValueCollectionDoc.h" - -#include "Doc/DocXml/DiagTypesXml/DiagTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the DiagDeleteValueCollection class to/from XML - namespace DiagDeleteValueCollectionXml { - - /// Adds the DiagDeleteValueCollectionDoc into the XML. - void DIAGTYPESXML_LINKAGE add( - const SmartPtrCDiagDeleteValueCollectionDoc diagDeleteValueCollectionDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the DiagDeleteValueCollectionDoc from the XML. - SmartPtrCDiagDeleteValueCollectionDoc DIAGTYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/DiagTypesXml/DiagDeleteValueXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/DiagTypesXml/DiagDeleteValueXml.h deleted file mode 100644 index 732387e81..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/DiagTypesXml/DiagDeleteValueXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef DiagDeleteValueXml_h_ -#define DiagDeleteValueXml_h_ - - -#include "Doc/DiagTypesDoc/CDiagDeleteValueDoc.h" - -#include "Doc/DocXml/DiagTypesXml/DiagTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the DiagDeleteValue class to/from XML - namespace DiagDeleteValueXml { - - /// Adds the DiagDeleteValueDoc into the XML. - void DIAGTYPESXML_LINKAGE add( - const SmartPtrCDiagDeleteValueDoc diagDeleteValueDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the DiagDeleteValueDoc from the XML. - SmartPtrCDiagDeleteValueDoc DIAGTYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/DiagTypesXml/DiagSetValueCollectionXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/DiagTypesXml/DiagSetValueCollectionXml.h deleted file mode 100644 index 5564b77ea..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/DiagTypesXml/DiagSetValueCollectionXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef DiagSetValueCollectionXml_h_ -#define DiagSetValueCollectionXml_h_ - - -#include "Doc/DiagTypesDoc/CDiagSetValueCollectionDoc.h" - -#include "Doc/DocXml/DiagTypesXml/DiagTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the DiagSetValueCollection class to/from XML - namespace DiagSetValueCollectionXml { - - /// Adds the DiagSetValueCollectionDoc into the XML. - void DIAGTYPESXML_LINKAGE add( - const SmartPtrCDiagSetValueCollectionDoc diagSetValueCollectionDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the DiagSetValueCollectionDoc from the XML. - SmartPtrCDiagSetValueCollectionDoc DIAGTYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/DiagTypesXml/DiagSetValueXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/DiagTypesXml/DiagSetValueXml.h deleted file mode 100644 index 083ca98f7..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/DiagTypesXml/DiagSetValueXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef DiagSetValueXml_h_ -#define DiagSetValueXml_h_ - - -#include "Doc/DiagTypesDoc/CDiagSetValueDoc.h" - -#include "Doc/DocXml/DiagTypesXml/DiagTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the DiagSetValue class to/from XML - namespace DiagSetValueXml { - - /// Adds the DiagSetValueDoc into the XML. - void DIAGTYPESXML_LINKAGE add( - const SmartPtrCDiagSetValueDoc diagSetValueDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the DiagSetValueDoc from the XML. - SmartPtrCDiagSetValueDoc DIAGTYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/DiagTypesXml/DiagTypesXmlLink.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/DiagTypesXml/DiagTypesXmlLink.h deleted file mode 100644 index aa379d22e..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/DiagTypesXml/DiagTypesXmlLink.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef DiagTypesXml_Link_h_ -#define DiagTypesXml_Link_h_ - -#ifndef DIAGTYPESXML_LINKAGE - #ifdef WIN32 - #ifdef FRAMEWORK_BUILD - #define DIAGTYPESXML_LINKAGE __declspec(dllexport) - #else - #define DIAGTYPESXML_LINKAGE __declspec(dllimport) - #endif - #else - #define DIAGTYPESXML_LINKAGE - #endif -#endif - - -#endif /* DiagTypesXml_Link_h_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/MgmtRequestXml/MgmtRequestXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/MgmtRequestXml/MgmtRequestXml.h deleted file mode 100644 index 73743490c..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/MgmtRequestXml/MgmtRequestXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef MgmtRequestXml_h_ -#define MgmtRequestXml_h_ - - -#include "Doc/MgmtRequestDoc/CMgmtRequestDoc.h" - -#include "Doc/DocXml/MgmtRequestXml/MgmtRequestXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the MgmtRequest class to/from XML - namespace MgmtRequestXml { - - /// Adds the MgmtRequestDoc into the XML. - void MGMTREQUESTXML_LINKAGE add( - const SmartPtrCMgmtRequestDoc mgmtRequestDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the MgmtRequestDoc from the XML. - SmartPtrCMgmtRequestDoc MGMTREQUESTXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/MgmtRequestXml/MgmtRequestXmlLink.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/MgmtRequestXml/MgmtRequestXmlLink.h deleted file mode 100644 index 36a725b32..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/MgmtRequestXml/MgmtRequestXmlLink.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef MgmtRequestXml_Link_h_ -#define MgmtRequestXml_Link_h_ - -#ifndef MGMTREQUESTXML_LINKAGE - #ifdef WIN32 - #ifdef FRAMEWORK_BUILD - #define MGMTREQUESTXML_LINKAGE __declspec(dllexport) - #else - #define MGMTREQUESTXML_LINKAGE __declspec(dllimport) - #endif - #else - #define MGMTREQUESTXML_LINKAGE - #endif -#endif - - -#endif /* MgmtRequestXml_Link_h_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/MgmtRequestXml/MgmtRequestXmlRoots.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/MgmtRequestXml/MgmtRequestXmlRoots.h deleted file mode 100644 index 43b5d2906..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/MgmtRequestXml/MgmtRequestXmlRoots.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef MgmtRequestXmlRoots_h_ -#define MgmtRequestXmlRoots_h_ - - -#include "Doc/MgmtRequestDoc/CMgmtRequestDoc.h" - -#include "Doc/DocXml/MgmtRequestXml/MgmtRequestXmlLink.h" - -namespace Caf { - - namespace XmlRoots { - - /// Saves the MgmtRequestDoc to a string. - std::string MGMTREQUESTXML_LINKAGE saveMgmtRequestToString( - const SmartPtrCMgmtRequestDoc mgmtRequestDoc); - - /// Parses the MgmtRequestDoc from the string. - SmartPtrCMgmtRequestDoc MGMTREQUESTXML_LINKAGE parseMgmtRequestFromString( - const std::string xml); - - /// Saves the MgmtRequestDoc to a file. - void MGMTREQUESTXML_LINKAGE saveMgmtRequestToFile( - const SmartPtrCMgmtRequestDoc mgmtRequestDoc, - const std::string filePath); - - /// Parses the MgmtRequestDoc from the file. - SmartPtrCMgmtRequestDoc MGMTREQUESTXML_LINKAGE parseMgmtRequestFromFile( - const std::string filePath); - } -} - -#endif /* MgmtRequestXmlRoots_h_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/MgmtTypesXml/MgmtBatchXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/MgmtTypesXml/MgmtBatchXml.h deleted file mode 100644 index c769982ec..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/MgmtTypesXml/MgmtBatchXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef MgmtBatchXml_h_ -#define MgmtBatchXml_h_ - - -#include "Doc/MgmtTypesDoc/CMgmtBatchDoc.h" - -#include "Doc/DocXml/MgmtTypesXml/MgmtTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the MgmtBatch class to/from XML - namespace MgmtBatchXml { - - /// Adds the MgmtBatchDoc into the XML. - void MGMTTYPESXML_LINKAGE add( - const SmartPtrCMgmtBatchDoc mgmtBatchDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the MgmtBatchDoc from the XML. - SmartPtrCMgmtBatchDoc MGMTTYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/MgmtTypesXml/MgmtCollectInstancesCollectionXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/MgmtTypesXml/MgmtCollectInstancesCollectionXml.h deleted file mode 100644 index f73d59ef9..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/MgmtTypesXml/MgmtCollectInstancesCollectionXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef MgmtCollectInstancesCollectionXml_h_ -#define MgmtCollectInstancesCollectionXml_h_ - - -#include "Doc/MgmtTypesDoc/CMgmtCollectInstancesCollectionDoc.h" - -#include "Doc/DocXml/MgmtTypesXml/MgmtTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the MgmtCollectInstancesCollection class to/from XML - namespace MgmtCollectInstancesCollectionXml { - - /// Adds the MgmtCollectInstancesCollectionDoc into the XML. - void MGMTTYPESXML_LINKAGE add( - const SmartPtrCMgmtCollectInstancesCollectionDoc mgmtCollectInstancesCollectionDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the MgmtCollectInstancesCollectionDoc from the XML. - SmartPtrCMgmtCollectInstancesCollectionDoc MGMTTYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/MgmtTypesXml/MgmtCollectInstancesXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/MgmtTypesXml/MgmtCollectInstancesXml.h deleted file mode 100644 index 550b6c3f5..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/MgmtTypesXml/MgmtCollectInstancesXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef MgmtCollectInstancesXml_h_ -#define MgmtCollectInstancesXml_h_ - - -#include "Doc/MgmtTypesDoc/CMgmtCollectInstancesDoc.h" - -#include "Doc/DocXml/MgmtTypesXml/MgmtTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the MgmtCollectInstances class to/from XML - namespace MgmtCollectInstancesXml { - - /// Adds the MgmtCollectInstancesDoc into the XML. - void MGMTTYPESXML_LINKAGE add( - const SmartPtrCMgmtCollectInstancesDoc mgmtCollectInstancesDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the MgmtCollectInstancesDoc from the XML. - SmartPtrCMgmtCollectInstancesDoc MGMTTYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/MgmtTypesXml/MgmtCollectSchemaXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/MgmtTypesXml/MgmtCollectSchemaXml.h deleted file mode 100644 index 264b9c3f2..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/MgmtTypesXml/MgmtCollectSchemaXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef MgmtCollectSchemaXml_h_ -#define MgmtCollectSchemaXml_h_ - - -#include "Doc/MgmtTypesDoc/CMgmtCollectSchemaDoc.h" - -#include "Doc/DocXml/MgmtTypesXml/MgmtTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the MgmtCollectSchema class to/from XML - namespace MgmtCollectSchemaXml { - - /// Adds the MgmtCollectSchemaDoc into the XML. - void MGMTTYPESXML_LINKAGE add( - const SmartPtrCMgmtCollectSchemaDoc mgmtCollectSchemaDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the MgmtCollectSchemaDoc from the XML. - SmartPtrCMgmtCollectSchemaDoc MGMTTYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/MgmtTypesXml/MgmtInvokeOperationCollectionXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/MgmtTypesXml/MgmtInvokeOperationCollectionXml.h deleted file mode 100644 index 617b5006e..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/MgmtTypesXml/MgmtInvokeOperationCollectionXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef MgmtInvokeOperationCollectionXml_h_ -#define MgmtInvokeOperationCollectionXml_h_ - - -#include "Doc/MgmtTypesDoc/CMgmtInvokeOperationCollectionDoc.h" - -#include "Doc/DocXml/MgmtTypesXml/MgmtTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the MgmtInvokeOperationCollection class to/from XML - namespace MgmtInvokeOperationCollectionXml { - - /// Adds the MgmtInvokeOperationCollectionDoc into the XML. - void MGMTTYPESXML_LINKAGE add( - const SmartPtrCMgmtInvokeOperationCollectionDoc mgmtInvokeOperationCollectionDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the MgmtInvokeOperationCollectionDoc from the XML. - SmartPtrCMgmtInvokeOperationCollectionDoc MGMTTYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/MgmtTypesXml/MgmtInvokeOperationXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/MgmtTypesXml/MgmtInvokeOperationXml.h deleted file mode 100644 index 6bc1dd171..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/MgmtTypesXml/MgmtInvokeOperationXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef MgmtInvokeOperationXml_h_ -#define MgmtInvokeOperationXml_h_ - - -#include "Doc/MgmtTypesDoc/CMgmtInvokeOperationDoc.h" - -#include "Doc/DocXml/MgmtTypesXml/MgmtTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the MgmtInvokeOperation class to/from XML - namespace MgmtInvokeOperationXml { - - /// Adds the MgmtInvokeOperationDoc into the XML. - void MGMTTYPESXML_LINKAGE add( - const SmartPtrCMgmtInvokeOperationDoc mgmtInvokeOperationDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the MgmtInvokeOperationDoc from the XML. - SmartPtrCMgmtInvokeOperationDoc MGMTTYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/MgmtTypesXml/MgmtTypesXmlLink.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/MgmtTypesXml/MgmtTypesXmlLink.h deleted file mode 100644 index d71e69f3a..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/MgmtTypesXml/MgmtTypesXmlLink.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef MgmtTypesXml_Link_h_ -#define MgmtTypesXml_Link_h_ - -#ifndef MGMTTYPESXML_LINKAGE - #ifdef WIN32 - #ifdef FRAMEWORK_BUILD - #define MGMTTYPESXML_LINKAGE __declspec(dllexport) - #else - #define MGMTTYPESXML_LINKAGE __declspec(dllimport) - #endif - #else - #define MGMTTYPESXML_LINKAGE - #endif -#endif - - -#endif /* MgmtTypesXml_Link_h_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/MultiPmeMgmtRequestXml/MultiPmeMgmtBatchCollectionXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/MultiPmeMgmtRequestXml/MultiPmeMgmtBatchCollectionXml.h deleted file mode 100644 index 40e0fb211..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/MultiPmeMgmtRequestXml/MultiPmeMgmtBatchCollectionXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef MultiPmeMgmtBatchCollectionXml_h_ -#define MultiPmeMgmtBatchCollectionXml_h_ - - -#include "Doc/MultiPmeMgmtRequestDoc/CMultiPmeMgmtBatchCollectionDoc.h" - -#include "Doc/DocXml/MultiPmeMgmtRequestXml/MultiPmeMgmtRequestXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the MultiPmeMgmtBatchCollection class to/from XML - namespace MultiPmeMgmtBatchCollectionXml { - - /// Adds the MultiPmeMgmtBatchCollectionDoc into the XML. - void MULTIPMEMGMTREQUESTXML_LINKAGE add( - const SmartPtrCMultiPmeMgmtBatchCollectionDoc multiPmeMgmtBatchCollectionDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the MultiPmeMgmtBatchCollectionDoc from the XML. - SmartPtrCMultiPmeMgmtBatchCollectionDoc MULTIPMEMGMTREQUESTXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/MultiPmeMgmtRequestXml/MultiPmeMgmtBatchXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/MultiPmeMgmtRequestXml/MultiPmeMgmtBatchXml.h deleted file mode 100644 index e50e4f441..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/MultiPmeMgmtRequestXml/MultiPmeMgmtBatchXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef MultiPmeMgmtBatchXml_h_ -#define MultiPmeMgmtBatchXml_h_ - - -#include "Doc/MultiPmeMgmtRequestDoc/CMultiPmeMgmtBatchDoc.h" - -#include "Doc/DocXml/MultiPmeMgmtRequestXml/MultiPmeMgmtRequestXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the MultiPmeMgmtBatch class to/from XML - namespace MultiPmeMgmtBatchXml { - - /// Adds the MultiPmeMgmtBatchDoc into the XML. - void MULTIPMEMGMTREQUESTXML_LINKAGE add( - const SmartPtrCMultiPmeMgmtBatchDoc multiPmeMgmtBatchDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the MultiPmeMgmtBatchDoc from the XML. - SmartPtrCMultiPmeMgmtBatchDoc MULTIPMEMGMTREQUESTXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/MultiPmeMgmtRequestXml/MultiPmeMgmtRequestXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/MultiPmeMgmtRequestXml/MultiPmeMgmtRequestXml.h deleted file mode 100644 index 4743b050b..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/MultiPmeMgmtRequestXml/MultiPmeMgmtRequestXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef MultiPmeMgmtRequestXml_h_ -#define MultiPmeMgmtRequestXml_h_ - - -#include "Doc/MultiPmeMgmtRequestDoc/CMultiPmeMgmtRequestDoc.h" - -#include "Doc/DocXml/MultiPmeMgmtRequestXml/MultiPmeMgmtRequestXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the MultiPmeMgmtRequest class to/from XML - namespace MultiPmeMgmtRequestXml { - - /// Adds the MultiPmeMgmtRequestDoc into the XML. - void MULTIPMEMGMTREQUESTXML_LINKAGE add( - const SmartPtrCMultiPmeMgmtRequestDoc multiPmeMgmtRequestDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the MultiPmeMgmtRequestDoc from the XML. - SmartPtrCMultiPmeMgmtRequestDoc MULTIPMEMGMTREQUESTXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/MultiPmeMgmtRequestXml/MultiPmeMgmtRequestXmlLink.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/MultiPmeMgmtRequestXml/MultiPmeMgmtRequestXmlLink.h deleted file mode 100644 index 33c5754dc..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/MultiPmeMgmtRequestXml/MultiPmeMgmtRequestXmlLink.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef MultiPmeMgmtRequestXml_Link_h_ -#define MultiPmeMgmtRequestXml_Link_h_ - -#ifndef MULTIPMEMGMTREQUESTXML_LINKAGE - #ifdef WIN32 - #ifdef FRAMEWORK_BUILD - #define MULTIPMEMGMTREQUESTXML_LINKAGE __declspec(dllexport) - #else - #define MULTIPMEMGMTREQUESTXML_LINKAGE __declspec(dllimport) - #endif - #else - #define MULTIPMEMGMTREQUESTXML_LINKAGE - #endif -#endif - - -#endif /* MultiPmeMgmtRequestXml_Link_h_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/MultiPmeMgmtRequestXml/MultiPmeMgmtRequestXmlRoots.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/MultiPmeMgmtRequestXml/MultiPmeMgmtRequestXmlRoots.h deleted file mode 100644 index 4436137ce..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/MultiPmeMgmtRequestXml/MultiPmeMgmtRequestXmlRoots.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef MultiPmeMgmtRequestXmlRoots_h_ -#define MultiPmeMgmtRequestXmlRoots_h_ - - -#include "Doc/MultiPmeMgmtRequestDoc/CMultiPmeMgmtRequestDoc.h" - -#include "Doc/DocXml/MultiPmeMgmtRequestXml/MultiPmeMgmtRequestXmlLink.h" - -namespace Caf { - - namespace XmlRoots { - - /// Saves the MultiPmeMgmtRequestDoc to a string. - std::string MULTIPMEMGMTREQUESTXML_LINKAGE saveMultiPmeMgmtRequestToString( - const SmartPtrCMultiPmeMgmtRequestDoc multiPmeMgmtRequestDoc); - - /// Parses the MultiPmeMgmtRequestDoc from the string. - SmartPtrCMultiPmeMgmtRequestDoc MULTIPMEMGMTREQUESTXML_LINKAGE parseMultiPmeMgmtRequestFromString( - const std::string xml); - - /// Saves the MultiPmeMgmtRequestDoc to a file. - void MULTIPMEMGMTREQUESTXML_LINKAGE saveMultiPmeMgmtRequestToFile( - const SmartPtrCMultiPmeMgmtRequestDoc multiPmeMgmtRequestDoc, - const std::string filePath); - - /// Parses the MultiPmeMgmtRequestDoc from the file. - SmartPtrCMultiPmeMgmtRequestDoc MULTIPMEMGMTREQUESTXML_LINKAGE parseMultiPmeMgmtRequestFromFile( - const std::string filePath); - } -} - -#endif /* MultiPmeMgmtRequestXmlRoots_h_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/MultiPmeMgmtRequestXml/PmeIdCollectionXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/MultiPmeMgmtRequestXml/PmeIdCollectionXml.h deleted file mode 100644 index 54fad83d1..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/MultiPmeMgmtRequestXml/PmeIdCollectionXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef PmeIdCollectionXml_h_ -#define PmeIdCollectionXml_h_ - - -#include "Doc/MultiPmeMgmtRequestDoc/CPmeIdCollectionDoc.h" - -#include "Doc/DocXml/MultiPmeMgmtRequestXml/MultiPmeMgmtRequestXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the PmeIdCollection class to/from XML - namespace PmeIdCollectionXml { - - /// Adds the PmeIdCollectionDoc into the XML. - void MULTIPMEMGMTREQUESTXML_LINKAGE add( - const SmartPtrCPmeIdCollectionDoc pmeIdCollectionDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the PmeIdCollectionDoc from the XML. - SmartPtrCPmeIdCollectionDoc MULTIPMEMGMTREQUESTXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/PayloadEnvelopeXml/PayloadEnvelopeXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/PayloadEnvelopeXml/PayloadEnvelopeXml.h deleted file mode 100644 index 84f38f775..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/PayloadEnvelopeXml/PayloadEnvelopeXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: July 3, 2015 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef PayloadEnvelopeXml_h_ -#define PayloadEnvelopeXml_h_ - - -#include "Doc/PayloadEnvelopeDoc/CPayloadEnvelopeDoc.h" - -#include "Doc/DocXml/PayloadEnvelopeXml/PayloadEnvelopeXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the PayloadEnvelope class to/from XML - namespace PayloadEnvelopeXml { - - /// Adds the PayloadEnvelopeDoc into the XML. - void PAYLOADENVELOPEXML_LINKAGE add( - const SmartPtrCPayloadEnvelopeDoc payloadEnvelopeDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the PayloadEnvelopeDoc from the XML. - SmartPtrCPayloadEnvelopeDoc PAYLOADENVELOPEXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/PayloadEnvelopeXml/PayloadEnvelopeXmlLink.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/PayloadEnvelopeXml/PayloadEnvelopeXmlLink.h deleted file mode 100644 index b7b23ddf1..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/PayloadEnvelopeXml/PayloadEnvelopeXmlLink.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef PayloadEnvelopeXml_Link_h_ -#define PayloadEnvelopeXml_Link_h_ - -#ifndef PAYLOADENVELOPEXML_LINKAGE - #ifdef WIN32 - #ifdef FRAMEWORK_BUILD - #define PAYLOADENVELOPEXML_LINKAGE __declspec(dllexport) - #else - #define PAYLOADENVELOPEXML_LINKAGE __declspec(dllimport) - #endif - #else - #define PAYLOADENVELOPEXML_LINKAGE - #endif -#endif - - -#endif /* PayloadEnvelopeXml_Link_h_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/PayloadEnvelopeXml/PayloadEnvelopeXmlRoots.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/PayloadEnvelopeXml/PayloadEnvelopeXmlRoots.h deleted file mode 100644 index 79f79d6a7..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/PayloadEnvelopeXml/PayloadEnvelopeXmlRoots.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef PayloadEnvelopeXmlRoots_h_ -#define PayloadEnvelopeXmlRoots_h_ - -#include "Doc/PayloadEnvelopeDoc/CPayloadEnvelopeDoc.h" - -#include "Doc/DocXml/PayloadEnvelopeXml/PayloadEnvelopeXmlLink.h" -#include "Doc/DocXml/PayloadEnvelopeXml/PayloadEnvelopeXmlRoots.h" - -namespace Caf { - - namespace XmlRoots { - /// Saves the PayloadEnvelopeDoc to a string. - std::string PAYLOADENVELOPEXML_LINKAGE savePayloadEnvelopeToString( - const SmartPtrCPayloadEnvelopeDoc payloadEnvelopeDoc); - - /// Parses the PayloadEnvelopeDoc from the string. - SmartPtrCPayloadEnvelopeDoc PAYLOADENVELOPEXML_LINKAGE parsePayloadEnvelopeFromString( - const std::string xml); - - /// Saves the PayloadEnvelopeDoc to a file. - void PAYLOADENVELOPEXML_LINKAGE savePayloadEnvelopeToFile( - const SmartPtrCPayloadEnvelopeDoc payloadEnvelopeDoc, - const std::string filePath); - - /// Parses the PayloadEnvelopeDoc from the file. - SmartPtrCPayloadEnvelopeDoc PAYLOADENVELOPEXML_LINKAGE parsePayloadEnvelopeFromFile( - const std::string filePath); - } -} - -#endif /* PayloadEnvelopeXmlRoots_h_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/PersistenceXml/CertCollectionXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/PersistenceXml/CertCollectionXml.h deleted file mode 100644 index 82f4e8024..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/PersistenceXml/CertCollectionXml.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Author: bwilliams - * Created: Nov 16, 2015 - * - * Copyright (C) 2015-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#ifndef CertCollectionXml_h_ -#define CertCollectionXml_h_ - - -#include "Doc/PersistenceDoc/CCertCollectionDoc.h" - -#include "Doc/DocXml/CafCoreTypesXml/CafCoreTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the CertCollection class to/from XML - namespace CertCollectionXml { - - /// Adds the CertCollectionDoc into the XML. - void CAFCORETYPESXML_LINKAGE add( - const SmartPtrCCertCollectionDoc certCollectionDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the CertCollectionDoc from the XML. - SmartPtrCCertCollectionDoc CAFCORETYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/PersistenceXml/CertPathCollectionXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/PersistenceXml/CertPathCollectionXml.h deleted file mode 100644 index c066457f9..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/PersistenceXml/CertPathCollectionXml.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Author: bwilliams - * Created: Nov 16, 2015 - * - * Copyright (C) 2015-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#ifndef CertPathCollectionXml_h_ -#define CertPathCollectionXml_h_ - - -#include "Doc/PersistenceDoc/CCertPathCollectionDoc.h" - -#include "Doc/DocXml/CafCoreTypesXml/CafCoreTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the CertPathCollection class to/from XML - namespace CertPathCollectionXml { - - /// Adds the CertPathCollectionDoc into the XML. - void CAFCORETYPESXML_LINKAGE add( - const SmartPtrCCertPathCollectionDoc certPathCollectionDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the CertPathCollectionDoc from the XML. - SmartPtrCCertPathCollectionDoc CAFCORETYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/PersistenceXml/LocalSecurityXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/PersistenceXml/LocalSecurityXml.h deleted file mode 100644 index 8ce8ac170..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/PersistenceXml/LocalSecurityXml.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Author: bwilliams - * Created: Nov 16, 2015 - * - * Copyright (C) 2015-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#ifndef LocalSecurityXml_h_ -#define LocalSecurityXml_h_ - - -#include "Doc/PersistenceDoc/CLocalSecurityDoc.h" - -#include "Doc/DocXml/PersistenceXml/PersistenceXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the LocalSecurity class to/from XML - namespace LocalSecurityXml { - - /// Adds the LocalSecurityDoc into the XML. - void PERSISTENCEXML_LINKAGE add( - const SmartPtrCLocalSecurityDoc localSecurityDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the LocalSecurityDoc from the XML. - SmartPtrCLocalSecurityDoc PERSISTENCEXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/PersistenceXml/PersistenceProtocolCollectionXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/PersistenceXml/PersistenceProtocolCollectionXml.h deleted file mode 100644 index 2c2331978..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/PersistenceXml/PersistenceProtocolCollectionXml.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Author: bwilliams - * Created: Nov 16, 2015 - * - * Copyright (C) 2015-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#ifndef PersistenceProtocolCollectionXml_h_ -#define PersistenceProtocolCollectionXml_h_ - - -#include "Doc/PersistenceDoc/CPersistenceProtocolCollectionDoc.h" - -#include "Doc/DocXml/CafCoreTypesXml/CafCoreTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the PersistenceProtocolCollection class to/from XML - namespace PersistenceProtocolCollectionXml { - - /// Adds the PersistenceProtocolCollectionDoc into the XML. - void CAFCORETYPESXML_LINKAGE add( - const SmartPtrCPersistenceProtocolCollectionDoc persistenceProtocolCollectionDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the PersistenceProtocolCollectionDoc from the XML. - SmartPtrCPersistenceProtocolCollectionDoc CAFCORETYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/PersistenceXml/PersistenceProtocolXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/PersistenceXml/PersistenceProtocolXml.h deleted file mode 100644 index 9808d7098..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/PersistenceXml/PersistenceProtocolXml.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Author: bwilliams - * Created: Nov 16, 2015 - * - * Copyright (C) 2015-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#ifndef PersistenceProtocolXml_h_ -#define PersistenceProtocolXml_h_ - - -#include "Doc/PersistenceDoc/CPersistenceProtocolDoc.h" - -#include "Doc/DocXml/PersistenceXml/PersistenceXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the PersistenceProtocol class to/from XML - namespace PersistenceProtocolXml { - - /// Adds the PersistenceProtocolDoc into the XML. - void PERSISTENCEXML_LINKAGE add( - const SmartPtrCPersistenceProtocolDoc persistenceProtocolDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the PersistenceProtocolDoc from the XML. - SmartPtrCPersistenceProtocolDoc PERSISTENCEXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/PersistenceXml/PersistenceXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/PersistenceXml/PersistenceXml.h deleted file mode 100644 index 265578b42..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/PersistenceXml/PersistenceXml.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Author: bwilliams - * Created: Nov 16, 2015 - * - * Copyright (C) 2015-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#ifndef PersistenceXml_h_ -#define PersistenceXml_h_ - - -#include "Doc/PersistenceDoc/CPersistenceDoc.h" - -#include "Doc/DocXml/PersistenceXml/PersistenceXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the Persistence class to/from XML - namespace PersistenceXml { - - /// Adds the PersistenceDoc into the XML. - void PERSISTENCEXML_LINKAGE add( - const SmartPtrCPersistenceDoc persistenceDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the PersistenceDoc from the XML. - SmartPtrCPersistenceDoc PERSISTENCEXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/PersistenceXml/PersistenceXmlLink.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/PersistenceXml/PersistenceXmlLink.h deleted file mode 100644 index c1c2ca98a..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/PersistenceXml/PersistenceXmlLink.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Author: bwilliams - * Created: Nov 16, 2015 - * - * Copyright (C) 2015-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#ifndef PersistenceXml_Link_h_ -#define PersistenceXml_Link_h_ - -#ifndef PERSISTENCEXML_LINKAGE - #ifdef WIN32 - #ifdef FRAMEWORK_BUILD - #define PERSISTENCEXML_LINKAGE __declspec(dllexport) - #else - #define PERSISTENCEXML_LINKAGE __declspec(dllimport) - #endif - #else - #define PERSISTENCEXML_LINKAGE - #endif -#endif - - -#endif /* PersistenceXml_Link_h_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/PersistenceXml/PersistenceXmlRoots.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/PersistenceXml/PersistenceXmlRoots.h deleted file mode 100644 index 094cce174..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/PersistenceXml/PersistenceXmlRoots.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Author: bwilliams - * Created: Nov 16, 2015 - * - * Copyright (C) 2015-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#ifndef PersistenceXmlRoots_h_ -#define PersistenceXmlRoots_h_ - - -#include "Doc/PersistenceDoc/CPersistenceDoc.h" - -#include "Doc/DocXml/PersistenceXml/PersistenceXmlLink.h" - -namespace Caf { - - namespace XmlRoots { - /// Saves the PersistenceDoc to a string. - std::string PERSISTENCEXML_LINKAGE savePersistenceToString( - const SmartPtrCPersistenceDoc persistenceDoc); - - /// Parses the PersistenceDoc from the string. - SmartPtrCPersistenceDoc PERSISTENCEXML_LINKAGE parsePersistenceFromString( - const std::string xml); - - /// Saves the PersistenceDoc to a file. - void PERSISTENCEXML_LINKAGE savePersistenceToFile( - const SmartPtrCPersistenceDoc persistenceDoc, - const std::string filePath); - - /// Parses the PersistenceDoc from the file. - SmartPtrCPersistenceDoc PERSISTENCEXML_LINKAGE parsePersistenceFromFile( - const std::string filePath); - } -} - -#endif /* PersistenceXmlRoots_h_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/PersistenceXml/RemoteSecurityCollectionXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/PersistenceXml/RemoteSecurityCollectionXml.h deleted file mode 100644 index 1c78f9ad2..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/PersistenceXml/RemoteSecurityCollectionXml.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Author: bwilliams - * Created: Nov 16, 2015 - * - * Copyright (C) 2015-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#ifndef RemoteSecurityCollectionXml_h_ -#define RemoteSecurityCollectionXml_h_ - - -#include "Doc/PersistenceDoc/CRemoteSecurityCollectionDoc.h" - -#include "Doc/DocXml/CafCoreTypesXml/CafCoreTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the RemoteSecurityCollection class to/from XML - namespace RemoteSecurityCollectionXml { - - /// Adds the RemoteSecurityCollectionDoc into the XML. - void CAFCORETYPESXML_LINKAGE add( - const SmartPtrCRemoteSecurityCollectionDoc remoteSecurityCollectionDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the RemoteSecurityCollectionDoc from the XML. - SmartPtrCRemoteSecurityCollectionDoc CAFCORETYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/PersistenceXml/RemoteSecurityXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/PersistenceXml/RemoteSecurityXml.h deleted file mode 100644 index 5c2ac7a4b..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/PersistenceXml/RemoteSecurityXml.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Author: bwilliams - * Created: Nov 16, 2015 - * - * Copyright (C) 2015-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#ifndef RemoteSecurityXml_h_ -#define RemoteSecurityXml_h_ - - -#include "Doc/PersistenceDoc/CRemoteSecurityDoc.h" - -#include "Doc/DocXml/PersistenceXml/PersistenceXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the RemoteSecurity class to/from XML - namespace RemoteSecurityXml { - - /// Adds the RemoteSecurityDoc into the XML. - void PERSISTENCEXML_LINKAGE add( - const SmartPtrCRemoteSecurityDoc remoteSecurityDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the RemoteSecurityDoc from the XML. - SmartPtrCRemoteSecurityDoc PERSISTENCEXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderInfraXml/ClassCollectionXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderInfraXml/ClassCollectionXml.h deleted file mode 100644 index 7b52afe9b..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderInfraXml/ClassCollectionXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef ClassCollectionXml_h_ -#define ClassCollectionXml_h_ - - -#include "Doc/ProviderInfraDoc/CClassCollectionDoc.h" - -#include "Doc/DocXml/ProviderInfraXml/ProviderInfraXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the ClassCollection class to/from XML - namespace ClassCollectionXml { - - /// Adds the ClassCollectionDoc into the XML. - void PROVIDERINFRAXML_LINKAGE add( - const SmartPtrCClassCollectionDoc classCollectionDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the ClassCollectionDoc from the XML. - SmartPtrCClassCollectionDoc PROVIDERINFRAXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderInfraXml/ProviderInfraXmlLink.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderInfraXml/ProviderInfraXmlLink.h deleted file mode 100644 index ac3fa2287..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderInfraXml/ProviderInfraXmlLink.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef ProviderInfraXml_Link_h_ -#define ProviderInfraXml_Link_h_ - -#ifndef PROVIDERINFRAXML_LINKAGE - #ifdef WIN32 - #ifdef FRAMEWORK_BUILD - #define PROVIDERINFRAXML_LINKAGE __declspec(dllexport) - #else - #define PROVIDERINFRAXML_LINKAGE __declspec(dllimport) - #endif - #else - #define PROVIDERINFRAXML_LINKAGE - #endif -#endif - - -#endif /* ProviderInfraXml_Link_h_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderInfraXml/ProviderInfraXmlRoots.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderInfraXml/ProviderInfraXmlRoots.h deleted file mode 100644 index a25184aac..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderInfraXml/ProviderInfraXmlRoots.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef ProviderInfraXmlRoots_h_ -#define ProviderInfraXmlRoots_h_ - - -#include "Doc/ProviderInfraDoc/CProviderRegDoc.h" - -#include "Doc/DocXml/ProviderInfraXml/ProviderInfraXmlLink.h" -#include "Doc/ProviderInfraDoc/CSchemaSummaryDoc.h" - -namespace Caf { - - namespace XmlRoots { - - /// Saves the ProviderRegDoc to a string. - std::string PROVIDERINFRAXML_LINKAGE saveProviderRegToString( - const SmartPtrCProviderRegDoc providerRegDoc); - - /// Parses the SchemaSummaryDoc from the string. - SmartPtrCProviderRegDoc PROVIDERINFRAXML_LINKAGE parseProviderRegFromString( - const std::string xml); - - /// Saves the ProviderRegDoc to a file. - void PROVIDERINFRAXML_LINKAGE saveProviderRegToFile( - const SmartPtrCProviderRegDoc providerRegDoc, - const std::string filePath); - - /// Parses the SchemaSummaryDoc from the file. - SmartPtrCProviderRegDoc PROVIDERINFRAXML_LINKAGE parseProviderRegFromFile( - const std::string filePath); - - /// Saves the SchemaSummaryDoc to a string. - std::string PROVIDERINFRAXML_LINKAGE saveSchemaSummaryToString( - const SmartPtrCSchemaSummaryDoc schemaSummaryDoc); - - /// Parses the SchemaSummaryDoc from the string. - SmartPtrCSchemaSummaryDoc PROVIDERINFRAXML_LINKAGE parseSchemaSummaryFromString( - const std::string xml); - - /// Saves the SchemaSummaryDoc to a file. - void PROVIDERINFRAXML_LINKAGE saveSchemaSummaryToFile( - const SmartPtrCSchemaSummaryDoc schemaSummaryDoc, - const std::string filePath); - - /// Parses the SchemaSummaryDoc from the file. - SmartPtrCSchemaSummaryDoc PROVIDERINFRAXML_LINKAGE parseSchemaSummaryFromFile( - const std::string filePath); - } -} - -#endif /* ProviderInfraXmlRoots_h_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderInfraXml/ProviderRegXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderInfraXml/ProviderRegXml.h deleted file mode 100644 index 6f1f48650..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderInfraXml/ProviderRegXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef ProviderRegXml_h_ -#define ProviderRegXml_h_ - - -#include "Doc/ProviderInfraDoc/CProviderRegDoc.h" - -#include "Doc/DocXml/ProviderInfraXml/ProviderInfraXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the ProviderReg class to/from XML - namespace ProviderRegXml { - - /// Adds the ProviderRegDoc into the XML. - void PROVIDERINFRAXML_LINKAGE add( - const SmartPtrCProviderRegDoc providerRegDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the ProviderRegDoc from the XML. - SmartPtrCProviderRegDoc PROVIDERINFRAXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderInfraXml/SchemaSummaryXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderInfraXml/SchemaSummaryXml.h deleted file mode 100644 index 265aa7e9d..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderInfraXml/SchemaSummaryXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef SchemaSummaryXml_h_ -#define SchemaSummaryXml_h_ - - -#include "Doc/ProviderInfraDoc/CSchemaSummaryDoc.h" - -#include "Doc/DocXml/ProviderInfraXml/ProviderInfraXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the SchemaSummary class to/from XML - namespace SchemaSummaryXml { - - /// Adds the SchemaSummaryDoc into the XML. - void PROVIDERINFRAXML_LINKAGE add( - const SmartPtrCSchemaSummaryDoc schemaSummaryDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the SchemaSummaryDoc from the XML. - SmartPtrCSchemaSummaryDoc PROVIDERINFRAXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderRequestXml/ProviderBatchXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderRequestXml/ProviderBatchXml.h deleted file mode 100644 index 7b8079d9e..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderRequestXml/ProviderBatchXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef ProviderBatchXml_h_ -#define ProviderBatchXml_h_ - - -#include "Doc/ProviderRequestDoc/CProviderBatchDoc.h" - -#include "Doc/DocXml/ProviderRequestXml/ProviderRequestXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the ProviderBatch class to/from XML - namespace ProviderBatchXml { - - /// Adds the ProviderBatchDoc into the XML. - void PROVIDERREQUESTXML_LINKAGE add( - const SmartPtrCProviderBatchDoc providerBatchDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the ProviderBatchDoc from the XML. - SmartPtrCProviderBatchDoc PROVIDERREQUESTXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderRequestXml/ProviderCollectInstancesCollectionXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderRequestXml/ProviderCollectInstancesCollectionXml.h deleted file mode 100644 index 65f423634..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderRequestXml/ProviderCollectInstancesCollectionXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef ProviderCollectInstancesCollectionXml_h_ -#define ProviderCollectInstancesCollectionXml_h_ - - -#include "Doc/ProviderRequestDoc/CProviderCollectInstancesCollectionDoc.h" - -#include "Doc/DocXml/ProviderRequestXml/ProviderRequestXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the ProviderCollectInstancesCollection class to/from XML - namespace ProviderCollectInstancesCollectionXml { - - /// Adds the ProviderCollectInstancesCollectionDoc into the XML. - void PROVIDERREQUESTXML_LINKAGE add( - const SmartPtrCProviderCollectInstancesCollectionDoc providerCollectInstancesCollectionDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the ProviderCollectInstancesCollectionDoc from the XML. - SmartPtrCProviderCollectInstancesCollectionDoc PROVIDERREQUESTXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderRequestXml/ProviderCollectInstancesXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderRequestXml/ProviderCollectInstancesXml.h deleted file mode 100644 index fb9439976..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderRequestXml/ProviderCollectInstancesXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef ProviderCollectInstancesXml_h_ -#define ProviderCollectInstancesXml_h_ - - -#include "Doc/ProviderRequestDoc/CProviderCollectInstancesDoc.h" - -#include "Doc/DocXml/ProviderRequestXml/ProviderRequestXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the ProviderCollectInstances class to/from XML - namespace ProviderCollectInstancesXml { - - /// Adds the ProviderCollectInstancesDoc into the XML. - void PROVIDERREQUESTXML_LINKAGE add( - const SmartPtrCProviderCollectInstancesDoc providerCollectInstancesDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the ProviderCollectInstancesDoc from the XML. - SmartPtrCProviderCollectInstancesDoc PROVIDERREQUESTXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderRequestXml/ProviderCollectSchemaRequestXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderRequestXml/ProviderCollectSchemaRequestXml.h deleted file mode 100644 index e686b4b37..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderRequestXml/ProviderCollectSchemaRequestXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef ProviderCollectSchemaRequestXml_h_ -#define ProviderCollectSchemaRequestXml_h_ - - -#include "Doc/ProviderRequestDoc/CProviderCollectSchemaRequestDoc.h" - -#include "Doc/DocXml/ProviderRequestXml/ProviderRequestXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the ProviderCollectSchemaRequest class to/from XML - namespace ProviderCollectSchemaRequestXml { - - /// Adds the ProviderCollectSchemaRequestDoc into the XML. - void PROVIDERREQUESTXML_LINKAGE add( - const SmartPtrCProviderCollectSchemaRequestDoc providerCollectSchemaRequestDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the ProviderCollectSchemaRequestDoc from the XML. - SmartPtrCProviderCollectSchemaRequestDoc PROVIDERREQUESTXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderRequestXml/ProviderInvokeOperationCollectionXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderRequestXml/ProviderInvokeOperationCollectionXml.h deleted file mode 100644 index 072f54b21..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderRequestXml/ProviderInvokeOperationCollectionXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef ProviderInvokeOperationCollectionXml_h_ -#define ProviderInvokeOperationCollectionXml_h_ - - -#include "Doc/ProviderRequestDoc/CProviderInvokeOperationCollectionDoc.h" - -#include "Doc/DocXml/ProviderRequestXml/ProviderRequestXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the ProviderInvokeOperationCollection class to/from XML - namespace ProviderInvokeOperationCollectionXml { - - /// Adds the ProviderInvokeOperationCollectionDoc into the XML. - void PROVIDERREQUESTXML_LINKAGE add( - const SmartPtrCProviderInvokeOperationCollectionDoc providerInvokeOperationCollectionDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the ProviderInvokeOperationCollectionDoc from the XML. - SmartPtrCProviderInvokeOperationCollectionDoc PROVIDERREQUESTXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderRequestXml/ProviderInvokeOperationXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderRequestXml/ProviderInvokeOperationXml.h deleted file mode 100644 index a195fa4c9..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderRequestXml/ProviderInvokeOperationXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef ProviderInvokeOperationXml_h_ -#define ProviderInvokeOperationXml_h_ - - -#include "Doc/ProviderRequestDoc/CProviderInvokeOperationDoc.h" - -#include "Doc/DocXml/ProviderRequestXml/ProviderRequestXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the ProviderInvokeOperation class to/from XML - namespace ProviderInvokeOperationXml { - - /// Adds the ProviderInvokeOperationDoc into the XML. - void PROVIDERREQUESTXML_LINKAGE add( - const SmartPtrCProviderInvokeOperationDoc providerInvokeOperationDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the ProviderInvokeOperationDoc from the XML. - SmartPtrCProviderInvokeOperationDoc PROVIDERREQUESTXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderRequestXml/ProviderRequestConfigXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderRequestXml/ProviderRequestConfigXml.h deleted file mode 100644 index 264bef874..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderRequestXml/ProviderRequestConfigXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef ProviderRequestConfigXml_h_ -#define ProviderRequestConfigXml_h_ - - -#include "Doc/ProviderRequestDoc/CProviderRequestConfigDoc.h" - -#include "Doc/DocXml/ProviderRequestXml/ProviderRequestXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the ProviderRequestConfig class to/from XML - namespace ProviderRequestConfigXml { - - /// Adds the ProviderRequestConfigDoc into the XML. - void PROVIDERREQUESTXML_LINKAGE add( - const SmartPtrCProviderRequestConfigDoc providerRequestConfigDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the ProviderRequestConfigDoc from the XML. - SmartPtrCProviderRequestConfigDoc PROVIDERREQUESTXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderRequestXml/ProviderRequestHeaderXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderRequestXml/ProviderRequestHeaderXml.h deleted file mode 100644 index 2f22d027f..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderRequestXml/ProviderRequestHeaderXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef ProviderRequestHeaderXml_h_ -#define ProviderRequestHeaderXml_h_ - - -#include "Doc/ProviderRequestDoc/CProviderRequestHeaderDoc.h" - -#include "Doc/DocXml/ProviderRequestXml/ProviderRequestXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the ProviderRequestHeader class to/from XML - namespace ProviderRequestHeaderXml { - - /// Adds the ProviderRequestHeaderDoc into the XML. - void PROVIDERREQUESTXML_LINKAGE add( - const SmartPtrCProviderRequestHeaderDoc providerRequestHeaderDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the ProviderRequestHeaderDoc from the XML. - SmartPtrCProviderRequestHeaderDoc PROVIDERREQUESTXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderRequestXml/ProviderRequestXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderRequestXml/ProviderRequestXml.h deleted file mode 100644 index 1aae79e17..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderRequestXml/ProviderRequestXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef ProviderRequestXml_h_ -#define ProviderRequestXml_h_ - - -#include "Doc/ProviderRequestDoc/CProviderRequestDoc.h" - -#include "Doc/DocXml/ProviderRequestXml/ProviderRequestXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the ProviderRequest class to/from XML - namespace ProviderRequestXml { - - /// Adds the ProviderRequestDoc into the XML. - void PROVIDERREQUESTXML_LINKAGE add( - const SmartPtrCProviderRequestDoc providerRequestDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the ProviderRequestDoc from the XML. - SmartPtrCProviderRequestDoc PROVIDERREQUESTXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderRequestXml/ProviderRequestXmlLink.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderRequestXml/ProviderRequestXmlLink.h deleted file mode 100644 index bcfb910c7..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderRequestXml/ProviderRequestXmlLink.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef ProviderRequestXml_Link_h_ -#define ProviderRequestXml_Link_h_ - -#ifndef PROVIDERREQUESTXML_LINKAGE - #ifdef WIN32 - #ifdef FRAMEWORK_BUILD - #define PROVIDERREQUESTXML_LINKAGE __declspec(dllexport) - #else - #define PROVIDERREQUESTXML_LINKAGE __declspec(dllimport) - #endif - #else - #define PROVIDERREQUESTXML_LINKAGE - #endif -#endif - - -#endif /* ProviderRequestXml_Link_h_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderRequestXml/ProviderRequestXmlRoots.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderRequestXml/ProviderRequestXmlRoots.h deleted file mode 100644 index 404ab56be..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderRequestXml/ProviderRequestXmlRoots.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef ProviderRequestXmlRoots_h_ -#define ProviderRequestXmlRoots_h_ - - -#include "Doc/ProviderRequestDoc/CProviderCollectSchemaRequestDoc.h" - -#include "Doc/DocXml/ProviderRequestXml/ProviderRequestXmlLink.h" -#include "Doc/ProviderRequestDoc/CProviderRequestDoc.h" - -namespace Caf { - - namespace XmlRoots { - - /// Saves the ProviderCollectSchemaRequestDoc to a string. - std::string PROVIDERREQUESTXML_LINKAGE saveProviderCollectSchemaRequestToString( - const SmartPtrCProviderCollectSchemaRequestDoc providerCollectSchemaRequestDoc); - - /// Parses the ProviderCollectSchemaRequestDoc from the string. - SmartPtrCProviderCollectSchemaRequestDoc PROVIDERREQUESTXML_LINKAGE parseProviderCollectSchemaRequestFromString( - const std::string xml); - - /// Saves the ProviderCollectSchemaRequestDoc to a file. - void PROVIDERREQUESTXML_LINKAGE saveProviderCollectSchemaRequestToFile( - const SmartPtrCProviderCollectSchemaRequestDoc providerCollectSchemaRequestDoc, - const std::string filePath); - - /// Parses the ProviderCollectSchemaRequestDoc from the file. - SmartPtrCProviderCollectSchemaRequestDoc PROVIDERREQUESTXML_LINKAGE parseProviderCollectSchemaRequestFromFile( - const std::string filePath); - - /// Saves the ProviderRequestDoc to a string. - std::string PROVIDERREQUESTXML_LINKAGE saveProviderRequestToString( - const SmartPtrCProviderRequestDoc providerRequestDoc); - - /// Parses the ProviderCollectSchemaRequestDoc from the string. - SmartPtrCProviderRequestDoc PROVIDERREQUESTXML_LINKAGE parseProviderRequestFromString( - const std::string xml); - - /// Saves the ProviderRequestDoc to a file. - void PROVIDERREQUESTXML_LINKAGE saveProviderRequestToFile( - const SmartPtrCProviderRequestDoc providerRequestDoc, - const std::string filePath); - - /// Parses the ProviderCollectSchemaRequestDoc from the file. - SmartPtrCProviderRequestDoc PROVIDERREQUESTXML_LINKAGE parseProviderRequestFromFile( - const std::string filePath); - } -} - -#endif /* ProviderRequestXmlRoots_h_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderResultsXml/CdifXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderResultsXml/CdifXml.h deleted file mode 100644 index 0a245e34d..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderResultsXml/CdifXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef CdifXml_h_ -#define CdifXml_h_ - - -#include "Doc/ProviderResultsDoc/CCdifDoc.h" - -#include "Doc/DocXml/ProviderResultsXml/ProviderResultsXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the Cdif class to/from XML - namespace CdifXml { - - /// Adds the CdifDoc into the XML. - void PROVIDERRESULTSXML_LINKAGE add( - const SmartPtrCCdifDoc cdifDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the CdifDoc from the XML. - SmartPtrCCdifDoc PROVIDERRESULTSXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderResultsXml/DefinitionObjectCollectionXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderResultsXml/DefinitionObjectCollectionXml.h deleted file mode 100644 index f0ac18ed7..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderResultsXml/DefinitionObjectCollectionXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef DefinitionObjectCollectionXml_h_ -#define DefinitionObjectCollectionXml_h_ - - -#include "Doc/ProviderResultsDoc/CDefinitionObjectCollectionDoc.h" - -#include "Doc/DocXml/ProviderResultsXml/ProviderResultsXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the DefinitionObjectCollection class to/from XML - namespace DefinitionObjectCollectionXml { - - /// Adds the DefinitionObjectCollectionDoc into the XML. - void PROVIDERRESULTSXML_LINKAGE add( - const SmartPtrCDefinitionObjectCollectionDoc definitionObjectCollectionDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the DefinitionObjectCollectionDoc from the XML. - SmartPtrCDefinitionObjectCollectionDoc PROVIDERRESULTSXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderResultsXml/ProviderResultsXmlLink.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderResultsXml/ProviderResultsXmlLink.h deleted file mode 100644 index 6bea774c4..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderResultsXml/ProviderResultsXmlLink.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef ProviderResultsXml_Link_h_ -#define ProviderResultsXml_Link_h_ - -#ifndef PROVIDERRESULTSXML_LINKAGE - #ifdef WIN32 - #ifdef FRAMEWORK_BUILD - #define PROVIDERRESULTSXML_LINKAGE __declspec(dllexport) - #else - #define PROVIDERRESULTSXML_LINKAGE __declspec(dllimport) - #endif - #else - #define PROVIDERRESULTSXML_LINKAGE - #endif -#endif - - -#endif /* ProviderResultsXml_Link_h_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderResultsXml/ProviderResultsXmlRoots.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderResultsXml/ProviderResultsXmlRoots.h deleted file mode 100644 index 389bd3543..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderResultsXml/ProviderResultsXmlRoots.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef ProviderResultsXmlRoots_h_ -#define ProviderResultsXmlRoots_h_ - - -#include "Doc/ProviderResultsDoc/CCdifDoc.h" - -#include "Doc/DocXml/ProviderResultsXml/ProviderResultsXmlLink.h" -#include "Doc/ProviderResultsDoc/CSchemaDoc.h" - -namespace Caf { - - namespace XmlRoots { - - /// Saves the SchemaDoc to a string. - std::string PROVIDERRESULTSXML_LINKAGE saveSchemaToString( - const SmartPtrCSchemaDoc schemaDoc); - - /// Parses the DefinitionObjectCollectionDoc from the string. - SmartPtrCSchemaDoc PROVIDERRESULTSXML_LINKAGE parseSchemaFromString( - const std::string xml); - - /// Saves the SchemaDoc to a file. - void PROVIDERRESULTSXML_LINKAGE saveSchemaToFile( - const SmartPtrCSchemaDoc schemaDoc, - const std::string filePath); - - /// Parses the DefinitionObjectCollectionDoc from the file. - SmartPtrCSchemaDoc PROVIDERRESULTSXML_LINKAGE parseSchemaFromFile( - const std::string filePath); - - /// Saves the CdifDoc to a string. - std::string PROVIDERRESULTSXML_LINKAGE saveCdifToString( - const SmartPtrCCdifDoc cdifDoc); - - /// Parses the DefinitionObjectCollectionDoc from the string. - SmartPtrCCdifDoc PROVIDERRESULTSXML_LINKAGE parseCdifFromString( - const std::string xml); - - /// Saves the CdifDoc to a file. - void PROVIDERRESULTSXML_LINKAGE saveCdifToFile( - const SmartPtrCCdifDoc cdifDoc, - const std::string filePath); - - /// Parses the DefinitionObjectCollectionDoc from the file. - SmartPtrCCdifDoc PROVIDERRESULTSXML_LINKAGE parseCdifFromFile( - const std::string filePath); - } -} - -#endif /* ProviderResultsXmlRoots_h_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderResultsXml/RequestIdentifierXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderResultsXml/RequestIdentifierXml.h deleted file mode 100644 index dcdc00659..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderResultsXml/RequestIdentifierXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef RequestIdentifierXml_h_ -#define RequestIdentifierXml_h_ - - -#include "Doc/ProviderResultsDoc/CRequestIdentifierDoc.h" - -#include "Doc/DocXml/ProviderResultsXml/ProviderResultsXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the RequestIdentifier class to/from XML - namespace RequestIdentifierXml { - - /// Adds the RequestIdentifierDoc into the XML. - void PROVIDERRESULTSXML_LINKAGE add( - const SmartPtrCRequestIdentifierDoc requestIdentifierDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the RequestIdentifierDoc from the XML. - SmartPtrCRequestIdentifierDoc PROVIDERRESULTSXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderResultsXml/SchemaXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderResultsXml/SchemaXml.h deleted file mode 100644 index f7ba69276..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ProviderResultsXml/SchemaXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef SchemaXml_h_ -#define SchemaXml_h_ - - -#include "Doc/ProviderResultsDoc/CSchemaDoc.h" - -#include "Doc/DocXml/ProviderResultsXml/ProviderResultsXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the Schema class to/from XML - namespace SchemaXml { - - /// Adds the SchemaDoc into the XML. - void PROVIDERRESULTSXML_LINKAGE add( - const SmartPtrCSchemaDoc schemaDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the SchemaDoc from the XML. - SmartPtrCSchemaDoc PROVIDERRESULTSXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ResponseXml/ErrorResponseXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ResponseXml/ErrorResponseXml.h deleted file mode 100644 index fc973e2c8..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ResponseXml/ErrorResponseXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef ErrorResponseXml_h_ -#define ErrorResponseXml_h_ - - -#include "Doc/ResponseDoc/CErrorResponseDoc.h" - -#include "Doc/DocXml/ResponseXml/ResponseXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the ErrorResponse class to/from XML - namespace ErrorResponseXml { - - /// Adds the ErrorResponseDoc into the XML. - void RESPONSEXML_LINKAGE add( - const SmartPtrCErrorResponseDoc errorResponseDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the ErrorResponseDoc from the XML. - SmartPtrCErrorResponseDoc RESPONSEXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ResponseXml/EventKeyCollectionXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ResponseXml/EventKeyCollectionXml.h deleted file mode 100644 index b828d1b9c..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ResponseXml/EventKeyCollectionXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef EventKeyCollectionXml_h_ -#define EventKeyCollectionXml_h_ - - -#include "Doc/ResponseDoc/CEventKeyCollectionDoc.h" - -#include "Doc/DocXml/ResponseXml/ResponseXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the EventKeyCollection class to/from XML - namespace EventKeyCollectionXml { - - /// Adds the EventKeyCollectionDoc into the XML. - void RESPONSEXML_LINKAGE add( - const SmartPtrCEventKeyCollectionDoc eventKeyCollectionDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the EventKeyCollectionDoc from the XML. - SmartPtrCEventKeyCollectionDoc RESPONSEXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ResponseXml/EventKeyXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ResponseXml/EventKeyXml.h deleted file mode 100644 index 5818b974f..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ResponseXml/EventKeyXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef EventKeyXml_h_ -#define EventKeyXml_h_ - - -#include "Doc/ResponseDoc/CEventKeyDoc.h" - -#include "Doc/DocXml/ResponseXml/ResponseXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the EventKey class to/from XML - namespace EventKeyXml { - - /// Adds the EventKeyDoc into the XML. - void RESPONSEXML_LINKAGE add( - const SmartPtrCEventKeyDoc eventKeyDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the EventKeyDoc from the XML. - SmartPtrCEventKeyDoc RESPONSEXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ResponseXml/EventManifestXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ResponseXml/EventManifestXml.h deleted file mode 100644 index c4303273b..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ResponseXml/EventManifestXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef EventManifestXml_h_ -#define EventManifestXml_h_ - - -#include "Doc/ResponseDoc/CEventManifestDoc.h" - -#include "Doc/DocXml/ResponseXml/ResponseXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the EventManifest class to/from XML - namespace EventManifestXml { - - /// Adds the EventManifestDoc into the XML. - void RESPONSEXML_LINKAGE add( - const SmartPtrCEventManifestDoc eventManifestDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the EventManifestDoc from the XML. - SmartPtrCEventManifestDoc RESPONSEXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ResponseXml/ManifestCollectionXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ResponseXml/ManifestCollectionXml.h deleted file mode 100644 index be002178f..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ResponseXml/ManifestCollectionXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef ManifestCollectionXml_h_ -#define ManifestCollectionXml_h_ - - -#include "Doc/ResponseDoc/CManifestCollectionDoc.h" - -#include "Doc/DocXml/ResponseXml/ResponseXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the ManifestCollection class to/from XML - namespace ManifestCollectionXml { - - /// Adds the ManifestCollectionDoc into the XML. - void RESPONSEXML_LINKAGE add( - const SmartPtrCManifestCollectionDoc manifestCollectionDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the ManifestCollectionDoc from the XML. - SmartPtrCManifestCollectionDoc RESPONSEXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ResponseXml/ManifestXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ResponseXml/ManifestXml.h deleted file mode 100644 index 8bebe6a26..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ResponseXml/ManifestXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef ManifestXml_h_ -#define ManifestXml_h_ - - -#include "Doc/ResponseDoc/CManifestDoc.h" - -#include "Doc/DocXml/ResponseXml/ResponseXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the Manifest class to/from XML - namespace ManifestXml { - - /// Adds the ManifestDoc into the XML. - void RESPONSEXML_LINKAGE add( - const SmartPtrCManifestDoc manifestDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the ManifestDoc from the XML. - SmartPtrCManifestDoc RESPONSEXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ResponseXml/ProviderEventResponseXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ResponseXml/ProviderEventResponseXml.h deleted file mode 100644 index 208da4851..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ResponseXml/ProviderEventResponseXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef ProviderEventResponseXml_h_ -#define ProviderEventResponseXml_h_ - - -#include "Doc/ResponseDoc/CProviderEventResponseDoc.h" - -#include "Doc/DocXml/ResponseXml/ResponseXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the ProviderEventResponse class to/from XML - namespace ProviderEventResponseXml { - - /// Adds the ProviderEventResponseDoc into the XML. - void RESPONSEXML_LINKAGE add( - const SmartPtrCProviderEventResponseDoc providerEventResponseDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the ProviderEventResponseDoc from the XML. - SmartPtrCProviderEventResponseDoc RESPONSEXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ResponseXml/ProviderResponseXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ResponseXml/ProviderResponseXml.h deleted file mode 100644 index 558993c59..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ResponseXml/ProviderResponseXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef ProviderResponseXml_h_ -#define ProviderResponseXml_h_ - - -#include "Doc/ResponseDoc/CProviderResponseDoc.h" - -#include "Doc/DocXml/ResponseXml/ResponseXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the ProviderResponse class to/from XML - namespace ProviderResponseXml { - - /// Adds the ProviderResponseDoc into the XML. - void RESPONSEXML_LINKAGE add( - const SmartPtrCProviderResponseDoc providerResponseDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the ProviderResponseDoc from the XML. - SmartPtrCProviderResponseDoc RESPONSEXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ResponseXml/ResponseHeaderXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ResponseXml/ResponseHeaderXml.h deleted file mode 100644 index 105c8e48e..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ResponseXml/ResponseHeaderXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef ResponseHeaderXml_h_ -#define ResponseHeaderXml_h_ - - -#include "Doc/ResponseDoc/CResponseHeaderDoc.h" - -#include "Doc/DocXml/ResponseXml/ResponseXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the ResponseHeader class to/from XML - namespace ResponseHeaderXml { - - /// Adds the ResponseHeaderDoc into the XML. - void RESPONSEXML_LINKAGE add( - const SmartPtrCResponseHeaderDoc responseHeaderDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the ResponseHeaderDoc from the XML. - SmartPtrCResponseHeaderDoc RESPONSEXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ResponseXml/ResponseXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ResponseXml/ResponseXml.h deleted file mode 100644 index 88dfbdbba..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ResponseXml/ResponseXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef ResponseXml_h_ -#define ResponseXml_h_ - - -#include "Doc/ResponseDoc/CResponseDoc.h" - -#include "Doc/DocXml/ResponseXml/ResponseXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the Response class to/from XML - namespace ResponseXml { - - /// Adds the ResponseDoc into the XML. - void RESPONSEXML_LINKAGE add( - const SmartPtrCResponseDoc responseDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the ResponseDoc from the XML. - SmartPtrCResponseDoc RESPONSEXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ResponseXml/ResponseXmlLink.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ResponseXml/ResponseXmlLink.h deleted file mode 100644 index a55bacca5..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ResponseXml/ResponseXmlLink.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef ResponseXml_Link_h_ -#define ResponseXml_Link_h_ - -#ifndef RESPONSEXML_LINKAGE - #ifdef WIN32 - #ifdef FRAMEWORK_BUILD - #define RESPONSEXML_LINKAGE __declspec(dllexport) - #else - #define RESPONSEXML_LINKAGE __declspec(dllimport) - #endif - #else - #define RESPONSEXML_LINKAGE - #endif -#endif - - -#endif /* ResponseXml_Link_h_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ResponseXml/ResponseXmlRoots.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ResponseXml/ResponseXmlRoots.h deleted file mode 100644 index 9fe5ea53c..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/ResponseXml/ResponseXmlRoots.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef ResponseXmlRoots_h_ -#define ResponseXmlRoots_h_ - - -#include "Doc/ResponseDoc/CErrorResponseDoc.h" - -#include "Doc/DocXml/ResponseXml/ResponseXmlLink.h" -#include "Doc/ResponseDoc/CProviderEventResponseDoc.h" -#include "Doc/ResponseDoc/CProviderResponseDoc.h" -#include "Doc/ResponseDoc/CResponseDoc.h" - -namespace Caf { - - namespace XmlRoots { - - /// Saves the ErrorResponseDoc to a string. - std::string RESPONSEXML_LINKAGE saveErrorResponseToString( - const SmartPtrCErrorResponseDoc errorResponseDoc); - - /// Parses the ErrorResponseDoc from the string. - SmartPtrCErrorResponseDoc RESPONSEXML_LINKAGE parseErrorResponseFromString( - const std::string xml); - - /// Saves the ErrorResponseDoc to a file. - void RESPONSEXML_LINKAGE saveErrorResponseToFile( - const SmartPtrCErrorResponseDoc errorResponseDoc, - const std::string filePath); - - /// Parses the ErrorResponseDoc from the file. - SmartPtrCErrorResponseDoc RESPONSEXML_LINKAGE parseErrorResponseFromFile( - const std::string filePath); - - /// Saves the ProviderResponseDoc to a string. - std::string RESPONSEXML_LINKAGE saveProviderResponseToString( - const SmartPtrCProviderResponseDoc providerResponseDoc); - - /// Parses the ErrorResponseDoc from the string. - SmartPtrCProviderResponseDoc RESPONSEXML_LINKAGE parseProviderResponseFromString( - const std::string xml); - - /// Saves the ProviderResponseDoc to a file. - void RESPONSEXML_LINKAGE saveProviderResponseToFile( - const SmartPtrCProviderResponseDoc providerResponseDoc, - const std::string filePath); - - /// Parses the ErrorResponseDoc from the file. - SmartPtrCProviderResponseDoc RESPONSEXML_LINKAGE parseProviderResponseFromFile( - const std::string filePath); - - /// Saves the ResponseDoc to a string. - std::string RESPONSEXML_LINKAGE saveResponseToString( - const SmartPtrCResponseDoc responseDoc); - - /// Parses the ErrorResponseDoc from the string. - SmartPtrCResponseDoc RESPONSEXML_LINKAGE parseResponseFromString( - const std::string xml); - - /// Saves the ResponseDoc to a file. - void RESPONSEXML_LINKAGE saveResponseToFile( - const SmartPtrCResponseDoc responseDoc, - const std::string filePath); - - /// Parses the ErrorResponseDoc from the file. - SmartPtrCResponseDoc RESPONSEXML_LINKAGE parseResponseFromFile( - const std::string filePath); - - /// Saves the ProviderEventResponseDoc to a string. - std::string RESPONSEXML_LINKAGE saveProviderEventResponseToString( - const SmartPtrCProviderEventResponseDoc providerEventResponseDoc); - - /// Parses the ErrorResponseDoc from the string. - SmartPtrCProviderEventResponseDoc RESPONSEXML_LINKAGE parseProviderEventResponseFromString( - const std::string xml); - - /// Saves the ProviderEventResponseDoc to a file. - void RESPONSEXML_LINKAGE saveProviderEventResponseToFile( - const SmartPtrCProviderEventResponseDoc providerEventResponseDoc, - const std::string filePath); - - /// Parses the ErrorResponseDoc from the file. - SmartPtrCProviderEventResponseDoc RESPONSEXML_LINKAGE parseProviderEventResponseFromFile( - const std::string filePath); - } -} - -#endif /* ResponseXmlRoots_h_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/ActionClassInstanceCollectionXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/ActionClassInstanceCollectionXml.h deleted file mode 100644 index ff923d419..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/ActionClassInstanceCollectionXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef ActionClassInstanceCollectionXml_h_ -#define ActionClassInstanceCollectionXml_h_ - - -#include "Doc/SchemaTypesDoc/CActionClassInstanceCollectionDoc.h" - -#include "Doc/DocXml/SchemaTypesXml/SchemaTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the ActionClassInstanceCollection class to/from XML - namespace ActionClassInstanceCollectionXml { - - /// Adds the ActionClassInstanceCollectionDoc into the XML. - void SCHEMATYPESXML_LINKAGE add( - const SmartPtrCActionClassInstanceCollectionDoc actionClassInstanceCollectionDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the ActionClassInstanceCollectionDoc from the XML. - SmartPtrCActionClassInstanceCollectionDoc SCHEMATYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/ActionClassInstanceXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/ActionClassInstanceXml.h deleted file mode 100644 index 215642e48..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/ActionClassInstanceXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef ActionClassInstanceXml_h_ -#define ActionClassInstanceXml_h_ - - -#include "Doc/SchemaTypesDoc/CActionClassInstanceDoc.h" - -#include "Doc/DocXml/SchemaTypesXml/SchemaTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the ActionClassInstance class to/from XML - namespace ActionClassInstanceXml { - - /// Adds the ActionClassInstanceDoc into the XML. - void SCHEMATYPESXML_LINKAGE add( - const SmartPtrCActionClassInstanceDoc actionClassInstanceDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the ActionClassInstanceDoc from the XML. - SmartPtrCActionClassInstanceDoc SCHEMATYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/ActionClassXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/ActionClassXml.h deleted file mode 100644 index ae777559c..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/ActionClassXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef ActionClassXml_h_ -#define ActionClassXml_h_ - - -#include "Doc/SchemaTypesDoc/CActionClassDoc.h" - -#include "Doc/DocXml/SchemaTypesXml/SchemaTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the ActionClass class to/from XML - namespace ActionClassXml { - - /// Adds the ActionClassDoc into the XML. - void SCHEMATYPESXML_LINKAGE add( - const SmartPtrCActionClassDoc actionClassDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the ActionClassDoc from the XML. - SmartPtrCActionClassDoc SCHEMATYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/ClassCardinalityXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/ClassCardinalityXml.h deleted file mode 100644 index 14016c727..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/ClassCardinalityXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef ClassCardinalityXml_h_ -#define ClassCardinalityXml_h_ - - -#include "Doc/SchemaTypesDoc/CClassCardinalityDoc.h" - -#include "Doc/DocXml/SchemaTypesXml/SchemaTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the ClassCardinality class to/from XML - namespace ClassCardinalityXml { - - /// Adds the ClassCardinalityDoc into the XML. - void SCHEMATYPESXML_LINKAGE add( - const SmartPtrCClassCardinalityDoc classCardinalityDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the ClassCardinalityDoc from the XML. - SmartPtrCClassCardinalityDoc SCHEMATYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/ClassFieldXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/ClassFieldXml.h deleted file mode 100644 index 1fd2eb9f8..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/ClassFieldXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef ClassFieldXml_h_ -#define ClassFieldXml_h_ - - -#include "Doc/SchemaTypesDoc/CClassFieldDoc.h" - -#include "Doc/DocXml/SchemaTypesXml/SchemaTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the ClassField class to/from XML - namespace ClassFieldXml { - - /// Adds the ClassFieldDoc into the XML. - void SCHEMATYPESXML_LINKAGE add( - const SmartPtrCClassFieldDoc classFieldDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the ClassFieldDoc from the XML. - SmartPtrCClassFieldDoc SCHEMATYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/ClassIdentifierXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/ClassIdentifierXml.h deleted file mode 100644 index b318476c7..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/ClassIdentifierXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef ClassIdentifierXml_h_ -#define ClassIdentifierXml_h_ - - -#include "Doc/SchemaTypesDoc/CClassIdentifierDoc.h" - -#include "Doc/DocXml/SchemaTypesXml/SchemaTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the ClassIdentifier class to/from XML - namespace ClassIdentifierXml { - - /// Adds the ClassIdentifierDoc into the XML. - void SCHEMATYPESXML_LINKAGE add( - const SmartPtrCClassIdentifierDoc classIdentifierDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the ClassIdentifierDoc from the XML. - SmartPtrCClassIdentifierDoc SCHEMATYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/ClassInstancePropertyXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/ClassInstancePropertyXml.h deleted file mode 100644 index 28e28ff2f..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/ClassInstancePropertyXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef ClassInstancePropertyXml_h_ -#define ClassInstancePropertyXml_h_ - - -#include "Doc/SchemaTypesDoc/CClassInstancePropertyDoc.h" - -#include "Doc/DocXml/SchemaTypesXml/SchemaTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the ClassInstanceProperty class to/from XML - namespace ClassInstancePropertyXml { - - /// Adds the ClassInstancePropertyDoc into the XML. - void SCHEMATYPESXML_LINKAGE add( - const SmartPtrCClassInstancePropertyDoc classInstancePropertyDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the ClassInstancePropertyDoc from the XML. - SmartPtrCClassInstancePropertyDoc SCHEMATYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/ClassPropertyXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/ClassPropertyXml.h deleted file mode 100644 index 022c50c33..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/ClassPropertyXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef ClassPropertyXml_h_ -#define ClassPropertyXml_h_ - - -#include "Doc/SchemaTypesDoc/CClassPropertyDoc.h" - -#include "Doc/DocXml/SchemaTypesXml/SchemaTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the ClassProperty class to/from XML - namespace ClassPropertyXml { - - /// Adds the ClassPropertyDoc into the XML. - void SCHEMATYPESXML_LINKAGE add( - const SmartPtrCClassPropertyDoc classPropertyDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the ClassPropertyDoc from the XML. - SmartPtrCClassPropertyDoc SCHEMATYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/CmdlMetadataXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/CmdlMetadataXml.h deleted file mode 100644 index 8d997852c..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/CmdlMetadataXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef CmdlMetadataXml_h_ -#define CmdlMetadataXml_h_ - - -#include "Doc/SchemaTypesDoc/CCmdlMetadataDoc.h" - -#include "Doc/DocXml/SchemaTypesXml/SchemaTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the CmdlMetadata class to/from XML - namespace CmdlMetadataXml { - - /// Adds the CmdlMetadataDoc into the XML. - void SCHEMATYPESXML_LINKAGE add( - const SmartPtrCCmdlMetadataDoc cmdlMetadataDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the CmdlMetadataDoc from the XML. - SmartPtrCCmdlMetadataDoc SCHEMATYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/CmdlUnionXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/CmdlUnionXml.h deleted file mode 100644 index 0488cba9c..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/CmdlUnionXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef CmdlUnionXml_h_ -#define CmdlUnionXml_h_ - - -#include "Doc/SchemaTypesDoc/CCmdlUnionDoc.h" - -#include "Doc/DocXml/SchemaTypesXml/SchemaTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the CmdlUnion class to/from XML - namespace CmdlUnionXml { - - /// Adds the CmdlUnionDoc into the XML. - void SCHEMATYPESXML_LINKAGE add( - const SmartPtrCCmdlUnionDoc cmdlUnionDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the CmdlUnionDoc from the XML. - SmartPtrCCmdlUnionDoc SCHEMATYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/CollectMethodXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/CollectMethodXml.h deleted file mode 100644 index 1e8581ad6..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/CollectMethodXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef CollectMethodXml_h_ -#define CollectMethodXml_h_ - - -#include "Doc/SchemaTypesDoc/CCollectMethodDoc.h" - -#include "Doc/DocXml/SchemaTypesXml/SchemaTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the CollectMethod class to/from XML - namespace CollectMethodXml { - - /// Adds the CollectMethodDoc into the XML. - void SCHEMATYPESXML_LINKAGE add( - const SmartPtrCCollectMethodDoc collectMethodDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the CollectMethodDoc from the XML. - SmartPtrCCollectMethodDoc SCHEMATYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/DataClassInstanceCollectionXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/DataClassInstanceCollectionXml.h deleted file mode 100644 index 8d4c31e44..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/DataClassInstanceCollectionXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef DataClassInstanceCollectionXml_h_ -#define DataClassInstanceCollectionXml_h_ - - -#include "Doc/SchemaTypesDoc/CDataClassInstanceCollectionDoc.h" - -#include "Doc/DocXml/SchemaTypesXml/SchemaTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the DataClassInstanceCollection class to/from XML - namespace DataClassInstanceCollectionXml { - - /// Adds the DataClassInstanceCollectionDoc into the XML. - void SCHEMATYPESXML_LINKAGE add( - const SmartPtrCDataClassInstanceCollectionDoc dataClassInstanceCollectionDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the DataClassInstanceCollectionDoc from the XML. - SmartPtrCDataClassInstanceCollectionDoc SCHEMATYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/DataClassInstanceXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/DataClassInstanceXml.h deleted file mode 100644 index 3e5110084..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/DataClassInstanceXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef DataClassInstanceXml_h_ -#define DataClassInstanceXml_h_ - - -#include "Doc/SchemaTypesDoc/CDataClassInstanceDoc.h" - -#include "Doc/DocXml/SchemaTypesXml/SchemaTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the DataClassInstance class to/from XML - namespace DataClassInstanceXml { - - /// Adds the DataClassInstanceDoc into the XML. - void SCHEMATYPESXML_LINKAGE add( - const SmartPtrCDataClassInstanceDoc dataClassInstanceDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the DataClassInstanceDoc from the XML. - SmartPtrCDataClassInstanceDoc SCHEMATYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/DataClassPropertyXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/DataClassPropertyXml.h deleted file mode 100644 index 670f6b87d..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/DataClassPropertyXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef DataClassPropertyXml_h_ -#define DataClassPropertyXml_h_ - - -#include "Doc/SchemaTypesDoc/CDataClassPropertyDoc.h" - -#include "Doc/DocXml/SchemaTypesXml/SchemaTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the DataClassProperty class to/from XML - namespace DataClassPropertyXml { - - /// Adds the DataClassPropertyDoc into the XML. - void SCHEMATYPESXML_LINKAGE add( - const SmartPtrCDataClassPropertyDoc dataClassPropertyDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the DataClassPropertyDoc from the XML. - SmartPtrCDataClassPropertyDoc SCHEMATYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/DataClassSubInstanceXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/DataClassSubInstanceXml.h deleted file mode 100644 index 6bd2eeb2d..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/DataClassSubInstanceXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef DataClassSubInstanceXml_h_ -#define DataClassSubInstanceXml_h_ - - -#include "Doc/SchemaTypesDoc/CDataClassSubInstanceDoc.h" - -#include "Doc/DocXml/SchemaTypesXml/SchemaTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the DataClassSubInstance class to/from XML - namespace DataClassSubInstanceXml { - - /// Adds the DataClassSubInstanceDoc into the XML. - void SCHEMATYPESXML_LINKAGE add( - const SmartPtrCDataClassSubInstanceDoc dataClassSubInstanceDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the DataClassSubInstanceDoc from the XML. - SmartPtrCDataClassSubInstanceDoc SCHEMATYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/DataClassXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/DataClassXml.h deleted file mode 100644 index beedd07ed..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/DataClassXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef DataClassXml_h_ -#define DataClassXml_h_ - - -#include "Doc/SchemaTypesDoc/CDataClassDoc.h" - -#include "Doc/DocXml/SchemaTypesXml/SchemaTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the DataClass class to/from XML - namespace DataClassXml { - - /// Adds the DataClassDoc into the XML. - void SCHEMATYPESXML_LINKAGE add( - const SmartPtrCDataClassDoc dataClassDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the DataClassDoc from the XML. - SmartPtrCDataClassDoc SCHEMATYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/InstanceOperationCollectionXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/InstanceOperationCollectionXml.h deleted file mode 100644 index 8ee07a676..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/InstanceOperationCollectionXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef InstanceOperationCollectionXml_h_ -#define InstanceOperationCollectionXml_h_ - - -#include "Doc/SchemaTypesDoc/CInstanceOperationCollectionDoc.h" - -#include "Doc/DocXml/SchemaTypesXml/SchemaTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the InstanceOperationCollection class to/from XML - namespace InstanceOperationCollectionXml { - - /// Adds the InstanceOperationCollectionDoc into the XML. - void SCHEMATYPESXML_LINKAGE add( - const SmartPtrCInstanceOperationCollectionDoc instanceOperationCollectionDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the InstanceOperationCollectionDoc from the XML. - SmartPtrCInstanceOperationCollectionDoc SCHEMATYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/InstanceOperationXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/InstanceOperationXml.h deleted file mode 100644 index 2b446ee26..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/InstanceOperationXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef InstanceOperationXml_h_ -#define InstanceOperationXml_h_ - - -#include "Doc/SchemaTypesDoc/CInstanceOperationDoc.h" - -#include "Doc/DocXml/SchemaTypesXml/SchemaTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the InstanceOperation class to/from XML - namespace InstanceOperationXml { - - /// Adds the InstanceOperationDoc into the XML. - void SCHEMATYPESXML_LINKAGE add( - const SmartPtrCInstanceOperationDoc instanceOperationDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the InstanceOperationDoc from the XML. - SmartPtrCInstanceOperationDoc SCHEMATYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/InstanceParameterXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/InstanceParameterXml.h deleted file mode 100644 index 1d54c6fa3..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/InstanceParameterXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef InstanceParameterXml_h_ -#define InstanceParameterXml_h_ - - -#include "Doc/SchemaTypesDoc/CInstanceParameterDoc.h" - -#include "Doc/DocXml/SchemaTypesXml/SchemaTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the InstanceParameter class to/from XML - namespace InstanceParameterXml { - - /// Adds the InstanceParameterDoc into the XML. - void SCHEMATYPESXML_LINKAGE add( - const SmartPtrCInstanceParameterDoc instanceParameterDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the InstanceParameterDoc from the XML. - SmartPtrCInstanceParameterDoc SCHEMATYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/JoinTypeXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/JoinTypeXml.h deleted file mode 100644 index d3cdfa484..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/JoinTypeXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef JoinTypeXml_h_ -#define JoinTypeXml_h_ - - -#include "Doc/SchemaTypesDoc/CJoinTypeDoc.h" - -#include "Doc/DocXml/SchemaTypesXml/SchemaTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the JoinType class to/from XML - namespace JoinTypeXml { - - /// Adds the JoinTypeDoc into the XML. - void SCHEMATYPESXML_LINKAGE add( - const SmartPtrCJoinTypeDoc joinTypeDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the JoinTypeDoc from the XML. - SmartPtrCJoinTypeDoc SCHEMATYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/LogicalRelationshipXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/LogicalRelationshipXml.h deleted file mode 100644 index 64b2886bd..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/LogicalRelationshipXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef LogicalRelationshipXml_h_ -#define LogicalRelationshipXml_h_ - - -#include "Doc/SchemaTypesDoc/CLogicalRelationshipDoc.h" - -#include "Doc/DocXml/SchemaTypesXml/SchemaTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the LogicalRelationship class to/from XML - namespace LogicalRelationshipXml { - - /// Adds the LogicalRelationshipDoc into the XML. - void SCHEMATYPESXML_LINKAGE add( - const SmartPtrCLogicalRelationshipDoc logicalRelationshipDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the LogicalRelationshipDoc from the XML. - SmartPtrCLogicalRelationshipDoc SCHEMATYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/MethodParameterXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/MethodParameterXml.h deleted file mode 100644 index a0230faf3..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/MethodParameterXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef MethodParameterXml_h_ -#define MethodParameterXml_h_ - - -#include "Doc/SchemaTypesDoc/CMethodParameterDoc.h" - -#include "Doc/DocXml/SchemaTypesXml/SchemaTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the MethodParameter class to/from XML - namespace MethodParameterXml { - - /// Adds the MethodParameterDoc into the XML. - void SCHEMATYPESXML_LINKAGE add( - const SmartPtrCMethodParameterDoc methodParameterDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the MethodParameterDoc from the XML. - SmartPtrCMethodParameterDoc SCHEMATYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/MethodXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/MethodXml.h deleted file mode 100644 index 15e72bdd0..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/MethodXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef MethodXml_h_ -#define MethodXml_h_ - - -#include "Doc/SchemaTypesDoc/CMethodDoc.h" - -#include "Doc/DocXml/SchemaTypesXml/SchemaTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the Method class to/from XML - namespace MethodXml { - - /// Adds the MethodDoc into the XML. - void SCHEMATYPESXML_LINKAGE add( - const SmartPtrCMethodDoc methodDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the MethodDoc from the XML. - SmartPtrCMethodDoc SCHEMATYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/PhysicalRelationshipXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/PhysicalRelationshipXml.h deleted file mode 100644 index 838f7eda0..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/PhysicalRelationshipXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef PhysicalRelationshipXml_h_ -#define PhysicalRelationshipXml_h_ - - -#include "Doc/SchemaTypesDoc/CPhysicalRelationshipDoc.h" - -#include "Doc/DocXml/SchemaTypesXml/SchemaTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the PhysicalRelationship class to/from XML - namespace PhysicalRelationshipXml { - - /// Adds the PhysicalRelationshipDoc into the XML. - void SCHEMATYPESXML_LINKAGE add( - const SmartPtrCPhysicalRelationshipDoc physicalRelationshipDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the PhysicalRelationshipDoc from the XML. - SmartPtrCPhysicalRelationshipDoc SCHEMATYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/RelationshipXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/RelationshipXml.h deleted file mode 100644 index 02003b980..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/RelationshipXml.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef RelationshipXml_h_ -#define RelationshipXml_h_ - - -#include "Doc/SchemaTypesDoc/CRelationshipDoc.h" - -#include "Doc/DocXml/SchemaTypesXml/SchemaTypesXmlLink.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - - /// Streams the Relationship class to/from XML - namespace RelationshipXml { - - /// Adds the RelationshipDoc into the XML. - void SCHEMATYPESXML_LINKAGE add( - const SmartPtrCRelationshipDoc relationshipDoc, - const SmartPtrCXmlElement thisXml); - - /// Parses the RelationshipDoc from the XML. - SmartPtrCRelationshipDoc SCHEMATYPESXML_LINKAGE parse( - const SmartPtrCXmlElement thisXml); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/SchemaTypesXmlLink.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/SchemaTypesXmlLink.h deleted file mode 100644 index 36374c5ac..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/DocXml/SchemaTypesXml/SchemaTypesXmlLink.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef SchemaTypesXml_Link_h_ -#define SchemaTypesXml_Link_h_ - -#ifndef SCHEMATYPESXML_LINKAGE - #ifdef WIN32 - #ifdef FRAMEWORK_BUILD - #define SCHEMATYPESXML_LINKAGE __declspec(dllexport) - #else - #define SCHEMATYPESXML_LINKAGE __declspec(dllimport) - #endif - #else - #define SCHEMATYPESXML_LINKAGE - #endif -#endif - - -#endif /* SchemaTypesXml_Link_h_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/MgmtRequestDoc/CMgmtRequestDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/MgmtRequestDoc/CMgmtRequestDoc.h deleted file mode 100644 index c86b7bce5..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/MgmtRequestDoc/CMgmtRequestDoc.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CMgmtRequestDoc_h_ -#define CMgmtRequestDoc_h_ - - -#include "Doc/CafCoreTypesDoc/CAttachmentCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CRequestHeaderDoc.h" -#include "Doc/MgmtTypesDoc/CMgmtBatchDoc.h" - -namespace Caf { - -/// A simple container for objects of type MgmtRequest -class MGMTREQUESTDOC_LINKAGE CMgmtRequestDoc { -public: - CMgmtRequestDoc(); - virtual ~CMgmtRequestDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const UUID clientId, - const UUID requestId, - const std::string pmeId, - const SmartPtrCRequestHeaderDoc requestHeader, - const SmartPtrCMgmtBatchDoc batch, - const SmartPtrCAttachmentCollectionDoc attachmentCollection); - -public: - /// Accessor for the ClientId - UUID getClientId() const; - - /// Accessor for the RequestId - UUID getRequestId() const; - - /// Accessor for the PmeId - std::string getPmeId() const; - - /// Accessor for the RequestHeader - SmartPtrCRequestHeaderDoc getRequestHeader() const; - - /// Accessor for the Batch - SmartPtrCMgmtBatchDoc getBatch() const; - - /// Accessor for the AttachmentCollection - SmartPtrCAttachmentCollectionDoc getAttachmentCollection() const; - -private: - UUID _clientId; - UUID _requestId; - std::string _pmeId; - SmartPtrCRequestHeaderDoc _requestHeader; - SmartPtrCMgmtBatchDoc _batch; - SmartPtrCAttachmentCollectionDoc _attachmentCollection; - bool _isInitialized; - -private: - CAF_CM_DECLARE_NOCOPY(CMgmtRequestDoc); -}; - -CAF_DECLARE_SMART_POINTER(CMgmtRequestDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/MgmtRequestDoc/MgmtRequestDocLink.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/MgmtRequestDoc/MgmtRequestDocLink.h deleted file mode 100644 index 069a8b579..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/MgmtRequestDoc/MgmtRequestDocLink.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Author: bwilliams - * Created: February 25, 2016 - * - * Copyright (C) 2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#ifndef MgmtRequestDoc_Link_h_ -#define MgmtRequestDoc_Link_h_ - -#ifndef MGMTREQUESTDOC_LINKAGE - #ifdef WIN32 - #ifdef FRAMEWORK_BUILD - #define MGMTREQUESTDOC_LINKAGE __declspec(dllexport) - #else - #define MGMTREQUESTDOC_LINKAGE __declspec(dllimport) - #endif - #else - #define MGMTREQUESTDOC_LINKAGE - #endif -#endif - - -#endif /* MgmtRequestDoc_Link_h_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/MgmtTypesDoc/CMgmtBatchDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/MgmtTypesDoc/CMgmtBatchDoc.h deleted file mode 100644 index 76ca16a80..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/MgmtTypesDoc/CMgmtBatchDoc.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CMgmtBatchDoc_h_ -#define CMgmtBatchDoc_h_ - - -#include "Doc/MgmtTypesDoc/CMgmtCollectInstancesCollectionDoc.h" -#include "Doc/MgmtTypesDoc/CMgmtCollectSchemaDoc.h" -#include "Doc/MgmtTypesDoc/CMgmtInvokeOperationCollectionDoc.h" - -namespace Caf { - -/// A simple container for objects of type MgmtBatch -class MGMTTYPESDOC_LINKAGE CMgmtBatchDoc { -public: - CMgmtBatchDoc(); - virtual ~CMgmtBatchDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const SmartPtrCMgmtCollectSchemaDoc collectSchema, - const SmartPtrCMgmtCollectInstancesCollectionDoc collectInstancesCollection, - const SmartPtrCMgmtInvokeOperationCollectionDoc invokeOperationCollection); - -public: - /// Accessor for the CollectSchema - SmartPtrCMgmtCollectSchemaDoc getCollectSchema() const; - - /// Accessor for the CollectInstancesCollection - SmartPtrCMgmtCollectInstancesCollectionDoc getCollectInstancesCollection() const; - - /// Accessor for the InvokeOperationCollection - SmartPtrCMgmtInvokeOperationCollectionDoc getInvokeOperationCollection() const; - -private: - bool _isInitialized; - - SmartPtrCMgmtCollectSchemaDoc _collectSchema; - SmartPtrCMgmtCollectInstancesCollectionDoc _collectInstancesCollection; - SmartPtrCMgmtInvokeOperationCollectionDoc _invokeOperationCollection; - -private: - CAF_CM_DECLARE_NOCOPY(CMgmtBatchDoc); -}; - -CAF_DECLARE_SMART_POINTER(CMgmtBatchDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/MgmtTypesDoc/CMgmtCollectInstancesCollectionDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/MgmtTypesDoc/CMgmtCollectInstancesCollectionDoc.h deleted file mode 100644 index 3544ca4c0..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/MgmtTypesDoc/CMgmtCollectInstancesCollectionDoc.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CMgmtCollectInstancesCollectionDoc_h_ -#define CMgmtCollectInstancesCollectionDoc_h_ - - -#include "Doc/MgmtTypesDoc/CMgmtCollectInstancesDoc.h" - -namespace Caf { - -/// A simple container for objects of type MgmtCollectInstancesCollection -class MGMTTYPESDOC_LINKAGE CMgmtCollectInstancesCollectionDoc { -public: - CMgmtCollectInstancesCollectionDoc(); - virtual ~CMgmtCollectInstancesCollectionDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::deque collectInstancesCollection); - -public: - /// Accessor for the CollectInstances - std::deque getCollectInstancesCollection() const; - -private: - bool _isInitialized; - - std::deque _collectInstancesCollection; - -private: - CAF_CM_DECLARE_NOCOPY(CMgmtCollectInstancesCollectionDoc); -}; - -CAF_DECLARE_SMART_POINTER(CMgmtCollectInstancesCollectionDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/MgmtTypesDoc/CMgmtCollectInstancesDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/MgmtTypesDoc/CMgmtCollectInstancesDoc.h deleted file mode 100644 index a70a50178..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/MgmtTypesDoc/CMgmtCollectInstancesDoc.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CMgmtCollectInstancesDoc_h_ -#define CMgmtCollectInstancesDoc_h_ - - -#include "Doc/CafCoreTypesDoc/CClassSpecifierDoc.h" -#include "Doc/CafCoreTypesDoc/CParameterCollectionDoc.h" - -namespace Caf { - -/// A simple container for objects of type MgmtCollectInstances -class MGMTTYPESDOC_LINKAGE CMgmtCollectInstancesDoc { -public: - CMgmtCollectInstancesDoc(); - virtual ~CMgmtCollectInstancesDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const UUID jobId, - const SmartPtrCClassSpecifierDoc classSpecifier, - const SmartPtrCParameterCollectionDoc parameterCollection); - -public: - /// Accessor for the JobId - UUID getJobId() const; - - /// Accessor for the ClassSpecifier - SmartPtrCClassSpecifierDoc getClassSpecifier() const; - - /// Accessor for the ParameterCollection - SmartPtrCParameterCollectionDoc getParameterCollection() const; - -private: - UUID _jobId; - SmartPtrCClassSpecifierDoc _classSpecifier; - SmartPtrCParameterCollectionDoc _parameterCollection; - bool _isInitialized; - -private: - CAF_CM_DECLARE_NOCOPY(CMgmtCollectInstancesDoc); -}; - -CAF_DECLARE_SMART_POINTER(CMgmtCollectInstancesDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/MgmtTypesDoc/CMgmtCollectSchemaDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/MgmtTypesDoc/CMgmtCollectSchemaDoc.h deleted file mode 100644 index 74fd5c020..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/MgmtTypesDoc/CMgmtCollectSchemaDoc.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CMgmtCollectSchemaDoc_h_ -#define CMgmtCollectSchemaDoc_h_ - -namespace Caf { - -/// A simple container for objects of type MgmtCollectSchema -class MGMTTYPESDOC_LINKAGE CMgmtCollectSchemaDoc { -public: - CMgmtCollectSchemaDoc(); - virtual ~CMgmtCollectSchemaDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const UUID jobId); - -public: - /// Accessor for the JobId - UUID getJobId() const; - -private: - UUID _jobId; - bool _isInitialized; - -private: - CAF_CM_DECLARE_NOCOPY(CMgmtCollectSchemaDoc); -}; - -CAF_DECLARE_SMART_POINTER(CMgmtCollectSchemaDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/MgmtTypesDoc/CMgmtInvokeOperationCollectionDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/MgmtTypesDoc/CMgmtInvokeOperationCollectionDoc.h deleted file mode 100644 index 25c7b85a3..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/MgmtTypesDoc/CMgmtInvokeOperationCollectionDoc.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CMgmtInvokeOperationCollectionDoc_h_ -#define CMgmtInvokeOperationCollectionDoc_h_ - - -#include "Doc/MgmtTypesDoc/CMgmtInvokeOperationDoc.h" - -namespace Caf { - -/// A simple container for objects of type MgmtInvokeOperationCollection -class MGMTTYPESDOC_LINKAGE CMgmtInvokeOperationCollectionDoc { -public: - CMgmtInvokeOperationCollectionDoc(); - virtual ~CMgmtInvokeOperationCollectionDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::deque invokeOperationCollection); - -public: - /// Accessor for the InvokeOperation - std::deque getInvokeOperationCollection() const; - -private: - bool _isInitialized; - - std::deque _invokeOperationCollection; - -private: - CAF_CM_DECLARE_NOCOPY(CMgmtInvokeOperationCollectionDoc); -}; - -CAF_DECLARE_SMART_POINTER(CMgmtInvokeOperationCollectionDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/MgmtTypesDoc/CMgmtInvokeOperationDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/MgmtTypesDoc/CMgmtInvokeOperationDoc.h deleted file mode 100644 index e03325d8c..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/MgmtTypesDoc/CMgmtInvokeOperationDoc.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CMgmtInvokeOperationDoc_h_ -#define CMgmtInvokeOperationDoc_h_ - - -#include "Doc/CafCoreTypesDoc/CClassSpecifierDoc.h" -#include "Doc/CafCoreTypesDoc/COperationDoc.h" - -namespace Caf { - -/// A simple container for objects of type MgmtInvokeOperation -class MGMTTYPESDOC_LINKAGE CMgmtInvokeOperationDoc { -public: - CMgmtInvokeOperationDoc(); - virtual ~CMgmtInvokeOperationDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const UUID jobId, - const SmartPtrCClassSpecifierDoc classSpecifier, - const SmartPtrCOperationDoc operation); - -public: - /// Accessor for the JobId - UUID getJobId() const; - - /// Accessor for the ClassSpecifier - SmartPtrCClassSpecifierDoc getClassSpecifier() const; - - /// Accessor for the Operation - SmartPtrCOperationDoc getOperation() const; - -private: - UUID _jobId; - SmartPtrCClassSpecifierDoc _classSpecifier; - SmartPtrCOperationDoc _operation; - bool _isInitialized; - -private: - CAF_CM_DECLARE_NOCOPY(CMgmtInvokeOperationDoc); -}; - -CAF_DECLARE_SMART_POINTER(CMgmtInvokeOperationDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/MgmtTypesDoc/MgmtTypesDocLink.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/MgmtTypesDoc/MgmtTypesDocLink.h deleted file mode 100644 index 1bcd3e3f8..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/MgmtTypesDoc/MgmtTypesDocLink.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Author: bwilliams - * Created: February 25, 2016 - * - * Copyright (C) 2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#ifndef MgmtTypesDoc_Link_h_ -#define MgmtTypesDoc_Link_h_ - -#ifndef MGMTTYPESDOC_LINKAGE - #ifdef WIN32 - #ifdef FRAMEWORK_BUILD - #define MGMTTYPESDOC_LINKAGE __declspec(dllexport) - #else - #define MGMTTYPESDOC_LINKAGE __declspec(dllimport) - #endif - #else - #define MGMTTYPESDOC_LINKAGE - #endif -#endif - - -#endif /* MgmtTypesDoc_Link_h_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/MultiPmeMgmtRequestDoc/CMultiPmeMgmtBatchCollectionDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/MultiPmeMgmtRequestDoc/CMultiPmeMgmtBatchCollectionDoc.h deleted file mode 100644 index a22398bdc..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/MultiPmeMgmtRequestDoc/CMultiPmeMgmtBatchCollectionDoc.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CMultiPmeMgmtBatchCollectionDoc_h_ -#define CMultiPmeMgmtBatchCollectionDoc_h_ - - -#include "Doc/MultiPmeMgmtRequestDoc/CMultiPmeMgmtBatchDoc.h" - -namespace Caf { - -/// A simple container for objects of type MultiPmeMgmtBatchCollection -class MULTIPMEMGMTREQUESTDOC_LINKAGE CMultiPmeMgmtBatchCollectionDoc { -public: - CMultiPmeMgmtBatchCollectionDoc(); - virtual ~CMultiPmeMgmtBatchCollectionDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::deque multiPmeBatch); - -public: - /// Accessor for the MultiPmeBatch - std::deque getMultiPmeBatch() const; - -private: - bool _isInitialized; - - std::deque _multiPmeBatch; - -private: - CAF_CM_DECLARE_NOCOPY(CMultiPmeMgmtBatchCollectionDoc); -}; - -CAF_DECLARE_SMART_POINTER(CMultiPmeMgmtBatchCollectionDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/MultiPmeMgmtRequestDoc/CMultiPmeMgmtBatchDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/MultiPmeMgmtRequestDoc/CMultiPmeMgmtBatchDoc.h deleted file mode 100644 index 252daef4e..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/MultiPmeMgmtRequestDoc/CMultiPmeMgmtBatchDoc.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CMultiPmeMgmtBatchDoc_h_ -#define CMultiPmeMgmtBatchDoc_h_ - - -#include "Doc/MgmtTypesDoc/CMgmtBatchDoc.h" -#include "Doc/MultiPmeMgmtRequestDoc/CPmeIdCollectionDoc.h" - -namespace Caf { - -/// A simple container for objects of type MultiPmeMgmtBatch -class MULTIPMEMGMTREQUESTDOC_LINKAGE CMultiPmeMgmtBatchDoc { -public: - CMultiPmeMgmtBatchDoc(); - virtual ~CMultiPmeMgmtBatchDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const SmartPtrCPmeIdCollectionDoc pmeIdCollection, - const SmartPtrCMgmtBatchDoc batch); - -public: - /// Accessor for the PmeIdCollection - SmartPtrCPmeIdCollectionDoc getPmeIdCollection() const; - - /// Accessor for the Batch - SmartPtrCMgmtBatchDoc getBatch() const; - -private: - bool _isInitialized; - - SmartPtrCPmeIdCollectionDoc _pmeIdCollection; - SmartPtrCMgmtBatchDoc _batch; - -private: - CAF_CM_DECLARE_NOCOPY(CMultiPmeMgmtBatchDoc); -}; - -CAF_DECLARE_SMART_POINTER(CMultiPmeMgmtBatchDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/MultiPmeMgmtRequestDoc/CMultiPmeMgmtRequestDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/MultiPmeMgmtRequestDoc/CMultiPmeMgmtRequestDoc.h deleted file mode 100644 index 1211d3dc9..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/MultiPmeMgmtRequestDoc/CMultiPmeMgmtRequestDoc.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CMultiPmeMgmtRequestDoc_h_ -#define CMultiPmeMgmtRequestDoc_h_ - - -#include "Doc/CafCoreTypesDoc/CRequestHeaderDoc.h" -#include "Doc/MultiPmeMgmtRequestDoc/CMultiPmeMgmtBatchCollectionDoc.h" - -namespace Caf { - -/// A simple container for objects of type MultiPmeMgmtRequest -class MULTIPMEMGMTREQUESTDOC_LINKAGE CMultiPmeMgmtRequestDoc { -public: - CMultiPmeMgmtRequestDoc(); - virtual ~CMultiPmeMgmtRequestDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const UUID clientId, - const UUID requestId, - const SmartPtrCRequestHeaderDoc requestHeader, - const SmartPtrCMultiPmeMgmtBatchCollectionDoc multiPmeBatchCollection); - -public: - /// Accessor for the ClientId - UUID getClientId() const; - - /// Accessor for the RequestId - UUID getRequestId() const; - - /// Accessor for the RequestHeader - SmartPtrCRequestHeaderDoc getRequestHeader() const; - - /// Accessor for the MultiPmeBatchCollection - SmartPtrCMultiPmeMgmtBatchCollectionDoc getMultiPmeBatchCollection() const; - -private: - UUID _clientId; - UUID _requestId; - SmartPtrCRequestHeaderDoc _requestHeader; - SmartPtrCMultiPmeMgmtBatchCollectionDoc _multiPmeBatchCollection; - bool _isInitialized; - -private: - CAF_CM_DECLARE_NOCOPY(CMultiPmeMgmtRequestDoc); -}; - -CAF_DECLARE_SMART_POINTER(CMultiPmeMgmtRequestDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/MultiPmeMgmtRequestDoc/CPmeIdCollectionDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/MultiPmeMgmtRequestDoc/CPmeIdCollectionDoc.h deleted file mode 100644 index cec3188da..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/MultiPmeMgmtRequestDoc/CPmeIdCollectionDoc.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CPmeIdCollectionDoc_h_ -#define CPmeIdCollectionDoc_h_ - -namespace Caf { - -/// A simple container for objects of type PmeIdCollection -class MULTIPMEMGMTREQUESTDOC_LINKAGE CPmeIdCollectionDoc { -public: - CPmeIdCollectionDoc(); - virtual ~CPmeIdCollectionDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::deque pmeIdCollection); - -public: - /// Accessor for the PmeId - std::deque getPmeIdCollection() const; - -private: - bool _isInitialized; - - std::deque _pmeIdCollection; - -private: - CAF_CM_DECLARE_NOCOPY(CPmeIdCollectionDoc); -}; - -CAF_DECLARE_SMART_POINTER(CPmeIdCollectionDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/MultiPmeMgmtRequestDoc/MultiPmeMgmtRequestDocLink.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/MultiPmeMgmtRequestDoc/MultiPmeMgmtRequestDocLink.h deleted file mode 100644 index c0d62af69..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/MultiPmeMgmtRequestDoc/MultiPmeMgmtRequestDocLink.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Author: bwilliams - * Created: February 25, 2016 - * - * Copyright (C) 2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#ifndef MultiPmeMgmtRequestDoc_Link_h_ -#define MultiPmeMgmtRequestDoc_Link_h_ - -#ifndef MULTIPMEMGMTREQUESTDOC_LINKAGE - #ifdef WIN32 - #ifdef FRAMEWORK_BUILD - #define MULTIPMEMGMTREQUESTDOC_LINKAGE __declspec(dllexport) - #else - #define MULTIPMEMGMTREQUESTDOC_LINKAGE __declspec(dllimport) - #endif - #else - #define MULTIPMEMGMTREQUESTDOC_LINKAGE - #endif -#endif - - -#endif /* MultiPmeMgmtRequestDoc_Link_h_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/PayloadEnvelopeDoc/CPayloadEnvelopeDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/PayloadEnvelopeDoc/CPayloadEnvelopeDoc.h deleted file mode 100644 index 2f3a145eb..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/PayloadEnvelopeDoc/CPayloadEnvelopeDoc.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Author: bwilliams - * Created: July 3, 2015 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#ifndef CPayloadEnvelopeDoc_h_ -#define CPayloadEnvelopeDoc_h_ - - -#include "Doc/CafCoreTypesDoc/CAttachmentCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CPropertyCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CProtocolCollectionDoc.h" - -namespace Caf { - -/// A simple container for objects of type PayloadEnvelope -class PAYLOADENVELOPEDOC_LINKAGE CPayloadEnvelopeDoc { -public: - CPayloadEnvelopeDoc(); - virtual ~CPayloadEnvelopeDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const UUID& clientId, - const UUID& requestId, - const std::string& pmeId, - const std::string& payloadType, - const std::string& payloadVersion, - const SmartPtrCAttachmentCollectionDoc& attachmentCollection, - const SmartPtrCProtocolCollectionDoc& protocolCollection = SmartPtrCProtocolCollectionDoc(), - const SmartPtrCPropertyCollectionDoc& headerCollection = SmartPtrCPropertyCollectionDoc(), - const std::string version = "1.0"); - -public: - /// Accessor for the ClientId - UUID getClientId() const; - - /// Accessor for the RequestId - UUID getRequestId() const; - - /// Accessor for the PmeId - std::string getPmeId() const; - - /// Accessor for the PayloadType - std::string getPayloadType() const; - - /// Accessor for the PayloadVersion - std::string getPayloadVersion() const; - - /// Accessor for the Protocol Collection - SmartPtrCProtocolCollectionDoc getProtocolCollection() const; - - /// Accessor for the AttachmentCollection - SmartPtrCAttachmentCollectionDoc getAttachmentCollection() const; - - /// Accessor for the Headers - SmartPtrCPropertyCollectionDoc getHeaderCollection() const; - - /// Accessor for the version - std::string getVersion() const; - -private: - UUID _clientId; - UUID _requestId; - std::string _pmeId; - std::string _payloadType; - std::string _payloadVersion; - SmartPtrCAttachmentCollectionDoc _attachmentCollection; - SmartPtrCProtocolCollectionDoc _protocolCollection; - SmartPtrCPropertyCollectionDoc _headerCollection; - std::string _version; - bool _isInitialized; - -private: - CAF_CM_DECLARE_NOCOPY(CPayloadEnvelopeDoc); -}; - -CAF_DECLARE_SMART_POINTER(CPayloadEnvelopeDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/PayloadEnvelopeDoc/PayloadEnvelopeDocLink.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/PayloadEnvelopeDoc/PayloadEnvelopeDocLink.h deleted file mode 100644 index f75aed98b..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/PayloadEnvelopeDoc/PayloadEnvelopeDocLink.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Author: bwilliams - * Created: February 25, 2016 - * - * Copyright (C) 2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#ifndef PayloadEnvelopeDoc_Link_h_ -#define PayloadEnvelopeDoc_Link_h_ - -#ifndef PAYLOADENVELOPEDOC_LINKAGE - #ifdef WIN32 - #ifdef FRAMEWORK_BUILD - #define PAYLOADENVELOPEDOC_LINKAGE __declspec(dllexport) - #else - #define PAYLOADENVELOPEDOC_LINKAGE __declspec(dllimport) - #endif - #else - #define PAYLOADENVELOPEDOC_LINKAGE - #endif -#endif - - -#endif /* PayloadEnvelopeDoc_Link_h_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/PersistenceDoc/CCertCollectionDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/PersistenceDoc/CCertCollectionDoc.h deleted file mode 100644 index fa34c7982..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/PersistenceDoc/CCertCollectionDoc.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CCertCollectionDoc_h_ -#define CCertCollectionDoc_h_ - -namespace Caf { - -/// A simple container for objects of type CertCollection -class PERSISTENCEDOC_LINKAGE CCertCollectionDoc { -public: - CCertCollectionDoc(); - virtual ~CCertCollectionDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::deque certCollection = std::deque()); - -public: - /// Accessor for the Cert - std::deque getCert() const; - -private: - bool _isInitialized; - - std::deque _certCollection; - -private: - CAF_CM_DECLARE_NOCOPY(CCertCollectionDoc); -}; - -CAF_DECLARE_SMART_POINTER(CCertCollectionDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/PersistenceDoc/CCertPathCollectionDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/PersistenceDoc/CCertPathCollectionDoc.h deleted file mode 100644 index 6f43ac105..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/PersistenceDoc/CCertPathCollectionDoc.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CCertPathCollectionDoc_h_ -#define CCertPathCollectionDoc_h_ - -namespace Caf { - -/// A simple container for objects of type CertPathCollection -class PERSISTENCEDOC_LINKAGE CCertPathCollectionDoc { -public: - CCertPathCollectionDoc(); - virtual ~CCertPathCollectionDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::deque certPathCollection = std::deque()); - -public: - /// Accessor for the Cert - std::deque getCertPath() const; - -private: - bool _isInitialized; - - std::deque _certPathCollection; - -private: - CAF_CM_DECLARE_NOCOPY(CCertPathCollectionDoc); -}; - -CAF_DECLARE_SMART_POINTER(CCertPathCollectionDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/PersistenceDoc/CLocalSecurityDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/PersistenceDoc/CLocalSecurityDoc.h deleted file mode 100644 index c69384311..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/PersistenceDoc/CLocalSecurityDoc.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Author: bwilliams - * Created: Nov 16, 2015 - * - * Copyright (C) 2015-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#ifndef CLocalSecurityDoc_h_ -#define CLocalSecurityDoc_h_ - -namespace Caf { - -/// A simple container for objects of type CLocalSecurityDoc -class PERSISTENCEDOC_LINKAGE CLocalSecurityDoc { -public: - CLocalSecurityDoc(); - virtual ~CLocalSecurityDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::string& localId = std::string(), - const std::string& privateKey = std::string(), - const std::string& cert = std::string(), - const std::string& privateKeyPath = std::string(), - const std::string& certPath = std::string()); - -public: - /// Accessor for the LocalId - std::string getLocalId() const; - - /// Accessor for the PrivateKey - std::string getPrivateKey() const; - - /// Accessor for the Cert - std::string getCert() const; - - /// Accessor for the PrivateKeyPath - std::string getPrivateKeyPath() const; - - /// Accessor for the CertPath - std::string getCertPath() const; - -private: - std::string _localId; - std::string _privateKey; - std::string _cert; - - std::string _privateKeyPath; - std::string _certPath; - - bool _isInitialized; - -private: - CAF_CM_DECLARE_NOCOPY(CLocalSecurityDoc); -}; - -CAF_DECLARE_SMART_POINTER(CLocalSecurityDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/PersistenceDoc/CPersistenceDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/PersistenceDoc/CPersistenceDoc.h deleted file mode 100644 index 9caed9acd..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/PersistenceDoc/CPersistenceDoc.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Author: bwilliams - * Created: Nov 16, 2015 - * - * Copyright (C) 2015-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#ifndef CPersistenceDoc_h_ -#define CPersistenceDoc_h_ - - -#include "Doc/PersistenceDoc/CLocalSecurityDoc.h" -#include "Doc/PersistenceDoc/CPersistenceProtocolCollectionDoc.h" -#include "Doc/PersistenceDoc/CRemoteSecurityCollectionDoc.h" - -namespace Caf { - -/// A simple container for objects of type PersistenceEnvelope -class PERSISTENCEDOC_LINKAGE CPersistenceDoc { -public: - CPersistenceDoc(); - virtual ~CPersistenceDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const SmartPtrCLocalSecurityDoc& localSecurity = SmartPtrCLocalSecurityDoc(), - const SmartPtrCRemoteSecurityCollectionDoc& remoteSecurityCollection = SmartPtrCRemoteSecurityCollectionDoc(), - const SmartPtrCPersistenceProtocolCollectionDoc& persistenceProtocolCollection = SmartPtrCPersistenceProtocolCollectionDoc(), - const std::string version = "1.0"); - -public: - /// Accessor for the LocalSecurity - SmartPtrCLocalSecurityDoc getLocalSecurity() const; - - /// Accessor for the Protocol Collection - SmartPtrCRemoteSecurityCollectionDoc getRemoteSecurityCollection() const; - - /// Accessor for the PersistenceProtocol - SmartPtrCPersistenceProtocolCollectionDoc getPersistenceProtocolCollection() const; - - /// Accessor for the version - std::string getVersion() const; - -private: - SmartPtrCLocalSecurityDoc _localSecurity; - SmartPtrCRemoteSecurityCollectionDoc _remoteSecurityCollection; - SmartPtrCPersistenceProtocolCollectionDoc _persistenceProtocolCollection; - std::string _version; - - bool _isInitialized; - -private: - CAF_CM_DECLARE_NOCOPY(CPersistenceDoc); -}; - -CAF_DECLARE_SMART_POINTER(CPersistenceDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/PersistenceDoc/CPersistenceProtocolCollectionDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/PersistenceDoc/CPersistenceProtocolCollectionDoc.h deleted file mode 100644 index 7548e3871..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/PersistenceDoc/CPersistenceProtocolCollectionDoc.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CPersistenceProtocolCollectionDoc_h_ -#define CPersistenceProtocolCollectionDoc_h_ - - -#include "Doc/PersistenceDoc/CPersistenceProtocolDoc.h" - -namespace Caf { - -/// A simple container for objects of type PersistenceProtocolCollection -class PERSISTENCEDOC_LINKAGE CPersistenceProtocolCollectionDoc { -public: - CPersistenceProtocolCollectionDoc(); - virtual ~CPersistenceProtocolCollectionDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::deque persistenceProtocol = std::deque()); - -public: - /// Accessor for the PersistenceProtocol - std::deque getPersistenceProtocol() const; - -private: - bool _isInitialized; - - std::deque _persistenceProtocol; - -private: - CAF_CM_DECLARE_NOCOPY(CPersistenceProtocolCollectionDoc); -}; - -CAF_DECLARE_SMART_POINTER(CPersistenceProtocolCollectionDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/PersistenceDoc/CPersistenceProtocolDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/PersistenceDoc/CPersistenceProtocolDoc.h deleted file mode 100644 index eea8401ef..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/PersistenceDoc/CPersistenceProtocolDoc.h +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Author: bwilliams - * Created: Nov 16, 2015 - * - * Copyright (C) 2015-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#ifndef CPersistenceProtocolDoc_h_ -#define CPersistenceProtocolDoc_h_ - - -#include "Doc/PersistenceDoc/CCertCollectionDoc.h" -#include "Doc/PersistenceDoc/CCertPathCollectionDoc.h" - -namespace Caf { - -/// A simple container for objects of type CPersistenceProtocolDoc -class PERSISTENCEDOC_LINKAGE CPersistenceProtocolDoc { -public: - CPersistenceProtocolDoc(); - virtual ~CPersistenceProtocolDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::string& protocolName = std::string(), - const std::string& uri = std::string(), - const std::string& uriAmqp = std::string(), - const std::string& uriTunnel = std::string(), - const std::string& tlsCert = std::string(), - const std::string& tlsProtocol = std::string(), - const Cdeqstr& tlsCipherCollection = Cdeqstr(), - const SmartPtrCCertCollectionDoc& tlsCertCollection = SmartPtrCCertCollectionDoc(), - const std::string& uriAmqpPath = std::string(), - const std::string& uriTunnelPath = std::string(), - const std::string& tlsCertPath = std::string(), - const SmartPtrCCertPathCollectionDoc& tlsCertPathCollection = SmartPtrCCertPathCollectionDoc()); - -public: - /// Accessor for the ProtocolName - std::string getProtocolName() const; - - /// Accessor for the Uri - std::string getUri() const; - - /// Accessor for the UriAmqp - std::string getUriAmqp() const; - - /// Accessor for the UriTunnel - std::string getUriTunnel() const; - - /// Accessor for the TlsCert - std::string getTlsCert() const; - - /// Accessor for the TlsProtocol - std::string getTlsProtocol() const; - - /// Accessor for the tlsCipherCollection - Cdeqstr getTlsCipherCollection() const; - - /// Accessor for the TlsCertCollection - SmartPtrCCertCollectionDoc getTlsCertCollection() const; - - /// Accessor for the UriAmqpPath - std::string getUriAmqpPath() const; - - /// Accessor for the UriTunnelPath - std::string getUriTunnelPath() const; - - /// Accessor for the TlsCertPath - std::string getTlsCertPath() const; - - /// Accessor for the TlsCertPathCollection - SmartPtrCCertPathCollectionDoc getTlsCertPathCollection() const; - -private: - std::string _protocolName; - std::string _uri; - std::string _uriAmqp; - std::string _uriTunnel; - std::string _tlsCert; - std::string _tlsProtocol; - Cdeqstr _tlsCipherCollection; - SmartPtrCCertCollectionDoc _tlsCertCollection; - - std::string _uriAmqpPath; - std::string _uriTunnelPath; - std::string _tlsCertPath; - SmartPtrCCertPathCollectionDoc _tlsCertPathCollection; - - bool _isInitialized; - -private: - CAF_CM_DECLARE_NOCOPY(CPersistenceProtocolDoc); -}; - -CAF_DECLARE_SMART_POINTER(CPersistenceProtocolDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/PersistenceDoc/CRemoteSecurityCollectionDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/PersistenceDoc/CRemoteSecurityCollectionDoc.h deleted file mode 100644 index 48076b8df..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/PersistenceDoc/CRemoteSecurityCollectionDoc.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CRemoteSecurityCollectionDoc_h_ -#define CRemoteSecurityCollectionDoc_h_ - - -#include "Doc/PersistenceDoc/CRemoteSecurityDoc.h" - -namespace Caf { - -/// A simple container for objects of type RemoteSecurityCollection -class PERSISTENCEDOC_LINKAGE CRemoteSecurityCollectionDoc { -public: - CRemoteSecurityCollectionDoc(); - virtual ~CRemoteSecurityCollectionDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::deque remoteSecurity = std::deque()); - -public: - /// Accessor for the RemoteSecurity - std::deque getRemoteSecurity() const; - -private: - bool _isInitialized; - - std::deque _remoteSecurity; - -private: - CAF_CM_DECLARE_NOCOPY(CRemoteSecurityCollectionDoc); -}; - -CAF_DECLARE_SMART_POINTER(CRemoteSecurityCollectionDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/PersistenceDoc/CRemoteSecurityDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/PersistenceDoc/CRemoteSecurityDoc.h deleted file mode 100644 index 96e8c436a..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/PersistenceDoc/CRemoteSecurityDoc.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Author: bwilliams - * Created: Nov 16, 2015 - * - * Copyright (C) 2015-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#ifndef CRemoteSecurityDoc_h_ -#define CRemoteSecurityDoc_h_ - - -#include "Doc/PersistenceDoc/CCertCollectionDoc.h" -#include "Doc/PersistenceDoc/CCertPathCollectionDoc.h" - -namespace Caf { - -/// A simple container for objects of type CRemoteSecurityDoc -class PERSISTENCEDOC_LINKAGE CRemoteSecurityDoc { -public: - CRemoteSecurityDoc(); - virtual ~CRemoteSecurityDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::string& remoteId = std::string(), - const std::string& protocolName = std::string(), - const std::string& cmsCert = std::string(), - const std::string& cmsCipherName = std::string(), - const SmartPtrCCertCollectionDoc& cmsCertCollection = SmartPtrCCertCollectionDoc(), - const std::string& cmsCertPath = std::string(), - const SmartPtrCCertPathCollectionDoc& cmsCertPathCollection = SmartPtrCCertPathCollectionDoc()); - -public: - /// Accessor for the RemoteId - std::string getRemoteId() const; - - /// Accessor for the ProtocolName - std::string getProtocolName() const; - - /// Accessor for the cmsCert - std::string getCmsCert() const; - - /// Accessor for the CmsCipher - std::string getCmsCipherName() const; - - /// Accessor for the CertCollection - SmartPtrCCertCollectionDoc getCmsCertCollection() const; - - /// Accessor for the cmsCertPath - std::string getCmsCertPath() const; - - /// Accessor for the CertPathCollection - SmartPtrCCertPathCollectionDoc getCmsCertPathCollection() const; - -private: - std::string _remoteId; - std::string _protocolName; - std::string _cmsCert; - std::string _cmsCipherName; - SmartPtrCCertCollectionDoc _cmsCertCollection; - - std::string _cmsCertPath; - SmartPtrCCertPathCollectionDoc _cmsCertPathCollection; - - bool _isInitialized; - -private: - CAF_CM_DECLARE_NOCOPY(CRemoteSecurityDoc); -}; - -CAF_DECLARE_SMART_POINTER(CRemoteSecurityDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/PersistenceDoc/PersistenceDocLink.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/PersistenceDoc/PersistenceDocLink.h deleted file mode 100644 index b96c6567c..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/PersistenceDoc/PersistenceDocLink.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Author: bwilliams - * Created: February 25, 2016 - * - * Copyright (C) 2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#ifndef PersistenceDoc_Link_h_ -#define PersistenceDoc_Link_h_ - -#ifndef PERSISTENCEDOC_LINKAGE - #ifdef WIN32 - #ifdef FRAMEWORK_BUILD - #define PERSISTENCEDOC_LINKAGE __declspec(dllexport) - #else - #define PERSISTENCEDOC_LINKAGE __declspec(dllimport) - #endif - #else - #define PERSISTENCEDOC_LINKAGE - #endif -#endif - - -#endif /* PersistenceDoc_Link_h_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ProviderInfraDoc/CClassCollectionDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ProviderInfraDoc/CClassCollectionDoc.h deleted file mode 100644 index 909caad9f..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ProviderInfraDoc/CClassCollectionDoc.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CClassCollectionDoc_h_ -#define CClassCollectionDoc_h_ - - -#include "Doc/CafCoreTypesDoc/CFullyQualifiedClassGroupDoc.h" - -namespace Caf { - -/// A simple container for objects of type ClassCollection -class PROVIDERINFRADOC_LINKAGE CClassCollectionDoc { -public: - CClassCollectionDoc(); - virtual ~CClassCollectionDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::deque fullyQualifiedClass); - -public: - /// Accessor for the FullyQualifiedClass - std::deque getFullyQualifiedClass() const; - -private: - bool _isInitialized; - - std::deque _fullyQualifiedClass; - -private: - CAF_CM_DECLARE_NOCOPY(CClassCollectionDoc); -}; - -CAF_DECLARE_SMART_POINTER(CClassCollectionDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ProviderInfraDoc/CProviderRegDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ProviderInfraDoc/CProviderRegDoc.h deleted file mode 100644 index c18ddc219..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ProviderInfraDoc/CProviderRegDoc.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CProviderRegDoc_h_ -#define CProviderRegDoc_h_ - -namespace Caf { - -/// A simple container for objects of type ProviderReg -class PROVIDERINFRADOC_LINKAGE CProviderRegDoc { -public: - CProviderRegDoc(); - virtual ~CProviderRegDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::string providerNamespace, - const std::string providerName, - const std::string providerVersion, - const int32 staleSec, - const bool isSchemaVisible, - const std::string invokerRelPath); - -public: - /// Accessor for the ProviderNamespace - std::string getProviderNamespace() const; - - /// Accessor for the ProviderName - std::string getProviderName() const; - - /// Accessor for the ProviderVersion - std::string getProviderVersion() const; - - /// Accessor for the StaleSec - int32 getStaleSec() const; - - /// Accessor for the IsSchemaVisible - bool getIsSchemaVisible() const; - - /// Accessor for the InvokerRelPath - std::string getInvokerRelPath() const; - -private: - std::string _providerNamespace; - std::string _providerName; - std::string _providerVersion; - int32 _staleSec; - bool _isSchemaVisible; - std::string _invokerRelPath; - bool _isInitialized; - -private: - CAF_CM_DECLARE_NOCOPY(CProviderRegDoc); -}; - -CAF_DECLARE_SMART_POINTER(CProviderRegDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ProviderInfraDoc/CSchemaSummaryDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ProviderInfraDoc/CSchemaSummaryDoc.h deleted file mode 100644 index 81ee08b68..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ProviderInfraDoc/CSchemaSummaryDoc.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CSchemaSummaryDoc_h_ -#define CSchemaSummaryDoc_h_ - - -#include "Doc/ProviderInfraDoc/CClassCollectionDoc.h" - -namespace Caf { - -/// A simple container for objects of type SchemaSummary -class PROVIDERINFRADOC_LINKAGE CSchemaSummaryDoc { -public: - CSchemaSummaryDoc(); - virtual ~CSchemaSummaryDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::string providerNamespace, - const std::string providerName, - const std::string providerVersion, - const SmartPtrCClassCollectionDoc classCollection, - const std::string invokerPath); - -public: - /// Accessor for the ProviderNamespace - std::string getProviderNamespace() const; - - /// Accessor for the ProviderName - std::string getProviderName() const; - - /// Accessor for the ProviderVersion - std::string getProviderVersion() const; - - /// Accessor for the ClassCollection - SmartPtrCClassCollectionDoc getClassCollection() const; - - /// Accessor for the InvokerPath - std::string getInvokerPath() const; - -private: - bool _isInitialized; - - std::string _providerNamespace; - std::string _providerName; - std::string _providerVersion; - SmartPtrCClassCollectionDoc _classCollection; - std::string _invokerPath; - -private: - CAF_CM_DECLARE_NOCOPY(CSchemaSummaryDoc); -}; - -CAF_DECLARE_SMART_POINTER(CSchemaSummaryDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ProviderInfraDoc/ProviderInfraDocLink.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ProviderInfraDoc/ProviderInfraDocLink.h deleted file mode 100644 index 6e507a4a4..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ProviderInfraDoc/ProviderInfraDocLink.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Author: bwilliams - * Created: February 25, 2016 - * - * Copyright (C) 2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#ifndef ProviderInfraDoc_Link_h_ -#define ProviderInfraDoc_Link_h_ - -#ifndef PROVIDERINFRADOC_LINKAGE - #ifdef WIN32 - #ifdef FRAMEWORK_BUILD - #define PROVIDERINFRADOC_LINKAGE __declspec(dllexport) - #else - #define PROVIDERINFRADOC_LINKAGE __declspec(dllimport) - #endif - #else - #define PROVIDERINFRADOC_LINKAGE - #endif -#endif - - -#endif /* ProviderInfraDoc_Link_h_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ProviderRequestDoc/CProviderBatchDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ProviderRequestDoc/CProviderBatchDoc.h deleted file mode 100644 index 970317ae3..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ProviderRequestDoc/CProviderBatchDoc.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CProviderBatchDoc_h_ -#define CProviderBatchDoc_h_ - - -#include "Doc/ProviderRequestDoc/CProviderCollectInstancesCollectionDoc.h" -#include "Doc/ProviderRequestDoc/CProviderInvokeOperationCollectionDoc.h" - -namespace Caf { - -/// A simple container for objects of type ProviderBatch -class PROVIDERREQUESTDOC_LINKAGE CProviderBatchDoc { -public: - CProviderBatchDoc(); - virtual ~CProviderBatchDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::string outputDir, - const SmartPtrCProviderCollectInstancesCollectionDoc collectInstancesCollection, - const SmartPtrCProviderInvokeOperationCollectionDoc invokeOperationCollection); - -public: - /// Accessor for the OutputDir - std::string getOutputDir() const; - - /// Accessor for the CollectInstancesCollection - SmartPtrCProviderCollectInstancesCollectionDoc getCollectInstancesCollection() const; - - /// Accessor for the InvokeOperationCollection - SmartPtrCProviderInvokeOperationCollectionDoc getInvokeOperationCollection() const; - -private: - bool _isInitialized; - - std::string _outputDir; - SmartPtrCProviderCollectInstancesCollectionDoc _collectInstancesCollection; - SmartPtrCProviderInvokeOperationCollectionDoc _invokeOperationCollection; - -private: - CAF_CM_DECLARE_NOCOPY(CProviderBatchDoc); -}; - -CAF_DECLARE_SMART_POINTER(CProviderBatchDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ProviderRequestDoc/CProviderCollectInstancesCollectionDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ProviderRequestDoc/CProviderCollectInstancesCollectionDoc.h deleted file mode 100644 index f0152894b..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ProviderRequestDoc/CProviderCollectInstancesCollectionDoc.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CProviderCollectInstancesCollectionDoc_h_ -#define CProviderCollectInstancesCollectionDoc_h_ - - -#include "Doc/ProviderRequestDoc/CProviderCollectInstancesDoc.h" - -namespace Caf { - -/// A simple container for objects of type ProviderCollectInstancesCollection -class PROVIDERREQUESTDOC_LINKAGE CProviderCollectInstancesCollectionDoc { -public: - CProviderCollectInstancesCollectionDoc(); - virtual ~CProviderCollectInstancesCollectionDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::deque collectInstances); - -public: - /// Accessor for the CollectInstances - std::deque getCollectInstances() const; - -private: - bool _isInitialized; - - std::deque _collectInstances; - -private: - CAF_CM_DECLARE_NOCOPY(CProviderCollectInstancesCollectionDoc); -}; - -CAF_DECLARE_SMART_POINTER(CProviderCollectInstancesCollectionDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ProviderRequestDoc/CProviderCollectInstancesDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ProviderRequestDoc/CProviderCollectInstancesDoc.h deleted file mode 100644 index a07b4289b..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ProviderRequestDoc/CProviderCollectInstancesDoc.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CProviderCollectInstancesDoc_h_ -#define CProviderCollectInstancesDoc_h_ - - -#include "Doc/CafCoreTypesDoc/CParameterCollectionDoc.h" - -namespace Caf { - -/// A simple container for objects of type ProviderCollectInstances -class PROVIDERREQUESTDOC_LINKAGE CProviderCollectInstancesDoc { -public: - CProviderCollectInstancesDoc(); - virtual ~CProviderCollectInstancesDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::string classNamespace, - const std::string className, - const std::string classVersion, - const UUID jobId, - const std::string outputDir, - const SmartPtrCParameterCollectionDoc parameterCollection); - -public: - /// Accessor for the ClassNamespace - std::string getClassNamespace() const; - - /// Accessor for the ClassName - std::string getClassName() const; - - /// Accessor for the ClassVersion - std::string getClassVersion() const; - - /// Accessor for the JobId - UUID getJobId() const; - - /// Accessor for the OutputDir - std::string getOutputDir() const; - - /// Accessor for the ParameterCollection - SmartPtrCParameterCollectionDoc getParameterCollection() const; - -private: - std::string _classNamespace; - std::string _className; - std::string _classVersion; - UUID _jobId; - std::string _outputDir; - SmartPtrCParameterCollectionDoc _parameterCollection; - bool _isInitialized; - -private: - CAF_CM_DECLARE_NOCOPY(CProviderCollectInstancesDoc); -}; - -CAF_DECLARE_SMART_POINTER(CProviderCollectInstancesDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ProviderRequestDoc/CProviderCollectSchemaRequestDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ProviderRequestDoc/CProviderCollectSchemaRequestDoc.h deleted file mode 100644 index 995134f3d..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ProviderRequestDoc/CProviderCollectSchemaRequestDoc.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CProviderCollectSchemaRequestDoc_h_ -#define CProviderCollectSchemaRequestDoc_h_ - - -#include "Doc/ProviderRequestDoc/CProviderRequestHeaderDoc.h" - -namespace Caf { - -/// A simple container for objects of type ProviderCollectSchemaRequest -class PROVIDERREQUESTDOC_LINKAGE CProviderCollectSchemaRequestDoc { -public: - CProviderCollectSchemaRequestDoc(); - virtual ~CProviderCollectSchemaRequestDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const UUID clientId, - const UUID requestId, - const std::string pmeId, - const UUID jobId, - const std::string outputDir, - const SmartPtrCProviderRequestHeaderDoc requestHeader); - -public: - /// Accessor for the ClientId - UUID getClientId() const; - - /// Accessor for the RequestId - UUID getRequestId() const; - - /// Accessor for the PmeId - std::string getPmeId() const; - - /// Accessor for the JobId - UUID getJobId() const; - - /// Accessor for the OutputDir - std::string getOutputDir() const; - - /// Accessor for the RequestHeader - SmartPtrCProviderRequestHeaderDoc getRequestHeader() const; - -private: - UUID _clientId; - UUID _requestId; - std::string _pmeId; - UUID _jobId; - std::string _outputDir; - SmartPtrCProviderRequestHeaderDoc _requestHeader; - bool _isInitialized; - -private: - CAF_CM_DECLARE_NOCOPY(CProviderCollectSchemaRequestDoc); -}; - -CAF_DECLARE_SMART_POINTER(CProviderCollectSchemaRequestDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ProviderRequestDoc/CProviderInvokeOperationCollectionDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ProviderRequestDoc/CProviderInvokeOperationCollectionDoc.h deleted file mode 100644 index ce7377a59..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ProviderRequestDoc/CProviderInvokeOperationCollectionDoc.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CProviderInvokeOperationCollectionDoc_h_ -#define CProviderInvokeOperationCollectionDoc_h_ - - -#include "Doc/ProviderRequestDoc/CProviderInvokeOperationDoc.h" - -namespace Caf { - -/// A simple container for objects of type ProviderInvokeOperationCollection -class PROVIDERREQUESTDOC_LINKAGE CProviderInvokeOperationCollectionDoc { -public: - CProviderInvokeOperationCollectionDoc(); - virtual ~CProviderInvokeOperationCollectionDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::deque invokeOperation); - -public: - /// Accessor for the InvokeOperation - std::deque getInvokeOperation() const; - -private: - bool _isInitialized; - - std::deque _invokeOperation; - -private: - CAF_CM_DECLARE_NOCOPY(CProviderInvokeOperationCollectionDoc); -}; - -CAF_DECLARE_SMART_POINTER(CProviderInvokeOperationCollectionDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ProviderRequestDoc/CProviderInvokeOperationDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ProviderRequestDoc/CProviderInvokeOperationDoc.h deleted file mode 100644 index a56bb6aab..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ProviderRequestDoc/CProviderInvokeOperationDoc.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CProviderInvokeOperationDoc_h_ -#define CProviderInvokeOperationDoc_h_ - - -#include "Doc/CafCoreTypesDoc/COperationDoc.h" - -namespace Caf { - -/// A simple container for objects of type ProviderInvokeOperation -class PROVIDERREQUESTDOC_LINKAGE CProviderInvokeOperationDoc { -public: - CProviderInvokeOperationDoc(); - virtual ~CProviderInvokeOperationDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::string classNamespace, - const std::string className, - const std::string classVersion, - const UUID jobId, - const std::string outputDir, - const SmartPtrCOperationDoc operation); - -public: - /// Accessor for the ClassNamespace - std::string getClassNamespace() const; - - /// Accessor for the ClassName - std::string getClassName() const; - - /// Accessor for the ClassVersion - std::string getClassVersion() const; - - /// Accessor for the JobId - UUID getJobId() const; - - /// Accessor for the OutputDir - std::string getOutputDir() const; - - /// Accessor for the Operation - SmartPtrCOperationDoc getOperation() const; - -private: - std::string _classNamespace; - std::string _className; - std::string _classVersion; - UUID _jobId; - std::string _outputDir; - SmartPtrCOperationDoc _operation; - bool _isInitialized; - -private: - CAF_CM_DECLARE_NOCOPY(CProviderInvokeOperationDoc); -}; - -CAF_DECLARE_SMART_POINTER(CProviderInvokeOperationDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ProviderRequestDoc/CProviderRequestConfigDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ProviderRequestDoc/CProviderRequestConfigDoc.h deleted file mode 100644 index b78e8e00a..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ProviderRequestDoc/CProviderRequestConfigDoc.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CProviderRequestConfigDoc_h_ -#define CProviderRequestConfigDoc_h_ - - -#include "Doc/CafCoreTypesDoc/CLoggingLevelCollectionDoc.h" - -namespace Caf { - -/// A simple container for objects of type ProviderRequestConfig -class PROVIDERREQUESTDOC_LINKAGE CProviderRequestConfigDoc { -public: - CProviderRequestConfigDoc(); - virtual ~CProviderRequestConfigDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::string responseFormatType, - const SmartPtrCLoggingLevelCollectionDoc loggingLevelCollection); - -public: - /// Accessor for the ResponseFormatType - std::string getResponseFormatType() const; - - /// Accessor for the LoggingLevelCollection - SmartPtrCLoggingLevelCollectionDoc getLoggingLevelCollection() const; - -private: - bool _isInitialized; - - std::string _responseFormatType; - SmartPtrCLoggingLevelCollectionDoc _loggingLevelCollection; - -private: - CAF_CM_DECLARE_NOCOPY(CProviderRequestConfigDoc); -}; - -CAF_DECLARE_SMART_POINTER(CProviderRequestConfigDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ProviderRequestDoc/CProviderRequestDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ProviderRequestDoc/CProviderRequestDoc.h deleted file mode 100644 index 971b5de31..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ProviderRequestDoc/CProviderRequestDoc.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CProviderRequestDoc_h_ -#define CProviderRequestDoc_h_ - - -#include "Doc/CafCoreTypesDoc/CAttachmentCollectionDoc.h" -#include "Doc/ProviderRequestDoc/CProviderBatchDoc.h" -#include "Doc/ProviderRequestDoc/CProviderRequestHeaderDoc.h" - -namespace Caf { - -/// A simple container for objects of type ProviderRequest -class PROVIDERREQUESTDOC_LINKAGE CProviderRequestDoc { -public: - CProviderRequestDoc(); - virtual ~CProviderRequestDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const UUID clientId, - const UUID requestId, - const std::string pmeId, - const SmartPtrCProviderRequestHeaderDoc requestHeader, - const SmartPtrCProviderBatchDoc batch, - const SmartPtrCAttachmentCollectionDoc attachmentCollection); - -public: - /// Accessor for the ClientId - UUID getClientId() const; - - /// Accessor for the RequestId - UUID getRequestId() const; - - /// Accessor for the PmeId - std::string getPmeId() const; - - /// Accessor for the RequestHeader - SmartPtrCProviderRequestHeaderDoc getRequestHeader() const; - - /// Accessor for the Batch - SmartPtrCProviderBatchDoc getBatch() const; - - /// Accessor for the AttachmentCollection - SmartPtrCAttachmentCollectionDoc getAttachmentCollection() const; - -private: - UUID _clientId; - UUID _requestId; - std::string _pmeId; - SmartPtrCProviderRequestHeaderDoc _requestHeader; - SmartPtrCProviderBatchDoc _batch; - SmartPtrCAttachmentCollectionDoc _attachmentCollection; - bool _isInitialized; - -private: - CAF_CM_DECLARE_NOCOPY(CProviderRequestDoc); -}; - -CAF_DECLARE_SMART_POINTER(CProviderRequestDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ProviderRequestDoc/CProviderRequestHeaderDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ProviderRequestDoc/CProviderRequestHeaderDoc.h deleted file mode 100644 index 7d29edf4f..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ProviderRequestDoc/CProviderRequestHeaderDoc.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CProviderRequestHeaderDoc_h_ -#define CProviderRequestHeaderDoc_h_ - - -#include "Doc/CafCoreTypesDoc/CPropertyCollectionDoc.h" -#include "Doc/ProviderRequestDoc/CProviderRequestConfigDoc.h" - -namespace Caf { - -/// A simple container for objects of type ProviderRequestHeader -class PROVIDERREQUESTDOC_LINKAGE CProviderRequestHeaderDoc { -public: - CProviderRequestHeaderDoc(); - virtual ~CProviderRequestHeaderDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const SmartPtrCProviderRequestConfigDoc requestConfig, - const SmartPtrCPropertyCollectionDoc echoPropertyBag); - -public: - /// Accessor for the RequestConfig - SmartPtrCProviderRequestConfigDoc getRequestConfig() const; - - /// Accessor for the EchoPropertyBag - SmartPtrCPropertyCollectionDoc getEchoPropertyBag() const; - -private: - bool _isInitialized; - - SmartPtrCProviderRequestConfigDoc _requestConfig; - SmartPtrCPropertyCollectionDoc _echoPropertyBag; - -private: - CAF_CM_DECLARE_NOCOPY(CProviderRequestHeaderDoc); -}; - -CAF_DECLARE_SMART_POINTER(CProviderRequestHeaderDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ProviderRequestDoc/ProviderRequestDocLink.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ProviderRequestDoc/ProviderRequestDocLink.h deleted file mode 100644 index 958532b9b..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ProviderRequestDoc/ProviderRequestDocLink.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Author: bwilliams - * Created: February 25, 2016 - * - * Copyright (C) 2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#ifndef ProviderRequestDoc_Link_h_ -#define ProviderRequestDoc_Link_h_ - -#ifndef PROVIDERREQUESTDOC_LINKAGE - #ifdef WIN32 - #ifdef FRAMEWORK_BUILD - #define PROVIDERREQUESTDOC_LINKAGE __declspec(dllexport) - #else - #define PROVIDERREQUESTDOC_LINKAGE __declspec(dllimport) - #endif - #else - #define PROVIDERREQUESTDOC_LINKAGE - #endif -#endif - - -#endif /* ProviderRequestDoc_Link_h_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ProviderResultsDoc/CCdifDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ProviderResultsDoc/CCdifDoc.h deleted file mode 100644 index 418ce689c..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ProviderResultsDoc/CCdifDoc.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CCdifDoc_h_ -#define CCdifDoc_h_ - - -#include "Doc/ProviderResultsDoc/CDefinitionObjectCollectionDoc.h" -#include "Doc/ProviderResultsDoc/CRequestIdentifierDoc.h" -#include "Doc/ProviderResultsDoc/CSchemaDoc.h" - -namespace Caf { - -/// A simple container for objects of type Cdif -class PROVIDERRESULTSDOC_LINKAGE CCdifDoc { -public: - CCdifDoc(); - virtual ~CCdifDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const SmartPtrCRequestIdentifierDoc requestIdentifier, - const SmartPtrCDefinitionObjectCollectionDoc definitionObjectCollection, - const SmartPtrCSchemaDoc schema); - -public: - /// Accessor for the RequestIdentifier - SmartPtrCRequestIdentifierDoc getRequestIdentifier() const; - - /// Accessor for the DefinitionObjectCollection - SmartPtrCDefinitionObjectCollectionDoc getDefinitionObjectCollection() const; - - /// Accessor for the Schema - SmartPtrCSchemaDoc getSchema() const; - -private: - bool _isInitialized; - - SmartPtrCRequestIdentifierDoc _requestIdentifier; - SmartPtrCDefinitionObjectCollectionDoc _definitionObjectCollection; - SmartPtrCSchemaDoc _schema; - -private: - CAF_CM_DECLARE_NOCOPY(CCdifDoc); -}; - -CAF_DECLARE_SMART_POINTER(CCdifDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ProviderResultsDoc/CDefinitionObjectCollectionDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ProviderResultsDoc/CDefinitionObjectCollectionDoc.h deleted file mode 100644 index a73204809..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ProviderResultsDoc/CDefinitionObjectCollectionDoc.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CDefinitionObjectCollectionDoc_h_ -#define CDefinitionObjectCollectionDoc_h_ - -namespace Caf { - -/// Set of elements containing data returned as a result of a provider collection or action -class PROVIDERRESULTSDOC_LINKAGE CDefinitionObjectCollectionDoc { -public: - CDefinitionObjectCollectionDoc(); - virtual ~CDefinitionObjectCollectionDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::deque value); - -public: - /// Accessor for the Value - std::deque getValue() const; - -private: - bool _isInitialized; - - std::deque _value; - -private: - CAF_CM_DECLARE_NOCOPY(CDefinitionObjectCollectionDoc); -}; - -CAF_DECLARE_SMART_POINTER(CDefinitionObjectCollectionDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ProviderResultsDoc/CRequestIdentifierDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ProviderResultsDoc/CRequestIdentifierDoc.h deleted file mode 100644 index 18b548dc3..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ProviderResultsDoc/CRequestIdentifierDoc.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CRequestIdentifierDoc_h_ -#define CRequestIdentifierDoc_h_ - - -#include "Doc/SchemaTypesDoc/CActionClassDoc.h" - -namespace Caf { - -/// Fields that allow client to determine which request resulted in this response document -class PROVIDERRESULTSDOC_LINKAGE CRequestIdentifierDoc { -public: - CRequestIdentifierDoc(); - virtual ~CRequestIdentifierDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const UUID clientId, - const UUID requestId, - const std::string pmeId, - const UUID jobId, - const SmartPtrCActionClassDoc actionClass, - const UUID sessionId); - -public: - /// Accessor for the ClientId - UUID getClientId() const; - - /// Accessor for the RequestId - UUID getRequestId() const; - - /// Accessor for the PmeId - std::string getPmeId() const; - - /// Identifier of the specific job within the request - UUID getJobId() const; - - /// Accessor for the ActionClass - SmartPtrCActionClassDoc getActionClass() const; - - /// Client-configurable identifier that is opaque (not used) by the Common Agent Framework - UUID getSessionId() const; - -private: - UUID _clientId; - UUID _requestId; - std::string _pmeId; - UUID _jobId; - SmartPtrCActionClassDoc _actionClass; - UUID _sessionId; - bool _isInitialized; - -private: - CAF_CM_DECLARE_NOCOPY(CRequestIdentifierDoc); -}; - -CAF_DECLARE_SMART_POINTER(CRequestIdentifierDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ProviderResultsDoc/CSchemaDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ProviderResultsDoc/CSchemaDoc.h deleted file mode 100644 index e9bd90ea6..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ProviderResultsDoc/CSchemaDoc.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CSchemaDoc_h_ -#define CSchemaDoc_h_ - - -#include "Doc/SchemaTypesDoc/CActionClassDoc.h" -#include "Doc/SchemaTypesDoc/CDataClassDoc.h" -#include "Doc/SchemaTypesDoc/CLogicalRelationshipDoc.h" -#include "Doc/SchemaTypesDoc/CPhysicalRelationshipDoc.h" - -namespace Caf { - -/// Set of elements describing the objects that can be generated by the provider -class PROVIDERRESULTSDOC_LINKAGE CSchemaDoc { -public: - CSchemaDoc(); - virtual ~CSchemaDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::deque dataClassCollection, - const std::deque actionClassCollection, - const std::deque logicalRelationshipCollection = std::deque(), - const std::deque physicalRelationshipCollection = std::deque()); - -public: - /// Accessor for the DataClassCollection - std::deque getDataClassCollection() const; - - /// Accessor for the ActionClassCollection - std::deque getActionClassCollection() const; - - /// Accessor for the LogicalRelationshipCollection - std::deque getLogicalRelationshipCollection() const; - - /// Accessor for the PhysicalRelationshipCollection - std::deque getPhysicalRelationshipCollection() const; - -private: - bool _isInitialized; - - std::deque _dataClassCollection; - std::deque _actionClassCollection; - std::deque _logicalRelationshipCollection; - std::deque _physicalRelationshipCollection; - -private: - CAF_CM_DECLARE_NOCOPY(CSchemaDoc); -}; - -CAF_DECLARE_SMART_POINTER(CSchemaDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ProviderResultsDoc/ProviderResultsDocLink.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ProviderResultsDoc/ProviderResultsDocLink.h deleted file mode 100644 index 6198c8c91..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ProviderResultsDoc/ProviderResultsDocLink.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Author: bwilliams - * Created: February 25, 2016 - * - * Copyright (C) 2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#ifndef ProviderResultsDoc_Link_h_ -#define ProviderResultsDoc_Link_h_ - -#ifndef PROVIDERRESULTSDOC_LINKAGE - #ifdef WIN32 - #ifdef FRAMEWORK_BUILD - #define PROVIDERRESULTSDOC_LINKAGE __declspec(dllexport) - #else - #define PROVIDERRESULTSDOC_LINKAGE __declspec(dllimport) - #endif - #else - #define PROVIDERRESULTSDOC_LINKAGE - #endif -#endif - - -#endif /* ProviderResultsDoc_Link_h_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ResponseDoc/CErrorResponseDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ResponseDoc/CErrorResponseDoc.h deleted file mode 100644 index d53b41e2a..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ResponseDoc/CErrorResponseDoc.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CErrorResponseDoc_h_ -#define CErrorResponseDoc_h_ - - -#include "Doc/ResponseDoc/CResponseHeaderDoc.h" - -namespace Caf { - -/// A simple container for objects of type ErrorResponse -class RESPONSEDOC_LINKAGE CErrorResponseDoc { -public: - CErrorResponseDoc(); - virtual ~CErrorResponseDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const UUID clientId, - const UUID requestId, - const std::string pmeId, - const SmartPtrCResponseHeaderDoc responseHeader, - const std::string errorMessage); - -public: - /// Accessor for the ClientId - UUID getClientId() const; - - /// Accessor for the RequestId - UUID getRequestId() const; - - /// Accessor for the PmeId - std::string getPmeId() const; - - /// Accessor for the Response Header - SmartPtrCResponseHeaderDoc getResponseHeader() const; - - /// Accessor for the ErrorMessage - std::string getErrorMessage() const; - -private: - UUID _clientId; - UUID _requestId; - std::string _pmeId; - SmartPtrCResponseHeaderDoc _responseHeader; - std::string _errorMessage; - bool _isInitialized; - -private: - CAF_CM_DECLARE_NOCOPY(CErrorResponseDoc); -}; - -CAF_DECLARE_SMART_POINTER(CErrorResponseDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ResponseDoc/CEventKeyCollectionDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ResponseDoc/CEventKeyCollectionDoc.h deleted file mode 100644 index f61c7a145..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ResponseDoc/CEventKeyCollectionDoc.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CEventKeyCollectionDoc_h_ -#define CEventKeyCollectionDoc_h_ - - -#include "Doc/ResponseDoc/CEventKeyDoc.h" - -namespace Caf { - -/// A simple container for objects of type EventKeyCollection -class RESPONSEDOC_LINKAGE CEventKeyCollectionDoc { -public: - CEventKeyCollectionDoc(); - virtual ~CEventKeyCollectionDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::deque eventKey); - -public: - /// Accessor for the EventKey - std::deque getEventKey() const; - -private: - bool _isInitialized; - - std::deque _eventKey; - -private: - CAF_CM_DECLARE_NOCOPY(CEventKeyCollectionDoc); -}; - -CAF_DECLARE_SMART_POINTER(CEventKeyCollectionDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ResponseDoc/CEventKeyDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ResponseDoc/CEventKeyDoc.h deleted file mode 100644 index 7e72cdb94..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ResponseDoc/CEventKeyDoc.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CEventKeyDoc_h_ -#define CEventKeyDoc_h_ - -namespace Caf { - -/// A simple container for objects of type EventKey -class RESPONSEDOC_LINKAGE CEventKeyDoc { -public: - CEventKeyDoc(); - virtual ~CEventKeyDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::string name, - const std::string value); - -public: - /// Accessor for the Name - std::string getName() const; - - /// Accessor for the Value - std::string getValue() const; - -private: - bool _isInitialized; - - std::string _name; - std::string _value; - -private: - CAF_CM_DECLARE_NOCOPY(CEventKeyDoc); -}; - -CAF_DECLARE_SMART_POINTER(CEventKeyDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ResponseDoc/CEventManifestDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ResponseDoc/CEventManifestDoc.h deleted file mode 100644 index 0b1c45bee..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ResponseDoc/CEventManifestDoc.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CEventManifestDoc_h_ -#define CEventManifestDoc_h_ - - -#include "Doc/CafCoreTypesDoc/CAttachmentCollectionDoc.h" - -namespace Caf { - -/// A simple container for objects of type EventManifest -class RESPONSEDOC_LINKAGE CEventManifestDoc { -public: - CEventManifestDoc(); - virtual ~CEventManifestDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::string classNamespace, - const std::string className, - const std::string classVersion, - const std::string operationName, - const SmartPtrCAttachmentCollectionDoc attachmentCollection); - -public: - /// Accessor for the ClassNamespace - std::string getClassNamespace() const; - - /// Accessor for the ClassName - std::string getClassName() const; - - /// Accessor for the ClassVersion - std::string getClassVersion() const; - - /// Accessor for the OperationName - std::string getOperationName() const; - - /// Accessor for the AttachmentCollection - SmartPtrCAttachmentCollectionDoc getAttachmentCollection() const; - -private: - bool _isInitialized; - - std::string _classNamespace; - std::string _className; - std::string _classVersion; - std::string _operationName; - SmartPtrCAttachmentCollectionDoc _attachmentCollection; - -private: - CAF_CM_DECLARE_NOCOPY(CEventManifestDoc); -}; - -CAF_DECLARE_SMART_POINTER(CEventManifestDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ResponseDoc/CManifestCollectionDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ResponseDoc/CManifestCollectionDoc.h deleted file mode 100644 index db4fadc39..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ResponseDoc/CManifestCollectionDoc.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CManifestCollectionDoc_h_ -#define CManifestCollectionDoc_h_ - - -#include "Doc/ResponseDoc/CManifestDoc.h" - -namespace Caf { - -/// A simple container for objects of type ManifestCollection -class RESPONSEDOC_LINKAGE CManifestCollectionDoc { -public: - CManifestCollectionDoc(); - virtual ~CManifestCollectionDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::deque manifest); - -public: - /// Accessor for the Manifest - std::deque getManifest() const; - -private: - bool _isInitialized; - - std::deque _manifest; - -private: - CAF_CM_DECLARE_NOCOPY(CManifestCollectionDoc); -}; - -CAF_DECLARE_SMART_POINTER(CManifestCollectionDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ResponseDoc/CManifestDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ResponseDoc/CManifestDoc.h deleted file mode 100644 index fcc7759b9..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ResponseDoc/CManifestDoc.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CManifestDoc_h_ -#define CManifestDoc_h_ - - -#include "Doc/CafCoreTypesDoc/CAttachmentNameCollectionDoc.h" - -namespace Caf { - -/// A simple container for objects of type Manifest -class RESPONSEDOC_LINKAGE CManifestDoc { -public: - CManifestDoc(); - virtual ~CManifestDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::string classNamespace, - const std::string className, - const std::string classVersion, - const UUID jobId, - const std::string operationName, - const SmartPtrCAttachmentNameCollectionDoc attachmentNameCollection); - -public: - /// Accessor for the ClassNamespace - std::string getClassNamespace() const; - - /// Accessor for the ClassName - std::string getClassName() const; - - /// Accessor for the ClassVersion - std::string getClassVersion() const; - - /// Accessor for the JobId - UUID getJobId() const; - - /// Accessor for the OperationName - std::string getOperationName() const; - - /// Accessor for the AttachmentNameCollection - SmartPtrCAttachmentNameCollectionDoc getAttachmentNameCollection() const; - -private: - std::string _classNamespace; - std::string _className; - std::string _classVersion; - UUID _jobId; - std::string _operationName; - SmartPtrCAttachmentNameCollectionDoc _attachmentNameCollection; - bool _isInitialized; - -private: - CAF_CM_DECLARE_NOCOPY(CManifestDoc); -}; - -CAF_DECLARE_SMART_POINTER(CManifestDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ResponseDoc/CProviderEventResponseDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ResponseDoc/CProviderEventResponseDoc.h deleted file mode 100644 index 4065f7720..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ResponseDoc/CProviderEventResponseDoc.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CProviderEventResponseDoc_h_ -#define CProviderEventResponseDoc_h_ - - -#include "Doc/CafCoreTypesDoc/CStatisticsDoc.h" -#include "Doc/ResponseDoc/CEventKeyCollectionDoc.h" -#include "Doc/ResponseDoc/CEventManifestDoc.h" -#include "Doc/ResponseDoc/CResponseHeaderDoc.h" - -namespace Caf { - -/// A simple container for objects of type ProviderEventResponse -class RESPONSEDOC_LINKAGE CProviderEventResponseDoc { -public: - CProviderEventResponseDoc(); - virtual ~CProviderEventResponseDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::string pmeId, - const SmartPtrCResponseHeaderDoc responseHeader, - const SmartPtrCEventManifestDoc manifest, - const SmartPtrCEventKeyCollectionDoc eventKeyCollection, - const SmartPtrCStatisticsDoc statistics); - -public: - /// Accessor for the PmeId - std::string getPmeId() const; - - /// Accessor for the ResponseHeader - SmartPtrCResponseHeaderDoc getResponseHeader() const; - - /// Accessor for the Manifest - SmartPtrCEventManifestDoc getManifest() const; - - /// Accessor for the EventKeyCollection - SmartPtrCEventKeyCollectionDoc getEventKeyCollection() const; - - /// Accessor for the Statistics - SmartPtrCStatisticsDoc getStatistics() const; - -private: - bool _isInitialized; - - std::string _pmeId; - SmartPtrCResponseHeaderDoc _responseHeader; - SmartPtrCEventManifestDoc _manifest; - SmartPtrCEventKeyCollectionDoc _eventKeyCollection; - SmartPtrCStatisticsDoc _statistics; - -private: - CAF_CM_DECLARE_NOCOPY(CProviderEventResponseDoc); -}; - -CAF_DECLARE_SMART_POINTER(CProviderEventResponseDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ResponseDoc/CProviderResponseDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ResponseDoc/CProviderResponseDoc.h deleted file mode 100644 index 2247a81aa..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ResponseDoc/CProviderResponseDoc.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CProviderResponseDoc_h_ -#define CProviderResponseDoc_h_ - - -#include "Doc/CafCoreTypesDoc/CAttachmentCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CStatisticsDoc.h" -#include "Doc/ResponseDoc/CManifestDoc.h" -#include "Doc/ResponseDoc/CResponseHeaderDoc.h" - -namespace Caf { - -/// A simple container for objects of type ProviderResponse -class RESPONSEDOC_LINKAGE CProviderResponseDoc { -public: - CProviderResponseDoc(); - virtual ~CProviderResponseDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const UUID clientId, - const UUID requestId, - const std::string pmeId, - const SmartPtrCResponseHeaderDoc responseHeader, - const SmartPtrCManifestDoc manifest, - const SmartPtrCAttachmentCollectionDoc attachmentCollection, - const SmartPtrCStatisticsDoc statistics); - -public: - /// Accessor for the ClientId - UUID getClientId() const; - - /// Accessor for the RequestId - UUID getRequestId() const; - - /// Accessor for the PmeId - std::string getPmeId() const; - - /// Accessor for the ResponseHeader - SmartPtrCResponseHeaderDoc getResponseHeader() const; - - /// Accessor for the Manifest - SmartPtrCManifestDoc getManifest() const; - - /// Accessor for the AttachmentCollection - SmartPtrCAttachmentCollectionDoc getAttachmentCollection() const; - - /// Accessor for the Statistics - SmartPtrCStatisticsDoc getStatistics() const; - -private: - UUID _clientId; - UUID _requestId; - std::string _pmeId; - SmartPtrCResponseHeaderDoc _responseHeader; - SmartPtrCManifestDoc _manifest; - SmartPtrCAttachmentCollectionDoc _attachmentCollection; - SmartPtrCStatisticsDoc _statistics; - bool _isInitialized; - -private: - CAF_CM_DECLARE_NOCOPY(CProviderResponseDoc); -}; - -CAF_DECLARE_SMART_POINTER(CProviderResponseDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ResponseDoc/CResponseDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ResponseDoc/CResponseDoc.h deleted file mode 100644 index 35f228bb0..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ResponseDoc/CResponseDoc.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CResponseDoc_h_ -#define CResponseDoc_h_ - - -#include "Doc/CafCoreTypesDoc/CAttachmentCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CStatisticsDoc.h" -#include "Doc/ResponseDoc/CManifestCollectionDoc.h" -#include "Doc/ResponseDoc/CResponseHeaderDoc.h" - -namespace Caf { - -/// A simple container for objects of type Response -class RESPONSEDOC_LINKAGE CResponseDoc { -public: - CResponseDoc(); - virtual ~CResponseDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const UUID clientId, - const UUID requestId, - const std::string pmeId, - const SmartPtrCResponseHeaderDoc responseHeader, - const SmartPtrCManifestCollectionDoc manifestCollection, - const SmartPtrCAttachmentCollectionDoc attachmentCollection, - const SmartPtrCStatisticsDoc statistics); - -public: - /// Accessor for the ClientId - UUID getClientId() const; - - /// Accessor for the RequestId - UUID getRequestId() const; - - /// Accessor for the PmeId - std::string getPmeId() const; - - /// Accessor for the ManifestCollection - SmartPtrCResponseHeaderDoc getResponseHeader() const; - - /// Accessor for the ManifestCollection - SmartPtrCManifestCollectionDoc getManifestCollection() const; - - /// Accessor for the AttachmentCollection - SmartPtrCAttachmentCollectionDoc getAttachmentCollection() const; - - /// Accessor for the Statistics - SmartPtrCStatisticsDoc getStatistics() const; - -private: - UUID _clientId; - UUID _requestId; - std::string _pmeId; - SmartPtrCResponseHeaderDoc _responseHeader; - SmartPtrCManifestCollectionDoc _manifestCollection; - SmartPtrCAttachmentCollectionDoc _attachmentCollection; - SmartPtrCStatisticsDoc _statistics; - bool _isInitialized; - -private: - CAF_CM_DECLARE_NOCOPY(CResponseDoc); -}; - -CAF_DECLARE_SMART_POINTER(CResponseDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ResponseDoc/CResponseHeaderDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ResponseDoc/CResponseHeaderDoc.h deleted file mode 100644 index a91dc6d78..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ResponseDoc/CResponseHeaderDoc.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CResponseHeaderDoc_h_ -#define CResponseHeaderDoc_h_ - -namespace Caf { - -/// A simple container for objects of type ResponseHeader -class RESPONSEDOC_LINKAGE CResponseHeaderDoc { -public: - CResponseHeaderDoc(); - virtual ~CResponseHeaderDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::string version = "1.0", - const std::string createdDateTime = CDateTimeUtils::getCurrentDateTime(), - const uint32 sequenceNumber = 0, - const bool isFinalResponse = true, - const UUID sessionId = CAFCOMMON_GUID_NULL); - -public: - /// Accessor for the version - std::string getVersion() const; - - /// Accessor for the date/time when the request was created - std::string getCreatedDateTime() const; - - /// Accessor for the sequenceNumber - uint32 getSequenceNumber() const; - - /// Accessor for the version - bool getIsFinalResponse() const; - - /// Accessor for the session ID - UUID getSessionId() const; - -private: - std::string _version; - std::string _createdDateTime; - uint32 _sequenceNumber; - bool _isFinalResponse; - UUID _sessionId; - bool _isInitialized; - -private: - CAF_CM_DECLARE_NOCOPY(CResponseHeaderDoc); -}; - -CAF_DECLARE_SMART_POINTER(CResponseHeaderDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ResponseDoc/ResponseDocLink.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ResponseDoc/ResponseDocLink.h deleted file mode 100644 index bf73e00d6..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/ResponseDoc/ResponseDocLink.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Author: bwilliams - * Created: February 25, 2016 - * - * Copyright (C) 2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#ifndef ResponseDoc_Link_h_ -#define ResponseDoc_Link_h_ - -#ifndef RESPONSEDOC_LINKAGE - #ifdef WIN32 - #ifdef FRAMEWORK_BUILD - #define RESPONSEDOC_LINKAGE __declspec(dllexport) - #else - #define RESPONSEDOC_LINKAGE __declspec(dllimport) - #endif - #else - #define RESPONSEDOC_LINKAGE - #endif -#endif - - -#endif /* ResponseDoc_Link_h_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CActionClassDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CActionClassDoc.h deleted file mode 100644 index 46526846a..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CActionClassDoc.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CActionClassDoc_h_ -#define CActionClassDoc_h_ - - -#include "Doc/SchemaTypesDoc/CCollectMethodDoc.h" -#include "Doc/SchemaTypesDoc/CMethodDoc.h" - -namespace Caf { - -/// Definition of an action class that may be generated by the provider -class SCHEMATYPESDOC_LINKAGE CActionClassDoc { -public: - CActionClassDoc(); - virtual ~CActionClassDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::string namespaceVal, - const std::string name, - const std::string version, - const SmartPtrCCollectMethodDoc collectMethod, - const std::deque methodCollection, - const std::string displayName = std::string(), - const std::string description = std::string()); - -public: - /// Accessor for the NamespaceVal - std::string getNamespaceVal() const; - - /// Accessor for the Name - std::string getName() const; - - /// Accessor for the Version - std::string getVersion() const; - - /// Accessor for the CollectMethod - SmartPtrCCollectMethodDoc getCollectMethod() const; - - /// Accessor for the Method - std::deque getMethodCollection() const; - - /// A hint as to what this class should be called when displaying it to a human - std::string getDisplayName() const; - - /// A phrase to describe the class for mouse-over text, etc - std::string getDescription() const; - -private: - bool _isInitialized; - - std::string _namespaceVal; - std::string _name; - std::string _version; - SmartPtrCCollectMethodDoc _collectMethod; - std::deque _methodCollection; - std::string _displayName; - std::string _description; - -private: - CAF_CM_DECLARE_NOCOPY(CActionClassDoc); -}; - -CAF_DECLARE_SMART_POINTER(CActionClassDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CActionClassInstanceCollectionDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CActionClassInstanceCollectionDoc.h deleted file mode 100644 index 3e05f0f54..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CActionClassInstanceCollectionDoc.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CActionClassInstanceCollectionDoc_h_ -#define CActionClassInstanceCollectionDoc_h_ - - -#include "Doc/SchemaTypesDoc/CActionClassInstanceDoc.h" - -namespace Caf { - -/// A simple container for objects of type ActionClassInstanceCollection -class SCHEMATYPESDOC_LINKAGE CActionClassInstanceCollectionDoc { -public: - CActionClassInstanceCollectionDoc(); - virtual ~CActionClassInstanceCollectionDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::deque actionClassInstanceCollection); - -public: - /// Accessor for the ActionClassInstance - std::deque getActionClassInstanceCollection() const; - -private: - bool _isInitialized; - - std::deque _actionClassInstanceCollection; - -private: - CAF_CM_DECLARE_NOCOPY(CActionClassInstanceCollectionDoc); -}; - -CAF_DECLARE_SMART_POINTER(CActionClassInstanceCollectionDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CActionClassInstanceDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CActionClassInstanceDoc.h deleted file mode 100644 index 4b41baf62..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CActionClassInstanceDoc.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CActionClassInstanceDoc_h_ -#define CActionClassInstanceDoc_h_ - - -#include "Doc/SchemaTypesDoc/CInstanceOperationCollectionDoc.h" - -namespace Caf { - -/// A simple container for objects of type ActionClassInstance -class SCHEMATYPESDOC_LINKAGE CActionClassInstanceDoc { -public: - CActionClassInstanceDoc(); - virtual ~CActionClassInstanceDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::string namespaceVal, - const std::string name, - const std::string version, - const SmartPtrCInstanceOperationCollectionDoc instanceOperationCollection); - -public: - /// Accessor for the NamespaceVal - std::string getNamespaceVal() const; - - /// Accessor for the Name - std::string getName() const; - - /// Accessor for the Version - std::string getVersion() const; - - /// Accessor for the InstanceOperationCollection - SmartPtrCInstanceOperationCollectionDoc getInstanceOperationCollection() const; - -private: - bool _isInitialized; - - std::string _namespaceVal; - std::string _name; - std::string _version; - SmartPtrCInstanceOperationCollectionDoc _instanceOperationCollection; - -private: - CAF_CM_DECLARE_NOCOPY(CActionClassInstanceDoc); -}; - -CAF_DECLARE_SMART_POINTER(CActionClassInstanceDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CClassCardinalityDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CClassCardinalityDoc.h deleted file mode 100644 index 46c689b1e..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CClassCardinalityDoc.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CClassCardinalityDoc_h_ -#define CClassCardinalityDoc_h_ - -namespace Caf { - -/// Class description of one end of a relationship -class SCHEMATYPESDOC_LINKAGE CClassCardinalityDoc { -public: - CClassCardinalityDoc(); - virtual ~CClassCardinalityDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::string namespaceVal, - const std::string name, - const std::string version, - const std::string cardinality); - -public: - /// Accessor for the NamespaceVal - std::string getNamespaceVal() const; - - /// Accessor for the Name - std::string getName() const; - - /// Accessor for the Version - std::string getVersion() const; - - /// Cardinality of one end relationship, i.e. has one, has many, etc - std::string getCardinality() const; - -private: - bool _isInitialized; - - std::string _namespaceVal; - std::string _name; - std::string _version; - std::string _cardinality; - -private: - CAF_CM_DECLARE_NOCOPY(CClassCardinalityDoc); -}; - -CAF_DECLARE_SMART_POINTER(CClassCardinalityDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CClassFieldDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CClassFieldDoc.h deleted file mode 100644 index 60517e6b5..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CClassFieldDoc.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CClassFieldDoc_h_ -#define CClassFieldDoc_h_ - -namespace Caf { - -/// Description of a class and the field used to identify one end of a relationship -class SCHEMATYPESDOC_LINKAGE CClassFieldDoc { -public: - CClassFieldDoc(); - virtual ~CClassFieldDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::string namespaceVal, - const std::string name, - const std::string version, - const std::string field); - -public: - /// Accessor for the NamespaceVal - std::string getNamespaceVal() const; - - /// Accessor for the Name - std::string getName() const; - - /// Accessor for the Version - std::string getVersion() const; - - /// Description of a class field used to identify one end of a relationship - std::string getField() const; - -private: - bool _isInitialized; - - std::string _namespaceVal; - std::string _name; - std::string _version; - std::string _field; - -private: - CAF_CM_DECLARE_NOCOPY(CClassFieldDoc); -}; - -CAF_DECLARE_SMART_POINTER(CClassFieldDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CClassIdentifierDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CClassIdentifierDoc.h deleted file mode 100644 index 42fa3d897..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CClassIdentifierDoc.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CClassIdentifierDoc_h_ -#define CClassIdentifierDoc_h_ - -namespace Caf { - -/// Tuple of values to uniquely identify a class -class SCHEMATYPESDOC_LINKAGE CClassIdentifierDoc { -public: - CClassIdentifierDoc(); - virtual ~CClassIdentifierDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::string namespaceVal, - const std::string name, - const std::string version); - -public: - /// Accessor for the NamespaceVal - std::string getNamespaceVal() const; - - /// Accessor for the Name - std::string getName() const; - - /// Accessor for the Version - std::string getVersion() const; - -private: - bool _isInitialized; - - std::string _namespaceVal; - std::string _name; - std::string _version; - -private: - CAF_CM_DECLARE_NOCOPY(CClassIdentifierDoc); -}; - -CAF_DECLARE_SMART_POINTER(CClassIdentifierDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CClassInstancePropertyDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CClassInstancePropertyDoc.h deleted file mode 100644 index 0140a46e6..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CClassInstancePropertyDoc.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CClassInstancePropertyDoc_h_ -#define CClassInstancePropertyDoc_h_ - - -#include "Doc/SchemaTypesDoc/CClassIdentifierDoc.h" - -namespace Caf { - -/// Definition of an attribute (field) of a class -class SCHEMATYPESDOC_LINKAGE CClassInstancePropertyDoc { -public: - CClassInstancePropertyDoc(); - virtual ~CClassInstancePropertyDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::string name, - const std::deque type, - const bool required = false, - const bool transientVal = false, - const bool list = false, - const std::string displayName = std::string(), - const std::string description = std::string()); - -public: - /// Property name - std::string getName() const; - - /// Accessor for the Type - std::deque getType() const; - - /// Whether this is a required property, i.e. this property must always be non-empty - bool getRequired() const; - - /// Accessor for the TransientVal - bool getTransientVal() const; - - /// Indicates whether to expect a list of properties in the provider response - bool getList() const; - - /// A hint as to what this property should be called when displaying it to a human - std::string getDisplayName() const; - - /// A phrase to describe the property for mouse-over text, etc - std::string getDescription() const; - -private: - std::string _name; - std::deque _type; - bool _required; - bool _transientVal; - bool _list; - std::string _displayName; - std::string _description; - bool _isInitialized; - -private: - CAF_CM_DECLARE_NOCOPY(CClassInstancePropertyDoc); -}; - -CAF_DECLARE_SMART_POINTER(CClassInstancePropertyDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CClassPropertyDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CClassPropertyDoc.h deleted file mode 100644 index 24745480a..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CClassPropertyDoc.h +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CClassPropertyDoc_h_ -#define CClassPropertyDoc_h_ - -#include "Doc/CafCoreTypesDoc/CafCoreTypesDocTypes.h" -#include "Doc/SchemaTypesDoc/SchemaTypesDocTypes.h" - -namespace Caf { - -/// Definition of an attribute (field) of a class -class SCHEMATYPESDOC_LINKAGE CClassPropertyDoc { -public: - CClassPropertyDoc(); - virtual ~CClassPropertyDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::string name, - const PROPERTY_TYPE type, - const std::deque value, - const bool required = false, - const bool key = false, - const bool list = false, - const bool caseSensitive = false, - const bool transientVal = false, - const std::string defaultVal = std::string(), - const VALIDATOR_TYPE validator = VALIDATOR_NONE, - const std::string upperRange = std::string(), - const std::string lowerRange = std::string(), - const std::string displayName = std::string(), - const std::string description = std::string()); - -public: - /// Property name - std::string getName() const; - - /// Describes the data type of the property - PROPERTY_TYPE getType() const; - - /// The contents of a validator used on this property - std::deque getValue() const; - - /// Whether this is a required property, i.e. this property must always be non-empty - bool getRequired() const; - - /// Indicates this property may be used as a key identifying field - bool getKey() const; - - /// Indicates whether to expect a list of properties in the provider response - bool getList() const; - - /// Indicates whether a string field should be treated in a case-sensitive manner - bool getCaseSensitive() const; - - /// Accessor for the TransientVal - bool getTransientVal() const; - - /// Accessor for the DefaultVal - std::string getDefaultVal() const; - - /// The type of validator described in the 'value' sub-elements - VALIDATOR_TYPE getValidator() const; - - /// If a 'range' validator is in use, this describes the upper limit of allowable values for the property. QUESTIONABLE: how do we determine inclusive or exclusive range - std::string getUpperRange() const; - - /// If a 'range' validator is in use, this describes the lower limit of allowable values for the property. QUESTIONABLE: how do we determine inclusive or exclusive range - std::string getLowerRange() const; - - /// A hint as to what this property should be called when displaying it to a human - std::string getDisplayName() const; - - /// A phrase to describe the property for mouse-over text, etc - std::string getDescription() const; - -private: - std::string _name; - PROPERTY_TYPE _type; - std::deque _value; - bool _required; - bool _key; - bool _list; - bool _caseSensitive; - bool _transientVal; - std::string _defaultVal; - VALIDATOR_TYPE _validator; - std::string _upperRange; - std::string _lowerRange; - std::string _displayName; - std::string _description; - bool _isInitialized; - -private: - CAF_CM_DECLARE_NOCOPY(CClassPropertyDoc); -}; - -CAF_DECLARE_SMART_POINTER(CClassPropertyDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CCmdlMetadataDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CCmdlMetadataDoc.h deleted file mode 100644 index b8944e7ee..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CCmdlMetadataDoc.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CCmdlMetadataDoc_h_ -#define CCmdlMetadataDoc_h_ - -namespace Caf { - -/// A simple container for objects of type CmdlMetadata -class SCHEMATYPESDOC_LINKAGE CCmdlMetadataDoc { -public: - CCmdlMetadataDoc(); - virtual ~CCmdlMetadataDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::string name, - const std::string value); - -public: - /// Accessor for the Name - std::string getName() const; - - /// Accessor for the Value - std::string getValue() const; - -private: - bool _isInitialized; - - std::string _name; - std::string _value; - -private: - CAF_CM_DECLARE_NOCOPY(CCmdlMetadataDoc); -}; - -CAF_DECLARE_SMART_POINTER(CCmdlMetadataDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CCmdlUnionDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CCmdlUnionDoc.h deleted file mode 100644 index 994044b4c..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CCmdlUnionDoc.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CCmdlUnionDoc_h_ -#define CCmdlUnionDoc_h_ - -namespace Caf { - -/// A simple container for objects of type CmdlUnion -class SCHEMATYPESDOC_LINKAGE CCmdlUnionDoc { -public: - CCmdlUnionDoc(); - virtual ~CCmdlUnionDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::string namespaceVal, - const std::string name, - const std::string version); - -public: - /// Accessor for the NamespaceVal - std::string getNamespaceVal() const; - - /// Accessor for the Name - std::string getName() const; - - /// Accessor for the Version - std::string getVersion() const; - -private: - bool _isInitialized; - - std::string _namespaceVal; - std::string _name; - std::string _version; - -private: - CAF_CM_DECLARE_NOCOPY(CCmdlUnionDoc); -}; - -CAF_DECLARE_SMART_POINTER(CCmdlUnionDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CCollectMethodDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CCollectMethodDoc.h deleted file mode 100644 index efa48502b..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CCollectMethodDoc.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CCollectMethodDoc_h_ -#define CCollectMethodDoc_h_ - - -#include "Doc/SchemaTypesDoc/CClassIdentifierDoc.h" -#include "Doc/SchemaTypesDoc/CInstanceParameterDoc.h" -#include "Doc/SchemaTypesDoc/CMethodParameterDoc.h" - -namespace Caf { - -/// Definition of a collection method on a class -class SCHEMATYPESDOC_LINKAGE CCollectMethodDoc { -public: - CCollectMethodDoc(); - virtual ~CCollectMethodDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::string name, - const std::deque parameterCollection = std::deque(), - const std::deque instanceParameterCollection = std::deque(), - const std::deque returnValCollection = std::deque(), - const std::deque eventValCollection = std::deque(), - const std::deque errorCollection = std::deque()); - -public: - /// name of the collection method - std::string getName() const; - - /// Definition of a parameter that passes simple types to the collection method - std::deque getParameterCollection() const; - - /// Definition of a parameter passing data class instances to the collection method - std::deque getInstanceParameterCollection() const; - - /// Accessor for the ReturnVal - std::deque getReturnValCollection() const; - - /// Accessor for the EventVal - std::deque getEventValCollection() const; - - /// A class that may be returned to indicate an error occurred during the processing of the collection method - std::deque getErrorCollection() const; - -private: - bool _isInitialized; - - std::string _name; - std::deque _parameterCollection; - std::deque _instanceParameterCollection; - std::deque _returnValCollection; - std::deque _eventValCollection; - std::deque _errorCollection; - -private: - CAF_CM_DECLARE_NOCOPY(CCollectMethodDoc); -}; - -CAF_DECLARE_SMART_POINTER(CCollectMethodDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CDataClassDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CDataClassDoc.h deleted file mode 100644 index 8cc703c91..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CDataClassDoc.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CDataClassDoc_h_ -#define CDataClassDoc_h_ - - -#include "Doc/SchemaTypesDoc/CClassInstancePropertyDoc.h" -#include "Doc/SchemaTypesDoc/CClassPropertyDoc.h" - -namespace Caf { - -/// Definition of a data class that may be generated by the provider -class SCHEMATYPESDOC_LINKAGE CDataClassDoc { -public: - CDataClassDoc(); - virtual ~CDataClassDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::string namespaceVal, - const std::string name, - const std::string version, - const std::deque propertyCollection = std::deque(), - const std::deque instancePropertyCollection = std::deque(), - const bool unique = false, - const bool transientVal = false, - const std::string displayName = std::string(), - const std::string description = std::string()); - -public: - /// Accessor for the NamespaceVal - std::string getNamespaceVal() const; - - /// Accessor for the Name - std::string getName() const; - - /// Accessor for the Version - std::string getVersion() const; - - /// Accessor for the Property - std::deque getPropertyCollection() const; - - /// Accessor for the InstanceProperty - std::deque getInstancePropertyCollection() const; - - /// Indicates whether the key properties of this class are enough to guarantee uniqueness from other classes of the same type - bool getUnique() const; - - /// Accessor for the TransientVal - bool getTransientVal() const; - - /// A hint as to what this class should be called when displaying it to a human - std::string getDisplayName() const; - - /// A phrase to describe the class for mouse-over text, etc - std::string getDescription() const; - -private: - std::string _namespaceVal; - std::string _name; - std::string _version; - std::deque _propertyCollection; - std::deque _instancePropertyCollection; - bool _unique; - bool _transientVal; - std::string _displayName; - std::string _description; - bool _isInitialized; - -private: - CAF_CM_DECLARE_NOCOPY(CDataClassDoc); -}; - -CAF_DECLARE_SMART_POINTER(CDataClassDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CDataClassInstanceCollectionDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CDataClassInstanceCollectionDoc.h deleted file mode 100644 index 4d2570ce4..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CDataClassInstanceCollectionDoc.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CDataClassInstanceCollectionDoc_h_ -#define CDataClassInstanceCollectionDoc_h_ - - -#include "Doc/SchemaTypesDoc/CDataClassInstanceDoc.h" - -namespace Caf { - -/// A simple container for objects of type DataClassInstanceCollection -class SCHEMATYPESDOC_LINKAGE CDataClassInstanceCollectionDoc { -public: - CDataClassInstanceCollectionDoc(); - virtual ~CDataClassInstanceCollectionDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::deque dataClassInstanceCollection = std::deque()); - -public: - /// Accessor for the DataClassInstance - std::deque getDataClassInstanceCollection() const; - -private: - bool _isInitialized; - - std::deque _dataClassInstanceCollection; - -private: - CAF_CM_DECLARE_NOCOPY(CDataClassInstanceCollectionDoc); -}; - -CAF_DECLARE_SMART_POINTER(CDataClassInstanceCollectionDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CDataClassInstanceDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CDataClassInstanceDoc.h deleted file mode 100644 index 904067fde..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CDataClassInstanceDoc.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CDataClassInstanceDoc_h_ -#define CDataClassInstanceDoc_h_ - - -#include "Doc/SchemaTypesDoc/CCmdlMetadataDoc.h" -#include "Doc/SchemaTypesDoc/CCmdlUnionDoc.h" -#include "Doc/SchemaTypesDoc/CDataClassPropertyDoc.h" -#include "Doc/SchemaTypesDoc/CDataClassSubInstanceDoc.h" - -namespace Caf { - -/// A simple container for objects of type DataClassInstance -class SCHEMATYPESDOC_LINKAGE CDataClassInstanceDoc { -public: - CDataClassInstanceDoc(); - virtual ~CDataClassInstanceDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::string namespaceVal, - const std::string name, - const std::string version, - const std::deque cmdlMetadataCollection, - const std::deque propertyCollection, - const std::deque instancePropertyCollection, - const SmartPtrCCmdlUnionDoc cmdlUnion); - -public: - /// Accessor for the NamespaceVal - std::string getNamespaceVal() const; - - /// Accessor for the Name - std::string getName() const; - - /// Accessor for the Version - std::string getVersion() const; - - /// Accessor for the CmdlMetadata - std::deque getCmdlMetadataCollection() const; - - /// Accessor for the Property - std::deque getPropertyCollection() const; - - /// Accessor for the InstanceProperty - std::deque getInstancePropertyCollection() const; - - /// Accessor for the CmdlUnion - SmartPtrCCmdlUnionDoc getCmdlUnion() const; - -private: - bool _isInitialized; - - std::string _namespaceVal; - std::string _name; - std::string _version; - std::deque _cmdlMetadataCollection; - std::deque _propertyCollection; - std::deque _instancePropertyCollection; - SmartPtrCCmdlUnionDoc _cmdlUnion; - -private: - CAF_CM_DECLARE_NOCOPY(CDataClassInstanceDoc); -}; - -CAF_DECLARE_SMART_POINTER(CDataClassInstanceDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CDataClassPropertyDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CDataClassPropertyDoc.h deleted file mode 100644 index ee0a80e96..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CDataClassPropertyDoc.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CDataClassPropertyDoc_h_ -#define CDataClassPropertyDoc_h_ - - -#include "Doc/SchemaTypesDoc/CCmdlMetadataDoc.h" - -namespace Caf { - -/// A simple container for objects of type DataClassProperty -class SCHEMATYPESDOC_LINKAGE CDataClassPropertyDoc { -public: - CDataClassPropertyDoc(); - virtual ~CDataClassPropertyDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::string name, - const std::deque cmdlMetadata, - const std::string value); - -public: - /// Accessor for the Name - std::string getName() const; - - /// Accessor for the CmdlMetadata - std::deque getCmdlMetadata() const; - - /// Accessor for the Value - std::string getValue() const; - -private: - bool _isInitialized; - - std::string _name; - std::deque _cmdlMetadata; - std::string _value; - -private: - CAF_CM_DECLARE_NOCOPY(CDataClassPropertyDoc); -}; - -CAF_DECLARE_SMART_POINTER(CDataClassPropertyDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CDataClassSubInstanceDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CDataClassSubInstanceDoc.h deleted file mode 100644 index 83126730b..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CDataClassSubInstanceDoc.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CDataClassSubInstanceDoc_h_ -#define CDataClassSubInstanceDoc_h_ - -#include "Doc/SchemaTypesDoc/CCmdlMetadataDoc.h" -#include "Doc/SchemaTypesDoc/CCmdlUnionDoc.h" -#include "Doc/SchemaTypesDoc/CDataClassPropertyDoc.h" - -namespace Caf { - -CAF_DECLARE_CLASS_AND_SMART_POINTER(CDataClassSubInstanceDoc); - -/// A simple container for objects of type DataClassSubInstance -class SCHEMATYPESDOC_LINKAGE CDataClassSubInstanceDoc { -public: - CDataClassSubInstanceDoc(); - virtual ~CDataClassSubInstanceDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::string name, - const std::deque cmdlMetadataCollection, - const std::deque propertyCollection, - const std::deque instancePropertyCollection, - const SmartPtrCCmdlUnionDoc cmdlUnion); - -public: - /// Accessor for the Name - std::string getName() const; - - /// Accessor for the CmdlMetadata - std::deque getCmdlMetadataCollection() const; - - /// Accessor for the Property - std::deque getPropertyCollection() const; - - /// Accessor for the InstanceProperty - std::deque getInstancePropertyCollection() const; - - /// Accessor for the CmdlUnion - SmartPtrCCmdlUnionDoc getCmdlUnion() const; - -private: - bool _isInitialized; - - std::string _name; - std::deque _cmdlMetadataCollection; - std::deque _propertyCollection; - std::deque _instancePropertyCollection; - SmartPtrCCmdlUnionDoc _cmdlUnion; - -private: - CAF_CM_DECLARE_NOCOPY(CDataClassSubInstanceDoc); -}; - -CAF_DECLARE_SMART_POINTER(CDataClassSubInstanceDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CInstanceOperationCollectionDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CInstanceOperationCollectionDoc.h deleted file mode 100644 index 7eb403d4c..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CInstanceOperationCollectionDoc.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CInstanceOperationCollectionDoc_h_ -#define CInstanceOperationCollectionDoc_h_ - - -#include "Doc/SchemaTypesDoc/CInstanceOperationDoc.h" - -namespace Caf { - -/// A simple container for objects of type InstanceOperationCollection -class SCHEMATYPESDOC_LINKAGE CInstanceOperationCollectionDoc { -public: - CInstanceOperationCollectionDoc(); - virtual ~CInstanceOperationCollectionDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::deque instanceOperationCollection); - -public: - /// Accessor for the InstanceOperation - std::deque getInstanceOperationCollection() const; - -private: - bool _isInitialized; - - std::deque _instanceOperationCollection; - -private: - CAF_CM_DECLARE_NOCOPY(CInstanceOperationCollectionDoc); -}; - -CAF_DECLARE_SMART_POINTER(CInstanceOperationCollectionDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CInstanceOperationDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CInstanceOperationDoc.h deleted file mode 100644 index 33081b6de..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CInstanceOperationDoc.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CInstanceOperationDoc_h_ -#define CInstanceOperationDoc_h_ - -namespace Caf { - -/// A simple container for objects of type InstanceOperation -class SCHEMATYPESDOC_LINKAGE CInstanceOperationDoc { -public: - CInstanceOperationDoc(); - virtual ~CInstanceOperationDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::string operationName, - const std::string moniker); - -public: - /// Accessor for the OperationName - std::string getOperationName() const; - - /// Accessor for the Moniker - std::string getMoniker() const; - -private: - bool _isInitialized; - - std::string _operationName; - std::string _moniker; - -private: - CAF_CM_DECLARE_NOCOPY(CInstanceOperationDoc); -}; - -CAF_DECLARE_SMART_POINTER(CInstanceOperationDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CInstanceParameterDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CInstanceParameterDoc.h deleted file mode 100644 index c7ea21986..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CInstanceParameterDoc.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CInstanceParameterDoc_h_ -#define CInstanceParameterDoc_h_ - -namespace Caf { - -/// A parameter containing a data class instance used by a method to control the outcome -class SCHEMATYPESDOC_LINKAGE CInstanceParameterDoc { -public: - CInstanceParameterDoc(); - virtual ~CInstanceParameterDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::string name, - const std::string instanceNamespace, - const std::string instanceName, - const std::string instanceVersion, - const bool isOptional = false, - const bool isList = false, - const std::string displayName = std::string(), - const std::string description = std::string()); - -public: - /// Name of parameter - std::string getName() const; - - /// Namespace of instance object type - std::string getInstanceNamespace() const; - - /// Name of instance object type - std::string getInstanceName() const; - - /// Version of instance object type - std::string getInstanceVersion() const; - - /// Indicates this parameter need not be passed - bool getIsOptional() const; - - /// Indicates whether to expect a list of values as opposed to a single value (the default if this attribute is not present) - bool getIsList() const; - - /// Human-readable version of the parameter name - std::string getDisplayName() const; - - /// Short description of what the parameter is for - std::string getDescription() const; - -private: - std::string _name; - std::string _instanceNamespace; - std::string _instanceName; - std::string _instanceVersion; - bool _isOptional; - bool _isList; - std::string _displayName; - std::string _description; - bool _isInitialized; - -private: - CAF_CM_DECLARE_NOCOPY(CInstanceParameterDoc); -}; - -CAF_DECLARE_SMART_POINTER(CInstanceParameterDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CJoinTypeDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CJoinTypeDoc.h deleted file mode 100644 index 17fb2b41e..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CJoinTypeDoc.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CJoinTypeDoc_h_ -#define CJoinTypeDoc_h_ - - -#include "Doc/SchemaTypesDoc/CClassFieldDoc.h" -#include "Doc/SchemaTypesDoc/SchemaTypesDocTypes.h" - -namespace Caf { - -/// A simple container for objects of type JoinType -class SCHEMATYPESDOC_LINKAGE CJoinTypeDoc { -public: - CJoinTypeDoc(); - virtual ~CJoinTypeDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const OPERATOR_TYPE operand, - const SmartPtrCClassFieldDoc dataClassLeft, - const SmartPtrCClassFieldDoc dataClassRight, - const std::string description); - -public: - /// Defines the operand used to join the class fields. Restricted to '=' for now - OPERATOR_TYPE getOperand() const; - - /// Identifies the fields on classes that uniquely identify relationship - SmartPtrCClassFieldDoc getDataClassLeft() const; - - /// Identifies the fields on classes that uniquely identify relationship - SmartPtrCClassFieldDoc getDataClassRight() const; - - /// A short human-readable description of the join - std::string getDescription() const; - -private: - OPERATOR_TYPE _operand; - SmartPtrCClassFieldDoc _dataClassLeft; - SmartPtrCClassFieldDoc _dataClassRight; - std::string _description; - bool _isInitialized; - -private: - CAF_CM_DECLARE_NOCOPY(CJoinTypeDoc); -}; - -CAF_DECLARE_SMART_POINTER(CJoinTypeDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CLogicalRelationshipDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CLogicalRelationshipDoc.h deleted file mode 100644 index 9b9d1d6d4..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CLogicalRelationshipDoc.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CLogicalRelationshipDoc_h_ -#define CLogicalRelationshipDoc_h_ - - -#include "Doc/SchemaTypesDoc/CClassCardinalityDoc.h" -#include "Doc/SchemaTypesDoc/SchemaTypesDocTypes.h" -#include "Doc/SchemaTypesDoc/CJoinTypeDoc.h" - -namespace Caf { - -/// Definition of a relationship between classes that can be described by identifying the fields on the classes that uniquely identify the relationship -class SCHEMATYPESDOC_LINKAGE CLogicalRelationshipDoc { -public: - CLogicalRelationshipDoc(); - virtual ~CLogicalRelationshipDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::string namespaceVal, - const std::string name, - const std::string version, - const ARITY_TYPE arity, - const SmartPtrCClassCardinalityDoc dataClassLeft, - const SmartPtrCClassCardinalityDoc dataClassRight, - const std::deque joinCollection, - const std::string description = std::string()); - -public: - /// Accessor for the NamespaceVal - std::string getNamespaceVal() const; - - /// Accessor for the Name - std::string getName() const; - - /// Accessor for the Version - std::string getVersion() const; - - /// Accessor for the Arity - ARITY_TYPE getArity() const; - - /// Accessor for the DataClassLeft - SmartPtrCClassCardinalityDoc getDataClassLeft() const; - - /// Accessor for the DataClassRight - SmartPtrCClassCardinalityDoc getDataClassRight() const; - - /// Defines a join condition of the relationship - std::deque getJoinCollection() const; - - /// Accessor for the Description - std::string getDescription() const; - -private: - std::string _namespaceVal; - std::string _name; - std::string _version; - ARITY_TYPE _arity; - SmartPtrCClassCardinalityDoc _dataClassLeft; - SmartPtrCClassCardinalityDoc _dataClassRight; - std::deque _joinCollection; - std::string _description; - bool _isInitialized; - -private: - CAF_CM_DECLARE_NOCOPY(CLogicalRelationshipDoc); -}; - -CAF_DECLARE_SMART_POINTER(CLogicalRelationshipDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CMethodDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CMethodDoc.h deleted file mode 100644 index 1654b0697..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CMethodDoc.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CMethodDoc_h_ -#define CMethodDoc_h_ - - -#include "Doc/SchemaTypesDoc/CClassIdentifierDoc.h" -#include "Doc/SchemaTypesDoc/CInstanceParameterDoc.h" -#include "Doc/SchemaTypesDoc/CMethodParameterDoc.h" - -namespace Caf { - -/// Definition of a method on a class -class SCHEMATYPESDOC_LINKAGE CMethodDoc { -public: - CMethodDoc(); - virtual ~CMethodDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::string name, - const std::deque parameterCollection = std::deque(), - const std::deque instanceParameterCollection = std::deque(), - const std::deque returnValCollection = std::deque(), - const std::deque eventValCollection = std::deque(), - const std::deque errorCollection = std::deque(), - const std::string displayName = std::string(), - const std::string description = std::string()); - -public: - /// name of the method - std::string getName() const; - - /// Definition of a parameter that passes simple types to the method - std::deque getParameterCollection() const; - - /// Definition of a parameter that passes data class instances to the method - std::deque getInstanceParameterCollection() const; - - /// Accessor for the ReturnVal - std::deque getReturnValCollection() const; - - /// Accessor for the EventVal - std::deque getEventValCollection() const; - - /// A class that may be returned to indicate an error occurred during the processing of the collection method - std::deque getErrorCollection() const; - - /// Human-readable version of the method name - std::string getDisplayName() const; - - /// A short phrase describing the purpose of the method - std::string getDescription() const; - -private: - bool _isInitialized; - - std::string _name; - std::deque _parameterCollection; - std::deque _instanceParameterCollection; - std::deque _returnValCollection; - std::deque _eventValCollection; - std::deque _errorCollection; - std::string _displayName; - std::string _description; - -private: - CAF_CM_DECLARE_NOCOPY(CMethodDoc); -}; - -CAF_DECLARE_SMART_POINTER(CMethodDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CMethodParameterDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CMethodParameterDoc.h deleted file mode 100644 index 607d5a27e..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CMethodParameterDoc.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CMethodParameterDoc_h_ -#define CMethodParameterDoc_h_ - -#include "Doc/CafCoreTypesDoc/CafCoreTypesDocTypes.h" - -namespace Caf { - -/// A parameter containing a simple type used by a method to control the outcome -class SCHEMATYPESDOC_LINKAGE CMethodParameterDoc { -public: - CMethodParameterDoc(); - virtual ~CMethodParameterDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::string name, - const PARAMETER_TYPE type, - const bool isOptional = false, - const bool isList = false, - const std::string defaultVal = std::string(), - const std::string displayName = std::string(), - const std::string description = std::string()); - -public: - /// Name of parameter - std::string getName() const; - - /// Describes the data type of the property - PARAMETER_TYPE getType() const; - - /// Indicates this parameter need not be passed - bool getIsOptional() const; - - /// Indicates whether to expect a list of values as opposed to a single value (the default if this attribute is not present) - bool getIsList() const; - - /// Accessor for the DefaultVal - std::string getDefaultVal() const; - - /// Human-readable version of the parameter name - std::string getDisplayName() const; - - /// Short description of what the parameter is for - std::string getDescription() const; - -private: - std::string _name; - PARAMETER_TYPE _type; - bool _isOptional; - bool _isList; - std::string _defaultVal; - std::string _displayName; - std::string _description; - bool _isInitialized; - -private: - CAF_CM_DECLARE_NOCOPY(CMethodParameterDoc); -}; - -CAF_DECLARE_SMART_POINTER(CMethodParameterDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CPhysicalRelationshipDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CPhysicalRelationshipDoc.h deleted file mode 100644 index 1904f22df..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CPhysicalRelationshipDoc.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CPhysicalRelationshipDoc_h_ -#define CPhysicalRelationshipDoc_h_ - - -#include "Doc/SchemaTypesDoc/CClassCardinalityDoc.h" -#include "Doc/SchemaTypesDoc/SchemaTypesDocTypes.h" - -namespace Caf { - -/// Describes a relationship between dataclass where the key information from data class instances comprising the relationship are listed in an instance of this class -class SCHEMATYPESDOC_LINKAGE CPhysicalRelationshipDoc { -public: - CPhysicalRelationshipDoc(); - virtual ~CPhysicalRelationshipDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::string namespaceVal, - const std::string name, - const std::string version, - const ARITY_TYPE arity, - const SmartPtrCClassCardinalityDoc dataClassLeft, - const SmartPtrCClassCardinalityDoc dataClassRight, - const std::string description = std::string()); - -public: - /// Accessor for the NamespaceVal - std::string getNamespaceVal() const; - - /// Accessor for the Name - std::string getName() const; - - /// Accessor for the Version - std::string getVersion() const; - - /// Accessor for the Arity - ARITY_TYPE getArity() const; - - /// Accessor for the DataClassLeft - SmartPtrCClassCardinalityDoc getDataClassLeft() const; - - /// Accessor for the DataClassRight - SmartPtrCClassCardinalityDoc getDataClassRight() const; - - /// Accessor for the Description - std::string getDescription() const; - -private: - std::string _namespaceVal; - std::string _name; - std::string _version; - ARITY_TYPE _arity; - SmartPtrCClassCardinalityDoc _dataClassLeft; - SmartPtrCClassCardinalityDoc _dataClassRight; - std::string _description; - bool _isInitialized; - -private: - CAF_CM_DECLARE_NOCOPY(CPhysicalRelationshipDoc); -}; - -CAF_DECLARE_SMART_POINTER(CPhysicalRelationshipDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CRelationshipDoc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CRelationshipDoc.h deleted file mode 100644 index 057d14948..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/CRelationshipDoc.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#ifndef CRelationshipDoc_h_ -#define CRelationshipDoc_h_ - - -#include "Doc/SchemaTypesDoc/CClassCardinalityDoc.h" -#include "Doc/SchemaTypesDoc/SchemaTypesDocTypes.h" - -namespace Caf { - -/// Definition of a relationship between data classes -class SCHEMATYPESDOC_LINKAGE CRelationshipDoc { -public: - CRelationshipDoc(); - virtual ~CRelationshipDoc(); - -public: - /// Initializes the object with everything required by this - /// container. Once initialized, this object cannot - /// be changed (i.e. it is immutable). - void initialize( - const std::string namespaceVal, - const std::string name, - const std::string version, - const ARITY_TYPE arity, - const SmartPtrCClassCardinalityDoc dataClassLeft, - const SmartPtrCClassCardinalityDoc dataClassRight, - const std::string description = std::string()); - -public: - /// Accessor for the NamespaceVal - std::string getNamespaceVal() const; - - /// Accessor for the Name - std::string getName() const; - - /// Accessor for the Version - std::string getVersion() const; - - /// Number of parts (sides) to relationship. Restricted to a two-sided relationship for now - ARITY_TYPE getArity() const; - - /// Identifies the two classes that make up the relationship - SmartPtrCClassCardinalityDoc getDataClassLeft() const; - - /// Identifies the two classes that make up the relationship - SmartPtrCClassCardinalityDoc getDataClassRight() const; - - /// A short human-readable description of the relationship - std::string getDescription() const; - -private: - std::string _namespaceVal; - std::string _name; - std::string _version; - ARITY_TYPE _arity; - SmartPtrCClassCardinalityDoc _dataClassLeft; - SmartPtrCClassCardinalityDoc _dataClassRight; - std::string _description; - bool _isInitialized; - - -private: - CAF_CM_DECLARE_NOCOPY(CRelationshipDoc); -}; - -CAF_DECLARE_SMART_POINTER(CRelationshipDoc); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/SchemaTypesDocLink.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/SchemaTypesDocLink.h deleted file mode 100644 index d817b550d..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/SchemaTypesDocLink.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Author: bwilliams - * Created: February 25, 2016 - * - * Copyright (C) 2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#ifndef SchemaTypesDoc_Link_h_ -#define SchemaTypesDoc_Link_h_ - -#ifndef SCHEMATYPESDOC_LINKAGE - #ifdef WIN32 - #ifdef FRAMEWORK_BUILD - #define SCHEMATYPESDOC_LINKAGE __declspec(dllexport) - #else - #define SCHEMATYPESDOC_LINKAGE __declspec(dllimport) - #endif - #else - #define SCHEMATYPESDOC_LINKAGE - #endif -#endif - - -#endif /* SchemaTypesDoc_Link_h_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/SchemaTypesDocTypes.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/SchemaTypesDocTypes.h deleted file mode 100644 index 8c56d8b84..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Doc/SchemaTypesDoc/SchemaTypesDocTypes.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef SCHEMATYPESDOCTYPES_H_ -#define SCHEMATYPESDOCTYPES_H_ - -#include "Doc/SchemaTypesDoc/SchemaTypesDocTypes.h" - -namespace Caf { - typedef enum { - OPERATOR_NONE, - OPERATOR_EQUAL - } OPERATOR_TYPE; - - typedef enum { - ARITY_NONE, - ARITY_UNSIGNED_BYTE = 2 - } ARITY_TYPE; - - typedef enum { - VALIDATOR_NONE, - VALIDATOR_ENUM, - VALIDATOR_RANGE, - VALIDATOR_REGEX, - VALIDATOR_CUSTOM - } VALIDATOR_TYPE; -} - -#endif /* SCHEMATYPESDOCTYPES_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/DocContracts.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/DocContracts.h deleted file mode 100644 index ad0baad53..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/DocContracts.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef DocContracts_h_ -#define DocContracts_h_ - -#include "Doc/CafCoreTypesDoc/CafCoreTypesDocLink.h" -#include "Doc/SchemaTypesDoc/SchemaTypesDocLink.h" -#include "Doc/DiagTypesDoc/DiagTypesDocLink.h" -#include "Doc/DiagRequestDoc/DiagRequestDocLink.h" -#include "Doc/MgmtTypesDoc/MgmtTypesDocLink.h" -#include "Doc/MgmtRequestDoc/MgmtRequestDocLink.h" -#include "Doc/PayloadEnvelopeDoc/PayloadEnvelopeDocLink.h" -#include "Doc/PersistenceDoc/PersistenceDocLink.h" -#include "Doc/ProviderInfraDoc/ProviderInfraDocLink.h" -#include "Doc/ProviderRequestDoc/ProviderRequestDocLink.h" -#include "Doc/ProviderResultsDoc/ProviderResultsDocLink.h" -#include "Doc/ResponseDoc/ResponseDocLink.h" -#include "Doc/CafInstallRequestDoc/CafInstallRequestDocLink.h" -#include "Doc/MultiPmeMgmtRequestDoc/MultiPmeMgmtRequestDocLink.h" - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/DocUtils.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/DocUtils.h deleted file mode 100644 index faa176b20..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/DocUtils.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 20, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef COMMON_SYS_INC_DOCUTILS_H_ -#define COMMON_SYS_INC_DOCUTILS_H_ - -#include -#include - -#include "../src/Doc/DocUtils/DocUtilsLink.h" - -#endif /* COMMON_SYS_INC_DOCUTILS_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/DocXml.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/DocXml.h deleted file mode 100644 index a37224995..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/DocXml.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 20, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef COMMON_SYS_INC_DOCXML_H_ -#define COMMON_SYS_INC_DOCXML_H_ - -#include -#include - -#include "Doc/DocXml/CafCoreTypesXml/CafCoreTypesXmlLink.h" -#include "Doc/DocXml/SchemaTypesXml/SchemaTypesXmlLink.h" -#include "Doc/DocXml/DiagTypesXml/DiagTypesXmlLink.h" -#include "Doc/DocXml/DiagRequestXml/DiagRequestXmlLink.h" -#include "Doc/DocXml/MgmtTypesXml/MgmtTypesXmlLink.h" -#include "Doc/DocXml/MgmtRequestXml/MgmtRequestXmlLink.h" -#include "Doc/DocXml/PayloadEnvelopeXml/PayloadEnvelopeXmlLink.h" -#include "Doc/DocXml/PersistenceXml/PersistenceXmlLink.h" -#include "Doc/DocXml/ProviderInfraXml/ProviderInfraXmlLink.h" -#include "Doc/DocXml/ProviderRequestXml/ProviderRequestXmlLink.h" -#include "Doc/DocXml/ProviderResultsXml/ProviderResultsXmlLink.h" -#include "Doc/DocXml/ResponseXml/ResponseXmlLink.h" -#include "Doc/DocXml/CafInstallRequestXml/CafInstallRequestXmlLink.h" -#include "Doc/DocXml/MgmtRequestXml/MgmtRequestXmlLink.h" - -#endif /* COMMON_SYS_INC_DOCXML_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Exception/CCafException.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Exception/CCafException.h deleted file mode 100644 index 168cdd276..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Exception/CCafException.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Author: mdonahue - * Created: Jan 13, 2011 - * - * Copyright (C) 2011-2018 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CCAFEXCEPTION_H_ -#define CCAFEXCEPTION_H_ - -#ifdef WIN32 -/* - * * Disable the 'std::basic_string<> needs to have dll-interface to be used by - * * clients of class 'Caf::CCafException' warning. - * */ -#pragma warning(disable : 4251) -#endif - -#include "ICafObject.h" - -namespace Caf { - -class EXCEPTION_LINKAGE CCafException : public ICafObject { -public: - CCafException(); - - CCafException(const std::string& exceptionClassName); - - virtual ~CCafException(); - - virtual void throwSelf(); - - virtual void throwAddRefedSelf(); - - void AddRef(); - - void Release(); - - void QueryInterface(const IID&, void**); - - void populate( - const std::string& message, - const HRESULT errorCode, - const std::string& className, - const std::string& funcName); - - void populateVA(const HRESULT errorCode, - const std::string& className, - const std::string& funcName, - const char* format, - ...); - - bool isPopulated() const; - - std::string getExceptionClassName() const; - - virtual std::string getMsg() const; - - std::string getClassName() const; - - std::string getFuncName() const; - - HRESULT getError() const; - - std::deque* getBacktrace() const; - - virtual std::string getFullMsg() const; - -private: - gint _refCnt; - bool _isPopulated; - -protected: - std::string _exceptionClassName; - HRESULT _errorCode; - std::string _message; - std::string _className; - std::string _funcName; - std::deque* _backtrace; - - CCafException(const CCafException&); - CCafException& operator=(const CCafException&); -}; -CAF_DECLARE_SMART_POINTER(CCafException); - -} - -#endif /* CCAFEXCEPTION_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/FrameworkLink.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/FrameworkLink.h deleted file mode 100644 index 57cd9abed..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/FrameworkLink.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef FrameworkLink_h_ -#define FrameworkLink_h_ - -#ifndef FRAMEWORK_LINKAGE - #ifdef WIN32 - #ifdef FRAMEWORK_BUILD - #define FRAMEWORK_LINKAGE __declspec(dllexport) - #else - #define FRAMEWORK_LINKAGE __declspec(dllimport) - #endif - #else - #define FRAMEWORK_LINKAGE - #endif -#endif - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/IBean.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/IBean.h deleted file mode 100644 index a6c04a5d3..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/IBean.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Author: bwilliams - * Created: Jan 26, 2011 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef _FxContracts_IBean_h_ -#define _FxContracts_IBean_h_ - - -#include "ICafObject.h" - -namespace Caf { - -CAF_FORWARD_DECLARE_SMART_INTERFACE(IBean); - -/// TODO - describe interface -struct __declspec(novtable) -IBean : public ICafObject { - CAF_DECL_UUID("860C6E41-76E4-404b-913F-C330EE864DCD") - - struct CArg { - CArg(const SmartPtrIBean& ref) : - _reference(ref), - _type(REFERENCE) {} - CArg(const std::string& val) : - _value(val), - _type(VALUE) {} - - typedef enum { - REFERENCE, - VALUE - } ARG_TYPE; - - SmartPtrIBean _reference; - std::string _value; - ARG_TYPE _type; - - private: - CArg(); - }; - - typedef std::deque Cargs; - typedef Cmapstrstr Cprops; - - virtual void initializeBean( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties) = 0; - - virtual void terminateBean() = 0; -}; - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/ICafObject.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/ICafObject.h deleted file mode 100644 index d4dbe253b..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/ICafObject.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef _ICafObject_H_ -#define _ICafObject_H_ - -/** - * @brief - * The base interface all classes must support in order to support lifetime management - * and interface retrieval. - *

- * Object lifetime is managed through the AddRef() and Release() methods. Pointers - * to supported interfaces on the object - in the form of TCafSmartPtr - are - * retrieved using the QueryInterface() method. - *

- * Interfaces and classes are candidates for QueryInterface() if they declare - * a unique identifier for the interface or class. The identifier is a - * UUID and is declared using the CAF_DECL_UUID macro. - *

- * Example interface declaration: - *

- * 
- * struct __declspcec(novtable) IMyInterface {
- *
- * 	CAF_DECL_UUID("6AECA0A4-C6B1-4A43-9769-C5A8F56F0B52")
- *
- * 	virtual void Foo() = 0;
- * };
- * 
- * 
- */ -struct __declspec(novtable) ICafObject { - CAF_DECL_UUID("d285ff70-2314-11e0-ac64-0800200c9a66") - - /** @brief Increment the object's reference count */ - virtual void AddRef() = 0; - - /** - * @brief Decrement the object's reference count - *

- * The object will be destroyed when the count reaches zero. - */ - virtual void Release() = 0; - - /** - * @brief Retrieve an interface on the object - * @param IID the interface's UUID - * @param ppv the address into which the retrieve interface's pointer - * will be stored - */ - virtual void QueryInterface(const IID&, void** ppv) = 0; -}; - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/IVariant.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/IVariant.h deleted file mode 100644 index 72049eafb..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/IVariant.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Created on: Jul 23, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef _FxContracts_IVARIANT_H_ -#define _FxContracts_IVARIANT_H_ - - -#include "ICafObject.h" - -namespace Caf { -struct __declspec(novtable) IVariant : public ICafObject { - CAF_DECL_UUID("05AC7CB8-BBD4-4B3B-AB80-29002DD73747") - - virtual GVariant *get() const = 0; - virtual std::string toString() const = 0; - virtual bool isString() const = 0; - virtual bool isBool() const = 0; - virtual bool isUint8() const = 0; - virtual bool isInt16() const = 0; - virtual bool isUint16() const = 0; - virtual bool isInt32() const = 0; - virtual bool isUint32() const = 0; - virtual bool isInt64() const = 0; - virtual bool isUint64() const = 0; -}; -CAF_DECLARE_SMART_INTERFACE_POINTER(IVariant); -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration.h deleted file mode 100644 index 6063fcd4f..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 20, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef COMMON_SYS_INC_INTEGRATION_H_ -#define COMMON_SYS_INC_INTEGRATION_H_ - -#include - -// Dependencies - -// Interfaces -#include "Integration/IThrowable.h" - -#include "Integration/Caf/IntegrationCafLink.h" -#include "Integration/Core/IntegrationCoreLink.h" - -#endif /* COMMON_SYS_INC_INTEGRATION_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Caf/CBeanPropertiesHelper.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Caf/CBeanPropertiesHelper.h deleted file mode 100644 index 204a9754c..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Caf/CBeanPropertiesHelper.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Author: bwilliams - * Created: Jul 2009 - * - * Copyright (C) 2009-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CBeanPropertiesHelper_h_ -#define CBeanPropertiesHelper_h_ - -namespace Caf { - -CAF_DECLARE_CLASS_AND_SMART_POINTER(CBeanPropertiesHelper); - -class INTEGRATIONCAF_LINKAGE CBeanPropertiesHelper { -public: - static SmartPtrCBeanPropertiesHelper create( - const IBean::Cprops& properties); - -public: - CBeanPropertiesHelper(); - virtual ~CBeanPropertiesHelper(); - -public: - void initialize( - const IBean::Cprops& properties); - -public: - std::string getRequiredString( - const std::string& key) const; - - std::string getOptionalString( - const std::string& key, - const std::string& defaultVal = std::string()) const; - - bool getRequiredBool( - const std::string& key) const; - - bool getOptionalBool( - const std::string& key, - const bool defaultVal = false) const; - -private: - bool m_isInitialized; - IBean::Cprops _properties; - -private: - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(CBeanPropertiesHelper); -}; - -} - -#endif // #ifndef CBeanPropertiesHelper_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Caf/CCafMessageCreator.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Caf/CCafMessageCreator.h deleted file mode 100644 index d4e290241..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Caf/CCafMessageCreator.h +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Author: bwilliams - * Created: Jul 2009 - * - * Copyright (C) 2009-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CCafMessageCreator_h_ -#define CCafMessageCreator_h_ - - -#include "Doc/CafCoreTypesDoc/CAttachmentCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CAttachmentDoc.h" -#include "Doc/CafCoreTypesDoc/CProtocolCollectionDoc.h" -#include "Doc/CafInstallRequestDoc/CInstallRequestDoc.h" -#include "Doc/DiagRequestDoc/CDiagRequestDoc.h" -#include "Doc/MgmtRequestDoc/CMgmtRequestDoc.h" -#include "Doc/PayloadEnvelopeDoc/CPayloadEnvelopeDoc.h" -#include "Doc/ProviderInfraDoc/CProviderRegDoc.h" -#include "Doc/ProviderRequestDoc/CProviderCollectSchemaRequestDoc.h" -#include "Doc/ProviderRequestDoc/CProviderRequestDoc.h" -#include "Doc/ResponseDoc/CErrorResponseDoc.h" -#include "Doc/ResponseDoc/CResponseDoc.h" -#include "Integration/IIntMessage.h" -#include "Memory/DynamicArray/DynamicArrayInc.h" - -namespace Caf { - -CAF_DECLARE_CLASS_AND_SMART_POINTER(CCafMessageCreator); - -class INTEGRATIONCAF_LINKAGE CCafMessageCreator { -public: - static SmartPtrIIntMessage createPayloadEnvelope( - const SmartPtrCResponseDoc& response, - const std::string& relFilename, - const IIntMessage::SmartPtrCHeaders& headers = IIntMessage::SmartPtrCHeaders()); - - static SmartPtrIIntMessage createPayloadEnvelope( - const SmartPtrCErrorResponseDoc& errorResponse, - const std::string& relFilename, - const IIntMessage::SmartPtrCHeaders& headers = IIntMessage::SmartPtrCHeaders()); - - static SmartPtrIIntMessage createPayloadEnvelope( - const SmartPtrCMgmtRequestDoc& mgmtRequest, - const IIntMessage::SmartPtrCHeaders& headers = IIntMessage::SmartPtrCHeaders()); - - static SmartPtrIIntMessage createPayloadEnvelope( - const SmartPtrCPayloadEnvelopeDoc& payloadEnvelope, - const std::deque& attachmentCollection, - const IIntMessage::SmartPtrCHeaders& newHeaders = IIntMessage::SmartPtrCHeaders(), - const IIntMessage::SmartPtrCHeaders& origHeaders = IIntMessage::SmartPtrCHeaders()); - -public: - static SmartPtrIIntMessage createFromProviderResponse( - const SmartPtrCDynamicByteArray& providerResponse, - const std::string& relFilename, - const IIntMessage::SmartPtrCHeaders& headers = IIntMessage::SmartPtrCHeaders()); - -public: - static SmartPtrIIntMessage create( - const SmartPtrCDynamicByteArray payload, - const std::deque& attachmentCollection, - const IIntMessage::SmartPtrCHeaders& headers = IIntMessage::SmartPtrCHeaders()); - -public: - static SmartPtrIIntMessage create( - const SmartPtrCMgmtRequestDoc& mgmtRequest, - const IIntMessage::SmartPtrCHeaders& headers = IIntMessage::SmartPtrCHeaders()); - - static SmartPtrIIntMessage create( - const SmartPtrCDiagRequestDoc& diagRequest, - const IIntMessage::SmartPtrCHeaders& headers = IIntMessage::SmartPtrCHeaders()); - - static SmartPtrIIntMessage create( - const SmartPtrCInstallRequestDoc& installRequest, - const IIntMessage::SmartPtrCHeaders& headers = IIntMessage::SmartPtrCHeaders()); - - static SmartPtrIIntMessage create( - const SmartPtrCProviderRegDoc& providerReg, - const IIntMessage::SmartPtrCHeaders& headers = IIntMessage::SmartPtrCHeaders()); - - static SmartPtrIIntMessage create( - const SmartPtrCProviderCollectSchemaRequestDoc& providerCollectSchemaRequest, - const std::string& relFilename, - const std::string& relDirectory, - const IIntMessage::SmartPtrCHeaders& headers = IIntMessage::SmartPtrCHeaders()); - - static SmartPtrIIntMessage create( - const SmartPtrCProviderRequestDoc& providerRequest, - const std::string& relFilename, - const std::string& relDirectory, - const std::string& providerUri, - const IIntMessage::SmartPtrCHeaders& headers = IIntMessage::SmartPtrCHeaders()); - -private: - static SmartPtrIIntMessage createPayloadEnvelope( - const std::string& payloadType, - const std::string& payloadStr, - const UUID& clientId, - const UUID& requestId, - const std::string& pmeId, - const std::string& payloadVersion, - const IIntMessage::SmartPtrCHeaders& newHeaders = IIntMessage::SmartPtrCHeaders(), - const IIntMessage::SmartPtrCHeaders& origHeaders = IIntMessage::SmartPtrCHeaders(), - const SmartPtrCAttachmentCollectionDoc& attachmentCollection = SmartPtrCAttachmentCollectionDoc(), - const SmartPtrCProtocolCollectionDoc& protocolCollection = SmartPtrCProtocolCollectionDoc()); - -private: - CAF_CM_DECLARE_NOCREATE(CCafMessageCreator); -}; - -} - -#endif // #ifndef CCafMessageCreator_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Caf/CCafMessageHeaders.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Caf/CCafMessageHeaders.h deleted file mode 100644 index ddaeef449..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Caf/CCafMessageHeaders.h +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Author: bwilliams - * Created: Jul 2009 - * - * Copyright (C) 2009-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CCafMessageHeaders_h_ -#define CCafMessageHeaders_h_ - - -#include "IVariant.h" -#include "Integration/IIntMessage.h" - -namespace Caf { - -CAF_DECLARE_CLASS_AND_SMART_POINTER(CCafMessageHeaders); - -class INTEGRATIONCAF_LINKAGE CCafMessageHeaders { -public: - static SmartPtrCCafMessageHeaders create( - const IIntMessage::SmartPtrCHeaders& headers); - -public: - CCafMessageHeaders(); - virtual ~CCafMessageHeaders(); - -public: - IIntMessage::SmartPtrCHeaders getHeaders() const; - -public: - std::string getPayloadType() const; - - std::string getPayloadTypeOpt( - const std::string& defaultVal = std::string()) const; - -public: - std::string getVersion() const; - - std::string getVersionOpt( - const std::string& defaultVal = "1.0") const; - -public: - UUID getClientId() const; - std::string getClientIdStr() const; - - UUID getClientIdOpt( - const UUID defaultVal = CAFCOMMON_GUID_NULL) const; - std::string getClientIdStrOpt( - const std::string& defaultVal = std::string()) const; - -public: - UUID getRequestId() const; - std::string getRequestIdStr() const; - - UUID getRequestIdOpt( - const UUID defaultVal = CAFCOMMON_GUID_NULL) const; - std::string getRequestIdStrOpt( - const std::string& defaultVal = std::string()) const; - -public: - std::string getPmeId() const; - - std::string getPmeIdOpt( - const std::string& defaultVal = std::string()) const; - -public: - UUID getSessionId() const; - std::string getSessionIdStr() const; - - UUID getSessionIdOpt( - const UUID defaultVal = CAFCOMMON_GUID_NULL) const; - std::string getSessionIdStrOpt( - const std::string& defaultVal = std::string()) const; - -public: - std::string getRelDirectory() const; - - std::string getRelDirectoryOpt( - const std::string& defaultVal = std::string()) const; - -public: - std::string getRelFilename() const; - - std::string getRelFilenameOpt( - const std::string& defaultVal) const; - -public: - std::string getProviderUri() const; - - std::string getProviderUriOpt( - const std::string& defaultVal) const; - -public: - std::string getFlowDirection() const; - - std::string getFlowDirectionOpt( - const std::string& defaultVal) const; - -public: - std::string getRequiredStr( - const std::string& key) const; - - std::string getOptionalStr( - const std::string& key, - const std::string& defaultVal = std::string()) const; - - bool getRequiredBool( - const std::string& key) const; - - bool getOptionalBool( - const std::string& key, - const bool defaultVal = false) const; - -private: - void initialize( - const IIntMessage::SmartPtrCHeaders& headers); - -private: - SmartPtrIVariant findOptionalHeader( - const std::string& key) const; - - SmartPtrIVariant findRequiredHeader( - const std::string& key) const; - -private: - bool _isInitialized; - IIntMessage::SmartPtrCHeaders _headers; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CCafMessageHeaders); -}; - -} - -#endif // #ifndef CCafMessageHeaders_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Caf/CCafMessageHeadersWriter.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Caf/CCafMessageHeadersWriter.h deleted file mode 100644 index 778e37a0d..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Caf/CCafMessageHeadersWriter.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Author: bwilliams - * Created: Jul 2009 - * - * Copyright (C) 2009-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CCafMessageHeadersWriter_h_ -#define CCafMessageHeadersWriter_h_ - - -#include "Integration/IIntMessage.h" - -namespace Caf { - -CAF_DECLARE_CLASS_AND_SMART_POINTER(CCafMessageHeadersWriter); - -class INTEGRATIONCAF_LINKAGE CCafMessageHeadersWriter { -public: - static SmartPtrCCafMessageHeadersWriter create(); - -public: - CCafMessageHeadersWriter(); - virtual ~CCafMessageHeadersWriter(); - -public: - IIntMessage::SmartPtrCHeaders getHeaders() const; - -public: - void setPayloadType(const std::string& payloadType); - - void setVersion(const std::string& version); - - void setPayloadVersion(const std::string& payloadVersion); - - void setClientId(const UUID& clientId); - - void setClientId(const std::string& clientIdStr); - - void setRequestId(const UUID& requestId); - - void setRequestId(const std::string& requestIdStr); - - void setPmeId(const std::string& pmeId); - - void setSessionId(const UUID& sessionId); - - void setSessionId(const std::string& sessionId); - - void setRelDirectory(const std::string& relDirectory); - - void setRelFilename(const std::string& relFilename); - - void setProviderUri(const std::string& providerUri); - - void setIsThrowable(const bool& isThrowable); - - void setIsMultiPart(const bool& isMultiPart); - - void setProtocol(const std::string& protocol); - - void setProtocolAddress(const std::string& protocolAddress); - - void setFlowDirection(const std::string& flowDirection); - -public: - void insertString( - const std::string& key, - const std::string& value); - - void insertBool( - const std::string& key, - const bool& value); - -private: - void initialize(); - -private: - bool _isInitialized; - IIntMessage::SmartPtrCHeaders _headers; - -private: - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(CCafMessageHeadersWriter); -}; - -} - -#endif // #ifndef CCafMessageHeadersWriter_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Caf/CCafMessagePayload.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Caf/CCafMessagePayload.h deleted file mode 100644 index 5f7c64322..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Caf/CCafMessagePayload.h +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Author: bwilliams - * Created: Jul 2009 - * - * Copyright (C) 2009-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CCafMessagePayload_h_ -#define CCafMessagePayload_h_ - -#include - -#include "Integration/Caf/CCafMessagePayload.h" -#include "Doc/CafCoreTypesDoc/CRequestHeaderDoc.h" -#include "Doc/ResponseDoc/CEventKeyDoc.h" -#include "Doc/ResponseDoc/CManifestDoc.h" -#include "Memory/DynamicArray/DynamicArrayInc.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - -CAF_DECLARE_CLASS_AND_SMART_POINTER(CCafMessagePayload); - -class INTEGRATIONCAF_LINKAGE CCafMessagePayload { -public: - static SmartPtrCCafMessagePayload create( - const SmartPtrCDynamicByteArray& payload, - const std::string& payloadType = std::string()); - - static SmartPtrCCafMessagePayload createFromFile( - const std::string& payloadFile, - const std::string& payloadType = std::string()); - - static SmartPtrCCafMessagePayload createFromStr( - const std::string& payloadStr, - const std::string& payloadType = std::string()); - -public: - static SmartPtrCDynamicByteArray createBufferFromStr( - const std::string& payloadStr); - - static SmartPtrCDynamicByteArray createBufferFromFile( - const std::string& payloadFile); - -public: - static void saveToFile( - const SmartPtrCDynamicByteArray& payload, - const std::string& payloadPath); - - static std::string saveToStr( - const SmartPtrCDynamicByteArray& payload); - -public: - CCafMessagePayload(); - virtual ~CCafMessagePayload(); - -public: - std::string getPayloadStr() const; - - SmartPtrCDynamicByteArray getPayload() const; - -public: - std::string getVersion() const; - -public: - SmartPtrCRequestHeaderDoc getRequestHeader() const; - - SmartPtrCManifestDoc getManifest() const; - - std::deque getEventKeyCollection() const; - -private: - void initialize( - const SmartPtrCDynamicByteArray& payload, - const std::string& payloadType = std::string(), - const std::string& encoding = "xml"); - -private: - bool _isInitialized; - - std::string _encoding; - SmartPtrCDynamicByteArray _payload; - std::string _payloadStr; - SmartPtrCXmlElement _payloadXml; - -private: - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(CCafMessagePayload); -}; - -} - -#endif // #ifndef CCafMessagePayload_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Caf/CCafMessagePayloadParser.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Caf/CCafMessagePayloadParser.h deleted file mode 100644 index d6a8613ae..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Caf/CCafMessagePayloadParser.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Author: bwilliams - * Created: Jul 2009 - * - * Copyright (C) 2009-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CCafMessagePayloadParser_h_ -#define CCafMessagePayloadParser_h_ - - -#include "Doc/CafInstallRequestDoc/CInstallProviderJobDoc.h" -#include "Doc/CafInstallRequestDoc/CInstallRequestDoc.h" -#include "Doc/CafInstallRequestDoc/CUninstallProviderJobDoc.h" -#include "Doc/MgmtRequestDoc/CMgmtRequestDoc.h" -#include "Doc/PayloadEnvelopeDoc/CPayloadEnvelopeDoc.h" -#include "Doc/ProviderInfraDoc/CProviderRegDoc.h" -#include "Doc/ProviderRequestDoc/CProviderRequestDoc.h" -#include "Memory/DynamicArray/DynamicArrayInc.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - -CAF_DECLARE_CLASS_AND_SMART_POINTER(CCafMessagePayloadParser); - -class INTEGRATIONCAF_LINKAGE CCafMessagePayloadParser { -public: - static SmartPtrCPayloadEnvelopeDoc getPayloadEnvelope( - const SmartPtrCDynamicByteArray& payload); - - static SmartPtrCInstallProviderJobDoc getInstallProviderJob( - const SmartPtrCDynamicByteArray& payload); - - static SmartPtrCUninstallProviderJobDoc getUninstallProviderJob( - const SmartPtrCDynamicByteArray& payload); - - static SmartPtrCProviderRequestDoc getProviderRequest( - const SmartPtrCDynamicByteArray& payload); - - static SmartPtrCProviderRegDoc getProviderReg( - const SmartPtrCDynamicByteArray& payload); - - static SmartPtrCInstallRequestDoc getInstallRequest( - const SmartPtrCDynamicByteArray& payload); - - static SmartPtrCMgmtRequestDoc getMgmtRequest( - const SmartPtrCDynamicByteArray& payload); - -private: - static SmartPtrCXmlElement bufferToXml( - const SmartPtrCDynamicByteArray& payload, - const std::string& payloadType = std::string()); - - static std::string bufferToStr( - const SmartPtrCDynamicByteArray& payload); - -private: - CAF_CM_DECLARE_NOCREATE(CCafMessagePayloadParser); -}; - -} - -#endif // #ifndef CCafMessagePayloadParser_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Caf/IntegrationCafLink.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Caf/IntegrationCafLink.h deleted file mode 100644 index b17c5710e..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Caf/IntegrationCafLink.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 20, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef INTEGRATIONCAFLINK_H_ -#define INTEGRATIONCAFLINK_H_ - -#ifndef INTEGRATIONCAF_LINKAGE - #ifdef WIN32 - #ifdef FRAMEWORK_BUILD - #define INTEGRATIONCAF_LINKAGE __declspec(dllexport) - #else - #define INTEGRATIONCAF_LINKAGE __declspec(dllimport) - #endif - #else - #define INTEGRATIONCAF_LINKAGE - #endif -#endif - -#endif /* INTEGRATIONCAFLINK_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/CAbstractMessageChannel.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/CAbstractMessageChannel.h deleted file mode 100644 index 7a4dfd709..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/CAbstractMessageChannel.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Created on: Jan 26, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CABSTRACTMESSAGECHANNEL_H_ -#define CABSTRACTMESSAGECHANNEL_H_ - -#include "Integration/IChannelInterceptorSupport.h" -#include "Integration/IChannelInterceptor.h" -#include "Integration/IIntMessage.h" -#include "Integration/IMessageChannel.h" -#include "Integration/Core/IntegrationCoreLink.h" - -namespace Caf { -/** - * Base class for {@link IMessageChannel} implementations providing common - * properties and method implementations including {@link IChannelInterceptor interceptors}. - */ -class INTEGRATIONCORE_LINKAGE CAbstractMessageChannel : - public IMessageChannel, - public IChannelInterceptorSupport { -public: - CAbstractMessageChannel(); - virtual ~CAbstractMessageChannel(); - -public: // IMessageChannel - bool send( - const SmartPtrIIntMessage& message); - - bool send( - const SmartPtrIIntMessage& message, - const int32 timeout); - -public: // IChannelInterceptorSupport - void setInterceptors( - const IChannelInterceptorSupport::InterceptorCollection& interceptors); - -protected: - /** - * Subclasses must implement this method. A non-negative timeout indicates - * how int32 to wait if the channel is at capacity. If the value is 0 it must - * return immediately with or without success. A negative timeout value - * indicates that the method should block until either the message is accepted - * or the blocking thread is interrupted. - */ - virtual bool doSend( - const SmartPtrIIntMessage& message, - int32 timeout) = 0; - -protected: - std::list getInterceptors() const; - -private: - std::list _interceptors; - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(CAbstractMessageChannel); -}; -} - -#endif /* CABSTRACTMESSAGECHANNEL_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/CAbstractMessageRouter.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/CAbstractMessageRouter.h deleted file mode 100644 index d77211cd6..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/CAbstractMessageRouter.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Created on: Aug 9, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CAbstractMessageRouter_h -#define CAbstractMessageRouter_h - - -#include "Integration/IMessageRouter.h" - -#include "Integration/IIntMessage.h" -#include "Integration/IMessageChannel.h" - -namespace Caf { - -class INTEGRATIONCORE_LINKAGE CAbstractMessageRouter : public IMessageRouter { -public: - CAbstractMessageRouter(); - virtual ~CAbstractMessageRouter(); - - void init(); - - void init( - const SmartPtrIMessageChannel& defaultOutputChannel, - const bool ignoreSendFailures, - const int32 sendTimeout); - - virtual void routeMessage( - const SmartPtrIIntMessage& message); - -protected: - typedef std::deque ChannelCollection; - virtual ChannelCollection getTargetChannels( - const SmartPtrIIntMessage& message) = 0; - -private: - SmartPtrIMessageChannel _defaultOutputChannel; - bool _ignoreSendFailures; - int32 _sendTimeout; - -private: - bool _isInitialized; - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CAbstractMessageRouter); -}; - -} - -#endif /* CAbstractMessageRouter_h */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/CAbstractPollableChannel.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/CAbstractPollableChannel.h deleted file mode 100644 index 793a86c96..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/CAbstractPollableChannel.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Created on: Jan 26, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CABSTRACTPOLLABLECHANNEL_H_ -#define CABSTRACTPOLLABLECHANNEL_H_ - -#include "Integration/Core/CAbstractMessageChannel.h" - -#include "Integration/Dependencies/CPollerMetadata.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" - -#include "Integration/IPollableChannel.h" - -namespace Caf { - -/** - * Base class for pollable channels - */ -class INTEGRATIONCORE_LINKAGE CAbstractPollableChannel : - public CAbstractMessageChannel, - public IPollableChannel { -public: - CAbstractPollableChannel(); - virtual ~CAbstractPollableChannel(); - -public: - SmartPtrIIntMessage receive(); - SmartPtrIIntMessage receive(const int32 timeout); - SmartPtrCPollerMetadata getPollerMetadata() const; - -protected: - /** - * Subclasses must implement this method. A non-negative timeout indicates - * how int32 to wait if the channel is empty (if the value is 0, it must - * return immediately with or without success). A negative timeout value - * indicates that the method should block until either a message is - * available or the blocking thread is interrupted. - */ - virtual SmartPtrIIntMessage doReceive(const int32 timeout) = 0; - - void setPollerMetadata(const SmartPtrCPollerMetadata& pollerMetadata); - - void setPollerMetadata(const SmartPtrIDocument& pollerDoc); - -private: - SmartPtrCPollerMetadata _pollerMetadata; - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(CAbstractPollableChannel); -}; -} - -#endif /* CABSTRACTPOLLABLECHANNEL_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/CBroadcastingDispatcher.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/CBroadcastingDispatcher.h deleted file mode 100644 index a92f98e26..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/CBroadcastingDispatcher.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CBroadcastingDispatcher_h_ -#define CBroadcastingDispatcher_h_ - - -#include "Integration/IMessageDispatcher.h" - -#include "Integration/IErrorHandler.h" -#include "Integration/IIntMessage.h" -#include "Integration/IMessageHandler.h" - -namespace Caf { - -/// Sends responses/errors back to the client. -class INTEGRATIONCORE_LINKAGE CBroadcastingDispatcher : - public IMessageDispatcher { -public: - CBroadcastingDispatcher(); - virtual ~CBroadcastingDispatcher(); - -public: - void initialize( - const SmartPtrIErrorHandler& errorHandler); - -public: // IMessageDispatcher - void addHandler( - const SmartPtrIMessageHandler& messageHandler); - - void removeHandler( - const SmartPtrIMessageHandler& messageHandler); - - bool dispatch( - const SmartPtrIIntMessage& message); - -private: - typedef std::map CIntMessageHandlerCollection; - CAF_DECLARE_SMART_POINTER(CIntMessageHandlerCollection); - -private: - bool _isInitialized; - SmartPtrIErrorHandler _errorHandler; - SmartPtrCIntMessageHandlerCollection _messageHandlerCollection; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CBroadcastingDispatcher); -}; - -CAF_DECLARE_SMART_POINTER(CBroadcastingDispatcher); - -} - -#endif // #ifndef CBroadcastingDispatcher_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/CChannelInterceptorAdapter.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/CChannelInterceptorAdapter.h deleted file mode 100644 index 0f67ee51c..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/CChannelInterceptorAdapter.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Created on: Jan 25, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CCHANNELINTERCEPTORADAPTER_H_ -#define CCHANNELINTERCEPTORADAPTER_H_ - - -#include "Integration/IChannelInterceptor.h" - -#include "Integration/IIntMessage.h" -#include "Integration/IMessageChannel.h" - -namespace Caf { - -/** - * A {@link IChannelInterceptor} with no-op method implementations so that - * subclasses do not have to implement all of th einterface's methods. - */ -class INTEGRATIONCORE_LINKAGE CChannelInterceptorAdapter : public IChannelInterceptor { -public: - CChannelInterceptorAdapter(); - virtual ~CChannelInterceptorAdapter(); - -public: // IChannelInterceptor - virtual SmartPtrIIntMessage& preSend( - SmartPtrIIntMessage& message, - SmartPtrIMessageChannel& channel); - - virtual void postSend( - SmartPtrIIntMessage& message, - SmartPtrIMessageChannel& channel, - bool sent); - - virtual bool preReceive( - SmartPtrIMessageChannel& channel); - - virtual SmartPtrIIntMessage& postReceive( - SmartPtrIIntMessage& message, - SmartPtrIMessageChannel& channel); - -private: - CAF_CM_DECLARE_NOCOPY(CChannelInterceptorAdapter); -}; - -} - -#endif /* CCHANNELINTERCEPTORADAPTER_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/CChannelResolver.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/CChannelResolver.h deleted file mode 100644 index 6eb981171..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/CChannelResolver.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 20, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CChannelResolver_h_ -#define CChannelResolver_h_ - - -#include "Integration/IChannelResolver.h" - -#include "Integration/IIntegrationObject.h" -#include "Integration/IMessageChannel.h" - -namespace Caf { - -class INTEGRATIONCORE_LINKAGE CChannelResolver : - public IChannelResolver { -public: - CChannelResolver(); - virtual ~CChannelResolver(); - -public: - void initialize( - const SmartPtrCIntegrationObjectCollection& integrationObjectCollection); - -public: // IChannelResolver - SmartPtrIMessageChannel resolveChannelName( - const std::string& channelName) const; - - SmartPtrIIntegrationObject resolveChannelNameToObject( - const std::string& channelName) const; - -private: - bool _isInitialized; - SmartPtrCIntegrationObjectCollection _integrationObjectCollection; - -private: - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(CChannelResolver); -}; - -CAF_DECLARE_SMART_POINTER(CChannelResolver); - -} - -#endif // #ifndef CChannelResolver_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/CDocument.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/CDocument.h deleted file mode 100644 index 31ee39413..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/CDocument.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 20, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CDocument_h_ -#define CDocument_h_ - - -#include "Integration/IDocument.h" - -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - -class INTEGRATIONCORE_LINKAGE CDocument : - public IDocument { -public: - CDocument(); - virtual ~CDocument(); - -public: - void initialize(const SmartPtrCXmlElement& xmlElement); - SmartPtrCXmlElement getXmlElement() const; - -public: // IDocument - std::string findRequiredAttribute(const std::string& name) const; - std::string findOptionalAttribute(const std::string& name) const; - SmartPtrIDocument findRequiredChild(const std::string& name) const; - SmartPtrIDocument findOptionalChild(const std::string& name) const; - SmartPtrCAttributeCollection getAllAttributes() const; - SmartPtrCChildCollection getAllChildren() const; - SmartPtrCOrderedChildCollection getAllChildrenInOrder() const; - std::string getName() const; - std::string getValue() const; - std::string getPath() const; - -public: // IDocument Save operations - void saveToFile(const std::string& filename) const; - std::string saveToString() const; - std::string saveToStringRaw() const; - -private: - bool _isInitialized; - SmartPtrCXmlElement _xmlElement; - -private: - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(CDocument); -}; - -CAF_DECLARE_SMART_POINTER(CDocument); -} - -#endif // #ifndef CDocument_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/CErrorHandler.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/CErrorHandler.h deleted file mode 100644 index 5d2f5331d..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/CErrorHandler.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 20, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CErrorHandler_h_ -#define CErrorHandler_h_ - - -#include "Integration/IErrorHandler.h" - -#include "Integration/IChannelResolver.h" -#include "Integration/IIntMessage.h" -#include "Integration/IMessageChannel.h" -#include "Integration/IThrowable.h" - -namespace Caf { - -class INTEGRATIONCORE_LINKAGE CErrorHandler : - public IErrorHandler { -public: - CErrorHandler(); - virtual ~CErrorHandler(); - -public: - void initialize( - const SmartPtrIChannelResolver& channelResolver, - const SmartPtrIMessageChannel& errorMessageChannel); - -public: // IErrorHandler - void handleError( - const SmartPtrIThrowable& throwable, - const SmartPtrIIntMessage& message) const; - -private: - bool _isInitialized; - SmartPtrIChannelResolver _channelResolver; - SmartPtrIMessageChannel _errorMessageChannel; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CErrorHandler); -}; - -CAF_DECLARE_SMART_POINTER(CErrorHandler); -} - -#endif // #ifndef CErrorHandler_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/CExpressionHandler.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/CExpressionHandler.h deleted file mode 100644 index eb0be8fce..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/CExpressionHandler.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Created on: Jul 23, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CEXPRESSIONHANDLER_H_ -#define CEXPRESSIONHANDLER_H_ - - -#include "Common/IAppConfig.h" -#include "Common/IAppContext.h" -#include "IVariant.h" -#include "Integration/IExpressionInvoker.h" - -namespace Caf { - -class INTEGRATIONCORE_LINKAGE CExpressionHandler { -public: - CExpressionHandler(); - virtual ~CExpressionHandler(); - - void init( - const SmartPtrIAppConfig& appConfig, - const SmartPtrIAppContext& appContext, - const std::string& expression); - - SmartPtrIVariant evaluate(const SmartPtrIIntMessage& message); - - std::string getBeanName() const; - - std::string getMethodName() const; - - Cdeqstr getMethodParameters() const; - - std::string toString() const; - -private: - bool _isInitialized; - SmartPtrIExpressionInvoker _invoker; - std::string _beanName; - std::string _methodName; - Cdeqstr _methodParams; - - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(CExpressionHandler); -}; -CAF_DECLARE_SMART_POINTER(CExpressionHandler); - -} - -#endif /* CEXPRESSIONHANDLER_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/CIntException.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/CIntException.h deleted file mode 100644 index 09489c96c..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/CIntException.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 20, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CIntException_h_ -#define CIntException_h_ - -#include "Exception/CCafException.h" - -#include "Integration/IThrowable.h" -#include "Integration/Core/CIntException.h" - -namespace Caf { - -class INTEGRATIONCORE_LINKAGE CIntException : - public IThrowable { -public: - CIntException(); - virtual ~CIntException(); - -public: - void initialize(const CCafException* cafException); - -public: // IThrowable - std::string getExceptionClassName() const; - std::string getMsg() const; - std::string getClassName() const; - std::string getFuncName() const; - HRESULT getError() const; - std::deque* getBacktrace() const; - std::string getFullMsg() const; - -private: - bool _isInitialized; - std::string _exceptionClassName; - HRESULT _errorCode; - std::string _message; - std::string _className; - std::string _funcName; - std::deque* _backtrace; - std::string _fullMsg; - -private: - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(CIntException); -}; - -CAF_DECLARE_SMART_POINTER(CIntException); - -#define CAF_CM_DECLARE_INTEGRATION_EXCEPTION_CLASS(_exclass_) \ -class INTEGRATIONCORE_LINKAGE _exclass_ : public Caf::CCafException { \ -public: \ - _exclass_(); \ - virtual ~_exclass_(); \ - void throwSelf(); \ -private: \ - _exclass_(const _exclass_ &); \ - _exclass_ & operator=(const _exclass_ &); \ -}; - -// Exceptions specific to integration -CAF_CM_DECLARE_INTEGRATION_EXCEPTION_CLASS(FatalListenerStartupException) - -CAF_CM_DECLARE_INTEGRATION_EXCEPTION_CLASS(ListenerExecutionFailedException) - -CAF_CM_DECLARE_INTEGRATION_EXCEPTION_CLASS(MessageDeliveryException) - -} - -#endif // #ifndef CIntException_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/CIntMessage.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/CIntMessage.h deleted file mode 100644 index 4406753ce..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/CIntMessage.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CIntMessage_h_ -#define CIntMessage_h_ - - -#include "Integration/IIntMessage.h" - -#include "ICafObject.h" -#include "IVariant.h" -#include "Memory/DynamicArray/DynamicArrayInc.h" - -namespace Caf { - -class INTEGRATIONCORE_LINKAGE CIntMessage : - public IIntMessage { -public: - static SmartPtrCHeaders mergeHeaders( - const SmartPtrCHeaders& newHeaders, - const SmartPtrCHeaders& origHeaders); - -public: - CIntMessage(); - virtual ~CIntMessage(); - -public: - void initializeStr( - const std::string& payloadStr, - const SmartPtrCHeaders& newHeaders, - const SmartPtrCHeaders& origHeaders); - - void initialize( - const SmartPtrCDynamicByteArray& payload, - const SmartPtrCHeaders& newHeaders, - const SmartPtrCHeaders& origHeaders); - -public: // IIntMessage - SmartPtrCDynamicByteArray getPayload() const; - - std::string getPayloadStr() const; - - UUID getMessageId() const; - - std::string getMessageIdStr() const; - - SmartPtrCHeaders getHeaders() const; - - SmartPtrIVariant findOptionalHeader( - const std::string& key) const; - - SmartPtrIVariant findRequiredHeader( - const std::string& key) const; - - std::string findOptionalHeaderAsString( - const std::string& key) const; - - std::string findRequiredHeaderAsString( - const std::string& key) const; - - SmartPtrICafObject findOptionalObjectHeader( - const std::string& key) const; - - SmartPtrICafObject findRequiredObjectHeader( - const std::string& key) const; - -private: - bool _isInitialized; - UUID _messageId; - SmartPtrCDynamicByteArray _payload; - SmartPtrCHeaders _headers; - -private: - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(CIntMessage); -}; - -CAF_DECLARE_SMART_POINTER(CIntMessage); - -} - -#endif // #ifndef _IntegrationContracts_CIntMessage_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/CIntMessageHeaders.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/CIntMessageHeaders.h deleted file mode 100644 index 8829e5fe0..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/CIntMessageHeaders.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CIntMessageHeaders_h_ -#define CIntMessageHeaders_h_ - -#include "Integration/Core/CIntMessageHeaders.h" - -#include "ICafObject.h" -#include "IVariant.h" -#include "Integration/IIntMessage.h" - -namespace Caf { - -class INTEGRATIONCORE_LINKAGE CIntMessageHeaders { -public: - CIntMessageHeaders(); - virtual ~CIntMessageHeaders(); - -public: - IIntMessage::SmartPtrCHeaders getHeaders() const; - - void clear(); - - void insertString( - const std::string& key, - const std::string& value); - - void insertStringOpt( - const std::string& key, - const std::string& value); - - void insertInt64( - const std::string& key, - const int64& value); - - void insertUint64( - const std::string& key, - const uint64& value); - - void insertInt32( - const std::string& key, - const int32& value); - - void insertUint32( - const std::string& key, - const uint32& value); - - void insertInt16( - const std::string& key, - const int16& value); - - void insertUint16( - const std::string& key, - const uint16& value); - - void insertUint8( - const std::string& key, - const uint8& value); - - void insertBool( - const std::string& key, - const bool& value); - - void insertVariant( - const std::string& key, - const SmartPtrIVariant& variant); - - void insertObject( - const std::string& key, - const SmartPtrICafObject& cafObject); - -private: - IIntMessage::SmartPtrCHeaders _headers; - -private: - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(CIntMessageHeaders); -}; - -CAF_DECLARE_SMART_POINTER(CIntMessageHeaders); - -} - -#endif // #ifndef _IntegrationContracts_CIntMessageHeaders_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/CIntegrationAppContext.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/CIntegrationAppContext.h deleted file mode 100644 index 3665121e5..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/CIntegrationAppContext.h +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 20, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CIntegrationAppContext_h_ -#define CIntegrationAppContext_h_ - - - -#include "Common/IAppContext.h" - -#include "Common/CApplicationContext.h" -#include "IBean.h" -#include "Integration/Core/CChannelResolver.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/ILifecycle.h" -#include "Integration/IMessageChannel.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IIntegrationAppContext.h" - -namespace Caf { - -class INTEGRATIONCORE_LINKAGE CIntegrationAppContext : - public IIntegrationAppContext, - public IAppContext, - public IChannelResolver { -public: - CIntegrationAppContext(); - virtual ~CIntegrationAppContext(); - -public: - void initialize(const uint32 timeoutMs); - void initialize(const uint32 timeoutMs, const std::string& beanConfigPath); - void initializeTwoPhase(const uint32 timeoutMs, const std::string& beanConfigPath); - void terminate(const uint32 timeoutMs); - -public: // IIntegrationAppContext - void startLifecycleBeans(); - SmartPtrIIntegrationObject getIntegrationObject(const std::string& id) const; - void getIntegrationObject(const IID& iid, void **ppv) const; - SmartPtrCObjectCollection getIntegrationObjects(const IID& iid) const; - -public: // IAppContext - SmartPtrIBean getBean(const std::string& name) const; - -public: // IChannelResolver - SmartPtrIMessageChannel resolveChannelName( - const std::string& channelName) const; - - SmartPtrIIntegrationObject resolveChannelNameToObject( - const std::string& channelName) const; - -private: - typedef std::multimap LifecycleBeans; - -private: - void initializeRaw( - const uint32 timeoutMs, - const std::string& beanConfigPath, - const bool startLifecycleBeans); - - SmartPtrCIntegrationObjectCollection assign( - const IAppContext::SmartPtrCBeans& contextBeans, - const Cdeqstr& beanConfigPathCollection) const; - - void injectChannelInterceptors( - const SmartPtrCIntegrationObjectCollection& integrationObjectCollection) const; - - void wire( - const SmartPtrIAppContext& appContext, - const SmartPtrCIntegrationObjectCollection& integrationObjectCollection, - const SmartPtrCChannelResolver& channelResolver) const; - - void startStop( - const LifecycleBeans& lifecycleBeans, - const uint32 timeoutMs, - const bool isStart) const; - - SmartPtrCXmlElement getBeanConfigRoot() const; - - void addBuiltIn( - const std::string& beanId, - const IAppContext::SmartPtrCBeans& beans, - SmartPtrCIntegrationObjectCollection& integrationObjectCollection) const; - - std::string getDefaultBeanConfigPath() const; - - Cdeqstr getBeanConfigFiles( - const std::string& beanConfigPath) const; - -private: - class CIntegrationAppContextWeakReference : public IIntegrationAppContext { - public: - CIntegrationAppContextWeakReference(); - - void set(CIntegrationAppContext *context); - - SmartPtrIIntegrationObject getIntegrationObject( - const std::string& id) const; - - void getIntegrationObject( - const IID& iid, - void **ppv) const; - - IIntegrationAppContext::SmartPtrCObjectCollection getIntegrationObjects( - const IID& iid) const; - - private: - CIntegrationAppContext *_context; - CAF_CM_CREATE; - CAF_CM_CREATE_THREADSAFE; - CAF_CM_DECLARE_NOCOPY(CIntegrationAppContextWeakReference); - }; - CAF_DECLARE_SMART_POINTER(CIntegrationAppContextWeakReference); - -private: - bool _isInitialized; - bool _isIntegrationObjectCollectionReady; - bool _lifecycleBeansStarted; - uint32 _timeoutMs; - SmartPtrCApplicationContext _applicationContext; - SmartPtrCChannelResolver _channelResolver; - SmartPtrCIntegrationObjectCollection _integrationObjectCollection; - SmartPtrCIntegrationAppContextWeakReference _weakSelfReference; - LifecycleBeans _lifecycleBeans; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CIntegrationAppContext); -}; - -CAF_DECLARE_SMART_POINTER(CIntegrationAppContext); - -} - -#endif // #ifndef CIntegrationAppContext_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/CMessageHandler.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/CMessageHandler.h deleted file mode 100644 index bdf489377..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/CMessageHandler.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CMessageHandler_h_ -#define CMessageHandler_h_ - - -#include "Integration/IMessageHandler.h" - -#include "ICafObject.h" -#include "Integration/IErrorProcessor.h" -#include "Integration/IIntMessage.h" -#include "Integration/IMessageChannel.h" -#include "Integration/IMessageProcessor.h" -#include "Integration/IMessageRouter.h" -#include "Integration/IMessageSplitter.h" -#include "Integration/ITransformer.h" - -namespace Caf { - -class INTEGRATIONCORE_LINKAGE CMessageHandler : public IMessageHandler { -public: - CMessageHandler(); - virtual ~CMessageHandler(); - -public: - void initialize( - const std::string& inputId, - const SmartPtrIMessageChannel& outputMessageChannel, - const SmartPtrICafObject& messageHandlerObj); - -public: - std::string getInputId() const; - -public: // IMessageHandler - void handleMessage( - const SmartPtrIIntMessage& message); - SmartPtrIIntMessage getSavedMessage() const; - void clearSavedMessage(); - -private: - bool _isInitialized; - std::string _inputId; - SmartPtrIIntMessage _savedMessage; - - SmartPtrIMessageChannel _outputMessageChannel; - SmartPtrITransformer _transformer; - SmartPtrIMessageProcessor _messageProcessor; - SmartPtrIErrorProcessor _errorProcessor; - SmartPtrIMessageSplitter _messageSplitter; - SmartPtrIMessageRouter _messageRouter; - SmartPtrIMessageHandler _messageHandler; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CMessageHandler); -}; - -CAF_DECLARE_SMART_POINTER(CMessageHandler); - -} - -#endif // #ifndef CMessageHandler_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/CMessageHeaderUtils.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/CMessageHeaderUtils.h deleted file mode 100644 index 4107c6c9a..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/CMessageHeaderUtils.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Created on: Nov 19, 2014 - * Author: bwilliams - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#ifndef CMessageHeaderUtils_h_ -#define CMessageHeaderUtils_h_ - - -#include "Integration/IIntMessage.h" - -namespace Caf { - -class INTEGRATIONCORE_LINKAGE CMessageHeaderUtils { -public: - static std::string getStringReq( - const IIntMessage::SmartPtrCHeaders& headers, - const std::string& tag); - - static std::string getStringOpt( - const IIntMessage::SmartPtrCHeaders& headers, - const std::string& tag); - - static uint8 getUint8Req( - const IIntMessage::SmartPtrCHeaders& headers, - const std::string& tag); - - static uint8 getUint8Opt( - const IIntMessage::SmartPtrCHeaders& headers, - const std::string& tag); - - static uint16 getUint16Req( - const IIntMessage::SmartPtrCHeaders& headers, - const std::string& tag); - - static uint16 getUint16Opt( - const IIntMessage::SmartPtrCHeaders& headers, - const std::string& tag); - - static uint32 getUint32Req( - const IIntMessage::SmartPtrCHeaders& headers, - const std::string& tag); - - static uint32 getUint32Opt( - const IIntMessage::SmartPtrCHeaders& headers, - const std::string& tag); - - static uint64 getUint64Req( - const IIntMessage::SmartPtrCHeaders& headers, - const std::string& tag); - - static uint64 getUint64Opt( - const IIntMessage::SmartPtrCHeaders& headers, - const std::string& tag); - - static bool getBoolReq( - const IIntMessage::SmartPtrCHeaders& headers, - const std::string& tag); - - static bool getBoolOpt( - const IIntMessage::SmartPtrCHeaders& headers, - const std::string& tag); - - static void log( - const IIntMessage::SmartPtrCHeaders& headers, - const log4cpp::Priority::PriorityLevel priorityLevel = log4cpp::Priority::DEBUG); - -private: - CAF_CM_DECLARE_NOCREATE(CMessageHeaderUtils); -}; - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/CMessagingTemplate.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/CMessagingTemplate.h deleted file mode 100644 index 6016dd646..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/CMessagingTemplate.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 20, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CMessagingTemplate_h_ -#define CMessagingTemplate_h_ - - -#include "Integration/ILifecycle.h" - -#include "ICafObject.h" -#include "Integration/Core/CMessageHandler.h" -#include "Integration/Core/CMessagingTemplateHandler.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/IMessageChannel.h" -#include "Integration/IPollableChannel.h" -#include "Integration/ISubscribableChannel.h" -#include "Integration/ITaskExecutor.h" - -namespace Caf { - -class INTEGRATIONCORE_LINKAGE CMessagingTemplate : - public ILifecycle { -public: - CMessagingTemplate(); - virtual ~CMessagingTemplate(); - -public: - void initialize( - const SmartPtrIChannelResolver& channelResolver, - const SmartPtrIIntegrationObject& inputIntegrationObject, - const SmartPtrIMessageChannel& errorMessageChannel, - const SmartPtrIMessageChannel& outputMessageChannel, - const SmartPtrICafObject& messageHandlerObj); - -public: // ILifecycle - void start(const uint32 timeoutMs); - void stop(const uint32 timeoutMs); - bool isRunning() const; - -private: - bool _isInitialized; - bool _isRunning; - std::string _inputId; - - SmartPtrISubscribableChannel _inputSubscribableChannel; - SmartPtrCMessagingTemplateHandler _messagingTemplateHandler; - SmartPtrITaskExecutor _taskExecutor; - -private: - SmartPtrITaskExecutor createTaskExecutor( - const SmartPtrIChannelResolver& channelResolver, - const SmartPtrCMessageHandler& messageHandler, - const SmartPtrIPollableChannel& inputPollableChannel, - const SmartPtrIMessageChannel& errorMessageChannel) const; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CMessagingTemplate); -}; - -CAF_DECLARE_SMART_POINTER(CMessagingTemplate); - -} - -#endif // #ifndef CMessagingTemplate_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/CMessagingTemplateHandler.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/CMessagingTemplateHandler.h deleted file mode 100644 index 4e5635892..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/CMessagingTemplateHandler.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CMessagingTemplateHandler_h_ -#define CMessagingTemplateHandler_h_ - - -#include "Integration/IMessageHandler.h" - -#include "Integration/IIntMessage.h" - -namespace Caf { - -class INTEGRATIONCORE_LINKAGE CMessagingTemplateHandler : - public IMessageHandler { -public: - CMessagingTemplateHandler(); - virtual ~CMessagingTemplateHandler(); - -public: - void initialize( - const SmartPtrIMessageHandler& messageHandler); - -public: // IMessageHandler - void handleMessage( - const SmartPtrIIntMessage& message); - SmartPtrIIntMessage getSavedMessage() const; - void clearSavedMessage(); - -private: - bool _isInitialized; - - SmartPtrIMessageHandler _messageHandler; - -private: - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(CMessagingTemplateHandler); -}; - -CAF_DECLARE_SMART_POINTER(CMessagingTemplateHandler); - -} - -#endif // #ifndef CMessagingTemplateHandler_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/CSimpleAsyncTaskExecutor.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/CSimpleAsyncTaskExecutor.h deleted file mode 100644 index 16542b964..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/CSimpleAsyncTaskExecutor.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 20, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CSimpleAsyncTaskExecutor_h_ -#define CSimpleAsyncTaskExecutor_h_ - -#include "Common/CThreadSignal.h" - -#include "Integration/Core/CSimpleAsyncTaskExecutorState.h" -#include "Integration/IErrorHandler.h" -#include "Integration/IRunnable.h" - -#include "Integration/ITaskExecutor.h" - -namespace Caf { - -class INTEGRATIONCORE_LINKAGE CSimpleAsyncTaskExecutor : - public ITaskExecutor { -public: - CSimpleAsyncTaskExecutor(); - virtual ~CSimpleAsyncTaskExecutor(); - -public: - void initialize( - const SmartPtrIRunnable& runnable, - const SmartPtrIErrorHandler& errorHandler); - -public: // ITaskExecutor - void execute(const uint32 timeoutMs); - void cancel(const uint32 timeoutMs); - ETaskState getState() const; - -private: - static void* threadFunc(void* data); - -private: - bool _isInitialized; - GThread* _thread; - SmartPtrCSimpleAsyncTaskExecutorState _state; - typedef std::pair CThreadData; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_THREADSIGNAL_CREATE; - CAF_CM_CREATE_THREADSAFE; - CAF_CM_DECLARE_NOCOPY(CSimpleAsyncTaskExecutor); -}; - -CAF_DECLARE_SMART_POINTER(CSimpleAsyncTaskExecutor); - -} - -#endif // #ifndef CSimpleAsyncTaskExecutor_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/CSimpleAsyncTaskExecutorState.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/CSimpleAsyncTaskExecutorState.h deleted file mode 100644 index a88e4bf40..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/CSimpleAsyncTaskExecutorState.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 20, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CSimpleAsyncTaskExecutorState_h_ -#define CSimpleAsyncTaskExecutorState_h_ - -#include "Common/CThreadSignal.h" - -#include "Common/CAutoMutex.h" -#include "Integration/IErrorHandler.h" -#include "Integration/IRunnable.h" -#include "Integration/ITaskExecutor.h" - -namespace Caf { - -class INTEGRATIONCORE_LINKAGE CSimpleAsyncTaskExecutorState { -public: - CSimpleAsyncTaskExecutorState(); - virtual ~CSimpleAsyncTaskExecutorState(); - -public: - void initialize( - const SmartPtrIRunnable& runnable, - const SmartPtrIErrorHandler& errorHandler); - - SmartPtrIRunnable getRunnable() const; - SmartPtrIErrorHandler getErrorHandler() const; - - ITaskExecutor::ETaskState getState() const; - std::string getStateStr() const; - void setState(const ITaskExecutor::ETaskState runnableState); - - bool getHasThreadExited(); - void setThreadExited(); - - void signalStart(); - void waitForStart(SmartPtrCAutoMutex& mutex, const uint32 timeoutMs); - - void signalStop(); - void waitForStop(SmartPtrCAutoMutex& mutex, const uint32 timeoutMs); - -private: - bool _isInitialized; - bool _hasThreadExited; - ITaskExecutor::ETaskState _runnableState; - SmartPtrIRunnable _runnable; - SmartPtrIErrorHandler _errorHandler; - std::string _exceptionMessage; - - CThreadSignal _threadSignalStart; - CThreadSignal _threadSignalStop; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_CREATE_THREADSAFE; - CAF_CM_DECLARE_NOCOPY(CSimpleAsyncTaskExecutorState); -}; - -CAF_DECLARE_SMART_POINTER(CSimpleAsyncTaskExecutorState); - -} - -#endif // #ifndef CSimpleAsyncTaskExecutorState_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/CSourcePollingChannelAdapter.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/CSourcePollingChannelAdapter.h deleted file mode 100644 index 14c224ec6..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/CSourcePollingChannelAdapter.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 20, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CSourcePollingChannelAdapter_h_ -#define CSourcePollingChannelAdapter_h_ - -#include "Common/CThreadSignal.h" - -#include "Integration/Dependencies/CPollerMetadata.h" -#include "Integration/IErrorHandler.h" -#include "Integration/IMessageHandler.h" -#include "Integration/IPollableChannel.h" - -#include "Integration/IRunnable.h" - -namespace Caf { - -class INTEGRATIONCORE_LINKAGE CSourcePollingChannelAdapter : - public IRunnable { -public: - CSourcePollingChannelAdapter(); - virtual ~CSourcePollingChannelAdapter(); - -public: - void initialize( - const SmartPtrIMessageHandler& messageHandler, - const SmartPtrIPollableChannel& inputPollableChannel, - const SmartPtrIErrorHandler& errorHandler); - - void initialize( - const SmartPtrIMessageHandler& messageHandler, - const SmartPtrIPollableChannel& inputPollableChannel, - const SmartPtrIErrorHandler& errorHandler, - const int32 timeout); - -public: // IRunnable - void run(); - void cancel(); - -private: - bool getIsCancelled() const; - -private: - bool _isInitialized; - bool _isCancelled; - bool _isTimeoutSet; - int32 _timeout; - SmartPtrIMessageHandler _messageHandler; - SmartPtrIPollableChannel _inputPollableChannel; - SmartPtrIErrorHandler _errorHandler; - SmartPtrCPollerMetadata _pollerMetadata; - CThreadSignal _threadSignalCancel; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_CREATE_THREADSAFE; - CAF_THREADSIGNAL_CREATE; - CAF_CM_DECLARE_NOCOPY(CSourcePollingChannelAdapter); -}; - -CAF_DECLARE_SMART_POINTER(CSourcePollingChannelAdapter); - -} - -#endif // #ifndef CSourcePollingChannelAdapter_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/CUnicastingDispatcher.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/CUnicastingDispatcher.h deleted file mode 100644 index 0feb9fb24..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/CUnicastingDispatcher.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CUnicastingDispatcher_h_ -#define CUnicastingDispatcher_h_ - - -#include "Integration/IMessageDispatcher.h" - -#include "Integration/Core/CBroadcastingDispatcher.h" -#include "Integration/IErrorHandler.h" -#include "Integration/IIntMessage.h" -#include "Integration/IMessageHandler.h" - -namespace Caf { - -/// Sends responses/errors back to the client. -class INTEGRATIONCORE_LINKAGE CUnicastingDispatcher : - public IMessageDispatcher { -public: - CUnicastingDispatcher(); - virtual ~CUnicastingDispatcher(); - -public: - void initialize( - const SmartPtrIErrorHandler& errorHandler); - -public: // IMessageDispatcher - void addHandler( - const SmartPtrIMessageHandler& messageHandler); - - void removeHandler( - const SmartPtrIMessageHandler& messageHandler); - - bool dispatch( - const SmartPtrIIntMessage& message); - -private: - typedef std::map CIntMessageHandlerCollection; - CAF_DECLARE_SMART_POINTER(CIntMessageHandlerCollection); - -private: - bool _isInitialized; - SmartPtrIErrorHandler _errorHandler; - SmartPtrCIntMessageHandlerCollection _messageHandlerCollection; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CUnicastingDispatcher); -}; - -CAF_DECLARE_SMART_POINTER(CUnicastingDispatcher); - -} - -#endif // #ifndef CUnicastingDispatcher_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/FileHeaders.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/FileHeaders.h deleted file mode 100644 index 16c4ce55c..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/FileHeaders.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 20, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef FileHeadersInc_h_ -#define FileHeadersInc_h_ - -namespace Caf { - namespace FileHeaders { - extern INTEGRATIONCORE_LINKAGE const char* _sFILENAME; - extern INTEGRATIONCORE_LINKAGE const char* _sORIGINAL_FILE; - } -} - -#endif // #ifndef FileHeadersInc_h_ - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/IntegrationCoreLink.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/IntegrationCoreLink.h deleted file mode 100644 index fab1c840b..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/IntegrationCoreLink.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 20, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef INTEGRATIONCORELINK_H_ -#define INTEGRATIONCORELINK_H_ - -#ifndef INTEGRATIONCORE_LINKAGE - #ifdef WIN32 - #ifdef FRAMEWORK_BUILD - #define INTEGRATIONCORE_LINKAGE __declspec(dllexport) - #else - #define INTEGRATIONCORE_LINKAGE __declspec(dllimport) - #endif - #else - #define INTEGRATIONCORE_LINKAGE - #endif -#endif - -#endif /* INTEGRATIONCORELINK_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/MessageHeaders.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/MessageHeaders.h deleted file mode 100644 index 9d3b6fb22..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Core/MessageHeaders.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 20, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef MessageHeadersInc_h_ -#define MessageHeadersInc_h_ - -namespace Caf { - namespace MessageHeaders { - // UUID stored as a string - extern INTEGRATIONCORE_LINKAGE const char* _sID; - - // int64 - extern INTEGRATIONCORE_LINKAGE const char* _sTIMESTAMP; - - // string - extern INTEGRATIONCORE_LINKAGE const char* _sCORRELATION_ID; - - // string - extern INTEGRATIONCORE_LINKAGE const char* _sREPLY_CHANNEL; - - // string - extern INTEGRATIONCORE_LINKAGE const char* _sERROR_CHANNEL; - - // int64 - extern INTEGRATIONCORE_LINKAGE const char* _sEXPIRATION_DATE; - - // int32 - extern INTEGRATIONCORE_LINKAGE const char* _sPRIORITY; - - // int32 - extern INTEGRATIONCORE_LINKAGE const char* _sSEQUENCE_NUMBER; - - // int32 - extern INTEGRATIONCORE_LINKAGE const char* _sSEQUENCE_SIZE; - - extern INTEGRATIONCORE_LINKAGE const char* _sIS_THROWABLE; - - // string - extern INTEGRATIONCORE_LINKAGE const char* _sREQUEST_ID; - - // boolean - extern INTEGRATIONCORE_LINKAGE const char* _sMULTIPART; - - // string - extern INTEGRATIONCORE_LINKAGE const char* _sMULTIPART_WORKING_DIR; - - // string - extern INTEGRATIONCORE_LINKAGE const char* _sMESSAGE_TYPE; - - // string - extern INTEGRATIONCORE_LINKAGE const char* _sPROTOCOL_TYPE; - - // string - extern INTEGRATIONCORE_LINKAGE const char* _sPROTOCOL_CONNSTR; - } -}; - -#endif // #ifndef MessageHeadersInc_h_ - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Dependencies/CPollerMetadata.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Dependencies/CPollerMetadata.h deleted file mode 100644 index 8311cf875..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/Dependencies/CPollerMetadata.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef _IntegrationContracts_CPollerMetadata_h_ -#define _IntegrationContracts_CPollerMetadata_h_ - -namespace Caf { - -class CPollerMetadata { -public: - CPollerMetadata() : - _maxMessagesPerPoll(0), - _fixedRate(0) {} - -public: - uint32 getMaxMessagesPerPoll() const { - return _maxMessagesPerPoll; - } - void putMaxMessagesPerPoll(const uint32& maxMessagesPerPoll) { - _maxMessagesPerPoll = maxMessagesPerPoll; - } - - uint32 getFixedRate() const { - return _fixedRate; - } - void putFixedRate(const uint32& fixedRate) { - _fixedRate = fixedRate; - } - -private: - uint32 _maxMessagesPerPoll; - uint32 _fixedRate; - -private: - CPollerMetadata (const CPollerMetadata&); - CPollerMetadata & operator=(const CPollerMetadata&); -}; - -CAF_DECLARE_SMART_POINTER(CPollerMetadata); - -} - -#endif // #ifndef _IntegrationContracts_CPollerMetadata_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IChannelInterceptor.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IChannelInterceptor.h deleted file mode 100644 index 266da2a4e..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IChannelInterceptor.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Created on: Jan 25, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef _IntegrationContracts_ICHANNELINTERCEPTOR_H_ -#define _IntegrationContracts_ICHANNELINTERCEPTOR_H_ - - -#include "Integration/IIntMessage.h" -#include "Integration/IMessageChannel.h" - -namespace Caf { - -struct __declspec(novtable) - IChannelInterceptor : public ICafObject -{ - CAF_DECL_UUID("5002EA10-769B-44A0-AA6B-18ED91B57655") - - /** - * Invoked before the message is sent to the channel. - * The message may be modified if necessary. - * If this method returns null then the - * actual send invocation will not occur. - */ - virtual SmartPtrIIntMessage& preSend( - SmartPtrIIntMessage& message, - SmartPtrIMessageChannel& channel) = 0; - - /** - * Invoked immediately after the send invocation. The - * boolean value argument represents the return value of - * that invocation. - */ - virtual void postSend( - SmartPtrIIntMessage& message, - SmartPtrIMessageChannel& channel, - bool sent) = 0; - - /** - * Invoked as soon as receive is called and before a message - * is actually retrieved. If the return value is 'false' then - * no message will be retrieved. This only applies to PollableChannels. - */ - virtual bool preReceive( - SmartPtrIMessageChannel& channel) = 0; - - /** - * Invoked immediately after a message has been retrieved but - * before it is returned to the caller. The message may be modified - * if necessary. This only applies to PollableChannels. - */ - virtual SmartPtrIIntMessage& postReceive( - SmartPtrIIntMessage& message, - SmartPtrIMessageChannel& channel) = 0; -}; - -CAF_DECLARE_SMART_INTERFACE_POINTER(IChannelInterceptor); - -} - -#endif /* _IntegrationContracts_ICHANNELINTERCEPTOR_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IChannelInterceptorInstance.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IChannelInterceptorInstance.h deleted file mode 100644 index b03ceb0f4..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IChannelInterceptorInstance.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Created on: Jan 25, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef _IntegrationContracts_ICHANNELINTERCEPTORINSTANCE_H_ -#define _IntegrationContracts_ICHANNELINTERCEPTORINSTANCE_H_ - -namespace Caf { - -struct __declspec(novtable) - IChannelInterceptorInstance : public ICafObject -{ - CAF_DECL_UUID("566C38A8-FF13-4E31-814E-A18130C009F6") - - virtual uint32 getOrder() const = 0; - - virtual bool isChannelIdMatched(const std::string& channelId) const = 0; -}; - -CAF_DECLARE_SMART_INTERFACE_POINTER(IChannelInterceptorInstance); - -} -#endif /* _IntegrationContracts_ICHANNELINTERCEPTORINSTANCE_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IChannelInterceptorSupport.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IChannelInterceptorSupport.h deleted file mode 100644 index c1d2cee1a..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IChannelInterceptorSupport.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Created on: Jan 26, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef _IntegrationContracts_ICHANNELINTERCEPTORSUPPORT_H_ -#define _IntegrationContracts_ICHANNELINTERCEPTORSUPPORT_H_ - - -#include "ICafObject.h" - -#include "Integration/IChannelInterceptor.h" - -namespace Caf { - -struct __declspec(novtable) -IChannelInterceptorSupport : public ICafObject { - CAF_DECL_UUID("C8F3CBAF-B1EB-4AD8-920C-EFE5EE25638A") - - typedef std::list InterceptorCollection; - virtual void setInterceptors( - const InterceptorCollection& interceptors) = 0; -}; - -CAF_DECLARE_SMART_INTERFACE_POINTER(IChannelInterceptorSupport); - -} - -#endif /* _IntegrationContracts_ICHANNELINTERCEPTORSUPPORT_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IChannelResolver.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IChannelResolver.h deleted file mode 100644 index 279a5331e..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IChannelResolver.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef _IntegrationContracts_IChannelResolver_h_ -#define _IntegrationContracts_IChannelResolver_h_ - - -#include "Integration/IIntegrationObject.h" -#include "Integration/IMessageChannel.h" - -namespace Caf { - -/// TODO - describe interface -struct __declspec(novtable) - IChannelResolver : public ICafObject -{ - CAF_DECL_UUID("32361862-a312-4cab-a978-45b7059ca102") - - virtual SmartPtrIMessageChannel resolveChannelName( - const std::string& channelName) const = 0; - - virtual SmartPtrIIntegrationObject resolveChannelNameToObject( - const std::string& channelName) const = 0; -}; - -CAF_DECLARE_SMART_INTERFACE_POINTER(IChannelResolver); - -} - -#endif // #ifndef _IntegrationContracts_IChannelResolver_h_ - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IDocument.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IDocument.h deleted file mode 100644 index 01a2b8e5e..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IDocument.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef _IntegrationContracts_IDocument_h_ -#define _IntegrationContracts_IDocument_h_ - -namespace Caf { - -CAF_FORWARD_DECLARE_SMART_INTERFACE(IDocument); - -/// TODO - describe interface -struct __declspec(novtable) - IDocument : public ICafObject -{ - CAF_DECL_UUID("aa95ea11-3ca0-4863-b267-88d38246ff67") - -public: // Read operations - typedef std::map CAttributeCollection; - typedef std::multimap CChildCollection; - typedef std::deque COrderedChildCollection; - CAF_DECLARE_SMART_POINTER(CAttributeCollection); - CAF_DECLARE_SMART_POINTER(CChildCollection); - CAF_DECLARE_SMART_POINTER(COrderedChildCollection); - -public: // Read operations - virtual std::string findRequiredAttribute(const std::string& name) const = 0; - virtual std::string findOptionalAttribute(const std::string& name) const = 0; - virtual SmartPtrIDocument findRequiredChild(const std::string& name) const = 0; - virtual SmartPtrIDocument findOptionalChild(const std::string& name) const = 0; - virtual SmartPtrCAttributeCollection getAllAttributes() const = 0; - virtual SmartPtrCChildCollection getAllChildren() const = 0; - virtual SmartPtrCOrderedChildCollection getAllChildrenInOrder() const = 0; - virtual std::string getName() const = 0; - virtual std::string getValue() const = 0; - virtual std::string getPath() const = 0; - -public: // Save operations - virtual void saveToFile(const std::string& filename) const = 0; - virtual std::string saveToString() const = 0; - virtual std::string saveToStringRaw() const = 0; -}; - -} - -#endif // #ifndef _IntegrationContracts_IDocument_h_ - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IErrorHandler.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IErrorHandler.h deleted file mode 100644 index 8905c797b..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IErrorHandler.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef _IntegrationContracts_IErrorHandler_h_ -#define _IntegrationContracts_IErrorHandler_h_ - - -#include "Integration/IIntMessage.h" -#include "Integration/IThrowable.h" - -namespace Caf { - -/// TODO - describe interface -struct __declspec(novtable) - IErrorHandler : public ICafObject -{ - CAF_DECL_UUID("da0e8646-43fb-4d43-a31b-f736c3978d48") - -public: // Read operations - virtual void handleError( - const SmartPtrIThrowable& throwable, - const SmartPtrIIntMessage& message) const = 0; -}; - -CAF_DECLARE_SMART_INTERFACE_POINTER(IErrorHandler); - -} - -#endif // #ifndef _IntegrationContracts_IErrorHandler_h_ - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IErrorProcessor.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IErrorProcessor.h deleted file mode 100644 index 337b6e35a..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IErrorProcessor.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef _IntegrationContracts_IErrorProcessor_h_ -#define _IntegrationContracts_IErrorProcessor_h_ - - -#include "Integration/IIntMessage.h" - -namespace Caf { - -/// TODO - describe interface -struct __declspec(novtable) - IErrorProcessor : public ICafObject -{ - CAF_DECL_UUID("7ed3c23c-609a-4e42-9463-ed98da222d0a") - - virtual SmartPtrIIntMessage processErrorMessage( - const SmartPtrIIntMessage& message) = 0; -}; - -CAF_DECLARE_SMART_INTERFACE_POINTER(IErrorProcessor); - -} - -#endif // #ifndef _IntegrationContracts_IErrorProcessor_h_ - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IExpressionInvoker.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IExpressionInvoker.h deleted file mode 100644 index c91c26188..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IExpressionInvoker.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Created on: Jul 23, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef _IntegrationContracts_IEXPRESSIONINVOKER_H_ -#define _IntegrationContracts_IEXPRESSIONINVOKER_H_ - - -#include "IVariant.h" -#include "Integration/IIntMessage.h" - -namespace Caf { - -struct __declspec(novtable) IExpressionInvoker : public ICafObject -{ - CAF_DECL_UUID("EF1DC19E-4DE0-416C-A7CB-D1695FF8D52A") - - virtual SmartPtrIVariant invokeExpression( - const std::string& methodName, - const Cdeqstr& methodParams, - const SmartPtrIIntMessage& message) = 0; -}; -CAF_DECLARE_SMART_INTERFACE_POINTER(IExpressionInvoker); -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IIntMessage.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IIntMessage.h deleted file mode 100644 index 5b9324b5a..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IIntMessage.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef _IntegrationContracts_IIntMessage_h_ -#define _IntegrationContracts_IIntMessage_h_ - - -#include "ICafObject.h" - -#include "IVariant.h" -#include "Memory/DynamicArray/DynamicArrayInc.h" - -namespace Caf { - -/// TODO - describe interface -struct __declspec(novtable) - IIntMessage : public ICafObject { - CAF_DECL_UUID("c9abc77a-ebd1-4203-911f-1b37d9b17d8e") - - // - // Routines dealing with the message - // - virtual UUID getMessageId() const = 0; - - virtual std::string getMessageIdStr() const = 0; - - // - // Routines dealing with the payload - // - typedef std::map > CHeaders; - CAF_DECLARE_SMART_POINTER(CHeaders); - - virtual SmartPtrCDynamicByteArray getPayload() const = 0; - - virtual std::string getPayloadStr() const = 0; - - // - // Routines dealing with the headers - // - virtual SmartPtrCHeaders getHeaders() const = 0; - - virtual SmartPtrIVariant findOptionalHeader( - const std::string& key) const = 0; - - virtual SmartPtrIVariant findRequiredHeader( - const std::string& key) const = 0; - - virtual std::string findOptionalHeaderAsString( - const std::string& key) const = 0; - - virtual std::string findRequiredHeaderAsString( - const std::string& key) const = 0; - - virtual SmartPtrICafObject findOptionalObjectHeader( - const std::string& key) const = 0; - - virtual SmartPtrICafObject findRequiredObjectHeader( - const std::string& key) const = 0; -}; - -CAF_DECLARE_SMART_INTERFACE_POINTER(IIntMessage); - -typedef std::deque CMessageCollection; -CAF_DECLARE_SMART_POINTER(CMessageCollection); - -} - -#endif // #ifndef _IntegrationContracts_IIntMessage_h_ - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IIntegrationAppContext.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IIntegrationAppContext.h deleted file mode 100644 index db7b68a44..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IIntegrationAppContext.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Created on: Jun 13, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef _IntegrationContracts_IINTEGRATIONAPPCONTEXT_H_ -#define _IntegrationContracts_IINTEGRATIONAPPCONTEXT_H_ - - -#include "ICafObject.h" - -#include "Integration/IIntegrationObject.h" - -namespace Caf { - -struct __declspec(novtable) IIntegrationAppContext : public ICafObject { - CAF_DECL_UUID("CC12C628-50C1-4E74-998D-3A9C961FA06F") - - virtual SmartPtrIIntegrationObject getIntegrationObject( - const std::string& id) const = 0; - - virtual void getIntegrationObject( - const IID& iid, - void **ppv) const = 0; - - typedef std::deque CObjectCollection; - CAF_DECLARE_SMART_POINTER(CObjectCollection); - - virtual SmartPtrCObjectCollection getIntegrationObjects(const IID& iid) const = 0; -}; - -CAF_DECLARE_SMART_INTERFACE_POINTER(IIntegrationAppContext); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IIntegrationAppContextAware.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IIntegrationAppContextAware.h deleted file mode 100644 index c8fa153a5..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IIntegrationAppContextAware.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Created on: Jun 13, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef _IntegrationContracts_IINTEGRATIONAPPCONTEXTAWARE_H_ -#define _IntegrationContracts_IINTEGRATIONAPPCONTEXTAWARE_H_ - - -#include "ICafObject.h" - -#include "Integration/IIntegrationAppContext.h" - -namespace Caf { - -struct __declspec(novtable) IIntegrationAppContextAware : public ICafObject { - CAF_DECL_UUID("9BC34EB5-AEFF-4384-86DE-421DE89AB6E8") - - virtual void setIntegrationAppContext( - SmartPtrIIntegrationAppContext context) = 0; -}; - -CAF_DECLARE_SMART_INTERFACE_POINTER(IIntegrationAppContextAware); -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IIntegrationComponent.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IIntegrationComponent.h deleted file mode 100644 index 18867421b..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IIntegrationComponent.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef _IntegrationContracts_IIntegrationComponent_h_ -#define _IntegrationContracts_IIntegrationComponent_h_ - - -#include "Integration/IDocument.h" -#include "Integration/IIntegrationObject.h" - -namespace Caf { - -/// TODO - describe interface -struct __declspec(novtable) - IIntegrationComponent : public ICafObject -{ - CAF_DECL_UUID("087e1494-4abe-4bb6-ae49-48f4510e057f") - - virtual bool isResponsible( - const SmartPtrIDocument& configSection) const = 0; - - virtual SmartPtrIIntegrationObject createObject( - const SmartPtrIDocument& configSection) const = 0; -}; - -CAF_DECLARE_SMART_INTERFACE_POINTER(IIntegrationComponent); - -} - -#endif // #ifndef _IntegrationContracts_IIntegrationComponent_h_ - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IIntegrationComponentInstance.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IIntegrationComponentInstance.h deleted file mode 100644 index 6e5d675d2..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IIntegrationComponentInstance.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef _IntegrationContracts_IIntegrationComponentInstance_h_ -#define _IntegrationContracts_IIntegrationComponentInstance_h_ - - -#include "Common/IAppContext.h" -#include "Integration/IChannelResolver.h" - -namespace Caf { - -/// TODO - describe interface -struct __declspec(novtable) - IIntegrationComponentInstance : public ICafObject -{ - CAF_DECL_UUID("70053165-1e46-4893-8e27-0e6ee8675c44") - - virtual void wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver) = 0; -}; - -CAF_DECLARE_SMART_INTERFACE_POINTER(IIntegrationComponentInstance); - -} - -#endif // #ifndef _IntegrationContracts_IIntegrationComponent_h_ - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IIntegrationObject.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IIntegrationObject.h deleted file mode 100644 index 54b846336..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IIntegrationObject.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef _IntegrationContracts_IIntegrationObject_h_ -#define _IntegrationContracts_IIntegrationObject_h_ - - -#include "Integration/IDocument.h" - -namespace Caf { - -/// TODO - describe interface -struct __declspec(novtable) - IIntegrationObject : public ICafObject -{ - CAF_DECL_UUID("295fa2c8-01a7-4102-b13e-8fcac00b3e5f") - - virtual void initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection) = 0; - - virtual std::string getId() const = 0; -}; - -CAF_DECLARE_SMART_INTERFACE_POINTER(IIntegrationObject); - -typedef std::map CIntegrationObjectCollection; -CAF_DECLARE_SMART_POINTER(CIntegrationObjectCollection); - -} - -#endif // #ifndef _IntegrationContracts_IIntegrationObject_h_ - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/ILifecycle.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/ILifecycle.h deleted file mode 100644 index 74c930ed0..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/ILifecycle.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef _IntegrationContracts_ILifecycle_h_ -#define _IntegrationContracts_ILifecycle_h_ - -namespace Caf { - -/// TODO - describe interface -struct __declspec(novtable) - ILifecycle : public ICafObject -{ - CAF_DECL_UUID("180845f8-c956-46b3-8a1b-ef5061cc927a") - - virtual void start(const uint32 timeoutMs) = 0; - virtual void stop(const uint32 timeoutMs) = 0; - virtual bool isRunning() const = 0; -}; - -CAF_DECLARE_SMART_INTERFACE_POINTER(ILifecycle); - -} - -#endif // #ifndef _IntegrationContracts_ILifecycle_h_ - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IMessageChannel.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IMessageChannel.h deleted file mode 100644 index 35b75e288..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IMessageChannel.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef _IntegrationContracts_IMessageChannel_h_ -#define _IntegrationContracts_IMessageChannel_h_ - - -#include "Integration/IIntMessage.h" - -namespace Caf { - -/// TODO - describe interface -struct __declspec(novtable) - IMessageChannel : public ICafObject -{ - CAF_DECL_UUID("d5192d01-9c26-4c1c-8966-66d7a108bcbf") - - virtual bool send( - const SmartPtrIIntMessage& message) = 0; - - virtual bool send( - const SmartPtrIIntMessage& message, - const int32 timeout) = 0; -}; - -CAF_DECLARE_SMART_INTERFACE_POINTER(IMessageChannel); - -} - -#endif // #ifndef _IntegrationContracts_IMessageChannel_h_ - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IMessageDispatcher.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IMessageDispatcher.h deleted file mode 100644 index 5e4d35afe..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IMessageDispatcher.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef _IntegrationContracts_IMessageDispatcher_h_ -#define _IntegrationContracts_IMessageDispatcher_h_ - - -#include "Integration/IIntMessage.h" -#include "Integration/IMessageHandler.h" - -namespace Caf { - -/// TODO - describe interface -struct __declspec(novtable) - IMessageDispatcher : public ICafObject -{ - CAF_DECL_UUID("639d8ead-6406-4c41-9a36-74d065f5dd6b") - - virtual void addHandler( - const SmartPtrIMessageHandler& messageHandler) = 0; - - virtual void removeHandler( - const SmartPtrIMessageHandler& messageHandler) = 0; - - virtual bool dispatch( - const SmartPtrIIntMessage& message) = 0; -}; - -CAF_DECLARE_SMART_INTERFACE_POINTER(IMessageDispatcher); - -} - -#endif // #ifndef _IntegrationContracts_IMessageDispatcher_h_ - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IMessageHandler.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IMessageHandler.h deleted file mode 100644 index 240e3c417..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IMessageHandler.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef _IntegrationContracts_IMessageHandler_h_ -#define _IntegrationContracts_IMessageHandler_h_ - - -#include "Integration/IIntMessage.h" - -namespace Caf { - -/// TODO - describe interface -struct __declspec(novtable) - IMessageHandler : public ICafObject -{ - CAF_DECL_UUID("39a78b6f-f326-4739-b8ad-9e90a827745a") - - virtual void handleMessage( - const SmartPtrIIntMessage& message) = 0; - - virtual SmartPtrIIntMessage getSavedMessage() const = 0; - - virtual void clearSavedMessage() = 0; -}; - -CAF_DECLARE_SMART_INTERFACE_POINTER(IMessageHandler); - -} - -#endif // #ifndef _IntegrationContracts_IMessageHandler_h_ - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IMessageProcessor.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IMessageProcessor.h deleted file mode 100644 index 345605ed5..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IMessageProcessor.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef _IntegrationContracts_IMessageProcessor_h_ -#define _IntegrationContracts_IMessageProcessor_h_ - - -#include "Integration/IIntMessage.h" - -namespace Caf { - -/// TODO - describe interface -struct __declspec(novtable) - IMessageProcessor : public ICafObject -{ - CAF_DECL_UUID("68770787-c44e-457e-bf8d-20c64d37bfee") - - virtual SmartPtrIIntMessage processMessage( - const SmartPtrIIntMessage& message) = 0; -}; - -CAF_DECLARE_SMART_INTERFACE_POINTER(IMessageProcessor); - -} - -#endif // #ifndef _IntegrationContracts_IMessageProcessor_h_ - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IMessageProducer.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IMessageProducer.h deleted file mode 100644 index 8775135b3..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IMessageProducer.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef _IntegrationContracts_IMessageProducer_h_ -#define _IntegrationContracts_IMessageProducer_h_ - -namespace Caf { - -/// TODO - describe interface -struct __declspec(novtable) - IMessageProducer : public ICafObject -{ - CAF_DECL_UUID("14430bc5-8556-48f8-b37f-c2f24a50d8dd") - - virtual bool isMessageProducer() const = 0; -}; - -CAF_DECLARE_SMART_INTERFACE_POINTER(IMessageProducer); - -} - -#endif // #ifndef _IntegrationContracts_IMessageProducer_h_ - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IMessageRouter.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IMessageRouter.h deleted file mode 100644 index 1db505f6e..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IMessageRouter.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef _IntegrationContracts_IMessageRouter_h_ -#define _IntegrationContracts_IMessageRouter_h_ - - -#include "Integration/IIntMessage.h" - -namespace Caf { - -/// TODO - describe interface -struct __declspec(novtable) - IMessageRouter : public ICafObject -{ - CAF_DECL_UUID("27ed0739-e527-469b-882f-196d532be0bd") - - virtual void routeMessage(const SmartPtrIIntMessage& message) = 0; -}; - -CAF_DECLARE_SMART_INTERFACE_POINTER(IMessageRouter); - -} - -#endif // #ifndef _IntegrationContracts_IMessageRouter_h_ - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IMessageSplitter.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IMessageSplitter.h deleted file mode 100644 index e32a8e76a..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IMessageSplitter.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef _IntegrationContracts_IMessageSplitter_h_ -#define _IntegrationContracts_IMessageSplitter_h_ - - -#include "Integration/IIntMessage.h" - -namespace Caf { - -/// TODO - describe interface -struct __declspec(novtable) - IMessageSplitter : public ICafObject -{ - CAF_DECL_UUID("89a25ba3-113d-4efc-af46-522feda304ac") - - typedef std::deque CMessageCollection; - CAF_DECLARE_SMART_POINTER(CMessageCollection); - - virtual SmartPtrCMessageCollection splitMessage( - const SmartPtrIIntMessage& message) = 0; -}; - -CAF_DECLARE_SMART_INTERFACE_POINTER(IMessageSplitter); - -} - -#endif // #ifndef _IntegrationContracts_IMessageSplitter_h_ - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IPhased.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IPhased.h deleted file mode 100644 index b8fea1669..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IPhased.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Created on: Aug 6, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef _IntegrationContracts_IPhased_h -#define _IntegrationContracts_IPhased_h - - -#include "ICafObject.h" - -namespace Caf { - -struct __declspec(novtable) IPhased : public ICafObject { - CAF_DECL_UUID("CAE354D0-E212-4030-8CB7-23C92D59C6A3") - - virtual int32 getPhase() const = 0; -}; -CAF_DECLARE_SMART_INTERFACE_POINTER(IPhased); - -}; - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IPollableChannel.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IPollableChannel.h deleted file mode 100644 index 92cd2b216..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IPollableChannel.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef _IntegrationContracts_IPollableChannel_h_ -#define _IntegrationContracts_IPollableChannel_h_ - - -#include "Integration/Dependencies/CPollerMetadata.h" -#include "Integration/IIntMessage.h" - -namespace Caf { - -/// TODO - describe interface -struct __declspec(novtable) - IPollableChannel : public ICafObject -{ - CAF_DECL_UUID("a7ce8841-f37d-489a-a299-e148c5ff6b11") - - virtual SmartPtrIIntMessage receive() = 0; - virtual SmartPtrIIntMessage receive(const int32 timeout) = 0; - virtual SmartPtrCPollerMetadata getPollerMetadata() const = 0; -}; - -CAF_DECLARE_SMART_INTERFACE_POINTER(IPollableChannel); - -} - -#endif // #ifndef _IntegrationContracts_IPollableChannel_h_ - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IRunnable.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IRunnable.h deleted file mode 100644 index f857a51a6..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IRunnable.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef _IntegrationContracts_IRunnable_h_ -#define _IntegrationContracts_IRunnable_h_ - -namespace Caf { - -/// TODO - describe interface -struct __declspec(novtable) - IRunnable : public ICafObject -{ - CAF_DECL_UUID("a3ad671c-3d04-4eba-aaa4-8dcc9c43c959") - - virtual void run() = 0; - virtual void cancel() = 0; -}; - -CAF_DECLARE_SMART_INTERFACE_POINTER(IRunnable); - -} - -#endif // #ifndef _IntegrationContracts_IRunnable_h_ - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/ISmartLifecycle.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/ISmartLifecycle.h deleted file mode 100644 index ada080173..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/ISmartLifecycle.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Created on: Aug 6, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef _IntegrationContracts_ISmartLifecycle_h -#define _IntegrationContracts_ISmartLifecycle_h - - -#include "Integration/ILifecycle.h" - -namespace Caf { - -struct __declspec(novtable) ISmartLifecycle : public ILifecycle { - CAF_DECL_UUID("312B7430-659F-48A1-AAAE-AE44D349132C") - - virtual bool isAutoStartup() const = 0; -}; -CAF_DECLARE_SMART_INTERFACE_POINTER(ISmartLifecycle); - -}; - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/ISubscribableChannel.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/ISubscribableChannel.h deleted file mode 100644 index a846fcc39..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/ISubscribableChannel.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef _IntegrationContracts_ISubscribableChannel_h_ -#define _IntegrationContracts_ISubscribableChannel_h_ - - -#include "Integration/IMessageHandler.h" - -namespace Caf { - -/// TODO - describe interface -struct __declspec(novtable) - ISubscribableChannel : public ICafObject -{ - CAF_DECL_UUID("14d7e980-1b98-4453-b27e-8c058fb705b9") - - virtual void subscribe( - const SmartPtrIMessageHandler& messageHandler) = 0; - virtual void unsubscribe( - const SmartPtrIMessageHandler& messageHandler) = 0; -}; - -CAF_DECLARE_SMART_INTERFACE_POINTER(ISubscribableChannel); - -} - -#endif // #ifndef _IntegrationContracts_ISubscribableChannel_h_ - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/ITaskExecutor.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/ITaskExecutor.h deleted file mode 100644 index e13163f4b..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/ITaskExecutor.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef _IntegrationContracts_ITaskExecutor_h_ -#define _IntegrationContracts_ITaskExecutor_h_ - -namespace Caf { - -/// TODO - describe interface -struct __declspec(novtable) - ITaskExecutor : public ICafObject -{ - CAF_DECL_UUID("4ab38314-fd31-49fc-bfce-173abc53f1a8") - - typedef enum { - ETaskStateNotStarted, - ETaskStateStarted, - ETaskStateStopping, - ETaskStateFinished, - ETaskStateFailed - } ETaskState; - - virtual void execute(const uint32 timeoutMs) = 0; - virtual void cancel(const uint32 timeoutMs) = 0; - virtual ETaskState getState() const = 0; -}; - -CAF_DECLARE_SMART_INTERFACE_POINTER(ITaskExecutor); - -} - -#endif // #ifndef _IntegrationContracts_ITaskExecutor_h_ - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IThrowable.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IThrowable.h deleted file mode 100644 index 9e5d8d529..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/IThrowable.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct. 25, 2011 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef _FxContracts_IThrowable_h_ -#define _FxContracts_IThrowable_h_ - - -#include "ICafObject.h" - -namespace Caf { - -CAF_FORWARD_DECLARE_SMART_INTERFACE(IThrowable); - -/// TODO - describe interface -struct __declspec(novtable) -IThrowable : public ICafObject { - CAF_DECL_UUID("5bced55d-06b7-4c4b-b805-90b51311dc9b") - - virtual std::string getExceptionClassName() const = 0; - virtual std::string getMsg() const = 0; - virtual std::string getClassName() const = 0; - virtual std::string getFuncName() const = 0; - virtual HRESULT getError() const = 0; - virtual std::string getFullMsg() const = 0; -}; - -} - -#endif - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/ITransformer.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/ITransformer.h deleted file mode 100644 index 59cf86afc..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Integration/ITransformer.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef _IntegrationContracts_ITransformer_h_ -#define _IntegrationContracts_ITransformer_h_ - - -#include "Integration/IIntMessage.h" - -namespace Caf { - -/// TODO - describe interface -struct __declspec(novtable) - ITransformer : public ICafObject -{ - CAF_DECL_UUID("1f2a6ecb-f842-4e09-82a8-89eaf64ec98b") - - virtual SmartPtrIIntMessage transformMessage( - const SmartPtrIIntMessage& message) = 0; -}; - -CAF_DECLARE_SMART_INTERFACE_POINTER(ITransformer); - -} - -#endif // #ifndef _IntegrationContracts_ITransformer_h_ - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Memory/DynamicArray/DynamicArrayInc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Memory/DynamicArray/DynamicArrayInc.h deleted file mode 100644 index a8d3207fd..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Memory/DynamicArray/DynamicArrayInc.h +++ /dev/null @@ -1,50 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////// -// -// Author: Michael Donahue -// -// Created: 05/03/2004 -// -// Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential -// -- VMware Confidential -// -/////////////////////////////////////////////////////////////////////////////////////////// - -#ifndef DynamicArrayInc_h_ -#define DynamicArrayInc_h_ - -#include "Memory/DynamicArray/SDynamicArrayMallocAllocator.h" - -namespace Caf { - -template -class TDynamicArray; - -template -class TCharAdapter; - -template -class TWCharAdapter; - -template -class TByteAdapter; - -typedef TDynamicArray CDynamicByteArray; -typedef TCharAdapter > > CDynamicCharArray; -typedef TWCharAdapter > > CDynamicWCharArray; - -} - -#include "Memory/DynamicArray/TDynamicArray.h" -#include "Memory/DynamicArray/TByteAdapter.h" -#include "Memory/DynamicArray/TCharAdapter.h" -#include "Memory/DynamicArray/TWCharAdapter.h" - -namespace Caf { - -CAF_DECLARE_SMART_POINTER(CDynamicByteArray); -CAF_DECLARE_SMART_POINTER(CDynamicCharArray); -CAF_DECLARE_SMART_POINTER(CDynamicWCharArray); - -} - -#endif // #ifdef DynamicArrayInc_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Memory/DynamicArray/SDynamicArrayMallocAllocator.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Memory/DynamicArray/SDynamicArrayMallocAllocator.h deleted file mode 100644 index 4bdeecd22..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Memory/DynamicArray/SDynamicArrayMallocAllocator.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Author: mdonahue - * Created: Feb 15, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef SDYNAMICARRAYMALLOCALLOCATOR_H_ -#define SDYNAMICARRAYMALLOCALLOCATOR_H_ - -namespace Caf { - -struct SDynamicArrayMallocAllocator { - static void* allocMemory( const uint32 cdwAllocSize ) - { - return ::malloc( cdwAllocSize ); - } - - static void freeMemory( void* pvFree ) - { - if ( NULL != pvFree ) - { - ::free( pvFree ); - } - } -}; -} - -#endif /* SDYNAMICARRAYMALLOCALLOCATOR_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Memory/DynamicArray/TByteAdapter.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Memory/DynamicArray/TByteAdapter.h deleted file mode 100644 index 55c55cb78..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Memory/DynamicArray/TByteAdapter.h +++ /dev/null @@ -1,104 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// $Workfile: TByteAdapter.h $ -// -// Author: Phil Smith -// -// Purpose: This template provides the ability to use a ${TDynamicArray} -// or a TStaticArray where a byte pointer is required. It -// provides a const byte* pointer conversion operator for use -// when read only access is required and a function to get the -// pointer for write access. Use the byte adapter as follows: -// TByteAdapter > -// -// Predefined character array objects CEcmCharArray and -// CEcmWCharArray which use the byte adapter have been provided -// in EcmCommonStaticMinDepInc.h. -// -// Created: Tuesday, August 20, 2002 10:00:00 AM -// -// Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential -// -- VMware Confidential -// -// Modification History: -// -// $Log: //wpbuild01/PvcsData/ECM_40/archives/ECM_41/WinNT/Source/CommonAgtCol/Cpp/EcmCommonStaticMinDep/TByteAdapter.h-arc $ -// -// Rev 1.4 17 Sep 2003 09:43:12 Michael.Donahue -// Implemented hooks for new library model -// -// Rev 1.3 31 Oct 2002 13:58:02 Greg.Burk -// Modified as per code review recomendations. -// -// Rev 1.2 15 Oct 2002 17:22:58 Phillip.Smith -// Documentation updates. -// -// Rev 1.0 09 Oct 2002 13:42:12 brian.williams -// Initial revision. -// -////////////////////////////////////////////////////////////////////////////// -#ifndef _TByteAdapter_H_ -#define _TByteAdapter_H_ - -namespace Caf { - -template -class TByteAdapter : public T -{ -public: - ////////////////////////////////////////////////////////////////////////// - // Default Constructor - ////////////////////////////////////////////////////////////////////////// - TByteAdapter(const wchar_t * pwszDesc = NULL) {} - - ////////////////////////////////////////////////////////////////////////// - // Destructor - ////////////////////////////////////////////////////////////////////////// - ~TByteAdapter() {} - - ////////////////////////////////////////////////////////////////////////// - // GetNonConstBytePtr - // - // Get non-const pointer to internal data converted to btye *. - // This function should be used only when you must get a pointer that is - // to be written to, and you should always call the ${TDynamicArray::Verify()} - // function after modifying the data pointed to by this pointer or passing - // the pointer to a function that modifies the data pointed to by this - // pointer. - ////////////////////////////////////////////////////////////////////////// - byte * getNonConstBytePtr() - { - this->verify(); - return reinterpret_cast(this->getNonConstPtr()); - } - - ////////////////////////////////////////////////////////////////////////// - // GetBytePtr - // - // Get const pointer to internal data converted to btye *. - ////////////////////////////////////////////////////////////////////////// - const byte * getBytePtr() const - { - this->verify(); - return reinterpret_cast(this->getPtr()); - } - - ////////////////////////////////////////////////////////////////////////// - // const byte Conversion Operator - // - // Get const pointer to internal data converted to btye *. - ////////////////////////////////////////////////////////////////////////// - operator const byte * () const - { - this->verify(); - return reinterpret_cast(this->getPtr()); - } - -private: - TByteAdapter(const TByteAdapter & crRhs); - TByteAdapter & operator=(const TByteAdapter & crRhs); -}; - -} - -#endif // _TByteAdapter_H_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Memory/DynamicArray/TCharAdapter.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Memory/DynamicArray/TCharAdapter.h deleted file mode 100644 index 3e76e0b2c..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Memory/DynamicArray/TCharAdapter.h +++ /dev/null @@ -1,401 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// $Workfile: TCharAdapter.h $ -// -// Author: Greg Burk -// -// Purpose: This template provides an adapter for TDynamicArray (or -// other types of "safe" array classes) that exposes functions -// that are useful when working with an array of type char. -// -// A typedef of this class is already defined and should be -// used instead of explicitly using this class. The typedef -// is CEcmCharArray. -// -// Created: Friday, October 18, 2002 1:50:32 PM -// -// Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential -// -- VMware Confidential -// -// Modification History: -// -// $Log: //wpbuild01/PvcsData/ECM_40/archives/ECM_41/WinNT/Source/CommonAgtCol/Cpp/EcmCommonStaticMinDep/TCharAdapter.h-arc $ -// -// Rev 1.3 10 Oct 2003 08:49:24 Michael.Donahue -// Fixed bug in StrCpy -// -// Rev 1.2 17 Sep 2003 09:43:12 Michael.Donahue -// Implemented hooks for new library model -// -// Rev 1.1 16 Jan 2003 11:17:52 Greg.Burk -// Made changes necessary to accomodate new CEcmBasicString class and changes to CEcmString. -// -// Rev 1.0 31 Oct 2002 10:43:06 Greg.Burk -// Initial Revision -// -////////////////////////////////////////////////////////////////////////////// -#ifndef _TCharAdapter_H_ -#define _TCharAdapter_H_ - -#include - -namespace Caf { - -template -class TCharAdapter : public T -{ -public: - ////////////////////////////////////////////////////////////////////////// - // Default Constructor - ////////////////////////////////////////////////////////////////////////// - TCharAdapter() {} - - ////////////////////////////////////////////////////////////////////////// - // Conversion Constructor - ////////////////////////////////////////////////////////////////////////// - TCharAdapter(const wchar_t * rhs) - { - wideToMultiByte(rhs); - } - - ////////////////////////////////////////////////////////////////////////// - // Conversion Constructor - ////////////////////////////////////////////////////////////////////////// - TCharAdapter(const char * rhs) - { - (*this) = rhs; - } - - ////////////////////////////////////////////////////////////////////////// - // Destructor - ////////////////////////////////////////////////////////////////////////// - ~TCharAdapter() {} - - ////////////////////////////////////////////////////////////////////////// - // Assignment operator - ////////////////////////////////////////////////////////////////////////// - TCharAdapter& operator=(const wchar_t * rhs) - { - wideToMultiByte(rhs); - return *this; - } - - ////////////////////////////////////////////////////////////////////////// - // Assignment operator - ////////////////////////////////////////////////////////////////////////// - TCharAdapter& operator=(const char * rhs) - { - const uint32 culLength = ::strlen(rhs); - - if(culLength > 0) - { - this->allocateELements(culLength); - strnCpy(rhs, culLength); - } - - return *this; - } - - ////////////////////////////////////////////////////////////////////////////// - // MakeLower() - // - // Converts all of the upper-case characters in this string to lower-case. - ////////////////////////////////////////////////////////////////////////////// - void makeLower() - { - // Pre-validation. - this->verifySentinal(); - - if(!this->IsNull()) - { - strlwr(this->m_ptData); - } - - // Post-validation. - this->verifySentinal(); - } - - ////////////////////////////////////////////////////////////////////////// - // MakeUpper - // - // Converts all of the lower-case characters in this array to upper-case. - ////////////////////////////////////////////////////////////////////////// - void makeUpper() - { - // Pre-validation. - this->verifySentinal(); - - if(!this->isNull()) - { - strupr(this->m_ptData); - } - - // Post-validation. - this->verifySentinal(); - } - - ////////////////////////////////////////////////////////////////////////// - // Reverse - // - // Reverses the characters in the array. - ////////////////////////////////////////////////////////////////////////// - void reverse() - { - // Pre-validation. - this->verifySentinal(); - - if(!this->isNull()) - { - strrev( this->m_ptData ); - } - - // Post-validation. - this->verifySentinal(); - } - - ////////////////////////////////////////////////////////////////////////// - // StrLen - // - // Return the length of the string. - ////////////////////////////////////////////////////////////////////////// - size_t strLen() const - { - size_t stRetVal = 0; - - // Pre-validation. - this->verifySentinal(); - this->verifyNotNull(); - - // Delegate to CEcmCtr. - stRetVal = ::strlen(this->m_ptData); - - // Post-validation. - this->verifyLength(static_cast(stRetVal)); - - return stRetVal; - } - - ////////////////////////////////////////////////////////////////////////// - // StrCpy - // - // Make a copy of the string into the buffer. - ////////////////////////////////////////////////////////////////////////// - TCharAdapter & strCpy(const char * cpszSource) - { - // Pre-validation. - this->verifySentinal(); - this->verifyNotNull(); - - // Get the length of the source string. - uint32 dwSourceLength = ::strlen(cpszSource); - - // Make sure the string will fit if we copy it. - this->verifyLength(dwSourceLength); - - // Copy the string into the buffer. - ::strcpy(this->m_ptData, cpszSource); - - // Post-validation. - this->verifySentinal(); - - return (*this); - } - - ////////////////////////////////////////////////////////////////////////// - // StrnCpy - // - // Make a copy of the string into the buffer upto culCount characters. - ////////////////////////////////////////////////////////////////////////// - TCharAdapter & strnCpy(const char * cpszSource, const uint32 culCount) - { - // Pre-validation. - this->verifySentinal(); - this->verifyNotNull(); - - // Make sure the string will fit if we copy it. - this->verifyLength(culCount); - - // Copy the string into the buffer. - ::strncpy(this->m_ptData, cpszSource, culCount); - - // Post-validation. - this->verifySentinal(); - - return (*this); - } - - ////////////////////////////////////////////////////////////////////////// - // StrStr - // - // Find the substring cpszSubString in the array. Returns the pointer to - // the first occurance of the substring in the array or NULL if the - // substring is not found. - ////////////////////////////////////////////////////////////////////////// - const char * strStr(const char * cpszSubString) const - { - const char * cpszRetVal = NULL; - - // Pre-validation. - this->verifySentinal(); - this->verifyNotNull(); - - // Find the substring. - cpszRetVal = ::strstr(this->m_ptData, cpszSubString); - - // Post-validation. - this->verifySentinal(); - - return cpszRetVal; - } - - ////////////////////////////////////////////////////////////////////////// - // StrCmp - // - // Compare the cpszString to this array. - ////////////////////////////////////////////////////////////////////////// - int32 strCmp(const char * cpszString) const - { - int32 iRetVal = 0; - - // Pre-validation. - this->verifySentinal(); - this->verifyNotNull(); - - // Compare the strings. - iRetVal = ::strcmp(this->m_ptData, cpszString); - - return iRetVal; - } - - ////////////////////////////////////////////////////////////////////////// - // StriCmp - // - // Compare the cpszString to this array (case insensitive). - ////////////////////////////////////////////////////////////////////////// - int32 striCmp(const char * cpszString) const - { - int32 iRetVal = 0; - - // Pre-validation. - this->verifySentinal(); - this->verifyNotNull(); - - // Compare the strings. - iRetVal = stricmp(this->m_ptData, cpszString); - - return iRetVal; - } - - ////////////////////////////////////////////////////////////////////////// - // StrnCmp - // - // Compare the cpszString to this array up to culCount characters. - ////////////////////////////////////////////////////////////////////////// - int32 strnCmp(const char * cpszString, const uint32 culCount) const - { - int32 iRetVal = 0; - - // Pre-validation. - this->erifySentinal(); - this->verifyNotNull(); - - // Make sure the comparison can take place with in our array bounds. - this->verifyLength(culCount); - - // Compare the strings. - iRetVal = strncmp(this->m_ptData, cpszString, culCount); - - return iRetVal; - } - - ////////////////////////////////////////////////////////////////////////// - // StrChr - // - // Find the first occurrence of the specified character in the string. - ////////////////////////////////////////////////////////////////////////// - const char * strChr(char cCharacter) const - { - const char * cpszRetVal = 0; - - // Pre-validation. - this->erifySentinal(); - this->verifyNotNull(); - - // Compare the strings. - cpszRetVal = ::strchr(this->m_ptData, cCharacter); - - return cpszRetVal; - } - -private: - void wideToMultiByte(const wchar_t* cpwszSource) - { - // Calculate the length of the source. - const uint32 cdwSourceLen = cpwszSource ? ::wcslen( cpwszSource ) : 0; - - // Convert the wide strings to multibyte. - if( cdwSourceLen > 0 ) - { - // This appears to be allocating twice as much memory as is needed, but - // this is the way W2A is implemented and W2A seems to convert some - // strings that will not convert where the destination is the same - // length (in characters) as the source. - this->allocateElements( cdwSourceLen * sizeof( wchar_t ) ); - - int32 iRet; -#ifdef WIN32 - iRet = ::WideCharToMultiByte( - CP_ACP, - 0, - cpwszSource, - -1, - GetNonConstPtr(), - GetLength(), - NULL, - NULL ); -#else - iRet = ::wcstombs( this->getNonConstPtr(), - cpwszSource, - this->getByteCount() ); - // wcstombs returns -1 for error or the length - // not including the NULL, so we must increment - // to match the windows version - iRet++; -#endif - - if( 0 == iRet ) - { - this->freeArray(); - } - else - { - // - // Must ReAllocate in order to have the proper char length - // The char array was allocated based on wchar_t - // - // no need to include the NULL terminator - // returned by WideCharToMultiByte() - // - this->rellocateElements( iRet - 1 ); - } - } - else if( cpwszSource != NULL ) - { - // This chunk of code is important. If the source - // string is empty, return an empty string, not - // a NULL pointer! - this->allocateElements(0); - } - - // Verify array. - this->verifySentinal(); - } - -private: - TCharAdapter(const TCharAdapter & crRhs); - TCharAdapter & operator=(const TCharAdapter & crRhs); -}; - -} - -#endif // _TCharAdapter_H_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Memory/DynamicArray/TDynamicArray.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Memory/DynamicArray/TDynamicArray.h deleted file mode 100644 index 941db14c9..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Memory/DynamicArray/TDynamicArray.h +++ /dev/null @@ -1,1092 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// Author: Greg Burk -// -// Purpose: This template provides a way to create an array that has -// certain safety features that help solve some of the problems -// often created by arrays in C++. You can create an array of -// any type. The safety features of this class include array -// bounds checking (indexes out of range), automatic -// initialization, and automatic destruction. It also provides -// some features to check the integrity of the array. This is -// especially useful when you get and pass the raw pointer to -// the array into a third party function (i.e. Windows API). -// -// The ${TDynamicArray::verify()} function is used for this -// purpose. It does two primary things: -// -// 1) When the array is allocated, some extra space is allocated -// for some sentinel bytes. These bytes are checked to make -// sure they are still intact when verify() is called. -// -// 2) When the array is allocated, the address of the memory -// that was allocated is stored and is XORed with a known -// bit pattern and the result is also stored. When verify() -// is called, this pattern is XORed again with the address -// and the result should be the original pattern. -// -// If either of the above checks fails, an exception is thrown. -// The primary weakness of this strategy is that the call to -// verify() is left up to the user. If the raw pointer is passed -// and something gets messed up, if verify() was not called, the -// problem won't be discovered until the next time a function -// that calls verify() (most do) is called. This will cause us -// to loose the context in which the problem occurred. -// -// Created: Wednesday, August 07, 2002 2:27:39 PM -// -// Copyright (C) 2011-2018 VMware, Inc. All rights reserved. -- VMware Confidential -// -- VMware Confidential -// -////////////////////////////////////////////////////////////////////////////// -#ifndef _TDynamicArray_H_ -#define _TDynamicArray_H_ - -#ifdef WIN32 -#pragma warning( disable : 4244 ) //Disabling unnecessary conversion warning -#endif - -#include -#include "Exception/CCafException.h" - -namespace Caf { - -////////////////////////////////////////////////////////////////////////////// -// Define sentinel bit pattern. -////////////////////////////////////////////////////////////////////////////// -#ifdef __x86_64__ -static const uint64 gs_ulDynamicArraySentinelBitPattern = (0xAAAAAAAAAAAAAAAA); -#else -static const uint32 gs_ulDynamicArraySentinelBitPattern = (0xAAAAAAAA); -#endif -static const uint32 gs_ulDynamicArraySentinelElementCount = (3); - -template -class TDynamicArray { -public: - typedef T Type; - - ////////////////////////////////////////////////////////////////////////// - // Default Constructor - ////////////////////////////////////////////////////////////////////////// - TDynamicArray() : - CAF_CM_INIT("TDynamicArray"), - _sentinelBits(gs_ulDynamicArraySentinelBitPattern), - _isSentinelSet(false), - _elementCount(0), - _elementIndex(0), - _byteCount(0), - _data(NULL) { - // Initialize the sentinel buffers. - ::memset(_sentinelBytes, 0, sizeof(_sentinelBytes)); - } - - ////////////////////////////////////////////////////////////////////////// - // Destructor - ////////////////////////////////////////////////////////////////////////// - virtual ~TDynamicArray() { - CAF_CM_FUNCNAME("~TDynamicArray"); - try { - freeArray(); - } - CAF_CM_CATCH_ALL; - CAF_CM_CLEAREXCEPTION; - } - - ////////////////////////////////////////////////////////////////////////// - // PutDescription - // - // Assign description to object instance. - ////////////////////////////////////////////////////////////////////////// - void putDescription(const char * pszDesc) { - CAF_CM_FUNCNAME_VALIDATE("putDescription"); - CAF_CM_VALIDATE_STRINGPTRA(pszDesc); - _description = pszDesc; - } - - ////////////////////////////////////////////////////////////////////////// - // GetPtr - // - // Get const pointer to internal data - ////////////////////////////////////////////////////////////////////////// - const T * getPtr() const { - // Pre-validation. - verifySentinel(); - - // Get pointer. - const T * rc = _data; - - return rc; - } - - ////////////////////////////////////////////////////////////////////////// - // GetNonConstPtr - // - // Get non-const pointer to internal data. This function should be used - // only when you must get a pointer that is to be written to, and you - // should always call the ${TDynamicArray::verify()} function after modifying the data - // pointed to by this pointer or passing the pointer to a function that - // modifies the data pointed to by this pointer. - ////////////////////////////////////////////////////////////////////////// - T * getNonConstPtr() { - // Pre-validation. - verifySentinel(); - - // Get pointer. - T * rc = _data; - - return rc; - } - - ////////////////////////////////////////////////////////////////////////// - // const Conversion Operator - ////////////////////////////////////////////////////////////////////////// - operator const T *() const { - // Pre-validation. - verifySentinel(); - - // Get pointer. - const T * rc = _data; - - return rc; - } - - ////////////////////////////////////////////////////////////////////////// - // GetPtrAt - // - // Returns a const pointer to the internal array at a given index - ////////////////////////////////////////////////////////////////////////// - const T * getPtrAt(const uint32 elementIndex) const { - // Pre-validation. - verifyNotNull(); - verifySentinel(); - verifyElementCount(elementIndex); - - // Get the pointer at the index specified. - const T * rc = &_data[elementIndex]; - - return rc; - } - - ////////////////////////////////////////////////////////////////////////// - // GetNonConstPtrAt - // - // Returns a non-const pointer to the internal array at a given index. - // This function should be used only when you must get a pointer that is - // to be written to, and you should always call the ${TDynamicArray::verify()} - // function after modifying the data pointed to by this pointer or passing - // the pointer to a function that modifies the data pointed to by this - // pointer. - ////////////////////////////////////////////////////////////////////////// - T * getNonConstPtrAt(const uint32 elementIndex) { - // Pre-validation. - verifyNotNull(); - verifySentinel(); - verifyElementCount(elementIndex); - - // Get the pointer at the index specified. - T * rc = &_data[elementIndex]; - - return rc; - } - - ////////////////////////////////////////////////////////////////////////// - // GetAt - // - // Returns the array element at a given index - ////////////////////////////////////////////////////////////////////////// - T getAt(const uint32 elementIndex) const { - // Pre-validation. - verifyNotNull(); - verifySentinel(); - verifyElementCount(elementIndex); - - // Get the pointer at the index specified. - T tRetVal = _data[elementIndex]; - - return tRetVal; - } - - ////////////////////////////////////////////////////////////////////////// - // getPtrAtCurrentPos - // - // Returns a const pointer to the internal array at the current position. - ////////////////////////////////////////////////////////////////////////// - const T * getPtrAtCurrentPos() const { - return getPtrAt(_elementIndex); - } - - ////////////////////////////////////////////////////////////////////////// - // getNonConstPtrAtCurrentPos - // - // Returns a non-const pointer to the internal array at the current position. - // This function should be used only when you must get a pointer that is - // to be written to, and you should always call the ${TDynamicArray::verify()} - // function after modifying the data pointed to by this pointer or passing - // the pointer to a function that modifies the data pointed to by this - // pointer. - ////////////////////////////////////////////////////////////////////////// - T * getNonConstPtrAtCurrentPos() { - return getNonConstPtrAt(_elementIndex); - } - - ////////////////////////////////////////////////////////////////////////// - // GetAtCurrentPos - // - // Returns the array element at the current position - ////////////////////////////////////////////////////////////////////////// - T getAtCurrentPos() const { - return getAt(_elementIndex); - } - - ////////////////////////////////////////////////////////////////////////// - // SetAt - // - // Sets the array element at a given index - ////////////////////////////////////////////////////////////////////////// - void setAt( - const uint32 elementIndex, - const T value) { - // Pre-validation. - verifyNotNull(); - verifySentinel(); - verifyElementCount(elementIndex); - - // Set the pointer at the index specified. - _data[elementIndex] = value; - } - - ////////////////////////////////////////////////////////////////////////// - // getElementCount - // - // Returns the number of array elements. - ////////////////////////////////////////////////////////////////////////// - uint32 getElementCount() const { - return _elementCount; - } - - ////////////////////////////////////////////////////////////////////////// - // getByteCount - // - // Returns the size of the array in bytes. - ////////////////////////////////////////////////////////////////////////// - uint32 getByteCount() const { - return _byteCount; - } - - ////////////////////////////////////////////////////////////////////////// - // getByteCountSize - // - // Returns the size of the array in bytes. - ////////////////////////////////////////////////////////////////////////// - size_t getByteCountSize() const { - return static_cast(_byteCount); - } - - ////////////////////////////////////////////////////////////////////////// - // IsNull - // - // Returns true if the pointer to the internal array is null or false if - // the array is not null - ////////////////////////////////////////////////////////////////////////// - bool isNull() const { - return ((NULL == _data) ? true : false); - } - - ////////////////////////////////////////////////////////////////////////// - // verify - // - // Verifies that the array is still properly bound and in good shape. - ////////////////////////////////////////////////////////////////////////// - void verify() const { - // verify. - verifySentinel(); - } - - ////////////////////////////////////////////////////////////////////////// - // Allocate - // - // Allocates a new array on the heap (elementCount = number of elements) - ////////////////////////////////////////////////////////////////////////// - TDynamicArray & allocateElements(const uint32 elementCount) { - // Free the previous array if it exists. - freeArray(); - - // Call internal allocation function to actually allocate the - // array buffer. - internalAllocate(elementCount); - - return (*this); - } - - ////////////////////////////////////////////////////////////////////////// - // AllocateBytes - // - // Allocates a new array on the heap. - ////////////////////////////////////////////////////////////////////////// - TDynamicArray & allocateBytes(const size_t byteCount) { - return allocateBytes(static_cast(byteCount)); - } - - ////////////////////////////////////////////////////////////////////////// - // AllocateBytes - // - // Allocates a new array on the heap. - ////////////////////////////////////////////////////////////////////////// - TDynamicArray & allocateBytes(const uint32 byteCount) { - // Calculate actual number of array elements to allocate based on - // the byte length. - const uint32 elementCount = byteCountToElementCount(byteCount); - - // Delegate to Allocate(). - allocateElements(elementCount); - - return (*this); - } - - ////////////////////////////////////////////////////////////////////////// - // ReAllocate - // - // Reallocates a array on the heap, keeping original contents. - // culLength = number of elements - ////////////////////////////////////////////////////////////////////////// - TDynamicArray & reallocateElements(const uint32 elementCount) { - CAF_CM_FUNCNAME("reallocateElements"); - - // Declare variables to hold copy of original information. - uint32 origElementIndex = 0; - uint32 origByteCount = 0; - T * origData = NULL; - - try { - // Pre-validation. - verifySentinel(); - - // Create a temporary copy of the original buffer and length. - origElementIndex = _elementIndex; - origByteCount = _byteCount; - origData = _data; - - // Reset the data pointer, length, and byte length. - _data = NULL; - _elementCount = 0; - _elementIndex = 0; - _byteCount = 0; - - // Reset the sentinel set flag. - _isSentinelSet = false; - - // Call internal allocation function to actually allocate the - // array buffer. - internalAllocate(elementCount); - - // Copy the original into the new if it exists. - if((origData != NULL) && (origByteCount > 0)) { - // Calculate the number of bytes to copy. - const uint32 bytesToCopy = - (_byteCount < origByteCount) ? _byteCount : origByteCount; - - // Copy the bytes. - ::memcpy(_data, origData, bytesToCopy); - - const uint32 elementsToCopy = byteCountToElementCount(bytesToCopy); - _elementIndex = - (elementsToCopy < origElementIndex) ? elementsToCopy : origElementIndex; - } - - // verify the sentinel bytes. - verifySentinel(); - } - CAF_CM_CATCH_ALL; - - // Delete the original buffer if non-null. - if (origData) { - Allocator::freeMemory(origData); - } - - CAF_CM_THROWEXCEPTION; - - return (*this); - } - - ////////////////////////////////////////////////////////////////////////// - // Grow - // - // Increases the size of the array by the length - // (number of elements) supplied - ////////////////////////////////////////////////////////////////////////// - TDynamicArray & grow(const uint32 elementCount) { - reallocateElements(_elementCount + elementCount); - - return (*this); - } - - ////////////////////////////////////////////////////////////////////////// - // ReAllocateBytes - // - // Reallocates a array on the heap, keeping original contents. - ////////////////////////////////////////////////////////////////////////// - TDynamicArray & reallocateBytes(const size_t byteCount) { - return reallocateBytes(static_cast(byteCount)); - } - - ////////////////////////////////////////////////////////////////////////// - // ReAllocateBytes - // - // Reallocates a array on the heap, keeping original contents. - ////////////////////////////////////////////////////////////////////////// - TDynamicArray & reallocateBytes(const uint32 byteCount) { - // Calculate actual number of array elements to allocate based - // on the byte length. - const uint32 elementCount = byteCountToElementCount(byteCount); - - // Delegate to ReAllocate() function. - reallocateElements(elementCount); - - return (*this); - } - - ////////////////////////////////////////////////////////////////////////// - // Free - // - // Frees the memory for the array. - ////////////////////////////////////////////////////////////////////////// - void freeArray() { - // Free the buffer if it exists. - if (_data) { - verifySentinel(); - - // Zeroize the buffer for cryptographic purposes - ::memset(_data, 0, _byteCount); - - Allocator::freeMemory(_data); - _data = NULL; - - // Reset to initial value. - _sentinelBits = gs_ulDynamicArraySentinelBitPattern; - } - - // Reset the length and byte length. - _elementCount = 0; - _elementIndex = 0; - _byteCount = 0; - - // Reset the sentinel set flag. - _isSentinelSet = false; - } - - ////////////////////////////////////////////////////////////////////////// - // ArrayCpy - // - // Copies the array entries from crArray into this array. - ////////////////////////////////////////////////////////////////////////// - void arrayCpy(const TDynamicArray & crArray) { - // Make sure reference is not to this. - if (this != &crArray) { - // Pre-validation. - verifyNotNull(); - verifyByteCount(crArray.getByteCount()); - verifySentinel(); - crArray.verifySentinel(); - - // Reinitialize this array. - memSet(); - - // Copy the array. - memcpy(_data, crArray.getPtr(), crArray.getByteCount()); - - // Post-validation. - verifySentinel(); - } - } - - ////////////////////////////////////////////////////////////////////////// - // ArrayCmp - // - // Compare this array with crArray. Compares the entire array, so arrays - // must be equal size to evaluate to equal. - ////////////////////////////////////////////////////////////////////////// - int32 arrayCmp(const TDynamicArray & crArray) const { - int32 iRetVal = 0; - - // Make sure reference is not to this. - if (this != &crArray) { - // Pre-validation. - verifySentinel(); - crArray.verifySentinel(); - - // Make sure the arrays are the same length. - if ((_data == NULL) && (crArray._data == NULL)) { - iRetVal = 0; - } else if (getByteCount() == crArray.getByteCount()) { - // Compare the array. - iRetVal = ::memcmp(_data, crArray.getPtr(), getByteCount()); - } else { - iRetVal = (getByteCount() > crArray.getByteCount()) ? 1 : -1; - } - - // Post-validation. - verifySentinel(); - } - - return iRetVal; - } - - ////////////////////////////////////////////////////////////////////////// - // ArrayPrepend - // - // Prepend this array with the provided array. This call will grow the - // array by the size of the provided array. - ////////////////////////////////////////////////////////////////////////// - void arrayPrepend(const TDynamicArray & crArray) { - CAF_CM_FUNCNAME("arrayPrepend"); - - // Declare variables to hold copy of original information. - uint32 origByteCount = 0; - uint32 origElementCount = 0; - T * origData = NULL; - - try { - // Pre-validation. - verifySentinel(); - - // Create a temporary copy of the original buffer and length. - origData = _data; - origByteCount = _byteCount; - origElementCount = _elementCount; - - // Reset the data pointer, length, and byte length. - _data = NULL; - _elementCount = 0; - _elementIndex = 0; - _byteCount = 0; - - // Reset the sentinel set flag. - _isSentinelSet = false; - - // Call internal allocation function to actually allocate the - // array buffer. - internalAllocate(origElementCount + crArray.getElementCount()); - - // Get an intermediate pointer to the internal buffer. - T * tempData = _data; - - // Copy the provided data into the new buffer if it exists. - if((crArray.getPtr() != NULL) && (crArray.getByteCount() > 0)) { - // Copy the bytes. - ::memcpy(tempData, crArray.getPtr(), crArray.getByteCount()); - - // Advance the pointer to the end of the data just copied. - tempData += crArray.getElementCount(); - } - - // Copy the original into the new if it exists. - if((origData != NULL) && (origByteCount > 0)) { - // Copy the bytes. - ::memcpy(tempData, origData, origByteCount); - } - - // verify the sentinel bytes. - verifySentinel(); - } - CAF_CM_CATCH_ALL; - - // Delete the original buffer if non-null. - if (origData) { - Allocator::freeMemory(origData); - } - - CAF_CM_THROWEXCEPTION; - } - - ////////////////////////////////////////////////////////////////////////// - // ArrayAppend - // - // Append this array with the provided array. This call will grow the - // array by the size of the provided array. - ////////////////////////////////////////////////////////////////////////// - void arrayAppend(const TDynamicArray & crArray) { - CAF_CM_FUNCNAME("arrayAppend"); - - // Declare variables to hold copy of original information. - uint32 origByteCount = 0; - uint32 origElementCount = 0; - uint32 origElementIndex = 0; - T * origData = NULL; - - try { - // Pre-validation. - verifySentinel(); - - // Create a temporary copy of the original buffer and length. - origData = _data; - origByteCount = _byteCount; - origElementCount = _elementCount; - origElementIndex = _elementIndex; - - // Reset the data pointer, length, and byte length. - _data = NULL; - _elementCount = 0; - _elementIndex = 0; - _byteCount = 0; - - // Reset the sentinel set flag. - _isSentinelSet = false; - - // Call internal allocation function to actually allocate the - // array buffer. - internalAllocate(origElementCount + crArray.getElementCount()); - - // Get an intermediate pointer to the internal buffer. - T * tempData = _data; - - // Copy the original into the new if it exists. - if((origData != NULL) && (origByteCount > 0)) - { - // Copy the bytes. - ::memcpy(tempData, origData, origByteCount); - - // Advance the pointer to the end of the data just copied. - tempData += origElementCount; - } - - // Copy the provided data into the new buffer if it exists. - if((crArray.getPtr() != NULL) && (crArray.getByteCount() > 0)) { - // Copy the bytes. - ::memcpy(tempData, crArray.getPtr(), crArray.getByteCount()); - } - - _elementIndex = origElementIndex; - - // verify the sentinel bytes. - verifySentinel(); - } - CAF_CM_CATCH_ALL; - - // Delete the original buffer if non-null. - if (origData) { - Allocator::freeMemory(origData); - } - } - - ////////////////////////////////////////////////////////////////////////// - // MemSet - // - // Initializes the array by filling it with the fillValue. - ////////////////////////////////////////////////////////////////////////// - void memSet(const byte fillValue = 0) { - // Pre-validation. - verifyNotNull(); - verifySentinel(); - - // Initialize the buffer. - ::memset(_data, fillValue, _byteCount); - _elementIndex = 0; - - // Post-validation. - verifySentinel(); - } - - ////////////////////////////////////////////////////////////////////////// - // MemCpy - // - // Copy the memory from sourceData into this array up to byteCount bytes. - ////////////////////////////////////////////////////////////////////////// - void memCpy( - const void * sourceData, - const size_t byteCount) { - memCpy(sourceData, static_cast(byteCount)); - } - - ////////////////////////////////////////////////////////////////////////// - // MemCpy - // - // Copy the memory from sourceData into this array up to byteCount bytes. - ////////////////////////////////////////////////////////////////////////// - void memCpy( - const void * sourceData, - const uint32 byteCount) { - // Pre-validation. - verifyNotNull(); - verifySentinel(); - - // Make sure the data will fit if we copy it. - verifyByteCount(byteCount); - - // Copy the data. - ::memcpy(_data, sourceData, byteCount); - _elementIndex = 0; - - // Post-validation. - verifySentinel(); - } - - ////////////////////////////////////////////////////////////////////////// - // MemAppend - // - // Append the memory from sourceData into this array up to byteCount bytes. - ////////////////////////////////////////////////////////////////////////// - void memAppend( - const void * sourceData, - const size_t byteCount) { - memAppend(sourceData, static_cast(byteCount)); - } - - ////////////////////////////////////////////////////////////////////////// - // MemAppend - // - // Append the memory from sourceData into this array up to byteCount bytes. - ////////////////////////////////////////////////////////////////////////// - void memAppend( - const void * sourceData, - const uint32 byteCount) { - // Pre-validation. - verifyNotNull(); - verifySentinel(); - - // Make sure the data will fit if we copy it. - const uint32 startingByteCount = elementCountToByteCount(_elementIndex); - verifyByteCount(startingByteCount + byteCount); - - // Copy the data. - ::memcpy(_data + _elementIndex, sourceData, byteCount); - _elementIndex += byteCountToElementCount(byteCount); - - // Post-validation. - verifySentinel(); - } - - ////////////////////////////////////////////////////////////////////////// - // MemCmp - // - // Compare the memory from sourceData with this array up to byteCount bytes. - ////////////////////////////////////////////////////////////////////////// - int32 memCmp( - const void * sourceData, - const size_t byteCount) { - return memCmp(sourceData, static_cast(byteCount)); - } - - ////////////////////////////////////////////////////////////////////////// - // MemCmp - // - // Compare the memory from sourceData with this array up to byteCount bytes. - ////////////////////////////////////////////////////////////////////////// - int32 memCmp( - const void * sourceData, - const uint32 byteCount) const { - CAF_CM_FUNCNAME_VALIDATE("memCmp"); - CAF_CM_VALIDATE_PTR(sourceData); - CAF_CM_VALIDATE_POSITIVE(byteCount); - - // Pre-validation. - verifySentinel(); - - // Make sure the comparison can take place within our array bounds. - verifyByteCount(byteCount); - - // Do comparison. - int32 iRetVal = 0; - if ((_data == NULL) && (sourceData == NULL)) { - iRetVal = 0; - } else { - iRetVal = ::memcmp(_data, sourceData, byteCount); - } - - // Post-validation. - verifySentinel(); - - return iRetVal; - } - - ////////////////////////////////////////////////////////////////////////// - // MemiCmp - // - // Compare the memory from sourceData with this array up to byteCount bytes - // (case insensitive). - ////////////////////////////////////////////////////////////////////////// - int32 memiCmp( - const void * sourceData, - const size_t byteCount) { - return memiCmp(sourceData, static_cast(byteCount)); - } - - ////////////////////////////////////////////////////////////////////////// - // MemiCmp - // - // Compare the memory from sourceData with this array up to byteCount bytes - // (case insensitive). - ////////////////////////////////////////////////////////////////////////// - int32 memiCmp( - const void * sourceData, - const uint32 byteCount) const { - CAF_CM_FUNCNAME_VALIDATE("memiCmp"); - CAF_CM_VALIDATE_PTR(sourceData); - CAF_CM_VALIDATE_POSITIVE(byteCount); - - // Pre-validation. - verifySentinel(); - - // Make sure the comparison can take place within our array bounds. - verifyByteCount(byteCount); - - // Do comparison. - int32 iRetVal = 0; - if ((_data == NULL) && (sourceData == NULL)) { - iRetVal = 0; - } else { - iRetVal = memicmp(_data, sourceData, byteCount); - } - - // Post-validation. - verifySentinel(); - - return iRetVal; - } - - ////////////////////////////////////////////////////////////////////////// - // incrementElementIndex - // - // Increments the current position of the index into the buffer. - ////////////////////////////////////////////////////////////////////////// - void incrementCurrentPos(const uint32 elementCount) { - CAF_CM_FUNCNAME("incrementCurrentPos"); - - if ((_elementIndex + elementCount) > _elementCount) { - CAF_CM_EXCEPTION_VA3(ERROR_INSUFFICIENT_BUFFER, - "Current position is longer than the total size for '%s' - currentPos: %d, totalLen: %d", - _description.c_str(), _elementIndex + elementCount, _elementCount); - } - - _elementIndex += elementCount; - } - - ////////////////////////////////////////////////////////////////////////// - // resetElementIndex - // - // Resets the current position of the index into the buffer. - ////////////////////////////////////////////////////////////////////////// - void resetCurrentPos() { - _elementIndex = 0; - } - - ////////////////////////////////////////////////////////////////////////// - // getByteCountFromCurrentPos - // - // Returns the size of the array in bytes from the current position. - ////////////////////////////////////////////////////////////////////////// - uint32 getByteCountFromCurrentPos() const { - const uint32 byteIndex = elementCountToByteCount(_elementIndex); - return (_byteCount - byteIndex); - } - -private: - ////////////////////////////////////////////////////////////////////////// - // internalAllocate (Private) - // - // Set the sentinel bytes at the end of the array. - ////////////////////////////////////////////////////////////////////////// - void internalAllocate(const uint32 elementCount) { - CAF_CM_FUNCNAME("internalAllocate"); - - // This function assumes the calling function has freed any pre- - // existing array. - CAF_CM_VALIDATE_NULLPTR(_data); - CAF_CM_VALIDATE_ZERO(_elementCount); - CAF_CM_VALIDATE_ZERO(_byteCount); - - // Allocate the new buffer. This buffer is - _data = static_cast(Allocator::allocMemory( - sizeof(T) * (elementCount + gs_ulDynamicArraySentinelElementCount))); - - // verify that the allocation succeeded. - if (!_data) { - CAF_CM_EXCEPTION_VA1(ERROR_OUTOFMEMORY, "Array allocation failed for '%s'", - _description.c_str()); - } - - // Set sentinel bits -#ifdef __x86_64__ - _sentinelBits = reinterpret_cast(_data) - ^ gs_ulDynamicArraySentinelBitPattern; -#else - _sentinelBits = reinterpret_cast(_data) ^ gs_ulDynamicArraySentinelBitPattern; -#endif - - // Initialize the new buffer. - ::memset(_data, 0, - ((elementCount + gs_ulDynamicArraySentinelElementCount) * sizeof(T))); - - // Set the length and byte length. - _elementCount = elementCount; - _elementIndex = 0; - _byteCount = elementCountToByteCount(elementCount); - - // Set the sentinel bytes. - setSentinel(); - - // verify the sentinel bytes. - verifySentinel(); - } - - ////////////////////////////////////////////////////////////////////////// - // SetSentinel (Private) - // - // Set the sentinel bytes at the end of the array. - ////////////////////////////////////////////////////////////////////////// - void setSentinel() { - // Set the sentinel characters. - for (uint32 ulIndex = 0; ulIndex < (2 * sizeof(T)); ++ulIndex) { - // Set the sentinel bytes at the end of the array. - reinterpret_cast(_data)[(_byteCount + ulIndex + sizeof(T))] = - ((ulIndex % 2) == 0) ? 0xFF : 0xDD; - - // Make a copy of the sentinel bytes for later comparison. - _sentinelBytes[ulIndex + sizeof(T)] = ((ulIndex % 2) == 0) ? 0xFF : 0xDD; - } - - // Set the flag indicating the sentinel is set. - _isSentinelSet = true; - } - - ////////////////////////////////////////////////////////////////////////// - // verifyByteCount (Private) - // - // Verifies that the byte length supplied is not longer than the array - // byte length. - ////////////////////////////////////////////////////////////////////////// - void verifyByteCount(const uint32 byteCount) const { - CAF_CM_FUNCNAME("verifyByteCount"); - - if (byteCount > _byteCount) { - CAF_CM_EXCEPTION_VA3(ERROR_INVALID_INDEX, "The byte length specified [%d] " - "exceeds the array length [%d] for '%s'", byteCount, _byteCount, - _description.c_str()); - } - } - - ////////////////////////////////////////////////////////////////////////// - // verifyElementCount (Private) - // - // Verifies that the index supplied does not go past end of the array. - ////////////////////////////////////////////////////////////////////////// - void verifyElementCount(const uint32 elementCount) const { - CAF_CM_FUNCNAME("verifyElementCount"); - - if (elementCount >= _elementCount) { - CAF_CM_EXCEPTION_VA3(ERROR_INVALID_INDEX, "The index specified [%d] is " - "beyond the array bounds [%d] for '%s'", elementCount, (_elementCount - 1), - _description.c_str()); - } - } - - uint32 byteCountToElementCount(const uint32 byteCount) const { - uint32 rc = 0; - if (byteCount > 0) { - rc = (byteCount / sizeof(T)) + (byteCount % sizeof(T)); - } - - return rc; - } - - uint32 elementCountToByteCount(const uint32 elementCount) const { - return (elementCount * sizeof(T)); - } - -protected: - ////////////////////////////////////////////////////////////////////////// - // verifySentinel (Private) - // - // Verifies that the sentinel bytes are still intact. - ////////////////////////////////////////////////////////////////////////// - void verifySentinel() const { - CAF_CM_FUNCNAME("verifySentinel"); - - if (_isSentinelSet) { -#ifdef __x86_64__ - if ((_sentinelBits ^ reinterpret_cast(_data)) - != gs_ulDynamicArraySentinelBitPattern) -#else - if ((_sentinelBits ^ reinterpret_cast(_data)) != - gs_ulDynamicArraySentinelBitPattern) -#endif - { - CAF_CM_EXCEPTION_VA1(ERROR_INVALID_DATA, - "The sentinel BITS for array '%s' are no longer valid.", - _description.c_str()); - } else if (::memcmp(_sentinelBytes, - (reinterpret_cast(_data) + _byteCount), - sizeof(_sentinelBytes)) != 0) { - CAF_CM_EXCEPTION_VA1(ERROR_INVALID_DATA, - "The sential BYTES for array '%s' are no longer valid.", - _description.c_str()); - } - } else if (_sentinelBits != gs_ulDynamicArraySentinelBitPattern) { - CAF_CM_EXCEPTION_VA1(ERROR_INVALID_DATA, - "The sential BITS for array '%s' are no longer valid.", _description.c_str()); - } - } - - ////////////////////////////////////////////////////////////////////////// - // verifyNotNull (Private) - // - // Verifies that the data pointer is not null. - ////////////////////////////////////////////////////////////////////////// - void verifyNotNull() const { - CAF_CM_FUNCNAME("verifyNotNull"); - - if (NULL == _data) { - CAF_CM_EXCEPTION_VA1(E_POINTER, "The pointer to the array is null for '%s'", - _description.c_str()); - } - } - -private: - TDynamicArray(const TDynamicArray & crRhs); - TDynamicArray & operator=(const TDynamicArray & crRhs); - -#ifdef WIN32 - ////////////////////////////////////////////////////////////////////////// - // Operator[] (Private) - // - // We need to provide an implementation to satisfy the VC8 compiler - // even though we never intend this method to be called. - ////////////////////////////////////////////////////////////////////////// - T operator[](size_t) - { - // Yes, this code looks very wrong, however, DO NOT REMOVE it! - // It is here to supply an implementation that doesn't generate - // compiler warnings. This method will never be called. - T* tpRetVal = NULL; - return *tpRetVal; - } -#endif - -private: - CAF_CM_CREATE; - byte _sentinelBytes[gs_ulDynamicArraySentinelElementCount * sizeof(T)]; -#ifdef __x86_64__ - uint64 _sentinelBits; -#else - uint32 _sentinelBits; -#endif - bool _isSentinelSet; - - // NOTE: ...Count are not zero-relative, ...Index are zero-relative. - - // An element is the template type (e.g. wchar_t), so the element count - // is the number of these template types in the array. - uint32 _elementCount; - uint32 _elementIndex; - - // The number of bytes consumed by the array of template types. - uint32 _byteCount; - -protected: - std::string _description; - T * _data; -}; - -} - -#endif // _TDynamicArray_H_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Memory/DynamicArray/TWCharAdapter.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Memory/DynamicArray/TWCharAdapter.h deleted file mode 100644 index 12005adba..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Memory/DynamicArray/TWCharAdapter.h +++ /dev/null @@ -1,370 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// $Workfile: TWCharAdapter.h $ -// -// Author: Greg Burk -// -// Purpose: This template provides an adapter for TDynamicArray (or -// other types of "safe" array classes) that exposes functions -// that are useful when working with an array of type wchar_t. -// -// A typedef of this class is already defined and should be -// used instead of explicitly using this class. The typedef -// is CEcmWCharArray. -// -// Created: Friday, October 18, 2002 1:59:49 PM -// -// Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential -// -- VMware Confidential -// -// Modification History: -// -// $Log: //wpbuild01/PvcsData/ECM_40/archives/ECM_41/WinNT/Source/CommonAgtCol/Cpp/EcmCommonStaticMinDep/TWCharAdapter.h-arc $ -// -// Rev 1.2 17 Sep 2003 09:43:16 Michael.Donahue -// Implemented hooks for new library model -// -// Rev 1.1 16 Jan 2003 11:17:54 Greg.Burk -// Made changes necessary to accomodate new CEcmBasicString class and changes to CEcmString. -// -// Rev 1.0 31 Oct 2002 10:43:08 Greg.Burk -// Initial Revision -// -////////////////////////////////////////////////////////////////////////////// -#ifndef _TWCharAdapter_H_ -#define _TWCharAdapter_H_ - -namespace Caf { - -template -class TWCharAdapter : public T -{ -public: - ////////////////////////////////////////////////////////////////////////// - // Default Constructor - ////////////////////////////////////////////////////////////////////////// - TWCharAdapter() {} - - ////////////////////////////////////////////////////////////////////////// - // Conversion Constructor - ////////////////////////////////////////////////////////////////////////// - TWCharAdapter(const char * rhs) - { - multiByteToWide(rhs); - } - - ////////////////////////////////////////////////////////////////////////// - // Conversion Constructor - ////////////////////////////////////////////////////////////////////////// - TWCharAdapter(const wchar_t * rhs) - { - (*this) = rhs; - } - - ////////////////////////////////////////////////////////////////////////// - // Destructor - ////////////////////////////////////////////////////////////////////////// - ~TWCharAdapter() {} - - ////////////////////////////////////////////////////////////////////////// - // Assignment operator - ////////////////////////////////////////////////////////////////////////// - TWCharAdapter& operator=(const char * rhs) - { - multiByteToWide(rhs); - return *this; - } - - ////////////////////////////////////////////////////////////////////////// - // Assignment operator - ////////////////////////////////////////////////////////////////////////// - TWCharAdapter& operator=(const wchar_t * rhs) - { - const uint32 culLength = ::wcslen(rhs); - - if(culLength > 0) - { - this->allocateElements(culLength); - wcsnCpy(rhs, culLength); - } - return *this; - } - - ////////////////////////////////////////////////////////////////////////////// - // MakeLower() - // - // Converts all of the upper-case characters in this string to lower-case. - ////////////////////////////////////////////////////////////////////////////// - void makeLower() - { - // Pre-validation. - this->verifySentinal(); - - if(!this->isNull()) - { - wcslwr(this->m_ptData); - } - - // Post-validation. - this->verifySentinal(); - } - - ////////////////////////////////////////////////////////////////////////// - // MakeUpper - // - // Converts all of the lower-case characters in this array to upper-case. - ////////////////////////////////////////////////////////////////////////// - void makeUpper() - { - // Pre-validation. - this->verifySentinal(); - - if(!this->isNull()) - { - wcsupr(this->m_ptData); - } - - // Post-validation. - this->verifySentinal(); - } - - ////////////////////////////////////////////////////////////////////////// - // Reverse - // - // Reverses the characters in the array. - ////////////////////////////////////////////////////////////////////////// - void reverse() - { - // Pre-validation. - this->verifySentinal(); - - if(!this->isNull()) - { - wcsrev(this->m_ptData); - } - - // Post-validation. - this->verifySentinal(); - } - - ////////////////////////////////////////////////////////////////////////// - // WcsLen - // - // Return the length of the string. - ////////////////////////////////////////////////////////////////////////// - size_t wcsLen() const - { - size_t stRetVal = 0; - this->verifySentinal(); - this->verifyNotNull(); - stRetVal = ::wcslen(this->m_ptData, this->m_strDesc); - this->verifyLength(static_cast(stRetVal)); - return stRetVal; - } - - ////////////////////////////////////////////////////////////////////////// - // WcsCpy - // - // Make a copy of the string into the buffer. - ////////////////////////////////////////////////////////////////////////// - TWCharAdapter & wcsCpy(const wchar_t * cpwszSource) - { - // Pre-validation. - this->verifySentinal(); - this->verifyNotNull(); - - // Get the length of the source string. - uint32 dwSourceLength = ::wcslen(cpwszSource); - - // Make sure the string will fit if we copy it. - this->verifyLength(dwSourceLength); - - // Copy the string into the buffer. - ::wcscpy(this->m_ptData, cpwszSource); - - // Post-validation. - this->verifySentinal(); - - return (*this); - } - - ////////////////////////////////////////////////////////////////////////// - // WcsnCpy - // - // Make a copy of the string into the buffer upto culCount characters. - ////////////////////////////////////////////////////////////////////////// - TWCharAdapter & wcsnCpy(const wchar_t * cpwszSource, const uint32 culCount) - { - // Pre-validation. - this->verifySentinal(); - this->verifyNotNull(); - - // Make sure the string will fit if we copy it. - this->verifyLength(culCount); - - // Copy the string into the buffer. - ::wcsncpy(this->m_ptData, cpwszSource, culCount); - - // Post-validation. - this->verifySentinal(); - - return (*this); - } - - ////////////////////////////////////////////////////////////////////////// - // WcsStr - // - // Find the substring cpwszSubString in the array. Returns the pointer to - // the first occurance of the substring in the array or NULL if the - // substring is not found. - ////////////////////////////////////////////////////////////////////////// - const wchar_t * wcsStr(const wchar_t * cpwszSubString) const - { - wchar_t * pwszRetVal = NULL; - - // Pre-validation. - this->verifySentinal(); - this->verifyNotNull(); - - // Find the substring. - pwszRetVal = ::wcsstr(this->m_ptData, cpwszSubString); - - // Post-validation. - this->verifySentinal(); - - return pwszRetVal; - } - - ////////////////////////////////////////////////////////////////////////// - // WcsCmp - // - // Compare the cpwszString to this array. - ////////////////////////////////////////////////////////////////////////// - int32 wcsCmp(const wchar_t * cpwszString) const - { - int32 iRetVal = 0; - - // Pre-validation. - this->verifySentinal(); - this->verifyNotNull(); - - // Compare the strings. - iRetVal = ::wcscmp(this->m_ptData, cpwszString); - - return iRetVal; - } - - ////////////////////////////////////////////////////////////////////////// - // WcsiCmp - // - // Compare the cpwszString to this array (case insensitive). - ////////////////////////////////////////////////////////////////////////// - int32 wcsiCmp(const wchar_t * cpwszString) const - { - int32 iRetVal = 0; - - // Pre-validation. - this->verifySentinal(); - this->verifyNotNull(); - - // Compare the strings. - iRetVal = wcsicmp(this->m_ptData, cpwszString); - - return iRetVal; - } - - ////////////////////////////////////////////////////////////////////////// - // WcsnCmp - // - // Compare the cpwszString to this array up to culCount characters. - ////////////////////////////////////////////////////////////////////////// - int32 wcsnCmp(const wchar_t * cpwszString, const uint32 culCount) const - { - int32 iRetVal = 0; - - // Pre-validation. - this->verifySentinal(); - this->verifyNotNull(); - - // Make sure the comparison can take place with in our array bounds. - this->verifyLength(culCount); - - // Compare the strings. - iRetVal = wcsncmp(this->m_ptData, cpwszString, culCount); - - return iRetVal; - } - - ////////////////////////////////////////////////////////////////////////// - // WcsChr - // - // Find the first occurrence of the specified character in the string. - ////////////////////////////////////////////////////////////////////////// - wchar_t * wcsChr(wchar_t wcCharacter) const - { - wchar_t * pwszRetVal = 0; - - // Pre-validation. - this->verifySentinal(); - this->verifyNotNull(); - - // Compare the strings. - pwszRetVal = ::wcschr(this->m_ptData, wcCharacter); - - return pwszRetVal; - } - -private: - void multiByteToWide(const char* cpszSource) - { - // Calculate the length of the source. - const uint32 cdwSourceLen = cpszSource ? ::strlen( cpszSource ) : 0; - - // Convert the multibyte strings to wide. - if( cdwSourceLen > 0 ) - { - this->allocateElements(cdwSourceLen); - int32 iRet; -#ifdef WIN32 - iRet = ::MultiByteToWideChar( - CP_ACP, - 0, - cpszSource, - cdwSourceLen, - GetNonConstPtr(), - GetLength() ); -#else - iRet = ::mbstowcs( this->getNonConstPtr(), cpszSource, cdwSourceLen ); - // mbstowcs returns -1 on error or the number of - // characters without the null terminator, so - // we can increase it by 1 for the null or to 0 for - // the error condition below - if ( 0 != iRet ) - iRet++; -#endif - - if( 0 == iRet ) - { - this->freeArray(); - } - } - else if( cpszSource != NULL ) - { - // This chunk of code is important. If the source - // string is empty, return an empty string, not - // a NULL pointer! - this->allocateElements(0); - } - - // Verify array. - this->verifySentinal(); - } - -private: - TWCharAdapter(const TWCharAdapter & crRhs); - TWCharAdapter & operator=(const TWCharAdapter & crRhs); -}; - -} - -#endif // _TWCharAdapter_H_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/PlatformDefines.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/PlatformDefines.h deleted file mode 100644 index a04edea0a..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/PlatformDefines.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef PLATFORM_DEFINES_H -#define PLATFORM_DEFINES_H - -#ifdef WIN32 - #ifdef _WIN64 - typedef uint64 SUBSYS_INTPTR; - const SUBSYS_INTPTR SUBSYS_INTPTR_INVALID = 0xffffffffffffffff; - #else - typedef uint32 SUBSYS_INTPTR; - const SUBSYS_INTPTR SUBSYS_INTPTR_INVALID = 0xffffffff; - #endif -#else - -#ifdef __x86_64__ -typedef uint64_t SUBSYS_INTPTR; -const SUBSYS_INTPTR SUBSYS_INTPTR_INVALID = 0xffffffffffffffff; -#else -typedef uint32_t SUBSYS_INTPTR; -const SUBSYS_INTPTR SUBSYS_INTPTR_INVALID = 0xffffffff; -#endif -const uint32 DLL_PROCESS_ATTACH = 1; -const uint32 DLL_PROCESS_DETACH = 2; - -#ifndef TRUE -#define TRUE true -#endif - -#ifndef FALSE -#define FALSE false -#endif - -#endif - -#endif // #ifndef PLATFORM_DEFINES_H diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/PlatformErrors.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/PlatformErrors.h deleted file mode 100644 index 0bd974556..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/PlatformErrors.h +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef PLATFORMERRORS_H_ -#define PLATFORMERRORS_H_ - -#ifdef WIN32 - -#include - -#else - -const HRESULT S_OK = 0; -const HRESULT S_FALSE = 1; -const HRESULT E_FAIL = 0x80004005; -const HRESULT E_NOTIMPL = 0x80004001; -const HRESULT E_INVALIDARG = 0x80070057; -const HRESULT E_OUTOFMEMORY = 0x8007000E; -const HRESULT E_POINTER = 0x80004003; -const HRESULT E_NOINTERFACE = 0x80004002; -const HRESULT E_UNEXPECTED = 0x8000FFFF; - -const HRESULT OLE_E_BLANK = 0x80040007; - -const HRESULT ERROR_SUCCESS = 0; -const HRESULT NO_ERROR = 0; -const HRESULT ERROR_INVALID_FUNCTION= 1; -const HRESULT ERROR_FILE_NOT_FOUND = 2; -const HRESULT ERROR_PATH_NOT_FOUND = 3; -const HRESULT ERROR_ACCESS_DENIED = 5; -const HRESULT ERROR_INVALID_HANDLE = 6; -const HRESULT ERROR_INVALID_DATA = 13; -const HRESULT ERROR_OUTOFMEMORY = 14; -const HRESULT ERROR_NOT_SAME_DEVICE= 17; -const HRESULT ERROR_HANDLE_EOF = 38; -const HRESULT ERROR_NOT_SUPPORTED = 50; -const HRESULT ERROR_FILE_EXISTS= 80; -const HRESULT ERROR_INVALID_PARAMETER = 87; -const HRESULT ERROR_BUFFER_OVERFLOW = 111; -const HRESULT ERROR_CALL_NOT_IMPLEMENTED = 120; -const HRESULT ERROR_INSUFFICIENT_BUFFER = 122; -const HRESULT ERROR_BAD_PATHNAME = 161; -const HRESULT ERROR_BUSY = 170; -const HRESULT ERROR_ALREADY_EXISTS= 183; -const HRESULT ERROR_NOT_FOUND = 1168; -const HRESULT ERROR_MORE_DATA = 234; -const HRESULT ERROR_NO_MORE_ITEMS = 259; -const HRESULT ERROR_SHUTDOWN_IN_PROGRESS = 1115; -const HRESULT ERROR_INVALID_INDEX = 1413; -const HRESULT ERROR_INTERNAL_ERROR = 1359; -const HRESULT ERROR_DISCARDED = 157; -const HRESULT ERROR_CLASS_ALREADY_EXISTS = 1410; -const HRESULT ERROR_CLASS_DOES_NOT_EXIST = 1411; -const HRESULT ERROR_TIMEOUT = 1460; -const HRESULT ERROR_UNSUPPORTED_TYPE = 1630; -const HRESULT ERROR_TAG_NOT_FOUND =2012; -const HRESULT ERROR_TAG_NOT_PRESENT =2013; -const HRESULT ERROR_DUPLICATE_TAG =2014; -const HRESULT ERROR_INVALID_STATE = 5023; -const HRESULT ERROR_FILE_READ_ONLY = 6009; -const HRESULT ERROR_REVISION_MISMATCH = 1306; -const HRESULT ERROR_ALREADY_INITIALIZED = 1247; - -const HRESULT DISP_E_BADVARTYPE = 0x80020008; -const HRESULT DISP_E_OVERFLOW = 0x8002000A; -const HRESULT DISP_E_TYPEMISMATCH = 0x80020005; -const HRESULT DISP_E_EXCEPTION = 0x80020009; -const HRESULT DISP_E_PARAMNOTOPTIONAL = 0x8002000F; -const HRESULT DISP_E_UNKNOWNNAME = 0x80020006; -const HRESULT DISP_E_BADPARAMCOUNT = 0x8002000E; -const HRESULT NTE_BAD_LEN = 0x80090004; - -const HRESULT RPC_S_OK = 0; -const HRESULT RPC_S_OUT_OF_MEMORY = ERROR_OUTOFMEMORY; -const HRESULT RPC_S_INVALID_STRING_BINDING = 1700; -const HRESULT RPC_S_WRONG_KIND_OF_BINDING = 1701; -const HRESULT RPC_S_INVALID_BINDING = 1702; -const HRESULT RPC_S_PROTSEQ_NOT_SUPPORTED = 1703; -const HRESULT RPC_S_INVALID_RPC_PROTSEQ = 1704; -const HRESULT RPC_S_INVALID_STRING_UUID = 1705; -const HRESULT RPC_S_INVALID_ENDPOINT_FORMAT = 1706; -const HRESULT RPC_S_INVALID_NET_ADDR = 1707; -const HRESULT RPC_S_NO_ENDPOINT_FOUND = 1708; -const HRESULT RPC_S_INVALID_TIMEOUT = 1709; -const HRESULT RPC_S_OBJECT_NOT_FOUND = 1710; -const HRESULT RPC_S_ALREADY_REGISTERED = 1711; -const HRESULT RPC_S_TYPE_ALREADY_REGISTERED = 1712; -const HRESULT RPC_S_ALREADY_LISTENING = 1713; -const HRESULT RPC_S_NO_PROTSEQS_REGISTERED = 1714; -const HRESULT RPC_S_NOT_LISTENING = 1715; -const HRESULT RPC_S_UNKNOWN_MGR_TYPE = 1716; -const HRESULT RPC_S_UNKNOWN_IF = 1717; -const HRESULT RPC_S_NO_BINDINGS = 1718; -const HRESULT RPC_S_NO_PROTSEQS = 1719; -const HRESULT RPC_S_CANT_CREATE_ENDPOINT = 1720; -const HRESULT RPC_S_OUT_OF_RESOURCES = 1721; -const HRESULT RPC_S_SERVER_UNAVAILABLE = 1722; -const HRESULT RPC_S_SERVER_TOO_BUSY = 1723; -const HRESULT RPC_S_INVALID_NETWORK_OPTIONS = 1724; -const HRESULT RPC_S_NO_CALL_ACTIVE = 1725; -const HRESULT RPC_S_CALL_FAILED = 1726; -const HRESULT RPC_S_CALL_FAILED_DNE = 1727; -const HRESULT RPC_S_PROTOCOL_ERROR = 1728; -const HRESULT RPC_S_UNSUPPORTED_TRANS_SYN = 1730; -const HRESULT RPC_S_UNSUPPORTED_TYPE = 1732; -const HRESULT RPC_S_INVALID_TAG = 1733; -const HRESULT RPC_S_INVALID_BOUND = 1734; -const HRESULT RPC_S_NO_ENTRY_NAME = 1735; -const HRESULT RPC_S_INVALID_NAME_SYNTAX = 1736; -const HRESULT RPC_S_UNSUPPORTED_NAME_SYNTAX = 1737; -const HRESULT RPC_S_UUID_NO_ADDRESS = 1739; -const HRESULT RPC_S_DUPLICATE_ENDPOINT = 1740; -const HRESULT RPC_S_UNKNOWN_AUTHN_TYPE = 1741; -const HRESULT RPC_S_MAX_CALLS_TOO_SMALL = 1742; -const HRESULT RPC_S_STRING_TOO_LONG = 1743; -const HRESULT RPC_S_PROTSEQ_NOT_FOUND = 1744; -const HRESULT RPC_S_PROCNUM_OUT_OF_RANGE = 1745; -const HRESULT RPC_S_BINDING_HAS_NO_AUTH = 1746; -const HRESULT RPC_S_UNKNOWN_AUTHN_SERVICE = 1747; -const HRESULT RPC_S_UNKNOWN_AUTHN_LEVEL = 1748; -const HRESULT RPC_S_INVALID_AUTH_IDENTITY = 1749; -const HRESULT RPC_S_UNKNOWN_AUTHZ_SERVICE = 1750; - -const HRESULT FACILITY_WINDOWS = 8; -const HRESULT FACILITY_URT = 19; -const HRESULT FACILITY_STORAGE = 3; -const HRESULT FACILITY_SSPI = 9; -const HRESULT FACILITY_SCARD = 16; -const HRESULT FACILITY_SETUPAPI = 15; -const HRESULT FACILITY_SECURITY = 9; -const HRESULT FACILITY_RPC = 1; -const HRESULT FACILITY_WIN32 = 7; -const HRESULT FACILITY_CONTROL = 10; -const HRESULT FACILITY_NULL = 0; -const HRESULT FACILITY_MSMQ = 14; -const HRESULT FACILITY_MEDIASERVER = 13; -const HRESULT FACILITY_INTERNET = 12; -const HRESULT FACILITY_ITF = 4; -const HRESULT FACILITY_DISPATCH = 2; -const HRESULT FACILITY_COMPLUS = 17; -const HRESULT FACILITY_CERT = 11; -const HRESULT FACILITY_ACS = 20; -const HRESULT FACILITY_AAF = 18; - -const HRESULT SEVERITY_SUCCESS = 0; -const HRESULT SEVERITY_ERROR = 1; - -#define HRESULT_FROM_WIN32(x) ((HRESULT)(x) <= 0 ? ((HRESULT)(x)) : ((HRESULT) (((x) & 0x0000FFFF) | (FACILITY_WIN32 << 16) | 0x80000000))) - -#define SUCCEEDED(status) ((HRESULT)(status) >= 0) -#define FAILED(status) ((HRESULT)(status) < 0) -#define IS_ERROR(status) ((uint32)(status) >> 31 == SEVERITY_ERROR) - -#define HRESULT_CODE(hr) ((hr) & 0xFFFF) -#define SCODE_CODE(sc) ((sc) & 0xFFFF) - -#define HRESULT_FACILITY(hr) (((hr) >> 16) & 0x1FFF) -#define SCODE_FACILITY(sc) (((sc) >> 16) & 0x1FFF) - -#define HRESULT_SEVERITY(hr) (((hr) >> 31) & 0x1 -#define SCODE_SEVERITY(sc) (((sc) >> 31) & 0x1) - -#define MAKE_HRESULT(sev,fac,code) \ - ((HRESULT) (((uint32)(sev)<<31) | ((uint32)(fac)<<16) | ((uint32)(code))) ) -#define MAKE_SCODE(sev,fac,code) \ - ((HRESULT) (((uint32)(sev)<<31) | ((uint32)(fac)<<16) | ((uint32)(code))) ) - -#endif - -#endif /* PLATFORMERRORS_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/PlatformIID.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/PlatformIID.h deleted file mode 100644 index bbb61537d..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/PlatformIID.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef PLATFORM_IID_H -#define PLATFORM_IID_H - -#ifndef WIN32 - - #include - #include - - struct GUID - { - // this must match the Windows GUID structure - uint32 Data1; // 4 bytes - uint16 Data2; // 2 bytes - uint16 Data3; // 2 bytes - byte Data4[8]; // 8 bytes - }; - - typedef GUID IID, UUID; - - inline bool IsEqualGUID(const GUID& rguid1, const GUID& rguid2) - { - return (!::memcmp(&rguid1,&rguid2,sizeof(GUID))); - } - - #define IsEqualIID(rguid1,rguid2) IsEqualGUID(rguid1,rguid2) - #define IsEqualUUID(rguid1,rguid2) IsEqualGUID(rguid1,rguid2) - - extern HRESULT UuidCreate(UUID* uuid); - -#endif - -namespace BasePlatform { -BASEPLATFORM_LINKAGE std::string UuidToString(const UUID& uuid); -BASEPLATFORM_LINKAGE HRESULT UuidFromString(const char* strGuid, UUID& uuid); - -// This mutex is used to guard the construction of the IIDs in the IIDOF macro -extern BASEPLATFORM_LINKAGE GMutex gs_BaseIIDInitMutex; -} - -#define CAF_DECL_UUID(iid) \ -public: \ -static const IID & IIDOF() \ -{ \ - static IID ms_oIID; \ - static bool m_bIsSet; \ - g_mutex_lock(&BasePlatform::gs_BaseIIDInitMutex); \ - if ( !m_bIsSet ) \ - { \ - BasePlatform::UuidFromString( iid , ms_oIID ); \ - m_bIsSet = true; \ - } \ - g_mutex_unlock(&BasePlatform::gs_BaseIIDInitMutex); \ - return ms_oIID; \ -} - -#define CAF_IIDOF(type_name) type_name::IIDOF() - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/PlatformStringFunc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/PlatformStringFunc.h deleted file mode 100644 index 8ec718843..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/PlatformStringFunc.h +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Author: mdonahue - * Created: Jan 13, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef PLATFORMSTRINGFUNC_H_ -#define PLATFORMSTRINGFUNC_H_ - -namespace BasePlatform { - - //extern std::wstring A2W(const std::string& str); - //extern std::string W2A(const std::wstring& str); -} - -#endif /* PLATFORMSTRINGFUNC_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/PlatformTypes.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/PlatformTypes.h deleted file mode 100644 index 271159954..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/PlatformTypes.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef PLATFORM_TYPES_H -#define PLATFORM_TYPES_H - -#ifdef WIN32 - -#include - -#else -// #include -#include -#include -#if defined (__linux__) || defined (__APPLE__) - #include -#endif - -//typedef int32 RPC_STATUS; - -#define __declspec(value) -#define __stdcall -#define __cdecl -#define APIENTRY - -#define FAR - -typedef void * HINSTANCE; -typedef void * HMODULE; -typedef void * HANDLE; -typedef void * LPVOID; -typedef bool BOOL; -typedef uint8_t byte; -typedef int32_t HRESULT; -#endif - -#endif // PLATFORM_TYPES_H diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/TCafObject.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/TCafObject.h deleted file mode 100644 index a485e30f1..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/TCafObject.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ -#ifndef _TCafObject_h -#define _TCafObject_h - -template -class TCafObject : public Base { -public: - TCafObject() : _refCnt(0) {} - -public: // ICafObect Implementations - void AddRef() { - g_atomic_int_inc(&_refCnt); - } - - void Release() { - if (g_atomic_int_dec_and_test(&_refCnt)) { - delete this; - } - } - - void QueryInterface(const IID&, void**) { - throw std::runtime_error("QueryInterface not supported"); - } - -private: - gint _refCnt; - -private: - TCafObject(const TCafObject&); - TCafObject& operator=(const TCafObject&); -}; - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/TCafQIObject.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/TCafQIObject.h deleted file mode 100644 index 0b220d21a..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/TCafQIObject.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Created: May 25, 2004 - * - * Copyright (C) 2004-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef TCAFQIOBJECT_H_ -#define TCAFQIOBJECT_H_ - -template -class TCafQIObject : public TCafObject -{ -public: - TCafQIObject () - { - } - - virtual ~TCafQIObject () - { - } - -public: - virtual void QueryInterface( const IID& criid, void** ppv ) - { - Base::_InternalQueryInterface( criid, ppv ); - } -}; - -//////////////////////////////////////////////////////////////////////// -// -// QI map -// -//////////////////////////////////////////////////////////////////////// -#define CAF_BEGIN_QI() \ -protected: \ - void _InternalQueryInterface (const IID &criid, void **ppv) \ - { \ - try \ - { \ - if (ppv) \ - { \ - *ppv = NULL; \ - bool bUseFirstInterface = (::IsEqualGUID(criid, CAF_IIDOF(::ICafObject)) != 0); \ - if (0); - -#define CAF_QI_ENTRY(Interface) \ - else if (bUseFirstInterface || ::IsEqualGUID(criid, CAF_IIDOF(Interface))) \ - *ppv = static_cast(this); - -#define CAF_QI_ENTRY2(Interface, IntermediateInterface) \ - else if (bUseFirstInterface || ::IsEqualGUID(criid, CAF_IIDOF(Interface))) \ - *ppv = static_cast(static_cast(this)); - -#define CAF_END_QI() \ - if (*ppv) \ - reinterpret_cast(this)->AddRef(); \ - } \ - } \ - catch (...) \ - { \ - } \ - } - -//////////////////////////////////////////////////////////////////////// -// -// Object Id - required for ISerializableObject -// -//////////////////////////////////////////////////////////////////////// -#define CAF_MAKE_OBJECT_ID(Factory, Class) \ - (std::string(Factory) + std::string(":") + std::string( #Class )) - -#define CAF_DECLARE_OBJECT_ID(Class, Factory) \ - public: \ - virtual std::string GetObjectId () const \ - { \ - return CAF_MAKE_OBJECT_ID(Factory, Class); \ - } - -// Declare a smart pointer to a class that supports QI after the class has been declared -#define CAF_DECLARE_SMART_QI_POINTER(ClassName) \ - typedef TCafSmartPtr > SmartPtr##ClassName; \ - typedef TCafSmartPtr > ConstPtr##ClassName - -// Forward declare a smart pointer to a class that supports QI -#define CAF_DECLARE_CLASS_AND_IMPQI_POINTER(ClassName) \ - class ClassName; \ - CAF_DECLARE_SMART_QI_POINTER(ClassName) - -#endif /* TCAFQIOBJECT_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/TCafSmartPtr.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/TCafSmartPtr.h deleted file mode 100644 index 5bc4bb41f..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/TCafSmartPtr.h +++ /dev/null @@ -1,399 +0,0 @@ -/* - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef _TCafSmartPtr_H -#define _TCafSmartPtr_H - -#ifdef WIN32 -// Disable C4800 - performance warning forcing value to 'true' or 'false' -#pragma warning(disable: 4800) -#endif - -// Forward declarations for Subsystem calls -#ifndef SUBSYSTEMBASE_LINKAGE -#ifdef WIN32 -#ifdef FRAMEWORK_BUILD -#define SUBSYSTEMBASE_LINKAGE __declspec(dllexport) -#else -#define SUBSYSTEMBASE_LINKAGE __declspec(dllimport) -#endif -#else -#define SUBSYSTEMBASE_LINKAGE -#endif -#endif - -namespace Caf { -extern "C" void SUBSYSTEMBASE_LINKAGE CreateObject(const char* cszObjectId, const IID& criid, void** ppv); -//extern "C" void SUBSYSTEMBASE_LINKAGE CreateQIObject(const char* cszFactoryId, const char* cszClassName, const IID& criid, void** ppv); -} - -/** - * @brief Template to wrap any interface or class and provide lifetime management. - *

- * Lifetime is managed through reference counting with counts stored in the object - * itself. The reference methods are AddRef() and Release(). When the reference - * count reaches zero the object will delete itself. - *

- * Template instantiation:
- * Cl is used for accessing the class. It may or may not be derived from - * #ICafObject.
- * CreateCl is used for creating the class and reference counting. It must - * support the #ICafObject interface. - */ -// CreateCl is used for creation and reference counting and must support the -// ICafObject interface. Cl is used for accessing the class. -template -class TCafSmartPtr { -public: - typedef Cl class_type; - typedef CreateCl create_type; - -private: - typedef TCafSmartPtr SameSmartType; - -public: - // constructors/destructors - - // default constructor - TCafSmartPtr(void) : - m_pCl(0) { - } - - // homogeneous raw constructor - TCafSmartPtr(Cl *rhs) { - m_pCl = rhs; - if (m_pCreateCl) - m_pCreateCl->AddRef(); - } - - // derived class smart constructor - template - TCafSmartPtr(const TCafSmartPtr &rhs) { - m_pCl = rhs.GetNonAddRefedInterface(); - if (m_pCreateCl) - m_pCreateCl->AddRef(); - } - - // homogeneous smart constructor - TCafSmartPtr(const SameSmartType& rhs) { - m_pCl = rhs.m_pCl; - if (m_pCreateCl) - m_pCreateCl->AddRef(); - } - - // don't allow construction from bool - explicit TCafSmartPtr(const bool &rb) { - int32 CantConstructSmartPointerFromBool[0]; - } - - // destructor - ~TCafSmartPtr(void) { - if (m_pCreateCl) - m_pCreateCl->Release(); - } - -public: - // assignment operators - - // homogeneous raw assignment - SameSmartType &operator=(Cl *rhs) { - Attach(rhs); - return *this; - } - - // derived class smart assignment - template - SameSmartType &operator=(const TCafSmartPtr &rhs) { - Attach(rhs.GetNonAddRefedInterface()); - return *this; - } - - // homogeneous smart assignment - SameSmartType &operator=(const SameSmartType &rhs) { - Attach(rhs.m_pCl); - return *this; - } - - // don't allow assignment from bool - void operator=(bool &rb) { - int32 CantAssignSmartPointerFromBool[0]; - } - -private: - - // This helper class is used to ensure that the old smart object gets - // released in a safe manner. It is not safe to touch 'this' in any way - // whatsoever after releasing the old smart object because the release - // could set off a chain of destruction that results in this smart pointer - // being destroyed. Note that this includes the exception macros which - // reference the automatically-defined class name member variable. - class CSafeAutoRelease { - public: - CSafeAutoRelease(CreateCl *pOldCreateCl) : - m_pOldCreateCl(pOldCreateCl) { - } - ~CSafeAutoRelease() { - if (m_pOldCreateCl) - m_pOldCreateCl->Release(); - } - CreateCl *m_pOldCreateCl; - }; - -public: - /** - * @brief Retrieve an interface from a ICafObject pointer and assign the result to self - * @param piObj the object to be queried - * @param cbIsRequired if true then the operation must succeed else an - * exception will be thrown. If false then the self value will be NULL - * if the operation fails. - */ - void QueryInterface(ICafObject *piObj, const bool cbIsRequired = true) { - CSafeAutoRelease oAutoRelease(m_pCreateCl); - - m_pCreateCl = NULL; - if (piObj) - piObj->QueryInterface(GetIID(), reinterpret_cast(&m_pCreateCl)); - if (cbIsRequired && !m_pCreateCl) - throw std::bad_cast(); - } - - /** - * @brief Retrieve an interface from another smart pointer and assign the result to self - * @param rhs the object to be queried - * @param cbIsRequired if true then the operation must succeed else an - * exception will be thrown. If false then the self value will be NULL - * if the operation fails. - */ - template - void QueryInterface(const TCafSmartPtr &rhs, const bool cbIsRequired = true) { - CSafeAutoRelease oAutoRelease(m_pCreateCl); - - m_pCreateCl = NULL; - if (rhs) - rhs.QueryInterface(GetIID(), reinterpret_cast(&m_pCreateCl)); - if (cbIsRequired && !m_pCreateCl) - throw std::bad_cast(); - } - - // This function is provided so that the delegation can go through m_pCreateCl - // rather than m_pCl. This way, if this is a smart pointer to a class that - // derives from multiple interfaces the compiler will not get confused about - // which QueryInterface function to use. - void QueryInterface(const IID &criid, void **ppv) const { - *ppv = NULL; - m_pCreateCl->QueryInterface(criid, ppv); - } - - /** - * @brief Return the UUID of the object - * @return the UUID - */ - static const IID& GetIID() { - // Compiler bug workaround (see comments before COpaqueTemplate) - // return TEcmSmartPtr_GetIID(static_cast *>(NULL)); - return CAF_IIDOF(Cl); - } - -public: - // comparison operators - - bool operator==(const Cl *rhs) const { - return m_pCl == rhs; - } - - template - bool operator==(const TCafSmartPtr &rhs) const { - return m_pCl == rhs.GetNonAddRefedInterface(); - } - - bool operator!=(const Cl *rhs) const { - return m_pCl != rhs; - } - - template - bool operator!=(const TCafSmartPtr &rhs) const { - return m_pCl != rhs.GetNonAddRefedInterface(); - } - - bool operator<(const SameSmartType &rhs) const { - return (m_pCl < rhs.m_pCl); - } - -public: - // conversion - - // This takes the place of operator bool. - // It turns out that the presence of operator bool - // causes the compiler to "get lost" when compiling - // comparison operations such as if( spcPtr1 == spcPtr2)... - // - // This conversion operator will satisfy the compiler when - // compiling comparison operations. - class PseudoBool { - }; - operator PseudoBool *() const { - return (PseudoBool *) m_pCl; - } - -public: - // instance creation - /** - * @brief Create an instance of the CreateCl object - *

- * The object will have an initial reference count of 1. - */ - void CreateInstance() { - CSafeAutoRelease oAutoRelease(m_pCreateCl); - - //////////////////////////////////////////////////////////////////////// - // - // This code is used to verify that it is safe to use a union of Cl - // and CreateCl. An error indicates that it is *not* safe in which - // case the smart pointer cannot be used as defined. To solve this - // problem, eliminate the second template parameter from the smart - // pointer definition which will force Cl and CreateCl to be the - // same, e.g.: - // - // typedef TCafSmartPtr > SmartPtrClass; - // - //////////////////////////////////////////////////////////////////////// - Cl *pCl = static_cast(reinterpret_cast(0x4)); - if (pCl != reinterpret_cast(0x4)) - throw std::logic_error("Illegal use of TCafSmartPtr<> (See comments in TCafSmartPtr.h)"); - m_pCreateCl = new CreateCl; - if (!m_pCreateCl) - throw std::bad_alloc(); - m_pCreateCl->AddRef(); - } - - /** - * @brief Create an instance of a subsystem object - *

- * Objects exposed as subsystems (#Caf::TCafSubSystemSmartCl) are identified - * by a string. The Cl and CreateCl template arguments would both be - * set to an interface on the subsystem object of interest. - *

- * The object will have an initial reference count of 1. - */ - void CreateInstance(const char* cszObjectId) { - CSafeAutoRelease oAutoRelease(m_pCreateCl); - Caf::CreateObject(cszObjectId, GetIID(), reinterpret_cast(&m_pCreateCl)); - } - -// void CreateInstance (const char *cszFactoryId, const char *cszClassName) -// { -// CSafeAutoRelease oAutoRelease(m_pCreateCl); -// Caf::CreateQIObject(cszFactoryId, cszClassName, GetIID(), reinterpret_cast(&m_pCreateCl)); -// } - -public: - // operations - Cl *GetAddRefedInterface() const { - if (!m_pCl) - throw std::runtime_error("TCafSmartPtr: m_pCl is NULL"); - if (m_pCreateCl) - m_pCreateCl->AddRef(); - return m_pCl; - } - - Cl *GetNonAddRefedInterface() const { - return m_pCl; - } - - Cl **GetReleasedInterfaceReference(void) { - CSafeAutoRelease oAutoRelease(m_pCreateCl); - m_pCreateCl = NULL; - return &m_pCreateCl; - } - - Cl **GetNonReleasedInterfaceReference(void) { - return &m_pCreateCl; - } - - void **GetAsPPVArg(void) { - return (void**) GetReleasedInterfaceReference(); - } - - bool IsNull() const { - return m_pCl == 0; - } - - // the arrow operator simply returns the pointer - Cl *operator->() const { - if (!m_pCl) - throw std::runtime_error("TCafSmartPtr: m_pCl is NULL"); - return m_pCl; - } - - Cl &operator*() const { - if (!m_pCl) - throw std::runtime_error("TCafSmartPtr: m_pCl is NULL"); - return *m_pCl; - } - -private: - // m_pCreateCl is used for reference counting; m_pCl is used for object access. - union { - Cl *m_pCl; - CreateCl *m_pCreateCl; - }; - -private: - // homogeneous raw attachment - void Attach(Cl* rhs) { - CSafeAutoRelease oAutoRelease(m_pCreateCl); - m_pCl = rhs; - if (m_pCreateCl) - m_pCreateCl->AddRef(); - } -}; - -// These template functions will give you a reference to the -// underlying object wraped in a smart class -template -const Cl& ToObj(const TCafSmartPtr& spcT) { - return *(spcT.GetNonAddRefedInterface()); -} - -template -Cl& ToNonConstObj(const TCafSmartPtr& spcT) { - return *(spcT.GetNonAddRefedInterface()); -} - -//////////////////////////////////////////////////////////////////////// -// -// Declaration Macros -// -//////////////////////////////////////////////////////////////////////// - -// Declare a smart pointer after the class has been declared -#define CAF_DECLARE_SMART_POINTER(ClassName) \ - typedef TCafSmartPtr > SmartPtr##ClassName; \ -// typedef TCafSmartPtr > ConstPtr##ClassName - -// Forward declare a class smart pointer -#define CAF_DECLARE_CLASS_AND_SMART_POINTER(ClassName) \ - class ClassName; \ - CAF_DECLARE_SMART_POINTER(ClassName) - -// Forward declare a struct smart pointer -#define CAF_DECLARE_STRUCT_AND_SMART_POINTER(StructName) \ - struct StructName; \ - CAF_DECLARE_SMART_POINTER(StructName) - -// Helper macro - do not use directly -#define CAF_DECLARE_SMART_INTERFACE_HELPER(InterfaceName) \ - typedef TCafSmartPtr SmartPtr##InterfaceName; \ -// typedef TCafSmartPtr ConstPtr##InterfaceName - -// Declare a smart pointer to an interface in the interface header file -#define CAF_DECLARE_SMART_INTERFACE_POINTER(InterfaceName) \ - CAF_DECLARE_SMART_INTERFACE_HELPER(InterfaceName) - -// Forward declare a smart interface pointer -#define CAF_FORWARD_DECLARE_SMART_INTERFACE(InterfaceName) \ - struct InterfaceName; \ - CAF_DECLARE_SMART_INTERFACE_HELPER(InterfaceName) - -#endif // #ifndef _TCafSmartPtr_H diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/TCafStackObject.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/TCafStackObject.h deleted file mode 100644 index 1d19d3e62..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/TCafStackObject.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Created on: Jul 23, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef TCAFSTACKOBJECT_H_ -#define TCAFSTACKOBJECT_H_ - -namespace Caf { - -template -class TCafStackObject : public Base { -public: - TCafStackObject() {} - virtual ~TCafStackObject() {} - -private: - virtual void AddRef() { - throw std::runtime_error("TCafStackObj::AddRef not supported"); - } - - virtual void Release() { - throw std::runtime_error("TCafStackObj::Release not supported"); - } - - virtual void QueryInterface(const IID&, void** ppv) { - throw std::runtime_error("TCafStackObj::QueryInterface not supported"); - } -}; - -} -#endif /* TCAFSTACKOBJECT_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Xml/MarkupParser/CMarkupParser.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Xml/MarkupParser/CMarkupParser.h deleted file mode 100644 index 12cff3a2b..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Xml/MarkupParser/CMarkupParser.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Author: mdonahue - * Created: Jan 20, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CMARKUPPARSER_H_ -#define CMARKUPPARSER_H_ - -#include -#include - -namespace Caf { - -/* - * Wrapper around glib GMarkupParser to store results in std containers - */ -namespace MarkupParser { - -// attribute name, value -typedef std::pair Attribute; -typedef std::list Attributes; - -struct AttributeName : public std::binary_function { - bool operator()(const Attribute& attr, const std::string& name) const { - return (attr.first.compare(name) == 0); - } -}; - -struct Element; -CAF_DECLARE_SMART_POINTER(Element); -struct Element { - Element() {} - std::string name; - std::string value; - Attributes attributes; - typedef std::list Children; - Children children; - - CAF_CM_DECLARE_NOCOPY(Element); -}; - -struct ElementName : public std::binary_function { - bool operator()(const SmartPtrElement& element, const std::string& name) const { - return (element->name.compare(name) == 0); - } -}; - -SmartPtrElement MARKUPPARSER_LINKAGE parseString(const std::string& xml); - -SmartPtrElement MARKUPPARSER_LINKAGE parseFile(const std::string& file); - -typedef Element::Children::iterator ChildIterator; -typedef Attributes::iterator AttributeIterator; - -ChildIterator MARKUPPARSER_LINKAGE findChild(SmartPtrElement& element, const std::string& name); - -AttributeIterator MARKUPPARSER_LINKAGE findAttribute(Attributes& attributes, const std::string& name); - -std::string MARKUPPARSER_LINKAGE getAttributeValue(SmartPtrElement& element, const std::string& name); - -}} - -#endif /* CMARKUPPARSER_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Xml/XmlUtils/CXmlElement.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Xml/XmlUtils/CXmlElement.h deleted file mode 100644 index c9e3456fc..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/include/Xml/XmlUtils/CXmlElement.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Author: mdonahue - * Created: Dec 3, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef _CXmlElement_h -#define _CXmlElement_h - - -#include "Integration/IDocument.h" -#include "Xml/MarkupParser/CMarkupParser.h" - -namespace Caf { - -CAF_DECLARE_CLASS_AND_SMART_POINTER(CXmlElement); - -class XMLUTILS_LINKAGE CXmlElement { -public: - typedef std::map CAttributeCollection; - typedef std::multimap CElementCollection; - typedef std::deque COrderedElementCollection; - CAF_DECLARE_SMART_POINTER(CAttributeCollection); - CAF_DECLARE_SMART_POINTER(CElementCollection); - CAF_DECLARE_SMART_POINTER(COrderedElementCollection); - -public: - CXmlElement(); - virtual ~CXmlElement(); - -public: - void initialize(const MarkupParser::SmartPtrElement& element, const std::string& path); - MarkupParser::SmartPtrElement getInternalElement(); - -public: // Read operations - - std::string findRequiredAttribute(const std::string& name) const; - std::string findOptionalAttribute(const std::string& name) const; - SmartPtrCXmlElement findRequiredChild(const std::string& name) const; - SmartPtrCXmlElement findOptionalChild(const std::string& name) const; - SmartPtrCElementCollection findRequiredChildren(const std::string& name) const; - SmartPtrCElementCollection findOptionalChildren(const std::string& name) const; - SmartPtrCAttributeCollection getAllAttributes() const; - SmartPtrCElementCollection getAllChildren() const; - SmartPtrCOrderedElementCollection getAllChildrenInOrder() const; - std::string getName() const; - std::string getValue() const; - std::string getCDataValue() const; - std::string getPath() const; - -public: // Write operations - void addAttribute(const std::string& name, const std::string& value); - void removeAttribute(const std::string& name); - void setAttribute(const std::string& name, const std::string& value); - SmartPtrCXmlElement createAndAddElement(const std::string& name); - void addChild(const SmartPtrCXmlElement& xmlElement); - void removeChild(const std::string& name); - void setValue(const std::string& value); - void setCDataValue(const std::string& value); - void appendValue(const std::string& value); - void saveToFile(const std::string& filename) const; - std::string saveToString() const; - std::string saveToStringRaw() const; - -private: - static const std::string CDATA_BEG; - static const std::string CDATA_END; - -private: - bool _isInitialized; - mutable MarkupParser::SmartPtrElement _element; - std::string _path; - -private: - static void saveToString(const MarkupParser::SmartPtrElement& element, std::string& xml); - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CXmlElement); -}; - -CAF_DECLARE_SMART_POINTER(CXmlElement); - -} - -#endif /* _CXmlElement_h */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/BasePlatform.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/BasePlatform.cpp deleted file mode 100644 index d75ee8be2..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/BasePlatform.cpp +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#ifdef WIN32 - -extern "C" -{ - -BOOL APIENTRY DllMain(HMODULE, uint32, LPVOID) -{ - return TRUE; -} - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Collections/Graphs/GraphsInc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Collections/Graphs/GraphsInc.h deleted file mode 100644 index 323d3ffd8..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Collections/Graphs/GraphsInc.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Created on: Sep 30, 2011 - * Author: mdonahue - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef GRAPHSINC_H_ -#define GRAPHSINC_H_ - -#include "TEdgeListGraph.h" - -#endif /* GRAPHSINC_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Collections/Graphs/TEdgeListGraph.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Collections/Graphs/TEdgeListGraph.h deleted file mode 100644 index 47660034b..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Collections/Graphs/TEdgeListGraph.h +++ /dev/null @@ -1,497 +0,0 @@ -/* - * Created on: Jul 09, 2003 - * Author: Scott VanCamp - * - * Copyright (C) 2003-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef TEDGELISTGRAPH_H_ -#define TEDGELISTGRAPH_H_ - -#include -#include "Exception/CCafException.h" -#include -#include -#include - -////////////////////////////////////////////////////////////////////////////// -// -// Simple graph that uses an edge list -// -// Since we may be using this graph with smart pointers I allow you to specify -// you own less than function. See -// for smart class less than template functions. -////////////////////////////////////////////////////////////////////////////// -using namespace Caf; - -template < class Item, class CustomLess = std::less< Item > > -class TEdgeListGraph -{ - private: - typedef TEdgeListGraph< Item, CustomLess > SameGraphType; - - public: - typedef std::set< Item, CustomLess> CsetVertexEdges; - typedef std::set< Item* > CsetptrVertexEdges; - typedef std::map< Item, CsetptrVertexEdges, CustomLess > CmapVertexEdgeList; - typedef std::list< Item > ClistVertexEdges; - - TEdgeListGraph() - : CAF_CM_INIT( "TEdgeListGraph" ) - { - } - - Item findVertex( const Item& crItemVertex ) const - { - return internalFindVertex(crItemVertex, _mapEdgeList); - } - - bool isVertexInGraph( const Item& crItemVertex ) const - { - return internalIsVertexInGraph(crItemVertex, _mapEdgeList); - } - - bool isEdgeInGraph(const Item& source, const Item& destination) const - { - return internalIsEdgeInGraph(source, destination, _mapEdgeList); - } - - void addVertex( const Item& crItemVertex ) - { - internalAddVertex(crItemVertex, _mapEdgeList); - } - - void removeVertices( const CsetVertexEdges& crsetParents) - { - internalRemoveVertices(crsetParents, _mapEdgeList); - } - - void removeVertex( const Item& crItemVertex ) - { - return internalRemoveVertex(crItemVertex, _mapEdgeList); - } - - void addEdge( const Item& crItemSource, const Item& crItemDestination ) - { - internalAddEdge(crItemSource, crItemDestination, _mapEdgeList); - } - - void removeEdge( const Item& crItemSource, const Item& crItemDestination ) - { - internalRemoveEdge(crItemSource, crItemDestination, _mapEdgeList); - } - - CsetVertexEdges getVertices() const - { - return internalGetVertices(_mapEdgeList); - } - - uint32 getNumberVertices() const - { - return static_cast(_mapEdgeList.size()); - } - - ////////////////////////////////////////////////////////////////////// - // - // getEdges() - // - // Does not recurse into the dependencies, returns the immediate items - // that the item depends on. - ////////////////////////////////////////////////////////////////////// - CsetVertexEdges getEdges( const Item& crItemVertex ) const - { - return internalGetEdges(crItemVertex, _mapEdgeList); - } - - ////////////////////////////////////////////////////////////////////// - // - // getParents() - // - // Returns the parents of a given vertex - // - ////////////////////////////////////////////////////////////////////// - CsetVertexEdges getParents( const Item& crItemVertex ) const - { - return internalGetParents(crItemVertex, _mapEdgeList); - } - - ////////////////////////////////////////////////////////////////////// - // - // getAllParents() - // Returns a set of all the parents of a particular vertex - // - ////////////////////////////////////////////////////////////////////// - CsetVertexEdges getAllParents( const Item& crItemVertex ) const - { - CsetVertexEdges oSetParents; - - // Get the Parents - internalGetAllParents( crItemVertex, _mapEdgeList, oSetParents ); - return oSetParents; - } - - void copyGraph(SameGraphType& copy) const - { - internalCopyGraph(*this, copy); - } - - ////////////////////////////////////////////////////////////////////// - // - // topologySort() - // Returns a topology sort of the entire graph. - // The returned list indicates vertices in sorted order - // - ////////////////////////////////////////////////////////////////////// - // Kahn, A. B. (1962), "Topological sorting of large networks", Communications of the ACM 5 (11): 558�562 - // - // L <- Empty list that will contain the sorted elements - // S <- Set of all nodes with no incoming edges - // while S is non-empty do - // remove a node n from S - // insert n into L - // for each node m with an edge e from n to m do - // remove edge e from the graph - // if m has no other incoming edges then - // insert m into S - // if graph has edges then - // output error message (graph has at least one cycle) - // else - // output message (proposed topologically sorted order: L) - ClistVertexEdges topologySort() const - { - CAF_CM_FUNCNAME("topologySort"); - ClistVertexEdges sortedList; - - // Work with a temporary copy of the graph - TEdgeListGraph graphCopy; - internalCopyGraph(*this, graphCopy); - CsetVertexEdges setNoParents; - - CsetVertexEdges vertices = graphCopy.getVertices(); - for (typename CsetVertexEdges::const_iterator vertex = vertices.begin(); - vertex != vertices.end(); - ++vertex) { - if (graphCopy.getParents(*vertex).size() == 0) { - setNoParents.insert(*vertex); - } - } - - while (setNoParents.size()) { - Item n = *(setNoParents.begin()); - setNoParents.erase(setNoParents.begin()); - sortedList.push_back(n); - CsetVertexEdges edges = graphCopy.getEdges(n); - for (typename CsetVertexEdges::const_iterator edge = edges.begin(); - edge != edges.end(); - ++edge) { - graphCopy.removeEdge(n, *edge); - - bool edgeFound = false; - CsetVertexEdges vertices = graphCopy.getVertices(); - for (typename CsetVertexEdges::const_iterator vertex = vertices.begin(); - !edgeFound && (vertex != vertices.end()); - ++vertex) { - edgeFound = graphCopy.isEdgeInGraph(*vertex, *edge); - } - - if (!edgeFound) { - setNoParents.insert(*edge); - } - } - } - - // Cycle check - vertices = graphCopy.getVertices(); - for (typename CsetVertexEdges::const_iterator vertex = vertices.begin(); - vertex != vertices.end(); - ++vertex) { - if (graphCopy.getEdges(*vertex).size()) { - CAF_CM_EXCEPTION_VA0(ERROR_INVALID_STATE, "The graph has at least one cycle"); - } - } - - return sortedList; - } - - private: - Item internalFindVertex( const Item& crItemVertex, const CmapVertexEdgeList& graph ) const - { - Item FoundVertex; - // Find the vertex - typename CmapVertexEdgeList::const_iterator imapVertex = graph.find( crItemVertex ); - if( imapVertex != graph.end() ) - { - FoundVertex = ( imapVertex->first ); - } - return FoundVertex; - } - - bool internalIsVertexInGraph( const Item& crItemVertex, const CmapVertexEdgeList& graph ) const - { - bool bVertexIsInGraph = false; - - // Find the vertex - typename CmapVertexEdgeList::const_iterator imapVertex = graph.find( crItemVertex ); - if( imapVertex != graph.end() ) - { - bVertexIsInGraph = true; - } - return bVertexIsInGraph; - } - - bool internalIsEdgeInGraph(const Item& source, const Item& destination, const CmapVertexEdgeList& graph) const - { - CsetVertexEdges edges = internalGetEdges(source, graph); - return (edges.end() != edges.find(destination)); - } - - - void internalAddVertex( const Item& crItemVertex, CmapVertexEdgeList& graph ) - { - CAF_CM_FUNCNAME("internalAddVertex"); - // Ensure that the Vertex doesn't already exist in the graph - // we do not allow duplicate Vertices to exist. - typename CmapVertexEdgeList::const_iterator imapEdgeList - = graph.find( crItemVertex ); - if ( graph.end() == imapEdgeList ) - { - graph.insert( std::make_pair( crItemVertex, CsetptrVertexEdges() ) ); - } - else - { - CAF_CM_EXCEPTION_VA0( - ERROR_DUPLICATE_TAG, - "Vertex already exists in the graph, cannot add duplicate Vertices"); - } - } - - void internalRemoveVertices( const CsetVertexEdges& crsetParents, CmapVertexEdgeList& graph) - { - for( typename CsetVertexEdges::const_iterator isetVertex = crsetParents.begin(); - isetVertex != crsetParents.end(); - ++isetVertex ) - { - internalRemoveVertex( *isetVertex, graph ); - } - } - - void internalRemoveVertex( const Item& crItemVertex, CmapVertexEdgeList& graph ) - { - CsetVertexEdges osetVerticesAffected; - - // Find the vertex - typename CmapVertexEdgeList::iterator imapVertex = graph.find( crItemVertex ); - if( imapVertex != graph.end() ) - { - // Get an Item pointer to the vertex that we wish to remove - Item* pItem = const_cast( &( imapVertex->first ) ); - - // Iterate over each vertex removing each reference to the vertex being removed - for( typename CmapVertexEdgeList::iterator imapEdgeList = graph.begin(); - imapEdgeList != graph.end(); - ++imapEdgeList ) - { - // Is the item in the edge list for the current vertex - typename CsetptrVertexEdges::iterator isetVertex = imapEdgeList->second.find( pItem ); - if( isetVertex != imapEdgeList->second.end() ) - { - // Remove the reference - imapEdgeList->second.erase( isetVertex ); - } - } - - // We no longer need the Item pointer - pItem = NULL; - - // Remove the vertex - graph.erase( imapVertex ); - } - } - - void internalAddEdge( const Item& crItemSource, const Item& crItemDestination, CmapVertexEdgeList& graph ) - { - CAF_CM_FUNCNAME("internalAddEdge"); - - // Ensure that you are not trying to add a dependency to yourself - if ( crItemSource == crItemDestination ) - { - CAF_CM_EXCEPTION_VA0( - ERROR_INVALID_DATA, - "Edges to yourself are not allowed, cannot add edge"); - } - - // Ensure that there is a source vertex - typename CmapVertexEdgeList::iterator imapSourceVertex = graph.find( crItemSource ); - if( imapSourceVertex == graph.end() ) - { - CAF_CM_EXCEPTION_VA0( - ERROR_TAG_NOT_FOUND, - "Unable to find source vertex, cannot add edge"); - } - - // Ensure that there is a destination vertex - typename CmapVertexEdgeList::iterator imapDestinationVertex = graph.find( crItemDestination ); - if( imapDestinationVertex == graph.end() ) - { - CAF_CM_EXCEPTION_VA0( - ERROR_TAG_NOT_FOUND, - "Unable to find destination vertex, cannot add edge"); - } - - // Create the edge - Item* pItem = const_cast( &( imapDestinationVertex->first ) ); - imapSourceVertex->second.insert( pItem ); - } - - void internalRemoveEdge( const Item& crItemSource, const Item& crItemDestination, CmapVertexEdgeList& graph ) - { - // Ensure that there is a source vertex - typename CmapVertexEdgeList::iterator imapSourceVertex = graph.find( crItemSource ); - if( imapSourceVertex != graph.end() ) - { - // Ensure that there is a destination vertex - typename CmapVertexEdgeList::iterator imapDestinationVertex = graph.find( crItemDestination ); - if( imapDestinationVertex != graph.end() ) - { - // Get a pointer to the edge - Item* pItem = const_cast( &( imapDestinationVertex->first ) ); - - // remove the edge - imapSourceVertex->second.erase( pItem ); - } - } - } - - CsetVertexEdges internalGetVertices(const CmapVertexEdgeList& graph) const - { - CsetVertexEdges osetVertices; - for( typename CmapVertexEdgeList::const_iterator imapEdgeList = graph.begin(); - imapEdgeList != graph.end(); - ++imapEdgeList ) - { - osetVertices.insert( imapEdgeList->first ); - } - return osetVertices; - } - - CsetVertexEdges internalGetEdges( const Item& crItemVertex, const CmapVertexEdgeList& graph ) const - { - CAF_CM_FUNCNAME("getEdges"); - CsetVertexEdges osetEdges; - - // Find the vertex - typename CmapVertexEdgeList::const_iterator imapVertex = graph.find( crItemVertex ); - if( imapVertex == graph.end() ) - { - CAF_CM_EXCEPTION_VA0( - ERROR_TAG_NOT_FOUND, - "Unable to find vertex. Cannot get edges"); - } - else - { - for( typename CsetptrVertexEdges::const_iterator isetEdge = imapVertex->second.begin(); - isetEdge != imapVertex->second.end(); - ++isetEdge ) - { - if( *isetEdge == NULL ) - { - CAF_CM_EXCEPTION_VA0( - E_FAIL, - "Invalid graph, an edge reported pointing to a invalid destination vertex"); - } - osetEdges.insert( **isetEdge ); - } - } - return osetEdges; - } - - CsetVertexEdges internalGetParents( - const Item& crItemVertex, - const CmapVertexEdgeList& graph) const - { - CsetVertexEdges oSetParents; - - // Find the vertex - typename CmapVertexEdgeList::const_iterator cimapVertex = graph.find( crItemVertex ); - if( cimapVertex != graph.end() ) - { - // Get an Item pointer to the vertex that we wish to get parents for - Item* pItem = const_cast( &( cimapVertex->first ) ); - - // Iterate over each vertex in the graph - for( typename CmapVertexEdgeList::const_iterator cimapEdgeList = graph.begin(); - cimapEdgeList != graph.end(); - ++cimapEdgeList ) - { - // Is the item in the edge list for the current vertex - typename CsetptrVertexEdges::const_iterator cisetVertex = cimapEdgeList->second.find( pItem ); - if( cisetVertex != cimapEdgeList->second.end() ) - { - // Add the vertex to the set of parents - oSetParents.insert( cimapEdgeList->first ); - } - } - - // We no longer need the Item pointer - pItem = NULL; - } - return oSetParents; - } - - void internalGetAllParents( - const Item& crItemVertex, - const CmapVertexEdgeList& graph, - CsetVertexEdges& roSetParents) const - { - // Find the vertex in the map - typename CmapVertexEdgeList::const_iterator imapVertex = graph.find( crItemVertex ); - if( imapVertex != graph.end() ) - { - // Get the parents of this vertex - CsetVertexEdges setCurrentParents = internalGetParents( crItemVertex, graph ); - - // For each parent found that we have not recorded yet find its parents - for( typename CsetVertexEdges::iterator isetCurrentParent = setCurrentParents.begin(); - isetCurrentParent != setCurrentParents.end(); - ++isetCurrentParent ) - { - // Have we recorded this current parent in the parent set? - typename CsetVertexEdges::iterator isetIsCurrentParentRecorded = roSetParents.find( *isetCurrentParent ); - if( isetIsCurrentParentRecorded == roSetParents.end() ) - { - // Since we have not recorded this vertex, record it and get its parents - roSetParents.insert( *isetCurrentParent ); - - // Since we have not recorded this parent, record it and get its parents - internalGetAllParents(*isetCurrentParent, graph, roSetParents ); - } - } - } - } - - void internalCopyGraph(const SameGraphType& source, SameGraphType& copy) const - { - CsetVertexEdges sourceVertices = source.getVertices(); - for (typename CsetVertexEdges::const_iterator vertex = sourceVertices.begin(); - vertex != sourceVertices.end(); - ++vertex) { - copy.addVertex(*vertex); - } - - for (typename CsetVertexEdges::const_iterator vertex = sourceVertices.begin(); - vertex != sourceVertices.end(); - ++vertex) { - CsetVertexEdges sourceEdges = source.getEdges(*vertex); - for (typename CsetVertexEdges::const_iterator edge = sourceEdges.begin(); - edge != sourceEdges.end(); - ++edge) { - copy.addEdge(*vertex, *edge); - } - } - } - - CmapVertexEdgeList _mapEdgeList; - CAF_CM_CREATE; -}; - -#endif /* TEDGELISTGRAPH_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Collections/Iterators/IteratorsInc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Collections/Iterators/IteratorsInc.h deleted file mode 100644 index b0f5b6421..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Collections/Iterators/IteratorsInc.h +++ /dev/null @@ -1,33 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// -// Author: J.P. Grossman -// -// Created: 10/16/2003 -// -// Copyright (C) 2003-2016 VMware, Inc. All rights reserved. -- VMware Confidential -// -- VMware Confidential -// -///////////////////////////////////////////////////////////////////////////// - -#ifndef IteratorsInc_h_ -#define IteratorsInc_h_ - -#include "TIterator.h" -#include "TMapIterator.h" - -#include "TConstIterator.h" -#include "TConstMapIterator.h" - -#include "TSmartIterator.h" -#include "TSmartMapIterator.h" - -#include "TSmartConstIterator.h" -#include "TSmartConstMapIterator.h" - -#include "TMultimapIterator.h" -#include "TConstMultimapIterator.h" - -#include "TSmartMultimapIterator.h" -#include "TSmartConstMultimapIterator.h" - -#endif // #ifndef IteratorsInc_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Collections/Iterators/TConstIterator.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Collections/Iterators/TConstIterator.h deleted file mode 100644 index 3439c194e..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Collections/Iterators/TConstIterator.h +++ /dev/null @@ -1,94 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// -// Author: J.P. Grossman -// -// Purpose: Return a lightweight iterator for an arbitrary container. -// The iterator moves in the forward direction only; once -// it reaches the end you need a new one. I considered -// adding m_citerBegin to allow for a Reset method, but -// decided that it was better to have a "use once then -// throw away" iterator to prevent the misuse of passing -// the iterator around, possibly after the original -// container has gone away. This way use of the iterator -// is localized, much like the use of standard iterators. -// -// Created: 10/16/2003 -// -// Copyright (C) 2003-2016 VMware, Inc. All rights reserved. -- VMware Confidential -// -- VMware Confidential -// -///////////////////////////////////////////////////////////////////////////// - -#ifndef TConstIterator_h_ -#define TConstIterator_h_ - -namespace Caf { - -template -class TConstIterator -{ -public: - TConstIterator () - { - m_citerCurrent = m_citerEnd; - } - - TConstIterator (const Container &rcContainer) - { - m_citerCurrent = rcContainer.begin(); - m_citerEnd = rcContainer.end(); - } - - TConstIterator (const TConstIterator &rhs) - { - m_citerCurrent = rhs.m_citerCurrent; - m_citerEnd = rhs.m_citerEnd; - } - - TConstIterator &operator= (const Container &rcContainer) - { - m_citerCurrent = rcContainer.begin(); - m_citerEnd = rcContainer.end(); - return *this; - } - - TConstIterator &operator= (const TConstIterator &rhs) - { - m_citerCurrent = rhs.m_citerCurrent; - m_citerEnd = rhs.m_citerEnd; - return *this; - } - -public: - const ValueType &operator* () - { - return *m_citerCurrent; - } - - const ValueType *operator-> () - { - return m_citerCurrent.operator->(); - } - - void operator++ () - { - ++m_citerCurrent; - } - - void operator++ (int32) - { - m_citerCurrent++; - } - - operator bool () - { - return m_citerCurrent != m_citerEnd; - } - -private: - typename Container::const_iterator m_citerCurrent; - typename Container::const_iterator m_citerEnd; -}; -} - -#endif // #ifndef TConstIterator_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Collections/Iterators/TConstMapIterator.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Collections/Iterators/TConstMapIterator.h deleted file mode 100644 index 1b8bcb77c..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Collections/Iterators/TConstMapIterator.h +++ /dev/null @@ -1,92 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// -// Author: J.P. Grossman -// -// Created: 10/16/2003 -// -// Copyright (C) 2003-2016 VMware, Inc. All rights reserved. -- VMware Confidential -// -- VMware Confidential -// -///////////////////////////////////////////////////////////////////////////// - -#ifndef TConstMapIterator_h_ -#define TConstMapIterator_h_ - -namespace Caf { - -template -class TConstMultimapIterator; - -template -class TConstMapIterator -{ -public: - TConstMapIterator () - { - m_citerCurrent = m_citerEnd; - } - - TConstMapIterator (const Container &rcContainer) - { - m_citerCurrent = rcContainer.begin(); - m_citerEnd = rcContainer.end(); - } - - TConstMapIterator (const TConstMapIterator &rhs) - { - m_citerCurrent = rhs.m_citerCurrent; - m_citerEnd = rhs.m_citerEnd; - } - - TConstMapIterator &operator= (const Container &rcContainer) - { - m_citerCurrent = rcContainer.begin(); - m_citerEnd = rcContainer.end(); - return *this; - } - - TConstMapIterator &operator= (const TConstMapIterator &rhs) - { - m_citerCurrent = rhs.m_citerCurrent; - m_citerEnd = rhs.m_citerEnd; - return *this; - } - -public: - const ValueType &operator* () - { - return m_citerCurrent->second; - } - - const ValueType *operator-> () - { - return &m_citerCurrent->second; - } - - void operator++ () - { - ++m_citerCurrent; - } - - void operator++ (int32) - { - m_citerCurrent++; - } - - const KeyType &getKey (void) - { - return m_citerCurrent->first; - } - - operator bool () - { - return m_citerCurrent != m_citerEnd; - } - -private: - typename Container::const_iterator m_citerCurrent; - typename Container::const_iterator m_citerEnd; -}; -} - -#endif // #ifndef TConstMapIterator_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Collections/Iterators/TConstMultimapIterator.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Collections/Iterators/TConstMultimapIterator.h deleted file mode 100644 index 83fee1924..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Collections/Iterators/TConstMultimapIterator.h +++ /dev/null @@ -1,82 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// -// Author: J.P. Grossman -// -// Created: 10/16/2003 -// -// Copyright (C) 2003-2016 VMware, Inc. All rights reserved. -- VMware Confidential -// -- VMware Confidential -// -///////////////////////////////////////////////////////////////////////////// - -#ifndef TCONSTMULTIMAPITERATOR_H_ -#define TCONSTMULTIMAPITERATOR_H_ - -namespace Caf { - -template -class TConstMultimapIterator -{ -public: - TConstMultimapIterator () - { - m_citerCurrent = m_citerEnd; - } - - TConstMultimapIterator (const Container &rcContainer) - { - m_citerCurrent = rcContainer.begin(); - m_citerEnd = rcContainer.end(); - } - - TConstMultimapIterator (const TConstMultimapIterator &rhs) - { - m_citerCurrent = rhs.m_citerCurrent; - m_citerEnd = rhs.m_citerEnd; - } - - TConstMultimapIterator &operator= (const TConstMultimapIterator &rhs) - { - m_citerCurrent = rhs.m_citerCurrent; - m_citerEnd = rhs.m_citerEnd; - return *this; - } - -public: - const KeyType &getKey (void) - { - return m_citerCurrent->first; - } - - const ValueType &operator* () - { - return m_citerCurrent->second; - } - - const ValueType *operator-> () - { - return &m_citerCurrent->second; - } - - void operator++ () - { - ++m_citerCurrent; - } - - void operator++ (int32) - { - m_citerCurrent++; - } - - operator bool () - { - return (m_citerCurrent != m_citerEnd); - } - -private: - typename Container::const_iterator m_citerCurrent; - typename Container::const_iterator m_citerEnd; -}; -} - -#endif // #ifdef TCONSTMULTIMAPITERATOR_H_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Collections/Iterators/TIterator.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Collections/Iterators/TIterator.h deleted file mode 100644 index 7c690992f..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Collections/Iterators/TIterator.h +++ /dev/null @@ -1,84 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// -// Author: J.P. Grossman -// -// Created: 10/16/2003 -// -// Copyright (C) 2003-2016 VMware, Inc. All rights reserved. -- VMware Confidential -// -- VMware Confidential -// -///////////////////////////////////////////////////////////////////////////// - -#ifndef TIterator_h_ -#define TIterator_h_ - -namespace Caf { - -template -class TIterator -{ -public: - TIterator () - { - m_iterCurrent = m_iterEnd; - } - - TIterator (Container &rContainer) - { - m_iterCurrent = rContainer.begin(); - m_iterEnd = rContainer.end(); - } - - TIterator (const TIterator &rhs) - { - m_iterCurrent = rhs.m_iterCurrent; - m_iterEnd = rhs.m_iterEnd; - } - - TIterator &operator= (const Container &rContainer) - { - m_iterCurrent = rContainer.begin(); - m_iterEnd = rContainer.end(); - return *this; - } - - TIterator &operator= (const TIterator &rhs) - { - m_iterCurrent = rhs.m_iterCurrent; - m_iterEnd = rhs.m_iterEnd; - return *this; - } - -public: - ValueType &operator* () - { - return *m_iterCurrent; - } - - ValueType *operator-> () - { - return m_iterCurrent.operator->(); - } - - void operator++ () - { - ++m_iterCurrent; - } - - void operator++ (int32) - { - m_iterCurrent++; - } - - operator bool () - { - return m_iterCurrent != m_iterEnd; - } - -private: - typename Container::iterator m_iterCurrent; - typename Container::iterator m_iterEnd; -}; -} - -#endif // #ifndef TIterator_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Collections/Iterators/TMapIterator.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Collections/Iterators/TMapIterator.h deleted file mode 100644 index 88b3ea4e6..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Collections/Iterators/TMapIterator.h +++ /dev/null @@ -1,91 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// -// Author: J.P. Grossman -// -// Created: 10/16/2003 -// -// Copyright (C) 2003-2016 VMware, Inc. All rights reserved. -- VMware Confidential -// -- VMware Confidential -// -///////////////////////////////////////////////////////////////////////////// - -#ifndef TMapIterator_h_ -#define TMapIterator_h_ - -namespace Caf { - -template class TMultimapIterator; - -template -class TMapIterator -{ -public: - TMapIterator () - { - m_iterCurrent = m_iterEnd; - } - - TMapIterator (Container &rContainer) - { - m_iterCurrent = rContainer.begin(); - m_iterEnd = rContainer.end(); - } - - TMapIterator (const TMapIterator &rhs) - { - m_iterCurrent = rhs.m_iterCurrent; - m_iterEnd = rhs.m_iterEnd; - } - - TMapIterator &operator= (const Container &rContainer) - { - m_iterCurrent = rContainer.begin(); - m_iterEnd = rContainer.end(); - return *this; - } - - TMapIterator &operator= (const TMapIterator &rhs) - { - m_iterCurrent = rhs.m_iterCurrent; - m_iterEnd = rhs.m_iterEnd; - return *this; - } - -public: - ValueType &operator* () - { - return m_iterCurrent->second; - } - - ValueType *operator-> () - { - return &m_iterCurrent->second; - } - - void operator++ () - { - ++m_iterCurrent; - } - - void operator++ (int32) - { - m_iterCurrent++; - } - - const KeyType &getKey (void) - { - return m_iterCurrent->first; - } - - operator bool () - { - return m_iterCurrent != m_iterEnd; - } - -private: - typename Container::iterator m_iterCurrent; - typename Container::iterator m_iterEnd; -}; -} - -#endif // #ifndef TMapIterator_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Collections/Iterators/TMultimapIterator.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Collections/Iterators/TMultimapIterator.h deleted file mode 100644 index 4229b4a7d..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Collections/Iterators/TMultimapIterator.h +++ /dev/null @@ -1,82 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// -// Author: J.P. Grossman -// -// Created: 10/16/2003 -// -// Copyright (C) 2003-2016 VMware, Inc. All rights reserved. -- VMware Confidential -// -- VMware Confidential -// -///////////////////////////////////////////////////////////////////////////// - -#ifndef TMULTIMAPITERATOR_H_ -#define TMULTIMAPITERATOR_H_ - -namespace Caf { - -template -class TMultimapIterator -{ -public: - TMultimapIterator () - { - m_iterCurrent = m_iterEnd; - } - - TMultimapIterator (Container &rContainer) - { - m_iterCurrent = rContainer.begin(); - m_iterEnd = rContainer.end(); - } - - TMultimapIterator (const TMultimapIterator &rhs) - { - m_iterCurrent = rhs.m_iterCurrent; - m_iterEnd = rhs.m_iterEnd; - } - - TMultimapIterator &operator= (const TMultimapIterator &rhs) - { - m_iterCurrent = rhs.m_iterCurrent; - m_iterEnd = rhs.m_iterEnd; - return *this; - } - -public: - const KeyType &getKey (void) - { - return m_iterCurrent->first; - } - - ValueType &operator* () - { - return m_iterCurrent->second; - } - - ValueType *operator-> () - { - return &m_iterCurrent->second; - } - - void operator++ () - { - ++m_iterCurrent; - } - - void operator++ (int32) - { - m_iterCurrent++; - } - - operator bool () - { - return (m_iterCurrent != m_iterEnd); - } - -private: - typename Container::iterator m_iterCurrent; - typename Container::iterator m_iterEnd; -}; -} - -#endif /* TMULTIMAPITERATOR_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Collections/Iterators/TSmartConstIterator.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Collections/Iterators/TSmartConstIterator.h deleted file mode 100644 index 4ba03b258..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Collections/Iterators/TSmartConstIterator.h +++ /dev/null @@ -1,88 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// -// Author: J.P. Grossman -// -// Purpose: Variant of TConstIterator that deals with smart pointers -// transparently when the arrow operator is used. ONLY works with -// containers that hold smart pointers. -// -// Created: 10/22/2003 -// -// Copyright (C) 2003-2016 VMware, Inc. All rights reserved. -- VMware Confidential -// -- VMware Confidential -// -///////////////////////////////////////////////////////////////////////////// - -#ifndef TSmartConstIterator_h_ -#define TSmartConstIterator_h_ - -namespace Caf { - -template -class TSmartConstIterator -{ -public: - TSmartConstIterator () - { - m_citerCurrent = m_citerEnd; - } - - TSmartConstIterator (const Container &rcContainer) - { - m_citerCurrent = rcContainer.begin(); - m_citerEnd = rcContainer.end(); - } - - TSmartConstIterator (const TSmartConstIterator &rhs) - { - m_citerCurrent = rhs.m_citerCurrent; - m_citerEnd = rhs.m_citerEnd; - } - - TSmartConstIterator &operator= (const Container &rcContainer) - { - m_citerCurrent = rcContainer.begin(); - m_citerEnd = rcContainer.end(); - return *this; - } - - TSmartConstIterator &operator= (const TSmartConstIterator &rhs) - { - m_citerCurrent = rhs.m_citerCurrent; - m_citerEnd = rhs.m_citerEnd; - return *this; - } - -public: - const SmartPtrType &operator* () - { - return *m_citerCurrent; - } - - const ValueType *operator-> () - { - return m_citerCurrent->operator->(); - } - - void operator++ () - { - ++m_citerCurrent; - } - - void operator++ (int32) - { - m_citerCurrent++; - } - - operator bool () - { - return m_citerCurrent != m_citerEnd; - } - -private: - typename Container::const_iterator m_citerCurrent; - typename Container::const_iterator m_citerEnd; -}; -} - -#endif // #ifndef TSmartConstIterator_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Collections/Iterators/TSmartConstMapIterator.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Collections/Iterators/TSmartConstMapIterator.h deleted file mode 100644 index 947c8b0ff..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Collections/Iterators/TSmartConstMapIterator.h +++ /dev/null @@ -1,91 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// -// Author: J.P. Grossman -// -// Created: 10/22/2003 -// -// Copyright (C) 2003-2016 VMware, Inc. All rights reserved. -- VMware Confidential -// -- VMware Confidential -// -///////////////////////////////////////////////////////////////////////////// - -#ifndef TSmartConstMapIterator_h_ -#define TSmartConstMapIterator_h_ - -namespace Caf { - -template class TSmartConstMultimapIterator; - -template -class TSmartConstMapIterator -{ -public: - TSmartConstMapIterator () - { - m_citerCurrent = m_citerEnd; - } - - TSmartConstMapIterator (const Container &rcContainer) - { - m_citerCurrent = rcContainer.begin(); - m_citerEnd = rcContainer.end(); - } - - TSmartConstMapIterator (const TSmartConstMapIterator &rhs) - { - m_citerCurrent = rhs.m_citerCurrent; - m_citerEnd = rhs.m_citerEnd; - } - - TSmartConstMapIterator &operator= (const Container &rcContainer) - { - m_citerCurrent = rcContainer.begin(); - m_citerEnd = rcContainer.end(); - return *this; - } - - TSmartConstMapIterator &operator= (const TSmartConstMapIterator &rhs) - { - m_citerCurrent = rhs.m_citerCurrent; - m_citerEnd = rhs.m_citerEnd; - return *this; - } - -public: - const SmartPtrType &operator* () - { - return m_citerCurrent->second; - } - - const ValueType *operator-> () - { - return m_citerCurrent->second.operator->(); - } - - void operator++ () - { - ++m_citerCurrent; - } - - void operator++ (int32) - { - m_citerCurrent++; - } - - const KeyType &getKey (void) - { - return m_citerCurrent->first; - } - - operator bool () - { - return m_citerCurrent != m_citerEnd; - } - -private: - typename Container::const_iterator m_citerCurrent; - typename Container::const_iterator m_citerEnd; -}; -} - -#endif // #ifndef TSmartConstMapIterator_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Collections/Iterators/TSmartConstMultimapIterator.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Collections/Iterators/TSmartConstMultimapIterator.h deleted file mode 100644 index ffdd30854..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Collections/Iterators/TSmartConstMultimapIterator.h +++ /dev/null @@ -1,83 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// -// Author: J.P. Grossman -// -// Created: 10/16/2003 -// -// Copyright (C) 2003-2016 VMware, Inc. All rights reserved. -- VMware Confidential -// -- VMware Confidential -// -///////////////////////////////////////////////////////////////////////////// - -#ifndef TSMARTCONSTMULTIMAPITERATOR_H_ -#define TSMARTCONSTMULTIMAPITERATOR_H_ - -namespace Caf { - -template -class TSmartConstMultimapIterator -{ -public: - TSmartConstMultimapIterator () - { - m_citerCurrent = m_citerEnd; - } - - TSmartConstMultimapIterator (const Container &rcContainer) - { - m_citerCurrent = rcContainer.begin(); - m_citerEnd = rcContainer.end(); - } - - TSmartConstMultimapIterator (const TSmartConstMultimapIterator &rhs) - { - m_citerCurrent = rhs.m_citerCurrent; - m_citerEnd = rhs.m_citerEnd; - } - - TSmartConstMultimapIterator &operator= (const TSmartConstMultimapIterator &rhs) - { - m_citerCurrent = rhs.m_citerCurrent; - m_citerEnd = rhs.m_citerEnd; - return *this; - } - -public: - const KeyType &getKey (void) - { - return m_citerCurrent->first; - } - - const SmartPtrType &operator* () - { - return m_citerCurrent->second; - } - - const ValueType *operator-> () - { - return m_citerCurrent->second.operator->(); - } - - void operator++ () - { - ++m_citerCurrent; - } - - void operator++ (int32) - { - m_citerCurrent++; - } - - operator bool () - { - return (m_citerCurrent != m_citerEnd); - } - -private: - typename Container::const_iterator m_citerCurrent; - typename Container::const_iterator m_citerEnd; -}; - -} - -#endif /* TSMARTCONSTMULTIMAPITERATOR_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Collections/Iterators/TSmartIterator.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Collections/Iterators/TSmartIterator.h deleted file mode 100644 index 32aa665e5..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Collections/Iterators/TSmartIterator.h +++ /dev/null @@ -1,84 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// -// Author: J.P. Grossman -// -// Created: 10/16/2003 -// -// Copyright (C) 2003-2016 VMware, Inc. All rights reserved. -- VMware Confidential -// -- VMware Confidential -// -///////////////////////////////////////////////////////////////////////////// - -#ifndef TSmartIterator_h_ -#define TSmartIterator_h_ - -namespace Caf { - -template -class TSmartIterator -{ -public: - TSmartIterator () - { - m_iterCurrent = m_iterEnd; - } - - TSmartIterator (Container &rContainer) - { - m_iterCurrent = rContainer.begin(); - m_iterEnd = rContainer.end(); - } - - TSmartIterator (const TSmartIterator &rhs) - { - m_iterCurrent = rhs.m_iterCurrent; - m_iterEnd = rhs.m_iterEnd; - } - - TSmartIterator &operator= (const Container &rContainer) - { - m_iterCurrent = rContainer.begin(); - m_iterEnd = rContainer.end(); - return *this; - } - - TSmartIterator &operator= (const TSmartIterator &rhs) - { - m_iterCurrent = rhs.m_iterCurrent; - m_iterEnd = rhs.m_iterEnd; - return *this; - } - -public: - SmartPtrType &operator* () - { - return *m_iterCurrent; - } - - ValueType *operator-> () - { - return m_iterCurrent->operator->(); - } - - void operator++ () - { - ++m_iterCurrent; - } - - void operator++ (int32) - { - m_iterCurrent++; - } - - operator bool () - { - return m_iterCurrent != m_iterEnd; - } - -private: - typename Container::iterator m_iterCurrent; - typename Container::iterator m_iterEnd; -}; -} - -#endif // #ifndef TSmartIterator_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Collections/Iterators/TSmartMapIterator.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Collections/Iterators/TSmartMapIterator.h deleted file mode 100644 index 5a9d31b38..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Collections/Iterators/TSmartMapIterator.h +++ /dev/null @@ -1,91 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// -// Author: J.P. Grossman -// -// Created: 10/16/2003 -// -// Copyright (C) 2003-2016 VMware, Inc. All rights reserved. -- VMware Confidential -// -- VMware Confidential -// -///////////////////////////////////////////////////////////////////////////// - -#ifndef TSmartMapIterator_h_ -#define TSmartMapIterator_h_ - -namespace Caf { - -template class TSmartMultimapIterator; - -template -class TSmartMapIterator -{ -public: - TSmartMapIterator () - { - m_iterCurrent = m_iterEnd; - } - - TSmartMapIterator (Container &rContainer) - { - m_iterCurrent = rContainer.begin(); - m_iterEnd = rContainer.end(); - } - - TSmartMapIterator (const TSmartMapIterator &rhs) - { - m_iterCurrent = rhs.m_iterCurrent; - m_iterEnd = rhs.m_iterEnd; - } - - TSmartMapIterator &operator= (const Container &rContainer) - { - m_iterCurrent = rContainer.begin(); - m_iterEnd = rContainer.end(); - return *this; - } - - TSmartMapIterator &operator= (const TSmartMapIterator &rhs) - { - m_iterCurrent = rhs.m_iterCurrent; - m_iterEnd = rhs.m_iterEnd; - return *this; - } - -public: - SmartPtrType &operator* () - { - return m_iterCurrent->second; - } - - ValueType *operator-> () - { - return m_iterCurrent->second.operator->(); - } - - void operator++ () - { - ++m_iterCurrent; - } - - void operator++ (int32) - { - m_iterCurrent++; - } - - const KeyType &getKey (void) - { - return m_iterCurrent->first; - } - - operator bool () - { - return m_iterCurrent != m_iterEnd; - } - -private: - typename Container::iterator m_iterCurrent; - typename Container::iterator m_iterEnd; -}; -} - -#endif // #ifndef TSmartMapIterator_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Collections/Iterators/TSmartMultimapIterator.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Collections/Iterators/TSmartMultimapIterator.h deleted file mode 100644 index 4fc9b87eb..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Collections/Iterators/TSmartMultimapIterator.h +++ /dev/null @@ -1,83 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// -// Author: J.P. Grossman -// -// Created: 10/16/2003 -// -// Copyright (C) 2003-2016 VMware, Inc. All rights reserved. -- VMware Confidential -// -- VMware Confidential -// -///////////////////////////////////////////////////////////////////////////// - -#ifndef TSMARTMULTIMAPITERATOR_H_ -#define TSMARTMULTIMAPITERATOR_H_ - -namespace Caf { - -template -class TSmartMultimapIterator -{ -public: - TSmartMultimapIterator () - { - m_iterCurrent = m_iterEnd; - } - - TSmartMultimapIterator (Container &rContainer) - { - m_iterCurrent = rContainer.begin(); - m_iterEnd = rContainer.end(); - } - - TSmartMultimapIterator (const TSmartMultimapIterator &rhs) - { - m_iterCurrent = rhs.m_iterCurrent; - m_iterEnd = rhs.m_iterEnd; - } - - TSmartMultimapIterator &operator= (const TSmartMultimapIterator &rhs) - { - m_iterCurrent = rhs.m_iterCurrent; - m_iterEnd = rhs.m_iterEnd; - return *this; - } - -public: - const KeyType &getKey (void) - { - return m_iterCurrent->first; - } - - SmartPtrType &operator* () - { - return m_iterCurrent->second; - } - - ValueType *operator-> () - { - return m_iterCurrent->second.operator->(); - } - - void operator++ () - { - ++m_iterCurrent; - } - - void operator++ (int32) - { - m_iterCurrent++; - } - - operator bool () - { - return (m_iterCurrent != m_iterEnd); - } - -private: - typename Container::iterator m_iterCurrent; - typename Container::iterator m_iterEnd; -}; - -} - -#endif /* TSMARTMULTIMAPITERATOR_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/AppConfigUtils.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/AppConfigUtils.cpp deleted file mode 100644 index 1023db251..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/AppConfigUtils.cpp +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Author: bwilliams - * Created: Jan 21, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "Common/IAppConfig.h" -#include "AppConfigUtils.h" - -using namespace Caf; - -std::string AppConfigUtils::getRequiredString( - const std::string& parameterName) { - std::string rc; - getAppConfig()->getGlobalString(parameterName, rc, IConfigParams::PARAM_REQUIRED); - return rc; -} - -uint32 AppConfigUtils::getRequiredUint32( - const std::string& parameterName) { - uint32 rc; - getAppConfig()->getGlobalUint32(parameterName, rc, IConfigParams::PARAM_REQUIRED); - return rc; -} - -int32 AppConfigUtils::getRequiredInt32( - const std::string& parameterName) { - int32 rc; - getAppConfig()->getGlobalInt32(parameterName, rc, IConfigParams::PARAM_REQUIRED); - return rc; -} - -bool AppConfigUtils::getRequiredBoolean( - const std::string& parameterName) { - bool rc; - getAppConfig()->getGlobalBoolean(parameterName, rc, IConfigParams::PARAM_REQUIRED); - return rc; -} - -std::string AppConfigUtils::getOptionalString( - const std::string& parameterName) { - std::string rc; - getAppConfig()->getGlobalString(parameterName, rc, IConfigParams::PARAM_OPTIONAL); - return rc; -} - -uint32 AppConfigUtils::getOptionalUint32( - const std::string& parameterName) { - uint32 rc = 0; - getAppConfig()->getGlobalUint32(parameterName, rc, IConfigParams::PARAM_OPTIONAL); - return rc; -} - -int32 AppConfigUtils::getOptionalInt32( - const std::string& parameterName) { - int32 rc = 0; - getAppConfig()->getGlobalInt32(parameterName, rc, IConfigParams::PARAM_OPTIONAL); - return rc; -} - -bool AppConfigUtils::getOptionalBoolean( - const std::string& parameterName) { - bool rc = false; - getAppConfig()->getGlobalBoolean(parameterName, rc, IConfigParams::PARAM_OPTIONAL); - return rc; -} - -std::string AppConfigUtils::getRequiredString( - const std::string& sectionName, - const std::string& parameterName) { - std::string rc; - getAppConfig()->getString(sectionName, parameterName, rc, IConfigParams::PARAM_REQUIRED); - return rc; -} - -uint32 AppConfigUtils::getRequiredUint32( - const std::string& sectionName, - const std::string& parameterName) { - uint32 rc; - getAppConfig()->getUint32(sectionName, parameterName, rc, IConfigParams::PARAM_REQUIRED); - return rc; -} - -int32 AppConfigUtils::getRequiredInt32( - const std::string& sectionName, - const std::string& parameterName) { - int32 rc; - getAppConfig()->getInt32(sectionName, parameterName, rc, IConfigParams::PARAM_REQUIRED); - return rc; -} - -bool AppConfigUtils::getRequiredBoolean( - const std::string& sectionName, - const std::string& parameterName) { - bool rc; - getAppConfig()->getBoolean(sectionName, parameterName, rc, IConfigParams::PARAM_REQUIRED); - return rc; -} - -std::string AppConfigUtils::getOptionalString( - const std::string& sectionName, - const std::string& parameterName) { - std::string rc; - getAppConfig()->getString(sectionName, parameterName, rc, IConfigParams::PARAM_OPTIONAL); - return rc; -} - -uint32 AppConfigUtils::getOptionalUint32( - const std::string& sectionName, - const std::string& parameterName) { - uint32 rc = 0; - getAppConfig()->getUint32(sectionName, parameterName, rc, IConfigParams::PARAM_OPTIONAL); - return rc; -} - -int32 AppConfigUtils::getOptionalInt32( - const std::string& sectionName, - const std::string& parameterName) { - int32 rc = 0; - getAppConfig()->getInt32(sectionName, parameterName, rc, IConfigParams::PARAM_OPTIONAL); - return rc; -} - -bool AppConfigUtils::getOptionalBoolean( - const std::string& sectionName, - const std::string& parameterName) { - bool rc = false; - getAppConfig()->getBoolean(sectionName, parameterName, rc, IConfigParams::PARAM_OPTIONAL); - return rc; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/AppConfigUtils.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/AppConfigUtils.h deleted file mode 100644 index 68b7746bf..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/AppConfigUtils.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Author: bwilliams - * Created: Jan 21, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef AppConfigUtils_H_ -#define AppConfigUtils_H_ - -namespace Caf { - -namespace AppConfigUtils { - - std::string COMMONAGGREGATOR_LINKAGE getRequiredString(const std::string& parameterName); - uint32 COMMONAGGREGATOR_LINKAGE getRequiredUint32(const std::string& parameterName); - int32 COMMONAGGREGATOR_LINKAGE getRequiredInt32(const std::string& parameterName); - bool COMMONAGGREGATOR_LINKAGE getRequiredBoolean(const std::string& parameterName); - - std::string COMMONAGGREGATOR_LINKAGE getOptionalString(const std::string& parameterName); - uint32 COMMONAGGREGATOR_LINKAGE getOptionalUint32(const std::string& parameterName); - int32 COMMONAGGREGATOR_LINKAGE getOptionalInt32(const std::string& parameterName); - bool COMMONAGGREGATOR_LINKAGE getOptionalBoolean(const std::string& parameterName); - - std::string COMMONAGGREGATOR_LINKAGE getRequiredString( - const std::string& sectionName, - const std::string& parameterName); - uint32 COMMONAGGREGATOR_LINKAGE getRequiredUint32( - const std::string& sectionName, - const std::string& parameterName); - int32 COMMONAGGREGATOR_LINKAGE getRequiredInt32( - const std::string& sectionName, - const std::string& parameterName); - bool COMMONAGGREGATOR_LINKAGE getRequiredBoolean( - const std::string& sectionName, - const std::string& parameterName); - - std::string COMMONAGGREGATOR_LINKAGE getOptionalString( - const std::string& sectionName, - const std::string& parameterName); - uint32 COMMONAGGREGATOR_LINKAGE getOptionalUint32( - const std::string& sectionName, - const std::string& parameterName); - int32 COMMONAGGREGATOR_LINKAGE getOptionalInt32( - const std::string& sectionName, - const std::string& parameterName); - bool COMMONAGGREGATOR_LINKAGE getOptionalBoolean( - const std::string& sectionName, - const std::string& parameterName); -}; - -} - -#endif /* AppConfigUtils_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CAppConfig.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CAppConfig.cpp deleted file mode 100644 index 52641d91d..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CAppConfig.cpp +++ /dev/null @@ -1,1059 +0,0 @@ -/* - * Author: mdonahue - * Created: Jan 19, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Common/CConfigParams.h" -#include "Common/CLoggingUtils.h" -#include "Exception/CCafException.h" -#include "Common/IAppConfigWrite.h" -#include "Common/IAppConfig.h" -#include "Common/IConfigParams.h" -#include "CAppConfig.h" - -using namespace Caf; - -SmartPtrIAppConfig Caf::getAppConfig() { - return CAppConfig::getInstance(); -} - -SmartPtrIAppConfig Caf::getAppConfig(const std::string& configFile) { - return CAppConfig::getInstance(configFile); -} - -SmartPtrIAppConfig Caf::getAppConfig(const Cdeqstr& configFileCollection) { - return CAppConfig::getInstance(configFileCollection); -} - -SmartPtrIAppConfig Caf::getAppConfigAppend(const std::string& configFile) { - return CAppConfig::getInstanceAppend(configFile); -} - -SmartPtrIAppConfig Caf::getAppConfigAppend(const Cdeqstr& configFileCollection) { - return CAppConfig::getInstanceAppend(configFileCollection); -} - -SmartPtrIAppConfigWrite Caf::getAppConfigWrite() { - return CAppConfig::getInstanceWrite(); -} - -SmartPtrIAppConfigWrite Caf::getAppConfigWrite(const std::string& configFile) { - return CAppConfig::getInstanceWrite(configFile); -} - -SmartPtrIAppConfigWrite Caf::getAppConfigWrite(const Cdeqstr& configFileCollection) { - return CAppConfig::getInstanceWrite(configFileCollection); -} - -const char* CAppConfig::_sGlobalsSectionName = "globals"; -GRecMutex CAppConfig::_sOpMutex; -SmartPtrCAppConfig CAppConfig::_sInstance; - -CAppConfig::CAppConfig() : - _isInitialized(false), - _envPattern(NULL), - _varPattern(NULL), - CAF_CM_INIT("CAppConfig") { -} - -CAppConfig::~CAppConfig() { - for (CGlobalReplacements::iterator iter = _globalReplacements.begin(); iter - != _globalReplacements.end(); ++iter) { - g_regex_unref(iter->first); - } - - if (_envPattern) { - g_regex_unref(_envPattern); - } - - if (_varPattern) { - g_regex_unref(_varPattern); - } -} - -void CAppConfig::initialize() { - CAF_CM_FUNCNAME("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - - CAutoMutexLockUnlockRaw oLock(&_sOpMutex); - - std::string appConfigEnv; - CEnvironmentUtils::readEnvironmentVar("CAF_APPCONFIG", appConfigEnv); - - if (appConfigEnv.empty()) { - CAF_CM_EXCEPTION_VA0(ERROR_TAG_NOT_FOUND, "CAF_APPCONFIG env var isn't set."); - } - - const Cdeqstr configFileCollection = CStringUtils::split(appConfigEnv, ';'); - - initialize(configFileCollection); -} - -void CAppConfig::initialize(const std::string& configFile) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(configFile); - - Cdeqstr configFileCollection; - configFileCollection.push_back(configFile); - - initialize(configFileCollection); -} - -void CAppConfig::initialize(const Cdeqstr& configFileCollection) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STL(configFileCollection); - - CAutoMutexLockUnlockRaw oLock(&_sOpMutex); - - for (TConstIterator strIter(configFileCollection); strIter; strIter++) { - const std::string configFile = *strIter; - const std::string configPath = calcConfigPath(configFile); - if (! configPath.empty()) { - _configFileCollection.push_back(configPath); - } - } - - // Add a pattern for environment variable lookup - _envPattern = g_regex_new( - "\\$\\{env\\:(.+)\\}", - (GRegexCompileFlags)(G_REGEX_OPTIMIZE | G_REGEX_UNGREEDY | G_REGEX_RAW), - (GRegexMatchFlags)0, - NULL); - - _varPattern = g_regex_new( - "\\$\\{var\\:(.+)\\}", - (GRegexCompileFlags)(G_REGEX_OPTIMIZE | G_REGEX_UNGREEDY | G_REGEX_RAW), - (GRegexMatchFlags)0, - NULL); - - _globals = internalLoadParameters(_sGlobalsSectionName); - validateGlobals(_globals); - - _isInitialized = true; -} - -void CAppConfig::append(const std::string& configFile) { - CAF_CM_FUNCNAME_VALIDATE("append"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(configFile); - - Cdeqstr configFileCollection; - configFileCollection.push_back(configFile); - - append(configFileCollection); -} - -void CAppConfig::append(const Cdeqstr& configFileCollection) { - CAF_CM_FUNCNAME_VALIDATE("append"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STL(configFileCollection); - - CAutoMutexLockUnlockRaw oLock(&_sOpMutex); - - for (TConstIterator strIter(configFileCollection); strIter; strIter++) { - const std::string configFile = *strIter; - const std::string configPath = calcConfigPath(configFile); - if (! configPath.empty()) { - _configFileCollection.push_back(configPath); - } - } -} - -SmartPtrIConfigParams CAppConfig::getParameters(const std::string& sectionName) { - CAF_CM_FUNCNAME_VALIDATE("getParameters"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(sectionName); - - SmartPtrIConfigParams params; - CAutoMutexLockUnlockRaw oLock(&_sOpMutex); - CParamSections::const_iterator cachedSection = _cachedSections.find(sectionName); - if (_cachedSections.end() == cachedSection) { - if (::strcmp(sectionName.c_str(), _sGlobalsSectionName) == 0) { - params = _globals; - } else { - params = internalLoadParameters(sectionName); - _cachedSections.insert(CParamSections::value_type(sectionName, params)); - } - } else { - params = cachedSection->second; - } - - return params; -} - -bool CAppConfig::getString( - const std::string& sectionName, - const std::string& parameterName, - std::string& value, - const IConfigParams::EParamDisposition disposition) { - CAF_CM_FUNCNAME("getString"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(sectionName); - CAF_CM_VALIDATE_STRING(parameterName); - - bool paramFound = false; - SmartPtrIConfigParams params = getParameters(sectionName); - GVariant* param = params->lookup( - parameterName.c_str(), - IConfigParams::PARAM_OPTIONAL); - if (param) { - if (g_variant_is_of_type(param, G_VARIANT_TYPE_STRING)) { - value = g_variant_get_string(param, NULL); - paramFound = true; - } else { - CAF_CM_EXCEPTION_VA1(DISP_E_TYPEMISMATCH, "%s exists but is not a string.", parameterName.c_str()); - } - } else { - if (IConfigParams::PARAM_REQUIRED == disposition) { - CAF_CM_EXCEPTION_VA2(ERROR_TAG_NOT_FOUND, - "Required config parameter [%s] is missing from section [%s]", - parameterName.c_str(), - sectionName.c_str()); - } - } - - return paramFound; -} - -bool CAppConfig::getUint32( - const std::string& sectionName, - const std::string& parameterName, - uint32& value, - const IConfigParams::EParamDisposition disposition) { - CAF_CM_FUNCNAME("getUint32"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(sectionName); - CAF_CM_VALIDATE_STRING(parameterName); - - bool paramFound = false; - - SmartPtrIConfigParams params = getParameters(sectionName); - GVariant* param = params->lookup( - parameterName.c_str(), - IConfigParams::PARAM_OPTIONAL); - if (param) { - if (g_variant_is_of_type(param, G_VARIANT_TYPE_INT32)) { - value = static_cast(g_variant_get_int32(param)); - paramFound = true; - } else { - std::string valueStr; - getString(sectionName, parameterName, valueStr, disposition); - value = CStringConv::fromString(valueStr); - } - } else { - if (IConfigParams::PARAM_REQUIRED == disposition) { - CAF_CM_EXCEPTION_VA2(ERROR_TAG_NOT_FOUND, - "Required config parameter [%s] is missing from section [%s]", - parameterName.c_str(), - sectionName.c_str()); - } - } - - return paramFound; -} - -bool CAppConfig::getInt32( - const std::string& sectionName, - const std::string& parameterName, - int32& value, - const IConfigParams::EParamDisposition disposition) { - CAF_CM_FUNCNAME("getInt32"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(sectionName); - CAF_CM_VALIDATE_STRING(parameterName); - - bool paramFound = false; - - SmartPtrIConfigParams params = getParameters(sectionName); - GVariant* param = params->lookup( - parameterName.c_str(), - IConfigParams::PARAM_OPTIONAL); - if (param) { - if (g_variant_is_of_type(param, G_VARIANT_TYPE_INT32)) { - value = g_variant_get_int32(param); - paramFound = true; - } else { - std::string valueStr; - getString(sectionName, parameterName, valueStr, disposition); - value = CStringConv::fromString(valueStr); - } - } else { - if (IConfigParams::PARAM_REQUIRED == disposition) { - CAF_CM_EXCEPTION_VA2(ERROR_TAG_NOT_FOUND, - "Required config parameter [%s] is missing from section [%s]", - parameterName.c_str(), - sectionName.c_str()); - } - } - - return paramFound; -} - -bool CAppConfig::getBoolean( - const std::string& sectionName, - const std::string& parameterName, - bool& value, - const IConfigParams::EParamDisposition disposition) { - CAF_CM_FUNCNAME("getBoolean"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(sectionName); - CAF_CM_VALIDATE_STRING(parameterName); - - value = false; - - std::string tmpValue; - bool paramFound = getString( - sectionName, - parameterName, - tmpValue, - IConfigParams::PARAM_OPTIONAL); - - if (paramFound) { - if ("true" == tmpValue) { - value = true; - } else if ("false" == tmpValue) { - value = false; - } else { - CAF_CM_EXCEPTION_VA1(DISP_E_TYPEMISMATCH, "%s exists but is not a boolean (true or false).", parameterName.c_str()); - } - } else { - if (IConfigParams::PARAM_REQUIRED == disposition) { - CAF_CM_EXCEPTION_VA2(ERROR_TAG_NOT_FOUND, - "Required config parameter [%s] is missing from section [%s]", - parameterName.c_str(), - sectionName.c_str()); - } - } - - return paramFound; -} - -bool CAppConfig::getGlobalString( - const std::string& parameterName, - std::string& value, - const IConfigParams::EParamDisposition disposition) { - return getString(_sGlobalsSectionName, parameterName, value, disposition); -} - -bool CAppConfig::getGlobalUint32( - const std::string& parameterName, - uint32& value, - const IConfigParams::EParamDisposition disposition) { - return getUint32(_sGlobalsSectionName, parameterName, value, disposition); -} - -bool CAppConfig::getGlobalInt32( - const std::string& parameterName, - int32& value, - const IConfigParams::EParamDisposition disposition) { - return getInt32(_sGlobalsSectionName, parameterName, value, disposition); -} - -bool CAppConfig::getGlobalBoolean( - const std::string& parameterName, - bool& value, - const IConfigParams::EParamDisposition disposition) { - return getBoolean(_sGlobalsSectionName, parameterName, value, disposition); -} - -void CAppConfig::setString( - const std::string& sectionName, - const std::string& parameterName, - const std::string& value) { - CAF_CM_FUNCNAME_VALIDATE("setString"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(sectionName); - CAF_CM_VALIDATE_STRING(parameterName); - CAF_CM_VALIDATE_STRING(value); - - SmartPtrIConfigParams params = getParameters(sectionName); - params->insert(g_strdup(parameterName.c_str()), g_variant_new_string( - value.c_str())); -} - -void CAppConfig::setUint32( - const std::string& sectionName, - const std::string& parameterName, - const uint32& value) { - CAF_CM_FUNCNAME_VALIDATE("setUint32"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(sectionName); - CAF_CM_VALIDATE_STRING(parameterName); - - SmartPtrIConfigParams params = getParameters(sectionName); - params->insert(g_strdup(parameterName.c_str()), g_variant_new_int32( - value)); -} - -void CAppConfig::setInt32( - const std::string& sectionName, - const std::string& parameterName, - const int32& value) { - CAF_CM_FUNCNAME_VALIDATE("setInt32"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(sectionName); - CAF_CM_VALIDATE_STRING(parameterName); - - SmartPtrIConfigParams params = getParameters(sectionName); - params->insert(g_strdup(parameterName.c_str()), g_variant_new_int32( - value)); -} - -void CAppConfig::setBoolean( - const std::string& sectionName, - const std::string& parameterName, - const bool& value) { - CAF_CM_FUNCNAME_VALIDATE("setBoolean"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(sectionName); - CAF_CM_VALIDATE_STRING(parameterName); - - SmartPtrIConfigParams params = getParameters(sectionName); - params->insert(g_strdup(parameterName.c_str()), g_variant_new_boolean( - value)); -} - -void CAppConfig::setGlobalString( - const std::string& parameterName, - const std::string& value) { - setString(_sGlobalsSectionName, parameterName, value); -} - -void CAppConfig::setGlobalUint32( - const std::string& parameterName, - const uint32& value) { - setUint32(_sGlobalsSectionName, parameterName, value); -} - -void CAppConfig::setGlobalInt32( - const std::string& parameterName, - const int32& value) { - setInt32(_sGlobalsSectionName, parameterName, value); -} - -void CAppConfig::setGlobalBoolean( - const std::string& parameterName, - const bool& value) { - setBoolean(_sGlobalsSectionName, parameterName, value); -} - -std::string CAppConfig::resolveValue(const std::string& value) { - CAF_CM_FUNCNAME("resolveValue"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - std::string rc = value; - GMatchInfo *matchInfo = NULL; - GError* error = NULL; - - try { - if (value.length()) { - gchar *match = NULL; - if (g_regex_match( - _varPattern, - rc.c_str(), - G_REGEX_MATCH_NOTBOL, - &matchInfo)) { - match = g_match_info_fetch(matchInfo, 1); - CAF_CM_VALIDATE_STRINGPTRA(match); - std::string varName(match); - g_free(match); - match = NULL; - size_t pos = varName.find(':', 4); - std::string section = _sGlobalsSectionName; - if (pos != std::string::npos) { - section = varName.substr(0, pos); - varName = varName.substr(pos + 1, varName.length() - pos - 1); - } - - std::string configVal; - bool resolved = false; - // one of these will work - the other two will fail - try { - getString( - section, - varName, - configVal, - IConfigParams::PARAM_REQUIRED); - resolved = true; - } catch (CCafException *ex) { - if (ex->getError() == DISP_E_TYPEMISMATCH) { - ex->Release(); - } else { - throw ex; - } - } - - if (!resolved) { - try { - int32 uval = 0; - getInt32( - section, - varName, - uval, - IConfigParams::PARAM_REQUIRED); - configVal = CStringConv::toString(uval); - resolved = true; - } catch (CCafException *ex) { - if (ex->getError() == DISP_E_TYPEMISMATCH) { - ex->Release(); - } else { - throw ex; - } - } - } - - if (!resolved) { - try { - bool bval = false; - getBoolean( - section, - varName, - bval, - IConfigParams::PARAM_REQUIRED); - configVal = bval ? "true" : "false"; - resolved = true; - } catch (CCafException *ex) { - if (ex->getError() == DISP_E_TYPEMISMATCH) { - ex->Release(); - } else { - throw ex; - } - } - } - - if (!resolved) { - CAF_CM_EXCEPTION_VA1( - ERROR_INVALID_DATA, - "Unable to resolve %s", - value.c_str()); - } - - gchar *replaced = g_regex_replace_literal( - _varPattern, - rc.c_str(), - -1, - 0, - configVal.c_str(), - G_REGEX_MATCH_NOTBOL, - &error); - if (error) { - throw error; - } - rc = replaced; - g_free(replaced); - } - g_match_info_free(matchInfo); - matchInfo = NULL; - - if (g_regex_match( - _envPattern, - rc.c_str(), - G_REGEX_MATCH_NOTBOL, - &matchInfo)) { - match = g_match_info_fetch(matchInfo, 1); - CAF_CM_VALIDATE_STRINGPTRA(match); - std::string envVarName(match); - g_free(match); - match = NULL; - #ifdef WIN32 - char* dupbuf = NULL; - size_t duplen = 0; - errno_t duprc = ::_dupenv_s(&dupbuf, &duplen, envVarName.c_str()); - const std::string dupval(dupbuf && ::strlen(dupbuf) ? dupbuf : ""); - ::free(dupbuf); - dupbuf = NULL; - const char* envVarValue = dupval.c_str(); - #else - const char* envVarValue = ::getenv(envVarName.c_str()); - #endif - - if (envVarValue && ::strlen(envVarValue)) { - gchar* replaced = g_regex_replace_literal( - _envPattern, - rc.c_str(), - -1, - 0, - envVarValue, - G_REGEX_MATCH_NOTBOL, - &error); - if (error) { - throw error; - } - rc = replaced; - g_free(replaced); - } else { - CAF_CM_EXCEPTION_VA1( - ERROR_TAG_NOT_FOUND, - "Referenced environment variable is not set: %s", - envVarName.c_str()); - } - - } - g_match_info_free(matchInfo); - matchInfo = NULL; - } - } - CAF_CM_CATCH_ALL; - if (matchInfo) { - g_match_info_free(matchInfo); - } - CAF_CM_THROWEXCEPTION; - return rc; -} - -SmartPtrIAppConfig CAppConfig::getInstance() { - CAutoMutexLockUnlockRaw oLock(&_sOpMutex); - if (!_sInstance) { - SmartPtrCAppConfig appConfig; - appConfig.CreateInstance(); - appConfig->initialize(); - _sInstance = appConfig; - } - - return _sInstance; -} - -SmartPtrIAppConfig CAppConfig::getInstance(const std::string& configFile) { - CAutoMutexLockUnlockRaw oLock(&_sOpMutex); - _sInstance = NULL; - SmartPtrCAppConfig appConfig; - appConfig.CreateInstance(); - appConfig->initialize(configFile); - _sInstance = appConfig; - - return _sInstance; -} - -SmartPtrIAppConfig CAppConfig::getInstance(const Cdeqstr& configFileCollection) { - CAutoMutexLockUnlockRaw oLock(&_sOpMutex); - _sInstance = NULL; - SmartPtrCAppConfig appConfig; - appConfig.CreateInstance(); - appConfig->initialize(configFileCollection); - _sInstance = appConfig; - - return _sInstance; -} - -SmartPtrIAppConfig CAppConfig::getInstanceAppend( - const std::string& configFile) { - CAF_CM_STATIC_FUNC_VALIDATE("CAppConfig", "getInstanceAppend"); - CAutoMutexLockUnlockRaw oLock(&_sOpMutex); - CAF_CM_VALIDATE_SMARTPTR(_sInstance); - _sInstance->append(configFile); - - return _sInstance; -} - -SmartPtrIAppConfig CAppConfig::getInstanceAppend( - const Cdeqstr& configFileCollection) { - CAF_CM_STATIC_FUNC_VALIDATE("CAppConfig", "getInstanceAppend"); - CAutoMutexLockUnlockRaw oLock(&_sOpMutex); - CAF_CM_VALIDATE_SMARTPTR(_sInstance); - _sInstance->append(configFileCollection); - - return _sInstance; -} - -SmartPtrIAppConfigWrite CAppConfig::getInstanceWrite() { - CAutoMutexLockUnlockRaw oLock(&_sOpMutex); - if (!_sInstance) { - SmartPtrCAppConfig appConfig; - appConfig.CreateInstance(); - appConfig->initialize(); - _sInstance = appConfig; - } - - return _sInstance; -} - -SmartPtrIAppConfigWrite CAppConfig::getInstanceWrite(const std::string& configFile) { - CAutoMutexLockUnlockRaw oLock(&_sOpMutex); - _sInstance = NULL; - SmartPtrCAppConfig appConfig; - appConfig.CreateInstance(); - appConfig->initialize(configFile); - _sInstance = appConfig; - - return _sInstance; -} - -SmartPtrIAppConfigWrite CAppConfig::getInstanceWrite(const Cdeqstr& configFileCollection) { - CAutoMutexLockUnlockRaw oLock(&_sOpMutex); - _sInstance = NULL; - SmartPtrCAppConfig appConfig; - appConfig.CreateInstance(); - appConfig->initialize(configFileCollection); - _sInstance = appConfig; - - return _sInstance; -} - -SmartPtrIConfigParams CAppConfig::internalLoadParameters(const std::string& sectionName) { - CAF_CM_FUNCNAME_VALIDATE("internalLoadParameters"); - CAF_CM_VALIDATE_STRING(sectionName); - - // Always return at least an empty collection - SmartPtrCConfigParams configParams; - configParams.CreateInstance(); - configParams->initialize( - sectionName, - CConfigParams::EKeysManaged, - CConfigParams::EValuesManaged); - - for (TConstIterator strIter(_configFileCollection); strIter; strIter++) { - const std::string configFile = *strIter; - internalLoadParameters(sectionName, configFile, configParams); - } - - return configParams; -} - -void CAppConfig::internalLoadParameters( - const std::string& sectionName, - const std::string& configFileName, - const SmartPtrCConfigParams& configParams) { - CAF_CM_FUNCNAME("internalLoadParameters"); - CAF_CM_VALIDATE_STRING(sectionName); - CAF_CM_VALIDATE_STRING(configFileName); - CAF_CM_VALIDATE_SMARTPTR(configParams); - - GKeyFile* configFile = NULL; - GError* configError = NULL; - gchar** keys = NULL; - gchar* sValue = NULL; - GMatchInfo* matchInfo = NULL; - gchar* match = NULL; - - try { - try { - configFile = g_key_file_new(); - g_key_file_load_from_file( - configFile, - configFileName.c_str(), - G_KEY_FILE_NONE, - &configError); - if (configError) { - throw configError; - } - - gsize numKeys = 0; - keys = g_key_file_get_keys( - configFile, - sectionName.c_str(), - &numKeys, - &configError); - - if (numKeys) { - bool isGlobals = (::strcmp(sectionName.c_str(), _sGlobalsSectionName) - == 0); - - for (gsize idx = 0; idx < numKeys; idx++) { - // There is no way to tell if a value is an integer or string. - // We want to insert the value as either string or int32 so - // try to read the value as an integer. If it cannot be read - // as an integer then insert it as a string. - gint iValue = g_key_file_get_integer( - configFile, - sectionName.c_str(), - keys[idx], - &configError); - if (!configError) { - configParams->insert(g_strdup(keys[idx]), g_variant_new_int32( - iValue)); - - if (isGlobals) { - // create a regular expression to apply against other - // values in other sections - std::string pattern("\\$\\{"); - pattern += keys[idx]; - pattern += "\\}"; - GRegex* regex = g_regex_new( - pattern.c_str(), - (GRegexCompileFlags)(G_REGEX_OPTIMIZE | G_REGEX_UNGREEDY | G_REGEX_RAW), - (GRegexMatchFlags)0, - &configError); - if (configError) { - throw configError; - } - - const std::string iValueStr = CStringConv::toString(iValue); - _globalReplacements.insert(CGlobalReplacements::value_type( - regex, iValueStr)); - } - } else { - if (G_KEY_FILE_ERROR_INVALID_VALUE != configError->code) { - throw configError; - } else { - g_error_free(configError); - configError = NULL; - sValue = g_key_file_get_string( - configFile, - sectionName.c_str(), - keys[idx], - &configError); - if (configError) { - throw configError; - } - - // Check the value to see if it references an environment variable - if (g_regex_match( - _envPattern, - sValue, - G_REGEX_MATCH_NOTBOL, - &matchInfo)) { - // Replace the reference with the env variable value - match = g_match_info_fetch(matchInfo, 1); - if (*match) { - std::string envVarName(match); - g_free(match); - match = NULL; - #ifdef WIN32 - char* dupbuf = NULL; - size_t duplen = 0; - errno_t duprc = ::_dupenv_s(&dupbuf, &duplen, envVarName.c_str()); - const std::string dupval(dupbuf && ::strlen(dupbuf) ? dupbuf : ""); - ::free(dupbuf); - dupbuf = NULL; - const char* envVarValue = dupval.c_str(); - #else - const char* envVarValue = ::getenv(envVarName.c_str()); - #endif - if (envVarValue && ::strlen(envVarValue)) { - gchar* newValue = g_regex_replace_literal( - _envPattern, - sValue, - -1, - 0, - envVarValue, - G_REGEX_MATCH_NOTBOL, - &configError); - if (configError) { - throw configError; - } - - g_free(sValue); - sValue = newValue; - } else { - CAF_CM_EXCEPTION_VA1(ERROR_TAG_NOT_FOUND, - "Referenced environment variable is not set: %s", - envVarName.c_str()); - } - } else { - CAF_CM_EXCEPTION_VA0(ERROR_INTERNAL_ERROR, - "${env:var} matched but subexpression #1 is null."); - } - } - g_match_info_free(matchInfo); - matchInfo = NULL; - - // Replace occurrences of ${global_var_name} with the appropriate global value - for (CGlobalReplacements::const_iterator pattern = - _globalReplacements.begin(); pattern - != _globalReplacements.end(); ++pattern) { - if (g_regex_match( - pattern->first, - sValue, - G_REGEX_MATCH_NOTBOL, - NULL)) { - gchar* newValue = g_regex_replace_literal( - pattern->first, - sValue, - -1, - 0, - pattern->second.c_str(), - G_REGEX_MATCH_NOTBOL, - &configError); - if (configError) { - throw configError; - } - - g_free(sValue); - sValue = newValue; - } - } - - // Add the variable to the collection - configParams->insert(g_strdup(keys[idx]), g_variant_new_string( - sValue)); - - if (isGlobals) { - // create a regular expression to apply against other - // values in other sections - std::string pattern("\\$\\{"); - pattern += keys[idx]; - pattern += "\\}"; - GRegex* regex = g_regex_new( - pattern.c_str(), - (GRegexCompileFlags)(G_REGEX_OPTIMIZE | G_REGEX_UNGREEDY | G_REGEX_RAW), - (GRegexMatchFlags)0, - &configError); - if (configError) { - throw configError; - } - - _globalReplacements.insert(CGlobalReplacements::value_type( - regex, sValue)); - } - } - - g_free(sValue); - sValue = NULL; - } - } - } - } catch (GError *e) { - CAF_CM_EXCEPTION_VA0(e->code, e->message); - } - } catch (CCafException *e) { - _cm_exception_ = e; - } - - if (configFile) { - g_key_file_free(configFile); - } - - if (configError) { - g_error_free(configError); - } - - if (keys) { - g_strfreev(keys); - } - - if (sValue) { - g_free(sValue); - } - - if (matchInfo) { - g_match_info_free(matchInfo); - } - - if (match) { - g_free(match); - } - - if (_cm_exception_) { - throw _cm_exception_; - } -} - -void CAppConfig::validateGlobals(const SmartPtrIConfigParams& globals) { - CAF_CM_FUNCNAME("validateGlobals"); - CAF_CM_VALIDATE_INTERFACE(globals); - - GVariant* log_dir = globals->lookup( - _sAppConfigGlobalParamLogDir, - IConfigParams::PARAM_REQUIRED); - CAF_CM_ASSERT(g_variant_is_of_type(log_dir, G_VARIANT_TYPE_STRING)); - const char* log_dir_val = g_variant_get_string(log_dir, NULL); - CAF_CM_VALIDATE_STRINGPTRA(log_dir_val); - - GVariant* log_file = globals->lookup( - _sAppConfigGlobalParamLogConfigFile, - IConfigParams::PARAM_REQUIRED); - CAF_CM_ASSERT(g_variant_is_of_type(log_file, G_VARIANT_TYPE_STRING)); - const char* log_file_val = g_variant_get_string(log_file, NULL); - CAF_CM_VALIDATE_STRINGPTRA(log_file_val); - CLoggingUtils::setStartupConfigFile(log_file_val); - - GVariant* thread_stack_size_kb = globals->lookup( - _sAppConfigGlobalThreadStackSizeKb, - IConfigParams::PARAM_REQUIRED); - CAF_CM_ASSERT(g_variant_is_of_type(thread_stack_size_kb, G_VARIANT_TYPE_INT32)); -} - -std::string CAppConfig::calcConfigPath( - const std::string& configFile) const { - CAF_CM_FUNCNAME_VALIDATE("calcConfigPath"); - CAF_CM_VALIDATE_STRING(configFile); - - std::string rc; - if (g_file_test(configFile.c_str(), G_FILE_TEST_IS_REGULAR)) { - rc = configFile; - } - - if (rc.empty()) { - const std::string currentConfigPath = calcCurrentConfigPath(configFile); - if (g_file_test(currentConfigPath.c_str(), G_FILE_TEST_IS_REGULAR)) { - rc = currentConfigPath; - } - } - - if (rc.empty()) { - const std::string pmeConfigPath = calcDefaultConfigPath("pme", configFile); - if (g_file_test(pmeConfigPath.c_str(), G_FILE_TEST_IS_REGULAR)) { - rc = pmeConfigPath; - } - } - - if (rc.empty()) { - const std::string clientConfigPath = calcDefaultConfigPath("client", configFile); - if (g_file_test(clientConfigPath.c_str(), G_FILE_TEST_IS_REGULAR)) { - rc = clientConfigPath; - } - } - - return rc; -} - -std::string CAppConfig::calcCurrentConfigPath( - const std::string& configFile) const { - CAF_CM_FUNCNAME_VALIDATE("calcCurrentConfigPath"); - CAF_CM_VALIDATE_STRING(configFile); - - const std::string currentDir = FileSystemUtils::getCurrentDir(); - const std::string configPath = FileSystemUtils::buildPath( - currentDir, configFile); - - return configPath; -} - -std::string CAppConfig::calcDefaultConfigPath( - const std::string& area, - const std::string& configFile) const { - CAF_CM_FUNCNAME_VALIDATE("calcDefaultConfigPath"); - CAF_CM_VALIDATE_STRING(area); - CAF_CM_VALIDATE_STRING(configFile); - - const std::string configDir = calcDefaultConfigDir(area); - const std::string configPath = FileSystemUtils::buildPath( - configDir, configFile); - - return configPath; -} - -#ifdef WIN32 -std::string CAppConfig::calcDefaultConfigDir( - const std::string& area) const { - CAF_CM_FUNCNAME("calcDefaultConfigDir"); - CAF_CM_VALIDATE_STRING(area); - - std::string programData; - CEnvironmentUtils::readEnvironmentVar("ProgramData", programData); - if (programData.empty()) { - CAF_CM_EXCEPTION_VA0(ERROR_TAG_NOT_FOUND, "ProgramData env var isn't set."); - } - - const std::string configDir = FileSystemUtils::buildPath( - programData, "VMware", "VMware CAF", area, "config"); - - return configDir; -} -#else -std::string CAppConfig::calcDefaultConfigDir( - const std::string& area) const { - CAF_CM_FUNCNAME_VALIDATE("calcDefaultConfigDir"); - CAF_CM_VALIDATE_STRING(area); - - const std::string configDir = FileSystemUtils::buildPath( - G_DIR_SEPARATOR_S, "etc", "vmware-caf", area, "config"); - - return configDir; -} -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CAppConfig.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CAppConfig.h deleted file mode 100644 index 4197821d0..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CAppConfig.h +++ /dev/null @@ -1,196 +0,0 @@ -/* - * Author: mdonahue - * Created: Jan 19, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CAPPCONFIG_H_ -#define CAPPCONFIG_H_ - -#include "Common/IConfigParams.h" - -#include "Common/CConfigParams.h" - -#include "Common/IAppConfig.h" -#include "Common/IAppConfigWrite.h" - -namespace Caf { - -CAF_DECLARE_CLASS_AND_SMART_POINTER(CAppConfig); - -class COMMONAGGREGATOR_LINKAGE CAppConfig : - public IAppConfig, - public IAppConfigWrite { -public: // IAppConfig - - SmartPtrIConfigParams getParameters(const std::string& sectionName); - - bool - getString( - const std::string& sectionName, - const std::string& parameterName, - std::string& value, - const IConfigParams::EParamDisposition disposition = - IConfigParams::PARAM_REQUIRED); - - bool - getUint32( - const std::string& sectionName, - const std::string& parameterName, - uint32& value, - const IConfigParams::EParamDisposition disposition = - IConfigParams::PARAM_REQUIRED); - - bool - getInt32( - const std::string& sectionName, - const std::string& parameterName, - int32& value, - const IConfigParams::EParamDisposition disposition = - IConfigParams::PARAM_REQUIRED); - - bool - getBoolean( - const std::string& sectionName, - const std::string& parameterName, - bool& value, - const IConfigParams::EParamDisposition disposition = - IConfigParams::PARAM_REQUIRED); - - bool - getGlobalString( - const std::string& parameterName, - std::string& value, - const IConfigParams::EParamDisposition disposition = - IConfigParams::PARAM_REQUIRED); - - bool - getGlobalUint32( - const std::string& parameterName, - uint32& value, - const IConfigParams::EParamDisposition disposition = - IConfigParams::PARAM_REQUIRED); - - bool - getGlobalInt32( - const std::string& parameterName, - int32& value, - const IConfigParams::EParamDisposition disposition = - IConfigParams::PARAM_REQUIRED); - - bool - getGlobalBoolean( - const std::string& parameterName, - bool& value, - const IConfigParams::EParamDisposition disposition = - IConfigParams::PARAM_REQUIRED); - - std::string resolveValue(const std::string& value); - - static SmartPtrIAppConfig getInstance(); - - static SmartPtrIAppConfig getInstance(const std::string& configFile); - - static SmartPtrIAppConfig getInstance(const Cdeqstr& configFileCollection); - - static SmartPtrIAppConfig getInstanceAppend(const std::string& configFile); - - static SmartPtrIAppConfig getInstanceAppend(const Cdeqstr& configFileCollection); - -public: // IAppConfigWrite - void setString(const std::string& sectionName, - const std::string& parameterName, - const std::string& value); - - void setUint32(const std::string& sectionName, - const std::string& parameterName, - const uint32& value); - - void setInt32(const std::string& sectionName, - const std::string& parameterName, - const int32& value); - - void setBoolean(const std::string& sectionName, - const std::string& parameterName, - const bool& value); - - void setGlobalString(const std::string& parameterName, - const std::string& value); - - void setGlobalUint32(const std::string& parameterName, - const uint32& value); - - void setGlobalInt32(const std::string& parameterName, - const int32& value); - - void setGlobalBoolean(const std::string& parameterName, - const bool& value); - - static SmartPtrIAppConfigWrite getInstanceWrite(); - - static SmartPtrIAppConfigWrite getInstanceWrite(const std::string& configFile); - - static SmartPtrIAppConfigWrite getInstanceWrite(const Cdeqstr& configFileCollection); - -private: - CAppConfig(); - virtual ~CAppConfig(); - -private: - void initialize(); - void initialize(const std::string& configFile); - void initialize(const Cdeqstr& configFileCollection); - - void append(const std::string& configFile); - void append(const Cdeqstr& configFileCollection); - -private: - SmartPtrIConfigParams internalLoadParameters( - const std::string& sectionName); - - void internalLoadParameters( - const std::string& sectionName, - const std::string& configFileName, - const SmartPtrCConfigParams& configParams); - - void validateGlobals(const SmartPtrIConfigParams& globals); - -private: - std::string calcCurrentConfigPath( - const std::string& configFile) const; - - std::string calcConfigPath( - const std::string& configFilename) const; - - std::string calcDefaultConfigPath( - const std::string& area, - const std::string& configFile) const; - - std::string calcDefaultConfigDir( - const std::string& area) const; - -private: - static const char* _sGlobalsSectionName; - static GRecMutex _sOpMutex; - static SmartPtrCAppConfig _sInstance; - bool _isInitialized; - typedef std::map CParamSections; - CParamSections _cachedSections; - typedef std::map CGlobalReplacements; - CGlobalReplacements _globalReplacements; - GRegex* _envPattern; - GRegex* _varPattern; - SmartPtrIConfigParams _globals; - - Cdeqstr _configFileCollection; - -private: - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(CAppConfig); - friend class TCafObject; -}; - -} - -#endif /* CAPPCONFIG_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CApplicationContext.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CApplicationContext.cpp deleted file mode 100644 index 5872e0138..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CApplicationContext.cpp +++ /dev/null @@ -1,498 +0,0 @@ -/* - * Author: bwilliams - * Created: Jul 2009 - * - * Copyright (C) 2009-2018 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include -#include "Common/IAppContext.h" -#include "IBean.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Common/CApplicationContext.h" -#include "Exception/CCafException.h" -#include "Common/IAppConfig.h" - -using namespace Caf; - -CApplicationContext::CApplicationContext(void) : - m_isInitialized(false), - CAF_CM_INIT_LOG("CApplicationContext") { -} - -CApplicationContext::~CApplicationContext(void) { -} - -void CApplicationContext::initialize() { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(m_isInitialized); - - const std::string beanConfigFile = getDefaultBeanConfigFile(); - - Cdeqstr filenameCollection; - filenameCollection.push_front(beanConfigFile); - - initialize(filenameCollection); -} - -void CApplicationContext::initialize(const Cdeqstr& filenameCollection) { - CAF_CM_FUNCNAME("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(m_isInitialized); - CAF_CM_VALIDATE_STL(filenameCollection); - - for (TConstIterator filenameIter(filenameCollection); - filenameIter; filenameIter++) { - const std::string beanConfigFile = *filenameIter; - - parseBeanConfig( - beanConfigFile, - _beanCollection); - } - - CBeanGraph beanGraph; - createBeanGraph( - _beanCollection, - beanGraph, - _beanTopologySort); - - try { - initializeBeans( - _beanCollection, - _beanTopologySort); - } CAF_CM_CATCH_ALL; - - if (CAF_CM_ISEXCEPTION) { - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CCafException *ex = CAF_CM_GETEXCEPTION; - ex->AddRef(); - CAF_CM_CLEAREXCEPTION; - try { - terminateBeans(_beanTopologySort); - } CAF_CM_CATCH_ALL; - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_CLEAREXCEPTION; - _beanTopologySort.clear(); - _beanCollection.clear(); - CAF_CM_GETEXCEPTION = ex; - CAF_CM_THROWEXCEPTION; - } - - m_isInitialized = true; -} - -void CApplicationContext::terminate() { - CAF_CM_FUNCNAME_VALIDATE("terminate"); - CAF_CM_PRECOND_ISINITIALIZED(m_isInitialized); - - terminateBeans(_beanTopologySort); - _beanTopologySort.clear(); - _beanCollection.clear(); - _filenameCollection.clear(); -} - -IAppContext::SmartPtrCBeans CApplicationContext::getBeans() const { - CAF_CM_FUNCNAME_VALIDATE("getBeans"); - CAF_CM_PRECOND_ISINITIALIZED(m_isInitialized); - - SmartPtrCBeans beans; - beans.CreateInstance(); - for (TSmartConstMapIterator beanIter(_beanCollection); - beanIter; beanIter++) { - beans->insert(CBeans::value_type( - beanIter.getKey().c_str(), - beanIter->_bean)); - } - - return beans; -} - -SmartPtrIBean CApplicationContext::getBean(const std::string& beanId) const { - CAF_CM_FUNCNAME("getBean"); - CAF_CM_PRECOND_ISINITIALIZED(m_isInitialized); - CAF_CM_VALIDATE_STRING(beanId); - - CBeanCollection::const_iterator iter = _beanCollection.find(beanId); - if (iter == _beanCollection.end()) { - CAF_CM_EXCEPTIONEX_VA1( - NoSuchElementException, - 0, - "Bean not found - %s", - beanId.c_str()); - } - - CAF_CM_LOG_DEBUG_VA1( - "Bean Found - %s", - beanId.c_str()); - return iter->second->_bean; -} - -std::string CApplicationContext::getDefaultBeanConfigFile() const { - CAF_CM_FUNCNAME("parseBeanConfig"); - - // Get the bean config file - const std::string beanConfigFile = - AppConfigUtils::getRequiredString("bean_config_file"); - if (!FileSystemUtils::doesFileExist(beanConfigFile)) { - CAF_CM_EXCEPTIONEX_VA1( - FileNotFoundException, - 0, - "The bean config file [%s] does not exist.", - beanConfigFile.c_str()); - } - - return beanConfigFile; -} - -void CApplicationContext::parseBeanConfig( - const std::string& beanConfigFile, - CBeanCollection& beanCollection) const { - CAF_CM_FUNCNAME("parseBeanConfig"); - CAF_CM_VALIDATE_STRING(beanConfigFile); - CAF_CM_LOG_DEBUG_VA1("Parsing bean config file %s", beanConfigFile.c_str()); - - // We will look up class references early in the process to fail as early - // as possible and to make logging better. - // Parse the bean config file - CXmlElement::SmartPtrCElementCollection rootElements = - CXmlUtils::parseFile(beanConfigFile, "caf:beans")->getAllChildren(); - for (TSmartConstMultimapIterator rootChild(*rootElements); - rootChild; - rootChild++) { - - // if the child is a bean... - if (rootChild->getName() == "bean") { - // Syntactic sugar - const SmartPtrCXmlElement beanElement = *rootChild; - - // Bean attributes - const std::string beanId = beanElement->findRequiredAttribute("id"); - CAF_CM_LOG_DEBUG_VA1("Parsing bean [id=%s]", beanId.c_str()); - const std::string beanClass = beanElement->findRequiredAttribute("class"); - CAF_CM_LOG_DEBUG_VA2( - "Checking bean class [id=%s][class=%s]", - beanId.c_str(), - beanClass.c_str()); - if (!CEcmSubSystemRegistry::IsRegistered(beanClass)) { - CAF_CM_EXCEPTIONEX_VA3( - NoSuchElementException, - 0, - "Bean class %s is not registered. Fix the AppConfig file. " - "[bean id=%s][bean_config_file=%s]", - beanClass.c_str(), - beanId.c_str(), - beanConfigFile.c_str()); - } - - // get optional constructor args and properties - CBeanCtorArgCollection beanCtorArgs; - Cmapstrstr beanProperties; - CAF_CM_LOG_DEBUG_VA1("Parsing bean ctor args and properties [id=%s]", beanId.c_str()); - CXmlElement::SmartPtrCElementCollection beanElements = beanElement->getAllChildren(); - for (TSmartConstMultimapIterator beanChild(*beanElements); - beanChild; - beanChild++) { - if (beanChild->getName() == "property") { - // Syntactic sugar - const SmartPtrCXmlElement propArgElement = *beanChild; - - // property attributes - const std::string name = propArgElement->findRequiredAttribute("name"); - const std::string value = propArgElement->findRequiredAttribute("value"); - if (!beanProperties.insert(std::make_pair(name, value)).second) { - CAF_CM_EXCEPTIONEX_VA3( - DuplicateElementException, - 0, - "Bean property name is duplicated. " - "[bean id=%s][property name=%s][bean_config_file=%s]", - beanId.c_str(), - name.c_str(), - beanConfigFile.c_str()); - } - } - else if (beanChild->getName() == "constructor-arg") { - // Syntactic sugar - const SmartPtrCXmlElement ctorArgElement = *beanChild; - - // ctor attributes - const uint32 ctorArgIndex = CStringConv::fromString(ctorArgElement->findRequiredAttribute("index")); - CBeanCtorArg::ARG_TYPE ctorArgType = CBeanCtorArg::NOT_SET; - std::string ctorArgValue = ctorArgElement->findOptionalAttribute("value"); - if (ctorArgValue.length() > 0) { - ctorArgType = CBeanCtorArg::VALUE; - } else { - ctorArgValue = ctorArgElement->findOptionalAttribute("ref"); - if (ctorArgValue.length() > 0) { - ctorArgType = CBeanCtorArg::REFERENCE; - } else { - CAF_CM_EXCEPTIONEX_VA2( - InvalidArgumentException, - 0, - "Bean constructor argument must be of type value or ref and cannot be empty. " - "[bean id=%s][bean_config_file=%s]", - beanId.c_str(), - beanConfigFile.c_str()); - } - } - - if (!beanCtorArgs.insert( - CBeanCtorArgCollection::value_type( - ctorArgIndex, - CBeanCtorArg(ctorArgType, ctorArgValue))).second) { - CAF_CM_EXCEPTIONEX_VA3( - DuplicateElementException, - 0, - "Bean has a duplicate constructor-arg index. " - "[bean id=%s][bean_config_file=%s][arg-index=%d]", - beanId.c_str(), - beanConfigFile.c_str(), - ctorArgIndex); - } - CAF_CM_LOG_DEBUG_VA4( - "Bean ctor arg parsed [id=%s][arg-index=%d][arg-type=%s][arg-value=%s]", - beanId.c_str(), - ctorArgIndex, - (CBeanCtorArg::VALUE == ctorArgType ? "VALUE" : "REFERENCE"), - ctorArgValue.c_str()); - } - } - - // Add the bean definition to the collection - SmartPtrCBeanNode beanNode; - beanNode.CreateInstance(); - beanNode->_id = beanId; - beanNode->_class = beanClass; - beanNode->_ctorArgs = beanCtorArgs; - beanNode->_properties = beanProperties; - - if (!beanCollection.insert( - CBeanCollection::value_type( - beanId, - beanNode)).second) { - CAF_CM_EXCEPTIONEX_VA3( - DuplicateElementException, - 0, - "Duplicate bean definition detected. " - "[bean id=%s][bean class=%s][bean_config_file=%s]", - beanId.c_str(), - beanNode->_class.c_str(), - beanConfigFile.c_str()); - } - } - } - - CAF_CM_LOG_DEBUG_VA2( - "Bean configuration file defined %d beans. " - "[file=%s]", - beanCollection.size(), - beanConfigFile.c_str()); -} - -void CApplicationContext::createBeanGraph( - CBeanCollection& beanCollection, - CBeanGraph& beanGraph, - CBeanGraph::ClistVertexEdges& beanTopologySort) const { - CAF_CM_FUNCNAME("createBeanGraph"); - - // Iterate the bean collection and create the beans. They will not be initialized. - // Two name sets will be built: bean names and contstructor-arg ref names. - // These two sets will be compared to ensure that all referenced beans exist. - Csetstr beanNames; - Csetstr beanCtorRefNames; - for (TSmartMapIterator beanIter(beanCollection); - beanIter; - beanIter++) { - - // Create the bean and add it to the collection - CAF_CM_LOG_DEBUG_VA2( - "Creating bean [id=%s][class=%s]", - beanIter.getKey().c_str(), - beanIter->_class.c_str()); - beanIter->_bean.CreateInstance(beanIter->_class.c_str()); - - // Add the bean id to the beanNames set - if (!beanNames.insert(beanIter->_id).second) { - CAF_CM_LOG_DEBUG_VA1( - "Internal logic error: duplicate bean detected. " - "[id=%s]", - beanIter->_id.c_str()); - } - - // Add ref constructor args to the ctor ref name set - for (TConstMapIterator beanCtorArg(beanIter->_ctorArgs); - beanCtorArg; - beanCtorArg++) { - if (CBeanCtorArg::REFERENCE == beanCtorArg->_type) { - beanCtorRefNames.insert(beanCtorArg->_value); - } - } - } - - // Make sure that all beans referenced as ctor args exist - Csetstr beanNameDiff; - std::set_difference( - beanCtorRefNames.begin(), - beanCtorRefNames.end(), - beanNames.begin(), - beanNames.end(), - std::inserter(beanNameDiff, beanNameDiff.end())); - - if (beanNameDiff.size()) { - for (TConstIterator missingName(beanNameDiff); - missingName; - missingName++) { - CAF_CM_LOG_ERROR_VA1( - "No bean definition exists for constructor-arg referenced bean '%s'", - missingName->c_str()); - } - CAF_CM_EXCEPTIONEX_VA0( - NoSuchElementException, - 0, - "One or more bean constructor-args references beans that are not defined."); - } - - // Create a graph node for each bean - for (TSmartConstMapIterator beanIter(beanCollection); - beanIter; - beanIter++) { - beanGraph.addVertex(*beanIter); - } - - // Okay. Now connect the vertices according the constructor-arg references. - // The resulting graph will give us the initialization/tear-down order. - for (TSmartConstMapIterator beanIter(beanCollection); - beanIter; - beanIter++) { - for (TConstMapIterator ctorArg(beanIter->_ctorArgs); - ctorArg; - ctorArg++) { - if (CBeanCtorArg::REFERENCE == ctorArg->_type) { - CBeanCollection::const_iterator ctorBean = beanCollection.find(ctorArg->_value); - if (beanCollection.end() == ctorBean) { - CAF_CM_EXCEPTIONEX_VA1( - NoSuchElementException, - 0, - "Internal error: constructor-arg referenced bean '%s' is missing", - ctorArg->_value.c_str()); - } - beanGraph.addEdge(ctorBean->second, *beanIter); - } - } - } - - // And finally - compute the bean topology sort order - beanTopologySort = beanGraph.topologySort(); - - // Debugging - you will thank me for this later - CAF_CM_LOG_DEBUG_VA0("BEGIN: Bean initialization order") - for (TSmartConstIterator beanNode(beanTopologySort); - beanNode; - beanNode++) { - CAF_CM_LOG_DEBUG_VA1("bean id=%s", beanNode->_id.c_str()); - } - CAF_CM_LOG_DEBUG_VA0("END: Bean initialization order") -} - -void CApplicationContext::initializeBeans( - CBeanCollection& beanCollection, - CBeanGraph::ClistVertexEdges& beanTopologySort) const { - CAF_CM_FUNCNAME("initializeBeans"); - - for (TSmartIterator beanNode(beanTopologySort); - beanNode; - beanNode++) { - CAF_CM_LOG_DEBUG_VA1("Initializing bean %s", beanNode->_id.c_str()); - - // The bean should not have been initialized - if (beanNode->_isInitialized) { - CAF_CM_EXCEPTIONEX_VA1( - IllegalStateException, - 0, - "Internal error: Bean [%s] has already been initialized.", - beanNode->_id.c_str()); - } - - // Iterate the contructor-args and build a collection to - // pass to the bean initializer - IBean::Cargs beanInitArgs; - for (TConstMapIterator ctorArg(beanNode->_ctorArgs); - ctorArg; - ctorArg++) { - switch (ctorArg->_type) { - case CBeanCtorArg::REFERENCE: { - CBeanCollection::const_iterator bean = beanCollection.find(ctorArg->_value); - if (!bean->second->_isInitialized) { - CAF_CM_EXCEPTIONEX_VA2( - NullPointerException, - 0, - "Internal error: Referenced bean not initialized. " - "[bean id=%s][constructor-arg ref=%s]", - beanNode->_id.c_str(), - ctorArg->_value.c_str()); - } - beanInitArgs.push_back(IBean::CArg(bean->second->_bean)); - CAF_CM_LOG_DEBUG_VA1( - "constructor-arg ref=%s", - ctorArg->_value.c_str()); - } - break; - - case CBeanCtorArg::VALUE: - beanInitArgs.push_back(IBean::CArg(ctorArg->_value)); - CAF_CM_LOG_DEBUG_VA1( - "constructor-arg value=%s", - ctorArg->_value.c_str()); - break; - - default: - CAF_CM_EXCEPTIONEX_VA2( - InvalidArgumentException, - 0, - "Internal error: Bean constructor-arg is not a ref or value " - "[bean id=%s][constructor-arg index=%d]", - beanNode->_id.c_str(), - ctorArg.getKey()); - } - } - - // Iterate the bean properties and resolve value references - SmartPtrIAppConfig appConfig = getAppConfig(); - Cmapstrstr properties = beanNode->_properties; - - for (TMapIterator property(properties); - property; - property++) { - *property = appConfig->resolveValue(*property); - } - - // Initialize the bean - beanNode->_bean->initializeBean(beanInitArgs, properties); - beanNode->_isInitialized = true; - } -} - -void CApplicationContext::terminateBeans(CBeanGraph::ClistVertexEdges& beanTopologySort) const { - CAF_CM_FUNCNAME("terminateBeans"); - - // Important! Iterate in reverse order of initialization - // Some beans may not be initialized because of exceptions during init process - for (CBeanGraph::ClistVertexEdges::reverse_iterator beanNode = beanTopologySort.rbegin(); - beanNode != beanTopologySort.rend(); - beanNode++) { - if ((*beanNode)->_isInitialized) { - CAF_CM_LOG_DEBUG_VA1( - "Terminating bean %s", - (*beanNode)->_id.c_str()); - try { - (*beanNode)->_bean->terminateBean(); - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_CLEAREXCEPTION; - } else { - CAF_CM_LOG_DEBUG_VA1( - "Skipping termination of uninitialized bean %s", - (*beanNode)->_id.c_str()); - } - } -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CAutoCondition.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CAutoCondition.cpp deleted file mode 100644 index 942f747d9..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CAutoCondition.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 29, 2014 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Common/CAutoMutex.h" -#include "Common/CAutoCondition.h" - -using namespace Caf; - -CAutoCondition::CAutoCondition() : - _isInitialized (false), - CAF_CM_INIT("CAutoCondition") { - ::g_cond_init(&_condition); -} - -CAutoCondition::~CAutoCondition() { - ::g_cond_clear(&_condition); -} - -void CAutoCondition::initialize(const std::string& name) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - - _name = name; - _isInitialized = true; -} - -bool CAutoCondition::isInitialized() const { - return _isInitialized; -} - -void CAutoCondition::close() { - CAF_CM_FUNCNAME_VALIDATE("close"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - if (_isInitialized) { - ::g_cond_clear(&_condition); - _name.clear(); - _isInitialized = false; - } -} - -std::string CAutoCondition::getName() const { - CAF_CM_FUNCNAME_VALIDATE("getName"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _name; -} - -void CAutoCondition::signal() { - CAF_CM_FUNCNAME_VALIDATE("signal"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - ::g_cond_signal(&_condition); -} - -void CAutoCondition::wait(SmartPtrCAutoMutex& mutex) { - CAF_CM_FUNCNAME_VALIDATE("wait"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_SMARTPTR(mutex); - - ::g_cond_wait(&_condition, mutex->getNonConstPtr()); -} - -bool CAutoCondition::waitUntil(SmartPtrCAutoMutex& mutex, gint64 endTime) { - CAF_CM_FUNCNAME_VALIDATE("waitUntil"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_SMARTPTR(mutex); - - gboolean isSignaled = ::g_cond_wait_until(&_condition, mutex->getNonConstPtr(), endTime); - return (FALSE == isSignaled) ? false : true; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CAutoFileUnlock.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CAutoFileUnlock.cpp deleted file mode 100644 index 0d662f127..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CAutoFileUnlock.cpp +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (C) 2004-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Common/CFileLock.h" -#include "Exception/CCafException.h" -#include "CAutoFileUnlock.h" - -using namespace Caf; - -CAutoFileUnlock::CAutoFileUnlock(SmartPtrCFileLock & rspcManagedLock) -{ - m_spcLock = rspcManagedLock; -} - -CAutoFileUnlock::~CAutoFileUnlock() -{ - CAF_CM_STATIC_FUNC("CAutoFileUnlock", "~CAutoFileUnlock"); - try - { - if (m_spcLock) - { - m_spcLock->setLockLevel(CFileLock::UNLOCK, true); - m_spcLock = 0; - } - } - CAF_CM_CATCH_ALL; - CAF_CM_CLEAREXCEPTION; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CAutoFileUnlock.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CAutoFileUnlock.h deleted file mode 100644 index 54cc32105..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CAutoFileUnlock.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2004-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CAutoFileUnlock_h_ -#define CAutoFileUnlock_h_ - - -#include "Common/CFileLock.h" - -namespace Caf { - -class COMMONAGGREGATOR_LINKAGE CAutoFileUnlock -{ -public: - CAutoFileUnlock(SmartPtrCFileLock & rspcManagedLock); - ~CAutoFileUnlock(); - -private: - SmartPtrCFileLock m_spcLock; - CAF_CM_DECLARE_NOCOPY(CAutoFileUnlock); -}; - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CAutoMutex.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CAutoMutex.cpp deleted file mode 100644 index fa97e94ef..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CAutoMutex.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 29, 2014 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "Common/CAutoMutex.h" - -using namespace Caf; - -CAutoMutex::CAutoMutex() : - _isInitialized(false), - CAF_CM_INIT("CAutoMutex") { -} - -CAutoMutex::~CAutoMutex() { - if (_isInitialized) { - ::g_mutex_clear(&_mutex); - } -} - -void CAutoMutex::initialize() { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - - ::g_mutex_init(&_mutex); - _isInitialized = true; -} - -bool CAutoMutex::isInitialized() const { - return _isInitialized; -} - -void CAutoMutex::lock( - const char* className, - const char* funcName, - const int32 lineNumber) { - CAF_CM_FUNCNAME_VALIDATE("lock"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - -// if ((NULL != className) && (NULL != funcName)) { -// CAF_CM_LOG_DEBUG_VA4("Waiting for lock - %s::%s(%d) - %p", className, funcName, -// lineNumber, &_mutex); -// } - - ::g_mutex_lock(&_mutex); - -// if ((NULL != className) && (NULL != funcName)) { -// CAF_CM_LOG_DEBUG_VA4("Got lock - %s::%s(%d) - %p", className, funcName, lineNumber, -// &_mutex); -// } -} - -void CAutoMutex::unlock( - const char* className, - const char* funcName, - const int32 lineNumber) { - CAF_CM_FUNCNAME_VALIDATE("unlock"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - -// if ((NULL != className) && (NULL != funcName)) { -// CAF_CM_LOG_DEBUG_VA4("Unlocking lock - %s::%s(%d) - %p", className, funcName, -// lineNumber, &_mutex); -// } - - ::g_mutex_unlock(&_mutex); -} - -GMutex* CAutoMutex::getNonConstPtr() { - CAF_CM_FUNCNAME_VALIDATE("getNonConstPtr"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return &_mutex; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CAutoMutexLockUnlock.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CAutoMutexLockUnlock.cpp deleted file mode 100644 index e9f0477d1..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CAutoMutexLockUnlock.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Author: mdonahue - * Created: Jan 20, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Common/CAutoMutex.h" -#include "Common/CAutoRecMutex.h" -#include "CAutoMutexLockUnlock.h" - -using namespace Caf; - -CAutoMutexLockUnlock::CAutoMutexLockUnlock( - SmartPtrCAutoMutex& mutex, - const char* className, - const char* funcName, - const int32 lineNumber) : - _lineNumber(0), - CAF_CM_INIT("CAutoMutexLockUnlock") { - CAF_CM_FUNCNAME_VALIDATE("CAutoMutexLockUnlock"); - CAF_CM_VALIDATE_SMARTPTR(mutex); - - _mutex = mutex; - - if ((NULL != className) && (NULL != funcName)) { - _className = className; - _funcName = funcName; - _lineNumber = lineNumber; - } - - _mutex->lock(className, funcName, lineNumber); -} - -CAutoMutexLockUnlock::CAutoMutexLockUnlock( - SmartPtrCAutoRecMutex& recMutex, - const char* className, - const char* funcName, - const int32 lineNumber) : - _lineNumber(0), - CAF_CM_INIT("CAutoMutexLockUnlock") { - CAF_CM_FUNCNAME_VALIDATE("CAutoMutexLockUnlock"); - CAF_CM_VALIDATE_SMARTPTR(recMutex); - - _recMutex = recMutex; - - if ((NULL != className) && (NULL != funcName)) { - _className = className; - _funcName = funcName; - _lineNumber = lineNumber; - } - - _recMutex->lock(className, funcName, lineNumber); -} - -CAutoMutexLockUnlock::~CAutoMutexLockUnlock() { - if (_className.empty() && _funcName.empty()) { - if (!_mutex.IsNull()) { - _mutex->unlock(); - } - if (!_recMutex.IsNull()) { - _recMutex->unlock(); - } - } else { - if (!_mutex.IsNull()) { - _mutex->unlock(_className.c_str(), _funcName.c_str(), _lineNumber); - } - if (!_recMutex.IsNull()) { - _recMutex->unlock(_className.c_str(), _funcName.c_str(), _lineNumber); - } - } -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CAutoMutexLockUnlock.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CAutoMutexLockUnlock.h deleted file mode 100644 index 4faf2a709..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CAutoMutexLockUnlock.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Author: mdonahue - * Created: Jan 20, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CAUTOMUTEXLOCKUNLOCK_H_ -#define CAUTOMUTEXLOCKUNLOCK_H_ - - -#include "Common/CAutoMutex.h" -#include "Common/CAutoRecMutex.h" - -namespace Caf { - -class COMMONAGGREGATOR_LINKAGE CAutoMutexLockUnlock { -public: - CAutoMutexLockUnlock( - SmartPtrCAutoMutex& mutex, - const char* className = NULL, - const char* funcName = NULL, - const int32 lineNumber = 0); - - CAutoMutexLockUnlock( - SmartPtrCAutoRecMutex& recMutex, - const char* className = NULL, - const char* funcName = NULL, - const int32 lineNumber = 0); - - ~CAutoMutexLockUnlock(); - -private: - SmartPtrCAutoMutex _mutex; - SmartPtrCAutoRecMutex _recMutex; - - std::string _className; - std::string _funcName; - int32 _lineNumber; - -private: - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(CAutoMutexLockUnlock); -}; -} - -#endif /* CAUTOMUTEXLOCKUNLOCK_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CAutoMutexLockUnlockRaw.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CAutoMutexLockUnlockRaw.cpp deleted file mode 100644 index d0d19ce2e..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CAutoMutexLockUnlockRaw.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Author: mdonahue - * Created: Jan 20, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "CAutoMutexLockUnlockRaw.h" - -using namespace Caf; - -CAutoMutexLockUnlockRaw::CAutoMutexLockUnlockRaw(GMutex* mutex) : - CAF_CM_INIT("CAutoMutexLockUnlockRaw") { - _mutex = mutex; - _recMutex = NULL; - - if (_mutex) { - ::g_mutex_lock(_mutex); - } -} - -CAutoMutexLockUnlockRaw::CAutoMutexLockUnlockRaw(GRecMutex* recMutex) : - CAF_CM_INIT("CAutoMutexLockUnlockRaw") { - _mutex = NULL; - _recMutex = recMutex; - - if (_recMutex) { - ::g_rec_mutex_lock(_recMutex); - } -} - -CAutoMutexLockUnlockRaw::~CAutoMutexLockUnlockRaw() { - if (_mutex) { - ::g_mutex_unlock(_mutex); - } - if (_recMutex) { - ::g_rec_mutex_unlock(_recMutex); - } -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CAutoMutexLockUnlockRaw.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CAutoMutexLockUnlockRaw.h deleted file mode 100644 index ba59641de..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CAutoMutexLockUnlockRaw.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Author: mdonahue - * Created: Jan 20, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CAUTOMUTEXLOCKUNLOCKRAW_H_ -#define CAUTOMUTEXLOCKUNLOCKRAW_H_ - -namespace Caf { - -class SUBSYSTEMBASE_LINKAGE CAutoMutexLockUnlockRaw { -public: - CAutoMutexLockUnlockRaw(GMutex* mutex); - - CAutoMutexLockUnlockRaw(GRecMutex* recMutex); - - ~CAutoMutexLockUnlockRaw(); - -private: - GMutex* _mutex; - GRecMutex* _recMutex; - -private: - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(CAutoMutexLockUnlockRaw); -}; - -} - -#endif /* CAUTOMUTEXLOCKUNLOCKRAW_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CAutoMutexUnlockLock.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CAutoMutexUnlockLock.cpp deleted file mode 100644 index 5f696747a..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CAutoMutexUnlockLock.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 21, 2014 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Common/CAutoMutex.h" -#include "Common/CAutoRecMutex.h" -#include "CAutoMutexUnlockLock.h" - -using namespace Caf; - -CAutoMutexUnlockLock::CAutoMutexUnlockLock( - SmartPtrCAutoMutex& mutex, - const char* className, - const char* funcName, - const int32 lineNumber) : - _lineNumber(lineNumber), - CAF_CM_INIT("CAutoMutexUnlockLock") { - CAF_CM_FUNCNAME_VALIDATE("CAutoMutexUnlockLock"); - CAF_CM_VALIDATE_SMARTPTR(mutex); - - _mutex = mutex; - - if ((NULL != className) && (NULL != funcName)) { - _className = className; - _funcName = funcName; - } - - _mutex->unlock(className, funcName, lineNumber); -} - -CAutoMutexUnlockLock::CAutoMutexUnlockLock( - SmartPtrCAutoRecMutex& recMutex, - const char* className, - const char* funcName, - const int32 lineNumber) : - _lineNumber(lineNumber), - CAF_CM_INIT("CAutoMutexUnlockLock") { - CAF_CM_FUNCNAME_VALIDATE("CAutoMutexUnlockLock"); - CAF_CM_VALIDATE_SMARTPTR(recMutex); - - _recMutex = recMutex; - - if ((NULL != className) && (NULL != funcName)) { - _className = className; - _funcName = funcName; - } - - _recMutex->unlock(className, funcName, lineNumber); -} - -CAutoMutexUnlockLock::~CAutoMutexUnlockLock() { - if (_className.empty() && _funcName.empty()) { - if (!_mutex.IsNull()) { - _mutex->lock(); - } - if (!_recMutex.IsNull()) { - _recMutex->lock(); - } - } else { - if (!_mutex.IsNull()) { - _mutex->lock(_className.c_str(), _funcName.c_str(), _lineNumber); - } - if (!_recMutex.IsNull()) { - _recMutex->lock(_className.c_str(), _funcName.c_str(), _lineNumber); - } - } -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CAutoMutexUnlockLock.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CAutoMutexUnlockLock.h deleted file mode 100644 index 9ad5ce175..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CAutoMutexUnlockLock.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 21, 2014 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CAUTOMUTEXUNLOCKLOCK_H_ -#define CAUTOMUTEXUNLOCKLOCK_H_ - - -#include "Common/CAutoMutex.h" -#include "Common/CAutoRecMutex.h" - -namespace Caf { - -class COMMONAGGREGATOR_LINKAGE CAutoMutexUnlockLock { -public: - CAutoMutexUnlockLock( - SmartPtrCAutoMutex& mutex, - const char* className = NULL, - const char* funcName = NULL, - const int32 lineNumber = 0); - - CAutoMutexUnlockLock( - SmartPtrCAutoRecMutex& recMutex, - const char* className = NULL, - const char* funcName = NULL, - const int32 lineNumber = 0); - - ~CAutoMutexUnlockLock(); - -private: - SmartPtrCAutoMutex _mutex; - SmartPtrCAutoRecMutex _recMutex; - - std::string _className; - std::string _funcName; - int32 _lineNumber; - -private: - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(CAutoMutexUnlockLock); -}; -} - -#endif /* CAUTOMUTEXUNLOCKLOCK_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CAutoRecMutex.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CAutoRecMutex.cpp deleted file mode 100644 index 9bc7a3fe2..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CAutoRecMutex.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 29, 2014 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "Common/CAutoRecMutex.h" - -using namespace Caf; - -CAutoRecMutex::CAutoRecMutex() : - _isInitialized(false), - CAF_CM_INIT("CAutoRecMutex") { - ::g_rec_mutex_init(&_mutex); -} - -CAutoRecMutex::~CAutoRecMutex() { - ::g_rec_mutex_clear(&_mutex); -} - -void CAutoRecMutex::initialize() { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - - _isInitialized = true; -} - -bool CAutoRecMutex::isInitialized() const { - return _isInitialized; -} - -void CAutoRecMutex::lock( - const char* className, - const char* funcName, - const int32 lineNumber) { - CAF_CM_FUNCNAME_VALIDATE("lock"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - -// if ((NULL != className) && (NULL != funcName)) { -// CAF_CM_LOG_DEBUG_VA4("Waiting for lock - %s::%s(%d) - %p", className, funcName, -// lineNumber, &_mutex); -// } - - ::g_rec_mutex_lock(&_mutex); - -// if ((NULL != className) && (NULL != funcName)) { -// CAF_CM_LOG_DEBUG_VA4("Got lock - %s::%s(%d) - %p", className, funcName, lineNumber, -// &_mutex); -// } - -} - -void CAutoRecMutex::unlock( - const char* className, - const char* funcName, - const int32 lineNumber) { - CAF_CM_FUNCNAME_VALIDATE("unlock"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - -// if ((NULL != className) && (NULL != funcName)) { -// CAF_CM_LOG_DEBUG_VA4("Unlocking lock - %s::%s(%d) - %p", className, funcName, -// lineNumber, &_mutex); -// } - - ::g_rec_mutex_unlock(&_mutex); -} - -GRecMutex* CAutoRecMutex::getNonConstPtr() { - CAF_CM_FUNCNAME_VALIDATE("getNonConstPtr"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return &_mutex; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CCafRegex.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CCafRegex.cpp deleted file mode 100644 index 4990cf602..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CCafRegex.cpp +++ /dev/null @@ -1,264 +0,0 @@ -/* - * Author: bwilliams - * Created: Jan 21, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "Common/CCafRegex.h" -#include "Exception/CCafException.h" - -using namespace Caf; - -CCafRegex::CCafRegex() : - _isInitialized(false), - _gRegex(NULL), - CAF_CM_INIT_LOG("CCafRegex") { -} - -CCafRegex::~CCafRegex() { - CAF_CM_FUNCNAME("~CCafRegex"); - - try { - if(NULL != _gRegex) { - g_regex_unref(_gRegex); - } - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_CLEAREXCEPTION; -} - -void CCafRegex::initialize(const std::string& regex) { - CAF_CM_FUNCNAME("initialize"); - - GError* gError = NULL; - try { - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(regex); - - _gRegex = g_regex_new( - regex.c_str(), - (GRegexCompileFlags)(G_REGEX_OPTIMIZE | G_REGEX_RAW), - (GRegexMatchFlags)0, - &gError); - if(NULL == _gRegex) { - const std::string errorMessage = (gError == NULL) ? "" : gError->message; - const int32 errorCode = (gError == NULL) ? 0 : gError->code; - CAF_CM_EXCEPTION_VA1(errorCode, "g_regex_new Failed: \"%s\"", errorMessage.c_str()); - } - - if(NULL != gError) { - g_error_free(gError); - } - - _regex = regex; - _isInitialized = true; - } - catch(...) { - if(NULL != gError) { - g_error_free(gError); - } - throw; - } -} - -bool CCafRegex::isMatched(const std::string& source) { - CAF_CM_FUNCNAME_VALIDATE("isMatched"); - - bool rc = false; - GMatchInfo* gMatchInfo = NULL; - - try { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(source); - - gboolean gIsMatch = g_regex_match(_gRegex, source.c_str(), (GRegexMatchFlags)0, &gMatchInfo); - rc = (FALSE == gIsMatch) ? false : true; - - if(NULL != gMatchInfo) { - g_match_info_free(gMatchInfo); - } - } - catch(...) { - if(NULL != gMatchInfo) { - g_match_info_free(gMatchInfo); - } - throw; - } - - return rc; -} - -std::map CCafRegex::matchNames( - const std::string& source, - const std::set& names) { - - CAF_CM_FUNCNAME_VALIDATE("matchNames"); - - std::map rc; - GMatchInfo* gMatchInfo = NULL; - - try { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(source); - CAF_CM_VALIDATE_STL(names); - - gboolean gIsMatch = g_regex_match(_gRegex, source.c_str(), (GRegexMatchFlags)0, &gMatchInfo); - if(GLIB_TRUE == gIsMatch) { - CAF_CM_VALIDATE_PTR(gMatchInfo); - - for(TConstIterator > name(names); name; name++) { - gchar* gString = g_match_info_fetch_named(gMatchInfo, (*name).c_str()); - if(NULL != gString) { - rc.insert(std::make_pair(*name, gString)); - g_free(gString); - } - } - } - - if(NULL != gMatchInfo) { - g_match_info_free(gMatchInfo); - } - } - catch(...) { - if(NULL != gMatchInfo) { - g_match_info_free(gMatchInfo); - } - throw; - } - - return rc; -} - -std::deque CCafRegex::matchName( - const std::string& source, - const std::string& name) { - - CAF_CM_FUNCNAME("matchName"); - - std::deque rc; - GMatchInfo* gMatchInfo = NULL; - GError* gError = NULL; - - try { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(source); - CAF_CM_VALIDATE_STRING(name); - - gboolean gIsMatch = g_regex_match(_gRegex, source.c_str(), (GRegexMatchFlags)0, &gMatchInfo); - if(GLIB_TRUE == gIsMatch) { - CAF_CM_VALIDATE_PTR(gMatchInfo); - - while(g_match_info_matches(gMatchInfo)) { - gchar* gString = g_match_info_fetch_named(gMatchInfo, name.c_str()); - rc.push_back(gString); - g_free(gString); - - g_match_info_next(gMatchInfo, &gError); - if(NULL != gError) { - CAF_CM_EXCEPTION_VA1(gError->code, "g_match_info_next Failed: \"%s\"", gError->message); - } - } - } - - if(NULL != gMatchInfo) { - g_match_info_free(gMatchInfo); - } - } - catch(...) { - if(NULL != gMatchInfo) { - g_match_info_free(gMatchInfo); - } - if(NULL != gError) { - g_error_free(gError); - } - throw; - } - - return rc; -} - -std::string CCafRegex::match( - const std::string& source, - const int32 matchNum) { - - CAF_CM_FUNCNAME_VALIDATE("match"); - - std::string rc; - GMatchInfo* gMatchInfo = NULL; - - try { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(source); - - gboolean gIsMatch = g_regex_match(_gRegex, source.c_str(), (GRegexMatchFlags)0, &gMatchInfo); - if(GLIB_TRUE == gIsMatch) { - CAF_CM_VALIDATE_PTR(gMatchInfo); - - gchar* gString = g_match_info_fetch(gMatchInfo, matchNum); - rc = gString; - g_free(gString); - } - - if(NULL != gMatchInfo) { - g_match_info_free(gMatchInfo); - } - } - catch(...) { - if(NULL != gMatchInfo) { - g_match_info_free(gMatchInfo); - } - } - - return rc; -} - -std::string CCafRegex::replaceLiteral( - const std::string& source, - const std::string& replacement) { - - CAF_CM_FUNCNAME("replaceLiteral"); - - std::string rc; - GError* gError = NULL; - - try { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(source); - CAF_CM_VALIDATE_STRING(replacement); - - gchar* gString = g_regex_replace_literal( - _gRegex, source.c_str(), -1, 0, replacement.c_str(), G_REGEX_MATCH_NOTBOL, &gError); - - if(NULL != gError) { - CAF_CM_EXCEPTION_VA1(gError->code, "g_regex_replace_literal Failed: \"%s\"", gError->message); - } - - rc = gString; - g_free(gString); - } - catch(...) { - if(NULL != gError) { - g_error_free(gError); - } - throw; - } - - return rc; -} - -std::string CCafRegex::replaceLiteral( - const std::string& regex, - const std::string& source, - const std::string& replacement) { - CAF_CM_STATIC_FUNC_VALIDATE("CCafRegex", "replaceLiteral"); - CAF_CM_VALIDATE_STRING(regex); - CAF_CM_VALIDATE_STRING(source); - CAF_CM_VALIDATE_STRING(replacement); - - CCafRegex cafRegex; - cafRegex.initialize(regex); - return cafRegex.replaceLiteral(source, replacement); -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CCmdLineOptions.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CCmdLineOptions.cpp deleted file mode 100644 index e72ab43ed..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CCmdLineOptions.cpp +++ /dev/null @@ -1,253 +0,0 @@ -/* - * Author: bwilliams - * Created: Jul 2009 - * - * Copyright (C) 2009-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "Common/CCmdLineOptions.h" -#include "Exception/CCafException.h" - -using namespace Caf; - -CCmdLineOptions::CCmdLineOptions(void) : - _isInitialized(false), - _optionCnt(0), - _maxOptions(0), - _gOptions(NULL), - CAF_CM_INIT_LOG("CCmdLineOptions") { -} - -CCmdLineOptions::~CCmdLineOptions(void) { - CAF_CM_FUNCNAME("~CCmdLineOptions"); - try { - for(TConstIterator option(_stringOptions); option && (option->second != NULL); option++) { - g_free(option->second); - } - } - CAF_CM_CATCH_ALL - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_CLEAREXCEPTION; -} - -void CCmdLineOptions::initialize( - const std::string& cmdDescription, - const uint32 maxOptions) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(cmdDescription); - CAF_CM_VALIDATE_POSITIVE(maxOptions); - - _cmdDescription = cmdDescription; - _maxOptions = maxOptions; - _gOptions = new GOptionEntry[_maxOptions + 1]; - - _isInitialized = true; - } - CAF_CM_EXIT; -} - -void CCmdLineOptions::addStringOption( - const std::string& longName, - const char shortName, - const std::string& optionDescription) { - CAF_CM_FUNCNAME_VALIDATE("addStringOption"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(longName); - CAF_CM_VALIDATE_STRING(optionDescription); - - checkOptionCnt(longName, _optionCnt, _maxOptions); - populateOption(_gOptions[_optionCnt], longName, shortName, optionDescription); - - _stringOptions.insert(std::make_pair(longName, static_cast(NULL))); - _gOptions[_optionCnt].arg_data = &(_stringOptions.find(longName)->second); - _gOptions[_optionCnt].arg = G_OPTION_ARG_STRING; - - _optionCnt++; - } - CAF_CM_EXIT; -} - -void CCmdLineOptions::addIntOption( - const std::string& longName, - const char shortName, - const std::string& optionDescription) { - CAF_CM_FUNCNAME_VALIDATE("addIntOption"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(longName); - CAF_CM_VALIDATE_STRING(optionDescription); - - checkOptionCnt(longName, _optionCnt, _maxOptions); - populateOption(_gOptions[_optionCnt], longName, shortName, optionDescription); - - _intOptions.insert(std::make_pair(longName, 0)); - _gOptions[_optionCnt].arg_data = &(_intOptions.find(longName)->second); - _gOptions[_optionCnt].arg = G_OPTION_ARG_INT; - - _optionCnt++; - } - CAF_CM_EXIT; -} - -void CCmdLineOptions::addBoolOption( - const std::string& longName, - const char shortName, - const std::string& optionDescription) { - CAF_CM_FUNCNAME_VALIDATE("addBoolOption"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(longName); - CAF_CM_VALIDATE_STRING(optionDescription); - - checkOptionCnt(longName, _optionCnt, _maxOptions); - populateOption(_gOptions[_optionCnt], longName, shortName, optionDescription); - - _boolOptions.insert(std::make_pair(longName, FALSE)); - _gOptions[_optionCnt].arg_data = &(_boolOptions.find(longName)->second); - _gOptions[_optionCnt].arg = G_OPTION_ARG_NONE; - - _optionCnt++; - } - CAF_CM_EXIT; -} - -void CCmdLineOptions::parse( - int32 argc, - char* argv[]) { - CAF_CM_FUNCNAME("parse"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - _gOptions[_optionCnt] = GOptionEntry(); - - GError *gError = NULL; - GOptionContext *gContext = g_option_context_new(_cmdDescription.c_str()); - g_option_context_add_main_entries(gContext, _gOptions, NULL); - if(!g_option_context_parse(gContext, &argc, &argv, &gError)) { - CAF_CM_VALIDATE_PTR(gError); - - const std::string errorMessage = gError->message; - const int32 errorCode = gError->code; - - g_error_free(gError); - g_option_context_free(gContext); - - CAF_CM_EXCEPTION_VA1(errorCode, "option parsing failed: %s", errorMessage.c_str()); - } - - g_option_context_free(gContext); - } - CAF_CM_EXIT; -} - -std::string CCmdLineOptions::findStringOption( - const std::string& longName) { - CAF_CM_FUNCNAME("findStringOption"); - - std::string rc; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(longName); - - CStringOptions::const_iterator iter = _stringOptions.find(longName); - if(iter == _stringOptions.end()) { - CAF_CM_EXCEPTION_VA1(E_FAIL, "String option not found: %s", longName.c_str()); - } - - if(iter->second != NULL) { - rc = iter->second; - } - } - CAF_CM_EXIT; - - return rc; -} - -int32 CCmdLineOptions::findIntOption( - const std::string& longName) { - CAF_CM_FUNCNAME("findIntOption"); - - int32 rc = 0; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(longName); - - CIntOptions::const_iterator iter = _intOptions.find(longName); - if(iter == _intOptions.end()) { - CAF_CM_EXCEPTION_VA1(E_FAIL, "Int option not found: %s", longName.c_str()); - } - - rc = iter->second; - } - CAF_CM_EXIT; - - return rc; -} - -bool CCmdLineOptions::findBoolOption( - const std::string& longName) { - CAF_CM_FUNCNAME("findBoolOption"); - - bool rc = false; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(longName); - - CBoolOptions::const_iterator iter = _boolOptions.find(longName); - if(iter == _boolOptions.end()) { - CAF_CM_EXCEPTION_VA1(E_FAIL, "Bool option not found: %s", longName.c_str()); - } - - rc = iter->second == GLIB_TRUE ? true : false; - } - CAF_CM_EXIT; - - return rc; -} - -void CCmdLineOptions::checkOptionCnt( - const std::string& longName, - const uint32 optionCnt, - const uint32 maxOptions) const { - CAF_CM_FUNCNAME("checkOptionCnt"); - - CAF_CM_ENTER { - if(optionCnt >= maxOptions) { - CAF_CM_EXCEPTION_VA3(E_INVALIDARG, "\"%s\" exceeded the maximum number of allowed options (%d >= %d)", - longName.c_str(), optionCnt, maxOptions); - } - } - CAF_CM_EXIT; -} - -void CCmdLineOptions::populateOption( - GOptionEntry& optionEntry, - const std::string& longName, - const char shortName, - const std::string& optionDescription) { - - CAF_CM_ENTER { - // We can't guarantee that longName's and optionDescription's scopes will be sufficient, so store the strings. - _longNames.push_back(longName); - _optionDescriptions.push_back(optionDescription); - - optionEntry.long_name = _longNames.back().c_str(); - optionEntry.short_name = shortName; - optionEntry.flags = 0; - optionEntry.description = _optionDescriptions.back().c_str(); - optionEntry.arg_description = NULL; - } - CAF_CM_EXIT; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CConfigParams.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CConfigParams.cpp deleted file mode 100644 index 94d53c312..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CConfigParams.cpp +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Author: mdonahue - * Created: Jan 17, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "Common/CConfigParams.h" -#include "Exception/CCafException.h" -#include "Common/IConfigParams.h" - -using namespace Caf; - -CConfigParams::CConfigParams() : - _table(NULL), - CAF_CM_INIT("CConfigParams") { -} - -CConfigParams::~CConfigParams() { - if (_table) - g_hash_table_unref( _table); -} - -void CConfigParams::initialize( - const std::string& sectionName, - EKeyManagement keyManagement, - EValueManagement valueManagement) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - - CAF_CM_ENTER - { - CAF_CM_PRECOND_ISNOTINITIALIZED(_table); - CAF_CM_VALIDATE_STRING(sectionName); - _sectionName = sectionName; - _table = g_hash_table_new_full( - g_str_hash, - g_str_equal, - EKeysManaged == keyManagement ? destroyKeyCallback : NULL, - EValuesManaged == valueManagement ? destroyValueCallback : NULL); - } - CAF_CM_EXIT; -} - -void CConfigParams::insert(const char* key, GVariant* value) { - CAF_CM_FUNCNAME_VALIDATE("insert"); - - CAF_CM_ENTER - { - CAF_CM_PRECOND_ISINITIALIZED(_table); - CAF_CM_VALIDATE_STRINGPTRA(key); - CAF_CM_VALIDATE_PTR(value); - g_hash_table_insert(_table, (void*)key, value); - } - CAF_CM_EXIT; -} - -GVariant* CConfigParams::lookup( - const char* key, - const EParamDisposition disposition) const { - CAF_CM_FUNCNAME("lookup"); - - GVariant* value = NULL; - CAF_CM_ENTER - { - CAF_CM_PRECOND_ISINITIALIZED(_table); - CAF_CM_VALIDATE_STRINGPTRA(key); - value = (GVariant*)g_hash_table_lookup(_table, key); - if (!value && (disposition == PARAM_REQUIRED)) { - CAF_CM_EXCEPTION_VA2( - ERROR_TAG_NOT_FOUND, - "Required config parameter [%s] is missing from section [%s]", - key, - _sectionName.c_str()); - } - } - CAF_CM_EXIT; - - return value; -} - -std::string CConfigParams::getSectionName() const { - CAF_CM_FUNCNAME_VALIDATE("getSectionName"); - CAF_CM_ENTER - { - CAF_CM_PRECOND_ISINITIALIZED(_table); - } - CAF_CM_EXIT; - return _sectionName; -} - -void CConfigParams::destroyKeyCallback(gpointer ptr) { - g_free(ptr); -} - -void CConfigParams::destroyValueCallback(gpointer ptr) { - g_variant_unref((GVariant*)ptr); -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CConfigParamsChain.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CConfigParamsChain.cpp deleted file mode 100644 index 760719103..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CConfigParamsChain.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Author: mdonahue - * Created: Jan 17, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "Common/CConfigParamsChain.h" -#include "Exception/CCafException.h" -#include "Common/IConfigParams.h" - -using namespace Caf; - -CConfigParamsChain::CConfigParamsChain() : - CAF_CM_INIT("CConfigParamsChain") { -} - -CConfigParamsChain::~CConfigParamsChain() { -} - -void CConfigParamsChain::initialize( - CConfigParams::EKeyManagement keyManagement, - CConfigParams::EValueManagement valueManagement, - const SmartPtrIConfigParams& baseParams) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_theseParams); - CAF_CM_VALIDATE_INTERFACE(baseParams); - - _baseParams = baseParams; - _theseParams.CreateInstance(); - _theseParams->initialize( - _baseParams->getSectionName(), - keyManagement, - valueManagement); -} - -void CConfigParamsChain::insert(const char* key, GVariant* value) { - CAF_CM_FUNCNAME_VALIDATE("insert"); - CAF_CM_PRECOND_ISINITIALIZED(_theseParams); - - _theseParams->insert(key, value); -} - -GVariant* CConfigParamsChain::lookup( - const char* key, - const EParamDisposition disposition) const { - CAF_CM_FUNCNAME("lookup"); - CAF_CM_PRECOND_ISINITIALIZED(_theseParams); - - GVariant* value = _theseParams->lookup(key, PARAM_OPTIONAL); - if (!value) { - value = _baseParams->lookup(key, PARAM_OPTIONAL); - } - - if (!value && (disposition == PARAM_REQUIRED)) { - CAF_CM_EXCEPTION_VA2( - ERROR_TAG_NOT_FOUND, - "Required config parameter [%s] is missing from section [%s]", - key, - _baseParams->getSectionName().c_str()); - } - - return value; -} - -std::string CConfigParamsChain::getSectionName() const { - CAF_CM_FUNCNAME_VALIDATE("lookup"); - CAF_CM_PRECOND_ISINITIALIZED(_theseParams); - - return _theseParams->getSectionName(); -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CDaemonUtils.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CDaemonUtils.cpp deleted file mode 100644 index 98f850be7..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CDaemonUtils.cpp +++ /dev/null @@ -1,410 +0,0 @@ -/* - * Author: mdonahue - * Created: Jun 9, 2011 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "Common/CLoggingUtils.h" -#include "CDaemonUtils.h" - -#include -#include -#include -#include -#include -#include - -#ifndef OPEN_MAX -#define OPEN_MAX 256 -#endif - -using namespace Caf; - -extern "C" void DaemonUtilsCrashHandler(int32 sigNum, siginfo_t *info, void *context); - -/////////////////////////////////////////////////////////////////////////////// -// -// MakeDaemon -// This function makes the process a daemon process -// -// NOTE: The following function has numerous coding standard violations that -// cannot be/should not be corrected by CAF common classes and macros. -// -/////////////////////////////////////////////////////////////////////////////// -void CDaemonUtils::MakeDaemon( - int32 argc, - char** argv, - const std::string& procPath, - const std::string& procName, - void(*pfnShutdownHandler)(int32 signalNum), - bool& isDaemonized, - bool& logInfos) { - - const std::string logProcName = procName.empty() ? "CDaemonUtils" : procName; - ::openlog(logProcName.c_str(), LOG_PID, LOG_USER); - ::atexit(::closelog); - ::syslog(LOG_INFO, "Initializing %s", logProcName.c_str()); - - isDaemonized = true; - logInfos = false; - bool enableCrashHandlers = true; - - std::string userName; - std::string groupName; - std::string rootDir; - int32 irc = 0; - while ((irc = ::getopt(argc, argv, "u:g:r:vnc")) != -1) { - switch (irc) { - case 'u': - userName = optarg; - break; - case 'g': - groupName = optarg; - break; - case 'r': - rootDir = optarg; - break; - case 'n': - isDaemonized = false; - break; - case 'c': - enableCrashHandlers = false; - break; - case 'v': - logInfos = true; - break; - default: - ::syslog(LOG_WARNING, "Unknown option '%c', ignoring", irc); - } - } - - if (logInfos) { - ::syslog( - LOG_INFO, - "Got user %s", - userName.empty() ? "" : userName.c_str()); - ::syslog( - LOG_INFO, - "Got group %s", - groupName.empty() ? "" : groupName.c_str()); - } - - if (isDaemonized) { - if (logInfos) { - ::syslog(LOG_INFO, "Daemonizing"); - } - - // This bizarre check is necessary because the console appender writes to stdout - // when a daemon, which messes up the listener some of the file reads - plus, it - // just doesn't make sense for a daemon to write to the console. - if (CLoggingUtils::isConsoleAppenderUsed()) { - ::syslog(LOG_ERR, "Daemon cannot use console appender"); - ::exit(2); - } - - // first fork ourselves off - if (logInfos) { - ::syslog(LOG_INFO, "Daemon forking"); - } - ::closelog(); - - int32 childPid = ::fork(); - if (childPid < 0) { - ::syslog(LOG_ERR, "Cannot fork child - %s", ::strerror(errno)); - ::exit(2); - } else if (childPid > 0) { - ::exit( 0 ); // we're done because we are the parent - } - - // so we are the child - setsid causes this process to be a new - // session leader, process group leader and has no controlling terminal - if (static_cast(-1) == ::setsid()) { - ::syslog( - LOG_ERR, - "Unable to become a session leader - %s", - ::strerror(errno)); - ::exit(2); - } - - // Ignore the signal from this parent terminating - ::signal(SIGHUP, SIG_IGN); - - // and fork again - puts the init process in charge of cleaning us up - childPid = ::fork(); - if (childPid < 0) { - syslog( LOG_ERR, "Cannot fork 2nd child - %s", ::strerror(errno)); - ::exit(2); - } else if (childPid > 0) { - ::exit( 0 ); // we're done because we are the first child - } - - // close any open file descriptors - int32 maxFd = ::sysconf(_SC_OPEN_MAX); - if (maxFd < 0) { - maxFd = OPEN_MAX; - } - - for (int32 fd = 0; fd < maxFd; ++fd) { - ::close(fd); - } - - // and re-open syslog - ::openlog(logProcName.c_str(), LOG_CONS | LOG_PID, LOG_USER); - errno = 0; - } - - // set a signal handler to catch SIGTERM & SIGINT - struct sigaction sigActionInfo; - if (pfnShutdownHandler) { - ::memset(&sigActionInfo, 0, sizeof(struct sigaction)); - sigActionInfo.sa_flags = 0; - sigActionInfo.sa_handler = pfnShutdownHandler; - sigemptyset(&sigActionInfo.sa_mask); - - if (-1 == ::sigaction(SIGTERM, &sigActionInfo, NULL)) { - ::syslog( - LOG_ERR, - "Unable to setup shutdown signal handler - %s", - ::strerror(errno)); - ::exit(2); - } - - if (-1 == ::sigaction(SIGINT, &sigActionInfo, NULL)) - { - ::syslog( - LOG_ERR, - "Unable to setup interrupt signal handler - %s", - ::strerror(errno)); - ::exit(2); - } - } else { - ::syslog(LOG_WARNING, "No shutdown handler function was supplied."); - } - - // ignore any terminal signals - #ifdef SIGTTOU - ::signal(SIGTTOU, SIG_IGN); - #endif - #ifdef SIGTTIN - ::signal(SIGTTIN, SIG_IGN); - #endif - #ifdef SIGTSTP - ::signal(SIGTSTP, SIG_IGN); - #endif - - // set us up as the specified group - if (!groupName.empty()) { - struct group* groupInfo = ::getgrnam(groupName.c_str()); - if (groupInfo) { - if (logInfos) { - ::syslog(LOG_INFO, "Switching to group %d", groupInfo->gr_gid); - } - if (0 != ::setgid(groupInfo->gr_gid)) { - ::syslog( - LOG_ERR, - "Unable to become group %s - %s", - groupName.c_str(), - ::strerror(errno)); - ::exit(2); - } - } else { - ::syslog( - LOG_ERR, - "Unable to find group info for %s - %s", - groupName.c_str(), - ::strerror(errno)); - ::exit(2); - } - } - - // set us up as the specified user - if (!userName.empty()) { - struct passwd * passwdInfo = ::getpwnam(userName.c_str()); - if (passwdInfo) { - if (logInfos) { - ::syslog(LOG_INFO, "Switching to user %d", passwdInfo->pw_uid); - } - if (0 != ::setuid(passwdInfo->pw_uid)) { - ::syslog( - LOG_ERR, - "Unable to become user %s - %s", - userName.c_str(), - ::strerror(errno)); - ::exit(2); - } - } else { - ::syslog( - LOG_ERR, - "Unable to find login info for %s - %s", - userName.c_str(), - ::strerror(errno)); - ::exit(2); - } - } - - // Move the current directory to the specified directory - // to make sure we don't hold a file system open. - if (rootDir.empty()) { - if (logInfos) { - ::syslog(LOG_INFO, "Switching to directory of %s", procPath.c_str()); - } - const char * lastSlash = ::strrchr(procPath.c_str(), '/'); - if (*lastSlash) { - std::string directory = procPath; - directory.erase(directory.rfind('/')); - if (logInfos) { - ::syslog(LOG_INFO, "chdir %s", directory.c_str()); - } - ::chdir(directory.c_str()); - } else { - if (logInfos) { - ::syslog(LOG_INFO, "chdir /"); - } - ::chdir("/"); - } - } else { - if (logInfos) { - ::syslog(LOG_INFO, "Switching to directory %s", rootDir.c_str()); - } - if (-1 == ::chdir(rootDir.c_str())) - { - ::syslog( - LOG_ERR, - "::chdir to %s failed - %s", - rootDir.c_str(), - ::strerror(errno)); - } - } - - // set our umask correctly - disable all world access - if (logInfos) { - ::syslog(LOG_INFO, "umask 0007"); - } - ::umask(0007); - - // boost our open file limit - struct rlimit rlimitInfo; - ::getrlimit(RLIMIT_NOFILE, &rlimitInfo); - if (rlimitInfo.rlim_cur < rlimitInfo.rlim_max) { - if (logInfos) { -#ifdef __x86_64__ - ::syslog( - LOG_INFO, - "rlimit change #files from %lld to %lld", - (long long) rlimitInfo.rlim_cur, - (long long) rlimitInfo.rlim_max); -#else - ::syslog( - LOG_INFO, - "rlimit change #files from %d to %d", - rlimitInfo.rlim_cur, - rlimitInfo.rlim_max); -#endif - } - rlimitInfo.rlim_cur = rlimitInfo.rlim_max; - ::setrlimit(RLIMIT_NOFILE, &rlimitInfo); - } else { - if (logInfos) { -#ifdef __x86_64__ - ::syslog( - LOG_INFO, - "rlimit #files already at maximum of %lld", - (long long) rlimitInfo.rlim_cur); -#else - ::syslog( - LOG_INFO, - "rlimit #files already at maximum of %d", - rlimitInfo.rlim_cur); -#endif - } - } - - if (enableCrashHandlers) - { - // Set up the crash handler - struct sigaction newAction; - struct sigaction oldAction; - ::memset(&newAction, 0, sizeof(struct sigaction)); - ::memset(&oldAction, 0, sizeof(struct sigaction)); - - newAction.sa_sigaction = DaemonUtilsCrashHandler; - newAction.sa_flags = SA_SIGINFO | SA_RESETHAND; - if (sigfillset(&newAction.sa_mask) == -1) { - ::syslog( - LOG_ERR, - "Unable to fill crash handler signal set - %s", - ::strerror(errno)); - } - else if (::sigaction(SIGILL, &newAction, &oldAction) == -1 || - ::sigaction(SIGSEGV, &newAction, &oldAction) == -1 || - ::sigaction(SIGFPE, &newAction, &oldAction) == -1 || - ::sigaction(SIGBUS, &newAction, &oldAction) == -1) - { - ::syslog( - LOG_ERR, - "Unable to set crash handler signal handler %s", - ::strerror(errno)); - } - } - - if (logInfos) - ::syslog(LOG_INFO, "Initialized"); -} - -extern "C" void DaemonUtilsCrashHandler(int32 sigNum, siginfo_t *info, void *context) -{ - CAF_CM_STATIC_FUNC_LOG("CDaemonUtils", "DaemonUtilsCrashHandler"); - - try { - std::string message("Got Signal "); - switch (sigNum) { - case SIGSEGV: - message += "[SEGV"; - break; - case SIGBUS: - message += "[BUS"; - break; - case SIGFPE: - message += "[FPE"; - break; - - case SIGILL: - message += "[ILL"; - break; - - default: - message += - "[UNKNOWN SIGNAL (" + - CStringConv::toString(sigNum) + - ")"; - break; - } - message += " code=" + CStringConv::toString(info->si_code) + "]"; - message += " Fault Addr[" + CStringConv::toString(info->si_addr) + "] "; - -#if defined ( __linux__ ) || defined ( __APPLE__ ) - Dl_info dlInfo; - if (0 != ::dladdr(info->si_addr, &dlInfo)) { - if (dlInfo.dli_fname != NULL) { - message += " Module ["; - message += dlInfo.dli_fname; - } - if (dlInfo.dli_sname != NULL) { - message += " Symbol ["; - message += dlInfo.dli_sname; - } - } -#else - #error "Need to determine if DlInfo is available" -#endif - - ::syslog(LOG_ERR, "%s", message.c_str()); - CAF_CM_LOG_ERROR_VA0(message.c_str()); - } - CAF_CM_CATCH_ALL; - CAF_CM_CLEAREXCEPTION; - ::exit(-1); -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CDaemonUtils.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CDaemonUtils.h deleted file mode 100644 index 73349ee90..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CDaemonUtils.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Author: mdonahue - * Created: Jun 9, 2011 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CDAEMONUTILS_H_ -#define CDAEMONUTILS_H_ - -class CDaemonUtils { -public: - static void MakeDaemon( - int32 argc, - char** argv, - const std::string& procPath, - const std::string& procName, - void(*pfnShutdownHandler)(int32 signalNum), - bool& isDaemonized, - bool& logInfos); - - CAF_CM_DECLARE_NOCREATE(CDaemonUtils); -}; - -#endif /* CDAEMONUTILS_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CDateTimeUtils.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CDateTimeUtils.cpp deleted file mode 100644 index 2bb2e4ec3..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CDateTimeUtils.cpp +++ /dev/null @@ -1,105 +0,0 @@ -/*k - * Author: bwilliams - * Created: Jan 21, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "Exception/CCafException.h" -#ifndef WIN32 -#include -#endif -#include "CDateTimeUtils.h" - -using namespace Caf; - -#ifdef WIN32 -#define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64 - -int32 CDateTimeUtils::getTimeOfDay(struct timeval *tv, struct timezone *tz) { - FILETIME ft; - unsigned __int64 tmpres = 0; - static int32 tzflag; - - if (NULL != tv) - { - ::GetSystemTimeAsFileTime(&ft); - - tmpres |= ft.dwHighDateTime; - tmpres <<= 32; - tmpres |= ft.dwLowDateTime; - - /*converting file time to unix epoch*/ - tmpres -= DELTA_EPOCH_IN_MICROSECS; - tmpres /= 10; /*convert into microseconds*/ - tv->tv_sec = (int32)(tmpres / 1000000UL); - tv->tv_usec = (int32)(tmpres % 1000000UL); - } - - if (NULL != tz) - { - if (!tzflag) - { - _tzset(); - tzflag++; - } - long minuteswest = 0; - ::_get_timezone(&minuteswest); - tz->tz_minuteswest = minuteswest / 60; - int32 dstHours = 0; - ::_get_daylight(&dstHours); - tz->tz_dsttime = dstHours == 0 ? 0 : 1; - } - - return 0; -} -#else -int32 CDateTimeUtils::getTimeOfDay(struct timeval *tv, struct timezone *tz) { - return ::gettimeofday(tv, tz); -} -#endif - -uint64 CDateTimeUtils::getTimeMs() { - CAF_CM_STATIC_FUNC("CDateTimeUtils", "getTimeMs"); - - timeval curTime; - if(-1 == getTimeOfDay(&curTime, NULL)) { - const int32 errorCode = errno; - CAF_CM_EXCEPTION_VA0(errorCode, "getTimeOfDay failed"); - } - - return (curTime.tv_sec * 1000) + (curTime.tv_usec / 1000); -} - -uint64 CDateTimeUtils::calcRemainingTime( - const uint64 begTimeMs, - const uint64 totalMs) { - CAF_CM_STATIC_FUNC_VALIDATE("CDateTimeUtils", "calcRemainingTime"); - - const uint64 diffTimeMs = CDateTimeUtils::getTimeMs() - begTimeMs; - CAF_CM_VALIDATE_NONNEGATIVE_INT64(diffTimeMs); - - uint64 rc = 0; - if(totalMs > diffTimeMs) { - rc = totalMs - diffTimeMs; - } - - return rc; -} - -std::string CDateTimeUtils::getCurrentDateTime() { - time_t now; - ::time(&now); - char buf[sizeof "0000-00-00T00:00:00Z"]; - tm result; -#ifdef WIN32 - ::gmtime_s(&result, &now); - ::strftime(buf, sizeof buf, "%Y-%m-%dT%H:%M:%SZ", &result); -#else - ::gmtime_r(&now, &result); - ::strftime(buf, sizeof buf, "%FT%TZ", &result); -#endif - - return buf; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CDateTimeUtils.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CDateTimeUtils.h deleted file mode 100644 index 57286e883..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CDateTimeUtils.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: Jan 21, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CDateTimeUtils_H_ -#define CDateTimeUtils_H_ - -#ifndef WIN32 -#include -#else -#include -#endif - -namespace Caf { - -class COMMONAGGREGATOR_LINKAGE CDateTimeUtils { -public: - static uint64 getTimeMs(); - - static uint64 calcRemainingTime( - const uint64 begTimeMs, - const uint64 totalMs); - - static int32 getTimeOfDay(struct timeval *tv, struct timezone *tz); - - static std::string getCurrentDateTime(); - -private: - CAF_CM_DECLARE_NOCREATE(CDateTimeUtils); -}; - -} - -#endif /* CDateTimeUtils_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CEnvironmentUtils.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CEnvironmentUtils.cpp deleted file mode 100644 index b8eb9ffc5..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CEnvironmentUtils.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Author: bwilliams - * Created: 10/19/2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "CEnvironmentUtils.h" -using namespace Caf; - - -void CEnvironmentUtils::readEnvironmentVar(const char* varname, std::string& rValue) { - CAF_CM_STATIC_FUNC_VALIDATE("CEnvironmentUtils", "readEnvironmentVar"); - CAF_CM_VALIDATE_PTR(varname); - #ifdef WIN32 - char* dupEnvBuf = NULL; - size_t dupEnvBufLen = 0; - errno_t apiRc = ::_dupenv_s(&dupEnvBuf, &dupEnvBufLen, varname); - rValue = std::string(dupEnvBuf && ::strlen(dupEnvBuf) ? dupEnvBuf : ""); - ::free(dupEnvBuf); - dupEnvBuf = NULL; - #else - const char *prValue = ::getenv(varname); - if (NULL != prValue) { - rValue = prValue; - } - #endif -} - -void CEnvironmentUtils::writeEnvironmentVar(const char* varname, std::string& rValue) { - CAF_CM_STATIC_FUNC_VALIDATE("CEnvironmentUtils", "writeEnvironmentVar"); - CAF_CM_VALIDATE_PTR(varname); - #ifdef WIN32 - std::ostringstream formattedStream; - formattedStream << std::string(varname) << std::string("=") << rValue; - ::_putenv(formattedStream.str().c_str()); - #else - // Not Implemented - #endif -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CEnvironmentUtils.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CEnvironmentUtils.h deleted file mode 100644 index 121affe76..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CEnvironmentUtils.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Author: bwilliams - * Created: 10/19/2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CENVIRONMENTUTILS_H_ -#define CENVIRONMENTUTILS_H_ - -namespace Caf { - -class COMMONAGGREGATOR_LINKAGE CEnvironmentUtils { -public: - - static void readEnvironmentVar(const char* varname, std::string& rValue); - static void writeEnvironmentVar(const char* varname, std::string& rValue); - -private: - CAF_CM_DECLARE_NOCREATE(CEnvironmentUtils); -}; - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CFileLock.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CFileLock.cpp deleted file mode 100644 index c38854f05..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CFileLock.cpp +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright (C) 2004-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "Common/CFileLock.h" -#include "Exception/CCafException.h" -#include -#include -#include -#include - -using namespace Caf; - -//////////////////////////////////////////////////////////////////////// -// -// CFileLock::CFileLock() -// -//////////////////////////////////////////////////////////////////////// -CFileLock::CFileLock() : - CAF_CM_INIT("CFileLock"), - _isInitialized(false), - _isFileDescriptorLocal(false), - _fileDescriptor(-1), - _lockLevel(UNLOCK) { -} - -//////////////////////////////////////////////////////////////////////// -// -// CFileLock::~CFileLock() -// -//////////////////////////////////////////////////////////////////////// -CFileLock::~CFileLock() { - CAF_CM_FUNCNAME("~CFileLock"); - try { - if (_isInitialized) { - setLockLevel(UNLOCK, true); - if (_isFileDescriptorLocal) - ::close(_fileDescriptor); - } - } - CAF_CM_CATCH_ALL; - CAF_CM_CLEAREXCEPTION; -} - -//////////////////////////////////////////////////////////////////////// -// -// CFileLock::Initialize() -// -//////////////////////////////////////////////////////////////////////// -void CFileLock::initialize(int32 iFileDescriptor) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - - _lockLevel = UNLOCK; - _fileDescriptor = iFileDescriptor; - _isFileDescriptorLocal = false; - _isInitialized = true; -} - -//////////////////////////////////////////////////////////////////////// -// -// CFileLock::Initialize() -// -//////////////////////////////////////////////////////////////////////// -void CFileLock::initialize(const char* cszFilename, bool bCreateFile) { - CAF_CM_FUNCNAME("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRINGPTRA(cszFilename); - - int32 iFlags = bCreateFile ? O_RDWR | O_CREAT : O_RDWR; - int32 iFileDescriptor = ::open(cszFilename, iFlags, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP); - - if (-1 != iFileDescriptor) { - _lockLevel = UNLOCK; - _fileDescriptor = iFileDescriptor; - _isFileDescriptorLocal = true; - _isInitialized = true; - } - else { - int32 iRc = errno; - CAF_CM_EXCEPTION_VA1(iRc, "Unable to open file %s", cszFilename); - } -} - -//////////////////////////////////////////////////////////////////////// -// -// CFileLock::GetLockLevel() -// -//////////////////////////////////////////////////////////////////////// -CFileLock::ELockLevel CFileLock::getLockLevel() const { - CAF_CM_FUNCNAME_VALIDATE("getLockLeve"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _lockLevel; -} - -//////////////////////////////////////////////////////////////////////// -// -// CFileLock::SetLockLevel() -// -//////////////////////////////////////////////////////////////////////// -void CFileLock::setLockLevel(ELockLevel eLockLevel, bool bDowngradeLock) { - CAF_CM_FUNCNAME("setLockLeve"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - bool bLockChangeOK = true; - // determine if we are attempting to downgrade an existing lock - if (!bDowngradeLock) { - if (eLockLevel <= _lockLevel) { - bLockChangeOK = false; - } - } - - if (bLockChangeOK && (eLockLevel != _lockLevel)) { - struct flock stFlock; - ::memset(&stFlock, 0, sizeof(stFlock)); - stFlock.l_whence = SEEK_SET; - stFlock.l_start = 0; - stFlock.l_len = 1; - if (SHARED_LOCK == eLockLevel) - stFlock.l_type = F_RDLCK; - else if (EXCLUSIVE_LOCK == eLockLevel) - stFlock.l_type = F_WRLCK; - else - stFlock.l_type = F_UNLCK; - - if (-1 != ::fcntl(_fileDescriptor, F_SETLKW, &stFlock)) { - _lockLevel = eLockLevel; - } - else { - CAF_CM_EXCEPTION_VA0(errno, "Unable to modify lock"); - } - } -} - -//////////////////////////////////////////////////////////////////////// -// -// CFileLock::AttemptSetLockLevel() -// -//////////////////////////////////////////////////////////////////////// -bool CFileLock::attemptSetLockLevel(ELockLevel eLockLevel, bool bDowngradeLock) { - CAF_CM_FUNCNAME("attemptSetLockLeve"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - bool bRet = false; - bool bLockChangeOK = true; - - // determine if we are attempting to downgrade an existing lock - if (!bDowngradeLock) { - if (eLockLevel <= _lockLevel) { - bLockChangeOK = false; - } - } - - if (bLockChangeOK && (eLockLevel != _lockLevel)) { - struct flock stFlock; - ::memset(&stFlock, 0, sizeof(stFlock)); - stFlock.l_whence = SEEK_SET; - stFlock.l_start = 0; - stFlock.l_len = 1; - if (SHARED_LOCK == eLockLevel) - stFlock.l_type = F_RDLCK; - else if (EXCLUSIVE_LOCK == eLockLevel) - stFlock.l_type = F_WRLCK; - else - stFlock.l_type = F_UNLCK; - - if (-1 != ::fcntl(_fileDescriptor, F_SETLK, &stFlock)) { - _lockLevel = eLockLevel; - bRet = true; - } - else if ((EACCES != errno) && (EAGAIN != errno)) { - CAF_CM_EXCEPTION_VA0(errno, "Unable to modify lock"); - } - } - - return bRet; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CFileSystemUtils.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CFileSystemUtils.cpp deleted file mode 100644 index 788a3641c..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CFileSystemUtils.cpp +++ /dev/null @@ -1,1317 +0,0 @@ -/* - * Author: bwilliams - * Created: Jan 21, 2011 - * - * Copyright (C) 2011-2017 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Memory/DynamicArray/DynamicArrayInc.h" -#include "Exception/CCafException.h" -#include "CFileSystemUtils.h" -#include "../Collections/Iterators/IteratorsInc.h" -#ifdef WIN32 - #include -#endif - -#ifdef __linux__ -#include -#include -#endif - -#include -#include - -using namespace Caf; - -const std::string FileSystemUtils::REGEX_MATCH_ALL; - -void FileSystemUtils::createDirectory( - const std::string& path, - const uint32 mode/* = 0770*/) { - CAF_CM_STATIC_FUNC_LOG("FileSystemUtils", "createDirectory"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(path); - - if(doesDirectoryExist(path)) { - CAF_CM_EXCEPTIONEX_VA1( - IllegalStateException, - ERROR_ALREADY_EXISTS, - "Directory exists: %s", - path.c_str()); - } else { - CAF_CM_LOG_DEBUG_VA1("Creating directory - %s", path.c_str()); - int32 rc = g_mkdir_with_parents(path.c_str(), mode); - if(rc < 0) { - rc = errno; - CAF_CM_EXCEPTIONEX_VA1( - IOException, - rc, - "Unable to create directory: %s", - path.c_str()); - } - } - } - CAF_CM_EXIT; -} - -void FileSystemUtils::removeDirectory( - const std::string& path) { - CAF_CM_STATIC_FUNC_LOG("FileSystemUtils", "removeDirectory"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(path); - - if(doesDirectoryExist(path)) { - CAF_CM_LOG_DEBUG_VA1("Removing directory - %s", path.c_str()); - int32 rc = g_rmdir(path.c_str()); - if(rc < 0) { - rc = errno; - CAF_CM_EXCEPTIONEX_VA1( - IOException, - rc, - "Failed to remove directory: %s", - path.c_str()); - } - } else { - CAF_CM_EXCEPTIONEX_VA1( - PathNotFoundException, - 0, - "Directory does not exist: %s", - path.c_str()); - } - } - CAF_CM_EXIT; -} - -void FileSystemUtils::recursiveRemoveDirectory(const std::string& path) { - CAF_CM_STATIC_FUNC("FileSystemUtils", "recursiveRemoveDirectory"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(path); - - if(doesDirectoryExist(path)) { - DirectoryItems items = itemsInDirectory(path, REGEX_MATCH_ALL); - - // Delete subdirs first - for (TConstIterator directory(items.directories); directory; directory++) { - recursiveRemoveDirectory(path + G_DIR_SEPARATOR_S + *directory); - } - - // Delete files - for (TConstIterator file(items.files); file; file++) { - removeFile(path + G_DIR_SEPARATOR_S + *file); - } - - // Delete directory - removeDirectory(path); - } else { - CAF_CM_EXCEPTIONEX_VA1( - PathNotFoundException, - 0, - "Directory does not exist: %s", - path.c_str()); - } - } - CAF_CM_EXIT; -} - -void FileSystemUtils::removeFile( - const std::string& path) { - CAF_CM_STATIC_FUNC_LOG("FileSystemUtils", "removeFile"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(path); - - if(doesFileExist(path)) { - CAF_CM_LOG_DEBUG_VA1("Removing file - %s", path.c_str()); - int32 rc = g_remove(path.c_str()); - if(rc < 0) { - rc = errno; - CAF_CM_EXCEPTIONEX_VA1( - IOException, - rc,"Failed to remove file: %s", - path.c_str()); - } - } else { - CAF_CM_EXCEPTIONEX_VA1( - FileNotFoundException, - 0, - "File does not exist: %s", - path.c_str()); - } - } - CAF_CM_EXIT; -} - -FileSystemUtils::Files FileSystemUtils::removeFilesInDirectory( - const std::string& path, - const std::string& regex) { - CAF_CM_STATIC_FUNC("FileSystemUtils", "removeFilesInDirectory"); - - Files rc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(path); - - if(doesDirectoryExist(path)) { - DirectoryItems items = itemsInDirectory(path, regex); - for (TConstIterator file(items.files); file; file++) { - removeFile(path + G_DIR_SEPARATOR_S + *file); - rc.push_back(*file); - } - } else { - CAF_CM_EXCEPTIONEX_VA1( - PathNotFoundException, - 0, - "Directory does not exist: %s", - path.c_str()); - } - } - CAF_CM_EXIT; - - return rc; -} - -bool FileSystemUtils::doesFileExist( - const std::string& path) { - CAF_CM_STATIC_FUNC_VALIDATE( "FileSystemUtils", "doesFileExist" ); - CAF_CM_VALIDATE_STRING(path); - - return isRegularFile(path); -} - -bool FileSystemUtils::doesDirectoryExist( - const std::string& path) { - - CAF_CM_STATIC_FUNC_LOG_VALIDATE( "FileSystemUtils", "doesDirectoryExist" ); - - bool rc = false; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(path); - - rc = (GLIB_TRUE == g_file_test(path.c_str(), G_FILE_TEST_IS_DIR)); - } - CAF_CM_EXIT; - - return rc; -} - -bool FileSystemUtils::isRegularFile( - const std::string& path) { - - CAF_CM_STATIC_FUNC_VALIDATE( "FileSystemUtils", "isRegularFile" ); - - bool rc = false; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(path); - - // Test to make sure the source is a regular file (or symlink to one), not a directory - rc = (g_file_test(path.c_str(), G_FILE_TEST_IS_REGULAR) == GLIB_TRUE); - } - CAF_CM_EXIT; - - return rc; -} - -std::string FileSystemUtils::getCurrentDir() { - return getDirname(getCurrentFile()); -} - -std::string FileSystemUtils::getCurrentFile() { - std::string fileName; - CEcmDllManager::GetLibraryNameFromHandle(NULL, fileName); - - return fileName; -} - -std::string FileSystemUtils::getBasename( - const std::string& path) { - - CAF_CM_STATIC_FUNC( "FileSystemUtils", "getBasename" ); - - std::string rc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(path); - - gchar* basename = g_path_get_basename(path.c_str()); - if(NULL == basename) { - CAF_CM_EXCEPTION_EFAIL( "g_path_get_basename Failed: " + path); - } - - rc = basename; - g_free(basename); - } - CAF_CM_EXIT; - - return rc; -} - -std::string FileSystemUtils::getDirname( - const std::string& path) { - - CAF_CM_STATIC_FUNC( "FileSystemUtils", "getDirname" ); - - std::string rc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(path); - - gchar* dirname = g_path_get_dirname(path.c_str()); - if(NULL == dirname) { - CAF_CM_EXCEPTION_EFAIL( "g_path_get_dirname Failed: " + path); - } - - rc = dirname; - g_free(dirname); - } - CAF_CM_EXIT; - - return rc; -} - -std::string FileSystemUtils::getTmpDir() { - - CAF_CM_STATIC_FUNC( "FileSystemUtils", "getTmpDir" ); - - std::string rc; - - CAF_CM_ENTER { - const gchar* tmpDir = g_get_tmp_dir(); - if(NULL == tmpDir) { - CAF_CM_EXCEPTION_EFAIL( "g_get_tmp_dir Failed"); - } else { - // Trim trailing slash - rc = tmpDir; - rc.erase(rc.find_last_not_of(G_DIR_SEPARATOR)+1); - } - } - CAF_CM_EXIT; - - return rc; -} - -std::string FileSystemUtils::buildPath( - const std::string& path, - const std::string& newElement) { - - CAF_CM_STATIC_FUNC( "FileSystemUtils", "buildPath" ); - - std::string rc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(path); - CAF_CM_VALIDATE_STRING(newElement); - - gchar* newPath = g_build_filename(path.c_str(), newElement.c_str(), NULL); - if(NULL == newPath) { - CAF_CM_EXCEPTION_VA2(E_FAIL, "g_build_filename Failed: %s, %s", path.c_str(), newElement.c_str()); - } - - rc = normalizePathForPlatform(newPath); - g_free(newPath); - } - CAF_CM_EXIT; - - return rc; -} - -std::string FileSystemUtils::buildPath( - const std::string& path, - const std::string& newElement1, - const std::string& newElement2) { - - CAF_CM_STATIC_FUNC( "FileSystemUtils", "buildPath" ); - - std::string rc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(path); - CAF_CM_VALIDATE_STRING(newElement1); - CAF_CM_VALIDATE_STRING(newElement2); - - gchar* newPath = g_build_filename(path.c_str(), newElement1.c_str(), newElement2.c_str(), NULL); - if(NULL == newPath) { - CAF_CM_EXCEPTION_VA3(E_FAIL, "g_build_filename Failed: %s, %s, %s", path.c_str(), newElement1.c_str(), newElement2.c_str()); - } - - rc = normalizePathForPlatform(newPath); - g_free(newPath); - } - CAF_CM_EXIT; - - return rc; -} - -std::string FileSystemUtils::buildPath( - const std::string& path, - const std::string& newElement1, - const std::string& newElement2, - const std::string& newElement3) { - - CAF_CM_STATIC_FUNC( "FileSystemUtils", "buildPath" ); - - std::string rc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(path); - CAF_CM_VALIDATE_STRING(newElement1); - CAF_CM_VALIDATE_STRING(newElement2); - CAF_CM_VALIDATE_STRING(newElement3); - - gchar* newPath = g_build_filename( - path.c_str(), newElement1.c_str(), newElement2.c_str(), newElement3.c_str(), NULL); - if(NULL == newPath) { - CAF_CM_EXCEPTION_VA4(E_FAIL, - "g_build_filename Failed: %s, %s, %s, %s", - path.c_str(), newElement1.c_str(), newElement2.c_str(), newElement3.c_str()); - } - - rc = normalizePathForPlatform(newPath); - g_free(newPath); - } - CAF_CM_EXIT; - - return rc; -} - -std::string FileSystemUtils::buildPath( - const std::string& path, - const std::string& newElement1, - const std::string& newElement2, - const std::string& newElement3, - const std::string& newElement4) { - - CAF_CM_STATIC_FUNC( "FileSystemUtils", "buildPath" ); - - std::string rc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(path); - CAF_CM_VALIDATE_STRING(newElement1); - CAF_CM_VALIDATE_STRING(newElement2); - CAF_CM_VALIDATE_STRING(newElement3); - CAF_CM_VALIDATE_STRING(newElement4); - - gchar* newPath = g_build_filename( - path.c_str(), newElement1.c_str(), newElement2.c_str(), newElement3.c_str(), newElement4.c_str(), NULL); - if(NULL == newPath) { - CAF_CM_EXCEPTION_VA5(E_FAIL, - "g_build_filename Failed: %s, %s, %s, %s, %s", - path.c_str(), newElement1.c_str(), newElement2.c_str(), newElement3.c_str(), newElement4.c_str()); - } - - rc = normalizePathForPlatform(newPath); - g_free(newPath); - } - CAF_CM_EXIT; - - return rc; -} - -std::string FileSystemUtils::loadTextFile( - const std::string& path) { - CAF_CM_STATIC_FUNC( "FileSystemUtils", "loadTextFile" ); - - std::string rc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(path); - - // Throw an exception if the file doesn't exist. - if (!doesFileExist(path)) { - CAF_CM_EXCEPTIONEX_VA1( - FileNotFoundException, - 0, - "The file '%s' does not exist.", - path.c_str()); - } - - // Read in the contents of the file. Since this is a text file, it's terminated with NULL - // so we needn't pass the length. - GError *gError = NULL; - gchar *fileContents = NULL; - const bool isSuccessful = g_file_get_contents(path.c_str(), &fileContents, NULL, &gError); - - // If the call wasn't successful, throw an exception with the error information. - if(! isSuccessful) { - CAF_CM_VALIDATE_PTR(gError); - - const std::string errorMessage = gError->message; - const int32 errorCode = gError->code; - - g_error_free(gError); - - CAF_CM_EXCEPTIONEX_VA2( - IOException, - errorCode, - "g_file_get_contents Failed: %s File: %s", - errorMessage.c_str(), - path.c_str()); - } - - if (fileContents && ::strlen(fileContents)) { - rc = fileContents; - } - g_free(fileContents); - } - CAF_CM_EXIT; - - return rc; -} - -Cdeqstr FileSystemUtils::loadTextFileIntoColl( - const std::string& path) { - CAF_CM_STATIC_FUNC("FileSystemUtils", "loadTextFileIntoColl"); - CAF_CM_VALIDATE_STRING(path); - - // Throw an exception if the file doesn't exist. - if (!doesFileExist(path)) { - CAF_CM_EXCEPTIONEX_VA1( - FileNotFoundException, - 0, - "The file '%s' does not exist.", - path.c_str()); - } - - std::ifstream fileStream(path.c_str()); - if (! fileStream.is_open()) { - CAF_CM_EXCEPTION_VA1(E_UNEXPECTED, - "Error opening file - %s", path.c_str()); - } - - Cdeqstr rc; - std::string line; - while(std::getline(fileStream, line)) { - rc.push_back(line); - } - - if (fileStream.bad()) { - CAF_CM_EXCEPTION_VA1(E_UNEXPECTED, - "Error reading file - %s", path.c_str()); - } - - return rc; -} - -SmartPtrCDynamicByteArray FileSystemUtils::loadByteFile( - const std::string& path) { - CAF_CM_STATIC_FUNC("FileSystemUtils", "loadByteFile"); - - SmartPtrCDynamicByteArray rc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(path); - - // Throw an exception if the file doesn't exist. - if (!doesFileExist(path)) { - CAF_CM_EXCEPTIONEX_VA1( - FileNotFoundException, - 0, - "The file '%s' does not exist.", - path.c_str()); - } - - // Read in the contents of the file. Since this is a text file, it's terminated with NULL - // so we needn't pass the length. - GError *gError = NULL; - gchar *fileContents = NULL; - gsize fileContentsLen = 0; - const bool isSuccessful = g_file_get_contents( - path.c_str(), &fileContents, &fileContentsLen, &gError); - - // If the call wasn't successful, throw an exception with the error information. - if(! isSuccessful) { - CAF_CM_VALIDATE_PTR(gError); - - const std::string errorMessage = gError->message; - const int32 errorCode = gError->code; - - g_error_free(gError); - - CAF_CM_EXCEPTIONEX_VA2( - IOException, - errorCode, - "g_file_get_contents Failed: %s File: %s", - errorMessage.c_str(), - path.c_str()); - } - - if (fileContents && fileContentsLen) { - rc.CreateInstance(); - rc->allocateBytes(static_cast(fileContentsLen)); - rc->memCpy(fileContents, static_cast(fileContentsLen)); - } - g_free(fileContents); - } - CAF_CM_EXIT; - - return rc; -} - -void FileSystemUtils::saveTextFile( - const std::string& outputDir, - const std::string& filename, - const std::string& contents, - const FILE_MODE_TYPE fileMode/* = FILE_MODE_REPLACE*/, - const std::string temporaryFileSuffix/* = ".tmp"*/) { - CAF_CM_STATIC_FUNC_VALIDATE("FileSystemUtils", "saveTextFile"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(outputDir); - CAF_CM_VALIDATE_STRING(filename); - CAF_CM_VALIDATE_STRING(contents); - - const std::string filePath = buildPath(outputDir, filename); - saveTextFile(filePath, contents, fileMode, temporaryFileSuffix); - } - CAF_CM_EXIT; -} - -void FileSystemUtils::saveTextFile( - const std::string& filePath, - const std::string& contents, - const FILE_MODE_TYPE fileMode/* = FILE_MODE_REPLACE*/, - const std::string temporaryFileSuffix/* = ".tmp"*/) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("FileSystemUtils", "saveTextFile"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(filePath); - CAF_CM_VALIDATE_STRING(contents); - - saveByteFile(filePath, reinterpret_cast(contents.c_str()), - contents.length(), fileMode, temporaryFileSuffix); - } - CAF_CM_EXIT; -} - -void FileSystemUtils::saveByteFile( - const std::string& filePath, - const SmartPtrCDynamicByteArray& contents, - const FILE_MODE_TYPE fileMode/* = FILE_MODE_REPLACE*/, - const std::string temporaryFileSuffix/* = ".tmp"*/) { - CAF_CM_STATIC_FUNC_VALIDATE("FileSystemUtils", "saveByteFile"); - CAF_CM_VALIDATE_STRING(filePath); - CAF_CM_VALIDATE_SMARTPTR(contents); - // temporaryFileSuffix is optional - - saveByteFile(filePath, contents->getPtr(), contents->getByteCount(), - fileMode, temporaryFileSuffix); -} - -void FileSystemUtils::saveByteFile( - const std::string& filePath, - const byte* contents, - const size_t& contentsLen, - const FILE_MODE_TYPE fileMode/* = FILE_MODE_REPLACE*/, - const std::string temporaryFileSuffix/* = ".tmp"*/) { - CAF_CM_STATIC_FUNC_LOG("FileSystemUtils", "saveByteFile"); - CAF_CM_VALIDATE_STRING(filePath); - CAF_CM_VALIDATE_PTR(contents); - // temporaryFileSuffix is optional - - const std::string fileDir = getDirname(filePath); - if (! doesDirectoryExist(fileDir)) { - createDirectory(fileDir); - } - - bool fileExists = doesFileExist(filePath); - switch (fileMode) { - case FILE_MODE_REPLACE: - if (fileExists) { - CAF_CM_LOG_DEBUG_VA1("Replacing file - %s", filePath.c_str()); - } - saveFileSafely(filePath, contents, contentsLen, temporaryFileSuffix); - break; - case FILE_MODE_IGNORE: - if (fileExists) { - CAF_CM_LOG_WARN_VA1("Ignoring file - %s", filePath.c_str()); - } else { - saveFileSafely(filePath, contents, contentsLen, temporaryFileSuffix); - } - break; - case FILE_MODE_FAIL: - if (fileExists) { - CAF_CM_EXCEPTION_VA1(ERROR_FILE_EXISTS, "File exists - %s", - filePath.c_str()); - } - saveFileSafely(filePath, contents, contentsLen, temporaryFileSuffix); - break; - } -} - -void FileSystemUtils::saveFileSafely( - const std::string& filePath, - const byte* contents, - const size_t& contentsLen, - const std::string& temporaryFileSuffix) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("FileSystemUtils", "saveFileSafely"); - CAF_CM_VALIDATE_STRING(filePath); - CAF_CM_VALIDATE_PTR(contents); - // temporaryFileSuffix is optional - - CAF_CM_LOG_DEBUG_VA1("Saving to file - %s", filePath.c_str()); - - if (temporaryFileSuffix.empty()) { - saveByteFileRaw(filePath, contents, contentsLen); - } else { - const std::string filePathTmp = filePath + temporaryFileSuffix; - saveByteFileRaw(filePathTmp, contents, contentsLen); - moveFile(filePathTmp, filePath); - } -} - -void FileSystemUtils::saveByteFileRaw( - const std::string& path, - const byte* contents, - const size_t& contentsLen) { - CAF_CM_STATIC_FUNC_LOG("FileSystemUtils", "saveByteFileRaw"); - CAF_CM_VALIDATE_STRING(path); - CAF_CM_VALIDATE_PTR(contents); - - GError *gError = NULL; - const bool isSuccessful = g_file_set_contents( - path.c_str(), reinterpret_cast(contents), contentsLen, &gError); - - // If the call wasn't successful, throw an exception with the error information. - if(! isSuccessful) { - CAF_CM_VALIDATE_PTR(gError); - - const std::string errorMessage = gError->message; - const int32 errorCode = gError->code; - - g_error_free(gError); - - CAF_CM_EXCEPTIONEX_VA2( - IOException, - errorCode, - "g_file_set_contents Failed: %s File: %s", - errorMessage.c_str(), - path.c_str()); - } -} - -FileSystemUtils::DirectoryItems FileSystemUtils::itemsInDirectory( - const std::string& path, - const std::string& regex) { - - CAF_CM_STATIC_FUNC( "FileSystemUtils", "itemsInDirectory" ); - - DirectoryItems rc; - GDir *gDir = NULL; - GError *gError = NULL; - GRegex *gRegex = NULL; - - try { - CAF_CM_VALIDATE_STRING(path); - - if(! doesDirectoryExist(path)) { - CAF_CM_EXCEPTIONEX_VA1( - PathNotFoundException, - 0, - "Directory does not exist: %s", - path.c_str()); - } - - gDir = g_dir_open(path.c_str(), 0, &gError); - if(NULL == gDir) { - const std::string errorMessage = (gError == NULL) ? "" : gError->message; - const int32 errorCode = (gError == NULL) ? 0 : gError->code; - - CAF_CM_EXCEPTIONEX_VA2( - IOException, - errorCode, - "Failed to open directory \"%s\": %s", - path.c_str(), - errorMessage.c_str()); - } - - if(regex.compare(REGEX_MATCH_ALL) != 0) { - gRegex = g_regex_new(regex.c_str(), - (GRegexCompileFlags)(G_REGEX_OPTIMIZE | G_REGEX_RAW), - (GRegexMatchFlags)0, - &gError); - if(gError) { - const std::string errorMessage = gError->message; - const int32 errorCode = gError->code; - - CAF_CM_EXCEPTIONEX_VA2(IOException, errorCode, - "g_regex_new Failed: %s regex: %s", - errorMessage.c_str(), - regex.c_str()); - } - } - - for(const gchar* filename = g_dir_read_name(gDir); - filename != NULL; - filename = g_dir_read_name(gDir)) { - std::string fullPath(path); - fullPath += G_DIR_SEPARATOR_S; - fullPath += filename; - bool isDirectory = g_file_test(fullPath.c_str(), G_FILE_TEST_IS_DIR); - - if (gRegex) { - if (g_regex_match(gRegex, - filename, - (GRegexMatchFlags)0, - NULL)) { - if (isDirectory) { - rc.directories.push_back(filename); - } else { - rc.files.push_back(filename); - } - } - } else { - if (isDirectory) { - rc.directories.push_back(filename); - } else { - rc.files.push_back(filename); - } - } - } - - if(gError != NULL) { - g_error_free(gError); - } - if(gDir != NULL) { - g_dir_close(gDir); - } - if(gRegex != NULL) { - g_regex_unref(gRegex); - } - } - catch(...) { - if(gError != NULL) { - g_error_free(gError); - } - if(gDir != NULL) { - g_dir_close(gDir); - } - if(gRegex != NULL) { - g_regex_unref(gRegex); - } - throw; - } - - return rc; -} - -FileSystemUtils::PathAndDirectoryItemsCollection -FileSystemUtils::recursiveItemsInDirectory(const std::string& path, const std::string& regex) { - PathAndDirectoryItemsCollection rc; - - CAF_CM_ENTER { - DirectoryItems items = itemsInDirectory(path, regex); - rc.push_back(PathAndDirectoryItems(path, items)); - - for (TConstIterator subdir(items.directories); subdir; subdir++) { - std::string subdirPath = buildPath(path, *subdir); - PathAndDirectoryItemsCollection subitems = recursiveItemsInDirectory(subdirPath, regex); - rc.insert(rc.end(), subitems.begin(), subitems.end()); - } - } - CAF_CM_EXIT; - - return rc; -} - -void FileSystemUtils::copyFile(const std::string& srcPath, const std::string& dstPath) { - CAF_CM_STATIC_FUNC_LOG("FileSystemUtils", "copyFile"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(srcPath); - CAF_CM_VALIDATE_STRING(dstPath); - - // Test to make sure the source is a regular file (or symlink to one), not a directory - if (! isRegularFile(srcPath)) { - CAF_CM_EXCEPTIONEX_VA1( - UnsupportedOperationException, - 0, - "Source is not a regular file: %s", - srcPath.c_str()); - } - - const std::string dstDir = getDirname(dstPath); - if (!doesDirectoryExist(dstDir)) { - CAF_CM_EXCEPTIONEX_VA1( - PathNotFoundException, - 0, - "Destination path does not exist: %s", - dstDir.c_str()); - } - -#if defined (__linux__) || defined (__APPLE__) - int32 infd = -1; - int32 outfd = -1; - try { - // Determine the stats of the source file, for use with output file later - struct stat srcStat; - if (::stat(srcPath.c_str(), &srcStat) != 0) { - int32 rc = errno; - CAF_CM_EXCEPTIONEX_VA1( - IOException, - rc, - "::stat %s failed", - srcPath.c_str()); - } - - infd = ::open(srcPath.c_str(), O_RDONLY); - if (infd == -1) { - int32 rc = errno; - CAF_CM_EXCEPTIONEX_VA1( - IOException, - rc, - "Unable to open %s for reading", - srcPath.c_str()); - } - - // Open output file write-only for user, initially, and set to source file's mode bits later - outfd = ::open(dstPath.c_str(), O_WRONLY | O_CREAT, S_IWUSR); - if (outfd == -1) { - int32 rc = errno; - CAF_CM_EXCEPTIONEX_VA1( - IOException, - rc, - "Unable to open %s for writing", - dstPath.c_str()); - } - - // Arbitrary size for the data buffer to use for the copy - const int32 buff_size = 65536; - - byte buffer[buff_size]; - ssize_t index = 0; - // Loop until we've processed the whole file - while (index < srcStat.st_size) { - ssize_t bytesRead = ::read(infd, buffer, buff_size); - if (bytesRead > 0) { - ssize_t writeIndex = 0; - // Loop until we've written out all the buffer - while (writeIndex < bytesRead) { - // If we're part way done, write from where we left off, but with a smaller number of bytes left - ssize_t bytesWritten = ::write(outfd, buffer + writeIndex, bytesRead - writeIndex); - if (bytesWritten < 0) { - int32 rc = errno; - CAF_CM_EXCEPTIONEX_VA2( - IOException, - rc, - "Unable to write to %s (index = %d)", - dstPath.c_str(), - writeIndex); - } - writeIndex += bytesWritten; - } - index += bytesRead; - } else if (bytesRead < 0) { - int32 rc = errno; - CAF_CM_EXCEPTIONEX_VA2( - IOException, - rc, - "Unable to read from %s at offset %d", - srcPath.c_str(), - index); - } - - } - if (outfd != -1) { - // Lastly, update the mode bits on the destination file to be the same as the source - ::fchmod(outfd, srcStat.st_mode); - } - } - CAF_CM_CATCH_ALL; - - if (infd != -1) { - ::close(infd); - } - if (outfd != -1) { - ::close(outfd); - } - CAF_CM_THROWEXCEPTION; -#elif defined(WIN32) - const std::wstring wSrcPath = CStringUtils::convertNarrowToWide(srcPath); - const std::wstring wDstPath = CStringUtils::convertNarrowToWide(dstPath); - BOOL bRc = ::CopyFileW( - wSrcPath.c_str(), - wDstPath.c_str(), - TRUE); - if (!bRc) { - const DWORD lastError = ::GetLastError(); - const std::string errorMsg = BasePlatform::PlatformApi::GetApiErrorMessage(lastError); - CAF_CM_EXCEPTIONEX_VA3( - IOException, - lastError, - "Failed to copy file %s to %s - %s", - srcPath.c_str(), - dstPath.c_str(), - errorMsg.c_str()); - } -#else -#error not implemented -#endif - } - CAF_CM_EXIT; -} - -void FileSystemUtils::moveFile(const std::string& srcPath, const std::string& dstPath) { - CAF_CM_STATIC_FUNC("FileSystemUtils", "moveFile"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(srcPath); - CAF_CM_VALIDATE_STRING(dstPath); - - if (!doesFileExist(srcPath)) { - CAF_CM_EXCEPTIONEX_VA1( - FileNotFoundException, - 0, - "Source file does not exist: %s", - srcPath.c_str()); - } - if (!doesDirectoryExist(getDirname(dstPath))) { - createDirectory(getDirname(dstPath)); - } - - if (g_rename(srcPath.c_str(), dstPath.c_str()) == -1) { - int32 rc = errno; - CAF_CM_EXCEPTIONEX_VA2( - IOException, - rc, - "Unable to move file %s to %s", - srcPath.c_str(), - dstPath.c_str()); - } - } - CAF_CM_EXIT; -} - -void FileSystemUtils::copyDirectory(const std::string& srcPath, const std::string& dstPath) { - CAF_CM_STATIC_FUNC("FileSystemUtils", "copyDirectory"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(srcPath); - CAF_CM_VALIDATE_STRING(dstPath); - - if(doesDirectoryExist(dstPath)) { - CAF_CM_EXCEPTIONEX_VA1( - IOException, - ERROR_ALREADY_EXISTS, - "Cannot copy into an existing directory: %s", - dstPath.c_str()); - } - createDirectory(dstPath); - - if(!doesDirectoryExist(srcPath)) { - CAF_CM_EXCEPTIONEX_VA1( - PathNotFoundException, - 0, - "Invalid source directory: %s", - srcPath.c_str()); - } - - const DirectoryItems items = itemsInDirectory(srcPath, FileSystemUtils::REGEX_MATCH_ALL); - for (TConstIterator srcFile(items.files); srcFile; srcFile++) { - copyFile(srcPath + G_DIR_SEPARATOR_S + *srcFile, - dstPath + G_DIR_SEPARATOR_S + *srcFile); - } - } - CAF_CM_EXIT; -} - -void FileSystemUtils::recursiveCopyDirectory(const std::string& srcPath, const std::string& dstPath) { - CAF_CM_STATIC_FUNC_VALIDATE("FileSystemUtils", "recursiveCopyDirectory"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(srcPath); - CAF_CM_VALIDATE_STRING(dstPath); - - const DirectoryItems items = itemsInDirectory(srcPath, FileSystemUtils::REGEX_MATCH_ALL); - - // Copy subdirectories first - for (TConstIterator srcDir(items.directories); srcDir; srcDir++) { - copyDirectory(srcPath + G_DIR_SEPARATOR_S + *srcDir, - dstPath + G_DIR_SEPARATOR_S + *srcDir); - } - - // Copy files second - for (TConstIterator srcFile(items.files); srcFile; srcFile++) { - copyFile(srcPath + G_DIR_SEPARATOR_S + *srcFile, - dstPath + G_DIR_SEPARATOR_S + *srcFile); - } - } - CAF_CM_EXIT; -} - -std::string FileSystemUtils::findOptionalFile( - const std::string& directory, - const std::string& filename) { - - CAF_CM_STATIC_FUNC_LOG("FileSystemUtils", "findOptionalFile"); - - std::string rc; - - CAF_CM_ENTER - { - CAF_CM_VALIDATE_STRING(directory); - CAF_CM_VALIDATE_STRING(filename); - - const std::deque files = findOptionalFiles(directory, filename); - if (files.size() == 1) { - rc = files[0]; - } else if (files.size() > 1) { - CAF_CM_EXCEPTION_VA2(ERROR_FILE_EXISTS, - "Found more than one file - directory: %s, filename: %s", - directory.c_str(), filename.c_str()) - } - } - CAF_CM_EXIT; - - return rc; -} - -std::string FileSystemUtils::findRequiredFile( - const std::string& directory, - const std::string& filename) { - - CAF_CM_STATIC_FUNC_LOG("FileSystemUtils", "findRequiredFile"); - - std::string rc; - - CAF_CM_ENTER - { - CAF_CM_VALIDATE_STRING(directory); - CAF_CM_VALIDATE_STRING(filename); - - rc = findOptionalFile(directory, filename); - if (rc.empty()) { - CAF_CM_EXCEPTION_VA2(ERROR_FILE_NOT_FOUND, - "File not found - directory: %s, filename: %s", - directory.c_str(), filename.c_str()) - } - } - CAF_CM_EXIT; - - return rc; -} - -std::deque FileSystemUtils::findOptionalFiles( - const std::string& directory, - const std::string& filename) { - - CAF_CM_STATIC_FUNC_LOG_VALIDATE("FileSystemUtils", "findOptionalFiles"); - - std::deque rc; - - CAF_CM_ENTER - { - CAF_CM_VALIDATE_STRING(directory); - CAF_CM_VALIDATE_STRING(filename); - - PathAndDirectoryItemsCollection pAndDItemsCol = - recursiveItemsInDirectory(directory, REGEX_MATCH_ALL); - for (TConstIterator - pAndDItemsColIter(pAndDItemsCol); pAndDItemsColIter; pAndDItemsColIter++) { - const std::string path = pAndDItemsColIter->path; - const DirectoryItems directoryItems = - pAndDItemsColIter->items; - const Files files = directoryItems.files; - for (TConstIterator fileIter(files); fileIter; fileIter++) { - const std::string filenameCur = *fileIter; - if (filenameCur.compare(filename) == 0) { - const std::string filePath = buildPath(path, filename); - rc.push_back(filePath); - } - } - } - } - CAF_CM_EXIT; - - return rc; -} - -std::deque FileSystemUtils::findRequiredFiles( - const std::string& directory, - const std::string& filename) { - - CAF_CM_STATIC_FUNC_LOG("FileSystemUtils", "findRequiredFiles"); - - std::deque rc; - - CAF_CM_ENTER - { - CAF_CM_VALIDATE_STRING(directory); - CAF_CM_VALIDATE_STRING(filename); - - rc = findOptionalFiles(directory, filename); - if (rc.empty()) { - CAF_CM_EXCEPTION_VA2(ERROR_FILE_NOT_FOUND, - "File not found - directory: %s, filename: %s", - directory.c_str(), filename.c_str()) - } - } - CAF_CM_EXIT; - - return rc; -} - -void FileSystemUtils::chmod( - const std::string &path, - const uint32 mode/* = 0770*/) { - - CAF_CM_STATIC_FUNC_LOG("FileSystemUtils", "chmod"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(path); - - if(! doesFileExist(path)) { - CAF_CM_EXCEPTIONEX_VA1(FileNotFoundException, 0, - "File does not exist: %s", path.c_str()); - } - - // Not using g_chmod on Nix because it hangs. -#ifdef WIN32 - g_chmod(path.c_str(), mode); -#else - const int32 rc = ::chmod(path.c_str(), mode); - if (rc != 0) { - CAF_CM_EXCEPTION_VA1(E_INVALIDARG, - "chmod failed - file: %s, filename: %s", path.c_str()); - } -#endif - } - CAF_CM_EXIT; -} - -std::string FileSystemUtils::normalizePathForPlatform( - const std::string &path) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("FileSystemUtils", "normalizePathForPlatform"); - - std::string rc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(path); - - rc = path; -#ifdef WIN32 - std::replace(rc.begin(), rc.end(), '/', '\\'); -#else - std::replace(rc.begin(), rc.end(), '\\', '/'); -#endif - } - CAF_CM_EXIT; - - return rc; -} - -std::string FileSystemUtils::normalizePathWithForward( - const std::string &path) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("FileSystemUtils", "normalizePathWithForward"); - - std::string rc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(path); - - rc = path; - std::replace(rc.begin(), rc.end(), '\\', '/'); - } - CAF_CM_EXIT; - - return rc; -} - -int64 FileSystemUtils::getFileSize(const std::string& filename) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("FileSystemUtils", "getFileSize"); - CAF_CM_VALIDATE_STRING(filename); - - struct stat stat_buf; - int32 rc = ::stat(filename.c_str(), &stat_buf); - return rc == 0 ? stat_buf.st_size : -1; -} - -std::string FileSystemUtils::saveTempTextFile(const std::string& filename_template, const std::string& contents) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("FileSystemUtils", "saveTempTextFile"); - - std::string filename; - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(filename_template); - CAF_CM_VALIDATE_STRING(contents); - - filename = FileSystemUtils::getTempFilename(filename_template); - - FileSystemUtils::saveTextFile(filename, contents); - } - CAF_CM_EXIT; - - return filename; -} - -std::string FileSystemUtils::getTempFilename(const std::string& filename_template) { - CAF_CM_STATIC_FUNC("FileSystemUtils", "getTempFilename"); - - std::string filename; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(filename_template); - - gchar* allocatedFilename; - GError *gError = NULL; - - int32 fd = g_file_open_tmp(filename_template.c_str(), &allocatedFilename, &gError); - if (fd >= 0) { - filename = allocatedFilename; -#ifdef WIN32 - ::_close(fd); -#else - ::close(fd); -#endif - g_free(allocatedFilename); - } - if (gError != NULL) { - const std::string errorMessage = gError->message; - const int32 errorCode = gError->code; - - g_error_free(gError); - - CAF_CM_EXCEPTIONEX_VA2( - IOException, - errorCode, - "g_file_open_tmp Failed: %s Template: %s", - errorMessage.c_str(), - filename_template.c_str()); - } - } - CAF_CM_EXIT; - CAF_CM_VALIDATE_STRING(filename); - - return filename; -} - -std::string FileSystemUtils::executeScript( - const std::string& scriptPath, - const std::string& scriptResultsDir) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("FileSystemUtils", "executeScript"); - CAF_CM_VALIDATE_STRING(scriptPath); - CAF_CM_VALIDATE_STRING(scriptResultsDir); - - Cdeqstr argv; - argv.push_back(scriptPath); - - const std::string basename = FileSystemUtils::getBasename(scriptPath); - const std::string stdoutPath = FileSystemUtils::buildPath( - scriptResultsDir, basename + ".stdout"); - const std::string stderrPath = FileSystemUtils::buildPath( - scriptResultsDir, basename + ".stderr"); - - ProcessUtils::runSyncToFiles(argv, stdoutPath, stderrPath); - - std::string rc; - if (FileSystemUtils::doesFileExist(stdoutPath)) { - rc = FileSystemUtils::loadTextFile(stdoutPath); - } - - return rc; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CFileSystemUtils.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CFileSystemUtils.h deleted file mode 100644 index ac4eb9700..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CFileSystemUtils.h +++ /dev/null @@ -1,209 +0,0 @@ -/* - * Author: bwilliams - * Created: Jan 21, 2011 - * - * Copyright (C) 2011-2017 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CFILESYSTEMUTILS_H_ -#define CFILESYSTEMUTILS_H_ - - - -#include "Memory/DynamicArray/DynamicArrayInc.h" - -namespace Caf { - -class COMMONAGGREGATOR_LINKAGE FileSystemUtils { -public: - // Helpful typedefs - - // file or directory name only: no path. - typedef std::deque Files; - typedef Files Directories; - - // directory and file names only: no path. - struct DirectoryItems { - DirectoryItems() {}; - DirectoryItems(const Directories& d, const Files& f) : directories(d), files(f) {}; - - Directories directories; - Files files; - }; - - // first is full path to the items in DirectoryItems - struct PathAndDirectoryItems { - PathAndDirectoryItems() {}; - PathAndDirectoryItems(const std::string& p, DirectoryItems& i) : path(p), items(i) {}; - - std::string path; - DirectoryItems items; - }; - - typedef enum { - FILE_MODE_REPLACE, - FILE_MODE_FAIL, - FILE_MODE_IGNORE - } FILE_MODE_TYPE; - - typedef std::deque PathAndDirectoryItemsCollection; - - // Use this constant to match all item names in a directory - static const std::string REGEX_MATCH_ALL; - - static void createDirectory(const std::string &path, const uint32 mode = 0770); - - static void removeDirectory(const std::string& path); - - static void recursiveRemoveDirectory(const std::string& path); - - static void removeFile(const std::string& path); - - static Files removeFilesInDirectory(const std::string& path, const std::string& regex); - - static bool doesFileExist(const std::string& path); - - static bool doesDirectoryExist(const std::string& path); - - static bool isRegularFile(const std::string& path); - - static std::string getCurrentDir(); - - static std::string getCurrentFile(); - - static std::string getBasename(const std::string& path); - - static std::string getDirname(const std::string& path); - - static std::string getTmpDir(); - - static std::string buildPath( - const std::string& path, - const std::string& newElement); - - static std::string buildPath( - const std::string& path, - const std::string& newElement1, - const std::string& newElement2); - - static std::string buildPath( - const std::string& path, - const std::string& newElement1, - const std::string& newElement2, - const std::string& newElement3); - - static std::string buildPath( - const std::string& path, - const std::string& newElement1, - const std::string& newElement2, - const std::string& newElement3, - const std::string& newElement4); - - static std::string loadTextFile( - const std::string& path); - - static Cdeqstr loadTextFileIntoColl( - const std::string& path); - - static SmartPtrCDynamicByteArray loadByteFile( - const std::string& path); - - static void saveTextFile( - const std::string& outputDir, - const std::string& filename, - const std::string& contents, - const FILE_MODE_TYPE fileMode = FILE_MODE_REPLACE, - const std::string temporaryFileSuffix = ".tmp"); - - static void saveTextFile( - const std::string& filePath, - const std::string& contents, - const FILE_MODE_TYPE fileMode = FILE_MODE_REPLACE, - const std::string temporaryFileSuffix = ".tmp"); - - static void saveByteFile( - const std::string& filePath, - const SmartPtrCDynamicByteArray& contents, - const FILE_MODE_TYPE fileMode = FILE_MODE_REPLACE, - const std::string temporaryFileSuffix = ".tmp"); - - static void saveByteFile( - const std::string& filePath, - const byte* contents, - const size_t& contentsLen, - const FILE_MODE_TYPE fileMode = FILE_MODE_REPLACE, - const std::string temporaryFileSuffix = ".tmp"); - - static DirectoryItems itemsInDirectory( - const std::string& path, - const std::string& regex); - - static PathAndDirectoryItemsCollection recursiveItemsInDirectory( - const std::string& path, - const std::string& regex); - - // The caller must ensure that dstPath exists. - static void copyFile(const std::string& srcPath, const std::string& dstPath); - - static void moveFile(const std::string& srcPath, const std::string& dstPath); - - static void copyDirectory(const std::string& srcPath, const std::string& dstPath); - - static void recursiveCopyDirectory(const std::string& srcPath, const std::string& dstPath); - - static std::string findOptionalFile( - const std::string& outputDir, - const std::string& filename); - - static std::string findRequiredFile( - const std::string& outputDir, - const std::string& filename); - - static std::deque findOptionalFiles( - const std::string& outputDir, - const std::string& filename); - - static std::deque findRequiredFiles( - const std::string& outputDir, - const std::string& filename); - - static void chmod( - const std::string &path, - const uint32 mode = 0770); - - static std::string normalizePathForPlatform( - const std::string &path); - - static std::string normalizePathWithForward( - const std::string &path); - - static int64 getFileSize(const std::string& filename); - - static std::string saveTempTextFile(const std::string& filename_template, const std::string& contents); - - static std::string getTempFilename(const std::string& filename_template); - - static std::string executeScript( - const std::string& scriptPath, - const std::string& scriptResultsDir); - -private: - static void saveFileSafely( - const std::string& filePath, - const byte* contents, - const size_t& contentsLen, - const std::string& temporaryFileSuffix); - - static void saveByteFileRaw( - const std::string& path, - const byte* contents, - const size_t& contentsLen); - - -private: - CAF_CM_DECLARE_NOCREATE(FileSystemUtils); -}; - -} - -#endif /* CFILESYSTEMUTILS_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CHexCodec.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CHexCodec.cpp deleted file mode 100644 index cdb21b7da..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CHexCodec.cpp +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Author: mdonahue - * Created: May 24, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "CHexCodec.h" -#include -#include - -using namespace Caf; -using namespace std; - -std::string CHexCodec::Encode( - const byte* buffer, - const uint32 bufferSize, - const uint32 pairSpacing, - const uint32 pairsPerLine, - const char lineBreakChar) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CHexCodec", "Encode"); - - stringstream encoding; - - CAF_CM_ENTER - { - CAF_CM_VALIDATE_PTR(buffer); - CAF_CM_VALIDATE_NOTZERO(bufferSize); - - string spacing; - for (uint32 u = 0; u < pairSpacing; ++u) { - spacing += ' '; - } - - uint16 uTest = 1; - byte bTest[2] = { 1, 0 }; - const bool isLittleEndian = (::memcmp(&uTest, bTest, 2) == 0); - uint32 groups = bufferSize >> 2; - uint32 remainder = bufferSize % 4; - encoding.fill('0'); - encoding.setf(ios_base::uppercase); - encoding.setf(ios_base::hex, ios_base::basefield); - uint8 b[4]; - const uint32* uintPtr = reinterpret_cast(buffer); - uint32 pairs = 0; - for (uint32 u = 0; u < groups; ++u) { - if (isLittleEndian) { - b[0] = static_cast(*uintPtr); - b[1] = static_cast(*uintPtr >> 8); - b[2] = static_cast(*uintPtr >> 16); - b[3] = static_cast(*uintPtr >> 24); - } else { - b[0] = static_cast(*uintPtr >> 24); - b[1] = static_cast(*uintPtr >> 16); - b[2] = static_cast(*uintPtr >> 8); - b[3] = static_cast(*uintPtr); - } - - for (uint32 p = 0; p < 4; ++p) { - if (pairSpacing && pairs) { - encoding << spacing; - } - encoding << setw(2) << static_cast(b[p]); - if (pairsPerLine) { - if (0 == (++pairs % pairsPerLine)) { - encoding << lineBreakChar; - pairs = 0; - } - } else { - ++pairs; - } - } - ++uintPtr; - } - - switch (remainder) { - case 0: - break; - case 1: - if (isLittleEndian) { - b[0] = static_cast(*uintPtr); - } else { - b[0] = static_cast(*uintPtr >> 24); - } - break; - case 2: - if (isLittleEndian) { - b[0] = static_cast(*uintPtr); - b[1] = static_cast(*uintPtr >> 8); - } else { - b[0] = static_cast(*uintPtr >> 24); - b[1] = static_cast(*uintPtr >> 16); - } - break; - case 3: - if (isLittleEndian) { - b[0] = static_cast(*uintPtr); - b[1] = static_cast(*uintPtr >> 8); - b[2] = static_cast(*uintPtr >> 16); - } else { - b[0] = static_cast(*uintPtr >> 24); - b[1] = static_cast(*uintPtr >> 16); - b[2] = static_cast(*uintPtr >> 8); - } - break; - } - - for (uint32 p = 0; p < remainder; ++p) { - if (pairSpacing && pairs) { - encoding << spacing; - } - encoding << setw(2) << static_cast(b[p]); - if (pairsPerLine) { - if (0 == (++pairs % pairsPerLine)) { - encoding << lineBreakChar; - pairs = 0; - } - } else { - ++pairs; - } - } - } - CAF_CM_EXIT; - - return encoding.str(); -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CHexCodec.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CHexCodec.h deleted file mode 100644 index f50b3e946..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CHexCodec.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Author: mdonahue - * Created: May 24, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CHEXCODEC_H_ -#define CHEXCODEC_H_ - -namespace Caf { -class COMMONAGGREGATOR_LINKAGE CHexCodec { -public: - /// Encodes a buffer as a 2 digit per byte string. - /// - /// @param buffer Input buffer - /// @param bufferSize Input buffer length - /// @param pairSpacing Number of spaces to insert between digit pairs - /// @param pairsPerLine Number of pairs to encode per line. 0 = single line output. - /// @param lineBreakChar Character to insert between lines - /// @return A string containing the hex encoding - static std::string Encode( - const byte* buffer, - const uint32 bufferSize, - const uint32 pairSpacing = 0, - const uint32 pairsPerLine = 0, - const char lineBreakChar = '\n'); -}; -} - -#endif /* CHEXCODEC_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CIniFile.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CIniFile.cpp deleted file mode 100644 index e31e4db78..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CIniFile.cpp +++ /dev/null @@ -1,528 +0,0 @@ -/* - * Author: bwilliams - * Created: May 18, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Common/CCafRegex.h" -#include "Common/CIniFile.h" -#include "Exception/CCafException.h" - -using namespace Caf; - -CIniFile::CIniFile() : - _isInitialized(false), - CAF_CM_INIT_LOG("CIniFile") { -} - -CIniFile::~CIniFile() { -} - -void CIniFile::initialize( - const std::string& configFilePath) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(configFilePath); - - _configFilePath = configFilePath; - - _isInitialized = true; -} - -std::deque CIniFile::getSectionCollection() { - CAF_CM_FUNCNAME_VALIDATE("getSectionCollection"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - std::deque sectionCollection; - if (_sectionCollection.empty()) { - _sectionCollection = parse(_configFilePath); - } - - sectionCollection = _sectionCollection; - - return sectionCollection; -} - -std::deque CIniFile::getEntryCollection( - const std::string& sectionName) { - CAF_CM_FUNCNAME_VALIDATE("getEntryCollection"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(sectionName); - - std::deque entryCollection; - if (_sectionCollection.empty()) { - _sectionCollection = parse(_configFilePath); - } - - for (TConstIterator > iniSectionIter(_sectionCollection); - iniSectionIter; iniSectionIter++) { - const SmartPtrSIniSection iniSection = *iniSectionIter; - const std::string sectionNameTmp = iniSection->_sectionName; - - if (sectionNameTmp.compare(sectionName) == 0) { - entryCollection = iniSection->_entryCollection; - } - } - - return entryCollection; -} - -CIniFile::SmartPtrSIniEntry CIniFile::findOptionalEntry( - const std::string& sectionName, - const std::string& keyName) { - CAF_CM_FUNCNAME_VALIDATE("findOptionalEntry"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(sectionName); - CAF_CM_VALIDATE_STRING(keyName); - - CIniFile::SmartPtrSIniEntry iniEntry; - if (_sectionCollection.empty()) { - _sectionCollection = parse(_configFilePath); - } - - for (TConstIterator > iniSectionIter(_sectionCollection); - iniSectionIter; iniSectionIter++) { - const SmartPtrSIniSection iniSection = *iniSectionIter; - const std::string sectionNameTmp = iniSection->_sectionName; - - if (sectionNameTmp.compare(sectionName) == 0) { - for (TConstIterator > iniEntryIter(iniSection->_entryCollection); - iniEntryIter; iniEntryIter++) { - const SmartPtrSIniEntry iniEntryTmp = *iniEntryIter; - const std::string keyNameTmp = iniEntryTmp->_name; - if (keyNameTmp.compare(keyName) == 0) { - iniEntry = iniEntryTmp; - break; - } - } - } - } - - return iniEntry; -} - -CIniFile::SmartPtrSIniEntry CIniFile::findRequiredEntry( - const std::string& sectionName, - const std::string& keyName) { - CAF_CM_FUNCNAME("findRequiredEntry"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(sectionName); - CAF_CM_VALIDATE_STRING(keyName); - - const SmartPtrSIniEntry iniEntry = findOptionalEntry(sectionName, keyName); - if (iniEntry.IsNull()) { - CAF_CM_EXCEPTIONEX_VA2(NoSuchElementException, ERROR_NOT_FOUND, - "Value not found - sectionName: %s, keyName: %s", sectionName.c_str(), keyName.c_str()); - } - - return iniEntry; -} - -std::string CIniFile::findOptionalString( - const std::string& sectionName, - const std::string& keyName) { - CAF_CM_FUNCNAME_VALIDATE("findOptionalString"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(sectionName); - CAF_CM_VALIDATE_STRING(keyName); - - std::string value; - const SmartPtrSIniEntry iniEntry = findOptionalEntry(sectionName, keyName); - if (! iniEntry.IsNull()) { - value = iniEntry->_valueExpanded; - } - - return value; -} - -std::string CIniFile::findRequiredString( - const std::string& sectionName, - const std::string& keyName) { - CAF_CM_FUNCNAME_VALIDATE("findRequiredString"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(sectionName); - CAF_CM_VALIDATE_STRING(keyName); - - const SmartPtrSIniEntry iniEntry = findRequiredEntry(sectionName, keyName); - return iniEntry->_valueExpanded; -} - -std::string CIniFile::findOptionalRawString( - const std::string& sectionName, - const std::string& keyName) { - CAF_CM_FUNCNAME_VALIDATE("findOptionalRawString"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(sectionName); - CAF_CM_VALIDATE_STRING(keyName); - - std::string value; - const SmartPtrSIniEntry iniEntry = findOptionalEntry(sectionName, keyName); - if (! iniEntry.IsNull()) { - value = iniEntry->_valueRaw; - } - - return value; -} - -std::string CIniFile::findRequiredRawString( - const std::string& sectionName, - const std::string& keyName) { - CAF_CM_FUNCNAME_VALIDATE("findRequiredRawString"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(sectionName); - CAF_CM_VALIDATE_STRING(keyName); - - const SmartPtrSIniEntry iniEntry = findRequiredEntry(sectionName, keyName); - return iniEntry->_valueRaw; -} - -void CIniFile::log() { - CAF_CM_FUNCNAME_VALIDATE("log"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - if (_sectionCollection.empty()) { - _sectionCollection = parse(_configFilePath); - } - - for (TConstIterator > iniSectionIter(_sectionCollection); - iniSectionIter; iniSectionIter++) { - const SmartPtrSIniSection iniSection = *iniSectionIter; - CAF_CM_LOG_DEBUG_VA1("Section - %s", iniSection->_sectionName.c_str()); - - for (TConstIterator > iniEntryIter(iniSection->_entryCollection); - iniEntryIter; iniEntryIter++) { - const SmartPtrSIniEntry iniEntry = *iniEntryIter; - CAF_CM_LOG_DEBUG_VA3(" Entry - %s=%s (%s)", - iniEntry->_name.c_str(), iniEntry->_valueRaw.c_str(), iniEntry->_valueExpanded.c_str()); - } - } -} - -void CIniFile::setValue( - const std::string& sectionName, - const std::string& keyName, - const std::string& value) { - CAF_CM_FUNCNAME("setValue"); - - GKeyFile* gKeyFile = NULL; - GError* gError = NULL; - gchar* gFileContents = NULL; - - try { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(sectionName); - CAF_CM_VALIDATE_STRING(keyName); - CAF_CM_VALIDATE_STRING(value); - - try { - gKeyFile = g_key_file_new(); - g_key_file_load_from_file( - gKeyFile, - _configFilePath.c_str(), - G_KEY_FILE_NONE, - &gError); - if (gError != NULL) { - throw gError; - } - - g_key_file_set_string( - gKeyFile, - sectionName.c_str(), - keyName.c_str(), - value.c_str()); - - gFileContents = g_key_file_to_data( - gKeyFile, - NULL, - &gError); - if (gError != NULL) { - throw gError; - } - if (gKeyFile) { - g_key_file_free(gKeyFile); - gKeyFile = NULL; - } - - g_file_set_contents( - _configFilePath.c_str(), - gFileContents, - -1, - &gError); - if (gError != NULL) { - throw gError; - } - - _sectionCollection.clear(); - } catch (GError *gErrorExc) { - CAF_CM_EXCEPTION_VA0(gErrorExc->code, gErrorExc->message); - } - } - CAF_CM_CATCH_CAF - CAF_CM_CATCH_DEFAULT - - try { - if (gKeyFile) { - g_key_file_free(gKeyFile); - } - - if (gError) { - g_error_free(gError); - } - - if (gFileContents) { - g_free(gFileContents); - } - } - CAF_CM_CATCH_DEFAULT - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_THROWEXCEPTION; -} - -void CIniFile::deleteValue( - const std::string& sectionName, - const std::string& keyName) { - CAF_CM_FUNCNAME("deleteValue"); - - GKeyFile* gKeyFile = NULL; - GError* gError = NULL; - gchar* gFileContents = NULL; - - try { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(sectionName); - CAF_CM_VALIDATE_STRING(keyName); - - try { - gKeyFile = g_key_file_new(); - g_key_file_load_from_file( - gKeyFile, - _configFilePath.c_str(), - G_KEY_FILE_NONE, - &gError); - if (gError != NULL) { - throw gError; - } - - g_key_file_remove_key( - gKeyFile, - sectionName.c_str(), - keyName.c_str(), - &gError); - if (gError != NULL) { - throw gError; - } - - gFileContents = g_key_file_to_data( - gKeyFile, - NULL, - &gError); - if (gError != NULL) { - throw gError; - } - if (gKeyFile) { - g_key_file_free(gKeyFile); - gKeyFile = NULL; - } - - g_file_set_contents( - _configFilePath.c_str(), - gFileContents, - -1, - &gError); - if (gError != NULL) { - throw gError; - } - - _sectionCollection.clear(); - } catch (GError *gErrorExc) { - CAF_CM_EXCEPTION_VA0(gErrorExc->code, gErrorExc->message); - } - } - CAF_CM_CATCH_CAF - CAF_CM_CATCH_DEFAULT - - try { - if (gKeyFile) { - g_key_file_free(gKeyFile); - } - - if (gError) { - g_error_free(gError); - } - - if (gFileContents) { - g_free(gFileContents); - } - } - CAF_CM_CATCH_DEFAULT - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_THROWEXCEPTION; -} - -std::deque CIniFile::parse( - const std::string& configFilePath) const { - CAF_CM_FUNCNAME("parse"); - - std::deque iniSectionCollection; - std::deque replacementCollection; - - GKeyFile* gKeyFile = NULL; - gchar** gGroupStrCollection = NULL; - gchar** gKeyStrCollection = NULL; - GError* gError = NULL; - gchar* gValueStr = NULL; - - try { - CAF_CM_VALIDATE_STRING(configFilePath); - - try { - gKeyFile = g_key_file_new(); - g_key_file_load_from_file( - gKeyFile, - configFilePath.c_str(), - G_KEY_FILE_NONE, - &gError); - if (gError != NULL) { - throw gError; - } - - gsize numGroups = 0; - gGroupStrCollection = g_key_file_get_groups(gKeyFile, &numGroups); - for (gsize groupNum = 0; groupNum < numGroups; groupNum++) { - const gchar* gGroupNameStr = gGroupStrCollection[groupNum]; - const std::string groupName = gGroupNameStr; - - SmartPtrSIniSection iniSection; - iniSection.CreateInstance(); - iniSection->_sectionName = groupName; - - gsize numKeys = 0; - gKeyStrCollection = g_key_file_get_keys( - gKeyFile, - gGroupNameStr, - &numKeys, - &gError); - - for (gsize keyNum = 0; keyNum < numKeys; keyNum++) { - const gchar* gKeyNameStr = gKeyStrCollection[keyNum]; - const std::string keyName = gKeyNameStr; - - gValueStr = g_key_file_get_string( - gKeyFile, - gGroupNameStr, - gKeyNameStr, - &gError); - if (gError != NULL) { - throw gError; - } - - std::string valueRaw = gValueStr; - g_free(gValueStr); - gValueStr = NULL; - - std::string valueExpanded; - if (valueRaw.empty()) { - // TODO: Need a way to represent NULL strings as opposed to empty strings. - valueRaw = " "; - valueExpanded = " "; - } else { - valueExpanded = CStringUtils::trim(valueRaw); - valueExpanded = CStringUtils::expandEnv(valueExpanded); - for (TConstIterator > replacementIter(replacementCollection); - replacementIter; replacementIter++ ) { - const SmartPtrSReplacement replacement = *replacementIter; - if (replacement->_regex->isMatched(valueExpanded)) { - valueExpanded = replacement->_regex->replaceLiteral(valueExpanded, replacement->_value); - break; - } - } - - if (groupName.compare("globals") == 0) { - const SmartPtrSReplacement replacement = createReplacement(keyName, valueExpanded); - replacementCollection.push_back(replacement); - } - } - - const SmartPtrSIniEntry iniEntry = createIniEntry(keyName, valueRaw, valueExpanded); - iniSection->_entryCollection.push_back(iniEntry); - } - - iniSectionCollection.push_back(iniSection); - } - } catch (GError *gErrorExc) { - CAF_CM_EXCEPTION_VA0(gErrorExc->code, gErrorExc->message); - } - } - CAF_CM_CATCH_CAF - CAF_CM_CATCH_DEFAULT - - try { - if (gKeyFile) { - g_key_file_free(gKeyFile); - } - - if (gError) { - g_error_free(gError); - } - - if (gGroupStrCollection) { - g_strfreev(gGroupStrCollection); - } - - if (gKeyStrCollection) { - g_strfreev(gKeyStrCollection); - } - - if (gValueStr) { - g_free(gValueStr); - } - } - CAF_CM_CATCH_DEFAULT - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_THROWEXCEPTION; - - return iniSectionCollection; -} - -CIniFile::SmartPtrSReplacement CIniFile::createReplacement( - const std::string& keyName, - const std::string& value) const { - CAF_CM_FUNCNAME_VALIDATE("createReplacement"); - CAF_CM_VALIDATE_STRING(keyName); - - std::string pattern("\\$\\{"); - pattern += keyName; - pattern += "\\}"; - - SmartPtrCCafRegex regex; - regex.CreateInstance(); - regex->initialize(pattern); - - SmartPtrSReplacement replacement; - replacement.CreateInstance(); - replacement->_regex = regex; - replacement->_value = value; - - return replacement; -} - -CIniFile::SmartPtrSIniEntry CIniFile::createIniEntry( - const std::string& keyName, - const std::string& valueRaw, - const std::string& valueExpanded) const { - CAF_CM_FUNCNAME_VALIDATE("createIniEntry"); - CAF_CM_VALIDATE_STRING(keyName); - CAF_CM_VALIDATE_STRING(valueRaw); - CAF_CM_VALIDATE_STRING(valueExpanded); - - SmartPtrSIniEntry iniEntry; - iniEntry.CreateInstance(); - iniEntry->_name = keyName; - iniEntry->_valueRaw = valueRaw; - iniEntry->_valueExpanded = valueExpanded; - - return iniEntry; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CLoggingSetter.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CLoggingSetter.cpp deleted file mode 100644 index 9bb4cc624..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CLoggingSetter.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2004-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "Common/CLoggingSetter.h" -#include "Common/CLoggingUtils.h" - -using namespace Caf; - -//////////////////////////////////////////////////////////////////////// -// -// CLoggingSetter::CLoggingSetter() -// -//////////////////////////////////////////////////////////////////////// -CLoggingSetter::CLoggingSetter() : - _isInitialized(false), - _remapLoggingLocation(false), - CAF_CM_INIT_LOG("CLoggingSetter") { -} - -//////////////////////////////////////////////////////////////////////// -// -// CLoggingSetter::~CLoggingSetter() -// -//////////////////////////////////////////////////////////////////////// -CLoggingSetter::~CLoggingSetter() { - CAF_CM_FUNCNAME("~CLoggingSetter"); - - try { - if (_isInitialized) { - if (_remapLoggingLocation) { - CAF_CM_LOG_DEBUG_VA0("Resetting log config dir"); - CLoggingUtils::resetConfigFile(); - CAF_CM_LOG_DEBUG_VA0("Reset log config dir"); - } - } - } - CAF_CM_CATCH_ALL; - CAF_CM_CLEAREXCEPTION; -} - -//////////////////////////////////////////////////////////////////////// -// -// CLoggingSetter::Initialize() -// -//////////////////////////////////////////////////////////////////////// -void CLoggingSetter::initialize(const std::string& logDir) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(logDir); - - _remapLoggingLocation = AppConfigUtils::getOptionalBoolean("remap_logging_location"); - if (_remapLoggingLocation) { - CAF_CM_LOG_DEBUG_VA1("Setting log config dir - %s", logDir.c_str()); - CLoggingUtils::setLogDir(logDir); - CAF_CM_LOG_DEBUG_VA1("Set log config dir - %s", logDir.c_str()); - } - - _isInitialized = true; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CLoggingUtils.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CLoggingUtils.cpp deleted file mode 100644 index da35b6f76..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CLoggingUtils.cpp +++ /dev/null @@ -1,195 +0,0 @@ -/*k - * Author: bwilliams - * Created: Jan 21, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "Common/CLoggingUtils.h" -#include "Exception/CCafException.h" -#include -#include - -using namespace Caf; - -GRecMutex CLoggingUtils::_sOpMutex; -SmartPtrCLoggingUtils CLoggingUtils::_sInstance; - -bool CLoggingUtils::isConsoleAppenderUsed() { - bool rc = false; - - const log4cpp::AppenderSet appenders = - log4cpp::Category::getRoot().getAllAppenders(); - for (log4cpp::AppenderSet::const_iterator iter = appenders.begin(); - (iter != appenders.end() && !rc); iter++) { - const log4cpp::Appender* appender = *iter; - rc = CStringUtils::isEqualIgnoreCase(appender->getName(), "console"); - } - - return rc; -} - -void CLoggingUtils::setStartupConfigFile( - const std::string& configFile, - const std::string& logDir) { - CAF_CM_STATIC_FUNC("CLoggingUtils", "setStartupConfigFile"); - CAF_CM_VALIDATE_STRING(configFile); - -#ifndef WIN32 - char configFileFullBuf[ 32768 ]; - ::realpath(configFile.c_str(), configFileFullBuf); - const std::string configFileFull = configFileFullBuf; -#else - wchar_t w_configFileFullBuf[ 32768 ]; - const std::wstring w_configFile = CStringUtils::convertNarrowToWide(configFile.c_str()); - DWORD dwResult = GetFullPathName(w_configFile.c_str(), 32768, w_configFileFullBuf, NULL); - // Convert the string back to narrow - const std::string configFileFull = CStringUtils::convertWideToNarrow(std::wstring(w_configFileFullBuf, dwResult)); -#endif - - if (!FileSystemUtils::doesFileExist(configFileFull)) { - CAF_CM_EXCEPTION_VA1(ERROR_FILE_NOT_FOUND, "Config file does not exist - %s", configFileFull.c_str()); - } - - CAutoMutexLockUnlockRaw oLock(&_sOpMutex); - if (_sInstance.IsNull()) { - _sInstance.CreateInstance(); - } - _sInstance->_configFile = configFileFull; - _sInstance->loadProperties(); - - if (logDir.empty()) { - _sInstance->loadConfig(configFileFull); - } else { - setLogDir(logDir); - } -} - -SmartPtrCLoggingUtils CLoggingUtils::getInstance() { - CAF_CM_STATIC_FUNC("CLoggingUtils", "getInstance"); - - CAutoMutexLockUnlockRaw oLock(&_sOpMutex); - if (!_sInstance) { - CAF_CM_EXCEPTION_VA0(ERROR_INVALID_STATE, "Config file not set"); - } - - return _sInstance; -} - -CLoggingUtils::CLoggingUtils() : - CAF_CM_INIT_LOG("CLoggingUtils") { -} - -void CLoggingUtils::loadConfig(const std::string& configFile) { - CAF_CM_STATIC_FUNC_LOG("CLoggingUtils", "loadConfig"); - CAF_CM_VALIDATE_STRING(configFile); - - if (!FileSystemUtils::doesFileExist(configFile)) { - CAF_CM_EXCEPTION_VA1(ERROR_FILE_NOT_FOUND, "Config file does not exist - %s", configFile.c_str()); - } - - // Make sure existing unmanaged appenders are cleaned up - std::vector* categories = log4cpp::Category::getCurrentCategories(); - for (std::vector::const_iterator catIter = categories->begin(); - catIter != categories->end(); catIter++) { - log4cpp::Category* category = *catIter; - log4cpp::AppenderSet appenders = category->getAllAppenders(); - for (log4cpp::AppenderSet::const_iterator appIter = appenders.begin(); appIter != appenders.end(); appIter++) { - log4cpp::Appender* appender = *appIter; - if (!category->ownsAppender(appender)) { - // Appender lifecycle is NOT managed by the category...need to manually delete - // First remove the appender before another thread attempts to access it during logging - category->removeAppender(appender); - delete appender; - } - } - } - - // Use property configurator to load configuration file..to set up configured Categories and Appenders - try { - log4cpp::PropertyConfigurator::configure(configFile); - } catch (log4cpp::ConfigureFailure e) { - std::cout << "Log4cpp Error: " << e.what() << std::endl; - } - - CAF_CM_LOG_DEBUG_VA1("Using log config file - %s", configFile.c_str()); -} - -std::string CLoggingUtils::getConfigFile() { - return getInstance()->_configFile; -} - -void CLoggingUtils::resetConfigFile() { - loadConfig(getInstance()->_configFile); -} - -void CLoggingUtils::setLogDir(const std::string& logDir) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CLoggingUtils", "setLogDir"); - CAF_CM_VALIDATE_STRING(logDir); - - if (!FileSystemUtils::doesDirectoryExist(logDir)) { - CAF_CM_LOG_INFO_VA1("Creating log dir - %s", logDir.c_str()); - FileSystemUtils::createDirectory(logDir); - } - - // Create a temporary file for storing the new config - std::string tmpFileName = FileSystemUtils::buildPath(logDir, "log4cpp_config_tmp"); - static const std::string SRCH_STR = ".fileName"; - static const size_t SRCH_STR_SIZE = SRCH_STR.length(); - - std::ofstream tmpCfg(tmpFileName.c_str(), std::ios_base::out | std::ios_base::trunc); - PropertyMap src = getInstance()->_properties; - for (PropertyMap::const_iterator iter = src.begin(); iter != src.end(); iter++) { - tmpCfg << (*iter).first << "="; - if (iter->first.rfind(SRCH_STR) == iter->first.length() - SRCH_STR_SIZE) { - const std::string basename = FileSystemUtils::getBasename(iter->second); - tmpCfg << FileSystemUtils::buildPath(logDir, basename); - } else { - tmpCfg << (*iter).second; - } - tmpCfg << std::endl; - } - tmpCfg.close(); - - loadConfig(tmpFileName); - FileSystemUtils::removeFile(tmpFileName); -} - -void CLoggingUtils::loadProperties() { - CAF_CM_FUNCNAME_VALIDATE("loadProperties"); - CAF_CM_VALIDATE_STRING(_configFile); - _properties.clear(); - - static const size_t BUFF_SIZE = 2048; - char buffer[BUFF_SIZE]; - - std::string line, property, name, value, prefix; - size_t pos = 0; - - std::ifstream properties(_configFile.c_str()); - while (properties.getline(buffer, BUFF_SIZE)) { - line = CStringUtils::trim(buffer); - - // Check for comment. If at beginning, ignore whole line. If not, extract portion up to comment - pos = line.find('#'); - if (pos == std::string::npos) { - property = line; - } else if (pos > 0) { - property = line.substr(0, pos); - } else { - continue; - } - - // Parse the property into name/value - pos = property.find('='); - if (pos != std::string::npos) { - name = CStringUtils::trim(property.substr(0, pos)); - value = CStringUtils::trim(property.substr(pos + 1, property.size() - pos)); - - _properties[name] = value; - } else { - continue; - } - } -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CManagedThreadPool.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CManagedThreadPool.cpp deleted file mode 100644 index 7eda6e558..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CManagedThreadPool.cpp +++ /dev/null @@ -1,392 +0,0 @@ -/* - * Created on: May 9, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "Common/CManagedThreadPool.h" -#include "Exception/CCafException.h" - -namespace Caf { - -class TaskWrapper : public CManagedThreadPool::IThreadTask { -public: - typedef enum { - StateInactive, - StateActive, - StateFinishedComplete, - StateFinishedIncomplete - } EnumState; - -public: - TaskWrapper(); - virtual ~TaskWrapper(); - - void init(const CManagedThreadPool::SmartPtrIThreadTask& task); - - void setState(EnumState state); - - EnumState getState() const; - -public: // IThreadTask - bool run(); - -private: - CManagedThreadPool::SmartPtrIThreadTask _task; - EnumState _state; - -private: - CAF_CM_CREATE_THREADSAFE; - CAF_CM_DECLARE_NOCOPY(TaskWrapper); - -}; -CAF_DECLARE_SMART_POINTER(TaskWrapper); - -} - -using namespace Caf; - -uint32 CManagedThreadPool::DEFAULT_TASK_UPDATE_INTERVAL = 333; - -CManagedThreadPool::CManagedThreadPool() : - _isInitialized(false), - _isShuttingDown(false), - _threadPool(NULL), - _workerThread(NULL), - _taskUpdateInterval(DEFAULT_TASK_UPDATE_INTERVAL), - CAF_CM_INIT_LOG("CManagedThreadPool") { - CAF_CM_INIT_THREADSAFE; -} - -CManagedThreadPool::~CManagedThreadPool() { - CAF_CM_FUNCNAME_VALIDATE("~CManagedThreadPool"); - - if (_threadPool || _workerThread || _tasks.size()) { - const char* poolName = _poolName.empty() ? "" : _poolName.c_str(); - CAF_CM_LOG_ERROR_VA1( - "[poolName=%s] Destroying thread pool but it is " - "still active. You really should call term() first.", - poolName); - - CAF_CM_LOG_DEBUG_VA1("[poolName=%s] Setting shutdown flag", poolName); - _isShuttingDown = true; - - if (_workerThread) { - CAF_CM_LOG_DEBUG_VA1("[poolName=%s] Waiting for worker thread to stop", poolName); - g_thread_join(_workerThread); - } - - if (_threadPool) { - CAF_CM_LOG_DEBUG_VA1("[poolName=%s] Waiting for thread pool to stop", poolName); - g_thread_pool_free( - _threadPool, - TRUE, /* immediate - do not schedule any more tasks to threads */ - TRUE /* wait - wait for currently running tasks to finish */ ); - } - - CAF_CM_LOG_DEBUG_VA2( - "[poolName=%s] Pool has shut down. Releasing %d tasks", - poolName, - _tasks.size()); - for (TConstIterator task(_tasks); task; task++) { - (*task)->Release(); - } - } -} - -void CManagedThreadPool::init( - const std::string& poolName, - uint32 threadCount, - uint32 taskUpdateInterval) { - CAF_CM_FUNCNAME("init"); - CAF_CM_VALIDATE_STRING(poolName); - CAF_CM_VALIDATE_NOTZERO(threadCount); - - CAF_CM_LOCK_UNLOCK; - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - - _poolName = poolName; - if (taskUpdateInterval) { - _taskUpdateInterval = taskUpdateInterval; - } - - GError *error = NULL; - _threadPool = g_thread_pool_new( - taskWorkerFunc, - NULL, - threadCount, - TRUE, - &error); - if (error) { - CAF_CM_THROW_GERROR(error); - } - _workerThread = CThreadUtils::startJoinable( - poolWorkerFunc, - this); - _isInitialized = true; -} - -void CManagedThreadPool::term() { - CAF_CM_FUNCNAME("term"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_LOCK_UNLOCK; - - if (g_thread_self() == _workerThread) { - CAF_CM_EXCEPTIONEX_VA1(IllegalStateException, ERROR_INVALID_STATE, "Must terminate the worker thread from a different thread - %p", _workerThread); - } - - CAF_CM_LOG_DEBUG_VA1("[poolName=%s] Setting shutdown flag", _poolName.c_str()); - _isShuttingDown = true; - - CAF_CM_LOG_DEBUG_VA2("[poolName=%s] Waiting for worker thread to stop - workerThread: %p", _poolName.c_str(), _workerThread); - GThread* workerThread = _workerThread; - { - CAF_CM_UNLOCK_LOCK; - g_thread_join(workerThread); - } - _workerThread = NULL; - - CAF_CM_LOG_DEBUG_VA1("[poolName=%s] Waiting for thread pool to stop", _poolName.c_str()); - GThreadPool* threadPool = _threadPool; - { - CAF_CM_UNLOCK_LOCK; - g_thread_pool_free( - threadPool, - TRUE, /* immediate - do not schedule any more tasks to threads */ - TRUE /* wait - wait for currently running tasks to finish */ ); - } - _threadPool = NULL; - - CAF_CM_LOG_DEBUG_VA2( - "[poolName=%s] Pool has shut down. Releasing %d tasks", - _poolName.c_str(), - _tasks.size()); - const TaskSet tasks = _tasks; - { - CAF_CM_UNLOCK_LOCK; - for (TConstIterator task(tasks); task; task++) { - (*task)->Release(); - } - } - _tasks.clear(); -} - -void CManagedThreadPool::enqueue(const SmartPtrIThreadTask& task) { - CAF_CM_FUNCNAME("enqueue"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(task); - CAF_CM_LOCK_UNLOCK; - SmartPtrTaskWrapper taskWrapper; - taskWrapper.CreateInstance(); - taskWrapper->init(task); - if (!_tasks.insert(taskWrapper.GetAddRefedInterface()).second) { - // This should not be possible! - taskWrapper->Release(); - CAF_CM_EXCEPTIONEX_VA1( - DuplicateElementException, - 0, - "[poolName=%s] An attempt was made to add a task object with an " - "address equal to that of an existing object. " - "This should not be possible. Please report this bug.", - _poolName.c_str()); - } -} - -void CManagedThreadPool::enqueue(const TaskDeque& tasks) { - CAF_CM_FUNCNAME("enqueue"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_LOCK_UNLOCK; - for (TSmartConstIterator task(tasks); task; task++) { - SmartPtrTaskWrapper taskWrapper; - taskWrapper.CreateInstance(); - taskWrapper->init(*task); - if (!_tasks.insert(taskWrapper.GetAddRefedInterface()).second) { - // This should not be possible! - taskWrapper->Release(); - CAF_CM_EXCEPTIONEX_VA1( - DuplicateElementException, - 0, - "[poolName=%s] An attempt was made to add a task object with an " - "address equal to that of an existing object. " - "This should not be possible. Please report this bug.", - _poolName.c_str()); - } - } -} - -CManagedThreadPool::Stats CManagedThreadPool::getStats() const { - CAF_CM_FUNCNAME_VALIDATE("getStats"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_LOCK_UNLOCK; - Stats stats = { 0, 0, 0, 0, 0 }; - stats.taskCount = static_cast(_tasks.size()); - for (TConstIterator task(_tasks); task; task++) { - TaskWrapper *taskWrapper = reinterpret_cast(*task); - switch (taskWrapper->getState()) { - case TaskWrapper::StateActive: - ++stats.activeTaskCount; - break; - - case TaskWrapper::StateInactive: - ++stats.inactiveTaskCount; - break; - - case TaskWrapper::StateFinishedComplete: - ++stats.completeTaskCount; - break; - - case TaskWrapper::StateFinishedIncomplete: - ++stats.incompleteTaskCount; - break; - } - } - return stats; -} - -gpointer CManagedThreadPool::poolWorkerFunc(gpointer context) { - CAF_CM_STATIC_FUNC_LOG("CManagedThreadPool", "poolWorkerFunc"); - try { - CAF_CM_VALIDATE_PTR(context); - CManagedThreadPool *pool = reinterpret_cast(context); - pool->runPool(); - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_CLEAREXCEPTION; - return NULL; -} - -void CManagedThreadPool::runPool() { - CAF_CM_FUNCNAME("runPool"); - CAF_CM_LOCK_UNLOCK; - - CAF_CM_LOG_DEBUG_VA1("[poolName=%s] Starting runPool() thread", _poolName.c_str()); - while (!_isShuttingDown) { - TaskSet tasksToRun; - TaskSet tasksRemoved; - - try { - // Move inactive tasks to the thread pool - for (TConstIterator task(_tasks); - !_isShuttingDown && task; - task++) { - TaskWrapper* taskWrapper = reinterpret_cast(*task); - if (TaskWrapper::StateInactive == taskWrapper->getState()) { - taskWrapper->setState(TaskWrapper::StateActive); - GError *error = NULL; - g_thread_pool_push( - _threadPool, - taskWrapper, - &error); - if (error) { - taskWrapper->setState(TaskWrapper::StateInactive); - CAF_CM_LOG_ERROR_VA3( - "[poolName=%s] Unable to add task to tread pool. " - "[%d][%s]", - _poolName.c_str(), - error->code, - error->message); - g_error_free(error); - error = NULL; - } - } - } - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_CLEAREXCEPTION; - - try { - // Handle finished tasks. The tasks may switch from Active to - // FinishedComplete or FinishedIncomplete while we are reading the - // state. That's okay - we'll just catch it on the next go-round. - // - // The alternative is to protect the state variable in the task wrapper - // with a critical section. Seems kind of expensive for something that - // isn't really a problem or time-critical. - // - // Also using naked iterators here since I'm updating the task set. - TaskSet::iterator task = _tasks.begin(); - while (!_isShuttingDown && (task != _tasks.end())) { - TaskWrapper* taskWrapper = reinterpret_cast(*task); - if (TaskWrapper::StateFinishedComplete == taskWrapper->getState()) { - TaskSet::iterator toErase = task; - ++task; - _tasks.erase(toErase); - taskWrapper->Release(); - } else if (TaskWrapper::StateFinishedIncomplete == taskWrapper->getState()) { - taskWrapper->setState(TaskWrapper::StateInactive); - ++task; - } else { - ++task; - } - } - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_CLEAREXCEPTION; - - const uint32 taskUpdateInterval = _taskUpdateInterval; - { - CAF_CM_UNLOCK_LOCK; - CThreadUtils::sleep(taskUpdateInterval); - } - } - CAF_CM_LOG_DEBUG_VA1("[poolName=%s] Leaving runPool() thread", _poolName.c_str()); -} - -void CManagedThreadPool::taskWorkerFunc(gpointer threadContext, gpointer) { - CAF_CM_STATIC_FUNC_LOG("TaskWorkerFunc", "taskWorkerFunc"); - // Don't want to segfault so I'll test threadContext even though - // it *cannot* be NULL. If it is we are in really bad shape! - try { - CAF_CM_VALIDATE_PTR(threadContext); - - TaskWrapper *task = reinterpret_cast(threadContext); - bool complete = false; - try { - complete = task->run(); - } - CAF_CM_CATCH_ALL; - if (CAF_CM_ISEXCEPTION) { - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_CLEAREXCEPTION; - task->setState(TaskWrapper::StateFinishedComplete); - } else { - task->setState(complete ? - TaskWrapper::StateFinishedComplete : - TaskWrapper::StateFinishedIncomplete); - } - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_CLEAREXCEPTION; -} - -TaskWrapper::TaskWrapper() : - _state(StateInactive) { - CAF_CM_INIT_THREADSAFE; -} - -TaskWrapper::~TaskWrapper() { -} - -void TaskWrapper::init(const CManagedThreadPool::SmartPtrIThreadTask& task) { - _task = task; -} - -void TaskWrapper::setState(EnumState state) { - CAF_CM_LOCK_UNLOCK; - _state = state; -} - -TaskWrapper::EnumState TaskWrapper::getState() const { - CAF_CM_LOCK_UNLOCK; - return _state; -} - -bool TaskWrapper::run() { - return _task->run(); -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CPersistenceUtils.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CPersistenceUtils.cpp deleted file mode 100644 index a561a3089..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CPersistenceUtils.cpp +++ /dev/null @@ -1,466 +0,0 @@ -/*k - * Author: bwilliams - * Created: Nov 25, 2015 - * - * Copyright (C) 2015-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Doc/PersistenceDoc/CCertCollectionDoc.h" -#include "Doc/PersistenceDoc/CCertPathCollectionDoc.h" -#include "Doc/PersistenceDoc/CLocalSecurityDoc.h" -#include "Doc/PersistenceDoc/CPersistenceDoc.h" -#include "Doc/PersistenceDoc/CPersistenceProtocolCollectionDoc.h" -#include "Doc/PersistenceDoc/CPersistenceProtocolDoc.h" -#include "Doc/PersistenceDoc/CRemoteSecurityCollectionDoc.h" -#include "Doc/PersistenceDoc/CRemoteSecurityDoc.h" -#include "CPersistenceUtils.h" - -using namespace Caf; - -SmartPtrCPersistenceDoc CPersistenceUtils::loadPersistence( - const std::string& persistenceDir) { - CAF_CM_STATIC_FUNC_VALIDATE("CPersistenceUtils", "loadPersistence"); - CAF_CM_VALIDATE_STRING(persistenceDir); - - SmartPtrCPersistenceDoc persistence; - persistence.CreateInstance(); - persistence->initialize( - loadLocalSecurity(persistenceDir), - loadRemoteSecurityCollection(persistenceDir), - loadPersistenceProtocolCollection(persistenceDir), - loadTextFile(persistenceDir, "version.txt", "1.0")); - - return persistence; -} - -SmartPtrCLocalSecurityDoc CPersistenceUtils::loadLocalSecurity( - const std::string& persistenceDir) { - CAF_CM_STATIC_FUNC_VALIDATE("CPersistenceUtils", "loadLocalSecurity"); - CAF_CM_VALIDATE_STRING(persistenceDir); - - const std::string localDir = FileSystemUtils::buildPath(persistenceDir, "local"); - - SmartPtrCLocalSecurityDoc localSecurity; - localSecurity.CreateInstance(); - localSecurity->initialize( - loadTextFile(localDir, "localId.txt"), - loadTextFile(localDir, "privateKey.pem"), - loadTextFile(localDir, "cert.pem"), - FileSystemUtils::buildPath(localDir, "privateKey.pem"), - FileSystemUtils::buildPath(localDir, "cert.pem")); - - return localSecurity; -} - -SmartPtrCRemoteSecurityCollectionDoc CPersistenceUtils::loadRemoteSecurityCollection( - const std::string& persistenceDir) { - CAF_CM_STATIC_FUNC_VALIDATE("CPersistenceUtils", "loadRemoteSecurityCollection"); - CAF_CM_VALIDATE_STRING(persistenceDir); - - const std::string remoteDir = FileSystemUtils::buildPath(persistenceDir, "remote"); - - std::deque remoteSecurityCollectionInner; - if (FileSystemUtils::doesDirectoryExist(remoteDir)) { - FileSystemUtils::DirectoryItems remoteItems = FileSystemUtils::itemsInDirectory( - remoteDir, FileSystemUtils::REGEX_MATCH_ALL); - for (TConstIterator remoteIter(remoteItems.directories); remoteIter; remoteIter++) { - const std::string remoteId = *remoteIter; - const std::string remoteIdDir = FileSystemUtils::buildPath(remoteDir, remoteId); - const std::string cmsCertCollectionDir = FileSystemUtils::buildPath(remoteIdDir, "cmsCertCollection"); - - std::deque cmsCertCollectionInner; - std::deque cmsCertPathCollectionInner; - if (FileSystemUtils::doesDirectoryExist(cmsCertCollectionDir)) { - FileSystemUtils::DirectoryItems cmsCertCollectionItems = FileSystemUtils::itemsInDirectory( - cmsCertCollectionDir, FileSystemUtils::REGEX_MATCH_ALL); - for (TConstIterator cmsCertCollectionIter(cmsCertCollectionItems.files); cmsCertCollectionIter; cmsCertCollectionIter++) { - cmsCertCollectionInner.push_back( - loadTextFile(cmsCertCollectionDir, *cmsCertCollectionIter)); - cmsCertPathCollectionInner.push_back( - FileSystemUtils::buildPath(cmsCertCollectionDir, *cmsCertCollectionIter)); - } - } - - SmartPtrCCertCollectionDoc cmsCertCollection; - cmsCertCollection.CreateInstance(); - cmsCertCollection->initialize(cmsCertCollectionInner); - - SmartPtrCCertPathCollectionDoc cmsCertPathCollection; - cmsCertPathCollection.CreateInstance(); - cmsCertPathCollection->initialize(cmsCertPathCollectionInner); - - SmartPtrCRemoteSecurityDoc remoteSecurity; - remoteSecurity.CreateInstance(); - remoteSecurity->initialize( - loadTextFile(remoteIdDir, "remoteId.txt"), - loadTextFile(remoteIdDir, "protocolName.txt"), - loadTextFile(remoteIdDir, "cmsCert.pem"), - loadTextFile(remoteIdDir, "cmsCipherName.txt"), - cmsCertCollection, - FileSystemUtils::buildPath(remoteIdDir, "cmsCert.pem"), - cmsCertPathCollection); - - remoteSecurityCollectionInner.push_back(remoteSecurity); - } - } - - SmartPtrCRemoteSecurityCollectionDoc remoteSecurityCollection; - remoteSecurityCollection.CreateInstance(); - remoteSecurityCollection->initialize(remoteSecurityCollectionInner); - - return remoteSecurityCollection; -} - -SmartPtrCPersistenceProtocolCollectionDoc CPersistenceUtils::loadPersistenceProtocolCollection( - const std::string& persistenceDir) { - CAF_CM_STATIC_FUNC_VALIDATE("CPersistenceUtils", "loadPersistenceProtocolCollection"); - CAF_CM_VALIDATE_STRING(persistenceDir); - - const std::string protocolDir = FileSystemUtils::buildPath(persistenceDir, "protocol"); - - std::deque persistenceProtocolCollectionInner; - if (FileSystemUtils::doesDirectoryExist(protocolDir)) { - FileSystemUtils::DirectoryItems protocolItems = FileSystemUtils::itemsInDirectory( - protocolDir, FileSystemUtils::REGEX_MATCH_ALL); - for (TConstIterator protocolIter(protocolItems.directories); protocolIter; protocolIter++) { - const std::string protocolId = *protocolIter; - const std::string protocolIdDir = FileSystemUtils::buildPath(protocolDir, protocolId); - const std::string tlsCipherCollectionDir = FileSystemUtils::buildPath(protocolIdDir, "tlsCipherCollection"); - const std::string tlsCertCollectionDir = FileSystemUtils::buildPath(protocolIdDir, "tlsCertCollection"); - - Cdeqstr tlsCipherCollection; - if (FileSystemUtils::doesDirectoryExist(tlsCipherCollectionDir)) { - FileSystemUtils::DirectoryItems tlsCipherCollectionItems = FileSystemUtils::itemsInDirectory( - tlsCipherCollectionDir, FileSystemUtils::REGEX_MATCH_ALL); - for (TConstIterator tlsCipherCollectionIter(tlsCipherCollectionItems.files); tlsCipherCollectionIter; tlsCipherCollectionIter++) { - tlsCipherCollection.push_back( - loadTextFile(tlsCipherCollectionDir, *tlsCipherCollectionIter)); - } - } - - std::deque tlsCertCollectionInner; - std::deque tlsCertPathCollectionInner; - if (FileSystemUtils::doesDirectoryExist(tlsCertCollectionDir)) { - FileSystemUtils::DirectoryItems tlsCertCollectionItems = FileSystemUtils::itemsInDirectory( - tlsCertCollectionDir, FileSystemUtils::REGEX_MATCH_ALL); - for (TConstIterator tlsCertCollectionIter(tlsCertCollectionItems.files); tlsCertCollectionIter; tlsCertCollectionIter++) { - tlsCertCollectionInner.push_back( - loadTextFile(tlsCertCollectionDir, *tlsCertCollectionIter)); - tlsCertPathCollectionInner.push_back( - FileSystemUtils::buildPath(tlsCertCollectionDir, *tlsCertCollectionIter)); - } - } - - SmartPtrCCertCollectionDoc tlsCertCollection; - tlsCertCollection.CreateInstance(); - tlsCertCollection->initialize(tlsCertCollectionInner); - - SmartPtrCCertPathCollectionDoc tlsCertPathCollection; - tlsCertPathCollection.CreateInstance(); - tlsCertPathCollection->initialize(tlsCertPathCollectionInner); - - SmartPtrCPersistenceProtocolDoc persistenceProtocol; - persistenceProtocol.CreateInstance(); - persistenceProtocol->initialize( - loadTextFile(protocolIdDir, "protocolName.txt"), - loadTextFile(protocolIdDir, "uri.txt"), - loadTextFile(protocolIdDir, "uri_amqp.txt"), - loadTextFile(protocolIdDir, "uri_tunnel.txt"), - loadTextFile(protocolIdDir, "tlsCert.pem"), - loadTextFile(protocolIdDir, "tlsProtocol.txt"), - tlsCipherCollection, - tlsCertCollection, - FileSystemUtils::buildPath(protocolIdDir, "uri_amqp.txt"), - FileSystemUtils::buildPath(protocolIdDir, "uri_tunnel.txt"), - FileSystemUtils::buildPath(protocolIdDir, "tlsCert.pem"), - tlsCertPathCollection); - - persistenceProtocolCollectionInner.push_back(persistenceProtocol); - } - } - - SmartPtrCPersistenceProtocolCollectionDoc persistenceProtocolCollection; - persistenceProtocolCollection.CreateInstance(); - persistenceProtocolCollection->initialize(persistenceProtocolCollectionInner); - - return persistenceProtocolCollection; -} - -SmartPtrCPersistenceProtocolDoc CPersistenceUtils::loadPersistenceProtocol( - const std::string& persistenceDir) { - CAF_CM_STATIC_FUNC_VALIDATE("CPersistenceUtils", "loadPersistenceProtocol"); - CAF_CM_VALIDATE_STRING(persistenceDir); - - const SmartPtrCPersistenceProtocolCollectionDoc persistenceProtocolCollection = - loadPersistenceProtocolCollection(persistenceDir); - - return loadPersistenceProtocol(persistenceProtocolCollection); -} - -SmartPtrCPersistenceProtocolDoc CPersistenceUtils::loadPersistenceProtocol( - const SmartPtrCPersistenceProtocolCollectionDoc& persistenceProtocolCollection) { - CAF_CM_STATIC_FUNC_VALIDATE("CPersistenceUtils", "loadPersistenceProtocol"); - CAF_CM_VALIDATE_SMARTPTR(persistenceProtocolCollection); - - std::deque persistenceProtocolCollectionInner = - persistenceProtocolCollection->getPersistenceProtocol(); - CAF_CM_VALIDATE_BOOL(persistenceProtocolCollectionInner.size() <= 1); - - SmartPtrCPersistenceProtocolDoc rc; - if (persistenceProtocolCollectionInner.size() == 1) { - rc = persistenceProtocolCollectionInner.front(); - } - - return rc; -} - -void CPersistenceUtils::savePersistence( - const SmartPtrCPersistenceDoc& persistence, - const std::string& persistenceDir) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CPersistenceUtils", "savePersistence"); - CAF_CM_VALIDATE_SMARTPTR(persistence); - CAF_CM_VALIDATE_STRING(persistenceDir); - - const std::string protocolDir = FileSystemUtils::buildPath(persistenceDir, "protocol", "amqpBroker_default"); - const std::string uriAmqp = loadTextFile(protocolDir, "uri_amqp.txt"); - const std::string uriTunnel = loadTextFile(protocolDir, "uri_tunnel.txt"); - - if (FileSystemUtils::doesDirectoryExist(persistenceDir)) { - CAF_CM_LOG_DEBUG_VA1("Removing directory - %s", persistenceDir.c_str()); - FileSystemUtils::recursiveRemoveDirectory(persistenceDir); - } - - const SmartPtrCLocalSecurityDoc localSecurity = persistence->getLocalSecurity(); - const SmartPtrCRemoteSecurityCollectionDoc remoteSecurityCollection = - persistence->getRemoteSecurityCollection(); - const SmartPtrCPersistenceProtocolCollectionDoc persistenceProtocolCollection = - persistence->getPersistenceProtocolCollection(); - - saveLocalSecurity(localSecurity, persistenceDir); - saveRemoteSecurityCollection(remoteSecurityCollection, persistenceDir); - savePersistenceProtocolCollection(persistenceProtocolCollection, persistenceDir, - uriAmqp, uriTunnel); - FileSystemUtils::saveTextFile(persistenceDir, "version.txt", persistence->getVersion()); -} - -void CPersistenceUtils::saveLocalSecurity( - const SmartPtrCLocalSecurityDoc& localSecurity, - const std::string& persistenceDir) { - CAF_CM_STATIC_FUNC_VALIDATE("CPersistenceUtils", "saveLocalSecurity"); - CAF_CM_VALIDATE_STRING(persistenceDir); - - if (localSecurity) { - const std::string locCertsDir = createDirectory(persistenceDir, "local"); - - if (! localSecurity->getLocalId().empty()) { - FileSystemUtils::saveTextFile( - locCertsDir, "localId.txt", localSecurity->getLocalId()); - } - - if (! localSecurity->getCert().empty()) { - FileSystemUtils::saveTextFile( - locCertsDir, "cert.pem", localSecurity->getCert()); - } - - if (! localSecurity->getPrivateKey().empty()) { - FileSystemUtils::saveTextFile( - locCertsDir, "privateKey.pem", localSecurity->getPrivateKey()); - } - } -} - -void CPersistenceUtils::saveRemoteSecurityCollection( - const SmartPtrCRemoteSecurityCollectionDoc& remoteSecurityCollection, - const std::string& persistenceDir) { - CAF_CM_STATIC_FUNC_VALIDATE("CPersistenceUtils", "saveRemoteSecurityCollection"); - CAF_CM_VALIDATE_STRING(persistenceDir); - - if (! remoteSecurityCollection.IsNull()) { - const std::deque remoteSecurityCollectionInner = - remoteSecurityCollection->getRemoteSecurity(); - if (! remoteSecurityCollectionInner.empty()) { - const std::string rmtCertsDir = createDirectory(persistenceDir, "remote"); - - for (TConstIterator > - remoteSecurityIter(remoteSecurityCollectionInner); - remoteSecurityIter; - remoteSecurityIter++) { - const SmartPtrCRemoteSecurityDoc remoteSecurity = *remoteSecurityIter; - CAF_CM_VALIDATE_SMARTPTR(remoteSecurity); - - const std::string remoteId = remoteSecurity->getRemoteId(); - CAF_CM_VALIDATE_STRING(remoteId); - - const std::string persistenceDir = createDirectory(rmtCertsDir, remoteId); - - FileSystemUtils::saveTextFile( - persistenceDir, "remoteId.txt", remoteSecurity->getRemoteId()); - - if (! remoteSecurity->getProtocolName().empty()) { - FileSystemUtils::saveTextFile( - persistenceDir, "protocolName.txt", remoteSecurity->getProtocolName()); - } - - if (! remoteSecurity->getCmsCert().empty()) { - FileSystemUtils::saveTextFile( - persistenceDir, "cmsCert.pem", remoteSecurity->getCmsCert()); - } - - if (! remoteSecurity->getCmsCipherName().empty()) { - FileSystemUtils::saveTextFile( - persistenceDir, "cmsCipherName.txt", remoteSecurity->getCmsCipherName()); - } - - if (! remoteSecurity->getCmsCertCollection().IsNull()) { - const std::deque cmsCertCollectionInner = - remoteSecurity->getCmsCertCollection()->getCert(); - - if (! cmsCertCollectionInner.empty()) { - const std::string certCollectionDir = createDirectory(persistenceDir, "cmsCertCollection"); - saveCollection(cmsCertCollectionInner, certCollectionDir, "cmsCert", ".pem"); - } - } - } - } - } -} - -void CPersistenceUtils::savePersistenceProtocolCollection( - const SmartPtrCPersistenceProtocolCollectionDoc& persistenceProtocolCollection, - const std::string& persistenceDir, - const std::string& uriAmqp, - const std::string& uriTunnel) { - CAF_CM_STATIC_FUNC_VALIDATE("CPersistenceUtils", "savePersistenceProtocolCollection"); - CAF_CM_VALIDATE_STRING(persistenceDir); - - if (! persistenceProtocolCollection.IsNull()) { - const std::deque persistenceProtocolCollectionInner = - persistenceProtocolCollection->getPersistenceProtocol(); - if (! persistenceProtocolCollectionInner.empty()) { - const std::string protocolDir = createDirectory(persistenceDir, "protocol"); - - for (TConstIterator > - persistenceProtocolIter(persistenceProtocolCollectionInner); - persistenceProtocolIter; - persistenceProtocolIter++) { - const SmartPtrCPersistenceProtocolDoc persistenceProtocol = *persistenceProtocolIter; - - const std::string protocolName = persistenceProtocol->getProtocolName(); - CAF_CM_VALIDATE_STRING(protocolName); - - const std::string amqpQueueDir = createDirectory(protocolDir, protocolName); - - FileSystemUtils::saveTextFile( - amqpQueueDir, "protocolName.txt", persistenceProtocol->getProtocolName()); - - if (! persistenceProtocol->getUri().empty()) { - FileSystemUtils::saveTextFile( - amqpQueueDir, "uri.txt", persistenceProtocol->getUri()); - } - - const std::string uriAmqpTmp = persistenceProtocol->getUriAmqp().empty() ? - uriAmqp : persistenceProtocol->getUriAmqp(); - if (! uriAmqpTmp.empty()) { - FileSystemUtils::saveTextFile( - amqpQueueDir, "uri_amqp.txt", uriAmqpTmp); - } - - const std::string uriTunnelTmp = persistenceProtocol->getUriTunnel().empty() ? - uriTunnel : persistenceProtocol->getUriTunnel(); - if (! uriTunnelTmp.empty()) { - FileSystemUtils::saveTextFile( - amqpQueueDir, "uri_tunnel.txt", uriTunnelTmp); - } - - if (! persistenceProtocol->getTlsCert().empty()) { - FileSystemUtils::saveTextFile( - amqpQueueDir, "tlsCert.pem", persistenceProtocol->getTlsCert()); - } - - if (! persistenceProtocol->getTlsProtocol().empty()) { - FileSystemUtils::saveTextFile( - amqpQueueDir, "tlsProtocol.txt", persistenceProtocol->getTlsProtocol()); - } - - const std::deque tlsCipherCollectionInner = - persistenceProtocol->getTlsCipherCollection(); - if (! tlsCipherCollectionInner.empty()) { - const std::string cipherDir = createDirectory(amqpQueueDir, "tlsCipherCollection"); - saveCollection(tlsCipherCollectionInner, cipherDir, "tlsCipher", ".txt"); - } - - if (! persistenceProtocol->getTlsCertCollection().IsNull()) { - const std::deque tlsCertCollectionInner = - persistenceProtocol->getTlsCertCollection()->getCert(); - - if (! tlsCertCollectionInner.empty()) { - const std::string certCollectionDir = createDirectory(amqpQueueDir, "tlsCertCollection"); - saveCollection(tlsCertCollectionInner, certCollectionDir, "tlsCert", ".pem"); - } - } - } - } - } -} - -std::string CPersistenceUtils::loadTextFile( - const std::string& dir, - const std::string& file, - const std::string& defaultVal, - const bool isTrimRight) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CPersistenceUtils", "loadTextFile"); - CAF_CM_VALIDATE_STRING(dir); - CAF_CM_VALIDATE_STRING(file); - - const std::string path = FileSystemUtils::buildPath(dir, file); - - std::string rc; - if (FileSystemUtils::doesFileExist(path)) { - rc = FileSystemUtils::loadTextFile(path); - if (isTrimRight) { - rc = CStringUtils::trimRight(rc); - } - } else { - CAF_CM_LOG_DEBUG_VA1("File not found - %s", path.c_str()); - rc = defaultVal; - } - - return rc; -} - -std::string CPersistenceUtils::createDirectory( - const std::string& directory, - const std::string& subdir) { - CAF_CM_STATIC_FUNC_VALIDATE("CPersistenceUtils", "createDirectory"); - CAF_CM_VALIDATE_STRING(directory); - CAF_CM_VALIDATE_STRING(subdir); - - const std::string dirPath = FileSystemUtils::buildPath(directory, subdir); - if (! FileSystemUtils::doesDirectoryExist(dirPath)) { - FileSystemUtils::createDirectory(dirPath); - } - - return dirPath; -} - -void CPersistenceUtils::saveCollection( - const Cdeqstr& collection, - const std::string& directory, - const std::string& filePrefix, - const std::string& filePostfix) { - CAF_CM_STATIC_FUNC_VALIDATE("CPersistenceUtils", "saveCollection"); - CAF_CM_VALIDATE_STL(collection); - CAF_CM_VALIDATE_STRING(directory); - CAF_CM_VALIDATE_STRING(filePrefix); - CAF_CM_VALIDATE_STRING(filePostfix); - - int32 cnt = 0; - for (TConstIterator elemIter(collection); elemIter; elemIter++) { - const std::string elem = *elemIter; - const std::string cntStr = CStringConv::toString(cnt++); - std::string elemFilename = filePrefix + cntStr + filePostfix; - FileSystemUtils::saveTextFile(directory, elemFilename, elem); - } -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CPersistenceUtils.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CPersistenceUtils.h deleted file mode 100644 index 99e126878..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CPersistenceUtils.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Author: bwilliams - * Created: Jan 21, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CPersistenceUtils_H_ -#define CPersistenceUtils_H_ - -#include - -#include "Doc/PersistenceDoc/CLocalSecurityDoc.h" -#include "Doc/PersistenceDoc/CPersistenceDoc.h" -#include "Doc/PersistenceDoc/CPersistenceProtocolCollectionDoc.h" -#include "Doc/PersistenceDoc/CPersistenceProtocolDoc.h" -#include "Doc/PersistenceDoc/CRemoteSecurityCollectionDoc.h" - -namespace Caf { - -class COMMONAGGREGATOR_LINKAGE CPersistenceUtils { -public: - static SmartPtrCPersistenceDoc loadPersistence( - const std::string& persistenceDir); - - static SmartPtrCLocalSecurityDoc loadLocalSecurity( - const std::string& persistenceDir); - - static SmartPtrCRemoteSecurityCollectionDoc loadRemoteSecurityCollection( - const std::string& persistenceDir); - - static SmartPtrCPersistenceProtocolCollectionDoc loadPersistenceProtocolCollection( - const std::string& persistenceDir); - - static SmartPtrCPersistenceProtocolDoc loadPersistenceProtocol( - const std::string& persistenceDir); - - static SmartPtrCPersistenceProtocolDoc loadPersistenceProtocol( - const SmartPtrCPersistenceProtocolCollectionDoc& persistenceProtocolCollection); - -public: - static void savePersistence( - const SmartPtrCPersistenceDoc& persistence, - const std::string& persistenceDir); - - static void saveLocalSecurity( - const SmartPtrCLocalSecurityDoc& localSecurity, - const std::string& persistenceDir); - - static void saveRemoteSecurityCollection( - const SmartPtrCRemoteSecurityCollectionDoc& remoteSecurityCollection, - const std::string& persistenceDir); - - static void savePersistenceProtocolCollection( - const SmartPtrCPersistenceProtocolCollectionDoc& persistenceProtocolCollection, - const std::string& persistenceDir, - const std::string& uriAmqp, - const std::string& uriTunnel); - -private: - static std::string loadTextFile( - const std::string& dir, - const std::string& file, - const std::string& defaultVal = std::string(), - const bool isTrimRight = true); - -private: - static std::string createDirectory( - const std::string& directory, - const std::string& subdir); - - static void saveCollection( - const Cdeqstr& collection, - const std::string& directory, - const std::string& filePrefix, - const std::string& filePostfix); - -private: - CAF_CM_DECLARE_NOCREATE(CPersistenceUtils); -}; - -} - -#endif /* CPersistenceUtils_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CProcessUtils.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CProcessUtils.cpp deleted file mode 100644 index 7efb82e5a..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CProcessUtils.cpp +++ /dev/null @@ -1,441 +0,0 @@ -/* - * Author: bwilliams - * Created: Jan 21, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "Exception/CCafException.h" -#include "CProcessUtils.h" -#ifndef WIN32 -#include -#include -#endif - - -using namespace Caf; - -const std::string ProcessUtils::INHERIT_PARENT_DIRECTORY; - -void ProcessUtils::runSyncToFiles( - const Cdeqstr& argv, - const std::string& stdoutPath, - const std::string& stderrPath, - const ProcessUtils::Priority priority, - const std::string workingDirectory) { - - CAF_CM_STATIC_FUNC_LOG_VALIDATE("ProcessUtils", "runSyncToFiles"); - - CAF_CM_ENTER - { - CAF_CM_VALIDATE_STL(argv); - // stdoutPath is optional - // stderrPath is optional - - std::string stdoutContent; - std::string stderrContent; - ProcessUtils::runSync( - argv, stdoutPath, stderrPath, stdoutContent, stderrContent, priority, workingDirectory); - } - CAF_CM_EXIT; -} - -void ProcessUtils::runSync( - const Cdeqstr& argv, - std::string& stdoutContent, - std::string& stderrContent, - const ProcessUtils::Priority priority, - const std::string workingDirectory) { - - CAF_CM_STATIC_FUNC_LOG_VALIDATE("ProcessUtils", "runSync"); - - CAF_CM_ENTER - { - CAF_CM_VALIDATE_STL(argv); - - ProcessUtils::runSync( - argv, std::string(), std::string(), stdoutContent, stderrContent, priority, workingDirectory); - } - CAF_CM_EXIT; -} - -#ifdef WIN32 -void ProcessUtils::runSync( - const Cdeqstr& argv, - const std::string& stdoutPath, - const std::string& stderrPath, - std::string& stdoutContent, - std::string& stderrContent, - const ProcessUtils::Priority priority, - const std::string& workingDirectory) { - CAF_CM_STATIC_FUNC_LOG( "CProcessUtils", "runSync(Win)" ); - - const uint32 maxCmdLineLen = 1024; - - PROCESS_INFORMATION processInfo; - HANDLE stdoutReadPipe = NULL; - HANDLE stdoutWritePipe = NULL; - HANDLE stderrReadPipe = NULL; - HANDLE stderrWritePipe = NULL; - - try { - CAF_CM_VALIDATE_STL(argv); - - const std::string cmdLine = convertToString(argv); - - if (cmdLine.length() > maxCmdLineLen) { - CAF_CM_EXCEPTION_VA1(0, "Command-line too long: \"%s\"", - cmdLine.c_str()); - } - - CAF_CM_LOG_INFO_VA1("Running command - %s", cmdLine.c_str()); - - char cmdLineBuf[maxCmdLineLen + 1]; - ::strcpy_s(cmdLineBuf, cmdLine.c_str()); - - SECURITY_ATTRIBUTES securityAttributes; - ::ZeroMemory(&securityAttributes, sizeof(securityAttributes)); - securityAttributes.nLength = sizeof(securityAttributes); - securityAttributes.bInheritHandle = TRUE; - - //Create pipes to write and read stdout/stderr - BOOL apiRc = ::CreatePipe(&stdoutReadPipe, &stdoutWritePipe, &securityAttributes, 0); - if (apiRc == FALSE) { - const DWORD errorCode = ::GetLastError(); - const std::string errorMsg = BasePlatform::PlatformApi::GetApiErrorMessage(errorCode); - CAF_CM_EXCEPTION_VA2(errorCode, "Failed to create the stdout pipe - cmdLine: \"%s\", msg: \"%s\"", - cmdLine.c_str(), errorMsg.c_str()); - } - - apiRc = ::CreatePipe(&stderrReadPipe, &stderrWritePipe, &securityAttributes, 0); - if (apiRc == FALSE) { - const DWORD errorCode = ::GetLastError(); - const std::string errorMsg = BasePlatform::PlatformApi::GetApiErrorMessage(errorCode); - CAF_CM_EXCEPTION_VA2(errorCode, "Failed to create the stderr pipe - cmdLine: \"%s\", msg: \"%s\"", - cmdLine.c_str(), errorMsg.c_str()); - } - - STARTUPINFOA startupInfo; - ::ZeroMemory(&startupInfo, sizeof(startupInfo)); - startupInfo.cb = sizeof(startupInfo); - startupInfo.dwFlags |= STARTF_USESTDHANDLES; - startupInfo.hStdInput = NULL; - startupInfo.hStdOutput = stdoutWritePipe; - startupInfo.hStdError = stderrWritePipe; - - ::ZeroMemory(&processInfo, sizeof(processInfo)); - - DWORD dwCreationFlags = CREATE_NO_WINDOW; - switch (priority) { - case LOW: - dwCreationFlags |= BELOW_NORMAL_PRIORITY_CLASS; - break; - - case IDLE: - dwCreationFlags |= IDLE_PRIORITY_CLASS; - break; - - case NORMAL: - default: - dwCreationFlags |= NORMAL_PRIORITY_CLASS; - break; - } - - // NORMAL_PRIORITY_CLASS BELOW_NORMAL_PRIORITY_CLASS IDLE_PRIORITY_CLASS - // Create the process - apiRc = ::CreateProcessA( - NULL, // Image Name - cmdLineBuf, // Command Line - NULL, // Security Attributes for the Process - NULL, // Security Attributes for the Thread - TRUE, // Inherit handles? - dwCreationFlags, // Creation flags - NULL, // Environment - workingDirectory.length() == 0 ? NULL : workingDirectory.c_str(), - &startupInfo, // Startup Info - &processInfo); // Process Info - - if (apiRc == FALSE) { - const DWORD errorCode = ::GetLastError(); - const std::string errorMsg = BasePlatform::PlatformApi::GetApiErrorMessage(errorCode); - CAF_CM_EXCEPTION_VA2(errorCode, "Failed to invoke \"%s\", msg: \"%s\"", - cmdLine.c_str(), errorMsg.c_str()); - } else { - // Successfully created the process. Wait for it to finish. - ::WaitForSingleObject(processInfo.hProcess, INFINITE); - - // Get the exit code. - DWORD exitCode = 0; - apiRc = ::GetExitCodeProcess(processInfo.hProcess, &exitCode); - if (apiRc == FALSE) { - const DWORD errorCode = ::GetLastError(); - const std::string errorMsg = BasePlatform::PlatformApi::GetApiErrorMessage(errorCode); - CAF_CM_EXCEPTION_VA2(errorCode, "Executed command but couldn't get exit code - cmdLine: \"%s\", msg: \"%s\"", - cmdLine.c_str(), errorMsg.c_str()); - } - - ::CloseHandle(stdoutWritePipe); - ::CloseHandle(stderrWritePipe); - stdoutWritePipe = NULL; - stderrWritePipe = NULL; - - stdoutContent = readFromPipe(stdoutReadPipe); - stderrContent = readFromPipe(stderrReadPipe); - - if (!stdoutContent.empty() && !stdoutPath.empty()) { - FileSystemUtils::saveTextFile(stdoutPath, stdoutContent); - } - - if (!stderrContent.empty() && !stderrPath.empty()) { - FileSystemUtils::saveTextFile(stderrPath, stderrContent); - } - - std::ostringstream msgStream; - if (exitCode != 0) { - msgStream << "Command failed - exitCode: " << exitCode; - msgStream << ", cmdLine: \"" << cmdLine << "\""; - msgStream << ", stdout: \"" << stdoutContent.c_str() << "\""; - msgStream << ", stderr: \"" << stderrContent.c_str() << "\""; - std::string msg = msgStream.str(); - - CAF_CM_LOG_WARN_VA0(msg.c_str()); - CAF_CM_EXCEPTIONEX_VA0(ProcessFailedException, exitCode, msg); - } - - msgStream << "Command succeeded - cmdLine: \"" << cmdLine << "\"; output: "; - msgStream << ", stdout: \"" << stdoutContent.c_str() << "\""; - msgStream << ", stderr: \"" << stderrContent.c_str() << "\""; - CAF_CM_LOG_DEBUG_VA0(msgStream.str().c_str()); - } - } - CAF_CM_CATCH_CAF - CAF_CM_CATCH_DEFAULT - - try { - if (processInfo.hProcess != NULL) { - ::CloseHandle(processInfo.hProcess); - } - if (processInfo.hThread != NULL) { - ::CloseHandle(processInfo.hThread); - } - if (stdoutReadPipe != NULL) { - ::CloseHandle(stdoutReadPipe); - } - if (stdoutWritePipe != NULL) { - ::CloseHandle(stdoutWritePipe); - } - if (stderrReadPipe != NULL) { - ::CloseHandle(stderrReadPipe); - } - if (stderrWritePipe != NULL) { - ::CloseHandle(stderrWritePipe); - } - } - CAF_CM_CATCH_DEFAULT - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_THROWEXCEPTION; -} - -std::string ProcessUtils::readFromPipe( - const HANDLE readPipe) { - CAF_CM_STATIC_FUNC_LOG( "CProcessUtils", "readFromPipe" ); - - const uint32 maxOutBufSize = 1024; - - std::string rc = ""; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_PTR(readPipe); - - char readBuf[maxOutBufSize+1]; - DWORD numberOfBytesRead = 0; - for (BOOL apiRc = ::ReadFile(readPipe, readBuf, maxOutBufSize, &numberOfBytesRead, NULL); - apiRc != FALSE; - apiRc = ::ReadFile(readPipe, readBuf, maxOutBufSize, &numberOfBytesRead, NULL)) { - readBuf[numberOfBytesRead] = '\0'; - rc += std::string(readBuf); - } - } - CAF_CM_EXIT; - - return rc; -} -#else - -void SpawnChildSetup(gpointer data) { - int niceLevel = *((int*) data); - setpriority(PRIO_PROCESS, 0, niceLevel); -} - -void ProcessUtils::runSync( - const Cdeqstr& argv, - const std::string& stdoutPath, - const std::string& stderrPath, - std::string& stdoutContent, - std::string& stderrContent, - const ProcessUtils::Priority priority, - const std::string& workingDirectory) { - CAF_CM_STATIC_FUNC_LOG( "CProcessUtils", "runSync(NotWin)" ); - - GError *gError = NULL; - gchar *gStdout = NULL; - gchar *gStderr = NULL; - const char** argvNative = NULL; - - try { - CAF_CM_VALIDATE_STL(argv); - - const std::string cmdLine = convertToString(argv); - - // Each string in argvNative points to the internal memory in - // the corresponding string in argv. So int32 as argvNative and - // argv have (at least) the same scope, everything should be fine. - argvNative = convertToCharArray(argv); - - int niceLevel; - switch (priority) { - case LOW: - niceLevel = 10; - break; - - case IDLE: - niceLevel = 19; - break; - - case NORMAL: - default: - niceLevel = 0; - break; - } - - CAF_CM_LOG_INFO_VA1("Running command - %s", cmdLine.c_str()); - - gint gStatus = 0; - const bool isSuccessful = g_spawn_sync( - workingDirectory.length() == 0 ? NULL : workingDirectory.c_str(), - const_cast(argvNative), - NULL, // child's environment, or NULL to inherit parent's - static_cast(0), // GSpawnFlags - the defaults are fine - &SpawnChildSetup, // child_setup - function to run in the child just before exec() - &niceLevel, // user_data - user data for child_setup - &gStdout, - &gStderr, - &gStatus, - &gError); - - stdoutContent = (gStdout == NULL) ? std::string() : gStdout; - stderrContent = (gStderr == NULL) ? std::string() : gStderr; - - if (!stdoutContent.empty() && !stdoutPath.empty()) { - FileSystemUtils::saveTextFile(stdoutPath, stdoutContent); - } - if (!stderrContent.empty() && !stderrPath.empty()) { - FileSystemUtils::saveTextFile(stderrPath, stderrContent); - } - - std::ostringstream msgStream; - if(!isSuccessful || (WIFEXITED(gStatus) == FALSE) || (WEXITSTATUS(gStatus) != 0)) { - const std::string errorMessage = (gError == NULL) ? std::string() : gError->message; - const int32 errorCode = (gError == NULL) ? 0 : gError->code; - - msgStream << "Failed to invoke command - errorCode: " << errorCode; - msgStream << ", errorMessage: \"" << errorMessage.c_str() << "\""; - msgStream << ", cmdLine: \"" << cmdLine << "\""; - msgStream << ", stdout: \"" << stdoutContent.c_str() << "\""; - msgStream << ", stderr: \"" << stderrContent.c_str() << "\""; - std::string msg = msgStream.str(); - - CAF_CM_LOG_WARN_VA0(msg.c_str()); - CAF_CM_EXCEPTIONEX_VA0(ProcessFailedException, errorCode, msg); - } - - msgStream << "Command succeeded - cmdLine: \"" << cmdLine << "\"; output: "; - msgStream << ", stdout: \"" << stdoutContent.c_str() << "\""; - msgStream << ", stderr: \"" << stderrContent.c_str() << "\""; - CAF_CM_LOG_DEBUG_VA0(msgStream.str().c_str()); - - freeMemory(gError, gStdout, gStderr, argvNative); - } - catch(...) { - freeMemory(gError, gStdout, gStderr, argvNative); - throw; - } -} -#endif - -std::string ProcessUtils::getUserName() { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("ProcessUtils", "getUserName"); - - std::string rc; - - CAF_CM_ENTER { - const gchar* gUserName = g_get_user_name(); - CAF_CM_VALIDATE_PTR(gUserName); - - rc = gUserName; - } - CAF_CM_EXIT; - - return rc; -} - -std::string ProcessUtils::getRealUserName() { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("ProcessUtils", "getRealUserName"); - - std::string rc; - - CAF_CM_ENTER { - const gchar* gUserName = g_get_real_name(); - CAF_CM_VALIDATE_PTR(gUserName); - - rc = gUserName; - } - CAF_CM_EXIT; - - return rc; -} - -const char** ProcessUtils::convertToCharArray( - const Cdeqstr& deqstr) { - int32 rcIndex = 0; - const char** rc = new const char*[deqstr.size() + 1]; - for (TConstIterator strIter(deqstr); strIter; strIter++) { - rc[rcIndex++] = (*strIter).c_str(); - } - - rc[rcIndex++] = NULL; - - return rc; -} - -std::string ProcessUtils::convertToString(const Cdeqstr& deqstr) { - std::string rc; - for (TConstIterator strIter(deqstr); strIter; strIter++) { - std::string str = *strIter; -#ifdef WIN32 - if (rc.empty() && str.find(" ") != std::string::npos) { - str = "\"" + *strIter + "\""; - } -#endif - rc += str + std::string(" "); - } - - return rc; -} - -void ProcessUtils::freeMemory( - GError *gError, - gchar *gStdout, - gchar *gStderr, - const char** argvNative) { - if(gError != NULL) { - g_error_free(gError); - gError = NULL; - } - g_free(gStdout); - g_free(gStderr); - if (argvNative != NULL) { - delete[] argvNative; - } -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CProcessUtils.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CProcessUtils.h deleted file mode 100644 index c217cbdf0..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CProcessUtils.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Author: bwilliams - * Created: Jan 21, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CProcessUtils_H_ -#define CProcessUtils_H_ - -namespace Caf { - -class COMMONAGGREGATOR_LINKAGE ProcessUtils { -public: - enum COMMONAGGREGATOR_LINKAGE Priority { - NORMAL, - LOW, - IDLE - }; -public: - // Use for the "workingDirectory" parameter when you want to inherit the parents directory. - static const std::string INHERIT_PARENT_DIRECTORY; - -public: - static void runSyncToFiles( - const Cdeqstr& argv, - const std::string& stdoutPath, - const std::string& stderrPath, - const ProcessUtils::Priority priority = NORMAL, - const std::string workingDirectory = ProcessUtils::INHERIT_PARENT_DIRECTORY); - - static void runSync( - const Cdeqstr& argv, - std::string& stdoutContent, - std::string& stderrContent, - const ProcessUtils::Priority priority = NORMAL, - const std::string workingDirectory = ProcessUtils::INHERIT_PARENT_DIRECTORY); - -public: - static std::string getUserName(); - static std::string getRealUserName(); - -private: - static void runSync( - const Cdeqstr& argv, - const std::string& stdoutPath, - const std::string& stderrPath, - std::string& stdoutContent, - std::string& stderrContent, - const ProcessUtils::Priority priority, - const std::string& workingDirectory); - - static const char** convertToCharArray( - const Cdeqstr& argv); - - static std::string convertToString( - const Cdeqstr& deqstr); - - static void freeMemory( - GError *gError, - gchar *gStdout, - gchar *gStderr, - const char** argvNative); - -#ifdef WIN32 - static std::string readFromPipe( - const HANDLE readPipe); -#endif - -private: - CAF_CM_DECLARE_NOCREATE(ProcessUtils); -}; - -} - -#endif /* CProcessUtils_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CStringUtils.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CStringUtils.cpp deleted file mode 100644 index 3758b21b2..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CStringUtils.cpp +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Author: bwilliams - * Created: Jan 21, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "Exception/CCafException.h" -#include "Common/IAppConfig.h" -#include "CStringUtils.h" - -#include -#include -#include - -using namespace Caf; - -Cdeqstr CStringUtils::split(const std::string &str, const char delim) { - Cdeqstr rc; - std::string token; - std::stringstream stream(str); - while(std::getline(stream, token, delim)) { - rc.push_back(token); - } - - return rc; -} - -// trim from both ends -std::string CStringUtils::trim(const std::string &s) { - std::string sTmp = s; - return trimLeft(trimRight(sTmp)); -} - -// trim from start -std::string CStringUtils::trimLeft(const std::string &s) { - std::string sTmp = s; - sTmp.erase( - sTmp.begin(), - std::find_if( - sTmp.begin(), - sTmp.end(), - std::not1(std::ptr_fun(std::isspace)))); - return sTmp; -} - -// trim from end -std::string CStringUtils::trimRight(const std::string &s) { - std::string sTmp = s; - sTmp.erase( - std::find_if( - sTmp.rbegin(), - sTmp.rend(), - std::not1(std::ptr_fun(std::isspace))).base(), sTmp.end()); - return sTmp; -} - -// expand the environment variable in the string. -std::string CStringUtils::expandEnv(const std::string &envStr) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CStringUtils", "expandEnv"); - CAF_CM_VALIDATE_STRING(envStr); - - return getAppConfig()->resolveValue(envStr); -} - -UUID CStringUtils::createRandomUuidRaw() { - CAF_CM_STATIC_FUNC_LOG("CStringUtils", "createRandomUuidRaw"); - - UUID randomUuid; - if (S_OK != ::UuidCreate(&randomUuid)) { - CAF_CM_EXCEPTIONEX_VA0(InvalidHandleException, E_UNEXPECTED, - "Failed to create the UUID"); - } - - return randomUuid; -} - -std::string CStringUtils::createRandomUuid() { - return BasePlatform::UuidToString(createRandomUuidRaw()); -} - -inline bool caseInsCharCompare(char a, char b) { - return(::toupper(a) == ::toupper(b)); -} - -bool CStringUtils::isEqualIgnoreCase( - const std::string & src, - const std::string & srch) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CStringUtils", "isEqualIgnoreCase"); - CAF_CM_VALIDATE_STRING(src); - CAF_CM_VALIDATE_STRING(srch); - - return((src.size() == srch.size()) && - std::equal(src.begin(), src.end(), srch.begin(), caseInsCharCompare)); - -// std::string::iterator it = std::search( -// src.begin(), src.end(), -// srch.begin(), srch.end(), -// [](char ch1, char ch2) { return std::toupper(ch1) == std::toupper(ch2); } -// ); -// -// return (it != src.end()); -} - -#ifdef WIN32 -std::string CStringUtils::convertWideToNarrow( - const std::wstring& src) { - CAF_CM_STATIC_FUNC_LOG("CStringUtils", "convertWideToNarrow"); - - std::string rc; - - // deal with trivial case of empty string - if (! src.empty()) { - // determine required length of new string - const int32 srcLength = static_cast(src.length()); - const int32 reqLength = ::WideCharToMultiByte(CP_UTF8, 0, src.c_str(), srcLength, NULL, 0, NULL, NULL); - - // construct new string of required length - std::string dst(reqLength, '\0'); - - // convert old string to new string - const int32 dstLength = static_cast(dst.length()); - ::WideCharToMultiByte(CP_UTF8, 0, src.c_str(), srcLength, &dst[0], dstLength, NULL, NULL); - - rc = dst; - } - - return rc; -} - -std::wstring CStringUtils::convertNarrowToWide( - const std::string& src) { - CAF_CM_STATIC_FUNC_LOG("CStringUtils", "convertNarrowToWide"); - - std::wstring rc; - - // deal with trivial case of empty string - if (! src.empty()) { - // determine required length of new string - const int32 srcLength = static_cast(src.length()); - const int32 reqLength = ::MultiByteToWideChar(CP_UTF8, 0, src.c_str(), srcLength, NULL, 0); - - // construct new string of required length - std::wstring dst(reqLength, L'\0'); - - // convert old string to new string - const int32 dstLength = static_cast(dst.length()); - ::MultiByteToWideChar(CP_UTF8, 0, src.c_str(), srcLength, &dst[0], dstLength); - - rc = dst; - } - - return rc; -} -#endif - -std::string CStringUtils::toLower( - const std::string& str) { - CAF_CM_STATIC_FUNC_VALIDATE("CStringUtils", "toLower"); - CAF_CM_VALIDATE_STRING(str); - - std::string rc(str); - std::transform( - str.begin(), - str.end(), - rc.begin(), - std::ptr_fun(std::tolower)); - - return rc; -} - -std::string CStringUtils::toUpper( - const std::string& str) { - CAF_CM_STATIC_FUNC_VALIDATE("CStringUtils", "toUpper"); - CAF_CM_VALIDATE_STRING(str); - - std::string rc(str); - std::transform( - str.begin(), - str.end(), - rc.begin(), - std::ptr_fun(std::toupper)); - - return rc; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CStringUtils.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CStringUtils.h deleted file mode 100644 index e8f415ff2..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CStringUtils.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Author: bwilliams - * Created: Jan 21, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CSTRINGUTILS_H_ -#define CSTRINGUTILS_H_ - -#include - -namespace Caf { - -class COMMONAGGREGATOR_LINKAGE CStringUtils { -public: - static Cdeqstr split(const std::string &str, const char delim); - static std::string trim(const std::string &s); - static std::string trimLeft(const std::string &s); - static std::string trimRight(const std::string &s); - static std::string expandEnv(const std::string &s); - static UUID createRandomUuidRaw(); - static std::string createRandomUuid(); - static bool isEqualIgnoreCase(const std::string & src, const std::string & srch); -#ifdef WIN32 - static std::string convertWideToNarrow(const std::wstring& src); - static std::wstring convertNarrowToWide(const std::string& src); -#endif - - static std::string toLower( - const std::string& str); - - static std::string toUpper( - const std::string& str); - -private: - CAF_CM_DECLARE_NOCREATE(CStringUtils); -}; - -namespace CStringConv { - -// Templates to convert numbers to strings -template -inline std::basic_string toTString(const T& t) { - std::basic_ostringstream o; - o << t; - if (o.fail()) { - throw std::runtime_error("cannot convert number to string"); - } - return o.str(); -} - -template -inline std::string toString(const T& t) { - return toTString(t); -} - -template -inline std::wstring toWString(const T& t) { - return toTString(t); -} - -// Templates to convert strings to numbers -template -inline T fromTString(const std::basic_string& s) { - T t; - std::basic_istringstream i(s); - i >> t; - if (i.fail()) { - throw std::runtime_error("cannot convert string '" + s + "' to number"); - } - return t; -} - -template -inline T fromString(const std::string& s) { - return fromTString(s); -} - -template -inline T fromWString(const std::wstring& s) { - return fromTString(s); -} - -}} - -#endif /* CSTRINGUTILS_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CThreadPool.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CThreadPool.cpp deleted file mode 100644 index 98119980a..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CThreadPool.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* - * CThreadPool.cpp - * - * Created on: May 9, 2012 - * Author: mdonahue - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Common/CManagedThreadPool.h" -#include "Common/CThreadPool.h" -#include "Exception/CCafException.h" - - bool _isInitialized; - GThreadPool *_threadPool; - gpointer _userData; - -CThreadPool::CThreadPool() : - _isInitialized(false), - _threadPool(NULL), - _userData(NULL), - CAF_CM_INIT("CThreadPool") { - CAF_CM_INIT_THREADSAFE; -} - -CThreadPool::~CThreadPool() { - if (_threadPool) { - g_thread_pool_free(_threadPool, FALSE, TRUE); - } -} - -void CThreadPool::init(gpointer userData, gint maxThreads) { - CAF_CM_FUNCNAME("init"); - CAF_CM_LOCK_UNLOCK; - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - GError *error = NULL; - _threadPool = g_thread_pool_new( - ThreadFunc, - userData, - maxThreads, - TRUE, - &error); - if (error) { - CAF_CM_THROW_GERROR(error); - } - _isInitialized = true; -} - -void CThreadPool::term() { - CAF_CM_FUNCNAME_VALIDATE("term"); - CAF_CM_LOCK_UNLOCK; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - g_thread_pool_free(_threadPool, FALSE, TRUE); - _threadPool = NULL; -} - -void CThreadPool::addTask(const SmartPtrIThreadTask& task) { - CAF_CM_FUNCNAME("addTask"); - CAF_CM_LOCK_UNLOCK; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(task); - - if (_threadPool) { - GError *error = NULL; - g_thread_pool_push( - _threadPool, - task.GetAddRefedInterface(), - &error); - if (error) { - task->Release(); - CAF_CM_THROW_GERROR(error); - } - } else { - CAF_CM_EXCEPTIONEX_VA0( - IllegalStateException, - 0, - "The thread pool has been shut down"); - } -} - -void CThreadPool::ThreadFunc(gpointer data, gpointer userData) { - CAF_CM_STATIC_FUNC_LOG("CThreadPool", "ThreadFunc"); - CAF_CM_VALIDATE_PTR(data); - // userData is optional - IThreadTask *task = reinterpret_cast(data); - try { - task->run(userData); - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_CLEAREXCEPTION; - task->Release(); -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CThreadSignal.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CThreadSignal.cpp deleted file mode 100644 index 9a21d3d93..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CThreadSignal.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Author: bwilliams - * Created: Jul 2009 - * - * Copyright (C) 2009-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Common/CAutoMutex.h" -#include "Exception/CCafException.h" -#include "Common/CThreadSignal.h" - -using namespace Caf; - -CThreadSignal::CThreadSignal(void) : - _isInitialized(false), - CAF_CM_INIT("CThreadSignal") { - CAF_CM_INIT_THREADSAFE - ; -} - -CThreadSignal::~CThreadSignal(void) { -} - -void CThreadSignal::initialize(const std::string& conditionName) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - CAF_CM_LOCK_UNLOCK; - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(conditionName); - - _condition.initialize(conditionName); - _isInitialized = true; -} - -bool CThreadSignal::isInitialized() const { - CAF_CM_LOCK_UNLOCK; - return _isInitialized; -} - -void CThreadSignal::signal() { - CAF_CM_FUNCNAME_VALIDATE("signal"); - CAF_CM_LOCK_UNLOCK; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - _condition.signal(); -} - -void CThreadSignal::wait(SmartPtrCAutoMutex& mutex, const uint32 timeoutMs) { - CAF_CM_FUNCNAME("wait"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_SMARTPTR(mutex); - - const bool isSignaled = waitOrTimeout(mutex, timeoutMs); - if (!isSignaled) { - CAF_CM_EXCEPTION_VA1(ERROR_TIMEOUT, "Signal timed-out: %s", - _condition.getName().c_str()); - } -} - -bool CThreadSignal::waitOrTimeout(SmartPtrCAutoMutex& mutex, const uint32 timeoutMs) { - CAF_CM_FUNCNAME_VALIDATE("waitOrTimeout"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_SMARTPTR(mutex); - - bool rc = false; - if (0 == timeoutMs) { - _condition.wait(mutex); - rc = true; - } else { - gint64 endTime; - endTime = ::g_get_monotonic_time() + timeoutMs * G_TIME_SPAN_MILLISECOND; - rc = _condition.waitUntil(mutex, endTime); - } - - return rc; -} - -std::string CThreadSignal::getName() const { - CAF_CM_FUNCNAME_VALIDATE("getName"); - CAF_CM_LOCK_UNLOCK; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _condition.getName(); -} - -void CThreadSignal::close() { - CAF_CM_LOCK_UNLOCK; - - if (_isInitialized) { - _condition.close(); - _isInitialized = false; - } -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CThreadUtils.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CThreadUtils.cpp deleted file mode 100644 index f1e3be9c1..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CThreadUtils.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Author: bwilliams - * Created: Jan 21, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "Exception/CCafException.h" -#include "CThreadUtils.h" - -using namespace Caf; - -uint32 CThreadUtils::getThreadStackSizeKb() { - CAF_CM_STATIC_FUNC_LOG_ONLY("CThreadUtils", "getThreadStackSizeKb"); - - uint32 stackSizeKb = - AppConfigUtils::getRequiredUint32(_sAppConfigGlobalThreadStackSizeKb); - -#ifdef __linux__ - // The thread stack size is the larger of - // PTHREAD_STACK_MIN, 256K and the config file value - stackSizeKb = std::max((int32)stackSizeKb, std::max(PTHREAD_STACK_MIN, (256 * 1024)) / 1024); -#endif - CAF_CM_LOG_DEBUG_VA1("thread_stack_size_kb=%d", stackSizeKb); - return stackSizeKb; -} - -GThread* CThreadUtils::startJoinable(threadFunc func, void* data) { - CAF_CM_STATIC_FUNC("CThreadUtils", "startJoinable"); - - GThread *rc = g_thread_new("CThreadUtils::startJoinable", func, data); - if(NULL == rc) { - CAF_CM_EXCEPTION_VA0(0, "g_thread_new Failed"); - } - - return rc; -} - -void CThreadUtils::join(GThread* thread) { - (void) g_thread_join(thread); -} - -void CThreadUtils::sleep( - const uint32 milliseconds) { - - CAF_CM_ENTER { - const int32 microseconds = milliseconds * 1000; - g_usleep(microseconds); - } - CAF_CM_EXIT; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CThreadUtils.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CThreadUtils.h deleted file mode 100644 index f8f28824d..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CThreadUtils.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Author: bwilliams - * Created: Jan 21, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CThreadUtils_H_ -#define CThreadUtils_H_ - -namespace Caf { - -class COMMONAGGREGATOR_LINKAGE CThreadUtils { -public: - typedef void* (*threadFunc) (void* data); - -public: - static uint32 getThreadStackSizeKb(); - static GThread* startJoinable(threadFunc func, void* data); - static void join(GThread* thread); - static void sleep(const uint32 milliseconds); - -private: - CAF_CM_DECLARE_NOCREATE(CThreadUtils); -}; - -} - -#endif /* CThreadUtils_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CTimeUnit.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CTimeUnit.cpp deleted file mode 100644 index 53b5f1433..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CTimeUnit.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Author: bwilliams - * Created: Nov 17, 2014 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "CTimeUnit.h" - -using namespace Caf; - -int32 CTimeUnit::MILLISECONDS::toDays(const int32 milliseconds) { - return milliseconds / (1000*60*60*24); -} - -int32 CTimeUnit::MILLISECONDS::toHours(const int32 milliseconds) { - return milliseconds / (1000*60*60); -} - -int32 CTimeUnit::MILLISECONDS::toMinutes(const int32 milliseconds) { - return milliseconds / (1000*60); -} - -int32 CTimeUnit::MILLISECONDS::toSeconds(const int32 milliseconds) { - return milliseconds / 1000; -} - -int32 CTimeUnit::SECONDS::toDays(const int32 seconds) { - return seconds / (60*60*24); -} - -int32 CTimeUnit::SECONDS::toHours(const int32 seconds) { - return seconds / (60*60); -} - -int32 CTimeUnit::SECONDS::toMinutes(const int32 seconds) { - return seconds / 60; -} - -int32 CTimeUnit::SECONDS::toMilliseconds(const int32 seconds) { - return seconds * 1000; -} - -int32 CTimeUnit::MINUTES::toDays(const int32 seconds) { - return seconds / (60*24); -} - -int32 CTimeUnit::MINUTES::toHours(const int32 minutes) { - return minutes / 60; -} - -int32 CTimeUnit::MINUTES::toSeconds(const int32 minutes) { - return minutes * 60; -} - -int32 CTimeUnit::MINUTES::toMilliseconds(const int32 minutes) { - return minutes * 1000 * 60; -} - -int32 CTimeUnit::HOURS::toDays(const int32 hours) { - return hours / 24; -} - -int32 CTimeUnit::HOURS::toMinutes(const int32 hours) { - return hours * 60; -} - -int32 CTimeUnit::HOURS::toSeconds(const int32 hours) { - return hours * (60*60); -} - -int32 CTimeUnit::HOURS::toMilliseconds(const int32 hours) { - return hours * (60*60*1000); -} - -int32 CTimeUnit::DAYS::toHours(const int32 days) { - return days * 24; -} - -int32 CTimeUnit::DAYS::toMinutes(const int32 days) { - return days * (24*60); -} - -int32 CTimeUnit::DAYS::toSeconds(const int32 days) { - return days * (24*60*60); -} - -int32 CTimeUnit::DAYS::toMilliseconds(const int32 days) { - return days * (24*60*60*1000); -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CTimeUnit.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CTimeUnit.h deleted file mode 100644 index d2c5663fd..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CTimeUnit.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Author: bwilliams - * Created: Nov 17, 2014 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CTimeUnit_H_ -#define CTimeUnit_H_ - -namespace Caf { - -class COMMONAGGREGATOR_LINKAGE CTimeUnit { -public: - class COMMONAGGREGATOR_LINKAGE MILLISECONDS { - public: - static int32 toDays(const int32 milliseconds); - static int32 toHours(const int32 milliseconds); - static int32 toMinutes(const int32 milliseconds); - static int32 toSeconds(const int32 milliseconds); - }; - - class COMMONAGGREGATOR_LINKAGE SECONDS { - public: - static int32 toDays(const int32 seconds); - static int32 toHours(const int32 seconds); - static int32 toMinutes(const int32 seconds); - static int32 toMilliseconds(const int32 seconds); - }; - - class COMMONAGGREGATOR_LINKAGE MINUTES { - public: - static int32 toDays(const int32 minutes); - static int32 toHours(const int32 minutes); - static int32 toSeconds(const int32 minutes); - static int32 toMilliseconds(const int32 minutes); - }; - - class COMMONAGGREGATOR_LINKAGE HOURS { - public: - static int32 toDays(const int32 hours); - static int32 toMinutes(const int32 hours); - static int32 toSeconds(const int32 hours); - static int32 toMilliseconds(const int32 hours); - }; - - class COMMONAGGREGATOR_LINKAGE DAYS { - public: - static int32 toHours(const int32 days); - static int32 toMinutes(const int32 days); - static int32 toSeconds(const int32 days); - static int32 toMilliseconds(const int32 days); - }; - -private: - CAF_CM_DECLARE_NOCREATE(CTimeUnit); -}; - -} - -#endif /* CTimeUnit_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CVariant.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CVariant.cpp deleted file mode 100644 index e380ccd06..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CVariant.cpp +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Created on: Jun 7, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "Exception/CCafException.h" -#include "Common/CVariant.h" - -using namespace Caf; - -CVariant::CVariant() : - _variant(NULL), - CAF_CM_INIT("CVariant") { -} - -CVariant::~CVariant() { - if (_variant) { - g_variant_unref(_variant); - } -} - -void CVariant::set(GVariant *variant) { - CAF_CM_FUNCNAME_VALIDATE("set"); - CAF_CM_VALIDATE_PTR(variant); - if (_variant) { - g_variant_unref(_variant); - _variant = NULL; - } - _variant = g_variant_ref_sink(variant); -} - -GVariant *CVariant::get() const { - CAF_CM_FUNCNAME_VALIDATE("get"); - CAF_CM_VALIDATE_PTR(_variant); - return _variant; -} - -std::string CVariant::toString() const { - CAF_CM_FUNCNAME("toString"); - CAF_CM_VALIDATE_PTR(_variant); - std::string result; - - const GVariantType *variantType = g_variant_get_type(_variant); - if (g_variant_type_equal(variantType, G_VARIANT_TYPE_BOOLEAN)) { - result = g_variant_get_boolean(_variant) ? "true" : "false"; - } else if (g_variant_type_equal(variantType, G_VARIANT_TYPE_BYTE)) { - result = CStringConv::toString(g_variant_get_byte(_variant)); - } else if (g_variant_type_equal(variantType, G_VARIANT_TYPE_INT16)) { - result = CStringConv::toString(g_variant_get_int16(_variant)); - } else if (g_variant_type_equal(variantType, G_VARIANT_TYPE_UINT16)) { - result = CStringConv::toString(g_variant_get_uint16(_variant)); - } else if (g_variant_type_equal(variantType, G_VARIANT_TYPE_INT32)) { - result = CStringConv::toString(g_variant_get_int32(_variant)); - } else if (g_variant_type_equal(variantType, G_VARIANT_TYPE_UINT32)) { - result = CStringConv::toString(g_variant_get_uint32(_variant)); - } else if (g_variant_type_equal(variantType, G_VARIANT_TYPE_INT64)) { - result = CStringConv::toString(g_variant_get_int64(_variant)); - } else if (g_variant_type_equal(variantType, G_VARIANT_TYPE_UINT64)) { - result = CStringConv::toString(g_variant_get_uint64(_variant)); - } else if (g_variant_type_equal(variantType, G_VARIANT_TYPE_STRING)) { - result = g_variant_get_string(_variant, NULL); - } else { - CAF_CM_EXCEPTIONEX_VA1( - UnsupportedOperationException, - 0, - "Unsupported GVariant conversion to string from type '%s'", - g_variant_get_type_string(_variant)); - } - return result; -} - -bool CVariant::isString() const { - return isType(G_VARIANT_TYPE_STRING); -} - -bool CVariant::isBool() const { - return isType(G_VARIANT_TYPE_BOOLEAN); -} - -bool CVariant::isUint8() const { - return isType(G_VARIANT_TYPE_BYTE); -} - -bool CVariant::isInt16() const { - return isType(G_VARIANT_TYPE_INT16); -} - -bool CVariant::isUint16() const { - return isType(G_VARIANT_TYPE_UINT16); -} - -bool CVariant::isInt32() const { - return isType(G_VARIANT_TYPE_INT32); -} - -bool CVariant::isUint32() const { - return isType(G_VARIANT_TYPE_UINT32); -} - -bool CVariant::isInt64() const { - return isType(G_VARIANT_TYPE_INT64); -} - -bool CVariant::isUint64() const { - return isType(G_VARIANT_TYPE_UINT64); -} - -SmartPtrCVariant CVariant::createString(const std::string& value) { - SmartPtrCVariant variant; - variant.CreateInstance(); - variant->set(g_variant_new_string(value.c_str())); - return variant; -} - -SmartPtrCVariant CVariant::createBool(const bool value) { - SmartPtrCVariant variant; - variant.CreateInstance(); - variant->set(g_variant_new_boolean(value)); - return variant; -} - -SmartPtrCVariant CVariant::createUint8(const uint8 value) { - SmartPtrCVariant variant; - variant.CreateInstance(); - variant->set(g_variant_new_byte(value)); - return variant; -} - -SmartPtrCVariant CVariant::createInt16(const int16 value) { - SmartPtrCVariant variant; - variant.CreateInstance(); - variant->set(g_variant_new_int16(value)); - return variant; -} - -SmartPtrCVariant CVariant::createUint16(const uint16 value) { - SmartPtrCVariant variant; - variant.CreateInstance(); - variant->set(g_variant_new_uint16(value)); - return variant; -} - -SmartPtrCVariant CVariant::createInt32(const int32 value) { - SmartPtrCVariant variant; - variant.CreateInstance(); - variant->set(g_variant_new_int32(value)); - return variant; -} - -SmartPtrCVariant CVariant::createUint32(const uint32 value) { - SmartPtrCVariant variant; - variant.CreateInstance(); - variant->set(g_variant_new_uint32(value)); - return variant; -} - -SmartPtrCVariant CVariant::createInt64(const int64 value) { - SmartPtrCVariant variant; - variant.CreateInstance(); - variant->set(g_variant_new_int64(value)); - return variant; -} - -SmartPtrCVariant CVariant::createUint64(const uint64 value) { - SmartPtrCVariant variant; - variant.CreateInstance(); - variant->set(g_variant_new_uint64(value)); - return variant; -} - -bool CVariant::isType(const GVariantType * varType) const { - CAF_CM_FUNCNAME_VALIDATE("isType"); - CAF_CM_VALIDATE_PTR(_variant); - CAF_CM_VALIDATE_PTR(varType); - return g_variant_type_equal(g_variant_get_type(_variant), varType); -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CafInitialize.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CafInitialize.cpp deleted file mode 100644 index 391034002..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CafInitialize.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Author: mdonahue - * Created: Jan 24, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#ifdef WIN32 -#include "Common/CWinScm.h" -#endif - -#include "CafInitialize.h" - -using namespace Caf; - -HRESULT CafInitialize::init() { - return S_OK; -} - -HRESULT CafInitialize::serviceConfig() { -#ifdef WIN32 -// CWinScm toolsScm("VMTools"); -// SmartPtrSServiceConfig toolsConfig = toolsScm.getServiceConfig(false); -// if (!toolsConfig.isNull()) { -// // Add to path -// } - - CWinScm vgAuthScm("VGAuthService"); - Caf::CWinScm::SmartPtrSServiceConfig vgAuthConfig = vgAuthScm.getServiceConfig(false); - if (!vgAuthConfig.IsNull() && !vgAuthConfig->_binaryPathName.empty()) { - // Add to path - std::string dllPath = vgAuthConfig->_binaryPathName; - if (dllPath[0] == '\"') { - dllPath = dllPath.substr(1, dllPath.length() - 2); - } - - const std::wstring dllPathWide = CStringUtils::convertNarrowToWide(FileSystemUtils::getDirname(dllPath)); - // NOTE: Can't use ::AddDllDirectory because it requires a newer base version of windows. Even so, - // MSDN documentation specifies search order to be non-deterministic. - if (0 == ::SetDllDirectory(dllPathWide.c_str())) { - const DWORD lastError = ::GetLastError(); - const std::string errorMsg = BasePlatform::PlatformApi::GetApiErrorMessage(lastError); - ::fprintf( - stderr, - "CafInitialize::serviceConfig() ::AddDllDirectory() Failed - : VGAuthService, msg: \"%s\"", - errorMsg.c_str()); - } - } -#endif - return S_OK; -} - -HRESULT CafInitialize::term() { - return S_OK; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CafInitialize.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CafInitialize.h deleted file mode 100644 index a5eefa04a..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CafInitialize.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Author: mdonahue - * Created: Jan 24, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CAFINITIALIZE_H_ -#define CAFINITIALIZE_H_ - -namespace Caf { - -class COMMONAGGREGATOR_LINKAGE CafInitialize { -public: - static HRESULT init(); - static HRESULT serviceConfig(); - static HRESULT term(); - - CAF_CM_DECLARE_NOCREATE(CafInitialize); -}; - -} - -#endif /* CAFINITIALIZE_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CommonAggregatorLink.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CommonAggregatorLink.h deleted file mode 100644 index 5e805b09f..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/CommonAggregatorLink.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Author: mdonahue - * Created: Jan 13, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef COMMONAGGREGATORLINK_H_ -#define COMMONAGGREGATORLINK_H_ - -#ifndef COMMONAGGREGATOR_LINKAGE - #ifdef WIN32 - #ifdef FRAMEWORK_BUILD - #define COMMONAGGREGATOR_LINKAGE __declspec(dllexport) - #else - #define COMMONAGGREGATOR_LINKAGE __declspec(dllimport) - #endif - #else - #define COMMONAGGREGATOR_LINKAGE - #endif -#endif - -#include -#include -#include -#include -#include - -#include -#include - -#include "../Logging/LoggingLink.h" -#include "../Exception/ExceptionLink.h" -#include "../Collections/Iterators/IteratorsInc.h" -#include "../Collections/Graphs/GraphsInc.h" - -#include "CTimeUnit.h" -#include "CAutoFileUnlock.h" -#include "CStringUtils.h" -#include "CFileSystemUtils.h" -#include "CProcessUtils.h" -#include "CDateTimeUtils.h" -#include "CThreadUtils.h" -#include "AppConfigUtils.h" -#include "CAutoMutexLockUnlock.h" -#include "CAutoMutexLockUnlockRaw.h" -#include "CAutoMutexUnlockLock.h" -#include "CafInitialize.h" -#include "CHexCodec.h" -#include "UriUtils.h" -#include "TBlockingCell.h" -#include "Common/CVariant.h" -#include "CEnvironmentUtils.h" -#include "CPersistenceUtils.h" - -#if defined(__linux__) || defined(__APPLE__) -#include "CDaemonUtils.h" -#elif WIN32 -#endif - -#include "../SubSystemBase/SubSystemBaseLink.h" -#include "../Xml/MarkupParser/MarkupParserLink.h" -#include "../Xml/XmlUtils/XmlUtilsLink.h" - -#endif /* COMMONAGGREGATORLINK_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/TBlockingCell.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/TBlockingCell.h deleted file mode 100644 index 8e31e1a7c..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/TBlockingCell.h +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Created on: May 15, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef TBLOCKINGCELL_H_ -#define TBLOCKINGCELL_H_ - -#include "Common/CThreadSignal.h" -#include "Exception/CCafException.h" - -namespace Caf { - -/** - * @brief Simple one-shot IPC mechanism. - * Allows a value to be passed from one thread to another in a thread-safe manner. - * The value may only be set once and once set may get retrieved as many times as - * desired. - */ -template class TBlockingCell { - -public: - TBlockingCell() : - _filled(false) { - CAF_CM_INIT_THREADSAFE; - CAF_THREADSIGNAL_INIT; - //TODO: This has stopped working... why? - //_value = NULL; - _valueSignal.initialize("valueSignal"); - } - - virtual ~TBlockingCell() { - } - - /** - * @brief Wait for a value indefinitely - * Waits indefinitely for the value to be set or returns the value if it is - * already set. - * @return value - */ - T get() { - return get(0); - } - - /** - * @brief Wait for a value for a specified amount of time - * Waits for a set amout of time (milliseconds) for the value to be set or returns - * the value if it is already set. - * @retval value if set - * @retval TimeoutException thrown if time expires - */ - T get(uint32 timeoutMs) { - CAF_CM_STATIC_FUNC("TBlockingCell", "get"); - CAF_CM_LOCK; - CAF_THREADSIGNAL_LOCK_UNLOCK; - if (!_filled) { - CAF_CM_UNLOCK; - _valueSignal.waitOrTimeout(CAF_THREADSIGNAL_MUTEX, timeoutMs); - CAF_CM_LOCK; - if (!_filled) { - CAF_CM_UNLOCK; - CAF_CM_EXCEPTIONEX_VA0( - TimeoutException, - 0, - "Timed out waiting for value to be set"); - } else { - CAF_CM_UNLOCK; - } - } else { - CAF_CM_UNLOCK; - } - return _value; - } - - /** - * @brief Sets a new value if the value is not already set - * If the value is already set an IllegalStateException will be thrown. - */ - void set(T newValue) { - CAF_CM_STATIC_FUNC("TBlockingCell", "set"); - CAF_CM_LOCK_UNLOCK; - if (_filled) { - CAF_CM_EXCEPTIONEX_VA0( - IllegalStateException, - 0, - "The value can only be set once"); - } - _value = newValue; - _filled = true; - _valueSignal.signal(); - } - -private: - bool _filled; - T _value; - CAF_THREADSIGNAL_CREATE; - CThreadSignal _valueSignal; - CAF_CM_CREATE_THREADSAFE; - CAF_CM_DECLARE_NOCOPY(TBlockingCell); -}; - -} - - -#endif /* TBLOCKINGCELL_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/UriUtils.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/UriUtils.cpp deleted file mode 100644 index 7dc265a23..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/UriUtils.cpp +++ /dev/null @@ -1,406 +0,0 @@ -/* - * Author: mdonahue - * Created: Feb 4, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "Exception/CCafException.h" -#include "UriUtils.h" - -using namespace Caf; - -void UriUtils::parseUriString( - const std::string& uri, - UriUtils::SUriRecord& data) { - CAF_CM_STATIC_FUNC("UriUtils", "parseUriString"); - CAF_CM_VALIDATE_STRING(uri); - - // examples: - // - // vmcf:service_id@tcp:host=hostname,port=portnum?timeout=timeoutval - // tunnel:localhost:6672/amqp_queue_name?vhost=caf;connection_timeout=150000;connection_retries=10;connection_seconds_to_wait=10;channel_cache_size=3 - // amqp:guest:guest@10.25.91.81:5672/amqp_queue_name?vhost=caf;connection_timeout=150000;connection_retries=10;connection_seconds_to_wait=10;channel_cache_size=3 - - static const std::string uriPattern("^(?P[^:]+?):(?P

[^?]+)\\?\?(?P.*)"); - static const std::string parmPattern("(?P[^=]+)=(?P[^;]+);?"); - static const std::string namePattern("^(?P[^:]+):(?P[^@]+)@(?P.*)"); - static const std::string hostPattern("^(?P[^:]+):(?P[^/]+)/"); - static const std::string pathPattern("/(?P[^?]+)"); - - CAF_CM_ENTER { - data.protocol = std::string(); - data.address = std::string(); - data.parameters.clear(); - - GRegex *regexUri = NULL; - GRegex *regexParms = NULL; - GRegex *regexName = NULL; - GRegex *regexHost = NULL; - GRegex *regexPath = NULL; - GMatchInfo* matchInfo = NULL; - - try { - CAF_CM_VALIDATE_STRING(uri); - GError *error = NULL; - regexUri = g_regex_new(uriPattern.c_str(), - (GRegexCompileFlags)(G_REGEX_RAW), - (GRegexMatchFlags)0, - &error); - if (error) { - throw error; - } - - regexParms = g_regex_new(parmPattern.c_str(), - (GRegexCompileFlags)(G_REGEX_OPTIMIZE | G_REGEX_RAW), - (GRegexMatchFlags)0, - &error); - if (error) { - throw error; - } - - regexName = g_regex_new(namePattern.c_str(), - (GRegexCompileFlags)(G_REGEX_OPTIMIZE | G_REGEX_RAW), - (GRegexMatchFlags)0, - &error); - if (error) { - throw error; - } - - regexHost = g_regex_new(hostPattern.c_str(), - (GRegexCompileFlags)(G_REGEX_OPTIMIZE | G_REGEX_RAW), - (GRegexMatchFlags)0, - &error); - if (error) { - throw error; - } - - regexPath = g_regex_new(pathPattern.c_str(), - (GRegexCompileFlags)(G_REGEX_OPTIMIZE | G_REGEX_RAW), - (GRegexMatchFlags)0, - &error); - if (error) { - throw error; - } - - if (g_regex_match(regexUri, uri.c_str(), (GRegexMatchFlags)0, &matchInfo)) { - gchar *value = g_match_info_fetch_named(matchInfo, "protocol"); - data.protocol = value; - g_free(value); - value = g_match_info_fetch_named(matchInfo, "address"); - data.address = value; - g_free(value); - value = g_match_info_fetch_named(matchInfo, "parameters"); - std::string params(value ? value : ""); - g_free(value); - g_match_info_free(matchInfo); - matchInfo = NULL; - - if (! data.address.empty()) { - std::string hostpath = data.address; - if (g_regex_match(regexName, data.address.c_str(), (GRegexMatchFlags)0, &matchInfo)) { - value = g_match_info_fetch_named(matchInfo, "username"); - data.username = value; - g_free(value); - value = g_match_info_fetch_named(matchInfo, "password"); - data.password = value; - g_free(value); - value = g_match_info_fetch_named(matchInfo, "hostpath"); - hostpath = value; - g_free(value); - } - g_match_info_free(matchInfo); - matchInfo = NULL; - - if (g_regex_match(regexHost, hostpath.c_str(), (GRegexMatchFlags)0, &matchInfo)) { - value = g_match_info_fetch_named(matchInfo, "host"); - data.host = value; - g_free(value); - value = g_match_info_fetch_named(matchInfo, "port"); - data.portStr = value; - data.port = CStringConv::fromString(value); - g_free(value); - } - g_match_info_free(matchInfo); - matchInfo = NULL; - - if (g_regex_match(regexPath, hostpath.c_str(), (GRegexMatchFlags)0, &matchInfo)) { - value = g_match_info_fetch_named(matchInfo, "path"); - data.path = value; - g_free(value); - } - g_match_info_free(matchInfo); - matchInfo = NULL; - } - - if (params.length()) { - if (g_regex_match(regexParms, params.c_str(), (GRegexMatchFlags)0, &matchInfo)) { - while (g_match_info_matches(matchInfo)) { - value = g_match_info_fetch_named(matchInfo, "name"); - std::string paramName(value); - g_free(value); - value = g_match_info_fetch_named(matchInfo, "value"); - std::string paramValue(value); - g_free(value); - if (!data.parameters.insert( - std::map::value_type(paramName, paramValue)).second) { - CAF_CM_EXCEPTION_VA2(ERROR_DUPLICATE_TAG, - "Duplicate parameter name %s in %s", - paramName.c_str(), - uri.c_str()); - } - g_match_info_next(matchInfo, &error); - if (error) { - throw error; - } - } - } - g_match_info_free(matchInfo); - matchInfo = NULL; - } - } - } - CAF_CM_CATCH_CAF - CAF_CM_CATCH_GERROR - - if (matchInfo) { - g_match_info_free(matchInfo); - } - if (regexUri) { - g_regex_unref(regexUri); - } - if (regexParms) { - g_regex_unref(regexParms); - } - if (regexName) { - g_regex_unref(regexName); - } - if (regexHost) { - g_regex_unref(regexHost); - } - if (regexPath) { - g_regex_unref(regexPath); - } - CAF_CM_THROWEXCEPTION; - } - CAF_CM_EXIT; -} - -std::string UriUtils::buildUriString( - UriUtils::SUriRecord& data) { - CAF_CM_STATIC_FUNC_VALIDATE("UriUtils", "buildUriString"); - CAF_CM_VALIDATE_STRING(data.protocol); - CAF_CM_VALIDATE_STRING(data.host); - CAF_CM_VALIDATE_STRING(data.path); - - std::string rc = data.protocol + ":"; - if (! data.username.empty() || ! data.password.empty()) { - rc += data.username + ":" + data.password + "@"; - } - - rc += data.host; - - if (! data.portStr.empty()) { - rc += ":" + data.portStr; - } - - rc += "/" + data.path; - - rc = appendParameters(rc, data.parameters); - - return rc; -} - -void UriUtils::parseFileAddress(const std::string& fileUri, UriUtils::SFileUriRecord& data) { - CAF_CM_STATIC_FUNC_LOG("UriUtils", "parseFileAddress"); - CAF_CM_VALIDATE_STRING(fileUri); - - // examples: - // - // ///c:/tmp - - static const std::string addressPattern("^//(?P[^/]*)/(?P.*)"); - static const std::string drivePattern("^[a-zA-Z]:"); - - CAF_CM_ENTER { - data.hostname = std::string(); - data.path = std::string(); - - GRegex *regexAddress = NULL; - GRegex *regexDrive = NULL; - GMatchInfo* matchInfo = NULL; - - try { - CAF_CM_VALIDATE_STRING(fileUri); - - GError *error = NULL; - regexAddress = g_regex_new(addressPattern.c_str(), - (GRegexCompileFlags)(G_REGEX_RAW), - (GRegexMatchFlags)0, - &error); - if (error) { - throw error; - } - - if (g_regex_match(regexAddress, fileUri.c_str(), (GRegexMatchFlags)0, &matchInfo)) { - gchar *value = g_match_info_fetch_named(matchInfo, "hostname"); - data.hostname = value; - g_free(value); - value = g_match_info_fetch_named(matchInfo, "path"); - data.path = value; - g_free(value); - g_match_info_free(matchInfo); - matchInfo = NULL; - - regexDrive = g_regex_new(drivePattern.c_str(), - (GRegexCompileFlags)(G_REGEX_RAW), - (GRegexMatchFlags)0, - &error); - if (error) { - throw error; - } - - if (! g_regex_match(regexDrive, data.path.c_str(), (GRegexMatchFlags)0, &matchInfo)) { - data.path = "/" + data.path; - } - g_match_info_free(matchInfo); - matchInfo = NULL; - } - } - CAF_CM_CATCH_CAF - CAF_CM_CATCH_GERROR - - if (matchInfo) { - g_match_info_free(matchInfo); - } - if (regexAddress) { - g_regex_unref(regexAddress); - } - if (regexDrive) { - g_regex_unref(regexDrive); - } - CAF_CM_THROWEXCEPTION; - } - CAF_CM_EXIT; -} - -std::string UriUtils::parseRequiredFilePath( - const std::string& uriStr) { - CAF_CM_STATIC_FUNC("UriUtils", "parseRequiredFilePath"); - CAF_CM_VALIDATE_STRING(uriStr); - - std::string rc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(uriStr); - - SUriRecord uriRecord; - parseUriString(uriStr, uriRecord); - - if(uriRecord.protocol.compare("file") != 0) { - CAF_CM_EXCEPTIONEX_VA2(InvalidArgumentException, ERROR_INVALID_DATA, - "Unsupported protocol (%s != \"file\") - %s", - uriRecord.protocol.c_str(), uriStr.c_str()); - } - - UriUtils::SFileUriRecord fileUriRecord; - UriUtils::parseFileAddress(uriRecord.address, fileUriRecord); - - rc = CStringUtils::expandEnv(fileUriRecord.path); - if(! FileSystemUtils::doesFileExist(rc)) { - CAF_CM_EXCEPTIONEX_VA1(FileNotFoundException, ERROR_FILE_NOT_FOUND, - "File in URI not found - %s", rc.c_str()); - } - } - CAF_CM_EXIT; - - return rc; -} - -std::string UriUtils::parseOptionalFilePath( - const std::string& uriStr) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("UriUtils", "parseOptionalFilePath"); - CAF_CM_VALIDATE_STRING(uriStr); - - std::string rc = ""; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(uriStr); - - SUriRecord uriRecord; - parseUriString(uriStr, uriRecord); - - if(uriRecord.protocol.compare("file") != 0) { - CAF_CM_LOG_DEBUG_VA2( - "Unsupported protocol (%s != \"file\") - %s", - uriRecord.protocol.c_str(), uriStr.c_str()); - } else { - UriUtils::SFileUriRecord fileUriRecord; - UriUtils::parseFileAddress(uriRecord.address, fileUriRecord); - - const std::string filePath = CStringUtils::expandEnv(fileUriRecord.path); - if(! FileSystemUtils::doesFileExist(filePath)) { - CAF_CM_LOG_DEBUG_VA2( - "File in URI not found - uri: %s, path: %s", uriStr.c_str(), filePath.c_str()); - } else { - rc = filePath; - } - } - } - CAF_CM_EXIT; - - return rc; -} - -std::string UriUtils::appendParameters( - const std::string& uriStr, - const std::map& parameters) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("UriUtils", "appendParameters"); - CAF_CM_VALIDATE_STRING(uriStr); - - std::string rc = uriStr; - if (!parameters.empty()) { - rc += "?"; - for (TConstMapIterator > parameter(parameters); - parameter; parameter++) { - rc += parameter.getKey() + "=" + *parameter + ";"; - } - } - - CAF_CM_LOG_DEBUG_VA1("Appended parameters - num: %d", parameters.size()); - - return rc; -} - -std::string UriUtils::findOptParameter( - const UriUtils::SUriRecord& uri, - const std::string& name, - const std::string& defaultValue) { - CAF_CM_STATIC_FUNC_VALIDATE("UriUtils", "findOptParameter"); - CAF_CM_VALIDATE_STRING(name); - - std::string rc = defaultValue; - const std::map::const_iterator param = - uri.parameters.find(name); - if(param != uri.parameters.end()) { - rc = param->second; - } - - return rc; -} - -std::string UriUtils::findReqParameter( - const UriUtils::SUriRecord& uri, - const std::string& name) { - CAF_CM_STATIC_FUNC("UriUtils", "findReqParameter"); - CAF_CM_VALIDATE_STRING(name); - - const std::map::const_iterator param = - uri.parameters.find(name); - if(param == uri.parameters.end()) { - CAF_CM_EXCEPTION_VA1(E_INVALIDARG, "param not found - %s", name.c_str()); - } - - return param->second; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/UriUtils.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/UriUtils.h deleted file mode 100644 index 48f381b50..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/UriUtils.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Author: mdonahue - * Created: Feb 4, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef UriUtils_h_ -#define UriUtils_h_ - -namespace Caf { - -namespace UriUtils { - - struct SUriRecord { - std::string protocol; - std::string address; - std::string username; - std::string password; - std::string host; - uint32 port; - std::string portStr; - std::string path; - std::map parameters; - }; - - struct SFileUriRecord { - std::string hostname; - std::string path; - }; - - void COMMONAGGREGATOR_LINKAGE parseUriString(const std::string& uri, SUriRecord& data); - std::string COMMONAGGREGATOR_LINKAGE buildUriString(SUriRecord& data); - void COMMONAGGREGATOR_LINKAGE parseFileAddress(const std::string& fileUri, SFileUriRecord& data); - std::string COMMONAGGREGATOR_LINKAGE parseRequiredFilePath(const std::string& uriStr); - std::string COMMONAGGREGATOR_LINKAGE parseOptionalFilePath(const std::string& uriStr); - std::string COMMONAGGREGATOR_LINKAGE appendParameters(const std::string& uriStr, - const std::map& parameters); - - std::string COMMONAGGREGATOR_LINKAGE findOptParameter( - const UriUtils::SUriRecord& uri, - const std::string& name, - const std::string& defaultValue = std::string()); - std::string COMMONAGGREGATOR_LINKAGE findReqParameter( - const UriUtils::SUriRecord& uri, - const std::string& name); -}; - -} - -#endif /* UriUtils_h_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/stdafx.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/stdafx.h deleted file mode 100644 index 91c0d5b49..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Common/stdafx.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Author: mdonahue - * Created: Jan 13, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef STDAFX_H_ -#define STDAFX_H_ - -#ifdef WIN32 - #define COMMONAGGREGATOR_LINKAGE __declspec(dllexport) - #define EXCEPTION_LINKAGE __declspec(dllexport) - #define LOGGING_LINKAGE __declspec(dllexport) - #define SUBSYSTEMBASE_LINKAGE __declspec(dllexport) - #define MARKUPPARSER_LINKAGE __declspec(dllexport) - #define XMLUTILS_LINKAGE __declspec(dllexport) -#else - #define COMMONAGGREGATOR_LINKAGE - #define EXCEPTION_LINKAGE - #define LOGGING_LINKAGE - #define SUBSYSTEMBASE_LINKAGE - #define MARKUPPARSER_LINKAGE - #define XMLUTILS_LINKAGE -#endif - -#include - -#include "CommonAggregatorLink.h" - -#endif /* STDAFX_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/CommonGlobals.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/CommonGlobals.cpp deleted file mode 100644 index a03376866..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/CommonGlobals.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Author: bwilliams - * Created: 10/19/2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include - -namespace Caf { - const char* _sConfigTmpDir = "tmp_dir"; - const char* _sConfigInputDir = "input_dir"; - const char* _sConfigOutputDir = "output_dir"; - const char* _sConfigSchemaCacheDir = "schema_cache_dir"; - const char* _sConfigProviderRegDir = "provider_reg_dir"; - const char* _sConfigInstallDir = "install_dir"; - const char* _sConfigInvokersDir = "invokers_dir"; - const char* _sConfigProvidersDir = "providers_dir"; - const char* _sConfigCommonPackagesDir = "common_packages_dir"; - const char* _sConfigWorkingDir = "working_dir"; - const char* _sConfigPrivateKeyFile = "private_key_file"; - const char* _sConfigCertFile = "cert_file"; - - const char* _sProviderHostArea = "providerHost"; - const char* _sManagementAgentArea = "managementAgent"; - - const char* _sSchemaSummaryFilename = "schemaSummary.xml"; - const char* _sProviderResponseFilename = "providerResponse.xml"; - const char* _sStdoutFilename = "_provider_stdout_"; - const char* _sStderrFilename = "_provider_stderr_"; - - const char* _sPayloadRequestFilename = "payloadRequest.xml"; - const char* _sResponseFilename = "response.xml"; - const char* _sErrorResponseFilename = "errorResponse.xml"; - const char* _sProviderRequestFilename = "providerRequest.xml"; - const char* _sInfraErrFilename = "_infraError_"; - - const char* _sAppConfigGlobalParamRootDir = "root_dir"; - const char* _sAppConfigGlobalParamDataDir = "data_dir"; - const char* _sAppConfigGlobalParamLogDir = "log_dir"; - const char* _sAppConfigGlobalParamLogConfigFile = "log_config_file"; - const char* _sAppConfigGlobalParamInputDir = "input_dir"; - const char* _sAppConfigGlobalParamOutputDir = "output_dir"; - const char* _sAppConfigGlobalParamDbDir = "db_dir"; - const char* _sAppConfigGlobalThreadStackSizeKb = "thread_stack_size_kb"; - - const GUID CAFCOMMON_GUID_NULL = {0}; - -#ifdef WIN32 - const char* CAFCOMMON_PATH_DELIM = "\\"; - const char CAFCOMMON_PATH_DELIM_CHAR = '\\'; -#else - const char* CAFCOMMON_PATH_DELIM = "/"; - const char CAFCOMMON_PATH_DELIM_CHAR = '/'; -#endif -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CAddInCollectionDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CAddInCollectionDoc.cpp deleted file mode 100644 index ede483ff2..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CAddInCollectionDoc.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" -#include "Doc/CafCoreTypesDoc/CAddInCollectionDoc.h" - -using namespace Caf; - -/// A simple container for objects of type AddInCollection -CAddInCollectionDoc::CAddInCollectionDoc() : - _isInitialized(false) {} -CAddInCollectionDoc::~CAddInCollectionDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CAddInCollectionDoc::initialize( - const std::deque addInCollection) { - if (! _isInitialized) { - _addInCollection = addInCollection; - - _isInitialized = true; - } -} - -/// Accessor for the AddIn -std::deque CAddInCollectionDoc::getAddInCollection() const { - return _addInCollection; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CAddInsDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CAddInsDoc.cpp deleted file mode 100644 index 54b9c9972..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CAddInsDoc.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/CafCoreTypesDoc/CAddInCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CAddInsDoc.h" - -using namespace Caf; - -/// A simple container for objects of type AddIns -CAddInsDoc::CAddInsDoc() : - _isInitialized(false) {} -CAddInsDoc::~CAddInsDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CAddInsDoc::initialize( - const std::deque addInCollection) { - if (! _isInitialized) { - _addInCollection = addInCollection; - - _isInitialized = true; - } -} - -/// Accessor for the AddInCollection -std::deque CAddInsDoc::getAddInCollection() const { - return _addInCollection; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CAttachmentCollectionDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CAttachmentCollectionDoc.cpp deleted file mode 100644 index a86565153..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CAttachmentCollectionDoc.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/CafCoreTypesDoc/CAttachmentDoc.h" -#include "Doc/CafCoreTypesDoc/CInlineAttachmentDoc.h" -#include "Doc/CafCoreTypesDoc/CAttachmentCollectionDoc.h" - -using namespace Caf; - -/// A simple container for objects of type AttachmentCollection -CAttachmentCollectionDoc::CAttachmentCollectionDoc() : - _isInitialized(false) {} -CAttachmentCollectionDoc::~CAttachmentCollectionDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CAttachmentCollectionDoc::initialize( - const std::deque attachment, - const std::deque inlineAttachment) { - if (! _isInitialized) { - _attachment = attachment; - _inlineAttachment = inlineAttachment; - - _isInitialized = true; - } -} - -/// Accessor for the Attachment -std::deque CAttachmentCollectionDoc::getAttachment() const { - return _attachment; -} - -/// Accessor for the InlineAttachment -std::deque CAttachmentCollectionDoc::getInlineAttachment() const { - return _inlineAttachment; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CAttachmentDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CAttachmentDoc.cpp deleted file mode 100644 index 08dfec25f..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CAttachmentDoc.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#include "stdafx.h" -#include "Doc/CafCoreTypesDoc/CafCoreTypesDocTypes.h" -#include "Doc/CafCoreTypesDoc/CAttachmentDoc.h" - -using namespace Caf; - -/// A simple container for objects of type Attachment -CAttachmentDoc::CAttachmentDoc() : - _isInitialized(false), - _isReference(false), - _cmsPolicy(CMS_POLICY_CAF_ENCRYPTED_AND_SIGNED) {} -CAttachmentDoc::~CAttachmentDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CAttachmentDoc::initialize( - const std::string name, - const std::string type, - const std::string uri, - const bool isReference, - const CMS_POLICY cmsPolicy) { - if (! _isInitialized) { - _name = name; - _type = type; - _uri = uri; - _isReference = isReference; - _cmsPolicy = cmsPolicy; - - _isInitialized = true; - } -} - -/// Accessor for the Name -std::string CAttachmentDoc::getName() const { - return _name; -} - -/// Accessor for the Type -std::string CAttachmentDoc::getType() const { - return _type; -} - -/// Accessor for the Uri -std::string CAttachmentDoc::getUri() const { - return _uri; -} - -/// Accessor for the IsReference -bool CAttachmentDoc::getIsReference() const { - return _isReference; -} - -/// Accessor for the CMS Policy -CMS_POLICY CAttachmentDoc::getCmsPolicy() const { - return _cmsPolicy; -} - - -CMS_POLICY _cmsPolicy; - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CAttachmentNameCollectionDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CAttachmentNameCollectionDoc.cpp deleted file mode 100644 index 4c3853e22..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CAttachmentNameCollectionDoc.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" -#include "Doc/CafCoreTypesDoc/CAttachmentNameCollectionDoc.h" - -using namespace Caf; - -/// A simple container for objects of type AttachmentNameCollection -CAttachmentNameCollectionDoc::CAttachmentNameCollectionDoc() : - _isInitialized(false) {} -CAttachmentNameCollectionDoc::~CAttachmentNameCollectionDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CAttachmentNameCollectionDoc::initialize( - const std::deque name) { - if (! _isInitialized) { - _name = name; - - _isInitialized = true; - } -} - -/// Accessor for the Name -std::deque CAttachmentNameCollectionDoc::getName() const { - return _name; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CAuthnAuthzCollectionDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CAuthnAuthzCollectionDoc.cpp deleted file mode 100644 index 9b6a96ca2..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CAuthnAuthzCollectionDoc.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/CafCoreTypesDoc/CAuthnAuthzDoc.h" -#include "Doc/CafCoreTypesDoc/CAuthnAuthzCollectionDoc.h" - -using namespace Caf; - -/// Set of logging levels for different components -CAuthnAuthzCollectionDoc::CAuthnAuthzCollectionDoc() : - _isInitialized(false) {} -CAuthnAuthzCollectionDoc::~CAuthnAuthzCollectionDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CAuthnAuthzCollectionDoc::initialize( - const std::deque authnAuthz) { - if (! _isInitialized) { - _authnAuthz = authnAuthz; - - _isInitialized = true; - } -} - -/// Used to change the logging level for a specific component -std::deque CAuthnAuthzCollectionDoc::getAuthnAuthz() const { - return _authnAuthz; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CAuthnAuthzDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CAuthnAuthzDoc.cpp deleted file mode 100644 index db114f935..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CAuthnAuthzDoc.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Author: bwilliams - * Created: May 24, 2015 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#include "stdafx.h" -#include "Doc/CafCoreTypesDoc/CAuthnAuthzDoc.h" - -using namespace Caf; - -/// A simple container for objects of type AuthnAuthz -CAuthnAuthzDoc::CAuthnAuthzDoc() : - _isInitialized(false), - _sequenceNumber(0) {} -CAuthnAuthzDoc::~CAuthnAuthzDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CAuthnAuthzDoc::initialize( - const std::string type, - const std::string value, - const std::string name, - const int32 sequenceNumber) { - if (! _isInitialized) { - _type = type; - _value = value; - _name = name; - _sequenceNumber = sequenceNumber; - - _isInitialized = true; - } -} - -/// Accessor for the Type -std::string CAuthnAuthzDoc::getType() const { - return _type; -} - -/// Accessor for the Value -std::string CAuthnAuthzDoc::getValue() const { - return _value; -} - -/// Accessor for the Name -std::string CAuthnAuthzDoc::getName() const { - return _name; -} - -/// Accessor for the SequenceNumber -int32 CAuthnAuthzDoc::getSequenceNumber() const { - return _sequenceNumber; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CClassFiltersDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CClassFiltersDoc.cpp deleted file mode 100644 index f04bdd0de..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CClassFiltersDoc.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" -#include "Doc/CafCoreTypesDoc/CClassFiltersDoc.h" - -using namespace Caf; - -/// A simple container for objects of type ClassFilters -CClassFiltersDoc::CClassFiltersDoc() : - _isInitialized(false) {} -CClassFiltersDoc::~CClassFiltersDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CClassFiltersDoc::initialize( - const std::string dialect, - const std::deque classFilter) { - if (! _isInitialized) { - _dialect = dialect; - _classFilter = classFilter; - - _isInitialized = true; - } -} - -/// Accessor for the Dialect -std::string CClassFiltersDoc::getDialect() const { - return _dialect; -} - -/// Accessor for the ClassFilter -std::deque CClassFiltersDoc::getClassFilter() const { - return _classFilter; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CClassSpecifierDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CClassSpecifierDoc.cpp deleted file mode 100644 index 319e7f0b5..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CClassSpecifierDoc.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/CafCoreTypesDoc/CClassFiltersDoc.h" -#include "Doc/CafCoreTypesDoc/CFullyQualifiedClassGroupDoc.h" -#include "Doc/CafCoreTypesDoc/CClassSpecifierDoc.h" - -using namespace Caf; - -/// A simple container for objects of type ClassSpecifier -CClassSpecifierDoc::CClassSpecifierDoc() : - _isInitialized(false) {} -CClassSpecifierDoc::~CClassSpecifierDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CClassSpecifierDoc::initialize( - const SmartPtrCFullyQualifiedClassGroupDoc fullyQualifiedClass, - const SmartPtrCClassFiltersDoc classFilters) { - if (! _isInitialized) { - _fullyQualifiedClass = fullyQualifiedClass; - _classFilters = classFilters; - - _isInitialized = true; - } -} - -/// Accessor for the FullyQualifiedClass -SmartPtrCFullyQualifiedClassGroupDoc CClassSpecifierDoc::getFullyQualifiedClass() const { - return _fullyQualifiedClass; -} - -/// Accessor for the ClassFilters -SmartPtrCClassFiltersDoc CClassSpecifierDoc::getClassFilters() const { - return _classFilters; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CFullyQualifiedClassGroupDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CFullyQualifiedClassGroupDoc.cpp deleted file mode 100644 index b1b4075a2..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CFullyQualifiedClassGroupDoc.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" -#include "Doc/CafCoreTypesDoc/CFullyQualifiedClassGroupDoc.h" - -using namespace Caf; - -/// A simple container for objects of type FullyQualifiedClassGroup -CFullyQualifiedClassGroupDoc::CFullyQualifiedClassGroupDoc() : - _isInitialized(false) {} -CFullyQualifiedClassGroupDoc::~CFullyQualifiedClassGroupDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CFullyQualifiedClassGroupDoc::initialize( - const std::string classNamespace, - const std::string className, - const std::string classVersion) { - if (! _isInitialized) { - _classNamespace = classNamespace; - _className = className; - _classVersion = classVersion; - - _isInitialized = true; - } -} - -/// Accessor for the ClassNamespace -std::string CFullyQualifiedClassGroupDoc::getClassNamespace() const { - return _classNamespace; -} - -/// Accessor for the ClassName -std::string CFullyQualifiedClassGroupDoc::getClassName() const { - return _className; -} - -/// Accessor for the ClassVersion -std::string CFullyQualifiedClassGroupDoc::getClassVersion() const { - return _classVersion; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CInlineAttachmentCollectionDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CInlineAttachmentCollectionDoc.cpp deleted file mode 100644 index a456beb49..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CInlineAttachmentCollectionDoc.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/CafCoreTypesDoc/CInlineAttachmentDoc.h" -#include "Doc/CafCoreTypesDoc/CInlineAttachmentCollectionDoc.h" - -using namespace Caf; - -/// A simple container for objects of type InlineAttachmentCollection -CInlineAttachmentCollectionDoc::CInlineAttachmentCollectionDoc() : - _isInitialized(false) {} -CInlineAttachmentCollectionDoc::~CInlineAttachmentCollectionDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CInlineAttachmentCollectionDoc::initialize( - const std::deque attachment) { - if (! _isInitialized) { - _attachment = attachment; - - _isInitialized = true; - } -} - -/// Accessor for the InlineAttachment -std::deque CInlineAttachmentCollectionDoc::getInlineAttachment() const { - return _attachment; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CInlineAttachmentDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CInlineAttachmentDoc.cpp deleted file mode 100644 index 889241552..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CInlineAttachmentDoc.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" -#include "Doc/CafCoreTypesDoc/CInlineAttachmentDoc.h" - -using namespace Caf; - -/// A simple container for objects of type InlineAttachment -CInlineAttachmentDoc::CInlineAttachmentDoc() : - _isInitialized(false) {} -CInlineAttachmentDoc::~CInlineAttachmentDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CInlineAttachmentDoc::initialize( - const std::string name, - const std::string type, - const std::string value) { - if (! _isInitialized) { - _name = name; - _type = type; - _value = value; - - _isInitialized = true; - } -} - -/// Accessor for the Name -std::string CInlineAttachmentDoc::getName() const { - return _name; -} - -/// Accessor for the Type -std::string CInlineAttachmentDoc::getType() const { - return _type; -} - -/// Accessor for the Value -std::string CInlineAttachmentDoc::getValue() const { - return _value; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CLoggingLevelCollectionDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CLoggingLevelCollectionDoc.cpp deleted file mode 100644 index 8783335ed..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CLoggingLevelCollectionDoc.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/CafCoreTypesDoc/CLoggingLevelElemDoc.h" -#include "Doc/CafCoreTypesDoc/CLoggingLevelCollectionDoc.h" - -using namespace Caf; - -/// Set of logging levels for different components -CLoggingLevelCollectionDoc::CLoggingLevelCollectionDoc() : - _isInitialized(false) {} -CLoggingLevelCollectionDoc::~CLoggingLevelCollectionDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CLoggingLevelCollectionDoc::initialize( - const std::deque loggingLevel) { - if (! _isInitialized) { - _loggingLevel = loggingLevel; - - _isInitialized = true; - } -} - -/// Used to change the logging level for a specific component -std::deque CLoggingLevelCollectionDoc::getLoggingLevel() const { - return _loggingLevel; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CLoggingLevelElemDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CLoggingLevelElemDoc.cpp deleted file mode 100644 index 6da901e13..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CLoggingLevelElemDoc.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" -#include "Doc/CafCoreTypesDoc/CafCoreTypesDocTypes.h" -#include "Doc/CafCoreTypesDoc/CLoggingLevelElemDoc.h" - -using namespace Caf; - -/// Logging level for a component -CLoggingLevelElemDoc::CLoggingLevelElemDoc() : - _component(LOGGINGCOMPONENT_NONE), - _level(LOGGINGLEVEL_NONE), - _isInitialized(false) {} -CLoggingLevelElemDoc::~CLoggingLevelElemDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CLoggingLevelElemDoc::initialize( - const LOGGINGCOMPONENT_TYPE component, - const LOGGINGLEVEL_TYPE level) { - if (! _isInitialized) { - _component = component; - _level = level; - - _isInitialized = true; - } -} - -/// The logging level applies to this component -LOGGINGCOMPONENT_TYPE CLoggingLevelElemDoc::getComponent() const { - return _component; -} - -/// Set the logging level to this value -LOGGINGLEVEL_TYPE CLoggingLevelElemDoc::getLevel() const { - return _level; -} - -LOGGINGCOMPONENT_TYPE _component; -LOGGINGLEVEL_TYPE _level; - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/COperationDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/COperationDoc.cpp deleted file mode 100644 index 0b5b96448..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/COperationDoc.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/CafCoreTypesDoc/CParameterCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/COperationDoc.h" - -using namespace Caf; - -/// A simple container for objects of type Operation -COperationDoc::COperationDoc() : - _isInitialized(false) {} -COperationDoc::~COperationDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void COperationDoc::initialize( - const std::string name, - const SmartPtrCParameterCollectionDoc parameterCollection) { - if (! _isInitialized) { - _name = name; - _parameterCollection = parameterCollection; - - _isInitialized = true; - } -} - -/// Accessor for the Name -std::string COperationDoc::getName() const { - return _name; -} - -/// Accessor for the ParameterCollection -SmartPtrCParameterCollectionDoc COperationDoc::getParameterCollection() const { - return _parameterCollection; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CParameterCollectionDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CParameterCollectionDoc.cpp deleted file mode 100644 index 9667c2ed0..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CParameterCollectionDoc.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/CafCoreTypesDoc/CRequestInstanceParameterDoc.h" -#include "Doc/CafCoreTypesDoc/CRequestParameterDoc.h" -#include "Doc/CafCoreTypesDoc/CParameterCollectionDoc.h" - -using namespace Caf; - -/// A simple container for objects of type ParameterCollection -CParameterCollectionDoc::CParameterCollectionDoc() : - _isInitialized(false) {} -CParameterCollectionDoc::~CParameterCollectionDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CParameterCollectionDoc::initialize( - const std::deque parameter, - const std::deque instanceParameter) { - if (! _isInitialized) { - _parameter = parameter; - _instanceParameter = instanceParameter; - - _isInitialized = true; - } -} - -/// Accessor for the Parameter -std::deque CParameterCollectionDoc::getParameter() const { - return _parameter; -} - -/// Accessor for the InstanceParameter -std::deque CParameterCollectionDoc::getInstanceParameter() const { - return _instanceParameter; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CPropertyCollectionDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CPropertyCollectionDoc.cpp deleted file mode 100644 index 10f45bc02..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CPropertyCollectionDoc.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/CafCoreTypesDoc/CPropertyDoc.h" -#include "Doc/CafCoreTypesDoc/CPropertyCollectionDoc.h" - -using namespace Caf; - -/// A simple container for objects of type PropertyCollection -CPropertyCollectionDoc::CPropertyCollectionDoc() : - _isInitialized(false) {} -CPropertyCollectionDoc::~CPropertyCollectionDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CPropertyCollectionDoc::initialize( - const std::deque property) { - if (! _isInitialized) { - _property = property; - - _isInitialized = true; - } -} - -/// Accessor for the Property -std::deque CPropertyCollectionDoc::getProperty() const { - return _property; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CPropertyDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CPropertyDoc.cpp deleted file mode 100644 index 9890b1dd4..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CPropertyDoc.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" -#include "Doc/CafCoreTypesDoc/CafCoreTypesDocTypes.h" -#include "Doc/CafCoreTypesDoc/CPropertyDoc.h" - -using namespace Caf; - -/// A simple container for objects of type Property -CPropertyDoc::CPropertyDoc() : - _type(PROPERTY_NONE), - _isInitialized(false) {} -CPropertyDoc::~CPropertyDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CPropertyDoc::initialize( - const std::string name, - const PROPERTY_TYPE type, - const std::deque value) { - if (! _isInitialized) { - _name = name; - _type = type; - _value = value; - - _isInitialized = true; - } -} - -/// Accessor for the Name -std::string CPropertyDoc::getName() const { - return _name; -} - -/// Accessor for the Type -PROPERTY_TYPE CPropertyDoc::getType() const { - return _type; -} - -/// Accessor for the Value -std::deque CPropertyDoc::getValue() const { - return _value; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CProtocolCollectionDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CProtocolCollectionDoc.cpp deleted file mode 100644 index 6ea4c3f90..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CProtocolCollectionDoc.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/CafCoreTypesDoc/CProtocolDoc.h" -#include "Doc/CafCoreTypesDoc/CProtocolCollectionDoc.h" - -using namespace Caf; - -/// Set of protocol -CProtocolCollectionDoc::CProtocolCollectionDoc() : - _isInitialized(false) {} -CProtocolCollectionDoc::~CProtocolCollectionDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CProtocolCollectionDoc::initialize( - const std::deque protocol) { - if (! _isInitialized) { - _protocol = protocol; - - _isInitialized = true; - } -} - -/// Used to change the logging level for a specific component -std::deque CProtocolCollectionDoc::getProtocol() const { - return _protocol; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CProtocolDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CProtocolDoc.cpp deleted file mode 100644 index 5256642c2..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CProtocolDoc.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" -#include "Doc/CafCoreTypesDoc/CProtocolDoc.h" - -using namespace Caf; - -/// A simple container for objects of Protocol -CProtocolDoc::CProtocolDoc() : - _sequenceNumber(0), - _isInitialized(false) {} -CProtocolDoc::~CProtocolDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CProtocolDoc::initialize( - const std::string uri, - const std::string name, - const int32 sequenceNumber) { - if (! _isInitialized) { - _name = name; - _uri = uri; - _sequenceNumber = sequenceNumber; - - _isInitialized = true; - } -} - -/// Accessor for the Uri -std::string CProtocolDoc::getUri() const { - return _uri; -} - -/// Accessor for the Name -std::string CProtocolDoc::getName() const { - return _name; -} - -/// Accessor for the Value -int32 CProtocolDoc::getSequenceNumber() const { - return _sequenceNumber; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CRequestConfigDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CRequestConfigDoc.cpp deleted file mode 100644 index 79d8252bd..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CRequestConfigDoc.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/CafCoreTypesDoc/CAddInsDoc.h" -#include "Doc/CafCoreTypesDoc/CLoggingLevelCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CRequestConfigDoc.h" - -using namespace Caf; - -/// A simple container for objects of type RequestConfig -CRequestConfigDoc::CRequestConfigDoc() : - _isInitialized(false) {} -CRequestConfigDoc::~CRequestConfigDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CRequestConfigDoc::initialize( - const std::string responseFormatType, - const SmartPtrCAddInsDoc requestProcessorAddIns, - const SmartPtrCAddInsDoc responseProcessorAddIns, - const SmartPtrCLoggingLevelCollectionDoc loggingLevelCollection) { - if (! _isInitialized) { - _responseFormatType = responseFormatType; - _requestProcessorAddIns = requestProcessorAddIns; - _responseProcessorAddIns = responseProcessorAddIns; - _loggingLevelCollection = loggingLevelCollection; - - _isInitialized = true; - } -} - -/// Accessor for the ResponseFormatType -std::string CRequestConfigDoc::getResponseFormatType() const { - return _responseFormatType; -} - -/// Accessor for the RequestProcessorAddIns -SmartPtrCAddInsDoc CRequestConfigDoc::getRequestProcessorAddIns() const { - return _requestProcessorAddIns; -} - -/// Accessor for the ResponseProcessorAddIns -SmartPtrCAddInsDoc CRequestConfigDoc::getResponseProcessorAddIns() const { - return _responseProcessorAddIns; -} - -/// Accessor for the LoggingLevelCollection -SmartPtrCLoggingLevelCollectionDoc CRequestConfigDoc::getLoggingLevelCollection() const { - return _loggingLevelCollection; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CRequestHeaderDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CRequestHeaderDoc.cpp deleted file mode 100644 index 50278455b..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CRequestHeaderDoc.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/CafCoreTypesDoc/CAuthnAuthzCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CPropertyCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CProtocolCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CRequestConfigDoc.h" -#include "Doc/CafCoreTypesDoc/CRequestHeaderDoc.h" - -using namespace Caf; - -/// A simple container for objects of type RequestHeader -CRequestHeaderDoc::CRequestHeaderDoc() : - _isInitialized(false), - _sessionId(CAFCOMMON_GUID_NULL) {} -CRequestHeaderDoc::~CRequestHeaderDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CRequestHeaderDoc::initialize( - const SmartPtrCRequestConfigDoc requestConfig, - const SmartPtrCAuthnAuthzCollectionDoc authnAuthzCollection, - const SmartPtrCProtocolCollectionDoc protocolCollection, - const SmartPtrCPropertyCollectionDoc echoPropertyBag, - const std::string version, - const std::string createdDateTime, - const UUID sessionId) { - if (! _isInitialized) { - _requestConfig = requestConfig; - _authnAuthzCollection = authnAuthzCollection; - _protocolCollection = protocolCollection; - _echoPropertyBag = echoPropertyBag; - _version = version; - _createdDateTime = createdDateTime; - _sessionId = sessionId; - - _isInitialized = true; - } -} - -/// Accessor for the RequestConfig -SmartPtrCRequestConfigDoc CRequestHeaderDoc::getRequestConfig() const { - return _requestConfig; -} - -/// Accessor for the Authentication / Authorization Collection -SmartPtrCAuthnAuthzCollectionDoc CRequestHeaderDoc::getAuthnAuthzCollection() const { - return _authnAuthzCollection; -} - -/// Accessor for the Protocol Collection -SmartPtrCProtocolCollectionDoc CRequestHeaderDoc::getProtocolCollection() const { - return _protocolCollection; -} - -/// Accessor for the EchoPropertyBag -SmartPtrCPropertyCollectionDoc CRequestHeaderDoc::getEchoPropertyBag() const { - return _echoPropertyBag; -} - -/// Accessor for the version -std::string CRequestHeaderDoc::getVersion() const { - return _version; -} - -/// Accessor for the date/time when the request was created -std::string CRequestHeaderDoc::getCreatedDateTime() const { - return _createdDateTime; -} - -/// Accessor for the session ID -UUID CRequestHeaderDoc::getSessionId() const { - return _sessionId; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CRequestInstanceParameterDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CRequestInstanceParameterDoc.cpp deleted file mode 100644 index d5a70ed8b..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CRequestInstanceParameterDoc.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" -#include "Doc/CafCoreTypesDoc/CRequestInstanceParameterDoc.h" - -using namespace Caf; - -/// A simple container for objects of type RequestInstanceParameter -CRequestInstanceParameterDoc::CRequestInstanceParameterDoc() : - _isInitialized(false) {} -CRequestInstanceParameterDoc::~CRequestInstanceParameterDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CRequestInstanceParameterDoc::initialize( - const std::string name, - const std::string classNamespace, - const std::string className, - const std::string classVersion, - const std::deque value) { - if (! _isInitialized) { - _name = name; - _classNamespace = classNamespace; - _className = className; - _classVersion = classVersion; - _value = value; - - _isInitialized = true; - } -} - -/// Accessor for the Name -std::string CRequestInstanceParameterDoc::getName() const { - return _name; -} - -/// Accessor for the ClassNamespace -std::string CRequestInstanceParameterDoc::getClassNamespace() const { - return _classNamespace; -} - -/// Accessor for the ClassName -std::string CRequestInstanceParameterDoc::getClassName() const { - return _className; -} - -/// Accessor for the ClassVersion -std::string CRequestInstanceParameterDoc::getClassVersion() const { - return _classVersion; -} - -/// Accessor for the Value -std::deque CRequestInstanceParameterDoc::getValue() const { - return _value; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CRequestParameterDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CRequestParameterDoc.cpp deleted file mode 100644 index e1ab1e7af..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CRequestParameterDoc.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" -#include "Doc/CafCoreTypesDoc/CafCoreTypesDocTypes.h" -#include "Doc/CafCoreTypesDoc/CRequestParameterDoc.h" - -using namespace Caf; - -/// A simple container for objects of type RequestParameter -CRequestParameterDoc::CRequestParameterDoc() : - _type(PARAMETER_NONE), - _isInitialized(false) {} -CRequestParameterDoc::~CRequestParameterDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CRequestParameterDoc::initialize( - const std::string name, - const PARAMETER_TYPE type, - const std::deque value) { - if (! _isInitialized) { - _name = name; - _type = type; - _value = value; - - _isInitialized = true; - } -} - -/// Accessor for the Name -std::string CRequestParameterDoc::getName() const { - return _name; -} - -/// Accessor for the Type -PARAMETER_TYPE CRequestParameterDoc::getType() const { - return _type; -} - -/// Accessor for the Value -std::deque CRequestParameterDoc::getValue() const { - return _value; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CStatisticsDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CStatisticsDoc.cpp deleted file mode 100644 index 596dd9eeb..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/CStatisticsDoc.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/CafCoreTypesDoc/CPropertyCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CStatisticsDoc.h" - -using namespace Caf; - -/// A simple container for objects of type Statistics -CStatisticsDoc::CStatisticsDoc() : - _providerJobNum(0), - _providerJobTotal(0), - _providerJobDurationSecs(0), - _pmeNum(0), - _pmeTotal(0), - _pmeDurationSecs(0), - _isInitialized(false) {} -CStatisticsDoc::~CStatisticsDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CStatisticsDoc::initialize( - const SmartPtrCPropertyCollectionDoc propertyCollection, - const int32 providerJobNum, - const int32 providerJobTotal, - const int32 providerJobDurationSecs, - const int32 pmeNum, - const int32 pmeTotal, - const int32 pmeDurationSecs) { - if (! _isInitialized) { - _propertyCollection = propertyCollection; - _providerJobNum = providerJobNum; - _providerJobTotal = providerJobTotal; - _providerJobDurationSecs = providerJobDurationSecs; - _pmeNum = pmeNum; - _pmeTotal = pmeTotal; - _pmeDurationSecs = pmeDurationSecs; - - _isInitialized = true; - } -} - -/// Accessor for the PropertyCollection -SmartPtrCPropertyCollectionDoc CStatisticsDoc::getPropertyCollection() const { - return _propertyCollection; -} - -/// Accessor for the ProviderJobNum -int32 CStatisticsDoc::getProviderJobNum() const { - return _providerJobNum; -} - -/// Accessor for the ProviderJobTotal -int32 CStatisticsDoc::getProviderJobTotal() const { - return _providerJobTotal; -} - -/// Accessor for the ProviderJobDurationSecs -int32 CStatisticsDoc::getProviderJobDurationSecs() const { - return _providerJobDurationSecs; -} - -/// Accessor for the PmeNum -int32 CStatisticsDoc::getPmeNum() const { - return _pmeNum; -} - -/// Accessor for the PmeTotal -int32 CStatisticsDoc::getPmeTotal() const { - return _pmeTotal; -} - -/// Accessor for the PmeDurationSecs -int32 CStatisticsDoc::getPmeDurationSecs() const { - return _pmeDurationSecs; -} - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/stdafx.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/stdafx.h deleted file mode 100644 index b3873419c..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafCoreTypesDoc/stdafx.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Author: bwilliams - * Created: February 25, 2016 - * - * Copyright (C) 2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#ifndef STDAFX_H_ -#define STDAFX_H_ - -#ifdef WIN32 - #define CAFCORETYPESDOC_LINKAGE __declspec(dllexport) -#else - #define CAFCORETYPESDOC_LINKAGE -#endif - -#include - -#endif /* STDAFX_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafInstallRequestDoc/CFullPackageElemDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafInstallRequestDoc/CFullPackageElemDoc.cpp deleted file mode 100644 index 8f5f645cb..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafInstallRequestDoc/CFullPackageElemDoc.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/CafInstallRequestDoc/CPackageDefnDoc.h" -#include "Doc/CafInstallRequestDoc/CFullPackageElemDoc.h" - -using namespace Caf; - -/// A simple container for objects of type FullPackageElem -CFullPackageElemDoc::CFullPackageElemDoc() : - _index(0), - _isInitialized(false) {} -CFullPackageElemDoc::~CFullPackageElemDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CFullPackageElemDoc::initialize( - const int32 index, - const std::string packageNamespace, - const std::string packageName, - const std::string packageVersion, - const SmartPtrCPackageDefnDoc installPackage, - const SmartPtrCPackageDefnDoc uninstallPackage) { - if (! _isInitialized) { - _index = index; - _packageNamespace = packageNamespace; - _packageName = packageName; - _packageVersion = packageVersion; - _installPackage = installPackage; - _uninstallPackage = uninstallPackage; - - _isInitialized = true; - } -} - -/// Accessor for the Index -int32 CFullPackageElemDoc::getIndex() const { - return _index; -} - -/// Accessor for the PackageNamespace -std::string CFullPackageElemDoc::getPackageNamespace() const { - return _packageNamespace; -} - -/// Accessor for the PackageName -std::string CFullPackageElemDoc::getPackageName() const { - return _packageName; -} - -/// Accessor for the PackageVersion -std::string CFullPackageElemDoc::getPackageVersion() const { - return _packageVersion; -} - -/// Accessor for the InstallPackage -SmartPtrCPackageDefnDoc CFullPackageElemDoc::getInstallPackage() const { - return _installPackage; -} - -/// Accessor for the UninstallPackage -SmartPtrCPackageDefnDoc CFullPackageElemDoc::getUninstallPackage() const { - return _uninstallPackage; -} - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafInstallRequestDoc/CGetInventoryJobDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafInstallRequestDoc/CGetInventoryJobDoc.cpp deleted file mode 100644 index 8fe4e1cad..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafInstallRequestDoc/CGetInventoryJobDoc.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" -#include "Doc/CafInstallRequestDoc/CGetInventoryJobDoc.h" - -using namespace Caf; - -/// A simple container for objects of type GetInventoryJob -CGetInventoryJobDoc::CGetInventoryJobDoc() : - _jobId(CAFCOMMON_GUID_NULL), - _isInitialized(false) {} -CGetInventoryJobDoc::~CGetInventoryJobDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CGetInventoryJobDoc::initialize( - const UUID jobId) { - if (! _isInitialized) { - _jobId = jobId; - - _isInitialized = true; - } -} - -/// Accessor for the JobId -UUID CGetInventoryJobDoc::getJobId() const { - return _jobId; -} - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafInstallRequestDoc/CInstallBatchDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafInstallRequestDoc/CInstallBatchDoc.cpp deleted file mode 100644 index 25707f701..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafInstallRequestDoc/CInstallBatchDoc.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/CafInstallRequestDoc/CGetInventoryJobDoc.h" -#include "Doc/CafInstallRequestDoc/CInstallProviderJobDoc.h" -#include "Doc/CafInstallRequestDoc/CUninstallProviderJobDoc.h" -#include "Doc/CafInstallRequestDoc/CInstallBatchDoc.h" - -using namespace Caf; - -/// A simple container for objects of type InstallBatch -CInstallBatchDoc::CInstallBatchDoc() : - _isInitialized(false) {} -CInstallBatchDoc::~CInstallBatchDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CInstallBatchDoc::initialize( - const SmartPtrCGetInventoryJobDoc getInventory, - const SmartPtrCInstallProviderJobDoc installProvider, - const SmartPtrCUninstallProviderJobDoc uninstallProvider) { - if (! _isInitialized) { - _getInventory = getInventory; - _installProvider = installProvider; - _uninstallProvider = uninstallProvider; - - _isInitialized = true; - } -} - -/// Accessor for the GetInventory -SmartPtrCGetInventoryJobDoc CInstallBatchDoc::getGetInventory() const { - return _getInventory; -} - -/// Accessor for the InstallProvider -SmartPtrCInstallProviderJobDoc CInstallBatchDoc::getInstallProvider() const { - return _installProvider; -} - -/// Accessor for the UninstallProvider -SmartPtrCUninstallProviderJobDoc CInstallBatchDoc::getUninstallProvider() const { - return _uninstallProvider; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafInstallRequestDoc/CInstallPackageSpecDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafInstallRequestDoc/CInstallPackageSpecDoc.cpp deleted file mode 100644 index 0e127decf..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafInstallRequestDoc/CInstallPackageSpecDoc.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/CafCoreTypesDoc/CAttachmentCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CAttachmentNameCollectionDoc.h" -#include "Doc/CafInstallRequestDoc/CInstallPackageSpecDoc.h" - -using namespace Caf; - -/// A simple container for objects of type InstallPackageSpec -CInstallPackageSpecDoc::CInstallPackageSpecDoc() : - _isInitialized(false) {} -CInstallPackageSpecDoc::~CInstallPackageSpecDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CInstallPackageSpecDoc::initialize( - const std::string packageNamespace, - const std::string packageName, - const std::string packageVersion, - const std::string startupAttachmentName, - const std::string packageAttachmentName, - const SmartPtrCAttachmentNameCollectionDoc attachmentNameCollection, - const SmartPtrCAttachmentCollectionDoc attachmentCollection, - const std::string arguments) { - if (! _isInitialized) { - _packageNamespace = packageNamespace; - _packageName = packageName; - _packageVersion = packageVersion; - _startupAttachmentName = startupAttachmentName; - _packageAttachmentName = packageAttachmentName; - _attachmentNameCollection = attachmentNameCollection; - _attachmentCollection = attachmentCollection; - _arguments = arguments; - - _isInitialized = true; - } -} - -/// Accessor for the PackageNamespace -std::string CInstallPackageSpecDoc::getPackageNamespace() const { - return _packageNamespace; -} - -/// Accessor for the PackageName -std::string CInstallPackageSpecDoc::getPackageName() const { - return _packageName; -} - -/// Accessor for the PackageVersion -std::string CInstallPackageSpecDoc::getPackageVersion() const { - return _packageVersion; -} - -/// Accessor for the StartupAttachmentName -std::string CInstallPackageSpecDoc::getStartupAttachmentName() const { - return _startupAttachmentName; -} - -/// Accessor for the PackageAttachmentName -std::string CInstallPackageSpecDoc::getPackageAttachmentName() const { - return _packageAttachmentName; -} - -/// Accessor for the AttachmentNameCollection -SmartPtrCAttachmentNameCollectionDoc CInstallPackageSpecDoc::getSupportingAttachmentNameCollection() const { - return _attachmentNameCollection; -} - -/// Accessor for the AttachmentCollection -SmartPtrCAttachmentCollectionDoc CInstallPackageSpecDoc::getAttachmentCollection() const { - return _attachmentCollection; -} - -/// Accessor for the Arguments -std::string CInstallPackageSpecDoc::getArguments() const { - return _arguments; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafInstallRequestDoc/CInstallProviderJobDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafInstallRequestDoc/CInstallProviderJobDoc.cpp deleted file mode 100644 index 5be27674e..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafInstallRequestDoc/CInstallProviderJobDoc.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" -#include "Doc/CafInstallRequestDoc/CafInstallRequestDocTypes.h" - -#include "Doc/CafInstallRequestDoc/CFullPackageElemDoc.h" -#include "Doc/CafInstallRequestDoc/CInstallProviderJobDoc.h" - -using namespace Caf; - -/// A simple container for objects of type InstallProviderJob -CInstallProviderJobDoc::CInstallProviderJobDoc() : - _clientId(CAFCOMMON_GUID_NULL), - _jobId(CAFCOMMON_GUID_NULL), - _packageOSType(PACKAGE_OS_NONE), - _isInitialized(false) {} -CInstallProviderJobDoc::~CInstallProviderJobDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CInstallProviderJobDoc::initialize( - const UUID clientId, - const UUID jobId, - const std::string providerNamespace, - const std::string providerName, - const std::string providerVersion, - const PACKAGE_OS_TYPE packageOSType, - const std::deque packageCollection) { - if (! _isInitialized) { - _clientId = clientId; - _jobId = jobId; - _providerNamespace = providerNamespace; - _providerName = providerName; - _providerVersion = providerVersion; - _packageOSType = packageOSType; - _packageCollection = packageCollection; - - _isInitialized = true; - } -} - -/// Accessor for the ClientId -UUID CInstallProviderJobDoc::getClientId() const { - return _clientId; -} - -/// Accessor for the JobId -UUID CInstallProviderJobDoc::getJobId() const { - return _jobId; -} - -/// Accessor for the ProviderNamespace -std::string CInstallProviderJobDoc::getProviderNamespace() const { - return _providerNamespace; -} - -/// Accessor for the ProviderName -std::string CInstallProviderJobDoc::getProviderName() const { - return _providerName; -} - -/// Accessor for the ProviderVersion -std::string CInstallProviderJobDoc::getProviderVersion() const { - return _providerVersion; -} - -/// Accessor for the PackageOSType -PACKAGE_OS_TYPE CInstallProviderJobDoc::getPackageOSType() const { - return _packageOSType; -} - -/// Accessor for the PackageVal -std::deque CInstallProviderJobDoc::getPackageCollection() const { - return _packageCollection; -} - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafInstallRequestDoc/CInstallProviderSpecDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafInstallRequestDoc/CInstallProviderSpecDoc.cpp deleted file mode 100644 index c26e93513..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafInstallRequestDoc/CInstallProviderSpecDoc.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/CafInstallRequestDoc/CMinPackageElemDoc.h" -#include "Doc/CafInstallRequestDoc/CInstallProviderSpecDoc.h" - -using namespace Caf; - -/// A simple container for objects of type InstallProviderSpec -CInstallProviderSpecDoc::CInstallProviderSpecDoc() : - _clientId(CAFCOMMON_GUID_NULL), - _isInitialized(false) {} -CInstallProviderSpecDoc::~CInstallProviderSpecDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CInstallProviderSpecDoc::initialize( - const UUID clientId, - const std::string providerNamespace, - const std::string providerName, - const std::string providerVersion, - const std::deque packageCollection) { - if (! _isInitialized) { - _clientId = clientId; - _providerNamespace = providerNamespace; - _providerName = providerName; - _providerVersion = providerVersion; - _packageCollection = packageCollection; - - _isInitialized = true; - } -} - -/// Accessor for the ClientId -UUID CInstallProviderSpecDoc::getClientId() const { - return _clientId; -} - -/// Accessor for the ProviderNamespace -std::string CInstallProviderSpecDoc::getProviderNamespace() const { - return _providerNamespace; -} - -/// Accessor for the ProviderName -std::string CInstallProviderSpecDoc::getProviderName() const { - return _providerName; -} - -/// Accessor for the ProviderVersion -std::string CInstallProviderSpecDoc::getProviderVersion() const { - return _providerVersion; -} - -/// Accessor for the PackageVal -std::deque CInstallProviderSpecDoc::getPackageCollection() const { - return _packageCollection; -} - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafInstallRequestDoc/CInstallRequestDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafInstallRequestDoc/CInstallRequestDoc.cpp deleted file mode 100644 index 237149213..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafInstallRequestDoc/CInstallRequestDoc.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/CafCoreTypesDoc/CAttachmentCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CRequestHeaderDoc.h" -#include "Doc/CafInstallRequestDoc/CInstallBatchDoc.h" -#include "Doc/CafInstallRequestDoc/CInstallRequestDoc.h" - -using namespace Caf; - -/// A simple container for objects of type InstallRequest -CInstallRequestDoc::CInstallRequestDoc() : - _clientId(CAFCOMMON_GUID_NULL), - _requestId(CAFCOMMON_GUID_NULL), - _isInitialized(false) {} -CInstallRequestDoc::~CInstallRequestDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CInstallRequestDoc::initialize( - const UUID clientId, - const UUID requestId, - const std::string pmeId, - const SmartPtrCRequestHeaderDoc requestHeader, - const SmartPtrCInstallBatchDoc batch, - const SmartPtrCAttachmentCollectionDoc attachmentCollection) { - if (! _isInitialized) { - _clientId = clientId; - _requestId = requestId; - _pmeId = pmeId; - _requestHeader = requestHeader; - _batch = batch; - _attachmentCollection = attachmentCollection; - - _isInitialized = true; - } -} - -/// Accessor for the ClientId -UUID CInstallRequestDoc::getClientId() const { - return _clientId; -} - -/// Accessor for the RequestId -UUID CInstallRequestDoc::getRequestId() const { - return _requestId; -} - -/// Accessor for the PmeId -std::string CInstallRequestDoc::getPmeId() const { - return _pmeId; -} - -/// Accessor for the RequestHeader -SmartPtrCRequestHeaderDoc CInstallRequestDoc::getRequestHeader() const { - return _requestHeader; -} - -/// Accessor for the Batch -SmartPtrCInstallBatchDoc CInstallRequestDoc::getBatch() const { - return _batch; -} - -/// Accessor for the AttachmentCollection -SmartPtrCAttachmentCollectionDoc CInstallRequestDoc::getAttachmentCollection() const { - return _attachmentCollection; -} - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafInstallRequestDoc/CMinPackageElemDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafInstallRequestDoc/CMinPackageElemDoc.cpp deleted file mode 100644 index 615cf1696..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafInstallRequestDoc/CMinPackageElemDoc.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" -#include "Doc/CafInstallRequestDoc/CMinPackageElemDoc.h" - -using namespace Caf; - -/// A simple container for objects of type MinPackageElem -CMinPackageElemDoc::CMinPackageElemDoc() : - _index(0), - _isInitialized(false) {} -CMinPackageElemDoc::~CMinPackageElemDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CMinPackageElemDoc::initialize( - const int32 index, - const std::string packageNamespace, - const std::string packageName, - const std::string packageVersion) { - if (! _isInitialized) { - _index = index; - _packageNamespace = packageNamespace; - _packageName = packageName; - _packageVersion = packageVersion; - - _isInitialized = true; - } -} - -/// Accessor for the Index -int32 CMinPackageElemDoc::getIndex() const { - return _index; -} - -/// Accessor for the PackageNamespace -std::string CMinPackageElemDoc::getPackageNamespace() const { - return _packageNamespace; -} - -/// Accessor for the PackageName -std::string CMinPackageElemDoc::getPackageName() const { - return _packageName; -} - -/// Accessor for the PackageVersion -std::string CMinPackageElemDoc::getPackageVersion() const { - return _packageVersion; -} - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafInstallRequestDoc/CPackageDefnDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafInstallRequestDoc/CPackageDefnDoc.cpp deleted file mode 100644 index cb79d285f..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafInstallRequestDoc/CPackageDefnDoc.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/CafCoreTypesDoc/CAttachmentNameCollectionDoc.h" -#include "Doc/CafInstallRequestDoc/CPackageDefnDoc.h" - -using namespace Caf; - -/// A simple container for objects of type PackageDefn -CPackageDefnDoc::CPackageDefnDoc() : - _isInitialized(false) {} -CPackageDefnDoc::~CPackageDefnDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CPackageDefnDoc::initialize( - const std::string startupAttachmentName, - const std::string packageAttachmentName, - const SmartPtrCAttachmentNameCollectionDoc attachmentNameCollection, - const std::string arguments) { - if (! _isInitialized) { - _startupAttachmentName = startupAttachmentName; - _packageAttachmentName = packageAttachmentName; - _attachmentNameCollection = attachmentNameCollection; - _arguments = arguments; - - _isInitialized = true; - } -} - -/// Accessor for the StartupAttachmentName -std::string CPackageDefnDoc::getStartupAttachmentName() const { - return _startupAttachmentName; -} - -/// Accessor for the PackageAttachmentName -std::string CPackageDefnDoc::getPackageAttachmentName() const { - return _packageAttachmentName; -} - -/// Accessor for the AttachmentNameCollection -SmartPtrCAttachmentNameCollectionDoc CPackageDefnDoc::getSupportingAttachmentNameCollection() const { - return _attachmentNameCollection; -} - -/// Accessor for the Arguments -std::string CPackageDefnDoc::getArguments() const { - return _arguments; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafInstallRequestDoc/CUninstallProviderJobDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafInstallRequestDoc/CUninstallProviderJobDoc.cpp deleted file mode 100644 index 81bbc272c..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafInstallRequestDoc/CUninstallProviderJobDoc.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" -#include "Doc/CafInstallRequestDoc/CafInstallRequestDocTypes.h" -#include "Doc/CafInstallRequestDoc/CUninstallProviderJobDoc.h" - -using namespace Caf; - -/// A simple container for objects of type UninstallProviderJob -CUninstallProviderJobDoc::CUninstallProviderJobDoc() : - _clientId(CAFCOMMON_GUID_NULL), - _jobId(CAFCOMMON_GUID_NULL), - _packageOSType(PACKAGE_OS_NONE), - _isInitialized(false) {} -CUninstallProviderJobDoc::~CUninstallProviderJobDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CUninstallProviderJobDoc::initialize( - const UUID clientId, - const UUID jobId, - const std::string providerNamespace, - const std::string providerName, - const std::string providerVersion, - const PACKAGE_OS_TYPE packageOSType) { - if (! _isInitialized) { - _clientId = clientId; - _jobId = jobId; - _providerNamespace = providerNamespace; - _providerName = providerName; - _providerVersion = providerVersion; - _packageOSType = packageOSType; - - _isInitialized = true; - } -} - -/// Accessor for the ClientId -UUID CUninstallProviderJobDoc::getClientId() const { - return _clientId; -} - -/// Accessor for the JobId -UUID CUninstallProviderJobDoc::getJobId() const { - return _jobId; -} - -/// Accessor for the ProviderNamespace -std::string CUninstallProviderJobDoc::getProviderNamespace() const { - return _providerNamespace; -} - -/// Accessor for the ProviderName -std::string CUninstallProviderJobDoc::getProviderName() const { - return _providerName; -} - -/// Accessor for the ProviderVersion -std::string CUninstallProviderJobDoc::getProviderVersion() const { - return _providerVersion; -} - -/// Accessor for the PackageOSType -PACKAGE_OS_TYPE CUninstallProviderJobDoc::getPackageOSType() const { - return _packageOSType; -} - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafInstallRequestDoc/stdafx.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafInstallRequestDoc/stdafx.h deleted file mode 100644 index 439086e46..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafInstallRequestDoc/stdafx.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Author: bwilliams - * Created: February 25, 2016 - * - * Copyright (C) 2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#ifndef STDAFX_H_ -#define STDAFX_H_ - -#ifdef WIN32 - #define CAFINSTALLREQUESTDOC_LINKAGE __declspec(dllexport) -#else - #define CAFINSTALLREQUESTDOC_LINKAGE -#endif - -#include - -#endif /* STDAFX_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/DiagRequestDoc/CDiagRequestDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/DiagRequestDoc/CDiagRequestDoc.cpp deleted file mode 100644 index fed946f27..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/DiagRequestDoc/CDiagRequestDoc.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/CafCoreTypesDoc/CRequestHeaderDoc.h" -#include "Doc/DiagTypesDoc/CDiagBatchDoc.h" -#include "Doc/DiagRequestDoc/CDiagRequestDoc.h" - -using namespace Caf; - -/// A simple container for objects of type DiagRequest -CDiagRequestDoc::CDiagRequestDoc() : - _clientId(CAFCOMMON_GUID_NULL), - _requestId(CAFCOMMON_GUID_NULL), - _isInitialized(false) {} -CDiagRequestDoc::~CDiagRequestDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CDiagRequestDoc::initialize( - const UUID clientId, - const UUID requestId, - const std::string pmeId, - const SmartPtrCRequestHeaderDoc requestHeader, - const SmartPtrCDiagBatchDoc batch) { - if (! _isInitialized) { - _clientId = clientId; - _requestId = requestId; - _pmeId = pmeId; - _requestHeader = requestHeader; - _batch = batch; - - _isInitialized = true; - } -} - -/// Accessor for the ClientId -UUID CDiagRequestDoc::getClientId() const { - return _clientId; -} - -/// Accessor for the RequestId -UUID CDiagRequestDoc::getRequestId() const { - return _requestId; -} - -/// Accessor for the PmeId -std::string CDiagRequestDoc::getPmeId() const { - return _pmeId; -} - -/// Accessor for the RequestHeader -SmartPtrCRequestHeaderDoc CDiagRequestDoc::getRequestHeader() const { - return _requestHeader; -} - -/// Accessor for the Batch -SmartPtrCDiagBatchDoc CDiagRequestDoc::getBatch() const { - return _batch; -} - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/DiagRequestDoc/stdafx.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/DiagRequestDoc/stdafx.h deleted file mode 100644 index ebe312589..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/DiagRequestDoc/stdafx.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Author: bwilliams - * Created: February 25, 2016 - * - * Copyright (C) 2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#ifndef STDAFX_H_ -#define STDAFX_H_ - -#ifdef WIN32 - #define DIAGREQUESTDOC_LINKAGE __declspec(dllexport) -#else - #define DIAGREQUESTDOC_LINKAGE -#endif - -#include - -#endif /* STDAFX_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/DiagTypesDoc/CDiagBatchDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/DiagTypesDoc/CDiagBatchDoc.cpp deleted file mode 100644 index 307845daf..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/DiagTypesDoc/CDiagBatchDoc.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/DiagTypesDoc/CDiagCollectInstancesDoc.h" -#include "Doc/DiagTypesDoc/CDiagDeleteValueCollectionDoc.h" -#include "Doc/DiagTypesDoc/CDiagSetValueCollectionDoc.h" -#include "Doc/DiagTypesDoc/CDiagBatchDoc.h" - -using namespace Caf; - -/// A simple container for objects of type DiagBatch -CDiagBatchDoc::CDiagBatchDoc() : - _isInitialized(false) {} -CDiagBatchDoc::~CDiagBatchDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CDiagBatchDoc::initialize( - const SmartPtrCDiagCollectInstancesDoc collectInstances, - const SmartPtrCDiagSetValueCollectionDoc setValueCollection, - const SmartPtrCDiagDeleteValueCollectionDoc deleteValueCollection) { - if (! _isInitialized) { - _collectInstances = collectInstances; - _setValueCollection = setValueCollection; - _deleteValueCollection = deleteValueCollection; - - _isInitialized = true; - } -} - -/// Accessor for the CollectInstances -SmartPtrCDiagCollectInstancesDoc CDiagBatchDoc::getCollectInstances() const { - return _collectInstances; -} - -/// Accessor for the SetValueCollection -SmartPtrCDiagSetValueCollectionDoc CDiagBatchDoc::getSetValueCollection() const { - return _setValueCollection; -} - -/// Accessor for the DeleteValueCollection -SmartPtrCDiagDeleteValueCollectionDoc CDiagBatchDoc::getDeleteValueCollection() const { - return _deleteValueCollection; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/DiagTypesDoc/CDiagCollectInstancesDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/DiagTypesDoc/CDiagCollectInstancesDoc.cpp deleted file mode 100644 index bb66491c4..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/DiagTypesDoc/CDiagCollectInstancesDoc.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" -#include "Doc/DiagTypesDoc/CDiagCollectInstancesDoc.h" - -using namespace Caf; - -/// A simple container for objects of type DiagCollectInstances -CDiagCollectInstancesDoc::CDiagCollectInstancesDoc() : - _jobId(CAFCOMMON_GUID_NULL), - _isInitialized(false) {} -CDiagCollectInstancesDoc::~CDiagCollectInstancesDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CDiagCollectInstancesDoc::initialize( - const UUID jobId) { - if (! _isInitialized) { - _jobId = jobId; - - _isInitialized = true; - } -} - -/// Accessor for the JobId -UUID CDiagCollectInstancesDoc::getJobId() const { - return _jobId; -} - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/DiagTypesDoc/CDiagDeleteValueCollectionDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/DiagTypesDoc/CDiagDeleteValueCollectionDoc.cpp deleted file mode 100644 index 579b28a09..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/DiagTypesDoc/CDiagDeleteValueCollectionDoc.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/DiagTypesDoc/CDiagDeleteValueDoc.h" -#include "Doc/DiagTypesDoc/CDiagDeleteValueCollectionDoc.h" - -using namespace Caf; - -/// A simple container for objects of type DiagDeleteValueCollection -CDiagDeleteValueCollectionDoc::CDiagDeleteValueCollectionDoc() : - _isInitialized(false) {} -CDiagDeleteValueCollectionDoc::~CDiagDeleteValueCollectionDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CDiagDeleteValueCollectionDoc::initialize( - const std::deque deleteValueCollection) { - if (! _isInitialized) { - _deleteValueCollection = deleteValueCollection; - - _isInitialized = true; - } -} - -/// Accessor for the DeleteValue -std::deque CDiagDeleteValueCollectionDoc::getDeleteValueCollection() const { - return _deleteValueCollection; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/DiagTypesDoc/CDiagDeleteValueDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/DiagTypesDoc/CDiagDeleteValueDoc.cpp deleted file mode 100644 index 62a5c1bf8..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/DiagTypesDoc/CDiagDeleteValueDoc.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" -#include "Doc/DiagTypesDoc/CDiagDeleteValueDoc.h" - -using namespace Caf; - -/// A simple container for objects of type DiagDeleteValue -CDiagDeleteValueDoc::CDiagDeleteValueDoc() : - _jobId(CAFCOMMON_GUID_NULL), - _isInitialized(false) {} -CDiagDeleteValueDoc::~CDiagDeleteValueDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CDiagDeleteValueDoc::initialize( - const UUID jobId, - const std::string fileAlias, - const std::string valueName) { - if (! _isInitialized) { - _jobId = jobId; - _fileAlias = fileAlias; - _valueName = valueName; - - _isInitialized = true; - } -} - -/// Accessor for the JobId -UUID CDiagDeleteValueDoc::getJobId() const { - return _jobId; -} - -/// Accessor for the FileAlias -std::string CDiagDeleteValueDoc::getFileAlias() const { - return _fileAlias; -} - -/// Accessor for the ValueName -std::string CDiagDeleteValueDoc::getValueName() const { - return _valueName; -} - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/DiagTypesDoc/CDiagSetValueCollectionDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/DiagTypesDoc/CDiagSetValueCollectionDoc.cpp deleted file mode 100644 index e80c802db..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/DiagTypesDoc/CDiagSetValueCollectionDoc.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/DiagTypesDoc/CDiagSetValueDoc.h" -#include "Doc/DiagTypesDoc/CDiagSetValueCollectionDoc.h" - -using namespace Caf; - -/// A simple container for objects of type DiagSetValueCollection -CDiagSetValueCollectionDoc::CDiagSetValueCollectionDoc() : - _isInitialized(false) {} -CDiagSetValueCollectionDoc::~CDiagSetValueCollectionDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CDiagSetValueCollectionDoc::initialize( - const std::deque setValueCollection) { - if (! _isInitialized) { - _setValueCollection = setValueCollection; - - _isInitialized = true; - } -} - -/// Accessor for the SetValue -std::deque CDiagSetValueCollectionDoc::getSetValueCollection() const { - return _setValueCollection; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/DiagTypesDoc/CDiagSetValueDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/DiagTypesDoc/CDiagSetValueDoc.cpp deleted file mode 100644 index 4a29f8e82..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/DiagTypesDoc/CDiagSetValueDoc.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/CafCoreTypesDoc/CPropertyDoc.h" -#include "Doc/DiagTypesDoc/CDiagSetValueDoc.h" - -using namespace Caf; - -/// A simple container for objects of type DiagSetValue -CDiagSetValueDoc::CDiagSetValueDoc() : - _jobId(CAFCOMMON_GUID_NULL), - _isInitialized(false) {} -CDiagSetValueDoc::~CDiagSetValueDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CDiagSetValueDoc::initialize( - const UUID jobId, - const std::string fileAlias, - const SmartPtrCPropertyDoc value) { - if (! _isInitialized) { - _jobId = jobId; - _fileAlias = fileAlias; - _value = value; - - _isInitialized = true; - } -} - -/// Accessor for the JobId -UUID CDiagSetValueDoc::getJobId() const { - return _jobId; -} - -/// Accessor for the FileAlias -std::string CDiagSetValueDoc::getFileAlias() const { - return _fileAlias; -} - -/// Accessor for the Value -SmartPtrCPropertyDoc CDiagSetValueDoc::getValue() const { - return _value; -} - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/DiagTypesDoc/stdafx.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/DiagTypesDoc/stdafx.h deleted file mode 100644 index c2b4aa8e4..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/DiagTypesDoc/stdafx.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Author: bwilliams - * Created: February 25, 2016 - * - * Copyright (C) 2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#ifndef STDAFX_H_ -#define STDAFX_H_ - -#ifdef WIN32 - #define DIAGTYPESDOC_LINKAGE __declspec(dllexport) -#else - #define DIAGTYPESDOC_LINKAGE -#endif - -#include - -#endif /* STDAFX_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/MgmtRequestDoc/CMgmtRequestDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/MgmtRequestDoc/CMgmtRequestDoc.cpp deleted file mode 100644 index b4782bd06..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/MgmtRequestDoc/CMgmtRequestDoc.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/CafCoreTypesDoc/CAttachmentCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CRequestHeaderDoc.h" -#include "Doc/MgmtTypesDoc/CMgmtBatchDoc.h" -#include "Doc/MgmtRequestDoc/CMgmtRequestDoc.h" - -using namespace Caf; - -/// A simple container for objects of type MgmtRequest -CMgmtRequestDoc::CMgmtRequestDoc() : - _clientId(CAFCOMMON_GUID_NULL), - _requestId(CAFCOMMON_GUID_NULL), - _isInitialized(false) {} -CMgmtRequestDoc::~CMgmtRequestDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CMgmtRequestDoc::initialize( - const UUID clientId, - const UUID requestId, - const std::string pmeId, - const SmartPtrCRequestHeaderDoc requestHeader, - const SmartPtrCMgmtBatchDoc batch, - const SmartPtrCAttachmentCollectionDoc attachmentCollection) { - if (! _isInitialized) { - _clientId = clientId; - _requestId = requestId; - _pmeId = pmeId; - _requestHeader = requestHeader; - _batch = batch; - _attachmentCollection = attachmentCollection; - - _isInitialized = true; - } -} - -/// Accessor for the ClientId -UUID CMgmtRequestDoc::getClientId() const { - return _clientId; -} - -/// Accessor for the RequestId -UUID CMgmtRequestDoc::getRequestId() const { - return _requestId; -} - -/// Accessor for the PmeId -std::string CMgmtRequestDoc::getPmeId() const { - return _pmeId; -} - -/// Accessor for the RequestHeader -SmartPtrCRequestHeaderDoc CMgmtRequestDoc::getRequestHeader() const { - return _requestHeader; -} - -/// Accessor for the Batch -SmartPtrCMgmtBatchDoc CMgmtRequestDoc::getBatch() const { - return _batch; -} - -/// Accessor for the AttachmentCollection -SmartPtrCAttachmentCollectionDoc CMgmtRequestDoc::getAttachmentCollection() const { - return _attachmentCollection; -} - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/MgmtRequestDoc/stdafx.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/MgmtRequestDoc/stdafx.h deleted file mode 100644 index 7bdaaf007..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/MgmtRequestDoc/stdafx.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Author: bwilliams - * Created: February 25, 2016 - * - * Copyright (C) 2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#ifndef STDAFX_H_ -#define STDAFX_H_ - -#ifdef WIN32 - #define MGMTREQUESTDOC_LINKAGE __declspec(dllexport) -#else - #define MGMTREQUESTDOC_LINKAGE -#endif - -#include - -#endif /* STDAFX_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/MgmtTypesDoc/CMgmtBatchDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/MgmtTypesDoc/CMgmtBatchDoc.cpp deleted file mode 100644 index 6bfe2f927..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/MgmtTypesDoc/CMgmtBatchDoc.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/MgmtTypesDoc/CMgmtCollectInstancesCollectionDoc.h" -#include "Doc/MgmtTypesDoc/CMgmtCollectSchemaDoc.h" -#include "Doc/MgmtTypesDoc/CMgmtInvokeOperationCollectionDoc.h" -#include "Doc/MgmtTypesDoc/CMgmtBatchDoc.h" - -using namespace Caf; - -/// A simple container for objects of type MgmtBatch -CMgmtBatchDoc::CMgmtBatchDoc() : - _isInitialized(false) {} -CMgmtBatchDoc::~CMgmtBatchDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CMgmtBatchDoc::initialize( - const SmartPtrCMgmtCollectSchemaDoc collectSchema, - const SmartPtrCMgmtCollectInstancesCollectionDoc collectInstancesCollection, - const SmartPtrCMgmtInvokeOperationCollectionDoc invokeOperationCollection) { - if (! _isInitialized) { - _collectSchema = collectSchema; - _collectInstancesCollection = collectInstancesCollection; - _invokeOperationCollection = invokeOperationCollection; - - _isInitialized = true; - } -} - -/// Accessor for the CollectSchema -SmartPtrCMgmtCollectSchemaDoc CMgmtBatchDoc::getCollectSchema() const { - return _collectSchema; -} - -/// Accessor for the CollectInstancesCollection -SmartPtrCMgmtCollectInstancesCollectionDoc CMgmtBatchDoc::getCollectInstancesCollection() const { - return _collectInstancesCollection; -} - -/// Accessor for the InvokeOperationCollection -SmartPtrCMgmtInvokeOperationCollectionDoc CMgmtBatchDoc::getInvokeOperationCollection() const { - return _invokeOperationCollection; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/MgmtTypesDoc/CMgmtCollectInstancesCollectionDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/MgmtTypesDoc/CMgmtCollectInstancesCollectionDoc.cpp deleted file mode 100644 index d093ce04f..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/MgmtTypesDoc/CMgmtCollectInstancesCollectionDoc.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/MgmtTypesDoc/CMgmtCollectInstancesDoc.h" -#include "Doc/MgmtTypesDoc/CMgmtCollectInstancesCollectionDoc.h" - -using namespace Caf; - -/// A simple container for objects of type MgmtCollectInstancesCollection -CMgmtCollectInstancesCollectionDoc::CMgmtCollectInstancesCollectionDoc() : - _isInitialized(false) {} -CMgmtCollectInstancesCollectionDoc::~CMgmtCollectInstancesCollectionDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CMgmtCollectInstancesCollectionDoc::initialize( - const std::deque collectInstancesCollection) { - if (! _isInitialized) { - _collectInstancesCollection = collectInstancesCollection; - - _isInitialized = true; - } -} - -/// Accessor for the CollectInstances -std::deque CMgmtCollectInstancesCollectionDoc::getCollectInstancesCollection() const { - return _collectInstancesCollection; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/MgmtTypesDoc/CMgmtCollectInstancesDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/MgmtTypesDoc/CMgmtCollectInstancesDoc.cpp deleted file mode 100644 index a18333b97..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/MgmtTypesDoc/CMgmtCollectInstancesDoc.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/CafCoreTypesDoc/CClassSpecifierDoc.h" -#include "Doc/CafCoreTypesDoc/CParameterCollectionDoc.h" -#include "Doc/MgmtTypesDoc/CMgmtCollectInstancesDoc.h" - -using namespace Caf; - -/// A simple container for objects of type MgmtCollectInstances -CMgmtCollectInstancesDoc::CMgmtCollectInstancesDoc() : - _jobId(CAFCOMMON_GUID_NULL), - _isInitialized(false) {} -CMgmtCollectInstancesDoc::~CMgmtCollectInstancesDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CMgmtCollectInstancesDoc::initialize( - const UUID jobId, - const SmartPtrCClassSpecifierDoc classSpecifier, - const SmartPtrCParameterCollectionDoc parameterCollection) { - if (! _isInitialized) { - _jobId = jobId; - _classSpecifier = classSpecifier; - _parameterCollection = parameterCollection; - - _isInitialized = true; - } -} - -/// Accessor for the JobId -UUID CMgmtCollectInstancesDoc::getJobId() const { - return _jobId; -} - -/// Accessor for the ClassSpecifier -SmartPtrCClassSpecifierDoc CMgmtCollectInstancesDoc::getClassSpecifier() const { - return _classSpecifier; -} - -/// Accessor for the ParameterCollection -SmartPtrCParameterCollectionDoc CMgmtCollectInstancesDoc::getParameterCollection() const { - return _parameterCollection; -} - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/MgmtTypesDoc/CMgmtCollectSchemaDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/MgmtTypesDoc/CMgmtCollectSchemaDoc.cpp deleted file mode 100644 index dc18591a3..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/MgmtTypesDoc/CMgmtCollectSchemaDoc.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" -#include "Doc/MgmtTypesDoc/CMgmtCollectSchemaDoc.h" - -using namespace Caf; - -/// A simple container for objects of type MgmtCollectSchema -CMgmtCollectSchemaDoc::CMgmtCollectSchemaDoc() : - _jobId(CAFCOMMON_GUID_NULL), - _isInitialized(false) {} -CMgmtCollectSchemaDoc::~CMgmtCollectSchemaDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CMgmtCollectSchemaDoc::initialize( - const UUID jobId) { - if (! _isInitialized) { - _jobId = jobId; - - _isInitialized = true; - } -} - -/// Accessor for the JobId -UUID CMgmtCollectSchemaDoc::getJobId() const { - return _jobId; -} - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/MgmtTypesDoc/CMgmtInvokeOperationCollectionDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/MgmtTypesDoc/CMgmtInvokeOperationCollectionDoc.cpp deleted file mode 100644 index abef57af3..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/MgmtTypesDoc/CMgmtInvokeOperationCollectionDoc.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/MgmtTypesDoc/CMgmtInvokeOperationDoc.h" -#include "Doc/MgmtTypesDoc/CMgmtInvokeOperationCollectionDoc.h" - -using namespace Caf; - -/// A simple container for objects of type MgmtInvokeOperationCollection -CMgmtInvokeOperationCollectionDoc::CMgmtInvokeOperationCollectionDoc() : - _isInitialized(false) {} -CMgmtInvokeOperationCollectionDoc::~CMgmtInvokeOperationCollectionDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CMgmtInvokeOperationCollectionDoc::initialize( - const std::deque invokeOperationCollection) { - if (! _isInitialized) { - _invokeOperationCollection = invokeOperationCollection; - - _isInitialized = true; - } -} - -/// Accessor for the InvokeOperation -std::deque CMgmtInvokeOperationCollectionDoc::getInvokeOperationCollection() const { - return _invokeOperationCollection; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/MgmtTypesDoc/CMgmtInvokeOperationDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/MgmtTypesDoc/CMgmtInvokeOperationDoc.cpp deleted file mode 100644 index 553815aa4..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/MgmtTypesDoc/CMgmtInvokeOperationDoc.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/CafCoreTypesDoc/CClassSpecifierDoc.h" -#include "Doc/CafCoreTypesDoc/COperationDoc.h" -#include "Doc/MgmtTypesDoc/CMgmtInvokeOperationDoc.h" - -using namespace Caf; - -/// A simple container for objects of type MgmtInvokeOperation -CMgmtInvokeOperationDoc::CMgmtInvokeOperationDoc() : - _jobId(CAFCOMMON_GUID_NULL), - _isInitialized(false) {} -CMgmtInvokeOperationDoc::~CMgmtInvokeOperationDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CMgmtInvokeOperationDoc::initialize( - const UUID jobId, - const SmartPtrCClassSpecifierDoc classSpecifier, - const SmartPtrCOperationDoc operation) { - if (! _isInitialized) { - _jobId = jobId; - _classSpecifier = classSpecifier; - _operation = operation; - - _isInitialized = true; - } -} - -/// Accessor for the JobId -UUID CMgmtInvokeOperationDoc::getJobId() const { - return _jobId; -} - -/// Accessor for the ClassSpecifier -SmartPtrCClassSpecifierDoc CMgmtInvokeOperationDoc::getClassSpecifier() const { - return _classSpecifier; -} - -/// Accessor for the Operation -SmartPtrCOperationDoc CMgmtInvokeOperationDoc::getOperation() const { - return _operation; -} - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/MgmtTypesDoc/stdafx.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/MgmtTypesDoc/stdafx.h deleted file mode 100644 index a80fcd556..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/MgmtTypesDoc/stdafx.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Author: bwilliams - * Created: February 25, 2016 - * - * Copyright (C) 2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#ifndef STDAFX_H_ -#define STDAFX_H_ - -#ifdef WIN32 - #define MGMTTYPESDOC_LINKAGE __declspec(dllexport) -#else - #define MGMTTYPESDOC_LINKAGE -#endif - -#include - -#endif /* STDAFX_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/MultiPmeMgmtRequestDoc/CMultiPmeMgmtBatchCollectionDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/MultiPmeMgmtRequestDoc/CMultiPmeMgmtBatchCollectionDoc.cpp deleted file mode 100644 index 00979b4fb..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/MultiPmeMgmtRequestDoc/CMultiPmeMgmtBatchCollectionDoc.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/MultiPmeMgmtRequestDoc/CMultiPmeMgmtBatchDoc.h" -#include "Doc/MultiPmeMgmtRequestDoc/CMultiPmeMgmtBatchCollectionDoc.h" - -using namespace Caf; - -/// A simple container for objects of type MultiPmeMgmtBatchCollection -CMultiPmeMgmtBatchCollectionDoc::CMultiPmeMgmtBatchCollectionDoc() : - _isInitialized(false) {} -CMultiPmeMgmtBatchCollectionDoc::~CMultiPmeMgmtBatchCollectionDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CMultiPmeMgmtBatchCollectionDoc::initialize( - const std::deque multiPmeBatch) { - if (! _isInitialized) { - _multiPmeBatch = multiPmeBatch; - - _isInitialized = true; - } -} - -/// Accessor for the MultiPmeBatch -std::deque CMultiPmeMgmtBatchCollectionDoc::getMultiPmeBatch() const { - return _multiPmeBatch; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/MultiPmeMgmtRequestDoc/CMultiPmeMgmtBatchDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/MultiPmeMgmtRequestDoc/CMultiPmeMgmtBatchDoc.cpp deleted file mode 100644 index b7c1b023e..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/MultiPmeMgmtRequestDoc/CMultiPmeMgmtBatchDoc.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/MgmtTypesDoc/CMgmtBatchDoc.h" -#include "Doc/MultiPmeMgmtRequestDoc/CPmeIdCollectionDoc.h" -#include "Doc/MultiPmeMgmtRequestDoc/CMultiPmeMgmtBatchDoc.h" - -using namespace Caf; - -/// A simple container for objects of type MultiPmeMgmtBatch -CMultiPmeMgmtBatchDoc::CMultiPmeMgmtBatchDoc() : - _isInitialized(false) {} -CMultiPmeMgmtBatchDoc::~CMultiPmeMgmtBatchDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CMultiPmeMgmtBatchDoc::initialize( - const SmartPtrCPmeIdCollectionDoc pmeIdCollection, - const SmartPtrCMgmtBatchDoc batch) { - if (! _isInitialized) { - _pmeIdCollection = pmeIdCollection; - _batch = batch; - - _isInitialized = true; - } -} - -/// Accessor for the PmeIdCollection -SmartPtrCPmeIdCollectionDoc CMultiPmeMgmtBatchDoc::getPmeIdCollection() const { - return _pmeIdCollection; -} - -/// Accessor for the Batch -SmartPtrCMgmtBatchDoc CMultiPmeMgmtBatchDoc::getBatch() const { - return _batch; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/MultiPmeMgmtRequestDoc/CMultiPmeMgmtRequestDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/MultiPmeMgmtRequestDoc/CMultiPmeMgmtRequestDoc.cpp deleted file mode 100644 index 1716cc66b..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/MultiPmeMgmtRequestDoc/CMultiPmeMgmtRequestDoc.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/CafCoreTypesDoc/CRequestHeaderDoc.h" -#include "Doc/MultiPmeMgmtRequestDoc/CMultiPmeMgmtBatchCollectionDoc.h" -#include "Doc/MultiPmeMgmtRequestDoc/CMultiPmeMgmtRequestDoc.h" - -using namespace Caf; - -/// A simple container for objects of type MultiPmeMgmtRequest -CMultiPmeMgmtRequestDoc::CMultiPmeMgmtRequestDoc() : - _clientId(CAFCOMMON_GUID_NULL), - _requestId(CAFCOMMON_GUID_NULL), - _isInitialized(false) {} -CMultiPmeMgmtRequestDoc::~CMultiPmeMgmtRequestDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CMultiPmeMgmtRequestDoc::initialize( - const UUID clientId, - const UUID requestId, - const SmartPtrCRequestHeaderDoc requestHeader, - const SmartPtrCMultiPmeMgmtBatchCollectionDoc multiPmeBatchCollection) { - if (! _isInitialized) { - _clientId = clientId; - _requestId = requestId; - _requestHeader = requestHeader; - _multiPmeBatchCollection = multiPmeBatchCollection; - - _isInitialized = true; - } -} - -/// Accessor for the ClientId -UUID CMultiPmeMgmtRequestDoc::getClientId() const { - return _clientId; -} - -/// Accessor for the RequestId -UUID CMultiPmeMgmtRequestDoc::getRequestId() const { - return _requestId; -} - -/// Accessor for the RequestHeader -SmartPtrCRequestHeaderDoc CMultiPmeMgmtRequestDoc::getRequestHeader() const { - return _requestHeader; -} - -/// Accessor for the MultiPmeBatchCollection -SmartPtrCMultiPmeMgmtBatchCollectionDoc CMultiPmeMgmtRequestDoc::getMultiPmeBatchCollection() const { - return _multiPmeBatchCollection; -} - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/MultiPmeMgmtRequestDoc/CPmeIdCollectionDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/MultiPmeMgmtRequestDoc/CPmeIdCollectionDoc.cpp deleted file mode 100644 index 2f3bcb3f0..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/MultiPmeMgmtRequestDoc/CPmeIdCollectionDoc.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" -#include "Doc/MultiPmeMgmtRequestDoc/CPmeIdCollectionDoc.h" - -using namespace Caf; - -/// A simple container for objects of type PmeIdCollection -CPmeIdCollectionDoc::CPmeIdCollectionDoc() : - _isInitialized(false) {} -CPmeIdCollectionDoc::~CPmeIdCollectionDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CPmeIdCollectionDoc::initialize( - const std::deque pmeIdCollection) { - if (! _isInitialized) { - _pmeIdCollection = pmeIdCollection; - - _isInitialized = true; - } -} - -/// Accessor for the PmeId -std::deque CPmeIdCollectionDoc::getPmeIdCollection() const { - return _pmeIdCollection; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/MultiPmeMgmtRequestDoc/stdafx.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/MultiPmeMgmtRequestDoc/stdafx.h deleted file mode 100644 index d6eaadb5b..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/MultiPmeMgmtRequestDoc/stdafx.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Author: bwilliams - * Created: February 25, 2016 - * - * Copyright (C) 2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#ifndef STDAFX_H_ -#define STDAFX_H_ - -#ifdef WIN32 - #define MULTIPMEMGMTREQUESTDOC_LINKAGE __declspec(dllexport) -#else - #define MULTIPMEMGMTREQUESTDOC_LINKAGE -#endif - -#include - -#endif /* STDAFX_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/PayloadEnvelopeDoc/CPayloadEnvelopeDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/PayloadEnvelopeDoc/CPayloadEnvelopeDoc.cpp deleted file mode 100644 index 5e47a0863..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/PayloadEnvelopeDoc/CPayloadEnvelopeDoc.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Author: bwilliams - * Created: July 3, 2015 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#include "stdafx.h" - -#include "Doc/CafCoreTypesDoc/CAttachmentCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CPropertyCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CProtocolCollectionDoc.h" -#include "Doc/PayloadEnvelopeDoc/CPayloadEnvelopeDoc.h" - -using namespace Caf; - -/// A simple container for objects of type PayloadEnvelope -CPayloadEnvelopeDoc::CPayloadEnvelopeDoc() : - _clientId(CAFCOMMON_GUID_NULL), - _requestId(CAFCOMMON_GUID_NULL), - _isInitialized(false) {} -CPayloadEnvelopeDoc::~CPayloadEnvelopeDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CPayloadEnvelopeDoc::initialize( - const UUID& clientId, - const UUID& requestId, - const std::string& pmeId, - const std::string& payloadType, - const std::string& payloadVersion, - const SmartPtrCAttachmentCollectionDoc& attachmentCollection, - const SmartPtrCProtocolCollectionDoc& protocolCollection, - const SmartPtrCPropertyCollectionDoc& headerCollection, - const std::string version) { - if (! _isInitialized) { - _clientId = clientId; - _requestId = requestId; - _pmeId = pmeId; - _payloadType = payloadType; - _payloadVersion = payloadVersion; - _attachmentCollection = attachmentCollection; - _protocolCollection = protocolCollection; - _headerCollection = headerCollection; - _version = version; - - _isInitialized = true; - } -} - -/// Accessor for the ClientId -UUID CPayloadEnvelopeDoc::getClientId() const { - return _clientId; -} - -/// Accessor for the RequestId -UUID CPayloadEnvelopeDoc::getRequestId() const { - return _requestId; -} - -/// Accessor for the PmeId -std::string CPayloadEnvelopeDoc::getPmeId() const { - return _pmeId; -} - -/// Accessor for the PayloadType -std::string CPayloadEnvelopeDoc::getPayloadType() const { - return _payloadType; -} - -/// Accessor for the PayloadVersion -std::string CPayloadEnvelopeDoc::getPayloadVersion() const { - return _payloadVersion; -} - -/// Accessor for the Protocol Collection -SmartPtrCProtocolCollectionDoc CPayloadEnvelopeDoc::getProtocolCollection() const { - return _protocolCollection; -} - -/// Accessor for the AttachmentCollection -SmartPtrCAttachmentCollectionDoc CPayloadEnvelopeDoc::getAttachmentCollection() const { - return _attachmentCollection; -} - -/// Accessor for the Headers -SmartPtrCPropertyCollectionDoc CPayloadEnvelopeDoc::getHeaderCollection() const { - return _headerCollection; -} - -/// Accessor for the version -std::string CPayloadEnvelopeDoc::getVersion() const { - return _version; -} - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/PayloadEnvelopeDoc/stdafx.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/PayloadEnvelopeDoc/stdafx.h deleted file mode 100644 index dcb0fa36c..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/PayloadEnvelopeDoc/stdafx.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Author: bwilliams - * Created: February 25, 2016 - * - * Copyright (C) 2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#ifndef STDAFX_H_ -#define STDAFX_H_ - -#ifdef WIN32 - #define PAYLOADENVELOPEDOC_LINKAGE __declspec(dllexport) -#else - #define PAYLOADENVELOPEDOC_LINKAGE -#endif - -#include - -#endif /* STDAFX_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/PersistenceDoc/CCertCollectionDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/PersistenceDoc/CCertCollectionDoc.cpp deleted file mode 100644 index 07eebf55e..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/PersistenceDoc/CCertCollectionDoc.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" -#include "Doc/PersistenceDoc/CCertCollectionDoc.h" - -using namespace Caf; - -/// A simple container for objects of type CertCollection -CCertCollectionDoc::CCertCollectionDoc() : - _isInitialized(false) {} -CCertCollectionDoc::~CCertCollectionDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CCertCollectionDoc::initialize( - const std::deque certCollection) { - if (! _isInitialized) { - _certCollection = certCollection; - - _isInitialized = true; - } -} - -/// Accessor for the Cert -std::deque CCertCollectionDoc::getCert() const { - return _certCollection; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/PersistenceDoc/CCertPathCollectionDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/PersistenceDoc/CCertPathCollectionDoc.cpp deleted file mode 100644 index aee764b6d..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/PersistenceDoc/CCertPathCollectionDoc.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" -#include "Doc/PersistenceDoc/CCertPathCollectionDoc.h" - -using namespace Caf; - -/// A simple container for objects of type CertPathCollection -CCertPathCollectionDoc::CCertPathCollectionDoc() : - _isInitialized(false) {} -CCertPathCollectionDoc::~CCertPathCollectionDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CCertPathCollectionDoc::initialize( - const std::deque certPathCollection) { - if (! _isInitialized) { - _certPathCollection = certPathCollection; - - _isInitialized = true; - } -} - -/// Accessor for the Cert -std::deque CCertPathCollectionDoc::getCertPath() const { - return _certPathCollection; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/PersistenceDoc/CLocalSecurityDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/PersistenceDoc/CLocalSecurityDoc.cpp deleted file mode 100644 index 1d1dbda39..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/PersistenceDoc/CLocalSecurityDoc.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Author: bwilliams - * Created: Nov 16, 2015 - * - * Copyright (C) 2015-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#include "stdafx.h" -#include "Doc/PersistenceDoc/CLocalSecurityDoc.h" - -using namespace Caf; - -/// A simple container for objects of type CLocalSecurityDoc -CLocalSecurityDoc::CLocalSecurityDoc() : - _isInitialized(false) {} -CLocalSecurityDoc::~CLocalSecurityDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CLocalSecurityDoc::initialize( - const std::string& localId, - const std::string& privateKey, - const std::string& cert, - const std::string& privateKeyPath, - const std::string& certPath) { - if (! _isInitialized) { - _localId = localId; - _privateKey = privateKey; - _cert = cert; - - _privateKeyPath = privateKeyPath; - _certPath = certPath; - - _isInitialized = true; - } -} - -/// Accessor for the LocalId -std::string CLocalSecurityDoc::getLocalId() const { - return _localId; -} - -/// Accessor for the PrivateKey -std::string CLocalSecurityDoc::getPrivateKey() const { - return _privateKey; -} - -/// Accessor for the Cert -std::string CLocalSecurityDoc::getCert() const { - return _cert; -} - -/// Accessor for the PrivateKeyPath -std::string CLocalSecurityDoc::getPrivateKeyPath() const { - return _privateKeyPath; -} - -/// Accessor for the CertPath -std::string CLocalSecurityDoc::getCertPath() const { - return _certPath; -} - - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/PersistenceDoc/CPersistenceDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/PersistenceDoc/CPersistenceDoc.cpp deleted file mode 100644 index cadd12120..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/PersistenceDoc/CPersistenceDoc.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Author: bwilliams - * Created: Nov 16, 2015 - * - * Copyright (C) 2015-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#include "stdafx.h" - -#include "Doc/PersistenceDoc/CLocalSecurityDoc.h" -#include "Doc/PersistenceDoc/CPersistenceProtocolCollectionDoc.h" -#include "Doc/PersistenceDoc/CRemoteSecurityCollectionDoc.h" -#include "Doc/PersistenceDoc/CPersistenceDoc.h" - -using namespace Caf; - -/// A simple container for objects of type PersistenceEnvelope -CPersistenceDoc::CPersistenceDoc() : - _isInitialized(false) {} -CPersistenceDoc::~CPersistenceDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CPersistenceDoc::initialize( - const SmartPtrCLocalSecurityDoc& localSecurity, - const SmartPtrCRemoteSecurityCollectionDoc& remoteSecurityCollection, - const SmartPtrCPersistenceProtocolCollectionDoc& persistenceProtocolCollection, - const std::string version) { - if (! _isInitialized) { - _localSecurity = localSecurity; - _remoteSecurityCollection = remoteSecurityCollection; - _persistenceProtocolCollection = persistenceProtocolCollection; - _version = version; - - _isInitialized = true; - } -} - -/// Accessor for the LocalSecurity -SmartPtrCLocalSecurityDoc CPersistenceDoc::getLocalSecurity() const { - return _localSecurity; -} - -/// Accessor for the Protocol Collection -SmartPtrCRemoteSecurityCollectionDoc CPersistenceDoc::getRemoteSecurityCollection() const { - return _remoteSecurityCollection; -} - -/// Accessor for the PersistenceProtocol -SmartPtrCPersistenceProtocolCollectionDoc CPersistenceDoc::getPersistenceProtocolCollection() const { - return _persistenceProtocolCollection; -} - -/// Accessor for the version -std::string CPersistenceDoc::getVersion() const { - return _version; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/PersistenceDoc/CPersistenceProtocolCollectionDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/PersistenceDoc/CPersistenceProtocolCollectionDoc.cpp deleted file mode 100644 index 39e7219eb..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/PersistenceDoc/CPersistenceProtocolCollectionDoc.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/PersistenceDoc/CPersistenceProtocolDoc.h" -#include "Doc/PersistenceDoc/CPersistenceProtocolCollectionDoc.h" - -using namespace Caf; - -/// A simple container for objects of type PersistenceProtocolCollection -CPersistenceProtocolCollectionDoc::CPersistenceProtocolCollectionDoc() : - _isInitialized(false) {} -CPersistenceProtocolCollectionDoc::~CPersistenceProtocolCollectionDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CPersistenceProtocolCollectionDoc::initialize( - const std::deque persistenceProtocol) { - if (! _isInitialized) { - _persistenceProtocol = persistenceProtocol; - - _isInitialized = true; - } -} - -/// Accessor for the PersistenceProtocol -std::deque CPersistenceProtocolCollectionDoc::getPersistenceProtocol() const { - return _persistenceProtocol; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/PersistenceDoc/CPersistenceProtocolDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/PersistenceDoc/CPersistenceProtocolDoc.cpp deleted file mode 100644 index 1da977b59..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/PersistenceDoc/CPersistenceProtocolDoc.cpp +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Author: bwilliams - * Created: Nov 16, 2015 - * - * Copyright (C) 2015-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#include "stdafx.h" - -#include "Doc/PersistenceDoc/CCertCollectionDoc.h" -#include "Doc/PersistenceDoc/CCertPathCollectionDoc.h" -#include "Doc/PersistenceDoc/CPersistenceProtocolDoc.h" - -using namespace Caf; - -/// A simple container for objects of type CPersistenceProtocolDoc -CPersistenceProtocolDoc::CPersistenceProtocolDoc() : - _isInitialized(false) {} -CPersistenceProtocolDoc::~CPersistenceProtocolDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CPersistenceProtocolDoc::initialize( - const std::string& protocolName, - const std::string& uri, - const std::string& uriAmqp, - const std::string& uriTunnel, - const std::string& tlsCert, - const std::string& tlsProtocol, - const Cdeqstr& tlsCipherCollection, - const SmartPtrCCertCollectionDoc& tlsCertCollection, - const std::string& uriAmqpPath, - const std::string& uriTunnelPath, - const std::string& tlsCertPath, - const SmartPtrCCertPathCollectionDoc& tlsCertPathCollection) { - if (! _isInitialized) { - _protocolName = protocolName; - _uri = uri; - _uriAmqp = uriAmqp; - _uriTunnel = uriTunnel; - _tlsCert = tlsCert; - _tlsProtocol = tlsProtocol; - _tlsCipherCollection = tlsCipherCollection; - _tlsCertCollection = tlsCertCollection; - - _uriAmqpPath = uriAmqpPath; - _uriTunnelPath = uriTunnelPath; - _tlsCertPath = tlsCertPath; - _tlsCertPathCollection = tlsCertPathCollection; - - _isInitialized = true; - } -} - -/// Accessor for the ProtocolName -std::string CPersistenceProtocolDoc::getProtocolName() const { - return _protocolName; -} - -/// Accessor for the Uri -std::string CPersistenceProtocolDoc::getUri() const { - return _uri; -} - -/// Accessor for the UriAmqp -std::string CPersistenceProtocolDoc::getUriAmqp() const { - return _uriAmqp; -} - -/// Accessor for the UriTunnel -std::string CPersistenceProtocolDoc::getUriTunnel() const { - return _uriTunnel; -} - -/// Accessor for the TlsCert -std::string CPersistenceProtocolDoc::getTlsCert() const { - return _tlsCert; -} - -/// Accessor for the TlsProtocol -std::string CPersistenceProtocolDoc::getTlsProtocol() const { - return _tlsProtocol; -} - -/// Accessor for the tlsCipherCollection -Cdeqstr CPersistenceProtocolDoc::getTlsCipherCollection() const { - return _tlsCipherCollection; -} - -/// Accessor for the TlsCertCollection -SmartPtrCCertCollectionDoc CPersistenceProtocolDoc::getTlsCertCollection() const { - return _tlsCertCollection; -} - -/// Accessor for the UriAmqpPath -std::string CPersistenceProtocolDoc::getUriAmqpPath() const { - return _uriAmqpPath; -} - -/// Accessor for the UriTunnelPath -std::string CPersistenceProtocolDoc::getUriTunnelPath() const { - return _uriTunnelPath; -} - -/// Accessor for the TlsCertPath -std::string CPersistenceProtocolDoc::getTlsCertPath() const { - return _tlsCertPath; -} - -/// Accessor for the TlsCertPathCollection -SmartPtrCCertPathCollectionDoc CPersistenceProtocolDoc::getTlsCertPathCollection() const { - return _tlsCertPathCollection; -} - -Cdeqstr _tlsCipherCollection; - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/PersistenceDoc/CRemoteSecurityCollectionDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/PersistenceDoc/CRemoteSecurityCollectionDoc.cpp deleted file mode 100644 index 88b7214c8..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/PersistenceDoc/CRemoteSecurityCollectionDoc.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/PersistenceDoc/CRemoteSecurityDoc.h" -#include "Doc/PersistenceDoc/CRemoteSecurityCollectionDoc.h" - -using namespace Caf; - -/// A simple container for objects of type RemoteSecurityCollection -CRemoteSecurityCollectionDoc::CRemoteSecurityCollectionDoc() : - _isInitialized(false) {} -CRemoteSecurityCollectionDoc::~CRemoteSecurityCollectionDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CRemoteSecurityCollectionDoc::initialize( - const std::deque remoteSecurity) { - if (! _isInitialized) { - _remoteSecurity = remoteSecurity; - - _isInitialized = true; - } -} - -/// Accessor for the RemoteSecurity -std::deque CRemoteSecurityCollectionDoc::getRemoteSecurity() const { - return _remoteSecurity; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/PersistenceDoc/CRemoteSecurityDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/PersistenceDoc/CRemoteSecurityDoc.cpp deleted file mode 100644 index eaafd9a63..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/PersistenceDoc/CRemoteSecurityDoc.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Author: bwilliams - * Created: Nov 16, 2015 - * - * Copyright (C) 2015-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#include "stdafx.h" - -#include "Doc/PersistenceDoc/CCertCollectionDoc.h" -#include "Doc/PersistenceDoc/CCertPathCollectionDoc.h" -#include "Doc/PersistenceDoc/CRemoteSecurityDoc.h" - -using namespace Caf; - -/// A simple container for objects of type CRemoteSecurityDoc -CRemoteSecurityDoc::CRemoteSecurityDoc() : - _isInitialized(false) {} -CRemoteSecurityDoc::~CRemoteSecurityDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CRemoteSecurityDoc::initialize( - const std::string& remoteId, - const std::string& protocolName, - const std::string& cmsCert, - const std::string& cmsCipherName, - const SmartPtrCCertCollectionDoc& cmsCertCollection, - const std::string& cmsCertPath, - const SmartPtrCCertPathCollectionDoc& cmsCertPathCollection) { - if (! _isInitialized) { - _remoteId = remoteId; - _protocolName = protocolName; - _cmsCert = cmsCert; - _cmsCipherName = cmsCipherName; - _cmsCertCollection = cmsCertCollection; - - _cmsCertPath = cmsCertPath; - _cmsCertPathCollection = cmsCertPathCollection; - - _isInitialized = true; - } -} - -/// Accessor for the RemoteId -std::string CRemoteSecurityDoc::getRemoteId() const { - return _remoteId; -} - -/// Accessor for the ProtocolName -std::string CRemoteSecurityDoc::getProtocolName() const { - return _protocolName; -} - -/// Accessor for the cmsCert -std::string CRemoteSecurityDoc::getCmsCert() const { - return _cmsCert; -} - -/// Accessor for the CmsCipher -std::string CRemoteSecurityDoc::getCmsCipherName() const { - return _cmsCipherName; -} - -/// Accessor for the CertCollection -SmartPtrCCertCollectionDoc CRemoteSecurityDoc::getCmsCertCollection() const { - return _cmsCertCollection; -} - -/// Accessor for the cmsCertPath -std::string CRemoteSecurityDoc::getCmsCertPath() const { - return _cmsCertPath; -} - -/// Accessor for the CertPathCollection -SmartPtrCCertPathCollectionDoc CRemoteSecurityDoc::getCmsCertPathCollection() const { - return _cmsCertPathCollection; -} - - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/PersistenceDoc/stdafx.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/PersistenceDoc/stdafx.h deleted file mode 100644 index f28ac1cf3..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/PersistenceDoc/stdafx.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Author: bwilliams - * Created: February 25, 2016 - * - * Copyright (C) 2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#ifndef STDAFX_H_ -#define STDAFX_H_ - -#ifdef WIN32 - #define PERSISTENCEDOC_LINKAGE __declspec(dllexport) -#else - #define PERSISTENCEDOC_LINKAGE -#endif - -#include - -#endif /* STDAFX_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ProviderInfraDoc/CClassCollectionDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ProviderInfraDoc/CClassCollectionDoc.cpp deleted file mode 100644 index 64ef9727a..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ProviderInfraDoc/CClassCollectionDoc.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/CafCoreTypesDoc/CFullyQualifiedClassGroupDoc.h" -#include "Doc/ProviderInfraDoc/CClassCollectionDoc.h" - -using namespace Caf; - -/// A simple container for objects of type ClassCollection -CClassCollectionDoc::CClassCollectionDoc() : - _isInitialized(false) {} -CClassCollectionDoc::~CClassCollectionDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CClassCollectionDoc::initialize( - const std::deque fullyQualifiedClass) { - if (! _isInitialized) { - _fullyQualifiedClass = fullyQualifiedClass; - - _isInitialized = true; - } -} - -/// Accessor for the FullyQualifiedClass -std::deque CClassCollectionDoc::getFullyQualifiedClass() const { - return _fullyQualifiedClass; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ProviderInfraDoc/CProviderRegDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ProviderInfraDoc/CProviderRegDoc.cpp deleted file mode 100644 index 0162608da..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ProviderInfraDoc/CProviderRegDoc.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" -#include "Doc/ProviderInfraDoc/CProviderRegDoc.h" - -using namespace Caf; - -/// A simple container for objects of type ProviderReg -CProviderRegDoc::CProviderRegDoc() : - _staleSec(0), - _isSchemaVisible(false), - _isInitialized(false) {} -CProviderRegDoc::~CProviderRegDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CProviderRegDoc::initialize( - const std::string providerNamespace, - const std::string providerName, - const std::string providerVersion, - const int32 staleSec, - const bool isSchemaVisible, - const std::string invokerRelPath) { - if (! _isInitialized) { - _providerNamespace = providerNamespace; - _providerName = providerName; - _providerVersion = providerVersion; - _staleSec = staleSec; - _isSchemaVisible = isSchemaVisible; - _invokerRelPath = invokerRelPath; - - _isInitialized = true; - } -} - -/// Accessor for the ProviderNamespace -std::string CProviderRegDoc::getProviderNamespace() const { - return _providerNamespace; -} - -/// Accessor for the ProviderName -std::string CProviderRegDoc::getProviderName() const { - return _providerName; -} - -/// Accessor for the ProviderVersion -std::string CProviderRegDoc::getProviderVersion() const { - return _providerVersion; -} - -/// Accessor for the StaleSec -int32 CProviderRegDoc::getStaleSec() const { - return _staleSec; -} - -/// Accessor for the IsSchemaVisible -bool CProviderRegDoc::getIsSchemaVisible() const { - return _isSchemaVisible; -} - -/// Accessor for the InvokerRelPath -std::string CProviderRegDoc::getInvokerRelPath() const { - return _invokerRelPath; -} - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ProviderInfraDoc/CSchemaSummaryDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ProviderInfraDoc/CSchemaSummaryDoc.cpp deleted file mode 100644 index 4c2f159e5..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ProviderInfraDoc/CSchemaSummaryDoc.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/ProviderInfraDoc/CClassCollectionDoc.h" -#include "Doc/ProviderInfraDoc/CSchemaSummaryDoc.h" - -using namespace Caf; - -/// A simple container for objects of type SchemaSummary -CSchemaSummaryDoc::CSchemaSummaryDoc() : - _isInitialized(false) {} -CSchemaSummaryDoc::~CSchemaSummaryDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CSchemaSummaryDoc::initialize( - const std::string providerNamespace, - const std::string providerName, - const std::string providerVersion, - const SmartPtrCClassCollectionDoc classCollection, - const std::string invokerPath) { - if (! _isInitialized) { - _providerNamespace = providerNamespace; - _providerName = providerName; - _providerVersion = providerVersion; - _classCollection = classCollection; - _invokerPath = invokerPath; - - _isInitialized = true; - } -} - -/// Accessor for the ProviderNamespace -std::string CSchemaSummaryDoc::getProviderNamespace() const { - return _providerNamespace; -} - -/// Accessor for the ProviderName -std::string CSchemaSummaryDoc::getProviderName() const { - return _providerName; -} - -/// Accessor for the ProviderVersion -std::string CSchemaSummaryDoc::getProviderVersion() const { - return _providerVersion; -} - -/// Accessor for the ClassCollection -SmartPtrCClassCollectionDoc CSchemaSummaryDoc::getClassCollection() const { - return _classCollection; -} - -/// Accessor for the InvokerPath -std::string CSchemaSummaryDoc::getInvokerPath() const { - return _invokerPath; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ProviderInfraDoc/stdafx.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ProviderInfraDoc/stdafx.h deleted file mode 100644 index 29378b813..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ProviderInfraDoc/stdafx.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Author: bwilliams - * Created: February 25, 2016 - * - * Copyright (C) 2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#ifndef STDAFX_H_ -#define STDAFX_H_ - -#ifdef WIN32 - #define PROVIDERINFRADOC_LINKAGE __declspec(dllexport) -#else - #define PROVIDERINFRADOC_LINKAGE -#endif - -#include - -#endif /* STDAFX_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ProviderRequestDoc/CProviderBatchDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ProviderRequestDoc/CProviderBatchDoc.cpp deleted file mode 100644 index 5fb9971fb..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ProviderRequestDoc/CProviderBatchDoc.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/ProviderRequestDoc/CProviderCollectInstancesCollectionDoc.h" -#include "Doc/ProviderRequestDoc/CProviderInvokeOperationCollectionDoc.h" -#include "Doc/ProviderRequestDoc/CProviderBatchDoc.h" - -using namespace Caf; - -/// A simple container for objects of type ProviderBatch -CProviderBatchDoc::CProviderBatchDoc() : - _isInitialized(false) {} -CProviderBatchDoc::~CProviderBatchDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CProviderBatchDoc::initialize( - const std::string outputDir, - const SmartPtrCProviderCollectInstancesCollectionDoc collectInstancesCollection, - const SmartPtrCProviderInvokeOperationCollectionDoc invokeOperationCollection) { - if (! _isInitialized) { - _outputDir = outputDir; - _collectInstancesCollection = collectInstancesCollection; - _invokeOperationCollection = invokeOperationCollection; - - _isInitialized = true; - } -} - -/// Accessor for the OutputDir -std::string CProviderBatchDoc::getOutputDir() const { - return _outputDir; -} - -/// Accessor for the CollectInstancesCollection -SmartPtrCProviderCollectInstancesCollectionDoc CProviderBatchDoc::getCollectInstancesCollection() const { - return _collectInstancesCollection; -} - -/// Accessor for the InvokeOperationCollection -SmartPtrCProviderInvokeOperationCollectionDoc CProviderBatchDoc::getInvokeOperationCollection() const { - return _invokeOperationCollection; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ProviderRequestDoc/CProviderCollectInstancesCollectionDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ProviderRequestDoc/CProviderCollectInstancesCollectionDoc.cpp deleted file mode 100644 index c6281d0bf..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ProviderRequestDoc/CProviderCollectInstancesCollectionDoc.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/ProviderRequestDoc/CProviderCollectInstancesDoc.h" -#include "Doc/ProviderRequestDoc/CProviderCollectInstancesCollectionDoc.h" - -using namespace Caf; - -/// A simple container for objects of type ProviderCollectInstancesCollection -CProviderCollectInstancesCollectionDoc::CProviderCollectInstancesCollectionDoc() : - _isInitialized(false) {} -CProviderCollectInstancesCollectionDoc::~CProviderCollectInstancesCollectionDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CProviderCollectInstancesCollectionDoc::initialize( - const std::deque collectInstances) { - if (! _isInitialized) { - _collectInstances = collectInstances; - - _isInitialized = true; - } -} - -/// Accessor for the CollectInstances -std::deque CProviderCollectInstancesCollectionDoc::getCollectInstances() const { - return _collectInstances; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ProviderRequestDoc/CProviderCollectInstancesDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ProviderRequestDoc/CProviderCollectInstancesDoc.cpp deleted file mode 100644 index dff72521f..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ProviderRequestDoc/CProviderCollectInstancesDoc.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/CafCoreTypesDoc/CParameterCollectionDoc.h" -#include "Doc/ProviderRequestDoc/CProviderCollectInstancesDoc.h" - -using namespace Caf; - -/// A simple container for objects of type ProviderCollectInstances -CProviderCollectInstancesDoc::CProviderCollectInstancesDoc() : - _jobId(CAFCOMMON_GUID_NULL), - _isInitialized(false) {} -CProviderCollectInstancesDoc::~CProviderCollectInstancesDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CProviderCollectInstancesDoc::initialize( - const std::string classNamespace, - const std::string className, - const std::string classVersion, - const UUID jobId, - const std::string outputDir, - const SmartPtrCParameterCollectionDoc parameterCollection) { - if (! _isInitialized) { - _classNamespace = classNamespace; - _className = className; - _classVersion = classVersion; - _jobId = jobId; - _outputDir = outputDir; - _parameterCollection = parameterCollection; - - _isInitialized = true; - } -} - -/// Accessor for the ClassNamespace -std::string CProviderCollectInstancesDoc::getClassNamespace() const { - return _classNamespace; -} - -/// Accessor for the ClassName -std::string CProviderCollectInstancesDoc::getClassName() const { - return _className; -} - -/// Accessor for the ClassVersion -std::string CProviderCollectInstancesDoc::getClassVersion() const { - return _classVersion; -} - -/// Accessor for the JobId -UUID CProviderCollectInstancesDoc::getJobId() const { - return _jobId; -} - -/// Accessor for the OutputDir -std::string CProviderCollectInstancesDoc::getOutputDir() const { - return _outputDir; -} - -/// Accessor for the ParameterCollection -SmartPtrCParameterCollectionDoc CProviderCollectInstancesDoc::getParameterCollection() const { - return _parameterCollection; -} - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ProviderRequestDoc/CProviderCollectSchemaRequestDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ProviderRequestDoc/CProviderCollectSchemaRequestDoc.cpp deleted file mode 100644 index ca89be60e..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ProviderRequestDoc/CProviderCollectSchemaRequestDoc.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/ProviderRequestDoc/CProviderRequestHeaderDoc.h" -#include "Doc/ProviderRequestDoc/CProviderCollectSchemaRequestDoc.h" - -using namespace Caf; - -/// A simple container for objects of type ProviderCollectSchemaRequest -CProviderCollectSchemaRequestDoc::CProviderCollectSchemaRequestDoc() : - _clientId(CAFCOMMON_GUID_NULL), - _requestId(CAFCOMMON_GUID_NULL), - _jobId(CAFCOMMON_GUID_NULL), - _isInitialized(false) {} -CProviderCollectSchemaRequestDoc::~CProviderCollectSchemaRequestDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CProviderCollectSchemaRequestDoc::initialize( - const UUID clientId, - const UUID requestId, - const std::string pmeId, - const UUID jobId, - const std::string outputDir, - const SmartPtrCProviderRequestHeaderDoc requestHeader) { - if (! _isInitialized) { - _clientId = clientId; - _requestId = requestId; - _pmeId = pmeId; - _jobId = jobId; - _outputDir = outputDir; - _requestHeader = requestHeader; - - _isInitialized = true; - } -} - -/// Accessor for the ClientId -UUID CProviderCollectSchemaRequestDoc::getClientId() const { - return _clientId; -} - -/// Accessor for the RequestId -UUID CProviderCollectSchemaRequestDoc::getRequestId() const { - return _requestId; -} - -/// Accessor for the PmeId -std::string CProviderCollectSchemaRequestDoc::getPmeId() const { - return _pmeId; -} - -/// Accessor for the JobId -UUID CProviderCollectSchemaRequestDoc::getJobId() const { - return _jobId; -} - -/// Accessor for the OutputDir -std::string CProviderCollectSchemaRequestDoc::getOutputDir() const { - return _outputDir; -} - -/// Accessor for the RequestHeader -SmartPtrCProviderRequestHeaderDoc CProviderCollectSchemaRequestDoc::getRequestHeader() const { - return _requestHeader; -} - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ProviderRequestDoc/CProviderInvokeOperationCollectionDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ProviderRequestDoc/CProviderInvokeOperationCollectionDoc.cpp deleted file mode 100644 index bdda24700..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ProviderRequestDoc/CProviderInvokeOperationCollectionDoc.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/ProviderRequestDoc/CProviderInvokeOperationDoc.h" -#include "Doc/ProviderRequestDoc/CProviderInvokeOperationCollectionDoc.h" - -using namespace Caf; - -/// A simple container for objects of type ProviderInvokeOperationCollection -CProviderInvokeOperationCollectionDoc::CProviderInvokeOperationCollectionDoc() : - _isInitialized(false) {} -CProviderInvokeOperationCollectionDoc::~CProviderInvokeOperationCollectionDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CProviderInvokeOperationCollectionDoc::initialize( - const std::deque invokeOperation) { - if (! _isInitialized) { - _invokeOperation = invokeOperation; - - _isInitialized = true; - } -} - -/// Accessor for the InvokeOperation -std::deque CProviderInvokeOperationCollectionDoc::getInvokeOperation() const { - return _invokeOperation; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ProviderRequestDoc/CProviderInvokeOperationDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ProviderRequestDoc/CProviderInvokeOperationDoc.cpp deleted file mode 100644 index bd63fc618..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ProviderRequestDoc/CProviderInvokeOperationDoc.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/CafCoreTypesDoc/COperationDoc.h" -#include "Doc/ProviderRequestDoc/CProviderInvokeOperationDoc.h" - -using namespace Caf; - -/// A simple container for objects of type ProviderInvokeOperation -CProviderInvokeOperationDoc::CProviderInvokeOperationDoc() : - _jobId(CAFCOMMON_GUID_NULL), - _isInitialized(false) {} -CProviderInvokeOperationDoc::~CProviderInvokeOperationDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CProviderInvokeOperationDoc::initialize( - const std::string classNamespace, - const std::string className, - const std::string classVersion, - const UUID jobId, - const std::string outputDir, - const SmartPtrCOperationDoc operation) { - if (! _isInitialized) { - _classNamespace = classNamespace; - _className = className; - _classVersion = classVersion; - _jobId = jobId; - _outputDir = outputDir; - _operation = operation; - - _isInitialized = true; - } -} - -/// Accessor for the ClassNamespace -std::string CProviderInvokeOperationDoc::getClassNamespace() const { - return _classNamespace; -} - -/// Accessor for the ClassName -std::string CProviderInvokeOperationDoc::getClassName() const { - return _className; -} - -/// Accessor for the ClassVersion -std::string CProviderInvokeOperationDoc::getClassVersion() const { - return _classVersion; -} - -/// Accessor for the JobId -UUID CProviderInvokeOperationDoc::getJobId() const { - return _jobId; -} - -/// Accessor for the OutputDir -std::string CProviderInvokeOperationDoc::getOutputDir() const { - return _outputDir; -} - -/// Accessor for the Operation -SmartPtrCOperationDoc CProviderInvokeOperationDoc::getOperation() const { - return _operation; -} - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ProviderRequestDoc/CProviderRequestConfigDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ProviderRequestDoc/CProviderRequestConfigDoc.cpp deleted file mode 100644 index 1d40ca9e6..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ProviderRequestDoc/CProviderRequestConfigDoc.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/CafCoreTypesDoc/CLoggingLevelCollectionDoc.h" -#include "Doc/ProviderRequestDoc/CProviderRequestConfigDoc.h" - -using namespace Caf; - -/// A simple container for objects of type ProviderRequestConfig -CProviderRequestConfigDoc::CProviderRequestConfigDoc() : - _isInitialized(false) {} -CProviderRequestConfigDoc::~CProviderRequestConfigDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CProviderRequestConfigDoc::initialize( - const std::string responseFormatType, - const SmartPtrCLoggingLevelCollectionDoc loggingLevelCollection) { - if (! _isInitialized) { - _responseFormatType = responseFormatType; - _loggingLevelCollection = loggingLevelCollection; - - _isInitialized = true; - } -} - -/// Accessor for the ResponseFormatType -std::string CProviderRequestConfigDoc::getResponseFormatType() const { - return _responseFormatType; -} - -/// Accessor for the LoggingLevelCollection -SmartPtrCLoggingLevelCollectionDoc CProviderRequestConfigDoc::getLoggingLevelCollection() const { - return _loggingLevelCollection; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ProviderRequestDoc/CProviderRequestDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ProviderRequestDoc/CProviderRequestDoc.cpp deleted file mode 100644 index 13b7c1375..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ProviderRequestDoc/CProviderRequestDoc.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/CafCoreTypesDoc/CAttachmentCollectionDoc.h" -#include "Doc/ProviderRequestDoc/CProviderBatchDoc.h" -#include "Doc/ProviderRequestDoc/CProviderRequestHeaderDoc.h" -#include "Doc/ProviderRequestDoc/CProviderRequestDoc.h" - -using namespace Caf; - -/// A simple container for objects of type ProviderRequest -CProviderRequestDoc::CProviderRequestDoc() : - _clientId(CAFCOMMON_GUID_NULL), - _requestId(CAFCOMMON_GUID_NULL), - _isInitialized(false) {} -CProviderRequestDoc::~CProviderRequestDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CProviderRequestDoc::initialize( - const UUID clientId, - const UUID requestId, - const std::string pmeId, - const SmartPtrCProviderRequestHeaderDoc requestHeader, - const SmartPtrCProviderBatchDoc batch, - const SmartPtrCAttachmentCollectionDoc attachmentCollection) { - if (! _isInitialized) { - _clientId = clientId; - _requestId = requestId; - _pmeId = pmeId; - _requestHeader = requestHeader; - _batch = batch; - _attachmentCollection = attachmentCollection; - - _isInitialized = true; - } -} - -/// Accessor for the ClientId -UUID CProviderRequestDoc::getClientId() const { - return _clientId; -} - -/// Accessor for the RequestId -UUID CProviderRequestDoc::getRequestId() const { - return _requestId; -} - -/// Accessor for the PmeId -std::string CProviderRequestDoc::getPmeId() const { - return _pmeId; -} - -/// Accessor for the RequestHeader -SmartPtrCProviderRequestHeaderDoc CProviderRequestDoc::getRequestHeader() const { - return _requestHeader; -} - -/// Accessor for the Batch -SmartPtrCProviderBatchDoc CProviderRequestDoc::getBatch() const { - return _batch; -} - -/// Accessor for the AttachmentCollection -SmartPtrCAttachmentCollectionDoc CProviderRequestDoc::getAttachmentCollection() const { - return _attachmentCollection; -} - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ProviderRequestDoc/CProviderRequestHeaderDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ProviderRequestDoc/CProviderRequestHeaderDoc.cpp deleted file mode 100644 index a08a8ae16..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ProviderRequestDoc/CProviderRequestHeaderDoc.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/CafCoreTypesDoc/CPropertyCollectionDoc.h" -#include "Doc/ProviderRequestDoc/CProviderRequestConfigDoc.h" -#include "Doc/ProviderRequestDoc/CProviderRequestHeaderDoc.h" - -using namespace Caf; - -/// A simple container for objects of type ProviderRequestHeader -CProviderRequestHeaderDoc::CProviderRequestHeaderDoc() : - _isInitialized(false) {} -CProviderRequestHeaderDoc::~CProviderRequestHeaderDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CProviderRequestHeaderDoc::initialize( - const SmartPtrCProviderRequestConfigDoc requestConfig, - const SmartPtrCPropertyCollectionDoc echoPropertyBag) { - if (! _isInitialized) { - _requestConfig = requestConfig; - _echoPropertyBag = echoPropertyBag; - - _isInitialized = true; - } -} - -/// Accessor for the RequestConfig -SmartPtrCProviderRequestConfigDoc CProviderRequestHeaderDoc::getRequestConfig() const { - return _requestConfig; -} - -/// Accessor for the EchoPropertyBag -SmartPtrCPropertyCollectionDoc CProviderRequestHeaderDoc::getEchoPropertyBag() const { - return _echoPropertyBag; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ProviderRequestDoc/stdafx.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ProviderRequestDoc/stdafx.h deleted file mode 100644 index c95958ad4..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ProviderRequestDoc/stdafx.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Author: bwilliams - * Created: February 25, 2016 - * - * Copyright (C) 2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#ifndef STDAFX_H_ -#define STDAFX_H_ - -#ifdef WIN32 - #define PROVIDERREQUESTDOC_LINKAGE __declspec(dllexport) -#else - #define PROVIDERREQUESTDOC_LINKAGE -#endif - -#include - -#endif /* STDAFX_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ProviderResultsDoc/CCdifDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ProviderResultsDoc/CCdifDoc.cpp deleted file mode 100644 index b20903a33..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ProviderResultsDoc/CCdifDoc.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/ProviderResultsDoc/CDefinitionObjectCollectionDoc.h" -#include "Doc/ProviderResultsDoc/CRequestIdentifierDoc.h" -#include "Doc/ProviderResultsDoc/CSchemaDoc.h" -#include "Doc/ProviderResultsDoc/CCdifDoc.h" - -using namespace Caf; - -/// A simple container for objects of type Cdif -CCdifDoc::CCdifDoc() : - _isInitialized(false) {} -CCdifDoc::~CCdifDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CCdifDoc::initialize( - const SmartPtrCRequestIdentifierDoc requestIdentifier, - const SmartPtrCDefinitionObjectCollectionDoc definitionObjectCollection, - const SmartPtrCSchemaDoc schema) { - if (! _isInitialized) { - _requestIdentifier = requestIdentifier; - _definitionObjectCollection = definitionObjectCollection; - _schema = schema; - - _isInitialized = true; - } -} - -/// Accessor for the RequestIdentifier -SmartPtrCRequestIdentifierDoc CCdifDoc::getRequestIdentifier() const { - return _requestIdentifier; -} - -/// Accessor for the DefinitionObjectCollection -SmartPtrCDefinitionObjectCollectionDoc CCdifDoc::getDefinitionObjectCollection() const { - return _definitionObjectCollection; -} - -/// Accessor for the Schema -SmartPtrCSchemaDoc CCdifDoc::getSchema() const { - return _schema; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ProviderResultsDoc/CDefinitionObjectCollectionDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ProviderResultsDoc/CDefinitionObjectCollectionDoc.cpp deleted file mode 100644 index 62c94393b..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ProviderResultsDoc/CDefinitionObjectCollectionDoc.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" -#include "Doc/ProviderResultsDoc/CDefinitionObjectCollectionDoc.h" - -using namespace Caf; - -/// Set of elements containing data returned as a result of a provider collection or action -CDefinitionObjectCollectionDoc::CDefinitionObjectCollectionDoc() : - _isInitialized(false) {} -CDefinitionObjectCollectionDoc::~CDefinitionObjectCollectionDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CDefinitionObjectCollectionDoc::initialize( - const std::deque value) { - if (! _isInitialized) { - _value = value; - - _isInitialized = true; - } -} - -/// Accessor for the Value -std::deque CDefinitionObjectCollectionDoc::getValue() const { - return _value; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ProviderResultsDoc/CRequestIdentifierDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ProviderResultsDoc/CRequestIdentifierDoc.cpp deleted file mode 100644 index 902cea13b..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ProviderResultsDoc/CRequestIdentifierDoc.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/SchemaTypesDoc/CActionClassDoc.h" -#include "Doc/ProviderResultsDoc/CRequestIdentifierDoc.h" - -using namespace Caf; - -/// Fields that allow client to determine which request resulted in this response document -CRequestIdentifierDoc::CRequestIdentifierDoc() : - _clientId(CAFCOMMON_GUID_NULL), - _requestId(CAFCOMMON_GUID_NULL), - _jobId(CAFCOMMON_GUID_NULL), - _sessionId(CAFCOMMON_GUID_NULL), - _isInitialized(false) {} -CRequestIdentifierDoc::~CRequestIdentifierDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CRequestIdentifierDoc::initialize( - const UUID clientId, - const UUID requestId, - const std::string pmeId, - const UUID jobId, - const SmartPtrCActionClassDoc actionClass, - const UUID sessionId) { - if (! _isInitialized) { - _clientId = clientId; - _requestId = requestId; - _pmeId = pmeId; - _jobId = jobId; - _actionClass = actionClass; - _sessionId = sessionId; - - _isInitialized = true; - } -} - -/// Accessor for the ClientId -UUID CRequestIdentifierDoc::getClientId() const { - return _clientId; -} - -/// Accessor for the RequestId -UUID CRequestIdentifierDoc::getRequestId() const { - return _requestId; -} - -/// Accessor for the PmeId -std::string CRequestIdentifierDoc::getPmeId() const { - return _pmeId; -} - -/// Identifier of the specific job within the request -UUID CRequestIdentifierDoc::getJobId() const { - return _jobId; -} - -/// Accessor for the ActionClass -SmartPtrCActionClassDoc CRequestIdentifierDoc::getActionClass() const { - return _actionClass; -} - -/// Client-configurable identifier that is opaque (not used) by the Common Agent Framework -UUID CRequestIdentifierDoc::getSessionId() const { - return _sessionId; -} - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ProviderResultsDoc/CSchemaDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ProviderResultsDoc/CSchemaDoc.cpp deleted file mode 100644 index b8d072831..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ProviderResultsDoc/CSchemaDoc.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/SchemaTypesDoc/CActionClassDoc.h" -#include "Doc/SchemaTypesDoc/CDataClassDoc.h" -#include "Doc/SchemaTypesDoc/CLogicalRelationshipDoc.h" -#include "Doc/SchemaTypesDoc/CPhysicalRelationshipDoc.h" -#include "Doc/ProviderResultsDoc/CSchemaDoc.h" - -using namespace Caf; - -/// Set of elements describing the objects that can be generated by the provider -CSchemaDoc::CSchemaDoc() : - _isInitialized(false) {} -CSchemaDoc::~CSchemaDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CSchemaDoc::initialize( - const std::deque dataClassCollection, - const std::deque actionClassCollection, - const std::deque logicalRelationshipCollection, - const std::deque physicalRelationshipCollection) { - if (! _isInitialized) { - _dataClassCollection = dataClassCollection; - _actionClassCollection = actionClassCollection; - _logicalRelationshipCollection = logicalRelationshipCollection; - _physicalRelationshipCollection = physicalRelationshipCollection; - - _isInitialized = true; - } -} - -/// Accessor for the DataClassCollection -std::deque CSchemaDoc::getDataClassCollection() const { - return _dataClassCollection; -} - -/// Accessor for the ActionClassCollection -std::deque CSchemaDoc::getActionClassCollection() const { - return _actionClassCollection; -} - -/// Accessor for the LogicalRelationshipCollection -std::deque CSchemaDoc::getLogicalRelationshipCollection() const { - return _logicalRelationshipCollection; -} - -/// Accessor for the PhysicalRelationshipCollection -std::deque CSchemaDoc::getPhysicalRelationshipCollection() const { - return _physicalRelationshipCollection; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ProviderResultsDoc/stdafx.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ProviderResultsDoc/stdafx.h deleted file mode 100644 index 9ec8336ad..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ProviderResultsDoc/stdafx.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Author: bwilliams - * Created: February 25, 2016 - * - * Copyright (C) 2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#ifndef STDAFX_H_ -#define STDAFX_H_ - -#ifdef WIN32 - #define PROVIDERRESULTSDOC_LINKAGE __declspec(dllexport) -#else - #define PROVIDERRESULTSDOC_LINKAGE -#endif - -#include - -#endif /* STDAFX_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ResponseDoc/CErrorResponseDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ResponseDoc/CErrorResponseDoc.cpp deleted file mode 100644 index 4d252de5b..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ResponseDoc/CErrorResponseDoc.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/ResponseDoc/CResponseHeaderDoc.h" -#include "Doc/ResponseDoc/CErrorResponseDoc.h" - -using namespace Caf; - -/// A simple container for objects of type ErrorResponse -CErrorResponseDoc::CErrorResponseDoc() : - _clientId(CAFCOMMON_GUID_NULL), - _requestId(CAFCOMMON_GUID_NULL), - _isInitialized(false) {} -CErrorResponseDoc::~CErrorResponseDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CErrorResponseDoc::initialize( - const UUID clientId, - const UUID requestId, - const std::string pmeId, - const SmartPtrCResponseHeaderDoc responseHeader, - const std::string errorMessage) { - if (! _isInitialized) { - _clientId = clientId; - _requestId = requestId; - _pmeId = pmeId; - _responseHeader = responseHeader; - _errorMessage = errorMessage; - - _isInitialized = true; - } -} - -/// Accessor for the ClientId -UUID CErrorResponseDoc::getClientId() const { - return _clientId; -} - -/// Accessor for the RequestId -UUID CErrorResponseDoc::getRequestId() const { - return _requestId; -} - -/// Accessor for the PmeId -std::string CErrorResponseDoc::getPmeId() const { - return _pmeId; -} - -/// Accessor for the Response Header -SmartPtrCResponseHeaderDoc CErrorResponseDoc::getResponseHeader() const { - return _responseHeader; -} - -/// Accessor for the ErrorMessage -std::string CErrorResponseDoc::getErrorMessage() const { - return _errorMessage; -} - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ResponseDoc/CEventKeyCollectionDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ResponseDoc/CEventKeyCollectionDoc.cpp deleted file mode 100644 index 5f277eb7b..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ResponseDoc/CEventKeyCollectionDoc.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/ResponseDoc/CEventKeyDoc.h" -#include "Doc/ResponseDoc/CEventKeyCollectionDoc.h" - -using namespace Caf; - -/// A simple container for objects of type EventKeyCollection -CEventKeyCollectionDoc::CEventKeyCollectionDoc() : - _isInitialized(false) {} -CEventKeyCollectionDoc::~CEventKeyCollectionDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CEventKeyCollectionDoc::initialize( - const std::deque eventKey) { - if (! _isInitialized) { - _eventKey = eventKey; - - _isInitialized = true; - } -} - -/// Accessor for the EventKey -std::deque CEventKeyCollectionDoc::getEventKey() const { - return _eventKey; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ResponseDoc/CEventKeyDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ResponseDoc/CEventKeyDoc.cpp deleted file mode 100644 index 987c71014..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ResponseDoc/CEventKeyDoc.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" -#include "Doc/ResponseDoc/CEventKeyDoc.h" - -using namespace Caf; - -/// A simple container for objects of type EventKey -CEventKeyDoc::CEventKeyDoc() : - _isInitialized(false) {} -CEventKeyDoc::~CEventKeyDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CEventKeyDoc::initialize( - const std::string name, - const std::string value) { - if (! _isInitialized) { - _name = name; - _value = value; - - _isInitialized = true; - } -} - -/// Accessor for the Name -std::string CEventKeyDoc::getName() const { - return _name; -} - -/// Accessor for the Value -std::string CEventKeyDoc::getValue() const { - return _value; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ResponseDoc/CEventManifestDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ResponseDoc/CEventManifestDoc.cpp deleted file mode 100644 index 041bc030f..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ResponseDoc/CEventManifestDoc.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/CafCoreTypesDoc/CAttachmentCollectionDoc.h" -#include "Doc/ResponseDoc/CEventManifestDoc.h" - -using namespace Caf; - -/// A simple container for objects of type EventManifest -CEventManifestDoc::CEventManifestDoc() : - _isInitialized(false) {} -CEventManifestDoc::~CEventManifestDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CEventManifestDoc::initialize( - const std::string classNamespace, - const std::string className, - const std::string classVersion, - const std::string operationName, - const SmartPtrCAttachmentCollectionDoc attachmentCollection) { - if (! _isInitialized) { - _classNamespace = classNamespace; - _className = className; - _classVersion = classVersion; - _operationName = operationName; - _attachmentCollection = attachmentCollection; - - _isInitialized = true; - } -} - -/// Accessor for the ClassNamespace -std::string CEventManifestDoc::getClassNamespace() const { - return _classNamespace; -} - -/// Accessor for the ClassName -std::string CEventManifestDoc::getClassName() const { - return _className; -} - -/// Accessor for the ClassVersion -std::string CEventManifestDoc::getClassVersion() const { - return _classVersion; -} - -/// Accessor for the OperationName -std::string CEventManifestDoc::getOperationName() const { - return _operationName; -} - -/// Accessor for the AttachmentCollection -SmartPtrCAttachmentCollectionDoc CEventManifestDoc::getAttachmentCollection() const { - return _attachmentCollection; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ResponseDoc/CManifestCollectionDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ResponseDoc/CManifestCollectionDoc.cpp deleted file mode 100644 index dc4bda6f7..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ResponseDoc/CManifestCollectionDoc.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/ResponseDoc/CManifestDoc.h" -#include "Doc/ResponseDoc/CManifestCollectionDoc.h" - -using namespace Caf; - -/// A simple container for objects of type ManifestCollection -CManifestCollectionDoc::CManifestCollectionDoc() : - _isInitialized(false) {} -CManifestCollectionDoc::~CManifestCollectionDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CManifestCollectionDoc::initialize( - const std::deque manifest) { - if (! _isInitialized) { - _manifest = manifest; - - _isInitialized = true; - } -} - -/// Accessor for the Manifest -std::deque CManifestCollectionDoc::getManifest() const { - return _manifest; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ResponseDoc/CManifestDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ResponseDoc/CManifestDoc.cpp deleted file mode 100644 index c4f10b22e..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ResponseDoc/CManifestDoc.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/CafCoreTypesDoc/CAttachmentNameCollectionDoc.h" -#include "Doc/ResponseDoc/CManifestDoc.h" - -using namespace Caf; - -/// A simple container for objects of type Manifest -CManifestDoc::CManifestDoc() : - _jobId(CAFCOMMON_GUID_NULL), - _isInitialized(false) {} -CManifestDoc::~CManifestDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CManifestDoc::initialize( - const std::string classNamespace, - const std::string className, - const std::string classVersion, - const UUID jobId, - const std::string operationName, - const SmartPtrCAttachmentNameCollectionDoc attachmentNameCollection) { - if (! _isInitialized) { - _classNamespace = classNamespace; - _className = className; - _classVersion = classVersion; - _jobId = jobId; - _operationName = operationName; - _attachmentNameCollection = attachmentNameCollection; - - _isInitialized = true; - } -} - -/// Accessor for the ClassNamespace -std::string CManifestDoc::getClassNamespace() const { - return _classNamespace; -} - -/// Accessor for the ClassName -std::string CManifestDoc::getClassName() const { - return _className; -} - -/// Accessor for the ClassVersion -std::string CManifestDoc::getClassVersion() const { - return _classVersion; -} - -/// Accessor for the JobId -UUID CManifestDoc::getJobId() const { - return _jobId; -} - -/// Accessor for the OperationName -std::string CManifestDoc::getOperationName() const { - return _operationName; -} - -/// Accessor for the AttachmentNameCollection -SmartPtrCAttachmentNameCollectionDoc CManifestDoc::getAttachmentNameCollection() const { - return _attachmentNameCollection; -} - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ResponseDoc/CProviderEventResponseDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ResponseDoc/CProviderEventResponseDoc.cpp deleted file mode 100644 index cd98b3baf..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ResponseDoc/CProviderEventResponseDoc.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/CafCoreTypesDoc/CStatisticsDoc.h" -#include "Doc/ResponseDoc/CEventKeyCollectionDoc.h" -#include "Doc/ResponseDoc/CEventManifestDoc.h" -#include "Doc/ResponseDoc/CResponseHeaderDoc.h" -#include "Doc/ResponseDoc/CProviderEventResponseDoc.h" - -using namespace Caf; - -/// A simple container for objects of type ProviderEventResponse -CProviderEventResponseDoc::CProviderEventResponseDoc() : - _isInitialized(false) {} -CProviderEventResponseDoc::~CProviderEventResponseDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CProviderEventResponseDoc::initialize( - const std::string pmeId, - const SmartPtrCResponseHeaderDoc responseHeader, - const SmartPtrCEventManifestDoc manifest, - const SmartPtrCEventKeyCollectionDoc eventKeyCollection, - const SmartPtrCStatisticsDoc statistics) { - if (! _isInitialized) { - _pmeId = pmeId; - _responseHeader = responseHeader; - _manifest = manifest; - _eventKeyCollection = eventKeyCollection; - _statistics = statistics; - - _isInitialized = true; - } -} - -/// Accessor for the PmeId -std::string CProviderEventResponseDoc::getPmeId() const { - return _pmeId; -} - -/// Accessor for the ResponseHeader -SmartPtrCResponseHeaderDoc CProviderEventResponseDoc::getResponseHeader() const { - return _responseHeader; -} - -/// Accessor for the Manifest -SmartPtrCEventManifestDoc CProviderEventResponseDoc::getManifest() const { - return _manifest; -} - -/// Accessor for the EventKeyCollection -SmartPtrCEventKeyCollectionDoc CProviderEventResponseDoc::getEventKeyCollection() const { - return _eventKeyCollection; -} - -/// Accessor for the Statistics -SmartPtrCStatisticsDoc CProviderEventResponseDoc::getStatistics() const { - return _statistics; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ResponseDoc/CProviderResponseDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ResponseDoc/CProviderResponseDoc.cpp deleted file mode 100644 index 33e63272c..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ResponseDoc/CProviderResponseDoc.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/CafCoreTypesDoc/CAttachmentCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CStatisticsDoc.h" -#include "Doc/ResponseDoc/CManifestDoc.h" -#include "Doc/ResponseDoc/CResponseHeaderDoc.h" -#include "Doc/ResponseDoc/CProviderResponseDoc.h" - -using namespace Caf; - -/// A simple container for objects of type ProviderResponse -CProviderResponseDoc::CProviderResponseDoc() : - _clientId(CAFCOMMON_GUID_NULL), - _requestId(CAFCOMMON_GUID_NULL), - _isInitialized(false) {} -CProviderResponseDoc::~CProviderResponseDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CProviderResponseDoc::initialize( - const UUID clientId, - const UUID requestId, - const std::string pmeId, - const SmartPtrCResponseHeaderDoc responseHeader, - const SmartPtrCManifestDoc manifest, - const SmartPtrCAttachmentCollectionDoc attachmentCollection, - const SmartPtrCStatisticsDoc statistics) { - if (! _isInitialized) { - _clientId = clientId; - _requestId = requestId; - _pmeId = pmeId; - _responseHeader = responseHeader; - _manifest = manifest; - _attachmentCollection = attachmentCollection; - _statistics = statistics; - - _isInitialized = true; - } -} - -/// Accessor for the ClientId -UUID CProviderResponseDoc::getClientId() const { - return _clientId; -} - -/// Accessor for the RequestId -UUID CProviderResponseDoc::getRequestId() const { - return _requestId; -} - -/// Accessor for the PmeId -std::string CProviderResponseDoc::getPmeId() const { - return _pmeId; -} - -/// Accessor for the ResponseHeader -SmartPtrCResponseHeaderDoc CProviderResponseDoc::getResponseHeader() const { - return _responseHeader; -} - -/// Accessor for the Manifest -SmartPtrCManifestDoc CProviderResponseDoc::getManifest() const { - return _manifest; -} - -/// Accessor for the AttachmentCollection -SmartPtrCAttachmentCollectionDoc CProviderResponseDoc::getAttachmentCollection() const { - return _attachmentCollection; -} - -/// Accessor for the Statistics -SmartPtrCStatisticsDoc CProviderResponseDoc::getStatistics() const { - return _statistics; -} - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ResponseDoc/CResponseDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ResponseDoc/CResponseDoc.cpp deleted file mode 100644 index 6f9d1123e..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ResponseDoc/CResponseDoc.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/CafCoreTypesDoc/CAttachmentCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CStatisticsDoc.h" -#include "Doc/ResponseDoc/CManifestCollectionDoc.h" -#include "Doc/ResponseDoc/CResponseHeaderDoc.h" -#include "Doc/ResponseDoc/CResponseDoc.h" - -using namespace Caf; - -/// A simple container for objects of type Response -CResponseDoc::CResponseDoc() : - _clientId(CAFCOMMON_GUID_NULL), - _requestId(CAFCOMMON_GUID_NULL), - _isInitialized(false) {} -CResponseDoc::~CResponseDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CResponseDoc::initialize( - const UUID clientId, - const UUID requestId, - const std::string pmeId, - const SmartPtrCResponseHeaderDoc responseHeader, - const SmartPtrCManifestCollectionDoc manifestCollection, - const SmartPtrCAttachmentCollectionDoc attachmentCollection, - const SmartPtrCStatisticsDoc statistics) { - if (! _isInitialized) { - _clientId = clientId; - _requestId = requestId; - _pmeId = pmeId; - _responseHeader = responseHeader; - _manifestCollection = manifestCollection; - _attachmentCollection = attachmentCollection; - _statistics = statistics; - - _isInitialized = true; - } -} - -/// Accessor for the ClientId -UUID CResponseDoc::getClientId() const { - return _clientId; -} - -/// Accessor for the RequestId -UUID CResponseDoc::getRequestId() const { - return _requestId; -} - -/// Accessor for the PmeId -std::string CResponseDoc::getPmeId() const { - return _pmeId; -} - -/// Accessor for the ManifestCollection -SmartPtrCResponseHeaderDoc CResponseDoc::getResponseHeader() const { - return _responseHeader; -} - -/// Accessor for the ManifestCollection -SmartPtrCManifestCollectionDoc CResponseDoc::getManifestCollection() const { - return _manifestCollection; -} - -/// Accessor for the AttachmentCollection -SmartPtrCAttachmentCollectionDoc CResponseDoc::getAttachmentCollection() const { - return _attachmentCollection; -} - -/// Accessor for the Statistics -SmartPtrCStatisticsDoc CResponseDoc::getStatistics() const { - return _statistics; -} - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ResponseDoc/CResponseHeaderDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ResponseDoc/CResponseHeaderDoc.cpp deleted file mode 100644 index 0d95bedf1..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ResponseDoc/CResponseHeaderDoc.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" -#include "Doc/ResponseDoc/CResponseHeaderDoc.h" - -using namespace Caf; - -/// A simple container for objects of type ResponseHeader -CResponseHeaderDoc::CResponseHeaderDoc() : - _sequenceNumber(0), - _isFinalResponse(true), - _sessionId(CAFCOMMON_GUID_NULL), - _isInitialized(false) {} -CResponseHeaderDoc::~CResponseHeaderDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CResponseHeaderDoc::initialize( - const std::string version, - const std::string createdDateTime, - const uint32 sequenceNumber, - const bool isFinalResponse, - const UUID sessionId) { - if (! _isInitialized) { - _version = version; - _createdDateTime = createdDateTime; - _sequenceNumber = sequenceNumber; - _isFinalResponse = isFinalResponse; - _sessionId = sessionId; - - _isInitialized = true; - } -} - -/// Accessor for the version -std::string CResponseHeaderDoc::getVersion() const { - return _version; -} - -/// Accessor for the date/time when the request was created -std::string CResponseHeaderDoc::getCreatedDateTime() const { - return _createdDateTime; -} - -/// Accessor for the sequenceNumber -uint32 CResponseHeaderDoc::getSequenceNumber() const { - return _sequenceNumber; -} - -/// Accessor for the version -bool CResponseHeaderDoc::getIsFinalResponse() const { - return _isFinalResponse; -} - -/// Accessor for the session ID -UUID CResponseHeaderDoc::getSessionId() const { - return _sessionId; -} - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ResponseDoc/stdafx.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ResponseDoc/stdafx.h deleted file mode 100644 index 68b8f4ae2..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/ResponseDoc/stdafx.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Author: bwilliams - * Created: February 25, 2016 - * - * Copyright (C) 2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#ifndef STDAFX_H_ -#define STDAFX_H_ - -#ifdef WIN32 - #define RESPONSEDOC_LINKAGE __declspec(dllexport) -#else - #define RESPONSEDOC_LINKAGE -#endif - -#include - -#endif /* STDAFX_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CActionClassDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CActionClassDoc.cpp deleted file mode 100644 index 901620b25..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CActionClassDoc.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/SchemaTypesDoc/CCollectMethodDoc.h" -#include "Doc/SchemaTypesDoc/CMethodDoc.h" -#include "Doc/SchemaTypesDoc/CActionClassDoc.h" - -using namespace Caf; - -/// Definition of an action class that may be generated by the provider -CActionClassDoc::CActionClassDoc() : - _isInitialized(false) {} -CActionClassDoc::~CActionClassDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CActionClassDoc::initialize( - const std::string namespaceVal, - const std::string name, - const std::string version, - const SmartPtrCCollectMethodDoc collectMethod, - const std::deque methodCollection, - const std::string displayName, - const std::string description) { - if (! _isInitialized) { - _namespaceVal = namespaceVal; - _name = name; - _version = version; - _collectMethod = collectMethod; - _methodCollection = methodCollection; - _displayName = displayName; - _description = description; - - _isInitialized = true; - } -} - -/// Accessor for the NamespaceVal -std::string CActionClassDoc::getNamespaceVal() const { - return _namespaceVal; -} - -/// Accessor for the Name -std::string CActionClassDoc::getName() const { - return _name; -} - -/// Accessor for the Version -std::string CActionClassDoc::getVersion() const { - return _version; -} - -/// Accessor for the CollectMethod -SmartPtrCCollectMethodDoc CActionClassDoc::getCollectMethod() const { - return _collectMethod; -} - -/// Accessor for the Method -std::deque CActionClassDoc::getMethodCollection() const { - return _methodCollection; -} - -/// A hint as to what this class should be called when displaying it to a human -std::string CActionClassDoc::getDisplayName() const { - return _displayName; -} - -/// A phrase to describe the class for mouse-over text, etc -std::string CActionClassDoc::getDescription() const { - return _description; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CActionClassInstanceCollectionDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CActionClassInstanceCollectionDoc.cpp deleted file mode 100644 index 28d36bf20..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CActionClassInstanceCollectionDoc.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/SchemaTypesDoc/CActionClassInstanceDoc.h" -#include "Doc/SchemaTypesDoc/CActionClassInstanceCollectionDoc.h" - -using namespace Caf; - -/// A simple container for objects of type ActionClassInstanceCollection -CActionClassInstanceCollectionDoc::CActionClassInstanceCollectionDoc() : - _isInitialized(false) {} -CActionClassInstanceCollectionDoc::~CActionClassInstanceCollectionDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CActionClassInstanceCollectionDoc::initialize( - const std::deque actionClassInstanceCollection) { - if (! _isInitialized) { - _actionClassInstanceCollection = actionClassInstanceCollection; - - _isInitialized = true; - } -} - -/// Accessor for the ActionClassInstance -std::deque CActionClassInstanceCollectionDoc::getActionClassInstanceCollection() const { - return _actionClassInstanceCollection; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CActionClassInstanceDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CActionClassInstanceDoc.cpp deleted file mode 100644 index 561aaf288..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CActionClassInstanceDoc.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/SchemaTypesDoc/CInstanceOperationCollectionDoc.h" -#include "Doc/SchemaTypesDoc/CActionClassInstanceDoc.h" - -using namespace Caf; - -/// A simple container for objects of type ActionClassInstance -CActionClassInstanceDoc::CActionClassInstanceDoc() : - _isInitialized(false) {} -CActionClassInstanceDoc::~CActionClassInstanceDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CActionClassInstanceDoc::initialize( - const std::string namespaceVal, - const std::string name, - const std::string version, - const SmartPtrCInstanceOperationCollectionDoc instanceOperationCollection) { - if (! _isInitialized) { - _namespaceVal = namespaceVal; - _name = name; - _version = version; - _instanceOperationCollection = instanceOperationCollection; - - _isInitialized = true; - } -} - -/// Accessor for the NamespaceVal -std::string CActionClassInstanceDoc::getNamespaceVal() const { - return _namespaceVal; -} - -/// Accessor for the Name -std::string CActionClassInstanceDoc::getName() const { - return _name; -} - -/// Accessor for the Version -std::string CActionClassInstanceDoc::getVersion() const { - return _version; -} - -/// Accessor for the InstanceOperationCollection -SmartPtrCInstanceOperationCollectionDoc CActionClassInstanceDoc::getInstanceOperationCollection() const { - return _instanceOperationCollection; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CClassCardinalityDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CClassCardinalityDoc.cpp deleted file mode 100644 index f50d023ae..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CClassCardinalityDoc.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" -#include "Doc/SchemaTypesDoc/CClassCardinalityDoc.h" - -using namespace Caf; - -/// Class description of one end of a relationship -CClassCardinalityDoc::CClassCardinalityDoc() : - _isInitialized(false) {} -CClassCardinalityDoc::~CClassCardinalityDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CClassCardinalityDoc::initialize( - const std::string namespaceVal, - const std::string name, - const std::string version, - const std::string cardinality) { - if (! _isInitialized) { - _namespaceVal = namespaceVal; - _name = name; - _version = version; - _cardinality = cardinality; - - _isInitialized = true; - } -} - -/// Accessor for the NamespaceVal -std::string CClassCardinalityDoc::getNamespaceVal() const { - return _namespaceVal; -} - -/// Accessor for the Name -std::string CClassCardinalityDoc::getName() const { - return _name; -} - -/// Accessor for the Version -std::string CClassCardinalityDoc::getVersion() const { - return _version; -} - -/// Cardinality of one end relationship, i.e. has one, has many, etc -std::string CClassCardinalityDoc::getCardinality() const { - return _cardinality; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CClassFieldDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CClassFieldDoc.cpp deleted file mode 100644 index 5a409ffaa..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CClassFieldDoc.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" -#include "Doc/SchemaTypesDoc/CClassFieldDoc.h" - -using namespace Caf; - -/// Description of a class and the field used to identify one end of a relationship -CClassFieldDoc::CClassFieldDoc() : - _isInitialized(false) {} -CClassFieldDoc::~CClassFieldDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CClassFieldDoc::initialize( - const std::string namespaceVal, - const std::string name, - const std::string version, - const std::string field) { - if (! _isInitialized) { - _namespaceVal = namespaceVal; - _name = name; - _version = version; - _field = field; - - _isInitialized = true; - } -} - -/// Accessor for the NamespaceVal -std::string CClassFieldDoc::getNamespaceVal() const { - return _namespaceVal; -} - -/// Accessor for the Name -std::string CClassFieldDoc::getName() const { - return _name; -} - -/// Accessor for the Version -std::string CClassFieldDoc::getVersion() const { - return _version; -} - -/// Description of a class field used to identify one end of a relationship -std::string CClassFieldDoc::getField() const { - return _field; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CClassIdentifierDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CClassIdentifierDoc.cpp deleted file mode 100644 index 7cf4de4e1..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CClassIdentifierDoc.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" -#include "Doc/SchemaTypesDoc/CClassIdentifierDoc.h" - -using namespace Caf; - -/// Tuple of values to uniquely identify a class -CClassIdentifierDoc::CClassIdentifierDoc() : - _isInitialized(false) {} -CClassIdentifierDoc::~CClassIdentifierDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CClassIdentifierDoc::initialize( - const std::string namespaceVal, - const std::string name, - const std::string version) { - if (! _isInitialized) { - _namespaceVal = namespaceVal; - _name = name; - _version = version; - - _isInitialized = true; - } -} - -/// Accessor for the NamespaceVal -std::string CClassIdentifierDoc::getNamespaceVal() const { - return _namespaceVal; -} - -/// Accessor for the Name -std::string CClassIdentifierDoc::getName() const { - return _name; -} - -/// Accessor for the Version -std::string CClassIdentifierDoc::getVersion() const { - return _version; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CClassInstancePropertyDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CClassInstancePropertyDoc.cpp deleted file mode 100644 index 60e8a98e0..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CClassInstancePropertyDoc.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/SchemaTypesDoc/CClassIdentifierDoc.h" -#include "Doc/SchemaTypesDoc/CClassInstancePropertyDoc.h" - -using namespace Caf; - -/// Definition of an attribute (field) of a class -CClassInstancePropertyDoc::CClassInstancePropertyDoc() : - _required(false), - _transientVal(false), - _list(false), - _isInitialized(false) {} -CClassInstancePropertyDoc::~CClassInstancePropertyDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CClassInstancePropertyDoc::initialize( - const std::string name, - const std::deque type, - const bool required, - const bool transientVal, - const bool list, - const std::string displayName, - const std::string description) { - if (! _isInitialized) { - _name = name; - _type = type; - _required = required; - _transientVal = transientVal; - _list = list; - _displayName = displayName; - _description = description; - - _isInitialized = true; - } -} - -/// Property name -std::string CClassInstancePropertyDoc::getName() const { - return _name; -} - -/// Accessor for the Type -std::deque CClassInstancePropertyDoc::getType() const { - return _type; -} - -/// Whether this is a required property, i.e. this property must always be non-empty -bool CClassInstancePropertyDoc::getRequired() const { - return _required; -} - -/// Accessor for the TransientVal -bool CClassInstancePropertyDoc::getTransientVal() const { - return _transientVal; -} - -/// Indicates whether to expect a list of properties in the provider response -bool CClassInstancePropertyDoc::getList() const { - return _list; -} - -/// A hint as to what this property should be called when displaying it to a human -std::string CClassInstancePropertyDoc::getDisplayName() const { - return _displayName; -} - -/// A phrase to describe the property for mouse-over text, etc -std::string CClassInstancePropertyDoc::getDescription() const { - return _description; -} - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CClassPropertyDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CClassPropertyDoc.cpp deleted file mode 100644 index 0ef813074..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CClassPropertyDoc.cpp +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" -#include "Doc/SchemaTypesDoc/SchemaTypesDocTypes.h" -#include "Doc/CafCoreTypesDoc/CafCoreTypesDocTypes.h" -#include "Doc/SchemaTypesDoc/CClassPropertyDoc.h" - -using namespace Caf; - -/// Definition of an attribute (field) of a class -CClassPropertyDoc::CClassPropertyDoc() : - _type(PROPERTY_NONE), - _required(false), - _key(false), - _list(false), - _caseSensitive(false), - _transientVal(false), - _validator(VALIDATOR_NONE), - _isInitialized(false) {} -CClassPropertyDoc::~CClassPropertyDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CClassPropertyDoc::initialize( - const std::string name, - const PROPERTY_TYPE type, - const std::deque value, - const bool required, - const bool key, - const bool list, - const bool caseSensitive, - const bool transientVal, - const std::string defaultVal, - const VALIDATOR_TYPE validator, - const std::string upperRange, - const std::string lowerRange, - const std::string displayName, - const std::string description) { - if (! _isInitialized) { - _name = name; - _type = type; - _value = value; - _required = required; - _key = key; - _list = list; - _caseSensitive = caseSensitive; - _transientVal = transientVal; - _defaultVal = defaultVal; - _validator = validator; - _upperRange = upperRange; - _lowerRange = lowerRange; - _displayName = displayName; - _description = description; - - _isInitialized = true; - } -} - -/// Property name -std::string CClassPropertyDoc::getName() const { - return _name; -} - -/// Describes the data type of the property -PROPERTY_TYPE CClassPropertyDoc::getType() const { - return _type; -} - -/// The contents of a validator used on this property -std::deque CClassPropertyDoc::getValue() const { - return _value; -} - -/// Whether this is a required property, i.e. this property must always be non-empty -bool CClassPropertyDoc::getRequired() const { - return _required; -} - -/// Indicates this property may be used as a key identifying field -bool CClassPropertyDoc::getKey() const { - return _key; -} - -/// Indicates whether to expect a list of properties in the provider response -bool CClassPropertyDoc::getList() const { - return _list; -} - -/// Indicates whether a string field should be treated in a case-sensitive manner -bool CClassPropertyDoc::getCaseSensitive() const { - return _caseSensitive; -} - -/// Accessor for the TransientVal -bool CClassPropertyDoc::getTransientVal() const { - return _transientVal; -} - -/// Accessor for the DefaultVal -std::string CClassPropertyDoc::getDefaultVal() const { - return _defaultVal; -} - -/// The type of validator described in the 'value' sub-elements -VALIDATOR_TYPE CClassPropertyDoc::getValidator() const { - return _validator; -} - -/// If a 'range' validator is in use, this describes the upper limit of allowable values for the property. QUESTIONABLE: how do we determine inclusive or exclusive range -std::string CClassPropertyDoc::getUpperRange() const { - return _upperRange; -} - -/// If a 'range' validator is in use, this describes the lower limit of allowable values for the property. QUESTIONABLE: how do we determine inclusive or exclusive range -std::string CClassPropertyDoc::getLowerRange() const { - return _lowerRange; -} - -/// A hint as to what this property should be called when displaying it to a human -std::string CClassPropertyDoc::getDisplayName() const { - return _displayName; -} - -/// A phrase to describe the property for mouse-over text, etc -std::string CClassPropertyDoc::getDescription() const { - return _description; -} - -VALIDATOR_TYPE _validator; - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CCmdlMetadataDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CCmdlMetadataDoc.cpp deleted file mode 100644 index a819c2c4e..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CCmdlMetadataDoc.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" -#include "Doc/SchemaTypesDoc/CCmdlMetadataDoc.h" - -using namespace Caf; - -/// A simple container for objects of type CmdlMetadata -CCmdlMetadataDoc::CCmdlMetadataDoc() : - _isInitialized(false) {} -CCmdlMetadataDoc::~CCmdlMetadataDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CCmdlMetadataDoc::initialize( - const std::string name, - const std::string value) { - if (! _isInitialized) { - _name = name; - _value = value; - - _isInitialized = true; - } -} - -/// Accessor for the Name -std::string CCmdlMetadataDoc::getName() const { - return _name; -} - -/// Accessor for the Value -std::string CCmdlMetadataDoc::getValue() const { - return _value; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CCmdlUnionDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CCmdlUnionDoc.cpp deleted file mode 100644 index 2ff303329..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CCmdlUnionDoc.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" -#include "Doc/SchemaTypesDoc/CCmdlUnionDoc.h" - -using namespace Caf; - -/// A simple container for objects of type CmdlUnion -CCmdlUnionDoc::CCmdlUnionDoc() : - _isInitialized(false) {} -CCmdlUnionDoc::~CCmdlUnionDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CCmdlUnionDoc::initialize( - const std::string namespaceVal, - const std::string name, - const std::string version) { - if (! _isInitialized) { - _namespaceVal = namespaceVal; - _name = name; - _version = version; - - _isInitialized = true; - } -} - -/// Accessor for the NamespaceVal -std::string CCmdlUnionDoc::getNamespaceVal() const { - return _namespaceVal; -} - -/// Accessor for the Name -std::string CCmdlUnionDoc::getName() const { - return _name; -} - -/// Accessor for the Version -std::string CCmdlUnionDoc::getVersion() const { - return _version; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CCollectMethodDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CCollectMethodDoc.cpp deleted file mode 100644 index 8b18a338f..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CCollectMethodDoc.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/SchemaTypesDoc/CClassIdentifierDoc.h" -#include "Doc/SchemaTypesDoc/CInstanceParameterDoc.h" -#include "Doc/SchemaTypesDoc/CMethodParameterDoc.h" -#include "Doc/SchemaTypesDoc/CCollectMethodDoc.h" - -using namespace Caf; - -/// Definition of a collection method on a class -CCollectMethodDoc::CCollectMethodDoc() : - _isInitialized(false) {} -CCollectMethodDoc::~CCollectMethodDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CCollectMethodDoc::initialize( - const std::string name, - const std::deque parameterCollection, - const std::deque instanceParameterCollection, - const std::deque returnValCollection, - const std::deque eventValCollection, - const std::deque errorCollection) { - if (! _isInitialized) { - _name = name; - _parameterCollection = parameterCollection; - _instanceParameterCollection = instanceParameterCollection; - _returnValCollection = returnValCollection; - _eventValCollection = eventValCollection; - _errorCollection = errorCollection; - - _isInitialized = true; - } -} - -/// name of the collection method -std::string CCollectMethodDoc::getName() const { - return _name; -} - -/// Definition of a parameter that passes simple types to the collection method -std::deque CCollectMethodDoc::getParameterCollection() const { - return _parameterCollection; -} - -/// Definition of a parameter passing data class instances to the collection method -std::deque CCollectMethodDoc::getInstanceParameterCollection() const { - return _instanceParameterCollection; -} - -/// Accessor for the ReturnVal -std::deque CCollectMethodDoc::getReturnValCollection() const { - return _returnValCollection; -} - -/// Accessor for the EventVal -std::deque CCollectMethodDoc::getEventValCollection() const { - return _eventValCollection; -} - -/// A class that may be returned to indicate an error occurred during the processing of the collection method -std::deque CCollectMethodDoc::getErrorCollection() const { - return _errorCollection; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CDataClassDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CDataClassDoc.cpp deleted file mode 100644 index a7a803d9d..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CDataClassDoc.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/SchemaTypesDoc/CClassInstancePropertyDoc.h" -#include "Doc/SchemaTypesDoc/CClassPropertyDoc.h" -#include "Doc/SchemaTypesDoc/CDataClassDoc.h" - -using namespace Caf; - -/// Definition of a data class that may be generated by the provider -CDataClassDoc::CDataClassDoc() : - _unique(false), - _transientVal(false), - _isInitialized(false) {} -CDataClassDoc::~CDataClassDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CDataClassDoc::initialize( - const std::string namespaceVal, - const std::string name, - const std::string version, - const std::deque propertyCollection, - const std::deque instancePropertyCollection, - const bool unique, - const bool transientVal, - const std::string displayName, - const std::string description) { - if (! _isInitialized) { - _namespaceVal = namespaceVal; - _name = name; - _version = version; - _propertyCollection = propertyCollection; - _instancePropertyCollection = instancePropertyCollection; - _unique = unique; - _transientVal = transientVal; - _displayName = displayName; - _description = description; - - _isInitialized = true; - } -} - -/// Accessor for the NamespaceVal -std::string CDataClassDoc::getNamespaceVal() const { - return _namespaceVal; -} - -/// Accessor for the Name -std::string CDataClassDoc::getName() const { - return _name; -} - -/// Accessor for the Version -std::string CDataClassDoc::getVersion() const { - return _version; -} - -/// Accessor for the Property -std::deque CDataClassDoc::getPropertyCollection() const { - return _propertyCollection; -} - -/// Accessor for the InstanceProperty -std::deque CDataClassDoc::getInstancePropertyCollection() const { - return _instancePropertyCollection; -} - -/// Indicates whether the key properties of this class are enough to guarantee uniqueness from other classes of the same type -bool CDataClassDoc::getUnique() const { - return _unique; -} - -/// Accessor for the TransientVal -bool CDataClassDoc::getTransientVal() const { - return _transientVal; -} - -/// A hint as to what this class should be called when displaying it to a human -std::string CDataClassDoc::getDisplayName() const { - return _displayName; -} - -/// A phrase to describe the class for mouse-over text, etc -std::string CDataClassDoc::getDescription() const { - return _description; -} - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CDataClassInstanceCollectionDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CDataClassInstanceCollectionDoc.cpp deleted file mode 100644 index cf287c846..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CDataClassInstanceCollectionDoc.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/SchemaTypesDoc/CDataClassInstanceDoc.h" -#include "Doc/SchemaTypesDoc/CDataClassInstanceCollectionDoc.h" - -using namespace Caf; - -/// A simple container for objects of type DataClassInstanceCollection -CDataClassInstanceCollectionDoc::CDataClassInstanceCollectionDoc() : - _isInitialized(false) {} -CDataClassInstanceCollectionDoc::~CDataClassInstanceCollectionDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CDataClassInstanceCollectionDoc::initialize( - const std::deque dataClassInstanceCollection) { - if (! _isInitialized) { - _dataClassInstanceCollection = dataClassInstanceCollection; - - _isInitialized = true; - } -} - -/// Accessor for the DataClassInstance -std::deque CDataClassInstanceCollectionDoc::getDataClassInstanceCollection() const { - return _dataClassInstanceCollection; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CDataClassInstanceDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CDataClassInstanceDoc.cpp deleted file mode 100644 index 3a127c8c3..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CDataClassInstanceDoc.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/SchemaTypesDoc/CCmdlMetadataDoc.h" -#include "Doc/SchemaTypesDoc/CCmdlUnionDoc.h" -#include "Doc/SchemaTypesDoc/CDataClassPropertyDoc.h" -#include "Doc/SchemaTypesDoc/CDataClassSubInstanceDoc.h" -#include "Doc/SchemaTypesDoc/CDataClassInstanceDoc.h" - -using namespace Caf; - -/// A simple container for objects of type DataClassInstance -CDataClassInstanceDoc::CDataClassInstanceDoc() : - _isInitialized(false) {} -CDataClassInstanceDoc::~CDataClassInstanceDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CDataClassInstanceDoc::initialize( - const std::string namespaceVal, - const std::string name, - const std::string version, - const std::deque cmdlMetadataCollection, - const std::deque propertyCollection, - const std::deque instancePropertyCollection, - const SmartPtrCCmdlUnionDoc cmdlUnion) { - if (! _isInitialized) { - _namespaceVal = namespaceVal; - _name = name; - _version = version; - _cmdlMetadataCollection = cmdlMetadataCollection; - _propertyCollection = propertyCollection; - _instancePropertyCollection = instancePropertyCollection; - _cmdlUnion = cmdlUnion; - - _isInitialized = true; - } -} - -/// Accessor for the NamespaceVal -std::string CDataClassInstanceDoc::getNamespaceVal() const { - return _namespaceVal; -} - -/// Accessor for the Name -std::string CDataClassInstanceDoc::getName() const { - return _name; -} - -/// Accessor for the Version -std::string CDataClassInstanceDoc::getVersion() const { - return _version; -} - -/// Accessor for the CmdlMetadata -std::deque CDataClassInstanceDoc::getCmdlMetadataCollection() const { - return _cmdlMetadataCollection; -} - -/// Accessor for the Property -std::deque CDataClassInstanceDoc::getPropertyCollection() const { - return _propertyCollection; -} - -/// Accessor for the InstanceProperty -std::deque CDataClassInstanceDoc::getInstancePropertyCollection() const { - return _instancePropertyCollection; -} - -/// Accessor for the CmdlUnion -SmartPtrCCmdlUnionDoc CDataClassInstanceDoc::getCmdlUnion() const { - return _cmdlUnion; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CDataClassPropertyDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CDataClassPropertyDoc.cpp deleted file mode 100644 index bb31826b9..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CDataClassPropertyDoc.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/SchemaTypesDoc/CCmdlMetadataDoc.h" -#include "Doc/SchemaTypesDoc/CDataClassPropertyDoc.h" - -using namespace Caf; - -/// A simple container for objects of type DataClassProperty -CDataClassPropertyDoc::CDataClassPropertyDoc() : - _isInitialized(false) {} -CDataClassPropertyDoc::~CDataClassPropertyDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CDataClassPropertyDoc::initialize( - const std::string name, - const std::deque cmdlMetadata, - const std::string value) { - if (! _isInitialized) { - _name = name; - _cmdlMetadata = cmdlMetadata; - _value = value; - - _isInitialized = true; - } -} - -/// Accessor for the Name -std::string CDataClassPropertyDoc::getName() const { - return _name; -} - -/// Accessor for the CmdlMetadata -std::deque CDataClassPropertyDoc::getCmdlMetadata() const { - return _cmdlMetadata; -} - -/// Accessor for the Value -std::string CDataClassPropertyDoc::getValue() const { - return _value; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CDataClassSubInstanceDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CDataClassSubInstanceDoc.cpp deleted file mode 100644 index b772a6cba..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CDataClassSubInstanceDoc.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/SchemaTypesDoc/CCmdlMetadataDoc.h" -#include "Doc/SchemaTypesDoc/CCmdlUnionDoc.h" -#include "Doc/SchemaTypesDoc/CDataClassPropertyDoc.h" -#include "Doc/SchemaTypesDoc/CDataClassSubInstanceDoc.h" - -using namespace Caf; - -/// A simple container for objects of type DataClassSubInstance -CDataClassSubInstanceDoc::CDataClassSubInstanceDoc() : - _isInitialized(false) {} -CDataClassSubInstanceDoc::~CDataClassSubInstanceDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CDataClassSubInstanceDoc::initialize( - const std::string name, - const std::deque cmdlMetadataCollection, - const std::deque propertyCollection, - const std::deque instancePropertyCollection, - const SmartPtrCCmdlUnionDoc cmdlUnion) { - if (! _isInitialized) { - _name = name; - _cmdlMetadataCollection = cmdlMetadataCollection; - _propertyCollection = propertyCollection; - _instancePropertyCollection = instancePropertyCollection; - _cmdlUnion = cmdlUnion; - - _isInitialized = true; - } -} - -/// Accessor for the Name -std::string CDataClassSubInstanceDoc::getName() const { - return _name; -} - -/// Accessor for the CmdlMetadata -std::deque CDataClassSubInstanceDoc::getCmdlMetadataCollection() const { - return _cmdlMetadataCollection; -} - -/// Accessor for the Property -std::deque CDataClassSubInstanceDoc::getPropertyCollection() const { - return _propertyCollection; -} - -/// Accessor for the InstanceProperty -std::deque CDataClassSubInstanceDoc::getInstancePropertyCollection() const { - return _instancePropertyCollection; -} - -/// Accessor for the CmdlUnion -SmartPtrCCmdlUnionDoc CDataClassSubInstanceDoc::getCmdlUnion() const { - return _cmdlUnion; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CInstanceOperationCollectionDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CInstanceOperationCollectionDoc.cpp deleted file mode 100644 index ca953e6d7..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CInstanceOperationCollectionDoc.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/SchemaTypesDoc/CInstanceOperationDoc.h" -#include "Doc/SchemaTypesDoc/CInstanceOperationCollectionDoc.h" - -using namespace Caf; - -/// A simple container for objects of type InstanceOperationCollection -CInstanceOperationCollectionDoc::CInstanceOperationCollectionDoc() : - _isInitialized(false) {} -CInstanceOperationCollectionDoc::~CInstanceOperationCollectionDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CInstanceOperationCollectionDoc::initialize( - const std::deque instanceOperationCollection) { - if (! _isInitialized) { - _instanceOperationCollection = instanceOperationCollection; - - _isInitialized = true; - } -} - -/// Accessor for the InstanceOperation -std::deque CInstanceOperationCollectionDoc::getInstanceOperationCollection() const { - return _instanceOperationCollection; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CInstanceOperationDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CInstanceOperationDoc.cpp deleted file mode 100644 index 0b7a6802f..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CInstanceOperationDoc.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" -#include "Doc/SchemaTypesDoc/CInstanceOperationDoc.h" - -using namespace Caf; - -/// A simple container for objects of type InstanceOperation -CInstanceOperationDoc::CInstanceOperationDoc() : - _isInitialized(false) {} -CInstanceOperationDoc::~CInstanceOperationDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CInstanceOperationDoc::initialize( - const std::string operationName, - const std::string moniker) { - if (! _isInitialized) { - _operationName = operationName; - _moniker = moniker; - - _isInitialized = true; - } -} - -/// Accessor for the OperationName -std::string CInstanceOperationDoc::getOperationName() const { - return _operationName; -} - -/// Accessor for the Moniker -std::string CInstanceOperationDoc::getMoniker() const { - return _moniker; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CInstanceParameterDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CInstanceParameterDoc.cpp deleted file mode 100644 index 636431fd1..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CInstanceParameterDoc.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" -#include "Doc/SchemaTypesDoc/CInstanceParameterDoc.h" - -using namespace Caf; - -/// A parameter containing a data class instance used by a method to control the outcome -CInstanceParameterDoc::CInstanceParameterDoc() : - _isOptional(false), - _isList(false), - _isInitialized(false) {} -CInstanceParameterDoc::~CInstanceParameterDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CInstanceParameterDoc::initialize( - const std::string name, - const std::string instanceNamespace, - const std::string instanceName, - const std::string instanceVersion, - const bool isOptional, - const bool isList, - const std::string displayName, - const std::string description) { - if (! _isInitialized) { - _name = name; - _instanceNamespace = instanceNamespace; - _instanceName = instanceName; - _instanceVersion = instanceVersion; - _isOptional = isOptional; - _isList = isList; - _displayName = displayName; - _description = description; - - _isInitialized = true; - } -} - -/// Name of parameter -std::string CInstanceParameterDoc::getName() const { - return _name; -} - -/// Namespace of instance object type -std::string CInstanceParameterDoc::getInstanceNamespace() const { - return _instanceNamespace; -} - -/// Name of instance object type -std::string CInstanceParameterDoc::getInstanceName() const { - return _instanceName; -} - -/// Version of instance object type -std::string CInstanceParameterDoc::getInstanceVersion() const { - return _instanceVersion; -} - -/// Indicates this parameter need not be passed -bool CInstanceParameterDoc::getIsOptional() const { - return _isOptional; -} - -/// Indicates whether to expect a list of values as opposed to a single value (the default if this attribute is not present) -bool CInstanceParameterDoc::getIsList() const { - return _isList; -} - -/// Human-readable version of the parameter name -std::string CInstanceParameterDoc::getDisplayName() const { - return _displayName; -} - -/// Short description of what the parameter is for -std::string CInstanceParameterDoc::getDescription() const { - return _description; -} - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CJoinTypeDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CJoinTypeDoc.cpp deleted file mode 100644 index 94f9d68e8..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CJoinTypeDoc.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" -#include "Doc/SchemaTypesDoc/SchemaTypesDocTypes.h" - -#include "Doc/SchemaTypesDoc/CClassFieldDoc.h" -#include "Doc/SchemaTypesDoc/CJoinTypeDoc.h" - -using namespace Caf; - -/// A simple container for objects of type JoinType -CJoinTypeDoc::CJoinTypeDoc() : - _operand(OPERATOR_NONE), - _isInitialized(false) {} -CJoinTypeDoc::~CJoinTypeDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CJoinTypeDoc::initialize( - const OPERATOR_TYPE operand, - const SmartPtrCClassFieldDoc dataClassLeft, - const SmartPtrCClassFieldDoc dataClassRight, - const std::string description) { - if (! _isInitialized) { - _operand = operand; - _dataClassLeft = dataClassLeft; - _dataClassRight = dataClassRight; - _description = description; - - _isInitialized = true; - } -} - -/// Defines the operand used to join the class fields. Restricted to '=' for now -OPERATOR_TYPE CJoinTypeDoc::getOperand() const { - return _operand; -} - -/// Identifies the fields on classes that uniquely identify relationship -SmartPtrCClassFieldDoc CJoinTypeDoc::getDataClassLeft() const { - return _dataClassLeft; -} - -/// Identifies the fields on classes that uniquely identify relationship -SmartPtrCClassFieldDoc CJoinTypeDoc::getDataClassRight() const { - return _dataClassRight; -} - -/// A short human-readable description of the join -std::string CJoinTypeDoc::getDescription() const { - return _description; -} - -OPERATOR_TYPE _operand; - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CLogicalRelationshipDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CLogicalRelationshipDoc.cpp deleted file mode 100644 index bf2c5c8f7..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CLogicalRelationshipDoc.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" -#include "Doc/SchemaTypesDoc/SchemaTypesDocTypes.h" - -#include "Doc/SchemaTypesDoc/CClassCardinalityDoc.h" -#include "Doc/SchemaTypesDoc/CJoinTypeDoc.h" -#include "Doc/SchemaTypesDoc/CLogicalRelationshipDoc.h" - -using namespace Caf; - -/// Definition of a relationship between classes that can be described by identifying the fields on the classes that uniquely identify the relationship -CLogicalRelationshipDoc::CLogicalRelationshipDoc() : - _arity(ARITY_NONE), - _isInitialized(false) {} -CLogicalRelationshipDoc::~CLogicalRelationshipDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CLogicalRelationshipDoc::initialize( - const std::string namespaceVal, - const std::string name, - const std::string version, - const ARITY_TYPE arity, - const SmartPtrCClassCardinalityDoc dataClassLeft, - const SmartPtrCClassCardinalityDoc dataClassRight, - const std::deque joinCollection, - const std::string description) { - if (! _isInitialized) { - _namespaceVal = namespaceVal; - _name = name; - _version = version; - _arity = arity; - _dataClassLeft = dataClassLeft; - _dataClassRight = dataClassRight; - _joinCollection = joinCollection; - _description = description; - - _isInitialized = true; - } -} - -/// Accessor for the NamespaceVal -std::string CLogicalRelationshipDoc::getNamespaceVal() const { - return _namespaceVal; -} - -/// Accessor for the Name -std::string CLogicalRelationshipDoc::getName() const { - return _name; -} - -/// Accessor for the Version -std::string CLogicalRelationshipDoc::getVersion() const { - return _version; -} - -/// Accessor for the Arity -ARITY_TYPE CLogicalRelationshipDoc::getArity() const { - return _arity; -} - -/// Accessor for the DataClassLeft -SmartPtrCClassCardinalityDoc CLogicalRelationshipDoc::getDataClassLeft() const { - return _dataClassLeft; -} - -/// Accessor for the DataClassRight -SmartPtrCClassCardinalityDoc CLogicalRelationshipDoc::getDataClassRight() const { - return _dataClassRight; -} - -/// Defines a join condition of the relationship -std::deque CLogicalRelationshipDoc::getJoinCollection() const { - return _joinCollection; -} - -/// Accessor for the Description -std::string CLogicalRelationshipDoc::getDescription() const { - return _description; -} - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CMethodDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CMethodDoc.cpp deleted file mode 100644 index cda0122b7..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CMethodDoc.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" - -#include "Doc/SchemaTypesDoc/CClassIdentifierDoc.h" -#include "Doc/SchemaTypesDoc/CInstanceParameterDoc.h" -#include "Doc/SchemaTypesDoc/CMethodParameterDoc.h" -#include "Doc/SchemaTypesDoc/CMethodDoc.h" - -using namespace Caf; - -/// Definition of a method on a class -CMethodDoc::CMethodDoc() : - _isInitialized(false) {} -CMethodDoc::~CMethodDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CMethodDoc::initialize( - const std::string name, - const std::deque parameterCollection, - const std::deque instanceParameterCollection, - const std::deque returnValCollection, - const std::deque eventValCollection, - const std::deque errorCollection, - const std::string displayName, - const std::string description) { - if (! _isInitialized) { - _name = name; - _parameterCollection = parameterCollection; - _instanceParameterCollection = instanceParameterCollection; - _returnValCollection = returnValCollection; - _eventValCollection = eventValCollection; - _errorCollection = errorCollection; - _displayName = displayName; - _description = description; - - _isInitialized = true; - } -} - -/// name of the method -std::string CMethodDoc::getName() const { - return _name; -} - -/// Definition of a parameter that passes simple types to the method -std::deque CMethodDoc::getParameterCollection() const { - return _parameterCollection; -} - -/// Definition of a parameter that passes data class instances to the method -std::deque CMethodDoc::getInstanceParameterCollection() const { - return _instanceParameterCollection; -} - -/// Accessor for the ReturnVal -std::deque CMethodDoc::getReturnValCollection() const { - return _returnValCollection; -} - -/// Accessor for the EventVal -std::deque CMethodDoc::getEventValCollection() const { - return _eventValCollection; -} - -/// A class that may be returned to indicate an error occurred during the processing of the collection method -std::deque CMethodDoc::getErrorCollection() const { - return _errorCollection; -} - -/// Human-readable version of the method name -std::string CMethodDoc::getDisplayName() const { - return _displayName; -} - -/// A short phrase describing the purpose of the method -std::string CMethodDoc::getDescription() const { - return _description; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CMethodParameterDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CMethodParameterDoc.cpp deleted file mode 100644 index 3d71d7d7f..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CMethodParameterDoc.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" -#include "Doc/CafCoreTypesDoc/CafCoreTypesDocTypes.h" -#include "Doc/SchemaTypesDoc/CMethodParameterDoc.h" - -using namespace Caf; - -/// A parameter containing a simple type used by a method to control the outcome -CMethodParameterDoc::CMethodParameterDoc() : - _type(PARAMETER_NONE), - _isOptional(false), - _isList(false), - _isInitialized(false) {} -CMethodParameterDoc::~CMethodParameterDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CMethodParameterDoc::initialize( - const std::string name, - const PARAMETER_TYPE type, - const bool isOptional, - const bool isList, - const std::string defaultVal, - const std::string displayName, - const std::string description) { - if (! _isInitialized) { - _name = name; - _type = type; - _isOptional = isOptional; - _isList = isList; - _defaultVal = defaultVal; - _displayName = displayName; - _description = description; - - _isInitialized = true; - } -} - -/// Name of parameter -std::string CMethodParameterDoc::getName() const { - return _name; -} - -/// Describes the data type of the property -PARAMETER_TYPE CMethodParameterDoc::getType() const { - return _type; -} - -/// Indicates this parameter need not be passed -bool CMethodParameterDoc::getIsOptional() const { - return _isOptional; -} - -/// Indicates whether to expect a list of values as opposed to a single value (the default if this attribute is not present) -bool CMethodParameterDoc::getIsList() const { - return _isList; -} - -/// Accessor for the DefaultVal -std::string CMethodParameterDoc::getDefaultVal() const { - return _defaultVal; -} - -/// Human-readable version of the parameter name -std::string CMethodParameterDoc::getDisplayName() const { - return _displayName; -} - -/// Short description of what the parameter is for -std::string CMethodParameterDoc::getDescription() const { - return _description; -} - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CPhysicalRelationshipDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CPhysicalRelationshipDoc.cpp deleted file mode 100644 index 9ad570ea2..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CPhysicalRelationshipDoc.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" -#include "Doc/SchemaTypesDoc/SchemaTypesDocTypes.h" - -#include "Doc/SchemaTypesDoc/CClassCardinalityDoc.h" -#include "Doc/SchemaTypesDoc/CPhysicalRelationshipDoc.h" - -using namespace Caf; - -/// Describes a relationship between dataclass where the key information from data class instances comprising the relationship are listed in an instance of this class -CPhysicalRelationshipDoc::CPhysicalRelationshipDoc() : - _arity(ARITY_NONE), - _isInitialized(false) {} -CPhysicalRelationshipDoc::~CPhysicalRelationshipDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CPhysicalRelationshipDoc::initialize( - const std::string namespaceVal, - const std::string name, - const std::string version, - const ARITY_TYPE arity, - const SmartPtrCClassCardinalityDoc dataClassLeft, - const SmartPtrCClassCardinalityDoc dataClassRight, - const std::string description) { - if (! _isInitialized) { - _namespaceVal = namespaceVal; - _name = name; - _version = version; - _arity = arity; - _dataClassLeft = dataClassLeft; - _dataClassRight = dataClassRight; - _description = description; - - _isInitialized = true; - } -} - -/// Accessor for the NamespaceVal -std::string CPhysicalRelationshipDoc::getNamespaceVal() const { - return _namespaceVal; -} - -/// Accessor for the Name -std::string CPhysicalRelationshipDoc::getName() const { - return _name; -} - -/// Accessor for the Version -std::string CPhysicalRelationshipDoc::getVersion() const { - return _version; -} - -/// Accessor for the Arity -ARITY_TYPE CPhysicalRelationshipDoc::getArity() const { - return _arity; -} - -/// Accessor for the DataClassLeft -SmartPtrCClassCardinalityDoc CPhysicalRelationshipDoc::getDataClassLeft() const { - return _dataClassLeft; -} - -/// Accessor for the DataClassRight -SmartPtrCClassCardinalityDoc CPhysicalRelationshipDoc::getDataClassRight() const { - return _dataClassRight; -} - -/// Accessor for the Description -std::string CPhysicalRelationshipDoc::getDescription() const { - return _description; -} - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CRelationshipDoc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CRelationshipDoc.cpp deleted file mode 100644 index 882672b82..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/CRelationshipDoc.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * - */ - -#include "stdafx.h" -#include "Doc/SchemaTypesDoc/SchemaTypesDocTypes.h" - -#include "Doc/SchemaTypesDoc/CClassCardinalityDoc.h" -#include "Doc/SchemaTypesDoc/CRelationshipDoc.h" - -using namespace Caf; - -/// Definition of a relationship between data classes -CRelationshipDoc::CRelationshipDoc() : - _arity(ARITY_NONE), - _isInitialized(false) {} -CRelationshipDoc::~CRelationshipDoc() {} - -/// Initializes the object with everything required by this -/// container. Once initialized, this object cannot -/// be changed (i.e. it is immutable). -void CRelationshipDoc::initialize( - const std::string namespaceVal, - const std::string name, - const std::string version, - const ARITY_TYPE arity, - const SmartPtrCClassCardinalityDoc dataClassLeft, - const SmartPtrCClassCardinalityDoc dataClassRight, - const std::string description) { - if (! _isInitialized) { - _namespaceVal = namespaceVal; - _name = name; - _version = version; - _arity = arity; - _dataClassLeft = dataClassLeft; - _dataClassRight = dataClassRight; - _description = description; - - _isInitialized = true; - } -} - -/// Accessor for the NamespaceVal -std::string CRelationshipDoc::getNamespaceVal() const { - return _namespaceVal; -} - -/// Accessor for the Name -std::string CRelationshipDoc::getName() const { - return _name; -} - -/// Accessor for the Version -std::string CRelationshipDoc::getVersion() const { - return _version; -} - -/// Number of parts (sides) to relationship. Restricted to a two-sided relationship for now -ARITY_TYPE CRelationshipDoc::getArity() const { - return _arity; -} - -/// Identifies the two classes that make up the relationship -SmartPtrCClassCardinalityDoc CRelationshipDoc::getDataClassLeft() const { - return _dataClassLeft; -} - -/// Identifies the two classes that make up the relationship -SmartPtrCClassCardinalityDoc CRelationshipDoc::getDataClassRight() const { - return _dataClassRight; -} - -/// A short human-readable description of the relationship -std::string CRelationshipDoc::getDescription() const { - return _description; -} - - - - - - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/stdafx.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/stdafx.h deleted file mode 100644 index f4bed1fb6..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/SchemaTypesDoc/stdafx.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Author: bwilliams - * Created: February 25, 2016 - * - * Copyright (C) 2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#ifndef STDAFX_H_ -#define STDAFX_H_ - -#ifdef WIN32 - #define SCHEMATYPESDOC_LINKAGE __declspec(dllexport) -#else - #define SCHEMATYPESDOC_LINKAGE -#endif - -#include - -#endif /* STDAFX_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocUtils/AttachmentUtils.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocUtils/AttachmentUtils.cpp deleted file mode 100644 index 68d3458b7..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocUtils/AttachmentUtils.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#include "stdafx.h" - -#include "Doc/CafCoreTypesDoc/CAttachmentCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CAttachmentDoc.h" -#include "Exception/CCafException.h" -#include "AttachmentUtils.h" - -using namespace Caf; - -SmartPtrCAttachmentDoc AttachmentUtils::findOptionalAttachment( - const std::string& attachmentName, - const SmartPtrCAttachmentCollectionDoc& attachmentCollection) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("AttachmentUtils", "findOptionalAttachment"); - - SmartPtrCAttachmentDoc attachmentRc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(attachmentName); - CAF_CM_VALIDATE_SMARTPTR(attachmentCollection); - - const std::deque attachmentCollectionInner = - attachmentCollection->getAttachment(); - for (TConstIterator > attachmentIter(attachmentCollectionInner); - attachmentIter; attachmentIter++) { - const SmartPtrCAttachmentDoc attachmentTmp = *attachmentIter; - const std::string attachmentNameTmp = attachmentTmp->getName(); - if (attachmentNameTmp.compare(attachmentName) == 0) { - attachmentRc = attachmentTmp; - } - } - } - CAF_CM_EXIT; - - return attachmentRc; -} - -SmartPtrCAttachmentDoc AttachmentUtils::findRequiredAttachment( - const std::string& attachmentName, - const SmartPtrCAttachmentCollectionDoc& attachmentCollection) { - CAF_CM_STATIC_FUNC_LOG("AttachmentUtils", "findRequiredAttachment"); - - SmartPtrCAttachmentDoc attachmentRc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(attachmentName); - CAF_CM_VALIDATE_SMARTPTR(attachmentCollection); - - attachmentRc = findOptionalAttachment(attachmentName, attachmentCollection); - if (attachmentRc.IsNull()) { - CAF_CM_EXCEPTIONEX_VA1(NoSuchElementException, ERROR_NOT_FOUND, - "Required attachment not found - %s", attachmentName.c_str()); - } - } - CAF_CM_EXIT; - - return attachmentRc; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocUtils/AttachmentUtils.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocUtils/AttachmentUtils.h deleted file mode 100644 index 67804858a..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocUtils/AttachmentUtils.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#ifndef AttachmentUtils_h_ -#define AttachmentUtils_h_ - - -#include "Doc/CafCoreTypesDoc/CAttachmentCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CAttachmentDoc.h" - -namespace Caf { -class DOCUTILS_LINKAGE AttachmentUtils { -public: - static SmartPtrCAttachmentDoc findOptionalAttachment( - const std::string& attachmentName, - const SmartPtrCAttachmentCollectionDoc& attachmentCollection); - - static SmartPtrCAttachmentDoc findRequiredAttachment( - const std::string& attachmentName, - const SmartPtrCAttachmentCollectionDoc& attachmentCollection); - -private: - CAF_CM_DECLARE_NOCREATE(AttachmentUtils); -}; - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocUtils/DefnObjectConverter.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocUtils/DefnObjectConverter.cpp deleted file mode 100644 index f33698165..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocUtils/DefnObjectConverter.cpp +++ /dev/null @@ -1,218 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#include "stdafx.h" - -#include "Doc/SchemaTypesDoc/CCmdlMetadataDoc.h" -#include "Doc/SchemaTypesDoc/CDataClassInstanceDoc.h" -#include "Doc/SchemaTypesDoc/CDataClassPropertyDoc.h" -#include "Doc/SchemaTypesDoc/CDataClassSubInstanceDoc.h" -#include "Integration/IDocument.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "DefnObjectConverter.h" - -using namespace Caf; - -std::string DefnObjectConverter::toString( - const SmartPtrCDataClassInstanceDoc dataClassInstance) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("DefnObjectConverter", "toString"); - - std::string defnObjXmlStr; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(dataClassInstance); - - const SmartPtrCXmlElement defnObjXml = CXmlUtils::createRootElement( - dataClassInstance->getName(), "http://schemas->vmware->com/caf/schema"); - - defnObjXml->addAttribute("namespace", dataClassInstance->getNamespaceVal()); - defnObjXml->addAttribute("name", dataClassInstance->getName()); - defnObjXml->addAttribute("version", dataClassInstance->getVersion()); - - SmartPtrCDataClassSubInstanceDoc dataClassSubInstance; - dataClassSubInstance.CreateInstance(); - dataClassSubInstance->initialize( - dataClassInstance->getName(), - dataClassInstance->getCmdlMetadataCollection(), - dataClassInstance->getPropertyCollection(), - dataClassInstance->getInstancePropertyCollection(), - dataClassInstance->getCmdlUnion()); - - addDataClassSubInstance(dataClassSubInstance, defnObjXml); - - defnObjXmlStr = defnObjXml->saveToStringRaw(); - } - CAF_CM_EXIT; - - return defnObjXmlStr; -} - -SmartPtrCDataClassInstanceDoc DefnObjectConverter::fromString( - const std::string defnObjectXmlStr) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("DefnObjectConverter", "fromString"); - - SmartPtrCDataClassInstanceDoc dataClassInstanceRc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(defnObjectXmlStr); - - const SmartPtrCXmlElement defnObjectXml = CXmlUtils::parseString(defnObjectXmlStr, std::string()); - - const SmartPtrCDataClassSubInstanceDoc dataClassSubInstance = parseDataClassSubInstance(defnObjectXml, true); - - dataClassInstanceRc.CreateInstance(); - dataClassInstanceRc->initialize( - defnObjectXml->findRequiredAttribute("namespace"), - defnObjectXml->findRequiredAttribute("name"), - defnObjectXml->findRequiredAttribute("version"), - dataClassSubInstance->getCmdlMetadataCollection(), - dataClassSubInstance->getPropertyCollection(), - dataClassSubInstance->getInstancePropertyCollection(), - dataClassSubInstance->getCmdlUnion()); - } - CAF_CM_EXIT; - - return dataClassInstanceRc; -} - -void DefnObjectConverter::addDataClassSubInstance( - const SmartPtrCDataClassSubInstanceDoc dataClassSubInstance, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("DefnObjectConverter", "addDataClassSubInstance"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(dataClassSubInstance); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::deque cmdlMetadataCollection = dataClassSubInstance->getCmdlMetadataCollection(); - if (! cmdlMetadataCollection.empty()) { - addCmdlMetadata(cmdlMetadataCollection, thisXml); - } - - const std::deque dataClassPropertyCollection = dataClassSubInstance->getPropertyCollection(); - if (! dataClassPropertyCollection.empty()) { - for (TSmartConstIterator > dataClassPropertyIter(dataClassPropertyCollection); - dataClassPropertyIter; dataClassPropertyIter++) { - const SmartPtrCDataClassPropertyDoc dataClassProperty = *dataClassPropertyIter; - const SmartPtrCXmlElement propertyXml = thisXml->createAndAddElement(dataClassProperty->getName()); - - const std::deque cmdlMetadataCollectionProperty = dataClassProperty->getCmdlMetadata(); - if (! cmdlMetadataCollectionProperty.empty()) { - addCmdlMetadata(cmdlMetadataCollectionProperty, propertyXml); - } - propertyXml->setValue(dataClassProperty->getValue()); - } - } - - const std::deque instancePropertyCollection = dataClassSubInstance->getInstancePropertyCollection(); - if (! instancePropertyCollection.empty()) { - for (TSmartConstIterator > dataClassSubInstanceIter(instancePropertyCollection); - dataClassSubInstanceIter; dataClassSubInstanceIter++) { - const SmartPtrCDataClassSubInstanceDoc instanceProperty = *dataClassSubInstanceIter; - const SmartPtrCXmlElement instancePropertyXml = thisXml->createAndAddElement(instanceProperty->getName()); - addDataClassSubInstance(instanceProperty, instancePropertyXml); - } - } - } - CAF_CM_EXIT; -} - -SmartPtrCDataClassSubInstanceDoc DefnObjectConverter::parseDataClassSubInstance( - const SmartPtrCXmlElement dataClassSubInstanceXml, - const bool isDataClassInstance) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("DefnObjectConverter", "parseDataClassSubInstance"); - - SmartPtrCDataClassSubInstanceDoc dataClassSubInstanceRc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(dataClassSubInstanceXml); - - std::deque cmdlMetadataCollection; - if (! isDataClassInstance) { - cmdlMetadataCollection = parseCmdlMetadata(dataClassSubInstanceXml); - } - - std::deque dataClassPropertyCollection; - std::deque instancePropertyCollection; - const CXmlElement::SmartPtrCElementCollection childrenXml = dataClassSubInstanceXml->getAllChildren(); - if (! childrenXml.IsNull() && ! childrenXml->empty()) { - for (TConstIterator childrenXmlIter(*childrenXml); - childrenXmlIter; childrenXmlIter++) { - const SmartPtrCXmlElement childXml = childrenXmlIter->second; - - const CXmlElement::SmartPtrCElementCollection grandChildrenXml = childXml->getAllChildren(); - if (! grandChildrenXml.IsNull() && ! grandChildrenXml->empty()) { - const SmartPtrCDataClassSubInstanceDoc dataClassSubInstance = parseDataClassSubInstance(childXml, false); - instancePropertyCollection.push_back(dataClassSubInstance); - } else { - const std::deque cmdlMetadataCollectionProperty = parseCmdlMetadata(childXml); - SmartPtrCDataClassPropertyDoc dataClassProperty; - dataClassProperty.CreateInstance(); - dataClassProperty->initialize( - childXml->getName(), cmdlMetadataCollectionProperty, childXml->getValue()); - dataClassPropertyCollection.push_back(dataClassProperty); - } - } - } - - dataClassSubInstanceRc.CreateInstance(); - dataClassSubInstanceRc->initialize( - dataClassSubInstanceXml->getName(), - cmdlMetadataCollection, dataClassPropertyCollection, instancePropertyCollection, SmartPtrCCmdlUnionDoc()); - } - CAF_CM_EXIT; - - return dataClassSubInstanceRc; -} - -std::deque DefnObjectConverter::parseCmdlMetadata( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("DefnObjectConverter", "parseCmdlMetadata"); - - std::deque cmdlMetadataCollection; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const CXmlElement::SmartPtrCAttributeCollection attributeCollection = thisXml->getAllAttributes(); - if (! attributeCollection.IsNull() && ! attributeCollection->empty()) { - for (TConstIterator childrenXmlIter(*attributeCollection); - childrenXmlIter; childrenXmlIter++) { - const std::string attributeName = childrenXmlIter->first; - const std::string attributeValue = childrenXmlIter->second; - - SmartPtrCCmdlMetadataDoc cmdlMetadata; - cmdlMetadata.CreateInstance(); - cmdlMetadata->initialize(attributeName, attributeValue); - - cmdlMetadataCollection.push_back(cmdlMetadata); - } - } - } - CAF_CM_EXIT; - - return cmdlMetadataCollection; -} - -void DefnObjectConverter::addCmdlMetadata( - const std::deque cmdlMetadataCollection, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("DefnObjectConverter", "addCmdlMetadata"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STL(cmdlMetadataCollection); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - for (TSmartConstIterator > cmdlMetadataIter(cmdlMetadataCollection); - cmdlMetadataIter; cmdlMetadataIter++) { - const SmartPtrCCmdlMetadataDoc cmdlMetadata = *cmdlMetadataIter; - thisXml->addAttribute(cmdlMetadata->getName(), cmdlMetadata->getValue()); - } - } - CAF_CM_EXIT; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocUtils/DefnObjectConverter.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocUtils/DefnObjectConverter.h deleted file mode 100644 index b1971bcba..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocUtils/DefnObjectConverter.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#ifndef DefnObjectConverter_h_ -#define DefnObjectConverter_h_ - - -#include "Doc/SchemaTypesDoc/CCmdlMetadataDoc.h" -#include "Doc/SchemaTypesDoc/CDataClassInstanceDoc.h" -#include "Doc/SchemaTypesDoc/CDataClassSubInstanceDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { -class DOCUTILS_LINKAGE DefnObjectConverter { -public: - static std::string toString( - const SmartPtrCDataClassInstanceDoc dataClassInstance); - - static SmartPtrCDataClassInstanceDoc fromString( - const std::string defnObjectXmlStr); - -private: - static void addDataClassSubInstance( - const SmartPtrCDataClassSubInstanceDoc dataClassSubInstance, - const SmartPtrCXmlElement thisXml); - - static SmartPtrCDataClassSubInstanceDoc parseDataClassSubInstance( - const SmartPtrCXmlElement dataClassInstanceXml, - const bool isDataClassInstance); - - static std::deque parseCmdlMetadata( - const SmartPtrCXmlElement thisXml); - - static void addCmdlMetadata( - const std::deque cmdlMetadataCollection, - const SmartPtrCXmlElement thisXml); - -private: - CAF_CM_DECLARE_NOCREATE(DefnObjectConverter); -}; - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocUtils/DocUtilsInc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocUtils/DocUtilsInc.h deleted file mode 100644 index aaebd8235..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocUtils/DocUtilsInc.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef DocUtils_Inc_h_ -#define DocUtils_Inc_h_ - -#include "Doc/DocUtils/EnumConvertersXml.h" -#include "DefnObjectConverter.h" -#include "ParameterUtils.h" -#include "AttachmentUtils.h" -#include "DocXmlUtils.h" - -#endif /* DocUtils_Inc_h_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocUtils/DocUtilsLink.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocUtils/DocUtilsLink.h deleted file mode 100644 index f0617e033..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocUtils/DocUtilsLink.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef DocUtils_Link_h_ -#define DocUtils_Link_h_ - -#ifndef DOCUTILS_LINKAGE - #ifdef WIN32 - #ifdef FRAMEWORK_BUILD - #define DOCUTILS_LINKAGE __declspec(dllexport) - #else - #define DOCUTILS_LINKAGE __declspec(dllimport) - #endif - #else - #define DOCUTILS_LINKAGE - #endif -#endif - -#include "Doc/DocUtils/EnumConvertersXml.h" -#include "DefnObjectConverter.h" -#include "ParameterUtils.h" -#include "AttachmentUtils.h" -#include "DocXmlUtils.h" - -#endif /* DocUtils_Link_h_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocUtils/DocXmlUtils.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocUtils/DocXmlUtils.cpp deleted file mode 100644 index 5f9546701..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocUtils/DocXmlUtils.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#include "stdafx.h" -#include "DocXmlUtils.h" - -using namespace Caf; - -std::string DocXmlUtils::getSchemaNamespace( - const std::string& relSchemaNamespace) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("DocXmlUtils", "getSchemaNamespace"); - - std::string schemaNamespace; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(relSchemaNamespace); - - const std::string schemaNamespaceRoot = - AppConfigUtils::getRequiredString("schema_namespace_root"); - const std::string pathDelim = "/"; - schemaNamespace = schemaNamespaceRoot + pathDelim + relSchemaNamespace; - } - CAF_CM_EXIT; - - return schemaNamespace; -} - -std::string DocXmlUtils::getSchemaLocation( - const std::string& relSchemaLocation) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("DocXmlUtils", "getSchemaLocation"); - - std::string schemaLocation; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(relSchemaLocation); - - const std::string schemaLocationRoot = - AppConfigUtils::getRequiredString("schema_location_root"); - const std::string pathDelim = "/"; - schemaLocation = schemaLocationRoot + pathDelim + relSchemaLocation; - } - CAF_CM_EXIT; - - return schemaLocation; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocUtils/DocXmlUtils.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocUtils/DocXmlUtils.h deleted file mode 100644 index 2bc37d2be..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocUtils/DocXmlUtils.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#ifndef DocXmlUtils_h_ -#define DocXmlUtils_h_ - -namespace Caf { - - namespace DocXmlUtils { - std::string DOCUTILS_LINKAGE getSchemaNamespace( - const std::string& relSchemaNamespace); - - std::string DOCUTILS_LINKAGE getSchemaLocation( - const std::string& relSchemaLocation); - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocUtils/EnumConvertersXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocUtils/EnumConvertersXml.cpp deleted file mode 100644 index ec89ec9d7..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocUtils/EnumConvertersXml.cpp +++ /dev/null @@ -1,588 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#include "stdafx.h" - -#include "Doc/DocUtils/EnumConvertersXml.h" -#include "Doc/CafInstallRequestDoc/CafInstallRequestDocTypes.h" -#include "Doc/SchemaTypesDoc/SchemaTypesDocTypes.h" -#include "Doc/CafCoreTypesDoc/CafCoreTypesDocTypes.h" -#include "Exception/CCafException.h" - -using namespace Caf; - -std::string EnumConvertersXml::convertParameterTypeToString( - const PARAMETER_TYPE parameterType) { - CAF_CM_STATIC_FUNC_LOG("EnumConvertersXml", "convertParameterTypeToString"); - - std::string rc; - - CAF_CM_ENTER { - switch(parameterType) { - case PARAMETER_NONE: - CAF_CM_LOG_DEBUG_VA0("Parameter not set"); - break; - case PARAMETER_STRING: - rc = "String"; - break; - case PARAMETER_SINT32: - rc = "SInt32"; - break; - case PARAMETER_UINT32: - rc = "UInt32"; - break; - case PARAMETER_SINT64: - rc = "SInt64"; - break; - case PARAMETER_UINT64: - rc = "UInt64"; - break; - case PARAMETER_DECIMAL: - rc = "Decimal"; - break; - case PARAMETER_DOUBLE: - rc = "Double"; - break; - case PARAMETER_BOOLEAN: - rc = "Boolean"; - break; - case PARAMETER_DATETIME: - rc = "DateTime"; - break; - default: - CAF_CM_EXCEPTIONEX_VA1(InvalidArgumentException, E_INVALIDARG, - "Unknown parameter type - %d", static_cast(parameterType)); - } - } - CAF_CM_EXIT; - - return rc; -} - -PARAMETER_TYPE EnumConvertersXml::convertStringToParameterType( - const std::string parameterType) { - CAF_CM_STATIC_FUNC("EnumConvertersXml", "convertStringToParameterType"); - - PARAMETER_TYPE rc = PARAMETER_NONE; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(parameterType); - - if (parameterType.compare("String") == 0) { - rc = PARAMETER_STRING; - } else if (parameterType.compare("SInt32") == 0) { - rc = PARAMETER_SINT32; - } else if (parameterType.compare("UInt32") == 0) { - rc = PARAMETER_UINT32; - } else if (parameterType.compare("SInt64") == 0) { - rc = PARAMETER_SINT64; - } else if (parameterType.compare("UInt64") == 0) { - rc = PARAMETER_UINT64; - } else if (parameterType.compare("Decimal") == 0) { - rc = PARAMETER_DECIMAL; - } else if (parameterType.compare("Double") == 0) { - rc = PARAMETER_DOUBLE; - } else if (parameterType.compare("Boolean") == 0) { - rc = PARAMETER_BOOLEAN; - } else if (parameterType.compare("DateTime") == 0) { - rc = PARAMETER_DATETIME; - } else { - CAF_CM_EXCEPTIONEX_VA1(InvalidArgumentException, E_INVALIDARG, - "Unknown parameter type - %s", parameterType.c_str()); - } - } - CAF_CM_EXIT; - - return rc; -} - -std::string EnumConvertersXml::convertPropertyTypeToString( - const PROPERTY_TYPE propertyType) { - CAF_CM_STATIC_FUNC_LOG("EnumConvertersXml", "convertPropertyTypeToString"); - - std::string rc; - - CAF_CM_ENTER { - switch(propertyType) { - case PROPERTY_NONE: - CAF_CM_LOG_DEBUG_VA0("Property not set"); - break; - case PROPERTY_STRING: - rc = "String"; - break; - case PROPERTY_SINT32: - rc = "SInt32"; - break; - case PROPERTY_UINT32: - rc = "UInt32"; - break; - case PROPERTY_SINT64: - rc = "SInt64"; - break; - case PROPERTY_UINT64: - rc = "UInt64"; - break; - case PROPERTY_DECIMAL: - rc = "Decimal"; - break; - case PROPERTY_DOUBLE: - rc = "Double"; - break; - case PROPERTY_BOOLEAN: - rc = "Boolean"; - break; - case PROPERTY_DATETIME: - rc = "DateTime"; - break; - default: - CAF_CM_EXCEPTIONEX_VA1(InvalidArgumentException, E_INVALIDARG, - "Unknown property type - %d", static_cast(propertyType)); - } - } - CAF_CM_EXIT; - - return rc; -} - -PROPERTY_TYPE EnumConvertersXml::convertStringToPropertyType( - const std::string propertyType) { - CAF_CM_STATIC_FUNC("EnumConvertersXml", "convertStringToPropertyType"); - - PROPERTY_TYPE rc = PROPERTY_NONE; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(propertyType); - - if (propertyType.compare("String") == 0) { - rc = PROPERTY_STRING; - } else if (propertyType.compare("SInt32") == 0) { - rc = PROPERTY_SINT32; - } else if (propertyType.compare("UInt32") == 0) { - rc = PROPERTY_UINT32; - } else if (propertyType.compare("SInt64") == 0) { - rc = PROPERTY_SINT64; - } else if (propertyType.compare("UInt64") == 0) { - rc = PROPERTY_UINT64; - } else if (propertyType.compare("Decimal") == 0) { - rc = PROPERTY_DECIMAL; - } else if (propertyType.compare("Double") == 0) { - rc = PROPERTY_DOUBLE; - } else if (propertyType.compare("Boolean") == 0) { - rc = PROPERTY_BOOLEAN; - } else if (propertyType.compare("DateTime") == 0) { - rc = PROPERTY_DATETIME; - } else { - CAF_CM_EXCEPTIONEX_VA1(InvalidArgumentException, E_INVALIDARG, - "Unknown property type - %s", propertyType.c_str()); - } - } - CAF_CM_EXIT; - - return rc; -} - -std::string EnumConvertersXml::convertValidatorTypeToString( - const VALIDATOR_TYPE validatorType) { - CAF_CM_STATIC_FUNC_LOG("EnumConvertersXml", "convertValidatorTypeToString"); - - std::string rc; - - CAF_CM_ENTER { - switch(validatorType) { - case VALIDATOR_NONE: - break; - case VALIDATOR_ENUM: - rc = "enum"; - break; - case VALIDATOR_RANGE: - rc = "range"; - break; - case VALIDATOR_REGEX: - rc = "regex"; - break; - case VALIDATOR_CUSTOM: - rc = "custom"; - break; - default: - CAF_CM_EXCEPTIONEX_VA1(InvalidArgumentException, E_INVALIDARG, - "Unknown validator type - %d", static_cast(validatorType)); - } - } - CAF_CM_EXIT; - - return rc; -} - -VALIDATOR_TYPE EnumConvertersXml::convertStringToValidatorType( - const std::string validatorType) { - CAF_CM_STATIC_FUNC("EnumConvertersXml", "convertStringToValidatorType"); - - VALIDATOR_TYPE rc = VALIDATOR_NONE; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(validatorType); - - if (validatorType.compare("enum") == 0) { - rc = VALIDATOR_ENUM; - } else if (validatorType.compare("range") == 0) { - rc = VALIDATOR_RANGE; - } else if (validatorType.compare("regex") == 0) { - rc = VALIDATOR_REGEX; - } else if (validatorType.compare("custom") == 0) { - rc = VALIDATOR_CUSTOM; - } else { - CAF_CM_EXCEPTIONEX_VA1(InvalidArgumentException, E_INVALIDARG, - "Unknown validator type - %s", validatorType.c_str()); - } - } - CAF_CM_EXIT; - - return rc; -} - -std::string EnumConvertersXml::convertOperatorTypeToString( - const OPERATOR_TYPE operatorType) { - CAF_CM_STATIC_FUNC_LOG("EnumConvertersXml", "convertOperatorTypeToString"); - - std::string rc; - - CAF_CM_ENTER { - switch(operatorType) { - case OPERATOR_NONE: - CAF_CM_LOG_DEBUG_VA0("Operator not set"); - break; - case OPERATOR_EQUAL: - rc = "="; - break; - default: - CAF_CM_EXCEPTIONEX_VA1(InvalidArgumentException, E_INVALIDARG, - "Unknown operator type - %d", static_cast(operatorType)); - } - } - CAF_CM_EXIT; - - return rc; -} - -OPERATOR_TYPE EnumConvertersXml::convertStringToOperatorType( - const std::string operatorType) { - CAF_CM_STATIC_FUNC("EnumConvertersXml", "convertStringToOperatorType"); - - OPERATOR_TYPE rc = OPERATOR_NONE; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(operatorType); - - if (operatorType.compare("=") == 0) { - rc = OPERATOR_EQUAL; - } else { - CAF_CM_EXCEPTIONEX_VA1(InvalidArgumentException, E_INVALIDARG, - "Unknown operator type - %s", operatorType.c_str()); - } - } - CAF_CM_EXIT; - - return rc; -} - -std::string EnumConvertersXml::convertArityTypeToString( - const ARITY_TYPE arityType) { - CAF_CM_STATIC_FUNC_LOG("EnumConvertersXml", "convertArityTypeToString"); - - std::string rc; - - CAF_CM_ENTER { - switch(arityType) { - case ARITY_NONE: - CAF_CM_LOG_DEBUG_VA0("Arity not set"); - break; - case ARITY_UNSIGNED_BYTE: - rc = "2"; - break; - default: - CAF_CM_EXCEPTIONEX_VA1(InvalidArgumentException, E_INVALIDARG, - "Unknown arity type - %d", static_cast(arityType)); - } - } - CAF_CM_EXIT; - - return rc; -} - -ARITY_TYPE EnumConvertersXml::convertStringToArityType( - const std::string arityType) { - CAF_CM_STATIC_FUNC("EnumConvertersXml", "convertStringToArityType"); - - ARITY_TYPE rc = ARITY_NONE; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(arityType); - - if (arityType.compare("2") == 0) { - rc = ARITY_UNSIGNED_BYTE; - } else { - CAF_CM_EXCEPTIONEX_VA1(InvalidArgumentException, E_INVALIDARG, - "Unknown arity type - %s", arityType.c_str()); - } - } - CAF_CM_EXIT; - - return rc; -} - -std::string EnumConvertersXml::convertPackageOSTypeToString( - const PACKAGE_OS_TYPE packageOSType) { - CAF_CM_STATIC_FUNC_LOG("EnumConvertersXml", "convertPackageOSTypeToString"); - - std::string rc; - - CAF_CM_ENTER { - switch(packageOSType) { - case PACKAGE_OS_NONE: - CAF_CM_LOG_DEBUG_VA0("Package OS not set"); - break; - case PACKAGE_OS_ALL: - rc = "All"; - break; - case PACKAGE_OS_NIX: - rc = "Nix"; - break; - case PACKAGE_OS_WIN: - rc = "Win"; - break; - default: - CAF_CM_EXCEPTIONEX_VA1(InvalidArgumentException, E_INVALIDARG, - "Unknown Package OS type - %d", static_cast(packageOSType)); - } - } - CAF_CM_EXIT; - - return rc; -} - -PACKAGE_OS_TYPE EnumConvertersXml::convertStringToPackageOSType( - const std::string packageOSType) { - CAF_CM_STATIC_FUNC("EnumConvertersXml", "convertStringToPackageOSType"); - - PACKAGE_OS_TYPE rc = PACKAGE_OS_NONE; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(packageOSType); - - if (packageOSType.compare("All") == 0) { - rc = PACKAGE_OS_ALL; - } else if (packageOSType.compare("Nix") == 0) { - rc = PACKAGE_OS_NIX; - } else if (packageOSType.compare("Win") == 0) { - rc = PACKAGE_OS_WIN; - } else { - CAF_CM_EXCEPTIONEX_VA1(InvalidArgumentException, E_INVALIDARG, - "Unknown Package OS type - %s", packageOSType.c_str()); - } - } - CAF_CM_EXIT; - - return rc; -} - -std::string EnumConvertersXml::convertLoggingLevelTypeToString( - const LOGGINGLEVEL_TYPE loggingLevelType) { - CAF_CM_STATIC_FUNC_LOG("EnumConvertersXml", "convertLoggingLevelTypeToString"); - - std::string rc; - - CAF_CM_ENTER { - switch(loggingLevelType) { - case LOGGINGLEVEL_NONE: - CAF_CM_LOG_DEBUG_VA0("Logging level not set"); - break; - case LOGGINGLEVEL_DEBUG: - rc = "DEBUG"; - break; - case LOGGINGLEVEL_INFO: - rc = "INFO"; - break; - case LOGGINGLEVEL_WARN: - rc = "WARN"; - break; - case LOGGINGLEVEL_ERROR: - rc = "ERROR"; - break; - case LOGGINGLEVEL_CRITICAL: - rc = "CRITICAL"; - break; - default: - CAF_CM_EXCEPTIONEX_VA1(InvalidArgumentException, E_INVALIDARG, - "Unknown logging level type - %d", static_cast(loggingLevelType)); - } - } - CAF_CM_EXIT; - - return rc; -} - -LOGGINGLEVEL_TYPE EnumConvertersXml::convertStringToLoggingLevelType( - const std::string loggingLevelType) { - CAF_CM_STATIC_FUNC("EnumConvertersXml", "convertStringToLoggingLevelType"); - - LOGGINGLEVEL_TYPE rc = LOGGINGLEVEL_NONE; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(loggingLevelType); - - if (loggingLevelType.compare("DEBUG") == 0) { - rc = LOGGINGLEVEL_DEBUG; - } else if (loggingLevelType.compare("INFO") == 0) { - rc = LOGGINGLEVEL_INFO; - } else if (loggingLevelType.compare("WARN") == 0) { - rc = LOGGINGLEVEL_WARN; - } else if (loggingLevelType.compare("ERROR") == 0) { - rc = LOGGINGLEVEL_ERROR; - } else if (loggingLevelType.compare("CRITICAL") == 0) { - rc = LOGGINGLEVEL_CRITICAL; - } else { - CAF_CM_EXCEPTIONEX_VA1(InvalidArgumentException, E_INVALIDARG, - "Unknown logging level type - %s", loggingLevelType.c_str()); - } - } - CAF_CM_EXIT; - - return rc; -} - -std::string EnumConvertersXml::convertLoggingComponentTypeToString( - const LOGGINGCOMPONENT_TYPE loggingComponentType) { - CAF_CM_STATIC_FUNC_LOG("EnumConvertersXml", "convertLoggingComponentTypeToString"); - - std::string rc; - - CAF_CM_ENTER { - switch(loggingComponentType) { - case LOGGINGCOMPONENT_NONE: - CAF_CM_LOG_DEBUG_VA0("Logging component not set"); - break; - case LOGGINGCOMPONENT_COMMUNICATIONS: - rc = "Communications"; - break; - case LOGGINGCOMPONENT_MANAGEMENTAGENT: - rc = "ManagementAgent"; - break; - case LOGGINGCOMPONENT_PROVIDERFRAMEWORK: - rc = "ProviderFramework"; - break; - case LOGGINGCOMPONENT_PROVIDER: - rc = "Provider"; - break; - default: - CAF_CM_EXCEPTIONEX_VA1(InvalidArgumentException, E_INVALIDARG, - "Unknown logging component type - %d", static_cast(loggingComponentType)); - } - } - CAF_CM_EXIT; - - return rc; -} - -LOGGINGCOMPONENT_TYPE EnumConvertersXml::convertStringToLoggingComponentType( - const std::string loggingComponentType) { - CAF_CM_STATIC_FUNC("EnumConvertersXml", "convertStringToLoggingComponentType"); - - LOGGINGCOMPONENT_TYPE rc = LOGGINGCOMPONENT_NONE; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(loggingComponentType); - - if (loggingComponentType.compare("Communications") == 0) { - rc = LOGGINGCOMPONENT_COMMUNICATIONS; - } else if (loggingComponentType.compare("ManagementAgent") == 0) { - rc = LOGGINGCOMPONENT_MANAGEMENTAGENT; - } else if (loggingComponentType.compare("ProviderFramework") == 0) { - rc = LOGGINGCOMPONENT_PROVIDERFRAMEWORK; - } else if (loggingComponentType.compare("Provider") == 0) { - rc = LOGGINGCOMPONENT_PROVIDER; - } else { - CAF_CM_EXCEPTIONEX_VA1(InvalidArgumentException, E_INVALIDARG, - "Unknown logging component type - %s", loggingComponentType.c_str()); - } - } - CAF_CM_EXIT; - - return rc; -} - -std::string EnumConvertersXml::convertCmsPolicyToString( - const CMS_POLICY cmsPolicy) { - CAF_CM_STATIC_FUNC_LOG("EnumConvertersXml", "convertCmsPolicyToString"); - - std::string rc; - - CAF_CM_ENTER { - switch(cmsPolicy) { - case CMS_POLICY_NONE: - rc = "None"; - break; - case CMS_POLICY_CAF_ENCRYPTED: - rc = "CAF_Encrypted"; - break; - case CMS_POLICY_CAF_SIGNED: - rc = "CAF_Signed"; - break; - case CMS_POLICY_CAF_ENCRYPTED_AND_SIGNED: - rc = "CAF_Encrypted_And_Signed"; - break; - case CMS_POLICY_APP_ENCRYPTED: - rc = "App_Encrypted"; - break; - case CMS_POLICY_APP_SIGNED: - rc = "App_Signed"; - break; - case CMS_POLICY_APP_ENCRYPTED_AND_SIGNED: - rc = "App_Encrypted_And_Signed"; - break; - default: - CAF_CM_EXCEPTIONEX_VA1(InvalidArgumentException, E_INVALIDARG, - "Unknown CMS Policy - %d", static_cast(cmsPolicy)); - } - } - CAF_CM_EXIT; - - return rc; -} - -CMS_POLICY EnumConvertersXml::convertStringToCmsPolicy( - const std::string cmsPolicy) { - CAF_CM_STATIC_FUNC("EnumConvertersXml", "convertStringToCmsPolicy"); - - CMS_POLICY rc = CMS_POLICY_NONE; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(cmsPolicy); - - if (cmsPolicy.compare("None") == 0) { - rc = CMS_POLICY_NONE; - } else if (cmsPolicy.compare("CAF_Encrypted") == 0) { - rc = CMS_POLICY_CAF_ENCRYPTED; - } else if (cmsPolicy.compare("CAF_Signed") == 0) { - rc = CMS_POLICY_CAF_SIGNED; - } else if (cmsPolicy.compare("CAF_Encrypted_And_Signed") == 0) { - rc = CMS_POLICY_CAF_ENCRYPTED_AND_SIGNED; - } else if (cmsPolicy.compare("App_Encrypted") == 0) { - rc = CMS_POLICY_APP_ENCRYPTED; - } else if (cmsPolicy.compare("App_Signed") == 0) { - rc = CMS_POLICY_APP_SIGNED; - } else if (cmsPolicy.compare("App_Encrypted_And_Signed") == 0) { - rc = CMS_POLICY_APP_ENCRYPTED_AND_SIGNED; - } else { - CAF_CM_EXCEPTIONEX_VA1(InvalidArgumentException, E_INVALIDARG, - "Unknown CMS Policy - %s", cmsPolicy.c_str()); - } - } - CAF_CM_EXIT; - - return rc; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocUtils/ParameterUtils.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocUtils/ParameterUtils.cpp deleted file mode 100644 index 38def7ba0..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocUtils/ParameterUtils.cpp +++ /dev/null @@ -1,336 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#include "stdafx.h" - -#include "Doc/CafCoreTypesDoc/CParameterCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CRequestInstanceParameterDoc.h" -#include "Doc/CafCoreTypesDoc/CRequestParameterDoc.h" -#include "Exception/CCafException.h" -#include "ParameterUtils.h" - -using namespace Caf; - -SmartPtrCRequestParameterDoc ParameterUtils::findOptionalParameter( - const std::string& parameterName, - const SmartPtrCParameterCollectionDoc& parameterCollection) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("ParameterUtils", "findOptionalParameter"); - - SmartPtrCRequestParameterDoc parameterRc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(parameterName); - CAF_CM_VALIDATE_SMARTPTR(parameterCollection); - - const std::deque parameterCollectionInner = - parameterCollection->getParameter(); - for (TConstIterator > parameterIter(parameterCollectionInner); - parameterIter; parameterIter++) { - const SmartPtrCRequestParameterDoc parameterTmp = *parameterIter; - const std::string parameterNameTmp = parameterTmp->getName(); - if (parameterNameTmp.compare(parameterName) == 0) { - parameterRc = parameterTmp; - } - } - } - CAF_CM_EXIT; - - return parameterRc; -} - -SmartPtrCRequestParameterDoc ParameterUtils::findRequiredParameter( - const std::string& parameterName, - const SmartPtrCParameterCollectionDoc& parameterCollection) { - CAF_CM_STATIC_FUNC_LOG("ParameterUtils", "findRequiredParameter"); - - SmartPtrCRequestParameterDoc parameterRc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(parameterName); - CAF_CM_VALIDATE_SMARTPTR(parameterCollection); - - parameterRc = findOptionalParameter(parameterName, parameterCollection); - if (parameterRc.IsNull()) { - CAF_CM_EXCEPTIONEX_VA1(NoSuchElementException, ERROR_NOT_FOUND, - "Required parameter not found - %s", parameterName.c_str()); - } - } - CAF_CM_EXIT; - - return parameterRc; -} - -std::deque ParameterUtils::findOptionalParameterAsStringCollection( - const std::string& parameterName, - const SmartPtrCParameterCollectionDoc& parameterCollection) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("ParameterUtils", "findOptionalParameterAsStringCollection"); - - std::deque parameterValueCollectionRc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(parameterName); - CAF_CM_VALIDATE_SMARTPTR(parameterCollection); - - const SmartPtrCRequestParameterDoc parameter = findOptionalParameter(parameterName, parameterCollection); - if (! parameter.IsNull()) { - parameterValueCollectionRc = parameter->getValue(); - } - } - CAF_CM_EXIT; - - return parameterValueCollectionRc; -} - -std::deque ParameterUtils::findRequiredParameterAsStringCollection( - const std::string& parameterName, - const SmartPtrCParameterCollectionDoc& parameterCollection) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("ParameterUtils", "findRequiredParameterAsStringCollection"); - - std::deque parameterValueCollectionRc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(parameterName); - CAF_CM_VALIDATE_SMARTPTR(parameterCollection); - - const SmartPtrCRequestParameterDoc parameter = findRequiredParameter(parameterName, parameterCollection); - parameterValueCollectionRc = parameter->getValue(); - } - CAF_CM_EXIT; - - return parameterValueCollectionRc; -} - -std::string ParameterUtils::findOptionalParameterAsString( - const std::string& parameterName, - const SmartPtrCParameterCollectionDoc& parameterCollection) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("ParameterUtils", "findOptionalParameterAsString"); - - std::string parameterValueRc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(parameterName); - CAF_CM_VALIDATE_SMARTPTR(parameterCollection); - - const std::deque parameterValueCollection = - findOptionalParameterAsStringCollection(parameterName, parameterCollection); - if (parameterValueCollection.size() == 1) { - parameterValueRc = parameterValueCollection.front(); - } - } - CAF_CM_EXIT; - - return parameterValueRc; -} - -std::string ParameterUtils::findRequiredParameterAsString( - const std::string& parameterName, - const SmartPtrCParameterCollectionDoc& parameterCollection) { - CAF_CM_STATIC_FUNC_LOG("ParameterUtils", "findRequiredParameterAsString"); - - std::string parameterValueRc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(parameterName); - CAF_CM_VALIDATE_SMARTPTR(parameterCollection); - - const std::deque parameterValueCollection = - findOptionalParameterAsStringCollection(parameterName, parameterCollection); - if (parameterValueCollection.size() != 1) { - CAF_CM_EXCEPTIONEX_VA1(NoSuchElementException, ERROR_NOT_FOUND, - "Required string parameter not found - %s", parameterName.c_str()); - } - - parameterValueRc = parameterValueCollection.front(); - } - CAF_CM_EXIT; - - return parameterValueRc; -} - -SmartPtrCRequestInstanceParameterDoc ParameterUtils::findOptionalInstanceParameter( - const std::string& parameterName, - const SmartPtrCParameterCollectionDoc& parameterCollection) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("ParameterUtils", "findOptionalInstanceParameter"); - - SmartPtrCRequestInstanceParameterDoc parameterRc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(parameterName); - CAF_CM_VALIDATE_SMARTPTR(parameterCollection); - - const std::deque parameterCollectionInner = - parameterCollection->getInstanceParameter(); - for (TConstIterator > parameterIter(parameterCollectionInner); - parameterIter; parameterIter++) { - const SmartPtrCRequestInstanceParameterDoc parameterTmp = *parameterIter; - const std::string parameterNameTmp = parameterTmp->getName(); - if (parameterNameTmp.compare(parameterName) == 0) { - parameterRc = parameterTmp; - } - } - } - CAF_CM_EXIT; - - return parameterRc; -} - -SmartPtrCRequestInstanceParameterDoc ParameterUtils::findRequiredInstanceParameter( - const std::string& parameterName, - const SmartPtrCParameterCollectionDoc& parameterCollection) { - CAF_CM_STATIC_FUNC_LOG("ParameterUtils", "findRequiredInstanceParameter"); - - SmartPtrCRequestInstanceParameterDoc parameterRc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(parameterName); - CAF_CM_VALIDATE_SMARTPTR(parameterCollection); - - parameterRc = findOptionalInstanceParameter(parameterName, parameterCollection); - if (parameterRc.IsNull()) { - CAF_CM_EXCEPTIONEX_VA1(NoSuchElementException, ERROR_NOT_FOUND, - "Required parameter not found - %s", parameterName.c_str()); - } - } - CAF_CM_EXIT; - - return parameterRc; -} - -std::deque ParameterUtils::findOptionalInstanceParameterAsStringCollection( - const std::string& parameterName, - const SmartPtrCParameterCollectionDoc& parameterCollection) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("ParameterUtils", "findOptionalInstanceParameterAsStringCollection"); - - std::deque parameterValueCollectionRc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(parameterName); - CAF_CM_VALIDATE_SMARTPTR(parameterCollection); - - const SmartPtrCRequestInstanceParameterDoc parameter = findOptionalInstanceParameter(parameterName, parameterCollection); - if (! parameter.IsNull()) { - parameterValueCollectionRc = parameter->getValue(); - } - } - CAF_CM_EXIT; - - return parameterValueCollectionRc; -} - -std::deque ParameterUtils::findRequiredInstanceParameterAsStringCollection( - const std::string& parameterName, - const SmartPtrCParameterCollectionDoc& parameterCollection) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("ParameterUtils", "findRequiredInstanceParameterAsStringCollection"); - - std::deque parameterValueCollectionRc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(parameterName); - CAF_CM_VALIDATE_SMARTPTR(parameterCollection); - - const SmartPtrCRequestInstanceParameterDoc parameter = findRequiredInstanceParameter(parameterName, parameterCollection); - parameterValueCollectionRc = parameter->getValue(); - } - CAF_CM_EXIT; - - return parameterValueCollectionRc; -} - -std::string ParameterUtils::findOptionalInstanceParameterAsString( - const std::string& parameterName, - const SmartPtrCParameterCollectionDoc& parameterCollection) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("ParameterUtils", "findOptionalInstanceParameterAsString"); - - std::string parameterValueRc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(parameterName); - CAF_CM_VALIDATE_SMARTPTR(parameterCollection); - - const std::deque parameterValueCollection = - findOptionalInstanceParameterAsStringCollection(parameterName, parameterCollection); - if (parameterValueCollection.size() == 1) { - parameterValueRc = parameterValueCollection.front(); - } - } - CAF_CM_EXIT; - - return parameterValueRc; -} - -std::string ParameterUtils::findRequiredInstanceParameterAsString( - const std::string& parameterName, - const SmartPtrCParameterCollectionDoc& parameterCollection) { - CAF_CM_STATIC_FUNC_LOG("ParameterUtils", "findRequiredInstanceParameterAsString"); - - std::string parameterValueRc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(parameterName); - CAF_CM_VALIDATE_SMARTPTR(parameterCollection); - - const std::deque parameterValueCollection = - findOptionalInstanceParameterAsStringCollection(parameterName, parameterCollection); - if (parameterValueCollection.size() != 1) { - CAF_CM_EXCEPTIONEX_VA1(NoSuchElementException, ERROR_NOT_FOUND, - "Required string parameter not found - %s", parameterName.c_str()); - } - - parameterValueRc = parameterValueCollection.front(); - } - CAF_CM_EXIT; - - return parameterValueRc; -} - -SmartPtrCRequestParameterDoc ParameterUtils::createParameter( - const std::string& name, - const std::string& value) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("ParameterUtils", "createParameter"); - - SmartPtrCRequestParameterDoc parameter; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(name); - CAF_CM_VALIDATE_STRING(value); - - std::deque valueCollection; - valueCollection.push_back(value); - - parameter.CreateInstance(); - parameter->initialize( - name, - PARAMETER_STRING, - valueCollection); - } - CAF_CM_EXIT; - - return parameter; -} - -SmartPtrCRequestParameterDoc ParameterUtils::createParameter( - const std::string& name, - const std::deque& valueCollection) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("ParameterUtils", "createParameter"); - - SmartPtrCRequestParameterDoc parameter; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(name); - CAF_CM_VALIDATE_STL(valueCollection); - - parameter.CreateInstance(); - parameter->initialize( - name, - PARAMETER_STRING, - valueCollection); - } - CAF_CM_EXIT; - - return parameter; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocUtils/ParameterUtils.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocUtils/ParameterUtils.h deleted file mode 100644 index 0a335b660..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocUtils/ParameterUtils.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#ifndef ParameterUtils_h_ -#define ParameterUtils_h_ - - -#include "Doc/CafCoreTypesDoc/CParameterCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CRequestInstanceParameterDoc.h" -#include "Doc/CafCoreTypesDoc/CRequestParameterDoc.h" - -namespace Caf { -class DOCUTILS_LINKAGE ParameterUtils { -public: - static SmartPtrCRequestParameterDoc findOptionalParameter( - const std::string& parameterName, - const SmartPtrCParameterCollectionDoc& parameterCollection); - - static SmartPtrCRequestParameterDoc findRequiredParameter( - const std::string& parameterName, - const SmartPtrCParameterCollectionDoc& parameterCollection); - - static std::deque findOptionalParameterAsStringCollection( - const std::string& parameterName, - const SmartPtrCParameterCollectionDoc& parameterCollection); - - static std::deque findRequiredParameterAsStringCollection( - const std::string& parameterName, - const SmartPtrCParameterCollectionDoc& parameterCollection); - - static std::string findOptionalParameterAsString( - const std::string& parameterName, - const SmartPtrCParameterCollectionDoc& parameterCollection); - - static std::string findRequiredParameterAsString( - const std::string& parameterName, - const SmartPtrCParameterCollectionDoc& parameterCollection); - -public: - static SmartPtrCRequestInstanceParameterDoc findOptionalInstanceParameter( - const std::string& parameterName, - const SmartPtrCParameterCollectionDoc& parameterCollection); - - static SmartPtrCRequestInstanceParameterDoc findRequiredInstanceParameter( - const std::string& parameterName, - const SmartPtrCParameterCollectionDoc& parameterCollection); - - static std::deque findOptionalInstanceParameterAsStringCollection( - const std::string& parameterName, - const SmartPtrCParameterCollectionDoc& parameterCollection); - - static std::deque findRequiredInstanceParameterAsStringCollection( - const std::string& parameterName, - const SmartPtrCParameterCollectionDoc& parameterCollection); - - static std::string findOptionalInstanceParameterAsString( - const std::string& parameterName, - const SmartPtrCParameterCollectionDoc& parameterCollection); - - static std::string findRequiredInstanceParameterAsString( - const std::string& parameterName, - const SmartPtrCParameterCollectionDoc& parameterCollection); - -public: - static SmartPtrCRequestParameterDoc createParameter( - const std::string& name, - const std::string& value); - - static SmartPtrCRequestParameterDoc createParameter( - const std::string& name, - const std::deque& valueCollection); - -private: - CAF_CM_DECLARE_NOCREATE(ParameterUtils); -}; - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocUtils/stdafx.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocUtils/stdafx.h deleted file mode 100644 index e181cff12..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocUtils/stdafx.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef STDAFX_H_ -#define STDAFX_H_ - -#include -#include -#include "DocUtilsLink.h" - -#endif /* STDAFX_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/AddInCollectionXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/AddInCollectionXml.cpp deleted file mode 100644 index 388066fa1..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/AddInCollectionXml.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/CafCoreTypesDoc/CAddInCollectionDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/CafCoreTypesXml/AddInCollectionXml.h" - -using namespace Caf; - -void AddInCollectionXml::add( - const SmartPtrCAddInCollectionDoc addInCollectionDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("AddInCollectionXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(addInCollectionDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::deque addInVal = - addInCollectionDoc->getAddInCollection(); - CAF_CM_VALIDATE_STL(addInVal); - - if (! addInVal.empty()) { - for (TConstIterator > addInIter(addInVal); - addInIter; addInIter++) { - const SmartPtrCXmlElement addInXml = - thisXml->createAndAddElement("addIn"); - addInXml->setValue(*addInIter); - } - } - } - CAF_CM_EXIT; -} - -SmartPtrCAddInCollectionDoc AddInCollectionXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("AddInCollectionXml", "parse"); - - SmartPtrCAddInCollectionDoc addInCollectionDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const CXmlElement::SmartPtrCElementCollection addInChildrenXml = - thisXml->findRequiredChildren("addIn"); - - std::deque addInVal; - if (! addInChildrenXml.IsNull() && ! addInChildrenXml->empty()) { - for (TConstIterator addInXmlIter(*addInChildrenXml); - addInXmlIter; addInXmlIter++) { - const SmartPtrCXmlElement addInXml = addInXmlIter->second; - const std::string addInDoc = addInXml->getValue(); - addInVal.push_back(addInDoc); - } - } - - addInCollectionDoc.CreateInstance(); - addInCollectionDoc->initialize( - addInVal); - } - CAF_CM_EXIT; - - return addInCollectionDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/AddInsXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/AddInsXml.cpp deleted file mode 100644 index 600ff4b3d..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/AddInsXml.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/CafCoreTypesDoc/CAddInCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CAddInsDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/CafCoreTypesXml/AddInsXml.h" -#include "Doc/DocXml/CafCoreTypesXml/AddInCollectionXml.h" - -using namespace Caf; - -void AddInsXml::add( - const SmartPtrCAddInsDoc addInsDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("AddInsXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(addInsDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::deque addInCollectionVal = - addInsDoc->getAddInCollection(); - CAF_CM_VALIDATE_STL(addInCollectionVal); - - if (! addInCollectionVal.empty()) { - for (TConstIterator > addInCollectionIter(addInCollectionVal); - addInCollectionIter; addInCollectionIter++) { - const SmartPtrCXmlElement addInCollectionXml = - thisXml->createAndAddElement("addInCollection"); - AddInCollectionXml::add(*addInCollectionIter, addInCollectionXml); - } - } - } - CAF_CM_EXIT; -} - -SmartPtrCAddInsDoc AddInsXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("AddInsXml", "parse"); - - SmartPtrCAddInsDoc addInsDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const CXmlElement::SmartPtrCElementCollection addInCollectionChildrenXml = - thisXml->findRequiredChildren("addInCollection"); - - std::deque addInCollectionVal; - if (! addInCollectionChildrenXml.IsNull() && ! addInCollectionChildrenXml->empty()) { - for (TConstIterator addInCollectionXmlIter(*addInCollectionChildrenXml); - addInCollectionXmlIter; addInCollectionXmlIter++) { - const SmartPtrCXmlElement addInCollectionXml = addInCollectionXmlIter->second; - const SmartPtrCAddInCollectionDoc addInCollectionDoc = - AddInCollectionXml::parse(addInCollectionXml); - addInCollectionVal.push_back(addInCollectionDoc); - } - } - - addInsDoc.CreateInstance(); - addInsDoc->initialize( - addInCollectionVal); - } - CAF_CM_EXIT; - - return addInsDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/AttachmentCollectionXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/AttachmentCollectionXml.cpp deleted file mode 100644 index 39b17ac00..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/AttachmentCollectionXml.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/CafCoreTypesDoc/CAttachmentCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CAttachmentDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/CafCoreTypesXml/AttachmentCollectionXml.h" -#include "Doc/DocXml/CafCoreTypesXml/AttachmentXml.h" - -using namespace Caf; - -void AttachmentCollectionXml::add( - const SmartPtrCAttachmentCollectionDoc attachmentCollectionDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("AttachmentCollectionXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(attachmentCollectionDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::deque attachmentVal = - attachmentCollectionDoc->getAttachment(); - if (! attachmentVal.empty()) { - for (TConstIterator > attachmentIter(attachmentVal); - attachmentIter; attachmentIter++) { - const SmartPtrCXmlElement attachmentXml = - thisXml->createAndAddElement("attachment"); - AttachmentXml::add(*attachmentIter, attachmentXml); - } - } - } - CAF_CM_EXIT; -} - -SmartPtrCAttachmentCollectionDoc AttachmentCollectionXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("AttachmentCollectionXml", "parse"); - - SmartPtrCAttachmentCollectionDoc attachmentCollectionDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const CXmlElement::SmartPtrCElementCollection attachmentChildrenXml = - thisXml->findOptionalChildren("attachment"); - - std::deque attachmentVal; - if (! attachmentChildrenXml.IsNull() && ! attachmentChildrenXml->empty()) { - for (TConstIterator attachmentXmlIter(*attachmentChildrenXml); - attachmentXmlIter; attachmentXmlIter++) { - const SmartPtrCXmlElement attachmentXml = attachmentXmlIter->second; - const SmartPtrCAttachmentDoc attachmentDoc = - AttachmentXml::parse(attachmentXml); - attachmentVal.push_back(attachmentDoc); - } - } - - attachmentCollectionDoc.CreateInstance(); - attachmentCollectionDoc->initialize( - attachmentVal); - } - CAF_CM_EXIT; - - return attachmentCollectionDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/AttachmentNameCollectionXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/AttachmentNameCollectionXml.cpp deleted file mode 100644 index 2f24a636e..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/AttachmentNameCollectionXml.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/CafCoreTypesDoc/CAttachmentNameCollectionDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/CafCoreTypesXml/AttachmentNameCollectionXml.h" - -using namespace Caf; - -void AttachmentNameCollectionXml::add( - const SmartPtrCAttachmentNameCollectionDoc attachmentNameCollectionDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("AttachmentNameCollectionXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(attachmentNameCollectionDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::deque nameVal = - attachmentNameCollectionDoc->getName(); - CAF_CM_VALIDATE_STL(nameVal); - - if (! nameVal.empty()) { - for (TConstIterator > nameIter(nameVal); - nameIter; nameIter++) { - const SmartPtrCXmlElement nameXml = - thisXml->createAndAddElement("attachmentName"); - nameXml->addAttribute("name", *nameIter); - } - } - } - CAF_CM_EXIT; -} - -SmartPtrCAttachmentNameCollectionDoc AttachmentNameCollectionXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("AttachmentNameCollectionXml", "parse"); - - SmartPtrCAttachmentNameCollectionDoc attachmentNameCollectionDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const CXmlElement::SmartPtrCElementCollection nameChildrenXml = - thisXml->findRequiredChildren("attachmentName"); - - std::deque nameVal; - if (! nameChildrenXml.IsNull() && ! nameChildrenXml->empty()) { - for (TConstIterator nameXmlIter(*nameChildrenXml); - nameXmlIter; nameXmlIter++) { - const SmartPtrCXmlElement nameXml = nameXmlIter->second; - const std::string name = nameXml->findRequiredAttribute("name"); - nameVal.push_back(name); - } - } - - attachmentNameCollectionDoc.CreateInstance(); - attachmentNameCollectionDoc->initialize( - nameVal); - } - CAF_CM_EXIT; - - return attachmentNameCollectionDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/AttachmentXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/AttachmentXml.cpp deleted file mode 100644 index f673b7557..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/AttachmentXml.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocUtils/EnumConvertersXml.h" -#include "Doc/CafCoreTypesDoc/CafCoreTypesDocTypes.h" - -#include "Doc/CafCoreTypesDoc/CAttachmentDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/CafCoreTypesXml/AttachmentXml.h" - -using namespace Caf; - -void AttachmentXml::add( - const SmartPtrCAttachmentDoc attachmentDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("AttachmentXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(attachmentDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string nameVal = attachmentDoc->getName(); - CAF_CM_VALIDATE_STRING(nameVal); - thisXml->addAttribute("name", nameVal); - - const std::string typeVal = attachmentDoc->getType(); - CAF_CM_VALIDATE_STRING(typeVal); - thisXml->addAttribute("type", typeVal); - - const std::string uriVal = attachmentDoc->getUri(); - CAF_CM_VALIDATE_STRING(uriVal); - thisXml->addAttribute("uri", uriVal); - - const std::string isReferenceVal = attachmentDoc->getIsReference() ? "true" : "false"; - CAF_CM_VALIDATE_STRING(isReferenceVal); - thisXml->addAttribute("isReference", isReferenceVal); - - const CMS_POLICY cmsPolicyVal = attachmentDoc->getCmsPolicy(); - thisXml->addAttribute("cmsPolicy", EnumConvertersXml::convertCmsPolicyToString(cmsPolicyVal)); - } - CAF_CM_EXIT; -} - -SmartPtrCAttachmentDoc AttachmentXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("AttachmentXml", "parse"); - - SmartPtrCAttachmentDoc attachmentDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string nameStrVal = - thisXml->findRequiredAttribute("name"); - const std::string nameVal = nameStrVal; - - const std::string typeStrVal = - thisXml->findRequiredAttribute("type"); - const std::string typeVal = typeStrVal; - - const std::string uriStrVal = - thisXml->findRequiredAttribute("uri"); - const std::string uriVal = uriStrVal; - - const std::string isReferenceStrVal = - thisXml->findRequiredAttribute("isReference"); - bool isReferenceVal = false; - if (! isReferenceStrVal.empty()) { - isReferenceVal = (isReferenceStrVal.compare("true") == 0) ? true : false; - } - - CMS_POLICY cmsPolicyVal = CMS_POLICY_NONE; - const std::string cmsPolicyStr = thisXml->findOptionalAttribute("cmsPolicy"); - if (! cmsPolicyStr.empty()) { - cmsPolicyVal = EnumConvertersXml::convertStringToCmsPolicy(cmsPolicyStr); - } - - attachmentDoc.CreateInstance(); - attachmentDoc->initialize( - nameVal, - typeVal, - uriVal, - isReferenceVal, - cmsPolicyVal); - } - CAF_CM_EXIT; - - return attachmentDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/AuthnAuthzCollectionXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/AuthnAuthzCollectionXml.cpp deleted file mode 100644 index a2df80630..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/AuthnAuthzCollectionXml.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/CafCoreTypesDoc/CAuthnAuthzCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CAuthnAuthzDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/CafCoreTypesXml/AuthnAuthzCollectionXml.h" -#include "Doc/DocXml/CafCoreTypesXml/AuthnAuthzXml.h" - -using namespace Caf; - -void AuthnAuthzCollectionXml::add( - const SmartPtrCAuthnAuthzCollectionDoc authnAuthzCollectionDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("AuthnAuthzCollectionXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(authnAuthzCollectionDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::deque authnAuthzVal = - authnAuthzCollectionDoc->getAuthnAuthz(); - CAF_CM_VALIDATE_STL(authnAuthzVal); - - if (! authnAuthzVal.empty()) { - for (TConstIterator > authnAuthzIter(authnAuthzVal); - authnAuthzIter; authnAuthzIter++) { - const SmartPtrCXmlElement authnAuthzXml = - thisXml->createAndAddElement("authnAuthz"); - AuthnAuthzXml::add(*authnAuthzIter, authnAuthzXml); - } - } - } - CAF_CM_EXIT; -} - -SmartPtrCAuthnAuthzCollectionDoc AuthnAuthzCollectionXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("AuthnAuthzCollectionXml", "parse"); - - SmartPtrCAuthnAuthzCollectionDoc authnAuthzCollectionDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const CXmlElement::SmartPtrCElementCollection authnAuthzChildrenXml = - thisXml->findRequiredChildren("authnAuthz"); - - std::deque authnAuthzVal; - if (! authnAuthzChildrenXml.IsNull() && ! authnAuthzChildrenXml->empty()) { - for (TConstIterator authnAuthzXmlIter(*authnAuthzChildrenXml); - authnAuthzXmlIter; authnAuthzXmlIter++) { - const SmartPtrCXmlElement authnAuthzXml = authnAuthzXmlIter->second; - const SmartPtrCAuthnAuthzDoc authnAuthzDoc = - AuthnAuthzXml::parse(authnAuthzXml); - authnAuthzVal.push_back(authnAuthzDoc); - } - } - - authnAuthzCollectionDoc.CreateInstance(); - authnAuthzCollectionDoc->initialize( - authnAuthzVal); - } - CAF_CM_EXIT; - - return authnAuthzCollectionDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/AuthnAuthzXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/AuthnAuthzXml.cpp deleted file mode 100644 index decb55d3a..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/AuthnAuthzXml.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/CafCoreTypesDoc/CAuthnAuthzDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/CafCoreTypesXml/AuthnAuthzXml.h" - -using namespace Caf; - -void AuthnAuthzXml::add( - const SmartPtrCAuthnAuthzDoc authnAuthzDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("AuthnAuthzXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(authnAuthzDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string typeVal = authnAuthzDoc->getType(); - CAF_CM_VALIDATE_STRING(typeVal); - thisXml->addAttribute("type", typeVal); - - const std::string valueVal = authnAuthzDoc->getValue(); - CAF_CM_VALIDATE_STRING(valueVal); - const SmartPtrCXmlElement valueXml = - thisXml->createAndAddElement("value"); - valueXml->setValue(valueVal); - - const std::string nameVal = authnAuthzDoc->getName(); - if (! nameVal.empty()) { - thisXml->addAttribute("name", nameVal); - } - - const std::string sequenceNumberVal = - CStringConv::toString(authnAuthzDoc->getSequenceNumber()); - if (! sequenceNumberVal.empty()) { - thisXml->addAttribute("sequenceNumber", sequenceNumberVal); - } - } - CAF_CM_EXIT; -} - -SmartPtrCAuthnAuthzDoc AuthnAuthzXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("AuthnAuthzXml", "parse"); - - SmartPtrCAuthnAuthzDoc authnAuthzDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string typeVal = - thisXml->findRequiredAttribute("type"); - - const std::string valueVal = - thisXml->findRequiredChild("value")->getValue(); - - const std::string nameVal = - thisXml->findOptionalAttribute("name"); - - const std::string sequenceNumberStrVal = - thisXml->findOptionalAttribute("sequenceNumber"); - int32 sequenceNumberVal = 0; - if (! sequenceNumberStrVal.empty()) { - sequenceNumberVal = CStringConv::fromString(sequenceNumberStrVal); - } - - authnAuthzDoc.CreateInstance(); - authnAuthzDoc->initialize( - typeVal, - valueVal, - nameVal, - sequenceNumberVal); - } - CAF_CM_EXIT; - - return authnAuthzDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/ClassFiltersXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/ClassFiltersXml.cpp deleted file mode 100644 index 6c11b829f..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/ClassFiltersXml.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/CafCoreTypesDoc/CClassFiltersDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/CafCoreTypesXml/ClassFiltersXml.h" - -using namespace Caf; - -void ClassFiltersXml::add( - const SmartPtrCClassFiltersDoc classFiltersDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("ClassFiltersXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(classFiltersDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string dialectVal = classFiltersDoc->getDialect(); - CAF_CM_VALIDATE_STRING(dialectVal); - thisXml->addAttribute("dialect", dialectVal); - - const std::deque classFilterVal = - classFiltersDoc->getClassFilter(); - CAF_CM_VALIDATE_STL(classFilterVal); - - if (! classFilterVal.empty()) { - for (TConstIterator > classFilterIter(classFilterVal); - classFilterIter; classFilterIter++) { - const SmartPtrCXmlElement classFilterXml = - thisXml->createAndAddElement("classFilter"); - classFilterXml->setValue(*classFilterIter); - } - } - } - CAF_CM_EXIT; -} - -SmartPtrCClassFiltersDoc ClassFiltersXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("ClassFiltersXml", "parse"); - - SmartPtrCClassFiltersDoc classFiltersDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string dialectStrVal = - thisXml->findRequiredAttribute("dialect"); - const std::string dialectVal = dialectStrVal; - - const CXmlElement::SmartPtrCElementCollection classFilterChildrenXml = - thisXml->findRequiredChildren("classFilter"); - - std::deque classFilterVal; - if (! classFilterChildrenXml.IsNull() && ! classFilterChildrenXml->empty()) { - for (TConstIterator classFilterXmlIter(*classFilterChildrenXml); - classFilterXmlIter; classFilterXmlIter++) { - const SmartPtrCXmlElement classFilterXml = classFilterXmlIter->second; - const std::string classFilterDoc = classFilterXml->getValue(); - classFilterVal.push_back(classFilterDoc); - } - } - - classFiltersDoc.CreateInstance(); - classFiltersDoc->initialize( - dialectVal, - classFilterVal); - } - CAF_CM_EXIT; - - return classFiltersDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/ClassSpecifierXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/ClassSpecifierXml.cpp deleted file mode 100644 index 95cd10cd5..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/ClassSpecifierXml.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/CafCoreTypesDoc/CClassFiltersDoc.h" -#include "Doc/CafCoreTypesDoc/CClassSpecifierDoc.h" -#include "Doc/CafCoreTypesDoc/CFullyQualifiedClassGroupDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/CafCoreTypesXml/ClassSpecifierXml.h" -#include "Doc/DocXml/CafCoreTypesXml/FullyQualifiedClassGroupXml.h" -#include "Doc/DocXml/CafCoreTypesXml/ClassFiltersXml.h" - -using namespace Caf; - -void ClassSpecifierXml::add( - const SmartPtrCClassSpecifierDoc classSpecifierDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("ClassSpecifierXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(classSpecifierDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const SmartPtrCFullyQualifiedClassGroupDoc fullyQualifiedClassVal = - classSpecifierDoc->getFullyQualifiedClass(); - if (! fullyQualifiedClassVal.IsNull()) { - const SmartPtrCXmlElement fullyQualifiedClassXml = - thisXml->createAndAddElement("fullyQualifiedClass"); - FullyQualifiedClassGroupXml::add(fullyQualifiedClassVal, fullyQualifiedClassXml); - } - - const SmartPtrCClassFiltersDoc classFiltersVal = - classSpecifierDoc->getClassFilters(); - if (! classFiltersVal.IsNull()) { - const SmartPtrCXmlElement classFiltersXml = - thisXml->createAndAddElement("classFilters"); - ClassFiltersXml::add(classFiltersVal, classFiltersXml); - } - } - CAF_CM_EXIT; -} - -SmartPtrCClassSpecifierDoc ClassSpecifierXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("ClassSpecifierXml", "parse"); - - SmartPtrCClassSpecifierDoc classSpecifierDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const SmartPtrCXmlElement fullyQualifiedClassXml = - thisXml->findOptionalChild("fullyQualifiedClass"); - - SmartPtrCFullyQualifiedClassGroupDoc fullyQualifiedClassVal; - if (! fullyQualifiedClassXml.IsNull()) { - fullyQualifiedClassVal = FullyQualifiedClassGroupXml::parse(fullyQualifiedClassXml); - } - - const SmartPtrCXmlElement classFiltersXml = - thisXml->findOptionalChild("classFilters"); - - SmartPtrCClassFiltersDoc classFiltersVal; - if (! classFiltersXml.IsNull()) { - classFiltersVal = ClassFiltersXml::parse(classFiltersXml); - } - - classSpecifierDoc.CreateInstance(); - classSpecifierDoc->initialize( - fullyQualifiedClassVal, - classFiltersVal); - } - CAF_CM_EXIT; - - return classSpecifierDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/FullyQualifiedClassGroupXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/FullyQualifiedClassGroupXml.cpp deleted file mode 100644 index d0d298daa..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/FullyQualifiedClassGroupXml.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/CafCoreTypesDoc/CFullyQualifiedClassGroupDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/CafCoreTypesXml/FullyQualifiedClassGroupXml.h" - -using namespace Caf; - -void FullyQualifiedClassGroupXml::add( - const SmartPtrCFullyQualifiedClassGroupDoc fullyQualifiedClassGroupDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("FullyQualifiedClassGroupXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(fullyQualifiedClassGroupDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string classNamespaceVal = fullyQualifiedClassGroupDoc->getClassNamespace(); - CAF_CM_VALIDATE_STRING(classNamespaceVal); - thisXml->addAttribute("classNamespace", classNamespaceVal); - - const std::string classNameVal = fullyQualifiedClassGroupDoc->getClassName(); - CAF_CM_VALIDATE_STRING(classNameVal); - thisXml->addAttribute("className", classNameVal); - - const std::string classVersionVal = fullyQualifiedClassGroupDoc->getClassVersion(); - CAF_CM_VALIDATE_STRING(classVersionVal); - thisXml->addAttribute("classVersion", classVersionVal); - } - CAF_CM_EXIT; -} - -SmartPtrCFullyQualifiedClassGroupDoc FullyQualifiedClassGroupXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("FullyQualifiedClassGroupXml", "parse"); - - SmartPtrCFullyQualifiedClassGroupDoc fullyQualifiedClassGroupDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string classNamespaceStrVal = - thisXml->findRequiredAttribute("classNamespace"); - const std::string classNamespaceVal = classNamespaceStrVal; - - const std::string classNameStrVal = - thisXml->findRequiredAttribute("className"); - const std::string classNameVal = classNameStrVal; - - const std::string classVersionStrVal = - thisXml->findRequiredAttribute("classVersion"); - const std::string classVersionVal = classVersionStrVal; - - fullyQualifiedClassGroupDoc.CreateInstance(); - fullyQualifiedClassGroupDoc->initialize( - classNamespaceVal, - classNameVal, - classVersionVal); - } - CAF_CM_EXIT; - - return fullyQualifiedClassGroupDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/LoggingLevelCollectionXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/LoggingLevelCollectionXml.cpp deleted file mode 100644 index 7054975ea..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/LoggingLevelCollectionXml.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/CafCoreTypesDoc/CLoggingLevelCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CLoggingLevelElemDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/CafCoreTypesXml/LoggingLevelCollectionXml.h" -#include "Doc/DocXml/CafCoreTypesXml/LoggingLevelElemXml.h" - -using namespace Caf; - -void LoggingLevelCollectionXml::add( - const SmartPtrCLoggingLevelCollectionDoc loggingLevelCollectionDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("LoggingLevelCollectionXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(loggingLevelCollectionDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::deque loggingLevelVal = - loggingLevelCollectionDoc->getLoggingLevel(); - CAF_CM_VALIDATE_STL(loggingLevelVal); - - if (! loggingLevelVal.empty()) { - for (TConstIterator > loggingLevelIter(loggingLevelVal); - loggingLevelIter; loggingLevelIter++) { - const SmartPtrCXmlElement loggingLevelXml = - thisXml->createAndAddElement("loggingLevel"); - LoggingLevelElemXml::add(*loggingLevelIter, loggingLevelXml); - } - } - } - CAF_CM_EXIT; -} - -SmartPtrCLoggingLevelCollectionDoc LoggingLevelCollectionXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("LoggingLevelCollectionXml", "parse"); - - SmartPtrCLoggingLevelCollectionDoc loggingLevelCollectionDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const CXmlElement::SmartPtrCElementCollection loggingLevelChildrenXml = - thisXml->findRequiredChildren("loggingLevel"); - - std::deque loggingLevelVal; - if (! loggingLevelChildrenXml.IsNull() && ! loggingLevelChildrenXml->empty()) { - for (TConstIterator loggingLevelXmlIter(*loggingLevelChildrenXml); - loggingLevelXmlIter; loggingLevelXmlIter++) { - const SmartPtrCXmlElement loggingLevelXml = loggingLevelXmlIter->second; - const SmartPtrCLoggingLevelElemDoc loggingLevelDoc = - LoggingLevelElemXml::parse(loggingLevelXml); - loggingLevelVal.push_back(loggingLevelDoc); - } - } - - loggingLevelCollectionDoc.CreateInstance(); - loggingLevelCollectionDoc->initialize( - loggingLevelVal); - } - CAF_CM_EXIT; - - return loggingLevelCollectionDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/LoggingLevelElemXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/LoggingLevelElemXml.cpp deleted file mode 100644 index 50cc299c5..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/LoggingLevelElemXml.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocUtils/EnumConvertersXml.h" -#include "Doc/CafCoreTypesDoc/CafCoreTypesDocTypes.h" - -#include "Doc/CafCoreTypesDoc/CLoggingLevelElemDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/CafCoreTypesXml/LoggingLevelElemXml.h" - -using namespace Caf; - -void LoggingLevelElemXml::add( - const SmartPtrCLoggingLevelElemDoc loggingLevelElemDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("LoggingLevelElemXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(loggingLevelElemDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string componentVal = - EnumConvertersXml::convertLoggingComponentTypeToString(loggingLevelElemDoc->getComponent()); - CAF_CM_VALIDATE_STRING(componentVal); - thisXml->addAttribute("component", componentVal); - - const std::string levelVal = - EnumConvertersXml::convertLoggingLevelTypeToString(loggingLevelElemDoc->getLevel()); - CAF_CM_VALIDATE_STRING(levelVal); - thisXml->addAttribute("level", levelVal); - } - CAF_CM_EXIT; -} - -SmartPtrCLoggingLevelElemDoc LoggingLevelElemXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("LoggingLevelElemXml", "parse"); - - SmartPtrCLoggingLevelElemDoc loggingLevelElemDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string componentStrVal = - thisXml->findRequiredAttribute("component"); - LOGGINGCOMPONENT_TYPE componentVal = LOGGINGCOMPONENT_NONE; - if (! componentStrVal.empty()) { - componentVal = EnumConvertersXml::convertStringToLoggingComponentType(componentStrVal); - } - - const std::string levelStrVal = - thisXml->findRequiredAttribute("level"); - LOGGINGLEVEL_TYPE levelVal = LOGGINGLEVEL_NONE; - if (! levelStrVal.empty()) { - levelVal = EnumConvertersXml::convertStringToLoggingLevelType(levelStrVal); - } - - loggingLevelElemDoc.CreateInstance(); - loggingLevelElemDoc->initialize( - componentVal, - levelVal); - } - CAF_CM_EXIT; - - return loggingLevelElemDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/OperationXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/OperationXml.cpp deleted file mode 100644 index 8c17d0ea8..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/OperationXml.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/CafCoreTypesDoc/COperationDoc.h" -#include "Doc/CafCoreTypesDoc/CParameterCollectionDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/CafCoreTypesXml/OperationXml.h" -#include "Doc/DocXml/CafCoreTypesXml/ParameterCollectionXml.h" - -using namespace Caf; - -void OperationXml::add( - const SmartPtrCOperationDoc operationDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("OperationXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(operationDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string nameVal = operationDoc->getName(); - CAF_CM_VALIDATE_STRING(nameVal); - thisXml->addAttribute("name", nameVal); - - const SmartPtrCParameterCollectionDoc parameterCollectionVal = - operationDoc->getParameterCollection(); - if (! parameterCollectionVal.IsNull()) { - const SmartPtrCXmlElement parameterCollectionXml = - thisXml->createAndAddElement("parameterCollection"); - ParameterCollectionXml::add(parameterCollectionVal, parameterCollectionXml); - } - } - CAF_CM_EXIT; -} - -SmartPtrCOperationDoc OperationXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("OperationXml", "parse"); - - SmartPtrCOperationDoc operationDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string nameStrVal = - thisXml->findRequiredAttribute("name"); - const std::string nameVal = nameStrVal; - - const SmartPtrCXmlElement parameterCollectionXml = - thisXml->findOptionalChild("parameterCollection"); - - SmartPtrCParameterCollectionDoc parameterCollectionVal; - if (! parameterCollectionXml.IsNull()) { - parameterCollectionVal = ParameterCollectionXml::parse(parameterCollectionXml); - } - - operationDoc.CreateInstance(); - operationDoc->initialize( - nameVal, - parameterCollectionVal); - } - CAF_CM_EXIT; - - return operationDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/ParameterCollectionXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/ParameterCollectionXml.cpp deleted file mode 100644 index 3b29f61a4..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/ParameterCollectionXml.cpp +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/CafCoreTypesDoc/CParameterCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CRequestInstanceParameterDoc.h" -#include "Doc/CafCoreTypesDoc/CRequestParameterDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/CafCoreTypesXml/ParameterCollectionXml.h" -#include "Doc/DocXml/CafCoreTypesXml/RequestParameterXml.h" -#include "Doc/DocXml/CafCoreTypesXml/RequestInstanceParameterXml.h" -#include "Doc/DocXml/CafCoreTypesXml/RequestParameterXml.h" - -using namespace Caf; - -void ParameterCollectionXml::add( - const SmartPtrCParameterCollectionDoc parameterCollectionDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("ParameterCollectionXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(parameterCollectionDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::deque parameterVal = - parameterCollectionDoc->getParameter(); - if (! parameterVal.empty()) { - for (TConstIterator > parameterIter(parameterVal); - parameterIter; parameterIter++) { - const SmartPtrCXmlElement parameterXml = - thisXml->createAndAddElement("parameter"); - RequestParameterXml::add(*parameterIter, parameterXml); - } - } - - const std::deque instanceParameterVal = - parameterCollectionDoc->getInstanceParameter(); - if (! instanceParameterVal.empty()) { - for (TConstIterator > instanceParameterIter(instanceParameterVal); - instanceParameterIter; instanceParameterIter++) { - const SmartPtrCXmlElement instanceParameterXml = - thisXml->createAndAddElement("instanceParameter"); - RequestInstanceParameterXml::add(*instanceParameterIter, instanceParameterXml); - } - } - } - CAF_CM_EXIT; -} - -SmartPtrCParameterCollectionDoc ParameterCollectionXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("ParameterCollectionXml", "parse"); - - SmartPtrCParameterCollectionDoc parameterCollectionDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const CXmlElement::SmartPtrCElementCollection parameterChildrenXml = - thisXml->findOptionalChildren("parameter"); - - std::deque parameterVal; - if (! parameterChildrenXml.IsNull() && ! parameterChildrenXml->empty()) { - for (TConstIterator parameterXmlIter(*parameterChildrenXml); - parameterXmlIter; parameterXmlIter++) { - const SmartPtrCXmlElement parameterXml = parameterXmlIter->second; - const SmartPtrCRequestParameterDoc parameterDoc = - RequestParameterXml::parse(parameterXml); - parameterVal.push_back(parameterDoc); - } - } - - const CXmlElement::SmartPtrCElementCollection instanceParameterChildrenXml = - thisXml->findOptionalChildren("instanceParameter"); - - std::deque instanceParameterVal; - if (! instanceParameterChildrenXml.IsNull() && ! instanceParameterChildrenXml->empty()) { - for (TConstIterator instanceParameterXmlIter(*instanceParameterChildrenXml); - instanceParameterXmlIter; instanceParameterXmlIter++) { - const SmartPtrCXmlElement instanceParameterXml = instanceParameterXmlIter->second; - const SmartPtrCRequestInstanceParameterDoc instanceParameterDoc = - RequestInstanceParameterXml::parse(instanceParameterXml); - instanceParameterVal.push_back(instanceParameterDoc); - } - } - - parameterCollectionDoc.CreateInstance(); - parameterCollectionDoc->initialize( - parameterVal, - instanceParameterVal); - } - CAF_CM_EXIT; - - return parameterCollectionDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/PropertyCollectionXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/PropertyCollectionXml.cpp deleted file mode 100644 index 9a2f9b839..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/PropertyCollectionXml.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/CafCoreTypesDoc/CPropertyCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CPropertyDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/CafCoreTypesXml/PropertyCollectionXml.h" -#include "Doc/DocXml/CafCoreTypesXml/PropertyXml.h" - -using namespace Caf; - -void PropertyCollectionXml::add( - const SmartPtrCPropertyCollectionDoc propertyCollectionDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("PropertyCollectionXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(propertyCollectionDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::deque propertyVal = - propertyCollectionDoc->getProperty(); - CAF_CM_VALIDATE_STL(propertyVal); - - if (! propertyVal.empty()) { - for (TConstIterator > propertyIter(propertyVal); - propertyIter; propertyIter++) { - const SmartPtrCXmlElement propertyXml = - thisXml->createAndAddElement("property"); - PropertyXml::add(*propertyIter, propertyXml); - } - } - } - CAF_CM_EXIT; -} - -SmartPtrCPropertyCollectionDoc PropertyCollectionXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("PropertyCollectionXml", "parse"); - - SmartPtrCPropertyCollectionDoc propertyCollectionDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const CXmlElement::SmartPtrCElementCollection propertyChildrenXml = - thisXml->findRequiredChildren("property"); - - std::deque propertyVal; - if (! propertyChildrenXml.IsNull() && ! propertyChildrenXml->empty()) { - for (TConstIterator propertyXmlIter(*propertyChildrenXml); - propertyXmlIter; propertyXmlIter++) { - const SmartPtrCXmlElement propertyXml = propertyXmlIter->second; - const SmartPtrCPropertyDoc propertyDoc = - PropertyXml::parse(propertyXml); - propertyVal.push_back(propertyDoc); - } - } - - propertyCollectionDoc.CreateInstance(); - propertyCollectionDoc->initialize( - propertyVal); - } - CAF_CM_EXIT; - - return propertyCollectionDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/PropertyXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/PropertyXml.cpp deleted file mode 100644 index 1feb87614..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/PropertyXml.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocUtils/EnumConvertersXml.h" -#include "Doc/CafCoreTypesDoc/CafCoreTypesDocTypes.h" - -#include "Doc/CafCoreTypesDoc/CPropertyDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/CafCoreTypesXml/PropertyXml.h" - -using namespace Caf; - -void PropertyXml::add( - const SmartPtrCPropertyDoc propertyDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("PropertyXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(propertyDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string nameVal = propertyDoc->getName(); - CAF_CM_VALIDATE_STRING(nameVal); - thisXml->addAttribute("name", nameVal); - - const std::string typeVal = - EnumConvertersXml::convertPropertyTypeToString(propertyDoc->getType()); - CAF_CM_VALIDATE_STRING(typeVal); - thisXml->addAttribute("type", typeVal); - - const std::deque valueVal = - propertyDoc->getValue(); - CAF_CM_VALIDATE_STL(valueVal); - - if (! valueVal.empty()) { - for (TConstIterator > valueIter(valueVal); - valueIter; valueIter++) { - const SmartPtrCXmlElement valueXml = - thisXml->createAndAddElement("value"); - valueXml->setValue(*valueIter); - } - } - } - CAF_CM_EXIT; -} - -SmartPtrCPropertyDoc PropertyXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("PropertyXml", "parse"); - - SmartPtrCPropertyDoc propertyDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string nameStrVal = - thisXml->findRequiredAttribute("name"); - const std::string nameVal = nameStrVal; - - const std::string typeStrVal = - thisXml->findRequiredAttribute("type"); - PROPERTY_TYPE typeVal = PROPERTY_NONE; - if (! typeStrVal.empty()) { - typeVal = EnumConvertersXml::convertStringToPropertyType(typeStrVal); - } - - const CXmlElement::SmartPtrCElementCollection valueChildrenXml = - thisXml->findRequiredChildren("value"); - - std::deque valueVal; - if (! valueChildrenXml.IsNull() && ! valueChildrenXml->empty()) { - for (TConstIterator valueXmlIter(*valueChildrenXml); - valueXmlIter; valueXmlIter++) { - const SmartPtrCXmlElement valueXml = valueXmlIter->second; - const std::string valueDoc = valueXml->getValue(); - valueVal.push_back(valueDoc); - } - } - - propertyDoc.CreateInstance(); - propertyDoc->initialize( - nameVal, - typeVal, - valueVal); - } - CAF_CM_EXIT; - - return propertyDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/ProtocolCollectionXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/ProtocolCollectionXml.cpp deleted file mode 100644 index 0bf26b654..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/ProtocolCollectionXml.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/CafCoreTypesDoc/CProtocolCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CProtocolDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/CafCoreTypesXml/ProtocolCollectionXml.h" -#include "Doc/DocXml/CafCoreTypesXml/ProtocolXml.h" - -using namespace Caf; - -void ProtocolCollectionXml::add( - const SmartPtrCProtocolCollectionDoc protocolCollectionDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("ProtocolCollectionXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(protocolCollectionDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::deque protocolVal = - protocolCollectionDoc->getProtocol(); - CAF_CM_VALIDATE_STL(protocolVal); - - if (! protocolVal.empty()) { - for (TConstIterator > protocolIter(protocolVal); - protocolIter; protocolIter++) { - const SmartPtrCXmlElement protocolXml = - thisXml->createAndAddElement("protocol"); - ProtocolXml::add(*protocolIter, protocolXml); - } - } - } - CAF_CM_EXIT; -} - -SmartPtrCProtocolCollectionDoc ProtocolCollectionXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("ProtocolCollectionXml", "parse"); - - SmartPtrCProtocolCollectionDoc protocolCollectionDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const CXmlElement::SmartPtrCElementCollection protocolChildrenXml = - thisXml->findRequiredChildren("protocol"); - - std::deque protocolVal; - if (! protocolChildrenXml.IsNull() && ! protocolChildrenXml->empty()) { - for (TConstIterator protocolXmlIter(*protocolChildrenXml); - protocolXmlIter; protocolXmlIter++) { - const SmartPtrCXmlElement protocolXml = protocolXmlIter->second; - const SmartPtrCProtocolDoc protocolDoc = - ProtocolXml::parse(protocolXml); - protocolVal.push_back(protocolDoc); - } - } - - protocolCollectionDoc.CreateInstance(); - protocolCollectionDoc->initialize( - protocolVal); - } - CAF_CM_EXIT; - - return protocolCollectionDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/ProtocolXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/ProtocolXml.cpp deleted file mode 100644 index 46fe2a82a..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/ProtocolXml.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/CafCoreTypesDoc/CProtocolDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/CafCoreTypesXml/ProtocolXml.h" - -using namespace Caf; - -void ProtocolXml::add( - const SmartPtrCProtocolDoc protocolDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("ProtocolXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(protocolDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string uriVal = protocolDoc->getUri(); - CAF_CM_VALIDATE_STRING(uriVal); - thisXml->addAttribute("uri", uriVal); - - const std::string nameVal = protocolDoc->getName(); - if (! nameVal.empty()) { - thisXml->addAttribute("name", nameVal); - } - - const std::string sequenceNumberVal = - CStringConv::toString(protocolDoc->getSequenceNumber()); - if (! sequenceNumberVal.empty()) { - thisXml->addAttribute("sequenceNumber", sequenceNumberVal); - } - } - CAF_CM_EXIT; -} - -SmartPtrCProtocolDoc ProtocolXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("ProtocolXml", "parse"); - - SmartPtrCProtocolDoc protocolDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string uriVal = - thisXml->findRequiredAttribute("uri"); - - const std::string nameVal = - thisXml->findOptionalAttribute("name"); - - const std::string sequenceNumberStrVal = - thisXml->findOptionalAttribute("sequenceNumber"); - int32 sequenceNumberVal = 0; - if (! sequenceNumberStrVal.empty()) { - sequenceNumberVal = CStringConv::fromString(sequenceNumberStrVal); - } - - protocolDoc.CreateInstance(); - protocolDoc->initialize( - uriVal, - nameVal, - sequenceNumberVal); - } - CAF_CM_EXIT; - - return protocolDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/RequestConfigXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/RequestConfigXml.cpp deleted file mode 100644 index 3f2cad764..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/RequestConfigXml.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/CafCoreTypesDoc/CAddInsDoc.h" -#include "Doc/CafCoreTypesDoc/CLoggingLevelCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CRequestConfigDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/CafCoreTypesXml/RequestConfigXml.h" -#include "Doc/DocXml/CafCoreTypesXml/AddInsXml.h" -#include "Doc/DocXml/CafCoreTypesXml/LoggingLevelCollectionXml.h" - -using namespace Caf; - -void RequestConfigXml::add( - const SmartPtrCRequestConfigDoc requestConfigDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("RequestConfigXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(requestConfigDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string responseFormatTypeVal = requestConfigDoc->getResponseFormatType(); - CAF_CM_VALIDATE_STRING(responseFormatTypeVal); - thisXml->addAttribute("responseFormatType", responseFormatTypeVal); - - const SmartPtrCAddInsDoc requestProcessorAddInsVal = - requestConfigDoc->getRequestProcessorAddIns(); - if (! requestProcessorAddInsVal.IsNull()) { - const SmartPtrCXmlElement requestProcessorAddInsXml = - thisXml->createAndAddElement("requestProcessorAddIns"); - AddInsXml::add(requestProcessorAddInsVal, requestProcessorAddInsXml); - } - - const SmartPtrCAddInsDoc responseProcessorAddInsVal = - requestConfigDoc->getResponseProcessorAddIns(); - if (! responseProcessorAddInsVal.IsNull()) { - const SmartPtrCXmlElement responseProcessorAddInsXml = - thisXml->createAndAddElement("responseProcessorAddIns"); - AddInsXml::add(responseProcessorAddInsVal, responseProcessorAddInsXml); - } - - const SmartPtrCLoggingLevelCollectionDoc loggingLevelCollectionVal = - requestConfigDoc->getLoggingLevelCollection(); - if (! loggingLevelCollectionVal.IsNull()) { - const SmartPtrCXmlElement loggingLevelCollectionXml = - thisXml->createAndAddElement("loggingLevelCollection"); - LoggingLevelCollectionXml::add(loggingLevelCollectionVal, loggingLevelCollectionXml); - } - } - CAF_CM_EXIT; -} - -SmartPtrCRequestConfigDoc RequestConfigXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("RequestConfigXml", "parse"); - - SmartPtrCRequestConfigDoc requestConfigDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string responseFormatTypeStrVal = - thisXml->findRequiredAttribute("responseFormatType"); - const std::string responseFormatTypeVal = responseFormatTypeStrVal; - - const SmartPtrCXmlElement requestProcessorAddInsXml = - thisXml->findOptionalChild("requestProcessorAddIns"); - - SmartPtrCAddInsDoc requestProcessorAddInsVal; - if (! requestProcessorAddInsXml.IsNull()) { - requestProcessorAddInsVal = AddInsXml::parse(requestProcessorAddInsXml); - } - - const SmartPtrCXmlElement responseProcessorAddInsXml = - thisXml->findOptionalChild("responseProcessorAddIns"); - - SmartPtrCAddInsDoc responseProcessorAddInsVal; - if (! responseProcessorAddInsXml.IsNull()) { - responseProcessorAddInsVal = AddInsXml::parse(responseProcessorAddInsXml); - } - - const SmartPtrCXmlElement loggingLevelCollectionXml = - thisXml->findOptionalChild("loggingLevelCollection"); - - SmartPtrCLoggingLevelCollectionDoc loggingLevelCollectionVal; - if (! loggingLevelCollectionXml.IsNull()) { - loggingLevelCollectionVal = LoggingLevelCollectionXml::parse(loggingLevelCollectionXml); - } - - requestConfigDoc.CreateInstance(); - requestConfigDoc->initialize( - responseFormatTypeVal, - requestProcessorAddInsVal, - responseProcessorAddInsVal, - loggingLevelCollectionVal); - } - CAF_CM_EXIT; - - return requestConfigDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/RequestHeaderXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/RequestHeaderXml.cpp deleted file mode 100644 index f55e69864..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/RequestHeaderXml.cpp +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/CafCoreTypesDoc/CAuthnAuthzCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CPropertyCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CProtocolCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CRequestConfigDoc.h" -#include "Doc/CafCoreTypesDoc/CRequestHeaderDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/CafCoreTypesXml/RequestHeaderXml.h" -#include "Doc/DocXml/CafCoreTypesXml/RequestConfigXml.h" -#include "Doc/DocXml/CafCoreTypesXml/AuthnAuthzCollectionXml.h" -#include "Doc/DocXml/CafCoreTypesXml/ProtocolCollectionXml.h" -#include "Doc/DocXml/CafCoreTypesXml/PropertyCollectionXml.h" - -using namespace Caf; - -void RequestHeaderXml::add( - const SmartPtrCRequestHeaderDoc requestHeaderDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("RequestHeaderXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(requestHeaderDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const SmartPtrCRequestConfigDoc requestConfigVal = - requestHeaderDoc->getRequestConfig(); - CAF_CM_VALIDATE_SMARTPTR(requestConfigVal); - - const SmartPtrCXmlElement requestConfigXml = - thisXml->createAndAddElement("requestConfig"); - RequestConfigXml::add(requestConfigVal, requestConfigXml); - - const SmartPtrCAuthnAuthzCollectionDoc authnAuthzCollectionVal = - requestHeaderDoc->getAuthnAuthzCollection(); - if (! authnAuthzCollectionVal.IsNull()) { - const SmartPtrCXmlElement authnAuthzCollectionXml = - thisXml->createAndAddElement("authnAuthzCollection"); - AuthnAuthzCollectionXml::add(authnAuthzCollectionVal, authnAuthzCollectionXml); - } - - const SmartPtrCProtocolCollectionDoc protocolCollectionVal = - requestHeaderDoc->getProtocolCollection(); - if (! protocolCollectionVal.IsNull()) { - const SmartPtrCXmlElement protocolCollectionXml = - thisXml->createAndAddElement("protocolCollection"); - ProtocolCollectionXml::add(protocolCollectionVal, protocolCollectionXml); - } - - const SmartPtrCPropertyCollectionDoc echoPropertyBagVal = - requestHeaderDoc->getEchoPropertyBag(); - if (! echoPropertyBagVal.IsNull()) { - const SmartPtrCXmlElement echoPropertyBagXml = - thisXml->createAndAddElement("echoPropertyBag"); - PropertyCollectionXml::add(echoPropertyBagVal, echoPropertyBagXml); - } - - const std::string versionVal = requestHeaderDoc->getVersion(); - CAF_CM_VALIDATE_STRING(versionVal); - thisXml->addAttribute("version", versionVal); - - const std::string createdDateTimeVal = requestHeaderDoc->getCreatedDateTime(); - CAF_CM_VALIDATE_STRING(createdDateTimeVal); - thisXml->addAttribute("createdDateTime", createdDateTimeVal); - - const std::string sessionIdVal = - BasePlatform::UuidToString(requestHeaderDoc->getSessionId()); - if (! sessionIdVal.empty()) { - thisXml->addAttribute("sessionId", sessionIdVal); - } - } - CAF_CM_EXIT; -} - -SmartPtrCRequestHeaderDoc RequestHeaderXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("RequestHeaderXml", "parse"); - - SmartPtrCRequestHeaderDoc requestHeaderDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const SmartPtrCXmlElement requestConfigXml = - thisXml->findRequiredChild("requestConfig"); - - SmartPtrCRequestConfigDoc requestConfigVal; - if (! requestConfigXml.IsNull()) { - requestConfigVal = RequestConfigXml::parse(requestConfigXml); - } - - const SmartPtrCXmlElement authnAuthzCollectionXml = - thisXml->findOptionalChild("authnAuthzCollection"); - - SmartPtrCAuthnAuthzCollectionDoc authnAuthzCollectionVal; - if (! authnAuthzCollectionXml.IsNull()) { - authnAuthzCollectionVal = AuthnAuthzCollectionXml::parse(authnAuthzCollectionXml); - } - - const SmartPtrCXmlElement protocolCollectionXml = - thisXml->findOptionalChild("protocolCollection"); - - SmartPtrCProtocolCollectionDoc protocolCollectionVal; - if (! protocolCollectionXml.IsNull()) { - protocolCollectionVal = ProtocolCollectionXml::parse(protocolCollectionXml); - } - - const SmartPtrCXmlElement echoPropertyBagXml = - thisXml->findOptionalChild("echoPropertyBag"); - - SmartPtrCPropertyCollectionDoc echoPropertyBagVal; - if (! echoPropertyBagXml.IsNull()) { - echoPropertyBagVal = PropertyCollectionXml::parse(echoPropertyBagXml); - } - - const std::string versionVal = - thisXml->findRequiredAttribute("version"); - - const std::string createdDateTimeVal = - thisXml->findRequiredAttribute("createdDateTime"); - - const std::string sessionIdStrVal = - thisXml->findOptionalAttribute("sessionId"); - UUID sessionIdVal = CAFCOMMON_GUID_NULL; - if (! sessionIdStrVal.empty()) { - BasePlatform::UuidFromString(sessionIdStrVal.c_str(), sessionIdVal); - } - - requestHeaderDoc.CreateInstance(); - requestHeaderDoc->initialize( - requestConfigVal, - authnAuthzCollectionVal, - protocolCollectionVal, - echoPropertyBagVal, - versionVal, - createdDateTimeVal, - sessionIdVal); - } - CAF_CM_EXIT; - - return requestHeaderDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/RequestInstanceParameterXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/RequestInstanceParameterXml.cpp deleted file mode 100644 index 1cbe4e208..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/RequestInstanceParameterXml.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/CafCoreTypesDoc/CRequestInstanceParameterDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/CafCoreTypesXml/RequestInstanceParameterXml.h" - -using namespace Caf; - -void RequestInstanceParameterXml::add( - const SmartPtrCRequestInstanceParameterDoc requestInstanceParameterDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("RequestInstanceParameterXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(requestInstanceParameterDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string nameVal = requestInstanceParameterDoc->getName(); - CAF_CM_VALIDATE_STRING(nameVal); - thisXml->addAttribute("name", nameVal); - - const std::string classNamespaceVal = requestInstanceParameterDoc->getClassNamespace(); - CAF_CM_VALIDATE_STRING(classNamespaceVal); - thisXml->addAttribute("classNamespace", classNamespaceVal); - - const std::string classNameVal = requestInstanceParameterDoc->getClassName(); - CAF_CM_VALIDATE_STRING(classNameVal); - thisXml->addAttribute("className", classNameVal); - - const std::string classVersionVal = requestInstanceParameterDoc->getClassVersion(); - CAF_CM_VALIDATE_STRING(classVersionVal); - thisXml->addAttribute("classVersion", classVersionVal); - - const std::deque valueVal = - requestInstanceParameterDoc->getValue(); - if (! valueVal.empty()) { - for (TConstIterator > valueIter(valueVal); - valueIter; valueIter++) { - thisXml->appendValue(*valueIter); - } - } - } - CAF_CM_EXIT; -} - -SmartPtrCRequestInstanceParameterDoc RequestInstanceParameterXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("RequestInstanceParameterXml", "parse"); - - SmartPtrCRequestInstanceParameterDoc requestInstanceParameterDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string nameStrVal = - thisXml->findRequiredAttribute("name"); - const std::string nameVal = nameStrVal; - - const std::string classNamespaceStrVal = - thisXml->findRequiredAttribute("classNamespace"); - const std::string classNamespaceVal = classNamespaceStrVal; - - const std::string classNameStrVal = - thisXml->findRequiredAttribute("className"); - const std::string classNameVal = classNameStrVal; - - const std::string classVersionStrVal = - thisXml->findRequiredAttribute("classVersion"); - const std::string classVersionVal = classVersionStrVal; - - const CXmlElement::SmartPtrCElementCollection valueChildrenXml = - thisXml->getAllChildren(); - - std::deque valueVal; - if (! valueChildrenXml.IsNull() && ! valueChildrenXml->empty()) { - for (TConstIterator valueXmlIter(*valueChildrenXml); - valueXmlIter; valueXmlIter++) { - const SmartPtrCXmlElement valueXml = valueXmlIter->second; - const std::string valueDoc = valueXml->saveToStringRaw(); - valueVal.push_back(valueDoc); - } - } - - requestInstanceParameterDoc.CreateInstance(); - requestInstanceParameterDoc->initialize( - nameVal, - classNamespaceVal, - classNameVal, - classVersionVal, - valueVal); - } - CAF_CM_EXIT; - - return requestInstanceParameterDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/RequestParameterXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/RequestParameterXml.cpp deleted file mode 100644 index 27e787287..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/RequestParameterXml.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocUtils/EnumConvertersXml.h" -#include "Doc/CafCoreTypesDoc/CafCoreTypesDocTypes.h" - -#include "Doc/CafCoreTypesDoc/CRequestParameterDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/CafCoreTypesXml/RequestParameterXml.h" - -using namespace Caf; - -void RequestParameterXml::add( - const SmartPtrCRequestParameterDoc requestParameterDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("RequestParameterXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(requestParameterDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string nameVal = requestParameterDoc->getName(); - CAF_CM_VALIDATE_STRING(nameVal); - thisXml->addAttribute("name", nameVal); - - const std::string typeVal = - EnumConvertersXml::convertParameterTypeToString(requestParameterDoc->getType()); - CAF_CM_VALIDATE_STRING(typeVal); - thisXml->addAttribute("type", typeVal); - - const std::deque valueVal = - requestParameterDoc->getValue(); - CAF_CM_VALIDATE_STL(valueVal); - - if (! valueVal.empty()) { - for (TConstIterator > valueIter(valueVal); - valueIter; valueIter++) { - const SmartPtrCXmlElement valueXml = - thisXml->createAndAddElement("value"); - valueXml->setCDataValue(*valueIter); - } - } - } - CAF_CM_EXIT; -} - -SmartPtrCRequestParameterDoc RequestParameterXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("RequestParameterXml", "parse"); - - SmartPtrCRequestParameterDoc requestParameterDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string nameStrVal = - thisXml->findRequiredAttribute("name"); - const std::string nameVal = nameStrVal; - - const std::string typeStrVal = - thisXml->findRequiredAttribute("type"); - PARAMETER_TYPE typeVal = PARAMETER_NONE; - if (! typeStrVal.empty()) { - typeVal = EnumConvertersXml::convertStringToParameterType(typeStrVal); - } - - const CXmlElement::SmartPtrCElementCollection valueChildrenXml = - thisXml->findRequiredChildren("value"); - - std::deque valueVal; - if (! valueChildrenXml.IsNull() && ! valueChildrenXml->empty()) { - for (TConstIterator valueXmlIter(*valueChildrenXml); - valueXmlIter; valueXmlIter++) { - const SmartPtrCXmlElement valueXml = valueXmlIter->second; - const std::string valueDoc = valueXml->getCDataValue(); - valueVal.push_back(valueDoc); - } - } - - requestParameterDoc.CreateInstance(); - requestParameterDoc->initialize( - nameVal, - typeVal, - valueVal); - } - CAF_CM_EXIT; - - return requestParameterDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/RequestXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/RequestXml.cpp deleted file mode 100644 index b7d0636f8..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/RequestXml.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Author: bwilliams - * Created: Nov 21, 2014 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/CafCoreTypesXml/RequestXml.h" - -using namespace Caf; - -SmartPtrCXmlElement RequestXml::parseString( - const std::string& xml, - const std::string& rootName) { - CAF_CM_STATIC_FUNC_VALIDATE("RequestXml", "parseString"); - CAF_CM_VALIDATE_STRING(xml); - // rootName is optional - - SmartPtrCXmlElement rootXml = CXmlUtils::parseString(xml, rootName); - - return rootXml; -} - -SmartPtrCXmlElement RequestXml::parseFile( - const std::string& xml, - const std::string& rootName) { - CAF_CM_STATIC_FUNC_VALIDATE("RequestXml", "parseFile"); - CAF_CM_VALIDATE_STRING(xml); - // rootName is optional - - SmartPtrCXmlElement rootXml = CXmlUtils::parseFile(xml, rootName); - - return rootXml; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/StatisticsXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/StatisticsXml.cpp deleted file mode 100644 index 7ed0a253b..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/StatisticsXml.cpp +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/CafCoreTypesDoc/CPropertyCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CStatisticsDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/CafCoreTypesXml/StatisticsXml.h" -#include "Doc/DocXml/CafCoreTypesXml/PropertyCollectionXml.h" - -using namespace Caf; - -void StatisticsXml::add( - const SmartPtrCStatisticsDoc statisticsDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("StatisticsXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(statisticsDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const SmartPtrCPropertyCollectionDoc propertyCollectionVal = - statisticsDoc->getPropertyCollection(); - CAF_CM_VALIDATE_SMARTPTR(propertyCollectionVal); - - const SmartPtrCXmlElement propertyCollectionXml = - thisXml->createAndAddElement("propertyCollection"); - PropertyCollectionXml::add(propertyCollectionVal, propertyCollectionXml); - - const std::string providerJobNumVal = - CStringConv::toString(statisticsDoc->getProviderJobNum()); - if (! providerJobNumVal.empty()) { - thisXml->addAttribute("providerJobNum", providerJobNumVal); - } - - const std::string providerJobTotalVal = - CStringConv::toString(statisticsDoc->getProviderJobTotal()); - if (! providerJobTotalVal.empty()) { - thisXml->addAttribute("providerJobTotal", providerJobTotalVal); - } - - const std::string providerJobDurationSecsVal = - CStringConv::toString(statisticsDoc->getProviderJobDurationSecs()); - if (! providerJobDurationSecsVal.empty()) { - thisXml->addAttribute("providerJobDurationSecs", providerJobDurationSecsVal); - } - - const std::string pmeNumVal = - CStringConv::toString(statisticsDoc->getPmeNum()); - if (! pmeNumVal.empty()) { - thisXml->addAttribute("pmeNum", pmeNumVal); - } - - const std::string pmeTotalVal = - CStringConv::toString(statisticsDoc->getPmeTotal()); - if (! pmeTotalVal.empty()) { - thisXml->addAttribute("pmeTotal", pmeTotalVal); - } - - const std::string pmeDurationSecsVal = - CStringConv::toString(statisticsDoc->getPmeDurationSecs()); - if (! pmeDurationSecsVal.empty()) { - thisXml->addAttribute("pmeDurationSecs", pmeDurationSecsVal); - } - } - CAF_CM_EXIT; -} - -SmartPtrCStatisticsDoc StatisticsXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("StatisticsXml", "parse"); - - SmartPtrCStatisticsDoc statisticsDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const SmartPtrCXmlElement propertyCollectionXml = - thisXml->findRequiredChild("propertyCollection"); - - SmartPtrCPropertyCollectionDoc propertyCollectionVal; - if (! propertyCollectionXml.IsNull()) { - propertyCollectionVal = PropertyCollectionXml::parse(propertyCollectionXml); - } - - const std::string providerJobNumStrVal = - thisXml->findOptionalAttribute("providerJobNum"); - int32 providerJobNumVal = 0; - if (! providerJobNumStrVal.empty()) { - providerJobNumVal = CStringConv::fromString(providerJobNumStrVal); - } - - const std::string providerJobTotalStrVal = - thisXml->findOptionalAttribute("providerJobTotal"); - int32 providerJobTotalVal = 0; - if (! providerJobTotalStrVal.empty()) { - providerJobTotalVal = CStringConv::fromString(providerJobTotalStrVal); - } - - const std::string providerJobDurationSecsStrVal = - thisXml->findOptionalAttribute("providerJobDurationSecs"); - int32 providerJobDurationSecsVal = 0; - if (! providerJobDurationSecsStrVal.empty()) { - providerJobDurationSecsVal = CStringConv::fromString(providerJobDurationSecsStrVal); - } - - const std::string pmeNumStrVal = - thisXml->findOptionalAttribute("pmeNum"); - int32 pmeNumVal = 0; - if (! pmeNumStrVal.empty()) { - pmeNumVal = CStringConv::fromString(pmeNumStrVal); - } - - const std::string pmeTotalStrVal = - thisXml->findOptionalAttribute("pmeTotal"); - int32 pmeTotalVal = 0; - if (! pmeTotalStrVal.empty()) { - pmeTotalVal = CStringConv::fromString(pmeTotalStrVal); - } - - const std::string pmeDurationSecsStrVal = - thisXml->findOptionalAttribute("pmeDurationSecs"); - int32 pmeDurationSecsVal = 0; - if (! pmeDurationSecsStrVal.empty()) { - pmeDurationSecsVal = CStringConv::fromString(pmeDurationSecsStrVal); - } - - statisticsDoc.CreateInstance(); - statisticsDoc->initialize( - propertyCollectionVal, - providerJobNumVal, - providerJobTotalVal, - providerJobDurationSecsVal, - pmeNumVal, - pmeTotalVal, - pmeDurationSecsVal); - } - CAF_CM_EXIT; - - return statisticsDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/stdafx.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/stdafx.h deleted file mode 100644 index b2390b571..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafCoreTypesXml/stdafx.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef STDAFX_H_ -#define STDAFX_H_ - -#ifdef WIN32 - #define CAFCORETYPESXML_LINKAGE __declspec(dllexport) -#else - #define CAFCORETYPESXML_LINKAGE -#endif - -#include - -#include -#include - - -#endif /* STDAFX_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafInstallRequestXml/CafInstallRequestXmlRoots.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafInstallRequestXml/CafInstallRequestXmlRoots.cpp deleted file mode 100644 index 624aff06e..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafInstallRequestXml/CafInstallRequestXmlRoots.cpp +++ /dev/null @@ -1,250 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/CafCoreTypesXml/RequestXml.h" -#include "Doc/DocXml/CafInstallRequestXml/InstallPackageSpecXml.h" -#include "Doc/DocXml/CafInstallRequestXml/InstallProviderSpecXml.h" -#include "Doc/DocXml/CafInstallRequestXml/InstallRequestXml.h" - -#include "Doc/CafInstallRequestDoc/CInstallPackageSpecDoc.h" -#include "Doc/CafInstallRequestDoc/CInstallProviderSpecDoc.h" -#include "Doc/CafInstallRequestDoc/CInstallRequestDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/CafInstallRequestXml/CafInstallRequestXmlRoots.h" - -using namespace Caf; - -std::string XmlRoots::saveInstallRequestToString( - const SmartPtrCInstallRequestDoc installRequestDoc) { - CAF_CM_STATIC_FUNC_VALIDATE("XmlRoots", "saveInstallRequestToString"); - - std::string rc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(installRequestDoc); - - const std::string schemaNamespace = DocXmlUtils::getSchemaNamespace("fx"); - const std::string schemaLocation = DocXmlUtils::getSchemaLocation("fx/CafInstallRequest.xsd"); - - const SmartPtrCXmlElement rootXml = CXmlUtils::createRootElement( - "installRequest", schemaNamespace, schemaLocation); - InstallRequestXml::add(installRequestDoc, rootXml); - - rc = rootXml->saveToString(); - } - CAF_CM_EXIT; - - return rc; -} - -SmartPtrCInstallRequestDoc XmlRoots::parseInstallRequestFromString( - const std::string xml) { - CAF_CM_STATIC_FUNC_VALIDATE("XmlRoots", "parseInstallRequestFromString"); - - SmartPtrCInstallRequestDoc installRequestDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(xml); - - const SmartPtrCXmlElement rootXml = RequestXml::parseString(xml, "caf:installRequest"); - installRequestDoc = InstallRequestXml::parse(rootXml); - } - CAF_CM_EXIT; - - return installRequestDoc; -} - -void XmlRoots::saveInstallRequestToFile( - const SmartPtrCInstallRequestDoc installRequestDoc, - const std::string filePath) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("XmlRoots", "saveInstallRequestToFile"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(installRequestDoc); - CAF_CM_VALIDATE_STRING(filePath); - - CAF_CM_LOG_DEBUG_VA1("Saving to file - %s", filePath.c_str()); - - const std::string installRequestStr = - saveInstallRequestToString(installRequestDoc); - FileSystemUtils::saveTextFile(filePath, installRequestStr); - } - CAF_CM_EXIT; -} - -SmartPtrCInstallRequestDoc XmlRoots::parseInstallRequestFromFile( - const std::string filePath) { - CAF_CM_STATIC_FUNC_VALIDATE("XmlRoots", "parseInstallRequestFromFile"); - - SmartPtrCInstallRequestDoc installRequestDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(filePath); - - const SmartPtrCXmlElement rootXml = RequestXml::parseFile(filePath, "caf:installRequest"); - installRequestDoc = InstallRequestXml::parse(rootXml); - } - CAF_CM_EXIT; - - return installRequestDoc; -} - -std::string XmlRoots::saveInstallProviderSpecToString( - const SmartPtrCInstallProviderSpecDoc installProviderSpecDoc) { - CAF_CM_STATIC_FUNC_VALIDATE("XmlRoots", "saveInstallProviderSpecToString"); - - std::string rc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(installProviderSpecDoc); - - const std::string schemaNamespace = DocXmlUtils::getSchemaNamespace("fx"); - const std::string schemaLocation = DocXmlUtils::getSchemaLocation("fx/CafInstallRequest.xsd"); - - const SmartPtrCXmlElement rootXml = CXmlUtils::createRootElement( - "installProviderSpec", schemaNamespace, schemaLocation); - InstallProviderSpecXml::add(installProviderSpecDoc, rootXml); - - rc = rootXml->saveToString(); - } - CAF_CM_EXIT; - - return rc; -} - -SmartPtrCInstallProviderSpecDoc XmlRoots::parseInstallProviderSpecFromString( - const std::string xml) { - CAF_CM_STATIC_FUNC_VALIDATE("XmlRoots", "parseInstallProviderSpecFromString"); - - SmartPtrCInstallProviderSpecDoc installProviderSpecDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(xml); - - const SmartPtrCXmlElement rootXml = CXmlUtils::parseString(xml, "caf:installProviderSpec"); - installProviderSpecDoc = InstallProviderSpecXml::parse(rootXml); - } - CAF_CM_EXIT; - - return installProviderSpecDoc; -} - -void XmlRoots::saveInstallProviderSpecToFile( - const SmartPtrCInstallProviderSpecDoc installProviderSpecDoc, - const std::string filePath) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("XmlRoots", "saveInstallProviderSpecToFile"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(installProviderSpecDoc); - CAF_CM_VALIDATE_STRING(filePath); - - CAF_CM_LOG_DEBUG_VA1("Saving to file - %s", filePath.c_str()); - - const std::string installProviderSpecStr = - saveInstallProviderSpecToString(installProviderSpecDoc); - FileSystemUtils::saveTextFile(filePath, installProviderSpecStr); - } - CAF_CM_EXIT; -} - -SmartPtrCInstallProviderSpecDoc XmlRoots::parseInstallProviderSpecFromFile( - const std::string filePath) { - CAF_CM_STATIC_FUNC_VALIDATE("XmlRoots", "parseInstallProviderSpecFromFile"); - - SmartPtrCInstallProviderSpecDoc installProviderSpecDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(filePath); - - const SmartPtrCXmlElement rootXml = CXmlUtils::parseFile(filePath, "caf:installProviderSpec"); - installProviderSpecDoc = InstallProviderSpecXml::parse(rootXml); - } - CAF_CM_EXIT; - - return installProviderSpecDoc; -} - -std::string XmlRoots::saveInstallPackageSpecToString( - const SmartPtrCInstallPackageSpecDoc installPackageSpecDoc) { - CAF_CM_STATIC_FUNC_VALIDATE("XmlRoots", "saveInstallPackageSpecToString"); - - std::string rc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(installPackageSpecDoc); - - const std::string schemaNamespace = DocXmlUtils::getSchemaNamespace("fx"); - const std::string schemaLocation = DocXmlUtils::getSchemaLocation("fx/CafInstallRequest.xsd"); - - const SmartPtrCXmlElement rootXml = CXmlUtils::createRootElement( - "installPackageSpec", schemaNamespace, schemaLocation); - InstallPackageSpecXml::add(installPackageSpecDoc, rootXml); - - rc = rootXml->saveToString(); - } - CAF_CM_EXIT; - - return rc; -} - -SmartPtrCInstallPackageSpecDoc XmlRoots::parseInstallPackageSpecFromString( - const std::string xml) { - CAF_CM_STATIC_FUNC_VALIDATE("XmlRoots", "parseInstallPackageSpecFromString"); - - SmartPtrCInstallPackageSpecDoc installPackageSpecDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(xml); - - const SmartPtrCXmlElement rootXml = CXmlUtils::parseString(xml, "caf:installPackageSpec"); - installPackageSpecDoc = InstallPackageSpecXml::parse(rootXml); - } - CAF_CM_EXIT; - - return installPackageSpecDoc; -} - -void XmlRoots::saveInstallPackageSpecToFile( - const SmartPtrCInstallPackageSpecDoc installPackageSpecDoc, - const std::string filePath) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("XmlRoots", "saveInstallPackageSpecToFile"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(installPackageSpecDoc); - CAF_CM_VALIDATE_STRING(filePath); - - CAF_CM_LOG_DEBUG_VA1("Saving to file - %s", filePath.c_str()); - - const std::string installPackageSpecStr = - saveInstallPackageSpecToString(installPackageSpecDoc); - FileSystemUtils::saveTextFile(filePath, installPackageSpecStr); - } - CAF_CM_EXIT; -} - -SmartPtrCInstallPackageSpecDoc XmlRoots::parseInstallPackageSpecFromFile( - const std::string filePath) { - CAF_CM_STATIC_FUNC_VALIDATE("XmlRoots", "parseInstallPackageSpecFromFile"); - - SmartPtrCInstallPackageSpecDoc installPackageSpecDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(filePath); - - const SmartPtrCXmlElement rootXml = CXmlUtils::parseFile(filePath, "caf:installPackageSpec"); - installPackageSpecDoc = InstallPackageSpecXml::parse(rootXml); - } - CAF_CM_EXIT; - - return installPackageSpecDoc; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafInstallRequestXml/FullPackageElemXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafInstallRequestXml/FullPackageElemXml.cpp deleted file mode 100644 index 4a1b1ec88..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafInstallRequestXml/FullPackageElemXml.cpp +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/CafInstallRequestXml/PackageDefnXml.h" - -#include "Doc/CafInstallRequestDoc/CFullPackageElemDoc.h" -#include "Doc/CafInstallRequestDoc/CPackageDefnDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/CafInstallRequestXml/FullPackageElemXml.h" - -using namespace Caf; - -void FullPackageElemXml::add( - const SmartPtrCFullPackageElemDoc fullPackageElemDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("FullPackageElemXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(fullPackageElemDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string indexVal = - CStringConv::toString(fullPackageElemDoc->getIndex()); - CAF_CM_VALIDATE_STRING(indexVal); - thisXml->addAttribute("index", indexVal); - - const std::string packageNamespaceVal = fullPackageElemDoc->getPackageNamespace(); - CAF_CM_VALIDATE_STRING(packageNamespaceVal); - thisXml->addAttribute("packageNamespace", packageNamespaceVal); - - const std::string packageNameVal = fullPackageElemDoc->getPackageName(); - CAF_CM_VALIDATE_STRING(packageNameVal); - thisXml->addAttribute("packageName", packageNameVal); - - const std::string packageVersionVal = fullPackageElemDoc->getPackageVersion(); - CAF_CM_VALIDATE_STRING(packageVersionVal); - thisXml->addAttribute("packageVersion", packageVersionVal); - - const SmartPtrCPackageDefnDoc installPackageVal = - fullPackageElemDoc->getInstallPackage(); - CAF_CM_VALIDATE_SMARTPTR(installPackageVal); - - const SmartPtrCXmlElement installPackageXml = - thisXml->createAndAddElement("installPackage"); - PackageDefnXml::add(installPackageVal, installPackageXml); - - const SmartPtrCPackageDefnDoc uninstallPackageVal = - fullPackageElemDoc->getUninstallPackage(); - CAF_CM_VALIDATE_SMARTPTR(uninstallPackageVal); - - const SmartPtrCXmlElement uninstallPackageXml = - thisXml->createAndAddElement("uninstallPackage"); - PackageDefnXml::add(uninstallPackageVal, uninstallPackageXml); - } - CAF_CM_EXIT; -} - -SmartPtrCFullPackageElemDoc FullPackageElemXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("FullPackageElemXml", "parse"); - - SmartPtrCFullPackageElemDoc fullPackageElemDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string indexStrVal = - thisXml->findRequiredAttribute("index"); - int32 indexVal = 0; - if (! indexStrVal.empty()) { - indexVal = CStringConv::fromString(indexStrVal); - } - - const std::string packageNamespaceStrVal = - thisXml->findRequiredAttribute("packageNamespace"); - const std::string packageNamespaceVal = packageNamespaceStrVal; - - const std::string packageNameStrVal = - thisXml->findRequiredAttribute("packageName"); - const std::string packageNameVal = packageNameStrVal; - - const std::string packageVersionStrVal = - thisXml->findRequiredAttribute("packageVersion"); - const std::string packageVersionVal = packageVersionStrVal; - - const SmartPtrCXmlElement installPackageXml = - thisXml->findRequiredChild("installPackage"); - - SmartPtrCPackageDefnDoc installPackageVal; - if (! installPackageXml.IsNull()) { - installPackageVal = PackageDefnXml::parse(installPackageXml); - } - - const SmartPtrCXmlElement uninstallPackageXml = - thisXml->findRequiredChild("uninstallPackage"); - - SmartPtrCPackageDefnDoc uninstallPackageVal; - if (! uninstallPackageXml.IsNull()) { - uninstallPackageVal = PackageDefnXml::parse(uninstallPackageXml); - } - - fullPackageElemDoc.CreateInstance(); - fullPackageElemDoc->initialize( - indexVal, - packageNamespaceVal, - packageNameVal, - packageVersionVal, - installPackageVal, - uninstallPackageVal); - } - CAF_CM_EXIT; - - return fullPackageElemDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafInstallRequestXml/GetInventoryJobXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafInstallRequestXml/GetInventoryJobXml.cpp deleted file mode 100644 index 33865cbee..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafInstallRequestXml/GetInventoryJobXml.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/CafInstallRequestDoc/CGetInventoryJobDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/CafInstallRequestXml/GetInventoryJobXml.h" - -using namespace Caf; - -void GetInventoryJobXml::add( - const SmartPtrCGetInventoryJobDoc getInventoryJobDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("GetInventoryJobXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(getInventoryJobDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string jobIdVal = - BasePlatform::UuidToString(getInventoryJobDoc->getJobId()); - CAF_CM_VALIDATE_STRING(jobIdVal); - thisXml->addAttribute("jobId", jobIdVal); - } - CAF_CM_EXIT; -} - -SmartPtrCGetInventoryJobDoc GetInventoryJobXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("GetInventoryJobXml", "parse"); - - SmartPtrCGetInventoryJobDoc getInventoryJobDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string jobIdStrVal = - thisXml->findRequiredAttribute("jobId"); - UUID jobIdVal = CAFCOMMON_GUID_NULL; - if (! jobIdStrVal.empty()) { - BasePlatform::UuidFromString(jobIdStrVal.c_str(), jobIdVal); - } - - getInventoryJobDoc.CreateInstance(); - getInventoryJobDoc->initialize( - jobIdVal); - } - CAF_CM_EXIT; - - return getInventoryJobDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafInstallRequestXml/InstallBatchXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafInstallRequestXml/InstallBatchXml.cpp deleted file mode 100644 index 82dd7adc7..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafInstallRequestXml/InstallBatchXml.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/CafInstallRequestXml/GetInventoryJobXml.h" -#include "Doc/DocXml/CafInstallRequestXml/InstallProviderJobXml.h" -#include "Doc/DocXml/CafInstallRequestXml/UninstallProviderJobXml.h" - -#include "Doc/CafInstallRequestDoc/CGetInventoryJobDoc.h" -#include "Doc/CafInstallRequestDoc/CInstallBatchDoc.h" -#include "Doc/CafInstallRequestDoc/CInstallProviderJobDoc.h" -#include "Doc/CafInstallRequestDoc/CUninstallProviderJobDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/CafInstallRequestXml/InstallBatchXml.h" - -using namespace Caf; - -void InstallBatchXml::add( - const SmartPtrCInstallBatchDoc installBatchDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("InstallBatchXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(installBatchDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const SmartPtrCGetInventoryJobDoc getInventoryVal = - installBatchDoc->getGetInventory(); - if (! getInventoryVal.IsNull()) { - const SmartPtrCXmlElement getInventoryXml = - thisXml->createAndAddElement("getInventory"); - GetInventoryJobXml::add(getInventoryVal, getInventoryXml); - } - - const SmartPtrCInstallProviderJobDoc installProviderVal = - installBatchDoc->getInstallProvider(); - if (! installProviderVal.IsNull()) { - const SmartPtrCXmlElement installProviderXml = - thisXml->createAndAddElement("installProvider"); - InstallProviderJobXml::add(installProviderVal, installProviderXml); - } - - const SmartPtrCUninstallProviderJobDoc uninstallProviderVal = - installBatchDoc->getUninstallProvider(); - if (! uninstallProviderVal.IsNull()) { - const SmartPtrCXmlElement uninstallProviderXml = - thisXml->createAndAddElement("uninstallProvider"); - UninstallProviderJobXml::add(uninstallProviderVal, uninstallProviderXml); - } - } - CAF_CM_EXIT; -} - -SmartPtrCInstallBatchDoc InstallBatchXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("InstallBatchXml", "parse"); - - SmartPtrCInstallBatchDoc installBatchDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const SmartPtrCXmlElement getInventoryXml = - thisXml->findOptionalChild("getInventory"); - - SmartPtrCGetInventoryJobDoc getInventoryVal; - if (! getInventoryXml.IsNull()) { - getInventoryVal = GetInventoryJobXml::parse(getInventoryXml); - } - - const SmartPtrCXmlElement installProviderXml = - thisXml->findOptionalChild("installProvider"); - - SmartPtrCInstallProviderJobDoc installProviderVal; - if (! installProviderXml.IsNull()) { - installProviderVal = InstallProviderJobXml::parse(installProviderXml); - } - - const SmartPtrCXmlElement uninstallProviderXml = - thisXml->findOptionalChild("uninstallProvider"); - - SmartPtrCUninstallProviderJobDoc uninstallProviderVal; - if (! uninstallProviderXml.IsNull()) { - uninstallProviderVal = UninstallProviderJobXml::parse(uninstallProviderXml); - } - - installBatchDoc.CreateInstance(); - installBatchDoc->initialize( - getInventoryVal, - installProviderVal, - uninstallProviderVal); - } - CAF_CM_EXIT; - - return installBatchDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafInstallRequestXml/InstallPackageSpecXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafInstallRequestXml/InstallPackageSpecXml.cpp deleted file mode 100644 index 58ae2e59b..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafInstallRequestXml/InstallPackageSpecXml.cpp +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/CafCoreTypesXml/AttachmentCollectionXml.h" -#include "Doc/DocXml/CafCoreTypesXml/AttachmentNameCollectionXml.h" - -#include "Doc/CafCoreTypesDoc/CAttachmentCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CAttachmentNameCollectionDoc.h" -#include "Doc/CafInstallRequestDoc/CInstallPackageSpecDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/CafInstallRequestXml/InstallPackageSpecXml.h" - -using namespace Caf; - -void InstallPackageSpecXml::add( - const SmartPtrCInstallPackageSpecDoc installPackageSpecDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("InstallPackageSpecXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(installPackageSpecDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string packageNamespaceVal = installPackageSpecDoc->getPackageNamespace(); - CAF_CM_VALIDATE_STRING(packageNamespaceVal); - thisXml->addAttribute("packageNamespace", packageNamespaceVal); - - const std::string packageNameVal = installPackageSpecDoc->getPackageName(); - CAF_CM_VALIDATE_STRING(packageNameVal); - thisXml->addAttribute("packageName", packageNameVal); - - const std::string packageVersionVal = installPackageSpecDoc->getPackageVersion(); - CAF_CM_VALIDATE_STRING(packageVersionVal); - thisXml->addAttribute("packageVersion", packageVersionVal); - - const std::string startupAttachmentNameVal = installPackageSpecDoc->getStartupAttachmentName(); - CAF_CM_VALIDATE_STRING(startupAttachmentNameVal); - thisXml->addAttribute("startupAttachmentName", startupAttachmentNameVal); - - const std::string packageAttachmentNameVal = installPackageSpecDoc->getPackageAttachmentName(); - CAF_CM_VALIDATE_STRING(packageAttachmentNameVal); - thisXml->addAttribute("packageAttachmentName", packageAttachmentNameVal); - - const SmartPtrCAttachmentNameCollectionDoc supportingAttachmentNameCollectionVal = - installPackageSpecDoc->getSupportingAttachmentNameCollection(); - if (! supportingAttachmentNameCollectionVal.IsNull()) { - const SmartPtrCXmlElement supportingAttachmentNameCollectionXml = - thisXml->createAndAddElement("attachmentNameCollection"); - AttachmentNameCollectionXml::add(supportingAttachmentNameCollectionVal, supportingAttachmentNameCollectionXml); - } - - const SmartPtrCAttachmentCollectionDoc attachmentCollectionVal = - installPackageSpecDoc->getAttachmentCollection(); - CAF_CM_VALIDATE_SMARTPTR(attachmentCollectionVal); - - const SmartPtrCXmlElement attachmentCollectionXml = - thisXml->createAndAddElement("attachmentCollection"); - AttachmentCollectionXml::add(attachmentCollectionVal, attachmentCollectionXml); - - const std::string argumentsVal = installPackageSpecDoc->getArguments(); - if (! argumentsVal.empty()) { - thisXml->addAttribute("arguments", argumentsVal); - } - - thisXml->addAttribute("version", "1.0"); - } - CAF_CM_EXIT; -} - -SmartPtrCInstallPackageSpecDoc InstallPackageSpecXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("InstallPackageSpecXml", "parse"); - - SmartPtrCInstallPackageSpecDoc installPackageSpecDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string packageNamespaceStrVal = - thisXml->findRequiredAttribute("packageNamespace"); - const std::string packageNamespaceVal = packageNamespaceStrVal; - - const std::string packageNameStrVal = - thisXml->findRequiredAttribute("packageName"); - const std::string packageNameVal = packageNameStrVal; - - const std::string packageVersionStrVal = - thisXml->findRequiredAttribute("packageVersion"); - const std::string packageVersionVal = packageVersionStrVal; - - const std::string startupAttachmentNameStrVal = - thisXml->findRequiredAttribute("startupAttachmentName"); - const std::string startupAttachmentNameVal = startupAttachmentNameStrVal; - - const std::string packageAttachmentNameStrVal = - thisXml->findRequiredAttribute("packageAttachmentName"); - const std::string packageAttachmentNameVal = packageAttachmentNameStrVal; - - const SmartPtrCXmlElement supportingAttachmentNameCollectionXml = - thisXml->findOptionalChild("attachmentNameCollection"); - - SmartPtrCAttachmentNameCollectionDoc supportingAttachmentNameCollectionVal; - if (! supportingAttachmentNameCollectionXml.IsNull()) { - supportingAttachmentNameCollectionVal = AttachmentNameCollectionXml::parse(supportingAttachmentNameCollectionXml); - } - - const SmartPtrCXmlElement attachmentCollectionXml = - thisXml->findRequiredChild("attachmentCollection"); - - SmartPtrCAttachmentCollectionDoc attachmentCollectionVal; - if (! attachmentCollectionXml.IsNull()) { - attachmentCollectionVal = AttachmentCollectionXml::parse(attachmentCollectionXml); - } - - const std::string argumentsStrVal = - thisXml->findOptionalAttribute("arguments"); - const std::string argumentsVal = argumentsStrVal; - - installPackageSpecDoc.CreateInstance(); - installPackageSpecDoc->initialize( - packageNamespaceVal, - packageNameVal, - packageVersionVal, - startupAttachmentNameVal, - packageAttachmentNameVal, - supportingAttachmentNameCollectionVal, - attachmentCollectionVal, - argumentsVal); - } - CAF_CM_EXIT; - - return installPackageSpecDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafInstallRequestXml/InstallProviderJobXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafInstallRequestXml/InstallProviderJobXml.cpp deleted file mode 100644 index bb87fc0b0..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafInstallRequestXml/InstallProviderJobXml.cpp +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocUtils/EnumConvertersXml.h" -#include "Doc/DocXml/CafInstallRequestXml/FullPackageElemXml.h" -#include "Doc/CafInstallRequestDoc/CafInstallRequestDocTypes.h" - -#include "Doc/CafInstallRequestDoc/CFullPackageElemDoc.h" -#include "Doc/CafInstallRequestDoc/CInstallProviderJobDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/CafInstallRequestXml/InstallProviderJobXml.h" - -using namespace Caf; - -void InstallProviderJobXml::add( - const SmartPtrCInstallProviderJobDoc installProviderJobDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("InstallProviderJobXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(installProviderJobDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string clientIdVal = - BasePlatform::UuidToString(installProviderJobDoc->getClientId()); - CAF_CM_VALIDATE_STRING(clientIdVal); - thisXml->addAttribute("clientId", clientIdVal); - - const std::string jobIdVal = - BasePlatform::UuidToString(installProviderJobDoc->getJobId()); - CAF_CM_VALIDATE_STRING(jobIdVal); - thisXml->addAttribute("jobId", jobIdVal); - - const std::string providerNamespaceVal = installProviderJobDoc->getProviderNamespace(); - CAF_CM_VALIDATE_STRING(providerNamespaceVal); - thisXml->addAttribute("providerNamespace", providerNamespaceVal); - - const std::string providerNameVal = installProviderJobDoc->getProviderName(); - CAF_CM_VALIDATE_STRING(providerNameVal); - thisXml->addAttribute("providerName", providerNameVal); - - const std::string providerVersionVal = installProviderJobDoc->getProviderVersion(); - CAF_CM_VALIDATE_STRING(providerVersionVal); - thisXml->addAttribute("providerVersion", providerVersionVal); - - const std::string packageOSTypeVal = - EnumConvertersXml::convertPackageOSTypeToString(installProviderJobDoc->getPackageOSType()); - CAF_CM_VALIDATE_STRING(packageOSTypeVal); - thisXml->addAttribute("packageOSType", packageOSTypeVal); - - const std::deque packageValVal = - installProviderJobDoc->getPackageCollection(); - CAF_CM_VALIDATE_STL(packageValVal); - - if (! packageValVal.empty()) { - const SmartPtrCXmlElement packageCollectionXml = - thisXml->createAndAddElement("packageCollection"); - for (TConstIterator > packageValIter(packageValVal); - packageValIter; packageValIter++) { - const SmartPtrCXmlElement packageValXml = - packageCollectionXml->createAndAddElement("package"); - FullPackageElemXml::add(*packageValIter, packageValXml); - } - } - } - CAF_CM_EXIT; -} - -SmartPtrCInstallProviderJobDoc InstallProviderJobXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("InstallProviderJobXml", "parse"); - - SmartPtrCInstallProviderJobDoc installProviderJobDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string clientIdStrVal = - thisXml->findRequiredAttribute("clientId"); - UUID clientIdVal = CAFCOMMON_GUID_NULL; - BasePlatform::UuidFromString(clientIdStrVal.c_str(), clientIdVal); - - const std::string jobIdStrVal = - thisXml->findRequiredAttribute("jobId"); - UUID jobIdVal = CAFCOMMON_GUID_NULL; - BasePlatform::UuidFromString(jobIdStrVal.c_str(), jobIdVal); - - const std::string providerNamespaceStrVal = - thisXml->findRequiredAttribute("providerNamespace"); - const std::string providerNamespaceVal = providerNamespaceStrVal; - - const std::string providerNameStrVal = - thisXml->findRequiredAttribute("providerName"); - const std::string providerNameVal = providerNameStrVal; - - const std::string providerVersionStrVal = - thisXml->findRequiredAttribute("providerVersion"); - const std::string providerVersionVal = providerVersionStrVal; - - const std::string packageOSTypeStrVal = - thisXml->findRequiredAttribute("packageOSType"); - PACKAGE_OS_TYPE packageOSTypeVal = PACKAGE_OS_NONE; - if (! packageOSTypeStrVal.empty()) { - packageOSTypeVal = EnumConvertersXml::convertStringToPackageOSType(packageOSTypeStrVal); - } - - const SmartPtrCXmlElement packageCollectionXml = - thisXml->findRequiredChild("packageCollection"); - const CXmlElement::SmartPtrCElementCollection packageValChildrenXml = - packageCollectionXml->findRequiredChildren("package"); - - std::deque packageValVal; - if (! packageValChildrenXml.IsNull() && ! packageValChildrenXml->empty()) { - for (TConstIterator packageValXmlIter(*packageValChildrenXml); - packageValXmlIter; packageValXmlIter++) { - const SmartPtrCXmlElement packageValXml = packageValXmlIter->second; - const SmartPtrCFullPackageElemDoc packageValDoc = - FullPackageElemXml::parse(packageValXml); - packageValVal.push_back(packageValDoc); - } - } - - installProviderJobDoc.CreateInstance(); - installProviderJobDoc->initialize( - clientIdVal, - jobIdVal, - providerNamespaceVal, - providerNameVal, - providerVersionVal, - packageOSTypeVal, - packageValVal); - } - CAF_CM_EXIT; - - return installProviderJobDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafInstallRequestXml/InstallProviderSpecXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafInstallRequestXml/InstallProviderSpecXml.cpp deleted file mode 100644 index 39d795080..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafInstallRequestXml/InstallProviderSpecXml.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/CafInstallRequestXml/MinPackageElemXml.h" - -#include "Doc/CafInstallRequestDoc/CInstallProviderSpecDoc.h" -#include "Doc/CafInstallRequestDoc/CMinPackageElemDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/CafInstallRequestXml/InstallProviderSpecXml.h" - -using namespace Caf; - -void InstallProviderSpecXml::add( - const SmartPtrCInstallProviderSpecDoc installProviderSpecDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("InstallProviderSpecXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(installProviderSpecDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string clientIdVal = - BasePlatform::UuidToString(installProviderSpecDoc->getClientId()); - CAF_CM_VALIDATE_STRING(clientIdVal); - thisXml->addAttribute("clientId", clientIdVal); - - const std::string providerNamespaceVal = installProviderSpecDoc->getProviderNamespace(); - CAF_CM_VALIDATE_STRING(providerNamespaceVal); - thisXml->addAttribute("providerNamespace", providerNamespaceVal); - - const std::string providerNameVal = installProviderSpecDoc->getProviderName(); - CAF_CM_VALIDATE_STRING(providerNameVal); - thisXml->addAttribute("providerName", providerNameVal); - - const std::string providerVersionVal = installProviderSpecDoc->getProviderVersion(); - CAF_CM_VALIDATE_STRING(providerVersionVal); - thisXml->addAttribute("providerVersion", providerVersionVal); - - const std::deque packageValVal = - installProviderSpecDoc->getPackageCollection(); - CAF_CM_VALIDATE_STL(packageValVal); - - if (! packageValVal.empty()) { - for (TConstIterator > packageValIter(packageValVal); - packageValIter; packageValIter++) { - const SmartPtrCXmlElement packageValXml = - thisXml->createAndAddElement("package"); - MinPackageElemXml::add(*packageValIter, packageValXml); - } - } - - thisXml->addAttribute("version", "1.0"); - } - CAF_CM_EXIT; -} - -SmartPtrCInstallProviderSpecDoc InstallProviderSpecXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("InstallProviderSpecXml", "parse"); - - SmartPtrCInstallProviderSpecDoc installProviderSpecDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string clientIdStrVal = - thisXml->findRequiredAttribute("clientId"); - UUID clientIdVal = CAFCOMMON_GUID_NULL; - if (! clientIdStrVal.empty()) { - BasePlatform::UuidFromString(clientIdStrVal.c_str(), clientIdVal); - } - - const std::string providerNamespaceStrVal = - thisXml->findRequiredAttribute("providerNamespace"); - const std::string providerNamespaceVal = providerNamespaceStrVal; - - const std::string providerNameStrVal = - thisXml->findRequiredAttribute("providerName"); - const std::string providerNameVal = providerNameStrVal; - - const std::string providerVersionStrVal = - thisXml->findRequiredAttribute("providerVersion"); - const std::string providerVersionVal = providerVersionStrVal; - - const CXmlElement::SmartPtrCElementCollection packageValChildrenXml = - thisXml->findRequiredChildren("package"); - - std::deque packageValVal; - if (! packageValChildrenXml.IsNull() && ! packageValChildrenXml->empty()) { - for (TConstIterator packageValXmlIter(*packageValChildrenXml); - packageValXmlIter; packageValXmlIter++) { - const SmartPtrCXmlElement packageValXml = packageValXmlIter->second; - const SmartPtrCMinPackageElemDoc packageValDoc = - MinPackageElemXml::parse(packageValXml); - packageValVal.push_back(packageValDoc); - } - } - - installProviderSpecDoc.CreateInstance(); - installProviderSpecDoc->initialize( - clientIdVal, - providerNamespaceVal, - providerNameVal, - providerVersionVal, - packageValVal); - } - CAF_CM_EXIT; - - return installProviderSpecDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafInstallRequestXml/InstallRequestXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafInstallRequestXml/InstallRequestXml.cpp deleted file mode 100644 index b9c721f65..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafInstallRequestXml/InstallRequestXml.cpp +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/CafCoreTypesXml/AttachmentCollectionXml.h" -#include "Doc/DocXml/CafCoreTypesXml/RequestHeaderXml.h" -#include "Doc/DocXml/CafInstallRequestXml/InstallBatchXml.h" - -#include "Doc/CafCoreTypesDoc/CAttachmentCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CRequestHeaderDoc.h" -#include "Doc/CafInstallRequestDoc/CInstallBatchDoc.h" -#include "Doc/CafInstallRequestDoc/CInstallRequestDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/CafInstallRequestXml/InstallRequestXml.h" - -using namespace Caf; - -void InstallRequestXml::add( - const SmartPtrCInstallRequestDoc installRequestDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("InstallRequestXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(installRequestDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string clientIdVal = - BasePlatform::UuidToString(installRequestDoc->getClientId()); - CAF_CM_VALIDATE_STRING(clientIdVal); - thisXml->addAttribute("clientId", clientIdVal); - - const std::string requestIdVal = - BasePlatform::UuidToString(installRequestDoc->getRequestId()); - CAF_CM_VALIDATE_STRING(requestIdVal); - thisXml->addAttribute("requestId", requestIdVal); - - const std::string pmeIdVal = installRequestDoc->getPmeId(); - CAF_CM_VALIDATE_STRING(pmeIdVal); - thisXml->addAttribute("pmeId", pmeIdVal); - - const SmartPtrCRequestHeaderDoc requestHeaderVal = - installRequestDoc->getRequestHeader(); - CAF_CM_VALIDATE_SMARTPTR(requestHeaderVal); - - const SmartPtrCXmlElement requestHeaderXml = - thisXml->createAndAddElement("requestHeader"); - RequestHeaderXml::add(requestHeaderVal, requestHeaderXml); - - const SmartPtrCInstallBatchDoc batchVal = - installRequestDoc->getBatch(); - CAF_CM_VALIDATE_SMARTPTR(batchVal); - - const SmartPtrCXmlElement batchXml = - thisXml->createAndAddElement("batch"); - InstallBatchXml::add(batchVal, batchXml); - - const SmartPtrCAttachmentCollectionDoc attachmentCollectionVal = - installRequestDoc->getAttachmentCollection(); - if (! attachmentCollectionVal.IsNull()) { - const SmartPtrCXmlElement attachmentCollectionXml = - thisXml->createAndAddElement("attachmentCollection"); - AttachmentCollectionXml::add(attachmentCollectionVal, attachmentCollectionXml); - } - } - CAF_CM_EXIT; -} - -SmartPtrCInstallRequestDoc InstallRequestXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("InstallRequestXml", "parse"); - - SmartPtrCInstallRequestDoc installRequestDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string clientIdStrVal = - thisXml->findRequiredAttribute("clientId"); - UUID clientIdVal = CAFCOMMON_GUID_NULL; - if (! clientIdStrVal.empty()) { - BasePlatform::UuidFromString(clientIdStrVal.c_str(), clientIdVal); - } - - const std::string requestIdStrVal = - thisXml->findRequiredAttribute("requestId"); - UUID requestIdVal = CAFCOMMON_GUID_NULL; - if (! requestIdStrVal.empty()) { - BasePlatform::UuidFromString(requestIdStrVal.c_str(), requestIdVal); - } - - const std::string pmeIdVal = - thisXml->findRequiredAttribute("pmeId"); - - const SmartPtrCXmlElement requestHeaderXml = - thisXml->findRequiredChild("requestHeader"); - - SmartPtrCRequestHeaderDoc requestHeaderVal; - if (! requestHeaderXml.IsNull()) { - requestHeaderVal = RequestHeaderXml::parse(requestHeaderXml); - } - - const SmartPtrCXmlElement batchXml = - thisXml->findRequiredChild("batch"); - - SmartPtrCInstallBatchDoc batchVal; - if (! batchXml.IsNull()) { - batchVal = InstallBatchXml::parse(batchXml); - } - - const SmartPtrCXmlElement attachmentCollectionXml = - thisXml->findOptionalChild("attachmentCollection"); - - SmartPtrCAttachmentCollectionDoc attachmentCollectionVal; - if (! attachmentCollectionXml.IsNull()) { - attachmentCollectionVal = AttachmentCollectionXml::parse(attachmentCollectionXml); - } - - installRequestDoc.CreateInstance(); - installRequestDoc->initialize( - clientIdVal, - requestIdVal, - pmeIdVal, - requestHeaderVal, - batchVal, - attachmentCollectionVal); - } - CAF_CM_EXIT; - - return installRequestDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafInstallRequestXml/MinPackageElemXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafInstallRequestXml/MinPackageElemXml.cpp deleted file mode 100644 index 2c839b68b..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafInstallRequestXml/MinPackageElemXml.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/CafInstallRequestDoc/CMinPackageElemDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/CafInstallRequestXml/MinPackageElemXml.h" - -using namespace Caf; - -void MinPackageElemXml::add( - const SmartPtrCMinPackageElemDoc minPackageElemDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("MinPackageElemXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(minPackageElemDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string indexVal = - CStringConv::toString(minPackageElemDoc->getIndex()); - CAF_CM_VALIDATE_STRING(indexVal); - thisXml->addAttribute("index", indexVal); - - const std::string packageNamespaceVal = minPackageElemDoc->getPackageNamespace(); - CAF_CM_VALIDATE_STRING(packageNamespaceVal); - thisXml->addAttribute("packageNamespace", packageNamespaceVal); - - const std::string packageNameVal = minPackageElemDoc->getPackageName(); - CAF_CM_VALIDATE_STRING(packageNameVal); - thisXml->addAttribute("packageName", packageNameVal); - - const std::string packageVersionVal = minPackageElemDoc->getPackageVersion(); - CAF_CM_VALIDATE_STRING(packageVersionVal); - thisXml->addAttribute("packageVersion", packageVersionVal); - } - CAF_CM_EXIT; -} - -SmartPtrCMinPackageElemDoc MinPackageElemXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("MinPackageElemXml", "parse"); - - SmartPtrCMinPackageElemDoc minPackageElemDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string indexStrVal = - thisXml->findRequiredAttribute("index"); - int32 indexVal = 0; - if (! indexStrVal.empty()) { - indexVal = CStringConv::fromString(indexStrVal); - } - - const std::string packageNamespaceStrVal = - thisXml->findRequiredAttribute("packageNamespace"); - const std::string packageNamespaceVal = packageNamespaceStrVal; - - const std::string packageNameStrVal = - thisXml->findRequiredAttribute("packageName"); - const std::string packageNameVal = packageNameStrVal; - - const std::string packageVersionStrVal = - thisXml->findRequiredAttribute("packageVersion"); - const std::string packageVersionVal = packageVersionStrVal; - - minPackageElemDoc.CreateInstance(); - minPackageElemDoc->initialize( - indexVal, - packageNamespaceVal, - packageNameVal, - packageVersionVal); - } - CAF_CM_EXIT; - - return minPackageElemDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafInstallRequestXml/PackageDefnXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafInstallRequestXml/PackageDefnXml.cpp deleted file mode 100644 index 187dc1f5e..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafInstallRequestXml/PackageDefnXml.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/CafCoreTypesXml/AttachmentNameCollectionXml.h" - -#include "Doc/CafCoreTypesDoc/CAttachmentNameCollectionDoc.h" -#include "Doc/CafInstallRequestDoc/CPackageDefnDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/CafInstallRequestXml/PackageDefnXml.h" - -using namespace Caf; - -void PackageDefnXml::add( - const SmartPtrCPackageDefnDoc packageDefnDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("PackageDefnXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(packageDefnDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string startupAttachmentNameVal = packageDefnDoc->getStartupAttachmentName(); - CAF_CM_VALIDATE_STRING(startupAttachmentNameVal); - thisXml->addAttribute("startupAttachmentName", startupAttachmentNameVal); - - const std::string packageAttachmentNameVal = packageDefnDoc->getPackageAttachmentName(); - CAF_CM_VALIDATE_STRING(packageAttachmentNameVal); - thisXml->addAttribute("packageAttachmentName", packageAttachmentNameVal); - - const SmartPtrCAttachmentNameCollectionDoc supportingAttachmentNameCollectionVal = - packageDefnDoc->getSupportingAttachmentNameCollection(); - if (! supportingAttachmentNameCollectionVal.IsNull()) { - const SmartPtrCXmlElement supportingAttachmentNameCollectionXml = - thisXml->createAndAddElement("attachmentNameCollection"); - AttachmentNameCollectionXml::add(supportingAttachmentNameCollectionVal, supportingAttachmentNameCollectionXml); - } - - const std::string argumentsVal = packageDefnDoc->getArguments(); - if (! argumentsVal.empty()) { - thisXml->addAttribute("arguments", argumentsVal); - } - } - CAF_CM_EXIT; -} - -SmartPtrCPackageDefnDoc PackageDefnXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("PackageDefnXml", "parse"); - - SmartPtrCPackageDefnDoc packageDefnDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string startupAttachmentNameStrVal = - thisXml->findRequiredAttribute("startupAttachmentName"); - const std::string startupAttachmentNameVal = startupAttachmentNameStrVal; - - const std::string packageAttachmentNameStrVal = - thisXml->findRequiredAttribute("packageAttachmentName"); - const std::string packageAttachmentNameVal = packageAttachmentNameStrVal; - - const SmartPtrCXmlElement supportingAttachmentNameCollectionXml = - thisXml->findOptionalChild("attachmentNameCollection"); - - SmartPtrCAttachmentNameCollectionDoc supportingAttachmentNameCollectionVal; - if (! supportingAttachmentNameCollectionXml.IsNull()) { - supportingAttachmentNameCollectionVal = AttachmentNameCollectionXml::parse(supportingAttachmentNameCollectionXml); - } - - const std::string argumentsStrVal = - thisXml->findOptionalAttribute("arguments"); - const std::string argumentsVal = argumentsStrVal; - - packageDefnDoc.CreateInstance(); - packageDefnDoc->initialize( - startupAttachmentNameVal, - packageAttachmentNameVal, - supportingAttachmentNameCollectionVal, - argumentsVal); - } - CAF_CM_EXIT; - - return packageDefnDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafInstallRequestXml/UninstallProviderJobXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafInstallRequestXml/UninstallProviderJobXml.cpp deleted file mode 100644 index 7092709cc..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafInstallRequestXml/UninstallProviderJobXml.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocUtils/EnumConvertersXml.h" -#include "Doc/CafInstallRequestDoc/CafInstallRequestDocTypes.h" - -#include "Doc/CafInstallRequestDoc/CUninstallProviderJobDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/CafInstallRequestXml/UninstallProviderJobXml.h" - -using namespace Caf; - -void UninstallProviderJobXml::add( - const SmartPtrCUninstallProviderJobDoc uninstallProviderJobDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("UninstallProviderJobXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(uninstallProviderJobDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string clientIdVal = - BasePlatform::UuidToString(uninstallProviderJobDoc->getClientId()); - CAF_CM_VALIDATE_STRING(clientIdVal); - thisXml->addAttribute("clientId", clientIdVal); - - const std::string jobIdVal = - BasePlatform::UuidToString(uninstallProviderJobDoc->getJobId()); - CAF_CM_VALIDATE_STRING(jobIdVal); - thisXml->addAttribute("jobId", jobIdVal); - - const std::string providerNamespaceVal = uninstallProviderJobDoc->getProviderNamespace(); - CAF_CM_VALIDATE_STRING(providerNamespaceVal); - thisXml->addAttribute("providerNamespace", providerNamespaceVal); - - const std::string providerNameVal = uninstallProviderJobDoc->getProviderName(); - CAF_CM_VALIDATE_STRING(providerNameVal); - thisXml->addAttribute("providerName", providerNameVal); - - const std::string providerVersionVal = uninstallProviderJobDoc->getProviderVersion(); - CAF_CM_VALIDATE_STRING(providerVersionVal); - thisXml->addAttribute("providerVersion", providerVersionVal); - - const std::string packageOSTypeVal = - EnumConvertersXml::convertPackageOSTypeToString(uninstallProviderJobDoc->getPackageOSType()); - CAF_CM_VALIDATE_STRING(packageOSTypeVal); - thisXml->addAttribute("packageOSType", packageOSTypeVal); - } - CAF_CM_EXIT; -} - -SmartPtrCUninstallProviderJobDoc UninstallProviderJobXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("UninstallProviderJobXml", "parse"); - - SmartPtrCUninstallProviderJobDoc uninstallProviderJobDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string clientIdStrVal = - thisXml->findRequiredAttribute("clientId"); - UUID clientIdVal = CAFCOMMON_GUID_NULL; - BasePlatform::UuidFromString(clientIdStrVal.c_str(), clientIdVal); - - const std::string jobIdStrVal = - thisXml->findRequiredAttribute("jobId"); - UUID jobIdVal = CAFCOMMON_GUID_NULL; - BasePlatform::UuidFromString(jobIdStrVal.c_str(), jobIdVal); - - const std::string providerNamespaceStrVal = - thisXml->findRequiredAttribute("providerNamespace"); - const std::string providerNamespaceVal = providerNamespaceStrVal; - - const std::string providerNameStrVal = - thisXml->findRequiredAttribute("providerName"); - const std::string providerNameVal = providerNameStrVal; - - const std::string providerVersionStrVal = - thisXml->findRequiredAttribute("providerVersion"); - const std::string providerVersionVal = providerVersionStrVal; - - const std::string packageOSTypeStrVal = - thisXml->findRequiredAttribute("packageOSType"); - PACKAGE_OS_TYPE packageOSTypeVal = PACKAGE_OS_NONE; - if (! packageOSTypeStrVal.empty()) { - packageOSTypeVal = EnumConvertersXml::convertStringToPackageOSType(packageOSTypeStrVal); - } - - uninstallProviderJobDoc.CreateInstance(); - uninstallProviderJobDoc->initialize( - clientIdVal, - jobIdVal, - providerNamespaceVal, - providerNameVal, - providerVersionVal, - packageOSTypeVal); - } - CAF_CM_EXIT; - - return uninstallProviderJobDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafInstallRequestXml/stdafx.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafInstallRequestXml/stdafx.h deleted file mode 100644 index 49d3d214c..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/CafInstallRequestXml/stdafx.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef STDAFX_H_ -#define STDAFX_H_ - -#ifdef WIN32 - #define CAFINSTALLREQUESTXML_LINKAGE __declspec(dllexport) -#else - #define CAFINSTALLREQUESTXML_LINKAGE -#endif - -#include - -#include -#include - - -#endif /* STDAFX_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/DiagRequestXml/DiagRequestXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/DiagRequestXml/DiagRequestXml.cpp deleted file mode 100644 index ed54bfa59..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/DiagRequestXml/DiagRequestXml.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/CafCoreTypesXml/RequestHeaderXml.h" -#include "Doc/DocXml/DiagTypesXml/DiagBatchXml.h" - -#include "Doc/CafCoreTypesDoc/CRequestHeaderDoc.h" -#include "Doc/DiagRequestDoc/CDiagRequestDoc.h" -#include "Doc/DiagTypesDoc/CDiagBatchDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/DiagRequestXml/DiagRequestXml.h" - -using namespace Caf; - -void DiagRequestXml::add( - const SmartPtrCDiagRequestDoc diagRequestDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("DiagRequestXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(diagRequestDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string clientIdVal = - BasePlatform::UuidToString(diagRequestDoc->getClientId()); - CAF_CM_VALIDATE_STRING(clientIdVal); - thisXml->addAttribute("clientId", clientIdVal); - - const std::string requestIdVal = - BasePlatform::UuidToString(diagRequestDoc->getRequestId()); - CAF_CM_VALIDATE_STRING(requestIdVal); - thisXml->addAttribute("requestId", requestIdVal); - - const std::string pmeIdVal = diagRequestDoc->getPmeId(); - CAF_CM_VALIDATE_STRING(pmeIdVal); - thisXml->addAttribute("pmeId", pmeIdVal); - - const SmartPtrCRequestHeaderDoc requestHeaderVal = - diagRequestDoc->getRequestHeader(); - CAF_CM_VALIDATE_SMARTPTR(requestHeaderVal); - - const SmartPtrCXmlElement requestHeaderXml = - thisXml->createAndAddElement("requestHeader"); - RequestHeaderXml::add(requestHeaderVal, requestHeaderXml); - - const SmartPtrCDiagBatchDoc batchVal = - diagRequestDoc->getBatch(); - CAF_CM_VALIDATE_SMARTPTR(batchVal); - - const SmartPtrCXmlElement batchXml = - thisXml->createAndAddElement("batch"); - DiagBatchXml::add(batchVal, batchXml); - } - CAF_CM_EXIT; -} - -SmartPtrCDiagRequestDoc DiagRequestXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("DiagRequestXml", "parse"); - - SmartPtrCDiagRequestDoc diagRequestDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string clientIdStrVal = - thisXml->findRequiredAttribute("clientId"); - UUID clientIdVal = CAFCOMMON_GUID_NULL; - if (! clientIdStrVal.empty()) { - BasePlatform::UuidFromString(clientIdStrVal.c_str(), clientIdVal); - } - - const std::string requestIdStrVal = - thisXml->findRequiredAttribute("requestId"); - UUID requestIdVal = CAFCOMMON_GUID_NULL; - if (! requestIdStrVal.empty()) { - BasePlatform::UuidFromString(requestIdStrVal.c_str(), requestIdVal); - } - - const std::string pmeIdVal = - thisXml->findRequiredAttribute("pmeId"); - - const SmartPtrCXmlElement requestHeaderXml = - thisXml->findRequiredChild("requestHeader"); - - SmartPtrCRequestHeaderDoc requestHeaderVal; - if (! requestHeaderXml.IsNull()) { - requestHeaderVal = RequestHeaderXml::parse(requestHeaderXml); - } - - const SmartPtrCXmlElement batchXml = - thisXml->findRequiredChild("batch"); - - SmartPtrCDiagBatchDoc batchVal; - if (! batchXml.IsNull()) { - batchVal = DiagBatchXml::parse(batchXml); - } - - diagRequestDoc.CreateInstance(); - diagRequestDoc->initialize( - clientIdVal, - requestIdVal, - pmeIdVal, - requestHeaderVal, - batchVal); - } - CAF_CM_EXIT; - - return diagRequestDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/DiagRequestXml/DiagRequestXmlRoots.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/DiagRequestXml/DiagRequestXmlRoots.cpp deleted file mode 100644 index 21cd24a1f..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/DiagRequestXml/DiagRequestXmlRoots.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/CafCoreTypesXml/RequestXml.h" -#include "Doc/DocXml/DiagRequestXml/DiagRequestXml.h" - -#include "Doc/DiagRequestDoc/CDiagRequestDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/DiagRequestXml/DiagRequestXmlRoots.h" - -using namespace Caf; - -std::string XmlRoots::saveDiagRequestToString( - const SmartPtrCDiagRequestDoc diagRequestDoc) { - CAF_CM_STATIC_FUNC_VALIDATE("XmlRoots", "saveDiagRequestToString"); - - std::string rc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(diagRequestDoc); - - const std::string schemaNamespace = DocXmlUtils::getSchemaNamespace("fx"); - const std::string schemaLocation = DocXmlUtils::getSchemaLocation("fx/DiagRequest.xsd"); - - const SmartPtrCXmlElement rootXml = CXmlUtils::createRootElement( - "diagRequest", schemaNamespace, schemaLocation); - DiagRequestXml::add(diagRequestDoc, rootXml); - - rc = rootXml->saveToString(); - } - CAF_CM_EXIT; - - return rc; -} - -SmartPtrCDiagRequestDoc XmlRoots::parseDiagRequestFromString( - const std::string xml) { - CAF_CM_STATIC_FUNC_VALIDATE("XmlRoots", "parseDiagRequestFromString"); - - SmartPtrCDiagRequestDoc diagRequestDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(xml); - - const SmartPtrCXmlElement rootXml = RequestXml::parseString(xml, "caf:diagRequest"); - diagRequestDoc = DiagRequestXml::parse(rootXml); - } - CAF_CM_EXIT; - - return diagRequestDoc; -} - -void XmlRoots::saveDiagRequestToFile( - const SmartPtrCDiagRequestDoc diagRequestDoc, - const std::string filePath) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("XmlRoots", "saveDiagRequestToFile"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(diagRequestDoc); - CAF_CM_VALIDATE_STRING(filePath); - - CAF_CM_LOG_DEBUG_VA1("Saving to file - %s", filePath.c_str()); - - const std::string diagRequestStr = - saveDiagRequestToString(diagRequestDoc); - FileSystemUtils::saveTextFile(filePath, diagRequestStr); - } - CAF_CM_EXIT; -} - -SmartPtrCDiagRequestDoc XmlRoots::parseDiagRequestFromFile( - const std::string filePath) { - CAF_CM_STATIC_FUNC_VALIDATE("XmlRoots", "parseDiagRequestFromFile"); - - SmartPtrCDiagRequestDoc diagRequestDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(filePath); - - const SmartPtrCXmlElement rootXml = RequestXml::parseFile(filePath, "caf:diagRequest"); - diagRequestDoc = DiagRequestXml::parse(rootXml); - } - CAF_CM_EXIT; - - return diagRequestDoc; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/DiagRequestXml/stdafx.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/DiagRequestXml/stdafx.h deleted file mode 100644 index 75e50bf79..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/DiagRequestXml/stdafx.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef STDAFX_H_ -#define STDAFX_H_ - -#ifdef WIN32 - #define DIAGREQUESTXML_LINKAGE __declspec(dllexport) -#else - #define DIAGREQUESTXML_LINKAGE -#endif - -#include - -#include -#include - - -#endif /* STDAFX_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/DiagTypesXml/DiagBatchXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/DiagTypesXml/DiagBatchXml.cpp deleted file mode 100644 index 60f1ef32b..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/DiagTypesXml/DiagBatchXml.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/DiagTypesXml/DiagCollectInstancesXml.h" -#include "Doc/DocXml/DiagTypesXml/DiagDeleteValueCollectionXml.h" -#include "Doc/DocXml/DiagTypesXml/DiagSetValueCollectionXml.h" - -#include "Doc/DiagTypesDoc/CDiagBatchDoc.h" -#include "Doc/DiagTypesDoc/CDiagCollectInstancesDoc.h" -#include "Doc/DiagTypesDoc/CDiagDeleteValueCollectionDoc.h" -#include "Doc/DiagTypesDoc/CDiagSetValueCollectionDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/DiagTypesXml/DiagBatchXml.h" - -using namespace Caf; - -void DiagBatchXml::add( - const SmartPtrCDiagBatchDoc diagBatchDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("DiagBatchXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(diagBatchDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const SmartPtrCDiagCollectInstancesDoc collectInstancesVal = - diagBatchDoc->getCollectInstances(); - if (! collectInstancesVal.IsNull()) { - const SmartPtrCXmlElement collectInstancesXml = - thisXml->createAndAddElement("collectInstances"); - DiagCollectInstancesXml::add(collectInstancesVal, collectInstancesXml); - } - - const SmartPtrCDiagSetValueCollectionDoc setValueCollectionVal = - diagBatchDoc->getSetValueCollection(); - if (! setValueCollectionVal.IsNull()) { - const SmartPtrCXmlElement setValueCollectionXml = - thisXml->createAndAddElement("setValueCollection"); - DiagSetValueCollectionXml::add(setValueCollectionVal, setValueCollectionXml); - } - - const SmartPtrCDiagDeleteValueCollectionDoc deleteValueCollectionVal = - diagBatchDoc->getDeleteValueCollection(); - if (! deleteValueCollectionVal.IsNull()) { - const SmartPtrCXmlElement deleteValueCollectionXml = - thisXml->createAndAddElement("deleteValueCollection"); - DiagDeleteValueCollectionXml::add(deleteValueCollectionVal, deleteValueCollectionXml); - } - } - CAF_CM_EXIT; -} - -SmartPtrCDiagBatchDoc DiagBatchXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("DiagBatchXml", "parse"); - - SmartPtrCDiagBatchDoc diagBatchDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const SmartPtrCXmlElement collectInstancesXml = - thisXml->findOptionalChild("collectInstances"); - - SmartPtrCDiagCollectInstancesDoc collectInstancesVal; - if (! collectInstancesXml.IsNull()) { - collectInstancesVal = DiagCollectInstancesXml::parse(collectInstancesXml); - } - - const SmartPtrCXmlElement setValueCollectionXml = - thisXml->findOptionalChild("setValueCollection"); - - SmartPtrCDiagSetValueCollectionDoc setValueCollectionVal; - if (! setValueCollectionXml.IsNull()) { - setValueCollectionVal = DiagSetValueCollectionXml::parse(setValueCollectionXml); - } - - const SmartPtrCXmlElement deleteValueCollectionXml = - thisXml->findOptionalChild("deleteValueCollection"); - - SmartPtrCDiagDeleteValueCollectionDoc deleteValueCollectionVal; - if (! deleteValueCollectionXml.IsNull()) { - deleteValueCollectionVal = DiagDeleteValueCollectionXml::parse(deleteValueCollectionXml); - } - - diagBatchDoc.CreateInstance(); - diagBatchDoc->initialize( - collectInstancesVal, - setValueCollectionVal, - deleteValueCollectionVal); - } - CAF_CM_EXIT; - - return diagBatchDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/DiagTypesXml/DiagCollectInstancesXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/DiagTypesXml/DiagCollectInstancesXml.cpp deleted file mode 100644 index c87f76c5d..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/DiagTypesXml/DiagCollectInstancesXml.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DiagTypesDoc/CDiagCollectInstancesDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/DiagTypesXml/DiagCollectInstancesXml.h" - -using namespace Caf; - -void DiagCollectInstancesXml::add( - const SmartPtrCDiagCollectInstancesDoc diagCollectInstancesDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("DiagCollectInstancesXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(diagCollectInstancesDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string jobIdVal = - BasePlatform::UuidToString(diagCollectInstancesDoc->getJobId()); - CAF_CM_VALIDATE_STRING(jobIdVal); - thisXml->addAttribute("jobId", jobIdVal); - } - CAF_CM_EXIT; -} - -SmartPtrCDiagCollectInstancesDoc DiagCollectInstancesXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("DiagCollectInstancesXml", "parse"); - - SmartPtrCDiagCollectInstancesDoc diagCollectInstancesDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string jobIdStrVal = - thisXml->findRequiredAttribute("jobId"); - UUID jobIdVal = CAFCOMMON_GUID_NULL; - if (! jobIdStrVal.empty()) { - BasePlatform::UuidFromString(jobIdStrVal.c_str(), jobIdVal); - } - - diagCollectInstancesDoc.CreateInstance(); - diagCollectInstancesDoc->initialize( - jobIdVal); - } - CAF_CM_EXIT; - - return diagCollectInstancesDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/DiagTypesXml/DiagDeleteValueCollectionXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/DiagTypesXml/DiagDeleteValueCollectionXml.cpp deleted file mode 100644 index 257bf2310..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/DiagTypesXml/DiagDeleteValueCollectionXml.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/DiagTypesXml/DiagDeleteValueXml.h" - -#include "Doc/DiagTypesDoc/CDiagDeleteValueCollectionDoc.h" -#include "Doc/DiagTypesDoc/CDiagDeleteValueDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/DiagTypesXml/DiagDeleteValueCollectionXml.h" - -using namespace Caf; - -void DiagDeleteValueCollectionXml::add( - const SmartPtrCDiagDeleteValueCollectionDoc diagDeleteValueCollectionDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("DiagDeleteValueCollectionXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(diagDeleteValueCollectionDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::deque deleteValueVal = - diagDeleteValueCollectionDoc->getDeleteValueCollection(); - CAF_CM_VALIDATE_STL(deleteValueVal); - - if (! deleteValueVal.empty()) { - for (TConstIterator > deleteValueIter(deleteValueVal); - deleteValueIter; deleteValueIter++) { - const SmartPtrCXmlElement deleteValueXml = - thisXml->createAndAddElement("deleteValue"); - DiagDeleteValueXml::add(*deleteValueIter, deleteValueXml); - } - } - } - CAF_CM_EXIT; -} - -SmartPtrCDiagDeleteValueCollectionDoc DiagDeleteValueCollectionXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("DiagDeleteValueCollectionXml", "parse"); - - SmartPtrCDiagDeleteValueCollectionDoc diagDeleteValueCollectionDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const CXmlElement::SmartPtrCElementCollection deleteValueChildrenXml = - thisXml->findRequiredChildren("deleteValue"); - - std::deque deleteValueVal; - if (! deleteValueChildrenXml.IsNull() && ! deleteValueChildrenXml->empty()) { - for (TConstIterator deleteValueXmlIter(*deleteValueChildrenXml); - deleteValueXmlIter; deleteValueXmlIter++) { - const SmartPtrCXmlElement deleteValueXml = deleteValueXmlIter->second; - const SmartPtrCDiagDeleteValueDoc deleteValueDoc = - DiagDeleteValueXml::parse(deleteValueXml); - deleteValueVal.push_back(deleteValueDoc); - } - } - - diagDeleteValueCollectionDoc.CreateInstance(); - diagDeleteValueCollectionDoc->initialize( - deleteValueVal); - } - CAF_CM_EXIT; - - return diagDeleteValueCollectionDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/DiagTypesXml/DiagDeleteValueXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/DiagTypesXml/DiagDeleteValueXml.cpp deleted file mode 100644 index 96a0e3caf..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/DiagTypesXml/DiagDeleteValueXml.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DiagTypesDoc/CDiagDeleteValueDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/DiagTypesXml/DiagDeleteValueXml.h" - -using namespace Caf; - -void DiagDeleteValueXml::add( - const SmartPtrCDiagDeleteValueDoc diagDeleteValueDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("DiagDeleteValueXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(diagDeleteValueDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string jobIdVal = - BasePlatform::UuidToString(diagDeleteValueDoc->getJobId()); - CAF_CM_VALIDATE_STRING(jobIdVal); - thisXml->addAttribute("jobId", jobIdVal); - - const std::string fileAliasVal = diagDeleteValueDoc->getFileAlias(); - CAF_CM_VALIDATE_STRING(fileAliasVal); - thisXml->addAttribute("fileAlias", fileAliasVal); - - const std::string valueNameVal = - diagDeleteValueDoc->getValueName(); - CAF_CM_VALIDATE_STRING(valueNameVal); - - const SmartPtrCXmlElement valueNameXml = - thisXml->createAndAddElement("valueName"); - valueNameXml->setValue(valueNameVal); - } - CAF_CM_EXIT; -} - -SmartPtrCDiagDeleteValueDoc DiagDeleteValueXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("DiagDeleteValueXml", "parse"); - - SmartPtrCDiagDeleteValueDoc diagDeleteValueDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string jobIdStrVal = - thisXml->findRequiredAttribute("jobId"); - UUID jobIdVal = CAFCOMMON_GUID_NULL; - if (! jobIdStrVal.empty()) { - BasePlatform::UuidFromString(jobIdStrVal.c_str(), jobIdVal); - } - - const std::string fileAliasStrVal = - thisXml->findRequiredAttribute("fileAlias"); - const std::string fileAliasVal = fileAliasStrVal; - - const SmartPtrCXmlElement valueNameXml = - thisXml->findRequiredChild("valueName"); - - std::string valueNameVal; - if (! valueNameXml.IsNull()) { - valueNameVal = valueNameXml->getValue(); - } - - diagDeleteValueDoc.CreateInstance(); - diagDeleteValueDoc->initialize( - jobIdVal, - fileAliasVal, - valueNameVal); - } - CAF_CM_EXIT; - - return diagDeleteValueDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/DiagTypesXml/DiagSetValueCollectionXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/DiagTypesXml/DiagSetValueCollectionXml.cpp deleted file mode 100644 index d9048c997..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/DiagTypesXml/DiagSetValueCollectionXml.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/DiagTypesXml/DiagSetValueXml.h" - -#include "Doc/DiagTypesDoc/CDiagSetValueCollectionDoc.h" -#include "Doc/DiagTypesDoc/CDiagSetValueDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/DiagTypesXml/DiagSetValueCollectionXml.h" - -using namespace Caf; - -void DiagSetValueCollectionXml::add( - const SmartPtrCDiagSetValueCollectionDoc diagSetValueCollectionDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("DiagSetValueCollectionXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(diagSetValueCollectionDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::deque setValueVal = - diagSetValueCollectionDoc->getSetValueCollection(); - CAF_CM_VALIDATE_STL(setValueVal); - - if (! setValueVal.empty()) { - for (TConstIterator > setValueIter(setValueVal); - setValueIter; setValueIter++) { - const SmartPtrCXmlElement setValueXml = - thisXml->createAndAddElement("setValue"); - DiagSetValueXml::add(*setValueIter, setValueXml); - } - } - } - CAF_CM_EXIT; -} - -SmartPtrCDiagSetValueCollectionDoc DiagSetValueCollectionXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("DiagSetValueCollectionXml", "parse"); - - SmartPtrCDiagSetValueCollectionDoc diagSetValueCollectionDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const CXmlElement::SmartPtrCElementCollection setValueChildrenXml = - thisXml->findRequiredChildren("setValue"); - - std::deque setValueVal; - if (! setValueChildrenXml.IsNull() && ! setValueChildrenXml->empty()) { - for (TConstIterator setValueXmlIter(*setValueChildrenXml); - setValueXmlIter; setValueXmlIter++) { - const SmartPtrCXmlElement setValueXml = setValueXmlIter->second; - const SmartPtrCDiagSetValueDoc setValueDoc = - DiagSetValueXml::parse(setValueXml); - setValueVal.push_back(setValueDoc); - } - } - - diagSetValueCollectionDoc.CreateInstance(); - diagSetValueCollectionDoc->initialize( - setValueVal); - } - CAF_CM_EXIT; - - return diagSetValueCollectionDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/DiagTypesXml/DiagSetValueXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/DiagTypesXml/DiagSetValueXml.cpp deleted file mode 100644 index da5471f70..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/DiagTypesXml/DiagSetValueXml.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/CafCoreTypesXml/PropertyXml.h" - -#include "Doc/CafCoreTypesDoc/CPropertyDoc.h" -#include "Doc/DiagTypesDoc/CDiagSetValueDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/DiagTypesXml/DiagSetValueXml.h" - -using namespace Caf; - -void DiagSetValueXml::add( - const SmartPtrCDiagSetValueDoc diagSetValueDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("DiagSetValueXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(diagSetValueDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string jobIdVal = - BasePlatform::UuidToString(diagSetValueDoc->getJobId()); - CAF_CM_VALIDATE_STRING(jobIdVal); - thisXml->addAttribute("jobId", jobIdVal); - - const std::string fileAliasVal = diagSetValueDoc->getFileAlias(); - CAF_CM_VALIDATE_STRING(fileAliasVal); - thisXml->addAttribute("fileAlias", fileAliasVal); - - const SmartPtrCPropertyDoc valueVal = - diagSetValueDoc->getValue(); - CAF_CM_VALIDATE_SMARTPTR(valueVal); - - const SmartPtrCXmlElement valueXml = - thisXml->createAndAddElement("value"); - PropertyXml::add(valueVal, valueXml); - } - CAF_CM_EXIT; -} - -SmartPtrCDiagSetValueDoc DiagSetValueXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("DiagSetValueXml", "parse"); - - SmartPtrCDiagSetValueDoc diagSetValueDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string jobIdStrVal = - thisXml->findRequiredAttribute("jobId"); - UUID jobIdVal = CAFCOMMON_GUID_NULL; - if (! jobIdStrVal.empty()) { - BasePlatform::UuidFromString(jobIdStrVal.c_str(), jobIdVal); - } - - const std::string fileAliasStrVal = - thisXml->findRequiredAttribute("fileAlias"); - const std::string fileAliasVal = fileAliasStrVal; - - const SmartPtrCXmlElement valueXml = - thisXml->findRequiredChild("value"); - - SmartPtrCPropertyDoc valueVal; - if (! valueXml.IsNull()) { - valueVal = PropertyXml::parse(valueXml); - } - - diagSetValueDoc.CreateInstance(); - diagSetValueDoc->initialize( - jobIdVal, - fileAliasVal, - valueVal); - } - CAF_CM_EXIT; - - return diagSetValueDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/DiagTypesXml/stdafx.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/DiagTypesXml/stdafx.h deleted file mode 100644 index aca7b2bbe..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/DiagTypesXml/stdafx.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef STDAFX_H_ -#define STDAFX_H_ - -#ifdef WIN32 - #define DIAGTYPESXML_LINKAGE __declspec(dllexport) -#else - #define DIAGTYPESXML_LINKAGE -#endif - -#include - -#include -#include - - -#endif /* STDAFX_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/MgmtRequestXml/MgmtRequestXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/MgmtRequestXml/MgmtRequestXml.cpp deleted file mode 100644 index 3727dca2a..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/MgmtRequestXml/MgmtRequestXml.cpp +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/CafCoreTypesXml/AttachmentCollectionXml.h" -#include "Doc/DocXml/CafCoreTypesXml/RequestHeaderXml.h" -#include "Doc/DocXml/MgmtTypesXml/MgmtBatchXml.h" - -#include "Doc/CafCoreTypesDoc/CAttachmentCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CRequestHeaderDoc.h" -#include "Doc/MgmtRequestDoc/CMgmtRequestDoc.h" -#include "Doc/MgmtTypesDoc/CMgmtBatchDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/MgmtRequestXml/MgmtRequestXml.h" - -using namespace Caf; - -void MgmtRequestXml::add( - const SmartPtrCMgmtRequestDoc mgmtRequestDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("MgmtRequestXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(mgmtRequestDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string clientIdVal = - BasePlatform::UuidToString(mgmtRequestDoc->getClientId()); - CAF_CM_VALIDATE_STRING(clientIdVal); - thisXml->addAttribute("clientId", clientIdVal); - - const std::string requestIdVal = - BasePlatform::UuidToString(mgmtRequestDoc->getRequestId()); - CAF_CM_VALIDATE_STRING(requestIdVal); - thisXml->addAttribute("requestId", requestIdVal); - - const std::string pmeIdVal = mgmtRequestDoc->getPmeId(); - CAF_CM_VALIDATE_STRING(pmeIdVal); - thisXml->addAttribute("pmeId", pmeIdVal); - - const SmartPtrCRequestHeaderDoc requestHeaderVal = - mgmtRequestDoc->getRequestHeader(); - CAF_CM_VALIDATE_SMARTPTR(requestHeaderVal); - - const SmartPtrCXmlElement requestHeaderXml = - thisXml->createAndAddElement("requestHeader"); - RequestHeaderXml::add(requestHeaderVal, requestHeaderXml); - - const SmartPtrCMgmtBatchDoc batchVal = - mgmtRequestDoc->getBatch(); - CAF_CM_VALIDATE_SMARTPTR(batchVal); - - const SmartPtrCXmlElement batchXml = - thisXml->createAndAddElement("batch"); - MgmtBatchXml::add(batchVal, batchXml); - - const SmartPtrCAttachmentCollectionDoc attachmentCollectionVal = - mgmtRequestDoc->getAttachmentCollection(); - if (! attachmentCollectionVal.IsNull()) { - const SmartPtrCXmlElement attachmentCollectionXml = - thisXml->createAndAddElement("attachmentCollection"); - AttachmentCollectionXml::add(attachmentCollectionVal, attachmentCollectionXml); - } - } - CAF_CM_EXIT; -} - -SmartPtrCMgmtRequestDoc MgmtRequestXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("MgmtRequestXml", "parse"); - - SmartPtrCMgmtRequestDoc mgmtRequestDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string clientIdStrVal = - thisXml->findRequiredAttribute("clientId"); - UUID clientIdVal = CAFCOMMON_GUID_NULL; - if (! clientIdStrVal.empty()) { - BasePlatform::UuidFromString(clientIdStrVal.c_str(), clientIdVal); - } - - const std::string requestIdStrVal = - thisXml->findRequiredAttribute("requestId"); - UUID requestIdVal = CAFCOMMON_GUID_NULL; - if (! requestIdStrVal.empty()) { - BasePlatform::UuidFromString(requestIdStrVal.c_str(), requestIdVal); - } - - const std::string pmeIdVal = - thisXml->findRequiredAttribute("pmeId"); - - const SmartPtrCXmlElement requestHeaderXml = - thisXml->findRequiredChild("requestHeader"); - SmartPtrCRequestHeaderDoc requestHeaderVal; - if (! requestHeaderXml.IsNull()) { - requestHeaderVal = RequestHeaderXml::parse(requestHeaderXml); - } - - const SmartPtrCXmlElement batchXml = - thisXml->findRequiredChild("batch"); - SmartPtrCMgmtBatchDoc batchVal; - if (! batchXml.IsNull()) { - batchVal = MgmtBatchXml::parse(batchXml); - } - - const SmartPtrCXmlElement attachmentCollectionXml = - thisXml->findOptionalChild("attachmentCollection"); - - SmartPtrCAttachmentCollectionDoc attachmentCollectionVal; - if (! attachmentCollectionXml.IsNull()) { - attachmentCollectionVal = AttachmentCollectionXml::parse(attachmentCollectionXml); - } - - mgmtRequestDoc.CreateInstance(); - mgmtRequestDoc->initialize( - clientIdVal, - requestIdVal, - pmeIdVal, - requestHeaderVal, - batchVal, - attachmentCollectionVal); - } - CAF_CM_EXIT; - - return mgmtRequestDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/MgmtRequestXml/MgmtRequestXmlRoots.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/MgmtRequestXml/MgmtRequestXmlRoots.cpp deleted file mode 100644 index 38a4b2879..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/MgmtRequestXml/MgmtRequestXmlRoots.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/CafCoreTypesXml/RequestXml.h" -#include "Doc/DocXml/MgmtRequestXml/MgmtRequestXml.h" - -#include "Doc/MgmtRequestDoc/CMgmtRequestDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/MgmtRequestXml/MgmtRequestXmlRoots.h" - -using namespace Caf; - -std::string XmlRoots::saveMgmtRequestToString( - const SmartPtrCMgmtRequestDoc mgmtRequestDoc) { - CAF_CM_STATIC_FUNC_VALIDATE("XmlRoots", "saveMgmtRequestToString"); - - std::string rc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(mgmtRequestDoc); - - const std::string schemaNamespace = DocXmlUtils::getSchemaNamespace("fx"); - const std::string schemaLocation = DocXmlUtils::getSchemaLocation("fx/MgmtRequest.xsd"); - - const SmartPtrCXmlElement rootXml = CXmlUtils::createRootElement( - "mgmtRequest", schemaNamespace, schemaLocation); - MgmtRequestXml::add(mgmtRequestDoc, rootXml); - - rc = rootXml->saveToString(); - } - CAF_CM_EXIT; - - return rc; -} - -SmartPtrCMgmtRequestDoc XmlRoots::parseMgmtRequestFromString( - const std::string xml) { - CAF_CM_STATIC_FUNC_VALIDATE("XmlRoots", "parseMgmtRequestFromString"); - - SmartPtrCMgmtRequestDoc mgmtRequestDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(xml); - - const SmartPtrCXmlElement rootXml = RequestXml::parseString(xml, "caf:mgmtRequest"); - mgmtRequestDoc = MgmtRequestXml::parse(rootXml); - } - CAF_CM_EXIT; - - return mgmtRequestDoc; -} - -void XmlRoots::saveMgmtRequestToFile( - const SmartPtrCMgmtRequestDoc mgmtRequestDoc, - const std::string filePath) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("XmlRoots", "saveMgmtRequestToFile"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(mgmtRequestDoc); - CAF_CM_VALIDATE_STRING(filePath); - - CAF_CM_LOG_DEBUG_VA1("Saving to file - %s", filePath.c_str()); - - const std::string mgmtRequestStr = - saveMgmtRequestToString(mgmtRequestDoc); - FileSystemUtils::saveTextFile(filePath, mgmtRequestStr); - } - CAF_CM_EXIT; -} - -SmartPtrCMgmtRequestDoc XmlRoots::parseMgmtRequestFromFile( - const std::string filePath) { - CAF_CM_STATIC_FUNC_VALIDATE("XmlRoots", "parseMgmtRequestFromFile"); - - SmartPtrCMgmtRequestDoc mgmtRequestDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(filePath); - - const SmartPtrCXmlElement rootXml = RequestXml::parseFile(filePath, "caf:mgmtRequest"); - mgmtRequestDoc = MgmtRequestXml::parse(rootXml); - } - CAF_CM_EXIT; - - return mgmtRequestDoc; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/MgmtRequestXml/stdafx.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/MgmtRequestXml/stdafx.h deleted file mode 100644 index 3e1cb250b..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/MgmtRequestXml/stdafx.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef STDAFX_H_ -#define STDAFX_H_ - -#ifdef WIN32 - #define MGMTREQUESTXML_LINKAGE __declspec(dllexport) -#else - #define MGMTREQUESTXML_LINKAGE -#endif - -#include - -#include -#include - - -#endif /* STDAFX_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/MgmtTypesXml/MgmtBatchXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/MgmtTypesXml/MgmtBatchXml.cpp deleted file mode 100644 index 315b0fda7..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/MgmtTypesXml/MgmtBatchXml.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/MgmtTypesXml/MgmtCollectInstancesCollectionXml.h" -#include "Doc/DocXml/MgmtTypesXml/MgmtCollectSchemaXml.h" -#include "Doc/DocXml/MgmtTypesXml/MgmtInvokeOperationCollectionXml.h" - -#include "Doc/MgmtTypesDoc/CMgmtBatchDoc.h" -#include "Doc/MgmtTypesDoc/CMgmtCollectInstancesCollectionDoc.h" -#include "Doc/MgmtTypesDoc/CMgmtCollectSchemaDoc.h" -#include "Doc/MgmtTypesDoc/CMgmtInvokeOperationCollectionDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/MgmtTypesXml/MgmtBatchXml.h" - -using namespace Caf; - -void MgmtBatchXml::add( - const SmartPtrCMgmtBatchDoc mgmtBatchDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("MgmtBatchXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(mgmtBatchDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const SmartPtrCMgmtCollectSchemaDoc collectSchemaVal = - mgmtBatchDoc->getCollectSchema(); - if (! collectSchemaVal.IsNull()) { - const SmartPtrCXmlElement collectSchemaXml = - thisXml->createAndAddElement("collectSchema"); - MgmtCollectSchemaXml::add(collectSchemaVal, collectSchemaXml); - } - - const SmartPtrCMgmtCollectInstancesCollectionDoc collectInstancesCollectionVal = - mgmtBatchDoc->getCollectInstancesCollection(); - if (! collectInstancesCollectionVal.IsNull()) { - const SmartPtrCXmlElement collectInstancesCollectionXml = - thisXml->createAndAddElement("collectInstancesCollection"); - MgmtCollectInstancesCollectionXml::add(collectInstancesCollectionVal, collectInstancesCollectionXml); - } - - const SmartPtrCMgmtInvokeOperationCollectionDoc invokeOperationCollectionVal = - mgmtBatchDoc->getInvokeOperationCollection(); - if (! invokeOperationCollectionVal.IsNull()) { - const SmartPtrCXmlElement invokeOperationCollectionXml = - thisXml->createAndAddElement("invokeOperationCollection"); - MgmtInvokeOperationCollectionXml::add(invokeOperationCollectionVal, invokeOperationCollectionXml); - } - } - CAF_CM_EXIT; -} - -SmartPtrCMgmtBatchDoc MgmtBatchXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("MgmtBatchXml", "parse"); - - SmartPtrCMgmtBatchDoc mgmtBatchDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const SmartPtrCXmlElement collectSchemaXml = - thisXml->findOptionalChild("collectSchema"); - - SmartPtrCMgmtCollectSchemaDoc collectSchemaVal; - if (! collectSchemaXml.IsNull()) { - collectSchemaVal = MgmtCollectSchemaXml::parse(collectSchemaXml); - } - - const SmartPtrCXmlElement collectInstancesCollectionXml = - thisXml->findOptionalChild("collectInstancesCollection"); - - SmartPtrCMgmtCollectInstancesCollectionDoc collectInstancesCollectionVal; - if (! collectInstancesCollectionXml.IsNull()) { - collectInstancesCollectionVal = MgmtCollectInstancesCollectionXml::parse(collectInstancesCollectionXml); - } - - const SmartPtrCXmlElement invokeOperationCollectionXml = - thisXml->findOptionalChild("invokeOperationCollection"); - - SmartPtrCMgmtInvokeOperationCollectionDoc invokeOperationCollectionVal; - if (! invokeOperationCollectionXml.IsNull()) { - invokeOperationCollectionVal = MgmtInvokeOperationCollectionXml::parse(invokeOperationCollectionXml); - } - - mgmtBatchDoc.CreateInstance(); - mgmtBatchDoc->initialize( - collectSchemaVal, - collectInstancesCollectionVal, - invokeOperationCollectionVal); - } - CAF_CM_EXIT; - - return mgmtBatchDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/MgmtTypesXml/MgmtCollectInstancesCollectionXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/MgmtTypesXml/MgmtCollectInstancesCollectionXml.cpp deleted file mode 100644 index d675edf37..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/MgmtTypesXml/MgmtCollectInstancesCollectionXml.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/MgmtTypesXml/MgmtCollectInstancesXml.h" - -#include "Doc/MgmtTypesDoc/CMgmtCollectInstancesCollectionDoc.h" -#include "Doc/MgmtTypesDoc/CMgmtCollectInstancesDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/MgmtTypesXml/MgmtCollectInstancesCollectionXml.h" - -using namespace Caf; - -void MgmtCollectInstancesCollectionXml::add( - const SmartPtrCMgmtCollectInstancesCollectionDoc mgmtCollectInstancesCollectionDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("MgmtCollectInstancesCollectionXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(mgmtCollectInstancesCollectionDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::deque collectInstancesVal = - mgmtCollectInstancesCollectionDoc->getCollectInstancesCollection(); - CAF_CM_VALIDATE_STL(collectInstancesVal); - - if (! collectInstancesVal.empty()) { - for (TConstIterator > collectInstancesIter(collectInstancesVal); - collectInstancesIter; collectInstancesIter++) { - const SmartPtrCXmlElement collectInstancesXml = - thisXml->createAndAddElement("collectInstances"); - MgmtCollectInstancesXml::add(*collectInstancesIter, collectInstancesXml); - } - } - } - CAF_CM_EXIT; -} - -SmartPtrCMgmtCollectInstancesCollectionDoc MgmtCollectInstancesCollectionXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("MgmtCollectInstancesCollectionXml", "parse"); - - SmartPtrCMgmtCollectInstancesCollectionDoc mgmtCollectInstancesCollectionDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const CXmlElement::SmartPtrCElementCollection collectInstancesChildrenXml = - thisXml->findRequiredChildren("collectInstances"); - - std::deque collectInstancesVal; - if (! collectInstancesChildrenXml.IsNull() && ! collectInstancesChildrenXml->empty()) { - for (TConstIterator collectInstancesXmlIter(*collectInstancesChildrenXml); - collectInstancesXmlIter; collectInstancesXmlIter++) { - const SmartPtrCXmlElement collectInstancesXml = collectInstancesXmlIter->second; - const SmartPtrCMgmtCollectInstancesDoc collectInstancesDoc = - MgmtCollectInstancesXml::parse(collectInstancesXml); - collectInstancesVal.push_back(collectInstancesDoc); - } - } - - mgmtCollectInstancesCollectionDoc.CreateInstance(); - mgmtCollectInstancesCollectionDoc->initialize( - collectInstancesVal); - } - CAF_CM_EXIT; - - return mgmtCollectInstancesCollectionDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/MgmtTypesXml/MgmtCollectInstancesXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/MgmtTypesXml/MgmtCollectInstancesXml.cpp deleted file mode 100644 index dc76b437f..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/MgmtTypesXml/MgmtCollectInstancesXml.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/CafCoreTypesXml/ClassSpecifierXml.h" -#include "Doc/DocXml/CafCoreTypesXml/ParameterCollectionXml.h" - -#include "Doc/CafCoreTypesDoc/CClassSpecifierDoc.h" -#include "Doc/CafCoreTypesDoc/CParameterCollectionDoc.h" -#include "Doc/MgmtTypesDoc/CMgmtCollectInstancesDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/MgmtTypesXml/MgmtCollectInstancesXml.h" - -using namespace Caf; - -void MgmtCollectInstancesXml::add( - const SmartPtrCMgmtCollectInstancesDoc mgmtCollectInstancesDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("MgmtCollectInstancesXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(mgmtCollectInstancesDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string jobIdVal = - BasePlatform::UuidToString(mgmtCollectInstancesDoc->getJobId()); - CAF_CM_VALIDATE_STRING(jobIdVal); - thisXml->addAttribute("jobId", jobIdVal); - - const SmartPtrCClassSpecifierDoc classSpecifierVal = - mgmtCollectInstancesDoc->getClassSpecifier(); - CAF_CM_VALIDATE_SMARTPTR(classSpecifierVal); - - const SmartPtrCXmlElement classSpecifierXml = - thisXml->createAndAddElement("classSpecifier"); - ClassSpecifierXml::add(classSpecifierVal, classSpecifierXml); - - const SmartPtrCParameterCollectionDoc parameterCollectionVal = - mgmtCollectInstancesDoc->getParameterCollection(); - if (! parameterCollectionVal.IsNull()) { - const SmartPtrCXmlElement parameterCollectionXml = - thisXml->createAndAddElement("parameterCollection"); - ParameterCollectionXml::add(parameterCollectionVal, parameterCollectionXml); - } - } - CAF_CM_EXIT; -} - -SmartPtrCMgmtCollectInstancesDoc MgmtCollectInstancesXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("MgmtCollectInstancesXml", "parse"); - - SmartPtrCMgmtCollectInstancesDoc mgmtCollectInstancesDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string jobIdStrVal = - thisXml->findRequiredAttribute("jobId"); - UUID jobIdVal = CAFCOMMON_GUID_NULL; - if (! jobIdStrVal.empty()) { - BasePlatform::UuidFromString(jobIdStrVal.c_str(), jobIdVal); - } - - const SmartPtrCXmlElement classSpecifierXml = - thisXml->findRequiredChild("classSpecifier"); - - SmartPtrCClassSpecifierDoc classSpecifierVal; - if (! classSpecifierXml.IsNull()) { - classSpecifierVal = ClassSpecifierXml::parse(classSpecifierXml); - } - - const SmartPtrCXmlElement parameterCollectionXml = - thisXml->findOptionalChild("parameterCollection"); - - SmartPtrCParameterCollectionDoc parameterCollectionVal; - if (! parameterCollectionXml.IsNull()) { - parameterCollectionVal = ParameterCollectionXml::parse(parameterCollectionXml); - } - - mgmtCollectInstancesDoc.CreateInstance(); - mgmtCollectInstancesDoc->initialize( - jobIdVal, - classSpecifierVal, - parameterCollectionVal); - } - CAF_CM_EXIT; - - return mgmtCollectInstancesDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/MgmtTypesXml/MgmtCollectSchemaXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/MgmtTypesXml/MgmtCollectSchemaXml.cpp deleted file mode 100644 index 09d9eda28..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/MgmtTypesXml/MgmtCollectSchemaXml.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/MgmtTypesDoc/CMgmtCollectSchemaDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/MgmtTypesXml/MgmtCollectSchemaXml.h" - -using namespace Caf; - -void MgmtCollectSchemaXml::add( - const SmartPtrCMgmtCollectSchemaDoc mgmtCollectSchemaDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("MgmtCollectSchemaXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(mgmtCollectSchemaDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string jobIdVal = - BasePlatform::UuidToString(mgmtCollectSchemaDoc->getJobId()); - CAF_CM_VALIDATE_STRING(jobIdVal); - thisXml->addAttribute("jobId", jobIdVal); - } - CAF_CM_EXIT; -} - -SmartPtrCMgmtCollectSchemaDoc MgmtCollectSchemaXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("MgmtCollectSchemaXml", "parse"); - - SmartPtrCMgmtCollectSchemaDoc mgmtCollectSchemaDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string jobIdStrVal = - thisXml->findRequiredAttribute("jobId"); - UUID jobIdVal = CAFCOMMON_GUID_NULL; - if (! jobIdStrVal.empty()) { - BasePlatform::UuidFromString(jobIdStrVal.c_str(), jobIdVal); - } - - mgmtCollectSchemaDoc.CreateInstance(); - mgmtCollectSchemaDoc->initialize( - jobIdVal); - } - CAF_CM_EXIT; - - return mgmtCollectSchemaDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/MgmtTypesXml/MgmtInvokeOperationCollectionXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/MgmtTypesXml/MgmtInvokeOperationCollectionXml.cpp deleted file mode 100644 index 36a79fad3..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/MgmtTypesXml/MgmtInvokeOperationCollectionXml.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/MgmtTypesXml/MgmtInvokeOperationXml.h" - -#include "Doc/MgmtTypesDoc/CMgmtInvokeOperationCollectionDoc.h" -#include "Doc/MgmtTypesDoc/CMgmtInvokeOperationDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/MgmtTypesXml/MgmtInvokeOperationCollectionXml.h" - -using namespace Caf; - -void MgmtInvokeOperationCollectionXml::add( - const SmartPtrCMgmtInvokeOperationCollectionDoc mgmtInvokeOperationCollectionDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("MgmtInvokeOperationCollectionXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(mgmtInvokeOperationCollectionDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::deque invokeOperationVal = - mgmtInvokeOperationCollectionDoc->getInvokeOperationCollection(); - CAF_CM_VALIDATE_STL(invokeOperationVal); - - if (! invokeOperationVal.empty()) { - for (TConstIterator > invokeOperationIter(invokeOperationVal); - invokeOperationIter; invokeOperationIter++) { - const SmartPtrCXmlElement invokeOperationXml = - thisXml->createAndAddElement("invokeOperation"); - MgmtInvokeOperationXml::add(*invokeOperationIter, invokeOperationXml); - } - } - } - CAF_CM_EXIT; -} - -SmartPtrCMgmtInvokeOperationCollectionDoc MgmtInvokeOperationCollectionXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("MgmtInvokeOperationCollectionXml", "parse"); - - SmartPtrCMgmtInvokeOperationCollectionDoc mgmtInvokeOperationCollectionDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const CXmlElement::SmartPtrCElementCollection invokeOperationChildrenXml = - thisXml->findRequiredChildren("invokeOperation"); - - std::deque invokeOperationVal; - if (! invokeOperationChildrenXml.IsNull() && ! invokeOperationChildrenXml->empty()) { - for (TConstIterator invokeOperationXmlIter(*invokeOperationChildrenXml); - invokeOperationXmlIter; invokeOperationXmlIter++) { - const SmartPtrCXmlElement invokeOperationXml = invokeOperationXmlIter->second; - const SmartPtrCMgmtInvokeOperationDoc invokeOperationDoc = - MgmtInvokeOperationXml::parse(invokeOperationXml); - invokeOperationVal.push_back(invokeOperationDoc); - } - } - - mgmtInvokeOperationCollectionDoc.CreateInstance(); - mgmtInvokeOperationCollectionDoc->initialize( - invokeOperationVal); - } - CAF_CM_EXIT; - - return mgmtInvokeOperationCollectionDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/MgmtTypesXml/MgmtInvokeOperationXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/MgmtTypesXml/MgmtInvokeOperationXml.cpp deleted file mode 100644 index d486e6414..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/MgmtTypesXml/MgmtInvokeOperationXml.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/CafCoreTypesXml/ClassSpecifierXml.h" - -#include "Doc/CafCoreTypesDoc/CClassSpecifierDoc.h" -#include "Doc/CafCoreTypesDoc/COperationDoc.h" -#include "Doc/MgmtTypesDoc/CMgmtInvokeOperationDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/MgmtTypesXml/MgmtInvokeOperationXml.h" -#include "Doc/DocXml/CafCoreTypesXml/OperationXml.h" - -using namespace Caf; - -void MgmtInvokeOperationXml::add( - const SmartPtrCMgmtInvokeOperationDoc mgmtInvokeOperationDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("MgmtInvokeOperationXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(mgmtInvokeOperationDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string jobIdVal = - BasePlatform::UuidToString(mgmtInvokeOperationDoc->getJobId()); - CAF_CM_VALIDATE_STRING(jobIdVal); - thisXml->addAttribute("jobId", jobIdVal); - - const SmartPtrCClassSpecifierDoc classSpecifierVal = - mgmtInvokeOperationDoc->getClassSpecifier(); - CAF_CM_VALIDATE_SMARTPTR(classSpecifierVal); - - const SmartPtrCXmlElement classSpecifierXml = - thisXml->createAndAddElement("classSpecifier"); - ClassSpecifierXml::add(classSpecifierVal, classSpecifierXml); - - const SmartPtrCOperationDoc operationVal = - mgmtInvokeOperationDoc->getOperation(); - CAF_CM_VALIDATE_SMARTPTR(operationVal); - - const SmartPtrCXmlElement operationXml = - thisXml->createAndAddElement("operation"); - OperationXml::add(operationVal, operationXml); - } - CAF_CM_EXIT; -} - -SmartPtrCMgmtInvokeOperationDoc MgmtInvokeOperationXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("MgmtInvokeOperationXml", "parse"); - - SmartPtrCMgmtInvokeOperationDoc mgmtInvokeOperationDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string jobIdStrVal = - thisXml->findRequiredAttribute("jobId"); - UUID jobIdVal = CAFCOMMON_GUID_NULL; - if (! jobIdStrVal.empty()) { - BasePlatform::UuidFromString(jobIdStrVal.c_str(), jobIdVal); - } - - const SmartPtrCXmlElement classSpecifierXml = - thisXml->findRequiredChild("classSpecifier"); - - SmartPtrCClassSpecifierDoc classSpecifierVal; - if (! classSpecifierXml.IsNull()) { - classSpecifierVal = ClassSpecifierXml::parse(classSpecifierXml); - } - - const SmartPtrCXmlElement operationXml = - thisXml->findRequiredChild("operation"); - - SmartPtrCOperationDoc operationVal; - if (! operationXml.IsNull()) { - operationVal = OperationXml::parse(operationXml); - } - - mgmtInvokeOperationDoc.CreateInstance(); - mgmtInvokeOperationDoc->initialize( - jobIdVal, - classSpecifierVal, - operationVal); - } - CAF_CM_EXIT; - - return mgmtInvokeOperationDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/MgmtTypesXml/stdafx.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/MgmtTypesXml/stdafx.h deleted file mode 100644 index c9aeb89a1..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/MgmtTypesXml/stdafx.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef STDAFX_H_ -#define STDAFX_H_ - -#ifdef WIN32 - #define MGMTTYPESXML_LINKAGE __declspec(dllexport) -#else - #define MGMTTYPESXML_LINKAGE -#endif - -#include - -#include -#include - - -#endif /* STDAFX_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/MultiPmeMgmtRequestXml/MultiPmeMgmtBatchCollectionXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/MultiPmeMgmtRequestXml/MultiPmeMgmtBatchCollectionXml.cpp deleted file mode 100644 index 1d0c37562..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/MultiPmeMgmtRequestXml/MultiPmeMgmtBatchCollectionXml.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/MultiPmeMgmtRequestXml/MultiPmeMgmtBatchXml.h" - -#include "Doc/MultiPmeMgmtRequestDoc/CMultiPmeMgmtBatchCollectionDoc.h" -#include "Doc/MultiPmeMgmtRequestDoc/CMultiPmeMgmtBatchDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/MultiPmeMgmtRequestXml/MultiPmeMgmtBatchCollectionXml.h" - -using namespace Caf; - -void MultiPmeMgmtBatchCollectionXml::add( - const SmartPtrCMultiPmeMgmtBatchCollectionDoc multiPmeMgmtBatchCollectionDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("MultiPmeMgmtBatchCollectionXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(multiPmeMgmtBatchCollectionDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::deque multiPmeBatchVal = - multiPmeMgmtBatchCollectionDoc->getMultiPmeBatch(); - CAF_CM_VALIDATE_STL(multiPmeBatchVal); - - if (! multiPmeBatchVal.empty()) { - for (TConstIterator > multiPmeBatchIter(multiPmeBatchVal); - multiPmeBatchIter; multiPmeBatchIter++) { - const SmartPtrCXmlElement multiPmeBatchXml = - thisXml->createAndAddElement("multiPmeBatch"); - MultiPmeMgmtBatchXml::add(*multiPmeBatchIter, multiPmeBatchXml); - } - } - } - CAF_CM_EXIT; -} - -SmartPtrCMultiPmeMgmtBatchCollectionDoc MultiPmeMgmtBatchCollectionXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("MultiPmeMgmtBatchCollectionXml", "parse"); - - SmartPtrCMultiPmeMgmtBatchCollectionDoc multiPmeMgmtBatchCollectionDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const CXmlElement::SmartPtrCElementCollection multiPmeBatchChildrenXml = - thisXml->findRequiredChildren("multiPmeBatch"); - - std::deque multiPmeBatchVal; - if (! multiPmeBatchChildrenXml.IsNull() && ! multiPmeBatchChildrenXml->empty()) { - for (TConstIterator multiPmeBatchXmlIter(*multiPmeBatchChildrenXml); - multiPmeBatchXmlIter; multiPmeBatchXmlIter++) { - const SmartPtrCXmlElement multiPmeBatchXml = multiPmeBatchXmlIter->second; - const SmartPtrCMultiPmeMgmtBatchDoc multiPmeBatchDoc = - MultiPmeMgmtBatchXml::parse(multiPmeBatchXml); - multiPmeBatchVal.push_back(multiPmeBatchDoc); - } - } - - multiPmeMgmtBatchCollectionDoc.CreateInstance(); - multiPmeMgmtBatchCollectionDoc->initialize( - multiPmeBatchVal); - } - CAF_CM_EXIT; - - return multiPmeMgmtBatchCollectionDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/MultiPmeMgmtRequestXml/MultiPmeMgmtBatchXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/MultiPmeMgmtRequestXml/MultiPmeMgmtBatchXml.cpp deleted file mode 100644 index ce9f346ab..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/MultiPmeMgmtRequestXml/MultiPmeMgmtBatchXml.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/MgmtTypesXml/MgmtBatchXml.h" - -#include "Doc/DocXml/MultiPmeMgmtRequestXml/PmeIdCollectionXml.h" - -#include "Doc/MgmtTypesDoc/CMgmtBatchDoc.h" -#include "Doc/MultiPmeMgmtRequestDoc/CMultiPmeMgmtBatchDoc.h" -#include "Doc/MultiPmeMgmtRequestDoc/CPmeIdCollectionDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/MultiPmeMgmtRequestXml/MultiPmeMgmtBatchXml.h" - -using namespace Caf; - -void MultiPmeMgmtBatchXml::add( - const SmartPtrCMultiPmeMgmtBatchDoc multiPmeMgmtBatchDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("MultiPmeMgmtBatchXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(multiPmeMgmtBatchDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const SmartPtrCPmeIdCollectionDoc pmeIdCollectionVal = - multiPmeMgmtBatchDoc->getPmeIdCollection(); - CAF_CM_VALIDATE_SMARTPTR(pmeIdCollectionVal); - - const SmartPtrCXmlElement pmeIdCollectionXml = - thisXml->createAndAddElement("pmeIdCollection"); - PmeIdCollectionXml::add(pmeIdCollectionVal, pmeIdCollectionXml); - - const SmartPtrCMgmtBatchDoc batchVal = - multiPmeMgmtBatchDoc->getBatch(); - CAF_CM_VALIDATE_SMARTPTR(batchVal); - - const SmartPtrCXmlElement batchXml = - thisXml->createAndAddElement("batch"); - MgmtBatchXml::add(batchVal, batchXml); - } - CAF_CM_EXIT; -} - -SmartPtrCMultiPmeMgmtBatchDoc MultiPmeMgmtBatchXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("MultiPmeMgmtBatchXml", "parse"); - - SmartPtrCMultiPmeMgmtBatchDoc multiPmeMgmtBatchDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const SmartPtrCXmlElement pmeIdCollectionXml = - thisXml->findRequiredChild("pmeIdCollection"); - - SmartPtrCPmeIdCollectionDoc pmeIdCollectionVal; - if (! pmeIdCollectionXml.IsNull()) { - pmeIdCollectionVal = PmeIdCollectionXml::parse(pmeIdCollectionXml); - } - - const SmartPtrCXmlElement batchXml = - thisXml->findRequiredChild("batch"); - - SmartPtrCMgmtBatchDoc batchVal; - if (! batchXml.IsNull()) { - batchVal = MgmtBatchXml::parse(batchXml); - } - - multiPmeMgmtBatchDoc.CreateInstance(); - multiPmeMgmtBatchDoc->initialize( - pmeIdCollectionVal, - batchVal); - } - CAF_CM_EXIT; - - return multiPmeMgmtBatchDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/MultiPmeMgmtRequestXml/MultiPmeMgmtRequestXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/MultiPmeMgmtRequestXml/MultiPmeMgmtRequestXml.cpp deleted file mode 100644 index 653f5e645..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/MultiPmeMgmtRequestXml/MultiPmeMgmtRequestXml.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/CafCoreTypesXml/RequestHeaderXml.h" -#include "Doc/DocXml/MultiPmeMgmtRequestXml/MultiPmeMgmtBatchCollectionXml.h" - -#include "Doc/CafCoreTypesDoc/CRequestHeaderDoc.h" -#include "Doc/MultiPmeMgmtRequestDoc/CMultiPmeMgmtBatchCollectionDoc.h" -#include "Doc/MultiPmeMgmtRequestDoc/CMultiPmeMgmtRequestDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/MultiPmeMgmtRequestXml/MultiPmeMgmtRequestXml.h" - -using namespace Caf; - -void MultiPmeMgmtRequestXml::add( - const SmartPtrCMultiPmeMgmtRequestDoc multiPmeMgmtRequestDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("MultiPmeMgmtRequestXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(multiPmeMgmtRequestDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string clientIdVal = - BasePlatform::UuidToString(multiPmeMgmtRequestDoc->getClientId()); - CAF_CM_VALIDATE_STRING(clientIdVal); - thisXml->addAttribute("clientId", clientIdVal); - - const std::string requestIdVal = - BasePlatform::UuidToString(multiPmeMgmtRequestDoc->getRequestId()); - CAF_CM_VALIDATE_STRING(requestIdVal); - thisXml->addAttribute("requestId", requestIdVal); - - const SmartPtrCRequestHeaderDoc requestHeaderVal = - multiPmeMgmtRequestDoc->getRequestHeader(); - CAF_CM_VALIDATE_SMARTPTR(requestHeaderVal); - - const SmartPtrCXmlElement requestHeaderXml = - thisXml->createAndAddElement("requestHeader"); - RequestHeaderXml::add(requestHeaderVal, requestHeaderXml); - - const SmartPtrCMultiPmeMgmtBatchCollectionDoc multiPmeBatchCollectionVal = - multiPmeMgmtRequestDoc->getMultiPmeBatchCollection(); - CAF_CM_VALIDATE_SMARTPTR(multiPmeBatchCollectionVal); - - const SmartPtrCXmlElement multiPmeBatchCollectionXml = - thisXml->createAndAddElement("multiPmeBatchCollection"); - MultiPmeMgmtBatchCollectionXml::add(multiPmeBatchCollectionVal, multiPmeBatchCollectionXml); - } - CAF_CM_EXIT; -} - -SmartPtrCMultiPmeMgmtRequestDoc MultiPmeMgmtRequestXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("MultiPmeMgmtRequestXml", "parse"); - - SmartPtrCMultiPmeMgmtRequestDoc multiPmeMgmtRequestDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string clientIdStrVal = - thisXml->findRequiredAttribute("clientId"); - UUID clientIdVal = CAFCOMMON_GUID_NULL; - if (! clientIdStrVal.empty()) { - BasePlatform::UuidFromString(clientIdStrVal.c_str(), clientIdVal); - } - - const std::string requestIdStrVal = - thisXml->findRequiredAttribute("requestId"); - UUID requestIdVal = CAFCOMMON_GUID_NULL; - if (! requestIdStrVal.empty()) { - BasePlatform::UuidFromString(requestIdStrVal.c_str(), requestIdVal); - } - - const SmartPtrCXmlElement requestHeaderXml = - thisXml->findRequiredChild("requestHeader"); - - SmartPtrCRequestHeaderDoc requestHeaderVal; - if (! requestHeaderXml.IsNull()) { - requestHeaderVal = RequestHeaderXml::parse(requestHeaderXml); - } - - const SmartPtrCXmlElement multiPmeBatchCollectionXml = - thisXml->findRequiredChild("multiPmeBatchCollection"); - - SmartPtrCMultiPmeMgmtBatchCollectionDoc multiPmeBatchCollectionVal; - if (! multiPmeBatchCollectionXml.IsNull()) { - multiPmeBatchCollectionVal = MultiPmeMgmtBatchCollectionXml::parse(multiPmeBatchCollectionXml); - } - - multiPmeMgmtRequestDoc.CreateInstance(); - multiPmeMgmtRequestDoc->initialize( - clientIdVal, - requestIdVal, - requestHeaderVal, - multiPmeBatchCollectionVal); - } - CAF_CM_EXIT; - - return multiPmeMgmtRequestDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/MultiPmeMgmtRequestXml/MultiPmeMgmtRequestXmlRoots.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/MultiPmeMgmtRequestXml/MultiPmeMgmtRequestXmlRoots.cpp deleted file mode 100644 index 2d095b88a..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/MultiPmeMgmtRequestXml/MultiPmeMgmtRequestXmlRoots.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/CafCoreTypesXml/RequestXml.h" -#include "Doc/DocXml/MultiPmeMgmtRequestXml/MultiPmeMgmtRequestXml.h" - -#include "Doc/MultiPmeMgmtRequestDoc/CMultiPmeMgmtRequestDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/MultiPmeMgmtRequestXml/MultiPmeMgmtRequestXmlRoots.h" - -using namespace Caf; - -std::string XmlRoots::saveMultiPmeMgmtRequestToString( - const SmartPtrCMultiPmeMgmtRequestDoc multiPmeMgmtRequestDoc) { - CAF_CM_STATIC_FUNC_VALIDATE("XmlRoots", "saveMultiPmeMgmtRequestToString"); - - std::string rc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(multiPmeMgmtRequestDoc); - - const std::string schemaNamespace = DocXmlUtils::getSchemaNamespace("fx"); - const std::string schemaLocation = DocXmlUtils::getSchemaLocation("fx/MultiPmeMgmtRequest.xsd"); - - const SmartPtrCXmlElement rootXml = CXmlUtils::createRootElement( - "multiPmeMgmtRequest", schemaNamespace, schemaLocation); - MultiPmeMgmtRequestXml::add(multiPmeMgmtRequestDoc, rootXml); - - rc = rootXml->saveToString(); - } - CAF_CM_EXIT; - - return rc; -} - -SmartPtrCMultiPmeMgmtRequestDoc XmlRoots::parseMultiPmeMgmtRequestFromString( - const std::string xml) { - CAF_CM_STATIC_FUNC_VALIDATE("XmlRoots", "parseMultiPmeMgmtRequestFromString"); - - SmartPtrCMultiPmeMgmtRequestDoc multiPmeMgmtRequestDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(xml); - - const SmartPtrCXmlElement rootXml = RequestXml::parseString(xml, "caf:multiPmeMgmtRequest"); - multiPmeMgmtRequestDoc = MultiPmeMgmtRequestXml::parse(rootXml); - } - CAF_CM_EXIT; - - return multiPmeMgmtRequestDoc; -} - -void XmlRoots::saveMultiPmeMgmtRequestToFile( - const SmartPtrCMultiPmeMgmtRequestDoc multiPmeMgmtRequestDoc, - const std::string filePath) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("XmlRoots", "saveMultiPmeMgmtRequestToFile"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(multiPmeMgmtRequestDoc); - CAF_CM_VALIDATE_STRING(filePath); - - CAF_CM_LOG_DEBUG_VA1("Saving to file - %s", filePath.c_str()); - - const std::string multiPmeMgmtRequestStr = - saveMultiPmeMgmtRequestToString(multiPmeMgmtRequestDoc); - FileSystemUtils::saveTextFile(filePath, multiPmeMgmtRequestStr); - } - CAF_CM_EXIT; -} - -SmartPtrCMultiPmeMgmtRequestDoc XmlRoots::parseMultiPmeMgmtRequestFromFile( - const std::string filePath) { - CAF_CM_STATIC_FUNC_VALIDATE("XmlRoots", "parseMultiPmeMgmtRequestFromFile"); - - SmartPtrCMultiPmeMgmtRequestDoc multiPmeMgmtRequestDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(filePath); - - const SmartPtrCXmlElement rootXml = RequestXml::parseFile(filePath, "caf:multiPmeMgmtRequest"); - multiPmeMgmtRequestDoc = MultiPmeMgmtRequestXml::parse(rootXml); - } - CAF_CM_EXIT; - - return multiPmeMgmtRequestDoc; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/MultiPmeMgmtRequestXml/PmeIdCollectionXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/MultiPmeMgmtRequestXml/PmeIdCollectionXml.cpp deleted file mode 100644 index f03e616ec..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/MultiPmeMgmtRequestXml/PmeIdCollectionXml.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/MultiPmeMgmtRequestDoc/CPmeIdCollectionDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/MultiPmeMgmtRequestXml/PmeIdCollectionXml.h" - -using namespace Caf; - -void PmeIdCollectionXml::add( - const SmartPtrCPmeIdCollectionDoc pmeIdCollectionDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("PmeIdCollectionXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(pmeIdCollectionDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::deque pmeIdVal = - pmeIdCollectionDoc->getPmeIdCollection(); - CAF_CM_VALIDATE_STL(pmeIdVal); - - if (! pmeIdVal.empty()) { - for (TConstIterator > pmeIdIter(pmeIdVal); - pmeIdIter; pmeIdIter++) { - const SmartPtrCXmlElement pmeIdXml = - thisXml->createAndAddElement("pmeId"); - pmeIdXml->setValue(*pmeIdIter); - } - } - } - CAF_CM_EXIT; -} - -SmartPtrCPmeIdCollectionDoc PmeIdCollectionXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("PmeIdCollectionXml", "parse"); - - SmartPtrCPmeIdCollectionDoc pmeIdCollectionDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const CXmlElement::SmartPtrCElementCollection pmeIdChildrenXml = - thisXml->findRequiredChildren("pmeId"); - - std::deque pmeIdVal; - if (! pmeIdChildrenXml.IsNull() && ! pmeIdChildrenXml->empty()) { - for (TConstIterator pmeIdXmlIter(*pmeIdChildrenXml); - pmeIdXmlIter; pmeIdXmlIter++) { - const SmartPtrCXmlElement pmeIdXml = pmeIdXmlIter->second; - - const std::string pmeIdDoc = pmeIdXml->getValue(); - - pmeIdVal.push_back(pmeIdDoc); - } - } - - pmeIdCollectionDoc.CreateInstance(); - pmeIdCollectionDoc->initialize( - pmeIdVal); - } - CAF_CM_EXIT; - - return pmeIdCollectionDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/MultiPmeMgmtRequestXml/stdafx.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/MultiPmeMgmtRequestXml/stdafx.h deleted file mode 100644 index 73cd2606e..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/MultiPmeMgmtRequestXml/stdafx.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef STDAFX_H_ -#define STDAFX_H_ - -#ifdef WIN32 - #define MULTIPMEMGMTREQUESTXML_LINKAGE __declspec(dllexport) -#else - #define MULTIPMEMGMTREQUESTXML_LINKAGE -#endif - -#include - -#include -#include - - -#endif /* STDAFX_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/PayloadEnvelopeXml/PayloadEnvelopeXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/PayloadEnvelopeXml/PayloadEnvelopeXml.cpp deleted file mode 100644 index 7a917c36b..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/PayloadEnvelopeXml/PayloadEnvelopeXml.cpp +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Author: bwilliams - * Created: July 3, 2015 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/CafCoreTypesXml/AttachmentCollectionXml.h" -#include "Doc/DocXml/CafCoreTypesXml/PropertyCollectionXml.h" -#include "Doc/DocXml/CafCoreTypesXml/ProtocolCollectionXml.h" - -#include "Doc/CafCoreTypesDoc/CAttachmentCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CPropertyCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CProtocolCollectionDoc.h" -#include "Doc/PayloadEnvelopeDoc/CPayloadEnvelopeDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/PayloadEnvelopeXml/PayloadEnvelopeXml.h" - -using namespace Caf; - -void PayloadEnvelopeXml::add( - const SmartPtrCPayloadEnvelopeDoc payloadEnvelopeDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("PayloadEnvelopeXml", "add"); - CAF_CM_VALIDATE_SMARTPTR(payloadEnvelopeDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string clientIdVal = - BasePlatform::UuidToString(payloadEnvelopeDoc->getClientId()); - if (! clientIdVal.empty()) { - thisXml->addAttribute("clientId", clientIdVal); - } - - const std::string requestIdVal = - BasePlatform::UuidToString(payloadEnvelopeDoc->getRequestId()); - if (! requestIdVal.empty()) { - thisXml->addAttribute("requestId", requestIdVal); - } - - const std::string pmeIdVal = payloadEnvelopeDoc->getPmeId(); - if (! pmeIdVal.empty()) { - thisXml->addAttribute("pmeId", pmeIdVal); - } - - const std::string payloadVersionVal = payloadEnvelopeDoc->getPayloadVersion(); - if (! payloadVersionVal.empty()) { - thisXml->addAttribute("payloadVersion", payloadVersionVal); - } - - const std::string payloadTypeVal = payloadEnvelopeDoc->getPayloadType(); - if (! payloadTypeVal.empty()) { - thisXml->addAttribute("payloadType", payloadTypeVal); - } - - const SmartPtrCAttachmentCollectionDoc attachmentCollectionVal = - payloadEnvelopeDoc->getAttachmentCollection(); - if (! attachmentCollectionVal.IsNull()) { - const SmartPtrCXmlElement attachmentCollectionXml = - thisXml->createAndAddElement("attachmentCollection"); - AttachmentCollectionXml::add(attachmentCollectionVal, attachmentCollectionXml); - } - - const SmartPtrCProtocolCollectionDoc protocolCollectionVal = - payloadEnvelopeDoc->getProtocolCollection(); - if (! protocolCollectionVal.IsNull()) { - const SmartPtrCXmlElement protocolCollectionXml = - thisXml->createAndAddElement("protocolCollection"); - ProtocolCollectionXml::add(protocolCollectionVal, protocolCollectionXml); - } - - const SmartPtrCPropertyCollectionDoc headerCollectionVal = - payloadEnvelopeDoc->getHeaderCollection(); - if (! headerCollectionVal.IsNull()) { - const SmartPtrCXmlElement headerCollectionXml = - thisXml->createAndAddElement("headerCollection"); - PropertyCollectionXml::add(headerCollectionVal, headerCollectionXml); - } - - const std::string versionVal = payloadEnvelopeDoc->getVersion().empty() ? "1.0" : payloadEnvelopeDoc->getVersion(); - thisXml->addAttribute("version", versionVal); -} - -SmartPtrCPayloadEnvelopeDoc PayloadEnvelopeXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("PayloadEnvelopeXml", "parse"); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string clientIdStrVal = - thisXml->findOptionalAttribute("clientId"); - UUID clientIdVal = CAFCOMMON_GUID_NULL; - if (! clientIdStrVal.empty()) { - BasePlatform::UuidFromString(clientIdStrVal.c_str(), clientIdVal); - } - - const std::string requestIdStrVal = - thisXml->findOptionalAttribute("requestId"); - UUID requestIdVal = CAFCOMMON_GUID_NULL; - if (! requestIdStrVal.empty()) { - BasePlatform::UuidFromString(requestIdStrVal.c_str(), requestIdVal); - } - - const std::string pmeIdVal = - thisXml->findOptionalAttribute("pmeId"); - - const std::string payloadTypeVal = - thisXml->findOptionalAttribute("payloadType"); - - const std::string payloadVersionVal = - thisXml->findOptionalAttribute("payloadVersion"); - - const SmartPtrCXmlElement attachmentCollectionXml = - thisXml->findOptionalChild("attachmentCollection"); - SmartPtrCAttachmentCollectionDoc attachmentCollectionVal; - if (! attachmentCollectionXml.IsNull()) { - attachmentCollectionVal = AttachmentCollectionXml::parse(attachmentCollectionXml); - } - - const SmartPtrCXmlElement protocolCollectionXml = - thisXml->findOptionalChild("protocolCollection"); - - SmartPtrCProtocolCollectionDoc protocolCollectionVal; - if (! protocolCollectionXml.IsNull()) { - protocolCollectionVal = ProtocolCollectionXml::parse(protocolCollectionXml); - } - - const SmartPtrCXmlElement headerCollectionXml = - thisXml->findOptionalChild("headerCollection"); - SmartPtrCPropertyCollectionDoc headerCollectionVal; - if (! headerCollectionXml.IsNull()) { - headerCollectionVal = PropertyCollectionXml::parse(headerCollectionXml); - } - - const std::string versionVal = - thisXml->findOptionalAttribute("version"); - - SmartPtrCPayloadEnvelopeDoc payloadEnvelopeDoc; - payloadEnvelopeDoc.CreateInstance(); - payloadEnvelopeDoc->initialize( - clientIdVal, - requestIdVal, - pmeIdVal, - payloadTypeVal, - payloadVersionVal, - attachmentCollectionVal, - protocolCollectionVal, - headerCollectionVal, - versionVal); - - return payloadEnvelopeDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/PayloadEnvelopeXml/PayloadEnvelopeXmlRoots.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/PayloadEnvelopeXml/PayloadEnvelopeXmlRoots.cpp deleted file mode 100644 index eb7b83dc4..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/PayloadEnvelopeXml/PayloadEnvelopeXmlRoots.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/PayloadEnvelopeXml/PayloadEnvelopeXml.h" - -#include "Doc/PayloadEnvelopeDoc/CPayloadEnvelopeDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/PayloadEnvelopeXml/PayloadEnvelopeXmlRoots.h" - -using namespace Caf; - -std::string XmlRoots::savePayloadEnvelopeToString( - const SmartPtrCPayloadEnvelopeDoc payloadEnvelopeDoc) { - CAF_CM_STATIC_FUNC_VALIDATE("XmlRoots", "savePayloadEnvelopeToString"); - CAF_CM_VALIDATE_SMARTPTR(payloadEnvelopeDoc); - - const std::string schemaNamespace = DocXmlUtils::getSchemaNamespace("fx"); - const std::string schemaLocation = DocXmlUtils::getSchemaLocation("fx/PayloadEnvelope.xsd"); - - const SmartPtrCXmlElement rootXml = CXmlUtils::createRootElement( - "payloadEnvelope", schemaNamespace, schemaLocation); - PayloadEnvelopeXml::add(payloadEnvelopeDoc, rootXml); - - return rootXml->saveToString(); -} - -SmartPtrCPayloadEnvelopeDoc XmlRoots::parsePayloadEnvelopeFromString( - const std::string xml) { - CAF_CM_STATIC_FUNC_VALIDATE("XmlRoots", "parsePayloadEnvelopeFromString"); - CAF_CM_VALIDATE_STRING(xml); - - const SmartPtrCXmlElement rootXml = CXmlUtils::parseString(xml, "caf:payloadEnvelope"); - return PayloadEnvelopeXml::parse(rootXml); -} - -void XmlRoots::savePayloadEnvelopeToFile( - const SmartPtrCPayloadEnvelopeDoc payloadEnvelopeDoc, - const std::string filePath) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("XmlRoots", "savePayloadEnvelopeToFile"); - CAF_CM_VALIDATE_SMARTPTR(payloadEnvelopeDoc); - CAF_CM_VALIDATE_STRING(filePath); - - CAF_CM_LOG_DEBUG_VA1("Saving to file - %s", filePath.c_str()); - - const std::string payloadEnvelopeStr = - savePayloadEnvelopeToString(payloadEnvelopeDoc); - FileSystemUtils::saveTextFile(filePath, payloadEnvelopeStr); -} - -SmartPtrCPayloadEnvelopeDoc XmlRoots::parsePayloadEnvelopeFromFile( - const std::string filePath) { - CAF_CM_STATIC_FUNC_VALIDATE("XmlRoots", "parsePayloadEnvelopeFromFile"); - CAF_CM_VALIDATE_STRING(filePath); - - const SmartPtrCXmlElement rootXml = CXmlUtils::parseFile(filePath, "caf:payloadEnvelope"); - return PayloadEnvelopeXml::parse(rootXml); -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/PayloadEnvelopeXml/stdafx.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/PayloadEnvelopeXml/stdafx.h deleted file mode 100644 index c3fae1c32..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/PayloadEnvelopeXml/stdafx.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef STDAFX_H_ -#define STDAFX_H_ - -#ifdef WIN32 - #define PAYLOADENVELOPEXML_LINKAGE __declspec(dllexport) -#else - #define PAYLOADENVELOPEXML_LINKAGE -#endif - -#include - -#include -#include - - -#endif /* STDAFX_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/PersistenceXml/CertCollectionXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/PersistenceXml/CertCollectionXml.cpp deleted file mode 100644 index b68c15bd8..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/PersistenceXml/CertCollectionXml.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Author: bwilliams - * Created: Nov 16, 2015 - * - * Copyright (C) 2015-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#include "stdafx.h" - -#include "Doc/PersistenceDoc/CCertCollectionDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/PersistenceXml/CertCollectionXml.h" - -using namespace Caf; - -void CertCollectionXml::add( - const SmartPtrCCertCollectionDoc certCollectionDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("CertCollectionXml", "add"); - CAF_CM_VALIDATE_SMARTPTR(certCollectionDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::deque certVal = - certCollectionDoc->getCert(); - - if (! certVal.empty()) { - for (TConstIterator > certIter(certVal); - certIter; certIter++) { - const SmartPtrCXmlElement certXml = - thisXml->createAndAddElement("cert"); - certXml->setValue(*certIter); - } - } -} - -SmartPtrCCertCollectionDoc CertCollectionXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("CertCollectionXml", "parse"); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const CXmlElement::SmartPtrCElementCollection certChildrenXml = - thisXml->findOptionalChildren("cert"); - - std::deque certVal; - if (! certChildrenXml.IsNull() && ! certChildrenXml->empty()) { - for (TConstIterator certXmlIter(*certChildrenXml); - certXmlIter; certXmlIter++) { - const SmartPtrCXmlElement certXml = certXmlIter->second; - const std::string certDoc = certXml->getValue(); - certVal.push_back(certDoc); - } - } - - SmartPtrCCertCollectionDoc certCollectionDoc; - certCollectionDoc.CreateInstance(); - certCollectionDoc->initialize(certVal); - - return certCollectionDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/PersistenceXml/CertPathCollectionXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/PersistenceXml/CertPathCollectionXml.cpp deleted file mode 100644 index e2e7adc53..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/PersistenceXml/CertPathCollectionXml.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Author: bwilliams - * Created: Nov 16, 2015 - * - * Copyright (C) 2015-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#include "stdafx.h" - -#include "Doc/PersistenceDoc/CCertPathCollectionDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/PersistenceXml/CertPathCollectionXml.h" - -using namespace Caf; - -void CertPathCollectionXml::add( - const SmartPtrCCertPathCollectionDoc certPathCollectionDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("CertPathCollectionXml", "add"); - CAF_CM_VALIDATE_SMARTPTR(certPathCollectionDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::deque certPathVal = - certPathCollectionDoc->getCertPath(); - - if (! certPathVal.empty()) { - for (TConstIterator > certPathIter(certPathVal); - certPathIter; certPathIter++) { - const SmartPtrCXmlElement certPathXml = - thisXml->createAndAddElement("certPath"); - certPathXml->setValue(*certPathIter); - } - } -} - -SmartPtrCCertPathCollectionDoc CertPathCollectionXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("CertPathCollectionXml", "parse"); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const CXmlElement::SmartPtrCElementCollection certPathChildrenXml = - thisXml->findOptionalChildren("certPath"); - - std::deque certPathVal; - if (! certPathChildrenXml.IsNull() && ! certPathChildrenXml->empty()) { - for (TConstIterator certPathXmlIter(*certPathChildrenXml); - certPathXmlIter; certPathXmlIter++) { - const SmartPtrCXmlElement certPathXml = certPathXmlIter->second; - const std::string certPathDoc = certPathXml->getValue(); - certPathVal.push_back(certPathDoc); - } - } - - SmartPtrCCertPathCollectionDoc certPathCollectionDoc; - certPathCollectionDoc.CreateInstance(); - certPathCollectionDoc->initialize(certPathVal); - - return certPathCollectionDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/PersistenceXml/LocalSecurityXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/PersistenceXml/LocalSecurityXml.cpp deleted file mode 100644 index 6f49e8a73..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/PersistenceXml/LocalSecurityXml.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Author: bwilliams - * Created: Nov 16, 2015 - * - * Copyright (C) 2015-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#include "stdafx.h" - -#include "Doc/PersistenceDoc/CLocalSecurityDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/PersistenceXml/LocalSecurityXml.h" - -using namespace Caf; - -void LocalSecurityXml::add( - const SmartPtrCLocalSecurityDoc localSecurityDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("LocalSecurityXml", "add"); - CAF_CM_VALIDATE_SMARTPTR(localSecurityDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string localIdVal = localSecurityDoc->getLocalId(); - if (! localIdVal.empty()) { - thisXml->addAttribute("localId", localIdVal); - } - - const std::string privateKeyVal = localSecurityDoc->getPrivateKey(); - if (! privateKeyVal.empty()) { - const SmartPtrCXmlElement privateKeyXml = thisXml->createAndAddElement("privateKey"); - privateKeyXml->setValue(privateKeyVal); - } - - const std::string certVal = localSecurityDoc->getCert(); - if (! certVal.empty()) { - const SmartPtrCXmlElement certXml = thisXml->createAndAddElement("cert"); - certXml->setValue(certVal); - } - - const std::string privateKeyPathVal = localSecurityDoc->getPrivateKeyPath(); - if (! privateKeyPathVal.empty()) { - thisXml->addAttribute("privateKeyPath", privateKeyPathVal); - } - - const std::string certPathVal = localSecurityDoc->getCertPath(); - if (! certPathVal.empty()) { - thisXml->addAttribute("certPath", certPathVal); - } -} - -SmartPtrCLocalSecurityDoc LocalSecurityXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("LocalSecurityXml", "parse"); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string localIdVal = thisXml->findOptionalAttribute("localId"); - - std::string privateKeyVal; - const SmartPtrCXmlElement privateKeyXml = thisXml->findOptionalChild("privateKey"); - if (privateKeyXml) { - privateKeyVal = privateKeyXml->getValue(); - } - - std::string certVal; - const SmartPtrCXmlElement certXml = thisXml->findOptionalChild("cert"); - if (certXml) { - certVal = certXml->getValue(); - } - - const std::string privateKeyPathVal = thisXml->findOptionalAttribute("privateKeyPath"); - const std::string certPathVal = thisXml->findOptionalAttribute("certPath"); - - SmartPtrCLocalSecurityDoc localSecurityDoc; - localSecurityDoc.CreateInstance(); - localSecurityDoc->initialize( - localIdVal, - privateKeyVal, - certVal, - privateKeyPathVal, - certPathVal); - - return localSecurityDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/PersistenceXml/PersistenceProtocolCollectionXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/PersistenceXml/PersistenceProtocolCollectionXml.cpp deleted file mode 100644 index 59a2c91d3..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/PersistenceXml/PersistenceProtocolCollectionXml.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Author: bwilliams - * Created: Nov 16, 2015 - * - * Copyright (C) 2015-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/PersistenceXml/PersistenceProtocolXml.h" - -#include "Doc/PersistenceDoc/CPersistenceProtocolCollectionDoc.h" -#include "Doc/PersistenceDoc/CPersistenceProtocolDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/PersistenceXml/PersistenceProtocolCollectionXml.h" - -using namespace Caf; - -void PersistenceProtocolCollectionXml::add( - const SmartPtrCPersistenceProtocolCollectionDoc persistenceProtocolCollectionDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("PersistenceProtocolCollectionXml", "add"); - CAF_CM_VALIDATE_SMARTPTR(persistenceProtocolCollectionDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::deque persistenceProtocolVal = - persistenceProtocolCollectionDoc->getPersistenceProtocol(); - if (! persistenceProtocolVal.empty()) { - for (TConstIterator > persistenceProtocolIter(persistenceProtocolVal); - persistenceProtocolIter; persistenceProtocolIter++) { - const SmartPtrCXmlElement persistenceProtocolXml = - thisXml->createAndAddElement("persistenceProtocol"); - PersistenceProtocolXml::add(*persistenceProtocolIter, persistenceProtocolXml); - } - } -} - -SmartPtrCPersistenceProtocolCollectionDoc PersistenceProtocolCollectionXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("PersistenceProtocolCollectionXml", "parse"); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const CXmlElement::SmartPtrCElementCollection persistenceProtocolChildrenXml = - thisXml->findOptionalChildren("persistenceProtocol"); - - std::deque persistenceProtocolVal; - if (! persistenceProtocolChildrenXml.IsNull() && ! persistenceProtocolChildrenXml->empty()) { - for (TConstIterator persistenceProtocolXmlIter(*persistenceProtocolChildrenXml); - persistenceProtocolXmlIter; persistenceProtocolXmlIter++) { - const SmartPtrCXmlElement persistenceProtocolXml = persistenceProtocolXmlIter->second; - const SmartPtrCPersistenceProtocolDoc persistenceProtocolDoc = - PersistenceProtocolXml::parse(persistenceProtocolXml); - persistenceProtocolVal.push_back(persistenceProtocolDoc); - } - } - - SmartPtrCPersistenceProtocolCollectionDoc persistenceProtocolCollectionDoc; - persistenceProtocolCollectionDoc.CreateInstance(); - persistenceProtocolCollectionDoc->initialize( - persistenceProtocolVal); - - return persistenceProtocolCollectionDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/PersistenceXml/PersistenceProtocolXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/PersistenceXml/PersistenceProtocolXml.cpp deleted file mode 100644 index 399693106..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/PersistenceXml/PersistenceProtocolXml.cpp +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Author: bwilliams - * Created: Nov 16, 2015 - * - * Copyright (C) 2015-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/PersistenceXml/CertCollectionXml.h" -#include "Doc/DocXml/PersistenceXml/CertPathCollectionXml.h" - -#include "Doc/PersistenceDoc/CCertCollectionDoc.h" -#include "Doc/PersistenceDoc/CCertPathCollectionDoc.h" -#include "Doc/PersistenceDoc/CPersistenceProtocolDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/PersistenceXml/PersistenceProtocolXml.h" - -using namespace Caf; - -void PersistenceProtocolXml::add( - const SmartPtrCPersistenceProtocolDoc persistenceProtocolDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("PersistenceProtocolXml", "add"); - CAF_CM_VALIDATE_SMARTPTR(persistenceProtocolDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string protocolNameVal = persistenceProtocolDoc->getProtocolName(); - if (! protocolNameVal.empty()) { - thisXml->addAttribute("protocolName", protocolNameVal); - } - - const std::string uriVal = persistenceProtocolDoc->getUri(); - if (! uriVal.empty()) { - thisXml->addAttribute("uri", uriVal); - } - - const std::string uriAmqpVal = persistenceProtocolDoc->getUriAmqp(); - if (! uriAmqpVal.empty()) { - thisXml->addAttribute("uriAmqp", uriAmqpVal); - } - - const std::string uriTunnelVal = persistenceProtocolDoc->getUriTunnel(); - if (! uriTunnelVal.empty()) { - thisXml->addAttribute("uriTunnel", uriTunnelVal); - } - - const std::string tlsCertVal = persistenceProtocolDoc->getTlsCert(); - if (! tlsCertVal.empty()) { - const SmartPtrCXmlElement tlsCertXml = thisXml->createAndAddElement("tlsCert"); - tlsCertXml->setValue(tlsCertVal); - } - - const std::string tlsProtocolVal = persistenceProtocolDoc->getTlsProtocol(); - if (! tlsProtocolVal.empty()) { - thisXml->addAttribute("tlsProtocol", tlsProtocolVal); - } - - const Cdeqstr tlsCipherCollectionVal = persistenceProtocolDoc->getTlsCipherCollection(); - if (! tlsCipherCollectionVal.empty()) { - const SmartPtrCXmlElement tlsCipherCollectionXml = - thisXml->createAndAddElement("tlsCipherCollection"); - for (TConstIterator > valueIter(tlsCipherCollectionVal); - valueIter; valueIter++) { - const SmartPtrCXmlElement valueXml = - tlsCipherCollectionXml->createAndAddElement("cipher"); - valueXml->setValue(*valueIter); - } - } - - const SmartPtrCCertCollectionDoc tlsCertCollectionVal = - persistenceProtocolDoc->getTlsCertCollection(); - if (! tlsCertCollectionVal.IsNull()) { - const SmartPtrCXmlElement tlsCertCollectionXml = - thisXml->createAndAddElement("tlsCertCollection"); - CertCollectionXml::add(tlsCertCollectionVal, tlsCertCollectionXml); - } - - const std::string uriAmqpPathVal = persistenceProtocolDoc->getUriAmqpPath(); - if (! uriAmqpPathVal.empty()) { - thisXml->addAttribute("uriAmqpPath", uriAmqpPathVal); - } - - const std::string uriTunnelPathVal = persistenceProtocolDoc->getUriTunnelPath(); - if (! uriTunnelPathVal.empty()) { - thisXml->addAttribute("uriTunnelPath", uriTunnelPathVal); - } - - const std::string tlsCertPathVal = persistenceProtocolDoc->getTlsCertPath(); - if (! tlsCertPathVal.empty()) { - thisXml->addAttribute("tlsCertPath", tlsCertPathVal); - } - - const SmartPtrCCertPathCollectionDoc tlsCertPathCollectionVal = - persistenceProtocolDoc->getTlsCertPathCollection(); - if (! tlsCertPathCollectionVal.IsNull()) { - const SmartPtrCXmlElement tlsCertPathCollectionXml = - thisXml->createAndAddElement("tlsCertPathCollection"); - CertPathCollectionXml::add(tlsCertPathCollectionVal, tlsCertPathCollectionXml); - } -} - -SmartPtrCPersistenceProtocolDoc PersistenceProtocolXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("PersistenceProtocolXml", "parse"); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string protocolNameVal = - thisXml->findOptionalAttribute("protocolName"); - - const std::string uriVal = - thisXml->findOptionalAttribute("uri"); - - const std::string uriAmqpVal = - thisXml->findOptionalAttribute("uriAmqp"); - - const std::string uriTunnelVal = - thisXml->findOptionalAttribute("uriTunnel"); - - std::string tlsCertVal; - const SmartPtrCXmlElement tlsCertXml = thisXml->findOptionalChild("tlsCert"); - if (tlsCertXml) { - tlsCertVal = tlsCertXml->getValue(); - } - - const std::string tlsProtocolVal = - thisXml->findOptionalAttribute("tlsProtocol"); - - const SmartPtrCXmlElement tlsCipherCollectionXml = - thisXml->findOptionalChild("tlsCipherCollection"); - std::deque tlsCipherCollectionVal; - if (! tlsCipherCollectionXml.IsNull()) { - const CXmlElement::SmartPtrCElementCollection valueCollectionXml = - tlsCipherCollectionXml->findOptionalChildren("cipher"); - if (! valueCollectionXml.IsNull() && ! valueCollectionXml->empty()) { - for (TConstIterator valueXmlIter(*valueCollectionXml); - valueXmlIter; valueXmlIter++) { - const SmartPtrCXmlElement valueXml = valueXmlIter->second; - const std::string valueDoc = valueXml->getValue(); - tlsCipherCollectionVal.push_back(valueDoc); - } - } - } - - const SmartPtrCXmlElement tlsCertCollectionXml = - thisXml->findOptionalChild("tlsCertCollection"); - SmartPtrCCertCollectionDoc tlsCertCollectionVal; - if (! tlsCertCollectionXml.IsNull()) { - tlsCertCollectionVal = CertCollectionXml::parse(tlsCertCollectionXml); - } - - const std::string uriAmqpPathVal = - thisXml->findOptionalAttribute("uriAmqpPath"); - - const std::string uriTunnelPathVal = - thisXml->findOptionalAttribute("uriTunnelPath"); - - const std::string tlsCertPathVal = - thisXml->findOptionalAttribute("tlsCertPath"); - - const SmartPtrCXmlElement tlsCertPathCollectionXml = - thisXml->findOptionalChild("tlsCertPathCollection"); - SmartPtrCCertPathCollectionDoc tlsCertPathCollectionVal; - if (! tlsCertPathCollectionXml.IsNull()) { - tlsCertPathCollectionVal = CertPathCollectionXml::parse(tlsCertPathCollectionXml); - } - - SmartPtrCPersistenceProtocolDoc persistenceProtocolDoc; - persistenceProtocolDoc.CreateInstance(); - persistenceProtocolDoc->initialize( - protocolNameVal, - uriVal, - uriAmqpVal, - uriTunnelVal, - tlsCertVal, - tlsProtocolVal, - tlsCipherCollectionVal, - tlsCertCollectionVal, - uriAmqpPathVal, - uriTunnelPathVal, - tlsCertPathVal, - tlsCertPathCollectionVal); - - return persistenceProtocolDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/PersistenceXml/PersistenceXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/PersistenceXml/PersistenceXml.cpp deleted file mode 100644 index 0e20685fc..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/PersistenceXml/PersistenceXml.cpp +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Author: bwilliams - * Created: Nov 16, 2015 - * - * Copyright (C) 2015-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/PersistenceXml/LocalSecurityXml.h" -#include "Doc/DocXml/PersistenceXml/PersistenceProtocolCollectionXml.h" -#include "Doc/DocXml/PersistenceXml/RemoteSecurityCollectionXml.h" - -#include "Doc/PersistenceDoc/CLocalSecurityDoc.h" -#include "Doc/PersistenceDoc/CPersistenceDoc.h" -#include "Doc/PersistenceDoc/CPersistenceProtocolCollectionDoc.h" -#include "Doc/PersistenceDoc/CRemoteSecurityCollectionDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/PersistenceXml/PersistenceXml.h" - -using namespace Caf; - -void PersistenceXml::add( - const SmartPtrCPersistenceDoc persistenceDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("PersistenceXml", "add"); - CAF_CM_VALIDATE_SMARTPTR(persistenceDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const SmartPtrCLocalSecurityDoc localSecurityVal = - persistenceDoc->getLocalSecurity(); - if (! localSecurityVal.IsNull()) { - const SmartPtrCXmlElement localSecurityXml = - thisXml->createAndAddElement("localSecurity"); - LocalSecurityXml::add(localSecurityVal, localSecurityXml); - } - - const SmartPtrCRemoteSecurityCollectionDoc remoteSecurityCollectionVal = - persistenceDoc->getRemoteSecurityCollection(); - if (! remoteSecurityCollectionVal.IsNull()) { - const SmartPtrCXmlElement remoteSecurityCollectionXml = - thisXml->createAndAddElement("remoteSecurityCollection"); - RemoteSecurityCollectionXml::add(remoteSecurityCollectionVal, remoteSecurityCollectionXml); - } - - const SmartPtrCPersistenceProtocolCollectionDoc persistenceProtocolCollectionVal = - persistenceDoc->getPersistenceProtocolCollection(); - if (! persistenceProtocolCollectionVal.IsNull()) { - const SmartPtrCXmlElement persistenceProtocolCollectionXml = - thisXml->createAndAddElement("persistenceProtocolCollection"); - PersistenceProtocolCollectionXml::add(persistenceProtocolCollectionVal, persistenceProtocolCollectionXml); - } - - const std::string versionVal = persistenceDoc->getVersion().empty() ? "1.0" : persistenceDoc->getVersion(); - thisXml->addAttribute("version", versionVal); -} - -SmartPtrCPersistenceDoc PersistenceXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("PersistenceXml", "parse"); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const SmartPtrCXmlElement localSecurityXml = - thisXml->findOptionalChild("localSecurity"); - SmartPtrCLocalSecurityDoc localSecurityVal; - if (! localSecurityXml.IsNull()) { - localSecurityVal = LocalSecurityXml::parse(localSecurityXml); - } - - const SmartPtrCXmlElement remoteSecurityCollectionXml = - thisXml->findOptionalChild("remoteSecurityCollection"); - SmartPtrCRemoteSecurityCollectionDoc remoteSecurityCollectionVal; - if (! remoteSecurityCollectionXml.IsNull()) { - remoteSecurityCollectionVal = RemoteSecurityCollectionXml::parse(remoteSecurityCollectionXml); - } - - const SmartPtrCXmlElement persistenceProtocolCollectionXml = - thisXml->findOptionalChild("persistenceProtocolCollection"); - SmartPtrCPersistenceProtocolCollectionDoc persistenceProtocolCollectionVal; - if (! persistenceProtocolCollectionXml.IsNull()) { - persistenceProtocolCollectionVal = PersistenceProtocolCollectionXml::parse(persistenceProtocolCollectionXml); - } - - const std::string versionVal = - thisXml->findOptionalAttribute("version"); - - SmartPtrCPersistenceDoc persistenceDoc; - persistenceDoc.CreateInstance(); - persistenceDoc->initialize( - localSecurityVal, - remoteSecurityCollectionVal, - persistenceProtocolCollectionVal, - versionVal); - - return persistenceDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/PersistenceXml/PersistenceXmlRoots.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/PersistenceXml/PersistenceXmlRoots.cpp deleted file mode 100644 index 11ffd413d..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/PersistenceXml/PersistenceXmlRoots.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Author: bwilliams - * Created: Nov 16, 2015 - * - * Copyright (C) 2015-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/PersistenceXml/PersistenceXml.h" - -#include "Doc/PersistenceDoc/CPersistenceDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/PersistenceXml/PersistenceXmlRoots.h" - -using namespace Caf; - -std::string XmlRoots::savePersistenceToString( - const SmartPtrCPersistenceDoc persistenceDoc) { - CAF_CM_STATIC_FUNC_VALIDATE("XmlRoots", "savePersistenceToString"); - CAF_CM_VALIDATE_SMARTPTR(persistenceDoc); - - const std::string schemaNamespace = DocXmlUtils::getSchemaNamespace("fx"); - const std::string schemaLocation = DocXmlUtils::getSchemaLocation("fx/Persistence.xsd"); - - const SmartPtrCXmlElement rootXml = CXmlUtils::createRootElement( - "persistence", schemaNamespace, schemaLocation); - PersistenceXml::add(persistenceDoc, rootXml); - - return rootXml->saveToString(); -} - -SmartPtrCPersistenceDoc XmlRoots::parsePersistenceFromString( - const std::string xml) { - CAF_CM_STATIC_FUNC_VALIDATE("XmlRoots", "parsePersistenceFromString"); - CAF_CM_VALIDATE_STRING(xml); - - const SmartPtrCXmlElement rootXml = CXmlUtils::parseString(xml, "caf:persistence"); - return PersistenceXml::parse(rootXml); -} - -void XmlRoots::savePersistenceToFile( - const SmartPtrCPersistenceDoc persistenceDoc, - const std::string filePath) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("XmlRoots", "savePersistenceToFile"); - CAF_CM_VALIDATE_SMARTPTR(persistenceDoc); - CAF_CM_VALIDATE_STRING(filePath); - - CAF_CM_LOG_DEBUG_VA1("Saving to file - %s", filePath.c_str()); - - const std::string persistenceStr = - savePersistenceToString(persistenceDoc); - FileSystemUtils::saveTextFile(filePath, persistenceStr); -} - -SmartPtrCPersistenceDoc XmlRoots::parsePersistenceFromFile( - const std::string filePath) { - CAF_CM_STATIC_FUNC_VALIDATE("XmlRoots", "parsePersistenceFromFile"); - CAF_CM_VALIDATE_STRING(filePath); - - const SmartPtrCXmlElement rootXml = CXmlUtils::parseFile(filePath, "caf:persistence"); - return PersistenceXml::parse(rootXml); -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/PersistenceXml/RemoteSecurityCollectionXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/PersistenceXml/RemoteSecurityCollectionXml.cpp deleted file mode 100644 index e77ece575..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/PersistenceXml/RemoteSecurityCollectionXml.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Author: bwilliams - * Created: Nov 16, 2015 - * - * Copyright (C) 2015-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/PersistenceXml/RemoteSecurityXml.h" - -#include "Doc/PersistenceDoc/CRemoteSecurityCollectionDoc.h" -#include "Doc/PersistenceDoc/CRemoteSecurityDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/PersistenceXml/RemoteSecurityCollectionXml.h" - -using namespace Caf; - -void RemoteSecurityCollectionXml::add( - const SmartPtrCRemoteSecurityCollectionDoc remoteSecurityCollectionDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("RemoteSecurityCollectionXml", "add"); - CAF_CM_VALIDATE_SMARTPTR(remoteSecurityCollectionDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::deque remoteSecurityVal = - remoteSecurityCollectionDoc->getRemoteSecurity(); - if (! remoteSecurityVal.empty()) { - for (TConstIterator > remoteSecurityIter(remoteSecurityVal); - remoteSecurityIter; remoteSecurityIter++) { - const SmartPtrCXmlElement remoteSecurityXml = - thisXml->createAndAddElement("remoteSecurity"); - RemoteSecurityXml::add(*remoteSecurityIter, remoteSecurityXml); - } - } -} - -SmartPtrCRemoteSecurityCollectionDoc RemoteSecurityCollectionXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("RemoteSecurityCollectionXml", "parse"); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const CXmlElement::SmartPtrCElementCollection remoteSecurityChildrenXml = - thisXml->findOptionalChildren("remoteSecurity"); - - std::deque remoteSecurityVal; - if (! remoteSecurityChildrenXml.IsNull() && ! remoteSecurityChildrenXml->empty()) { - for (TConstIterator remoteSecurityXmlIter(*remoteSecurityChildrenXml); - remoteSecurityXmlIter; remoteSecurityXmlIter++) { - const SmartPtrCXmlElement remoteSecurityXml = remoteSecurityXmlIter->second; - const SmartPtrCRemoteSecurityDoc remoteSecurityDoc = - RemoteSecurityXml::parse(remoteSecurityXml); - remoteSecurityVal.push_back(remoteSecurityDoc); - } - } - - SmartPtrCRemoteSecurityCollectionDoc remoteSecurityCollectionDoc; - remoteSecurityCollectionDoc.CreateInstance(); - remoteSecurityCollectionDoc->initialize( - remoteSecurityVal); - - return remoteSecurityCollectionDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/PersistenceXml/RemoteSecurityXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/PersistenceXml/RemoteSecurityXml.cpp deleted file mode 100644 index b03e12187..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/PersistenceXml/RemoteSecurityXml.cpp +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Author: bwilliams - * Created: Nov 16, 2015 - * - * Copyright (C) 2015-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/PersistenceXml/CertCollectionXml.h" -#include "Doc/DocXml/PersistenceXml/CertPathCollectionXml.h" - -#include "Doc/PersistenceDoc/CCertCollectionDoc.h" -#include "Doc/PersistenceDoc/CCertPathCollectionDoc.h" -#include "Doc/PersistenceDoc/CRemoteSecurityDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/PersistenceXml/RemoteSecurityXml.h" - -using namespace Caf; - -void RemoteSecurityXml::add( - const SmartPtrCRemoteSecurityDoc remoteSecurityDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("RemoteSecurityXml", "add"); - CAF_CM_VALIDATE_SMARTPTR(remoteSecurityDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string remoteIdVal = remoteSecurityDoc->getRemoteId(); - if (! remoteIdVal.empty()) { - thisXml->addAttribute("remoteId", remoteIdVal); - } - - const std::string protocolNameVal = remoteSecurityDoc->getProtocolName(); - if (! protocolNameVal.empty()) { - thisXml->addAttribute("protocolName", protocolNameVal); - } - - const std::string cmsCertVal = remoteSecurityDoc->getCmsCert(); - if (! cmsCertVal.empty()) { - const SmartPtrCXmlElement cmsCertXml = thisXml->createAndAddElement("cmsCert"); - cmsCertXml->setValue(cmsCertVal); - } - - const std::string cmsCipherNameVal = remoteSecurityDoc->getCmsCipherName(); - if (! cmsCipherNameVal.empty()) { - thisXml->addAttribute("cmsCipherName", cmsCipherNameVal); - } - - const SmartPtrCCertCollectionDoc cmsCertCollectionVal = - remoteSecurityDoc->getCmsCertCollection(); - if (! cmsCertCollectionVal.IsNull()) { - const SmartPtrCXmlElement cmsCertCollectionXml = - thisXml->createAndAddElement("cmsCertCollection"); - CertCollectionXml::add(cmsCertCollectionVal, cmsCertCollectionXml); - } - - const std::string cmsCertPathVal = remoteSecurityDoc->getCmsCertPath(); - if (! cmsCertPathVal.empty()) { - thisXml->addAttribute("cmsCertPath", cmsCertPathVal); - } - - const SmartPtrCCertPathCollectionDoc cmsCertPathCollectionVal = - remoteSecurityDoc->getCmsCertPathCollection(); - if (! cmsCertPathCollectionVal.IsNull()) { - const SmartPtrCXmlElement cmsCertPathCollectionXml = - thisXml->createAndAddElement("cmsCertPathCollection"); - CertPathCollectionXml::add(cmsCertPathCollectionVal, cmsCertPathCollectionXml); - } -} - -SmartPtrCRemoteSecurityDoc RemoteSecurityXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("RemoteSecurityXml", "parse"); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string remoteIdVal = - thisXml->findOptionalAttribute("remoteId"); - - const std::string protocolNameVal = - thisXml->findOptionalAttribute("protocolName"); - - std::string cmsCertVal; - const SmartPtrCXmlElement cmsCertXml = thisXml->findOptionalChild("cmsCert"); - if (cmsCertXml) { - cmsCertVal = cmsCertXml->getValue(); - } - - const std::string cmsCipherNameVal = - thisXml->findOptionalAttribute("cmsCipherName"); - - const SmartPtrCXmlElement cmsCertCollectionXml = - thisXml->findOptionalChild("cmsCertCollection"); - SmartPtrCCertCollectionDoc cmsCertCollectionVal; - if (! cmsCertCollectionXml.IsNull()) { - cmsCertCollectionVal = CertCollectionXml::parse(cmsCertCollectionXml); - } - - const std::string cmsCertPathVal = - thisXml->findOptionalAttribute("cmsCertPath"); - - const SmartPtrCXmlElement cmsCertPathCollectionXml = - thisXml->findOptionalChild("cmsCertPathCollection"); - SmartPtrCCertPathCollectionDoc cmsCertPathCollectionVal; - if (! cmsCertPathCollectionXml.IsNull()) { - cmsCertPathCollectionVal = CertPathCollectionXml::parse(cmsCertPathCollectionXml); - } - - SmartPtrCRemoteSecurityDoc remoteSecurityDoc; - remoteSecurityDoc.CreateInstance(); - remoteSecurityDoc->initialize( - remoteIdVal, - protocolNameVal, - cmsCertVal, - cmsCipherNameVal, - cmsCertCollectionVal, - cmsCertPathVal, - cmsCertPathCollectionVal); - - return remoteSecurityDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/PersistenceXml/stdafx.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/PersistenceXml/stdafx.h deleted file mode 100644 index c13afe134..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/PersistenceXml/stdafx.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Author: bwilliams - * Created: Nov 16, 2015 - * - * Copyright (C) 2015-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#ifndef STDAFX_H_ -#define STDAFX_H_ - -#ifdef WIN32 - #define PERSISTENCEXML_LINKAGE __declspec(dllexport) -#else - #define PERSISTENCEXML_LINKAGE -#endif - -#include - -#include -#include - - -#endif /* STDAFX_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderInfraXml/ClassCollectionXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderInfraXml/ClassCollectionXml.cpp deleted file mode 100644 index 8890dd697..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderInfraXml/ClassCollectionXml.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/CafCoreTypesXml/FullyQualifiedClassGroupXml.h" - -#include "Doc/CafCoreTypesDoc/CFullyQualifiedClassGroupDoc.h" -#include "Doc/ProviderInfraDoc/CClassCollectionDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/ProviderInfraXml/ClassCollectionXml.h" - -using namespace Caf; - -void ClassCollectionXml::add( - const SmartPtrCClassCollectionDoc classCollectionDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("ClassCollectionXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(classCollectionDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::deque fullyQualifiedClassVal = - classCollectionDoc->getFullyQualifiedClass(); - CAF_CM_VALIDATE_STL(fullyQualifiedClassVal); - - if (! fullyQualifiedClassVal.empty()) { - for (TConstIterator > fullyQualifiedClassIter(fullyQualifiedClassVal); - fullyQualifiedClassIter; fullyQualifiedClassIter++) { - const SmartPtrCXmlElement fullyQualifiedClassXml = - thisXml->createAndAddElement("fullyQualifiedClass"); - FullyQualifiedClassGroupXml::add(*fullyQualifiedClassIter, fullyQualifiedClassXml); - } - } - } - CAF_CM_EXIT; -} - -SmartPtrCClassCollectionDoc ClassCollectionXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("ClassCollectionXml", "parse"); - - SmartPtrCClassCollectionDoc classCollectionDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const CXmlElement::SmartPtrCElementCollection fullyQualifiedClassChildrenXml = - thisXml->findRequiredChildren("fullyQualifiedClass"); - - std::deque fullyQualifiedClassVal; - if (! fullyQualifiedClassChildrenXml.IsNull() && ! fullyQualifiedClassChildrenXml->empty()) { - for (TConstIterator fullyQualifiedClassXmlIter(*fullyQualifiedClassChildrenXml); - fullyQualifiedClassXmlIter; fullyQualifiedClassXmlIter++) { - const SmartPtrCXmlElement fullyQualifiedClassXml = fullyQualifiedClassXmlIter->second; - const SmartPtrCFullyQualifiedClassGroupDoc fullyQualifiedClassDoc = - FullyQualifiedClassGroupXml::parse(fullyQualifiedClassXml); - fullyQualifiedClassVal.push_back(fullyQualifiedClassDoc); - } - } - - classCollectionDoc.CreateInstance(); - classCollectionDoc->initialize( - fullyQualifiedClassVal); - } - CAF_CM_EXIT; - - return classCollectionDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderInfraXml/ProviderInfraXmlRoots.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderInfraXml/ProviderInfraXmlRoots.cpp deleted file mode 100644 index f8200200f..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderInfraXml/ProviderInfraXmlRoots.cpp +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/ProviderInfraXml/ProviderRegXml.h" -#include "Doc/DocXml/ProviderInfraXml/SchemaSummaryXml.h" - -#include "Doc/ProviderInfraDoc/CProviderRegDoc.h" -#include "Doc/ProviderInfraDoc/CSchemaSummaryDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/ProviderInfraXml/ProviderInfraXmlRoots.h" - -using namespace Caf; - -std::string XmlRoots::saveProviderRegToString( - const SmartPtrCProviderRegDoc providerRegDoc) { - CAF_CM_STATIC_FUNC_VALIDATE("XmlRoots", "saveProviderRegToString"); - - std::string rc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(providerRegDoc); - - const std::string schemaNamespace = DocXmlUtils::getSchemaNamespace("fx"); - const std::string schemaLocation = DocXmlUtils::getSchemaLocation("fx/ProviderInfra.xsd"); - - const SmartPtrCXmlElement rootXml = CXmlUtils::createRootElement( - "providerReg", schemaNamespace, schemaLocation); - ProviderRegXml::add(providerRegDoc, rootXml); - - rc = rootXml->saveToString(); - } - CAF_CM_EXIT; - - return rc; -} - -SmartPtrCProviderRegDoc XmlRoots::parseProviderRegFromString( - const std::string xml) { - CAF_CM_STATIC_FUNC_VALIDATE("XmlRoots", "parseProviderRegFromString"); - - SmartPtrCProviderRegDoc providerRegDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(xml); - - const SmartPtrCXmlElement rootXml = CXmlUtils::parseString(xml, "caf:providerReg"); - providerRegDoc = ProviderRegXml::parse(rootXml); - } - CAF_CM_EXIT; - - return providerRegDoc; -} - -void XmlRoots::saveProviderRegToFile( - const SmartPtrCProviderRegDoc providerRegDoc, - const std::string filePath) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("XmlRoots", "saveProviderRegToFile"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(providerRegDoc); - CAF_CM_VALIDATE_STRING(filePath); - - CAF_CM_LOG_DEBUG_VA1("Saving to file - %s", filePath.c_str()); - - const std::string providerRegStr = - saveProviderRegToString(providerRegDoc); - FileSystemUtils::saveTextFile(filePath, providerRegStr); - } - CAF_CM_EXIT; -} - -SmartPtrCProviderRegDoc XmlRoots::parseProviderRegFromFile( - const std::string filePath) { - CAF_CM_STATIC_FUNC_VALIDATE("XmlRoots", "parseProviderRegFromFile"); - - SmartPtrCProviderRegDoc providerRegDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(filePath); - - const SmartPtrCXmlElement rootXml = CXmlUtils::parseFile(filePath, "caf:providerReg"); - providerRegDoc = ProviderRegXml::parse(rootXml); - } - CAF_CM_EXIT; - - return providerRegDoc; -} - -std::string XmlRoots::saveSchemaSummaryToString( - const SmartPtrCSchemaSummaryDoc schemaSummaryDoc) { - CAF_CM_STATIC_FUNC_VALIDATE("XmlRoots", "saveSchemaSummaryToString"); - - std::string rc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(schemaSummaryDoc); - - const std::string schemaNamespace = DocXmlUtils::getSchemaNamespace("fx"); - const std::string schemaLocation = DocXmlUtils::getSchemaLocation("fx/ProviderInfra.xsd"); - - const SmartPtrCXmlElement rootXml = CXmlUtils::createRootElement( - "schemaSummary", schemaNamespace, schemaLocation); - SchemaSummaryXml::add(schemaSummaryDoc, rootXml); - - rc = rootXml->saveToString(); - } - CAF_CM_EXIT; - - return rc; -} - -SmartPtrCSchemaSummaryDoc XmlRoots::parseSchemaSummaryFromString( - const std::string xml) { - CAF_CM_STATIC_FUNC_VALIDATE("XmlRoots", "parseSchemaSummaryFromString"); - - SmartPtrCSchemaSummaryDoc schemaSummaryDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(xml); - - const SmartPtrCXmlElement rootXml = CXmlUtils::parseString(xml, "caf:schemaSummary"); - schemaSummaryDoc = SchemaSummaryXml::parse(rootXml); - } - CAF_CM_EXIT; - - return schemaSummaryDoc; -} - -void XmlRoots::saveSchemaSummaryToFile( - const SmartPtrCSchemaSummaryDoc schemaSummaryDoc, - const std::string filePath) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("XmlRoots", "saveSchemaSummaryToFile"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(schemaSummaryDoc); - CAF_CM_VALIDATE_STRING(filePath); - - CAF_CM_LOG_DEBUG_VA1("Saving to file - %s", filePath.c_str()); - - const std::string schemaSummaryStr = - saveSchemaSummaryToString(schemaSummaryDoc); - FileSystemUtils::saveTextFile(filePath, schemaSummaryStr); - } - CAF_CM_EXIT; -} - -SmartPtrCSchemaSummaryDoc XmlRoots::parseSchemaSummaryFromFile( - const std::string filePath) { - CAF_CM_STATIC_FUNC_VALIDATE("XmlRoots", "parseSchemaSummaryFromFile"); - - SmartPtrCSchemaSummaryDoc schemaSummaryDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(filePath); - - const SmartPtrCXmlElement rootXml = CXmlUtils::parseFile(filePath, "caf:schemaSummary"); - schemaSummaryDoc = SchemaSummaryXml::parse(rootXml); - } - CAF_CM_EXIT; - - return schemaSummaryDoc; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderInfraXml/ProviderRegXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderInfraXml/ProviderRegXml.cpp deleted file mode 100644 index 5e968576f..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderInfraXml/ProviderRegXml.cpp +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/ProviderInfraDoc/CProviderRegDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/ProviderInfraXml/ProviderRegXml.h" - -using namespace Caf; - -void ProviderRegXml::add( - const SmartPtrCProviderRegDoc providerRegDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("ProviderRegXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(providerRegDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string providerNamespaceVal = providerRegDoc->getProviderNamespace(); - CAF_CM_VALIDATE_STRING(providerNamespaceVal); - thisXml->addAttribute("providerNamespace", providerNamespaceVal); - - const std::string providerNameVal = providerRegDoc->getProviderName(); - CAF_CM_VALIDATE_STRING(providerNameVal); - thisXml->addAttribute("providerName", providerNameVal); - - const std::string providerVersionVal = providerRegDoc->getProviderVersion(); - CAF_CM_VALIDATE_STRING(providerVersionVal); - thisXml->addAttribute("providerVersion", providerVersionVal); - - const std::string staleSecVal = - CStringConv::toString(providerRegDoc->getStaleSec()); - CAF_CM_VALIDATE_STRING(staleSecVal); - thisXml->addAttribute("staleSec", staleSecVal); - - const std::string isSchemaVisibleVal = providerRegDoc->getIsSchemaVisible() ? "true" : "false"; - CAF_CM_VALIDATE_STRING(isSchemaVisibleVal); - thisXml->addAttribute("isSchemaVisible", isSchemaVisibleVal); - - const std::string invokerRelPathVal = providerRegDoc->getInvokerRelPath(); - if (! invokerRelPathVal.empty()) { - thisXml->addAttribute("invokerRelPath", invokerRelPathVal); - } - } - CAF_CM_EXIT; -} - -SmartPtrCProviderRegDoc ProviderRegXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("ProviderRegXml", "parse"); - - SmartPtrCProviderRegDoc providerRegDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string providerNamespaceStrVal = - thisXml->findRequiredAttribute("providerNamespace"); - const std::string providerNamespaceVal = providerNamespaceStrVal; - - const std::string providerNameStrVal = - thisXml->findRequiredAttribute("providerName"); - const std::string providerNameVal = providerNameStrVal; - - const std::string providerVersionStrVal = - thisXml->findRequiredAttribute("providerVersion"); - const std::string providerVersionVal = providerVersionStrVal; - - const std::string staleSecStrVal = - thisXml->findRequiredAttribute("staleSec"); - int32 staleSecVal = 0; - if (! staleSecStrVal.empty()) { - staleSecVal = CStringConv::fromString(staleSecStrVal); - } - - const std::string isSchemaVisibleStrVal = - thisXml->findRequiredAttribute("isSchemaVisible"); - bool isSchemaVisibleVal = false; - if (! isSchemaVisibleStrVal.empty()) { - isSchemaVisibleVal = (isSchemaVisibleStrVal.compare("true") == 0) ? true : false; - } - - const std::string invokerRelPathStrVal = - thisXml->findOptionalAttribute("invokerRelPath"); - const std::string invokerRelPathVal = invokerRelPathStrVal; - - providerRegDoc.CreateInstance(); - providerRegDoc->initialize( - providerNamespaceVal, - providerNameVal, - providerVersionVal, - staleSecVal, - isSchemaVisibleVal, - invokerRelPathVal); - } - CAF_CM_EXIT; - - return providerRegDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderInfraXml/SchemaSummaryXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderInfraXml/SchemaSummaryXml.cpp deleted file mode 100644 index 13ecd9450..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderInfraXml/SchemaSummaryXml.cpp +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/ProviderInfraXml/ClassCollectionXml.h" - -#include "Doc/ProviderInfraDoc/CClassCollectionDoc.h" -#include "Doc/ProviderInfraDoc/CSchemaSummaryDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/ProviderInfraXml/SchemaSummaryXml.h" - -using namespace Caf; - -void SchemaSummaryXml::add( - const SmartPtrCSchemaSummaryDoc schemaSummaryDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("SchemaSummaryXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(schemaSummaryDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string providerNamespaceVal = schemaSummaryDoc->getProviderNamespace(); - CAF_CM_VALIDATE_STRING(providerNamespaceVal); - thisXml->addAttribute("providerNamespace", providerNamespaceVal); - - const std::string providerNameVal = schemaSummaryDoc->getProviderName(); - CAF_CM_VALIDATE_STRING(providerNameVal); - thisXml->addAttribute("providerName", providerNameVal); - - const std::string providerVersionVal = schemaSummaryDoc->getProviderVersion(); - CAF_CM_VALIDATE_STRING(providerVersionVal); - thisXml->addAttribute("providerVersion", providerVersionVal); - - const SmartPtrCClassCollectionDoc classCollectionVal = - schemaSummaryDoc->getClassCollection(); - CAF_CM_VALIDATE_SMARTPTR(classCollectionVal); - - const SmartPtrCXmlElement classCollectionXml = - thisXml->createAndAddElement("classCollection"); - ClassCollectionXml::add(classCollectionVal, classCollectionXml); - - const std::string invokerPathVal = schemaSummaryDoc->getInvokerPath(); - if (! invokerPathVal.empty()) { - thisXml->addAttribute("invokerPath", invokerPathVal); - } - } - CAF_CM_EXIT; -} - -SmartPtrCSchemaSummaryDoc SchemaSummaryXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("SchemaSummaryXml", "parse"); - - SmartPtrCSchemaSummaryDoc schemaSummaryDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string providerNamespaceStrVal = - thisXml->findRequiredAttribute("providerNamespace"); - const std::string providerNamespaceVal = providerNamespaceStrVal; - - const std::string providerNameStrVal = - thisXml->findRequiredAttribute("providerName"); - const std::string providerNameVal = providerNameStrVal; - - const std::string providerVersionStrVal = - thisXml->findRequiredAttribute("providerVersion"); - const std::string providerVersionVal = providerVersionStrVal; - - const SmartPtrCXmlElement classCollectionXml = - thisXml->findRequiredChild("classCollection"); - - SmartPtrCClassCollectionDoc classCollectionVal; - if (! classCollectionXml.IsNull()) { - classCollectionVal = ClassCollectionXml::parse(classCollectionXml); - } - - const std::string invokerPathStrVal = - thisXml->findOptionalAttribute("invokerPath"); - const std::string invokerPathVal = invokerPathStrVal; - - schemaSummaryDoc.CreateInstance(); - schemaSummaryDoc->initialize( - providerNamespaceVal, - providerNameVal, - providerVersionVal, - classCollectionVal, - invokerPathVal); - } - CAF_CM_EXIT; - - return schemaSummaryDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderInfraXml/stdafx.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderInfraXml/stdafx.h deleted file mode 100644 index f64b02dc8..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderInfraXml/stdafx.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef STDAFX_H_ -#define STDAFX_H_ - -#ifdef WIN32 - #define PROVIDERINFRAXML_LINKAGE __declspec(dllexport) -#else - #define PROVIDERINFRAXML_LINKAGE -#endif - -#include - -#include -#include - - -#endif /* STDAFX_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderRequestXml/ProviderBatchXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderRequestXml/ProviderBatchXml.cpp deleted file mode 100644 index dec2af9e0..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderRequestXml/ProviderBatchXml.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/ProviderRequestXml/ProviderCollectInstancesCollectionXml.h" -#include "Doc/DocXml/ProviderRequestXml/ProviderInvokeOperationCollectionXml.h" - -#include "Doc/ProviderRequestDoc/CProviderBatchDoc.h" -#include "Doc/ProviderRequestDoc/CProviderCollectInstancesCollectionDoc.h" -#include "Doc/ProviderRequestDoc/CProviderInvokeOperationCollectionDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/ProviderRequestXml/ProviderBatchXml.h" - -using namespace Caf; - -void ProviderBatchXml::add( - const SmartPtrCProviderBatchDoc providerBatchDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("ProviderBatchXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(providerBatchDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string outputDirVal = providerBatchDoc->getOutputDir(); - CAF_CM_VALIDATE_STRING(outputDirVal); - thisXml->addAttribute("outputDir", outputDirVal); - - const SmartPtrCProviderCollectInstancesCollectionDoc collectInstancesCollectionVal = - providerBatchDoc->getCollectInstancesCollection(); - if (! collectInstancesCollectionVal.IsNull()) { - const SmartPtrCXmlElement collectInstancesCollectionXml = - thisXml->createAndAddElement("collectInstancesCollection"); - ProviderCollectInstancesCollectionXml::add(collectInstancesCollectionVal, collectInstancesCollectionXml); - } - - const SmartPtrCProviderInvokeOperationCollectionDoc invokeOperationCollectionVal = - providerBatchDoc->getInvokeOperationCollection(); - if (! invokeOperationCollectionVal.IsNull()) { - const SmartPtrCXmlElement invokeOperationCollectionXml = - thisXml->createAndAddElement("invokeOperationCollection"); - ProviderInvokeOperationCollectionXml::add(invokeOperationCollectionVal, invokeOperationCollectionXml); - } - } - CAF_CM_EXIT; -} - -SmartPtrCProviderBatchDoc ProviderBatchXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("ProviderBatchXml", "parse"); - - SmartPtrCProviderBatchDoc providerBatchDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string outputDirStrVal = - thisXml->findRequiredAttribute("outputDir"); - const std::string outputDirVal = outputDirStrVal; - - const SmartPtrCXmlElement collectInstancesCollectionXml = - thisXml->findOptionalChild("collectInstancesCollection"); - - SmartPtrCProviderCollectInstancesCollectionDoc collectInstancesCollectionVal; - if (! collectInstancesCollectionXml.IsNull()) { - collectInstancesCollectionVal = ProviderCollectInstancesCollectionXml::parse(collectInstancesCollectionXml); - } - - const SmartPtrCXmlElement invokeOperationCollectionXml = - thisXml->findOptionalChild("invokeOperationCollection"); - - SmartPtrCProviderInvokeOperationCollectionDoc invokeOperationCollectionVal; - if (! invokeOperationCollectionXml.IsNull()) { - invokeOperationCollectionVal = ProviderInvokeOperationCollectionXml::parse(invokeOperationCollectionXml); - } - - providerBatchDoc.CreateInstance(); - providerBatchDoc->initialize( - outputDirVal, - collectInstancesCollectionVal, - invokeOperationCollectionVal); - } - CAF_CM_EXIT; - - return providerBatchDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderRequestXml/ProviderCollectInstancesCollectionXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderRequestXml/ProviderCollectInstancesCollectionXml.cpp deleted file mode 100644 index 7f302d002..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderRequestXml/ProviderCollectInstancesCollectionXml.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/ProviderRequestXml/ProviderCollectInstancesXml.h" - -#include "Doc/ProviderRequestDoc/CProviderCollectInstancesCollectionDoc.h" -#include "Doc/ProviderRequestDoc/CProviderCollectInstancesDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/ProviderRequestXml/ProviderCollectInstancesCollectionXml.h" - -using namespace Caf; - -void ProviderCollectInstancesCollectionXml::add( - const SmartPtrCProviderCollectInstancesCollectionDoc providerCollectInstancesCollectionDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("ProviderCollectInstancesCollectionXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(providerCollectInstancesCollectionDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::deque collectInstancesVal = - providerCollectInstancesCollectionDoc->getCollectInstances(); - CAF_CM_VALIDATE_STL(collectInstancesVal); - - if (! collectInstancesVal.empty()) { - for (TConstIterator > collectInstancesIter(collectInstancesVal); - collectInstancesIter; collectInstancesIter++) { - const SmartPtrCXmlElement collectInstancesXml = - thisXml->createAndAddElement("collectInstances"); - ProviderCollectInstancesXml::add(*collectInstancesIter, collectInstancesXml); - } - } - } - CAF_CM_EXIT; -} - -SmartPtrCProviderCollectInstancesCollectionDoc ProviderCollectInstancesCollectionXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("ProviderCollectInstancesCollectionXml", "parse"); - - SmartPtrCProviderCollectInstancesCollectionDoc providerCollectInstancesCollectionDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const CXmlElement::SmartPtrCElementCollection collectInstancesChildrenXml = - thisXml->findRequiredChildren("collectInstances"); - - std::deque collectInstancesVal; - if (! collectInstancesChildrenXml.IsNull() && ! collectInstancesChildrenXml->empty()) { - for (TConstIterator collectInstancesXmlIter(*collectInstancesChildrenXml); - collectInstancesXmlIter; collectInstancesXmlIter++) { - const SmartPtrCXmlElement collectInstancesXml = collectInstancesXmlIter->second; - const SmartPtrCProviderCollectInstancesDoc collectInstancesDoc = - ProviderCollectInstancesXml::parse(collectInstancesXml); - collectInstancesVal.push_back(collectInstancesDoc); - } - } - - providerCollectInstancesCollectionDoc.CreateInstance(); - providerCollectInstancesCollectionDoc->initialize( - collectInstancesVal); - } - CAF_CM_EXIT; - - return providerCollectInstancesCollectionDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderRequestXml/ProviderCollectInstancesXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderRequestXml/ProviderCollectInstancesXml.cpp deleted file mode 100644 index 14107edeb..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderRequestXml/ProviderCollectInstancesXml.cpp +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/CafCoreTypesXml/ParameterCollectionXml.h" - -#include "Doc/CafCoreTypesDoc/CParameterCollectionDoc.h" -#include "Doc/ProviderRequestDoc/CProviderCollectInstancesDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/ProviderRequestXml/ProviderCollectInstancesXml.h" - -using namespace Caf; - -void ProviderCollectInstancesXml::add( - const SmartPtrCProviderCollectInstancesDoc providerCollectInstancesDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("ProviderCollectInstancesXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(providerCollectInstancesDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string classNamespaceVal = providerCollectInstancesDoc->getClassNamespace(); - CAF_CM_VALIDATE_STRING(classNamespaceVal); - thisXml->addAttribute("classNamespace", classNamespaceVal); - - const std::string classNameVal = providerCollectInstancesDoc->getClassName(); - CAF_CM_VALIDATE_STRING(classNameVal); - thisXml->addAttribute("className", classNameVal); - - const std::string classVersionVal = providerCollectInstancesDoc->getClassVersion(); - CAF_CM_VALIDATE_STRING(classVersionVal); - thisXml->addAttribute("classVersion", classVersionVal); - - const std::string jobIdVal = - BasePlatform::UuidToString(providerCollectInstancesDoc->getJobId()); - CAF_CM_VALIDATE_STRING(jobIdVal); - thisXml->addAttribute("jobId", jobIdVal); - - const std::string outputDirVal = providerCollectInstancesDoc->getOutputDir(); - CAF_CM_VALIDATE_STRING(outputDirVal); - thisXml->addAttribute("outputDir", outputDirVal); - - const SmartPtrCParameterCollectionDoc parameterCollectionVal = - providerCollectInstancesDoc->getParameterCollection(); - if (! parameterCollectionVal.IsNull()) { - const SmartPtrCXmlElement parameterCollectionXml = - thisXml->createAndAddElement("parameterCollection"); - ParameterCollectionXml::add(parameterCollectionVal, parameterCollectionXml); - } - } - CAF_CM_EXIT; -} - -SmartPtrCProviderCollectInstancesDoc ProviderCollectInstancesXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("ProviderCollectInstancesXml", "parse"); - - SmartPtrCProviderCollectInstancesDoc providerCollectInstancesDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string classNamespaceStrVal = - thisXml->findRequiredAttribute("classNamespace"); - const std::string classNamespaceVal = classNamespaceStrVal; - - const std::string classNameStrVal = - thisXml->findRequiredAttribute("className"); - const std::string classNameVal = classNameStrVal; - - const std::string classVersionStrVal = - thisXml->findRequiredAttribute("classVersion"); - const std::string classVersionVal = classVersionStrVal; - - const std::string jobIdStrVal = - thisXml->findRequiredAttribute("jobId"); - UUID jobIdVal = CAFCOMMON_GUID_NULL; - if (! jobIdStrVal.empty()) { - BasePlatform::UuidFromString(jobIdStrVal.c_str(), jobIdVal); - } - - const std::string outputDirStrVal = - thisXml->findRequiredAttribute("outputDir"); - const std::string outputDirVal = outputDirStrVal; - - const SmartPtrCXmlElement parameterCollectionXml = - thisXml->findOptionalChild("parameterCollection"); - - SmartPtrCParameterCollectionDoc parameterCollectionVal; - if (! parameterCollectionXml.IsNull()) { - parameterCollectionVal = ParameterCollectionXml::parse(parameterCollectionXml); - } - - providerCollectInstancesDoc.CreateInstance(); - providerCollectInstancesDoc->initialize( - classNamespaceVal, - classNameVal, - classVersionVal, - jobIdVal, - outputDirVal, - parameterCollectionVal); - } - CAF_CM_EXIT; - - return providerCollectInstancesDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderRequestXml/ProviderCollectSchemaRequestXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderRequestXml/ProviderCollectSchemaRequestXml.cpp deleted file mode 100644 index 0d6965397..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderRequestXml/ProviderCollectSchemaRequestXml.cpp +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/ProviderRequestXml/ProviderRequestHeaderXml.h" - -#include "Doc/ProviderRequestDoc/CProviderCollectSchemaRequestDoc.h" -#include "Doc/ProviderRequestDoc/CProviderRequestHeaderDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/ProviderRequestXml/ProviderCollectSchemaRequestXml.h" - -using namespace Caf; - -void ProviderCollectSchemaRequestXml::add( - const SmartPtrCProviderCollectSchemaRequestDoc providerCollectSchemaRequestDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("ProviderCollectSchemaRequestXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(providerCollectSchemaRequestDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string clientIdVal = - BasePlatform::UuidToString(providerCollectSchemaRequestDoc->getClientId()); - CAF_CM_VALIDATE_STRING(clientIdVal); - thisXml->addAttribute("clientId", clientIdVal); - - const std::string requestIdVal = - BasePlatform::UuidToString(providerCollectSchemaRequestDoc->getRequestId()); - CAF_CM_VALIDATE_STRING(requestIdVal); - thisXml->addAttribute("requestId", requestIdVal); - - const std::string pmeIdVal = providerCollectSchemaRequestDoc->getPmeId(); - CAF_CM_VALIDATE_STRING(pmeIdVal); - thisXml->addAttribute("pmeId", pmeIdVal); - - const std::string jobIdVal = - BasePlatform::UuidToString(providerCollectSchemaRequestDoc->getJobId()); - CAF_CM_VALIDATE_STRING(jobIdVal); - thisXml->addAttribute("jobId", jobIdVal); - - const std::string outputDirVal = providerCollectSchemaRequestDoc->getOutputDir(); - CAF_CM_VALIDATE_STRING(outputDirVal); - thisXml->addAttribute("outputDir", outputDirVal); - - const SmartPtrCProviderRequestHeaderDoc requestHeaderVal = - providerCollectSchemaRequestDoc->getRequestHeader(); - CAF_CM_VALIDATE_SMARTPTR(requestHeaderVal); - - const SmartPtrCXmlElement requestHeaderXml = - thisXml->createAndAddElement("requestHeader"); - ProviderRequestHeaderXml::add(requestHeaderVal, requestHeaderXml); - } - CAF_CM_EXIT; -} - -SmartPtrCProviderCollectSchemaRequestDoc ProviderCollectSchemaRequestXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("ProviderCollectSchemaRequestXml", "parse"); - - SmartPtrCProviderCollectSchemaRequestDoc providerCollectSchemaRequestDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string clientIdStrVal = - thisXml->findRequiredAttribute("clientId"); - UUID clientIdVal = CAFCOMMON_GUID_NULL; - if (! clientIdStrVal.empty()) { - BasePlatform::UuidFromString(clientIdStrVal.c_str(), clientIdVal); - } - - const std::string requestIdStrVal = - thisXml->findRequiredAttribute("requestId"); - UUID requestIdVal = CAFCOMMON_GUID_NULL; - if (! requestIdStrVal.empty()) { - BasePlatform::UuidFromString(requestIdStrVal.c_str(), requestIdVal); - } - - const std::string pmeIdVal = - thisXml->findRequiredAttribute("pmeId"); - - const std::string jobIdStrVal = - thisXml->findRequiredAttribute("jobId"); - UUID jobIdVal = CAFCOMMON_GUID_NULL; - if (! jobIdStrVal.empty()) { - BasePlatform::UuidFromString(jobIdStrVal.c_str(), jobIdVal); - } - - const std::string outputDirStrVal = - thisXml->findRequiredAttribute("outputDir"); - const std::string outputDirVal = outputDirStrVal; - - const SmartPtrCXmlElement requestHeaderXml = - thisXml->findRequiredChild("requestHeader"); - - SmartPtrCProviderRequestHeaderDoc requestHeaderVal; - if (! requestHeaderXml.IsNull()) { - requestHeaderVal = ProviderRequestHeaderXml::parse(requestHeaderXml); - } - - providerCollectSchemaRequestDoc.CreateInstance(); - providerCollectSchemaRequestDoc->initialize( - clientIdVal, - requestIdVal, - pmeIdVal, - jobIdVal, - outputDirVal, - requestHeaderVal); - } - CAF_CM_EXIT; - - return providerCollectSchemaRequestDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderRequestXml/ProviderInvokeOperationCollectionXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderRequestXml/ProviderInvokeOperationCollectionXml.cpp deleted file mode 100644 index effe7aa82..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderRequestXml/ProviderInvokeOperationCollectionXml.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/ProviderRequestXml/ProviderInvokeOperationXml.h" - -#include "Doc/ProviderRequestDoc/CProviderInvokeOperationCollectionDoc.h" -#include "Doc/ProviderRequestDoc/CProviderInvokeOperationDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/ProviderRequestXml/ProviderInvokeOperationCollectionXml.h" - -using namespace Caf; - -void ProviderInvokeOperationCollectionXml::add( - const SmartPtrCProviderInvokeOperationCollectionDoc providerInvokeOperationCollectionDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("ProviderInvokeOperationCollectionXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(providerInvokeOperationCollectionDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::deque invokeOperationVal = - providerInvokeOperationCollectionDoc->getInvokeOperation(); - CAF_CM_VALIDATE_STL(invokeOperationVal); - - if (! invokeOperationVal.empty()) { - for (TConstIterator > invokeOperationIter(invokeOperationVal); - invokeOperationIter; invokeOperationIter++) { - const SmartPtrCXmlElement invokeOperationXml = - thisXml->createAndAddElement("invokeOperation"); - ProviderInvokeOperationXml::add(*invokeOperationIter, invokeOperationXml); - } - } - } - CAF_CM_EXIT; -} - -SmartPtrCProviderInvokeOperationCollectionDoc ProviderInvokeOperationCollectionXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("ProviderInvokeOperationCollectionXml", "parse"); - - SmartPtrCProviderInvokeOperationCollectionDoc providerInvokeOperationCollectionDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const CXmlElement::SmartPtrCElementCollection invokeOperationChildrenXml = - thisXml->findRequiredChildren("invokeOperation"); - - std::deque invokeOperationVal; - if (! invokeOperationChildrenXml.IsNull() && ! invokeOperationChildrenXml->empty()) { - for (TConstIterator invokeOperationXmlIter(*invokeOperationChildrenXml); - invokeOperationXmlIter; invokeOperationXmlIter++) { - const SmartPtrCXmlElement invokeOperationXml = invokeOperationXmlIter->second; - const SmartPtrCProviderInvokeOperationDoc invokeOperationDoc = - ProviderInvokeOperationXml::parse(invokeOperationXml); - invokeOperationVal.push_back(invokeOperationDoc); - } - } - - providerInvokeOperationCollectionDoc.CreateInstance(); - providerInvokeOperationCollectionDoc->initialize( - invokeOperationVal); - } - CAF_CM_EXIT; - - return providerInvokeOperationCollectionDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderRequestXml/ProviderInvokeOperationXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderRequestXml/ProviderInvokeOperationXml.cpp deleted file mode 100644 index e41b0a346..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderRequestXml/ProviderInvokeOperationXml.cpp +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/CafCoreTypesXml/OperationXml.h" - -#include "Doc/CafCoreTypesDoc/COperationDoc.h" -#include "Doc/ProviderRequestDoc/CProviderInvokeOperationDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/ProviderRequestXml/ProviderInvokeOperationXml.h" - -using namespace Caf; - -void ProviderInvokeOperationXml::add( - const SmartPtrCProviderInvokeOperationDoc providerInvokeOperationDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("ProviderInvokeOperationXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(providerInvokeOperationDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string classNamespaceVal = providerInvokeOperationDoc->getClassNamespace(); - CAF_CM_VALIDATE_STRING(classNamespaceVal); - thisXml->addAttribute("classNamespace", classNamespaceVal); - - const std::string classNameVal = providerInvokeOperationDoc->getClassName(); - CAF_CM_VALIDATE_STRING(classNameVal); - thisXml->addAttribute("className", classNameVal); - - const std::string classVersionVal = providerInvokeOperationDoc->getClassVersion(); - CAF_CM_VALIDATE_STRING(classVersionVal); - thisXml->addAttribute("classVersion", classVersionVal); - - const std::string jobIdVal = - BasePlatform::UuidToString(providerInvokeOperationDoc->getJobId()); - CAF_CM_VALIDATE_STRING(jobIdVal); - thisXml->addAttribute("jobId", jobIdVal); - - const std::string outputDirVal = providerInvokeOperationDoc->getOutputDir(); - CAF_CM_VALIDATE_STRING(outputDirVal); - thisXml->addAttribute("outputDir", outputDirVal); - - const SmartPtrCOperationDoc operationVal = - providerInvokeOperationDoc->getOperation(); - CAF_CM_VALIDATE_SMARTPTR(operationVal); - - const SmartPtrCXmlElement operationXml = - thisXml->createAndAddElement("operation"); - OperationXml::add(operationVal, operationXml); - } - CAF_CM_EXIT; -} - -SmartPtrCProviderInvokeOperationDoc ProviderInvokeOperationXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("ProviderInvokeOperationXml", "parse"); - - SmartPtrCProviderInvokeOperationDoc providerInvokeOperationDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string classNamespaceStrVal = - thisXml->findRequiredAttribute("classNamespace"); - const std::string classNamespaceVal = classNamespaceStrVal; - - const std::string classNameStrVal = - thisXml->findRequiredAttribute("className"); - const std::string classNameVal = classNameStrVal; - - const std::string classVersionStrVal = - thisXml->findRequiredAttribute("classVersion"); - const std::string classVersionVal = classVersionStrVal; - - const std::string jobIdStrVal = - thisXml->findRequiredAttribute("jobId"); - UUID jobIdVal = CAFCOMMON_GUID_NULL; - if (! jobIdStrVal.empty()) { - BasePlatform::UuidFromString(jobIdStrVal.c_str(), jobIdVal); - } - - const std::string outputDirStrVal = - thisXml->findRequiredAttribute("outputDir"); - const std::string outputDirVal = outputDirStrVal; - - const SmartPtrCXmlElement operationXml = - thisXml->findRequiredChild("operation"); - - SmartPtrCOperationDoc operationVal; - if (! operationXml.IsNull()) { - operationVal = OperationXml::parse(operationXml); - } - - providerInvokeOperationDoc.CreateInstance(); - providerInvokeOperationDoc->initialize( - classNamespaceVal, - classNameVal, - classVersionVal, - jobIdVal, - outputDirVal, - operationVal); - } - CAF_CM_EXIT; - - return providerInvokeOperationDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderRequestXml/ProviderRequestConfigXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderRequestXml/ProviderRequestConfigXml.cpp deleted file mode 100644 index d83171e4d..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderRequestXml/ProviderRequestConfigXml.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/CafCoreTypesXml/LoggingLevelCollectionXml.h" - -#include "Doc/CafCoreTypesDoc/CLoggingLevelCollectionDoc.h" -#include "Doc/ProviderRequestDoc/CProviderRequestConfigDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/ProviderRequestXml/ProviderRequestConfigXml.h" - -using namespace Caf; - -void ProviderRequestConfigXml::add( - const SmartPtrCProviderRequestConfigDoc providerRequestConfigDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("ProviderRequestConfigXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(providerRequestConfigDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string responseFormatTypeVal = providerRequestConfigDoc->getResponseFormatType(); - CAF_CM_VALIDATE_STRING(responseFormatTypeVal); - thisXml->addAttribute("responseFormatType", responseFormatTypeVal); - - const SmartPtrCLoggingLevelCollectionDoc loggingLevelCollectionVal = - providerRequestConfigDoc->getLoggingLevelCollection(); - if (! loggingLevelCollectionVal.IsNull()) { - const SmartPtrCXmlElement loggingLevelCollectionXml = - thisXml->createAndAddElement("loggingLevelCollection"); - LoggingLevelCollectionXml::add(loggingLevelCollectionVal, loggingLevelCollectionXml); - } - } - CAF_CM_EXIT; -} - -SmartPtrCProviderRequestConfigDoc ProviderRequestConfigXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("ProviderRequestConfigXml", "parse"); - - SmartPtrCProviderRequestConfigDoc providerRequestConfigDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string responseFormatTypeStrVal = - thisXml->findRequiredAttribute("responseFormatType"); - const std::string responseFormatTypeVal = responseFormatTypeStrVal; - - const SmartPtrCXmlElement loggingLevelCollectionXml = - thisXml->findOptionalChild("loggingLevelCollection"); - - SmartPtrCLoggingLevelCollectionDoc loggingLevelCollectionVal; - if (! loggingLevelCollectionXml.IsNull()) { - loggingLevelCollectionVal = LoggingLevelCollectionXml::parse(loggingLevelCollectionXml); - } - - providerRequestConfigDoc.CreateInstance(); - providerRequestConfigDoc->initialize( - responseFormatTypeVal, - loggingLevelCollectionVal); - } - CAF_CM_EXIT; - - return providerRequestConfigDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderRequestXml/ProviderRequestHeaderXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderRequestXml/ProviderRequestHeaderXml.cpp deleted file mode 100644 index fa5567526..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderRequestXml/ProviderRequestHeaderXml.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/CafCoreTypesXml/PropertyCollectionXml.h" -#include "Doc/DocXml/ProviderRequestXml/ProviderRequestConfigXml.h" - -#include "Doc/CafCoreTypesDoc/CPropertyCollectionDoc.h" -#include "Doc/ProviderRequestDoc/CProviderRequestConfigDoc.h" -#include "Doc/ProviderRequestDoc/CProviderRequestHeaderDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/ProviderRequestXml/ProviderRequestHeaderXml.h" - -using namespace Caf; - -void ProviderRequestHeaderXml::add( - const SmartPtrCProviderRequestHeaderDoc providerRequestHeaderDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("ProviderRequestHeaderXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(providerRequestHeaderDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const SmartPtrCProviderRequestConfigDoc requestConfigVal = - providerRequestHeaderDoc->getRequestConfig(); - CAF_CM_VALIDATE_SMARTPTR(requestConfigVal); - - const SmartPtrCXmlElement requestConfigXml = - thisXml->createAndAddElement("requestConfig"); - ProviderRequestConfigXml::add(requestConfigVal, requestConfigXml); - - const SmartPtrCPropertyCollectionDoc echoPropertyBagVal = - providerRequestHeaderDoc->getEchoPropertyBag(); - if (! echoPropertyBagVal.IsNull()) { - const SmartPtrCXmlElement echoPropertyBagXml = - thisXml->createAndAddElement("echoPropertyBag"); - PropertyCollectionXml::add(echoPropertyBagVal, echoPropertyBagXml); - } - } - CAF_CM_EXIT; -} - -SmartPtrCProviderRequestHeaderDoc ProviderRequestHeaderXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("ProviderRequestHeaderXml", "parse"); - - SmartPtrCProviderRequestHeaderDoc providerRequestHeaderDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const SmartPtrCXmlElement requestConfigXml = - thisXml->findRequiredChild("requestConfig"); - - SmartPtrCProviderRequestConfigDoc requestConfigVal; - if (! requestConfigXml.IsNull()) { - requestConfigVal = ProviderRequestConfigXml::parse(requestConfigXml); - } - - const SmartPtrCXmlElement echoPropertyBagXml = - thisXml->findOptionalChild("echoPropertyBag"); - - SmartPtrCPropertyCollectionDoc echoPropertyBagVal; - if (! echoPropertyBagXml.IsNull()) { - echoPropertyBagVal = PropertyCollectionXml::parse(echoPropertyBagXml); - } - - providerRequestHeaderDoc.CreateInstance(); - providerRequestHeaderDoc->initialize( - requestConfigVal, - echoPropertyBagVal); - } - CAF_CM_EXIT; - - return providerRequestHeaderDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderRequestXml/ProviderRequestXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderRequestXml/ProviderRequestXml.cpp deleted file mode 100644 index 0e7516748..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderRequestXml/ProviderRequestXml.cpp +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/CafCoreTypesXml/AttachmentCollectionXml.h" -#include "Doc/DocXml/ProviderRequestXml/ProviderBatchXml.h" -#include "Doc/DocXml/ProviderRequestXml/ProviderRequestHeaderXml.h" - -#include "Doc/CafCoreTypesDoc/CAttachmentCollectionDoc.h" -#include "Doc/ProviderRequestDoc/CProviderBatchDoc.h" -#include "Doc/ProviderRequestDoc/CProviderRequestDoc.h" -#include "Doc/ProviderRequestDoc/CProviderRequestHeaderDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/ProviderRequestXml/ProviderRequestXml.h" - -using namespace Caf; - -void ProviderRequestXml::add( - const SmartPtrCProviderRequestDoc providerRequestDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("ProviderRequestXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(providerRequestDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string clientIdVal = - BasePlatform::UuidToString(providerRequestDoc->getClientId()); - CAF_CM_VALIDATE_STRING(clientIdVal); - thisXml->addAttribute("clientId", clientIdVal); - - const std::string requestIdVal = - BasePlatform::UuidToString(providerRequestDoc->getRequestId()); - CAF_CM_VALIDATE_STRING(requestIdVal); - thisXml->addAttribute("requestId", requestIdVal); - - const std::string pmeIdVal = providerRequestDoc->getPmeId(); - CAF_CM_VALIDATE_STRING(pmeIdVal); - thisXml->addAttribute("pmeId", pmeIdVal); - - const SmartPtrCProviderRequestHeaderDoc requestHeaderVal = - providerRequestDoc->getRequestHeader(); - CAF_CM_VALIDATE_SMARTPTR(requestHeaderVal); - - const SmartPtrCXmlElement requestHeaderXml = - thisXml->createAndAddElement("requestHeader"); - ProviderRequestHeaderXml::add(requestHeaderVal, requestHeaderXml); - - const SmartPtrCProviderBatchDoc batchVal = - providerRequestDoc->getBatch(); - CAF_CM_VALIDATE_SMARTPTR(batchVal); - - const SmartPtrCXmlElement batchXml = - thisXml->createAndAddElement("batch"); - ProviderBatchXml::add(batchVal, batchXml); - - const SmartPtrCAttachmentCollectionDoc attachmentCollectionVal = - providerRequestDoc->getAttachmentCollection(); - if (! attachmentCollectionVal.IsNull()) { - const SmartPtrCXmlElement attachmentCollectionXml = - thisXml->createAndAddElement("attachmentCollection"); - AttachmentCollectionXml::add(attachmentCollectionVal, attachmentCollectionXml); - } - } - CAF_CM_EXIT; -} - -SmartPtrCProviderRequestDoc ProviderRequestXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("ProviderRequestXml", "parse"); - - SmartPtrCProviderRequestDoc providerRequestDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string clientIdStrVal = - thisXml->findRequiredAttribute("clientId"); - UUID clientIdVal = CAFCOMMON_GUID_NULL; - if (! clientIdStrVal.empty()) { - BasePlatform::UuidFromString(clientIdStrVal.c_str(), clientIdVal); - } - - const std::string requestIdStrVal = - thisXml->findRequiredAttribute("requestId"); - UUID requestIdVal = CAFCOMMON_GUID_NULL; - if (! requestIdStrVal.empty()) { - BasePlatform::UuidFromString(requestIdStrVal.c_str(), requestIdVal); - } - - const std::string pmeIdVal = - thisXml->findRequiredAttribute("pmeId"); - - const SmartPtrCXmlElement requestHeaderXml = - thisXml->findRequiredChild("requestHeader"); - - SmartPtrCProviderRequestHeaderDoc requestHeaderVal; - if (! requestHeaderXml.IsNull()) { - requestHeaderVal = ProviderRequestHeaderXml::parse(requestHeaderXml); - } - - const SmartPtrCXmlElement batchXml = - thisXml->findRequiredChild("batch"); - - SmartPtrCProviderBatchDoc batchVal; - if (! batchXml.IsNull()) { - batchVal = ProviderBatchXml::parse(batchXml); - } - - const SmartPtrCXmlElement attachmentCollectionXml = - thisXml->findOptionalChild("attachmentCollection"); - - SmartPtrCAttachmentCollectionDoc attachmentCollectionVal; - if (! attachmentCollectionXml.IsNull()) { - attachmentCollectionVal = AttachmentCollectionXml::parse(attachmentCollectionXml); - } - - providerRequestDoc.CreateInstance(); - providerRequestDoc->initialize( - clientIdVal, - requestIdVal, - pmeIdVal, - requestHeaderVal, - batchVal, - attachmentCollectionVal); - } - CAF_CM_EXIT; - - return providerRequestDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderRequestXml/ProviderRequestXmlRoots.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderRequestXml/ProviderRequestXmlRoots.cpp deleted file mode 100644 index 880a3d995..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderRequestXml/ProviderRequestXmlRoots.cpp +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/ProviderRequestXml/ProviderCollectSchemaRequestXml.h" -#include "Doc/DocXml/ProviderRequestXml/ProviderRequestXml.h" - -#include "Doc/ProviderRequestDoc/CProviderCollectSchemaRequestDoc.h" -#include "Doc/ProviderRequestDoc/CProviderRequestDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/ProviderRequestXml/ProviderRequestXmlRoots.h" - -using namespace Caf; - -std::string XmlRoots::saveProviderCollectSchemaRequestToString( - const SmartPtrCProviderCollectSchemaRequestDoc providerCollectSchemaRequestDoc) { - CAF_CM_STATIC_FUNC_VALIDATE("XmlRoots", "saveProviderCollectSchemaRequestToString"); - - std::string rc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(providerCollectSchemaRequestDoc); - - const std::string schemaNamespace = DocXmlUtils::getSchemaNamespace("fx"); - const std::string schemaLocation = DocXmlUtils::getSchemaLocation("fx/ProviderRequest.xsd"); - - const SmartPtrCXmlElement rootXml = CXmlUtils::createRootElement( - "providerCollectSchemaRequest", schemaNamespace, schemaLocation); - ProviderCollectSchemaRequestXml::add(providerCollectSchemaRequestDoc, rootXml); - - rc = rootXml->saveToString(); - } - CAF_CM_EXIT; - - return rc; -} - -SmartPtrCProviderCollectSchemaRequestDoc XmlRoots::parseProviderCollectSchemaRequestFromString( - const std::string xml) { - CAF_CM_STATIC_FUNC_VALIDATE("XmlRoots", "parseProviderCollectSchemaRequestFromString"); - - SmartPtrCProviderCollectSchemaRequestDoc providerCollectSchemaRequestDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(xml); - - const SmartPtrCXmlElement rootXml = CXmlUtils::parseString(xml, "caf:providerCollectSchemaRequest"); - providerCollectSchemaRequestDoc = ProviderCollectSchemaRequestXml::parse(rootXml); - } - CAF_CM_EXIT; - - return providerCollectSchemaRequestDoc; -} - -void XmlRoots::saveProviderCollectSchemaRequestToFile( - const SmartPtrCProviderCollectSchemaRequestDoc providerCollectSchemaRequestDoc, - const std::string filePath) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("XmlRoots", "saveProviderCollectSchemaRequestToFile"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(providerCollectSchemaRequestDoc); - CAF_CM_VALIDATE_STRING(filePath); - - CAF_CM_LOG_DEBUG_VA1("Saving to file - %s", filePath.c_str()); - - const std::string providerCollectSchemaRequestStr = - saveProviderCollectSchemaRequestToString(providerCollectSchemaRequestDoc); - FileSystemUtils::saveTextFile(filePath, providerCollectSchemaRequestStr); - } - CAF_CM_EXIT; -} - -SmartPtrCProviderCollectSchemaRequestDoc XmlRoots::parseProviderCollectSchemaRequestFromFile( - const std::string filePath) { - CAF_CM_STATIC_FUNC_VALIDATE("XmlRoots", "parseProviderCollectSchemaRequestFromFile"); - - SmartPtrCProviderCollectSchemaRequestDoc providerCollectSchemaRequestDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(filePath); - - const SmartPtrCXmlElement rootXml = CXmlUtils::parseFile(filePath, "caf:providerCollectSchemaRequest"); - providerCollectSchemaRequestDoc = ProviderCollectSchemaRequestXml::parse(rootXml); - } - CAF_CM_EXIT; - - return providerCollectSchemaRequestDoc; -} - -std::string XmlRoots::saveProviderRequestToString( - const SmartPtrCProviderRequestDoc providerRequestDoc) { - CAF_CM_STATIC_FUNC_VALIDATE("XmlRoots", "saveProviderRequestToString"); - - std::string rc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(providerRequestDoc); - - const std::string schemaNamespace = DocXmlUtils::getSchemaNamespace("fx"); - const std::string schemaLocation = DocXmlUtils::getSchemaLocation("fx/ProviderRequest.xsd"); - - const SmartPtrCXmlElement rootXml = CXmlUtils::createRootElement( - "providerRequest", schemaNamespace, schemaLocation); - ProviderRequestXml::add(providerRequestDoc, rootXml); - - rc = rootXml->saveToString(); - } - CAF_CM_EXIT; - - return rc; -} - -SmartPtrCProviderRequestDoc XmlRoots::parseProviderRequestFromString( - const std::string xml) { - CAF_CM_STATIC_FUNC_VALIDATE("XmlRoots", "parseProviderRequestFromString"); - - SmartPtrCProviderRequestDoc providerRequestDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(xml); - - const SmartPtrCXmlElement rootXml = CXmlUtils::parseString(xml, "caf:providerRequest"); - providerRequestDoc = ProviderRequestXml::parse(rootXml); - } - CAF_CM_EXIT; - - return providerRequestDoc; -} - -void XmlRoots::saveProviderRequestToFile( - const SmartPtrCProviderRequestDoc providerRequestDoc, - const std::string filePath) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("XmlRoots", "saveProviderRequestToFile"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(providerRequestDoc); - CAF_CM_VALIDATE_STRING(filePath); - - CAF_CM_LOG_DEBUG_VA1("Saving to file - %s", filePath.c_str()); - - const std::string providerRequestStr = - saveProviderRequestToString(providerRequestDoc); - FileSystemUtils::saveTextFile(filePath, providerRequestStr); - } - CAF_CM_EXIT; -} - -SmartPtrCProviderRequestDoc XmlRoots::parseProviderRequestFromFile( - const std::string filePath) { - CAF_CM_STATIC_FUNC_VALIDATE("XmlRoots", "parseProviderRequestFromFile"); - - SmartPtrCProviderRequestDoc providerRequestDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(filePath); - - const SmartPtrCXmlElement rootXml = CXmlUtils::parseFile(filePath, "caf:providerRequest"); - providerRequestDoc = ProviderRequestXml::parse(rootXml); - } - CAF_CM_EXIT; - - return providerRequestDoc; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderRequestXml/stdafx.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderRequestXml/stdafx.h deleted file mode 100644 index 2a4ce7e88..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderRequestXml/stdafx.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef STDAFX_H_ -#define STDAFX_H_ - -#ifdef WIN32 - #define PROVIDERREQUESTXML_LINKAGE __declspec(dllexport) -#else - #define PROVIDERREQUESTXML_LINKAGE -#endif - -#include - -#include -#include - - -#endif /* STDAFX_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderResultsXml/CdifXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderResultsXml/CdifXml.cpp deleted file mode 100644 index 744695f12..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderResultsXml/CdifXml.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/ProviderResultsXml/DefinitionObjectCollectionXml.h" -#include "Doc/DocXml/ProviderResultsXml/RequestIdentifierXml.h" -#include "Doc/DocXml/ProviderResultsXml/SchemaXml.h" - -#include "Doc/ProviderResultsDoc/CCdifDoc.h" -#include "Doc/ProviderResultsDoc/CDefinitionObjectCollectionDoc.h" -#include "Doc/ProviderResultsDoc/CRequestIdentifierDoc.h" -#include "Doc/ProviderResultsDoc/CSchemaDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/ProviderResultsXml/CdifXml.h" - -using namespace Caf; - -void CdifXml::add( - const SmartPtrCCdifDoc cdifDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("CdifXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(cdifDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const SmartPtrCRequestIdentifierDoc requestIdentifierVal = - cdifDoc->getRequestIdentifier(); - CAF_CM_VALIDATE_SMARTPTR(requestIdentifierVal); - - const SmartPtrCXmlElement requestIdentifierXml = - thisXml->createAndAddElement("requestIdentifier"); - RequestIdentifierXml::add(requestIdentifierVal, requestIdentifierXml); - - const SmartPtrCDefinitionObjectCollectionDoc definitionObjectCollectionVal = - cdifDoc->getDefinitionObjectCollection(); - if (! definitionObjectCollectionVal.IsNull()) { - const SmartPtrCXmlElement definitionObjectCollectionXml = - thisXml->createAndAddElement("definitionObjectCollection"); - DefinitionObjectCollectionXml::add(definitionObjectCollectionVal, definitionObjectCollectionXml); - } - - const SmartPtrCSchemaDoc schemaVal = - cdifDoc->getSchema(); - CAF_CM_VALIDATE_SMARTPTR(schemaVal); - - const SmartPtrCXmlElement schemaXml = - thisXml->createAndAddElement("schema"); - SchemaXml::add(schemaVal, schemaXml); - } - CAF_CM_EXIT; -} - -SmartPtrCCdifDoc CdifXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("CdifXml", "parse"); - - SmartPtrCCdifDoc cdifDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const SmartPtrCXmlElement requestIdentifierXml = - thisXml->findRequiredChild("requestIdentifier"); - - SmartPtrCRequestIdentifierDoc requestIdentifierVal; - if (! requestIdentifierXml.IsNull()) { - requestIdentifierVal = RequestIdentifierXml::parse(requestIdentifierXml); - } - - const SmartPtrCXmlElement definitionObjectCollectionXml = - thisXml->findOptionalChild("definitionObjectCollection"); - - SmartPtrCDefinitionObjectCollectionDoc definitionObjectCollectionVal; - if (! definitionObjectCollectionXml.IsNull()) { - definitionObjectCollectionVal = DefinitionObjectCollectionXml::parse(definitionObjectCollectionXml); - } - - const SmartPtrCXmlElement schemaXml = - thisXml->findRequiredChild("schema"); - - SmartPtrCSchemaDoc schemaVal; - if (! schemaXml.IsNull()) { - schemaVal = SchemaXml::parse(schemaXml); - } - - cdifDoc.CreateInstance(); - cdifDoc->initialize( - requestIdentifierVal, - definitionObjectCollectionVal, - schemaVal); - } - CAF_CM_EXIT; - - return cdifDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderResultsXml/DefinitionObjectCollectionXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderResultsXml/DefinitionObjectCollectionXml.cpp deleted file mode 100644 index b55dffdd0..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderResultsXml/DefinitionObjectCollectionXml.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/ProviderResultsDoc/CDefinitionObjectCollectionDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/ProviderResultsXml/DefinitionObjectCollectionXml.h" - -using namespace Caf; - -void DefinitionObjectCollectionXml::add( - const SmartPtrCDefinitionObjectCollectionDoc definitionObjectCollectionDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("DefinitionObjectCollectionXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(definitionObjectCollectionDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::deque valueVal = - definitionObjectCollectionDoc->getValue(); - if (! valueVal.empty()) { - for (TConstIterator > valueIter(valueVal); - valueIter; valueIter++) { - thisXml->appendValue(*valueIter); - } - } - } - CAF_CM_EXIT; -} - -SmartPtrCDefinitionObjectCollectionDoc DefinitionObjectCollectionXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("DefinitionObjectCollectionXml", "parse"); - - SmartPtrCDefinitionObjectCollectionDoc definitionObjectCollectionDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const CXmlElement::SmartPtrCElementCollection valueChildrenXml = - thisXml->getAllChildren(); - - std::deque valueVal; - if (! valueChildrenXml.IsNull() && ! valueChildrenXml->empty()) { - for (TConstIterator valueXmlIter(*valueChildrenXml); - valueXmlIter; valueXmlIter++) { - const SmartPtrCXmlElement valueXml = valueXmlIter->second; - const std::string valueDoc = valueXml->saveToStringRaw(); - valueVal.push_back(valueDoc); - } - } - - definitionObjectCollectionDoc.CreateInstance(); - definitionObjectCollectionDoc->initialize( - valueVal); - } - CAF_CM_EXIT; - - return definitionObjectCollectionDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderResultsXml/ProviderResultsXmlRoots.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderResultsXml/ProviderResultsXmlRoots.cpp deleted file mode 100644 index 2881d0906..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderResultsXml/ProviderResultsXmlRoots.cpp +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/ProviderResultsXml/CdifXml.h" -#include "Doc/DocXml/ProviderResultsXml/SchemaXml.h" - -#include "Doc/ProviderResultsDoc/CCdifDoc.h" -#include "Doc/ProviderResultsDoc/CSchemaDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/ProviderResultsXml/ProviderResultsXmlRoots.h" - -using namespace Caf; - -std::string XmlRoots::saveSchemaToString( - const SmartPtrCSchemaDoc schemaDoc) { - CAF_CM_STATIC_FUNC_VALIDATE("XmlRoots", "saveSchemaToString"); - - std::string rc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(schemaDoc); - - const std::string schemaNamespace = DocXmlUtils::getSchemaNamespace("cmdl"); - const std::string schemaLocation = DocXmlUtils::getSchemaLocation("cmdl/ProviderResults.xsd"); - - const SmartPtrCXmlElement rootXml = CXmlUtils::createRootElement( - "schema", schemaNamespace, schemaLocation); - SchemaXml::add(schemaDoc, rootXml); - - rc = rootXml->saveToString(); - } - CAF_CM_EXIT; - - return rc; -} - -SmartPtrCSchemaDoc XmlRoots::parseSchemaFromString( - const std::string xml) { - CAF_CM_STATIC_FUNC_VALIDATE("XmlRoots", "parseSchemaFromString"); - - SmartPtrCSchemaDoc schemaDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(xml); - - const SmartPtrCXmlElement rootXml = CXmlUtils::parseString(xml, "caf:schema"); - schemaDoc = SchemaXml::parse(rootXml); - } - CAF_CM_EXIT; - - return schemaDoc; -} - -void XmlRoots::saveSchemaToFile( - const SmartPtrCSchemaDoc schemaDoc, - const std::string filePath) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("XmlRoots", "saveSchemaToFile"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(schemaDoc); - CAF_CM_VALIDATE_STRING(filePath); - - CAF_CM_LOG_DEBUG_VA1("Saving to file - %s", filePath.c_str()); - - const std::string schemaStr = - saveSchemaToString(schemaDoc); - FileSystemUtils::saveTextFile(filePath, schemaStr); - } - CAF_CM_EXIT; -} - -SmartPtrCSchemaDoc XmlRoots::parseSchemaFromFile( - const std::string filePath) { - CAF_CM_STATIC_FUNC_VALIDATE("XmlRoots", "parseSchemaFromFile"); - - SmartPtrCSchemaDoc schemaDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(filePath); - - const SmartPtrCXmlElement rootXml = CXmlUtils::parseFile(filePath, "caf:schema"); - schemaDoc = SchemaXml::parse(rootXml); - } - CAF_CM_EXIT; - - return schemaDoc; -} - -std::string XmlRoots::saveCdifToString( - const SmartPtrCCdifDoc cdifDoc) { - CAF_CM_STATIC_FUNC_VALIDATE("XmlRoots", "saveCdifToString"); - - std::string rc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(cdifDoc); - - const std::string schemaNamespace = DocXmlUtils::getSchemaNamespace("cmdl"); - const std::string schemaLocation = DocXmlUtils::getSchemaLocation("cmdl/ProviderResults.xsd"); - - const SmartPtrCXmlElement rootXml = CXmlUtils::createRootElement( - "cdif", schemaNamespace, schemaLocation); - CdifXml::add(cdifDoc, rootXml); - - rc = rootXml->saveToString(); - } - CAF_CM_EXIT; - - return rc; -} - -SmartPtrCCdifDoc XmlRoots::parseCdifFromString( - const std::string xml) { - CAF_CM_STATIC_FUNC_VALIDATE("XmlRoots", "parseCdifFromString"); - - SmartPtrCCdifDoc cdifDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(xml); - - const SmartPtrCXmlElement rootXml = CXmlUtils::parseString(xml, "caf:cdif"); - cdifDoc = CdifXml::parse(rootXml); - } - CAF_CM_EXIT; - - return cdifDoc; -} - -void XmlRoots::saveCdifToFile( - const SmartPtrCCdifDoc cdifDoc, - const std::string filePath) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("XmlRoots", "saveCdifToFile"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(cdifDoc); - CAF_CM_VALIDATE_STRING(filePath); - - CAF_CM_LOG_DEBUG_VA1("Saving to file - %s", filePath.c_str()); - - const std::string cdifStr = - saveCdifToString(cdifDoc); - FileSystemUtils::saveTextFile(filePath, cdifStr); - } - CAF_CM_EXIT; -} - -SmartPtrCCdifDoc XmlRoots::parseCdifFromFile( - const std::string filePath) { - CAF_CM_STATIC_FUNC_VALIDATE("XmlRoots", "parseCdifFromFile"); - - SmartPtrCCdifDoc cdifDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(filePath); - - const SmartPtrCXmlElement rootXml = CXmlUtils::parseFile(filePath, "caf:cdif"); - cdifDoc = CdifXml::parse(rootXml); - } - CAF_CM_EXIT; - - return cdifDoc; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderResultsXml/RequestIdentifierXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderResultsXml/RequestIdentifierXml.cpp deleted file mode 100644 index 863a4da88..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderResultsXml/RequestIdentifierXml.cpp +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/SchemaTypesXml/ActionClassXml.h" - -#include "Doc/ProviderResultsDoc/CRequestIdentifierDoc.h" -#include "Doc/SchemaTypesDoc/CActionClassDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/ProviderResultsXml/RequestIdentifierXml.h" - -using namespace Caf; - -void RequestIdentifierXml::add( - const SmartPtrCRequestIdentifierDoc requestIdentifierDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("RequestIdentifierXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(requestIdentifierDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string clientIdVal = - BasePlatform::UuidToString(requestIdentifierDoc->getClientId()); - CAF_CM_VALIDATE_STRING(clientIdVal); - thisXml->addAttribute("clientId", clientIdVal); - - const std::string requestIdVal = - BasePlatform::UuidToString(requestIdentifierDoc->getRequestId()); - CAF_CM_VALIDATE_STRING(requestIdVal); - thisXml->addAttribute("requestId", requestIdVal); - - const std::string pmeIdVal = requestIdentifierDoc->getPmeId(); - CAF_CM_VALIDATE_STRING(pmeIdVal); - thisXml->addAttribute("pmeId", pmeIdVal); - - const std::string jobIdVal = - BasePlatform::UuidToString(requestIdentifierDoc->getJobId()); - CAF_CM_VALIDATE_STRING(jobIdVal); - thisXml->addAttribute("jobId", jobIdVal); - - const SmartPtrCActionClassDoc actionClassVal = - requestIdentifierDoc->getActionClass(); - CAF_CM_VALIDATE_SMARTPTR(actionClassVal); - - const SmartPtrCXmlElement actionClassXml = - thisXml->createAndAddElement("actionClass"); - ActionClassXml::add(actionClassVal, actionClassXml); - - const std::string sessionIdVal = - BasePlatform::UuidToString(requestIdentifierDoc->getSessionId()); - if (! sessionIdVal.empty()) { - thisXml->addAttribute("sessionId", sessionIdVal); - } - - thisXml->addAttribute("version", "1.0"); - } - CAF_CM_EXIT; -} - -SmartPtrCRequestIdentifierDoc RequestIdentifierXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("RequestIdentifierXml", "parse"); - - SmartPtrCRequestIdentifierDoc requestIdentifierDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string clientIdStrVal = - thisXml->findRequiredAttribute("clientId"); - UUID clientIdVal = CAFCOMMON_GUID_NULL; - if (! clientIdStrVal.empty()) { - BasePlatform::UuidFromString(clientIdStrVal.c_str(), clientIdVal); - } - - const std::string requestIdStrVal = - thisXml->findRequiredAttribute("requestId"); - UUID requestIdVal = CAFCOMMON_GUID_NULL; - if (! requestIdStrVal.empty()) { - BasePlatform::UuidFromString(requestIdStrVal.c_str(), requestIdVal); - } - - const std::string pmeIdVal = - thisXml->findRequiredAttribute("pmeId"); - - const std::string jobIdStrVal = - thisXml->findRequiredAttribute("jobId"); - UUID jobIdVal = CAFCOMMON_GUID_NULL; - if (! jobIdStrVal.empty()) { - BasePlatform::UuidFromString(jobIdStrVal.c_str(), jobIdVal); - } - - const SmartPtrCXmlElement actionClassXml = - thisXml->findRequiredChild("actionClass"); - - SmartPtrCActionClassDoc actionClassVal; - if (! actionClassXml.IsNull()) { - actionClassVal = ActionClassXml::parse(actionClassXml); - } - - const std::string sessionIdStrVal = - thisXml->findOptionalAttribute("sessionId"); - UUID sessionIdVal = CAFCOMMON_GUID_NULL; - if (! sessionIdStrVal.empty()) { - BasePlatform::UuidFromString(sessionIdStrVal.c_str(), sessionIdVal); - } - - requestIdentifierDoc.CreateInstance(); - requestIdentifierDoc->initialize( - clientIdVal, - requestIdVal, - pmeIdVal, - jobIdVal, - actionClassVal, - sessionIdVal); - } - CAF_CM_EXIT; - - return requestIdentifierDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderResultsXml/SchemaXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderResultsXml/SchemaXml.cpp deleted file mode 100644 index 7fe686003..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderResultsXml/SchemaXml.cpp +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/SchemaTypesXml/ActionClassXml.h" -#include "Doc/DocXml/SchemaTypesXml/DataClassXml.h" - -#include "Doc/ProviderResultsDoc/CSchemaDoc.h" -#include "Doc/SchemaTypesDoc/CActionClassDoc.h" -#include "Doc/SchemaTypesDoc/CDataClassDoc.h" -#include "Doc/SchemaTypesDoc/CLogicalRelationshipDoc.h" -#include "Doc/SchemaTypesDoc/CPhysicalRelationshipDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/ProviderResultsXml/SchemaXml.h" -#include "Doc/DocXml/SchemaTypesXml/LogicalRelationshipXml.h" -#include "Doc/DocXml/SchemaTypesXml/PhysicalRelationshipXml.h" - -using namespace Caf; - -void SchemaXml::add( - const SmartPtrCSchemaDoc schemaDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("SchemaXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(schemaDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::deque dataClassVal = - schemaDoc->getDataClassCollection(); - if (! dataClassVal.empty()) { - for (TConstIterator > dataClassIter(dataClassVal); - dataClassIter; dataClassIter++) { - const SmartPtrCXmlElement dataClassXml = - thisXml->createAndAddElement("dataClass"); - DataClassXml::add(*dataClassIter, dataClassXml); - } - } - - const std::deque actionClassVal = - schemaDoc->getActionClassCollection(); - if (! actionClassVal.empty()) { - for (TConstIterator > actionClassIter(actionClassVal); - actionClassIter; actionClassIter++) { - const SmartPtrCXmlElement actionClassXml = - thisXml->createAndAddElement("actionClass"); - ActionClassXml::add(*actionClassIter, actionClassXml); - } - } - - const std::deque logicalRelationshipVal = - schemaDoc->getLogicalRelationshipCollection(); - if (! logicalRelationshipVal.empty()) { - for (TConstIterator > logicalRelationshipIter(logicalRelationshipVal); - logicalRelationshipIter; logicalRelationshipIter++) { - const SmartPtrCXmlElement logicalRelationshipXml = - thisXml->createAndAddElement("logicalRelationship"); - LogicalRelationshipXml::add(*logicalRelationshipIter, logicalRelationshipXml); - } - } - - const std::deque physicalRelationshipVal = - schemaDoc->getPhysicalRelationshipCollection(); - if (! physicalRelationshipVal.empty()) { - for (TConstIterator > physicalRelationshipIter(physicalRelationshipVal); - physicalRelationshipIter; physicalRelationshipIter++) { - const SmartPtrCXmlElement physicalRelationshipXml = - thisXml->createAndAddElement("physicalRelationship"); - PhysicalRelationshipXml::add(*physicalRelationshipIter, physicalRelationshipXml); - } - } - } - CAF_CM_EXIT; -} - -SmartPtrCSchemaDoc SchemaXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("SchemaXml", "parse"); - - SmartPtrCSchemaDoc schemaDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const CXmlElement::SmartPtrCElementCollection dataClassChildrenXml = - thisXml->findOptionalChildren("dataClass"); - - std::deque dataClassVal; - if (! dataClassChildrenXml.IsNull() && ! dataClassChildrenXml->empty()) { - for (TConstIterator dataClassXmlIter(*dataClassChildrenXml); - dataClassXmlIter; dataClassXmlIter++) { - const SmartPtrCXmlElement dataClassXml = dataClassXmlIter->second; - const SmartPtrCDataClassDoc dataClassDoc = - DataClassXml::parse(dataClassXml); - dataClassVal.push_back(dataClassDoc); - } - } - - const CXmlElement::SmartPtrCElementCollection actionClassChildrenXml = - thisXml->findOptionalChildren("actionClass"); - - std::deque actionClassVal; - if (! actionClassChildrenXml.IsNull() && ! actionClassChildrenXml->empty()) { - for (TConstIterator actionClassXmlIter(*actionClassChildrenXml); - actionClassXmlIter; actionClassXmlIter++) { - const SmartPtrCXmlElement actionClassXml = actionClassXmlIter->second; - const SmartPtrCActionClassDoc actionClassDoc = - ActionClassXml::parse(actionClassXml); - actionClassVal.push_back(actionClassDoc); - } - } - - const CXmlElement::SmartPtrCElementCollection logicalRelationshipChildrenXml = - thisXml->findOptionalChildren("logicalRelationship"); - - std::deque logicalRelationshipVal; - if (! logicalRelationshipChildrenXml.IsNull() && ! logicalRelationshipChildrenXml->empty()) { - for (TConstIterator logicalRelationshipXmlIter(*logicalRelationshipChildrenXml); - logicalRelationshipXmlIter; logicalRelationshipXmlIter++) { - const SmartPtrCXmlElement logicalRelationshipXml = logicalRelationshipXmlIter->second; - const SmartPtrCLogicalRelationshipDoc logicalRelationshipDoc = - LogicalRelationshipXml::parse(logicalRelationshipXml); - logicalRelationshipVal.push_back(logicalRelationshipDoc); - } - } - - const CXmlElement::SmartPtrCElementCollection physicalRelationshipChildrenXml = - thisXml->findOptionalChildren("physicalRelationship"); - - std::deque physicalRelationshipVal; - if (! physicalRelationshipChildrenXml.IsNull() && ! physicalRelationshipChildrenXml->empty()) { - for (TConstIterator physicalRelationshipXmlIter(*physicalRelationshipChildrenXml); - physicalRelationshipXmlIter; physicalRelationshipXmlIter++) { - const SmartPtrCXmlElement physicalRelationshipXml = physicalRelationshipXmlIter->second; - const SmartPtrCPhysicalRelationshipDoc physicalRelationshipDoc = - PhysicalRelationshipXml::parse(physicalRelationshipXml); - physicalRelationshipVal.push_back(physicalRelationshipDoc); - } - } - - schemaDoc.CreateInstance(); - schemaDoc->initialize( - dataClassVal, - actionClassVal, - logicalRelationshipVal, - physicalRelationshipVal); - } - CAF_CM_EXIT; - - return schemaDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderResultsXml/stdafx.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderResultsXml/stdafx.h deleted file mode 100644 index eacbcaebd..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ProviderResultsXml/stdafx.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef STDAFX_H_ -#define STDAFX_H_ - -#ifdef WIN32 - #define PROVIDERRESULTSXML_LINKAGE __declspec(dllexport) -#else - #define PROVIDERRESULTSXML_LINKAGE -#endif - -#include - -#include -#include - - -#endif /* STDAFX_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ResponseXml/ErrorResponseXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ResponseXml/ErrorResponseXml.cpp deleted file mode 100644 index 931b5e16e..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ResponseXml/ErrorResponseXml.cpp +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/ResponseXml/ResponseHeaderXml.h" - -#include "Doc/ResponseDoc/CErrorResponseDoc.h" -#include "Doc/ResponseDoc/CResponseHeaderDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/ResponseXml/ErrorResponseXml.h" - -using namespace Caf; - -void ErrorResponseXml::add( - const SmartPtrCErrorResponseDoc errorResponseDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("ErrorResponseXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(errorResponseDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string clientIdVal = - BasePlatform::UuidToString(errorResponseDoc->getClientId()); - if (! clientIdVal.empty()) { - thisXml->addAttribute("clientId", clientIdVal); - } - - const std::string requestIdVal = - BasePlatform::UuidToString(errorResponseDoc->getRequestId()); - if (! requestIdVal.empty()) { - thisXml->addAttribute("requestId", requestIdVal); - } - - const std::string pmeIdVal = errorResponseDoc->getPmeId(); - if (! pmeIdVal.empty()) { - thisXml->addAttribute("pmeId", pmeIdVal); - } - - const SmartPtrCResponseHeaderDoc responseHeaderVal = - errorResponseDoc->getResponseHeader(); - if (! responseHeaderVal.IsNull()) { - const SmartPtrCXmlElement responseHeaderXml = - thisXml->createAndAddElement("responseHeader"); - ResponseHeaderXml::add(responseHeaderVal, responseHeaderXml); - } - - const std::string errorMessageVal = errorResponseDoc->getErrorMessage(); - if (! errorMessageVal.empty()) { - const SmartPtrCXmlElement errorMessageXml = - thisXml->createAndAddElement("errorMessage"); - errorMessageXml->setValue(errorMessageVal); - } - } - CAF_CM_EXIT; -} - -SmartPtrCErrorResponseDoc ErrorResponseXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("ErrorResponseXml", "parse"); - - SmartPtrCErrorResponseDoc errorResponseDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string clientIdStrVal = - thisXml->findOptionalAttribute("clientId"); - UUID clientIdVal = CAFCOMMON_GUID_NULL; - if (! clientIdStrVal.empty()) { - BasePlatform::UuidFromString(clientIdStrVal.c_str(), clientIdVal); - } - - const std::string requestIdStrVal = - thisXml->findOptionalAttribute("requestId"); - UUID requestIdVal = CAFCOMMON_GUID_NULL; - if (! requestIdStrVal.empty()) { - BasePlatform::UuidFromString(requestIdStrVal.c_str(), requestIdVal); - } - - const std::string pmeIdVal = - thisXml->findOptionalAttribute("pmeId"); - - const SmartPtrCXmlElement responseHeaderXml = - thisXml->findOptionalChild("responseHeader"); - SmartPtrCResponseHeaderDoc responseHeaderVal; - if (! responseHeaderXml.IsNull()) { - responseHeaderVal = ResponseHeaderXml::parse(responseHeaderXml); - } - - const SmartPtrCXmlElement errorMessageXml = - thisXml->findOptionalChild("errorMessage"); - std::string errorMessageVal; - if (! errorMessageXml.IsNull()) { - errorMessageVal = errorMessageXml->getValue(); - } - - errorResponseDoc.CreateInstance(); - errorResponseDoc->initialize( - clientIdVal, - requestIdVal, - pmeIdVal, - responseHeaderVal, - errorMessageVal); - } - CAF_CM_EXIT; - - return errorResponseDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ResponseXml/EventKeyCollectionXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ResponseXml/EventKeyCollectionXml.cpp deleted file mode 100644 index 177bf1ad0..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ResponseXml/EventKeyCollectionXml.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/ResponseXml/EventKeyXml.h" - -#include "Doc/ResponseDoc/CEventKeyCollectionDoc.h" -#include "Doc/ResponseDoc/CEventKeyDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/ResponseXml/EventKeyCollectionXml.h" - -using namespace Caf; - -void EventKeyCollectionXml::add( - const SmartPtrCEventKeyCollectionDoc eventKeyCollectionDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("EventKeyCollectionXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(eventKeyCollectionDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::deque eventKeyVal = - eventKeyCollectionDoc->getEventKey(); - CAF_CM_VALIDATE_STL(eventKeyVal); - - if (! eventKeyVal.empty()) { - for (TConstIterator > eventKeyIter(eventKeyVal); - eventKeyIter; eventKeyIter++) { - const SmartPtrCXmlElement eventKeyXml = - thisXml->createAndAddElement("eventKey"); - EventKeyXml::add(*eventKeyIter, eventKeyXml); - } - } - } - CAF_CM_EXIT; -} - -SmartPtrCEventKeyCollectionDoc EventKeyCollectionXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("EventKeyCollectionXml", "parse"); - - SmartPtrCEventKeyCollectionDoc eventKeyCollectionDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const CXmlElement::SmartPtrCElementCollection eventKeyChildrenXml = - thisXml->findRequiredChildren("eventKey"); - - std::deque eventKeyVal; - if (! eventKeyChildrenXml.IsNull() && ! eventKeyChildrenXml->empty()) { - for (TConstIterator eventKeyXmlIter(*eventKeyChildrenXml); - eventKeyXmlIter; eventKeyXmlIter++) { - const SmartPtrCXmlElement eventKeyXml = eventKeyXmlIter->second; - const SmartPtrCEventKeyDoc eventKeyDoc = - EventKeyXml::parse(eventKeyXml); - eventKeyVal.push_back(eventKeyDoc); - } - } - - eventKeyCollectionDoc.CreateInstance(); - eventKeyCollectionDoc->initialize( - eventKeyVal); - } - CAF_CM_EXIT; - - return eventKeyCollectionDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ResponseXml/EventKeyXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ResponseXml/EventKeyXml.cpp deleted file mode 100644 index 67d9766d9..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ResponseXml/EventKeyXml.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/ResponseDoc/CEventKeyDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/ResponseXml/EventKeyXml.h" - -using namespace Caf; - -void EventKeyXml::add( - const SmartPtrCEventKeyDoc eventKeyDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("EventKeyXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(eventKeyDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string nameVal = eventKeyDoc->getName(); - CAF_CM_VALIDATE_STRING(nameVal); - thisXml->addAttribute("name", nameVal); - - const std::string valueVal = eventKeyDoc->getValue(); - CAF_CM_VALIDATE_STRING(valueVal); - thisXml->addAttribute("value", valueVal); - } - CAF_CM_EXIT; -} - -SmartPtrCEventKeyDoc EventKeyXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("EventKeyXml", "parse"); - - SmartPtrCEventKeyDoc eventKeyDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string nameStrVal = - thisXml->findRequiredAttribute("name"); - const std::string nameVal = nameStrVal; - - const std::string valueStrVal = - thisXml->findRequiredAttribute("value"); - const std::string valueVal = valueStrVal; - - eventKeyDoc.CreateInstance(); - eventKeyDoc->initialize( - nameVal, - valueVal); - } - CAF_CM_EXIT; - - return eventKeyDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ResponseXml/EventManifestXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ResponseXml/EventManifestXml.cpp deleted file mode 100644 index a2a1e1d37..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ResponseXml/EventManifestXml.cpp +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/CafCoreTypesXml/AttachmentCollectionXml.h" - -#include "Doc/CafCoreTypesDoc/CAttachmentCollectionDoc.h" -#include "Doc/ResponseDoc/CEventManifestDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/ResponseXml/EventManifestXml.h" - -using namespace Caf; - -void EventManifestXml::add( - const SmartPtrCEventManifestDoc eventManifestDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("EventManifestXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(eventManifestDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string classNamespaceVal = eventManifestDoc->getClassNamespace(); - CAF_CM_VALIDATE_STRING(classNamespaceVal); - thisXml->addAttribute("classNamespace", classNamespaceVal); - - const std::string classNameVal = eventManifestDoc->getClassName(); - CAF_CM_VALIDATE_STRING(classNameVal); - thisXml->addAttribute("className", classNameVal); - - const std::string classVersionVal = eventManifestDoc->getClassVersion(); - CAF_CM_VALIDATE_STRING(classVersionVal); - thisXml->addAttribute("classVersion", classVersionVal); - - const std::string operationNameVal = eventManifestDoc->getOperationName(); - CAF_CM_VALIDATE_STRING(operationNameVal); - thisXml->addAttribute("operationName", operationNameVal); - - const SmartPtrCAttachmentCollectionDoc attachmentCollectionVal = - eventManifestDoc->getAttachmentCollection(); - CAF_CM_VALIDATE_SMARTPTR(attachmentCollectionVal); - - const SmartPtrCXmlElement attachmentCollectionXml = - thisXml->createAndAddElement("attachmentCollection"); - AttachmentCollectionXml::add(attachmentCollectionVal, attachmentCollectionXml); - } - CAF_CM_EXIT; -} - -SmartPtrCEventManifestDoc EventManifestXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("EventManifestXml", "parse"); - - SmartPtrCEventManifestDoc eventManifestDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string classNamespaceStrVal = - thisXml->findRequiredAttribute("classNamespace"); - const std::string classNamespaceVal = classNamespaceStrVal; - - const std::string classNameStrVal = - thisXml->findRequiredAttribute("className"); - const std::string classNameVal = classNameStrVal; - - const std::string classVersionStrVal = - thisXml->findRequiredAttribute("classVersion"); - const std::string classVersionVal = classVersionStrVal; - - const std::string operationNameStrVal = - thisXml->findRequiredAttribute("operationName"); - const std::string operationNameVal = operationNameStrVal; - - const SmartPtrCXmlElement attachmentCollectionXml = - thisXml->findRequiredChild("attachmentCollection"); - - SmartPtrCAttachmentCollectionDoc attachmentCollectionVal; - if (! attachmentCollectionXml.IsNull()) { - attachmentCollectionVal = AttachmentCollectionXml::parse(attachmentCollectionXml); - } - - eventManifestDoc.CreateInstance(); - eventManifestDoc->initialize( - classNamespaceVal, - classNameVal, - classVersionVal, - operationNameVal, - attachmentCollectionVal); - } - CAF_CM_EXIT; - - return eventManifestDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ResponseXml/ManifestCollectionXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ResponseXml/ManifestCollectionXml.cpp deleted file mode 100644 index 53392448f..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ResponseXml/ManifestCollectionXml.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/ResponseXml/ManifestXml.h" - -#include "Doc/ResponseDoc/CManifestCollectionDoc.h" -#include "Doc/ResponseDoc/CManifestDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/ResponseXml/ManifestCollectionXml.h" - -using namespace Caf; - -void ManifestCollectionXml::add( - const SmartPtrCManifestCollectionDoc manifestCollectionDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("ManifestCollectionXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(manifestCollectionDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::deque manifestVal = - manifestCollectionDoc->getManifest(); - CAF_CM_VALIDATE_STL(manifestVal); - - if (! manifestVal.empty()) { - for (TConstIterator > manifestIter(manifestVal); - manifestIter; manifestIter++) { - const SmartPtrCXmlElement manifestXml = - thisXml->createAndAddElement("manifest"); - ManifestXml::add(*manifestIter, manifestXml); - } - } - } - CAF_CM_EXIT; -} - -SmartPtrCManifestCollectionDoc ManifestCollectionXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("ManifestCollectionXml", "parse"); - - SmartPtrCManifestCollectionDoc manifestCollectionDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const CXmlElement::SmartPtrCElementCollection manifestChildrenXml = - thisXml->findRequiredChildren("manifest"); - - std::deque manifestVal; - if (! manifestChildrenXml.IsNull() && ! manifestChildrenXml->empty()) { - for (TConstIterator manifestXmlIter(*manifestChildrenXml); - manifestXmlIter; manifestXmlIter++) { - const SmartPtrCXmlElement manifestXml = manifestXmlIter->second; - const SmartPtrCManifestDoc manifestDoc = - ManifestXml::parse(manifestXml); - manifestVal.push_back(manifestDoc); - } - } - - manifestCollectionDoc.CreateInstance(); - manifestCollectionDoc->initialize( - manifestVal); - } - CAF_CM_EXIT; - - return manifestCollectionDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ResponseXml/ManifestXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ResponseXml/ManifestXml.cpp deleted file mode 100644 index 3f5af0d24..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ResponseXml/ManifestXml.cpp +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/CafCoreTypesXml/AttachmentNameCollectionXml.h" - -#include "Doc/CafCoreTypesDoc/CAttachmentNameCollectionDoc.h" -#include "Doc/ResponseDoc/CManifestDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/ResponseXml/ManifestXml.h" - -using namespace Caf; - -void ManifestXml::add( - const SmartPtrCManifestDoc manifestDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("ManifestXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(manifestDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string classNamespaceVal = manifestDoc->getClassNamespace(); - CAF_CM_VALIDATE_STRING(classNamespaceVal); - thisXml->addAttribute("classNamespace", classNamespaceVal); - - const std::string classNameVal = manifestDoc->getClassName(); - CAF_CM_VALIDATE_STRING(classNameVal); - thisXml->addAttribute("className", classNameVal); - - const std::string classVersionVal = manifestDoc->getClassVersion(); - CAF_CM_VALIDATE_STRING(classVersionVal); - thisXml->addAttribute("classVersion", classVersionVal); - - const std::string jobIdVal = - BasePlatform::UuidToString(manifestDoc->getJobId()); - CAF_CM_VALIDATE_STRING(jobIdVal); - thisXml->addAttribute("jobId", jobIdVal); - - const std::string operationNameVal = manifestDoc->getOperationName(); - CAF_CM_VALIDATE_STRING(operationNameVal); - thisXml->addAttribute("operationName", operationNameVal); - - const SmartPtrCAttachmentNameCollectionDoc attachmentNameCollectionVal = - manifestDoc->getAttachmentNameCollection(); - CAF_CM_VALIDATE_SMARTPTR(attachmentNameCollectionVal); - - const SmartPtrCXmlElement attachmentNameCollectionXml = - thisXml->createAndAddElement("attachmentNameCollection"); - AttachmentNameCollectionXml::add(attachmentNameCollectionVal, attachmentNameCollectionXml); - } - CAF_CM_EXIT; -} - -SmartPtrCManifestDoc ManifestXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("ManifestXml", "parse"); - - SmartPtrCManifestDoc manifestDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string classNamespaceStrVal = - thisXml->findRequiredAttribute("classNamespace"); - const std::string classNamespaceVal = classNamespaceStrVal; - - const std::string classNameStrVal = - thisXml->findRequiredAttribute("className"); - const std::string classNameVal = classNameStrVal; - - const std::string classVersionStrVal = - thisXml->findRequiredAttribute("classVersion"); - const std::string classVersionVal = classVersionStrVal; - - const std::string jobIdStrVal = - thisXml->findRequiredAttribute("jobId"); - UUID jobIdVal = CAFCOMMON_GUID_NULL; - if (! jobIdStrVal.empty()) { - BasePlatform::UuidFromString(jobIdStrVal.c_str(), jobIdVal); - } - - const std::string operationNameStrVal = - thisXml->findRequiredAttribute("operationName"); - const std::string operationNameVal = operationNameStrVal; - - const SmartPtrCXmlElement attachmentNameCollectionXml = - thisXml->findRequiredChild("attachmentNameCollection"); - - SmartPtrCAttachmentNameCollectionDoc attachmentNameCollectionVal; - if (! attachmentNameCollectionXml.IsNull()) { - attachmentNameCollectionVal = AttachmentNameCollectionXml::parse(attachmentNameCollectionXml); - } - - manifestDoc.CreateInstance(); - manifestDoc->initialize( - classNamespaceVal, - classNameVal, - classVersionVal, - jobIdVal, - operationNameVal, - attachmentNameCollectionVal); - } - CAF_CM_EXIT; - - return manifestDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ResponseXml/ProviderEventResponseXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ResponseXml/ProviderEventResponseXml.cpp deleted file mode 100644 index fa0bf84c8..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ResponseXml/ProviderEventResponseXml.cpp +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/CafCoreTypesXml/StatisticsXml.h" -#include "Doc/DocXml/ResponseXml/EventKeyCollectionXml.h" -#include "Doc/DocXml/ResponseXml/ResponseHeaderXml.h" - -#include "Doc/CafCoreTypesDoc/CStatisticsDoc.h" -#include "Doc/ResponseDoc/CEventKeyCollectionDoc.h" -#include "Doc/ResponseDoc/CEventManifestDoc.h" -#include "Doc/ResponseDoc/CProviderEventResponseDoc.h" -#include "Doc/ResponseDoc/CResponseHeaderDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/ResponseXml/ProviderEventResponseXml.h" -#include "Doc/DocXml/ResponseXml/EventManifestXml.h" - -using namespace Caf; - -void ProviderEventResponseXml::add( - const SmartPtrCProviderEventResponseDoc providerEventResponseDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("ProviderEventResponseXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(providerEventResponseDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string pmeIdVal = providerEventResponseDoc->getPmeId(); - CAF_CM_VALIDATE_STRING(pmeIdVal); - thisXml->addAttribute("pmeId", pmeIdVal); - - const SmartPtrCResponseHeaderDoc responseHeaderVal = - providerEventResponseDoc->getResponseHeader(); - if (! responseHeaderVal.IsNull()) { - const SmartPtrCXmlElement responseHeaderXml = - thisXml->createAndAddElement("responseHeader"); - ResponseHeaderXml::add(responseHeaderVal, responseHeaderXml); - } - - const SmartPtrCEventManifestDoc manifestVal = - providerEventResponseDoc->getManifest(); - CAF_CM_VALIDATE_SMARTPTR(manifestVal); - - const SmartPtrCXmlElement manifestXml = - thisXml->createAndAddElement("manifest"); - EventManifestXml::add(manifestVal, manifestXml); - - const SmartPtrCEventKeyCollectionDoc eventKeyCollectionVal = - providerEventResponseDoc->getEventKeyCollection(); - if (! eventKeyCollectionVal.IsNull()) { - const SmartPtrCXmlElement eventKeyCollectionXml = - thisXml->createAndAddElement("eventKeyCollection"); - EventKeyCollectionXml::add(eventKeyCollectionVal, eventKeyCollectionXml); - } - - const SmartPtrCStatisticsDoc statisticsVal = - providerEventResponseDoc->getStatistics(); - if (! statisticsVal.IsNull()) { - const SmartPtrCXmlElement statisticsXml = - thisXml->createAndAddElement("statistics"); - StatisticsXml::add(statisticsVal, statisticsXml); - } - } - CAF_CM_EXIT; -} - -SmartPtrCProviderEventResponseDoc ProviderEventResponseXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("ProviderEventResponseXml", "parse"); - - SmartPtrCProviderEventResponseDoc providerEventResponseDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string pmeIdVal = - thisXml->findRequiredAttribute("pmeId"); - - const SmartPtrCXmlElement responseHeaderXml = - thisXml->findOptionalChild("responseHeader"); - SmartPtrCResponseHeaderDoc responseHeaderVal; - if (! responseHeaderXml.IsNull()) { - responseHeaderVal = ResponseHeaderXml::parse(responseHeaderXml); - } - - const SmartPtrCXmlElement manifestXml = - thisXml->findRequiredChild("manifest"); - SmartPtrCEventManifestDoc manifestVal; - if (! manifestXml.IsNull()) { - manifestVal = EventManifestXml::parse(manifestXml); - } - - const SmartPtrCXmlElement eventKeyCollectionXml = - thisXml->findOptionalChild("eventKeyCollection"); - SmartPtrCEventKeyCollectionDoc eventKeyCollectionVal; - if (! eventKeyCollectionXml.IsNull()) { - eventKeyCollectionVal = EventKeyCollectionXml::parse(eventKeyCollectionXml); - } - - const SmartPtrCXmlElement statisticsXml = - thisXml->findOptionalChild("statistics"); - SmartPtrCStatisticsDoc statisticsVal; - if (! statisticsXml.IsNull()) { - statisticsVal = StatisticsXml::parse(statisticsXml); - } - - providerEventResponseDoc.CreateInstance(); - providerEventResponseDoc->initialize( - pmeIdVal, - responseHeaderVal, - manifestVal, - eventKeyCollectionVal, - statisticsVal); - } - CAF_CM_EXIT; - - return providerEventResponseDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ResponseXml/ProviderResponseXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ResponseXml/ProviderResponseXml.cpp deleted file mode 100644 index 32bbf0348..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ResponseXml/ProviderResponseXml.cpp +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/CafCoreTypesXml/AttachmentCollectionXml.h" -#include "Doc/DocXml/CafCoreTypesXml/StatisticsXml.h" -#include "Doc/DocXml/ResponseXml/ManifestXml.h" -#include "Doc/DocXml/ResponseXml/ResponseHeaderXml.h" - -#include "Doc/CafCoreTypesDoc/CAttachmentCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CStatisticsDoc.h" -#include "Doc/ResponseDoc/CManifestDoc.h" -#include "Doc/ResponseDoc/CProviderResponseDoc.h" -#include "Doc/ResponseDoc/CResponseHeaderDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/ResponseXml/ProviderResponseXml.h" - -using namespace Caf; - -void ProviderResponseXml::add( - const SmartPtrCProviderResponseDoc providerResponseDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("ProviderResponseXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(providerResponseDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string clientIdVal = - BasePlatform::UuidToString(providerResponseDoc->getClientId()); - if (! clientIdVal.empty()) { - thisXml->addAttribute("clientId", clientIdVal); - } - - const std::string requestIdVal = - BasePlatform::UuidToString(providerResponseDoc->getRequestId()); - if (! requestIdVal.empty()) { - thisXml->addAttribute("requestId", requestIdVal); - } - - const std::string pmeIdVal = providerResponseDoc->getPmeId(); - if (! pmeIdVal.empty()) { - thisXml->addAttribute("pmeId", pmeIdVal); - } - - const SmartPtrCResponseHeaderDoc responseHeaderVal = - providerResponseDoc->getResponseHeader(); - if (! responseHeaderVal.IsNull()) { - const SmartPtrCXmlElement responseHeaderXml = - thisXml->createAndAddElement("responseHeader"); - ResponseHeaderXml::add(responseHeaderVal, responseHeaderXml); - } - - const SmartPtrCManifestDoc manifestVal = - providerResponseDoc->getManifest(); - if (! manifestVal.IsNull()) { - const SmartPtrCXmlElement manifestXml = - thisXml->createAndAddElement("manifest"); - ManifestXml::add(manifestVal, manifestXml); - } - - const SmartPtrCAttachmentCollectionDoc attachmentCollectionVal = - providerResponseDoc->getAttachmentCollection(); - if (! attachmentCollectionVal.IsNull()) { - const SmartPtrCXmlElement attachmentCollectionXml = - thisXml->createAndAddElement("attachmentCollection"); - AttachmentCollectionXml::add(attachmentCollectionVal, attachmentCollectionXml); - } - - const SmartPtrCStatisticsDoc statisticsVal = - providerResponseDoc->getStatistics(); - if (! statisticsVal.IsNull()) { - const SmartPtrCXmlElement statisticsXml = - thisXml->createAndAddElement("statistics"); - StatisticsXml::add(statisticsVal, statisticsXml); - } - } - CAF_CM_EXIT; -} - -SmartPtrCProviderResponseDoc ProviderResponseXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("ProviderResponseXml", "parse"); - - SmartPtrCProviderResponseDoc providerResponseDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string clientIdStrVal = - thisXml->findOptionalAttribute("clientId"); - UUID clientIdVal = CAFCOMMON_GUID_NULL; - if (! clientIdStrVal.empty()) { - BasePlatform::UuidFromString(clientIdStrVal.c_str(), clientIdVal); - } - - const std::string requestIdStrVal = - thisXml->findOptionalAttribute("requestId"); - UUID requestIdVal = CAFCOMMON_GUID_NULL; - if (! requestIdStrVal.empty()) { - BasePlatform::UuidFromString(requestIdStrVal.c_str(), requestIdVal); - } - - const std::string pmeIdVal = - thisXml->findOptionalAttribute("pmeId"); - - const SmartPtrCXmlElement responseHeaderXml = - thisXml->findOptionalChild("responseHeader"); - SmartPtrCResponseHeaderDoc responseHeaderVal; - if (! responseHeaderXml.IsNull()) { - responseHeaderVal = ResponseHeaderXml::parse(responseHeaderXml); - } - - const SmartPtrCXmlElement manifestXml = - thisXml->findOptionalChild("manifest"); - SmartPtrCManifestDoc manifestVal; - if (! manifestXml.IsNull()) { - manifestVal = ManifestXml::parse(manifestXml); - } - - const SmartPtrCXmlElement attachmentCollectionXml = - thisXml->findOptionalChild("attachmentCollection"); - SmartPtrCAttachmentCollectionDoc attachmentCollectionVal; - if (! attachmentCollectionXml.IsNull()) { - attachmentCollectionVal = AttachmentCollectionXml::parse(attachmentCollectionXml); - } - - const SmartPtrCXmlElement statisticsXml = - thisXml->findOptionalChild("statistics"); - SmartPtrCStatisticsDoc statisticsVal; - if (! statisticsXml.IsNull()) { - statisticsVal = StatisticsXml::parse(statisticsXml); - } - - providerResponseDoc.CreateInstance(); - providerResponseDoc->initialize( - clientIdVal, - requestIdVal, - pmeIdVal, - responseHeaderVal, - manifestVal, - attachmentCollectionVal, - statisticsVal); - } - CAF_CM_EXIT; - - return providerResponseDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ResponseXml/ResponseHeaderXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ResponseXml/ResponseHeaderXml.cpp deleted file mode 100644 index 31a17d3f8..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ResponseXml/ResponseHeaderXml.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/ResponseDoc/CResponseHeaderDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/ResponseXml/ResponseHeaderXml.h" - -using namespace Caf; - -void ResponseHeaderXml::add( - const SmartPtrCResponseHeaderDoc responseHeaderDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("ResponseHeaderXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(responseHeaderDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string versionVal = responseHeaderDoc->getVersion(); - CAF_CM_VALIDATE_STRING(versionVal); - thisXml->addAttribute("version", versionVal); - - const std::string createdDateTimeVal = responseHeaderDoc->getCreatedDateTime(); - CAF_CM_VALIDATE_STRING(createdDateTimeVal); - thisXml->addAttribute("createdDateTime", createdDateTimeVal); - - const std::string sequenceNumberVal = - CStringConv::toString(responseHeaderDoc->getSequenceNumber()); - CAF_CM_VALIDATE_STRING(sequenceNumberVal); - thisXml->addAttribute("sequenceNumber", sequenceNumberVal); - - const std::string isFinalResponseVal = responseHeaderDoc->getIsFinalResponse() ? "true" : "false"; - CAF_CM_VALIDATE_STRING(isFinalResponseVal); - thisXml->addAttribute("isFinalResponse", isFinalResponseVal); - - const std::string sessionIdVal = - BasePlatform::UuidToString(responseHeaderDoc->getSessionId()); - if (! sessionIdVal.empty()) { - thisXml->addAttribute("sessionId", sessionIdVal); - } - } - CAF_CM_EXIT; -} - -SmartPtrCResponseHeaderDoc ResponseHeaderXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("ResponseHeaderXml", "parse"); - - SmartPtrCResponseHeaderDoc responseHeaderDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string versionVal = - thisXml->findRequiredAttribute("version"); - - const std::string createdDateTimeVal = - thisXml->findRequiredAttribute("createdDateTime"); - - const std::string sequenceNumberStrVal = - thisXml->findRequiredAttribute("sequenceNumber"); - uint32 sequenceNumberVal = 0; - if (! sequenceNumberStrVal.empty()) { - sequenceNumberVal = CStringConv::fromString(sequenceNumberStrVal); - } - - const std::string isFinalResponseStrVal = - thisXml->findRequiredAttribute("isFinalResponse"); - bool isFinalResponseVal = false; - if (! isFinalResponseStrVal.empty()) { - isFinalResponseVal = (isFinalResponseStrVal.compare("true") == 0) ? true : false; - } - - const std::string sessionIdStrVal = - thisXml->findOptionalAttribute("sessionId"); - UUID sessionIdVal = CAFCOMMON_GUID_NULL; - if (! sessionIdStrVal.empty()) { - BasePlatform::UuidFromString(sessionIdStrVal.c_str(), sessionIdVal); - } - - responseHeaderDoc.CreateInstance(); - responseHeaderDoc->initialize( - versionVal, - createdDateTimeVal, - sequenceNumberVal, - isFinalResponseVal, - sessionIdVal); - } - CAF_CM_EXIT; - - return responseHeaderDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ResponseXml/ResponseXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ResponseXml/ResponseXml.cpp deleted file mode 100644 index eac1b07c4..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ResponseXml/ResponseXml.cpp +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/CafCoreTypesXml/AttachmentCollectionXml.h" -#include "Doc/DocXml/CafCoreTypesXml/StatisticsXml.h" -#include "Doc/DocXml/ResponseXml/ManifestCollectionXml.h" -#include "Doc/DocXml/ResponseXml/ResponseHeaderXml.h" - -#include "Doc/CafCoreTypesDoc/CAttachmentCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CStatisticsDoc.h" -#include "Doc/ResponseDoc/CManifestCollectionDoc.h" -#include "Doc/ResponseDoc/CResponseDoc.h" -#include "Doc/ResponseDoc/CResponseHeaderDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/ResponseXml/ResponseXml.h" - -using namespace Caf; - -void ResponseXml::add( - const SmartPtrCResponseDoc responseDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("ResponseXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(responseDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string clientIdVal = - BasePlatform::UuidToString(responseDoc->getClientId()); - if (! clientIdVal.empty()) { - thisXml->addAttribute("clientId", clientIdVal); - } - - const std::string requestIdVal = - BasePlatform::UuidToString(responseDoc->getRequestId()); - if (! requestIdVal.empty()) { - thisXml->addAttribute("requestId", requestIdVal); - } - - const std::string pmeIdVal = responseDoc->getPmeId(); - if (! pmeIdVal.empty()) { - thisXml->addAttribute("pmeId", pmeIdVal); - } - - const SmartPtrCResponseHeaderDoc responseHeaderVal = - responseDoc->getResponseHeader(); - if (! responseHeaderVal.IsNull()) { - const SmartPtrCXmlElement responseHeaderXml = - thisXml->createAndAddElement("responseHeader"); - ResponseHeaderXml::add(responseHeaderVal, responseHeaderXml); - } - - const SmartPtrCManifestCollectionDoc manifestCollectionVal = - responseDoc->getManifestCollection(); - if (! manifestCollectionVal.IsNull()) { - const SmartPtrCXmlElement manifestCollectionXml = - thisXml->createAndAddElement("manifestCollection"); - ManifestCollectionXml::add(manifestCollectionVal, manifestCollectionXml); - } - - const SmartPtrCAttachmentCollectionDoc attachmentCollectionVal = - responseDoc->getAttachmentCollection(); - if (! attachmentCollectionVal.IsNull()) { - const SmartPtrCXmlElement attachmentCollectionXml = - thisXml->createAndAddElement("attachmentCollection"); - AttachmentCollectionXml::add(attachmentCollectionVal, attachmentCollectionXml); - } - - const SmartPtrCStatisticsDoc statisticsVal = - responseDoc->getStatistics(); - if (! statisticsVal.IsNull()) { - const SmartPtrCXmlElement statisticsXml = - thisXml->createAndAddElement("statistics"); - StatisticsXml::add(statisticsVal, statisticsXml); - } - } - CAF_CM_EXIT; -} - -SmartPtrCResponseDoc ResponseXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("ResponseXml", "parse"); - - SmartPtrCResponseDoc responseDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string clientIdStrVal = - thisXml->findOptionalAttribute("clientId"); - UUID clientIdVal = CAFCOMMON_GUID_NULL; - if (! clientIdStrVal.empty()) { - BasePlatform::UuidFromString(clientIdStrVal.c_str(), clientIdVal); - } - - const std::string requestIdStrVal = - thisXml->findOptionalAttribute("requestId"); - UUID requestIdVal = CAFCOMMON_GUID_NULL; - if (! requestIdStrVal.empty()) { - BasePlatform::UuidFromString(requestIdStrVal.c_str(), requestIdVal); - } - - const std::string pmeIdVal = - thisXml->findOptionalAttribute("pmeId"); - - const SmartPtrCXmlElement responseHeaderXml = - thisXml->findOptionalChild("responseHeader"); - SmartPtrCResponseHeaderDoc responseHeaderVal; - if (! responseHeaderXml.IsNull()) { - responseHeaderVal = ResponseHeaderXml::parse(responseHeaderXml); - } - - const SmartPtrCXmlElement manifestCollectionXml = - thisXml->findOptionalChild("manifestCollection"); - - SmartPtrCManifestCollectionDoc manifestCollectionVal; - if (! manifestCollectionXml.IsNull()) { - manifestCollectionVal = ManifestCollectionXml::parse(manifestCollectionXml); - } - - const SmartPtrCXmlElement attachmentCollectionXml = - thisXml->findOptionalChild("attachmentCollection"); - SmartPtrCAttachmentCollectionDoc attachmentCollectionVal; - if (! attachmentCollectionXml.IsNull()) { - attachmentCollectionVal = AttachmentCollectionXml::parse(attachmentCollectionXml); - } - - const SmartPtrCXmlElement statisticsXml = - thisXml->findOptionalChild("statistics"); - SmartPtrCStatisticsDoc statisticsVal; - if (! statisticsXml.IsNull()) { - statisticsVal = StatisticsXml::parse(statisticsXml); - } - - responseDoc.CreateInstance(); - responseDoc->initialize( - clientIdVal, - requestIdVal, - pmeIdVal, - responseHeaderVal, - manifestCollectionVal, - attachmentCollectionVal, - statisticsVal); - } - CAF_CM_EXIT; - - return responseDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ResponseXml/ResponseXmlRoots.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ResponseXml/ResponseXmlRoots.cpp deleted file mode 100644 index b8c448166..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ResponseXml/ResponseXmlRoots.cpp +++ /dev/null @@ -1,326 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/ResponseXml/ResponseXml.h" - -#include "Doc/ResponseDoc/CErrorResponseDoc.h" -#include "Doc/ResponseDoc/CProviderEventResponseDoc.h" -#include "Doc/ResponseDoc/CProviderResponseDoc.h" -#include "Doc/ResponseDoc/CResponseDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/ResponseXml/ResponseXmlRoots.h" -#include "Doc/DocXml/ResponseXml/ErrorResponseXml.h" -#include "Doc/DocXml/ResponseXml/ProviderResponseXml.h" -#include "Doc/DocXml/ResponseXml/ProviderEventResponseXml.h" - -using namespace Caf; - -std::string XmlRoots::saveErrorResponseToString( - const SmartPtrCErrorResponseDoc errorResponseDoc) { - CAF_CM_STATIC_FUNC_VALIDATE("XmlRoots", "saveErrorResponseToString"); - - std::string rc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(errorResponseDoc); - - const std::string schemaNamespace = DocXmlUtils::getSchemaNamespace("fx"); - const std::string schemaLocation = DocXmlUtils::getSchemaLocation("fx/Response.xsd"); - - const SmartPtrCXmlElement rootXml = CXmlUtils::createRootElement( - "errorResponse", schemaNamespace, schemaLocation); - ErrorResponseXml::add(errorResponseDoc, rootXml); - - rc = rootXml->saveToString(); - } - CAF_CM_EXIT; - - return rc; -} - -SmartPtrCErrorResponseDoc XmlRoots::parseErrorResponseFromString( - const std::string xml) { - CAF_CM_STATIC_FUNC_VALIDATE("XmlRoots", "parseErrorResponseFromString"); - - SmartPtrCErrorResponseDoc errorResponseDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(xml); - - const SmartPtrCXmlElement rootXml = CXmlUtils::parseString(xml, "caf:errorResponse"); - errorResponseDoc = ErrorResponseXml::parse(rootXml); - } - CAF_CM_EXIT; - - return errorResponseDoc; -} - -void XmlRoots::saveErrorResponseToFile( - const SmartPtrCErrorResponseDoc errorResponseDoc, - const std::string filePath) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("XmlRoots", "saveErrorResponseToFile"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(errorResponseDoc); - CAF_CM_VALIDATE_STRING(filePath); - - CAF_CM_LOG_DEBUG_VA1("Saving to file - %s", filePath.c_str()); - - const std::string errorResponseStr = - saveErrorResponseToString(errorResponseDoc); - FileSystemUtils::saveTextFile(filePath, errorResponseStr); - } - CAF_CM_EXIT; -} - -SmartPtrCErrorResponseDoc XmlRoots::parseErrorResponseFromFile( - const std::string filePath) { - CAF_CM_STATIC_FUNC_VALIDATE("XmlRoots", "parseErrorResponseFromFile"); - - SmartPtrCErrorResponseDoc errorResponseDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(filePath); - - const SmartPtrCXmlElement rootXml = CXmlUtils::parseFile(filePath, "caf:errorResponse"); - errorResponseDoc = ErrorResponseXml::parse(rootXml); - } - CAF_CM_EXIT; - - return errorResponseDoc; -} - -std::string XmlRoots::saveProviderResponseToString( - const SmartPtrCProviderResponseDoc providerResponseDoc) { - CAF_CM_STATIC_FUNC_VALIDATE("XmlRoots", "saveProviderResponseToString"); - - std::string rc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(providerResponseDoc); - - const std::string schemaNamespace = DocXmlUtils::getSchemaNamespace("fx"); - const std::string schemaLocation = DocXmlUtils::getSchemaLocation("fx/Response.xsd"); - - const SmartPtrCXmlElement rootXml = CXmlUtils::createRootElement( - "providerResponse", schemaNamespace, schemaLocation); - ProviderResponseXml::add(providerResponseDoc, rootXml); - - rc = rootXml->saveToString(); - } - CAF_CM_EXIT; - - return rc; -} - -SmartPtrCProviderResponseDoc XmlRoots::parseProviderResponseFromString( - const std::string xml) { - CAF_CM_STATIC_FUNC_VALIDATE("XmlRoots", "parseProviderResponseFromString"); - - SmartPtrCProviderResponseDoc providerResponseDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(xml); - - const SmartPtrCXmlElement rootXml = CXmlUtils::parseString(xml, "caf:providerResponse"); - providerResponseDoc = ProviderResponseXml::parse(rootXml); - } - CAF_CM_EXIT; - - return providerResponseDoc; -} - -void XmlRoots::saveProviderResponseToFile( - const SmartPtrCProviderResponseDoc providerResponseDoc, - const std::string filePath) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("XmlRoots", "saveProviderResponseToFile"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(providerResponseDoc); - CAF_CM_VALIDATE_STRING(filePath); - - CAF_CM_LOG_DEBUG_VA1("Saving to file - %s", filePath.c_str()); - - const std::string providerResponseStr = - saveProviderResponseToString(providerResponseDoc); - FileSystemUtils::saveTextFile(filePath, providerResponseStr); - } - CAF_CM_EXIT; -} - -SmartPtrCProviderResponseDoc XmlRoots::parseProviderResponseFromFile( - const std::string filePath) { - CAF_CM_STATIC_FUNC_VALIDATE("XmlRoots", "parseProviderResponseFromFile"); - - SmartPtrCProviderResponseDoc providerResponseDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(filePath); - - const SmartPtrCXmlElement rootXml = CXmlUtils::parseFile(filePath, "caf:providerResponse"); - providerResponseDoc = ProviderResponseXml::parse(rootXml); - } - CAF_CM_EXIT; - - return providerResponseDoc; -} - -std::string XmlRoots::saveResponseToString( - const SmartPtrCResponseDoc responseDoc) { - CAF_CM_STATIC_FUNC_VALIDATE("XmlRoots", "saveResponseToString"); - - std::string rc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(responseDoc); - - const std::string schemaNamespace = DocXmlUtils::getSchemaNamespace("fx"); - const std::string schemaLocation = DocXmlUtils::getSchemaLocation("fx/Response.xsd"); - - const SmartPtrCXmlElement rootXml = CXmlUtils::createRootElement( - "response", schemaNamespace, schemaLocation); - ResponseXml::add(responseDoc, rootXml); - - rc = rootXml->saveToString(); - } - CAF_CM_EXIT; - - return rc; -} - -SmartPtrCResponseDoc XmlRoots::parseResponseFromString( - const std::string xml) { - CAF_CM_STATIC_FUNC_VALIDATE("XmlRoots", "parseResponseFromString"); - - SmartPtrCResponseDoc responseDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(xml); - - const SmartPtrCXmlElement rootXml = CXmlUtils::parseString(xml, "caf:response"); - responseDoc = ResponseXml::parse(rootXml); - } - CAF_CM_EXIT; - - return responseDoc; -} - -void XmlRoots::saveResponseToFile( - const SmartPtrCResponseDoc responseDoc, - const std::string filePath) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("XmlRoots", "saveResponseToFile"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(responseDoc); - CAF_CM_VALIDATE_STRING(filePath); - - CAF_CM_LOG_DEBUG_VA1("Saving to file - %s", filePath.c_str()); - - const std::string responseStr = - saveResponseToString(responseDoc); - FileSystemUtils::saveTextFile(filePath, responseStr); - } - CAF_CM_EXIT; -} - -SmartPtrCResponseDoc XmlRoots::parseResponseFromFile( - const std::string filePath) { - CAF_CM_STATIC_FUNC_VALIDATE("XmlRoots", "parseResponseFromFile"); - - SmartPtrCResponseDoc responseDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(filePath); - - const SmartPtrCXmlElement rootXml = CXmlUtils::parseFile(filePath, "caf:response"); - responseDoc = ResponseXml::parse(rootXml); - } - CAF_CM_EXIT; - - return responseDoc; -} - -std::string XmlRoots::saveProviderEventResponseToString( - const SmartPtrCProviderEventResponseDoc providerEventResponseDoc) { - CAF_CM_STATIC_FUNC_VALIDATE("XmlRoots", "saveProviderEventResponseToString"); - - std::string rc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(providerEventResponseDoc); - - const std::string schemaNamespace = DocXmlUtils::getSchemaNamespace("fx"); - const std::string schemaLocation = DocXmlUtils::getSchemaLocation("fx/Response.xsd"); - - const SmartPtrCXmlElement rootXml = CXmlUtils::createRootElement( - "providerEventResponse", schemaNamespace, schemaLocation); - ProviderEventResponseXml::add(providerEventResponseDoc, rootXml); - - rc = rootXml->saveToString(); - } - CAF_CM_EXIT; - - return rc; -} - -SmartPtrCProviderEventResponseDoc XmlRoots::parseProviderEventResponseFromString( - const std::string xml) { - CAF_CM_STATIC_FUNC_VALIDATE("XmlRoots", "parseProviderEventResponseFromString"); - - SmartPtrCProviderEventResponseDoc providerEventResponseDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(xml); - - const SmartPtrCXmlElement rootXml = CXmlUtils::parseString(xml, "caf:providerEventResponse"); - providerEventResponseDoc = ProviderEventResponseXml::parse(rootXml); - } - CAF_CM_EXIT; - - return providerEventResponseDoc; -} - -void XmlRoots::saveProviderEventResponseToFile( - const SmartPtrCProviderEventResponseDoc providerEventResponseDoc, - const std::string filePath) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("XmlRoots", "saveProviderEventResponseToFile"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(providerEventResponseDoc); - CAF_CM_VALIDATE_STRING(filePath); - - CAF_CM_LOG_DEBUG_VA1("Saving to file - %s", filePath.c_str()); - - const std::string providerEventResponseStr = - saveProviderEventResponseToString(providerEventResponseDoc); - FileSystemUtils::saveTextFile(filePath, providerEventResponseStr); - } - CAF_CM_EXIT; -} - -SmartPtrCProviderEventResponseDoc XmlRoots::parseProviderEventResponseFromFile( - const std::string filePath) { - CAF_CM_STATIC_FUNC_VALIDATE("XmlRoots", "parseProviderEventResponseFromFile"); - - SmartPtrCProviderEventResponseDoc providerEventResponseDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(filePath); - - const SmartPtrCXmlElement rootXml = CXmlUtils::parseFile(filePath, "caf:providerEventResponse"); - providerEventResponseDoc = ProviderEventResponseXml::parse(rootXml); - } - CAF_CM_EXIT; - - return providerEventResponseDoc; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ResponseXml/stdafx.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ResponseXml/stdafx.h deleted file mode 100644 index 091ff5905..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/ResponseXml/stdafx.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef STDAFX_H_ -#define STDAFX_H_ - -#ifdef WIN32 - #define RESPONSEXML_LINKAGE __declspec(dllexport) -#else - #define RESPONSEXML_LINKAGE -#endif - -#include - -#include -#include - - -#endif /* STDAFX_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/ActionClassInstanceCollectionXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/ActionClassInstanceCollectionXml.cpp deleted file mode 100644 index 5d5e21c34..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/ActionClassInstanceCollectionXml.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/SchemaTypesXml/ActionClassInstanceXml.h" - -#include "Doc/SchemaTypesDoc/CActionClassInstanceCollectionDoc.h" -#include "Doc/SchemaTypesDoc/CActionClassInstanceDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/SchemaTypesXml/ActionClassInstanceCollectionXml.h" - -using namespace Caf; - -void ActionClassInstanceCollectionXml::add( - const SmartPtrCActionClassInstanceCollectionDoc actionClassInstanceCollectionDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("ActionClassInstanceCollectionXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(actionClassInstanceCollectionDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::deque actionClassInstanceVal = - actionClassInstanceCollectionDoc->getActionClassInstanceCollection(); - CAF_CM_VALIDATE_STL(actionClassInstanceVal); - - if (! actionClassInstanceVal.empty()) { - for (TConstIterator > actionClassInstanceIter(actionClassInstanceVal); - actionClassInstanceIter; actionClassInstanceIter++) { - const SmartPtrCXmlElement actionClassInstanceXml = - thisXml->createAndAddElement("actionClassInstance"); - ActionClassInstanceXml::add(*actionClassInstanceIter, actionClassInstanceXml); - } - } - } - CAF_CM_EXIT; -} - -SmartPtrCActionClassInstanceCollectionDoc ActionClassInstanceCollectionXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("ActionClassInstanceCollectionXml", "parse"); - - SmartPtrCActionClassInstanceCollectionDoc actionClassInstanceCollectionDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const CXmlElement::SmartPtrCElementCollection actionClassInstanceChildrenXml = - thisXml->findRequiredChildren("actionClassInstance"); - - std::deque actionClassInstanceVal; - if (! actionClassInstanceChildrenXml.IsNull() && ! actionClassInstanceChildrenXml->empty()) { - for (TConstIterator actionClassInstanceXmlIter(*actionClassInstanceChildrenXml); - actionClassInstanceXmlIter; actionClassInstanceXmlIter++) { - const SmartPtrCXmlElement actionClassInstanceXml = actionClassInstanceXmlIter->second; - const SmartPtrCActionClassInstanceDoc actionClassInstanceDoc = - ActionClassInstanceXml::parse(actionClassInstanceXml); - actionClassInstanceVal.push_back(actionClassInstanceDoc); - } - } - - actionClassInstanceCollectionDoc.CreateInstance(); - actionClassInstanceCollectionDoc->initialize( - actionClassInstanceVal); - } - CAF_CM_EXIT; - - return actionClassInstanceCollectionDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/ActionClassInstanceXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/ActionClassInstanceXml.cpp deleted file mode 100644 index 523ff1277..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/ActionClassInstanceXml.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/SchemaTypesXml/InstanceOperationCollectionXml.h" - -#include "Doc/SchemaTypesDoc/CActionClassInstanceDoc.h" -#include "Doc/SchemaTypesDoc/CInstanceOperationCollectionDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/SchemaTypesXml/ActionClassInstanceXml.h" - -using namespace Caf; - -void ActionClassInstanceXml::add( - const SmartPtrCActionClassInstanceDoc actionClassInstanceDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("ActionClassInstanceXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(actionClassInstanceDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string namespaceValVal = actionClassInstanceDoc->getNamespaceVal(); - CAF_CM_VALIDATE_STRING(namespaceValVal); - thisXml->addAttribute("namespace", namespaceValVal); - - const std::string nameVal = actionClassInstanceDoc->getName(); - CAF_CM_VALIDATE_STRING(nameVal); - thisXml->addAttribute("name", nameVal); - - const std::string versionVal = actionClassInstanceDoc->getVersion(); - CAF_CM_VALIDATE_STRING(versionVal); - thisXml->addAttribute("version", versionVal); - - const SmartPtrCInstanceOperationCollectionDoc instanceOperationCollectionVal = - actionClassInstanceDoc->getInstanceOperationCollection(); - CAF_CM_VALIDATE_SMARTPTR(instanceOperationCollectionVal); - - const SmartPtrCXmlElement instanceOperationCollectionXml = - thisXml->createAndAddElement("instanceOperationCollection"); - InstanceOperationCollectionXml::add(instanceOperationCollectionVal, instanceOperationCollectionXml); - } - CAF_CM_EXIT; -} - -SmartPtrCActionClassInstanceDoc ActionClassInstanceXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("ActionClassInstanceXml", "parse"); - - SmartPtrCActionClassInstanceDoc actionClassInstanceDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string namespaceValStrVal = - thisXml->findRequiredAttribute("namespace"); - const std::string namespaceValVal = namespaceValStrVal; - - const std::string nameStrVal = - thisXml->findRequiredAttribute("name"); - const std::string nameVal = nameStrVal; - - const std::string versionStrVal = - thisXml->findRequiredAttribute("version"); - const std::string versionVal = versionStrVal; - - const SmartPtrCXmlElement instanceOperationCollectionXml = - thisXml->findRequiredChild("instanceOperationCollection"); - - SmartPtrCInstanceOperationCollectionDoc instanceOperationCollectionVal; - if (! instanceOperationCollectionXml.IsNull()) { - instanceOperationCollectionVal = InstanceOperationCollectionXml::parse(instanceOperationCollectionXml); - } - - actionClassInstanceDoc.CreateInstance(); - actionClassInstanceDoc->initialize( - namespaceValVal, - nameVal, - versionVal, - instanceOperationCollectionVal); - } - CAF_CM_EXIT; - - return actionClassInstanceDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/ActionClassXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/ActionClassXml.cpp deleted file mode 100644 index f273eb41f..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/ActionClassXml.cpp +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/SchemaTypesXml/MethodXml.h" - -#include "Doc/SchemaTypesDoc/CActionClassDoc.h" -#include "Doc/SchemaTypesDoc/CCollectMethodDoc.h" -#include "Doc/SchemaTypesDoc/CMethodDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/SchemaTypesXml/ActionClassXml.h" -#include "Doc/DocXml/SchemaTypesXml/CollectMethodXml.h" - -using namespace Caf; - -void ActionClassXml::add( - const SmartPtrCActionClassDoc actionClassDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("ActionClassXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(actionClassDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string namespaceValVal = actionClassDoc->getNamespaceVal(); - CAF_CM_VALIDATE_STRING(namespaceValVal); - thisXml->addAttribute("namespace", namespaceValVal); - - const std::string nameVal = actionClassDoc->getName(); - CAF_CM_VALIDATE_STRING(nameVal); - thisXml->addAttribute("name", nameVal); - - const std::string versionVal = actionClassDoc->getVersion(); - CAF_CM_VALIDATE_STRING(versionVal); - thisXml->addAttribute("version", versionVal); - - const SmartPtrCCollectMethodDoc collectMethodVal = - actionClassDoc->getCollectMethod(); - if (! collectMethodVal.IsNull()) { - const SmartPtrCXmlElement collectMethodXml = - thisXml->createAndAddElement("collectMethod"); - CollectMethodXml::add(collectMethodVal, collectMethodXml); - } - - const std::deque methodVal = - actionClassDoc->getMethodCollection(); - if (! methodVal.empty()) { - for (TConstIterator > methodIter(methodVal); - methodIter; methodIter++) { - const SmartPtrCXmlElement methodXml = - thisXml->createAndAddElement("method"); - MethodXml::add(*methodIter, methodXml); - } - } - - const std::string displayNameVal = actionClassDoc->getDisplayName(); - if (! displayNameVal.empty()) { - thisXml->addAttribute("displayName", displayNameVal); - } - - const std::string descriptionVal = actionClassDoc->getDescription(); - if (! descriptionVal.empty()) { - thisXml->addAttribute("description", descriptionVal); - } - } - CAF_CM_EXIT; -} - -SmartPtrCActionClassDoc ActionClassXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("ActionClassXml", "parse"); - - SmartPtrCActionClassDoc actionClassDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string namespaceValStrVal = - thisXml->findRequiredAttribute("namespace"); - const std::string namespaceValVal = namespaceValStrVal; - - const std::string nameStrVal = - thisXml->findRequiredAttribute("name"); - const std::string nameVal = nameStrVal; - - const std::string versionStrVal = - thisXml->findRequiredAttribute("version"); - const std::string versionVal = versionStrVal; - - const SmartPtrCXmlElement collectMethodXml = - thisXml->findOptionalChild("collectMethod"); - - SmartPtrCCollectMethodDoc collectMethodVal; - if (! collectMethodXml.IsNull()) { - collectMethodVal = CollectMethodXml::parse(collectMethodXml); - } - - const CXmlElement::SmartPtrCElementCollection methodChildrenXml = - thisXml->findOptionalChildren("method"); - - std::deque methodVal; - if (! methodChildrenXml.IsNull() && ! methodChildrenXml->empty()) { - for (TConstIterator methodXmlIter(*methodChildrenXml); - methodXmlIter; methodXmlIter++) { - const SmartPtrCXmlElement methodXml = methodXmlIter->second; - const SmartPtrCMethodDoc methodDoc = - MethodXml::parse(methodXml); - methodVal.push_back(methodDoc); - } - } - - const std::string displayNameStrVal = - thisXml->findOptionalAttribute("displayName"); - const std::string displayNameVal = displayNameStrVal; - - const std::string descriptionStrVal = - thisXml->findOptionalAttribute("description"); - const std::string descriptionVal = descriptionStrVal; - - actionClassDoc.CreateInstance(); - actionClassDoc->initialize( - namespaceValVal, - nameVal, - versionVal, - collectMethodVal, - methodVal, - displayNameVal, - descriptionVal); - } - CAF_CM_EXIT; - - return actionClassDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/ClassCardinalityXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/ClassCardinalityXml.cpp deleted file mode 100644 index f6e8a7738..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/ClassCardinalityXml.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/SchemaTypesDoc/CClassCardinalityDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/SchemaTypesXml/ClassCardinalityXml.h" - -using namespace Caf; - -void ClassCardinalityXml::add( - const SmartPtrCClassCardinalityDoc classCardinalityDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("ClassCardinalityXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(classCardinalityDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string namespaceValVal = classCardinalityDoc->getNamespaceVal(); - CAF_CM_VALIDATE_STRING(namespaceValVal); - thisXml->addAttribute("namespace", namespaceValVal); - - const std::string nameVal = classCardinalityDoc->getName(); - CAF_CM_VALIDATE_STRING(nameVal); - thisXml->addAttribute("name", nameVal); - - const std::string versionVal = classCardinalityDoc->getVersion(); - CAF_CM_VALIDATE_STRING(versionVal); - thisXml->addAttribute("version", versionVal); - - const std::string cardinalityVal = classCardinalityDoc->getCardinality(); - CAF_CM_VALIDATE_STRING(cardinalityVal); - thisXml->addAttribute("cardinality", cardinalityVal); - } - CAF_CM_EXIT; -} - -SmartPtrCClassCardinalityDoc ClassCardinalityXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("ClassCardinalityXml", "parse"); - - SmartPtrCClassCardinalityDoc classCardinalityDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string namespaceValStrVal = - thisXml->findRequiredAttribute("namespace"); - const std::string namespaceValVal = namespaceValStrVal; - - const std::string nameStrVal = - thisXml->findRequiredAttribute("name"); - const std::string nameVal = nameStrVal; - - const std::string versionStrVal = - thisXml->findRequiredAttribute("version"); - const std::string versionVal = versionStrVal; - - const std::string cardinalityStrVal = - thisXml->findRequiredAttribute("cardinality"); - const std::string cardinalityVal = cardinalityStrVal; - - classCardinalityDoc.CreateInstance(); - classCardinalityDoc->initialize( - namespaceValVal, - nameVal, - versionVal, - cardinalityVal); - } - CAF_CM_EXIT; - - return classCardinalityDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/ClassFieldXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/ClassFieldXml.cpp deleted file mode 100644 index 73e93fb4b..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/ClassFieldXml.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/SchemaTypesDoc/CClassFieldDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/SchemaTypesXml/ClassFieldXml.h" - -using namespace Caf; - -void ClassFieldXml::add( - const SmartPtrCClassFieldDoc classFieldDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("ClassFieldXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(classFieldDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string namespaceValVal = classFieldDoc->getNamespaceVal(); - CAF_CM_VALIDATE_STRING(namespaceValVal); - thisXml->addAttribute("namespace", namespaceValVal); - - const std::string nameVal = classFieldDoc->getName(); - CAF_CM_VALIDATE_STRING(nameVal); - thisXml->addAttribute("name", nameVal); - - const std::string versionVal = classFieldDoc->getVersion(); - CAF_CM_VALIDATE_STRING(versionVal); - thisXml->addAttribute("version", versionVal); - - const std::string fieldVal = classFieldDoc->getField(); - CAF_CM_VALIDATE_STRING(fieldVal); - thisXml->addAttribute("field", fieldVal); - } - CAF_CM_EXIT; -} - -SmartPtrCClassFieldDoc ClassFieldXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("ClassFieldXml", "parse"); - - SmartPtrCClassFieldDoc classFieldDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string namespaceValStrVal = - thisXml->findRequiredAttribute("namespace"); - const std::string namespaceValVal = namespaceValStrVal; - - const std::string nameStrVal = - thisXml->findRequiredAttribute("name"); - const std::string nameVal = nameStrVal; - - const std::string versionStrVal = - thisXml->findRequiredAttribute("version"); - const std::string versionVal = versionStrVal; - - const std::string fieldStrVal = - thisXml->findRequiredAttribute("field"); - const std::string fieldVal = fieldStrVal; - - classFieldDoc.CreateInstance(); - classFieldDoc->initialize( - namespaceValVal, - nameVal, - versionVal, - fieldVal); - } - CAF_CM_EXIT; - - return classFieldDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/ClassIdentifierXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/ClassIdentifierXml.cpp deleted file mode 100644 index 016147cbd..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/ClassIdentifierXml.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/SchemaTypesDoc/CClassIdentifierDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/SchemaTypesXml/ClassIdentifierXml.h" - -using namespace Caf; - -void ClassIdentifierXml::add( - const SmartPtrCClassIdentifierDoc classIdentifierDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("ClassIdentifierXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(classIdentifierDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string namespaceValVal = classIdentifierDoc->getNamespaceVal(); - CAF_CM_VALIDATE_STRING(namespaceValVal); - thisXml->addAttribute("namespace", namespaceValVal); - - const std::string nameVal = classIdentifierDoc->getName(); - CAF_CM_VALIDATE_STRING(nameVal); - thisXml->addAttribute("name", nameVal); - - const std::string versionVal = classIdentifierDoc->getVersion(); - CAF_CM_VALIDATE_STRING(versionVal); - thisXml->addAttribute("version", versionVal); - } - CAF_CM_EXIT; -} - -SmartPtrCClassIdentifierDoc ClassIdentifierXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("ClassIdentifierXml", "parse"); - - SmartPtrCClassIdentifierDoc classIdentifierDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string namespaceValStrVal = - thisXml->findRequiredAttribute("namespace"); - const std::string namespaceValVal = namespaceValStrVal; - - const std::string nameStrVal = - thisXml->findRequiredAttribute("name"); - const std::string nameVal = nameStrVal; - - const std::string versionStrVal = - thisXml->findRequiredAttribute("version"); - const std::string versionVal = versionStrVal; - - classIdentifierDoc.CreateInstance(); - classIdentifierDoc->initialize( - namespaceValVal, - nameVal, - versionVal); - } - CAF_CM_EXIT; - - return classIdentifierDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/ClassInstancePropertyXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/ClassInstancePropertyXml.cpp deleted file mode 100644 index b402656a1..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/ClassInstancePropertyXml.cpp +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/SchemaTypesXml/ClassIdentifierXml.h" - -#include "Doc/SchemaTypesDoc/CClassIdentifierDoc.h" -#include "Doc/SchemaTypesDoc/CClassInstancePropertyDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/SchemaTypesXml/ClassInstancePropertyXml.h" - -using namespace Caf; - -void ClassInstancePropertyXml::add( - const SmartPtrCClassInstancePropertyDoc classInstancePropertyDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("ClassInstancePropertyXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(classInstancePropertyDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string nameVal = classInstancePropertyDoc->getName(); - CAF_CM_VALIDATE_STRING(nameVal); - thisXml->addAttribute("name", nameVal); - - const std::deque typeVal = - classInstancePropertyDoc->getType(); - CAF_CM_VALIDATE_STL(typeVal); - - if (! typeVal.empty()) { - for (TConstIterator > typeIter(typeVal); - typeIter; typeIter++) { - const SmartPtrCXmlElement typeXml = - thisXml->createAndAddElement("type"); - ClassIdentifierXml::add(*typeIter, typeXml); - } - } - - const std::string requiredVal = classInstancePropertyDoc->getRequired() ? "true" : "false"; - if (! requiredVal.empty()) { - thisXml->addAttribute("required", requiredVal); - } - - const std::string transientValVal = classInstancePropertyDoc->getTransientVal() ? "true" : "false"; - if (! transientValVal.empty()) { - thisXml->addAttribute("transient", transientValVal); - } - - const std::string listVal = classInstancePropertyDoc->getList() ? "true" : "false"; - if (! listVal.empty()) { - thisXml->addAttribute("list", listVal); - } - - const std::string displayNameVal = classInstancePropertyDoc->getDisplayName(); - if (! displayNameVal.empty()) { - thisXml->addAttribute("displayName", displayNameVal); - } - - const std::string descriptionVal = classInstancePropertyDoc->getDescription(); - if (! descriptionVal.empty()) { - thisXml->addAttribute("description", descriptionVal); - } - } - CAF_CM_EXIT; -} - -SmartPtrCClassInstancePropertyDoc ClassInstancePropertyXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("ClassInstancePropertyXml", "parse"); - - SmartPtrCClassInstancePropertyDoc classInstancePropertyDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string nameStrVal = - thisXml->findRequiredAttribute("name"); - const std::string nameVal = nameStrVal; - - const CXmlElement::SmartPtrCElementCollection typeChildrenXml = - thisXml->findRequiredChildren("type"); - - std::deque typeVal; - if (! typeChildrenXml.IsNull() && ! typeChildrenXml->empty()) { - for (TConstIterator typeXmlIter(*typeChildrenXml); - typeXmlIter; typeXmlIter++) { - const SmartPtrCXmlElement typeXml = typeXmlIter->second; - const SmartPtrCClassIdentifierDoc typeDoc = - ClassIdentifierXml::parse(typeXml); - typeVal.push_back(typeDoc); - } - } - - const std::string requiredStrVal = - thisXml->findOptionalAttribute("required"); - bool requiredVal = false; - if (! requiredStrVal.empty()) { - requiredVal = (requiredStrVal.compare("true") == 0) ? true : false; - } - - const std::string transientValStrVal = - thisXml->findOptionalAttribute("transient"); - bool transientValVal = false; - if (! transientValStrVal.empty()) { - transientValVal = (transientValStrVal.compare("true") == 0) ? true : false; - } - - const std::string listStrVal = - thisXml->findOptionalAttribute("list"); - bool listVal = false; - if (! listStrVal.empty()) { - listVal = (listStrVal.compare("true") == 0) ? true : false; - } - - const std::string displayNameStrVal = - thisXml->findOptionalAttribute("displayName"); - const std::string displayNameVal = displayNameStrVal; - - const std::string descriptionStrVal = - thisXml->findOptionalAttribute("description"); - const std::string descriptionVal = descriptionStrVal; - - classInstancePropertyDoc.CreateInstance(); - classInstancePropertyDoc->initialize( - nameVal, - typeVal, - requiredVal, - transientValVal, - listVal, - displayNameVal, - descriptionVal); - } - CAF_CM_EXIT; - - return classInstancePropertyDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/ClassPropertyXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/ClassPropertyXml.cpp deleted file mode 100644 index ba35f5209..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/ClassPropertyXml.cpp +++ /dev/null @@ -1,228 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocUtils/EnumConvertersXml.h" -#include "Doc/SchemaTypesDoc/SchemaTypesDocTypes.h" -#include "Doc/CafCoreTypesDoc/CafCoreTypesDocTypes.h" - -#include "Doc/SchemaTypesDoc/CClassPropertyDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/SchemaTypesXml/ClassPropertyXml.h" - -using namespace Caf; - -void ClassPropertyXml::add( - const SmartPtrCClassPropertyDoc classPropertyDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("ClassPropertyXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(classPropertyDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string nameVal = classPropertyDoc->getName(); - CAF_CM_VALIDATE_STRING(nameVal); - thisXml->addAttribute("name", nameVal); - - const std::string typeVal = - EnumConvertersXml::convertPropertyTypeToString(classPropertyDoc->getType()); - CAF_CM_VALIDATE_STRING(typeVal); - thisXml->addAttribute("type", typeVal); - - const std::deque valueVal = - classPropertyDoc->getValue(); - if (! valueVal.empty()) { - for (TConstIterator > valueIter(valueVal); - valueIter; valueIter++) { - const SmartPtrCXmlElement valueXml = - thisXml->createAndAddElement("value"); - valueXml->setValue(*valueIter); - } - } - - const std::string requiredVal = classPropertyDoc->getRequired() ? "true" : "false"; - if (! requiredVal.empty()) { - thisXml->addAttribute("required", requiredVal); - } - - const std::string keyVal = classPropertyDoc->getKey() ? "true" : "false"; - if (! keyVal.empty()) { - thisXml->addAttribute("key", keyVal); - } - - const std::string listVal = classPropertyDoc->getList() ? "true" : "false"; - if (! listVal.empty()) { - thisXml->addAttribute("list", listVal); - } - - const std::string caseSensitiveVal = classPropertyDoc->getCaseSensitive() ? "true" : "false"; - if (! caseSensitiveVal.empty()) { - thisXml->addAttribute("caseSensitive", caseSensitiveVal); - } - - const std::string transientValVal = classPropertyDoc->getTransientVal() ? "true" : "false"; - if (! transientValVal.empty()) { - thisXml->addAttribute("transient", transientValVal); - } - - const std::string defaultValVal = classPropertyDoc->getDefaultVal(); - if (! defaultValVal.empty()) { - thisXml->addAttribute("default", defaultValVal); - } - - const std::string validatorVal = - EnumConvertersXml::convertValidatorTypeToString(classPropertyDoc->getValidator()); - if (! validatorVal.empty()) { - thisXml->addAttribute("validator", validatorVal); - } - - const std::string upperRangeVal = classPropertyDoc->getUpperRange(); - if (! upperRangeVal.empty()) { - thisXml->addAttribute("upperRange", upperRangeVal); - } - - const std::string lowerRangeVal = classPropertyDoc->getLowerRange(); - if (! lowerRangeVal.empty()) { - thisXml->addAttribute("lowerRange", lowerRangeVal); - } - - const std::string displayNameVal = classPropertyDoc->getDisplayName(); - if (! displayNameVal.empty()) { - thisXml->addAttribute("displayName", displayNameVal); - } - - const std::string descriptionVal = classPropertyDoc->getDescription(); - if (! descriptionVal.empty()) { - thisXml->addAttribute("description", descriptionVal); - } - } - CAF_CM_EXIT; -} - -SmartPtrCClassPropertyDoc ClassPropertyXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("ClassPropertyXml", "parse"); - - SmartPtrCClassPropertyDoc classPropertyDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string nameStrVal = - thisXml->findRequiredAttribute("name"); - const std::string nameVal = nameStrVal; - - const std::string typeStrVal = - thisXml->findRequiredAttribute("type"); - PROPERTY_TYPE typeVal = PROPERTY_NONE; - if (! typeStrVal.empty()) { - typeVal = EnumConvertersXml::convertStringToPropertyType(typeStrVal); - } - - const CXmlElement::SmartPtrCElementCollection valueChildrenXml = - thisXml->findOptionalChildren("value"); - - std::deque valueVal; - if (! valueChildrenXml.IsNull() && ! valueChildrenXml->empty()) { - for (TConstIterator valueXmlIter(*valueChildrenXml); - valueXmlIter; valueXmlIter++) { - const SmartPtrCXmlElement valueXml = valueXmlIter->second; - const std::string valueDoc = valueXml->getValue(); - valueVal.push_back(valueDoc); - } - } - - const std::string requiredStrVal = - thisXml->findOptionalAttribute("required"); - bool requiredVal = false; - if (! requiredStrVal.empty()) { - requiredVal = (requiredStrVal.compare("true") == 0) ? true : false; - } - - const std::string keyStrVal = - thisXml->findOptionalAttribute("key"); - bool keyVal = false; - if (! keyStrVal.empty()) { - keyVal = (keyStrVal.compare("true") == 0) ? true : false; - } - - const std::string listStrVal = - thisXml->findOptionalAttribute("list"); - bool listVal = false; - if (! listStrVal.empty()) { - listVal = (listStrVal.compare("true") == 0) ? true : false; - } - - const std::string caseSensitiveStrVal = - thisXml->findOptionalAttribute("caseSensitive"); - bool caseSensitiveVal = false; - if (! caseSensitiveStrVal.empty()) { - caseSensitiveVal = (caseSensitiveStrVal.compare("true") == 0) ? true : false; - } - - const std::string transientValStrVal = - thisXml->findOptionalAttribute("transient"); - bool transientValVal = false; - if (! transientValStrVal.empty()) { - transientValVal = (transientValStrVal.compare("true") == 0) ? true : false; - } - - const std::string defaultValStrVal = - thisXml->findOptionalAttribute("default"); - const std::string defaultValVal = defaultValStrVal; - - const std::string validatorStrVal = - thisXml->findOptionalAttribute("validator"); - VALIDATOR_TYPE validatorVal = VALIDATOR_NONE; - if (! validatorStrVal.empty()) { - validatorVal = EnumConvertersXml::convertStringToValidatorType(validatorStrVal); - } - - const std::string upperRangeStrVal = - thisXml->findOptionalAttribute("upperRange"); - const std::string upperRangeVal = upperRangeStrVal; - - const std::string lowerRangeStrVal = - thisXml->findOptionalAttribute("lowerRange"); - const std::string lowerRangeVal = lowerRangeStrVal; - - const std::string displayNameStrVal = - thisXml->findOptionalAttribute("displayName"); - const std::string displayNameVal = displayNameStrVal; - - const std::string descriptionStrVal = - thisXml->findOptionalAttribute("description"); - const std::string descriptionVal = descriptionStrVal; - - classPropertyDoc.CreateInstance(); - classPropertyDoc->initialize( - nameVal, - typeVal, - valueVal, - requiredVal, - keyVal, - listVal, - caseSensitiveVal, - transientValVal, - defaultValVal, - validatorVal, - upperRangeVal, - lowerRangeVal, - displayNameVal, - descriptionVal); - } - CAF_CM_EXIT; - - return classPropertyDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/CmdlMetadataXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/CmdlMetadataXml.cpp deleted file mode 100644 index 9dc07ad68..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/CmdlMetadataXml.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/SchemaTypesDoc/CCmdlMetadataDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/SchemaTypesXml/CmdlMetadataXml.h" - -using namespace Caf; - -void CmdlMetadataXml::add( - const SmartPtrCCmdlMetadataDoc cmdlMetadataDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("CmdlMetadataXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(cmdlMetadataDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string nameVal = cmdlMetadataDoc->getName(); - CAF_CM_VALIDATE_STRING(nameVal); - thisXml->addAttribute("name", nameVal); - - const std::string valueVal = - cmdlMetadataDoc->getValue(); - CAF_CM_VALIDATE_STRING(valueVal); - - const SmartPtrCXmlElement valueXml = - thisXml->createAndAddElement("value"); - valueXml->setValue(valueVal); - } - CAF_CM_EXIT; -} - -SmartPtrCCmdlMetadataDoc CmdlMetadataXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("CmdlMetadataXml", "parse"); - - SmartPtrCCmdlMetadataDoc cmdlMetadataDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string nameStrVal = - thisXml->findRequiredAttribute("name"); - const std::string nameVal = nameStrVal; - - const SmartPtrCXmlElement valueXml = - thisXml->findRequiredChild("value"); - - std::string valueVal; - if (! valueXml.IsNull()) { - valueVal = valueXml->getValue(); - } - - cmdlMetadataDoc.CreateInstance(); - cmdlMetadataDoc->initialize( - nameVal, - valueVal); - } - CAF_CM_EXIT; - - return cmdlMetadataDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/CmdlUnionXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/CmdlUnionXml.cpp deleted file mode 100644 index a6fc7065e..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/CmdlUnionXml.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/SchemaTypesDoc/CCmdlUnionDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/SchemaTypesXml/CmdlUnionXml.h" - -using namespace Caf; - -void CmdlUnionXml::add( - const SmartPtrCCmdlUnionDoc cmdlUnionDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("CmdlUnionXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(cmdlUnionDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string namespaceValVal = cmdlUnionDoc->getNamespaceVal(); - CAF_CM_VALIDATE_STRING(namespaceValVal); - thisXml->addAttribute("namespace", namespaceValVal); - - const std::string nameVal = cmdlUnionDoc->getName(); - CAF_CM_VALIDATE_STRING(nameVal); - thisXml->addAttribute("name", nameVal); - - const std::string versionVal = cmdlUnionDoc->getVersion(); - CAF_CM_VALIDATE_STRING(versionVal); - thisXml->addAttribute("version", versionVal); - } - CAF_CM_EXIT; -} - -SmartPtrCCmdlUnionDoc CmdlUnionXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("CmdlUnionXml", "parse"); - - SmartPtrCCmdlUnionDoc cmdlUnionDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string namespaceValStrVal = - thisXml->findRequiredAttribute("namespace"); - const std::string namespaceValVal = namespaceValStrVal; - - const std::string nameStrVal = - thisXml->findRequiredAttribute("name"); - const std::string nameVal = nameStrVal; - - const std::string versionStrVal = - thisXml->findRequiredAttribute("version"); - const std::string versionVal = versionStrVal; - - cmdlUnionDoc.CreateInstance(); - cmdlUnionDoc->initialize( - namespaceValVal, - nameVal, - versionVal); - } - CAF_CM_EXIT; - - return cmdlUnionDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/CollectMethodXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/CollectMethodXml.cpp deleted file mode 100644 index eb27474ee..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/CollectMethodXml.cpp +++ /dev/null @@ -1,194 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/SchemaTypesXml/ClassIdentifierXml.h" -#include "Doc/DocXml/SchemaTypesXml/InstanceParameterXml.h" -#include "Doc/DocXml/SchemaTypesXml/MethodParameterXml.h" - -#include "Doc/SchemaTypesDoc/CClassIdentifierDoc.h" -#include "Doc/SchemaTypesDoc/CCollectMethodDoc.h" -#include "Doc/SchemaTypesDoc/CInstanceParameterDoc.h" -#include "Doc/SchemaTypesDoc/CMethodParameterDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/SchemaTypesXml/CollectMethodXml.h" - -using namespace Caf; - -void CollectMethodXml::add( - const SmartPtrCCollectMethodDoc collectMethodDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("CollectMethodXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(collectMethodDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string nameVal = collectMethodDoc->getName(); - CAF_CM_VALIDATE_STRING(nameVal); - thisXml->addAttribute("name", nameVal); - - const std::deque parameterVal = - collectMethodDoc->getParameterCollection(); - if (! parameterVal.empty()) { - for (TConstIterator > parameterIter(parameterVal); - parameterIter; parameterIter++) { - const SmartPtrCXmlElement parameterXml = - thisXml->createAndAddElement("parameter"); - MethodParameterXml::add(*parameterIter, parameterXml); - } - } - - const std::deque instanceParameterVal = - collectMethodDoc->getInstanceParameterCollection(); - if (! instanceParameterVal.empty()) { - for (TConstIterator > instanceParameterIter(instanceParameterVal); - instanceParameterIter; instanceParameterIter++) { - const SmartPtrCXmlElement instanceParameterXml = - thisXml->createAndAddElement("instanceParameter"); - InstanceParameterXml::add(*instanceParameterIter, instanceParameterXml); - } - } - - const std::deque returnValVal = - collectMethodDoc->getReturnValCollection(); - if (! returnValVal.empty()) { - for (TConstIterator > returnValIter(returnValVal); - returnValIter; returnValIter++) { - const SmartPtrCXmlElement returnValXml = - thisXml->createAndAddElement("return"); - ClassIdentifierXml::add(*returnValIter, returnValXml); - } - } - - const std::deque eventValVal = - collectMethodDoc->getEventValCollection(); - if (! eventValVal.empty()) { - for (TConstIterator > eventValIter(eventValVal); - eventValIter; eventValIter++) { - const SmartPtrCXmlElement eventValXml = - thisXml->createAndAddElement("event"); - ClassIdentifierXml::add(*eventValIter, eventValXml); - } - } - - const std::deque errorVal = - collectMethodDoc->getErrorCollection(); - if (! errorVal.empty()) { - for (TConstIterator > errorIter(errorVal); - errorIter; errorIter++) { - const SmartPtrCXmlElement errorXml = - thisXml->createAndAddElement("error"); - ClassIdentifierXml::add(*errorIter, errorXml); - } - } - } - CAF_CM_EXIT; -} - -SmartPtrCCollectMethodDoc CollectMethodXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("CollectMethodXml", "parse"); - - SmartPtrCCollectMethodDoc collectMethodDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string nameStrVal = - thisXml->findRequiredAttribute("name"); - const std::string nameVal = nameStrVal; - - const CXmlElement::SmartPtrCElementCollection parameterChildrenXml = - thisXml->findOptionalChildren("parameter"); - - std::deque parameterVal; - if (! parameterChildrenXml.IsNull() && ! parameterChildrenXml->empty()) { - for (TConstIterator parameterXmlIter(*parameterChildrenXml); - parameterXmlIter; parameterXmlIter++) { - const SmartPtrCXmlElement parameterXml = parameterXmlIter->second; - const SmartPtrCMethodParameterDoc parameterDoc = - MethodParameterXml::parse(parameterXml); - parameterVal.push_back(parameterDoc); - } - } - - const CXmlElement::SmartPtrCElementCollection instanceParameterChildrenXml = - thisXml->findOptionalChildren("instanceParameter"); - - std::deque instanceParameterVal; - if (! instanceParameterChildrenXml.IsNull() && ! instanceParameterChildrenXml->empty()) { - for (TConstIterator instanceParameterXmlIter(*instanceParameterChildrenXml); - instanceParameterXmlIter; instanceParameterXmlIter++) { - const SmartPtrCXmlElement instanceParameterXml = instanceParameterXmlIter->second; - const SmartPtrCInstanceParameterDoc instanceParameterDoc = - InstanceParameterXml::parse(instanceParameterXml); - instanceParameterVal.push_back(instanceParameterDoc); - } - } - - const CXmlElement::SmartPtrCElementCollection returnValChildrenXml = - thisXml->findOptionalChildren("return"); - - std::deque returnValVal; - if (! returnValChildrenXml.IsNull() && ! returnValChildrenXml->empty()) { - for (TConstIterator returnValXmlIter(*returnValChildrenXml); - returnValXmlIter; returnValXmlIter++) { - const SmartPtrCXmlElement returnValXml = returnValXmlIter->second; - const SmartPtrCClassIdentifierDoc returnValDoc = - ClassIdentifierXml::parse(returnValXml); - returnValVal.push_back(returnValDoc); - } - } - - const CXmlElement::SmartPtrCElementCollection eventValChildrenXml = - thisXml->findOptionalChildren("event"); - - std::deque eventValVal; - if (! eventValChildrenXml.IsNull() && ! eventValChildrenXml->empty()) { - for (TConstIterator eventValXmlIter(*eventValChildrenXml); - eventValXmlIter; eventValXmlIter++) { - const SmartPtrCXmlElement eventValXml = eventValXmlIter->second; - const SmartPtrCClassIdentifierDoc eventValDoc = - ClassIdentifierXml::parse(eventValXml); - eventValVal.push_back(eventValDoc); - } - } - - const CXmlElement::SmartPtrCElementCollection errorChildrenXml = - thisXml->findOptionalChildren("error"); - - std::deque errorVal; - if (! errorChildrenXml.IsNull() && ! errorChildrenXml->empty()) { - for (TConstIterator errorXmlIter(*errorChildrenXml); - errorXmlIter; errorXmlIter++) { - const SmartPtrCXmlElement errorXml = errorXmlIter->second; - const SmartPtrCClassIdentifierDoc errorDoc = - ClassIdentifierXml::parse(errorXml); - errorVal.push_back(errorDoc); - } - } - - collectMethodDoc.CreateInstance(); - collectMethodDoc->initialize( - nameVal, - parameterVal, - instanceParameterVal, - returnValVal, - eventValVal, - errorVal); - } - CAF_CM_EXIT; - - return collectMethodDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/DataClassInstanceCollectionXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/DataClassInstanceCollectionXml.cpp deleted file mode 100644 index 65d2b2725..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/DataClassInstanceCollectionXml.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/SchemaTypesXml/DataClassInstanceXml.h" - -#include "Doc/SchemaTypesDoc/CDataClassInstanceCollectionDoc.h" -#include "Doc/SchemaTypesDoc/CDataClassInstanceDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/SchemaTypesXml/DataClassInstanceCollectionXml.h" - -using namespace Caf; - -void DataClassInstanceCollectionXml::add( - const SmartPtrCDataClassInstanceCollectionDoc dataClassInstanceCollectionDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("DataClassInstanceCollectionXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(dataClassInstanceCollectionDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::deque dataClassInstanceVal = - dataClassInstanceCollectionDoc->getDataClassInstanceCollection(); - CAF_CM_VALIDATE_STL(dataClassInstanceVal); - - if (! dataClassInstanceVal.empty()) { - for (TConstIterator > dataClassInstanceIter(dataClassInstanceVal); - dataClassInstanceIter; dataClassInstanceIter++) { - const SmartPtrCXmlElement dataClassInstanceXml = - thisXml->createAndAddElement("dataClassInstance"); - DataClassInstanceXml::add(*dataClassInstanceIter, dataClassInstanceXml); - } - } - } - CAF_CM_EXIT; -} - -SmartPtrCDataClassInstanceCollectionDoc DataClassInstanceCollectionXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("DataClassInstanceCollectionXml", "parse"); - - SmartPtrCDataClassInstanceCollectionDoc dataClassInstanceCollectionDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const CXmlElement::SmartPtrCElementCollection dataClassInstanceChildrenXml = - thisXml->findRequiredChildren("dataClassInstance"); - - std::deque dataClassInstanceVal; - if (! dataClassInstanceChildrenXml.IsNull() && ! dataClassInstanceChildrenXml->empty()) { - for (TConstIterator dataClassInstanceXmlIter(*dataClassInstanceChildrenXml); - dataClassInstanceXmlIter; dataClassInstanceXmlIter++) { - const SmartPtrCXmlElement dataClassInstanceXml = dataClassInstanceXmlIter->second; - const SmartPtrCDataClassInstanceDoc dataClassInstanceDoc = - DataClassInstanceXml::parse(dataClassInstanceXml); - dataClassInstanceVal.push_back(dataClassInstanceDoc); - } - } - - dataClassInstanceCollectionDoc.CreateInstance(); - dataClassInstanceCollectionDoc->initialize( - dataClassInstanceVal); - } - CAF_CM_EXIT; - - return dataClassInstanceCollectionDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/DataClassInstanceXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/DataClassInstanceXml.cpp deleted file mode 100644 index 1e23beb4e..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/DataClassInstanceXml.cpp +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/SchemaTypesXml/CmdlMetadataXml.h" -#include "Doc/DocXml/SchemaTypesXml/CmdlUnionXml.h" -#include "Doc/DocXml/SchemaTypesXml/DataClassSubInstanceXml.h" - -#include "Doc/SchemaTypesDoc/CCmdlMetadataDoc.h" -#include "Doc/SchemaTypesDoc/CCmdlUnionDoc.h" -#include "Doc/SchemaTypesDoc/CDataClassInstanceDoc.h" -#include "Doc/SchemaTypesDoc/CDataClassPropertyDoc.h" -#include "Doc/SchemaTypesDoc/CDataClassSubInstanceDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/SchemaTypesXml/DataClassInstanceXml.h" -#include "Doc/DocXml/SchemaTypesXml/DataClassPropertyXml.h" - -using namespace Caf; - -void DataClassInstanceXml::add( - const SmartPtrCDataClassInstanceDoc dataClassInstanceDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("DataClassInstanceXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(dataClassInstanceDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string namespaceValVal = dataClassInstanceDoc->getNamespaceVal(); - CAF_CM_VALIDATE_STRING(namespaceValVal); - thisXml->addAttribute("namespace", namespaceValVal); - - const std::string nameVal = dataClassInstanceDoc->getName(); - CAF_CM_VALIDATE_STRING(nameVal); - thisXml->addAttribute("name", nameVal); - - const std::string versionVal = dataClassInstanceDoc->getVersion(); - CAF_CM_VALIDATE_STRING(versionVal); - thisXml->addAttribute("version", versionVal); - - const std::deque cmdlMetadataVal = - dataClassInstanceDoc->getCmdlMetadataCollection(); - if (! cmdlMetadataVal.empty()) { - for (TConstIterator > cmdlMetadataIter(cmdlMetadataVal); - cmdlMetadataIter; cmdlMetadataIter++) { - const SmartPtrCXmlElement cmdlMetadataXml = - thisXml->createAndAddElement("cmdlMetadata"); - CmdlMetadataXml::add(*cmdlMetadataIter, cmdlMetadataXml); - } - } - - const std::deque propertyVal = - dataClassInstanceDoc->getPropertyCollection(); - if (! propertyVal.empty()) { - for (TConstIterator > propertyIter(propertyVal); - propertyIter; propertyIter++) { - const SmartPtrCXmlElement propertyXml = - thisXml->createAndAddElement("property"); - DataClassPropertyXml::add(*propertyIter, propertyXml); - } - } - - const std::deque instancePropertyVal = - dataClassInstanceDoc->getInstancePropertyCollection(); - if (! instancePropertyVal.empty()) { - for (TConstIterator > instancePropertyIter(instancePropertyVal); - instancePropertyIter; instancePropertyIter++) { - const SmartPtrCXmlElement instancePropertyXml = - thisXml->createAndAddElement("instanceProperty"); - DataClassSubInstanceXml::add(*instancePropertyIter, instancePropertyXml); - } - } - - const SmartPtrCCmdlUnionDoc cmdlUnionVal = - dataClassInstanceDoc->getCmdlUnion(); - if (! cmdlUnionVal.IsNull()) { - const SmartPtrCXmlElement cmdlUnionXml = - thisXml->createAndAddElement("cmdlUnion"); - CmdlUnionXml::add(cmdlUnionVal, cmdlUnionXml); - } - } - CAF_CM_EXIT; -} - -SmartPtrCDataClassInstanceDoc DataClassInstanceXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("DataClassInstanceXml", "parse"); - - SmartPtrCDataClassInstanceDoc dataClassInstanceDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string namespaceValStrVal = - thisXml->findRequiredAttribute("namespace"); - const std::string namespaceValVal = namespaceValStrVal; - - const std::string nameStrVal = - thisXml->findRequiredAttribute("name"); - const std::string nameVal = nameStrVal; - - const std::string versionStrVal = - thisXml->findRequiredAttribute("version"); - const std::string versionVal = versionStrVal; - - const CXmlElement::SmartPtrCElementCollection cmdlMetadataChildrenXml = - thisXml->findOptionalChildren("cmdlMetadata"); - - std::deque cmdlMetadataVal; - if (! cmdlMetadataChildrenXml.IsNull() && ! cmdlMetadataChildrenXml->empty()) { - for (TConstIterator cmdlMetadataXmlIter(*cmdlMetadataChildrenXml); - cmdlMetadataXmlIter; cmdlMetadataXmlIter++) { - const SmartPtrCXmlElement cmdlMetadataXml = cmdlMetadataXmlIter->second; - const SmartPtrCCmdlMetadataDoc cmdlMetadataDoc = - CmdlMetadataXml::parse(cmdlMetadataXml); - cmdlMetadataVal.push_back(cmdlMetadataDoc); - } - } - - const CXmlElement::SmartPtrCElementCollection propertyChildrenXml = - thisXml->findOptionalChildren("property"); - - std::deque propertyVal; - if (! propertyChildrenXml.IsNull() && ! propertyChildrenXml->empty()) { - for (TConstIterator propertyXmlIter(*propertyChildrenXml); - propertyXmlIter; propertyXmlIter++) { - const SmartPtrCXmlElement propertyXml = propertyXmlIter->second; - const SmartPtrCDataClassPropertyDoc propertyDoc = - DataClassPropertyXml::parse(propertyXml); - propertyVal.push_back(propertyDoc); - } - } - - const CXmlElement::SmartPtrCElementCollection instancePropertyChildrenXml = - thisXml->findOptionalChildren("instanceProperty"); - - std::deque instancePropertyVal; - if (! instancePropertyChildrenXml.IsNull() && ! instancePropertyChildrenXml->empty()) { - for (TConstIterator instancePropertyXmlIter(*instancePropertyChildrenXml); - instancePropertyXmlIter; instancePropertyXmlIter++) { - const SmartPtrCXmlElement instancePropertyXml = instancePropertyXmlIter->second; - const SmartPtrCDataClassSubInstanceDoc instancePropertyDoc = - DataClassSubInstanceXml::parse(instancePropertyXml); - instancePropertyVal.push_back(instancePropertyDoc); - } - } - - const SmartPtrCXmlElement cmdlUnionXml = - thisXml->findOptionalChild("cmdlUnion"); - - SmartPtrCCmdlUnionDoc cmdlUnionVal; - if (! cmdlUnionXml.IsNull()) { - cmdlUnionVal = CmdlUnionXml::parse(cmdlUnionXml); - } - - dataClassInstanceDoc.CreateInstance(); - dataClassInstanceDoc->initialize( - namespaceValVal, - nameVal, - versionVal, - cmdlMetadataVal, - propertyVal, - instancePropertyVal, - cmdlUnionVal); - } - CAF_CM_EXIT; - - return dataClassInstanceDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/DataClassPropertyXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/DataClassPropertyXml.cpp deleted file mode 100644 index 478859fcb..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/DataClassPropertyXml.cpp +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/SchemaTypesXml/CmdlMetadataXml.h" - -#include "Doc/SchemaTypesDoc/CCmdlMetadataDoc.h" -#include "Doc/SchemaTypesDoc/CDataClassPropertyDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/SchemaTypesXml/DataClassPropertyXml.h" - -using namespace Caf; - -void DataClassPropertyXml::add( - const SmartPtrCDataClassPropertyDoc dataClassPropertyDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("DataClassPropertyXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(dataClassPropertyDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string nameVal = dataClassPropertyDoc->getName(); - CAF_CM_VALIDATE_STRING(nameVal); - thisXml->addAttribute("name", nameVal); - - const std::deque cmdlMetadataVal = - dataClassPropertyDoc->getCmdlMetadata(); - if (! cmdlMetadataVal.empty()) { - for (TConstIterator > cmdlMetadataIter(cmdlMetadataVal); - cmdlMetadataIter; cmdlMetadataIter++) { - const SmartPtrCXmlElement cmdlMetadataXml = - thisXml->createAndAddElement("cmdlMetadata"); - CmdlMetadataXml::add(*cmdlMetadataIter, cmdlMetadataXml); - } - } - - const std::string valueVal = - dataClassPropertyDoc->getValue(); - if (! valueVal.empty()) { - const SmartPtrCXmlElement valueXml = - thisXml->createAndAddElement("value"); - valueXml->setValue(valueVal); - } - } - CAF_CM_EXIT; -} - -SmartPtrCDataClassPropertyDoc DataClassPropertyXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("DataClassPropertyXml", "parse"); - - SmartPtrCDataClassPropertyDoc dataClassPropertyDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string nameStrVal = - thisXml->findRequiredAttribute("name"); - const std::string nameVal = nameStrVal; - - const CXmlElement::SmartPtrCElementCollection cmdlMetadataChildrenXml = - thisXml->findOptionalChildren("cmdlMetadata"); - - std::deque cmdlMetadataVal; - if (! cmdlMetadataChildrenXml.IsNull() && ! cmdlMetadataChildrenXml->empty()) { - for (TConstIterator cmdlMetadataXmlIter(*cmdlMetadataChildrenXml); - cmdlMetadataXmlIter; cmdlMetadataXmlIter++) { - const SmartPtrCXmlElement cmdlMetadataXml = cmdlMetadataXmlIter->second; - const SmartPtrCCmdlMetadataDoc cmdlMetadataDoc = - CmdlMetadataXml::parse(cmdlMetadataXml); - cmdlMetadataVal.push_back(cmdlMetadataDoc); - } - } - - const SmartPtrCXmlElement valueXml = - thisXml->findOptionalChild("value"); - - std::string valueVal; - if (! valueXml.IsNull()) { - if (! valueXml.IsNull()) { - valueVal = valueXml->getValue(); - } - } - - dataClassPropertyDoc.CreateInstance(); - dataClassPropertyDoc->initialize( - nameVal, - cmdlMetadataVal, - valueVal); - } - CAF_CM_EXIT; - - return dataClassPropertyDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/DataClassSubInstanceXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/DataClassSubInstanceXml.cpp deleted file mode 100644 index b53133004..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/DataClassSubInstanceXml.cpp +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/SchemaTypesXml/CmdlMetadataXml.h" -#include "Doc/DocXml/SchemaTypesXml/CmdlUnionXml.h" - -#include "Doc/SchemaTypesDoc/CCmdlMetadataDoc.h" -#include "Doc/SchemaTypesDoc/CCmdlUnionDoc.h" -#include "Doc/SchemaTypesDoc/CDataClassPropertyDoc.h" -#include "Doc/SchemaTypesDoc/CDataClassSubInstanceDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/SchemaTypesXml/DataClassSubInstanceXml.h" -#include "Doc/DocXml/SchemaTypesXml/DataClassPropertyXml.h" - -using namespace Caf; - -void DataClassSubInstanceXml::add( - const SmartPtrCDataClassSubInstanceDoc dataClassSubInstanceDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("DataClassSubInstanceXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(dataClassSubInstanceDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string nameVal = dataClassSubInstanceDoc->getName(); - CAF_CM_VALIDATE_STRING(nameVal); - thisXml->addAttribute("name", nameVal); - - const std::deque cmdlMetadataVal = - dataClassSubInstanceDoc->getCmdlMetadataCollection(); - if (! cmdlMetadataVal.empty()) { - for (TConstIterator > cmdlMetadataIter(cmdlMetadataVal); - cmdlMetadataIter; cmdlMetadataIter++) { - const SmartPtrCXmlElement cmdlMetadataXml = - thisXml->createAndAddElement("cmdlMetadata"); - CmdlMetadataXml::add(*cmdlMetadataIter, cmdlMetadataXml); - } - } - - const std::deque propertyVal = - dataClassSubInstanceDoc->getPropertyCollection(); - if (! propertyVal.empty()) { - for (TConstIterator > propertyIter(propertyVal); - propertyIter; propertyIter++) { - const SmartPtrCXmlElement propertyXml = - thisXml->createAndAddElement("property"); - DataClassPropertyXml::add(*propertyIter, propertyXml); - } - } - - const std::deque instancePropertyVal = - dataClassSubInstanceDoc->getInstancePropertyCollection(); - if (! instancePropertyVal.empty()) { - for (TConstIterator > instancePropertyIter(instancePropertyVal); - instancePropertyIter; instancePropertyIter++) { - const SmartPtrCXmlElement instancePropertyXml = - thisXml->createAndAddElement("instanceProperty"); - DataClassSubInstanceXml::add(*instancePropertyIter, instancePropertyXml); - } - } - - const SmartPtrCCmdlUnionDoc cmdlUnionVal = - dataClassSubInstanceDoc->getCmdlUnion(); - if (! cmdlUnionVal.IsNull()) { - const SmartPtrCXmlElement cmdlUnionXml = - thisXml->createAndAddElement("cmdlUnion"); - CmdlUnionXml::add(cmdlUnionVal, cmdlUnionXml); - } - } - CAF_CM_EXIT; -} - -SmartPtrCDataClassSubInstanceDoc DataClassSubInstanceXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("DataClassSubInstanceXml", "parse"); - - SmartPtrCDataClassSubInstanceDoc dataClassSubInstanceDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string nameStrVal = - thisXml->findRequiredAttribute("name"); - const std::string nameVal = nameStrVal; - - const CXmlElement::SmartPtrCElementCollection cmdlMetadataChildrenXml = - thisXml->findOptionalChildren("cmdlMetadata"); - - std::deque cmdlMetadataVal; - if (! cmdlMetadataChildrenXml.IsNull() && ! cmdlMetadataChildrenXml->empty()) { - for (TConstIterator cmdlMetadataXmlIter(*cmdlMetadataChildrenXml); - cmdlMetadataXmlIter; cmdlMetadataXmlIter++) { - const SmartPtrCXmlElement cmdlMetadataXml = cmdlMetadataXmlIter->second; - const SmartPtrCCmdlMetadataDoc cmdlMetadataDoc = - CmdlMetadataXml::parse(cmdlMetadataXml); - cmdlMetadataVal.push_back(cmdlMetadataDoc); - } - } - - const CXmlElement::SmartPtrCElementCollection propertyChildrenXml = - thisXml->findOptionalChildren("property"); - - std::deque propertyVal; - if (! propertyChildrenXml.IsNull() && ! propertyChildrenXml->empty()) { - for (TConstIterator propertyXmlIter(*propertyChildrenXml); - propertyXmlIter; propertyXmlIter++) { - const SmartPtrCXmlElement propertyXml = propertyXmlIter->second; - const SmartPtrCDataClassPropertyDoc propertyDoc = - DataClassPropertyXml::parse(propertyXml); - propertyVal.push_back(propertyDoc); - } - } - - const CXmlElement::SmartPtrCElementCollection instancePropertyChildrenXml = - thisXml->findOptionalChildren("instanceProperty"); - - std::deque instancePropertyVal; - if (! instancePropertyChildrenXml.IsNull() && ! instancePropertyChildrenXml->empty()) { - for (TConstIterator instancePropertyXmlIter(*instancePropertyChildrenXml); - instancePropertyXmlIter; instancePropertyXmlIter++) { - const SmartPtrCXmlElement instancePropertyXml = instancePropertyXmlIter->second; - const SmartPtrCDataClassSubInstanceDoc instancePropertyDoc = - DataClassSubInstanceXml::parse(instancePropertyXml); - instancePropertyVal.push_back(instancePropertyDoc); - } - } - - const SmartPtrCXmlElement cmdlUnionXml = - thisXml->findOptionalChild("cmdlUnion"); - - SmartPtrCCmdlUnionDoc cmdlUnionVal; - if (! cmdlUnionXml.IsNull()) { - cmdlUnionVal = CmdlUnionXml::parse(cmdlUnionXml); - } - - dataClassSubInstanceDoc.CreateInstance(); - dataClassSubInstanceDoc->initialize( - nameVal, - cmdlMetadataVal, - propertyVal, - instancePropertyVal, - cmdlUnionVal); - } - CAF_CM_EXIT; - - return dataClassSubInstanceDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/DataClassXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/DataClassXml.cpp deleted file mode 100644 index 414a0d2fb..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/DataClassXml.cpp +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/SchemaTypesXml/ClassInstancePropertyXml.h" -#include "Doc/DocXml/SchemaTypesXml/ClassPropertyXml.h" - -#include "Doc/SchemaTypesDoc/CClassInstancePropertyDoc.h" -#include "Doc/SchemaTypesDoc/CClassPropertyDoc.h" -#include "Doc/SchemaTypesDoc/CDataClassDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/SchemaTypesXml/DataClassXml.h" - -using namespace Caf; - -void DataClassXml::add( - const SmartPtrCDataClassDoc dataClassDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("DataClassXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(dataClassDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string namespaceValVal = dataClassDoc->getNamespaceVal(); - CAF_CM_VALIDATE_STRING(namespaceValVal); - thisXml->addAttribute("namespace", namespaceValVal); - - const std::string nameVal = dataClassDoc->getName(); - CAF_CM_VALIDATE_STRING(nameVal); - thisXml->addAttribute("name", nameVal); - - const std::string versionVal = dataClassDoc->getVersion(); - CAF_CM_VALIDATE_STRING(versionVal); - thisXml->addAttribute("version", versionVal); - - const std::deque propertyVal = - dataClassDoc->getPropertyCollection(); - if (! propertyVal.empty()) { - for (TConstIterator > propertyIter(propertyVal); - propertyIter; propertyIter++) { - const SmartPtrCXmlElement propertyXml = - thisXml->createAndAddElement("property"); - ClassPropertyXml::add(*propertyIter, propertyXml); - } - } - - const std::deque instancePropertyVal = - dataClassDoc->getInstancePropertyCollection(); - if (! instancePropertyVal.empty()) { - for (TConstIterator > instancePropertyIter(instancePropertyVal); - instancePropertyIter; instancePropertyIter++) { - const SmartPtrCXmlElement instancePropertyXml = - thisXml->createAndAddElement("instanceProperty"); - ClassInstancePropertyXml::add(*instancePropertyIter, instancePropertyXml); - } - } - - const std::string uniqueVal = dataClassDoc->getUnique() ? "true" : "false"; - if (! uniqueVal.empty()) { - thisXml->addAttribute("unique", uniqueVal); - } - - const std::string transientValVal = dataClassDoc->getTransientVal() ? "true" : "false"; - if (! transientValVal.empty()) { - thisXml->addAttribute("transient", transientValVal); - } - - const std::string displayNameVal = dataClassDoc->getDisplayName(); - if (! displayNameVal.empty()) { - thisXml->addAttribute("displayName", displayNameVal); - } - - const std::string descriptionVal = dataClassDoc->getDescription(); - if (! descriptionVal.empty()) { - thisXml->addAttribute("description", descriptionVal); - } - } - CAF_CM_EXIT; -} - -SmartPtrCDataClassDoc DataClassXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("DataClassXml", "parse"); - - SmartPtrCDataClassDoc dataClassDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string namespaceValStrVal = - thisXml->findRequiredAttribute("namespace"); - const std::string namespaceValVal = namespaceValStrVal; - - const std::string nameStrVal = - thisXml->findRequiredAttribute("name"); - const std::string nameVal = nameStrVal; - - const std::string versionStrVal = - thisXml->findRequiredAttribute("version"); - const std::string versionVal = versionStrVal; - - const CXmlElement::SmartPtrCElementCollection propertyChildrenXml = - thisXml->findOptionalChildren("property"); - - std::deque propertyVal; - if (! propertyChildrenXml.IsNull() && ! propertyChildrenXml->empty()) { - for (TConstIterator propertyXmlIter(*propertyChildrenXml); - propertyXmlIter; propertyXmlIter++) { - const SmartPtrCXmlElement propertyXml = propertyXmlIter->second; - const SmartPtrCClassPropertyDoc propertyDoc = - ClassPropertyXml::parse(propertyXml); - propertyVal.push_back(propertyDoc); - } - } - - const CXmlElement::SmartPtrCElementCollection instancePropertyChildrenXml = - thisXml->findOptionalChildren("instanceProperty"); - - std::deque instancePropertyVal; - if (! instancePropertyChildrenXml.IsNull() && ! instancePropertyChildrenXml->empty()) { - for (TConstIterator instancePropertyXmlIter(*instancePropertyChildrenXml); - instancePropertyXmlIter; instancePropertyXmlIter++) { - const SmartPtrCXmlElement instancePropertyXml = instancePropertyXmlIter->second; - const SmartPtrCClassInstancePropertyDoc instancePropertyDoc = - ClassInstancePropertyXml::parse(instancePropertyXml); - instancePropertyVal.push_back(instancePropertyDoc); - } - } - - const std::string uniqueStrVal = - thisXml->findOptionalAttribute("unique"); - bool uniqueVal = false; - if (! uniqueStrVal.empty()) { - uniqueVal = (uniqueStrVal.compare("true") == 0) ? true : false; - } - - const std::string transientValStrVal = - thisXml->findOptionalAttribute("transient"); - bool transientValVal = false; - if (! transientValStrVal.empty()) { - transientValVal = (transientValStrVal.compare("true") == 0) ? true : false; - } - - const std::string displayNameStrVal = - thisXml->findOptionalAttribute("displayName"); - const std::string displayNameVal = displayNameStrVal; - - const std::string descriptionStrVal = - thisXml->findOptionalAttribute("description"); - const std::string descriptionVal = descriptionStrVal; - - dataClassDoc.CreateInstance(); - dataClassDoc->initialize( - namespaceValVal, - nameVal, - versionVal, - propertyVal, - instancePropertyVal, - uniqueVal, - transientValVal, - displayNameVal, - descriptionVal); - } - CAF_CM_EXIT; - - return dataClassDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/InstanceOperationCollectionXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/InstanceOperationCollectionXml.cpp deleted file mode 100644 index a6e6bdab9..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/InstanceOperationCollectionXml.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/SchemaTypesXml/InstanceOperationXml.h" - -#include "Doc/SchemaTypesDoc/CInstanceOperationCollectionDoc.h" -#include "Doc/SchemaTypesDoc/CInstanceOperationDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/SchemaTypesXml/InstanceOperationCollectionXml.h" - -using namespace Caf; - -void InstanceOperationCollectionXml::add( - const SmartPtrCInstanceOperationCollectionDoc instanceOperationCollectionDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("InstanceOperationCollectionXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(instanceOperationCollectionDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::deque instanceOperationVal = - instanceOperationCollectionDoc->getInstanceOperationCollection(); - CAF_CM_VALIDATE_STL(instanceOperationVal); - - if (! instanceOperationVal.empty()) { - for (TConstIterator > instanceOperationIter(instanceOperationVal); - instanceOperationIter; instanceOperationIter++) { - const SmartPtrCXmlElement instanceOperationXml = - thisXml->createAndAddElement("instanceOperation"); - InstanceOperationXml::add(*instanceOperationIter, instanceOperationXml); - } - } - } - CAF_CM_EXIT; -} - -SmartPtrCInstanceOperationCollectionDoc InstanceOperationCollectionXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("InstanceOperationCollectionXml", "parse"); - - SmartPtrCInstanceOperationCollectionDoc instanceOperationCollectionDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const CXmlElement::SmartPtrCElementCollection instanceOperationChildrenXml = - thisXml->findRequiredChildren("instanceOperation"); - - std::deque instanceOperationVal; - if (! instanceOperationChildrenXml.IsNull() && ! instanceOperationChildrenXml->empty()) { - for (TConstIterator instanceOperationXmlIter(*instanceOperationChildrenXml); - instanceOperationXmlIter; instanceOperationXmlIter++) { - const SmartPtrCXmlElement instanceOperationXml = instanceOperationXmlIter->second; - const SmartPtrCInstanceOperationDoc instanceOperationDoc = - InstanceOperationXml::parse(instanceOperationXml); - instanceOperationVal.push_back(instanceOperationDoc); - } - } - - instanceOperationCollectionDoc.CreateInstance(); - instanceOperationCollectionDoc->initialize( - instanceOperationVal); - } - CAF_CM_EXIT; - - return instanceOperationCollectionDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/InstanceOperationXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/InstanceOperationXml.cpp deleted file mode 100644 index 12747a666..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/InstanceOperationXml.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/SchemaTypesDoc/CInstanceOperationDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/SchemaTypesXml/InstanceOperationXml.h" - -using namespace Caf; - -void InstanceOperationXml::add( - const SmartPtrCInstanceOperationDoc instanceOperationDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("InstanceOperationXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(instanceOperationDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string operationNameVal = instanceOperationDoc->getOperationName(); - CAF_CM_VALIDATE_STRING(operationNameVal); - thisXml->addAttribute("operationName", operationNameVal); - - const std::string monikerVal = instanceOperationDoc->getMoniker(); - CAF_CM_VALIDATE_STRING(monikerVal); - thisXml->addAttribute("moniker", monikerVal); - } - CAF_CM_EXIT; -} - -SmartPtrCInstanceOperationDoc InstanceOperationXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("InstanceOperationXml", "parse"); - - SmartPtrCInstanceOperationDoc instanceOperationDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string operationNameStrVal = - thisXml->findRequiredAttribute("operationName"); - const std::string operationNameVal = operationNameStrVal; - - const std::string monikerStrVal = - thisXml->findRequiredAttribute("moniker"); - const std::string monikerVal = monikerStrVal; - - instanceOperationDoc.CreateInstance(); - instanceOperationDoc->initialize( - operationNameVal, - monikerVal); - } - CAF_CM_EXIT; - - return instanceOperationDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/InstanceParameterXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/InstanceParameterXml.cpp deleted file mode 100644 index 07506cd44..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/InstanceParameterXml.cpp +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/SchemaTypesDoc/CInstanceParameterDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/SchemaTypesXml/InstanceParameterXml.h" - -using namespace Caf; - -void InstanceParameterXml::add( - const SmartPtrCInstanceParameterDoc instanceParameterDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("InstanceParameterXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(instanceParameterDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string nameVal = instanceParameterDoc->getName(); - CAF_CM_VALIDATE_STRING(nameVal); - thisXml->addAttribute("name", nameVal); - - const std::string instanceNamespaceVal = instanceParameterDoc->getInstanceNamespace(); - CAF_CM_VALIDATE_STRING(instanceNamespaceVal); - thisXml->addAttribute("instanceNamespace", instanceNamespaceVal); - - const std::string instanceNameVal = instanceParameterDoc->getInstanceName(); - CAF_CM_VALIDATE_STRING(instanceNameVal); - thisXml->addAttribute("instanceName", instanceNameVal); - - const std::string instanceVersionVal = instanceParameterDoc->getInstanceVersion(); - CAF_CM_VALIDATE_STRING(instanceVersionVal); - thisXml->addAttribute("instanceVersion", instanceVersionVal); - - const std::string isOptionalVal = instanceParameterDoc->getIsOptional() ? "true" : "false"; - CAF_CM_VALIDATE_STRING(isOptionalVal); - thisXml->addAttribute("isOptional", isOptionalVal); - - const std::string isListVal = instanceParameterDoc->getIsList() ? "true" : "false"; - if (! isListVal.empty()) { - thisXml->addAttribute("isList", isListVal); - } - - const std::string displayNameVal = instanceParameterDoc->getDisplayName(); - if (! displayNameVal.empty()) { - thisXml->addAttribute("displayName", displayNameVal); - } - - const std::string descriptionVal = instanceParameterDoc->getDescription(); - if (! descriptionVal.empty()) { - thisXml->addAttribute("description", descriptionVal); - } - } - CAF_CM_EXIT; -} - -SmartPtrCInstanceParameterDoc InstanceParameterXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("InstanceParameterXml", "parse"); - - SmartPtrCInstanceParameterDoc instanceParameterDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string nameStrVal = - thisXml->findRequiredAttribute("name"); - const std::string nameVal = nameStrVal; - - const std::string instanceNamespaceStrVal = - thisXml->findRequiredAttribute("instanceNamespace"); - const std::string instanceNamespaceVal = instanceNamespaceStrVal; - - const std::string instanceNameStrVal = - thisXml->findRequiredAttribute("instanceName"); - const std::string instanceNameVal = instanceNameStrVal; - - const std::string instanceVersionStrVal = - thisXml->findRequiredAttribute("instanceVersion"); - const std::string instanceVersionVal = instanceVersionStrVal; - - const std::string isOptionalStrVal = - thisXml->findRequiredAttribute("isOptional"); - bool isOptionalVal = false; - if (! isOptionalStrVal.empty()) { - isOptionalVal = (isOptionalStrVal.compare("true") == 0) ? true : false; - } - - const std::string isListStrVal = - thisXml->findOptionalAttribute("isList"); - bool isListVal = false; - if (! isListStrVal.empty()) { - isListVal = (isListStrVal.compare("true") == 0) ? true : false; - } - - const std::string displayNameStrVal = - thisXml->findOptionalAttribute("displayName"); - const std::string displayNameVal = displayNameStrVal; - - const std::string descriptionStrVal = - thisXml->findOptionalAttribute("description"); - const std::string descriptionVal = descriptionStrVal; - - instanceParameterDoc.CreateInstance(); - instanceParameterDoc->initialize( - nameVal, - instanceNamespaceVal, - instanceNameVal, - instanceVersionVal, - isOptionalVal, - isListVal, - displayNameVal, - descriptionVal); - } - CAF_CM_EXIT; - - return instanceParameterDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/JoinTypeXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/JoinTypeXml.cpp deleted file mode 100644 index e7f6de6cf..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/JoinTypeXml.cpp +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocUtils/EnumConvertersXml.h" -#include "Doc/DocXml/SchemaTypesXml/ClassFieldXml.h" -#include "Doc/SchemaTypesDoc/SchemaTypesDocTypes.h" - -#include "Doc/SchemaTypesDoc/CClassFieldDoc.h" -#include "Doc/SchemaTypesDoc/CJoinTypeDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/SchemaTypesXml/JoinTypeXml.h" - -using namespace Caf; - -void JoinTypeXml::add( - const SmartPtrCJoinTypeDoc joinTypeDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("JoinTypeXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(joinTypeDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string operandVal = - EnumConvertersXml::convertOperatorTypeToString(joinTypeDoc->getOperand()); - CAF_CM_VALIDATE_STRING(operandVal); - thisXml->addAttribute("operand", operandVal); - - const SmartPtrCClassFieldDoc dataClassLeftVal = - joinTypeDoc->getDataClassLeft(); - CAF_CM_VALIDATE_SMARTPTR(dataClassLeftVal); - - const SmartPtrCXmlElement dataClassLeftXml = - thisXml->createAndAddElement("dataClassLeft"); - ClassFieldXml::add(dataClassLeftVal, dataClassLeftXml); - - const SmartPtrCClassFieldDoc dataClassRightVal = - joinTypeDoc->getDataClassRight(); - CAF_CM_VALIDATE_SMARTPTR(dataClassRightVal); - - const SmartPtrCXmlElement dataClassRightXml = - thisXml->createAndAddElement("dataClassRight"); - ClassFieldXml::add(dataClassRightVal, dataClassRightXml); - - const std::string descriptionVal = joinTypeDoc->getDescription(); - if (! descriptionVal.empty()) { - thisXml->addAttribute("description", descriptionVal); - } - } - CAF_CM_EXIT; -} - -SmartPtrCJoinTypeDoc JoinTypeXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("JoinTypeXml", "parse"); - - SmartPtrCJoinTypeDoc joinTypeDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string operandStrVal = - thisXml->findRequiredAttribute("operand"); - OPERATOR_TYPE operandVal = OPERATOR_NONE; - if (! operandStrVal.empty()) { - operandVal = EnumConvertersXml::convertStringToOperatorType(operandStrVal); - } - - const SmartPtrCXmlElement dataClassLeftXml = - thisXml->findRequiredChild("dataClassLeft"); - - SmartPtrCClassFieldDoc dataClassLeftVal; - if (! dataClassLeftXml.IsNull()) { - dataClassLeftVal = ClassFieldXml::parse(dataClassLeftXml); - } - - const SmartPtrCXmlElement dataClassRightXml = - thisXml->findRequiredChild("dataClassRight"); - - SmartPtrCClassFieldDoc dataClassRightVal; - if (! dataClassRightXml.IsNull()) { - dataClassRightVal = ClassFieldXml::parse(dataClassRightXml); - } - - const std::string descriptionStrVal = - thisXml->findOptionalAttribute("description"); - const std::string descriptionVal = descriptionStrVal; - - joinTypeDoc.CreateInstance(); - joinTypeDoc->initialize( - operandVal, - dataClassLeftVal, - dataClassRightVal, - descriptionVal); - } - CAF_CM_EXIT; - - return joinTypeDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/LogicalRelationshipXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/LogicalRelationshipXml.cpp deleted file mode 100644 index 0183de376..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/LogicalRelationshipXml.cpp +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocUtils/EnumConvertersXml.h" -#include "Doc/DocXml/SchemaTypesXml/ClassCardinalityXml.h" -#include "Doc/DocXml/SchemaTypesXml/JoinTypeXml.h" -#include "Doc/SchemaTypesDoc/SchemaTypesDocTypes.h" - -#include "Doc/SchemaTypesDoc/CClassCardinalityDoc.h" -#include "Doc/SchemaTypesDoc/CJoinTypeDoc.h" -#include "Doc/SchemaTypesDoc/CLogicalRelationshipDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/SchemaTypesXml/LogicalRelationshipXml.h" - -using namespace Caf; - -void LogicalRelationshipXml::add( - const SmartPtrCLogicalRelationshipDoc logicalRelationshipDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("LogicalRelationshipXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(logicalRelationshipDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string namespaceValVal = logicalRelationshipDoc->getNamespaceVal(); - CAF_CM_VALIDATE_STRING(namespaceValVal); - thisXml->addAttribute("namespace", namespaceValVal); - - const std::string nameVal = logicalRelationshipDoc->getName(); - CAF_CM_VALIDATE_STRING(nameVal); - thisXml->addAttribute("name", nameVal); - - const std::string versionVal = logicalRelationshipDoc->getVersion(); - CAF_CM_VALIDATE_STRING(versionVal); - thisXml->addAttribute("version", versionVal); - - const std::string arityVal = - EnumConvertersXml::convertArityTypeToString(logicalRelationshipDoc->getArity()); - CAF_CM_VALIDATE_STRING(arityVal); - thisXml->addAttribute("arity", arityVal); - - const SmartPtrCClassCardinalityDoc dataClassLeftVal = - logicalRelationshipDoc->getDataClassLeft(); - CAF_CM_VALIDATE_SMARTPTR(dataClassLeftVal); - - const SmartPtrCXmlElement dataClassLeftXml = - thisXml->createAndAddElement("dataClassLeft"); - ClassCardinalityXml::add(dataClassLeftVal, dataClassLeftXml); - - const SmartPtrCClassCardinalityDoc dataClassRightVal = - logicalRelationshipDoc->getDataClassRight(); - CAF_CM_VALIDATE_SMARTPTR(dataClassRightVal); - - const SmartPtrCXmlElement dataClassRightXml = - thisXml->createAndAddElement("dataClassRight"); - ClassCardinalityXml::add(dataClassRightVal, dataClassRightXml); - - const std::deque joinVal = - logicalRelationshipDoc->getJoinCollection(); - CAF_CM_VALIDATE_STL(joinVal); - - if (! joinVal.empty()) { - for (TConstIterator > joinIter(joinVal); - joinIter; joinIter++) { - const SmartPtrCXmlElement joinXml = - thisXml->createAndAddElement("join"); - JoinTypeXml::add(*joinIter, joinXml); - } - } - - const std::string descriptionVal = logicalRelationshipDoc->getDescription(); - if (! descriptionVal.empty()) { - thisXml->addAttribute("description", descriptionVal); - } - } - CAF_CM_EXIT; -} - -SmartPtrCLogicalRelationshipDoc LogicalRelationshipXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("LogicalRelationshipXml", "parse"); - - SmartPtrCLogicalRelationshipDoc logicalRelationshipDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string namespaceValStrVal = - thisXml->findRequiredAttribute("namespace"); - const std::string namespaceValVal = namespaceValStrVal; - - const std::string nameStrVal = - thisXml->findRequiredAttribute("name"); - const std::string nameVal = nameStrVal; - - const std::string versionStrVal = - thisXml->findRequiredAttribute("version"); - const std::string versionVal = versionStrVal; - - const std::string arityStrVal = - thisXml->findRequiredAttribute("arity"); - ARITY_TYPE arityVal = ARITY_NONE; - if (! arityStrVal.empty()) { - arityVal = EnumConvertersXml::convertStringToArityType(arityStrVal); - } - - const SmartPtrCXmlElement dataClassLeftXml = - thisXml->findRequiredChild("dataClassLeft"); - - SmartPtrCClassCardinalityDoc dataClassLeftVal; - if (! dataClassLeftXml.IsNull()) { - dataClassLeftVal = ClassCardinalityXml::parse(dataClassLeftXml); - } - - const SmartPtrCXmlElement dataClassRightXml = - thisXml->findRequiredChild("dataClassRight"); - - SmartPtrCClassCardinalityDoc dataClassRightVal; - if (! dataClassRightXml.IsNull()) { - dataClassRightVal = ClassCardinalityXml::parse(dataClassRightXml); - } - - const CXmlElement::SmartPtrCElementCollection joinChildrenXml = - thisXml->findRequiredChildren("join"); - - std::deque joinVal; - if (! joinChildrenXml.IsNull() && ! joinChildrenXml->empty()) { - for (TConstIterator joinXmlIter(*joinChildrenXml); - joinXmlIter; joinXmlIter++) { - const SmartPtrCXmlElement joinXml = joinXmlIter->second; - const SmartPtrCJoinTypeDoc joinDoc = - JoinTypeXml::parse(joinXml); - joinVal.push_back(joinDoc); - } - } - - const std::string descriptionStrVal = - thisXml->findOptionalAttribute("description"); - const std::string descriptionVal = descriptionStrVal; - - logicalRelationshipDoc.CreateInstance(); - logicalRelationshipDoc->initialize( - namespaceValVal, - nameVal, - versionVal, - arityVal, - dataClassLeftVal, - dataClassRightVal, - joinVal, - descriptionVal); - } - CAF_CM_EXIT; - - return logicalRelationshipDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/MethodParameterXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/MethodParameterXml.cpp deleted file mode 100644 index 37137de6d..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/MethodParameterXml.cpp +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocUtils/EnumConvertersXml.h" -#include "Doc/CafCoreTypesDoc/CafCoreTypesDocTypes.h" - -#include "Doc/SchemaTypesDoc/CMethodParameterDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/SchemaTypesXml/MethodParameterXml.h" - -using namespace Caf; - -void MethodParameterXml::add( - const SmartPtrCMethodParameterDoc methodParameterDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("MethodParameterXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(methodParameterDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string nameVal = methodParameterDoc->getName(); - CAF_CM_VALIDATE_STRING(nameVal); - thisXml->addAttribute("name", nameVal); - - const std::string typeVal = - EnumConvertersXml::convertParameterTypeToString(methodParameterDoc->getType()); - CAF_CM_VALIDATE_STRING(typeVal); - thisXml->addAttribute("type", typeVal); - - const std::string isOptionalVal = methodParameterDoc->getIsOptional() ? "true" : "false"; - CAF_CM_VALIDATE_STRING(isOptionalVal); - thisXml->addAttribute("isOptional", isOptionalVal); - - const std::string isListVal = methodParameterDoc->getIsList() ? "true" : "false"; - if (! isListVal.empty()) { - thisXml->addAttribute("isList", isListVal); - } - - const std::string defaultValVal = methodParameterDoc->getDefaultVal(); - if (! defaultValVal.empty()) { - thisXml->addAttribute("default", defaultValVal); - } - - const std::string displayNameVal = methodParameterDoc->getDisplayName(); - if (! displayNameVal.empty()) { - thisXml->addAttribute("displayName", displayNameVal); - } - - const std::string descriptionVal = methodParameterDoc->getDescription(); - if (! descriptionVal.empty()) { - thisXml->addAttribute("description", descriptionVal); - } - } - CAF_CM_EXIT; -} - -SmartPtrCMethodParameterDoc MethodParameterXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("MethodParameterXml", "parse"); - - SmartPtrCMethodParameterDoc methodParameterDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string nameStrVal = - thisXml->findRequiredAttribute("name"); - const std::string nameVal = nameStrVal; - - const std::string typeStrVal = - thisXml->findRequiredAttribute("type"); - PARAMETER_TYPE typeVal = PARAMETER_NONE; - if (! typeStrVal.empty()) { - typeVal = EnumConvertersXml::convertStringToParameterType(typeStrVal); - } - - const std::string isOptionalStrVal = - thisXml->findRequiredAttribute("isOptional"); - bool isOptionalVal = false; - if (! isOptionalStrVal.empty()) { - isOptionalVal = (isOptionalStrVal.compare("true") == 0) ? true : false; - } - - const std::string isListStrVal = - thisXml->findOptionalAttribute("isList"); - bool isListVal = false; - if (! isListStrVal.empty()) { - isListVal = (isListStrVal.compare("true") == 0) ? true : false; - } - - const std::string defaultValStrVal = - thisXml->findOptionalAttribute("default"); - const std::string defaultValVal = defaultValStrVal; - - const std::string displayNameStrVal = - thisXml->findOptionalAttribute("displayName"); - const std::string displayNameVal = displayNameStrVal; - - const std::string descriptionStrVal = - thisXml->findOptionalAttribute("description"); - const std::string descriptionVal = descriptionStrVal; - - methodParameterDoc.CreateInstance(); - methodParameterDoc->initialize( - nameVal, - typeVal, - isOptionalVal, - isListVal, - defaultValVal, - displayNameVal, - descriptionVal); - } - CAF_CM_EXIT; - - return methodParameterDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/MethodXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/MethodXml.cpp deleted file mode 100644 index 8fed64113..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/MethodXml.cpp +++ /dev/null @@ -1,214 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocXml/SchemaTypesXml/ClassIdentifierXml.h" -#include "Doc/DocXml/SchemaTypesXml/InstanceParameterXml.h" -#include "Doc/DocXml/SchemaTypesXml/MethodParameterXml.h" - -#include "Doc/SchemaTypesDoc/CClassIdentifierDoc.h" -#include "Doc/SchemaTypesDoc/CInstanceParameterDoc.h" -#include "Doc/SchemaTypesDoc/CMethodDoc.h" -#include "Doc/SchemaTypesDoc/CMethodParameterDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/SchemaTypesXml/MethodXml.h" - -using namespace Caf; - -void MethodXml::add( - const SmartPtrCMethodDoc methodDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("MethodXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(methodDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string nameVal = methodDoc->getName(); - CAF_CM_VALIDATE_STRING(nameVal); - thisXml->addAttribute("name", nameVal); - - const std::deque parameterVal = - methodDoc->getParameterCollection(); - if (! parameterVal.empty()) { - for (TConstIterator > parameterIter(parameterVal); - parameterIter; parameterIter++) { - const SmartPtrCXmlElement parameterXml = - thisXml->createAndAddElement("parameter"); - MethodParameterXml::add(*parameterIter, parameterXml); - } - } - - const std::deque instanceParameterVal = - methodDoc->getInstanceParameterCollection(); - if (! instanceParameterVal.empty()) { - for (TConstIterator > instanceParameterIter(instanceParameterVal); - instanceParameterIter; instanceParameterIter++) { - const SmartPtrCXmlElement instanceParameterXml = - thisXml->createAndAddElement("instanceParameter"); - InstanceParameterXml::add(*instanceParameterIter, instanceParameterXml); - } - } - - const std::deque returnValVal = - methodDoc->getReturnValCollection(); - if (! returnValVal.empty()) { - for (TConstIterator > returnValIter(returnValVal); - returnValIter; returnValIter++) { - const SmartPtrCXmlElement returnValXml = - thisXml->createAndAddElement("return"); - ClassIdentifierXml::add(*returnValIter, returnValXml); - } - } - - const std::deque eventValVal = - methodDoc->getEventValCollection(); - if (! eventValVal.empty()) { - for (TConstIterator > eventValIter(eventValVal); - eventValIter; eventValIter++) { - const SmartPtrCXmlElement eventValXml = - thisXml->createAndAddElement("event"); - ClassIdentifierXml::add(*eventValIter, eventValXml); - } - } - - const std::deque errorVal = - methodDoc->getErrorCollection(); - if (! errorVal.empty()) { - for (TConstIterator > errorIter(errorVal); - errorIter; errorIter++) { - const SmartPtrCXmlElement errorXml = - thisXml->createAndAddElement("error"); - ClassIdentifierXml::add(*errorIter, errorXml); - } - } - - const std::string displayNameVal = methodDoc->getDisplayName(); - if (! displayNameVal.empty()) { - thisXml->addAttribute("displayName", displayNameVal); - } - - const std::string descriptionVal = methodDoc->getDescription(); - if (! descriptionVal.empty()) { - thisXml->addAttribute("description", descriptionVal); - } - } - CAF_CM_EXIT; -} - -SmartPtrCMethodDoc MethodXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("MethodXml", "parse"); - - SmartPtrCMethodDoc methodDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string nameStrVal = - thisXml->findRequiredAttribute("name"); - const std::string nameVal = nameStrVal; - - const CXmlElement::SmartPtrCElementCollection parameterChildrenXml = - thisXml->findOptionalChildren("parameter"); - - std::deque parameterVal; - if (! parameterChildrenXml.IsNull() && ! parameterChildrenXml->empty()) { - for (TConstIterator parameterXmlIter(*parameterChildrenXml); - parameterXmlIter; parameterXmlIter++) { - const SmartPtrCXmlElement parameterXml = parameterXmlIter->second; - const SmartPtrCMethodParameterDoc parameterDoc = - MethodParameterXml::parse(parameterXml); - parameterVal.push_back(parameterDoc); - } - } - - const CXmlElement::SmartPtrCElementCollection instanceParameterChildrenXml = - thisXml->findOptionalChildren("instanceParameter"); - - std::deque instanceParameterVal; - if (! instanceParameterChildrenXml.IsNull() && ! instanceParameterChildrenXml->empty()) { - for (TConstIterator instanceParameterXmlIter(*instanceParameterChildrenXml); - instanceParameterXmlIter; instanceParameterXmlIter++) { - const SmartPtrCXmlElement instanceParameterXml = instanceParameterXmlIter->second; - const SmartPtrCInstanceParameterDoc instanceParameterDoc = - InstanceParameterXml::parse(instanceParameterXml); - instanceParameterVal.push_back(instanceParameterDoc); - } - } - - const CXmlElement::SmartPtrCElementCollection returnValChildrenXml = - thisXml->findOptionalChildren("return"); - - std::deque returnValVal; - if (! returnValChildrenXml.IsNull() && ! returnValChildrenXml->empty()) { - for (TConstIterator returnValXmlIter(*returnValChildrenXml); - returnValXmlIter; returnValXmlIter++) { - const SmartPtrCXmlElement returnValXml = returnValXmlIter->second; - const SmartPtrCClassIdentifierDoc returnValDoc = - ClassIdentifierXml::parse(returnValXml); - returnValVal.push_back(returnValDoc); - } - } - - const CXmlElement::SmartPtrCElementCollection eventValChildrenXml = - thisXml->findOptionalChildren("event"); - - std::deque eventValVal; - if (! eventValChildrenXml.IsNull() && ! eventValChildrenXml->empty()) { - for (TConstIterator eventValXmlIter(*eventValChildrenXml); - eventValXmlIter; eventValXmlIter++) { - const SmartPtrCXmlElement eventValXml = eventValXmlIter->second; - const SmartPtrCClassIdentifierDoc eventValDoc = - ClassIdentifierXml::parse(eventValXml); - eventValVal.push_back(eventValDoc); - } - } - - const CXmlElement::SmartPtrCElementCollection errorChildrenXml = - thisXml->findOptionalChildren("error"); - - std::deque errorVal; - if (! errorChildrenXml.IsNull() && ! errorChildrenXml->empty()) { - for (TConstIterator errorXmlIter(*errorChildrenXml); - errorXmlIter; errorXmlIter++) { - const SmartPtrCXmlElement errorXml = errorXmlIter->second; - const SmartPtrCClassIdentifierDoc errorDoc = - ClassIdentifierXml::parse(errorXml); - errorVal.push_back(errorDoc); - } - } - - const std::string displayNameStrVal = - thisXml->findOptionalAttribute("displayName"); - const std::string displayNameVal = displayNameStrVal; - - const std::string descriptionStrVal = - thisXml->findOptionalAttribute("description"); - const std::string descriptionVal = descriptionStrVal; - - methodDoc.CreateInstance(); - methodDoc->initialize( - nameVal, - parameterVal, - instanceParameterVal, - returnValVal, - eventValVal, - errorVal, - displayNameVal, - descriptionVal); - } - CAF_CM_EXIT; - - return methodDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/PhysicalRelationshipXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/PhysicalRelationshipXml.cpp deleted file mode 100644 index 2314474ef..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/PhysicalRelationshipXml.cpp +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocUtils/EnumConvertersXml.h" -#include "Doc/DocXml/SchemaTypesXml/ClassCardinalityXml.h" -#include "Doc/SchemaTypesDoc/SchemaTypesDocTypes.h" - -#include "Doc/SchemaTypesDoc/CClassCardinalityDoc.h" -#include "Doc/SchemaTypesDoc/CPhysicalRelationshipDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/SchemaTypesXml/PhysicalRelationshipXml.h" - -using namespace Caf; - -void PhysicalRelationshipXml::add( - const SmartPtrCPhysicalRelationshipDoc physicalRelationshipDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("PhysicalRelationshipXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(physicalRelationshipDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string namespaceValVal = physicalRelationshipDoc->getNamespaceVal(); - CAF_CM_VALIDATE_STRING(namespaceValVal); - thisXml->addAttribute("namespace", namespaceValVal); - - const std::string nameVal = physicalRelationshipDoc->getName(); - CAF_CM_VALIDATE_STRING(nameVal); - thisXml->addAttribute("name", nameVal); - - const std::string versionVal = physicalRelationshipDoc->getVersion(); - CAF_CM_VALIDATE_STRING(versionVal); - thisXml->addAttribute("version", versionVal); - - const std::string arityVal = - EnumConvertersXml::convertArityTypeToString(physicalRelationshipDoc->getArity()); - CAF_CM_VALIDATE_STRING(arityVal); - thisXml->addAttribute("arity", arityVal); - - const SmartPtrCClassCardinalityDoc dataClassLeftVal = - physicalRelationshipDoc->getDataClassLeft(); - CAF_CM_VALIDATE_SMARTPTR(dataClassLeftVal); - - const SmartPtrCXmlElement dataClassLeftXml = - thisXml->createAndAddElement("dataClassLeft"); - ClassCardinalityXml::add(dataClassLeftVal, dataClassLeftXml); - - const SmartPtrCClassCardinalityDoc dataClassRightVal = - physicalRelationshipDoc->getDataClassRight(); - CAF_CM_VALIDATE_SMARTPTR(dataClassRightVal); - - const SmartPtrCXmlElement dataClassRightXml = - thisXml->createAndAddElement("dataClassRight"); - ClassCardinalityXml::add(dataClassRightVal, dataClassRightXml); - - const std::string descriptionVal = physicalRelationshipDoc->getDescription(); - if (! descriptionVal.empty()) { - thisXml->addAttribute("description", descriptionVal); - } - } - CAF_CM_EXIT; -} - -SmartPtrCPhysicalRelationshipDoc PhysicalRelationshipXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("PhysicalRelationshipXml", "parse"); - - SmartPtrCPhysicalRelationshipDoc physicalRelationshipDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string namespaceValStrVal = - thisXml->findRequiredAttribute("namespace"); - const std::string namespaceValVal = namespaceValStrVal; - - const std::string nameStrVal = - thisXml->findRequiredAttribute("name"); - const std::string nameVal = nameStrVal; - - const std::string versionStrVal = - thisXml->findRequiredAttribute("version"); - const std::string versionVal = versionStrVal; - - const std::string arityStrVal = - thisXml->findRequiredAttribute("arity"); - ARITY_TYPE arityVal = ARITY_NONE; - if (! arityStrVal.empty()) { - arityVal = EnumConvertersXml::convertStringToArityType(arityStrVal); - } - - const SmartPtrCXmlElement dataClassLeftXml = - thisXml->findRequiredChild("dataClassLeft"); - - SmartPtrCClassCardinalityDoc dataClassLeftVal; - if (! dataClassLeftXml.IsNull()) { - dataClassLeftVal = ClassCardinalityXml::parse(dataClassLeftXml); - } - - const SmartPtrCXmlElement dataClassRightXml = - thisXml->findRequiredChild("dataClassRight"); - - SmartPtrCClassCardinalityDoc dataClassRightVal; - if (! dataClassRightXml.IsNull()) { - dataClassRightVal = ClassCardinalityXml::parse(dataClassRightXml); - } - - const std::string descriptionStrVal = - thisXml->findOptionalAttribute("description"); - const std::string descriptionVal = descriptionStrVal; - - physicalRelationshipDoc.CreateInstance(); - physicalRelationshipDoc->initialize( - namespaceValVal, - nameVal, - versionVal, - arityVal, - dataClassLeftVal, - dataClassRightVal, - descriptionVal); - } - CAF_CM_EXIT; - - return physicalRelationshipDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/RelationshipXml.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/RelationshipXml.cpp deleted file mode 100644 index 16f73d5f9..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/RelationshipXml.cpp +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#include "stdafx.h" - -#include "Doc/DocUtils/EnumConvertersXml.h" -#include "Doc/DocXml/SchemaTypesXml/ClassCardinalityXml.h" -#include "Doc/SchemaTypesDoc/SchemaTypesDocTypes.h" - -#include "Doc/SchemaTypesDoc/CClassCardinalityDoc.h" -#include "Doc/SchemaTypesDoc/CRelationshipDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Doc/DocXml/SchemaTypesXml/RelationshipXml.h" - -using namespace Caf; - -void RelationshipXml::add( - const SmartPtrCRelationshipDoc relationshipDoc, - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("RelationshipXml", "add"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(relationshipDoc); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string namespaceValVal = relationshipDoc->getNamespaceVal(); - CAF_CM_VALIDATE_STRING(namespaceValVal); - thisXml->addAttribute("namespace", namespaceValVal); - - const std::string nameVal = relationshipDoc->getName(); - CAF_CM_VALIDATE_STRING(nameVal); - thisXml->addAttribute("name", nameVal); - - const std::string versionVal = relationshipDoc->getVersion(); - CAF_CM_VALIDATE_STRING(versionVal); - thisXml->addAttribute("version", versionVal); - - const std::string arityVal = - EnumConvertersXml::convertArityTypeToString(relationshipDoc->getArity()); - CAF_CM_VALIDATE_STRING(arityVal); - thisXml->addAttribute("arity", arityVal); - - const SmartPtrCClassCardinalityDoc dataClassLeftVal = - relationshipDoc->getDataClassLeft(); - CAF_CM_VALIDATE_SMARTPTR(dataClassLeftVal); - - const SmartPtrCXmlElement dataClassLeftXml = - thisXml->createAndAddElement("dataClassLeft"); - ClassCardinalityXml::add(dataClassLeftVal, dataClassLeftXml); - - const SmartPtrCClassCardinalityDoc dataClassRightVal = - relationshipDoc->getDataClassRight(); - CAF_CM_VALIDATE_SMARTPTR(dataClassRightVal); - - const SmartPtrCXmlElement dataClassRightXml = - thisXml->createAndAddElement("dataClassRight"); - ClassCardinalityXml::add(dataClassRightVal, dataClassRightXml); - - const std::string descriptionVal = relationshipDoc->getDescription(); - if (! descriptionVal.empty()) { - thisXml->addAttribute("description", descriptionVal); - } - } - CAF_CM_EXIT; -} - -SmartPtrCRelationshipDoc RelationshipXml::parse( - const SmartPtrCXmlElement thisXml) { - CAF_CM_STATIC_FUNC_VALIDATE("RelationshipXml", "parse"); - - SmartPtrCRelationshipDoc relationshipDoc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(thisXml); - - const std::string namespaceValStrVal = - thisXml->findRequiredAttribute("namespace"); - const std::string namespaceValVal = namespaceValStrVal; - - const std::string nameStrVal = - thisXml->findRequiredAttribute("name"); - const std::string nameVal = nameStrVal; - - const std::string versionStrVal = - thisXml->findRequiredAttribute("version"); - const std::string versionVal = versionStrVal; - - const std::string arityStrVal = - thisXml->findRequiredAttribute("arity"); - ARITY_TYPE arityVal = ARITY_NONE; - if (! arityStrVal.empty()) { - arityVal = EnumConvertersXml::convertStringToArityType(arityStrVal); - } - - const SmartPtrCXmlElement dataClassLeftXml = - thisXml->findRequiredChild("dataClassLeft"); - - SmartPtrCClassCardinalityDoc dataClassLeftVal; - if (! dataClassLeftXml.IsNull()) { - dataClassLeftVal = ClassCardinalityXml::parse(dataClassLeftXml); - } - - const SmartPtrCXmlElement dataClassRightXml = - thisXml->findRequiredChild("dataClassRight"); - - SmartPtrCClassCardinalityDoc dataClassRightVal; - if (! dataClassRightXml.IsNull()) { - dataClassRightVal = ClassCardinalityXml::parse(dataClassRightXml); - } - - const std::string descriptionStrVal = - thisXml->findOptionalAttribute("description"); - const std::string descriptionVal = descriptionStrVal; - - relationshipDoc.CreateInstance(); - relationshipDoc->initialize( - namespaceValVal, - nameVal, - versionVal, - arityVal, - dataClassLeftVal, - dataClassRightVal, - descriptionVal); - } - CAF_CM_EXIT; - - return relationshipDoc; -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/stdafx.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/stdafx.h deleted file mode 100644 index 833de41bf..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocXml/SchemaTypesXml/stdafx.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - * This code was generated by the script "build/dev/codeGen/genCppXml". Please - * speak to Brian W. before modifying it by hand. - * - */ - -#ifndef STDAFX_H_ -#define STDAFX_H_ - -#ifdef WIN32 - #define SCHEMATYPESXML_LINKAGE __declspec(dllexport) -#else - #define SCHEMATYPESXML_LINKAGE -#endif - -#include - -#include -#include - - -#endif /* STDAFX_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Exception/CBacktraceUtils.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Exception/CBacktraceUtils.cpp deleted file mode 100644 index f78eb9b5a..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Exception/CBacktraceUtils.cpp +++ /dev/null @@ -1,142 +0,0 @@ -/*k - * Author: bwilliams - * Created: Oct 30, 2014 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "stdlib.h" -#include "CBacktraceUtils.h" -#include - -#ifdef WIN32 -#include "StackWalker.h" -#else -#include -#include -#endif - -using namespace Caf; - -#ifdef WIN32 -class StackWalkerToDeque : public StackWalker { -public: - StackWalkerToDeque() : depth(0) {} - - std::deque getBacktrace() { - return backtrace; - } - -private: - static const int STACK_DEPTH_IGNORE = 3; - int depth; - std::deque backtrace; - -protected: - virtual void OnSymInit(LPCSTR szSearchPath, DWORD symOptions, LPCSTR szUserName) { - // Do nothing to suppress default OnSymInit output - } - - virtual void OnLoadModule(LPCSTR img, LPCSTR mod, DWORD64 baseAddr, DWORD size, DWORD result, LPCSTR symType, LPCSTR pdbName, ULONGLONG fileVersion) { - // Do nothing to suppress default OnLoadModule output - } - - virtual void OnDbgHelpErr(LPCSTR szFuncName, DWORD gle, DWORD64 addr){ - // Do nothing to suppress default OnDbgHelpErr output - } - - virtual void OnOutput(LPCSTR szText) { - try { - std::string line = szText; - if (STACK_DEPTH_IGNORE < depth++) { - backtrace.push_back(CStringUtils::trimRight(line)); - } - } catch (...) { - backtrace.push_back("CBacktraceUtils::getBacktrace() threw an exception"); - } - } -}; - -std::deque CBacktraceUtils::getBacktrace() { - StackWalkerToDeque sw; - sw.ShowCallstack(); - return sw.getBacktrace(); -} - -#else -std::deque CBacktraceUtils::getBacktrace() { - char** messages = NULL; - std::deque backtrace; - try { - const int32 maxStackEntries = 50; - void *stackEntries[maxStackEntries]; - const size_t size = ::backtrace(stackEntries, maxStackEntries); - - messages = ::backtrace_symbols(stackEntries, size); - - /* skip first stack frame (points here) */ - for (size_t i = 1; i < size && messages != NULL; ++i) { - const std::string name = demangleName(messages[i]); - backtrace.push_back(name); - } - } - catch (...) { - backtrace.push_back("CBacktraceUtils::getBacktrace() threw an exception"); - } - - if (NULL != messages) { - ::free(messages); - } - - return backtrace; -} - -std::string CBacktraceUtils::demangleName(char* name) { - std::string rc; - if (NULL != name) { - char* mangled_name = 0; - char* offset_begin = 0; - char* offset_end = 0; - - // find parentheses and +address offset surrounding mangled name - for (char *p = name; *p; ++p) { - if (*p == '(') { - mangled_name = p; - } else if (*p == '+') { - offset_begin = p; - } else if (*p == ')') { - offset_end = p; - break; - } - } - - // if the line could be processed, attempt to demangle the symbol - if (mangled_name && offset_begin && offset_end && mangled_name < offset_begin) { - *mangled_name++ = '\0'; - *offset_begin++ = '\0'; - *offset_end++ = '\0'; - - int32 status; - char* real_name = abi::__cxa_demangle(mangled_name, 0, 0, &status); - - // if demangling is successful, output the demangled function name - if (status == 0) { - rc = real_name; - } - // otherwise, output the mangled function name - else { - rc = mangled_name; - } - - ::free(real_name); - } - // otherwise, print the whole line - else { - rc = name; - } - } - - return rc; -} -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Exception/CBacktraceUtils.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Exception/CBacktraceUtils.h deleted file mode 100644 index 57503a911..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Exception/CBacktraceUtils.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 30, 2014 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CBacktraceUtils_H_ -#define CBacktraceUtils_H_ - -namespace Caf { - -// See http://stackoverflow.com/questions/77005/how-to-generate-a-stacktrace-when-my-gcc-c-app-crashes -class EXCEPTION_LINKAGE CBacktraceUtils { -public: - static std::deque getBacktrace(); - -#ifndef WIN32 -private: - static std::string demangleName(char* name); -#endif - -private: - CBacktraceUtils(); - ~CBacktraceUtils(); - CBacktraceUtils(const CBacktraceUtils&); - CBacktraceUtils& operator=(const CBacktraceUtils&); -}; - -} - -#endif /* CBacktraceUtils_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Exception/CCafException.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Exception/CCafException.cpp deleted file mode 100644 index f1be31bee..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Exception/CCafException.cpp +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Author: mdonahue - * Created: Jan 13, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "Exception/CCafException.h" -#include -#include -#include "CBacktraceUtils.h" - -using namespace Caf; - -CCafException::CCafException() : - _refCnt(0), - _isPopulated(false), - _exceptionClassName("CCafException"), - _errorCode(S_OK), - _backtrace(NULL) { -} - -CCafException::CCafException(const std::string& exceptionClassName) : - _refCnt(0), - _isPopulated(false), - _exceptionClassName(exceptionClassName), - _errorCode(S_OK), - _backtrace(NULL) { -} - -CCafException::~CCafException() { - if (_backtrace != NULL) { - delete _backtrace; - } -} - -void CCafException::throwSelf() { - throw this; -} - -void CCafException::throwAddRefedSelf() { - this->AddRef(); - throw this; -} - -void CCafException::AddRef() { - g_atomic_int_inc(&_refCnt); -} - -void CCafException::Release() { - if (g_atomic_int_dec_and_test(&_refCnt)) { - delete this; - } -} - -void CCafException::QueryInterface(const IID&, void**) { - throw std::runtime_error("QueryInterface not supported"); -} - -void CCafException::populate( - const std::string& message, - const HRESULT errorCode, - const std::string& className, - const std::string& funcName) { - _message = message; - _className = className; - _funcName = funcName; - _errorCode = HRESULT_FROM_WIN32(errorCode); - if (_backtrace != NULL) { - delete _backtrace; - } - _backtrace = new std::deque(CBacktraceUtils::getBacktrace()); - _isPopulated = true; -} - -void CCafException::populateVA( - const HRESULT errorCode, - const std::string& className, - const std::string& funcName, - const char* format, - ...) { - char buffer[1024]; - va_list args; - va_start(args, format); -#ifdef WIN32 - // Returns -1 if the buffer is truncated. - const int rc = vsnprintf_s(buffer, 1024, _TRUNCATE, format, args); - if ((rc > 0) || (rc == -1)) { -#else - if (vsnprintf(buffer, 1024, format, args) > 0) { -#endif - _message = buffer; - } else { - _message = "*** PopulateVA() INTERNAL ERROR: UNABLE TO FORMAT MESSAGE ***"; - } - va_end(args); - _className = className; - _funcName = funcName; - _errorCode = HRESULT_FROM_WIN32(errorCode); - if (_backtrace != NULL) { - delete _backtrace; - } - _backtrace = new std::deque(CBacktraceUtils::getBacktrace()); - _isPopulated = true; -} - -bool CCafException::isPopulated() const { - return _isPopulated; -} - -std::string CCafException::getExceptionClassName() const { - return _exceptionClassName; -} - -std::string CCafException::getMsg() const { - return _message; -} - -std::string CCafException::getClassName() const { - return _className; -} - -std::string CCafException::getFuncName() const { - return _funcName; -} - -HRESULT CCafException::getError() const { - return _errorCode; -} - -std::deque* CCafException::getBacktrace() const { - return _backtrace; -} - -std::string CCafException::getFullMsg() const { - std::string msg("["); - msg += _exceptionClassName; - msg += "] "; - msg += _className; - msg += "::"; - msg += _funcName; - msg += "() "; - msg += _message; - return msg; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Exception/CCafExceptionEx.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Exception/CCafExceptionEx.cpp deleted file mode 100644 index 940e534bd..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Exception/CCafExceptionEx.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Created on: Oct 6, 2011 - * Author: mdonahue - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "CCafExceptionEx.h" - -using namespace Caf; - -// General Runtime Exceptions -CAF_CM_DEFINE_EXCEPTION_CLASS(AccessDeniedException); -CAF_CM_DEFINE_EXCEPTION_CLASS(NullPointerException); -CAF_CM_DEFINE_EXCEPTION_CLASS(BufferOverflowException); -CAF_CM_DEFINE_EXCEPTION_CLASS(BufferUnderflowException); -CAF_CM_DEFINE_EXCEPTION_CLASS(InvalidArgumentException); -CAF_CM_DEFINE_EXCEPTION_CLASS(IllegalStateException); -CAF_CM_DEFINE_EXCEPTION_CLASS(IndexOutOfBoundsException); -CAF_CM_DEFINE_EXCEPTION_CLASS(NoSuchElementException); -CAF_CM_DEFINE_EXCEPTION_CLASS(DuplicateElementException); -CAF_CM_DEFINE_EXCEPTION_CLASS(UnsupportedOperationException); -CAF_CM_DEFINE_EXCEPTION_CLASS(UnsupportedVersionException); -CAF_CM_DEFINE_EXCEPTION_CLASS(InvalidHandleException); -CAF_CM_DEFINE_EXCEPTION_CLASS(TimeoutException); -CAF_CM_DEFINE_EXCEPTION_CLASS(NoSuchInterfaceException); -CAF_CM_DEFINE_EXCEPTION_CLASS(ProcessFailedException); - -// AppConfig Exceptions -CAF_CM_DEFINE_EXCEPTION_CLASS(NoSuchConfigSectionException); -CAF_CM_DEFINE_EXCEPTION_CLASS(NoSuchConfigValueException); - -// Dynamic Library Exception -CAF_CM_DEFINE_EXCEPTION_CLASS(LibraryFailedToLoadException); -CAF_CM_DEFINE_EXCEPTION_CLASS(NoSuchMethodException); - -// I/O Exceptions -CAF_CM_DEFINE_EXCEPTION_CLASS(IOException); -CAF_CM_DEFINE_EXCEPTION_CLASS(EOFException); -CAF_CM_DEFINE_EXCEPTION_CLASS(FileNotFoundException); -CAF_CM_DEFINE_EXCEPTION_CLASS(PathNotFoundException); -CAF_CM_DEFINE_EXCEPTION_CLASS(FileLockedException); - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Exception/CCafExceptionEx.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Exception/CCafExceptionEx.h deleted file mode 100644 index 4262b7208..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Exception/CCafExceptionEx.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Created on: Oct 6, 2011 - * Author: mdonahue - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CCAFEXCEPTIONEX_H_ -#define CCAFEXCEPTIONEX_H_ - - -#define CAF_CM_DECLARE_EXCEPTION_CLASS(_exclass_) \ -class EXCEPTION_LINKAGE _exclass_ : public Caf::CCafException { \ -public: \ - _exclass_(); \ - virtual ~_exclass_(); \ - void throwSelf(); \ - void throwAddRefedSelf(); \ -private: \ - _exclass_(const _exclass_ &); \ - _exclass_ & operator=(const _exclass_ &); \ -}; \ -typedef TCafSmartPtr<_exclass_, TCafObject<_exclass_> > SmartPtr##_exclass_ - -#define CAF_CM_DEFINE_EXCEPTION_CLASS(_exclass_) \ - _exclass_::_exclass_() : CCafException( #_exclass_ ) {} \ - _exclass_::~_exclass_() {} \ - void _exclass_::throwSelf() { throw this; } \ - void _exclass_::throwAddRefedSelf() { this->AddRef(); throw this; } - -#include "Exception/CCafException.h" - -namespace Caf { - -// General Runtime Exceptions -CAF_CM_DECLARE_EXCEPTION_CLASS(AccessDeniedException); -CAF_CM_DECLARE_EXCEPTION_CLASS(NullPointerException); -CAF_CM_DECLARE_EXCEPTION_CLASS(BufferOverflowException); -CAF_CM_DECLARE_EXCEPTION_CLASS(BufferUnderflowException); -CAF_CM_DECLARE_EXCEPTION_CLASS(InvalidArgumentException); -CAF_CM_DECLARE_EXCEPTION_CLASS(IllegalStateException); -CAF_CM_DECLARE_EXCEPTION_CLASS(IndexOutOfBoundsException); -CAF_CM_DECLARE_EXCEPTION_CLASS(NoSuchElementException); -CAF_CM_DECLARE_EXCEPTION_CLASS(DuplicateElementException); -CAF_CM_DECLARE_EXCEPTION_CLASS(UnsupportedOperationException); -CAF_CM_DECLARE_EXCEPTION_CLASS(UnsupportedVersionException); -CAF_CM_DECLARE_EXCEPTION_CLASS(InvalidHandleException); -CAF_CM_DECLARE_EXCEPTION_CLASS(TimeoutException); -CAF_CM_DECLARE_EXCEPTION_CLASS(NoSuchInterfaceException); -CAF_CM_DECLARE_EXCEPTION_CLASS(ProcessFailedException); - -// AppConfig Exceptions -CAF_CM_DECLARE_EXCEPTION_CLASS(NoSuchConfigSectionException); -CAF_CM_DECLARE_EXCEPTION_CLASS(NoSuchConfigValueException); - -// Dynamic Library Exception -CAF_CM_DECLARE_EXCEPTION_CLASS(LibraryFailedToLoadException); -CAF_CM_DECLARE_EXCEPTION_CLASS(NoSuchMethodException); - -// I/O Exceptions -CAF_CM_DECLARE_EXCEPTION_CLASS(IOException); -CAF_CM_DECLARE_EXCEPTION_CLASS(EOFException); -CAF_CM_DECLARE_EXCEPTION_CLASS(FileNotFoundException); -CAF_CM_DECLARE_EXCEPTION_CLASS(PathNotFoundException); -CAF_CM_DECLARE_EXCEPTION_CLASS(FileLockedException); - -} - -#endif - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Exception/CValidate.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Exception/CValidate.cpp deleted file mode 100644 index 1bb61d86e..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Exception/CValidate.cpp +++ /dev/null @@ -1,257 +0,0 @@ -/* - * Author: bwilliams - * Created: Jan 21, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "Exception/CCafException.h" -#include "CValidate.h" -#include "ValidationMacros.h" - -using namespace Caf; - -// Some helper macros that make is easy to validate input arguments. -#define CAF_EXCEPTION_VALIDATE(_valmsg_, _variable_text_ ) \ - CAF_CM_EXCEPTION_VA2(E_INVALIDARG, "%s %s", _valmsg_, _variable_text_) - -void CValidate::constructed(const bool value, const char* className, const char* funcName) { - CAF_CM_STATIC_FUNC(className, funcName); - - CAF_CM_ENTER { - if (! value ) { - CAF_CM_EXCEPTION_VA0(ERROR_INVALID_STATE, _sPRECOND_ISCONSTRUCTED); - } - } - CAF_CM_EXIT; -} - -void CValidate::initialized(const bool value, const char* className, const char* funcName) { - CAF_CM_STATIC_FUNC(className, funcName); - - CAF_CM_ENTER { - if (! value ) { - CAF_CM_EXCEPTION_VA0(OLE_E_BLANK, _sPRECOND_ISINITIALIZED); - } - } - CAF_CM_EXIT; -} - -void CValidate::notInitialized(const bool value, const char* className, const char* funcName) { - CAF_CM_STATIC_FUNC(className, funcName); - - CAF_CM_ENTER { - if (value ) { - CAF_CM_EXCEPTION_VA0(ERROR_ALREADY_INITIALIZED, _sPRECOND_ISNOTINITIALIZED); - } - } - CAF_CM_EXIT; -} - -void CValidate::notEmptyStr(const std::string& value, const char* name, const char* className, const char* funcName) { - CAF_CM_STATIC_FUNC(className, funcName); - - CAF_CM_ENTER { - if (value.length() == 0 ) { - CAF_EXCEPTION_VALIDATE(_sVALIDATE_STRINGEMPTY, name); - } - } - CAF_CM_EXIT; -} - -void CValidate::notEmptyStr(const std::wstring& value, const char* name, const char* className, const char* funcName) { - CAF_CM_STATIC_FUNC(className, funcName); - - CAF_CM_ENTER { - if (value.length() == 0 ) { - CAF_EXCEPTION_VALIDATE(_sVALIDATE_STRINGEMPTY, name); - } - } - CAF_CM_EXIT; -} - -void CValidate::notEmptyUuid(const UUID value, const char* name, const char* className, const char* funcName) { - CAF_CM_STATIC_FUNC(className, funcName); - - CAF_CM_ENTER { - if (::IsEqualGUID(value, CAFCOMMON_GUID_NULL) ) { - CAF_EXCEPTION_VALIDATE(_sVALIDATE_GUID, name); - } - } - CAF_CM_EXIT; -} - -void CValidate::notNullOrEmptyStr(const char* value, const char* name, const char* className, const char* funcName) { - CAF_CM_STATIC_FUNC(className, funcName); - - CAF_CM_ENTER { - if (NULL == value) { - CAF_EXCEPTION_VALIDATE(_sVALIDATE_STRINGPTRNULL, name); - } - if (value[ 0 ] == '\0' ) { - CAF_EXCEPTION_VALIDATE(_sVALIDATE_STRINGPTREMPTY, name); - } - } - CAF_CM_EXIT; -} - -void CValidate::notNullOrEmptyStr(const wchar_t* value, const char* name, const char* className, const char* funcName) { - CAF_CM_STATIC_FUNC(className, funcName); - - CAF_CM_ENTER { - if (NULL == value) { - CAF_EXCEPTION_VALIDATE(_sVALIDATE_STRINGPTRNULL, name); - } - if (value[ 0 ] == L'\0') { - CAF_EXCEPTION_VALIDATE(_sVALIDATE_STRINGPTREMPTY, name); - } - } - CAF_CM_EXIT; -} - -void CValidate::notNullOrEmptyPtrArr(const void** value, const char* name, const char* className, const char* funcName) { - CAF_CM_STATIC_FUNC(className, funcName); - - CAF_CM_ENTER { - if (NULL == value) { - CAF_EXCEPTION_VALIDATE( _sVALIDATE_PTRARRAYNULL, name); - } - if (NULL == value[ 0 ]) { - CAF_EXCEPTION_VALIDATE( _sVALIDATE_PTRARRAYEMPTY, name); - } - } - CAF_CM_EXIT; -} - -void CValidate::notNullInterface(const ICafObject* value, const char* name, const char* className, const char* funcName) { - CAF_CM_STATIC_FUNC(className, funcName); - - CAF_CM_ENTER { - if (NULL == value) { - CAF_EXCEPTION_VALIDATE(_sVALIDATE_INTERFACE, name); - } - } - CAF_CM_EXIT; -} - -void CValidate::notNullPtr(const void* value, const char* name, const char* className, const char* funcName) { - CAF_CM_STATIC_FUNC(className, funcName); - - CAF_CM_ENTER { - if (NULL == value) { - CAF_EXCEPTION_VALIDATE(_sVALIDATE_NOTNULL, name); - } - } - CAF_CM_EXIT; -} - -void CValidate::nullPtr(const void* value, const char* name, const char* className, const char* funcName) { - CAF_CM_STATIC_FUNC(className, funcName); - - CAF_CM_ENTER { - if (NULL != value) { - CAF_EXCEPTION_VALIDATE(_sVALIDATE_NULL, name); - } - } - CAF_CM_EXIT; -} - -void CValidate::zero(const int32 value, const char* name, const char* className, const char* funcName) { - CAF_CM_STATIC_FUNC(className, funcName); - - CAF_CM_ENTER { - if (value != 0 ) { - CAF_EXCEPTION_VALIDATE(_sVALIDATE_ZERO, name); - } - } - CAF_CM_EXIT; -} - -void CValidate::notZero(const int32 value, const char* name, const char* className, const char* funcName) { - CAF_CM_STATIC_FUNC(className, funcName); - - CAF_CM_ENTER { - if (value == 0 ) { - CAF_EXCEPTION_VALIDATE(_sVALIDATE_ISNOTZERO, name); - } - } - CAF_CM_EXIT; -} - -void CValidate::positive(const int32 value, const char* name, const char* className, const char* funcName) { - CAF_CM_STATIC_FUNC(className, funcName); - - CAF_CM_ENTER { - if (value <= 0 ) { - CAF_EXCEPTION_VALIDATE(_sVALIDATE_POSITIVE, name); - } - } - CAF_CM_EXIT; -} - -void CValidate::negative(const int32 value, const char* name, const char* className, const char* funcName) { - CAF_CM_STATIC_FUNC(className, funcName); - - CAF_CM_ENTER { - if (value >= 0 ) { - CAF_EXCEPTION_VALIDATE(_sVALIDATE_NEGATIVE, name); - } - } - CAF_CM_EXIT; -} - -void CValidate::nonNegative(const int32 value, const char* name, const char* className, const char* funcName) { - CAF_CM_STATIC_FUNC(className, funcName); - - CAF_CM_ENTER { - if (value < 0 ) { - CAF_EXCEPTION_VALIDATE(_sVALIDATE_NONNEGATIVE, name); - } - } - CAF_CM_EXIT; -} - -void CValidate::nonNegative64(const int64 value, const char* name, const char* className, const char* funcName) { - CAF_CM_STATIC_FUNC(className, funcName); - - CAF_CM_ENTER { - if (value < 0 ) { - CAF_EXCEPTION_VALIDATE(_sVALIDATE_NONNEGATIVE, name); - } - } - CAF_CM_EXIT; -} - -void CValidate::isTrue(const bool value, const char* name, const char* className, const char* funcName) { - CAF_CM_STATIC_FUNC(className, funcName); - - CAF_CM_ENTER { - if (! value ) { - CAF_EXCEPTION_VALIDATE(_sVALIDATE_BOOL, name); - } - } - CAF_CM_EXIT; -} - -void CValidate::notEmptyStl(const size_t value, const char* name, const char* className, const char* funcName) { - CAF_CM_STATIC_FUNC(className, funcName); - - CAF_CM_ENTER { - if (value < 1) { - CAF_EXCEPTION_VALIDATE(_sVALIDATE_STL, name); - } - } - CAF_CM_EXIT; -} - -void CValidate::emptyStl(const size_t value, const char* name, const char* className, const char* funcName) { - CAF_CM_STATIC_FUNC(className, funcName); - - CAF_CM_ENTER { - if (value != 0) { - CAF_EXCEPTION_VALIDATE(_sVALIDATE_STL_EMPTY, name); - } - } - CAF_CM_EXIT; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Exception/CValidate.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Exception/CValidate.h deleted file mode 100644 index d33ae9ca9..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Exception/CValidate.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Author: bwilliams - * Created: Jan 21, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CVALIDATE_H_ -#define CVALIDATE_H_ - -namespace Caf { - -class EXCEPTION_LINKAGE CValidate { -public: - static void constructed(const bool value, const char* className, const char* funcName); - static void initialized(const bool value, const char* className, const char* funcName); - static void notInitialized(const bool value, const char* className, const char* funcName); - static void notEmptyStr(const std::string& value, const char* name, const char* className, const char* funcName); - static void notEmptyStr(const std::wstring& value, const char* name, const char* className, const char* funcName); - static void notEmptyUuid(const UUID value, const char* name, const char* className, const char* funcName); - static void notNullOrEmptyStr(const char* value, const char* name, const char* className, const char* funcName); - static void notNullOrEmptyStr(const wchar_t* value, const char* name, const char* className, const char* funcName); - static void notNullOrEmptyPtrArr(const void** value, const char* name, const char* className, const char* funcName); - static void notNullInterface(const ICafObject* value, const char* name, const char* className, const char* funcName); - static void notNullPtr(const void* value, const char* name, const char* className, const char* funcName); - static void nullPtr(const void* value, const char* name, const char* className, const char* funcName); - static void zero(const int32 value, const char* name, const char* className, const char* funcName); - static void notZero(const int32 value, const char* name, const char* className, const char* funcName); - static void positive(const int32 value, const char* name, const char* className, const char* funcName); - static void negative(const int32 value, const char* name, const char* className, const char* funcName); - static void nonNegative(const int32 value, const char* name, const char* className, const char* funcName); - static void nonNegative64(const int64 value, const char* name, const char* className, const char* funcName); - static void isTrue(const bool value, const char* name, const char* className, const char* funcName); - static void notEmptyStl(const size_t value, const char* name, const char* className, const char* funcName); - static void emptyStl(const size_t value, const char* name, const char* className, const char* funcName); - -private: - CAF_CM_DECLARE_NOCREATE(CValidate); -}; - -} - -#endif /* CVALIDATE_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Exception/ClassMacros.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Exception/ClassMacros.h deleted file mode 100644 index 48ede1b63..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Exception/ClassMacros.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Author: mdonahue - * Created: Jan 13, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CLASSMACROS_H_ -#define CLASSMACROS_H_ - -// Prevents class creation -#define CAF_CM_DECLARE_NOCREATE(_classname_) \ - private:\ - _classname_();\ - ~_classname_();\ - _classname_(const _classname_&);\ - _classname_& operator=(const _classname_&) - -// Prevents copying -#define CAF_CM_DECLARE_NOCOPY(_classname_) \ - private:\ - _classname_(const _classname_&);\ - _classname_& operator=(const _classname_&) - -// Initializes the members of the class -#define CAF_CM_INIT( _ClassName_ ) _cm_className_( _ClassName_ ) - -// Sets up a class method for parameter validation only -#define CAF_CM_FUNCNAME_VALIDATE( _szFuncNameIn_ ) \ - const char * _cm_funcName_ = _szFuncNameIn_ - -// Sets up a class method for exception handling/parameter validation -#define CAF_CM_FUNCNAME( _szFuncNameIn_ ) \ - CAF_CM_FUNCNAME_VALIDATE ( _szFuncNameIn_); \ - CCafException* _cm_exception_ = NULL - -#define CAF_CM_CREATE \ - private: \ - const char * _cm_className_ - -#define CAF_CM_STATIC_FUNC_VALIDATE( _szScope_, _szFuncName_ ) \ - const char * _cm_className_ = _szScope_; \ - CAF_CM_FUNCNAME_VALIDATE( _szFuncName_ ) - -#define CAF_CM_STATIC_FUNC( _szScope_, _szFuncName_ ) \ - const char * _cm_className_ = _szScope_; \ - CAF_CM_FUNCNAME( _szFuncName_ ) - -#define CAF_CM_GET_FUNCNAME _cm_funcName_ - -#define CAF_CM_GET_CLASSNAME _cm_className_ - -#define CAF_CM_ENTER (void)0; - -#define CAF_CM_EXIT (void)0 - -#define CAF_CM_UPTLINE (void)0 - -// Class-level thread safety macros -#define CAF_CM_CREATE_THREADSAFE \ - private: \ - mutable Caf::SmartPtrCAutoRecMutex _cm_mutex_ - -#define CAF_CM_INIT_THREADSAFE \ - _cm_mutex_.CreateInstance(); \ - _cm_mutex_->initialize() - -#define CAF_CM_ENTER_AND_LOCK \ - Caf::CAutoMutexLockUnlock _auto_lock_unlock(_cm_mutex_); \ - CAF_CM_ENTER - -#define CAF_CM_UNLOCK_AND_EXIT CAF_CM_EXIT - -#define CAF_CM_LOCK _cm_mutex_->lock() - -#define CAF_CM_UNLOCK _cm_mutex_->unlock() - - -#define CAF_CM_LOCK_UNLOCK Caf::CAutoMutexLockUnlock _auto_lock_unlock(_cm_mutex_) - -#define CAF_CM_UNLOCK_LOCK Caf::CAutoMutexUnlockLock _auto_unlock_lock(_cm_mutex_) - -#define CAF_CM_LOCK_UNLOCK_LOG Caf::CAutoMutexLockUnlock _auto_lock_unlock(_cm_mutex_, CAF_CM_GET_CLASSNAME, CAF_CM_GET_FUNCNAME, __LINE__) - -#define CAF_CM_UNLOCK_LOCK_LOG Caf::CAutoMutexUnlockLock _auto_unlock_lock(_cm_mutex_, CAF_CM_GET_CLASSNAME, CAF_CM_GET_FUNCNAME, __LINE__) - - -#define CAF_CM_LOCK_UNLOCK1(_this_mutex_) Caf::CAutoMutexLockUnlock _auto_lock_unlock1(_this_mutex_) - -#define CAF_CM_UNLOCK_LOCK1(_this_mutex_) Caf::CAutoMutexUnlockLock _auto_unlock_lock1(_this_mutex_) - -#define CAF_CM_LOCK_UNLOCK1_LOG(_this_mutex_) Caf::CAutoMutexLockUnlock _auto_lock_unlock1(_this_mutex_, CAF_CM_GET_CLASSNAME, CAF_CM_GET_FUNCNAME, __LINE__) - -#define CAF_CM_UNLOCK_LOCK1_LOG(_this_mutex_) Caf::CAutoMutexUnlockLock _auto_unlock_lock1(_this_mutex_, CAF_CM_GET_CLASSNAME, CAF_CM_GET_FUNCNAME, __LINE__) - -#endif /* CLASSMACROS_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Exception/ExceptionExMacros.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Exception/ExceptionExMacros.h deleted file mode 100644 index 930ed03f3..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Exception/ExceptionExMacros.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Created on: Oct 6, 2011 - * Author: mdonahue - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef EXEXCEPTIONEXMACROS_H_ -#define EXEXCEPTIONEXMACROS_H_ - -#define CAF_CM_EXCEPTIONEX_VA0(_exclass_, _code_, _msg_) \ - { \ - _cm_exception_ = new _exclass_(); \ - _cm_exception_->populate(_msg_, _code_, _cm_className_, _cm_funcName_); \ - _cm_exception_->AddRef(); \ - throw static_cast<_exclass_*>(_cm_exception_); \ - } - -#define CAF_CM_EXCEPTIONEX_VA1(_exclass_, _code_, _fmt_, _arg1_) \ - { \ - _cm_exception_ = new _exclass_(); \ - _cm_exception_->populateVA(_code_, _cm_className_, _cm_funcName_, _fmt_, _arg1_); \ - _cm_exception_->AddRef(); \ - throw static_cast<_exclass_*>(_cm_exception_); \ - } - -#define CAF_CM_EXCEPTIONEX_VA2(_exclass_, _code_, _fmt_, _arg1_, _arg2_) \ - { \ - _cm_exception_ = new _exclass_(); \ - _cm_exception_->populateVA(_code_, _cm_className_, _cm_funcName_, _fmt_, _arg1_, _arg2_); \ - _cm_exception_->AddRef(); \ - throw static_cast<_exclass_*>(_cm_exception_); \ - } - -#define CAF_CM_EXCEPTIONEX_VA3(_exclass_, _code_, _fmt_, _arg1_, _arg2_, _arg3_) \ - { \ - _cm_exception_ = new _exclass_(); \ - _cm_exception_->populateVA(_code_, _cm_className_, _cm_funcName_, _fmt_, _arg1_, _arg2_, _arg3_); \ - _cm_exception_->AddRef(); \ - throw static_cast<_exclass_*>(_cm_exception_); \ - } - -#define CAF_CM_EXCEPTIONEX_VA4(_exclass_, _code_, _fmt_, _arg1_, _arg2_, _arg3_, _arg4_) \ - { \ - _cm_exception_ = new _exclass_(); \ - _cm_exception_->populateVA(_code_, _cm_className_, _cm_funcName_, _fmt_, _arg1_, _arg2_, _arg3_, _arg4_); \ - _cm_exception_->AddRef(); \ - throw static_cast<_exclass_*>(_cm_exception_); \ - } - -#define CAF_CM_EXCEPTIONEX_VA5(_exclass_, _code_, _fmt_, _arg1_, _arg2_, _arg3_, _arg4_, _arg5_) \ - { \ - _cm_exception_ = new _exclass_(); \ - _cm_exception_->populateVA(_code_, _cm_className_, _cm_funcName_, _fmt_, _arg1_, _arg2_, _arg3_, _arg4_, _arg5_); \ - _cm_exception_->AddRef(); \ - throw static_cast<_exclass_*>(_cm_exception_); \ - } - -#define CAF_CM_EXCEPTIONEX_VA6(_exclass_, _code_, _fmt_, _arg1_, _arg2_, _arg3_, _arg4_, _arg5_, _arg6_) \ - { \ - _cm_exception_ = new _exclass_(); \ - _cm_exception_->populateVA(_code_, _cm_className_, _cm_funcName_, _fmt_, _arg1_, _arg2_, _arg3_, _arg4_, _arg5_, _arg6_); \ - _cm_exception_->AddRef(); \ - throw static_cast<_exclass_*>(_cm_exception_); \ - } - -#endif /* EXEXCEPTIONEXMACROS_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Exception/ExceptionLink.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Exception/ExceptionLink.h deleted file mode 100644 index 4261af66a..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Exception/ExceptionLink.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Author: mdonahue - * Created: Jan 13, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef EXCEPTIONLINK_H_ -#define EXCEPTIONLINK_H_ - -#ifndef EXCEPTION_LINKAGE - #ifdef WIN32 - #ifdef FRAMEWORK_BUILD - #define EXCEPTION_LINKAGE __declspec(dllexport) - #else - #define EXCEPTION_LINKAGE __declspec(dllimport) - #endif - #else - #define EXCEPTION_LINKAGE - #endif -#endif - -#include "CBacktraceUtils.h" -#include "ClassMacros.h" -#include "ExceptionMacros.h" -#include "CCafExceptionEx.h" -#include "ExceptionExMacros.h" -#include "CValidate.h" -#include "ValidationMacros.h" -#include "ValidationMacrosRaw.h" -#include "StatusMacros.h" - -#endif /* EXCEPTIONLINK_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Exception/ExceptionMacros.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Exception/ExceptionMacros.h deleted file mode 100644 index b248fe971..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Exception/ExceptionMacros.h +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Author: mdonahue - * Created: Jan 26, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef EXCEPTIONMACROS_H_ -#define EXCEPTIONMACROS_H_ - -#define CAF_CM_EXCEPTION_EFAIL( _msg_ ) \ - { \ - _cm_exception_ = new Caf::CCafException(); \ - _cm_exception_->populate(_msg_, E_FAIL, _cm_className_, _cm_funcName_); \ - _cm_exception_->AddRef(); \ - throw _cm_exception_; \ - } - -#define CAF_CM_EXCEPTION_VA0(_code_, _msg_) \ - { \ - _cm_exception_ = new Caf::CCafException(); \ - _cm_exception_->populate(_msg_, _code_, _cm_className_, _cm_funcName_); \ - _cm_exception_->AddRef(); \ - throw _cm_exception_; \ - } - -#define CAF_CM_EXCEPTION_VA1(_code_, _fmt_, _arg1_) \ - { \ - _cm_exception_ = new Caf::CCafException(); \ - _cm_exception_->populateVA(_code_, _cm_className_, _cm_funcName_, _fmt_, _arg1_); \ - _cm_exception_->AddRef(); \ - throw _cm_exception_; \ - } - -#define CAF_CM_EXCEPTION_VA2(_code_, _fmt_, _arg1_, _arg2_) \ - { \ - _cm_exception_ = new Caf::CCafException(); \ - _cm_exception_->populateVA(_code_, _cm_className_, _cm_funcName_, _fmt_, _arg1_, _arg2_); \ - _cm_exception_->AddRef(); \ - throw _cm_exception_; \ - } - -#define CAF_CM_EXCEPTION_VA3(_code_, _fmt_, _arg1_, _arg2_, _arg3_) \ - { \ - _cm_exception_ = new Caf::CCafException(); \ - _cm_exception_->populateVA(_code_, _cm_className_, _cm_funcName_, _fmt_, _arg1_, _arg2_, _arg3_); \ - _cm_exception_->AddRef(); \ - throw _cm_exception_; \ - } - -#define CAF_CM_EXCEPTION_VA4(_code_, _fmt_, _arg1_, _arg2_, _arg3_, _arg4_) \ - { \ - _cm_exception_ = new Caf::CCafException(); \ - _cm_exception_->populateVA(_code_, _cm_className_, _cm_funcName_, _fmt_, _arg1_, _arg2_, _arg3_, _arg4_); \ - _cm_exception_->AddRef(); \ - throw _cm_exception_; \ - } - -#define CAF_CM_EXCEPTION_VA5(_code_, _fmt_, _arg1_, _arg2_, _arg3_, _arg4_, _arg5_) \ - { \ - _cm_exception_ = new Caf::CCafException(); \ - _cm_exception_->populateVA(_code_, _cm_className_, _cm_funcName_, _fmt_, _arg1_, _arg2_, _arg3_, _arg4_, _arg5_); \ - _cm_exception_->AddRef(); \ - throw _cm_exception_; \ - } - -#define CAF_CM_EXCEPTION_VA6(_code_, _fmt_, _arg1_, _arg2_, _arg3_, _arg4_, _arg5_, _arg6_) \ - { \ - _cm_exception_ = new Caf::CCafException(); \ - _cm_exception_->populateVA(_code_, _cm_className_, _cm_funcName_, _fmt_, _arg1_, _arg2_, _arg3_, _arg4_, _arg5_, _arg6_); \ - _cm_exception_->AddRef(); \ - throw _cm_exception_; \ - } - - -#define CAF_CM_CLEAREXCEPTION \ - if(NULL != _cm_exception_) { _cm_exception_->Release(); _cm_exception_ = NULL; } - -#define CAF_CM_ISEXCEPTION \ - ((NULL == _cm_exception_) ? false : true) - -#define CAF_CM_EXCEPTION_GET_FULLMSG \ - (NULL == _cm_exception_) ? std::string() : _cm_exception_->getFullMsg() - -#define CAF_CM_EXCEPTION_GET_MSG \ - (NULL == _cm_exception_) ? std::string() : _cm_exception_->getMsg() - -#define CAF_CM_EXCEPTION_GET_ERROR \ - (NULL == _cm_exception_) ? S_OK : _cm_exception_->getError() - -#define CAF_CM_THROWEXCEPTION \ - if(NULL != _cm_exception_) { _cm_exception_->throwSelf(); } - -#define CAF_CM_GETEXCEPTION \ - _cm_exception_ - -// Catch exceptions and turn them into CafException -#define CAF_CM_CATCH_CAF \ - catch (CCafException* _catchException_) { \ - if(NULL == _cm_exception_) { \ - _cm_exception_ = _catchException_; \ - } \ - } - -#define CAF_CM_CATCH_HRESULT \ - catch (HRESULT& _catchException_) { \ - _cm_exception_ = new Caf::CCafException(); \ - _cm_exception_->populate("HRESULT Exception", _catchException_, _cm_className_, _cm_funcName_); \ - _cm_exception_->AddRef(); \ - } - -#define CAF_CM_CATCH_STL \ - catch (exception& _catchException_) { \ - const std::string _msg_ = std::string("STL Exception: " ) + std::string( _catchException_.what() ); \ - _cm_exception_ = new Caf::CCafException(); \ - _cm_exception_->populate(_msg_, E_FAIL, _cm_className_, _cm_funcName_); \ - _cm_exception_->AddRef(); \ - } - -#define CAF_CM_CATCH_STD \ - catch (const std::exception& _catchException_) { \ - const std::string _msg_ = std::string("STD Exception: " ) + std::string( _catchException_.what() ); \ - _cm_exception_ = new Caf::CCafException(); \ - _cm_exception_->populate(_msg_, E_FAIL, _cm_className_, _cm_funcName_); \ - _cm_exception_->AddRef(); \ - } - -#define CAF_CM_CATCH_DEFAULT \ - catch (...) { \ - _cm_exception_ = new Caf::CCafException(); \ - _cm_exception_->populate("Default Exception", E_FAIL, _cm_className_, _cm_funcName_); \ - _cm_exception_->AddRef(); \ - } - -#define CAF_CM_CATCH_GERROR \ - catch (GError* _catchException_) { \ - _cm_exception_ = new Caf::CCafException(); \ - _cm_exception_->populate(_catchException_->message, _catchException_->code, _cm_className_, _cm_funcName_); \ - _cm_exception_->AddRef(); \ - g_error_free(_catchException_); \ - } - -#define CAF_CM_THROW_GERROR(_err_) { \ - _cm_exception_ = new Caf::CCafException(); \ - _cm_exception_->populate(_err_->message, _err_->code, _cm_className_, _cm_funcName_); \ - _cm_exception_->AddRef(); \ - g_error_free(_err_); \ - _cm_exception_->throwSelf(); } - -#define CAF_CM_CATCH_ALL \ - CAF_CM_CATCH_CAF \ - CAF_CM_CATCH_HRESULT \ - CAF_CM_CATCH_STD \ - CAF_CM_CATCH_GERROR \ - CAF_CM_CATCH_DEFAULT - -#endif /* EXCEPTIONMACROS_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Exception/StatusMacros.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Exception/StatusMacros.h deleted file mode 100644 index 5228db180..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Exception/StatusMacros.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Author: mdonahue - * Created: Jan 13, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef STATUSMACROS_H_ -#define STATUSMACROS_H_ - -typedef std::pair CCafStatus; - -#define CAF_CM_VALIDATE_STATUS(_status_) \ - { \ - CCafStatus _int_status_ = _status_; \ - if (_int_status_.first != S_OK) \ - CAF_CM_EXCEPTION_VA0(_int_status_.first, _int_status_.second.c_str()); \ - } - -#define CAF_CM_STATUS _status_ - -#define CAF_CM_INIT_STATUS CCafStatus CAF_CM_STATUS = std::make_pair(S_OK, ""); - -#define CAF_CM_SET_STATUS_FROM_EXCEPTION(_arg_) \ - { \ - if (_arg_->isPopulated()) \ - CAF_CM_STATUS = std::make_pair(_arg_->getError(), _arg_->getMsg()); \ - else \ - CAF_CM_STATUS = std::make_pair(E_FAIL, "Unknown exception"); \ - } - -#endif /* STATUSMACROS_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Exception/ValidationMacros.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Exception/ValidationMacros.h deleted file mode 100644 index 3645c5b62..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Exception/ValidationMacros.h +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Author: mdonahue - * Created: Jan 13, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef VALIDATIONMACROS_H_ -#define VALIDATIONMACROS_H_ - -// String constants used in validation -const char _sPRECOND_ISCONSTRUCTED[] = "Pre-condition failed because object was not constructed successfully"; -const char _sPRECOND_ISINITIALIZED[] = "Pre-condition failed because object was not initialized successfully"; -const char _sPRECOND_ISNOTINITIALIZED[] = "Pre-condition failed because object has already been initialized"; -const char _sPRECOND_ISNOTREADONLY[] = "Pre-condition failed because the object is read-only."; - -const char _sVALIDATE_STRINGEMPTY[] ="Invalid Argument because a string is empty:"; -const char _sVALIDATE_STRINGPTRNULL[] ="Invalid Argument because a string pointer is null:"; -const char _sVALIDATE_STRINGPTREMPTY[] ="Invalid Argument because a string pointer is empty:"; -const char _sVALIDATE_PTRARRAYNULL[] ="Invalid Argument because a pointer array is null:"; -const char _sVALIDATE_PTRARRAYEMPTY[] ="Invalid Argument because a pointer array is empty:"; -const char _sVALIDATE_STL[] ="Invalid Argument because an STL container is empty:"; -const char _sVALIDATE_STL_EMPTY[] ="Invalid Argument because an STL container is not empty:"; -const char _sVALIDATE_STL_ITERATOR[] ="Invalid Argument because an STL iterator is at the end of the containter:"; -const char _sVALIDATE_INTERFACE[] ="Invalid Argument because an interface is NULL:"; -const char _sVALIDATE_ZERO[] ="Invalid Argument because a number is not equal to zero:"; -const char _sVALIDATE_ISNOTZERO[] ="Invalid Argument because a number is equal to zero:"; -const char _sVALIDATE_POSITIVE[] ="Invalid Argument because a number is less-than or equal-to zero:"; -const char _sVALIDATE_NEGATIVE[] ="Invalid Argument because a number is greater-than or equal-to zero:"; -const char _sVALIDATE_NONNEGATIVE[] ="Invalid Argument because a number is less-than zero:"; -const char _sVALIDATE_NOTNULL[] ="Invalid Argument is NULL:"; -const char _sVALIDATE_NULL[] ="Invalid Argument must be NULL:"; -const char _sVALIDATE_BOOL[] ="Invalid Argument because a bool is false:"; -const char _sVALIDATE_GUID[] ="Invalid Argument because a GUID is NULL:"; -const char _sASSERT_FAILED[] ="Assertion failed:"; - -// Used internally by some of these macros. -#define CAF_CM_EXCEPTION_VALIDATE( _valmsg_, _variable_text_ ) \ - CAF_CM_EXCEPTION_VA2(E_INVALIDARG, "%s %s", _valmsg_, _variable_text_) - -// Some helper macros that make it easy to validate that the object pre-conditions have been met. -#define CAF_CM_PRECOND_ISCONSTRUCTED( _bIsConstucted_ ) \ - CValidate::constructed(_bIsConstucted_, _cm_className_, _cm_funcName_) - -#define CAF_CM_PRECOND_ISINITIALIZED( _bIsInitialized_ ) \ - CValidate::initialized(_bIsInitialized_, _cm_className_, _cm_funcName_) - -#define CAF_CM_PRECOND_ISNOTINITIALIZED( _bIsInitialized_ ) \ - CValidate::notInitialized(_bIsInitialized_, _cm_className_, _cm_funcName_) - -// Some helper macros that make is easy to validate input arguments. -#define CAF_CM_VALIDATE_STRING( _validate_ ) \ - CValidate::notEmptyStr(_validate_, #_validate_, _cm_className_, _cm_funcName_) - -#define CAF_CM_VALIDATE_STRINGPTRW( _validate_ ) \ - CValidate::notNullOrEmptyStr(_validate_, #_validate_, _cm_className_, _cm_funcName_) - -#define CAF_CM_VALIDATE_STRINGPTRA( _validate_ ) \ - CValidate::notNullOrEmptyStr(_validate_, #_validate_, _cm_className_, _cm_funcName_) - -#define CAF_CM_VALIDATE_ZERO( _validate_) \ - CValidate::zero(_validate_, #_validate_, _cm_className_, _cm_funcName_) - -#define CAF_CM_VALIDATE_NOTZERO( _validate_) \ - CValidate::notZero(_validate_, #_validate_, _cm_className_, _cm_funcName_) - -#define CAF_CM_VALIDATE_POSITIVE( _validate_ ) \ - CValidate::positive(_validate_, #_validate_, _cm_className_, _cm_funcName_) - -#define CAF_CM_VALIDATE_NEGATIVE( _validate_ ) \ - CValidate::negative(_validate_, #_validate_, _cm_className_, _cm_funcName_) - -#define CAF_CM_VALIDATE_NONNEGATIVE( _validate_ ) \ - CValidate::nonNegative(_validate_, #_validate_, _cm_className_, _cm_funcName_) - -#define CAF_CM_VALIDATE_NONNEGATIVE_INT64( _validate_ ) \ - CValidate::nonNegative64(_validate_, #_validate_, _cm_className_, _cm_funcName_) - -#define CAF_CM_VALIDATE_BOOL( _validate_ ) \ - CValidate::isTrue(_validate_, #_validate_, _cm_className_, _cm_funcName_) - -#define CAF_CM_VALIDATE_GUID( _validate_ ) \ - CValidate::notEmptyUuid(_validate_, #_validate_, _cm_className_, _cm_funcName_) - -#define CAF_CM_VALIDATE_INTERFACE( _validate_ ) \ - CValidate::notNullInterface(_validate_.GetNonAddRefedInterface(), #_validate_, _cm_className_, _cm_funcName_) - -#define CAF_CM_VALIDATE_INTERFACEPTR( _validate_ ) \ - CValidate::notNullInterface(_validate_, #_validate_, _cm_className_, _cm_funcName_) - -#define CAF_CM_VALIDATE_PTR( _validate_ ) \ - CValidate::notNullPtr(_validate_, #_validate_, _cm_className_, _cm_funcName_) - -#define CAF_CM_VALIDATE_NULLPTR( _validate_ ) \ - CValidate::nullPtr(_validate_, #_validate_, _cm_className_, _cm_funcName_) - -#define CAF_CM_VALIDATE_SMARTPTR( _validate_ ) \ - CValidate::notNullPtr(_validate_.GetNonAddRefedInterface(), #_validate_, _cm_className_, _cm_funcName_) - -#define CAF_CM_VALIDATE_PTRARRAY( _validate_ ) \ - CValidate::notNullOrEmptyPtrArr(_validate_, #_validate_, _cm_className_, _cm_funcName_) - -#define CAF_CM_VALIDATE_STL( _validate_ ) \ - CValidate::notEmptyStl(_validate_.size(), #_validate_, _cm_className_, _cm_funcName_) - -#define CAF_CM_VALIDATE_STL_EMPTY( _validate_ ) \ - CValidate::emptyStl(_validate_.size(), #_validate_, _cm_className_, _cm_funcName_) - -// Not included in CValidate either because these macros are not currently used or because -// the types are too varied to include in a class. -#define CAF_CM_VALIDATE_STL_ITERATOR( _stlContainer_, _stlIterator ) \ - if( _stlIterator == _stlContainer_.end() ) \ - CAF_CM_EXCEPTION_VALIDATE( _sVALIDATE_STL_ITERATOR, #_stlContainer_ ) - -#define CAF_CM_VALIDATE_SMARTSTL_NOTEMPTY( _validate_ ) \ - if( _validate_.IsNull() || _validate_->empty() ) \ - CAF_CM_EXCEPTION_VALIDATE( _sVALIDATE_STL, #_validate_ ) - -#define CAF_CM_VALIDATE_COND_VA1( _cond_, _fmt_, _arg1_ ) \ - if(! (_cond_) ) { \ - const std::string _fullfmt_ = std::string(#_cond_) + " - " + std::string(_fmt_); \ - CAF_CM_EXCEPTION_VA1(E_INVALIDARG, _fullfmt_.c_str(), _arg1_); \ - } - -#define CAF_CM_VALIDATE_COND_VA2( _cond_, _fmt_, _arg1_, _arg2_ ) \ - if(! (_cond_) ) { \ - const std::string _fullfmt_ = std::string(#_cond_) + " - " + std::string(_fmt_); \ - CAF_CM_EXCEPTION_VA2(E_INVALIDARG, _fullfmt_.c_str(), _arg1_, _arg2_); \ - } - -#define CAF_CM_VALIDATE_COND_VA3( _cond_, _fmt_, _arg1_, _arg2_, _arg3_ ) \ - if(! (_cond_) ) { \ - const std::string _fullfmt_ = std::string(#_cond_) + " - " + std::string(_fmt_); \ - CAF_CM_EXCEPTION_VA3(E_INVALIDARG, _fullfmt_.c_str(), _arg1_, _arg2_, _arg3_); \ - } - -// Generic assert -#define CAF_CM_ASSERT(_exp_) \ - if (!(_exp_)) \ - CAF_CM_EXCEPTION_VA2(E_FAIL, "%s %s", _sASSERT_FAILED, #_exp_ ) - -#define CAF_CM_ASSERT_MSG(_exp_, _msg_) \ - if (!(_exp_)) \ - CAF_CM_EXCEPTION_VA1( E_FAIL, "%s", _msg_ ); - -#endif /* VALIDATIONMACROS_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Exception/ValidationMacrosRaw.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Exception/ValidationMacrosRaw.h deleted file mode 100644 index d9faad23d..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Exception/ValidationMacrosRaw.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Author: mdonahue - * Created: Jan 13, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef VALIDATIONMACROSRAW_H_ -#define VALIDATIONMACROSRAW_H_ - -// Some helper macros that make it easy to validate that the object pre-conditions have been met. -#define CAF_CM_PRECONDRAW_ISCONSTRUCTED( _cm_className_, _cm_funcName_, _bIsConstucted_ ) \ - CValidate::constructed(_bIsConstucted_, _cm_className_, _cm_funcName_) - -#define CAF_CM_PRECONDRAW_ISINITIALIZED( _cm_className_, _cm_funcName_, _bIsInitialized_ ) \ - CValidate::initialized(_bIsInitialized_, _cm_className_, _cm_funcName_) - -#define CAF_CM_PRECONDRAW_ISNOTINITIALIZED( _cm_className_, _cm_funcName_, _bIsInitialized_ ) \ - CValidate::notInitialized(_bIsInitialized_, _cm_className_, _cm_funcName_) - -// Some helper macros that make is easy to validate input arguments. -#define CAF_CM_VALIDATERAW_STRING( _cm_className_, _cm_funcName_, _validate_ ) \ - CValidate::notEmptyStr(_validate_, #_validate_, _cm_className_, _cm_funcName_) - -#define CAF_CM_VALIDATERAW_STRINGPTRW( _cm_className_, _cm_funcName_, _validate_ ) \ - CValidate::notNullOrEmptyStr(_validate_, #_validate_, _cm_className_, _cm_funcName_) - -#define CAF_CM_VALIDATERAW_STRINGPTRA( _cm_className_, _cm_funcName_, _validate_ ) \ - CValidate::notNullOrEmptyStr(_validate_, #_validate_, _cm_className_, _cm_funcName_) - -#define CAF_CM_VALIDATERAW_ZERO( _cm_className_, _cm_funcName_, _validate_) \ - CValidate::zero(_validate_, #_validate_, _cm_className_, _cm_funcName_) - -#define CAF_CM_VALIDATERAW_NOTZERO( _cm_className_, _cm_funcName_, _validate_) \ - CValidate::notZero(_validate_, #_validate_, _cm_className_, _cm_funcName_) - -#define CAF_CM_VALIDATERAW_POSITIVE( _cm_className_, _cm_funcName_, _validate_ ) \ - CValidate::positive(_validate_, #_validate_, _cm_className_, _cm_funcName_) - -#define CAF_CM_VALIDATERAW_NEGATIVE( _cm_className_, _cm_funcName_, _validate_ ) \ - CValidate::negative(_validate_, #_validate_, _cm_className_, _cm_funcName_) - -#define CAF_CM_VALIDATERAW_NONNEGATIVE( _cm_className_, _cm_funcName_, _validate_ ) \ - CValidate::nonNegative(_validate_, #_validate_, _cm_className_, _cm_funcName_) - -#define CAF_CM_VALIDATERAW_BOOL( _cm_className_, _cm_funcName_, _validate_ ) \ - CValidate::isTrue(_validate_, #_validate_, _cm_className_, _cm_funcName_) - -#define CAF_CM_VALIDATERAW_GUID( _cm_className_, _cm_funcName_, _validate_ ) \ - CValidate::notEmptyUuid(_validate_, #_validate_, _cm_className_, _cm_funcName_) - -#define CAF_CM_VALIDATERAW_INTERFACE( _cm_className_, _cm_funcName_, _validate_ ) \ - CValidate::notNullInterface(_validate_.GetNonAddRefedInterface(), #_validate_, _cm_className_, _cm_funcName_) - -#define CAF_CM_VALIDATERAW_INTERFACEPTR( _cm_className_, _cm_funcName_, _validate_ ) \ - CValidate::notNullInterface(_validate_, #_validate_, _cm_className_, _cm_funcName_) - -#define CAF_CM_VALIDATERAW_PTR( _cm_className_, _cm_funcName_, _validate_ ) \ - CValidate::notNullPtr(_validate_, #_validate_, _cm_className_, _cm_funcName_) - -#define CAF_CM_VALIDATERAW_NULLPTR( _cm_className_, _cm_funcName_, _validate_ ) \ - CValidate::nullPtr(_validate_, #_validate_, _cm_className_, _cm_funcName_) - -#define CAF_CM_VALIDATERAW_SMARTPTR( _cm_className_, _cm_funcName_, _validate_ ) \ - CValidate::notNullPtr(_validate_.GetNonAddRefedInterface(), #_validate_, _cm_className_, _cm_funcName_) - -#define CAF_CM_VALIDATERAW_PTRARRAY( _cm_className_, _cm_funcName_, _validate_ ) \ - CValidate::notNullOrEmptyPtrArr(_validate_, #_validate_, _cm_className_, _cm_funcName_) - -#define CAF_CM_VALIDATERAW_STL( _cm_className_, _cm_funcName_, _validate_ ) \ - CValidate::notEmptyStl(_validate_.size(), #_validate_, _cm_className_, _cm_funcName_) - -#define CAF_CM_VALIDATERAW_STL_EMPTY( _cm_className_, _cm_funcName_, _validate_ ) \ - CValidate::emptyStl(_validate_.size(), #_validate_, _cm_className_, _cm_funcName_) - -#endif /* VALIDATIONMACROSRAW_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Exception/stdafx.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Exception/stdafx.h deleted file mode 100644 index 3b99d36b8..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Exception/stdafx.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Author: mdonahue - * Created: Jan 13, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef STDAFX_H_ -#define STDAFX_H_ - -#ifdef WIN32 - #define EXCEPTION_LINKAGE __declspec(dllexport) - #define COMMONAGGREGATOR_LINKAGE __declspec(dllexport) -#else - #define EXCEPTION_LINKAGE - #define COMMONAGGREGATOR_LINKAGE -#endif - -#include -#include -#include "ClassMacros.h" -#include "ExceptionMacros.h" - -#endif /* STDAFX_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Caf/CBeanPropertiesHelper.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Caf/CBeanPropertiesHelper.cpp deleted file mode 100644 index 6ab2c37d4..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Caf/CBeanPropertiesHelper.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Author: bwilliams - * Created: Jul 2009 - * - * Copyright (C) 2009-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "Exception/CCafException.h" -#include "Integration/Caf/CBeanPropertiesHelper.h" - -using namespace Caf; - -SmartPtrCBeanPropertiesHelper CBeanPropertiesHelper::create( - const IBean::Cprops& properties) { - SmartPtrCBeanPropertiesHelper rc; - rc.CreateInstance(); - rc->initialize(properties); - - return rc; -} - -CBeanPropertiesHelper::CBeanPropertiesHelper(void) : - m_isInitialized(false), - CAF_CM_INIT("CBeanPropertiesHelper") { -} - -CBeanPropertiesHelper::~CBeanPropertiesHelper(void) { -} - -void CBeanPropertiesHelper::initialize( - const IBean::Cprops& properties) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(m_isInitialized); - - _properties = properties; - m_isInitialized = true; -} - -std::string CBeanPropertiesHelper::getRequiredString( - const std::string& key) const { - CAF_CM_FUNCNAME("getRequiredString"); - CAF_CM_PRECOND_ISINITIALIZED(m_isInitialized); - CAF_CM_VALIDATE_STRING(key); - - const IBean::Cprops::const_iterator iter = _properties.find(key); - if (_properties.end() == iter) { - CAF_CM_EXCEPTION_VA1(E_FAIL, - "Required property not found - %s", key.c_str()); - } - - return iter->second; -} - -std::string CBeanPropertiesHelper::getOptionalString( - const std::string& key, - const std::string& defaultVal) const { - CAF_CM_FUNCNAME_VALIDATE("getOptionalString"); - CAF_CM_PRECOND_ISINITIALIZED(m_isInitialized); - CAF_CM_VALIDATE_STRING(key); - - std::string rc = defaultVal; - const IBean::Cprops::const_iterator iter = _properties.find(key); - if (_properties.end() != iter) { - rc = iter->second; - } - - return rc; -} - -bool CBeanPropertiesHelper::getRequiredBool( - const std::string& key) const { - CAF_CM_FUNCNAME_VALIDATE("getRequiredBool"); - CAF_CM_PRECOND_ISINITIALIZED(m_isInitialized); - CAF_CM_VALIDATE_STRING(key); - - const std::string val = getRequiredString(key); - return (val.compare("true") == 0); -} - -bool CBeanPropertiesHelper::getOptionalBool( - const std::string& key, - const bool defaultValue) const { - CAF_CM_FUNCNAME_VALIDATE("getOptionalBool"); - CAF_CM_PRECOND_ISINITIALIZED(m_isInitialized); - CAF_CM_VALIDATE_STRING(key); - - bool rc = defaultValue; - const IBean::Cprops::const_iterator iter = _properties.find(key); - if (_properties.end() != iter) { - rc = (iter->second.compare("true") == 0); - } - - return rc; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Caf/CCafMessageCreator.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Caf/CCafMessageCreator.cpp deleted file mode 100644 index a4017c386..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Caf/CCafMessageCreator.cpp +++ /dev/null @@ -1,468 +0,0 @@ -/* - * Author: bwilliams - * Created: Jul 2009 - * - * Copyright (C) 2009-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Doc/DocXml/CafInstallRequestXml/CafInstallRequestXmlRoots.h" -#include "Doc/DocXml/DiagRequestXml/DiagRequestXmlRoots.h" -#include "Doc/DocXml/MgmtRequestXml/MgmtRequestXmlRoots.h" -#include "Doc/DocXml/ProviderInfraXml/ProviderInfraXmlRoots.h" -#include "Doc/DocXml/ProviderRequestXml/ProviderRequestXmlRoots.h" -#include "Doc/DocXml/ResponseXml/ResponseXmlRoots.h" - -#include "Doc/DocUtils/EnumConvertersXml.h" -#include "Doc/DocXml/CafCoreTypesXml/AttachmentCollectionXml.h" - -#include "Doc/CafCoreTypesDoc/CafCoreTypesDocTypes.h" -#include "Integration/Caf/CCafMessageHeadersWriter.h" -#include "Doc/CafCoreTypesDoc/CAttachmentCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CAttachmentDoc.h" -#include "Doc/CafCoreTypesDoc/CPropertyCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CPropertyDoc.h" -#include "Doc/CafCoreTypesDoc/CProtocolCollectionDoc.h" -#include "Doc/CafInstallRequestDoc/CInstallRequestDoc.h" -#include "Doc/DiagRequestDoc/CDiagRequestDoc.h" -#include "Doc/MgmtRequestDoc/CMgmtRequestDoc.h" -#include "Doc/PayloadEnvelopeDoc/CPayloadEnvelopeDoc.h" -#include "Doc/ProviderInfraDoc/CProviderRegDoc.h" -#include "Doc/ProviderRequestDoc/CProviderCollectSchemaRequestDoc.h" -#include "Doc/ProviderRequestDoc/CProviderRequestDoc.h" -#include "Doc/ProviderRequestDoc/CProviderRequestHeaderDoc.h" -#include "Doc/ResponseDoc/CErrorResponseDoc.h" -#include "Doc/ResponseDoc/CResponseDoc.h" -#include "Integration/Core/CIntMessage.h" -#include "Integration/IIntMessage.h" -#include "Memory/DynamicArray/DynamicArrayInc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Integration/Caf/CCafMessagePayload.h" -#include "Integration/Caf/CCafMessageCreator.h" -#include "Doc/DocXml/PayloadEnvelopeXml/PayloadEnvelopeXmlRoots.h" - -using namespace Caf; - -SmartPtrIIntMessage CCafMessageCreator::createPayloadEnvelope( - const SmartPtrCResponseDoc& response, - const std::string& relFilename, - const IIntMessage::SmartPtrCHeaders& headers) { - CAF_CM_STATIC_FUNC_VALIDATE("CCafMessageCreator", "createPayloadEnvelope"); - CAF_CM_VALIDATE_SMARTPTR(response); - CAF_CM_VALIDATE_STRING(relFilename); - - SmartPtrCCafMessageHeadersWriter messageHeadersWriter = - CCafMessageHeadersWriter::create(); - messageHeadersWriter->setRelFilename(relFilename); - - const SmartPtrIIntMessage rc = createPayloadEnvelope( - "response", - XmlRoots::saveResponseToString(response), - response->getClientId(), - response->getRequestId(), - response->getPmeId(), - response->getResponseHeader()->getVersion(), - messageHeadersWriter->getHeaders(), - headers, - response->getAttachmentCollection()); - - return rc; -} - -SmartPtrIIntMessage CCafMessageCreator::createPayloadEnvelope( - const SmartPtrCErrorResponseDoc& errorResponse, - const std::string& relFilename, - const IIntMessage::SmartPtrCHeaders& headers) { - CAF_CM_STATIC_FUNC_VALIDATE("CCafMessageCreator", "createPayloadEnvelope"); - CAF_CM_VALIDATE_SMARTPTR(errorResponse); - CAF_CM_VALIDATE_STRING(relFilename); - - SmartPtrCCafMessageHeadersWriter messageHeadersWriter = - CCafMessageHeadersWriter::create(); - messageHeadersWriter->setRelFilename(relFilename); - - const SmartPtrIIntMessage rc = createPayloadEnvelope( - "errorResponse", - XmlRoots::saveErrorResponseToString(errorResponse), - errorResponse->getClientId(), - errorResponse->getRequestId(), - errorResponse->getPmeId(), - errorResponse->getResponseHeader()->getVersion(), - messageHeadersWriter->getHeaders(), - headers); - - return rc; -} - -SmartPtrIIntMessage CCafMessageCreator::createPayloadEnvelope( - const SmartPtrCMgmtRequestDoc& mgmtRequest, - const IIntMessage::SmartPtrCHeaders& headers) { - CAF_CM_STATIC_FUNC_VALIDATE("CCafMessageCreator", "createPayloadEnvelope"); - CAF_CM_VALIDATE_SMARTPTR(mgmtRequest); - - const SmartPtrIIntMessage rc = createPayloadEnvelope( - "mgmtRequest", - XmlRoots::saveMgmtRequestToString(mgmtRequest), - mgmtRequest->getClientId(), - mgmtRequest->getRequestId(), - mgmtRequest->getPmeId(), - mgmtRequest->getRequestHeader()->getVersion(), - IIntMessage::SmartPtrCHeaders(), - headers, - mgmtRequest->getAttachmentCollection(), - mgmtRequest->getRequestHeader()->getProtocolCollection()); - - return rc; -} - -SmartPtrIIntMessage CCafMessageCreator::createPayloadEnvelope( - const SmartPtrCPayloadEnvelopeDoc& payloadEnvelope, - const std::deque& attachmentCollection, - const IIntMessage::SmartPtrCHeaders& newHeaders, - const IIntMessage::SmartPtrCHeaders& origHeaders) { - CAF_CM_STATIC_FUNC_VALIDATE("CCafMessageCreator", "createPayloadEnvelope"); - CAF_CM_VALIDATE_SMARTPTR(payloadEnvelope); - - SmartPtrCPayloadEnvelopeDoc payloadEnvelopeNew = payloadEnvelope; - if (attachmentCollection.size() > 0) { - SmartPtrCAttachmentCollectionDoc attachmentCollectionDoc; - attachmentCollectionDoc.CreateInstance(); - attachmentCollectionDoc->initialize(attachmentCollection); - - payloadEnvelopeNew.CreateInstance(); - payloadEnvelopeNew->initialize( - payloadEnvelope->getClientId(), - payloadEnvelope->getRequestId(), - payloadEnvelope->getPmeId(), - payloadEnvelope->getPayloadType(), - payloadEnvelope->getPayloadVersion(), - attachmentCollectionDoc, - payloadEnvelope->getProtocolCollection(), - payloadEnvelope->getHeaderCollection(), - payloadEnvelope->getVersion()); - } - - const std::string payloadEnvelopeStr = - XmlRoots::savePayloadEnvelopeToString(payloadEnvelopeNew); - - SmartPtrCIntMessage messageImpl; - messageImpl.CreateInstance(); - messageImpl->initializeStr(payloadEnvelopeStr, newHeaders, origHeaders); - - return messageImpl; -} - -SmartPtrIIntMessage CCafMessageCreator::createFromProviderResponse( - const SmartPtrCDynamicByteArray& providerResponse, - const std::string& relFilename, - const IIntMessage::SmartPtrCHeaders& headers) { - CAF_CM_STATIC_FUNC_VALIDATE("CCafMessageCreator", "createFromProviderResponse"); - CAF_CM_VALIDATE_SMARTPTR(providerResponse); - CAF_CM_VALIDATE_STRING(relFilename); - - SmartPtrCCafMessageHeadersWriter messageHeadersWriter = - CCafMessageHeadersWriter::create(); - messageHeadersWriter->setPayloadType("providerResponse"); - messageHeadersWriter->setRelFilename(relFilename); - - SmartPtrCIntMessage messageImpl; - messageImpl.CreateInstance(); - messageImpl->initialize(providerResponse, - messageHeadersWriter->getHeaders(), headers); - - return messageImpl; -} - -SmartPtrIIntMessage CCafMessageCreator::create( - const SmartPtrCDynamicByteArray payload, - const std::deque& attachmentCollection, - const IIntMessage::SmartPtrCHeaders& headers) { - CAF_CM_STATIC_FUNC_VALIDATE("CCafMessageCreator", "create"); - CAF_CM_VALIDATE_SMARTPTR(payload); - - const std::string payloadStr = reinterpret_cast(payload->getPtr()); - const SmartPtrCXmlElement payloadXml = - CXmlUtils::parseString(payloadStr, std::string()); - - payloadXml->removeChild("attachmentCollection"); - if (! attachmentCollection.empty()) { - SmartPtrCAttachmentCollectionDoc attachmentCollectionDoc; - attachmentCollectionDoc.CreateInstance(); - attachmentCollectionDoc->initialize(attachmentCollection); - - const SmartPtrCXmlElement attachmentCollectionXml = - payloadXml->createAndAddElement("attachmentCollection"); - AttachmentCollectionXml::add(attachmentCollectionDoc, attachmentCollectionXml); - } - - SmartPtrCIntMessage messageImpl; - messageImpl.CreateInstance(); - messageImpl->initializeStr( - payloadXml->saveToString(), CIntMessage::SmartPtrCHeaders(), headers); - - return messageImpl; -} - -SmartPtrIIntMessage CCafMessageCreator::create( - const SmartPtrCMgmtRequestDoc& mgmtRequest, - const IIntMessage::SmartPtrCHeaders& headers) { - CAF_CM_STATIC_FUNC_VALIDATE("CCafMessageCreator", "create"); - CAF_CM_VALIDATE_SMARTPTR(mgmtRequest); - - const std::string mgmtRequestStr = - XmlRoots::saveMgmtRequestToString(mgmtRequest); - - SmartPtrCCafMessageHeadersWriter messageHeadersWriter = - CCafMessageHeadersWriter::create(); - messageHeadersWriter->setPayloadType("mgmtRequest"); - - SmartPtrCIntMessage messageImpl; - messageImpl.CreateInstance(); - messageImpl->initializeStr(mgmtRequestStr, - messageHeadersWriter->getHeaders(), headers); - - return messageImpl; -} - -SmartPtrIIntMessage CCafMessageCreator::create( - const SmartPtrCDiagRequestDoc& diagRequest, - const IIntMessage::SmartPtrCHeaders& headers) { - CAF_CM_STATIC_FUNC_VALIDATE("CCafMessageCreator", "create"); - CAF_CM_VALIDATE_SMARTPTR(diagRequest); - - const std::string diagRequestStr = - XmlRoots::saveDiagRequestToString(diagRequest); - - SmartPtrCCafMessageHeadersWriter messageHeadersWriter = - CCafMessageHeadersWriter::create(); - messageHeadersWriter->setPayloadType("diagRequest"); - - SmartPtrCIntMessage messageImpl; - messageImpl.CreateInstance(); - messageImpl->initializeStr(diagRequestStr, - messageHeadersWriter->getHeaders(), headers); - - return messageImpl; -} - -SmartPtrIIntMessage CCafMessageCreator::create( - const SmartPtrCInstallRequestDoc& installRequest, - const IIntMessage::SmartPtrCHeaders& headers) { - CAF_CM_STATIC_FUNC_VALIDATE("CCafMessageCreator", "create"); - CAF_CM_VALIDATE_SMARTPTR(installRequest); - - const std::string installRequestStr = - XmlRoots::saveInstallRequestToString(installRequest); - - SmartPtrCCafMessageHeadersWriter messageHeadersWriter = - CCafMessageHeadersWriter::create(); - messageHeadersWriter->setPayloadType("installRequest"); - - SmartPtrCIntMessage messageImpl; - messageImpl.CreateInstance(); - messageImpl->initializeStr(installRequestStr, - messageHeadersWriter->getHeaders(), headers); - - return messageImpl; -} - -SmartPtrIIntMessage CCafMessageCreator::create( - const SmartPtrCProviderRegDoc& providerReg, - const IIntMessage::SmartPtrCHeaders& headers) { - CAF_CM_STATIC_FUNC_VALIDATE("CCafMessageCreator", "create"); - CAF_CM_VALIDATE_SMARTPTR(providerReg); - - const std::string installRequestStr = - XmlRoots::saveProviderRegToString(providerReg); - - SmartPtrCCafMessageHeadersWriter messageHeadersWriter = - CCafMessageHeadersWriter::create(); - messageHeadersWriter->setPayloadType("providerReg"); - - SmartPtrCIntMessage messageImpl; - messageImpl.CreateInstance(); - messageImpl->initializeStr(installRequestStr, - messageHeadersWriter->getHeaders(), headers); - - return messageImpl; -} - -SmartPtrIIntMessage CCafMessageCreator::create( - const SmartPtrCProviderCollectSchemaRequestDoc& providerCollectSchemaRequest, - const std::string& relFilename, - const std::string& relDirectory, - const IIntMessage::SmartPtrCHeaders& headers) { - CAF_CM_STATIC_FUNC_VALIDATE("CCafMessageCreator", "create"); - CAF_CM_VALIDATE_SMARTPTR(providerCollectSchemaRequest); - CAF_CM_VALIDATE_STRING(relFilename); - CAF_CM_VALIDATE_STRING(relDirectory); - - const std::string providerCollectSchemaRequestMem = - XmlRoots::saveProviderCollectSchemaRequestToString(providerCollectSchemaRequest); - - SmartPtrCCafMessageHeadersWriter messageHeadersWriter = - CCafMessageHeadersWriter::create(); - messageHeadersWriter->setPayloadType("providerCollectSchemaRequest"); - messageHeadersWriter->setRelFilename(relFilename); - messageHeadersWriter->setRelDirectory(relDirectory); - - SmartPtrCIntMessage messageImpl; - messageImpl.CreateInstance(); - messageImpl->initializeStr(providerCollectSchemaRequestMem, - messageHeadersWriter->getHeaders(), headers); - - return messageImpl; -} - -SmartPtrIIntMessage CCafMessageCreator::create( - const SmartPtrCProviderRequestDoc& providerRequest, - const std::string& relFilename, - const std::string& relDirectory, - const std::string& providerUri, - const IIntMessage::SmartPtrCHeaders& headers) { - CAF_CM_STATIC_FUNC_VALIDATE("CCafMessageCreator", "create"); - CAF_CM_VALIDATE_SMARTPTR(providerRequest); - CAF_CM_VALIDATE_STRING(relFilename); - CAF_CM_VALIDATE_STRING(relDirectory); - - SmartPtrCProviderRequestHeaderDoc requestHeader = providerRequest->getRequestHeader(); - SmartPtrCPropertyCollectionDoc propertyBag = requestHeader->getEchoPropertyBag(); - - std::deque newProperties; - if (!propertyBag.IsNull()) { - newProperties.assign(propertyBag->getProperty().begin(), propertyBag->getProperty().end()); - } - - std::deque relDirectoryValue(1, relDirectory); - SmartPtrCPropertyDoc relDirectoryProp; - relDirectoryProp.CreateInstance(); - relDirectoryProp->initialize("relDirectory", PROPERTY_STRING, relDirectoryValue); - newProperties.push_back(relDirectoryProp); - - std::deque providerUriValue(1, providerUri); - SmartPtrCPropertyDoc providerUriProp; - providerUriProp.CreateInstance(); - providerUriProp->initialize("providerUri", PROPERTY_STRING, providerUriValue); - newProperties.push_back(providerUriProp); - - SmartPtrCPropertyCollectionDoc newPropertyBag; - newPropertyBag.CreateInstance(); - newPropertyBag->initialize(newProperties); - - SmartPtrCProviderRequestHeaderDoc newRequestHeader; - newRequestHeader.CreateInstance(); - newRequestHeader->initialize(requestHeader->getRequestConfig(), newPropertyBag); - - SmartPtrCProviderRequestDoc newProviderRequest; - newProviderRequest.CreateInstance(); - newProviderRequest->initialize(providerRequest->getClientId(), - providerRequest->getRequestId(), providerRequest->getPmeId(), newRequestHeader, - providerRequest->getBatch(), providerRequest->getAttachmentCollection()); - - const std::string providerRequestMem = - XmlRoots::saveProviderRequestToString(newProviderRequest); - - SmartPtrCCafMessageHeadersWriter messageHeadersWriter = - CCafMessageHeadersWriter::create(); - messageHeadersWriter->setPayloadType("providerRequest"); - messageHeadersWriter->setRelFilename(relFilename); - messageHeadersWriter->setRelDirectory(relDirectory); - - if (! providerUri.empty()) { - messageHeadersWriter->setProviderUri(providerUri); - } - - SmartPtrCIntMessage messageImpl; - messageImpl.CreateInstance(); - messageImpl->initializeStr(providerRequestMem, - messageHeadersWriter->getHeaders(), headers); - - return messageImpl; -} - -SmartPtrIIntMessage CCafMessageCreator::createPayloadEnvelope( - const std::string& payloadType, - const std::string& payloadStr, - const UUID& clientId, - const UUID& requestId, - const std::string& pmeId, - const std::string& payloadVersion, - const IIntMessage::SmartPtrCHeaders& newHeaders, - const IIntMessage::SmartPtrCHeaders& origHeaders, - const SmartPtrCAttachmentCollectionDoc& attachmentCollection, - const SmartPtrCProtocolCollectionDoc& protocolCollection) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CCafMessageCreator", "createPayloadEnvelope"); - CAF_CM_VALIDATE_STRING(payloadType); - CAF_CM_VALIDATE_STRING(payloadStr); - // clientId is optional - // requestId is optional - // pmeId is optional - CAF_CM_VALIDATE_STRING(payloadVersion); - - SmartPtrCIntMessage messageImpl; - if (::IsEqualGUID(requestId, CAFCOMMON_GUID_NULL)) { - CAF_CM_LOG_WARN_VA1("Message is not associated with a request - %s", payloadStr.c_str()); - } else { - const std::string outputDir = - AppConfigUtils::getRequiredString(_sAppConfigGlobalParamOutputDir); - - const std::string destAttachmentFilename = - BasePlatform::UuidToString(requestId) + "-EnvelopePayload.xml"; - const std::string destAttachmentPath = FileSystemUtils::buildPath( - outputDir, "att", destAttachmentFilename); - const std::string destAttachmentUri = - "file:///" + destAttachmentPath + "?relPath=" + destAttachmentFilename; - - const SmartPtrCDynamicByteArray payload = - CCafMessagePayload::createBufferFromStr(payloadStr); - FileSystemUtils::saveByteFile(destAttachmentPath, payload); - - const std::string cmsPolicyStr = AppConfigUtils::getRequiredString( - "security", "cms_policy"); - const CMS_POLICY cmsPolicy = - EnumConvertersXml::convertStringToCmsPolicy(cmsPolicyStr); - - SmartPtrCAttachmentDoc envelopePayloadAttachment; - envelopePayloadAttachment.CreateInstance(); - envelopePayloadAttachment->initialize("_EnvelopePayload_", "EnvelopePayload", - destAttachmentUri, false, cmsPolicy); - - std::deque attachmentCollectionNew; - if (! attachmentCollection.IsNull()) { - attachmentCollectionNew = attachmentCollection->getAttachment(); - } - attachmentCollectionNew.push_back(envelopePayloadAttachment); - - SmartPtrCAttachmentCollectionDoc attachmentCollectionDocNew; - attachmentCollectionDocNew.CreateInstance(); - attachmentCollectionDocNew->initialize(attachmentCollectionNew); - - SmartPtrCPayloadEnvelopeDoc payloadEnvelope; - payloadEnvelope.CreateInstance(); - payloadEnvelope->initialize( - clientId, - requestId, - pmeId, - payloadType, - payloadVersion, - attachmentCollectionDocNew, - protocolCollection); - - const std::string payloadEnvelopeStr = - XmlRoots::savePayloadEnvelopeToString(payloadEnvelope); - - const CIntMessage::SmartPtrCHeaders mergedHeaders = - CIntMessage::mergeHeaders(newHeaders, origHeaders); - - SmartPtrCCafMessageHeadersWriter messageHeadersWriter = - CCafMessageHeadersWriter::create(); - messageHeadersWriter->setPayloadType(payloadType); - - messageImpl.CreateInstance(); - messageImpl->initializeStr( - payloadEnvelopeStr, messageHeadersWriter->getHeaders(), mergedHeaders); - } - - return messageImpl; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Caf/CCafMessageHeaders.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Caf/CCafMessageHeaders.cpp deleted file mode 100644 index 7840cdf4f..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Caf/CCafMessageHeaders.cpp +++ /dev/null @@ -1,418 +0,0 @@ -/* - * Author: bwilliams - * Created: Jul 2009 - * - * Copyright (C) 2009-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "IVariant.h" -#include "Integration/IIntMessage.h" -#include "Exception/CCafException.h" -#include "Integration/Caf/CCafMessageHeaders.h" -#include "Integration/Core/FileHeaders.h" - -using namespace Caf; - -SmartPtrCCafMessageHeaders CCafMessageHeaders::create( - const IIntMessage::SmartPtrCHeaders& headers) { - CAF_CM_STATIC_FUNC_VALIDATE("CCafMessageHeaders", "create"); - CAF_CM_VALIDATE_SMARTPTR(headers); - - SmartPtrCCafMessageHeaders rc; - rc.CreateInstance(); - rc->initialize(headers); - - return rc; -} - -CCafMessageHeaders::CCafMessageHeaders(void) : - _isInitialized(false), - CAF_CM_INIT_LOG("CCafMessageHeaders") { -} - -CCafMessageHeaders::~CCafMessageHeaders(void) { -} - -void CCafMessageHeaders::initialize( - const IIntMessage::SmartPtrCHeaders& headers) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_SMARTPTR(headers); - - _headers = headers; - _isInitialized = true; -} - -IIntMessage::SmartPtrCHeaders CCafMessageHeaders::getHeaders() const { - CAF_CM_FUNCNAME_VALIDATE("getHeaders"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _headers; -} - -std::string CCafMessageHeaders::getPayloadType() const { - CAF_CM_FUNCNAME_VALIDATE("getPayloadType"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return getRequiredStr("payloadType"); -} - -std::string CCafMessageHeaders::getPayloadTypeOpt( - const std::string& defaultVal) const { - CAF_CM_FUNCNAME_VALIDATE("getPayloadTypeOpt"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - std::string rcStr = getOptionalStr("payloadType"); - if (rcStr.empty()) { - rcStr = defaultVal; - } - - return rcStr; -} - -std::string CCafMessageHeaders::getVersion() const { - CAF_CM_FUNCNAME_VALIDATE("getVersion"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return getRequiredStr("version"); -} - -std::string CCafMessageHeaders::getVersionOpt( - const std::string& defaultVal) const { - CAF_CM_FUNCNAME_VALIDATE("getVersionOpt"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - std::string rcStr = getOptionalStr("version"); - if (rcStr.empty()) { - rcStr = defaultVal; - } - - return rcStr; -} - -UUID CCafMessageHeaders::getClientId() const { - CAF_CM_FUNCNAME_VALIDATE("getClientId"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - UUID rc; - const std::string rcStr = getClientIdStr(); - BasePlatform::UuidFromString(rcStr.c_str(), rc); - return rc; -} - -std::string CCafMessageHeaders::getClientIdStr() const { - CAF_CM_FUNCNAME_VALIDATE("getClientIdStr"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return getRequiredStr("clientId"); -} - -UUID CCafMessageHeaders::getClientIdOpt( - const UUID defaultVal) const { - CAF_CM_FUNCNAME_VALIDATE("getClientIdOpt"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - UUID rc = defaultVal; - const std::string rcStr = getClientIdStrOpt(); - if (! rcStr.empty()) { - BasePlatform::UuidFromString(rcStr.c_str(), rc); - } - - return rc; -} - -std::string CCafMessageHeaders::getClientIdStrOpt( - const std::string& defaultVal) const { - CAF_CM_FUNCNAME_VALIDATE("getClientIdStrOpt"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - std::string rcStr = getOptionalStr("clientId"); - if (rcStr.empty()) { - rcStr = defaultVal; - } - - return rcStr; -} - -UUID CCafMessageHeaders::getRequestId() const { - CAF_CM_FUNCNAME_VALIDATE("getRequestId"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - UUID rc; - const std::string rcStr = getRequestIdStr(); - BasePlatform::UuidFromString(rcStr.c_str(), rc); - return rc; -} - -std::string CCafMessageHeaders::getRequestIdStr() const { - CAF_CM_FUNCNAME_VALIDATE("getRequestIdStr"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return getRequiredStr("requestId"); -} - -UUID CCafMessageHeaders::getRequestIdOpt( - const UUID defaultVal) const { - CAF_CM_FUNCNAME_VALIDATE("getRequestIdOpt"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - UUID rc = defaultVal; - const std::string rcStr = getRequestIdStrOpt(); - if (! rcStr.empty()) { - BasePlatform::UuidFromString(rcStr.c_str(), rc); - } - - return rc; -} - -std::string CCafMessageHeaders::getRequestIdStrOpt( - const std::string& defaultVal) const { - CAF_CM_FUNCNAME_VALIDATE("getRequestIdStrOpt"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - std::string rcStr = getOptionalStr("requestId"); - if (rcStr.empty()) { - rcStr = defaultVal; - } - - return rcStr; -} - -std::string CCafMessageHeaders::getPmeId() const { - CAF_CM_FUNCNAME_VALIDATE("getPmeId"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return getRequiredStr("pmeId"); -} - -std::string CCafMessageHeaders::getPmeIdOpt( - const std::string& defaultVal) const { - CAF_CM_FUNCNAME_VALIDATE("getPmeIdOpt"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - std::string rcStr = getOptionalStr("pmeId"); - if (rcStr.empty()) { - rcStr = defaultVal; - } - - return rcStr; -} - -UUID CCafMessageHeaders::getSessionId() const { - CAF_CM_FUNCNAME_VALIDATE("getSessionId"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - UUID rc; - const std::string rcStr = getSessionIdStr(); - BasePlatform::UuidFromString(rcStr.c_str(), rc); - return rc; -} - -std::string CCafMessageHeaders::getSessionIdStr() const { - CAF_CM_FUNCNAME_VALIDATE("getSessionIdStr"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return getRequiredStr("sessionId"); -} - -UUID CCafMessageHeaders::getSessionIdOpt( - const UUID defaultVal) const { - CAF_CM_FUNCNAME_VALIDATE("getSessionIdOpt"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - UUID rc = defaultVal; - const std::string rcStr = getSessionIdStrOpt(); - if (! rcStr.empty()) { - BasePlatform::UuidFromString(rcStr.c_str(), rc); - } - - return rc; -} - -std::string CCafMessageHeaders::getSessionIdStrOpt( - const std::string& defaultVal) const { - CAF_CM_FUNCNAME_VALIDATE("getSessionIdStrOpt"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - std::string rcStr = getOptionalStr("sessionId"); - if (rcStr.empty()) { - rcStr = defaultVal; - } - - return rcStr; -} - -std::string CCafMessageHeaders::getRelDirectory() const { - CAF_CM_FUNCNAME_VALIDATE("getRelDirectory"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return getRequiredStr("relDirectory"); -} - -std::string CCafMessageHeaders::getRelDirectoryOpt( - const std::string& defaultVal) const { - CAF_CM_FUNCNAME_VALIDATE("getRelDirectoryOpt"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - std::string rcStr = getOptionalStr("relDirectory"); - if (rcStr.empty()) { - rcStr = defaultVal; - } - - return rcStr; -} - -std::string CCafMessageHeaders::getRelFilename() const { - CAF_CM_FUNCNAME_VALIDATE("getRelFilename"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return getRequiredStr(FileHeaders::_sFILENAME); -} - -std::string CCafMessageHeaders::getRelFilenameOpt( - const std::string& defaultVal) const { - CAF_CM_FUNCNAME_VALIDATE("getRelFilenameOpt"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - std::string rcStr = getOptionalStr(FileHeaders::_sFILENAME); - if (rcStr.empty()) { - rcStr = defaultVal; - } - - return rcStr; -} - -std::string CCafMessageHeaders::getProviderUri() const { - CAF_CM_FUNCNAME_VALIDATE("getProviderUri"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return getRequiredStr("providerUri"); -} - -std::string CCafMessageHeaders::getProviderUriOpt( - const std::string& defaultVal) const { - CAF_CM_FUNCNAME_VALIDATE("getProviderUriOpt"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - std::string rcStr = getOptionalStr("providerUri"); - if (rcStr.empty()) { - rcStr = defaultVal; - } - - return rcStr; -} - -std::string CCafMessageHeaders::getFlowDirection() const { - CAF_CM_FUNCNAME_VALIDATE("getFlowDirection"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return getRequiredStr("cafcomm.internal.msgflow"); -} - -std::string CCafMessageHeaders::getFlowDirectionOpt( - const std::string& defaultVal) const { - CAF_CM_FUNCNAME_VALIDATE("getFlowDirectionOpt"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - std::string rcStr = getOptionalStr("cafcomm.internal.msgflow"); - if (rcStr.empty()) { - rcStr = defaultVal; - } - - return rcStr; -} - -std::string CCafMessageHeaders::getRequiredStr( - const std::string& key) const { - CAF_CM_FUNCNAME_VALIDATE("getRequiredStr"); - CAF_CM_VALIDATE_STRING(key); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return findRequiredHeader(key)->toString(); -} - -std::string CCafMessageHeaders::getOptionalStr( - const std::string& key, - const std::string& defaultVal) const { - CAF_CM_FUNCNAME_VALIDATE("getOptionalStr"); - CAF_CM_VALIDATE_STRING(key); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - std::string rcStr = defaultVal; - const SmartPtrIVariant valueVar = findOptionalHeader(key); - if (! valueVar.IsNull()) { - rcStr = valueVar->toString(); - } - - return rcStr; -} - -bool CCafMessageHeaders::getRequiredBool( - const std::string& key) const { - CAF_CM_FUNCNAME_VALIDATE("getRequiredBool"); - CAF_CM_VALIDATE_STRING(key); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - const SmartPtrIVariant valueVar = findRequiredHeader(key); - CAF_CM_VALIDATE_BOOL(valueVar->isBool()); - - const std::string valueStr = valueVar->toString(); - CAF_CM_LOG_DEBUG_VA2("key: %s, value: %s", key.c_str(), valueStr.c_str()); - - return (valueStr.compare("true") == 0); -} - -bool CCafMessageHeaders::getOptionalBool( - const std::string& key, - const bool defaultVal) const { - CAF_CM_FUNCNAME_VALIDATE("getOptionalBool"); - CAF_CM_VALIDATE_STRING(key); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - const SmartPtrIVariant valueVar = findOptionalHeader(key); - - bool rc = defaultVal; - if (! valueVar.IsNull()) { - CAF_CM_VALIDATE_BOOL(valueVar->isBool()); - - const std::string valueStr = valueVar->toString(); - CAF_CM_LOG_DEBUG_VA2("key: %s, value: %s", key.c_str(), valueStr.c_str()); - - rc = (valueStr.compare("true") == 0); - } - - return rc; -} - -SmartPtrIVariant CCafMessageHeaders::findOptionalHeader( - const std::string& key) const { - CAF_CM_FUNCNAME_VALIDATE("findOptionalHeader"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(key); - - SmartPtrIVariant value; - - IIntMessage::CHeaders::const_iterator headerIter = _headers->find(key); - if (headerIter != _headers->end()) { - value = headerIter->second.first; - } - - return value; -} - -SmartPtrIVariant CCafMessageHeaders::findRequiredHeader( - const std::string& key) const { - CAF_CM_FUNCNAME("findRequiredHeader"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(key); - - IIntMessage::CHeaders::const_iterator headerIter = _headers->find(key); - if (headerIter == _headers->end()) { - CAF_CM_EXCEPTIONEX_VA1(NoSuchElementException, ERROR_NOT_FOUND, - "Key not found in headers - %s", key.c_str()); - } - - return headerIter->second.first; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Caf/CCafMessageHeadersWriter.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Caf/CCafMessageHeadersWriter.cpp deleted file mode 100644 index f9475d555..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Caf/CCafMessageHeadersWriter.cpp +++ /dev/null @@ -1,223 +0,0 @@ -/* - * Author: bwilliams - * Created: Jul 2009 - * - * Copyright (C) 2009-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Integration/IIntMessage.h" -#include "Integration/Caf/CCafMessageHeadersWriter.h" -#include "Integration/Core/FileHeaders.h" -#include "Integration/Core/MessageHeaders.h" - -using namespace Caf; - -SmartPtrCCafMessageHeadersWriter CCafMessageHeadersWriter::create() { - SmartPtrCCafMessageHeadersWriter rc; - rc.CreateInstance(); - rc->initialize(); - - return rc; -} - -CCafMessageHeadersWriter::CCafMessageHeadersWriter(void) : - _isInitialized(false), - CAF_CM_INIT("CCafMessageHeadersWriter") { -} - -CCafMessageHeadersWriter::~CCafMessageHeadersWriter(void) { -} - -void CCafMessageHeadersWriter::initialize() { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - - _headers.CreateInstance(); - _isInitialized = true; -} - -IIntMessage::SmartPtrCHeaders CCafMessageHeadersWriter::getHeaders() const { - CAF_CM_FUNCNAME_VALIDATE("getHeaders"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _headers; -} - -void CCafMessageHeadersWriter::setPayloadType( - const std::string& payloadType) { - CAF_CM_FUNCNAME_VALIDATE("setPayloadType"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(payloadType); - - insertString("payloadType", payloadType); -} - -void CCafMessageHeadersWriter::setVersion( - const std::string& version) { - CAF_CM_FUNCNAME_VALIDATE("setVersion"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(version); - - insertString("version", version); -} - -void CCafMessageHeadersWriter::setPayloadVersion( - const std::string& payloadVersion) { - CAF_CM_FUNCNAME_VALIDATE("setPayloadVersion"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(payloadVersion); - - insertString("payloadVersion", payloadVersion); -} - -void CCafMessageHeadersWriter::setClientId( - const UUID& clientId) { - CAF_CM_FUNCNAME_VALIDATE("setClientId"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - std::string clientIdStr = BasePlatform::UuidToString(clientId); - insertString("clientId", clientIdStr); -} - -void CCafMessageHeadersWriter::setClientId( - const std::string& clientIdStr) { - CAF_CM_FUNCNAME_VALIDATE("setClientId"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(clientIdStr); - - insertString("clientId", clientIdStr); -} - -void CCafMessageHeadersWriter::setRequestId( - const UUID& requestId) { - CAF_CM_FUNCNAME_VALIDATE("setRequestId"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - std::string requestIdStr = BasePlatform::UuidToString(requestId); - insertString("requestId", requestIdStr); -} - -void CCafMessageHeadersWriter::setRequestId( - const std::string& requestIdStr) { - CAF_CM_FUNCNAME_VALIDATE("setRequestId"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(requestIdStr); - - insertString("requestId", requestIdStr); -} - -void CCafMessageHeadersWriter::setPmeId( - const std::string& pmeId) { - CAF_CM_FUNCNAME_VALIDATE("setPmeId"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(pmeId); - - insertString("pmeId", pmeId); -} - -void CCafMessageHeadersWriter::setSessionId( - const UUID& sessionId) { - CAF_CM_FUNCNAME_VALIDATE("setSessionId"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - std::string sessionIdStr = BasePlatform::UuidToString(sessionId); - insertString("sessionId", sessionIdStr); -} - -void CCafMessageHeadersWriter::setSessionId( - const std::string& sessionIdStr) { - CAF_CM_FUNCNAME_VALIDATE("setSessionId"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(sessionIdStr); - - insertString("sessionId", sessionIdStr); -} - -void CCafMessageHeadersWriter::setRelDirectory( - const std::string& relDirectory) { - CAF_CM_FUNCNAME_VALIDATE("setRelDirectory"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(relDirectory); - - insertString("relDirectory", relDirectory); -} - -void CCafMessageHeadersWriter::setRelFilename( - const std::string& relFilename) { - CAF_CM_FUNCNAME_VALIDATE("setRelFilename"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(relFilename); - - insertString(FileHeaders::_sFILENAME, relFilename); -} - -void CCafMessageHeadersWriter::setProviderUri( - const std::string& providerUri) { - CAF_CM_FUNCNAME_VALIDATE("setProviderUri"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(providerUri); - - insertString("providerUri", providerUri); -} - -void CCafMessageHeadersWriter::setIsThrowable( - const bool& isThrowable) { - CAF_CM_FUNCNAME_VALIDATE("setIsThrowable"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - insertBool(MessageHeaders::_sIS_THROWABLE, isThrowable); -} - -void CCafMessageHeadersWriter::setIsMultiPart( - const bool& isMultiPart) { - CAF_CM_FUNCNAME_VALIDATE("setIsMultiPart"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - insertBool(MessageHeaders::_sMULTIPART, isMultiPart); -} - -void CCafMessageHeadersWriter::setProtocol( - const std::string& protocol) { - CAF_CM_FUNCNAME_VALIDATE("setProtocol"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(protocol); - - insertString(MessageHeaders::_sPROTOCOL_TYPE, protocol); -} - -void CCafMessageHeadersWriter::setProtocolAddress( - const std::string& protocolAddress) { - CAF_CM_FUNCNAME_VALIDATE("setProtocolAddress"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(protocolAddress); - - insertString(MessageHeaders::_sPROTOCOL_CONNSTR, protocolAddress); -} - -void CCafMessageHeadersWriter::setFlowDirection( - const std::string& flowDirection) { - CAF_CM_FUNCNAME_VALIDATE("setFlowDirection"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(flowDirection); - - insertString("cafcomm.internal.msgflow", flowDirection); -} - -void CCafMessageHeadersWriter::insertString( - const std::string& key, - const std::string& value) { - CAF_CM_FUNCNAME_VALIDATE("insertString"); - CAF_CM_VALIDATE_STRING(key); - CAF_CM_VALIDATE_STRING(value); - _headers->insert(std::make_pair(key, std::make_pair(CVariant::createString(value), SmartPtrICafObject()))); -} - -void CCafMessageHeadersWriter::insertBool( - const std::string& key, - const bool& value) { - CAF_CM_FUNCNAME_VALIDATE("insertBool"); - CAF_CM_VALIDATE_STRING(key); - _headers->insert(std::make_pair(key, std::make_pair(CVariant::createBool(value), SmartPtrICafObject()))); -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Caf/CCafMessagePayload.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Caf/CCafMessagePayload.cpp deleted file mode 100644 index 68109ac36..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Caf/CCafMessagePayload.cpp +++ /dev/null @@ -1,197 +0,0 @@ -/* - * Author: bwilliams - * Created: Jul 2009 - * - * Copyright (C) 2009-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Doc/CafCoreTypesDoc/CRequestHeaderDoc.h" -#include "Doc/ResponseDoc/CEventKeyCollectionDoc.h" -#include "Doc/ResponseDoc/CEventKeyDoc.h" -#include "Doc/ResponseDoc/CManifestDoc.h" -#include "Memory/DynamicArray/DynamicArrayInc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Integration/Caf/CCafMessagePayload.h" -#include "Doc/DocXml/CafCoreTypesXml/RequestHeaderXml.h" -#include "Doc/DocXml/ResponseXml/ManifestXml.h" -#include "Doc/DocXml/ResponseXml/EventKeyCollectionXml.h" - -using namespace Caf; - -SmartPtrCCafMessagePayload CCafMessagePayload::create( - const SmartPtrCDynamicByteArray& payload, - const std::string& payloadType) { - CAF_CM_STATIC_FUNC_VALIDATE("CCafMessagePayload", "create"); - CAF_CM_VALIDATE_SMARTPTR(payload); - - SmartPtrCCafMessagePayload rc; - rc.CreateInstance(); - rc->initialize(payload, payloadType); - - return rc; -} - -SmartPtrCCafMessagePayload CCafMessagePayload::createFromFile( - const std::string& payloadFile, - const std::string& payloadType) { - CAF_CM_STATIC_FUNC_VALIDATE("CCafMessagePayload", "createFromFile"); - CAF_CM_VALIDATE_STRING(payloadFile); - - const SmartPtrCDynamicByteArray payload = - FileSystemUtils::loadByteFile(payloadFile); - - return create(payload, payloadType); -} - -SmartPtrCCafMessagePayload CCafMessagePayload::createFromStr( - const std::string& payloadStr, - const std::string& payloadType) { - CAF_CM_STATIC_FUNC_VALIDATE("CCafMessagePayload", "createFromStr"); - CAF_CM_VALIDATE_STRING(payloadStr); - - SmartPtrCDynamicByteArray payload = createBufferFromStr(payloadStr); - - SmartPtrCCafMessagePayload rc; - rc.CreateInstance(); - rc->initialize(payload, payloadType); - - return rc; -} - -SmartPtrCDynamicByteArray CCafMessagePayload::createBufferFromStr( - const std::string& payloadStr) { - CAF_CM_STATIC_FUNC_VALIDATE("CCafMessagePayload", "createBufferFromStr"); - CAF_CM_VALIDATE_STRING(payloadStr); - - SmartPtrCDynamicByteArray rc; - rc.CreateInstance(); - rc->allocateBytes(static_cast(payloadStr.length())); - rc->memCpy(payloadStr.c_str(), static_cast(payloadStr.length())); - - return rc; -} - -SmartPtrCDynamicByteArray CCafMessagePayload::createBufferFromFile( - const std::string& payloadFile) { - CAF_CM_STATIC_FUNC_VALIDATE("CCafMessagePayload", "createBufferFromFile"); - CAF_CM_VALIDATE_STRING(payloadFile); - - return FileSystemUtils::loadByteFile(payloadFile); -} - -void CCafMessagePayload::saveToFile( - const SmartPtrCDynamicByteArray& payload, - const std::string& payloadPath) { - CAF_CM_STATIC_FUNC_VALIDATE("CCafMessagePayload", "saveToFile"); - CAF_CM_VALIDATE_SMARTPTR(payload); - CAF_CM_VALIDATE_STRING(payloadPath); - - FileSystemUtils::saveByteFile(payloadPath, - payload->getPtr(), payload->getByteCount()); -} - -std::string CCafMessagePayload::saveToStr( - const SmartPtrCDynamicByteArray& payload) { - CAF_CM_STATIC_FUNC_VALIDATE("CCafMessagePayload", "saveToStr"); - CAF_CM_VALIDATE_SMARTPTR(payload); - - return reinterpret_cast(payload->getPtr()); -} - -CCafMessagePayload::CCafMessagePayload(void) : - _isInitialized(false), - CAF_CM_INIT("CCafMessagePayload") { -} - -CCafMessagePayload::~CCafMessagePayload(void) { -} - -void CCafMessagePayload::initialize( - const SmartPtrCDynamicByteArray& payload, - const std::string& payloadType, - const std::string& encoding) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_SMARTPTR(payload); - CAF_CM_VALIDATE_STRING(encoding); - CAF_CM_VALIDATE_BOOL(encoding.compare("xml") == 0); - - _payload = payload; - _encoding = encoding; - _payloadStr = saveToStr(payload); - _payloadXml = CXmlUtils::parseString(_payloadStr, payloadType); - - _isInitialized = true; -} - -std::string CCafMessagePayload::getPayloadStr() const { - CAF_CM_FUNCNAME_VALIDATE("getPayloadStr"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _payloadStr; -} - -SmartPtrCDynamicByteArray CCafMessagePayload::getPayload() const { - CAF_CM_FUNCNAME_VALIDATE("getPayload"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _payload; -} - -std::string CCafMessagePayload::getVersion() const { - CAF_CM_FUNCNAME_VALIDATE("getVersion"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - SmartPtrCXmlElement headerXml = _payloadXml->findOptionalChild("requestHeader"); - if (headerXml.IsNull()) { - headerXml = _payloadXml->findOptionalChild("responseHeader"); - } - - std::string rc; - if (headerXml.IsNull()) { - rc = _payloadXml->findRequiredAttribute("version"); - } else { - rc = headerXml->findRequiredAttribute("version"); - } - - return rc; -} - -SmartPtrCRequestHeaderDoc CCafMessagePayload::getRequestHeader() const { - CAF_CM_FUNCNAME_VALIDATE("getRequestHeader"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - const SmartPtrCXmlElement requestHeaderXml = - _payloadXml->findRequiredChild("requestHeader"); - return RequestHeaderXml::parse(requestHeaderXml); -} - -SmartPtrCManifestDoc CCafMessagePayload::getManifest() const { - CAF_CM_FUNCNAME_VALIDATE("getManifest"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - const SmartPtrCXmlElement manifestXml = - _payloadXml->findRequiredChild("manifest"); - - return ManifestXml::parse(manifestXml); -} - -std::deque CCafMessagePayload::getEventKeyCollection() const { - CAF_CM_FUNCNAME_VALIDATE("getEventKeyCollection"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - std::deque rc; - - SmartPtrCXmlElement eventKeyCollectionXml = - _payloadXml->findOptionalChild("eventKeyCollection"); - if (eventKeyCollectionXml) { - const SmartPtrCEventKeyCollectionDoc eventKeyCollection = - EventKeyCollectionXml::parse(eventKeyCollectionXml); - - rc = eventKeyCollection->getEventKey(); - } - - return rc; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Caf/CCafMessagePayloadParser.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Caf/CCafMessagePayloadParser.cpp deleted file mode 100644 index 7e6af45d4..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Caf/CCafMessagePayloadParser.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Author: bwilliams - * Created: Jul 2009 - * - * Copyright (C) 2009-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Doc/DocXml/CafInstallRequestXml/CafInstallRequestXmlRoots.h" -#include "Doc/DocXml/MgmtRequestXml/MgmtRequestXmlRoots.h" -#include "Doc/DocXml/ProviderInfraXml/ProviderInfraXmlRoots.h" -#include "Doc/DocXml/ProviderRequestXml/ProviderRequestXmlRoots.h" - -#include "Doc/DocXml/CafInstallRequestXml/InstallProviderJobXml.h" -#include "Doc/DocXml/CafInstallRequestXml/UninstallProviderJobXml.h" -#include "Doc/DocXml/PayloadEnvelopeXml/PayloadEnvelopeXml.h" - -#include "Doc/CafInstallRequestDoc/CInstallProviderJobDoc.h" -#include "Doc/CafInstallRequestDoc/CInstallRequestDoc.h" -#include "Doc/CafInstallRequestDoc/CUninstallProviderJobDoc.h" -#include "Doc/MgmtRequestDoc/CMgmtRequestDoc.h" -#include "Doc/PayloadEnvelopeDoc/CPayloadEnvelopeDoc.h" -#include "Doc/ProviderInfraDoc/CProviderRegDoc.h" -#include "Doc/ProviderRequestDoc/CProviderRequestDoc.h" -#include "Memory/DynamicArray/DynamicArrayInc.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Integration/Caf/CCafMessagePayloadParser.h" - -using namespace Caf; - -SmartPtrCPayloadEnvelopeDoc CCafMessagePayloadParser::getPayloadEnvelope( - const SmartPtrCDynamicByteArray& payload) { - CAF_CM_STATIC_FUNC_VALIDATE("CCafMessagePayloadParser", "getPayloadEnvelope"); - CAF_CM_VALIDATE_SMARTPTR(payload); - - return PayloadEnvelopeXml::parse(bufferToXml(payload, "caf:payloadEnvelope")); -} - -SmartPtrCInstallProviderJobDoc CCafMessagePayloadParser::getInstallProviderJob( - const SmartPtrCDynamicByteArray& payload) { - CAF_CM_STATIC_FUNC_VALIDATE("CCafMessagePayloadParser", "getInstallProviderJob"); - CAF_CM_VALIDATE_SMARTPTR(payload); - - return InstallProviderJobXml::parse(bufferToXml(payload, "caf:cafInstallProviderJob")); -} - -SmartPtrCUninstallProviderJobDoc CCafMessagePayloadParser::getUninstallProviderJob( - const SmartPtrCDynamicByteArray& payload) { - CAF_CM_STATIC_FUNC_VALIDATE("CCafMessagePayloadParser", "getUninstallProviderJob"); - CAF_CM_VALIDATE_SMARTPTR(payload); - - return UninstallProviderJobXml::parse(bufferToXml(payload, "caf:cafUninstallProviderJob")); -} - -SmartPtrCProviderRequestDoc CCafMessagePayloadParser::getProviderRequest( - const SmartPtrCDynamicByteArray& payload) { - CAF_CM_STATIC_FUNC_VALIDATE("CCafMessagePayloadParser", "getProviderRequest"); - CAF_CM_VALIDATE_SMARTPTR(payload); - - return XmlRoots::parseProviderRequestFromString(bufferToStr(payload)); -} - -SmartPtrCProviderRegDoc CCafMessagePayloadParser::getProviderReg( - const SmartPtrCDynamicByteArray& payload) { - CAF_CM_STATIC_FUNC_VALIDATE("CCafMessagePayloadParser", "getProviderReg"); - CAF_CM_VALIDATE_SMARTPTR(payload); - - return XmlRoots::parseProviderRegFromString(bufferToStr(payload)); -} - -SmartPtrCInstallRequestDoc CCafMessagePayloadParser::getInstallRequest( - const SmartPtrCDynamicByteArray& payload) { - CAF_CM_STATIC_FUNC_VALIDATE("CCafMessagePayloadParser", "getInstallRequest"); - CAF_CM_VALIDATE_SMARTPTR(payload); - - return XmlRoots::parseInstallRequestFromString(bufferToStr(payload)); -} - -SmartPtrCMgmtRequestDoc CCafMessagePayloadParser::getMgmtRequest( - const SmartPtrCDynamicByteArray& payload) { - CAF_CM_STATIC_FUNC_VALIDATE("CCafMessagePayloadParser", "getMgmtRequest"); - CAF_CM_VALIDATE_SMARTPTR(payload); - - return XmlRoots::parseMgmtRequestFromString(bufferToStr(payload)); -} - -SmartPtrCXmlElement CCafMessagePayloadParser::bufferToXml( - const SmartPtrCDynamicByteArray& payload, - const std::string& payloadType) { - CAF_CM_STATIC_FUNC_VALIDATE("CCafMessagePayloadParser", "bufferToXml"); - CAF_CM_VALIDATE_SMARTPTR(payload); - - return CXmlUtils::parseString(bufferToStr(payload), payloadType); -} - -std::string CCafMessagePayloadParser::bufferToStr( - const SmartPtrCDynamicByteArray& payload) { - CAF_CM_STATIC_FUNC_VALIDATE("CCafMessagePayloadParser", "bufferToStr"); - CAF_CM_VALIDATE_SMARTPTR(payload); - - return reinterpret_cast(payload->getPtr()); -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Caf/stdafx.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Caf/stdafx.h deleted file mode 100644 index 9d98d4e95..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Caf/stdafx.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 20, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef STDAFX_H_ -#define STDAFX_H_ - -#ifdef WIN32 - #define INTEGRATIONCAF_LINKAGE __declspec(dllexport) -#else - #define INTEGRATIONCAF_LINKAGE -#endif - -#include -#include -#include - -#endif /* STDAFX_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/CAbstractMessageChannel.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/CAbstractMessageChannel.cpp deleted file mode 100644 index f6b54c4e6..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/CAbstractMessageChannel.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Created on: Jan 26, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Integration/IChannelInterceptor.h" -#include "Integration/IIntMessage.h" -#include "Integration/IMessageChannel.h" -#include "Integration/Core/CAbstractMessageChannel.h" - -CAbstractMessageChannel::CAbstractMessageChannel() : - CAF_CM_INIT("CAbstractMessageChannel") { -} - -CAbstractMessageChannel::~CAbstractMessageChannel() { -} - -bool CAbstractMessageChannel::send( - const SmartPtrIIntMessage& message) { - return send(message, -1); -} - -bool CAbstractMessageChannel::send( - const SmartPtrIIntMessage& message, - const int32 timeout) { - CAF_CM_FUNCNAME_VALIDATE("send"); - CAF_CM_VALIDATE_INTERFACE(message); - - // Call all interceptors' preSend() - SmartPtrIIntMessage intMessage = message; - SmartPtrIMessageChannel channel(this); - for (TSmartIterator > interceptor(_interceptors); - interceptor; - interceptor++) { - intMessage = interceptor->preSend(intMessage, channel); - if (!intMessage) { - break; - } - } - - // If an interceptor returned NULL then we're done - bool sent = false; - if (intMessage) { - // Send the message through the subclass doSend() - sent = doSend(intMessage, timeout); - - // Call the interceptors' postSend() - for (TSmartIterator > interceptor(_interceptors); - interceptor; - interceptor++) { - interceptor->postSend(intMessage, channel, sent); - } - } - - return sent; -} - -void CAbstractMessageChannel::setInterceptors( - const IChannelInterceptorSupport::InterceptorCollection& interceptors) { - _interceptors = interceptors; -} - -std::list CAbstractMessageChannel::getInterceptors() const { - return _interceptors; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/CAbstractMessageRouter.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/CAbstractMessageRouter.cpp deleted file mode 100644 index 04714daa8..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/CAbstractMessageRouter.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Created on: Aug 9, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Integration/IIntMessage.h" -#include "Integration/IMessageChannel.h" -#include "Integration/Core/CIntException.h" -#include "Exception/CCafException.h" -#include "Integration/Core/CAbstractMessageRouter.h" - -using namespace Caf; - -CAbstractMessageRouter::CAbstractMessageRouter() : - _ignoreSendFailures(false), - _sendTimeout(-1), - _isInitialized(false), - CAF_CM_INIT_LOG("CAbstractMessageRouter") { -} - -CAbstractMessageRouter::~CAbstractMessageRouter() { -} - -void CAbstractMessageRouter::init() { - init(SmartPtrIMessageChannel(), false, -1); -} - -void CAbstractMessageRouter::init( - const SmartPtrIMessageChannel& defaultOutputChannel, - const bool ignoreSendFailures, - const int32 sendTimeout) { - CAF_CM_FUNCNAME_VALIDATE("init"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - // defaultOutputChannel may be NULL - - _defaultOutputChannel = defaultOutputChannel; - _ignoreSendFailures = ignoreSendFailures; - _sendTimeout = sendTimeout; - _isInitialized = true; -} - -void CAbstractMessageRouter::routeMessage(const SmartPtrIIntMessage& message) { - CAF_CM_FUNCNAME("routeMessage"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - bool isSent = false; - - ChannelCollection channels; - try { - channels = getTargetChannels(message); - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_CLEAREXCEPTION; - - for (TSmartConstIterator channelIter(channels); - channelIter; - channelIter++) { - try { - SmartPtrIMessageChannel channel(*channelIter); - CAF_CM_VALIDATE_INTERFACE(channel); - channel->send(message, _sendTimeout); - isSent = true; - } - CAF_CM_CATCH_ALL; - if (CAF_CM_ISEXCEPTION && _ignoreSendFailures) { - CAF_CM_LOG_DEBUG_CAFEXCEPTION; - CAF_CM_CLEAREXCEPTION; - } - CAF_CM_THROWEXCEPTION; - } - - if (!isSent) { - if (_defaultOutputChannel) { - _defaultOutputChannel->send(message, _sendTimeout); - } else { - if (channels.size()) { - CAF_CM_EXCEPTIONEX_VA0( - MessageDeliveryException, - 0, - "failed to send message to resolved channel(s) " - "and no default output channel defined"); - } else { - CAF_CM_EXCEPTIONEX_VA0( - MessageDeliveryException, - 0, - "no channel resolved by router and no default " - "output channel defined"); - } - } - } -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/CAbstractPollableChannel.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/CAbstractPollableChannel.cpp deleted file mode 100644 index a798b8753..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/CAbstractPollableChannel.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Created on: Jan 26, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Integration/Dependencies/CPollerMetadata.h" -#include "Integration/IChannelInterceptor.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "Integration/IMessageChannel.h" -#include "Integration/Core/CAbstractPollableChannel.h" - -CAbstractPollableChannel::CAbstractPollableChannel() : - CAF_CM_INIT("CAbstractPollableChannel") { -} - -CAbstractPollableChannel::~CAbstractPollableChannel() { -} - -SmartPtrIIntMessage CAbstractPollableChannel::receive() { - return receive(0); -} - -SmartPtrIIntMessage CAbstractPollableChannel::receive(const int32 timeout) { - SmartPtrIIntMessage message; - CAF_CM_ENTER { - std::list interceptors = getInterceptors(); - SmartPtrIMessageChannel channel(this); - bool preReceiveOk = true; - for (TSmartIterator > interceptor(interceptors); - interceptor && preReceiveOk; - interceptor++) { - preReceiveOk = interceptor->preReceive(channel); - } - - if (preReceiveOk) { - message = doReceive(timeout); - for (TSmartIterator > interceptor(interceptors); - interceptor && message; - interceptor++) { - message = interceptor->postReceive(message, channel); - } - } - } - CAF_CM_EXIT; - return message; -} - -SmartPtrCPollerMetadata CAbstractPollableChannel::getPollerMetadata() const { - CAF_CM_FUNCNAME_VALIDATE("getPollerMetadata"); - CAF_CM_VALIDATE_SMARTPTR(_pollerMetadata); - return _pollerMetadata; -} - -void CAbstractPollableChannel::setPollerMetadata(const SmartPtrCPollerMetadata& pollerMetadata) { - CAF_CM_FUNCNAME_VALIDATE("setPollerMetadata"); - CAF_CM_VALIDATE_SMARTPTR(pollerMetadata); - _pollerMetadata = pollerMetadata; -} - -void CAbstractPollableChannel::setPollerMetadata(const SmartPtrIDocument& pollerDoc) { - // pollerDoc is optional - - CAF_CM_ENTER { - _pollerMetadata.CreateInstance(); - _pollerMetadata->putFixedRate(1000); - _pollerMetadata->putMaxMessagesPerPoll(1); - - if (pollerDoc) { - const std::string maxMessagesPerPollStr = pollerDoc->findOptionalAttribute("max-messages-per-poll"); - if (!maxMessagesPerPollStr.empty()) { - const uint32 maxMessagesPerPoll = CStringConv::fromString(maxMessagesPerPollStr); - _pollerMetadata->putMaxMessagesPerPoll(maxMessagesPerPoll); - } - - const std::string fixedRateStr = pollerDoc->findOptionalAttribute("fixed-rate"); - if (!fixedRateStr.empty()) { - const uint32 fixedRate = CStringConv::fromString(fixedRateStr); - _pollerMetadata->putFixedRate(fixedRate); - } - } - } - CAF_CM_EXIT; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/CBroadcastingDispatcher.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/CBroadcastingDispatcher.cpp deleted file mode 100644 index fef2ce0d3..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/CBroadcastingDispatcher.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Integration/Core/CIntException.h" -#include "Integration/IErrorHandler.h" -#include "Integration/IIntMessage.h" -#include "Integration/IMessageHandler.h" -#include "Integration/Core/CBroadcastingDispatcher.h" - -using namespace Caf; - -CBroadcastingDispatcher::CBroadcastingDispatcher() : - _isInitialized(false), - CAF_CM_INIT_LOG("CBroadcastingDispatcher") { -} - -CBroadcastingDispatcher::~CBroadcastingDispatcher() { -} - -void CBroadcastingDispatcher::initialize( - const SmartPtrIErrorHandler& errorHandler) { - - CAF_CM_FUNCNAME_VALIDATE("initialize"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(errorHandler); - - _errorHandler = errorHandler; - _messageHandlerCollection.CreateInstance(); - - _isInitialized = true; - } - CAF_CM_EXIT; -} - -void CBroadcastingDispatcher::addHandler( - const SmartPtrIMessageHandler& messageHandler) { - CAF_CM_FUNCNAME_VALIDATE("addHandler"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(messageHandler); - - const void* handlerPtr = messageHandler.GetNonAddRefedInterface(); - _messageHandlerCollection->insert(std::make_pair(handlerPtr, messageHandler)); - -#ifdef __x86_64__ - CAF_CM_LOG_DEBUG_VA1("Added handler - %llX", handlerPtr); -#else - CAF_CM_LOG_DEBUG_VA1("Added handler - %X", handlerPtr); -#endif - } - CAF_CM_EXIT; -} - -void CBroadcastingDispatcher::removeHandler( - const SmartPtrIMessageHandler& messageHandler) { - CAF_CM_FUNCNAME_VALIDATE("removeHandler"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(messageHandler); - - const void* handlerPtr = messageHandler.GetNonAddRefedInterface(); - _messageHandlerCollection->erase(handlerPtr); - -#ifdef __x86_64__ - CAF_CM_LOG_DEBUG_VA1("Removed handler - %llX", handlerPtr); -#else - CAF_CM_LOG_DEBUG_VA1("Removed handler - %X", handlerPtr); -#endif - } - CAF_CM_EXIT; -} - -bool CBroadcastingDispatcher::dispatch( - const SmartPtrIIntMessage& message) { - CAF_CM_FUNCNAME("dispatch"); - - bool isMessageHandled = false; - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(message); - - for (TSmartConstMapIterator messageHandlerIter(*_messageHandlerCollection); - messageHandlerIter; messageHandlerIter++) { - const SmartPtrIMessageHandler messageHandler = *messageHandlerIter; - -#ifdef __x86_64__ - CAF_CM_LOG_DEBUG_VA1("Dispatching to handler - %llX", messageHandlerIter.getKey()); -#else - CAF_CM_LOG_DEBUG_VA1("Dispatching to handler - %X", messageHandlerIter.getKey()); -#endif - - try { - messageHandler->handleMessage(message); - isMessageHandled = true; - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_CRIT_CAFEXCEPTION; - - try { - if (CAF_CM_ISEXCEPTION) { - CAF_CM_VALIDATE_INTERFACE(messageHandler); - SmartPtrIIntMessage savedMessage = messageHandler->getSavedMessage(); - if (savedMessage.IsNull()) { - savedMessage = message; - } - - SmartPtrCIntException intException; - intException.CreateInstance(); - intException->initialize(CAF_CM_GETEXCEPTION); - _errorHandler->handleError(intException, savedMessage); - - CAF_CM_CLEAREXCEPTION; - } - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_CLEAREXCEPTION; - } - } - CAF_CM_EXIT; - - return isMessageHandled; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/CChannelInterceptorAdapter.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/CChannelInterceptorAdapter.cpp deleted file mode 100644 index 1162ca1da..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/CChannelInterceptorAdapter.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Created on: Jan 25, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Integration/IIntMessage.h" -#include "Integration/IMessageChannel.h" -#include "Integration/Core/CChannelInterceptorAdapter.h" - -CChannelInterceptorAdapter::CChannelInterceptorAdapter() { -} - -CChannelInterceptorAdapter::~CChannelInterceptorAdapter() { -} - -SmartPtrIIntMessage& CChannelInterceptorAdapter::preSend( - SmartPtrIIntMessage& message, - SmartPtrIMessageChannel&) { - return message; -} - -void CChannelInterceptorAdapter::postSend( - SmartPtrIIntMessage&, - SmartPtrIMessageChannel&, - bool) { -} - -bool CChannelInterceptorAdapter::preReceive( - SmartPtrIMessageChannel&) { - return true; -} - -SmartPtrIIntMessage& CChannelInterceptorAdapter::postReceive( - SmartPtrIIntMessage& message, - SmartPtrIMessageChannel&) { - return message; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/CChannelResolver.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/CChannelResolver.cpp deleted file mode 100644 index c3f0c65a5..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/CChannelResolver.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 20, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Integration/IIntegrationObject.h" -#include "Integration/IMessageChannel.h" -#include "Integration/Core/CChannelResolver.h" -#include "Exception/CCafException.h" - -using namespace Caf; - -CChannelResolver::CChannelResolver() : - _isInitialized(false), - CAF_CM_INIT("CChannelResolver") { -} - -CChannelResolver::~CChannelResolver() { -} - -void CChannelResolver::initialize( - const SmartPtrCIntegrationObjectCollection& integrationObjectCollection) { - CAF_CM_FUNCNAME("initialize"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_SMARTSTL_NOTEMPTY(integrationObjectCollection); - - _integrationObjectCollection = integrationObjectCollection; - - _isInitialized = true; - } - CAF_CM_EXIT; -} - -SmartPtrIMessageChannel CChannelResolver::resolveChannelName( - const std::string& channelName) const { - CAF_CM_FUNCNAME("resolveChannelName"); - - SmartPtrIMessageChannel messageChannel; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(channelName); - - const SmartPtrIIntegrationObject integrationObject = - resolveChannelNameToObject(channelName); - - messageChannel.QueryInterface(integrationObject, false); - if (messageChannel.IsNull()) { - CAF_CM_EXCEPTIONEX_VA1(NoSuchElementException, ERROR_NOT_FOUND, - "Integration object is not a message channel - %s", channelName.c_str()); - } - } - CAF_CM_EXIT; - - return messageChannel; -} - -SmartPtrIIntegrationObject CChannelResolver::resolveChannelNameToObject( - const std::string& channelName) const { - CAF_CM_FUNCNAME("resolveChannelNameToObject"); - - SmartPtrIIntegrationObject integrationObject; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(channelName); - - const CIntegrationObjectCollection::const_iterator integrationObjectCollectionIter = - _integrationObjectCollection->find(channelName); - if (integrationObjectCollectionIter == _integrationObjectCollection->end()) { - CAF_CM_EXCEPTIONEX_VA1(NoSuchElementException, ERROR_NOT_FOUND, - "Bean with given ID not found - %s", channelName.c_str()); - } - - integrationObject = integrationObjectCollectionIter->second; - } - CAF_CM_EXIT; - - return integrationObject; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/CDocument.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/CDocument.cpp deleted file mode 100644 index 74c32262d..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/CDocument.cpp +++ /dev/null @@ -1,299 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 20, 2011 - * - * Copyright (C) 2011-2018 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include - -#include "Integration/IDocument.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Integration/Core/CDocument.h" -#include "Common/IAppConfig.h" - -using namespace Caf; - -CDocument::CDocument() : - _isInitialized(false), - CAF_CM_INIT("CDocument") { -} - -CDocument::~CDocument() { -} - -void CDocument::initialize( - const SmartPtrCXmlElement& xmlElement) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_SMARTPTR(xmlElement); - - _xmlElement = xmlElement; - - // iterate over all attributes and resolve the attribute values - // for environment and appConfig value references - SmartPtrIAppConfig appConfig = getAppConfig(); - std::deque stack; - stack.push_back(_xmlElement); - while (stack.size()) { - SmartPtrCXmlElement element = stack.front(); - stack.pop_front(); - CXmlElement::SmartPtrCAttributeCollection attributes = element->getAllAttributes(); - for (TConstMapIterator attribute(*attributes); - attribute; - attribute++) { - element->setAttribute( - attribute.getKey(), - appConfig->resolveValue(*attribute)); - } - CXmlElement::SmartPtrCElementCollection children = element->getAllChildren(); - std::transform( - children->begin(), - children->end(), - std::insert_iterator >(stack, stack.end()), - select2nd()); - } - - _isInitialized = true; - } - CAF_CM_EXIT; -} - -SmartPtrCXmlElement CDocument::getXmlElement() const { - CAF_CM_FUNCNAME_VALIDATE("getXmlElement"); - - SmartPtrCXmlElement rc; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - rc = _xmlElement; - } - CAF_CM_EXIT; - - return rc; -} - -std::string CDocument::findRequiredAttribute(const std::string& name) const { - CAF_CM_FUNCNAME_VALIDATE("findRequiredAttribute"); - - std::string rc; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - rc = _xmlElement->findRequiredAttribute(name); - } - CAF_CM_EXIT; - - return rc; -} - -std::string CDocument::findOptionalAttribute(const std::string& name) const { - CAF_CM_FUNCNAME_VALIDATE("findOptionalAttribute"); - - std::string rc; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - rc = _xmlElement->findOptionalAttribute(name); - } - CAF_CM_EXIT; - - return rc; -} - -SmartPtrIDocument CDocument::findRequiredChild(const std::string& name) const { - CAF_CM_FUNCNAME_VALIDATE("findRequiredChild"); - - SmartPtrIDocument rc; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - const SmartPtrCXmlElement child = _xmlElement->findRequiredChild(name); - - SmartPtrCDocument document; - document.CreateInstance(); - document->initialize(child); - - rc = document; - } - CAF_CM_EXIT; - - return rc; -} - -SmartPtrIDocument CDocument::findOptionalChild(const std::string& name) const { - CAF_CM_FUNCNAME_VALIDATE("findOptionalChild"); - - SmartPtrIDocument rc; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - const SmartPtrCXmlElement child = _xmlElement->findOptionalChild(name); - if (! child.IsNull()) { - SmartPtrCDocument document; - document.CreateInstance(); - document->initialize(child); - - rc = document; - } - } - CAF_CM_EXIT; - - return rc; -} - -IDocument::SmartPtrCAttributeCollection CDocument::getAllAttributes() const { - CAF_CM_FUNCNAME_VALIDATE("getAllAttributes"); - - IDocument::SmartPtrCAttributeCollection rc; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - rc.CreateInstance(); - - const CXmlElement::SmartPtrCAttributeCollection attributesXml = - _xmlElement->getAllAttributes(); - for (TConstIterator attributeXmlIter(*attributesXml); - attributeXmlIter; attributeXmlIter++) { - rc->insert(std::make_pair(attributeXmlIter->first, attributeXmlIter->second)); - } - } - CAF_CM_EXIT; - - return rc; -} - -IDocument::SmartPtrCChildCollection CDocument::getAllChildren() const { - CAF_CM_FUNCNAME_VALIDATE("getAllChildren"); - - IDocument::SmartPtrCChildCollection rc; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - rc.CreateInstance(); - - const CXmlElement::SmartPtrCElementCollection childrenXml = - _xmlElement->getAllChildren(); - for (TConstIterator childXmlIter(*childrenXml); - childXmlIter; childXmlIter++) { - SmartPtrCDocument document; - document.CreateInstance(); - document->initialize(childXmlIter->second); - - rc->insert(std::make_pair(childXmlIter->first, document)); - } - } - CAF_CM_EXIT; - - return rc; -} - -IDocument::SmartPtrCOrderedChildCollection CDocument::getAllChildrenInOrder() const { - CAF_CM_FUNCNAME_VALIDATE("getAllChildrenInOrder"); - - IDocument::SmartPtrCOrderedChildCollection rc; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - rc.CreateInstance(); - - const CXmlElement::SmartPtrCOrderedElementCollection childrenXml = - _xmlElement->getAllChildrenInOrder(); - for (TConstIterator childXmlIter(*childrenXml); - childXmlIter; childXmlIter++) { - SmartPtrCDocument document; - document.CreateInstance(); - document->initialize(*childXmlIter); - rc->push_back(document); - } - } - CAF_CM_EXIT; - - return rc; -} - -std::string CDocument::getName() const { - CAF_CM_FUNCNAME_VALIDATE("getName"); - - std::string rc; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - rc = _xmlElement->getName(); - } - CAF_CM_EXIT; - - return rc; -} - -std::string CDocument::getValue() const { - CAF_CM_FUNCNAME_VALIDATE("getValue"); - - std::string rc; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - rc = _xmlElement->getValue(); - } - CAF_CM_EXIT; - - return rc; -} - -std::string CDocument::getPath() const { - CAF_CM_FUNCNAME_VALIDATE("getPath"); - - std::string rc; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - rc = _xmlElement->getPath(); - } - CAF_CM_EXIT; - - return rc; -} - -void CDocument::saveToFile(const std::string& filename) const { - CAF_CM_FUNCNAME_VALIDATE("saveToFile"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - _xmlElement->saveToFile(filename); - } - CAF_CM_EXIT; -} - -std::string CDocument::saveToString() const { - CAF_CM_FUNCNAME_VALIDATE("saveToString"); - - std::string rc; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - rc = _xmlElement->saveToString(); - } - CAF_CM_EXIT; - - return rc; -} - -std::string CDocument::saveToStringRaw() const { - CAF_CM_FUNCNAME_VALIDATE("saveToStringRaw"); - - std::string rc; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - rc = _xmlElement->saveToStringRaw(); - } - CAF_CM_EXIT; - - return rc; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/CErrorHandler.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/CErrorHandler.cpp deleted file mode 100644 index 1520718fc..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/CErrorHandler.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 20, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Integration/Core/CIntMessage.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IIntMessage.h" -#include "Integration/IMessageChannel.h" -#include "Integration/IThrowable.h" -#include "Integration/Core/CErrorHandler.h" -#include "Integration/Core/CIntMessageHeaders.h" -#include "Integration/Core/MessageHeaders.h" - -using namespace Caf; - -CErrorHandler::CErrorHandler() : - _isInitialized(false), - CAF_CM_INIT_LOG("CErrorHandler") { -} - -CErrorHandler::~CErrorHandler() { -} - -void CErrorHandler::initialize( - const SmartPtrIChannelResolver& channelResolver, - const SmartPtrIMessageChannel& errorMessageChannel) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(channelResolver); - CAF_CM_VALIDATE_INTERFACE(errorMessageChannel); - - _channelResolver = channelResolver; - _errorMessageChannel = errorMessageChannel; - - _isInitialized = true; - } - CAF_CM_EXIT; -} - -void CErrorHandler::handleError( - const SmartPtrIThrowable& throwable, - const SmartPtrIIntMessage& message) const { - CAF_CM_FUNCNAME_VALIDATE("handleError"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(throwable); - // message is optional - - bool isThrowable = false; - if (! message.IsNull()) { - const std::string isThrowableStr = - message->findOptionalHeaderAsString(MessageHeaders::_sIS_THROWABLE); - isThrowable = - (isThrowableStr.empty() || (isThrowableStr.compare("false") == 0)) ? false : true; - } - - if (isThrowable) { - CAF_CM_LOG_ERROR_VA2("Error already handled - MsgErr: %s, Thrown: %s", - message->getPayloadStr().c_str(), throwable->getFullMsg().c_str()); - } else { - CIntMessageHeaders messageHeaders; - messageHeaders.insertString(MessageHeaders::_sIS_THROWABLE, "true"); - - const IIntMessage::SmartPtrCHeaders origHeaders = - message.IsNull() ? IIntMessage::SmartPtrCHeaders() : message->getHeaders(); - - SmartPtrCIntMessage messageImpl; - messageImpl.CreateInstance(); - messageImpl->initializeStr(throwable->getFullMsg(), - messageHeaders.getHeaders(), origHeaders); - - const SmartPtrIIntMessage newMessage = messageImpl; - - const std::string errorChannelRef = - newMessage->findOptionalHeaderAsString(MessageHeaders::_sERROR_CHANNEL); - - SmartPtrIMessageChannel errorMessageChannel = _errorMessageChannel; - if (! errorChannelRef.empty()) { - CAF_CM_LOG_INFO_VA1("Using alternate error channel - %s", errorChannelRef.c_str()); - errorMessageChannel = _channelResolver->resolveChannelName(errorChannelRef); - } - - errorMessageChannel->send(newMessage); - } - } - CAF_CM_EXIT; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/CExpressionHandler.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/CExpressionHandler.cpp deleted file mode 100644 index 7d8dd089a..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/CExpressionHandler.cpp +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Created on: Jul 23, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Common/IAppConfig.h" -#include "Common/IAppContext.h" -#include "IBean.h" -#include "IVariant.h" -#include "Integration/Core/CExpressionHandler.h" -#include "Common/CCafRegex.h" -#include "Exception/CCafException.h" - -using namespace Caf; - -CExpressionHandler::CExpressionHandler() : - _isInitialized(false), - CAF_CM_INIT("CExpressionHandler") { -} - -CExpressionHandler::~CExpressionHandler() { -} - -void CExpressionHandler::init( - const SmartPtrIAppConfig& appConfig, - const SmartPtrIAppContext& appContext, - const std::string& expression) { - CAF_CM_FUNCNAME("init"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(appConfig); - CAF_CM_VALIDATE_INTERFACE(appContext); - CAF_CM_VALIDATE_STRING(expression); - - CCafRegex regex; - regex.initialize("\\@(\\w+)\\.(\\w+)\\((.*)\\)"); - if (!regex.isMatched(expression)) { - CAF_CM_EXCEPTIONEX_VA1( - InvalidArgumentException, - 0, - "Invalid expression syntax '%s'", - expression.c_str()); - } - _beanName = regex.match(expression, 1); - _methodName = regex.match(expression, 2); - if (!_beanName.length() || !_methodName.length()) { - CAF_CM_EXCEPTIONEX_VA1( - InvalidArgumentException, - 0, - "Invalid expression syntax '%s'", - expression.c_str()); - } - - SmartPtrIBean bean = appContext->getBean(_beanName); - _invoker.QueryInterface(bean, false); - if (!_invoker) { - CAF_CM_EXCEPTIONEX_VA1( - NoSuchInterfaceException, - 0, - "bean '%s' does not support the IExpressionInvoker interface", - _beanName.c_str()); - } - - const std::string paramSubstr = regex.match(expression, 3); - Cdeqstr paramExprs = CStringUtils::split(paramSubstr, ','); - CCafRegex regexLiteral; - regexLiteral.initialize("'(.*)'"); - for (TConstIterator paramExpr(paramExprs); paramExpr; paramExpr++) { - std::string trimmedExpr = CStringUtils::trim(*paramExpr); - if (regexLiteral.isMatched(trimmedExpr)) { - std::string val = regexLiteral.match(trimmedExpr, 1); - if (val.length()) { - _methodParams.push_back(appConfig->resolveValue(val)); - } else { - _methodParams.push_back(""); - } - } else { - CAF_CM_EXCEPTIONEX_VA1( - InvalidArgumentException, - 0, - "Invalid expression syntax '%s'", - expression.c_str()); - } - } - _isInitialized = true; -} - -SmartPtrIVariant CExpressionHandler::evaluate(const SmartPtrIIntMessage& message) { - CAF_CM_FUNCNAME_VALIDATE("evaluate"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _invoker->invokeExpression(_methodName, _methodParams, message); -} - -std::string CExpressionHandler::getBeanName() const { - CAF_CM_FUNCNAME_VALIDATE("getBeanName"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _beanName; -} - -std::string CExpressionHandler::getMethodName() const { - CAF_CM_FUNCNAME_VALIDATE("getMethodName"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _methodName; -} - -Cdeqstr CExpressionHandler::getMethodParameters() const { - CAF_CM_FUNCNAME_VALIDATE("getMethodParameters"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _methodParams; -} - -std::string CExpressionHandler::toString() const { - std::stringstream result; - result - << "invoke @" - << _beanName - << '.' - << _methodName - << '('; - bool first = true; - for (TConstIterator param(_methodParams); param; param++) { - if (!first) { - result << ", "; - } - result - << '\'' - << *param - << '\''; - first = false; - } - result << ')'; - return result.str(); -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/CIntException.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/CIntException.cpp deleted file mode 100644 index 08e858579..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/CIntException.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 20, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "Integration/Core/CIntException.h" - -#define CAF_CM_DEFINE_INTEGRATION_EXCEPTION_CLASS(_exclass_) \ - _exclass_::_exclass_() : CCafException( #_exclass_ ) {} \ - _exclass_::~_exclass_() {} \ - void _exclass_::throwSelf() { throw this; } - -using namespace Caf; - -CAF_CM_DEFINE_INTEGRATION_EXCEPTION_CLASS(FatalListenerStartupException) -CAF_CM_DEFINE_INTEGRATION_EXCEPTION_CLASS(ListenerExecutionFailedException) -CAF_CM_DEFINE_INTEGRATION_EXCEPTION_CLASS(MessageDeliveryException) - -CIntException::CIntException() : - _isInitialized(false), - _errorCode(0), - _backtrace(NULL), - CAF_CM_INIT("CIntException") { -} - -CIntException::~CIntException() { -} - -void CIntException::initialize(const CCafException* cafException) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_PTR(cafException); - - _exceptionClassName = cafException->getExceptionClassName(); - _message = cafException->getMsg(); - _className = cafException->getClassName(); - _funcName = cafException->getFuncName(); - _errorCode = cafException->getError(); - _backtrace = cafException->getBacktrace(); - _fullMsg = cafException->getFullMsg(); - - _isInitialized = true; -} - -std::string CIntException::getExceptionClassName() const { - CAF_CM_FUNCNAME_VALIDATE("getExceptionClassName"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _exceptionClassName; -} - -std::string CIntException::getMsg() const { - CAF_CM_FUNCNAME_VALIDATE("getMsg"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _message; -} - -std::string CIntException::getClassName() const { - CAF_CM_FUNCNAME_VALIDATE("getClassName"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _className; -} - -std::string CIntException::getFuncName() const { - CAF_CM_FUNCNAME_VALIDATE("getFuncName"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _funcName; -} - -HRESULT CIntException::getError() const { - CAF_CM_FUNCNAME_VALIDATE("getError"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _errorCode; -} - -std::deque* CIntException::getBacktrace() const { - CAF_CM_FUNCNAME_VALIDATE("getBacktrace"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _backtrace; -} - -std::string CIntException::getFullMsg() const { - CAF_CM_FUNCNAME_VALIDATE("getFullMsg"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _fullMsg; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/CIntMessage.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/CIntMessage.cpp deleted file mode 100644 index f41522199..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/CIntMessage.cpp +++ /dev/null @@ -1,241 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2018 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include - -#include "ICafObject.h" -#include "IVariant.h" -#include "Integration/IIntMessage.h" -#include "Memory/DynamicArray/DynamicArrayInc.h" -#include "Integration/Core/CIntMessage.h" -#include "Exception/CCafException.h" - -using namespace Caf; - -CIntMessage::CIntMessage() : - _isInitialized(false), - _messageId(CAFCOMMON_GUID_NULL), - CAF_CM_INIT("CIntMessage") { -} - -CIntMessage::~CIntMessage() { -} - -CIntMessage::SmartPtrCHeaders CIntMessage::mergeHeaders( - const SmartPtrCHeaders& newHeaders, - const SmartPtrCHeaders& origHeaders) { - CIntMessage::SmartPtrCHeaders headers; - headers.CreateInstance(); - - if (newHeaders) { - std::copy( - newHeaders->begin(), - newHeaders->end(), - std::inserter( - *headers, - headers->end())); - } - if (origHeaders) { - std::copy( - origHeaders->begin(), - origHeaders->end(), - std::inserter( - *headers, - headers->end())); - } - - return headers; -} - -void CIntMessage::initializeStr( - const std::string& payloadStr, - const SmartPtrCHeaders& newHeaders, - const SmartPtrCHeaders& origHeaders) { - CAF_CM_FUNCNAME_VALIDATE("initializeStr"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - - std::string payloadStrTmp = payloadStr; - if (payloadStr.empty()) { - payloadStrTmp = ""; - } - - SmartPtrCDynamicByteArray payload; - payload.CreateInstance(); - payload->allocateBytes(payloadStrTmp.length()); - payload->memCpy(payloadStrTmp.c_str(), payloadStrTmp.length()); - - initialize(payload, newHeaders, origHeaders); -} - -void CIntMessage::initialize( - const SmartPtrCDynamicByteArray& payload, - const SmartPtrCHeaders& newHeaders, - const SmartPtrCHeaders& origHeaders) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - // payload is optional - // newHeaders are optional - // origHeaders are optional - - _payload = payload; - ::UuidCreate(&_messageId); - - _headers = mergeHeaders(newHeaders, origHeaders); - - IIntMessage::CHeaders::iterator header = _headers->find(MessageHeaders::_sID); - if (_headers->end() == header) { - _headers->insert(std::make_pair(MessageHeaders::_sID, - std::make_pair(CVariant::createString(CStringUtils::createRandomUuid()), SmartPtrICafObject()))); - } - header = _headers->find(MessageHeaders::_sTIMESTAMP); - if (_headers->end() == header) { - _headers->insert(std::make_pair(MessageHeaders::_sTIMESTAMP, - std::make_pair(CVariant::createUint64(CDateTimeUtils::getTimeMs()), SmartPtrICafObject()))); - } - _isInitialized = true; - } - CAF_CM_EXIT; -} - -SmartPtrCDynamicByteArray CIntMessage::getPayload() const { - CAF_CM_FUNCNAME_VALIDATE("getPayload"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _payload; -} - -std::string CIntMessage::getPayloadStr() const { - CAF_CM_FUNCNAME_VALIDATE("getPayloadStr"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return reinterpret_cast(_payload->getPtr()); -} - -UUID CIntMessage::getMessageId() const { - CAF_CM_FUNCNAME_VALIDATE("getMessageId"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _messageId; -} - -std::string CIntMessage::getMessageIdStr() const { - CAF_CM_FUNCNAME_VALIDATE("getMessageIdStr"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return BasePlatform::UuidToString(_messageId); -} - -IIntMessage::SmartPtrCHeaders CIntMessage::getHeaders() const { - CAF_CM_FUNCNAME_VALIDATE("getHeaders"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _headers; -} - -SmartPtrIVariant CIntMessage::findOptionalHeader( - const std::string& key) const { - CAF_CM_FUNCNAME_VALIDATE("findOptionalHeader"); - - SmartPtrIVariant value; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(key); - - CHeaders::const_iterator headerIter = _headers->find(key); - if (headerIter != _headers->end()) { - value = headerIter->second.first; - } - } - CAF_CM_EXIT; - - return value; -} - -SmartPtrIVariant CIntMessage::findRequiredHeader( - const std::string& key) const { - CAF_CM_FUNCNAME("findRequiredHeader"); - - SmartPtrIVariant value; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(key); - - CHeaders::const_iterator headerIter = _headers->find(key); - if (headerIter == _headers->end()) { - CAF_CM_EXCEPTIONEX_VA1(NoSuchElementException, ERROR_NOT_FOUND, - "Key not found in headers - %s", key.c_str()); - } - - value = headerIter->second.first; - } - CAF_CM_EXIT; - - return value; -} - -std::string CIntMessage::findOptionalHeaderAsString( - const std::string& key) const { - std::string valueStr; - SmartPtrIVariant value = findOptionalHeader(key); - if (value) { - valueStr = value->toString(); - } - return valueStr; -} - -std::string CIntMessage::findRequiredHeaderAsString( - const std::string& key) const { - std::string valueStr; - SmartPtrIVariant value = findRequiredHeader(key); - if (value) { - valueStr = value->toString(); - } - return valueStr; -} - -SmartPtrICafObject CIntMessage::findOptionalObjectHeader( - const std::string& key) const { - CAF_CM_FUNCNAME_VALIDATE("findOptionalObjectHeader"); - - SmartPtrICafObject value; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(key); - - CHeaders::const_iterator headerIter = _headers->find(key); - if (headerIter != _headers->end()) { - value = headerIter->second.second; - } - } - CAF_CM_EXIT; - - return value; -} - -SmartPtrICafObject CIntMessage::findRequiredObjectHeader( - const std::string& key) const { - CAF_CM_FUNCNAME("findRequiredObjectHeader"); - - SmartPtrICafObject value; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(key); - - CHeaders::const_iterator headerIter = _headers->find(key); - if (headerIter == _headers->end()) { - CAF_CM_EXCEPTIONEX_VA1(NoSuchElementException, ERROR_NOT_FOUND, - "Key not found in headers - %s", key.c_str()); - } - - value = headerIter->second.second; - } - CAF_CM_EXIT; - - return value; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/CIntMessageHeaders.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/CIntMessageHeaders.cpp deleted file mode 100644 index 75a8ab870..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/CIntMessageHeaders.cpp +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "ICafObject.h" -#include "IVariant.h" -#include "Integration/IIntMessage.h" -#include "Integration/Core/CIntMessageHeaders.h" - -using namespace Caf; - -CIntMessageHeaders::CIntMessageHeaders() : - CAF_CM_INIT("CIntMessageHeaders") { - _headers.CreateInstance(); -} - -CIntMessageHeaders::~CIntMessageHeaders() { -} - -IIntMessage::SmartPtrCHeaders CIntMessageHeaders::getHeaders() const { - return _headers; -} - -void CIntMessageHeaders::clear() { - _headers.CreateInstance(); -} - -void CIntMessageHeaders::insertString( - const std::string& key, - const std::string& value) { - CAF_CM_FUNCNAME_VALIDATE("insertString"); - CAF_CM_VALIDATE_STRING(key); - CAF_CM_VALIDATE_STRING(value); - _headers->insert(std::make_pair(key, std::make_pair(CVariant::createString(value), SmartPtrICafObject()))); -} - -void CIntMessageHeaders::insertStringOpt( - const std::string& key, - const std::string& value) { - CAF_CM_FUNCNAME_VALIDATE("insertStringOpt"); - CAF_CM_VALIDATE_STRING(key); - _headers->insert(std::make_pair(key, std::make_pair(CVariant::createString(value), SmartPtrICafObject()))); -} - -void CIntMessageHeaders::insertInt64( - const std::string& key, - const int64& value) { - CAF_CM_FUNCNAME_VALIDATE("insertInt64"); - CAF_CM_VALIDATE_STRING(key); - _headers->insert(std::make_pair(key, std::make_pair(CVariant::createInt64(value), SmartPtrICafObject()))); -} - -void CIntMessageHeaders::insertUint64( - const std::string& key, - const uint64& value) { - CAF_CM_FUNCNAME_VALIDATE("insertUint64"); - CAF_CM_VALIDATE_STRING(key); - _headers->insert(std::make_pair(key, std::make_pair(CVariant::createUint64(value), SmartPtrICafObject()))); -} - -void CIntMessageHeaders::insertInt32( - const std::string& key, - const int32& value) { - CAF_CM_FUNCNAME_VALIDATE("insertInt32"); - CAF_CM_VALIDATE_STRING(key); - _headers->insert(std::make_pair(key, std::make_pair(CVariant::createInt32(value), SmartPtrICafObject()))); -} - -void CIntMessageHeaders::insertUint32( - const std::string& key, - const uint32& value) { - CAF_CM_FUNCNAME_VALIDATE("insertUint32"); - CAF_CM_VALIDATE_STRING(key); - _headers->insert(std::make_pair(key, std::make_pair(CVariant::createUint32(value), SmartPtrICafObject()))); -} - -void CIntMessageHeaders::insertInt16( - const std::string& key, - const int16& value) { - CAF_CM_FUNCNAME_VALIDATE("insertInt16"); - CAF_CM_VALIDATE_STRING(key); - _headers->insert(std::make_pair(key, std::make_pair(CVariant::createInt16(value), SmartPtrICafObject()))); -} - -void CIntMessageHeaders::insertUint16( - const std::string& key, - const uint16& value) { - CAF_CM_FUNCNAME_VALIDATE("insertUint16"); - CAF_CM_VALIDATE_STRING(key); - _headers->insert(std::make_pair(key, std::make_pair(CVariant::createUint16(value), SmartPtrICafObject()))); -} - -void CIntMessageHeaders::insertUint8( - const std::string& key, - const uint8& value) { - CAF_CM_FUNCNAME_VALIDATE("insertUint8"); - CAF_CM_VALIDATE_STRING(key); - _headers->insert(std::make_pair(key, std::make_pair(CVariant::createUint8(value), SmartPtrICafObject()))); -} - -void CIntMessageHeaders::insertBool( - const std::string& key, - const bool& value) { - CAF_CM_FUNCNAME_VALIDATE("insertBool"); - CAF_CM_VALIDATE_STRING(key); - _headers->insert(std::make_pair(key, std::make_pair(CVariant::createBool(value), SmartPtrICafObject()))); -} - -void CIntMessageHeaders::insertVariant( - const std::string& key, - const SmartPtrIVariant& variant) { - CAF_CM_FUNCNAME_VALIDATE("insertVariant"); - CAF_CM_VALIDATE_STRING(key); - CAF_CM_VALIDATE_SMARTPTR(variant); - _headers->insert(std::make_pair(key, std::make_pair(variant, SmartPtrICafObject()))); -} - -void CIntMessageHeaders::insertObject( - const std::string& key, - const SmartPtrICafObject& cafObject) { - CAF_CM_FUNCNAME_VALIDATE("insertObject"); - CAF_CM_VALIDATE_STRING(key); - CAF_CM_VALIDATE_SMARTPTR(cafObject); - _headers->insert(std::make_pair(key, std::make_pair(SmartPtrIVariant(), cafObject))); -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/CIntegrationAppContext.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/CIntegrationAppContext.cpp deleted file mode 100644 index 2c988f5f0..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/CIntegrationAppContext.cpp +++ /dev/null @@ -1,701 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 20, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Common/IAppContext.h" -#include "IBean.h" -#include "Integration/Core/CChannelResolver.h" -#include "Integration/Core/CDocument.h" -#include "Integration/IChannelInterceptor.h" -#include "Integration/IChannelInterceptorInstance.h" -#include "Integration/IChannelInterceptorSupport.h" -#include "Integration/IDocument.h" -#include "Integration/IIntegrationAppContext.h" -#include "Integration/IIntegrationAppContextAware.h" -#include "Integration/IIntegrationComponent.h" -#include "Integration/IIntegrationComponentInstance.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/ILifecycle.h" -#include "Integration/IMessageChannel.h" -#include "Integration/IMessageProducer.h" -#include "Integration/IPhased.h" -#include "Integration/ISmartLifecycle.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Integration/Core/CIntegrationAppContext.h" -#include "Exception/CCafException.h" - -using namespace Caf; - -CIntegrationAppContext::CIntegrationAppContext() : - _isInitialized(false), - _isIntegrationObjectCollectionReady(false), - _lifecycleBeansStarted(false), - _timeoutMs(0), - CAF_CM_INIT_LOG("CIntegrationAppContext") { -} - -CIntegrationAppContext::~CIntegrationAppContext() { - if (_weakSelfReference) { - _weakSelfReference->set(NULL); - } -} - -void CIntegrationAppContext::initialize( - const uint32 timeoutMs) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - - const std::string beanConfigPath = getDefaultBeanConfigPath(); - initializeRaw(timeoutMs, beanConfigPath, true); -} - -void CIntegrationAppContext::initialize( - const uint32 timeoutMs, - const std::string& beanConfigPath) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(beanConfigPath); - - initializeRaw(timeoutMs, beanConfigPath, true); -} - -void CIntegrationAppContext::initializeTwoPhase( - const uint32 timeoutMs, - const std::string& beanConfigPath) { - CAF_CM_FUNCNAME_VALIDATE("initializeTwoPhase"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(beanConfigPath); - - initializeRaw(timeoutMs, beanConfigPath, false); -} - -void CIntegrationAppContext::initializeRaw( - const uint32 timeoutMs, - const std::string& beanConfigPath, - const bool startLifecycleBeans) { - CAF_CM_FUNCNAME("initializeRaw"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(beanConfigPath); - - _timeoutMs = timeoutMs; - - _weakSelfReference.CreateInstance(); - _weakSelfReference->set(this); - - const Cdeqstr beanConfigPathCollection = - getBeanConfigFiles(beanConfigPath); - - _applicationContext.CreateInstance(); - _applicationContext->initialize(beanConfigPathCollection); - const IAppContext::SmartPtrCBeans contextBeans = - _applicationContext->getBeans(); - - _integrationObjectCollection = assign(contextBeans, beanConfigPathCollection); - - // Set context aware objects' appContext reference - for (TSmartConstMapIterator object(*_integrationObjectCollection); - object; - object++) { - SmartPtrIIntegrationAppContextAware contextAwareObj; - contextAwareObj.QueryInterface(*object, false); - if (contextAwareObj) { - contextAwareObj->setIntegrationAppContext(_weakSelfReference); - } - } - - // Inject channel interceptors - injectChannelInterceptors(_integrationObjectCollection); - _isIntegrationObjectCollectionReady = true; - - // Create the channel resolver and wire up the integration objects - SmartPtrCChannelResolver channelResolver; - channelResolver.CreateInstance(); - channelResolver->initialize(_integrationObjectCollection); - _channelResolver = channelResolver; - wire(_applicationContext, _integrationObjectCollection, _channelResolver); - - // Build up the collection of ILifecycle objects and determine - // the startup order. - // - // ISmartLifecycle objects will provide a phase number to state their - // desired relative load order. - // - // ILifecycle objects do not provide phase and will be set to order: - // 0 - non-message producing - // 1 - message producing - for (TSmartConstMapIterator object(*_integrationObjectCollection); - object; - object++) { - SmartPtrILifecycle lifecycleObj; - lifecycleObj.QueryInterface(*object, false); - if (lifecycleObj) { - SmartPtrISmartLifecycle smartLifecycleObj; - smartLifecycleObj.QueryInterface(*object, false); - if (smartLifecycleObj) { - SmartPtrIPhased phasedObj; - phasedObj.QueryInterface(*object, false); - if (phasedObj) { - _lifecycleBeans.insert( - LifecycleBeans::value_type( - phasedObj->getPhase(), - lifecycleObj)); - } else { - CAF_CM_EXCEPTIONEX_VA1( - NoSuchInterfaceException, - 0, - "ISmartLifecycle object '%s' must also " - "support the IPhased interface.", - object.getKey().c_str()); - } - } else { - SmartPtrIMessageProducer messageProducer; - messageProducer.QueryInterface(*object, false); - _lifecycleBeans.insert( - LifecycleBeans::value_type( - messageProducer && messageProducer->isMessageProducer() ? 1 : 0, - lifecycleObj)); - } - } - } - - if (_lifecycleBeans.size() && CAF_CM_IS_LOG_DEBUG_ENABLED) { - CAF_CM_LOG_DEBUG_VA0("Lifecycle startup order:"); - for (TSmartConstMultimapIterator lcBean(_lifecycleBeans); - lcBean; - lcBean++) { - SmartPtrIIntegrationObject obj; - obj.QueryInterface(*lcBean); - CAF_CM_LOG_DEBUG_VA2( - " [phase=%d][id=%s]", - lcBean.getKey(), - obj->getId().c_str()); - } - } - - // Start the lifecycle objects - if (startLifecycleBeans) { - _lifecycleBeansStarted = true; - startStop(_lifecycleBeans, _timeoutMs, true); - } - - _isInitialized = true; -} - -void CIntegrationAppContext::startLifecycleBeans() { - CAF_CM_FUNCNAME_VALIDATE("startLifecycleBeans"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_PRECOND_ISNOTINITIALIZED(_lifecycleBeansStarted); - - _lifecycleBeansStarted = true; - startStop(_lifecycleBeans, _timeoutMs, true); -} - -void CIntegrationAppContext::terminate(const uint32 timeoutMs) { - CAF_CM_FUNCNAME("terminate"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_PRECOND_ISINITIALIZED(_lifecycleBeansStarted); - - try { - _weakSelfReference->set(NULL); - startStop(_lifecycleBeans, timeoutMs, false); - _isInitialized = false; - _isIntegrationObjectCollectionReady = false; - _channelResolver = NULL; - _integrationObjectCollection->clear(); - _integrationObjectCollection = NULL; - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_CLEAREXCEPTION; - - try { - _applicationContext->terminate(); - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_CLEAREXCEPTION; - - try { - _applicationContext = NULL; - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_CLEAREXCEPTION; -} - -SmartPtrIIntegrationObject CIntegrationAppContext::getIntegrationObject( - const std::string& id) const { - CAF_CM_FUNCNAME("getIntegrationObject"); - CAF_CM_VALIDATE_STRING(id); - CAF_CM_PRECOND_ISINITIALIZED(_isIntegrationObjectCollectionReady); - - CIntegrationObjectCollection::const_iterator objIter = - _integrationObjectCollection->find(id); - SmartPtrIIntegrationObject object; - if (objIter != _integrationObjectCollection->end()) { - object = objIter->second; - } else { - CAF_CM_EXCEPTIONEX_VA1( - NoSuchElementException, - 0, - "Integration object [id=%s] is not in the collection", - id.c_str()); - } - - return object; -} - -void CIntegrationAppContext::getIntegrationObject(const IID& iid, void **ppv) const { - CAF_CM_FUNCNAME("getIntegrationObject"); - CAF_CM_PRECOND_ISINITIALIZED(_isIntegrationObjectCollectionReady); - CAF_CM_VALIDATE_PTR(ppv); - - for (TSmartConstMapIterator objIter(*_integrationObjectCollection); - objIter; - objIter++) { - void *result; - (*objIter).QueryInterface(iid, &result); - if (result) { - if (*ppv) { - CAF_CM_EXCEPTIONEX_VA1( - DuplicateElementException, - 0, - "More than one integration object [iid=%s] was found.", - BasePlatform::UuidToString(iid).c_str()); - } else { - *ppv = result; - } - } - } - - if (!*ppv) { - CAF_CM_EXCEPTIONEX_VA1( - NoSuchElementException, - 0, - "Integration object [iid=%s] is not in the collection", - BasePlatform::UuidToString(iid).c_str()); - } -} - -IIntegrationAppContext::SmartPtrCObjectCollection -CIntegrationAppContext::getIntegrationObjects(const IID& iid) const { - CAF_CM_FUNCNAME_VALIDATE("getIntegrationObjects"); - - SmartPtrCObjectCollection collection; - collection.CreateInstance(); - CAF_CM_PRECOND_ISINITIALIZED(_isIntegrationObjectCollectionReady); - for (TSmartMapIterator objIter(*_integrationObjectCollection); - objIter; - objIter++) { - void *result; - (*objIter).QueryInterface(iid, &result); - if (result) { - collection->push_back(*objIter); - objIter->Release(); - } - } - - return collection; -} - -SmartPtrIBean CIntegrationAppContext::getBean(const std::string& name) const { - CAF_CM_FUNCNAME_VALIDATE("getBean"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(name); - - return _applicationContext->getBean(name); -} - -SmartPtrIMessageChannel CIntegrationAppContext::resolveChannelName( - const std::string& channelName) const { - CAF_CM_FUNCNAME_VALIDATE("resolveChannelName"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(channelName); - - return _channelResolver->resolveChannelName(channelName); -} - -SmartPtrIIntegrationObject CIntegrationAppContext::resolveChannelNameToObject( - const std::string& channelName) const { - CAF_CM_FUNCNAME_VALIDATE("resolveChannelNameToObject"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(channelName); - - return _channelResolver->resolveChannelNameToObject(channelName); -} - -SmartPtrCIntegrationObjectCollection CIntegrationAppContext::assign( - const IAppContext::SmartPtrCBeans& contextBeans, - const Cdeqstr& beanConfigPathCollection) const { - CAF_CM_FUNCNAME("assign"); - CAF_CM_VALIDATE_SMARTPTR(contextBeans); - CAF_CM_VALIDATE_STL(beanConfigPathCollection); - - SmartPtrCIntegrationObjectCollection integrationObjectCollection; - integrationObjectCollection.CreateInstance(); - addBuiltIn("nullChannelBean", contextBeans, integrationObjectCollection); - addBuiltIn("errorChannelBean", contextBeans, integrationObjectCollection); - - // Parse the bean config file - for (TConstIterator beanConfigPathIter(beanConfigPathCollection); - beanConfigPathIter; beanConfigPathIter++) { - const std::string beanConfigPath = *beanConfigPathIter; - - const SmartPtrCXmlElement configBeanRoot = CXmlUtils::parseFile(beanConfigPath, "caf:beans"); - const CXmlElement::SmartPtrCElementCollection configBeanChildren = - configBeanRoot->getAllChildren(); - for (TSmartConstMapIterator configBeanIter(*configBeanChildren); - configBeanIter; configBeanIter++) { - const SmartPtrCXmlElement configBean = *configBeanIter; - - // if the child is anything but a bean... - if ((configBean->getName() != "bean") && (configBean->getName() != "import")) { - SmartPtrCDocument document; - document.CreateInstance(); - document->initialize(configBean); - const SmartPtrIDocument configSection = document; - - SmartPtrIIntegrationObject integrationObject; - for (TSmartConstMapIterator contextBeanIter(*contextBeans); - contextBeanIter; contextBeanIter++) { - const SmartPtrIBean contextBean = *contextBeanIter; - - SmartPtrIIntegrationComponent integrationComponent; - integrationComponent.QueryInterface(contextBean, false); - - if (!integrationComponent.IsNull() && - integrationComponent->isResponsible(configSection)) { - integrationObject = integrationComponent->createObject(configSection); - if (!integrationObject) { - CAF_CM_EXCEPTIONEX_VA2( - NullPointerException, - 0, - "Component took responsibility for section - beanId: %s," - " section: %s - but createObject() returned NULL", - contextBeanIter.getKey().c_str(), - configSection->getName().c_str()); - } - - CAF_CM_LOG_DEBUG_VA3( - "Component took responsibility for section - beanId: %s, section: %s, id: %s", - contextBeanIter.getKey().c_str(), configSection->getName().c_str(), integrationObject->getId().c_str()); - - break; - } - } - - if (integrationObject.IsNull()) { - CAF_CM_EXCEPTIONEX_VA1(NoSuchElementException, ERROR_NOT_FOUND, - "Nothing took responsibility for the section: %s", - configBean->saveToStringRaw().c_str()); - } - - const std::string id = integrationObject->getId(); - if (integrationObjectCollection->find(id) != integrationObjectCollection->end()) { - CAF_CM_EXCEPTIONEX_VA1(DuplicateElementException, ERROR_ALREADY_EXISTS, - "Duplicate id: %s", id.c_str()); - } - - integrationObjectCollection->insert(std::make_pair(id, integrationObject)); - } - } - } - - return integrationObjectCollection; -} - -void CIntegrationAppContext::injectChannelInterceptors( - const SmartPtrCIntegrationObjectCollection& integrationObjectCollection) const { - CAF_CM_FUNCNAME("injectChannelInterceptors"); - CAF_CM_VALIDATE_SMARTPTR(integrationObjectCollection); - CAF_CM_LOG_DEBUG_VA0("Searching for Channels and ChannelInterceptors"); - - // Build two collections: Channels and ChannelInterceptors - // ChannelInterceptors are wired in order, if specified. - // Order does not need to be unique. Multiple interceptors at the same - // order will be wired in first-seen order. - typedef std::multimap CChannelInterceptorMap; - CChannelInterceptorMap channelInterceptors; - typedef std::list CChannelList; - CChannelList channels; - for (TSmartConstMapIterator object(*integrationObjectCollection); - object; - object++) { - SmartPtrIMessageChannel channel; - channel.QueryInterface(*object, false); - if (channel) { - channels.push_back(channel); - } else { - SmartPtrIChannelInterceptorInstance interceptorInstance; - interceptorInstance.QueryInterface(*object, false); - if (interceptorInstance) { - channelInterceptors.insert( - CChannelInterceptorMap::value_type( - interceptorInstance->getOrder(), - interceptorInstance)); - } - } - } - - if (channelInterceptors.size()) { - // For each channel create a list of ChannelInterceptors that - // apply to it and add the list to the channel. - for (TSmartConstIterator channel(channels); - channel; - channel++) { - // Get the channel id - SmartPtrIIntegrationObject integrationObj; - integrationObj.QueryInterface(*channel); - const std::string channelId = integrationObj->getId(); - - // Channels must support the IChannelInterceptorSupport interface - SmartPtrIChannelInterceptorSupport interceptorSupport; - interceptorSupport.QueryInterface(*channel, false); - if (!interceptorSupport) { - CAF_CM_EXCEPTIONEX_VA1( - UnsupportedOperationException, - E_NOINTERFACE, - "Channel [%s] does not support the required " - "IChannelInterceptorSupport interface", - channelId.c_str()); - } - - IChannelInterceptorSupport::InterceptorCollection interceptors; - for (TSmartConstMultimapIterator interceptorInstance(channelInterceptors); - interceptorInstance; - interceptorInstance++) { - integrationObj.QueryInterface(*interceptorInstance); - const std::string interceptorId = integrationObj->getId(); - if (interceptorInstance->isChannelIdMatched(channelId)) { - CAF_CM_LOG_DEBUG_VA3( - "Adding interceptor [id=%s order=%d] to channel [%s]", - interceptorId.c_str(), - interceptorInstance->getOrder(), - channelId.c_str()); - SmartPtrIChannelInterceptor interceptor; - interceptor.QueryInterface(*interceptorInstance); - interceptors.push_back(interceptor); - } - } - - if (interceptors.size()) { - interceptorSupport->setInterceptors(interceptors); - } - } - } else { - CAF_CM_LOG_DEBUG_VA0("No ChannelInterceptors were found"); - } -} - -void CIntegrationAppContext::wire( - const SmartPtrIAppContext& appContext, - const SmartPtrCIntegrationObjectCollection& integrationObjectCollection, - const SmartPtrCChannelResolver& channelResolver) const { - CAF_CM_FUNCNAME_VALIDATE("wire"); - CAF_CM_VALIDATE_INTERFACE(appContext); - CAF_CM_VALIDATE_SMARTPTR(integrationObjectCollection); - - for (TSmartConstMapIterator integrationObjectIter(*integrationObjectCollection); - integrationObjectIter; integrationObjectIter++) { - const SmartPtrIIntegrationObject integrationObject = *integrationObjectIter; - - SmartPtrIIntegrationComponentInstance integrationComponentInstance; - integrationComponentInstance.QueryInterface(integrationObject, false); - if (integrationComponentInstance) { - CAF_CM_LOG_DEBUG_VA1( - "Wiring - id: %s", integrationObject->getId().c_str()); - integrationComponentInstance->wire(appContext, channelResolver); - } - } -} - -void CIntegrationAppContext::startStop( - const LifecycleBeans& lifecycleBeans, - const uint32 timeoutMs, - const bool isStart) const { - CAF_CM_FUNCNAME("startStop"); - - if (isStart) { - for (LifecycleBeans::const_iterator lifecycleObjIter = lifecycleBeans.begin(); - lifecycleObjIter != lifecycleBeans.end(); - ++lifecycleObjIter) { - SmartPtrILifecycle lifecycleObj = lifecycleObjIter->second; - SmartPtrIIntegrationObject integrationObj; - integrationObj.QueryInterface(lifecycleObj, true); - bool bAutoStart = true; - SmartPtrISmartLifecycle smartLifecycleObj; - smartLifecycleObj.QueryInterface(lifecycleObj, false); - if (smartLifecycleObj) { - bAutoStart = smartLifecycleObj->isAutoStartup(); - } - if (bAutoStart) { - CAF_CM_LOG_DEBUG_VA2( - "Starting lifecycle object [phase:%d][id:%s]", - lifecycleObjIter->first, - integrationObj->getId().c_str()); - lifecycleObj->start(timeoutMs); - } else { - CAF_CM_LOG_DEBUG_VA2( - "Skipping lifecycle object start [phase:%d][id:%s] " - "because isAutoStartup=false", - lifecycleObjIter->first, - integrationObj->getId().c_str()); - } - } - } else { - for (LifecycleBeans::const_reverse_iterator lifecycleObjIter = lifecycleBeans.rbegin(); - lifecycleObjIter != lifecycleBeans.rend(); - ++lifecycleObjIter) { - try { - SmartPtrILifecycle lifecycleObj = lifecycleObjIter->second; - SmartPtrIIntegrationObject integrationObj; - integrationObj.QueryInterface(lifecycleObj, true); - CAF_CM_LOG_DEBUG_VA2( - "Stopping lifecycle object [phase:%d][id:%s]", - lifecycleObjIter->first, - integrationObj->getId().c_str()); - lifecycleObj->stop(timeoutMs); - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_ERROR_CAFEXCEPTION; - CAF_CM_CLEAREXCEPTION; - } - } -} - -void CIntegrationAppContext::addBuiltIn( - const std::string& beanId, - const IAppContext::SmartPtrCBeans& beans, - SmartPtrCIntegrationObjectCollection& integrationObjectCollection) const { - CAF_CM_FUNCNAME_VALIDATE("addBuiltIn"); - CAF_CM_VALIDATE_STRING(beanId); - CAF_CM_VALIDATE_SMARTPTR(beans); - CAF_CM_VALIDATE_SMARTPTR(integrationObjectCollection); - - const SmartPtrIDocument configSection; - - const IAppContext::CBeans::const_iterator beanIter = beans->find(beanId); - if (beanIter != beans->end()) { - const SmartPtrIBean bean = beanIter->second; - - SmartPtrIIntegrationComponent integrationComponent; - integrationComponent.QueryInterface(bean, false); - - if (!integrationComponent.IsNull()) { - const SmartPtrIIntegrationObject integrationObject = - integrationComponent->createObject(configSection); - - const std::string id = integrationObject->getId(); - integrationObjectCollection->insert(std::make_pair(id, integrationObject)); - } - } -} - -std::string CIntegrationAppContext::getDefaultBeanConfigPath() const { - CAF_CM_FUNCNAME("getDefaultBeanConfigPath"); - - // Get the bean config file - const std::string appConfigKey = "bean_config_file"; - std::string beanConfigPath = AppConfigUtils::getRequiredString(appConfigKey); - beanConfigPath = CStringUtils::expandEnv(beanConfigPath); - if (!FileSystemUtils::doesFileExist(beanConfigPath)) { - CAF_CM_EXCEPTIONEX_VA2(FileNotFoundException, ERROR_FILE_NOT_FOUND, - "The bean config file does not exist - appConfigKey: %s, file: %s", - appConfigKey.c_str(), beanConfigPath.c_str()); - } - - return beanConfigPath; -} - -Cdeqstr CIntegrationAppContext::getBeanConfigFiles( - const std::string& beanConfigPath) const { - CAF_CM_FUNCNAME("getBeanConfigFiles"); - CAF_CM_VALIDATE_STRING(beanConfigPath); - - // Get the bean config file - const std::string beanConfigPathExp = CStringUtils::expandEnv(beanConfigPath); - if (!FileSystemUtils::doesFileExist(beanConfigPathExp)) { - CAF_CM_EXCEPTIONEX_VA1(FileNotFoundException, ERROR_FILE_NOT_FOUND, - "The bean config file does not exist - file: %s", - beanConfigPathExp.c_str()); - } - - CAF_CM_LOG_DEBUG_VA1("Adding bean file - %s", beanConfigPathExp.c_str()); - Cdeqstr beanConfigPathCollection; - beanConfigPathCollection.push_front(beanConfigPathExp); - - const SmartPtrCXmlElement rootXml = CXmlUtils::parseFile(beanConfigPathExp, "caf:beans"); - const CXmlElement::SmartPtrCElementCollection beanChildrenXml = rootXml->getAllChildren(); - CAF_CM_VALIDATE_SMARTPTR(beanChildrenXml); - - const std::string beanConfigDirname = FileSystemUtils::getDirname(beanConfigPathExp); - for (TSmartConstMapIterator beanXmlIter(*beanChildrenXml); - beanXmlIter; beanXmlIter++) { - if (beanXmlIter.getKey().compare("import") == 0) { - const SmartPtrCXmlElement importXml = *beanXmlIter; - const std::string import = importXml->findRequiredAttribute("resource"); - const std::string importExp = CStringUtils::expandEnv(import); - - std::string importPath = FileSystemUtils::buildPath(beanConfigDirname, importExp); - if (! FileSystemUtils::doesFileExist(importPath)) { - importPath = importExp; - if (! FileSystemUtils::doesFileExist(importPath)) { - CAF_CM_EXCEPTIONEX_VA2(FileNotFoundException, ERROR_FILE_NOT_FOUND, - "Import does not exist - origFile: %s, importPath: %s", - beanConfigPath.c_str(), importPath.c_str()); - } - } - - CAF_CM_LOG_DEBUG_VA1("Adding bean file - %s", importPath.c_str()); - beanConfigPathCollection.push_front(importPath); - } - } - - return beanConfigPathCollection; -} - -CIntegrationAppContext:: -CIntegrationAppContextWeakReference::CIntegrationAppContextWeakReference() : - _context(NULL), - CAF_CM_INIT("CIntegrationAppContext") { - CAF_CM_INIT_THREADSAFE; -} - -void CIntegrationAppContext:: -CIntegrationAppContextWeakReference::set(CIntegrationAppContext *context) { - CAF_CM_LOCK_UNLOCK; - _context = context; -} - -SmartPtrIIntegrationObject CIntegrationAppContext:: -CIntegrationAppContextWeakReference::getIntegrationObject( - const std::string& id) const { - CAF_CM_FUNCNAME_VALIDATE("getIntegrtationObject"); - CAF_CM_LOCK_UNLOCK; - CAF_CM_VALIDATE_PTR(_context); - return _context->getIntegrationObject(id); -} - -void CIntegrationAppContext:: -CIntegrationAppContextWeakReference::getIntegrationObject( - const IID& iid, - void **ppv) const { - CAF_CM_FUNCNAME_VALIDATE("getIntegrtationObject"); - CAF_CM_LOCK_UNLOCK; - CAF_CM_VALIDATE_PTR(_context); - _context->getIntegrationObject(iid, ppv); -} - -IIntegrationAppContext::SmartPtrCObjectCollection CIntegrationAppContext:: -CIntegrationAppContextWeakReference::getIntegrationObjects( - const IID& iid) const { - CAF_CM_FUNCNAME_VALIDATE("getIntegrtationObjects"); - CAF_CM_LOCK_UNLOCK; - CAF_CM_VALIDATE_PTR(_context); - return _context->getIntegrationObjects(iid); -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/CMessageHandler.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/CMessageHandler.cpp deleted file mode 100644 index c17d97817..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/CMessageHandler.cpp +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "ICafObject.h" -#include "Integration/IIntMessage.h" -#include "Integration/IMessageChannel.h" -#include "Integration/Core/CMessageHandler.h" -#include "Exception/CCafException.h" - -using namespace Caf; - -CMessageHandler::CMessageHandler() : - _isInitialized(false), - CAF_CM_INIT_LOG("CMessageHandler") { -} - -CMessageHandler::~CMessageHandler() { -} - -void CMessageHandler::initialize( - const std::string& inputId, - const SmartPtrIMessageChannel& outputMessageChannel, - const SmartPtrICafObject& messageHandlerObj) { - CAF_CM_FUNCNAME("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(inputId); - // outputMessageChannel is optional - // - // messageHandlerObj optional but if provided must be one of - // ITransformer - // IMessageProcessor - // IMessageSplitter - // IMessageRouter - // IMessageHandler - // - // messageHandlerObj may also support IErrorProcessor - - _inputId = inputId; - _outputMessageChannel = outputMessageChannel; - - if (messageHandlerObj) { - _transformer.QueryInterface(messageHandlerObj, false); - _errorProcessor.QueryInterface(messageHandlerObj, false); - _messageProcessor.QueryInterface(messageHandlerObj, false); - _messageSplitter.QueryInterface(messageHandlerObj, false); - _messageRouter.QueryInterface(messageHandlerObj, false); - _messageHandler.QueryInterface(messageHandlerObj, false); - if (!_transformer && - !_errorProcessor && - !_messageProcessor && - !_messageSplitter && - !_messageRouter && - !_messageHandler) { - CAF_CM_EXCEPTIONEX_VA1( - InvalidArgumentException, - 0, - "The messageHandler object '%s' does not have " - "a supported endpoint interface", - _inputId.c_str()); - } - } - - _isInitialized = true; -} - -std::string CMessageHandler::getInputId() const { - CAF_CM_FUNCNAME_VALIDATE("getInputId"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _inputId; -} - -void CMessageHandler::handleMessage( - const SmartPtrIIntMessage& message) { - CAF_CM_FUNCNAME("handleMessage"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(message); - - _savedMessage = message; - - const std::string isThrowableStr = - message->findOptionalHeaderAsString(MessageHeaders::_sIS_THROWABLE); - const bool isThrowable = - (isThrowableStr.empty() || (isThrowableStr.compare("false") == 0)) ? false : true; - - if (isThrowable) { - if (! _errorProcessor.IsNull()) { - _savedMessage = _errorProcessor->processErrorMessage(message); - if (_savedMessage.IsNull()) { - CAF_CM_LOG_WARN_VA1( - "Error processing did not return a message - %s", _inputId.c_str()); - } else { - CAF_CM_VALIDATE_INTERFACE(_outputMessageChannel); - _outputMessageChannel->send(_savedMessage); - } - } else { - CAF_CM_EXCEPTIONEX_VA1(IllegalStateException, ERROR_INVALID_STATE, - "Nothing handled the throwable message - %s", _inputId.c_str()); - } - } else { - if (_inputId.compare("errorChannel") == 0) { - CAF_CM_LOG_WARN_VA1( - "Received non-error on error channel - %s", _inputId.c_str()); - } else if (! _messageSplitter.IsNull()) { - const IMessageSplitter::SmartPtrCMessageCollection outputMessageCollection = - _messageSplitter->splitMessage(message); - if (outputMessageCollection.IsNull() || outputMessageCollection->empty()) { - CAF_CM_LOG_WARN_VA1( - "Splitter did not split the message - %s", _inputId.c_str()); - } else { - CAF_CM_VALIDATE_INTERFACE(_outputMessageChannel); - for (TSmartConstIterator outputMessageIter(*outputMessageCollection); - outputMessageIter; outputMessageIter++) { - _savedMessage = *outputMessageIter; - _outputMessageChannel->send(_savedMessage); - } - } - } else if (! _messageRouter.IsNull()) { - CAF_CM_VALIDATE_BOOL(_outputMessageChannel.IsNull()); - _messageRouter->routeMessage(message); - } else if (! _messageProcessor.IsNull()) { - _savedMessage = _messageProcessor->processMessage(message); - if (_savedMessage.IsNull()) { - CAF_CM_LOG_WARN_VA1( - "Message processing did not return a message - %s", _inputId.c_str()); - } else { - CAF_CM_VALIDATE_INTERFACE(_outputMessageChannel); - _outputMessageChannel->send(_savedMessage); - } - } else if (! _transformer.IsNull()) { - _savedMessage = _transformer->transformMessage(message); - if (_savedMessage.IsNull()) { - CAF_CM_LOG_WARN_VA1( - "Transform did not return a message - %s", _inputId.c_str()); - } else { - CAF_CM_VALIDATE_INTERFACE(_outputMessageChannel); - _outputMessageChannel->send(_savedMessage); - } - } else if (! _messageHandler.IsNull()) { - _messageHandler->handleMessage(message); - } else if (! _outputMessageChannel.IsNull()) { - _outputMessageChannel->send(message); - } else { - CAF_CM_EXCEPTIONEX_VA1(IllegalStateException, ERROR_INVALID_STATE, - "Nothing handled the message - %s", _inputId.c_str()); - } - } -} - -SmartPtrIIntMessage CMessageHandler::getSavedMessage() const { - CAF_CM_FUNCNAME_VALIDATE("getSavedMessage"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _savedMessage; -} - -void CMessageHandler::clearSavedMessage() { - CAF_CM_FUNCNAME_VALIDATE("clearSavedMessage"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - _savedMessage = NULL; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/CMessageHeaderUtils.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/CMessageHeaderUtils.cpp deleted file mode 100644 index c7866884e..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/CMessageHeaderUtils.cpp +++ /dev/null @@ -1,199 +0,0 @@ -/* - * Author: bwilliams - * Created: April 6, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - * - */ - -#include "stdafx.h" - -#include "Integration/IIntMessage.h" -#include "Exception/CCafException.h" -#include "Integration/Core/CMessageHeaderUtils.h" - -using namespace Caf; - -std::string CMessageHeaderUtils::getStringReq( - const IIntMessage::SmartPtrCHeaders& headers, - const std::string& tag) { - CAF_CM_STATIC_FUNC("CMessageHeaderUtils", "getStringReq"); - - if (headers->find(tag) == headers->end()) { - CAF_CM_EXCEPTION_VA1(ERROR_NOT_FOUND, "Header not found: %s", tag.c_str()); - } - return getStringOpt(headers, tag); -} - -std::string CMessageHeaderUtils::getStringOpt( - const IIntMessage::SmartPtrCHeaders& headers, - const std::string& tag) { - - std::string rc = 0; - IIntMessage::CHeaders::const_iterator iter = headers->find(tag); - if (iter != headers->end()) { - rc = iter->second.first->toString(); - } - return rc; -} - -uint8 CMessageHeaderUtils::getUint8Req( - const IIntMessage::SmartPtrCHeaders& headers, - const std::string& tag) { - CAF_CM_STATIC_FUNC("CMessageHeaderUtils", "getUint8Req"); - - if (headers->find(tag) == headers->end()) { - CAF_CM_EXCEPTION_VA1(ERROR_NOT_FOUND, "Header not found: %s", tag.c_str()); - } - return getUint8Opt(headers, tag); -} - -uint8 CMessageHeaderUtils::getUint8Opt( - const IIntMessage::SmartPtrCHeaders& headers, - const std::string& tag) { - - uint8 rc = 0; - IIntMessage::CHeaders::const_iterator header = headers->find(tag); - if (header != headers->end()) { - if (g_variant_is_of_type(header->second.first->get(), G_VARIANT_TYPE_BYTE)) { - rc = g_variant_get_byte(header->second.first->get()); - } else { - rc = CStringConv::fromString(header->second.first->toString()); - } - } - return rc; -} - -uint16 CMessageHeaderUtils::getUint16Req( - const IIntMessage::SmartPtrCHeaders& headers, - const std::string& tag) { - CAF_CM_STATIC_FUNC("CMessageHeaderUtils", "getUint16Req"); - - if (headers->find(tag) == headers->end()) { - CAF_CM_EXCEPTION_VA1(ERROR_NOT_FOUND, "Header not found: %s", tag.c_str()); - } - return getUint16Opt(headers, tag); -} - -uint16 CMessageHeaderUtils::getUint16Opt( - const IIntMessage::SmartPtrCHeaders& headers, - const std::string& tag) { - - uint16 rc = 0; - IIntMessage::CHeaders::const_iterator header = headers->find(tag); - if (header != headers->end()) { - if (g_variant_is_of_type(header->second.first->get(), G_VARIANT_TYPE_UINT16)) { - rc = g_variant_get_uint16(header->second.first->get()); - } else { - rc = CStringConv::fromString(header->second.first->toString()); - } - } - return rc; -} - -uint32 CMessageHeaderUtils::getUint32Req( - const IIntMessage::SmartPtrCHeaders& headers, - const std::string& tag) { - CAF_CM_STATIC_FUNC("CMessageHeaderUtils", "getUint32Req"); - - if (headers->find(tag) == headers->end()) { - CAF_CM_EXCEPTION_VA1(ERROR_NOT_FOUND, "Header not found: %s", tag.c_str()); - } - return getUint32Opt(headers, tag); -} - -uint32 CMessageHeaderUtils::getUint32Opt( - const IIntMessage::SmartPtrCHeaders& headers, - const std::string& tag) { - - uint32 rc = 0; - IIntMessage::CHeaders::const_iterator header = headers->find(tag); - if (header != headers->end()) { - if (g_variant_is_of_type(header->second.first->get(), G_VARIANT_TYPE_UINT32)) { - rc = g_variant_get_uint32(header->second.first->get()); - } else { - rc = CStringConv::fromString(header->second.first->toString()); - } - } - return rc; -} - -uint64 CMessageHeaderUtils::getUint64Req( - const IIntMessage::SmartPtrCHeaders& headers, - const std::string& tag) { - CAF_CM_STATIC_FUNC("CMessageHeaderUtils", "getUint64Req"); - - if (headers->find(tag) == headers->end()) { - CAF_CM_EXCEPTION_VA1(ERROR_NOT_FOUND, "Header not found: %s", tag.c_str()); - } - return getUint64Opt(headers, tag); -} - -uint64 CMessageHeaderUtils::getUint64Opt( - const IIntMessage::SmartPtrCHeaders& headers, - const std::string& tag) { - - uint64 rc = 0; - IIntMessage::CHeaders::const_iterator header = headers->find(tag); - if (header != headers->end()) { - if (g_variant_is_of_type(header->second.first->get(), G_VARIANT_TYPE_UINT64)) { - rc = g_variant_get_uint64(header->second.first->get()); - } else { - rc = CStringConv::fromString(header->second.first->toString()); - } - } - return rc; -} - -bool CMessageHeaderUtils::getBoolReq( - const IIntMessage::SmartPtrCHeaders& headers, - const std::string& tag) { - CAF_CM_STATIC_FUNC("CMessageHeaderUtils", "getBoolReq"); - - if (headers->find(tag) == headers->end()) { - CAF_CM_EXCEPTION_VA1(ERROR_NOT_FOUND, "Header not found: %s", tag.c_str()); - } - return getBoolOpt(headers, tag); -} - -bool CMessageHeaderUtils::getBoolOpt( - const IIntMessage::SmartPtrCHeaders& headers, - const std::string& tag) { - - bool rc = false; - IIntMessage::CHeaders::const_iterator header = headers->find(tag); - if (header != headers->end()) { - if (g_variant_is_of_type(header->second.first->get(), G_VARIANT_TYPE_BOOLEAN)) { - rc = g_variant_get_boolean(header->second.first->get()); - } else { - const std::string val = header->second.first->toString(); - - rc = true; - if ((val == "0") - || (g_ascii_strncasecmp(val.c_str(), "false", val.length()) == 0)) { - rc = false; - } - } - } - return rc; -} - -void CMessageHeaderUtils::log( - const IIntMessage::SmartPtrCHeaders& headers, - const log4cpp::Priority::PriorityLevel priorityLevel) { - CAF_CM_STATIC_FUNC_LOG_ONLY("CMessageHeaderUtils", "log"); - - if (_logger.isPriorityEnabled(priorityLevel)) { - for (IIntMessage::CHeaders::const_iterator headerIter = headers->begin(); - headerIter != headers->end(); - headerIter++) { - std::stringstream logMessage; - logMessage << '[' - << headerIter->first - << '=' - << headerIter->second.first->toString() - << ']'; - _logger.logVA(priorityLevel, _cm_funcName_, __LINE__, logMessage.str().c_str()); - } - } -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/CMessagingTemplate.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/CMessagingTemplate.cpp deleted file mode 100644 index 7866937da..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/CMessagingTemplate.cpp +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 20, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "ICafObject.h" -#include "Integration/Core/CErrorHandler.h" -#include "Integration/Core/CMessageHandler.h" -#include "Integration/Core/CSimpleAsyncTaskExecutor.h" -#include "Integration/Core/CSourcePollingChannelAdapter.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/IMessageChannel.h" -#include "Integration/IPollableChannel.h" -#include "Integration/ITaskExecutor.h" -#include "Integration/Core/CMessagingTemplate.h" -#include "Exception/CCafException.h" - -using namespace Caf; - -CMessagingTemplate::CMessagingTemplate() : - _isInitialized(false), - _isRunning(false), - CAF_CM_INIT_LOG("CMessagingTemplate") { -} - -CMessagingTemplate::~CMessagingTemplate() { -} - -void CMessagingTemplate::initialize( - const SmartPtrIChannelResolver& channelResolver, - const SmartPtrIIntegrationObject& inputIntegrationObject, - const SmartPtrIMessageChannel& errorMessageChannel, - const SmartPtrIMessageChannel& outputMessageChannel, - const SmartPtrICafObject& messageHandlerObj) { - CAF_CM_FUNCNAME("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(channelResolver); - CAF_CM_VALIDATE_INTERFACE(inputIntegrationObject); - CAF_CM_VALIDATE_INTERFACE(errorMessageChannel); - // outputMessageChannel is optional - // - // messageHandlerObj optional but if provided must be one of - // ITransformer - // IMessageProcessor - // IMessageSplitter - // IMessageRouter - // IMessageHandler - // - // messageHandlerObj may also support IErrorProcessor - - _inputId = inputIntegrationObject->getId(); - - SmartPtrCMessageHandler messageHandler; - messageHandler.CreateInstance(); - messageHandler->initialize( - _inputId, - outputMessageChannel, - messageHandlerObj); - - SmartPtrIPollableChannel inputPollableChannel; - inputPollableChannel.QueryInterface(inputIntegrationObject, false); - _inputSubscribableChannel.QueryInterface(inputIntegrationObject, false); - - if (! _inputSubscribableChannel.IsNull()) { - _messagingTemplateHandler.CreateInstance(); - _messagingTemplateHandler->initialize(messageHandler); - } else if (! inputPollableChannel.IsNull()) { - _taskExecutor = createTaskExecutor( - channelResolver, messageHandler, inputPollableChannel, errorMessageChannel); - } else { - CAF_CM_EXCEPTIONEX_VA1(NoSuchElementException, ERROR_NOT_FOUND, - "Input object does not support any required interfaces - %s", _inputId.c_str()); - } - - _isInitialized = true; -} - -void CMessagingTemplate::start(const uint32 timeoutMs) { - CAF_CM_FUNCNAME("start"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - if (! _taskExecutor.IsNull()) { - CAF_CM_LOG_DEBUG_VA1("Executing task - %s", _inputId.c_str()); - _taskExecutor->execute(timeoutMs); - } else if (! _inputSubscribableChannel.IsNull()) { - CAF_CM_LOG_DEBUG_VA1("Subscribing handler - %s", _inputId.c_str()); - _inputSubscribableChannel->subscribe(_messagingTemplateHandler); - } else { - CAF_CM_EXCEPTIONEX_VA1(IllegalStateException, E_UNEXPECTED, - "Nothing to start: %s", _inputId.c_str()); - } -} - -void CMessagingTemplate::stop(const uint32 timeoutMs) { - CAF_CM_FUNCNAME("stop"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - CAF_CM_LOG_DEBUG_VA0("Stopping"); - - if (! _taskExecutor.IsNull()) { - CAF_CM_LOG_DEBUG_VA1("Canceling task - %s", _inputId.c_str()); - _taskExecutor->cancel(timeoutMs); - } else if (! _inputSubscribableChannel.IsNull()) { - CAF_CM_LOG_DEBUG_VA1("Unsubscribing handler - %s", _inputId.c_str()); - _inputSubscribableChannel->unsubscribe(_messagingTemplateHandler); - } else { - CAF_CM_EXCEPTIONEX_VA1(IllegalStateException, E_UNEXPECTED, - "Nothing to stop: %s", _inputId.c_str()); - } -} - -bool CMessagingTemplate::isRunning() const { - CAF_CM_FUNCNAME_VALIDATE("isRunning"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - bool isRunning = true; - if (! _taskExecutor.IsNull()) { - isRunning = (_taskExecutor->getState() == ITaskExecutor::ETaskStateStarted); - } - - return isRunning; -} - -SmartPtrITaskExecutor CMessagingTemplate::createTaskExecutor( - const SmartPtrIChannelResolver& channelResolver, - const SmartPtrCMessageHandler& messageHandler, - const SmartPtrIPollableChannel& inputPollableChannel, - const SmartPtrIMessageChannel& errorMessageChannel) const { - CAF_CM_FUNCNAME_VALIDATE("createTaskExecutor"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(channelResolver); - CAF_CM_VALIDATE_SMARTPTR(messageHandler); - CAF_CM_VALIDATE_INTERFACE(inputPollableChannel); - CAF_CM_VALIDATE_INTERFACE(errorMessageChannel); - - SmartPtrCErrorHandler errorHandler; - errorHandler.CreateInstance(); - errorHandler->initialize(channelResolver, errorMessageChannel); - - SmartPtrCSourcePollingChannelAdapter sourcePollingChannelAdapter; - sourcePollingChannelAdapter.CreateInstance(); - sourcePollingChannelAdapter->initialize(messageHandler, inputPollableChannel, errorHandler); - - SmartPtrCSimpleAsyncTaskExecutor simpleAsyncTaskExecutor; - simpleAsyncTaskExecutor.CreateInstance(); - simpleAsyncTaskExecutor->initialize(sourcePollingChannelAdapter, errorHandler); - - return simpleAsyncTaskExecutor; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/CMessagingTemplateHandler.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/CMessagingTemplateHandler.cpp deleted file mode 100644 index 81ac2931d..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/CMessagingTemplateHandler.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Integration/IIntMessage.h" -#include "Integration/IMessageHandler.h" -#include "Integration/Core/CMessagingTemplateHandler.h" - -using namespace Caf; - -CMessagingTemplateHandler::CMessagingTemplateHandler() : - _isInitialized(false), - CAF_CM_INIT("CMessagingTemplateHandler") { -} - -CMessagingTemplateHandler::~CMessagingTemplateHandler() { -} - -void CMessagingTemplateHandler::initialize( - const SmartPtrIMessageHandler& messageHandler) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_SMARTPTR(messageHandler); - - _messageHandler = messageHandler; - _isInitialized = true; -} - -void CMessagingTemplateHandler::handleMessage( - const SmartPtrIIntMessage& message) { - CAF_CM_FUNCNAME_VALIDATE("handleMessage"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(message); - - _messageHandler->handleMessage(message); -} - -SmartPtrIIntMessage CMessagingTemplateHandler::getSavedMessage() const { - CAF_CM_FUNCNAME_VALIDATE("getSavedMessage"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _messageHandler->getSavedMessage(); -} - -void CMessagingTemplateHandler::clearSavedMessage() { - CAF_CM_FUNCNAME_VALIDATE("clearSavedMessage"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - _messageHandler->clearSavedMessage();; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/CSimpleAsyncTaskExecutor.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/CSimpleAsyncTaskExecutor.cpp deleted file mode 100644 index 5b35f82fb..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/CSimpleAsyncTaskExecutor.cpp +++ /dev/null @@ -1,230 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 20, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Common/CAutoMutex.h" -#include "Integration/Core/CIntException.h" -#include "Integration/Core/CSimpleAsyncTaskExecutorState.h" -#include "Integration/IErrorHandler.h" -#include "Integration/IRunnable.h" -#include "Integration/ITaskExecutor.h" -#include "Integration/Core/CSimpleAsyncTaskExecutor.h" -#include "Exception/CCafException.h" - -using namespace Caf; - -CSimpleAsyncTaskExecutor::CSimpleAsyncTaskExecutor() : - _isInitialized(false), - _thread(NULL), - CAF_CM_INIT_LOG("CSimpleAsyncTaskExecutor") { - CAF_CM_FUNCNAME("CSimpleAsyncTaskExecutor"); - - try { - CAF_CM_INIT_THREADSAFE; - CAF_THREADSIGNAL_INIT; - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_CLEAREXCEPTION; -} - -CSimpleAsyncTaskExecutor::~CSimpleAsyncTaskExecutor() { - CAF_CM_FUNCNAME("~CSimpleAsyncTaskExecutor"); - - try { - cancel(0); - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_CLEAREXCEPTION; - - try { - if (_thread) { - CThreadUtils::join(_thread); - } - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_CLEAREXCEPTION; -} - -void CSimpleAsyncTaskExecutor::initialize( - const SmartPtrIRunnable& runnable, - const SmartPtrIErrorHandler& errorHandler) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - CAF_CM_LOCK_UNLOCK; - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(runnable); - CAF_CM_VALIDATE_INTERFACE(errorHandler); - - _state.CreateInstance(); - _state->initialize(runnable, errorHandler); - - _isInitialized = true; -} - -void CSimpleAsyncTaskExecutor::execute( - const uint32 timeoutMs) { - CAF_CM_FUNCNAME("execute"); - CAF_CM_LOCK_UNLOCK; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - if (ITaskExecutor::ETaskStateNotStarted == _state->getState()) { - // The mutex must be locked before calling waitForStart - // and before letting the thread spin up to avoid - // a race condition. See g_cond_timed_wait() - // - // Scope the CAF_THREADSIGNAL_LOCK_UNLOCK so that the - // mutex is guaranteed to unlock - { - CAF_CM_LOG_DEBUG_VA0("Starting the thread"); - CAF_THREADSIGNAL_LOCK_UNLOCK; - CThreadData threadData = std::make_pair( - CAF_THREADSIGNAL_MUTEX, - _state.GetNonAddRefedInterface()); - CAF_CM_VALIDATE_NULLPTR(_thread); - _thread = CThreadUtils::startJoinable(threadFunc, &threadData); - - CAF_CM_UNLOCK_LOCK; - _state->waitForStart(CAF_THREADSIGNAL_MUTEX, timeoutMs); - } - if (_state->getState() != ITaskExecutor::ETaskStateStarted) { - CAF_CM_EXCEPTION_VA1(ERROR_INVALID_STATE, - "Not Started: %s", _state->getStateStr().c_str()); - } - } else if (ITaskExecutor::ETaskStateStarted != _state->getState()) { - CAF_CM_EXCEPTION_VA1(ERROR_INVALID_STATE, - "Invalid State: %s", _state->getStateStr().c_str()); - } - - CAF_CM_LOG_INFO_VA0("Started"); -} - -void CSimpleAsyncTaskExecutor::cancel( - const uint32 timeoutMs) { - CAF_CM_FUNCNAME("cancel"); - CAF_CM_LOCK_UNLOCK; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - if (ITaskExecutor::ETaskStateStarted == _state->getState()) { - CAF_CM_LOG_INFO_VA0("Stopping"); - _state->setState(ITaskExecutor::ETaskStateStopping); - } - - if (ITaskExecutor::ETaskStateStopping == _state->getState()) { - _state->getRunnable()->cancel(); - - // The mutex must be locked before calling waitForStop - // and before letting the thread spin up to avoid - // a race condition. See g_cond_timed_wait() - // - // Scope the CAF_THREADSIGNAL_LOCK_UNLOCK so that the - // mutex is guaranteed to unlock - { - CAF_THREADSIGNAL_LOCK_UNLOCK; - CAF_CM_UNLOCK_LOCK; - while (! _state->getHasThreadExited()) { - _state->waitForStop(CAF_THREADSIGNAL_MUTEX, timeoutMs); - } - } - - if (_thread) { - CThreadUtils::join(_thread); - _thread = NULL; - } - - if (_state->getState() != ITaskExecutor::ETaskStateFinished) { - CAF_CM_EXCEPTION_VA1(ERROR_INVALID_STATE, "Not Stopped: %s", - _state->getStateStr().c_str()); - } - } else if (!((ITaskExecutor::ETaskStateFinished == _state->getState()) || - (ITaskExecutor::ETaskStateFailed == _state->getState()))) { - CAF_CM_EXCEPTION_VA1(ERROR_INVALID_STATE, "Invalid State: %s", - _state->getStateStr().c_str()); - } - - CAF_CM_LOG_INFO_VA0("Stopped"); -} - -ITaskExecutor::ETaskState CSimpleAsyncTaskExecutor::getState() const { - CAF_CM_FUNCNAME_VALIDATE("getState"); - CAF_CM_LOCK_UNLOCK; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _state->getState(); -} - -void* CSimpleAsyncTaskExecutor::threadFunc(void* data) { - CAF_CM_STATIC_FUNC_LOG("CSimpleAsyncTaskExecutor", "threadFunc"); - - SmartPtrCSimpleAsyncTaskExecutorState state; - SmartPtrCAutoMutex mutex; - ITaskExecutor::ETaskState stateState = ITaskExecutor::ETaskStateFailed; - - try { - CAF_CM_VALIDATE_PTR(data); - CThreadData *threadData = static_cast(data); - CAF_CM_VALIDATE_PTR(threadData->first); - CAF_CM_VALIDATE_PTR(threadData->second); - mutex = threadData->first; - state = static_cast(threadData->second); - CAF_CM_VALIDATE_SMARTPTR(state); - - try { - state->setState(ITaskExecutor::ETaskStateStarted); - - CAF_CM_LOCK_UNLOCK1(mutex); - state->signalStart(); - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_CRIT_CAFEXCEPTION; - - if (!CAF_CM_ISEXCEPTION) { - try { - state->getRunnable()->run(); - stateState = ITaskExecutor::ETaskStateFinished; - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_CRIT_CAFEXCEPTION; - } - - try { - if (CAF_CM_ISEXCEPTION) { - SmartPtrCIntException intException; - intException.CreateInstance(); - intException->initialize(CAF_CM_GETEXCEPTION); - state->getErrorHandler()->handleError(intException, SmartPtrIIntMessage()); - - CAF_CM_CLEAREXCEPTION; - } - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_CLEAREXCEPTION; - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_CLEAREXCEPTION; - - if (! state.IsNull()) { - try { - state->setState(stateState); - state->setThreadExited(); - - CAF_CM_LOCK_UNLOCK1(mutex); - state->signalStop(); - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_CLEAREXCEPTION; - } - - CAF_CM_LOG_INFO_VA0("**** Thread exiting ****"); - - return NULL; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/CSimpleAsyncTaskExecutorState.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/CSimpleAsyncTaskExecutorState.cpp deleted file mode 100644 index 04f07477b..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/CSimpleAsyncTaskExecutorState.cpp +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 20, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Common/CAutoMutex.h" -#include "Integration/IErrorHandler.h" -#include "Integration/IRunnable.h" -#include "Integration/Core/CSimpleAsyncTaskExecutorState.h" - -using namespace Caf; - -CSimpleAsyncTaskExecutorState::CSimpleAsyncTaskExecutorState() : - _isInitialized(false), - _hasThreadExited(false), - _runnableState(ITaskExecutor::ETaskStateNotStarted), - CAF_CM_INIT_LOG("CSimpleAsyncTaskExecutorState") { - CAF_CM_INIT_THREADSAFE; -} - -CSimpleAsyncTaskExecutorState::~CSimpleAsyncTaskExecutorState() { -} - -void CSimpleAsyncTaskExecutorState::initialize( - const SmartPtrIRunnable& runnable, - const SmartPtrIErrorHandler& errorHandler) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(runnable); - CAF_CM_VALIDATE_INTERFACE(errorHandler); - - _runnable = runnable; - _errorHandler = errorHandler; - - _threadSignalStart.initialize("Start"); - _threadSignalStop.initialize("Stop"); - - _isInitialized = true; -} - -ITaskExecutor::ETaskState CSimpleAsyncTaskExecutorState::getState() const { - CAF_CM_FUNCNAME_VALIDATE("getState"); - CAF_CM_LOCK_UNLOCK; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _runnableState; -} - -std::string CSimpleAsyncTaskExecutorState::getStateStr() const { - CAF_CM_FUNCNAME_VALIDATE("getStateStr"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - std::string rc; - switch(getState()) { - case ITaskExecutor::ETaskStateNotStarted: - rc = "NotStarted"; - break; - case ITaskExecutor::ETaskStateStarted: - rc = "Started"; - break; - case ITaskExecutor::ETaskStateStopping: - rc = "Stopping"; - break; - case ITaskExecutor::ETaskStateFinished: - rc = "Finished"; - break; - case ITaskExecutor::ETaskStateFailed: - rc = "Failed"; - break; - default: - rc = "Unknown"; - break; - } - - return rc; -} - -void CSimpleAsyncTaskExecutorState::setState( - const ITaskExecutor::ETaskState runnableState) { - CAF_CM_FUNCNAME_VALIDATE("setState"); - CAF_CM_LOCK_UNLOCK; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - _runnableState = runnableState; -} - -bool CSimpleAsyncTaskExecutorState::getHasThreadExited() { - CAF_CM_FUNCNAME_VALIDATE("getHasThreadExited"); - CAF_CM_LOCK_UNLOCK; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _hasThreadExited; -} - -void CSimpleAsyncTaskExecutorState::setThreadExited() { - CAF_CM_FUNCNAME_VALIDATE("setThreadExited"); - CAF_CM_LOCK_UNLOCK; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - _hasThreadExited = true; -} - -SmartPtrIRunnable CSimpleAsyncTaskExecutorState::getRunnable() const { - CAF_CM_FUNCNAME_VALIDATE("getRunnable"); - CAF_CM_LOCK_UNLOCK; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _runnable; -} - -SmartPtrIErrorHandler CSimpleAsyncTaskExecutorState::getErrorHandler() const { - CAF_CM_FUNCNAME_VALIDATE("getErrorHandler"); - CAF_CM_LOCK_UNLOCK; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _errorHandler; -} - -void CSimpleAsyncTaskExecutorState::signalStart() { - CAF_CM_FUNCNAME_VALIDATE("signalStart"); - CAF_CM_LOCK_UNLOCK; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - CAF_CM_LOG_DEBUG_VA2("Signal (%s) - %p", _threadSignalStart.getName().c_str(), this); - _threadSignalStart.signal(); -} - -void CSimpleAsyncTaskExecutorState::waitForStart( - SmartPtrCAutoMutex& mutex, - const uint32 timeoutMs) { - CAF_CM_FUNCNAME_VALIDATE("waitForStart"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - CAF_CM_LOG_DEBUG_VA2("Wait (%s) - waitMs: %d", _threadSignalStart.getName().c_str(), timeoutMs); - _threadSignalStart.wait(mutex, timeoutMs); -} - -void CSimpleAsyncTaskExecutorState::signalStop() { - CAF_CM_FUNCNAME_VALIDATE("signalStop"); - CAF_CM_LOCK_UNLOCK; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - CAF_CM_LOG_DEBUG_VA1("Signal (%s)", _threadSignalStop.getName().c_str()); - _threadSignalStop.signal(); -} - -void CSimpleAsyncTaskExecutorState::waitForStop( - SmartPtrCAutoMutex& mutex, - const uint32 timeoutMs) { - CAF_CM_FUNCNAME_VALIDATE("waitForStop"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - CAF_CM_LOG_DEBUG_VA2("Wait (%s) - waitMs: %d", _threadSignalStop.getName().c_str(), timeoutMs); - _threadSignalStop.wait(mutex, timeoutMs); -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/CSourcePollingChannelAdapter.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/CSourcePollingChannelAdapter.cpp deleted file mode 100644 index 20ead150d..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/CSourcePollingChannelAdapter.cpp +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 20, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Integration/Core/CIntException.h" -#include "Integration/IErrorHandler.h" -#include "Integration/IIntMessage.h" -#include "Integration/IMessageHandler.h" -#include "Integration/IPollableChannel.h" -#include "Integration/Core/CSourcePollingChannelAdapter.h" - -using namespace Caf; - -CSourcePollingChannelAdapter::CSourcePollingChannelAdapter() : - _isInitialized(false), - _isCancelled(false), - _isTimeoutSet(false), - _timeout(0), - CAF_CM_INIT_LOG("CSourcePollingChannelAdapter") { - CAF_CM_INIT_THREADSAFE; - CAF_THREADSIGNAL_INIT; -} - -CSourcePollingChannelAdapter::~CSourcePollingChannelAdapter() { -} - -void CSourcePollingChannelAdapter::initialize( - const SmartPtrIMessageHandler& messageHandler, - const SmartPtrIPollableChannel& inputPollableChannel, - const SmartPtrIErrorHandler& errorHandler) { - - initialize( - messageHandler, - inputPollableChannel, - errorHandler, - 0); - _isTimeoutSet = false; -} - -void CSourcePollingChannelAdapter::initialize( - const SmartPtrIMessageHandler& messageHandler, - const SmartPtrIPollableChannel& inputPollableChannel, - const SmartPtrIErrorHandler& errorHandler, - const int32 timeout) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(messageHandler); - CAF_CM_VALIDATE_INTERFACE(inputPollableChannel); - CAF_CM_VALIDATE_INTERFACE(errorHandler); - - _messageHandler = messageHandler; - _inputPollableChannel = inputPollableChannel; - _pollerMetadata = inputPollableChannel->getPollerMetadata(); - _errorHandler = errorHandler; - _timeout = timeout; - _isTimeoutSet = true; - - _threadSignalCancel.initialize("Cancel"); - - _isInitialized = true; -} - -void CSourcePollingChannelAdapter::run() { - CAF_CM_FUNCNAME("run"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - uint32 messageCount = 0; - SmartPtrIIntMessage message; - while (! getIsCancelled()) { - try { - message = NULL; - if (_isTimeoutSet) { - message = _inputPollableChannel->receive(_timeout); - } else { - message = _inputPollableChannel->receive(); - } - if (! message.IsNull()) { - messageCount++; - _messageHandler->handleMessage(message); - } - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_CRIT_CAFEXCEPTION; - - if (CAF_CM_ISEXCEPTION) { - SmartPtrIIntMessage savedMessage = _messageHandler->getSavedMessage(); - if (savedMessage.IsNull()) { - savedMessage = message; - } - - SmartPtrCIntException intException; - intException.CreateInstance(); - intException->initialize(CAF_CM_GETEXCEPTION); - _errorHandler->handleError(intException, savedMessage); - - CAF_CM_CLEAREXCEPTION; - } - - if (message.IsNull() - || (messageCount >= _pollerMetadata->getMaxMessagesPerPoll())) { - { - CAF_THREADSIGNAL_LOCK_UNLOCK; -// CAF_CM_LOG_DEBUG_VA2("Wait (%s) - waitMs: %d", -// _threadSignalCancel.getName().c_str(), -// _pollerMetadata->getFixedRate()); - _threadSignalCancel.waitOrTimeout( - CAF_THREADSIGNAL_MUTEX, _pollerMetadata->getFixedRate()); - } - - messageCount = 0; - } - } - - CAF_CM_LOG_DEBUG_VA0("Finished"); -} - -void CSourcePollingChannelAdapter::cancel() { - CAF_CM_FUNCNAME_VALIDATE("cancel"); - CAF_CM_LOCK_UNLOCK; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - CAF_CM_LOG_DEBUG_VA1("Signal (%s)", _threadSignalCancel.getName().c_str()); - _isCancelled = true; - _threadSignalCancel.signal(); -} - -bool CSourcePollingChannelAdapter::getIsCancelled() const { - CAF_CM_FUNCNAME_VALIDATE("getIsCancelled"); - CAF_CM_LOCK_UNLOCK; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _isCancelled; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/CUnicastingDispatcher.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/CUnicastingDispatcher.cpp deleted file mode 100644 index 1457e27da..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/CUnicastingDispatcher.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Integration/Core/CIntException.h" -#include "Integration/IErrorHandler.h" -#include "Integration/IIntMessage.h" -#include "Integration/IMessageHandler.h" -#include "Integration/Core/CUnicastingDispatcher.h" - -using namespace Caf; - -CUnicastingDispatcher::CUnicastingDispatcher() : - _isInitialized(false), - CAF_CM_INIT_LOG("CUnicastingDispatcher") { -} - -CUnicastingDispatcher::~CUnicastingDispatcher() { -} - -void CUnicastingDispatcher::initialize( - const SmartPtrIErrorHandler& errorHandler) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(errorHandler); - - _errorHandler = errorHandler; - _messageHandlerCollection.CreateInstance(); - - _isInitialized = true; -} - -void CUnicastingDispatcher::addHandler( - const SmartPtrIMessageHandler& messageHandler) { - CAF_CM_FUNCNAME_VALIDATE("addHandler"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(messageHandler); - - const void* handlerPtr = messageHandler.GetNonAddRefedInterface(); - _messageHandlerCollection->insert(std::make_pair(handlerPtr, messageHandler)); - -#ifdef __x86_64__ - CAF_CM_LOG_DEBUG_VA1("Added handler - %llX", handlerPtr); -#else - CAF_CM_LOG_DEBUG_VA1("Added handler - %X", handlerPtr); -#endif -} - -void CUnicastingDispatcher::removeHandler( - const SmartPtrIMessageHandler& messageHandler) { - CAF_CM_FUNCNAME_VALIDATE("removeHandler"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(messageHandler); - - const void* handlerPtr = messageHandler.GetNonAddRefedInterface(); - _messageHandlerCollection->erase(handlerPtr); - -#ifdef __x86_64__ - CAF_CM_LOG_DEBUG_VA1("Removed handler - %llX", handlerPtr); -#else - CAF_CM_LOG_DEBUG_VA1("Removed handler - %X", handlerPtr); -#endif -} - -bool CUnicastingDispatcher::dispatch( - const SmartPtrIIntMessage& message) { - CAF_CM_FUNCNAME("dispatch"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(message); - - bool isMessageHandled = false; - - for (TSmartConstMapIterator messageHandlerIter(*_messageHandlerCollection); - ! isMessageHandled && messageHandlerIter; messageHandlerIter++) { - const SmartPtrIMessageHandler messageHandler = *messageHandlerIter; - -#ifdef __x86_64__ - CAF_CM_LOG_DEBUG_VA1("Dispatching to handler - %llX", messageHandlerIter.getKey()); -#else - CAF_CM_LOG_DEBUG_VA1("Dispatching to handler - %X", messageHandlerIter.getKey()); -#endif - try { - messageHandler->handleMessage(message); - isMessageHandled = true; - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_CRIT_CAFEXCEPTION; - - try { - if (CAF_CM_ISEXCEPTION) { - CAF_CM_VALIDATE_INTERFACE(messageHandler); - SmartPtrIIntMessage savedMessage = messageHandler->getSavedMessage(); - if (savedMessage.IsNull()) { - savedMessage = message; - } - - SmartPtrCIntException intException; - intException.CreateInstance(); - intException->initialize(CAF_CM_GETEXCEPTION); - _errorHandler->handleError(intException, savedMessage); - - CAF_CM_CLEAREXCEPTION; - } - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_CLEAREXCEPTION; - } - - return isMessageHandled; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/FileHeaders.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/FileHeaders.cpp deleted file mode 100644 index 6701a117c..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/FileHeaders.cpp +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Author: bwilliams - * Created: 10/19/2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "Integration/Core/FileHeaders.h" - -namespace Caf { - namespace FileHeaders { - const char* _sFILENAME = "file_name"; - const char* _sORIGINAL_FILE = "file_originalFile"; - } -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/MessageHeaders.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/MessageHeaders.cpp deleted file mode 100644 index 6c325a102..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/MessageHeaders.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Author: bwilliams - * Created: 10/19/2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "Integration/Core/MessageHeaders.h" - -namespace Caf { - namespace MessageHeaders { - // UUID stored as a string - const char* _sID = "id"; - - // int64 - const char* _sTIMESTAMP = "timestamp"; - - // string - const char* _sCORRELATION_ID = "correlationId"; - - // string - const char* _sREPLY_CHANNEL = "replyChannel"; - - // string - const char* _sERROR_CHANNEL = "errorChannel"; - - // int64 - const char* _sEXPIRATION_DATE = "expirationDate"; - - // int32 - const char* _sPRIORITY = "priority"; - - // int32 - const char* _sSEQUENCE_NUMBER = "sequenceNumber"; - - // int32 - const char* _sSEQUENCE_SIZE = "sequenceSize"; - - const char* _sIS_THROWABLE = "_isThrowable_"; - - // string - const char* _sREQUEST_ID = "caf.msg.requestid"; - - // boolean - const char* _sMULTIPART = "caf.msg.multipart"; - - // string - const char* _sMULTIPART_WORKING_DIR = "cafcomm.internal.multipart-working-dir"; - - // string - const char* _sPROTOCOL_TYPE = "caf.protocolType"; - - // string - const char* _sPROTOCOL_CONNSTR = "caf.connStr"; - } -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/stdafx.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/stdafx.h deleted file mode 100644 index 2087eb94d..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Integration/Core/stdafx.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 20, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef STDAFX_H_ -#define STDAFX_H_ - -#ifdef WIN32 - #define INTEGRATIONCORE_LINKAGE __declspec(dllexport) -#else - #define INTEGRATIONCORE_LINKAGE -#endif - -#include -#include - -#include "Integration/Core/FileHeaders.h" -#include "Integration/Core/MessageHeaders.h" - -#endif /* STDAFX_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Logging/CLogger.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Logging/CLogger.cpp deleted file mode 100644 index 5d51759a5..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Logging/CLogger.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Author: bwilliams - * Created: 1/14/2011 - * - * Copyright (C) 2009-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "CLogger.h" - -using namespace Caf; - -CLogger::CLogger(const char* className) : - _category(log4cpp::Category::getInstance(className)) { -} - -CLogger::~CLogger() { -} - -void CLogger::log( - const log4cpp::Priority::PriorityLevel priority, - const char* funcName, - const int32 lineNumber, - const CCafException* cafException) const { - - if(_category.isPriorityEnabled(priority) && (NULL != cafException)) { - logVA(priority, funcName, lineNumber, "0x%08X %s", cafException->getError(), - cafException->getFullMsg().c_str()); - logBacktrace(log4cpp::Priority::INFO, funcName, lineNumber, - *cafException->getBacktrace()); - } -} - -void CLogger::logMessage( - const log4cpp::Priority::PriorityLevel priority, - const char* funcName, - const int32 lineNumber, - const char* message) const { - - if(_category.isPriorityEnabled(priority)) { - std::stringstream fullMsg; - fullMsg << - funcName << "|" << - lineNumber << "|" << - message; - - _category.log(priority, fullMsg.str()); - } -} - -void CLogger::logVA( - const log4cpp::Priority::PriorityLevel priority, - const char* funcName, - const int32 lineNumber, - const char* format, - ...) const { - - const int16 logLineLen = 1024; - if(_category.isPriorityEnabled(priority)) { - char buffer [logLineLen]; - va_list args; - va_start(args, format); -#ifdef WIN32 - // Returns -1 if the buffer is truncated. - const int rc = vsnprintf_s(buffer, logLineLen, _TRUNCATE, format, args); - if (! ((rc > 0) || (rc == -1))) { - ::strcpy_s(buffer, "*** INTERNAL ERROR: UNABLE TO FORMAT MESSAGE ***"); -#else - const int rc = vsnprintf(buffer, logLineLen, format, args); - if (! (rc > 0)) { - ::strcpy(buffer, "*** INTERNAL ERROR: UNABLE TO FORMAT MESSAGE ***"); -#endif - } - - std::stringstream fullMsg; - fullMsg << - funcName << "|" << - lineNumber << "|" << - buffer; - - _category.log(priority, fullMsg.str()); - - va_end(args); - } -} - -bool CLogger::isPriorityEnabled(const log4cpp::Priority::Value priority) const { - return _category.isPriorityEnabled(priority); -} - -log4cpp::Priority::Value CLogger::getPriority() const { - return _category.getPriority(); -} - -void CLogger::setPriority(const log4cpp::Priority::Value priority) const { - _category.setPriority(priority); -} - -void CLogger::logBacktrace( - const log4cpp::Priority::PriorityLevel priority, - const char* funcName, - const int32 lineNumber, - const std::deque& backtrace) const { - - if (backtrace.empty()) { - logVA(priority, funcName, lineNumber, "Backtrace is empty"); - } else { - for (std::deque::const_iterator iter = backtrace.begin(); - iter != backtrace.end(); iter++) { - std::string name = *iter; - if (!name.empty()) { - logVA(priority, funcName, lineNumber, "%s", name.c_str()); - } - } - } -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Logging/CLogger.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Logging/CLogger.h deleted file mode 100644 index 9530d850d..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Logging/CLogger.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Author: bwilliams - * Created: 1/14/2011 - * - * Copyright (C) 2009-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CLogger_h_ -#define CLogger_h_ - -namespace Caf { - -class LOGGING_LINKAGE CLogger -{ -public: - CLogger(const char* className); - virtual ~CLogger(); - -public: - void log( - const log4cpp::Priority::PriorityLevel priority, - const char* funcName, - const int32 lineNumber, - const CCafException* cafException) const; - - void logMessage( - const log4cpp::Priority::PriorityLevel priority, - const char* funcName, - const int32 lineNumber, - const char* message) const; - - void logVA( - const log4cpp::Priority::PriorityLevel priority, - const char* funcName, - const int32 lineNumber, - const char* format, - ...) const; - - void logBacktrace( - const log4cpp::Priority::PriorityLevel priority, - const char* funcName, - const int32 lineNumber, - const std::deque& backtrace) const; - -public: - bool isPriorityEnabled(const log4cpp::Priority::Value priority) const; - - log4cpp::Priority::Value getPriority() const; - - void setPriority(const log4cpp::Priority::Value priority) const; - -private: - log4cpp::Category& _category; - -private: - CLogger(const CLogger&); - CLogger& operator=(const CLogger&); -}; - -} - -#endif // #define CLogger_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Logging/LoggingLink.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Logging/LoggingLink.h deleted file mode 100644 index 7448a2e87..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Logging/LoggingLink.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Author: bwilliams - * Created: Jan 13, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef LOGGINGLINK_H_ -#define LOGGINGLINK_H_ - -#ifndef LOGGING_LINKAGE - #ifdef WIN32 - #ifdef FRAMEWORK_BUILD - #define LOGGING_LINKAGE __declspec(dllexport) - #else - #define LOGGING_LINKAGE __declspec(dllimport) - #endif - #else - #define LOGGING_LINKAGE - #endif -#endif - -#include -#include -#define LOG4CPP_FIX_ERROR_COLLISION 1 -#include -#include -#include -#include -#include - -#include "../Exception/ExceptionLink.h" - -#include "CLogger.h" -#include "LoggingMacros.h" - -#endif /* LOGGINGLINK_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Logging/LoggingMacros.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Logging/LoggingMacros.h deleted file mode 100644 index 677d355b2..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Logging/LoggingMacros.h +++ /dev/null @@ -1,250 +0,0 @@ -/* - * Author: bwilliams - * Created: 1/14/2011 - * - * Copyright (C) 2009-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef LoggingMacros_h_ -#define LoggingMacros_h_ - -#define CAF_CM_CREATE_LOG \ - private: \ - CLogger _logger - -#define CAF_CM_INIT_LOG( _className_ ) \ - _cm_className_( _className_ ), \ - _logger(_className_) - -#define CAF_CM_STATIC_FUNC_LOG_VALIDATE( _scope_, _funcName_ ) \ - CLogger _logger(_scope_); \ - CAF_CM_STATIC_FUNC_VALIDATE( _scope_, _funcName_ ) - -#define CAF_CM_STATIC_FUNC_LOG_ONLY( _scope_, _funcName_ ) \ - CLogger _logger(_scope_); \ - CAF_CM_FUNCNAME_VALIDATE( _funcName_ ) - -#define CAF_CM_STATIC_FUNC_LOG( _scope_, _funcName_ ) \ - CLogger _logger(_scope_); \ - CAF_CM_STATIC_FUNC( _scope_, _funcName_ ) - -#define CAF_CM_LOG_GET_PRIORITY (_logger.getPriority()) -#define CAF_CM_LOG_SET_PRIORITY(_priorityLevel_) (_logger.setPriority(_priorityLevel_)) -#define CAF_CM_IS_LOG_ENABLED(_priorityLevel_) (_logger.isPriorityEnabled(_priorityLevel_)) -#define CAF_CM_IS_LOG_DEBUG_ENABLED (_logger.isPriorityEnabled(log4cpp::Priority::DEBUG)) -#define CAF_CM_IS_LOG_INFO_ENABLED (_logger.isPriorityEnabled(log4cpp::Priority::INFO)) -#define CAF_CM_IS_LOG_WARN_ENABLED (_logger.isPriorityEnabled(log4cpp::Priority::WARN)) -#define CAF_CM_IS_LOG_ERROR_ENABLED (_logger.isPriorityEnabled(log4cpp::Priority::ERROR)) -#define CAF_CM_IS_LOG_CRIT_ENABLED (_logger.isPriorityEnabled(log4cpp::Priority::CRIT)) - -/* - * Provide priority level - */ -#define CAF_CM_LOG_CAFEXCEPTION(_priorityLevel_) { \ - _logger.log(_priorityLevel_, _cm_funcName_, __LINE__, _cm_exception_); \ - } - -#define CAF_CM_LOG_VA0(_priorityLevel_, _msg_) { \ - _logger.logMessage(_priorityLevel_, _cm_funcName_, __LINE__, _msg_); \ - } - -#define CAF_CM_LOG_VA1(_priorityLevel_, _fmt_, _arg1_) { \ - _logger.logVA(_priorityLevel_, _cm_funcName_, __LINE__, _fmt_, _arg1_); \ - } - -#define CAF_CM_LOG_VA2(_priorityLevel_, _fmt_, _arg1_, _arg2_) { \ - _logger.logVA(_priorityLevel_, _cm_funcName_, __LINE__, _fmt_, _arg1_, _arg2_); \ - } - -#define CAF_CM_LOG_VA3(_priorityLevel_, _fmt_, _arg1_, _arg2_, _arg3_) { \ - _logger.logVA(_priorityLevel_, _cm_funcName_, __LINE__, _fmt_, _arg1_, _arg2_, _arg3_); \ - } - -#define CAF_CM_LOG_VA4(_priorityLevel_, _fmt_, _arg1_, _arg2_, _arg3_, _arg4_) { \ - _logger.logVA(_priorityLevel_, _cm_funcName_, __LINE__, _fmt_, _arg1_, _arg2_, _arg3_, _arg4_); \ - } - -#define CAF_CM_LOG_VA5(_priorityLevel_, _fmt_, _arg1_, _arg2_, _arg3_, _arg4_, _arg5_) { \ - _logger.logVA(_priorityLevel_, _cm_funcName_, __LINE__, _fmt_, _arg1_, _arg2_, _arg3_, _arg4_, _arg5_); \ - } - -#define CAF_CM_LOG_VA6(_priorityLevel_, _fmt_, _arg1_, _arg2_, _arg3_, _arg4_, _arg5_, _arg6_) { \ - _logger.logVA(_priorityLevel_, _cm_funcName_, __LINE__, _fmt_, _arg1_, _arg2_, _arg3_, _arg4_, _arg5_, _arg6_); \ - } - -/* - * Debug Macros - */ -#define CAF_CM_LOG_DEBUG_CAFEXCEPTION { \ - _logger.log(log4cpp::Priority::DEBUG, _cm_funcName_, __LINE__, _cm_exception_); \ - } - -#define CAF_CM_LOG_DEBUG_VA0(_msg_) { \ - _logger.logMessage(log4cpp::Priority::DEBUG, _cm_funcName_, __LINE__, _msg_); \ - } - -#define CAF_CM_LOG_DEBUG_VA1(_fmt_, _arg1_) { \ - _logger.logVA(log4cpp::Priority::DEBUG, _cm_funcName_, __LINE__, _fmt_, _arg1_); \ - } - -#define CAF_CM_LOG_DEBUG_VA2(_fmt_, _arg1_, _arg2_) { \ - _logger.logVA(log4cpp::Priority::DEBUG, _cm_funcName_, __LINE__, _fmt_, _arg1_, _arg2_); \ - } - -#define CAF_CM_LOG_DEBUG_VA3(_fmt_, _arg1_, _arg2_, _arg3_) { \ - _logger.logVA(log4cpp::Priority::DEBUG, _cm_funcName_, __LINE__, _fmt_, _arg1_, _arg2_, _arg3_); \ - } - -#define CAF_CM_LOG_DEBUG_VA4(_fmt_, _arg1_, _arg2_, _arg3_, _arg4_) { \ - _logger.logVA(log4cpp::Priority::DEBUG, _cm_funcName_, __LINE__, _fmt_, _arg1_, _arg2_, _arg3_, _arg4_); \ - } - -#define CAF_CM_LOG_DEBUG_VA5(_fmt_, _arg1_, _arg2_, _arg3_, _arg4_, _arg5_) { \ - _logger.logVA(log4cpp::Priority::DEBUG, _cm_funcName_, __LINE__, _fmt_, _arg1_, _arg2_, _arg3_, _arg4_, _arg5_); \ - } - -#define CAF_CM_LOG_DEBUG_VA6(_fmt_, _arg1_, _arg2_, _arg3_, _arg4_, _arg5_, _arg6_) { \ - _logger.logVA(log4cpp::Priority::DEBUG, _cm_funcName_, __LINE__, _fmt_, _arg1_, _arg2_, _arg3_, _arg4_, _arg5_, _arg6_); \ - } - -/* - * Info Macros - */ -#define CAF_CM_LOG_INFO_CAFEXCEPTION { \ - _logger.log(log4cpp::Priority::INFO, _cm_funcName_, __LINE__, _cm_exception_); \ - } - -#define CAF_CM_LOG_INFO_VA0(_msg_) { \ - _logger.logMessage(log4cpp::Priority::INFO, _cm_funcName_, __LINE__, _msg_); \ - } - -#define CAF_CM_LOG_INFO_VA1(_fmt_, _arg1_) { \ - _logger.logVA(log4cpp::Priority::INFO, _cm_funcName_, __LINE__, _fmt_, _arg1_); \ - } - -#define CAF_CM_LOG_INFO_VA2(_fmt_, _arg1_, _arg2_) { \ - _logger.logVA(log4cpp::Priority::INFO, _cm_funcName_, __LINE__, _fmt_, _arg1_, _arg2_); \ - } - -#define CAF_CM_LOG_INFO_VA3(_fmt_, _arg1_, _arg2_, _arg3_) { \ - _logger.logVA(log4cpp::Priority::INFO, _cm_funcName_, __LINE__, _fmt_, _arg1_, _arg2_, _arg3_); \ - } - -#define CAF_CM_LOG_INFO_VA4(_fmt_, _arg1_, _arg2_, _arg3_, _arg4_) { \ - _logger.logVA(log4cpp::Priority::INFO, _cm_funcName_, __LINE__, _fmt_, _arg1_, _arg2_, _arg3_, _arg4_); \ - } - -#define CAF_CM_LOG_INFO_VA5(_fmt_, _arg1_, _arg2_, _arg3_, _arg4_, _arg5_) { \ - _logger.logVA(log4cpp::Priority::INFO, _cm_funcName_, __LINE__, _fmt_, _arg1_, _arg2_, _arg3_, _arg4_, _arg5_); \ - } - -#define CAF_CM_LOG_INFO_VA6(_fmt_, _arg1_, _arg2_, _arg3_, _arg4_, _arg5_, _arg6_) { \ - _logger.logVA(log4cpp::Priority::INFO, _cm_funcName_, __LINE__, _fmt_, _arg1_, _arg2_, _arg3_, _arg4_, _arg5_, _arg6_); \ - } - -/* - * Warn Macros - */ -#define CAF_CM_LOG_WARN_CAFEXCEPTION { \ - _logger.log(log4cpp::Priority::WARN, _cm_funcName_, __LINE__, _cm_exception_); \ - } - -#define CAF_CM_LOG_WARN_VA0(_msg_) { \ - _logger.logMessage(log4cpp::Priority::WARN, _cm_funcName_, __LINE__, _msg_); \ - } - -#define CAF_CM_LOG_WARN_VA1(_fmt_, _arg1_) { \ - _logger.logVA(log4cpp::Priority::WARN, _cm_funcName_, __LINE__, _fmt_, _arg1_); \ - } - -#define CAF_CM_LOG_WARN_VA2(_fmt_, _arg1_, _arg2_) { \ - _logger.logVA(log4cpp::Priority::WARN, _cm_funcName_, __LINE__, _fmt_, _arg1_, _arg2_); \ - } - -#define CAF_CM_LOG_WARN_VA3(_fmt_, _arg1_, _arg2_, _arg3_) { \ - _logger.logVA(log4cpp::Priority::WARN, _cm_funcName_, __LINE__, _fmt_, _arg1_, _arg2_, _arg3_); \ - } - -#define CAF_CM_LOG_WARN_VA4(_fmt_, _arg1_, _arg2_, _arg3_, _arg4_) { \ - _logger.logVA(log4cpp::Priority::WARN, _cm_funcName_, __LINE__, _fmt_, _arg1_, _arg2_, _arg3_, _arg4_); \ - } - -#define CAF_CM_LOG_WARN_VA5(_fmt_, _arg1_, _arg2_, _arg3_, _arg4_, _arg5_) { \ - _logger.logVA(log4cpp::Priority::WARN, _cm_funcName_, __LINE__, _fmt_, _arg1_, _arg2_, _arg3_, _arg4_, _arg5_); \ - } - -#define CAF_CM_LOG_WARN_VA6(_fmt_, _arg1_, _arg2_, _arg3_, _arg4_, _arg5_, _arg6_) { \ - _logger.logVA(log4cpp::Priority::WARN, _cm_funcName_, __LINE__, _fmt_, _arg1_, _arg2_, _arg3_, _arg4_, _arg5_, _arg6_); \ - } - -/* - * Error Macros - */ -#define CAF_CM_LOG_ERROR_CAFEXCEPTION { \ - _logger.log(log4cpp::Priority::ERROR, _cm_funcName_, __LINE__, _cm_exception_); \ - } - -#define CAF_CM_LOG_ERROR_VA0(_msg_) { \ - _logger.logMessage(log4cpp::Priority::ERROR, _cm_funcName_, __LINE__, _msg_); \ - } - -#define CAF_CM_LOG_ERROR_VA1(_fmt_, _arg1_) { \ - _logger.logVA(log4cpp::Priority::ERROR, _cm_funcName_, __LINE__, _fmt_, _arg1_); \ - } - -#define CAF_CM_LOG_ERROR_VA2(_fmt_, _arg1_, _arg2_) { \ - _logger.logVA(log4cpp::Priority::ERROR, _cm_funcName_, __LINE__, _fmt_, _arg1_, _arg2_); \ - } - -#define CAF_CM_LOG_ERROR_VA3(_fmt_, _arg1_, _arg2_, _arg3_) { \ - _logger.logVA(log4cpp::Priority::ERROR, _cm_funcName_, __LINE__, _fmt_, _arg1_, _arg2_, _arg3_); \ - } - -#define CAF_CM_LOG_ERROR_VA4(_fmt_, _arg1_, _arg2_, _arg3_, _arg4_) { \ - _logger.logVA(log4cpp::Priority::ERROR, _cm_funcName_, __LINE__, _fmt_, _arg1_, _arg2_, _arg3_, _arg4_); \ - } - -#define CAF_CM_LOG_ERROR_VA5(_fmt_, _arg1_, _arg2_, _arg3_, _arg4_, _arg5_) { \ - _logger.logVA(log4cpp::Priority::ERROR, _cm_funcName_, __LINE__, _fmt_, _arg1_, _arg2_, _arg3_, _arg4_, _arg5_); \ - } - -#define CAF_CM_LOG_ERROR_VA6(_fmt_, _arg1_, _arg2_, _arg3_, _arg4_, _arg5_, _arg6_) { \ - _logger.logVA(log4cpp::Priority::ERROR, _cm_funcName_, __LINE__, _fmt_, _arg1_, _arg2_, _arg3_, _arg4_, _arg5_, _arg6_); \ - } - -/* - * Crit Macros - */ -#define CAF_CM_LOG_CRIT_CAFEXCEPTION { \ - _logger.log(log4cpp::Priority::CRIT, _cm_funcName_, __LINE__, _cm_exception_); \ - } - -#define CAF_CM_LOG_CRIT_VA0(_msg_) { \ - _logger.logMessage(log4cpp::Priority::CRIT, _cm_funcName_, __LINE__, _msg_); \ - } - -#define CAF_CM_LOG_CRIT_VA1(_fmt_, _arg1_) { \ - _logger.logVA(log4cpp::Priority::CRIT, _cm_funcName_, __LINE__, _fmt_, _arg1_); \ - } - -#define CAF_CM_LOG_CRIT_VA2(_fmt_, _arg1_, _arg2_) { \ - _logger.logVA(log4cpp::Priority::CRIT, _cm_funcName_, __LINE__, _fmt_, _arg1_, _arg2_); \ - } - -#define CAF_CM_LOG_CRIT_VA3(_fmt_, _arg1_, _arg2_, _arg3_) { \ - _logger.logVA(log4cpp::Priority::CRIT, _cm_funcName_, __LINE__, _fmt_, _arg1_, _arg2_, _arg3_); \ - } - -#define CAF_CM_LOG_CRIT_VA4(_fmt_, _arg1_, _arg2_, _arg3_, _arg4_) { \ - _logger.logVA(log4cpp::Priority::CRIT, _cm_funcName_, __LINE__, _fmt_, _arg1_, _arg2_, _arg3_, _arg4_); \ - } - -#define CAF_CM_LOG_CRIT_VA5(_fmt_, _arg1_, _arg2_, _arg3_, _arg4_, _arg5_) { \ - _logger.logVA(log4cpp::Priority::CRIT, _cm_funcName_, __LINE__, _fmt_, _arg1_, _arg2_, _arg3_, _arg4_, _arg5_); \ - } - -#define CAF_CM_LOG_CRIT_VA6(_fmt_, _arg1_, _arg2_, _arg3_, _arg4_, _arg5_, _arg6_) { \ - _logger.logVA(log4cpp::Priority::CRIT, _cm_funcName_, __LINE__, _fmt_, _arg1_, _arg2_, _arg3_, _arg4_, _arg5_, _arg6_); \ - } - -#endif // #define LoggingMacros_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Logging/stdafx.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Logging/stdafx.h deleted file mode 100644 index 38d6f0328..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Logging/stdafx.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Author: mdonahue - * Created: Jan 13, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef STDAFX_H_ -#define STDAFX_H_ - -#ifdef WIN32 - #define LOGGING_LINKAGE __declspec(dllexport) - #define COMMONAGGREGATOR_LINKAGE __declspec(dllexport) -#else - #define LOGGING_LINKAGE - #define COMMONAGGREGATOR_LINKAGE -#endif - -#include -#include -#include -#define LOG4CPP_FIX_ERROR_COLLISION 1 -#include -//#include -//#include -//#include -//#include - -#include "../Exception/ExceptionLink.h" - -#include "CLogger.h" -#include "LoggingMacros.h" - -#endif /* STDAFX_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/PlatformIID.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/PlatformIID.cpp deleted file mode 100644 index 47379106f..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/PlatformIID.cpp +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "PlatformIID.h" - -#include -#include -#ifndef WIN32 -#include -#include -#endif - -GMutex BasePlatform::gs_BaseIIDInitMutex; - -using namespace std; - -namespace BasePlatform { - -BASEPLATFORM_LINKAGE std::string UuidToString(const UUID& uuid) { - stringstream str; - str.fill('0'); - str.setf(ios_base::uppercase); - str.setf(ios_base::hex, ios_base::basefield); - str << setw(8) << uuid.Data1; - str << '-' << setw(4) << uuid.Data2; - str << '-' << setw(4) << uuid.Data3; - str << '-' << setw(2) << (int32)uuid.Data4[0]; - str << setw(2) << (int32)uuid.Data4[1]; - str << '-' << setw(2) << (int32)uuid.Data4[2]; - str << setw(2) << (int32)uuid.Data4[3]; - str << setw(2) << (int32)uuid.Data4[4]; - str << setw(2) << (int32)uuid.Data4[5]; - str << setw(2) << (int32)uuid.Data4[6]; - str << setw(2) << (int32)uuid.Data4[7]; - return str.str(); -} - -unsigned char Char2Bin(const unsigned char cucValue) -{ - unsigned char ucBinValue = 0; - if ('0' <= cucValue && '9' >= cucValue) - { - ucBinValue = cucValue - '0'; - } - else - { - ucBinValue = ::tolower(cucValue) - 'a' + 10; - } - return ucBinValue; -} - -BASEPLATFORM_LINKAGE HRESULT UuidFromString(const char* pszUuid, UUID& uuid) { - if (pszUuid) - { - // Check to see if the guid is surrounded by '{' '}' - if (*pszUuid == '{') { - pszUuid = &pszUuid[1]; - } - - if (::strlen(pszUuid) >= 36) - { - if (('-' != pszUuid[8]) || ('-' != pszUuid[13]) || - ('-' != pszUuid[18]) || ('-' != pszUuid[23])) - { - return E_INVALIDARG; - } - - for (int32 iLoop = 0; iLoop < 36; ++iLoop) - { - if (8 != iLoop && 13 != iLoop && 18 != iLoop && 23 != iLoop) - { -#if defined (__APPLE__) || defined (__hpux__) || defined (__sun__) || (defined (__linux__) && OS_RELEASE_MAJOR == 2) - if (!isxdigit(pszUuid[iLoop])) -#else - if (!::isxdigit(pszUuid[iLoop])) -#endif - { - return E_INVALIDARG; - } - } - } - - // so we've validated the string, so now we need to BCD it into - // the UUID structure - make a temporary and then memcpy it - uuid.Data1 = Char2Bin(pszUuid[0]) << 28; - uuid.Data1 |= Char2Bin(pszUuid[1]) << 24; - uuid.Data1 |= Char2Bin(pszUuid[2]) << 20; - uuid.Data1 |= Char2Bin(pszUuid[3]) << 16; - uuid.Data1 |= Char2Bin(pszUuid[4]) << 12; - uuid.Data1 |= Char2Bin(pszUuid[5]) << 8; - uuid.Data1 |= Char2Bin(pszUuid[6]) << 4; - uuid.Data1 |= Char2Bin(pszUuid[7]); - - uuid.Data2 = Char2Bin(pszUuid[9]) << 12; - uuid.Data2 |= Char2Bin(pszUuid[10]) << 8; - uuid.Data2 |= Char2Bin(pszUuid[11]) << 4; - uuid.Data2 |= Char2Bin(pszUuid[12]); - - uuid.Data3 = Char2Bin(pszUuid[14]) << 12; - uuid.Data3 |= Char2Bin(pszUuid[15]) << 8; - uuid.Data3 |= Char2Bin(pszUuid[16]) << 4; - uuid.Data3 |= Char2Bin(pszUuid[17]); - - uuid.Data4[0] = Char2Bin(pszUuid[19]) << 4; - uuid.Data4[0] |= Char2Bin(pszUuid[20]); - uuid.Data4[1] = Char2Bin(pszUuid[21]) << 4; - uuid.Data4[1] |= Char2Bin(pszUuid[22]); - uuid.Data4[2] = Char2Bin(pszUuid[24]) << 4; - uuid.Data4[2] |= Char2Bin(pszUuid[25]); - uuid.Data4[3] = Char2Bin(pszUuid[26]) << 4; - uuid.Data4[3] |= Char2Bin(pszUuid[27]); - uuid.Data4[4] = Char2Bin(pszUuid[28]) << 4; - uuid.Data4[4] |= Char2Bin(pszUuid[29]); - uuid.Data4[5] = Char2Bin(pszUuid[30]) << 4; - uuid.Data4[5] |= Char2Bin(pszUuid[31]); - uuid.Data4[6] = Char2Bin(pszUuid[32]) << 4; - uuid.Data4[6] |= Char2Bin(pszUuid[33]); - uuid.Data4[7] = Char2Bin(pszUuid[34]) << 4; - uuid.Data4[7] |= Char2Bin(pszUuid[35]); - - return S_OK; - } - else - { - return E_INVALIDARG; - } - } - - return E_INVALIDARG; -} -} -#ifndef WIN32 - -HRESULT UuidCreate(UUID* uuid) { - if (uuid) { - // a uuid is 16 bytes - we'll fill them with a - // random number (1st 4 bytes) - // the current time in seconds (2nd 4 bytes) - // the hostid of the machine (3rd 4 bytes) - // the current micro seconds (last 4 bytes) - int32 iRand = ::rand(); - struct timeval stTimeVal; - ::gettimeofday(&stTimeVal, NULL); - int32 iHostId = ::gethostid(); - - byte * pbUuid = reinterpret_cast(uuid); - ::memcpy(pbUuid, &iRand, 4); - ::memcpy(pbUuid+4, &stTimeVal.tv_sec, 4); - ::memcpy(pbUuid+8, &iHostId, 4); - ::memcpy(pbUuid+12, &stTimeVal.tv_usec, 4); - return S_OK; - } - else { - return OLE_E_BLANK; - } -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/PlatformStringFunc.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/PlatformStringFunc.cpp deleted file mode 100644 index 6ee8606bf..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/PlatformStringFunc.cpp +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Author: mdonahue - * Created: Jan 13, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "PlatformStringFunc.h" -#include - -using namespace std; - -namespace BasePlatform { -#ifdef fix -std::wstring A2W(const std::string& str) -{ - wstringstream wstm ; - const ctype& ctfacet = use_facet< ctype >(wstm.getloc()); - for (size_t i = 0; i < str.size(); ++i) { - wstm << ctfacet.widen(str[i]); - } - return wstm.str(); -} - -std::string W2A(const std::wstring& str) -{ - ostringstream stm; - const ctype& ctfacet = use_facet< ctype >(stm.getloc()); - for (size_t i = 0; i < str.size(); ++i) { - stm << ctfacet.narrow(str[i], 0); - } - return stm.str(); -} -#endif -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/SubSystemBase/CEcmDllManager.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/SubSystemBase/CEcmDllManager.cpp deleted file mode 100644 index 8000a4051..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/SubSystemBase/CEcmDllManager.cpp +++ /dev/null @@ -1,829 +0,0 @@ -/* - * Created: Oct 09, 2002 - * - * Copyright (C) 2002-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "Exception/CCafException.h" -#include "CEcmDllManager.h" - -#ifndef WIN32 - #include - #include - #include - #include -#endif - -#define _MAX_PATH_LARGE 32768 - -using namespace Caf; - -GRecMutex CEcmDllManager::ms_mutex; - -#if !defined( WIN32 ) -std::map CEcmDllManager::ms_mapLoadedModuleRefCounts; -std::map CEcmDllManager::ms_mapLoadedModules; -#endif - -// Here is where we work out which Unix OS style of dl functions we are -// going to use -// 1. we have all dl functions we need dlopen, dlclose, dladdr and dlsym -// 2. we have all dl functions except dladdr (AIX) -#if defined ( __sun__ ) || defined ( __linux__ ) || defined ( WIN32 ) || defined ( __hpux__ ) || defined (__APPLE__) -// we have everything we need -#elif defined ( _AIX ) - #include - #include - #include - extern "C" - { - extern int32 getargs(struct procsinfo*, int32, char*, int32); - } -#else - #error "Not yet ported to this platform" -#endif - -typedef BOOL (*DllMainPtr) (HINSTANCE, uint32, LPVOID); -static const char *gs_cszDllMainFunctionName = "DllMain"; -static const char *gs_cszMainFunctionName = "main"; -#ifdef _AIX -static const char *gs_cszInitFunctionName = "_GLOBAL__DI"; -#else -static const char *gs_cszInitFunctionName = "_init"; -#endif - -////////////////////////////////////////////////////////////////////////////// -// -// LoadLibrary -// Loads a shared library from any OS -// -////////////////////////////////////////////////////////////////////////////// -HMODULE CEcmDllManager::LoadLibrary( - const char * cszLibName, - bool bMustInvokeDllMain, - bool bThrowExceptionUponFailure/* = true */) -{ - CAF_CM_STATIC_FUNC( "CEcmDllManager", "LoadLibrary" ); - CAF_CM_VALIDATE_STRINGPTRA( cszLibName ); - - HMODULE hRetModule = NULL; - bool bIsLoaded = false; - -#if defined (WIN32) - const char* libPrefix = NULL; - const char* libSuffix = ".dll"; -#elif defined (__APPLE__) - const char* libPrefix = "lib"; - const char* libSuffix = ".dylib"; -#elif defined (__linux__) - const char* libPrefix = "lib"; - const char* libSuffix = ".so"; -#else -#error 'NOT IMPLEMENTED FOR THIS OPERATING SYSTEM' -#endif - - std::string libName(cszLibName); - if (libPrefix != NULL && libName.compare(0, std::string::npos, libPrefix) != 0) { - libName.insert(0, libPrefix); - } - if (libName.find(libSuffix) == std::string::npos) { - libName += libSuffix; - } - - try - { -#if defined ( WIN32 ) - hRetModule = ::LoadLibraryExA( libName.c_str(), NULL, 0 ); - uint32 rc = ::GetLastError(); - - if ( NULL != hRetModule ) - { - bIsLoaded = true; - } - else - { - std::string strSystemMessage; - if ( ERROR_SUCCESS != rc ) - { - strSystemMessage = BasePlatform::PlatformApi::GetApiErrorMessage(rc); - } - else - { - strSystemMessage = "GetLastError() returned ERROR_SUCCESS but hRetModule is NULL"; - } - - CAF_CM_EXCEPTION_VA2( - rc, - "Failed to load library: %s Error: %s", - libName.c_str(), - strSystemMessage.c_str()); - } -#else - bool bLogLoading = ( ::getenv( "SYSLOG_DLOPENS" ) != NULL ); - - // this needs to be thread safe so that we dont lose the last error - // generated if a new thread also calls dlerror - unlike windows, the - // error message is not per thread. - CAutoMutexLockUnlockRaw oCS( &ms_mutex ); - - if ( bLogLoading ) - ::syslog(LOG_DEBUG, "---- Loading %s", libName.c_str() ); - - - // Let's see if we've already loaded it - std::map::iterator it = ms_mapLoadedModuleRefCounts.find( libName.c_str() ); - if ( it != ms_mapLoadedModuleRefCounts.end() ) - { - it->second.m_iRefCount++; - hRetModule = it->second.m_hModule; - if ( bLogLoading ) -#ifdef __x86_64__ - ::syslog(LOG_DEBUG," ------ Already loaded as %p count is now %d", hRetModule, it->second.m_iRefCount ); -#else - ::syslog(LOG_DEBUG," ------ Already loaded as %p count is now %d", hRetModule, it->second.m_iRefCount ); -#endif - } - else - { - hRetModule = ::dlopen( libName.c_str(), RTLD_NOW | RTLD_LOCAL ); - if ( bLogLoading ) -#ifdef __x86_64__ - ::syslog(LOG_DEBUG," ------ Loaded as %p" , hRetModule); -#else - ::syslog(LOG_DEBUG," ------ Loaded as %p" , hRetModule); -#endif - - if ( NULL == hRetModule ) - { - std::string strSystemMessage; - const char * pszMessage = dlerror(); - if ( NULL != pszMessage ) - { - strSystemMessage = pszMessage; - } - else - { - strSystemMessage = "dlerror() returned NULL"; - } - - CAF_CM_EXCEPTIONEX_VA2( - LibraryFailedToLoadException, - 0, - "Failed to load library: %s Error: %s", - libName.c_str(), - strSystemMessage.c_str()); - } - else - { - bIsLoaded = true; - std::string strSubErrorMessage; - - // not all compilers will call a method on initializing - // a shared library, so we will force ourselves to call one - // we will mimic the Windows DllMain functionality - DllMainPtr pfnDllMain = (DllMainPtr) - CEcmDllManager::GetFunctionAddress( - hRetModule, - gs_cszDllMainFunctionName, - strSubErrorMessage ); - - - if ( NULL != pfnDllMain ) - { - BOOL result = ( *pfnDllMain )( hRetModule, DLL_PROCESS_ATTACH, NULL ); - if ( false == result ) - { - CAF_CM_EXCEPTION_VA2(E_FAIL, - "%s in library %s returned false - library not loaded", - gs_cszDllMainFunctionName, - libName.c_str()); - } - } - else if ( bMustInvokeDllMain ) - { - CAF_CM_EXCEPTION_VA3(E_FAIL, - "Unable to find %s in library %s, Error: %s - library not loaded", - gs_cszDllMainFunctionName, - libName.c_str(), - strSubErrorMessage.c_str()); - } - SModuleRefCount stRefCount; - stRefCount.m_iRefCount = 1; - stRefCount.m_hModule = hRetModule; - std::string strModuleName( libName.c_str() ); - ms_mapLoadedModuleRefCounts.insert( std::make_pair(strModuleName, stRefCount ) ); - ms_mapLoadedModules.insert( std::make_pair( hRetModule, strModuleName ) ); - } - } -#endif - } - catch (CCafException *e) - { - _cm_exception_ = e; - } - - if ( _cm_exception_ ) - { - try - { - if ( bIsLoaded ) - { - CEcmDllManager::UnloadLibrary( hRetModule, false ); - } - } - catch (CCafException *e) - { - e->Release(); - } - - - // If we were told to eat the exception then do so - hRetModule = NULL; - if( !bThrowExceptionUponFailure ) - { - _cm_exception_->Release(); - } - else - { - _cm_exception_->throwSelf(); - } - } - return hRetModule; -} - -////////////////////////////////////////////////////////////////////////////// -// -// UnloadLibrary -// Unloads a shared library from any OS -// -////////////////////////////////////////////////////////////////////////////// -void CEcmDllManager::UnloadLibrary( HMODULE hLibraryHandle, bool bMustInvokeDllMain ) -{ - CAF_CM_STATIC_FUNC( "CEcmDllManager", "UnloadLibrary" ); - CAF_CM_VALIDATE_PTR( hLibraryHandle ); - -#if defined ( WIN32 ) - if ( ! ::FreeLibrary( hLibraryHandle ) ) - { - uint32 rc = ::GetLastError(); - std::string strSystemMessage; - if ( ERROR_SUCCESS != rc ) - { - strSystemMessage = BasePlatform::PlatformApi::GetApiErrorMessage(rc); - } - else - { - strSystemMessage = "GetLastError() returned ERROR_SUCCESS"; - } - - CAF_CM_EXCEPTION_VA1( - rc, - "::FreeLibrary failed: %s", - strSystemMessage.c_str()); - } -#else - // this needs to be thread safe so that we dont lose the last error - // generated if a new thread also calls dlerror - unlike windows, the - // error message is not per thread. - bool bLogLoading = ( ::getenv( "SYSLOG_DLOPENS" ) != NULL ); - - CAutoMutexLockUnlockRaw oCS( &ms_mutex ); - - if ( bLogLoading ) -#ifdef __x86_64__ - ::syslog( LOG_DEBUG, "---- Unloading %p", hLibraryHandle ); -#else - ::syslog( LOG_DEBUG, "---- Unloading %p", hLibraryHandle ); -#endif - // look for the specific library in our loaded list - - // we'll unload if the ref count hits 0 or if it doesn't exist - int32 iRefCount = 0; - std::map::iterator it = ms_mapLoadedModules.find( hLibraryHandle ); - if ( it != ms_mapLoadedModules.end() ) - { - if ( bLogLoading ) { - ::syslog( LOG_DEBUG, "------ Is Library %s", it->second.c_str() ); - } - - std::map::iterator itCnt = - ms_mapLoadedModuleRefCounts.find (it->second); - if ( itCnt != ms_mapLoadedModuleRefCounts.end() ) - { - iRefCount = --itCnt->second.m_iRefCount; - if ( iRefCount == 0 ) - ms_mapLoadedModuleRefCounts.erase( itCnt ); - } - if ( iRefCount == 0 ) - { - ms_mapLoadedModules.erase( it ); - } - } - - if ( bLogLoading ) - ::syslog( LOG_DEBUG, "------ ref count is %d", iRefCount ); - - if ( iRefCount == 0 ) - { - // not all compilers will call a method on initializing - // a shared library, so we will force ourselves to call one - // we will mimic the Windows DllMain functionality - std::string strSubErrorMessage; - DllMainPtr pfnDllMain = (DllMainPtr) CEcmDllManager::GetFunctionAddress( - hLibraryHandle, - gs_cszDllMainFunctionName, strSubErrorMessage ); - - if ( NULL != pfnDllMain ) - { - BOOL result = ( *pfnDllMain )( hLibraryHandle, DLL_PROCESS_DETACH, NULL ); - if ( false == result ) - { - CAF_CM_EXCEPTION_VA1(E_FAIL, - "%s returned false - library not unloaded", - gs_cszDllMainFunctionName); - } - } - else if ( bMustInvokeDllMain ) - { - CAF_CM_EXCEPTION_VA2(E_FAIL, - "Unable to find %s, Error: %s, returned false - library not unloaded", - gs_cszDllMainFunctionName, - strSubErrorMessage.c_str()); - } - - if ( 0 != ::dlclose( hLibraryHandle ) ) - { - CAF_CM_EXCEPTION_VA1(E_FAIL, - "Unable to unload library %s", - ::dlerror()); - } - } -#endif -} - -////////////////////////////////////////////////////////////////////////////// -// -// GetFunctionAddress -// -// Finds the specified symbol in a library -// -////////////////////////////////////////////////////////////////////////////// -void * CEcmDllManager::GetFunctionAddress( HMODULE hLibraryHandle, const char * cszFunctionName, std::string & rstrErrorMessage ) -{ - CAF_CM_STATIC_FUNC_VALIDATE( "CEcmDllManager", "GetFunctionAddress" ); - CAF_CM_VALIDATE_STRINGPTRA( cszFunctionName ); - // It is legal for a NULL handle to be passed in - NULL is the - // executable - - void * pvRetAddress = NULL; - - rstrErrorMessage = ""; - -#if defined ( WIN32 ) - - pvRetAddress = ::GetProcAddress( hLibraryHandle, cszFunctionName ); - if ( NULL == pvRetAddress ) - { - uint32 rc = ::GetLastError(); - rstrErrorMessage = "Unable to locate function "; - rstrErrorMessage += cszFunctionName; - rstrErrorMessage += ", Error : "; - if ( ERROR_SUCCESS != rc ) - { - rstrErrorMessage += BasePlatform::PlatformApi::GetApiErrorMessage(rc); - } - else - { - rstrErrorMessage += "GetLastError() returned ERROR_SUCCESS"; - } - } -#else - CAutoMutexLockUnlockRaw oCS( &ms_mutex ); - try - { - pvRetAddress = ::dlsym( hLibraryHandle, cszFunctionName ); - } - catch (...) - { - // if we were passed a bad handle, this can cause a seg - // violation - so treat it as a regular error - // Note : Sometimes we can do nothing about it and the - // program will crash - pvRetAddress = NULL; - } - - if ( NULL == pvRetAddress ) - { - rstrErrorMessage = "Unable to locate function "; - rstrErrorMessage += cszFunctionName; - rstrErrorMessage += ", Error : "; - const char * pszError = ::dlerror(); - if ( NULL != pszError ) - { - rstrErrorMessage += pszError; - } - else - { - rstrErrorMessage += "dlerror() returned NULL"; - } - } -#endif - - return pvRetAddress; -} - -////////////////////////////////////////////////////////////////////////////// -// -// GetLibraryNameFromHandle -// Determines the name of a library from its handle. -// We are going to need to add functionality here for AIX 4.3.3 and HPUX10.20 -// -////////////////////////////////////////////////////////////////////////////// -void CEcmDllManager::GetLibraryNameFromHandle ( HMODULE hLibraryHandle, std::string & rstrLibName ) -{ - CAF_CM_STATIC_FUNC( "CEcmDllManager", "GetLibraryNameFromHandle" ); - // it is legal for hLibraryModule to be NULL (it's the executable) - // so don't validate it - - rstrLibName = ""; -#if defined ( WIN32 ) - char szFilePath[ _MAX_PATH_LARGE ] = {0}; - if (0 != ::GetModuleFileNameA( hLibraryHandle, szFilePath, _MAX_PATH_LARGE - 1)) - { - rstrLibName = szFilePath; - } - else - { - uint32 rc = ::GetLastError(); - std::string strErrorMessage( "Error Getting Module Name " ); - strErrorMessage += ", Error : "; - if ( ERROR_SUCCESS != rc ) - { - strErrorMessage += BasePlatform::PlatformApi::GetApiErrorMessage(rc); - } - else - { - strErrorMessage += "GetLastError() returned ERROR_SUCCESS"; - } - CAF_CM_EXCEPTION_VA0(rc, strErrorMessage.c_str()); - } -#else - // we know that all of our libs must have a DllMain function - // so look it up in the specified library and then - // use its address to find the name - std::string strSubErrorMessage; - void * vpAddress = NULL; - - if ( NULL == hLibraryHandle ) - { - // if its the NULL handle, we really want to look - // at the main program, on AIX we need to get the 1st entry from - // loadquery, otherwise we can use dlopen on NULL - GetMainProgramName( rstrLibName ); - } - else - { - // In a dll we need to look for DllMain - vpAddress = CEcmDllManager::GetFunctionAddress( hLibraryHandle, - gs_cszDllMainFunctionName, - strSubErrorMessage ); - - - if ( NULL == vpAddress ) - { - // try looking for main as well - vpAddress = CEcmDllManager::GetFunctionAddress( hLibraryHandle, - gs_cszMainFunctionName, - strSubErrorMessage ); - } - - if ( NULL == vpAddress ) - { - // try looking for _init as well - vpAddress = CEcmDllManager::GetFunctionAddress( hLibraryHandle, - gs_cszInitFunctionName, - strSubErrorMessage ); - } - - if ( vpAddress ) - { - CEcmDllManager::GetLibraryNameFromAddress( vpAddress, rstrLibName ); - } - else - { - CAF_CM_EXCEPTION_VA1(E_FAIL, - "Cannot find symbol in library, cannot resolve library handle to file name: %s", - strSubErrorMessage.c_str()); - } - } -#endif -} - -////////////////////////////////////////////////////////////////////////////// -// -// GetLibraryNameFromAddress -// Determines which library/exe contains the specific address (Unix only). -// We are going to need to add functionality here for AIX 4.3.3 and HPUX10.20 -// -////////////////////////////////////////////////////////////////////////////// -void CEcmDllManager::GetLibraryNameFromAddress( const void * cpvAddressInLibrary, std::string & rstrLibName ) -{ - CAF_CM_STATIC_FUNC( "CEcmDllManager", "GetLibraryNameFromAddress" ); - - char * szBuffer = NULL; - - try - { -#if defined ( WIN32 ) - CAF_CM_EXCEPTION_VA0( - E_NOTIMPL, - "CEcmDllManager::GetLibraryNameFromAddress not implemented"); - -#elif defined ( __sun__ ) || defined ( __linux__ ) || defined ( __hpux__ ) || defined (__APPLE__) - - CAutoMutexLockUnlockRaw oCS( &ms_mutex ); - Dl_info stDlInfo; - - if ( 0 != ::dladdr( const_cast( cpvAddressInLibrary ), &stDlInfo ) ) - { - char szFilePath[ 32768 ]; - ::realpath( stDlInfo.dli_fname, szFilePath ); - rstrLibName = szFilePath; - } - else - { - std::string strErrorMessage( "Unable to locate address in library " ); - strErrorMessage += ", Error : "; - const char * pszError = ::dlerror(); - if ( NULL != pszError ) - { - strErrorMessage += pszError; - } - else - { - strErrorMessage += "dlerror() returned NULL"; - } - CAF_CM_EXCEPTION_EFAIL(strErrorMessage.c_str()); - } - -#elif defined ( _AIX ) - - szBuffer = static_cast( ::malloc(1024) ); - int32 iSize = 1024; - - int32 iRc = ::loadquery( L_GETINFO, static_cast( szBuffer ),iSize); - - while ( ( -1 == iRc ) && ( ENOMEM == errno ) ) - { - ::free( szBuffer ); - iSize += 1024; - szBuffer = static_cast( ::malloc( iSize ) ); - iRc = ::loadquery( L_GETINFO, static_cast( szBuffer ),iSize); - } - - if ( -1 == iRc ) - { - ::free( szBuffer ); - szBuffer = NULL; - CAF_CM_EXCEPTION( "::loadquery failed", errno ); - } - - - ld_info * pLdInfo = reinterpret_cast( szBuffer ); - - while ( pLdInfo ) - { - void * pvUpper = reinterpret_cast( - reinterpret_cast( pLdInfo->ldinfo_dataorg) + - pLdInfo->ldinfo_datasize ); - - if ( ( cpvAddressInLibrary >= pLdInfo->ldinfo_dataorg ) && - ( cpvAddressInLibrary < pvUpper ) ) - { - char szFilePath[ _MAX_PATH ]; - ::realpath( pLdInfo->ldinfo_filename, szFilePath ); - rstrLibName = szFilePath; - break; - } - else - { - if ( pLdInfo->ldinfo_next == 0 ) - pLdInfo = NULL; - else - pLdInfo = reinterpret_cast ( - reinterpret_cast( pLdInfo ) + - pLdInfo->ldinfo_next ); - } - } - - ::free( szBuffer ); - szBuffer = NULL; - - if ( rstrLibName.length() == 0 ) - { - CAF_CM_EXCEPTION_EFAIL("Unable to locate address in library"); - } - -#else -#error "Not yet implemented on this platform"; -#endif - } - catch(CCafException *e) - { - _cm_exception_ = e; - } - - if ( szBuffer ) - { - ::free( szBuffer ); - } - - if ( _cm_exception_ ) - { - throw _cm_exception_; - } -} - -////////////////////////////////////////////////////////////////////////////// -// -// GetMainProgramName -// Determines the name of the current program. -// We are going to need to add functionality here for AIX 4.3.3 and HPUX10.20 -// -////////////////////////////////////////////////////////////////////////////// -void CEcmDllManager::GetMainProgramName ( std::string & rstrProgName ) -{ - CAF_CM_STATIC_FUNC( "CEcmDllManager", "GetMainProgramName" ); - - char * szBuffer = NULL; - HMODULE hSearchModule = NULL; - std::string strSubErrorMessage; - try - { - rstrProgName = ""; -#if defined ( WIN32 ) - - char szFilePath[ _MAX_PATH_LARGE] = {0}; - if ( 0 != ::GetModuleFileNameA( NULL, szFilePath, _MAX_PATH_LARGE-1) ) - { - rstrProgName = szFilePath; - } - else - { - uint32 rc = ::GetLastError(); - std::string strErrorMessage( "Error Getting Module Name " ); - strErrorMessage += ", Error : "; - if ( ERROR_SUCCESS != rc ) - { - strErrorMessage += BasePlatform::PlatformApi::GetApiErrorMessage(rc); - } - else - { - strErrorMessage += "GetLastError() returned ERROR_SUCCESS"; - } - CAF_CM_EXCEPTION_VA0(rc, strErrorMessage.c_str()); - } -#elif defined ( _AIX ) - - // on AIX we need to get the 1st entry from - // loadquery, otherwise we can use dlopen on NULL - szBuffer = static_cast( ::malloc(1024) ); - int32 iSize = 1024; - - int32 iRc = ::loadquery( L_GETINFO, - static_cast( szBuffer ),iSize); - - while ( ( -1 == iRc ) && ( ENOMEM == errno ) ) - { - ::free( szBuffer ); - iSize += 1024; - szBuffer = static_cast( ::malloc( iSize ) ); - iRc = ::loadquery( L_GETINFO, - static_cast( szBuffer ),iSize); - } - - if ( -1 == iRc ) - { - ::free( szBuffer ); - szBuffer = NULL; - CAF_CM_EXCEPTION( "::loadquery failed", errno ); - } - - - ld_info * pLdInfo = reinterpret_cast( szBuffer ); - - char szFilePath[ _MAX_PATH ]; - if ( NULL == ::realpath( pLdInfo->ldinfo_filename, szFilePath ) ) - { - std::string strError( "::realpath failed for " ); - strError += pLdInfo->ldinfo_filename; - strError += " attempting ::getargs"; - CAF_CM_WARNING( static_cast( strError ) ); - - // use getargs to get arg 0 - struct procsinfo stProcInfo; - stProcInfo.pi_pid = ::getpid(); - char aszArgs[_MAX_PATH * 2]; - if ( 0 == ::getargs( &stProcInfo, sizeof(procsinfo), - aszArgs, _MAX_PATH * 2 ) ) - { - if ( NULL == ::realpath( aszArgs, szFilePath ) ) - { - std::string strError( "::realpath failed - using result of getargs "); - strError += pLdInfo->ldinfo_filename ; - CAF_CM_ERROR( static_cast( strError ), - errno ); - } - else - { - rstrProgName = szFilePath; - } - } - else - { - std::string strError( "::getargs failed - using result of loadquery " ); - strError += pLdInfo->ldinfo_filename; - CAF_CM_ERROR( static_cast( strError ), - errno ); - } - } - else - { - // set from the realpath command - rstrProgName = szFilePath; - } - - ::free( szBuffer ); - szBuffer = NULL; - -#elif defined ( __linux__ ) || defined ( __sun__ ) - // we know that all of our libs must have a DllMain function - // so look it up in the specified library and then - // use its address to find the name - void * vpAddress = NULL; - hSearchModule = ::dlopen( NULL, RTLD_LAZY | RTLD_LOCAL ); - - if ( ! hSearchModule ) - { - CAF_CM_EXCEPTION_EFAIL(::dlerror()); - } - - // In a dll we need to look for DllMain - vpAddress = CEcmDllManager::GetFunctionAddress( hSearchModule, - gs_cszDllMainFunctionName, - strSubErrorMessage ); - - - if ( NULL == vpAddress ) - { - // try looking for main as well - vpAddress = CEcmDllManager::GetFunctionAddress( hSearchModule, - gs_cszMainFunctionName, - strSubErrorMessage ); - } - - if ( NULL == vpAddress ) - { - // try looking for _init as well - vpAddress = CEcmDllManager::GetFunctionAddress( hSearchModule, - gs_cszInitFunctionName, - strSubErrorMessage ); - } - - if ( vpAddress ) - { - CEcmDllManager::GetLibraryNameFromAddress( vpAddress, rstrProgName ); - } - else - { - std::string strErrorMessage( "Cannot find symbol in library, cannot resolve library handle to file name" ); - strErrorMessage += strSubErrorMessage; - CAF_CM_EXCEPTION_EFAIL(strErrorMessage.c_str()); - } -#else - CAF_CM_EXCEPTION_VA0(E_NOTIMPL, "Not Yet Ported to this platform"); -#endif - } - catch (CCafException* e) - { - _cm_exception_ = e; - } - -#ifndef WIN32 - if ( hSearchModule ) - { - ::dlclose(hSearchModule); - } -#endif - - if ( szBuffer ) - { - ::free( szBuffer ); - } - - if ( _cm_exception_ ) - { - throw _cm_exception_; - } -} - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/SubSystemBase/CEcmDllManager.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/SubSystemBase/CEcmDllManager.h deleted file mode 100644 index f6a26982c..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/SubSystemBase/CEcmDllManager.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Created: Oct 09, 2002 - * - * Copyright (C) 2002-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ -#ifndef _CEcmDllManager_H -#define _CEcmDllManager_H - -#include -#include - -namespace Caf { - -class SUBSYSTEMBASE_LINKAGE CEcmDllManager { -public: - static HMODULE LoadLibrary( const char * cpszLibName, bool bMustInvokeDllMain,bool bThrowExceptionUponFailure = true ); - static void UnloadLibrary( HMODULE hLibraryHandle, bool bMustInvokeDllMain ); - static void * GetFunctionAddress( HMODULE hLibraryHandle, const char * cpszFunctionName, std::string & rstrErrorMessage ); - static void GetLibraryNameFromHandle ( HMODULE hLibraryHandle, std::string & rstrLibName ); - -private: // a purely static class - CEcmDllManager(); - ~CEcmDllManager(); - CEcmDllManager( const CEcmDllManager& ); - CEcmDllManager& operator=( const CEcmDllManager& ); - -private: // used internally on Unix platforms - static void GetLibraryNameFromAddress( const void * cpvAddressInLibrary, std::string & rstrLibName ); - static void GetMainProgramName( std::string & rstrProgName ); - -private: - static GRecMutex ms_mutex; - -#ifndef WIN32 - struct SModuleRefCount - { - HMODULE m_hModule; - int32 m_iRefCount; - }; - static std::map ms_mapLoadedModuleRefCounts; - static std::map ms_mapLoadedModules; -#endif -}; -} - -#endif // _CEcmDllManager_H - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/SubSystemBase/CEcmSubSystem.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/SubSystemBase/CEcmSubSystem.cpp deleted file mode 100644 index be7b333c2..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/SubSystemBase/CEcmSubSystem.cpp +++ /dev/null @@ -1,339 +0,0 @@ -/* - * Created: Oct 09, 2002 - * - * Copyright (C) 2002-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "Exception/CCafException.h" -#include "CEcmSubSystem.h" -#include "EcmSubSystemBase.h" -#include "CEcmSubSystemRegistry.h" - -#ifdef WIN32 -#ifdef CFC_AS_STATIC_LIB -#define IStream ::IStream -#endif -#include -#ifdef CFC_AS_STATIC_LIB -#undef IStream -#endif -#endif - -#include "CEcmDllManager.h" - -using namespace Caf; - -////////////////////////////////////////////////////////////////////// -// Construction/Destruction -////////////////////////////////////////////////////////////////////// -std::map CEcmSubSystem::m_mapModuleCache; - -GRecMutex CEcmSubSystem::m_oModuleCacheMutex; - -CEcmSubSystem::CEcmSubSystem(bool bIsUnloadable) : - CAF_CM_INIT_LOG("CEcmSubSystem"), - m_bIsUnloadable(bIsUnloadable), - m_hModule(NULL), - m_pfnCreateInstance(NULL), - m_pfnCanUnloadNow(NULL) -{ -} - -CEcmSubSystem::~CEcmSubSystem() -{ -} - -bool CEcmSubSystem::IsRegistered( const std::string & rstrSubSystemIdentifier ) -{ - CAF_CM_FUNCNAME_VALIDATE("IsRegistered"); - - bool bRetVal = false; - - CAF_CM_VALIDATE_STRINGPTRA(rstrSubSystemIdentifier.c_str()); - bRetVal = CEcmSubSystemRegistry::IsRegistered( rstrSubSystemIdentifier ); - - return bRetVal; -} - -void CEcmSubSystem::Load(const std::string& rstrSubSystemIdentifier) -{ - CAF_CM_FUNCNAME("Load"); - - // Make sure that we have sub-system name. - CAF_CM_VALIDATE_STRINGPTRA(rstrSubSystemIdentifier.c_str()); - - // If this is an unloadable sub-system... - if(m_bIsUnloadable) - { - // make sure it is unlaoded before loading the next one. - Unload(); - } - // Otherwise... - else - { - // if there is already a module loaded by this sub-system - // object... - if(NULL != m_hModule) - { - CAF_CM_EXCEPTION_VA1(E_FAIL, - "The sub-system %s is already loaded. Load may not be called again.", - rstrSubSystemIdentifier.c_str()); - } - } - - // Create a helper to make sure we unlock the critical section. - CAutoMutexLockUnlockRaw oCS( &m_oModuleCacheMutex ); - - // Before we do the lookup again, lets check the cache to see if we - // already have the module. - std::map::iterator iterModule = - m_mapModuleCache.find(rstrSubSystemIdentifier); - - // If we found the module in the cache... - if(iterModule != m_mapModuleCache.end()) - { - // set from the cache, and we're done. - m_hModule = iterModule->second; - m_strSubSystemIdentifier = rstrSubSystemIdentifier; - - //CAF_CM_LOG_DEBUG_VA2("Found the subsystem in the cache - id: %s, module: %p", - // m_strSubSystemIdentifier.c_str(), m_hModule); - } - // Otherwise, look in the registry for the sub-system module. - else - { - // Create a registry object. - if (CEcmSubSystemRegistry::IsRegistered( rstrSubSystemIdentifier )) { - std::string modulePath = CEcmSubSystemRegistry::GetModulePath( rstrSubSystemIdentifier ); - if ( modulePath.length() ) - { - // load the DLL. - m_hModule = CEcmDllManager::LoadLibrary( modulePath.c_str(), true ); - - // Record the sub-system identifier. - m_strSubSystemIdentifier = rstrSubSystemIdentifier; - - // Insert the sub-system id to module mapping entry. - m_mapModuleCache.insert( - std::pair - (rstrSubSystemIdentifier, m_hModule)); - - //CAF_CM_LOG_DEBUG_VA3("Loaded the subsystem - id: %s, path: %s, module: %p", - // m_strSubSystemIdentifier.c_str(), modulePath.c_str(), m_hModule); - } - else - { - CAF_CM_EXCEPTION_VA1(E_FAIL, - "Failed to load subsystem %s - Registered but modulePath is empty", - rstrSubSystemIdentifier.c_str()); - } - } - else - { - CAF_CM_EXCEPTION_VA1(E_FAIL, - "Failed to load subsystem %s - Not registered", - rstrSubSystemIdentifier.c_str()); - } - } -} - -bool CEcmSubSystem::Unload( const bool cbMustUnloadNow /* = true */ ) -{ - CAF_CM_FUNCNAME("Unload"); - - bool bSubsystemWasUnloaded = false; - // If the sub-system is unloadable... - if(m_bIsUnloadable) - { - // and there is a module actually loaded... - if(NULL != m_hModule) - { - // if we don't already have it... - if(NULL == m_pfnCanUnloadNow) - { - std::string strErrorMessage; - // get the address of the sub-system's can unload function. - m_pfnCanUnloadNow = (CanUnloadNowFunc) - CEcmDllManager::GetFunctionAddress(m_hModule, CAN_UNLOAD_NOW, strErrorMessage ); - - // If we did not got the function pointer... - if(NULL == m_pfnCanUnloadNow) - { - // throw an exception indicating that the can unload - // function could not be found. - CAF_CM_EXCEPTION_EFAIL(strErrorMessage); - } - } - - if(m_pfnCanUnloadNow()) - { - // free the library, and - CEcmDllManager::UnloadLibrary( m_hModule, true ); - // Create a helper to make sure we unlock the critical section. - CAutoMutexLockUnlockRaw oCS( &m_oModuleCacheMutex ); - - // try to find the module entry. - std::map::iterator iterModule = - m_mapModuleCache.find(m_strSubSystemIdentifier); - - // If we found the module in the cache... - if(iterModule != m_mapModuleCache.end()) - { - // remove if from the cache. - m_mapModuleCache.erase(iterModule); - } - - bSubsystemWasUnloaded = true; - // Reset the member variables to an initialized state. - m_hModule = NULL; - m_pfnCreateInstance = NULL; - m_pfnCanUnloadNow = NULL; - m_strSubSystemIdentifier = ""; - } - // Otherwise, the sub-system is telling us it cannot safely be - // unloaded at this time, if the caller indicated that it must - // unload now we fail unload - else if ( cbMustUnloadNow ) - { - // throw an exception indicating the condition. - CAF_CM_EXCEPTION_EFAIL("Unable to safely unload the sub-system at this time."); - } - } - - // Otherwise, they are trying to unload nothing, so let them. - } - // If the sub-system is not unloadable... - else - { - // and there is a module actually loaded... - if(NULL != m_hModule) - { - // throw an exception. - CAF_CM_EXCEPTION_EFAIL("Unable to unload an unloadable sub-system."); - } - - // Otherwise, they are trying to unload nothing, so let them. - } - - return bSubsystemWasUnloaded; -} - -void CEcmSubSystem::CreateInstance( const std::string & rstrIdentifier, const IID & riid, void ** ppv ) -{ - CAF_CM_FUNCNAME( "CreateInstance" ); - - // If the sub-system is not loaded... - if(NULL == m_hModule) - { - // throw an exception indicating that the sub-system must be - // loaded before object instance can be created from it. - CAF_CM_EXCEPTION_EFAIL("No sub-system is loaded. You must call Load before " - "object instances can be created."); - } - - // If we don't already have a pointer to the CreateInstance - // function provided by the sub-system DLL... - if(NULL == m_pfnCreateInstance) - { - //CAF_CM_LOG_DEBUG_VA2("Getting CreateInstance - id: %s, module: %p", - // rstrIdentifier.c_str(), m_hModule); - - std::string strErrorMessage; - // get the address of the CreateInstance function. - m_pfnCreateInstance = - (void (*)( const char* rstrIdentifier, const IID & riid, void ** ppv )) - CEcmDllManager::GetFunctionAddress(m_hModule, CREATE_INSTANCE, strErrorMessage ); - - // If we did not get the function pointer... - if(NULL == m_pfnCreateInstance) - { - // throw an exception indicating that the create instance - // could not be found. - CAF_CM_EXCEPTION_EFAIL(strErrorMessage); - } - } - - // Call the function, passing in the supplied arguments. - m_pfnCreateInstance(rstrIdentifier.c_str(), riid, ppv); -} - - -//////////////////////////////////////////////////////////////////////// -// -// CEcmSubSystem::CEcmSubSystem( CEcmSubSystem ) -// -// overloaded copy constructor -// -//////////////////////////////////////////////////////////////////////// -CEcmSubSystem::CEcmSubSystem( const CEcmSubSystem& crCEcmSubSystem ) : - CAF_CM_INIT_LOG("CEcmSubSystem") -{ - m_bIsUnloadable = crCEcmSubSystem.m_bIsUnloadable; - m_strSubSystemIdentifier = crCEcmSubSystem.m_strSubSystemIdentifier; - m_hModule = crCEcmSubSystem.m_hModule; - m_pfnCreateInstance = crCEcmSubSystem.m_pfnCreateInstance; - m_pfnCanUnloadNow = crCEcmSubSystem.m_pfnCanUnloadNow; -} - - - -//////////////////////////////////////////////////////////////////////// -// -// CEcmSubSystem::operator=() -// -// overloaded = operator -// -//////////////////////////////////////////////////////////////////////// -CEcmSubSystem& CEcmSubSystem::operator=( const CEcmSubSystem& crCEcmSubSystem ) -{ - m_bIsUnloadable = crCEcmSubSystem.m_bIsUnloadable; - m_strSubSystemIdentifier = crCEcmSubSystem.m_strSubSystemIdentifier; - m_hModule = crCEcmSubSystem.m_hModule; - m_pfnCreateInstance = crCEcmSubSystem.m_pfnCreateInstance; - m_pfnCanUnloadNow = crCEcmSubSystem.m_pfnCanUnloadNow; - - return *this; - -} - - - -//////////////////////////////////////////////////////////////////////// -// -// CEcmSubSystem::IsUnloadable() -// -// returns true if this subsystem is unloadable, false if it isn't -// -//////////////////////////////////////////////////////////////////////// -bool CEcmSubSystem::IsUnloadable() const -{ - return m_bIsUnloadable; -} - - - -//////////////////////////////////////////////////////////////////////// -// -// CEcmSubSystem::GetSubSystemID() -// -// returns the subystem identifier -// -//////////////////////////////////////////////////////////////////////// -std::string CEcmSubSystem::GetSubSystemID() const -{ - return m_strSubSystemIdentifier; -} - - -//////////////////////////////////////////////////////////////////////// -// -// CEcmSubSystem::operator<() -// -// overloaded < operator -// -//////////////////////////////////////////////////////////////////////// -bool CEcmSubSystem::operator< ( const CEcmSubSystem& crCEcmSubsystemRight ) const -{ - return (::strcmp(m_strSubSystemIdentifier.c_str(), crCEcmSubsystemRight.GetSubSystemID().c_str()) < 0); -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/SubSystemBase/CEcmSubSystem.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/SubSystemBase/CEcmSubSystem.h deleted file mode 100644 index aefecde41..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/SubSystemBase/CEcmSubSystem.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Created: Oct 09, 2002 - * - * Copyright (C) 2002-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef _CEcmSubSystem_H_ -#define _CEcmSubSystem_H_ - -#include - -namespace Caf { - -// Typedef the function pointers. -typedef void ( * CreateInstanceFunc )( const char*, const IID & riid, void ** ppv ) ; - -typedef bool( * CanUnloadNowFunc )(); - -// Class declaration -class SUBSYSTEMBASE_LINKAGE CEcmSubSystem -{ -public: - CEcmSubSystem( bool bIsUnloadable = false ); - virtual ~ CEcmSubSystem(); - - bool IsRegistered( const std::string & rstrSubSystemIdentifier ); - void Load( const std::string & rstrSubSystemIdentifier ); - bool IsUnloadable() const; - std::string GetSubSystemID() const; - bool Unload( const bool cbMustUnloadNow = true ); - void GetVersionInfo(); - void CreateInstance( const std::string & rstrIdentifier, const IID & riid, - void ** ppv ); - -public: // copy constructor and assignment operator - CEcmSubSystem( const CEcmSubSystem& crCEcmSubSystem); - CEcmSubSystem& operator= ( const CEcmSubSystem& crCEcmSubSystem ); - -public: // less than, allows use in associative containers - bool operator< ( const CEcmSubSystem& ) const; - -private: - // Standard ECM macro for a standard object. - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - - // Flag indicating whether a sub-system is able to be unloaded. - bool m_bIsUnloadable; - - // Sub-system identifier. - std::string m_strSubSystemIdentifier; - - // Sub-system DLL module handle. - HMODULE m_hModule; - - // A map to hold a module cache. - static std::map m_mapModuleCache; - - // A critical section to protect the module cache. - static GRecMutex m_oModuleCacheMutex; - - // A pointer to the create instance of the function of the sub-system. - CreateInstanceFunc m_pfnCreateInstance; - - // A pointer to the can unload function of the sub-system. - CanUnloadNowFunc m_pfnCanUnloadNow; -}; -} - -#endif // _CEcmSubSystem_H_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/SubSystemBase/CEcmSubSystemModule.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/SubSystemBase/CEcmSubSystemModule.cpp deleted file mode 100644 index 8178c0786..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/SubSystemBase/CEcmSubSystemModule.cpp +++ /dev/null @@ -1,300 +0,0 @@ -/* - * Created: Oct 09, 2002 - * - * Copyright (C) 2002-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "Exception/CCafException.h" -#include "CEcmSubSystemModule.h" -#include "CEcmSubSystemRegistry.h" -#include "CEcmDllManager.h" -#include "TCafSubSystemCreator.h" - -using namespace Caf; - -////////////////////////////////////////////////////////////////////// -// Construction/Destruction -////////////////////////////////////////////////////////////////////// - -CEcmSubSystemModule::CEcmSubSystemModule() : - CAF_CM_INIT_LOG("CEcmSubSystemModule"), - m_pObjectEntries(NULL), - m_hInstance(NULL), - m_lLockCount(0) -{ - -} - -CEcmSubSystemModule::~CEcmSubSystemModule() -{ -} - -void CEcmSubSystemModule::Init(const _CAF_OBJECT_ENTRY* const pObjectEntries, - const HINSTANCE hInstance) -{ - CAF_CM_FUNCNAME("Init"); - - try - { - // Initialize the QI maps of all registered objects - // to prevent multithreading problems - uint32 dwIdx = 0; - while (pObjectEntries[dwIdx].pfnGetEntries) - { - // Ignore the return value - we are just causing - // the QI map to initialize by calling the func - (void)pObjectEntries[dwIdx].pfnGetEntries(); - - CAF_CM_LOG_DEBUG_VA3("Initializing object entries - index: %d, objId: %s, module: %p", - dwIdx, pObjectEntries[dwIdx].pfnIdentifier(), hInstance); - - ++dwIdx; - } - - // Initialize the member variables - m_pObjectEntries = pObjectEntries; - m_hInstance = hInstance; - } - CAF_CM_CATCH_ALL; - CAF_CM_CLEAREXCEPTION; -} - -void CEcmSubSystemModule::Term() -{ - CAF_CM_FUNCNAME("Term"); - - try - { - // Loop through the Object Entries table and release the singletons - uint32 dwIndex = 0; - while(m_pObjectEntries && m_pObjectEntries[dwIndex].pfnCreator) - { - // If this is a sub-system... - if(m_pObjectEntries[dwIndex].bIsSingleton && m_pObjectEntries[dwIndex].pCachedObject) - { - ( m_pObjectEntries[dwIndex].pCachedObject )->Release(); - m_pObjectEntries[dwIndex].pCachedObject = NULL; - } - - // Increment the index. - ++ dwIndex; - } - } - CAF_CM_CATCH_ALL; - CAF_CM_CLEAREXCEPTION; - - // Set the instance handle to NULL. - m_hInstance = NULL; - - // Set the object entries pointer to NULL. - m_pObjectEntries = NULL; -} - -void CEcmSubSystemModule::Lock() -{ - g_atomic_int_inc(&m_lLockCount); -} - -void CEcmSubSystemModule::Unlock() -{ - (void)g_atomic_int_dec_and_test(&m_lLockCount); -} - -void CEcmSubSystemModule::CreateInstance(const char* crstrIdentifier, const IID& criid, void** ppv) -{ - CAF_CM_FUNCNAME("CreateInstance"); - - CAF_CM_VALIDATE_STRINGPTRA(crstrIdentifier); - CAF_CM_VALIDATE_PTR(ppv); - - // Initialize the out-param - *ppv = NULL; - - // Declare flag indicating that the identifier was found in the map. - bool bFoundIdentifier = false; - - // Declare and index for iterating over the object map. - uint32 dwIndex = 0; - - // Loop through the Object Entries table... - CAF_CM_LOG_DEBUG_VA1("Looking for ID - %s", crstrIdentifier); - while(m_pObjectEntries && m_pObjectEntries[dwIndex].pfnCreator) - { - // comparing the supplied identifier to the identifier in the - // table. If we find a match... - CAF_CM_LOG_DEBUG_VA2("Comparing to - index: %d, objId: %s", - dwIndex, m_pObjectEntries[dwIndex].pfnIdentifier()); - if(::strcmp(crstrIdentifier, m_pObjectEntries[dwIndex].pfnIdentifier()) == 0) - { - // indicate we found the identifier - bFoundIdentifier = true; - -#ifdef IMPLEMENT_SINGLETONS - // If this is the subsystem singleton manager... - if(::strcmp(crstrIdentifier, _sObjIdSubsystemSingletonManager) == 0) - { - // Check for a cached object. - if(m_pObjectEntries[dwIndex].pCachedObject) - { - // Use the cached object. - m_pObjectEntries[dwIndex].pCachedObject->QueryInterface(criid, ppv); - } - else - { - // Call the creator function associated with the identifier. - createInstanceException = true; - ICafObject* pEcmObject = 0; - TCafSubSystemCreator::CreateInstance( m_pObjectEntries[dwIndex].pfnCreator, - CAF_IIDOF(ICafObject), - reinterpret_cast(&pEcmObject)); - - // Cache the object. - pEcmObject->QueryInterface(criid, ppv); - m_pObjectEntries[dwIndex].pCachedObject = pEcmObject; - createInstanceException = false; - } - } - // If this is a singleton... - else if(m_pObjectEntries[dwIndex].bIsSingleton) - { - // Create a pointer to a subsystem singleton manager. - IEcmSubsystemSingletonManager* piSingletonMgr = NULL; - - CAF_CM_TRY - { - // Create a subsystem object. - CEcmSubSystem oSubSystem; - - // See if the subsystem is registered before trying to load it. - if(oSubSystem.IsRegistered(gs_cstrObjIdEcmSubsystemSingletonManagerSubsystem)) - { - // Load the subsystem singleton manager subsystem. - oSubSystem.Load(gs_cstrObjIdEcmSubsystemSingletonManagerSubsystem); - - // Create an instance of the subsystem singleton manager object. - oSubSystem.CreateInstance(gs_cstrObjIdEcmSubsystemSingletonManagerSubsystem, - CSI_IIDOF(IEcmSubsystemSingletonManager), reinterpret_cast(&piSingletonMgr)); - } - } - CAF_CM_CATCH_KEEPEXCEPTION; - - // If we did not get an exception or is the singleton manager not registered. - if(!(CAF_CM_ISEXCEPTION) && piSingletonMgr) - { - // Declare a IEcmObject pointer for local use. - IEcmObject* pObject = NULL; - - // Check for a cached object. - piSingletonMgr->GetSingleton(crstrIdentifier, &pObject); - - // Make sure the pointer is good. - if(pObject) - { - // Query for the interface. - pObject->QueryInterface(criid, ppv); - - // Release the object. - pObject->Release(); - pObject = NULL; - } - // No cached object, so... - else - { - // Call the creator function associated with the identifier. - createInstanceException = true; - TCafSubSystemCreator::CreateInstance( m_pObjectEntries[dwIndex].pfnCreator, - CSI_IIDOF(IEcmObject), - reinterpret_cast(&pObject)); - - // Query for the interface. - pObject->QueryInterface(criid, ppv); - createInstanceException = false; - - // Cache the object. - piSingletonMgr->RegisterSingleton(crstrIdentifier, pObject); - - // Release the object we got back from CreateInstance. - pObject->Release(); - pObject = NULL; - } - - // Release the singleton manager. - piSingletonMgr->Release(); - piSingletonMgr = NULL; - } - // We got an exception or the subsystem singleton manager is not registered. - else - { - // Clean up the exception. - if(CAF_CM_ISEXCEPTION) - { - CAF_CM_CLEAREXCEPTION; - } - - // Release the piSingletonMgr if it is not null - if(piSingletonMgr) - { - piSingletonMgr->Release(); - piSingletonMgr = NULL; - } - - // Check for a cached object. - if(m_pObjectEntries[dwIndex].pCachedObject) - { - // Use the cached object. - m_pObjectEntries[dwIndex].pCachedObject->QueryInterface(criid, ppv); - } - else - { - // Call the creator function associated with the identifier. - createInstanceException = true; - IEcmObject* pEcmObject = 0; - TCafSubSystemCreator::CreateInstance( m_pObjectEntries[dwIndex].pfnCreator, - CSI_IIDOF(IEcmObject), - reinterpret_cast(&pEcmObject)); - - // Cache the object. - pEcmObject->QueryInterface(criid, ppv); - m_pObjectEntries[dwIndex].pCachedObject = pEcmObject; - createInstanceException = false; - } - } - } - else - -#endif // IMPLEMENT_SINGLETONS - { - // call the creator function associated with the identifier. - TCafSubSystemCreator::CreateInstance( m_pObjectEntries[dwIndex].pfnCreator, - criid, - ppv); - } - - // If we are here then an object was created - break; - } - - // Increment the index. - ++ dwIndex; - } - - // If we were unable to find the identifier in the map... - if(!bFoundIdentifier) - { - CAF_CM_EXCEPTION_VA1(E_FAIL, - "Unable to find object with provided identifier [%s]", - crstrIdentifier); - } -} - -bool CEcmSubSystemModule::CanUnload() -{ - gint value = g_atomic_int_get(&m_lLockCount); - return (value == 0 ); -} - -HINSTANCE CEcmSubSystemModule::GetModuleHandle() -{ - return m_hInstance; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/SubSystemBase/CEcmSubSystemModule.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/SubSystemBase/CEcmSubSystemModule.h deleted file mode 100644 index 5ffd9ae8d..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/SubSystemBase/CEcmSubSystemModule.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Created: Oct 09, 2002 - * - * Copyright (C) 2002-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef _CEcmSubSystemModule_H_ -#define _CEcmSubSystemModule_H_ - -namespace Caf { - -struct _CAF_OBJECT_ENTRY; - -class SUBSYSTEMBASE_LINKAGE CEcmSubSystemModule -{ -public: - CEcmSubSystemModule(); - virtual ~CEcmSubSystemModule(); - - void Init(const _CAF_OBJECT_ENTRY* const pObjectEntries, const HINSTANCE hInstance); - void Term(); - - void Lock(); - void Unlock(); - - void CreateInstance(const char* crstrIdentifier, const IID& criid, void** ppv); - - bool CanUnload(); - - HINSTANCE GetModuleHandle(); - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - const _CAF_OBJECT_ENTRY* m_pObjectEntries; - HINSTANCE m_hInstance; - gint m_lLockCount; -}; - -} - -#endif // _CEcmSubSystemModule_H_ - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/SubSystemBase/CEcmSubSystemRegistry.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/SubSystemBase/CEcmSubSystemRegistry.cpp deleted file mode 100644 index ac75fd19d..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/SubSystemBase/CEcmSubSystemRegistry.cpp +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Created: Oct 09, 2002 - * - * Copyright (C) 2002-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "Common/IAppConfig.h" -#include "CEcmSubSystemRegistry.h" -#include "CEcmDllManager.h" -#include - -using namespace Caf; - -bool CEcmSubSystemRegistry::IsRegistered( const std::string & crstrSubSystemIdentifier ) -{ - std::string modulePath; - return getAppConfig()->getString("subsystems", crstrSubSystemIdentifier, modulePath, IConfigParams::PARAM_OPTIONAL); -} - -std::string CEcmSubSystemRegistry::GetModulePath( const std::string & crstrSubSystemIdentifier ) -{ - std::string modulePath; - getAppConfig()->getString("subsystems", crstrSubSystemIdentifier, modulePath, IConfigParams::PARAM_REQUIRED); - return modulePath; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/SubSystemBase/CEcmSubSystemRegistry.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/SubSystemBase/CEcmSubSystemRegistry.h deleted file mode 100644 index f1cca23b0..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/SubSystemBase/CEcmSubSystemRegistry.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Created: Oct 09, 2002 - * - * Copyright (C) 2002-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ -#ifndef _CEcmSubSystemRegistry_H_ -#define _CEcmSubSystemRegistry_H_ - -#include - -namespace Caf { - -class SUBSYSTEMBASE_LINKAGE CEcmSubSystemRegistry -{ -public: - static bool IsRegistered( const std::string & crstrSubSystemIdentifier ); - - static std::string GetModulePath( const std::string & crstrSubSystemIdentifier ); -}; -} - -#endif // _CEcmSubSystem_H_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/SubSystemBase/EcmSubSystemBase.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/SubSystemBase/EcmSubSystemBase.cpp deleted file mode 100644 index 43b6e7126..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/SubSystemBase/EcmSubSystemBase.cpp +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Created: Oct 09, 2002 - * - * Copyright (C) 2002-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "Exception/CCafException.h" -#include "EcmSubSystemBase.h" -#include -#include - -using namespace Caf; - -////////////////////////////////////////////////////////////////////////////// -// ECM Sub-System Constant Definitions -////////////////////////////////////////////////////////////////////////////// - -// The value name for retrieving the module's path -const char* Caf::MODULE_PATH_VALUE_NAME = "ModulePath"; - -// The DLL exported function names -const char* Caf::CREATE_INSTANCE = "CafCreateInstance"; -const char* Caf::CAN_UNLOAD_NOW = "CafDllCanUnloadNow"; - -//////////////////////////////////////////////////////////////////////// -// -// Global implementation of CreateObject - helper functions for -// TEcmSmartPtr that can't go inside of TEcmSmartPtr because gcc barfs. -// -//////////////////////////////////////////////////////////////////////// - -// Suppress warning about throwing an exception: we want C linkage, -// but we also want to throw exceptions -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable:4297) // function assumed not to throw an exception but does -#endif - -// The function is extern "C" and /EHc is specified -extern "C" SUBSYSTEMBASE_LINKAGE void Caf::CreateObject (const char *cszObjectId, const IID &criid, void **ppv) -{ - CAF_CM_STATIC_FUNC_VALIDATE( "SubSystemBase", "CreateObject" ); - CAF_CM_VALIDATE_STRINGPTRA(cszObjectId); - CAF_CM_VALIDATE_PTR(ppv); - - #ifdef WIN32 - char* objId = ::_strdup(cszObjectId); - #else - char* objId = ::strdup(cszObjectId); - #endif - - try - { - // Determine the type of object to create based on Id. - // QI object id's are of the form :ClassName. -// char *szColon = ::strchr(objId, ':'); -// -// if (szColon) -// { -// // Create a QI object -// *szColon = NULL; -// CreateQIObject(objId, szColon + 1, criid, ppv); -// } -// else -// { - // Create a subsystem object - CEcmSubSystem oSubSystem; - oSubSystem.Load(cszObjectId); - oSubSystem.CreateInstance(cszObjectId, criid, ppv); -// } - } - catch (CCafException *e) - { - ::free(objId); - throw e; - } - catch (std::exception& e) - { - ::free(objId); - throw e; - } - catch (...) - { - ::free(objId); - throw; - } - - ::free(objId); -} - -//extern "C" SUBSYSTEMBASE_LINKAGE void Caf::CreateQIObject (const char *cszFactoryId, const char* cszClassName, const IID &criid, void **ppv) -//{ -// CAF_CM_STATIC_FUNC( "SubSystemBase", "CreateObject" ); -// CAF_CM_VALIDATE_STRINGPTRA(cszFactoryId); -// CAF_CM_VALIDATE_STRINGPTRA(cszClassName); -// CAF_CM_VALIDATE_PTR(ppv); -// -//// SmartSbICfcClassFactory spsFactory; -//// spsFactory.CreateInstance(cwszFactoryId); -//// *ppv = NULL; -//// spsFactory->CreateObject(cwszClassName, criid, ppv); -//// CAF_CM_ASSERT_MSG(*ppv, "Failed to create object"); -//} - -#ifdef _MSC_VER -#pragma warning(pop) -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/SubSystemBase/EcmSubSystemBase.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/SubSystemBase/EcmSubSystemBase.h deleted file mode 100644 index 0578571b8..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/SubSystemBase/EcmSubSystemBase.h +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Created: Oct 09, 2002 - * - * Copyright (C) 2002-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef _EcmSubSystemBase_H_ -#define _EcmSubSystemBase_H_ - -namespace Caf { - -////////////////////////////////////////////////////////////////////// -// Forward Declarations -////////////////////////////////////////////////////////////////////// -struct _CAF_INTMAP_ENTRY; - -////////////////////////////////////////////////////////////////////////////// -// ECM Sub-System Constants -////////////////////////////////////////////////////////////////////////////// - -// The value name for retrieving the module's path -extern SUBSYSTEMBASE_LINKAGE const char* MODULE_PATH_VALUE_NAME; - -// The DLL exported function names -extern SUBSYSTEMBASE_LINKAGE const char* CREATE_INSTANCE; -extern SUBSYSTEMBASE_LINKAGE const char* CAN_UNLOAD_NOW; - -////////////////////////////////////////////////////////////////////////////// -// ECM Object Map Support -////////////////////////////////////////////////////////////////////////////// -struct _CAF_OBJECT_ENTRY -{ - const char* (*pfnIdentifier)(); - const UUID* cpclsidClassId; - uint32 (*pfnCreator)(const IID& riid, void** ppv); - mutable ICafObject* pCachedObject; - bool bIsSingleton; - const _CAF_INTMAP_ENTRY* (*pfnGetEntries)(); -}; - -} - -#define CAF_BEGIN_OBJECT_MAP(x) static _CAF_OBJECT_ENTRY x[] = { - -#define CAF_END_OBJECT_MAP() { NULL, NULL, NULL, NULL, false, NULL }}; - -#define CAF_OBJECT_ENTRY(className)\ - { className::GetObjectIdentifier,\ - NULL,\ - className::Creator,\ - NULL,\ - false,\ - className::_GetEntries }, - -#define CAF_OBJECT_ENTRY2(className, objectIdentifier)\ - { objectIdentifier,\ - NULL,\ - className::Creator,\ - NULL,\ - false,\ - className::_GetEntries }, - -/*#define CAF_OBJECT_ENTRY_SINGLETON(className)\ - { className::GetObjectIdentifier,\ - NULL,\ - className::Creator,\ - NULL,\ - true,\ - className::_GetEntries },*/ - -////////////////////////////////////////////////////////////////////////////// -// ECM Interface Map Support -////////////////////////////////////////////////////////////////////////////// -namespace Caf { -struct _CAF_INTMAP_ENTRY -{ - const IID* cpiid; - SUBSYS_INTPTR offset; -}; -} - -#define _CAF_PACKING 8 -#define CAF_offsetofclass(base, derived)\ - ((SUBSYS_INTPTR)(static_cast((derived*)_CAF_PACKING))-_CAF_PACKING) - -#define CAF_BEGIN_INTERFACE_MAP(x) public: \ - typedef x _CafMapClass; \ - ICafObject* _GetRawObjectInterface() \ - { return (ICafObject*)((SUBSYS_INTPTR)this+_GetEntries()->offset); } \ - ICafObject* GetObjectInterface() { return _GetRawObjectInterface(); }\ - void _InternalQueryInterface(const IID& iid, void** ppv) \ - { InternalQueryInterface(this, _GetEntries(), iid, ppv); } \ - static const _CAF_INTMAP_ENTRY* _GetEntries() \ - { static const _CAF_INTMAP_ENTRY _entries[] = { - -#define CAF_END_INTERFACE_MAP() {NULL, SUBSYS_INTPTR_INVALID}}; return _entries;} \ - virtual void AddRef() = 0;\ - virtual void Release() = 0;\ - virtual void QueryInterface(const IID&, void**) = 0; - -#define CAF_INTERFACE_ENTRY(x)\ - {&CAF_IIDOF(x), \ - CAF_offsetofclass(x, _CafMapClass)}, - -#define CAF_INTERFACE_ENTRY_IID(iid, x)\ - {&iid,\ - offsetofclass(x, _CafMapClass)}, - -#define CAF_INTERFACE_ENTRY2(x, x2)\ - {&CSI_IIDOF(x),\ - (SUBSYS_INTPTR)((x*)(x2*)((_CafMapClass*)_CAF_PACKING))-_CAF_PACKING}, - -#define CAF_INTERFACE_ENTRY2_IID(iid, x, x2)\ - {&iid,\ - (SUBSYS_INTPTR)((x*)(x2*)((_CafMapClass*)_CAF_PACKING))-_CAF_PACKING}, - -////////////////////////////////////////////////////////////////////////////// -// ECM Helper Macros -////////////////////////////////////////////////////////////////////////////// - -// Place in class to be exposed from a sub-system in order to -// specify its identifier. -#define CAF_DECLARE_OBJECT_IDENTIFIER(x)\ - public: \ - static const char* GetObjectIdentifier()\ - {\ - return x;\ - } \ - const char* GetObjectId () const \ - { \ - return x;\ - } - -////////////////////////////////////////////////////////////////////////////// -// ECM Sub-System Standard Function Exports -////////////////////////////////////////////////////////////////////////////// -// Place in module that contains DllMain -#define CAF_DECLARE_SUBSYSTEM_EXPORTS()\ - extern "C" void __declspec(dllexport) CafCreateInstance(\ - const char* rstrIdentifier, const IID & riid, void ** ppv )\ - {\ - _Module.CreateInstance(rstrIdentifier, riid, ppv);\ - }\ - extern "C" bool __declspec(dllexport) EcmDllCanUnloadNow()\ - {\ - return _Module.CanUnload();\ - } - -////////////////////////////////////////////////////////////////////////////// -// ECM Sub-System Standard Includes -////////////////////////////////////////////////////////////////////////////// -#include "CEcmSubSystemModule.h" - -#ifdef CAF_SUBSYSTEM -extern Caf::CEcmSubSystemModule _Module; -#endif - -#include "TCafSubSystemObject.h" -#include "TCafSubSystemObjectRoot.h" -#include "CEcmSubSystem.h" - - -#endif // _EcmSubSystemBase_H_ - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/SubSystemBase/SubSystemBaseInc.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/SubSystemBase/SubSystemBaseInc.h deleted file mode 100644 index 695f838b7..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/SubSystemBase/SubSystemBaseInc.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Created: Mar 11, 2004 - * - * Copyright (C) 2004-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef _SubSystemBaseInc_h_ -#define _SubSystemBaseInc_h_ - -#include "TCafSubSystemObjectRoot.h" -#include "TCafSubSystemSmartCl.h" - -#endif // #ifndef _SubSystemBaseInc_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/SubSystemBase/SubSystemBaseLink.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/SubSystemBase/SubSystemBaseLink.h deleted file mode 100644 index fcb6a7029..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/SubSystemBase/SubSystemBaseLink.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Created: Nov 21, 2003 - * - * Copyright (C) 2003-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef SubSystemBaseLink_h_ -#define SubSystemBaseLink_h_ - -#ifndef SUBSYSTEMBASE_LINKAGE - #ifdef WIN32 - #ifdef FRAMEWORK_BUILD - #define SUBSYSTEMBASE_LINKAGE __declspec(dllexport) - #else - #define SUBSYSTEMBASE_LINKAGE __declspec(dllimport) - #endif - #else - #define SUBSYSTEMBASE_LINKAGE - #endif -#endif - -#include "SubSystemBaseInc.h" - -#include "CEcmDllManager.h" -#include "CEcmSubSystem.h" -#include "CEcmSubSystemModule.h" -#include "CEcmSubSystemRegistry.h" - -#endif // #ifndef SubSystemBaseLink_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/SubSystemBase/TCafSubSystemCreator.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/SubSystemBase/TCafSubSystemCreator.h deleted file mode 100644 index 34f85fa20..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/SubSystemBase/TCafSubSystemCreator.h +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Created: Jan 30, 2003 - * - * Copyright (C) 2003-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef _TCafSubSystemCreator_H_ -#define _TCafSubSystemCreator_H_ - -#include "Exception/CCafException.h" - -namespace Caf { - -template< typename Derived, typename SmartPtr = TCafSmartPtr< Derived > > -class TCafSubSystemCreator -{ -public: - static SmartPtr CreateInstance(); - - static void CreateInstance( uint32(*pfn)(const IID& criid, void** ppv), const IID& criid, void** ppv ); - -private: - static void ValidateResultCode(const uint32 cdwRc); -}; - -//////////////////////////////////////////////////////// -// -// CreateInstance() -// -// Creates an instance of the object and returns is as -// the supplied smart class type. -// -////////////////////////////////////////////////////////template -template -SmartPtr TCafSubSystemCreator::CreateInstance() -{ - CAF_CM_STATIC_FUNC( "TCafSubSystemCreator", - "CreateInstance()" ); - - // This local smart class object is transient. - // If the lvalue is of the proper type then the - // reference count will go to 2. When the trasient - // object dies then count will go to 1. Perfect. - // - // If the lvalue is not the proper type then - // the reference count will remain at 1. When the - // transient object dies the count will go to 0 - // and the Derived object will be destroyed. Perfect. - SmartPtr spcReturn; - - // Verify that the smart class template argument - // is really a smart class object by calling - // a method on it that must exist - (void)spcReturn.GetNonAddRefedInterface(); - - // Create a derived raw pointer - Derived* pDerived = NULL; - ValidateResultCode( Derived::Creator( &pDerived ) ); - - // Assign it to the smart class which - // will do an AddRef - count now = 2 - spcReturn = pDerived; - - // Release the raw pointer - count now = 1 - pDerived->Release(); - - return spcReturn; -} - -//////////////////////////////////////////////////////// -// -// CreateInstance() -// -// Creates an instance of the object QI'd to the requested interface -// using the supplied creator function. -// -////////////////////////////////////////////////////////template -template -void TCafSubSystemCreator::CreateInstance( uint32(*pfn)(const IID& criid, void** ppv), const IID& criid, void** ppv ) -{ - ValidateResultCode( (*pfn)( criid, ppv ) ); -} - -//////////////////////////////////////////////////////// -// -// ValidateResultCode() -// -// Maps the TCafSubSystemObjectRoot<>::Creator function result code -// to an exception and throw it. -// -////////////////////////////////////////////////////////template -template -void TCafSubSystemCreator::ValidateResultCode(const uint32 cdwRc) -{ - CAF_CM_STATIC_FUNC( "TCafSubSystemCreator", - "ValidateResultCode" ); - - if(TCafSubSystemObjectRoot::Success == cdwRc) - { - // No point in evalulating the remaining clauses - } - // Otherwise, if the interface was not supported... - else if(TCafSubSystemObjectRoot::InterfaceNotSupported == cdwRc) - { - // throw an exception. - CAF_CM_EXCEPTION_VA0(E_NOINTERFACE, - "The requested interface is not supported by the object requested."); - } - // Otherwise, if we are out of memory... - else if(TCafSubSystemObjectRoot::OutOfMemory == cdwRc) - { - // throw an exception. - CAF_CM_EXCEPTION_EFAIL("Out of memory."); - } - // Otherwise, if the ppv was null... - else if(TCafSubSystemObjectRoot::InvalidPointerValue == cdwRc) - { - // throw an exception. - CAF_CM_EXCEPTION_EFAIL("The ppv argument must not be NULL."); - } - // Otherwise, if something unexpected happened... - else if(TCafSubSystemObjectRoot::UnknownFailure == cdwRc) - { - // throw an exception. - CAF_CM_EXCEPTION_EFAIL("An unexpected exception occurred while " - "trying to create requested object."); - } -} - -} - -#endif // #ifndef _TCafSubSystemCreator_H_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/SubSystemBase/TCafSubSystemObject.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/SubSystemBase/TCafSubSystemObject.h deleted file mode 100644 index d15089b8f..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/SubSystemBase/TCafSubSystemObject.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Created: Oct 9, 2002 - * - * Copyright (C) 2002-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef _TCafSubSystemObject_H_ -#define _TCafSubSystemObject_H_ - -namespace Caf { - -template -class TCafSubSystemObject : public Base -{ -public: // Constructor / Destructor - TCafSubSystemObject() : m_lRefCnt( 0 ) - { - // There is no module to lock if we are not in a sub-system - // project, so conditionally define. - #ifdef CAF_SUBSYSTEM - - // Lock the module. - _Module.Lock(); - - #endif - } - - virtual ~TCafSubSystemObject() - { - // There is no module to unlock if we are not in a sub-system - // project, so conditionally define. - #ifdef CAF_SUBSYSTEM - - // Unlock the module. - _Module.Unlock(); - - #endif - } - -public: // IEcmSubSystemObject Implementations - virtual void AddRef() - { - g_atomic_int_inc(&m_lRefCnt); - } - - virtual void Release() - { - // If the ref-count is greater than 0... - if (g_atomic_int_dec_and_test(&m_lRefCnt)) - { - // delete self. - delete this; - } - } - - virtual void QueryInterface(const IID& riid, void** ppv) - { - this->_InternalQueryInterface(riid, ppv); - } - -private: - gint m_lRefCnt; - -private: // Deny copy and assignment - TCafSubSystemObject(const TCafSubSystemObject&); - TCafSubSystemObject& operator=(const TCafSubSystemObject&); -}; - -} - -#endif // _TCafSubSystemObject_H_ - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/SubSystemBase/TCafSubSystemObjectRoot.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/SubSystemBase/TCafSubSystemObjectRoot.h deleted file mode 100644 index a6e40d10d..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/SubSystemBase/TCafSubSystemObjectRoot.h +++ /dev/null @@ -1,214 +0,0 @@ -/* - * Created: Oct 9, 2002 - * - * Copyright (C) 2002-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef _TCafSubSystemObjectRoot_H_ -#define _TCafSubSystemObjectRoot_H_ - -#include "EcmSubSystemBase.h" - -namespace Caf { - -template > -class TCafSubSystemObjectRoot -{ -public: - enum ReturnCodes { - Success = 0x0, // The call succeeded - InvalidPointerValue, // An invalid pointer was passed - OutOfMemory, // We're out of memory - InterfaceNotSupported, // The interface requested in not supported - UnknownFailure // Something happened that we didn't expect - }; - - // Creator Function - static uint32 Creator(const IID& criid, void** ppv); - static uint32 Creator(Derived** ppDerived); - -protected: - static void InternalQueryInterface(const void* cpThis, - const _CAF_INTMAP_ENTRY* cpEntries, - const IID& criid, - void** ppv); - -protected: - TCafSubSystemObjectRoot() {;} - virtual ~TCafSubSystemObjectRoot() {;} - -private: - TCafSubSystemObjectRoot(const TCafSubSystemObjectRoot&) {;} - TCafSubSystemObjectRoot& operator=(const TCafSubSystemObjectRoot&) { return *this; } -}; - -// Default Creator Function (can be overridden in Derived) - returns a QI'd void* -template -uint32 TCafSubSystemObjectRoot::Creator(const IID& criid, void** ppv) -{ - uint32 dwRetCode = Success; - - try - { - // Make sure the outer pointer seems valid. - if(ppv != NULL) - { - // Initialize the out-param - *ppv = NULL; - - // Create a new derived object - Derived* pObj = NULL; - dwRetCode = Creator( &pObj ); - - if( Success == dwRetCode ) - { - // QI to the requested interface - pObj->QueryInterface(criid, ppv); - - // if *ppv is NULL... - if(NULL == *ppv) - { - // then the interface requested is not supported. - dwRetCode = InterfaceNotSupported; - } - - // decrement the reference count. - pObj->Release(); - } - } - // Otherwise... - else - { - // set the return code to indicate an invalid pointer was passed. - dwRetCode = InvalidPointerValue; - } - } - // No exceptions should be thrown, but if one is... - catch(...) - { - // set the return code to unknown failure occurred. - dwRetCode = UnknownFailure; - } - - return dwRetCode; -} - -// Creator Function (can be overridden in Derived) - returns a pDerived -template -uint32 TCafSubSystemObjectRoot::Creator(Derived** ppDerived) -{ - uint32 dwRetCode = Success; - - try - { - // Make sure the outer pointer seems valid. - if(ppDerived != NULL) - { - // Create the out-param - *ppDerived = new LifetimeManager; - - // If we were able to allocate and create... - if(NULL != *ppDerived) - { - // Increment the ref count - (*ppDerived)->AddRef(); - } - else - { - // set the return code to indicate out of memory. - dwRetCode = OutOfMemory; - } - } - // Otherwise... - else - { - // set the return code to indicate an invalid pointer was passed. - dwRetCode = InvalidPointerValue; - } - } - // No exceptions should be thrown, but if one is... - catch(...) - { - // set the return code to unknown failure occurred. - dwRetCode = UnknownFailure; - } - - return dwRetCode; -} - -// Table driven query interface -template -void TCafSubSystemObjectRoot::InternalQueryInterface(const void* cpThis, - const _CAF_INTMAP_ENTRY* cpEntries, - const IID& criid, - void** ppv) -{ - if(NULL != cpThis) - { - if(cpEntries != NULL) - { - if(ppv != NULL) - { - // Initialize the out-param - *ppv = NULL; - - // If the iid passed in is the iid of IEcmObject... - if(::IsEqualIID(criid, CAF_IIDOF(ICafObject))) - { - // get the first interface in the map, - ICafObject* pObj = - reinterpret_cast( - (SUBSYS_INTPTR)cpThis+cpEntries->offset); - - // increment the reference count, - pObj->AddRef(); - - // set the out-param equal to the interface pointer. - *ppv = pObj; - } - // Otherwise, we are looking for something other than - // IEcmObject, so... - else - { - // get a copy of the pointer to the entries so we can - // increment it, - _CAF_INTMAP_ENTRY* pEntries = - const_cast<_CAF_INTMAP_ENTRY*>(cpEntries); - - // loop through the interface map entries... - while((pEntries->cpiid != NULL) && - (pEntries->offset != SUBSYS_INTPTR_INVALID)) - { - // if we find a matching IID... - if ((NULL != pEntries->cpiid) && - (::IsEqualIID(*(pEntries->cpiid), criid))) - { - // get the interface at the offset from the map, - ICafObject* pObj = - reinterpret_cast( - (SUBSYS_INTPTR)cpThis+pEntries->offset); - - // increment the reference count, - pObj->AddRef(); - - // set the out-param equal to the interface - // pointer, and - *ppv = pObj; - - // break out of the loop. - break; - } - - // Move to the next entry in the interface map. - pEntries++; - } - } - } - } - } -} - -} - -#endif // _TCafSubSystemObjectRoot_H_ - diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/SubSystemBase/TCafSubSystemSmartCl.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/SubSystemBase/TCafSubSystemSmartCl.h deleted file mode 100644 index ea3d14d0b..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/SubSystemBase/TCafSubSystemSmartCl.h +++ /dev/null @@ -1,608 +0,0 @@ -/* - * Created: Oct 9, 2002 - * - * Copyright (C) 2002-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ -#ifndef _TCafSubSystemSmartCl_H -#define _TCafSubSystemSmartCl_H - -#include "EcmSubSystemBase.h" -#include "Exception/CCafException.h" -#include "CEcmSubSystem.h" -#include - -namespace Caf { - -struct CafSubSystemSmartClToken { ICafObject *m_pCl; CafSubSystemSmartClToken(ICafObject* p) : m_pCl(p) {} }; - -// this routine should really be moved to a real extern -inline BOOL CafSubSystemSmartClIsSameObject(ICafObject *pObj1, ICafObject *pObj2) -{ - BOOL bResult = TRUE; - if( pObj1 != pObj2) - { - ICafObject *p1 = 0, *p2 = 0; - pObj1->QueryInterface(CAF_IIDOF(ICafObject), (void**)&p1); - if( p1 ) p1->Release(); else p1 = 0; - pObj2->QueryInterface(CAF_IIDOF(ICafObject), (void**)&p2); - if( p2 ) p2->Release(); else p2 = 0; - bResult = (p1 == p2); // values do not change after release - } - return bResult; -} - -inline BOOL CafSubSystemSmartClIsSameObject(ICafObject *pObj1, const CafSubSystemSmartClToken& pObj2) -{ - return CafSubSystemSmartClIsSameObject(pObj1, pObj2.m_pCl); -} - -inline BOOL CafSubSystemSmartClIsSameObject(const CafSubSystemSmartClToken& pObj1, ICafObject *pObj2) -{ - return CafSubSystemSmartClIsSameObject(pObj1.m_pCl, pObj2); -} - -inline BOOL CafSubSystemSmartClIsSameObject(const CafSubSystemSmartClToken& pObj1, const CafSubSystemSmartClToken& pObj2) -{ - return CafSubSystemSmartClIsSameObject(pObj1.m_pCl, pObj2.m_pCl); -} - -/** - * @brief Template for classes exposed as subsystem objects - */ -template -class TCafSubSystemSmartCl -{ -private: - typedef TCafSubSystemSmartCl SameSmartType; - -public: // constructors/destructors - - // default constructor - TCafSubSystemSmartCl(void) : - CAF_CM_INIT( "TCafSubSystemSmartC" ), - m_pCl( 0 ) - { - } - - // homogeneous raw constructor - TCafSubSystemSmartCl(Cl* rhs) : - CAF_CM_INIT( "TCafSubSystemSmartC" ), - m_pCl( rhs ) - { - if( NULL != m_pCl ) - m_pCl->AddRef(); - } - - // homogeneous smart constructor - TCafSubSystemSmartCl(const SameSmartType& rhs) : - CAF_CM_INIT( "TCafSubSystemSmartC" ), - m_pCl( rhs.m_pCl ) - { - if( NULL != m_pCl ) - m_pCl->AddRef(); - } - - // heterogeneous raw constructor - TCafSubSystemSmartCl(ICafObject* rhs) : - CAF_CM_INIT( "TCafSubSystemSmartC" ), - m_pCl( 0 ) - { - if( rhs ) - { - // Do QueryInterface (throws exception if QI fails) - rhs->QueryInterface( GetIID(), ( void ** ) &m_pCl ); - } - } - - // heterogeneous smart constructor - TCafSubSystemSmartCl(const CafSubSystemSmartClToken& rhs) : - CAF_CM_INIT( "TCafSubSystemSmartC" ), - m_pCl( 0 ) - { - if( rhs.m_pCl ) - { - // Do QueryInterface (throws exception if QI fails) - rhs.m_pCl->QueryInterface( GetIID(), ( void ** ) &m_pCl ); - } - } - - // destructor - ~TCafSubSystemSmartCl(void) - { - SafeRelease(); - } - - operator CafSubSystemSmartClToken(void) const - { - return CafSubSystemSmartClToken( m_pCl ); - } - -public: // Attach operations - - // homogeneous raw attachment - void Attach(Cl* rhs) - { - if( rhs != m_pCl ) - { - SafeRelease(); - if( m_pCl = rhs ) - m_pCl->AddRef(); - } - } - - // homogeneous smart attachment - void Attach(const SameSmartType& rhs) - { - Attach( rhs.m_pCl ); - } - - // heterogeneous raw attachment - void Attach(ICafObject* rhs) - { - SafeRelease(); - if( rhs ) - { - rhs->QueryInterface( GetIID(), ( void ** ) &m_pCl ); - } - } - - // heterogeneous smart attachment - void Attach(const CafSubSystemSmartClToken& rhs) - { - Attach( rhs.m_pCl ); - } - -public: // assignment operators - - // homogeneous raw assignment - SameSmartType& operator = (Cl *rhs) - { - Attach( rhs ); - return *this; - } - - // homogeneous smart assignment - SameSmartType& operator = (const SameSmartType& rhs) - { - Attach( rhs ); - return *this; - } - - // heterogeneous raw assignment - SameSmartType& operator = (ICafObject * rhs) - { - Attach( rhs ); - return *this; - } - - // heterogeneous smart assignment - SameSmartType& operator = (const CafSubSystemSmartClToken& rhs) - { - Attach( rhs ); - return *this; - } - -public: // equivalence operators (note - no identity tests performed here!) - - BOOL operator == (Cl * rhs) - { - return m_pCl == rhs; - } - - BOOL operator == (const SameSmartType& rhs) - { - return m_pCl == rhs.m_pCl; - } - - BOOL operator != (Cl *rhs) - { - return m_pCl != rhs; - } - - BOOL operator != (const SameSmartType& rhs) - { - return m_pCl != rhs.m_pCl; - } - -public: // CoCreateInstance wrappers - void CreateInstance(const std::string& strClassIdentifier, const bool cbIsExceptionOnFailure = true) - { - CCafException* _cm_exception_ = NULL; - SafeRelease(); - - try - { - CEcmSubSystem oSubSystem; - oSubSystem.Load(strClassIdentifier); - oSubSystem.CreateInstance(strClassIdentifier, GetIID(), AsPPVArg()); - } - catch (CCafException *e) - { - _cm_exception_ = e; - } - - if( _cm_exception_ ) - { - if( cbIsExceptionOnFailure ) - { - _cm_exception_->throwSelf(); - } - else - { - _cm_exception_->Release(); - } - } - } - -private: - const IID& GetIID(void) const - { - return CAF_IIDOF(Cl); - } - - void** AsPPVArg(void) - { - SafeRelease(); - return (void **)&m_pCl; - } - -public: // operations - -// note: no Cl * operator is allowed, as it makes it very -// easy to break the protocol of COM. Instead, these -// four operations require the user to be explicit - - Cl* GetAddRefedInterface(void) const - { - if( m_pCl) - m_pCl->AddRef(); - return m_pCl; - } - - Cl* GetNonAddRefedInterface(void) const - { - return m_pCl; - } - - Cl** GetReleasedInterfaceReference(void) - { - SafeRelease(); - return &m_pCl; - } - - Cl** GetNonReleasedInterfaceReference(void) - { - return &m_pCl; - } - - BOOL operator ! (void) const - { - return m_pCl == 0; - } - - BOOL IsOK(void) const - { - return m_pCl != 0; - } - - // instead of operator bool, we return a fake ptr type to allow if( pFoo) usage - // but to disallow if( pFoo == pBar) which is probably wrong - class PseudoBool {}; - operator PseudoBool * (void) const - { - return (PseudoBool *)m_pCl; - } - - // the arrow operator returns a pointer with AddRef and Release disabled - class NoAddRefOrRelease : public Cl { - private: - virtual void AddRef() = 0; - virtual void Release() = 0; - }; - - NoAddRefOrRelease *operator ->(void) - { - return (NoAddRefOrRelease *)m_pCl; - } - - NoAddRefOrRelease *operator ->(void) const - { - return (NoAddRefOrRelease *)m_pCl; - } - - static Cl* GetAddRefedQueryInterface(ICafObject* pICafObject) - { - CAF_CM_STATIC_FUNC( "TCafSubSystemSmartC", "GetAddRefedQueryInterface" ); - CAF_CM_VALIDATE_INTERFACEPTR( pICafObject ); - - // QI to the interface and validate that the QI was successful. - Cl* pCl = 0; - pICafObject->QueryInterface( CAF_IIDOF(Cl), ( void ** ) &pCl ); - - return pCl; - } - - static Cl* GetNonAddRefedQueryInterface(ICafObject* pICafObject) - { - CAF_CM_STATIC_FUNC( "TCafSubSystemSmartC", "GetNonAddRefedQueryInterface" ); - CAF_CM_VALIDATE_INTERFACEPTR( pICafObject ); - - // QI to the interface and validate that the QI was successful. - Cl* pCl = 0; - pICafObject->QueryInterface( CAF_IIDOF(Cl), ( void ** ) &pCl ); - - // QueryInterface automatically AddRefs the interface, so it must be released. - if( pCl ) - pCl->Release(); - - return pCl; - } - -private: - CAF_CM_CREATE; - Cl* m_pCl; - -private: - void SafeRelease(void) - { - if( m_pCl ) - m_pCl->Release(); - m_pCl = 0; - } -}; - -template <> -class TCafSubSystemSmartCl -{ -private: - typedef ICafObject Cl; - typedef TCafSubSystemSmartCl SameSmartType; - -public: // constructors/destructors - - // default constructor - TCafSubSystemSmartCl(void) : - CAF_CM_INIT( "TCafSubSystemSmartC" ), - m_pCl(0) - { - } - - // homogeneous raw constructor - TCafSubSystemSmartCl(Cl *rhs) : - CAF_CM_INIT( "TCafSubSystemSmartC" ), - m_pCl(rhs) - { - if (NULL != m_pCl) - m_pCl->AddRef(); - } - - // homogeneous smart constructor - TCafSubSystemSmartCl(const SameSmartType& rhs) : - CAF_CM_INIT( "TCafSubSystemSmartC" ), - m_pCl(rhs.m_pCl) - { - if (NULL != m_pCl) - m_pCl->AddRef(); - } - - operator CafSubSystemSmartClToken (void) const - { - return CafSubSystemSmartClToken(m_pCl); - } - - // heterogeneous smart constructor (AddRef's instead of QI) - TCafSubSystemSmartCl(const CafSubSystemSmartClToken& rhs) : - CAF_CM_INIT( "TCafSubSystemSmartC" ), - m_pCl(0) - { - if ( rhs.m_pCl ) - { - m_pCl = rhs.m_pCl; - m_pCl->AddRef(); - } - } - - // destructor - ~TCafSubSystemSmartCl(void) - { - SafeRelease(); - } - -public: // Attach operations - - // homogeneous raw attachment - void Attach(Cl * rhs) - { - if (rhs != m_pCl) - { - SafeRelease(); - if ( rhs ) - { - m_pCl = rhs; - m_pCl->AddRef(); - } - } - } - - // homogeneous smart attachment - void Attach(const SameSmartType& rhs) - { - Attach(rhs.m_pCl); - } - - // heterogeneous smart attachment - void Attach(const CafSubSystemSmartClToken& rhs) - { - Attach(rhs.m_pCl); - } - -public: // assignment operators - // homogeneous raw assignment - SameSmartType& operator = (Cl *rhs) - { - Attach(rhs); - return *this; - } - - // homogeneous smart assignment - SameSmartType& operator = (const SameSmartType& rhs) - { - Attach(rhs); - return *this; - } - - // heterogeneous smart assignment - SameSmartType& operator = (const CafSubSystemSmartClToken& rhs) - { - Attach(rhs); - return *this; - } - - // equivalence operators (note - no identity tests performed here!) - BOOL operator == (Cl * rhs) - { - return m_pCl == rhs; - } - - BOOL operator == (const SameSmartType& rhs) - { - return m_pCl == rhs.m_pCl; - } - - BOOL operator != (Cl *rhs) - { - return m_pCl != rhs; - } - - BOOL operator != (const SameSmartType& rhs) - { - return m_pCl != rhs.m_pCl; - } - -public: // CoCreateInstance wrappers - void CreateInstance(const std::string& strClassIdentifier, - const bool cbIsExceptionOnFailure = true) - { - CCafException* _cm_exception_ = NULL; - SafeRelease(); - - try - { - CEcmSubSystem oSubSystem; - oSubSystem.Load(strClassIdentifier); - oSubSystem.CreateInstance(strClassIdentifier, GetIID(), AsPPVArg()); - } - catch (CCafException* e) - { - _cm_exception_ = e; - } - - if(_cm_exception_) - { - if( cbIsExceptionOnFailure ) - { - _cm_exception_->throwSelf(); - } - else - { - _cm_exception_->Release(); - } - } - } - -public: // Interface pointer accessors - // note: no If * operator is allowed, as it makes it very - // easy to break the protocol of COM. Instead, these - // four operations require the user to be explicit - - Cl * GetAddRefedInterface(void) const - { - if (m_pCl) - m_pCl->AddRef(); - return m_pCl; - } - - Cl * GetNonAddRefedInterface(void) const - { - return m_pCl; - } - - Cl **GetReleasedInterfaceReference(void) - { - SafeRelease(); - return &m_pCl; - } - - Cl **GetNonReleasedInterfaceReference(void) - { - return &m_pCl; - } - -public: // operations - const IID GetIID(void) const - { - return CAF_IIDOF(ICafObject); - } - - void * * AsPPVArg(void) - { - SafeRelease(); - return (void **)&m_pCl; - } - - BOOL operator ! (void) const - { - return m_pCl == 0; - } - - BOOL IsOK(void) const - { - return m_pCl != 0; - } - - // instead of operator bool, we return a fake ptr type to allow if (pFoo) usage - // but to disallow if (pFoo == pBar) which is probably wrong - class PseudoBool {}; - operator PseudoBool * (void) const - { - return (PseudoBool *)m_pCl; - } - - // the arrow operator returns a pointer with AddRef and Release disabled - class NoAddRefOrRelease : public Cl { - private: - virtual void AddRef() = 0; - virtual void Release() = 0; - }; - - NoAddRefOrRelease *operator ->(void) - { - CAF_CM_FUNCNAME_VALIDATE( "operator ->" ); - CAF_CM_VALIDATE_PTR( m_pCl ); - - return (NoAddRefOrRelease *)m_pCl; - } - - NoAddRefOrRelease *operator ->(void) const - { - CAF_CM_FUNCNAME_VALIDATE( "operator ->" ); - CAF_CM_VALIDATE_PTR( m_pCl ); - - return (NoAddRefOrRelease *)m_pCl; - } -private: - CAF_CM_CREATE; - Cl* m_pCl; - -private: - void SafeRelease(void) - { - if( m_pCl ) - m_pCl->Release(); - m_pCl = 0; - } -}; - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/SubSystemBase/stdafx.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/SubSystemBase/stdafx.h deleted file mode 100644 index ff169b0e7..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/SubSystemBase/stdafx.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Created: Mar 21, 2004 - * - * Copyright (C) 2004-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef stdafx_h_ -#define stdafx_h_ - -#ifdef WIN32 - #define SUBSYSTEMBASE_LINKAGE __declspec(dllexport) -#else - #define SUBSYSTEMBASE_LINKAGE -#endif - -#include -#include "../Common/CommonAggregatorLink.h" - -#endif // #ifndef stdafx_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Xml/MarkupParser/CMarkupParser.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Xml/MarkupParser/CMarkupParser.cpp deleted file mode 100644 index d4585b445..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Xml/MarkupParser/CMarkupParser.cpp +++ /dev/null @@ -1,250 +0,0 @@ -/* - * Author: mdonahue - * Created: Jan 20, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "Xml/MarkupParser/CMarkupParser.h" -#include "Exception/CCafException.h" -#include -#include - -namespace Caf { namespace MarkupParser { - -std::string _xml; - -struct SParserState { - SParserState() : - depth(0) { - } - - SmartPtrElement root; - std::deque stack; - uint32 depth; - -private: - CAF_CM_DECLARE_NOCOPY(SParserState); -}; - -void cb_start_element(GMarkupParseContext *context, - const gchar *element_name, - const gchar **attribute_names, - const gchar **attribute_values, - gpointer user_data, - GError **error) { - CAF_CM_STATIC_FUNC("MarkupParser", "cb_start_element"); - - try { - SParserState& state = *(reinterpret_cast(user_data)); - CAF_CM_ASSERT(state.depth == state.stack.size()); - if (state.depth == 0) { - //TODO-BLW: For some reason the root is already created, so temporarily - // remove the assert and re-create the root. - //CAF_CM_ASSERT(!state.root); - state.root.CreateInstance(); - state.stack.push_back(state.root); - } - else { - SmartPtrElement element; - element.CreateInstance(); - state.stack.back()->children.push_back(element); - state.stack.push_back(element); - } - - ++state.depth; - SmartPtrElement element = state.stack.back(); - element->name = element_name; - - const gchar **attr_name_cursor = attribute_names; - const gchar **attr_value_cursor = attribute_values; - while (*attr_name_cursor) { - element->attributes.push_back(Attribute(*attr_name_cursor, *attr_value_cursor)); - ++attr_name_cursor; - ++attr_value_cursor; - } - } - catch(CCafException *e) { - std::string msg(e->getFullMsg()); - e->Release(); - *error = g_error_new_literal(G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT, msg.c_str()); - } -} - -void cb_text(GMarkupParseContext *context, - const gchar *text, - gsize text_len, - gpointer user_data, - GError **error) { - SParserState& state = *(reinterpret_cast(user_data)); - if (text_len) { - state.stack.back()->value.append(text, text_len); - } -} - -void cb_end_element(GMarkupParseContext *context, - const gchar *element_name, - gpointer user_data, - GError **error) { - CAF_CM_STATIC_FUNC("MarkupParser", "cb_end_element"); - - try { - SParserState& state = *(reinterpret_cast(user_data)); - CAF_CM_ASSERT((state.depth) && (state.depth == state.stack.size())); - --state.depth; - state.stack.pop_back(); - } - catch(CCafException *e) { - std::string msg(e->getFullMsg()); - e->Release(); - *error = g_error_new_literal(G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT, msg.c_str()); - } -} - -void cb_destroy_user_data(gpointer data) { - delete (SParserState*)data; -} - -static GMarkupParser _markupParser = { cb_start_element, - cb_end_element, - cb_text, - NULL, - NULL }; - -SmartPtrElement parseString(const std::string& xml) { - CAF_CM_STATIC_FUNC("MarkupParser", "parseString"); - CAF_CM_VALIDATE_STRINGPTRA(xml.c_str()); - - _xml = xml; - - SParserState *parserState = new SParserState(); - GError *parserError = NULL; - GMarkupParseContext *context = - g_markup_parse_context_new(&_markupParser, - G_MARKUP_TREAT_CDATA_AS_TEXT, - parserState, - cb_destroy_user_data); - - SmartPtrElement root; - try { - if (g_markup_parse_context_parse(context, - xml.c_str(), - xml.length(), - &parserError)) { - root = parserState->root; - } - else { - CAF_CM_EXCEPTION_VA0(parserError->code, parserError->message); - } - } - catch (...) { - if (parserError) { - g_error_free(parserError); - } - - if (context) { - g_markup_parse_context_free(context); - } - throw; - } - - if (parserError) { - g_error_free(parserError); - } - - if (context) { - g_markup_parse_context_free(context); - } - - return root; -} - -SmartPtrElement parseFile(const std::string& file) { - CAF_CM_STATIC_FUNC("MarkupParser", "parseFile"); - CAF_CM_VALIDATE_STRINGPTRA(file.c_str()); - - gchar* text = NULL; - GError *fileError = NULL; - SmartPtrElement root; - try { - if (g_file_get_contents(file.c_str(), &text, NULL, &fileError)) { - if (! text || (text[ 0 ] == L'\0' )) { - CAF_CM_EXCEPTION_VA1(ERROR_INVALID_DATA, "File is empty - %s", file.c_str()); - } - root = parseString(text); - } - else { - CAF_CM_EXCEPTION_VA0(fileError->code, fileError->message); - } - } - catch (...) { - if (fileError) { - g_error_free(fileError); - } - - if (text) { - g_free(text); - } - throw; - } - - if (fileError) { - g_error_free(fileError); - } - - if (text) { - g_free(text); - } - - return root; -} - -ChildIterator findChild(SmartPtrElement& element, const std::string& name) { - CAF_CM_STATIC_FUNC_VALIDATE("MarkupParser", "findChild"); - CAF_CM_VALIDATE_SMARTPTR(element); - CAF_CM_VALIDATE_STRING(name); - - ChildIterator rc = element->children.end(); - for(ChildIterator childIter = element->children.begin(); - childIter != element->children.end(); - childIter++) { - if((*childIter)->name.compare(name) == 0) { - rc = childIter; - } - } - return rc; -/* - return std::find_if(element->children.begin(), - element->children.end(), - std::bind2nd(ElementName(), name)); -*/ -} - -AttributeIterator findAttribute(Attributes& attributes, const std::string& name) { - CAF_CM_STATIC_FUNC_VALIDATE("MarkupParser", "findAttribute"); - CAF_CM_VALIDATE_STRING(name); - return std::find_if(attributes.begin(), - attributes.end(), - std::bind2nd(AttributeName(), name)); -} - -std::string getAttributeValue(SmartPtrElement& element, const std::string& name) { - CAF_CM_STATIC_FUNC("MarkupParser", "getAttributeValue"); - CAF_CM_VALIDATE_SMARTPTR(element); - CAF_CM_VALIDATE_STRING(name); - std::string rc; - - AttributeIterator iter = findAttribute(element->attributes, name); - if (iter != element->attributes.end()) { - rc = iter->second; - } else { - CAF_CM_EXCEPTION_VA2(ERROR_TAG_NOT_FOUND, - "Element %s does not contain attribute %s", - element->name.c_str(), - name.c_str()); - } - return rc; -} - -}} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Xml/MarkupParser/MarkupParserLink.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Xml/MarkupParser/MarkupParserLink.h deleted file mode 100644 index 54caf0a0e..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Xml/MarkupParser/MarkupParserLink.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Author: mdonahue - * Created: Jan 20, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef MARKUPPARSERLINK_H_ -#define MARKUPPARSERLINK_H_ - -#ifndef MARKUPPARSER_LINKAGE - #ifdef WIN32 - #ifdef FRAMEWORK_BUILD - #define MARKUPPARSER_LINKAGE __declspec(dllexport) - #else - #define MARKUPPARSER_LINKAGE __declspec(dllimport) - #endif - #else - #define MARKUPPARSER_LINKAGE - #endif -#endif - - -#endif /* MARKUPPARSERLINK_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Xml/MarkupParser/stdafx.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Xml/MarkupParser/stdafx.h deleted file mode 100644 index 7cf7940b3..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Xml/MarkupParser/stdafx.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Author: mdonahue - * Created: Jan 20, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef STDAFX_H_ -#define STDAFX_H_ - -#ifdef WIN32 - #define MARKUPPARSER_LINKAGE __declspec(dllexport) - #define COMMONAGGREGATOR_LINKAGE __declspec(dllexport) -#else - #define MARKUPPARSER_LINKAGE - #define COMMONAGGREGATOR_LINKAGE -#endif - -#include -#include -#include "../../Common/CAutoMutexLockUnlock.h" -#include "../../Exception/ExceptionLink.h" - -#endif /* STDAFX_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Xml/XmlUtils/CXmlElement.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Xml/XmlUtils/CXmlElement.cpp deleted file mode 100644 index abf30630b..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Xml/XmlUtils/CXmlElement.cpp +++ /dev/null @@ -1,417 +0,0 @@ -/* - * Author: mdonahue - * Created: Dec 3, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Integration/IDocument.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Exception/CCafException.h" - -using namespace Caf; - -const std::string CXmlElement::CDATA_BEG = ""; - -CXmlElement::CXmlElement() : - _isInitialized(false), - CAF_CM_INIT_LOG("CXmlElement") { -} - -CXmlElement::~CXmlElement() { -} - -void CXmlElement::initialize( - const MarkupParser::SmartPtrElement& element, - const std::string& path) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_PTR(element); - CAF_CM_VALIDATE_STRING(path); - - _element = element; - _path = path; - _isInitialized = true; -} - -MarkupParser::SmartPtrElement CXmlElement::getInternalElement() { - return _element; -} - -std::string CXmlElement::findRequiredAttribute(const std::string& name) const { - CAF_CM_FUNCNAME("findRequiredAttribute"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(name); - - CAF_CM_VALIDATE_COND_VA3(!_element->attributes.empty(), - "element (%s) does not contain any attributes (%s) in %s", _element->name.c_str(), - name.c_str(), _path.c_str()); - - MarkupParser::AttributeIterator iter = MarkupParser::findAttribute( - _element->attributes, name); - CAF_CM_VALIDATE_COND_VA3(iter != _element->attributes.end(), - "element (%s) does not contain required attribute (%s) in %s", - _element->name.c_str(), name.c_str(), _path.c_str()); - - std::string rc = iter->second; - CAF_CM_VALIDATE_STRING(rc); - - return rc; -} - -std::string CXmlElement::findOptionalAttribute(const std::string& name) const { - CAF_CM_FUNCNAME_VALIDATE("findOptionalAttribute"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(name); - - std::string rc; - if (!_element->attributes.empty()) { - MarkupParser::AttributeIterator iter = MarkupParser::findAttribute( - _element->attributes, name); - if (iter != _element->attributes.end()) { - rc = iter->second; - } - } - - return rc; -} - -SmartPtrCXmlElement CXmlElement::findRequiredChild(const std::string& name) const { - CAF_CM_FUNCNAME("findRequiredChild"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(name); - - const MarkupParser::ChildIterator iter = MarkupParser::findChild(_element, name); - if (iter == _element->children.end()) { - CAF_CM_LOG_INFO_VA1("Child not found: %s", name.c_str()); - } - CAF_CM_VALIDATE_COND_VA3(iter != _element->children.end(), - "element (%s) does not contain required child (%s) in %s", _element->name.c_str(), - name.c_str(), _path.c_str()); - - SmartPtrCXmlElement rc; - rc.CreateInstance(); - rc->initialize(*iter, _path); - - return rc; -} - -SmartPtrCXmlElement CXmlElement::findOptionalChild(const std::string& name) const { - CAF_CM_FUNCNAME_VALIDATE("findOptionalChild"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(name); - - SmartPtrCXmlElement rc; - const MarkupParser::ChildIterator iter = MarkupParser::findChild(_element, name); - if (iter != _element->children.end()) { - rc.CreateInstance(); - rc->initialize(*iter, _path); - } - - return rc; -} - -CXmlElement::SmartPtrCAttributeCollection CXmlElement::getAllAttributes() const { - CAF_CM_FUNCNAME_VALIDATE("getAllAttributes"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - SmartPtrCAttributeCollection rc; - rc.CreateInstance(); - - for (TConstIterator attribute(_element->attributes); - attribute; attribute++) { - rc->insert(std::make_pair((*attribute).first, (*attribute).second)); - } - - return rc; -} - -CXmlElement::SmartPtrCElementCollection CXmlElement::getAllChildren() const { - CAF_CM_FUNCNAME_VALIDATE("getAllChildren"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - SmartPtrCElementCollection rc; - rc.CreateInstance(); - - SmartPtrCXmlElement xmlElement; - for (TConstIterator child(_element->children); child; - child++) { - xmlElement.CreateInstance(); - xmlElement->initialize(*child, _path); - rc->insert(std::make_pair((*child)->name, xmlElement)); - } - - return rc; -} - -CXmlElement::SmartPtrCOrderedElementCollection CXmlElement::getAllChildrenInOrder() const { - CAF_CM_FUNCNAME_VALIDATE("getAllChildrenInOrder"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - SmartPtrCOrderedElementCollection rc; - rc.CreateInstance(); - - SmartPtrCXmlElement xmlElement; - for (TConstIterator child(_element->children); child; - child++) { - xmlElement.CreateInstance(); - xmlElement->initialize(*child, _path); - rc->push_back(xmlElement); - } - - return rc; -} - -CXmlElement::SmartPtrCElementCollection CXmlElement::findRequiredChildren( - const std::string& name) const { - CAF_CM_FUNCNAME("findRequiredChildren"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(name); - - SmartPtrCElementCollection rc = findOptionalChildren(name); - - if (rc.IsNull() || rc->empty()) { - CAF_CM_EXCEPTIONEX_VA1(NoSuchElementException, ERROR_NOT_FOUND, - "Children not found: %s", name.c_str()); - } - - return rc; -} - -CXmlElement::SmartPtrCElementCollection CXmlElement::findOptionalChildren( - const std::string& name) const { - CAF_CM_FUNCNAME_VALIDATE("findOptionalChildren"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(name); - - SmartPtrCElementCollection rc; - rc.CreateInstance(); - - SmartPtrCXmlElement xmlElement; - for (TConstIterator child(_element->children); child; - child++) { - if (((*child)->name).compare(name) == 0) { - xmlElement.CreateInstance(); - xmlElement->initialize(*child, _path); - rc->insert(std::make_pair((*child)->name, xmlElement)); - } - } - - return rc; -} - -std::string CXmlElement::getName() const { - CAF_CM_FUNCNAME_VALIDATE("getName"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _element->name; -} - -std::string CXmlElement::getValue() const { - CAF_CM_FUNCNAME_VALIDATE("getValue"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _element->value; -} - -std::string CXmlElement::getCDataValue() const { - CAF_CM_FUNCNAME_VALIDATE("getCDataValue"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - std::string rc = _element->value; - if (! rc.empty()) { - const std::string::size_type cdataBegPos = rc.find(CDATA_BEG); - const std::string::size_type cdataEndPos = rc.find(CDATA_END); - if ((0 == cdataBegPos) && (std::string::npos != cdataEndPos)) { - rc = rc.substr(0, cdataEndPos); - rc = rc.substr(cdataBegPos + CDATA_BEG.length()); - } - } - - return rc; -} - -std::string CXmlElement::getPath() const { - CAF_CM_FUNCNAME_VALIDATE("getPath"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _path; -} - -void CXmlElement::addAttribute(const std::string& name, const std::string& value) { - CAF_CM_FUNCNAME("addAttribute"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(name); - CAF_CM_VALIDATE_STRING(value); - - if (!_element->attributes.empty()) { - MarkupParser::AttributeIterator iter = MarkupParser::findAttribute( - _element->attributes, name); - CAF_CM_VALIDATE_COND_VA3(iter == _element->attributes.end(), - "element (%s) already contains attribute (%s) in %s", _element->name.c_str(), - name.c_str(), _path.c_str()); - } - - _element->attributes.push_back(std::make_pair(name, value)); -} - -void CXmlElement::removeAttribute(const std::string& name) { - - CAF_CM_FUNCNAME_VALIDATE("removeAttribute"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(name); - - if (!_element->attributes.empty()) { - MarkupParser::AttributeIterator iter = MarkupParser::findAttribute( - _element->attributes, name); - if (iter != _element->attributes.end()) { - _element->attributes.erase(iter); - } - } -} - -void CXmlElement::setAttribute(const std::string& name, const std::string& value) { - CAF_CM_FUNCNAME("setAttribute"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(name); - CAF_CM_VALIDATE_STRING(value); - - CAF_CM_VALIDATE_COND_VA3(!_element->attributes.empty(), - "element (%s) does not contain any attributes (%s) in %s", - _element->name.c_str(), name.c_str(), _path.c_str()); - - MarkupParser::AttributeIterator iter = MarkupParser::findAttribute( - _element->attributes, name); - CAF_CM_VALIDATE_COND_VA3(iter != _element->attributes.end(), - "element (%s) does not contain required attribute (%s) in %s", - _element->name.c_str(), name.c_str(), _path.c_str()); - - iter->second = value; -} - -SmartPtrCXmlElement CXmlElement::createAndAddElement(const std::string& name) { - CAF_CM_FUNCNAME_VALIDATE("createAndAddElement"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(name); - - MarkupParser::SmartPtrElement element; - element.CreateInstance(); - element->name = name; - - SmartPtrCXmlElement rc; - rc.CreateInstance(); - rc->initialize(element, _path); - - _element->children.push_back(element); - - return rc; -} - -void CXmlElement::addChild(const SmartPtrCXmlElement& xmlElement) { - CAF_CM_FUNCNAME_VALIDATE("addChild"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_SMARTPTR(xmlElement); - - _element->children.push_back(xmlElement->getInternalElement()); -} - -void CXmlElement::removeChild(const std::string& name) { - CAF_CM_FUNCNAME_VALIDATE("removeChild"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(name); - - const MarkupParser::ChildIterator iter = MarkupParser::findChild(_element, name); - if (iter != _element->children.end()) { - _element->children.erase(iter); - } -} - -void CXmlElement::setValue(const std::string& value) { - CAF_CM_FUNCNAME_VALIDATE("setValue"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(value); - - _element->value = value; -} - -void CXmlElement::setCDataValue(const std::string& value) { - CAF_CM_FUNCNAME_VALIDATE("setCDataValue"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(value); - - if (std::string::npos == value.find(CDATA_BEG)) { - _element->value = CDATA_BEG + value + CDATA_END; - } else { - _element->value = value; - } -} - -void CXmlElement::appendValue(const std::string& value) { - CAF_CM_FUNCNAME_VALIDATE("appendValue"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(value); - - if (_element->value.empty()) { - _element->value = ""; - } - - _element->value += value; -} - -void CXmlElement::saveToFile(const std::string& filename) const { - CAF_CM_FUNCNAME_VALIDATE("saveToFile"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(filename); - - CAF_CM_LOG_INFO_VA1("Saving XML to file \"%s\"", filename.c_str()); - - const std::string xml = saveToString(); - FileSystemUtils::saveTextFile(filename, xml); -} - -std::string CXmlElement::saveToString() const { - CAF_CM_FUNCNAME_VALIDATE("saveToString"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - std::string rc = ""; - saveToString(_element, rc); - - return rc; -} - -std::string CXmlElement::saveToStringRaw() const { - CAF_CM_FUNCNAME_VALIDATE("saveToStringRaw"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - std::string rc; - saveToString(_element, rc); - - return rc; -} - -void CXmlElement::saveToString( - const MarkupParser::SmartPtrElement& element, - std::string& xml) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CXmlElement", "saveToString"); - CAF_CM_VALIDATE_PTR(element); - - xml += "<" + element->name; - for (TConstIterator attribute(element->attributes); - attribute; attribute++) { - xml += " " + attribute->first + "=\"" + attribute->second + "\""; - } - - if (element->value.empty() && element->children.empty()) { - xml += "/>"; - } else { - xml += ">" + element->value; - for (TConstIterator child(element->children); - child; child++) { - saveToString(*child, xml); - } - xml += "name + ">"; - } -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Xml/XmlUtils/CXmlUtils.cpp b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Xml/XmlUtils/CXmlUtils.cpp deleted file mode 100644 index efe7b57dc..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Xml/XmlUtils/CXmlUtils.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Author: bwilliams - * Created: Jan 21, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Xml/MarkupParser/CMarkupParser.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Exception/CCafException.h" -#include "CXmlUtils.h" - -using namespace Caf; - -SmartPtrCXmlElement CXmlUtils::parseFile( - const std::string& path, - const std::string& rootName) { - CAF_CM_STATIC_FUNC("CXmlUtils", "parseFile"); - CAF_CM_VALIDATE_STRING(path); - // rootName is optional - - if (!FileSystemUtils::doesFileExist(path)) { - CAF_CM_EXCEPTION_VA1(ERROR_FILE_NOT_FOUND, "File not found: %s", path.c_str()); - } - - const MarkupParser::SmartPtrElement element = MarkupParser::parseFile(path); - CAF_CM_VALIDATE_SMARTPTR(element); - CAF_CM_VALIDATE_STRING(element->name); - if (!rootName.empty()) { - CAF_CM_VALIDATE_COND_VA3(element->name == rootName, - "root not valid (\"%s\" != \"%s\") in %s", rootName.c_str(), - element->name.c_str(), path.c_str()); - } - - SmartPtrCXmlElement xmlElement; - xmlElement.CreateInstance(); - xmlElement->initialize(element, path); - - return xmlElement; -} - -SmartPtrCXmlElement CXmlUtils::parseString( - const std::string& xml, - const std::string& rootName) { - CAF_CM_STATIC_FUNC("CXmlUtils", "parseString"); - CAF_CM_VALIDATE_STRING(xml); - // rootName is optional - - const std::string path = "fromString"; - - const MarkupParser::SmartPtrElement element = MarkupParser::parseString(xml); - CAF_CM_VALIDATE_SMARTPTR(element); - CAF_CM_VALIDATE_STRING(element->name); - if (!rootName.empty()) { - CAF_CM_VALIDATE_COND_VA3(element->name == rootName, - "root not valid (\"%s\" != \"%s\") in %s", rootName.c_str(), - element->name.c_str(), path.c_str()); - } - - SmartPtrCXmlElement xmlElement; - xmlElement.CreateInstance(); - xmlElement->initialize(element, path); - - return xmlElement; -} - -SmartPtrCXmlElement CXmlUtils::createRootElement( - const std::string& rootName, - const std::string& rootNamespace) { - CAF_CM_STATIC_FUNC_VALIDATE("CXmlUtils", "createRootElement"); - CAF_CM_VALIDATE_STRING(rootName); - CAF_CM_VALIDATE_STRING(rootNamespace); - - return createRootElement(rootName, rootNamespace, std::string()); -} - -SmartPtrCXmlElement CXmlUtils::createRootElement( - const std::string& rootName, - const std::string& rootNamespace, - const std::string& schemaLocation) { - CAF_CM_STATIC_FUNC_VALIDATE("CXmlUtils", "createRootElement"); - CAF_CM_VALIDATE_STRING(rootName); - CAF_CM_VALIDATE_STRING(rootNamespace); - // schemaLocation is optional - - MarkupParser::SmartPtrElement element; - element.CreateInstance(); - - SmartPtrCXmlElement xmlElement; - xmlElement.CreateInstance(); - xmlElement->initialize(element, "createRootElement"); - xmlElement->addAttribute("xmlns:caf", rootNamespace); - - if (!schemaLocation.empty()) { - const std::string fullSchemaLocation = rootNamespace + " " + schemaLocation; - xmlElement->addAttribute("xmlns:xsi", - "http://www.w3.org/2001/XMLSchema-instance"); - xmlElement->addAttribute("xsi:schemaLocation", fullSchemaLocation); - } - - element->name = "caf:" + rootName; - - return xmlElement; -} - -std::string CXmlUtils::escape(const std::string& text) { - CAF_CM_STATIC_FUNC("CXmlUtils", "escape"); - - std::string rc; - gchar* gRc = NULL; - - try { - CAF_CM_VALIDATE_STRING(text); - - gRc = g_markup_escape_text(text.c_str(), -1); - if (gRc) { - rc = gRc; - g_free(gRc); - gRc = NULL; - } - } - CAF_CM_CATCH_DEFAULT - - try { - if (gRc) { - g_free(gRc); - } - } - CAF_CM_CATCH_DEFAULT - CAF_CM_THROWEXCEPTION; - - return rc; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Xml/XmlUtils/CXmlUtils.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Xml/XmlUtils/CXmlUtils.h deleted file mode 100644 index ee9119106..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Xml/XmlUtils/CXmlUtils.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Author: bwilliams - * Created: Jan 21, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CXmlUtils_H_ -#define CXmlUtils_H_ - - - -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - -class XMLUTILS_LINKAGE CXmlUtils { -public: - static SmartPtrCXmlElement parseFile( - const std::string& path, - const std::string& rootName); - - static SmartPtrCXmlElement parseString( - const std::string& xml, - const std::string& rootName); - - static SmartPtrCXmlElement createRootElement( - const std::string& rootName, - const std::string& rootNamespace); - - static SmartPtrCXmlElement createRootElement( - const std::string& rootName, - const std::string& rootNamespace, - const std::string& schemaLocation); - - static std::string escape( - const std::string& text); - -private: - CAF_CM_DECLARE_NOCREATE(CXmlUtils); -}; - -} - -#endif /* CXmlUtils_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Xml/XmlUtils/XmlUtilsLink.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Xml/XmlUtils/XmlUtilsLink.h deleted file mode 100644 index 1165f99d6..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Xml/XmlUtils/XmlUtilsLink.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Author: mdonahue - * Created: Sep 28, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef XMLUTILSLINK_H_ -#define XMLUTILSLINK_H_ - -#ifndef XMLUTILS_LINKAGE - #ifdef WIN32 - #ifdef FRAMEWORK_BUILD - #define XMLUTILS_LINKAGE __declspec(dllexport) - #else - #define XMLUTILS_LINKAGE __declspec(dllimport) - #endif - #else - #define XMLUTILS_LINKAGE - #endif -#endif - -#include "CXmlUtils.h" - -#endif diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Xml/XmlUtils/stdafx.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Xml/XmlUtils/stdafx.h deleted file mode 100644 index da0ed97cd..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/Xml/XmlUtils/stdafx.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Author: mdonahue - * Created: Sep 28, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef STDAFX_H_ -#define STDAFX_H_ - -#ifdef WIN32 - #define XMLUTILS_LINKAGE __declspec(dllexport) - #define COMMONAGGREGATOR_LINKAGE __declspec(dllexport) -#else - #define XMLUTILS_LINKAGE - #define COMMONAGGREGATOR_LINKAGE -#endif - -#include -#include -#include "../../Exception/ExceptionLink.h" -#include "../../Logging/LoggingLink.h" -#include "../../Collections/Iterators/IteratorsInc.h" -#include "../../Common/CFileSystemUtils.h" -#include "../MarkupParser/MarkupParserLink.h" - -#endif /* STDAFX_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/stdafx.h b/open-vm-tools/common-agent/Cpp/Framework/Framework/src/stdafx.h deleted file mode 100644 index d4c73201c..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Framework/src/stdafx.h +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef stdafx_h_ -#define stdafx_h_ - -#ifdef WIN32 - #define BASEPLATFORM_LINKAGE __declspec(dllexport) -#else - #define BASEPLATFORM_LINKAGE -#endif - -#include -#include "BasePlatformInc.h" - -#endif // #ifndef stdafx_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Makefile.am b/open-vm-tools/common-agent/Cpp/Framework/Makefile.am deleted file mode 100644 index 1c5e6c1da..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Makefile.am +++ /dev/null @@ -1,428 +0,0 @@ -################################################################################ -### Copyright (C) 2016 VMware, Inc. All rights reserved. -### -### This program is free software; you can redistribute it and/or modify -### it under the terms of version 2 of the GNU General Public License as -### published by the Free Software Foundation. -### -### 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -################################################################################ - -AUTOMAKE_OPTIONS = subdir-objects -subsysdir = @CAF_SUBSYS_DIR@ -subsys_LTLIBRARIES = -caflibdir = @CAF_PME_LIB_DIR@ -caflib_LTLIBRARIES = -caflib_LTLIBRARIES += libFramework.la - -libFramework_la_SOURCES= -libFramework_la_SOURCES += Framework/src/BasePlatform.cpp -libFramework_la_SOURCES += Framework/src/Common/AppConfigUtils.cpp -libFramework_la_SOURCES += Framework/src/Common/CAppConfig.cpp -libFramework_la_SOURCES += Framework/src/Common/CApplicationContext.cpp -libFramework_la_SOURCES += Framework/src/Common/CAutoCondition.cpp -libFramework_la_SOURCES += Framework/src/Common/CAutoFileUnlock.cpp -libFramework_la_SOURCES += Framework/src/Common/CAutoMutex.cpp -libFramework_la_SOURCES += Framework/src/Common/CAutoMutexLockUnlock.cpp -libFramework_la_SOURCES += Framework/src/Common/CAutoMutexLockUnlockRaw.cpp -libFramework_la_SOURCES += Framework/src/Common/CAutoMutexUnlockLock.cpp -libFramework_la_SOURCES += Framework/src/Common/CAutoRecMutex.cpp -libFramework_la_SOURCES += Framework/src/Common/CCafRegex.cpp -libFramework_la_SOURCES += Framework/src/Common/CCmdLineOptions.cpp -libFramework_la_SOURCES += Framework/src/Common/CConfigParams.cpp -libFramework_la_SOURCES += Framework/src/Common/CConfigParamsChain.cpp -libFramework_la_SOURCES += Framework/src/Common/CDaemonUtils.cpp -libFramework_la_SOURCES += Framework/src/Common/CDateTimeUtils.cpp -libFramework_la_SOURCES += Framework/src/Common/CEnvironmentUtils.cpp -libFramework_la_SOURCES += Framework/src/Common/CFileLock.cpp -libFramework_la_SOURCES += Framework/src/Common/CFileSystemUtils.cpp -libFramework_la_SOURCES += Framework/src/Common/CHexCodec.cpp -libFramework_la_SOURCES += Framework/src/Common/CIniFile.cpp -libFramework_la_SOURCES += Framework/src/Common/CLoggingSetter.cpp -libFramework_la_SOURCES += Framework/src/Common/CLoggingUtils.cpp -libFramework_la_SOURCES += Framework/src/Common/CManagedThreadPool.cpp -libFramework_la_SOURCES += Framework/src/Common/CPersistenceUtils.cpp -libFramework_la_SOURCES += Framework/src/Common/CProcessUtils.cpp -libFramework_la_SOURCES += Framework/src/Common/CStringUtils.cpp -libFramework_la_SOURCES += Framework/src/Common/CThreadPool.cpp -libFramework_la_SOURCES += Framework/src/Common/CThreadSignal.cpp -libFramework_la_SOURCES += Framework/src/Common/CThreadUtils.cpp -libFramework_la_SOURCES += Framework/src/Common/CTimeUnit.cpp -libFramework_la_SOURCES += Framework/src/Common/CVariant.cpp -libFramework_la_SOURCES += Framework/src/Common/CafInitialize.cpp -libFramework_la_SOURCES += Framework/src/Common/UriUtils.cpp -libFramework_la_SOURCES += Framework/src/CommonGlobals.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/CafCoreTypesDoc/CAddInCollectionDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/CafCoreTypesDoc/CAddInsDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/CafCoreTypesDoc/CAttachmentCollectionDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/CafCoreTypesDoc/CAttachmentDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/CafCoreTypesDoc/CAttachmentNameCollectionDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/CafCoreTypesDoc/CAuthnAuthzCollectionDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/CafCoreTypesDoc/CAuthnAuthzDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/CafCoreTypesDoc/CClassFiltersDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/CafCoreTypesDoc/CClassSpecifierDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/CafCoreTypesDoc/CFullyQualifiedClassGroupDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/CafCoreTypesDoc/CInlineAttachmentCollectionDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/CafCoreTypesDoc/CInlineAttachmentDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/CafCoreTypesDoc/CLoggingLevelCollectionDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/CafCoreTypesDoc/CLoggingLevelElemDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/CafCoreTypesDoc/COperationDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/CafCoreTypesDoc/CParameterCollectionDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/CafCoreTypesDoc/CPropertyCollectionDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/CafCoreTypesDoc/CPropertyDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/CafCoreTypesDoc/CProtocolCollectionDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/CafCoreTypesDoc/CProtocolDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/CafCoreTypesDoc/CRequestConfigDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/CafCoreTypesDoc/CRequestHeaderDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/CafCoreTypesDoc/CRequestInstanceParameterDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/CafCoreTypesDoc/CRequestParameterDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/CafCoreTypesDoc/CStatisticsDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/CafInstallRequestDoc/CFullPackageElemDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/CafInstallRequestDoc/CGetInventoryJobDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/CafInstallRequestDoc/CInstallBatchDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/CafInstallRequestDoc/CInstallPackageSpecDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/CafInstallRequestDoc/CInstallProviderJobDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/CafInstallRequestDoc/CInstallProviderSpecDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/CafInstallRequestDoc/CInstallRequestDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/CafInstallRequestDoc/CMinPackageElemDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/CafInstallRequestDoc/CPackageDefnDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/CafInstallRequestDoc/CUninstallProviderJobDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/DiagRequestDoc/CDiagRequestDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/DiagTypesDoc/CDiagBatchDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/DiagTypesDoc/CDiagCollectInstancesDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/DiagTypesDoc/CDiagDeleteValueCollectionDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/DiagTypesDoc/CDiagDeleteValueDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/DiagTypesDoc/CDiagSetValueCollectionDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/DiagTypesDoc/CDiagSetValueDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/MgmtRequestDoc/CMgmtRequestDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/MgmtTypesDoc/CMgmtBatchDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/MgmtTypesDoc/CMgmtCollectInstancesCollectionDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/MgmtTypesDoc/CMgmtCollectInstancesDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/MgmtTypesDoc/CMgmtCollectSchemaDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/MgmtTypesDoc/CMgmtInvokeOperationCollectionDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/MgmtTypesDoc/CMgmtInvokeOperationDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/MultiPmeMgmtRequestDoc/CMultiPmeMgmtBatchCollectionDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/MultiPmeMgmtRequestDoc/CMultiPmeMgmtBatchDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/MultiPmeMgmtRequestDoc/CMultiPmeMgmtRequestDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/MultiPmeMgmtRequestDoc/CPmeIdCollectionDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/PayloadEnvelopeDoc/CPayloadEnvelopeDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/PersistenceDoc/CCertCollectionDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/PersistenceDoc/CCertPathCollectionDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/PersistenceDoc/CLocalSecurityDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/PersistenceDoc/CPersistenceDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/PersistenceDoc/CPersistenceProtocolCollectionDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/PersistenceDoc/CPersistenceProtocolDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/PersistenceDoc/CRemoteSecurityCollectionDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/PersistenceDoc/CRemoteSecurityDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/ProviderInfraDoc/CClassCollectionDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/ProviderInfraDoc/CProviderRegDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/ProviderInfraDoc/CSchemaSummaryDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/ProviderRequestDoc/CProviderBatchDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/ProviderRequestDoc/CProviderCollectInstancesCollectionDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/ProviderRequestDoc/CProviderCollectInstancesDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/ProviderRequestDoc/CProviderCollectSchemaRequestDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/ProviderRequestDoc/CProviderInvokeOperationCollectionDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/ProviderRequestDoc/CProviderInvokeOperationDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/ProviderRequestDoc/CProviderRequestConfigDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/ProviderRequestDoc/CProviderRequestDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/ProviderRequestDoc/CProviderRequestHeaderDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/ProviderResultsDoc/CCdifDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/ProviderResultsDoc/CDefinitionObjectCollectionDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/ProviderResultsDoc/CRequestIdentifierDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/ProviderResultsDoc/CSchemaDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/ResponseDoc/CErrorResponseDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/ResponseDoc/CEventKeyCollectionDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/ResponseDoc/CEventKeyDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/ResponseDoc/CEventManifestDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/ResponseDoc/CManifestCollectionDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/ResponseDoc/CManifestDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/ResponseDoc/CProviderEventResponseDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/ResponseDoc/CProviderResponseDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/ResponseDoc/CResponseDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/ResponseDoc/CResponseHeaderDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/SchemaTypesDoc/CActionClassDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/SchemaTypesDoc/CActionClassInstanceCollectionDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/SchemaTypesDoc/CActionClassInstanceDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/SchemaTypesDoc/CClassCardinalityDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/SchemaTypesDoc/CClassFieldDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/SchemaTypesDoc/CClassIdentifierDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/SchemaTypesDoc/CClassInstancePropertyDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/SchemaTypesDoc/CClassPropertyDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/SchemaTypesDoc/CCmdlMetadataDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/SchemaTypesDoc/CCmdlUnionDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/SchemaTypesDoc/CCollectMethodDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/SchemaTypesDoc/CDataClassDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/SchemaTypesDoc/CDataClassInstanceCollectionDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/SchemaTypesDoc/CDataClassInstanceDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/SchemaTypesDoc/CDataClassPropertyDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/SchemaTypesDoc/CDataClassSubInstanceDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/SchemaTypesDoc/CInstanceOperationCollectionDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/SchemaTypesDoc/CInstanceOperationDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/SchemaTypesDoc/CInstanceParameterDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/SchemaTypesDoc/CJoinTypeDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/SchemaTypesDoc/CLogicalRelationshipDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/SchemaTypesDoc/CMethodDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/SchemaTypesDoc/CMethodParameterDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/SchemaTypesDoc/CPhysicalRelationshipDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocDoc/SchemaTypesDoc/CRelationshipDoc.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocUtils/AttachmentUtils.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocUtils/DefnObjectConverter.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocUtils/DocXmlUtils.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocUtils/EnumConvertersXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocUtils/ParameterUtils.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/CafCoreTypesXml/AddInCollectionXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/CafCoreTypesXml/AddInsXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/CafCoreTypesXml/AttachmentCollectionXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/CafCoreTypesXml/AttachmentNameCollectionXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/CafCoreTypesXml/AttachmentXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/CafCoreTypesXml/AuthnAuthzCollectionXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/CafCoreTypesXml/AuthnAuthzXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/CafCoreTypesXml/ClassFiltersXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/CafCoreTypesXml/ClassSpecifierXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/CafCoreTypesXml/FullyQualifiedClassGroupXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/CafCoreTypesXml/LoggingLevelCollectionXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/CafCoreTypesXml/LoggingLevelElemXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/CafCoreTypesXml/OperationXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/CafCoreTypesXml/ParameterCollectionXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/CafCoreTypesXml/PropertyCollectionXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/CafCoreTypesXml/PropertyXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/CafCoreTypesXml/ProtocolCollectionXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/CafCoreTypesXml/ProtocolXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/CafCoreTypesXml/RequestConfigXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/CafCoreTypesXml/RequestHeaderXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/CafCoreTypesXml/RequestInstanceParameterXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/CafCoreTypesXml/RequestParameterXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/CafCoreTypesXml/RequestXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/CafCoreTypesXml/StatisticsXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/CafInstallRequestXml/CafInstallRequestXmlRoots.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/CafInstallRequestXml/FullPackageElemXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/CafInstallRequestXml/GetInventoryJobXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/CafInstallRequestXml/InstallBatchXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/CafInstallRequestXml/InstallPackageSpecXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/CafInstallRequestXml/InstallProviderJobXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/CafInstallRequestXml/InstallProviderSpecXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/CafInstallRequestXml/InstallRequestXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/CafInstallRequestXml/MinPackageElemXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/CafInstallRequestXml/PackageDefnXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/CafInstallRequestXml/UninstallProviderJobXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/DiagRequestXml/DiagRequestXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/DiagRequestXml/DiagRequestXmlRoots.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/DiagTypesXml/DiagBatchXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/DiagTypesXml/DiagCollectInstancesXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/DiagTypesXml/DiagDeleteValueCollectionXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/DiagTypesXml/DiagDeleteValueXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/DiagTypesXml/DiagSetValueCollectionXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/DiagTypesXml/DiagSetValueXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/MgmtRequestXml/MgmtRequestXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/MgmtRequestXml/MgmtRequestXmlRoots.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/MgmtTypesXml/MgmtBatchXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/MgmtTypesXml/MgmtCollectInstancesCollectionXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/MgmtTypesXml/MgmtCollectInstancesXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/MgmtTypesXml/MgmtCollectSchemaXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/MgmtTypesXml/MgmtInvokeOperationCollectionXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/MgmtTypesXml/MgmtInvokeOperationXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/MultiPmeMgmtRequestXml/MultiPmeMgmtBatchCollectionXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/MultiPmeMgmtRequestXml/MultiPmeMgmtBatchXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/MultiPmeMgmtRequestXml/MultiPmeMgmtRequestXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/MultiPmeMgmtRequestXml/MultiPmeMgmtRequestXmlRoots.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/MultiPmeMgmtRequestXml/PmeIdCollectionXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/PayloadEnvelopeXml/PayloadEnvelopeXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/PayloadEnvelopeXml/PayloadEnvelopeXmlRoots.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/PersistenceXml/CertCollectionXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/PersistenceXml/CertPathCollectionXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/PersistenceXml/LocalSecurityXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/PersistenceXml/PersistenceProtocolCollectionXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/PersistenceXml/PersistenceProtocolXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/PersistenceXml/PersistenceXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/PersistenceXml/PersistenceXmlRoots.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/PersistenceXml/RemoteSecurityCollectionXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/PersistenceXml/RemoteSecurityXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/ProviderInfraXml/ClassCollectionXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/ProviderInfraXml/ProviderInfraXmlRoots.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/ProviderInfraXml/ProviderRegXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/ProviderInfraXml/SchemaSummaryXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/ProviderRequestXml/ProviderBatchXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/ProviderRequestXml/ProviderCollectInstancesCollectionXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/ProviderRequestXml/ProviderCollectInstancesXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/ProviderRequestXml/ProviderCollectSchemaRequestXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/ProviderRequestXml/ProviderInvokeOperationCollectionXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/ProviderRequestXml/ProviderInvokeOperationXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/ProviderRequestXml/ProviderRequestConfigXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/ProviderRequestXml/ProviderRequestHeaderXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/ProviderRequestXml/ProviderRequestXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/ProviderRequestXml/ProviderRequestXmlRoots.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/ProviderResultsXml/CdifXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/ProviderResultsXml/DefinitionObjectCollectionXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/ProviderResultsXml/ProviderResultsXmlRoots.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/ProviderResultsXml/RequestIdentifierXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/ProviderResultsXml/SchemaXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/ResponseXml/ErrorResponseXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/ResponseXml/EventKeyCollectionXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/ResponseXml/EventKeyXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/ResponseXml/EventManifestXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/ResponseXml/ManifestCollectionXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/ResponseXml/ManifestXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/ResponseXml/ProviderEventResponseXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/ResponseXml/ProviderResponseXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/ResponseXml/ResponseHeaderXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/ResponseXml/ResponseXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/ResponseXml/ResponseXmlRoots.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/SchemaTypesXml/ActionClassInstanceCollectionXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/SchemaTypesXml/ActionClassInstanceXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/SchemaTypesXml/ActionClassXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/SchemaTypesXml/ClassCardinalityXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/SchemaTypesXml/ClassFieldXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/SchemaTypesXml/ClassIdentifierXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/SchemaTypesXml/ClassInstancePropertyXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/SchemaTypesXml/ClassPropertyXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/SchemaTypesXml/CmdlMetadataXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/SchemaTypesXml/CmdlUnionXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/SchemaTypesXml/CollectMethodXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/SchemaTypesXml/DataClassInstanceCollectionXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/SchemaTypesXml/DataClassInstanceXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/SchemaTypesXml/DataClassPropertyXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/SchemaTypesXml/DataClassSubInstanceXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/SchemaTypesXml/DataClassXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/SchemaTypesXml/InstanceOperationCollectionXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/SchemaTypesXml/InstanceOperationXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/SchemaTypesXml/InstanceParameterXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/SchemaTypesXml/JoinTypeXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/SchemaTypesXml/LogicalRelationshipXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/SchemaTypesXml/MethodParameterXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/SchemaTypesXml/MethodXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/SchemaTypesXml/PhysicalRelationshipXml.cpp -libFramework_la_SOURCES += Framework/src/Doc/DocXml/SchemaTypesXml/RelationshipXml.cpp -libFramework_la_SOURCES += Framework/src/Exception/CBacktraceUtils.cpp -libFramework_la_SOURCES += Framework/src/Exception/CCafException.cpp -libFramework_la_SOURCES += Framework/src/Exception/CCafExceptionEx.cpp -libFramework_la_SOURCES += Framework/src/Exception/CValidate.cpp -libFramework_la_SOURCES += Framework/src/Integration/Caf/CBeanPropertiesHelper.cpp -libFramework_la_SOURCES += Framework/src/Integration/Caf/CCafMessageCreator.cpp -libFramework_la_SOURCES += Framework/src/Integration/Caf/CCafMessageHeaders.cpp -libFramework_la_SOURCES += Framework/src/Integration/Caf/CCafMessageHeadersWriter.cpp -libFramework_la_SOURCES += Framework/src/Integration/Caf/CCafMessagePayload.cpp -libFramework_la_SOURCES += Framework/src/Integration/Caf/CCafMessagePayloadParser.cpp -libFramework_la_SOURCES += Framework/src/Integration/Core/CAbstractMessageChannel.cpp -libFramework_la_SOURCES += Framework/src/Integration/Core/CAbstractMessageRouter.cpp -libFramework_la_SOURCES += Framework/src/Integration/Core/CAbstractPollableChannel.cpp -libFramework_la_SOURCES += Framework/src/Integration/Core/CBroadcastingDispatcher.cpp -libFramework_la_SOURCES += Framework/src/Integration/Core/CChannelInterceptorAdapter.cpp -libFramework_la_SOURCES += Framework/src/Integration/Core/CChannelResolver.cpp -libFramework_la_SOURCES += Framework/src/Integration/Core/CDocument.cpp -libFramework_la_SOURCES += Framework/src/Integration/Core/CErrorHandler.cpp -libFramework_la_SOURCES += Framework/src/Integration/Core/CExpressionHandler.cpp -libFramework_la_SOURCES += Framework/src/Integration/Core/CIntException.cpp -libFramework_la_SOURCES += Framework/src/Integration/Core/CIntMessage.cpp -libFramework_la_SOURCES += Framework/src/Integration/Core/CIntMessageHeaders.cpp -libFramework_la_SOURCES += Framework/src/Integration/Core/CIntegrationAppContext.cpp -libFramework_la_SOURCES += Framework/src/Integration/Core/CMessageHandler.cpp -libFramework_la_SOURCES += Framework/src/Integration/Core/CMessageHeaderUtils.cpp -libFramework_la_SOURCES += Framework/src/Integration/Core/CMessagingTemplate.cpp -libFramework_la_SOURCES += Framework/src/Integration/Core/CMessagingTemplateHandler.cpp -libFramework_la_SOURCES += Framework/src/Integration/Core/CSimpleAsyncTaskExecutor.cpp -libFramework_la_SOURCES += Framework/src/Integration/Core/CSimpleAsyncTaskExecutorState.cpp -libFramework_la_SOURCES += Framework/src/Integration/Core/CSourcePollingChannelAdapter.cpp -libFramework_la_SOURCES += Framework/src/Integration/Core/CUnicastingDispatcher.cpp -libFramework_la_SOURCES += Framework/src/Integration/Core/FileHeaders.cpp -libFramework_la_SOURCES += Framework/src/Integration/Core/MessageHeaders.cpp -libFramework_la_SOURCES += Framework/src/Logging/CLogger.cpp -libFramework_la_SOURCES += Framework/src/PlatformIID.cpp -libFramework_la_SOURCES += Framework/src/PlatformStringFunc.cpp -libFramework_la_SOURCES += Framework/src/SubSystemBase/CEcmDllManager.cpp -libFramework_la_SOURCES += Framework/src/SubSystemBase/CEcmSubSystem.cpp -libFramework_la_SOURCES += Framework/src/SubSystemBase/CEcmSubSystemModule.cpp -libFramework_la_SOURCES += Framework/src/SubSystemBase/CEcmSubSystemRegistry.cpp -libFramework_la_SOURCES += Framework/src/SubSystemBase/EcmSubSystemBase.cpp -libFramework_la_SOURCES += Framework/src/Xml/MarkupParser/CMarkupParser.cpp -libFramework_la_SOURCES += Framework/src/Xml/XmlUtils/CXmlElement.cpp -libFramework_la_SOURCES += Framework/src/Xml/XmlUtils/CXmlUtils.cpp - -libFramework_la_CPPFLAGS = -libFramework_la_CPPFLAGS += @GLIB2_CPPFLAGS@ -libFramework_la_CPPFLAGS += @LOG4CPP_CPPFLAGS@ - -libFramework_la_CPPFLAGS += -I$(top_srcdir)/common-agent/Cpp/Framework/Framework/include -libFramework_la_LIBADD = -libFramework_la_LIBADD += @GLIB2_LIBS@ -libFramework_la_LIBADD += @LOG4CPP_LIBS@ -libFramework_la_LIBADD += -ldl - -libFramework_la_LDFLAGS = -shared - -subsys_LTLIBRARIES += libIntegrationSubsys.la -libIntegrationSubsys_la_LDFLAGS = @CAF_SUBSYS_LDFLAGS@ - -libIntegrationSubsys_la_SOURCES= -libIntegrationSubsys_la_SOURCES += Subsystems/Integration/src/CDirectChannelInstance.cpp -libIntegrationSubsys_la_SOURCES += Subsystems/Integration/src/CErrorChannel.cpp -libIntegrationSubsys_la_SOURCES += Subsystems/Integration/src/CErrorChannelInstance.cpp -libIntegrationSubsys_la_SOURCES += Subsystems/Integration/src/CFileInboundChannelAdapterInstance.cpp -libIntegrationSubsys_la_SOURCES += Subsystems/Integration/src/CFileOutboundChannelAdapterInstance.cpp -libIntegrationSubsys_la_SOURCES += Subsystems/Integration/src/CFileReadingMessageSource.cpp -libIntegrationSubsys_la_SOURCES += Subsystems/Integration/src/CFileToStringTransformerInstance.cpp -libIntegrationSubsys_la_SOURCES += Subsystems/Integration/src/CHeaderEnricherTransformerInstance.cpp -libIntegrationSubsys_la_SOURCES += Subsystems/Integration/src/CHeaderExpressionInvoker.cpp -libIntegrationSubsys_la_SOURCES += Subsystems/Integration/src/CHeaderValueRouterInstance.cpp -libIntegrationSubsys_la_SOURCES += Subsystems/Integration/src/CIntegrationObjectFactory.cpp -libIntegrationSubsys_la_SOURCES += Subsystems/Integration/src/CLoggingChannelAdapterInstance.cpp -libIntegrationSubsys_la_SOURCES += Subsystems/Integration/src/CMessageHandlerChainInstance.cpp -libIntegrationSubsys_la_SOURCES += Subsystems/Integration/src/CNullChannel.cpp -libIntegrationSubsys_la_SOURCES += Subsystems/Integration/src/CNullChannelInstance.cpp -libIntegrationSubsys_la_SOURCES += Subsystems/Integration/src/CObjectFactoryTables.cpp -libIntegrationSubsys_la_SOURCES += Subsystems/Integration/src/CPayloadContentRouterInstance.cpp -libIntegrationSubsys_la_SOURCES += Subsystems/Integration/src/CPublishSubscribeChannelInstance.cpp -libIntegrationSubsys_la_SOURCES += Subsystems/Integration/src/CQueueChannelInstance.cpp -libIntegrationSubsys_la_SOURCES += Subsystems/Integration/src/CRecipientListRouterInstance.cpp -libIntegrationSubsys_la_SOURCES += Subsystems/Integration/src/CRouterInstance.cpp -libIntegrationSubsys_la_SOURCES += Subsystems/Integration/src/CServiceActivatorInstance.cpp -libIntegrationSubsys_la_SOURCES += Subsystems/Integration/src/CWireTapInstance.cpp -libIntegrationSubsys_la_SOURCES += Subsystems/Integration/src/CXPathHeaderEnricherItem.cpp -libIntegrationSubsys_la_SOURCES += Subsystems/Integration/src/CXPathHeaderEnricherTransformerInstance.cpp -libIntegrationSubsys_la_SOURCES += Subsystems/Integration/src/Integration.cpp - -libIntegrationSubsys_la_CPPFLAGS = -libIntegrationSubsys_la_CPPFLAGS += @GLIB2_CPPFLAGS@ -libIntegrationSubsys_la_CPPFLAGS += @LOG4CPP_CPPFLAGS@ - -libIntegrationSubsys_la_CPPFLAGS += -I$(top_srcdir)/common-agent/Cpp/Framework/Framework/include -libIntegrationSubsys_la_CPPFLAGS += -I$(top_srcdir)/common-agent/Cpp/Framework/Subsystems/Integration/include -libIntegrationSubsys_la_LIBADD = -libIntegrationSubsys_la_LIBADD += @GLIB2_LIBS@ -libIntegrationSubsys_la_LIBADD += @LOG4CPP_LIBS@ -libIntegrationSubsys_la_LIBADD += -ldl -libIntegrationSubsys_la_LIBADD += ../Framework/libFramework.la - -libIntegrationSubsys_la_LDFLAGS += -shared - -subsys_LTLIBRARIES += libCafIntegrationSubsys.la -libCafIntegrationSubsys_la_LDFLAGS = @CAF_SUBSYS_LDFLAGS@ - -libCafIntegrationSubsys_la_SOURCES= -libCafIntegrationSubsys_la_SOURCES += Subsystems/CafIntegration/src/CEnvelopeToPayloadTransformer.cpp -libCafIntegrationSubsys_la_SOURCES += Subsystems/CafIntegration/src/CEnvelopeToPayloadTransformerInstance.cpp -libCafIntegrationSubsys_la_SOURCES += Subsystems/CafIntegration/src/CErrorToResponseTransformer.cpp -libCafIntegrationSubsys_la_SOURCES += Subsystems/CafIntegration/src/CErrorToResponseTransformerInstance.cpp -libCafIntegrationSubsys_la_SOURCES += Subsystems/CafIntegration/src/CPayloadHeaderEnricher.cpp -libCafIntegrationSubsys_la_SOURCES += Subsystems/CafIntegration/src/CPayloadHeaderEnricherInstance.cpp -libCafIntegrationSubsys_la_SOURCES += Subsystems/CafIntegration/src/CafIntegration.cpp - -libCafIntegrationSubsys_la_CPPFLAGS = -libCafIntegrationSubsys_la_CPPFLAGS += @GLIB2_CPPFLAGS@ -libCafIntegrationSubsys_la_CPPFLAGS += @LOG4CPP_CPPFLAGS@ - -libCafIntegrationSubsys_la_CPPFLAGS += -I$(top_srcdir)/common-agent/Cpp/Framework/Framework/include -libCafIntegrationSubsys_la_CPPFLAGS += -I$(top_srcdir)/common-agent/Cpp/Framework/Subsystems/CafIntegration/include -libCafIntegrationSubsys_la_LIBADD = -libCafIntegrationSubsys_la_LIBADD += @GLIB2_LIBS@ -libCafIntegrationSubsys_la_LIBADD += @LOG4CPP_LIBS@ -libCafIntegrationSubsys_la_LIBADD += -ldl -libCafIntegrationSubsys_la_LIBADD += ../Framework/libFramework.la - -libCafIntegrationSubsys_la_LDFLAGS += -shared diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/CafIntegration/include/CEnvelopeToPayloadTransformerInstance.h b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/CafIntegration/include/CEnvelopeToPayloadTransformerInstance.h deleted file mode 100644 index f4e14ac06..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/CafIntegration/include/CEnvelopeToPayloadTransformerInstance.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CEnvelopeToPayloadTransformerInstance_h_ -#define CEnvelopeToPayloadTransformerInstance_h_ - -#include "Common/IAppContext.h" -#include "CafIntegrationSubsys.h" -#include "Doc/CafCoreTypesDoc/CAttachmentDoc.h" -#include "Memory/DynamicArray/DynamicArrayInc.h" - -#include "Integration/IErrorProcessor.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "Integration/IIntegrationComponentInstance.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/ITransformer.h" - -namespace Caf { - -class CEnvelopeToPayloadTransformerInstance : - public TCafSubSystemObjectRoot, - public IIntegrationObject, - public IIntegrationComponentInstance, - public ITransformer, - public IErrorProcessor { -public: - struct SExpandedFileAlias { - std::string _filePath; - std::string _encoding; - }; - CAF_DECLARE_SMART_POINTER(SExpandedFileAlias); - -public: - CEnvelopeToPayloadTransformerInstance(); - virtual ~CEnvelopeToPayloadTransformerInstance(); - - CAF_DECLARE_OBJECT_IDENTIFIER(_sObjIdEnvelopeToPayloadTransformerInstance) - - CAF_BEGIN_INTERFACE_MAP(CEnvelopeToPayloadTransformerInstance) - CAF_INTERFACE_ENTRY(IIntegrationObject) - CAF_INTERFACE_ENTRY(IIntegrationComponentInstance) - CAF_INTERFACE_ENTRY(ITransformer) - CAF_INTERFACE_ENTRY(IErrorProcessor) - CAF_END_INTERFACE_MAP() - -public: // IIntegrationObject - void initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection); - - std::string getId() const; - -public: // IIntegrationComponentInstance - void wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver); - -public: // ITransformer - SmartPtrIIntMessage transformMessage( - const SmartPtrIIntMessage& message); - -public: // IErrorProcessor - SmartPtrIIntMessage processErrorMessage( - const SmartPtrIIntMessage& message); - -private: - SmartPtrCDynamicByteArray findPayload( - const std::deque& attachmentCollection) const; - - std::deque removePayload( - const std::deque& attachmentCollection) const; - -private: - bool _isInitialized; - std::string _id; - -private: - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(CEnvelopeToPayloadTransformerInstance); -}; - -} - -#endif // #ifndef CEnvelopeToPayloadTransformerInstance_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/CafIntegration/include/CafIntegrationSubsys.h b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/CafIntegration/include/CafIntegrationSubsys.h deleted file mode 100644 index 39ff668fb..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/CafIntegration/include/CafIntegrationSubsys.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CafIntegrationSubsys_h_ -#define CafIntegrationSubsys_h_ - -namespace Caf { - extern const char* _sObjIdErrorToResponseTransformerInstance; - extern const char* _sObjIdErrorToResponseTransformer; - extern const char* _sObjIdPayloadHeaderEnricherInstance; - extern const char* _sObjIdPayloadHeaderEnricher; - extern const char* _sObjIdEnvelopeToPayloadTransformerInstance; - extern const char* _sObjIdEnvelopeToPayloadTransformer; -} - -#endif // #ifndef CafIntegrationSubsys_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/CafIntegration/src/CEnvelopeToPayloadTransformer.cpp b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/CafIntegration/src/CEnvelopeToPayloadTransformer.cpp deleted file mode 100644 index cc010ab48..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/CafIntegration/src/CEnvelopeToPayloadTransformer.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Integration/IDocument.h" -#include "Integration/IIntegrationObject.h" -#include "CEnvelopeToPayloadTransformer.h" - -using namespace Caf; - -CEnvelopeToPayloadTransformer::CEnvelopeToPayloadTransformer() : - _isInitialized(false), - CAF_CM_INIT("CEnvelopeToPayloadTransformer") { -} - -CEnvelopeToPayloadTransformer::~CEnvelopeToPayloadTransformer() { -} - -void CEnvelopeToPayloadTransformer::initializeBean( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties) { - CAF_CM_FUNCNAME_VALIDATE("initializeBean"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STL_EMPTY(ctorArgs); - CAF_CM_VALIDATE_STL_EMPTY(properties); - - _ctorArgs = ctorArgs; - _properties = properties; - - initialize(); -} - -void CEnvelopeToPayloadTransformer::terminateBean() { -} - -void CEnvelopeToPayloadTransformer::initialize() { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - - _isInitialized = true; -} - -bool CEnvelopeToPayloadTransformer::isResponsible( - const SmartPtrIDocument& configSection) const { - CAF_CM_FUNCNAME_VALIDATE("isResponsible"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - - return false; -} - -SmartPtrIIntegrationObject CEnvelopeToPayloadTransformer::createObject( - const SmartPtrIDocument& configSection) const { - CAF_CM_FUNCNAME_VALIDATE("createObject"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - - SmartPtrIIntegrationObject rc; - rc.CreateInstance(_sObjIdEnvelopeToPayloadTransformerInstance); - rc->initialize(_ctorArgs, _properties, configSection); - - return rc; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/CafIntegration/src/CEnvelopeToPayloadTransformer.h b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/CafIntegration/src/CEnvelopeToPayloadTransformer.h deleted file mode 100644 index e525d8fc8..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/CafIntegration/src/CEnvelopeToPayloadTransformer.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CEnvelopeToPayloadTransformer_h_ -#define CEnvelopeToPayloadTransformer_h_ - - -#include "IBean.h" - -#include "Integration/IDocument.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/IIntegrationComponent.h" - -namespace Caf { - -/// Sends responses/errors back to the client. -class CEnvelopeToPayloadTransformer : - public TCafSubSystemObjectRoot, - public IBean, - public IIntegrationComponent { -public: - CEnvelopeToPayloadTransformer(); - virtual ~CEnvelopeToPayloadTransformer(); - - CAF_DECLARE_OBJECT_IDENTIFIER(_sObjIdEnvelopeToPayloadTransformer) - - CAF_BEGIN_INTERFACE_MAP(CEnvelopeToPayloadTransformer) - CAF_INTERFACE_ENTRY(IBean) - CAF_INTERFACE_ENTRY(IIntegrationComponent) - CAF_END_INTERFACE_MAP() - -public: - virtual void initialize(); - -public: // IBean - virtual void initializeBean(const IBean::Cargs& ctorArgs, const IBean::Cprops& properties); - - virtual void terminateBean(); - -public: // IIntegrationComponent - bool isResponsible( - const SmartPtrIDocument& configSection) const; - - SmartPtrIIntegrationObject createObject( - const SmartPtrIDocument& configSection) const; - -private: - bool _isInitialized; - IBean::Cargs _ctorArgs; - IBean::Cprops _properties; - -private: - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(CEnvelopeToPayloadTransformer); -}; - -} - -#endif // #ifndef CEnvelopeToPayloadTransformer_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/CafIntegration/src/CEnvelopeToPayloadTransformerInstance.cpp b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/CafIntegration/src/CEnvelopeToPayloadTransformerInstance.cpp deleted file mode 100644 index dbdae1803..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/CafIntegration/src/CEnvelopeToPayloadTransformerInstance.cpp +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Common/IAppContext.h" -#include "Doc/CafCoreTypesDoc/CAttachmentDoc.h" -#include "Doc/PayloadEnvelopeDoc/CPayloadEnvelopeDoc.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "Memory/DynamicArray/DynamicArrayInc.h" -#include "CEnvelopeToPayloadTransformerInstance.h" -#include "Exception/CCafException.h" -#include "Integration/Caf/CCafMessagePayloadParser.h" -#include "Integration/Caf/CCafMessageCreator.h" - -using namespace Caf; - -CEnvelopeToPayloadTransformerInstance::CEnvelopeToPayloadTransformerInstance() : - _isInitialized(false), - CAF_CM_INIT("CEnvelopeToPayloadTransformerInstance") { -} - -CEnvelopeToPayloadTransformerInstance::~CEnvelopeToPayloadTransformerInstance() { -} - -void CEnvelopeToPayloadTransformerInstance::initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - - _id = configSection->findRequiredAttribute("id"); - _isInitialized = true; -} - -std::string CEnvelopeToPayloadTransformerInstance::getId() const { - CAF_CM_FUNCNAME_VALIDATE("getId"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _id; -} - -void CEnvelopeToPayloadTransformerInstance::wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver) { - CAF_CM_FUNCNAME_VALIDATE("wire"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(appContext); - CAF_CM_VALIDATE_INTERFACE(channelResolver); -} - -SmartPtrIIntMessage CEnvelopeToPayloadTransformerInstance::transformMessage( - const SmartPtrIIntMessage& message) { - CAF_CM_FUNCNAME_VALIDATE("transformMessage"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - const SmartPtrCPayloadEnvelopeDoc payloadEnvelope = - CCafMessagePayloadParser::getPayloadEnvelope(message->getPayload()); - - const std::deque attachmentCollection = - payloadEnvelope->getAttachmentCollection()->getAttachment(); - - const SmartPtrCDynamicByteArray payload= findPayload(attachmentCollection); - const std::deque attachmentCollectionRm = - removePayload(attachmentCollection); - - return CCafMessageCreator::create( - payload, attachmentCollectionRm, message->getHeaders()); -} - -SmartPtrIIntMessage CEnvelopeToPayloadTransformerInstance::processErrorMessage( - const SmartPtrIIntMessage& message) { - return transformMessage(message); -} - -SmartPtrCDynamicByteArray CEnvelopeToPayloadTransformerInstance::findPayload( - const std::deque& attachmentCollection) const { - CAF_CM_FUNCNAME("findPayload"); - CAF_CM_VALIDATE_STL(attachmentCollection); - - std::string payloadPath; - for (TConstIterator > attachmentIter(attachmentCollection); - attachmentIter; attachmentIter++) { - const SmartPtrCAttachmentDoc attachment = *attachmentIter; - - if (attachment->getName().compare("_EnvelopePayload_") == 0) { - UriUtils::SUriRecord sourceUriRecord; - UriUtils::parseUriString(attachment->getUri(), sourceUriRecord); - - if (sourceUriRecord.protocol.compare("file") != 0) { - CAF_CM_EXCEPTION_VA1(ERROR_INVALID_STATE, - "Payload attachment must be a file - uri: %s", - attachment->getUri().c_str()); - } - - UriUtils::SFileUriRecord sourceFileUriRecord; - UriUtils::parseFileAddress(sourceUriRecord.address, sourceFileUriRecord); - payloadPath = sourceFileUriRecord.path; - - if (!FileSystemUtils::doesFileExist(payloadPath)) { - CAF_CM_EXCEPTION_VA1(ERROR_FILE_NOT_FOUND, - "File not found - %s", payloadPath.c_str()); - } - } - } - - if (payloadPath.empty()) { - CAF_CM_EXCEPTION_VA0(ERROR_NOT_FOUND, "Payload attachment not found"); - } - - return FileSystemUtils::loadByteFile(payloadPath); -} - -std::deque CEnvelopeToPayloadTransformerInstance::removePayload( - const std::deque& attachmentCollection) const { - CAF_CM_FUNCNAME_VALIDATE("removePayload"); - CAF_CM_VALIDATE_STL(attachmentCollection); - - std::deque rc; - for (TConstIterator > attachmentIter(attachmentCollection); - attachmentIter; attachmentIter++) { - const SmartPtrCAttachmentDoc attachment = *attachmentIter; - - if (attachment->getName().compare("_EnvelopePayload_") != 0) { - rc.push_back(attachment); - } - } - - return rc; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/CafIntegration/src/CErrorToResponseTransformer.cpp b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/CafIntegration/src/CErrorToResponseTransformer.cpp deleted file mode 100644 index 0b7e01be9..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/CafIntegration/src/CErrorToResponseTransformer.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Integration/IDocument.h" -#include "Integration/IIntegrationObject.h" -#include "CErrorToResponseTransformer.h" - -using namespace Caf; - -CErrorToResponseTransformer::CErrorToResponseTransformer() : - _isInitialized(false), - CAF_CM_INIT("CErrorToResponseTransformer") { -} - -CErrorToResponseTransformer::~CErrorToResponseTransformer() { -} - -void CErrorToResponseTransformer::initializeBean( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties) { - - CAF_CM_FUNCNAME_VALIDATE("initializeBean"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STL_EMPTY(ctorArgs); - CAF_CM_VALIDATE_STL_EMPTY(properties); - _ctorArgs = ctorArgs; - _properties = properties; - initialize(); - } - CAF_CM_EXIT; -} - -void CErrorToResponseTransformer::terminateBean() { -} - -void CErrorToResponseTransformer::initialize() { - - CAF_CM_FUNCNAME_VALIDATE("initialize"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - _isInitialized = true; - } - CAF_CM_EXIT; -} - -bool CErrorToResponseTransformer::isResponsible( - const SmartPtrIDocument& configSection) const { - CAF_CM_FUNCNAME_VALIDATE("isResponsible"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - } - CAF_CM_EXIT; - - return false; -} - -SmartPtrIIntegrationObject CErrorToResponseTransformer::createObject( - const SmartPtrIDocument& configSection) const { - CAF_CM_FUNCNAME_VALIDATE("createObject"); - - SmartPtrIIntegrationObject rc; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - - rc.CreateInstance(_sObjIdErrorToResponseTransformerInstance); - rc->initialize(_ctorArgs, _properties, configSection); - } - CAF_CM_EXIT; - - return rc; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/CafIntegration/src/CErrorToResponseTransformer.h b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/CafIntegration/src/CErrorToResponseTransformer.h deleted file mode 100644 index 13dffa9e8..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/CafIntegration/src/CErrorToResponseTransformer.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CErrorToResponseTransformer_h_ -#define CErrorToResponseTransformer_h_ - - -#include "IBean.h" - -#include "Integration/IDocument.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/IIntegrationComponent.h" - -namespace Caf { - -/// Sends responses/errors back to the client. -class CErrorToResponseTransformer : - public TCafSubSystemObjectRoot, - public IBean, - public IIntegrationComponent { -public: - CErrorToResponseTransformer(); - virtual ~CErrorToResponseTransformer(); - - CAF_DECLARE_OBJECT_IDENTIFIER(_sObjIdErrorToResponseTransformer) - - CAF_BEGIN_INTERFACE_MAP(CErrorToResponseTransformer) - CAF_INTERFACE_ENTRY(IBean) - CAF_INTERFACE_ENTRY(IIntegrationComponent) - CAF_END_INTERFACE_MAP() - -public: - virtual void initialize(); - -public: // IBean - virtual void initializeBean(const IBean::Cargs& ctorArgs, const IBean::Cprops& properties); - - virtual void terminateBean(); - -public: // IIntegrationComponent - bool isResponsible( - const SmartPtrIDocument& configSection) const; - - SmartPtrIIntegrationObject createObject( - const SmartPtrIDocument& configSection) const; - -private: - bool _isInitialized; - IBean::Cargs _ctorArgs; - IBean::Cprops _properties; - -private: - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(CErrorToResponseTransformer); -}; - -} - -#endif // #ifndef CErrorToResponseTransformer_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/CafIntegration/src/CErrorToResponseTransformerInstance.cpp b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/CafIntegration/src/CErrorToResponseTransformerInstance.cpp deleted file mode 100644 index a894d3a77..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/CafIntegration/src/CErrorToResponseTransformerInstance.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Integration/Caf/CCafMessageHeaders.h" -#include "Common/IAppContext.h" -#include "Doc/ResponseDoc/CErrorResponseDoc.h" -#include "Doc/ResponseDoc/CResponseHeaderDoc.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "CErrorToResponseTransformerInstance.h" -#include "Integration/Caf/CCafMessageCreator.h" - -using namespace Caf; - -CErrorToResponseTransformerInstance::CErrorToResponseTransformerInstance() : - _isInitialized(false), - CAF_CM_INIT_LOG("CErrorToResponseTransformerInstance") { -} - -CErrorToResponseTransformerInstance::~CErrorToResponseTransformerInstance() { -} - -void CErrorToResponseTransformerInstance::initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection) { - - CAF_CM_FUNCNAME_VALIDATE("initialize"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - - _id = configSection->findRequiredAttribute("id"); - - _isInitialized = true; - } - CAF_CM_EXIT; -} - -std::string CErrorToResponseTransformerInstance::getId() const { - CAF_CM_FUNCNAME_VALIDATE("getId"); - - std::string rc; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - rc = _id; - } - CAF_CM_EXIT; - - return rc; -} - -void CErrorToResponseTransformerInstance::wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver) { - CAF_CM_FUNCNAME_VALIDATE("wire"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(appContext); - CAF_CM_VALIDATE_INTERFACE(channelResolver); - - } - CAF_CM_EXIT; -} - -SmartPtrIIntMessage CErrorToResponseTransformerInstance::processErrorMessage( - const SmartPtrIIntMessage& message) { - CAF_CM_FUNCNAME("processErrorMessage"); - - SmartPtrIIntMessage newMessage; - - try { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - CAF_CM_LOG_DEBUG_VA1("Called - %s", _id.c_str()); - - const SmartPtrCCafMessageHeaders cafMessageHeaders = - CCafMessageHeaders::create(message->getHeaders()); - - const std::string errorMessage = message->getPayloadStr(); - const UUID clientId = cafMessageHeaders->getClientIdOpt(); - const UUID requestId = cafMessageHeaders->getRequestIdOpt(); - const std::string pmeIdStr = cafMessageHeaders->getPmeIdOpt(); - const UUID sessionId = cafMessageHeaders->getSessionIdOpt(); - - const std::string version = "1.0"; - const std::string createdDateTime = CDateTimeUtils::getCurrentDateTime(); - const uint32 sequenceNumber = 0; - const bool isFinalResponse = true; - - SmartPtrCResponseHeaderDoc responseHeader; - responseHeader.CreateInstance(); - responseHeader->initialize( - version, - createdDateTime, - sequenceNumber, - isFinalResponse, - sessionId); - - SmartPtrCErrorResponseDoc errorResponse; - errorResponse.CreateInstance(); - errorResponse->initialize( - clientId, - requestId, - pmeIdStr, - responseHeader, - errorMessage); - - const std::string randomUuidStr = CStringUtils::createRandomUuid(); - const std::string relFilename = randomUuidStr + "_" + _sErrorResponseFilename; - - newMessage = CCafMessageCreator::createPayloadEnvelope( - errorResponse, relFilename, message->getHeaders()); - - // Writing the error response for debugging purposes - const std::string tmpDir = AppConfigUtils::getRequiredString(_sConfigTmpDir); - FileSystemUtils::saveTextFile(tmpDir, _sErrorResponseFilename, - newMessage->getPayloadStr()); - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_CLEAREXCEPTION; - - return newMessage; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/CafIntegration/src/CErrorToResponseTransformerInstance.h b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/CafIntegration/src/CErrorToResponseTransformerInstance.h deleted file mode 100644 index 072d52af2..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/CafIntegration/src/CErrorToResponseTransformerInstance.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CErrorToResponseTransformerInstance_h_ -#define CErrorToResponseTransformerInstance_h_ - -#include "CafIntegrationSubsys.h" -#include "Common/IAppContext.h" -#include "Integration/IErrorProcessor.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "Integration/IIntegrationComponentInstance.h" -#include "Integration/IIntegrationObject.h" - -namespace Caf { - -class CErrorToResponseTransformerInstance : - public TCafSubSystemObjectRoot, - public IIntegrationObject, - public IIntegrationComponentInstance, - public IErrorProcessor { -public: - CErrorToResponseTransformerInstance(); - virtual ~CErrorToResponseTransformerInstance(); - - CAF_DECLARE_OBJECT_IDENTIFIER(_sObjIdErrorToResponseTransformerInstance) - - CAF_BEGIN_INTERFACE_MAP(CErrorToResponseTransformerInstance) - CAF_INTERFACE_ENTRY(IIntegrationObject) - CAF_INTERFACE_ENTRY(IIntegrationComponentInstance) - CAF_INTERFACE_ENTRY(IErrorProcessor) - CAF_END_INTERFACE_MAP() - -public: // IIntegrationObject - void initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection); - - std::string getId() const; - -public: // IIntegrationComponentInstance - void wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver); - -public: // IErrorProcessor - SmartPtrIIntMessage processErrorMessage( - const SmartPtrIIntMessage& message); - -private: - bool _isInitialized; - std::string _id; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CErrorToResponseTransformerInstance); -}; - -} - -#endif // #ifndef CErrorToResponseTransformerInstance_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/CafIntegration/src/CPayloadHeaderEnricher.cpp b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/CafIntegration/src/CPayloadHeaderEnricher.cpp deleted file mode 100644 index 548b13e11..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/CafIntegration/src/CPayloadHeaderEnricher.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Integration/IDocument.h" -#include "Integration/IIntegrationObject.h" -#include "CPayloadHeaderEnricher.h" - -using namespace Caf; - -CPayloadHeaderEnricher::CPayloadHeaderEnricher() : - _isInitialized(false), - CAF_CM_INIT("CPayloadHeaderEnricher") { -} - -CPayloadHeaderEnricher::~CPayloadHeaderEnricher() { -} - -void CPayloadHeaderEnricher::initializeBean( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties) { - - CAF_CM_FUNCNAME_VALIDATE("initializeBean"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STL_EMPTY(ctorArgs); - - _ctorArgs = ctorArgs; - _properties = properties; - - initialize(); - } - CAF_CM_EXIT; -} - -void CPayloadHeaderEnricher::terminateBean() { -} - -void CPayloadHeaderEnricher::initialize() { - - CAF_CM_FUNCNAME_VALIDATE("initialize"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - _isInitialized = true; - } - CAF_CM_EXIT; -} - -bool CPayloadHeaderEnricher::isResponsible( - const SmartPtrIDocument& configSection) const { - CAF_CM_FUNCNAME_VALIDATE("isResponsible"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - } - CAF_CM_EXIT; - - return false; -} - -SmartPtrIIntegrationObject CPayloadHeaderEnricher::createObject( - const SmartPtrIDocument& configSection) const { - CAF_CM_FUNCNAME_VALIDATE("createObject"); - - SmartPtrIIntegrationObject rc; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - - rc.CreateInstance(_sObjIdPayloadHeaderEnricherInstance); - rc->initialize(_ctorArgs, _properties, configSection); - } - CAF_CM_EXIT; - - return rc; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/CafIntegration/src/CPayloadHeaderEnricher.h b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/CafIntegration/src/CPayloadHeaderEnricher.h deleted file mode 100644 index d988c0d2e..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/CafIntegration/src/CPayloadHeaderEnricher.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CPayloadHeaderEnricher_h_ -#define CPayloadHeaderEnricher_h_ - - -#include "IBean.h" - -#include "Integration/IDocument.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/IIntegrationComponent.h" - -namespace Caf { - -/// Sends responses/errors back to the client. -class CPayloadHeaderEnricher : - public TCafSubSystemObjectRoot, - public IBean, - public IIntegrationComponent { -public: - CPayloadHeaderEnricher(); - virtual ~CPayloadHeaderEnricher(); - - CAF_DECLARE_OBJECT_IDENTIFIER(_sObjIdPayloadHeaderEnricher) - - CAF_BEGIN_INTERFACE_MAP(CPayloadHeaderEnricher) - CAF_INTERFACE_ENTRY(IBean) - CAF_INTERFACE_ENTRY(IIntegrationComponent) - CAF_END_INTERFACE_MAP() - -public: - virtual void initialize(); - -public: // IBean - virtual void initializeBean( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties); - - virtual void terminateBean(); - -public: // IIntegrationComponent - bool isResponsible( - const SmartPtrIDocument& configSection) const; - - SmartPtrIIntegrationObject createObject( - const SmartPtrIDocument& configSection) const; - -private: - bool _isInitialized; - IBean::Cargs _ctorArgs; - IBean::Cprops _properties; - -private: - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(CPayloadHeaderEnricher); -}; - -} - -#endif // #ifndef CPayloadHeaderEnricher_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/CafIntegration/src/CPayloadHeaderEnricherInstance.cpp b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/CafIntegration/src/CPayloadHeaderEnricherInstance.cpp deleted file mode 100644 index 474470991..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/CafIntegration/src/CPayloadHeaderEnricherInstance.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Integration/Caf/CBeanPropertiesHelper.h" -#include "Integration/Caf/CCafMessageHeadersWriter.h" -#include "Common/IAppContext.h" -#include "Doc/PayloadEnvelopeDoc/CPayloadEnvelopeDoc.h" -#include "Integration/Core/CIntMessage.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "CPayloadHeaderEnricherInstance.h" -#include "Integration/Caf/CCafMessagePayloadParser.h" - -using namespace Caf; - -CPayloadHeaderEnricherInstance::CPayloadHeaderEnricherInstance() : - _isInitialized(false), - _includeFilename(false), - CAF_CM_INIT_LOG("CPayloadHeaderEnricherInstance") { -} - -CPayloadHeaderEnricherInstance::~CPayloadHeaderEnricherInstance() { -} - -void CPayloadHeaderEnricherInstance::initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - - _id = configSection->findRequiredAttribute("id"); - - const SmartPtrCBeanPropertiesHelper beanProperties = - CBeanPropertiesHelper::create(properties); - _includeFilename = beanProperties->getOptionalBool("includeFilename", true); - - _isInitialized = true; -} - -std::string CPayloadHeaderEnricherInstance::getId() const { - CAF_CM_FUNCNAME_VALIDATE("getId"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _id; -} - -void CPayloadHeaderEnricherInstance::wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver) { - CAF_CM_FUNCNAME_VALIDATE("wire"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(appContext); - CAF_CM_VALIDATE_INTERFACE(channelResolver); -} - -SmartPtrIIntMessage CPayloadHeaderEnricherInstance::transformMessage( - const SmartPtrIIntMessage& message) { - CAF_CM_FUNCNAME_VALIDATE("transformMessage"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - const SmartPtrCPayloadEnvelopeDoc payloadEnvelope = - CCafMessagePayloadParser::getPayloadEnvelope(message->getPayload()); - - const std::string payloadType = payloadEnvelope->getPayloadType(); - const std::string clientIdStr = - BasePlatform::UuidToString(payloadEnvelope->getClientId()); - const std::string requestIdStr = - BasePlatform::UuidToString(payloadEnvelope->getRequestId()); - const std::string pmeIdStr = payloadEnvelope->getPmeId(); - const std::string version = payloadEnvelope->getVersion(); - const std::string payloadVersion = payloadEnvelope->getPayloadVersion(); - - SmartPtrCCafMessageHeadersWriter messageHeadersWriter = - CCafMessageHeadersWriter::create(); - messageHeadersWriter->setPayloadType(payloadType); - messageHeadersWriter->setClientId(clientIdStr); - messageHeadersWriter->setRequestId(requestIdStr); - messageHeadersWriter->setPmeId(pmeIdStr); - messageHeadersWriter->setVersion(version); - messageHeadersWriter->setPayloadVersion(payloadVersion); - - if (_includeFilename) { - std::string relFilename = FileSystemUtils::buildPath( - clientIdStr, requestIdStr, pmeIdStr); - relFilename = FileSystemUtils::buildPath(relFilename, _sPayloadRequestFilename); - - messageHeadersWriter->setRelFilename(relFilename); - - CAF_CM_LOG_DEBUG_VA2( - "Enhanced the headers - payloadType: \"%s\", filename: \"%s\"", - payloadType.c_str(), relFilename.c_str()); - } - - SmartPtrCIntMessage messageImpl; - messageImpl.CreateInstance(); - messageImpl->initialize(message->getPayload(), - messageHeadersWriter->getHeaders(), message->getHeaders()); - - return messageImpl; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/CafIntegration/src/CPayloadHeaderEnricherInstance.h b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/CafIntegration/src/CPayloadHeaderEnricherInstance.h deleted file mode 100644 index 14f0b57ac..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/CafIntegration/src/CPayloadHeaderEnricherInstance.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CPayloadHeaderEnricherInstance_h_ -#define CPayloadHeaderEnricherInstance_h_ - - -#include "Integration/IIntegrationComponentInstance.h" - -#include "Common/IAppContext.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/ITransformer.h" - -namespace Caf { - -class CPayloadHeaderEnricherInstance : - public TCafSubSystemObjectRoot, - public IIntegrationObject, - public IIntegrationComponentInstance, - public ITransformer { -public: - CPayloadHeaderEnricherInstance(); - virtual ~CPayloadHeaderEnricherInstance(); - - CAF_DECLARE_OBJECT_IDENTIFIER(_sObjIdPayloadHeaderEnricherInstance) - - CAF_BEGIN_INTERFACE_MAP(CPayloadHeaderEnricherInstance) - CAF_INTERFACE_ENTRY(IIntegrationObject) - CAF_INTERFACE_ENTRY(IIntegrationComponentInstance) - CAF_INTERFACE_ENTRY(ITransformer) - CAF_END_INTERFACE_MAP() - -public: // IIntegrationObject - void initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection); - - std::string getId() const; - -public: // IIntegrationComponentInstance - void wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver); - -public: // ITransformer - SmartPtrIIntMessage transformMessage( - const SmartPtrIIntMessage& message); - -private: - bool _isInitialized; - std::string _id; - bool _includeFilename; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CPayloadHeaderEnricherInstance); -}; - -} - -#endif // #ifndef CPayloadHeaderEnricherInstance_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/CafIntegration/src/CafIntegration.cpp b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/CafIntegration/src/CafIntegration.cpp deleted file mode 100644 index d7c24afb5..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/CafIntegration/src/CafIntegration.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "CEnvelopeToPayloadTransformerInstance.h" - -using namespace Caf; - -namespace Caf { - const char* _sObjIdErrorToResponseTransformerInstance = "com.vmware.commonagent.cafintegration.errortoresponsetransformerinstance"; - const char* _sObjIdErrorToResponseTransformer = "com.vmware.commonagent.cafintegration.errortoresponsetransformer"; - const char* _sObjIdPayloadHeaderEnricherInstance = "com.vmware.commonagent.cafintegration.payloadheaderenricherinstance"; - const char* _sObjIdPayloadHeaderEnricher = "com.vmware.commonagent.cafintegration.payloadheaderenricher"; - const char* _sObjIdEnvelopeToPayloadTransformerInstance = "com.vmware.commonagent.cafintegration.envelopetopayloadtransformerinstance"; - const char* _sObjIdEnvelopeToPayloadTransformer = "com.vmware.commonagent.cafintegration.envelopetopayloadtransformer"; -} - -CEcmSubSystemModule _Module; - -CAF_BEGIN_OBJECT_MAP(ObjectMap) - CAF_OBJECT_ENTRY(CErrorToResponseTransformer) - CAF_OBJECT_ENTRY(CErrorToResponseTransformerInstance) - CAF_OBJECT_ENTRY(CPayloadHeaderEnricher) - CAF_OBJECT_ENTRY(CPayloadHeaderEnricherInstance) - CAF_OBJECT_ENTRY(CEnvelopeToPayloadTransformer) - CAF_OBJECT_ENTRY(CEnvelopeToPayloadTransformerInstance) -CAF_END_OBJECT_MAP() - -CAF_DECLARE_SUBSYSTEM_EXPORTS() - -extern "C" BOOL APIENTRY DllMain(HINSTANCE hModule, uint32 dwReason, LPVOID) -{ - try { - if (DLL_PROCESS_ATTACH == dwReason) - { - // initialize the sub-system module - _Module.Init(ObjectMap, hModule); - } - else if (DLL_PROCESS_DETACH == dwReason) - { - // Terminate the sub-system module - _Module.Term(); - } - } catch (std::runtime_error) { - ::exit(2); - } catch (...) { - ::exit(2); - } - - return TRUE; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/CafIntegration/src/stdafx.h b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/CafIntegration/src/stdafx.h deleted file mode 100644 index 4dd72888a..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/CafIntegration/src/stdafx.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef stdafx_h_ -#define stdafx_h_ - -//{{CAF_SUBSYSTEM}} - -#include -#include -#include - -#include "CErrorToResponseTransformerInstance.h" -#include "CErrorToResponseTransformer.h" - -#include "CPayloadHeaderEnricherInstance.h" -#include "CPayloadHeaderEnricher.h" - -#include "CEnvelopeToPayloadTransformer.h" - -#endif // #ifndef stdafx_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/include/CFileReadingMessageSource.h b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/include/CFileReadingMessageSource.h deleted file mode 100644 index 5f81cf5fc..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/include/CFileReadingMessageSource.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CFileReadingMessageSource_h_ -#define CFileReadingMessageSource_h_ - -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "Integration/Core/CAbstractPollableChannel.h" - -namespace Caf { - -class CFileReadingMessageSource : - public CAbstractPollableChannel -{ -private: - typedef std::map CFileCollection; - CAF_DECLARE_SMART_POINTER(CFileCollection); - -public: - CFileReadingMessageSource(); - virtual ~CFileReadingMessageSource(); - -public: - void initialize( - const SmartPtrIDocument& configSection); - -protected: // CAbstractPollableChannel - bool doSend( - const SmartPtrIIntMessage& message, - int32 timeout); - - SmartPtrIIntMessage doReceive(const int32 timeout); - -private: - SmartPtrCFileCollection itemsInDirectory( - const std::string& directory, - const std::string& filenameRegex) const; - - SmartPtrCFileCollection merge( - const SmartPtrCFileCollection& newFileCollection, - const SmartPtrCFileCollection& existingFileCollection) const; - - std::string calcNextFile( - SmartPtrCFileCollection& fileCollection) const; - - uint64 getTimeSec() const; - - bool isRefreshNecessary( - const uint32 refreshSec, - const uint64 lastRefreshSec) const; - -private: - bool _isInitialized; - std::string _id; - std::string _directory; - std::string _filenameRegex; - bool _preventDuplicates; - uint32 _refreshSec; - uint64 _lastRefreshSec; - - SmartPtrCFileCollection _fileCollection; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CFileReadingMessageSource); -}; - -CAF_DECLARE_SMART_POINTER(CFileReadingMessageSource); - -} - -#endif // #ifndef CFileReadingMessageSource_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/include/CMessageHandlerChainInstance.h b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/include/CMessageHandlerChainInstance.h deleted file mode 100644 index da03f262e..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/include/CMessageHandlerChainInstance.h +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Created on: Aug 10, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CMessageHandlerChainInstance_h -#define CMessageHandlerChainInstance_h - - -#include "Integration/IIntegrationComponentInstance.h" - -#include "Common/IAppContext.h" -#include "ICafObject.h" -#include "Integration/Core/CMessageHandler.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "Integration/ISubscribableChannel.h" -#include "Integration/ITaskExecutor.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/ILifecycle.h" -#include "Integration/IMessageChannel.h" -#include "Integration/IMessageHandler.h" - -namespace Caf { - -class CMessageHandlerChainInstance : - public IIntegrationObject, - public IIntegrationComponentInstance, - public ILifecycle, - public IMessageHandler -{ -public: - CMessageHandlerChainInstance(); - virtual ~CMessageHandlerChainInstance(); - - CAF_BEGIN_QI() - CAF_QI_ENTRY(IIntegrationObject) - CAF_QI_ENTRY(IIntegrationComponentInstance) - CAF_QI_ENTRY(ILifecycle) - CAF_QI_ENTRY(IMessageHandler) - CAF_END_QI() - -public: // IIntegrationObject - void initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection); - - std::string getId() const; - -public: // IIntegrationComponentInstance - void wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver); - -public: // ILifecycle - void start(const uint32 timeoutMs); - void stop(const uint32 timeoutMs); - bool isRunning() const; - -public: // IMessageHandler - void handleMessage( - const SmartPtrIIntMessage& message); - SmartPtrIIntMessage getSavedMessage() const; - void clearSavedMessage(); - -private: - void logMessage(const SmartPtrIIntMessage& message) const; - -private: - class ChainedMessageHandler { - public: - ChainedMessageHandler(); - - void init( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver); - void setId(const std::string& id); - void setOutputChannel(const SmartPtrIMessageChannel& channel); - void setMessageHandler(const SmartPtrICafObject& handlerObj); - void handleMessage(const SmartPtrIIntMessage& message); - SmartPtrIIntMessage getSavedMessage() const; - void clearSavedMessage(); - - private: - void logMessage(const SmartPtrIIntMessage& message) const; - - private: - bool _isInitialized; - std::string _id; - SmartPtrIMessageChannel _outputChannel; - SmartPtrICafObject _messageHandlerObj; - SmartPtrCMessageHandler _messageHandler; - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(ChainedMessageHandler); - }; - CAF_DECLARE_SMART_POINTER(ChainedMessageHandler); - typedef std::deque MessageHandlers; - - class InterconnectChannel : public IMessageChannel { - public: - InterconnectChannel(); - virtual ~InterconnectChannel(); - void init(const SmartPtrChainedMessageHandler& nextHandler); - bool send( - const SmartPtrIIntMessage& message); - bool send( - const SmartPtrIIntMessage& message, - const int32 timeout); - - private: - SmartPtrChainedMessageHandler _nextHandler; - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(InterconnectChannel); - }; - CAF_DECLARE_SMART_POINTER(InterconnectChannel); - - struct ChainLink { - CMessageHandlerChainInstance::SmartPtrChainedMessageHandler handler; - std::string id; - bool isMessageProducer; - }; - CAF_DECLARE_SMART_POINTER(ChainLink); - typedef std::vector ChainLinks; - - class SelfWeakReference : public IMessageHandler { - public: - SelfWeakReference(); - void setReference(IMessageHandler *handler); - public: // IMessageHandler - void handleMessage( - const SmartPtrIIntMessage& message); - SmartPtrIIntMessage getSavedMessage() const; - void clearSavedMessage(); - private: - IMessageHandler *_reference; - CAF_CM_CREATE_THREADSAFE; - }; - CAF_DECLARE_SMART_POINTER(SelfWeakReference); - -private: - bool _isInitialized; - bool _isRunning; - IBean::Cargs _ctorArgs; - IBean::Cprops _properties; - SmartPtrIDocument _configSection; - std::string _id; - SmartPtrISubscribableChannel _subscribableInputChannel; - SmartPtrITaskExecutor _taskExecutor; - SmartPtrSelfWeakReference _weakRefSelf; - MessageHandlers _messageHandlers; - SmartPtrIIntMessage _savedMessage; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CMessageHandlerChainInstance); -}; - -CAF_DECLARE_SMART_QI_POINTER(CMessageHandlerChainInstance); - -} - -#endif /* CMessageHandlerChainInstance_h */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/include/CXPathHeaderEnricherItem.h b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/include/CXPathHeaderEnricherItem.h deleted file mode 100644 index 9b4ffe404..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/include/CXPathHeaderEnricherItem.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CXPathHeaderEnricherItem_h_ -#define CXPathHeaderEnricherItem_h_ - - -#include "Integration/IDocument.h" - -namespace Caf { - -class CXPathHeaderEnricherItem { -private: - typedef std::map CFileCollection; - CAF_DECLARE_SMART_POINTER(CFileCollection); - -public: - CXPathHeaderEnricherItem(); - virtual ~CXPathHeaderEnricherItem(); - -public: - void initialize( - const SmartPtrIDocument& configSection, - const bool& defaultOverwrite); - -public: - std::string getName() const; - std::string getEvaluationType() const; - bool getOverwrite() const; - std::string getXpathExpression() const; - std::string getXpathExpressionRef() const; - -private: - bool _isInitialized; - - std::string _name; - std::string _evaluationType; - bool _overwrite; - std::string _xpathExpression; - std::string _xpathExpressionRef; - -private: - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(CXPathHeaderEnricherItem); -}; - -CAF_DECLARE_SMART_POINTER(CXPathHeaderEnricherItem); - -} - -#endif // #ifndef CXPathHeaderEnricherItem_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/include/IntegrationSubsys.h b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/include/IntegrationSubsys.h deleted file mode 100644 index 9fa6ccc58..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/include/IntegrationSubsys.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef IntegrationSubsys_h_ -#define IntegrationSubsys_h_ - -namespace Caf { - // Integration Contracts - extern const char* _sObjIdIntegrationObjectFactory; - extern const char* _sObjIdErrorChannel; - extern const char* _sObjIdNullChannel; - extern const char* _sObjIdHeaderExpressionInvoker; -} - -#endif // #ifndef IntegrationSubsys_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CDirectChannelInstance.cpp b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CDirectChannelInstance.cpp deleted file mode 100644 index bc5cf8116..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CDirectChannelInstance.cpp +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Common/IAppContext.h" -#include "Integration/Core/CErrorHandler.h" -#include "Integration/Core/CUnicastingDispatcher.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "Integration/IMessageChannel.h" -#include "Integration/IMessageHandler.h" -#include "Exception/CCafException.h" -#include "CDirectChannelInstance.h" - -using namespace Caf; - -CDirectChannelInstance::CDirectChannelInstance() : - _isInitialized(false), - CAF_CM_INIT_LOG("CDirectChannelInstance"){ -} - -CDirectChannelInstance::~CDirectChannelInstance() { -} - -void CDirectChannelInstance::initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection) { - - CAF_CM_FUNCNAME_VALIDATE("initialize"); - - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - - _configSection = configSection; - _id = _configSection->findRequiredAttribute("id"); - - _isInitialized = true; -} - -std::string CDirectChannelInstance::getId() const { - CAF_CM_FUNCNAME_VALIDATE("getId"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _id; -} - -void CDirectChannelInstance::wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver) { - CAF_CM_FUNCNAME_VALIDATE("wire"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(appContext); - CAF_CM_VALIDATE_INTERFACE(channelResolver); - - const SmartPtrIMessageChannel errorMessageChannel = - channelResolver->resolveChannelName("errorChannel"); - - SmartPtrCErrorHandler errorHandler; - errorHandler.CreateInstance(); - errorHandler->initialize(channelResolver, errorMessageChannel); - - SmartPtrCUnicastingDispatcher unicastingDispatcher; - unicastingDispatcher.CreateInstance(); - unicastingDispatcher->initialize(errorHandler); - _messageDispatcher = unicastingDispatcher; -} - -void CDirectChannelInstance::subscribe( - const SmartPtrIMessageHandler& messageHandler) { - CAF_CM_FUNCNAME_VALIDATE("subscribe"); - - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(messageHandler); - - _messageDispatcher->addHandler(messageHandler); -} - -void CDirectChannelInstance::unsubscribe( - const SmartPtrIMessageHandler& messageHandler) { - CAF_CM_FUNCNAME_VALIDATE("unsubscribe"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(messageHandler); - - _messageDispatcher->removeHandler(messageHandler); -} - -bool CDirectChannelInstance::doSend( - const SmartPtrIIntMessage& message, - int32 timeout) { - CAF_CM_FUNCNAME("doSend"); - - bool sent = false; - try { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(message); - - if (timeout > 0) { - CAF_CM_EXCEPTIONEX_VA1(UnsupportedOperationException, E_INVALIDARG, - "Timeout not currently supported: %s", _id.c_str()); - } else { - CAF_CM_LOG_DEBUG_VA1("Dispatching message - %s", _id.c_str()); - sent = _messageDispatcher->dispatch(message); - if (!sent) { - CAF_CM_LOG_WARN_VA1("Nothing handled the message - channel: %s", _id.c_str()); - } - } - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_CLEAREXCEPTION; - return sent; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CDirectChannelInstance.h b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CDirectChannelInstance.h deleted file mode 100644 index 1cf1406b8..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CDirectChannelInstance.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CDirectChannelInstance_h_ -#define CDirectChannelInstance_h_ - -#include "Integration/IIntegrationComponentInstance.h" -#include "Common/IAppContext.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "Integration/IMessageDispatcher.h" -#include "Integration/IMessageHandler.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/ISubscribableChannel.h" -#include "Integration/Core/CAbstractMessageChannel.h" - -namespace Caf { - -/// Sends responses/errors back to the client. -class CDirectChannelInstance : - public IIntegrationObject, - public IIntegrationComponentInstance, - public ISubscribableChannel, - public CAbstractMessageChannel -{ -public: - CDirectChannelInstance(); - virtual ~CDirectChannelInstance(); - - CAF_BEGIN_QI() - CAF_QI_ENTRY(IIntegrationObject) - CAF_QI_ENTRY(IIntegrationComponentInstance) - CAF_QI_ENTRY(ISubscribableChannel) - CAF_QI_ENTRY(IMessageChannel) - CAF_QI_ENTRY(IChannelInterceptorSupport) - CAF_END_QI() - -public: // IIntegrationObject - void initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection); - - std::string getId() const; - -public: // IIntegrationComponentInstance - void wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver); - -public: // ISubscribableChannel - void subscribe( - const SmartPtrIMessageHandler& messageHandler); - - void unsubscribe( - const SmartPtrIMessageHandler& messageHandler); - - -protected: // CAbstractMessageChannel - bool doSend( - const SmartPtrIIntMessage& message, - int32 timeout); - -private: - bool _isInitialized; - SmartPtrIDocument _configSection; - std::string _id; - SmartPtrIMessageDispatcher _messageDispatcher; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CDirectChannelInstance); -}; - -CAF_DECLARE_SMART_QI_POINTER(CDirectChannelInstance); - -} - -#endif // #ifndef CDirectChannelInstance_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CErrorChannel.cpp b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CErrorChannel.cpp deleted file mode 100644 index 635bef809..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CErrorChannel.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Integration/IDocument.h" -#include "Integration/IIntegrationObject.h" -#include "CErrorChannel.h" -#include "CErrorChannelInstance.h" - -using namespace Caf; - -CErrorChannel::CErrorChannel() : - _isInitialized(false), - CAF_CM_INIT("CErrorChannel"){ -} - -CErrorChannel::~CErrorChannel() { -} - -void CErrorChannel::initializeBean( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties) { - - CAF_CM_FUNCNAME_VALIDATE("initializeBean"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STL_EMPTY(ctorArgs); - CAF_CM_VALIDATE_STL_EMPTY(properties); - - _ctorArgs = ctorArgs; - _properties = properties; - - initialize(); - } - CAF_CM_EXIT; -} - -void CErrorChannel::terminateBean() { -} - -void CErrorChannel::initialize() { - - CAF_CM_FUNCNAME_VALIDATE("initialize"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - - _isInitialized = true; - } - CAF_CM_EXIT; -} - -bool CErrorChannel::isResponsible( - const SmartPtrIDocument& configSection) const { - CAF_CM_FUNCNAME_VALIDATE("isResponsible"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - } - CAF_CM_EXIT; - - return false; -} - -SmartPtrIIntegrationObject CErrorChannel::createObject( - const SmartPtrIDocument& configSection) const { - CAF_CM_FUNCNAME_VALIDATE("createObject"); - - SmartPtrIIntegrationObject rc; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - // configSection is optional - - SmartPtrCErrorChannelInstance instance; - instance.CreateInstance(); - instance->initialize(_ctorArgs, _properties, configSection); - rc.QueryInterface(instance, false); - CAF_CM_VALIDATE_INTERFACE(rc); - } - CAF_CM_EXIT; - - return rc; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CErrorChannel.h b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CErrorChannel.h deleted file mode 100644 index 83f41311c..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CErrorChannel.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CErrorChannel_h_ -#define CErrorChannel_h_ - - -#include "IBean.h" - -#include "IntegrationSubsys.h" -#include "Integration/IDocument.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/IIntegrationComponent.h" - -namespace Caf { - -/// Sends responses/errors back to the client. -class CErrorChannel : - public TCafSubSystemObjectRoot, - public IBean, - public IIntegrationComponent -{ -public: - CErrorChannel(); - virtual ~CErrorChannel(); - - CAF_DECLARE_OBJECT_IDENTIFIER(_sObjIdErrorChannel) - - CAF_BEGIN_INTERFACE_MAP(CErrorChannel) - CAF_INTERFACE_ENTRY(IBean) - CAF_INTERFACE_ENTRY(IIntegrationComponent) - CAF_END_INTERFACE_MAP() - -public: - void initialize(); - -public: // IBean - void initializeBean(const IBean::Cargs& ctorArgs, const IBean::Cprops& properties); - void terminateBean(); - -public: // IIntegrationComponent - bool isResponsible( - const SmartPtrIDocument& configSection) const; - - SmartPtrIIntegrationObject createObject( - const SmartPtrIDocument& configSection) const; - -private: - bool _isInitialized; - IBean::Cargs _ctorArgs; - IBean::Cprops _properties; - -private: - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(CErrorChannel); -}; - -} - -#endif // #ifndef CErrorChannel_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CErrorChannelInstance.cpp b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CErrorChannelInstance.cpp deleted file mode 100644 index 5c1715a5e..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CErrorChannelInstance.cpp +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Common/IAppContext.h" -#include "Integration/Core/CErrorHandler.h" -#include "Integration/Core/CUnicastingDispatcher.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "Integration/IMessageChannel.h" -#include "Integration/IMessageHandler.h" -#include "Exception/CCafException.h" -#include "CErrorChannelInstance.h" - -using namespace Caf; - -CErrorChannelInstance::CErrorChannelInstance() : - _isInitialized(false), - CAF_CM_INIT_LOG("CErrorChannelInstance") { -} - -CErrorChannelInstance::~CErrorChannelInstance() { -} - -void CErrorChannelInstance::initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection) { - - CAF_CM_FUNCNAME_VALIDATE("initialize"); - - CAF_CM_ENTER - { - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - // configSection is optional - - _id = "errorChannel"; - - _isInitialized = true; - } - CAF_CM_EXIT; -} - -std::string CErrorChannelInstance::getId() const { - CAF_CM_FUNCNAME_VALIDATE("getId"); - - std::string rc; - - CAF_CM_ENTER - { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - rc = _id; - } - CAF_CM_EXIT; - - return rc; -} - -void CErrorChannelInstance::wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver) { - CAF_CM_FUNCNAME_VALIDATE("wire"); - - CAF_CM_ENTER - { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(appContext); - CAF_CM_VALIDATE_INTERFACE(channelResolver); - - const SmartPtrIMessageChannel nullMessageChannel = - channelResolver->resolveChannelName("nullChannel"); - - SmartPtrCErrorHandler errorHandler; - errorHandler.CreateInstance(); - errorHandler->initialize(channelResolver, nullMessageChannel); - - SmartPtrCUnicastingDispatcher unicastingDispatcher; - unicastingDispatcher.CreateInstance(); - unicastingDispatcher->initialize(errorHandler); - _messageDispatcher = unicastingDispatcher; - } - CAF_CM_EXIT; -} - -void CErrorChannelInstance::subscribe(const SmartPtrIMessageHandler& messageHandler) { - CAF_CM_FUNCNAME_VALIDATE("subscribe"); - - CAF_CM_ENTER - { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(messageHandler); - - _messageDispatcher->addHandler(messageHandler); - } - CAF_CM_EXIT; -} - -void CErrorChannelInstance::unsubscribe(const SmartPtrIMessageHandler& messageHandler) { - CAF_CM_FUNCNAME_VALIDATE("unsubscribe"); - - CAF_CM_ENTER - { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(messageHandler); - - _messageDispatcher->removeHandler(messageHandler); - } - CAF_CM_EXIT; -} - -bool CErrorChannelInstance::doSend( - const SmartPtrIIntMessage& message, - int32 timeout) { - CAF_CM_FUNCNAME("doSend"); - - bool sent = false; - try { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(message); - - if (timeout > 0) { - CAF_CM_EXCEPTIONEX_VA1(UnsupportedOperationException, E_INVALIDARG, - "Timeout not currently supported: %s", _id.c_str()); - } else { - CAF_CM_LOG_DEBUG_VA1("Dispatching message - %s", _id.c_str()); - sent = _messageDispatcher->dispatch(message); - if (!sent) { - CAF_CM_LOG_WARN_VA1("Nothing handled the message - channel: %s", _id.c_str()); - } - } - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_CLEAREXCEPTION; - return sent; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CErrorChannelInstance.h b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CErrorChannelInstance.h deleted file mode 100644 index 468190aee..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CErrorChannelInstance.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CErrorChannelInstance_h_ -#define CErrorChannelInstance_h_ - -#include "Integration/IIntegrationComponentInstance.h" -#include "Common/IAppContext.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "Integration/IMessageDispatcher.h" -#include "Integration/IMessageHandler.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/ISubscribableChannel.h" -#include "Integration/Core/CAbstractMessageChannel.h" - -namespace Caf { - -/// Sends responses/errors back to the client. -class CErrorChannelInstance : - public IIntegrationObject, - public IIntegrationComponentInstance, - public ISubscribableChannel, - public CAbstractMessageChannel -{ -public: - CErrorChannelInstance(); - virtual ~CErrorChannelInstance(); - - CAF_BEGIN_QI() - CAF_QI_ENTRY(IIntegrationObject) - CAF_QI_ENTRY(IIntegrationComponentInstance) - CAF_QI_ENTRY(ISubscribableChannel) - CAF_QI_ENTRY(IMessageChannel) - CAF_QI_ENTRY(IChannelInterceptorSupport) - CAF_END_QI() - -public: // IIntegrationObject - void initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection); - - std::string getId() const; - -public: // IIntegrationComponentInstance - void wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver); - -public: // ISubscribableChannel - void subscribe( - const SmartPtrIMessageHandler& messageHandler); - - void unsubscribe( - const SmartPtrIMessageHandler& messageHandler); - -protected: // CAbstractMessageChannel - bool doSend( - const SmartPtrIIntMessage& message, - int32 timeout); - -private: - bool _isInitialized; - std::string _id; - SmartPtrIMessageDispatcher _messageDispatcher; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CErrorChannelInstance); -}; -CAF_DECLARE_SMART_QI_POINTER(CErrorChannelInstance); -} - -#endif // #ifndef CErrorChannelInstance_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CFileInboundChannelAdapterInstance.cpp b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CFileInboundChannelAdapterInstance.cpp deleted file mode 100644 index e9e7606db..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CFileInboundChannelAdapterInstance.cpp +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "CFileReadingMessageSource.h" -#include "Common/IAppContext.h" -#include "Integration/Core/CErrorHandler.h" -#include "Integration/Core/CMessageHandler.h" -#include "Integration/Core/CSimpleAsyncTaskExecutor.h" -#include "Integration/Core/CSourcePollingChannelAdapter.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IMessageChannel.h" -#include "CFileInboundChannelAdapterInstance.h" - -using namespace Caf; - -CFileInboundChannelAdapterInstance::CFileInboundChannelAdapterInstance() : - _isInitialized(false), - CAF_CM_INIT_LOG("CFileInboundChannelAdapterInstance") { -} - -CFileInboundChannelAdapterInstance::~CFileInboundChannelAdapterInstance() { -} - -void CFileInboundChannelAdapterInstance::initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection) { - - CAF_CM_FUNCNAME_VALIDATE("initialize"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - - _configSection = configSection; - _id = _configSection->findRequiredAttribute("id"); - - _isInitialized = true; - } - CAF_CM_EXIT; -} - -std::string CFileInboundChannelAdapterInstance::getId() const { - CAF_CM_FUNCNAME_VALIDATE("getId"); - - std::string rc; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - rc = _id; - } - CAF_CM_EXIT; - - return rc; -} - -void CFileInboundChannelAdapterInstance::wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver) { - CAF_CM_FUNCNAME_VALIDATE("wire"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(appContext); - CAF_CM_VALIDATE_INTERFACE(channelResolver); - - const std::string outputChannelStr = - _configSection->findRequiredAttribute("channel"); - - SmartPtrCFileReadingMessageSource fileReadingMessageSource; - fileReadingMessageSource.CreateInstance(); - fileReadingMessageSource->initialize(_configSection); - - const SmartPtrIMessageChannel outputMessageChannel = - channelResolver->resolveChannelName(outputChannelStr); - const SmartPtrIMessageChannel errorMessageChannel = - channelResolver->resolveChannelName("errorChannel"); - - SmartPtrCMessageHandler messageHandler; - messageHandler.CreateInstance(); - messageHandler->initialize( - _id, - outputMessageChannel, - SmartPtrICafObject()); - - SmartPtrCErrorHandler errorHandler; - errorHandler.CreateInstance(); - errorHandler->initialize(channelResolver, errorMessageChannel); - - SmartPtrCSourcePollingChannelAdapter sourcePollingChannelAdapter; - sourcePollingChannelAdapter.CreateInstance(); - sourcePollingChannelAdapter->initialize( - messageHandler, fileReadingMessageSource, errorHandler); - - SmartPtrCSimpleAsyncTaskExecutor simpleAsyncTaskExecutor; - simpleAsyncTaskExecutor.CreateInstance(); - simpleAsyncTaskExecutor->initialize(sourcePollingChannelAdapter, errorHandler); - _taskExecutor = simpleAsyncTaskExecutor; - } - CAF_CM_EXIT; -} - -void CFileInboundChannelAdapterInstance::start(const uint32 timeoutMs) { - CAF_CM_FUNCNAME_VALIDATE("start"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - CAF_CM_LOG_DEBUG_VA0("Starting the executor"); - _taskExecutor->execute(timeoutMs); - } - CAF_CM_EXIT; -} - -void CFileInboundChannelAdapterInstance::stop(const uint32 timeoutMs) { - CAF_CM_FUNCNAME_VALIDATE("stop"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - CAF_CM_LOG_DEBUG_VA0("Stopping the executor"); - _taskExecutor->cancel(timeoutMs); - } - CAF_CM_EXIT; -} - -bool CFileInboundChannelAdapterInstance::isRunning() const { - CAF_CM_FUNCNAME_VALIDATE("isRunning"); - - bool rc = false; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - rc = (_taskExecutor->getState() == ITaskExecutor::ETaskStateStarted); - } - CAF_CM_EXIT; - - return rc; -} - -bool CFileInboundChannelAdapterInstance::isMessageProducer() const { - CAF_CM_FUNCNAME_VALIDATE("isMessageProducer"); - - bool rc = false; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - rc = true; - } - CAF_CM_EXIT; - - return rc; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CFileInboundChannelAdapterInstance.h b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CFileInboundChannelAdapterInstance.h deleted file mode 100644 index aab1eabbb..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CFileInboundChannelAdapterInstance.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CFileInboundChannelAdapterInstance_h_ -#define CFileInboundChannelAdapterInstance_h_ - - -#include "Integration/IIntegrationComponentInstance.h" - -#include "Common/IAppContext.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/ITaskExecutor.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/ILifecycle.h" -#include "Integration/IMessageProducer.h" - -namespace Caf { - -class CFileInboundChannelAdapterInstance : - public IIntegrationObject, - public IIntegrationComponentInstance, - public ILifecycle, - public IMessageProducer { -public: - CFileInboundChannelAdapterInstance(); - virtual ~CFileInboundChannelAdapterInstance(); - - CAF_BEGIN_QI() - CAF_QI_ENTRY(IIntegrationObject) - CAF_QI_ENTRY(IIntegrationComponentInstance) - CAF_QI_ENTRY(ILifecycle) - CAF_QI_ENTRY(IMessageProducer) - CAF_END_QI() - -public: // IIntegrationObject - void initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection); - - std::string getId() const; - -public: // IIntegrationComponentInstance - void wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver); - -public: // ILifecycle - void start(const uint32 timeoutMs); - void stop(const uint32 timeoutMs); - bool isRunning() const; - -public: // IMessageProducer - bool isMessageProducer() const; - -private: - bool _isInitialized; - SmartPtrIDocument _configSection; - std::string _id; - SmartPtrITaskExecutor _taskExecutor; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CFileInboundChannelAdapterInstance); -}; - -CAF_DECLARE_SMART_QI_POINTER(CFileInboundChannelAdapterInstance); - -} - -#endif // #ifndef CFileInboundChannelAdapterInstance_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CFileOutboundChannelAdapterInstance.cpp b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CFileOutboundChannelAdapterInstance.cpp deleted file mode 100644 index 1d2d7a887..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CFileOutboundChannelAdapterInstance.cpp +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Common/IAppContext.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "Memory/DynamicArray/DynamicArrayInc.h" -#include "Exception/CCafException.h" -#include "CFileOutboundChannelAdapterInstance.h" -#include "CDirectChannelInstance.h" -#include "Integration/Core/FileHeaders.h" - -using namespace Caf; - -CFileOutboundChannelAdapterInstance::CFileOutboundChannelAdapterInstance() : - _isInitialized(false), - _autoCreateDirectory(false), - _deleteSourceFiles(false), - CAF_CM_INIT_LOG("CFileOutboundChannelAdapterInstance") { -} - -CFileOutboundChannelAdapterInstance::~CFileOutboundChannelAdapterInstance() { -} - -void CFileOutboundChannelAdapterInstance::initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - - _id = configSection->findRequiredAttribute("id"); - - const std::string directoryStr = configSection->findRequiredAttribute("directory"); - const std::string autoCreateDirectoryStr = configSection->findOptionalAttribute( - "auto-create-directory"); - const std::string deleteSourceFilesStr = configSection->findOptionalAttribute( - "delete-source-files"); - const std::string temporaryFileSuffixStr = configSection->findOptionalAttribute( - "temporary-file-suffix"); - _modeStr = configSection->findOptionalAttribute("mode"); - - _directory = CStringUtils::expandEnv(directoryStr); - _deleteSourceFiles = - (deleteSourceFilesStr.empty() || deleteSourceFilesStr.compare("false") == 0) ? - false : true; - _autoCreateDirectory = - (autoCreateDirectoryStr.empty() || autoCreateDirectoryStr.compare("true") == 0) ? - true : false; - _temporaryFileSuffix = - temporaryFileSuffixStr.empty() ? ".writing" : temporaryFileSuffixStr; - - _isInitialized = true; -} - -std::string CFileOutboundChannelAdapterInstance::getId() const { - CAF_CM_FUNCNAME_VALIDATE("getId"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _id; -} - -void CFileOutboundChannelAdapterInstance::wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver) { - CAF_CM_FUNCNAME_VALIDATE("wire"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(appContext); - CAF_CM_VALIDATE_INTERFACE(channelResolver); -} - -void CFileOutboundChannelAdapterInstance::handleMessage( - const SmartPtrIIntMessage& message) { - CAF_CM_FUNCNAME_VALIDATE("handleMessage"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(message); - - _savedMessage = message; - savePayloadToFile(message); - deleteSourceFiles(message); -} - -SmartPtrIIntMessage CFileOutboundChannelAdapterInstance::getSavedMessage() const { - CAF_CM_FUNCNAME_VALIDATE("getSavedMessage"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _savedMessage; -} - -void CFileOutboundChannelAdapterInstance::clearSavedMessage() { - CAF_CM_FUNCNAME_VALIDATE("clearSavedMessage"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - _savedMessage = NULL; -} - -SmartPtrIIntMessage CFileOutboundChannelAdapterInstance::processErrorMessage( - const SmartPtrIIntMessage& message) { - CAF_CM_FUNCNAME_VALIDATE("processErrorMessage"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(message); - - _savedMessage = message; - savePayloadToFile(message); - deleteSourceFiles(message); - - return SmartPtrIIntMessage(); -} - -void CFileOutboundChannelAdapterInstance::savePayloadToFile( - const SmartPtrIIntMessage& message) const { - CAF_CM_FUNCNAME("savePayloadToFile"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(message); - - const std::string relFilename = generateFilename(message); - const std::string filePath = FileSystemUtils::buildPath(_directory, relFilename); - const std::string fileDir = FileSystemUtils::getDirname(filePath); - - if (! _autoCreateDirectory && ! FileSystemUtils::doesDirectoryExist(fileDir)) { - CAF_CM_EXCEPTION_VA1(ERROR_PATH_NOT_FOUND, - "Directory does not exist - %s", fileDir.c_str()); - } - - const SmartPtrCDynamicByteArray payload = message->getPayload(); - FileSystemUtils::saveByteFile(filePath, payload->getPtr(), payload->getByteCount(), - translateMode(_modeStr), _temporaryFileSuffix); -} - -std::string CFileOutboundChannelAdapterInstance::generateFilename( - const SmartPtrIIntMessage& message) const { - CAF_CM_FUNCNAME_VALIDATE("generateFilename"); - CAF_CM_VALIDATE_INTERFACE(message); - - std::string relFilename = message->findOptionalHeaderAsString( - FileHeaders::_sFILENAME); - if (relFilename.empty()) { - relFilename = CStringUtils::createRandomUuid() + ".msg"; - } - - return relFilename; -} - -FileSystemUtils::FILE_MODE_TYPE CFileOutboundChannelAdapterInstance::translateMode( - const std::string modeStr) const { - CAF_CM_FUNCNAME("translateMode"); - - FileSystemUtils::FILE_MODE_TYPE modeType; - if (modeStr.empty() || (modeStr.compare("REPLACE") == 0)) { - modeType = FileSystemUtils::FILE_MODE_REPLACE; - } else if (modeStr.compare("FAIL") == 0) { - modeType = FileSystemUtils::FILE_MODE_FAIL; - } else if (modeStr.compare("IGNORE") == 0) { - modeType = FileSystemUtils::FILE_MODE_IGNORE; - } else if (modeStr.compare("APPEND") == 0) { - CAF_CM_EXCEPTION_VA0(ERROR_INVALID_DATA, - "Invalid mode - APPEND not currently supported"); - } else { - CAF_CM_EXCEPTION_VA1(ERROR_INVALID_DATA, "Invalid mode - %s", modeStr.c_str()); - } - - return modeType; -} - -void CFileOutboundChannelAdapterInstance::deleteSourceFiles( - const SmartPtrIIntMessage& message) const { - CAF_CM_FUNCNAME_VALIDATE("deleteSourceFiles"); - CAF_CM_VALIDATE_INTERFACE(message); - - if (_deleteSourceFiles) { - const std::string originalFile = message->findOptionalHeaderAsString( - FileHeaders::_sORIGINAL_FILE); - if (!originalFile.empty()) { - if (FileSystemUtils::doesFileExist(originalFile)) { - CAF_CM_LOG_INFO_VA1("Removing original file - %s", originalFile.c_str()); - FileSystemUtils::removeFile(originalFile); - } - } - } -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CFileOutboundChannelAdapterInstance.h b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CFileOutboundChannelAdapterInstance.h deleted file mode 100644 index f92b2b388..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CFileOutboundChannelAdapterInstance.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CFileOutboundChannelAdapterInstance_h_ -#define CFileOutboundChannelAdapterInstance_h_ - - -#include "Integration/IErrorProcessor.h" - -#include "Common/IAppContext.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "Integration/IIntegrationComponentInstance.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/IMessageHandler.h" - -namespace Caf { - -class CFileOutboundChannelAdapterInstance : - public IIntegrationObject, - public IIntegrationComponentInstance, - public IMessageHandler, - public IErrorProcessor { -public: - CFileOutboundChannelAdapterInstance(); - virtual ~CFileOutboundChannelAdapterInstance(); - - CAF_BEGIN_QI() - CAF_QI_ENTRY(IIntegrationObject) - CAF_QI_ENTRY(IIntegrationComponentInstance) - CAF_QI_ENTRY(IMessageHandler) - CAF_QI_ENTRY(IErrorProcessor) - CAF_END_QI() - -public: // IIntegrationObject - void initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection); - - std::string getId() const; - -public: // IIntegrationComponentInstance - void wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver); - -public: // IMessageHandler - void handleMessage( - const SmartPtrIIntMessage& message); - - SmartPtrIIntMessage getSavedMessage() const; - - void clearSavedMessage(); - -public: // IErrorProcessor - SmartPtrIIntMessage processErrorMessage( - const SmartPtrIIntMessage& message); - -private: - bool _isInitialized; - std::string _id; - std::string _directory; - std::string _temporaryFileSuffix; - std::string _modeStr; - bool _autoCreateDirectory; - bool _deleteSourceFiles; - SmartPtrIIntMessage _savedMessage; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CFileOutboundChannelAdapterInstance); - -private: - void savePayloadToFile( - const SmartPtrIIntMessage& message) const; - - std::string generateFilename( - const SmartPtrIIntMessage& message) const; - - FileSystemUtils::FILE_MODE_TYPE translateMode( - const std::string modeStr) const; - - void deleteSourceFiles( - const SmartPtrIIntMessage& message) const; -}; -CAF_DECLARE_SMART_QI_POINTER(CFileOutboundChannelAdapterInstance); -} - -#endif // #ifndef CFileOutboundChannelAdapterInstance_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CFileReadingMessageSource.cpp b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CFileReadingMessageSource.cpp deleted file mode 100644 index 6961d736d..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CFileReadingMessageSource.cpp +++ /dev/null @@ -1,207 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Integration/Core/CIntMessage.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "CFileReadingMessageSource.h" -#include "Exception/CCafException.h" - -using namespace Caf; - -CFileReadingMessageSource::CFileReadingMessageSource() : - _isInitialized(false), - _preventDuplicates(true), - _refreshSec(0), - _lastRefreshSec(0), - CAF_CM_INIT_LOG("CFileReadingMessageSource") { -} - -CFileReadingMessageSource::~CFileReadingMessageSource() { -} - -void CFileReadingMessageSource::initialize( - const SmartPtrIDocument& configSection) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - - _id = configSection->findRequiredAttribute("id"); - const std::string directoryStr = configSection->findRequiredAttribute("directory"); - const std::string filenameRegexStr = configSection->findOptionalAttribute("filename-regex"); - const std::string preventDuplicatesStr = configSection->findOptionalAttribute("prevent-duplicates"); - const std::string autoCreateDirectoryStr = configSection->findOptionalAttribute("auto-create-directory"); - const SmartPtrIDocument pollerDoc = configSection->findOptionalChild("poller"); - - _refreshSec = 0; - - _directory = CStringUtils::expandEnv(directoryStr); - setPollerMetadata(pollerDoc); - _preventDuplicates = - (preventDuplicatesStr.empty() || preventDuplicatesStr.compare("true") == 0) ? true : false; - - if (filenameRegexStr.empty()) { - _filenameRegex = FileSystemUtils::REGEX_MATCH_ALL; - } else { - _filenameRegex = filenameRegexStr; - } - - const bool autoCreateDirectory = - (autoCreateDirectoryStr.empty() || autoCreateDirectoryStr.compare("true") == 0) ? true : false; - if (autoCreateDirectory && ! FileSystemUtils::doesDirectoryExist(_directory)) { - FileSystemUtils::createDirectory(_directory); - } - - CAF_CM_LOG_DEBUG_VA2( - "Monitoring inbound directory - dir: %s, fileRegex: %s", - _directory.c_str(), _filenameRegex.c_str()); - - _fileCollection.CreateInstance(); - _isInitialized = true; -} - -bool CFileReadingMessageSource::doSend( - const SmartPtrIIntMessage&, - int32) { - CAF_CM_FUNCNAME("doSend"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - CAF_CM_EXCEPTIONEX_VA1( - UnsupportedOperationException, - E_NOTIMPL, - "This is not a sending channel: %s", _id.c_str()); -} - -SmartPtrIIntMessage CFileReadingMessageSource::doReceive(const int32 timeout) { - CAF_CM_FUNCNAME("receive"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - if (timeout > 0) { - CAF_CM_EXCEPTIONEX_VA1(UnsupportedOperationException, E_INVALIDARG, - "Timeout not currently supported: %s", _id.c_str()); - } - - if (isRefreshNecessary(_refreshSec, _lastRefreshSec)) { - const SmartPtrCFileCollection newFileCollection = - itemsInDirectory(_directory, _filenameRegex); - - if (_preventDuplicates) { - _fileCollection = merge(newFileCollection, _fileCollection); - } else { - _fileCollection = newFileCollection; - } - - _lastRefreshSec = getTimeSec(); - } - - SmartPtrIIntMessage message; - const std::string filename = calcNextFile(_fileCollection); - if (! filename.empty()) { - CAF_CM_LOG_DEBUG_VA1("Creating message with filename - %s", filename.c_str()); - - SmartPtrCIntMessage messageImpl; - messageImpl.CreateInstance(); - messageImpl->initializeStr(filename, IIntMessage::SmartPtrCHeaders(), IIntMessage::SmartPtrCHeaders()); - message = messageImpl; - } - - return message; -} - -CFileReadingMessageSource::SmartPtrCFileCollection -CFileReadingMessageSource::itemsInDirectory( - const std::string& directory, - const std::string& filenameRegex) const { - CAF_CM_FUNCNAME_VALIDATE("itemsInDirectory"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(directory); - // filenameRegex defaults to FileSystemUtils::REGEX_MATCH_ALL - - SmartPtrCFileCollection rc; - rc.CreateInstance(); - - const FileSystemUtils::DirectoryItems directoryItems = - FileSystemUtils::itemsInDirectory(directory, filenameRegex); - const FileSystemUtils::Files files = directoryItems.files; - for (TConstIterator fileIter(files); fileIter; fileIter++) { - const std::string filename = *fileIter; - const std::string filePath = FileSystemUtils::buildPath( - directory, filename); - - rc->insert(std::make_pair(filePath, false)); - } - - return rc; -} - -CFileReadingMessageSource::SmartPtrCFileCollection -CFileReadingMessageSource::merge( - const SmartPtrCFileCollection& newFileCollection, - const SmartPtrCFileCollection& existingFileCollection) const { - CAF_CM_FUNCNAME_VALIDATE("merge"); - CAF_CM_VALIDATE_SMARTPTR(newFileCollection); - CAF_CM_VALIDATE_SMARTPTR(existingFileCollection); - - SmartPtrCFileCollection newFileCollectionRc = newFileCollection; - for (TMapIterator newFileIter(*newFileCollectionRc); - newFileIter; newFileIter++) { - const std::string newFile = newFileIter.getKey(); - - CFileCollection::const_iterator existingFileIter = - existingFileCollection->find(newFile); - if (existingFileIter != existingFileCollection->end()) { - *newFileIter = existingFileIter->second; - } - } - - return newFileCollectionRc; -} - -std::string CFileReadingMessageSource::calcNextFile( - SmartPtrCFileCollection& fileCollection) const { - CAF_CM_FUNCNAME_VALIDATE("calcNextFile"); - CAF_CM_VALIDATE_SMARTPTR(fileCollection); - - std::string filename; - for (TMapIterator fileIter(*fileCollection); - filename.empty() && fileIter; fileIter++) { - const bool isFileReceived = *fileIter; - if (! isFileReceived) { - filename = fileIter.getKey(); - *fileIter = true; - } - } - - return filename; -} - -bool CFileReadingMessageSource::isRefreshNecessary( - const uint32 refreshSec, - const uint64 lastRefreshSec) const { - bool rc = false; - - if (refreshSec == 0) { - rc = true; - } else { - const uint64 currentTimeSec = getTimeSec(); - if ((currentTimeSec - lastRefreshSec) > refreshSec) { - rc = true; - } - } - - return rc; -} - -uint64 CFileReadingMessageSource::getTimeSec() const { - GTimeVal curTime; - ::g_get_current_time(&curTime); - uint64 rc = curTime.tv_sec; - - return rc; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CFileToStringTransformerInstance.cpp b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CFileToStringTransformerInstance.cpp deleted file mode 100644 index ba027a7ee..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CFileToStringTransformerInstance.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Common/IAppContext.h" -#include "Integration/Core/CIntMessage.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "Integration/Core/CIntMessageHeaders.h" -#include "CFileToStringTransformerInstance.h" -#include "Integration/Core/FileHeaders.h" - -using namespace Caf; - -CFileToStringTransformerInstance::CFileToStringTransformerInstance() : - _isInitialized(false), - _deleteFiles(false), - CAF_CM_INIT_LOG("CFileToStringTransformerInstance") { -} - -CFileToStringTransformerInstance::~CFileToStringTransformerInstance() { -} - -void CFileToStringTransformerInstance::initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection) { - - CAF_CM_FUNCNAME_VALIDATE("initialize"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - - _id = configSection->findRequiredAttribute("id"); - - const std::string deleteFilesStr = configSection->findOptionalAttribute("delete-files"); - _deleteFiles = (deleteFilesStr.empty() || deleteFilesStr.compare("true") == 0) ? true : false; - - CAF_CM_LOG_DEBUG_VA2("deleteFilesStr: %s, deleteFiles: %s", deleteFilesStr.c_str(), _deleteFiles ? "true" : "false"); - - _isInitialized = true; - } - CAF_CM_EXIT; -} - -std::string CFileToStringTransformerInstance::getId() const { - CAF_CM_FUNCNAME_VALIDATE("getId"); - - std::string rc; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - rc = _id; - } - CAF_CM_EXIT; - - return rc; -} - -void CFileToStringTransformerInstance::wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver) { - CAF_CM_FUNCNAME_VALIDATE("wire"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(appContext); - CAF_CM_VALIDATE_INTERFACE(channelResolver); - - } - CAF_CM_EXIT; -} - -SmartPtrIIntMessage CFileToStringTransformerInstance::transformMessage( - const SmartPtrIIntMessage& message) { - CAF_CM_FUNCNAME_VALIDATE("transformMessage"); - - SmartPtrIIntMessage newMessage; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - const std::string filename = message->getPayloadStr(); - const std::string fileContents = FileSystemUtils::loadTextFile(filename); - - CIntMessageHeaders messageHeaders; - if (_deleteFiles) { - CAF_CM_LOG_INFO_VA1("Removing file - %s", filename.c_str()); - FileSystemUtils::removeFile(filename); - } else { - messageHeaders.insertString(FileHeaders::_sORIGINAL_FILE, filename); - } - - SmartPtrCIntMessage messageImpl; - messageImpl.CreateInstance(); - messageImpl->initializeStr(fileContents, messageHeaders.getHeaders(), message->getHeaders()); - newMessage = messageImpl; - } - CAF_CM_EXIT; - - return newMessage; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CFileToStringTransformerInstance.h b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CFileToStringTransformerInstance.h deleted file mode 100644 index b68f7de86..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CFileToStringTransformerInstance.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CFileToStringTransformerInstance_h_ -#define CFileToStringTransformerInstance_h_ - - -#include "Integration/IIntegrationComponentInstance.h" - -#include "Common/IAppContext.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/ITransformer.h" - -namespace Caf { - -class CFileToStringTransformerInstance : - public IIntegrationObject, - public IIntegrationComponentInstance, - public ITransformer -{ -public: - CFileToStringTransformerInstance(); - virtual ~CFileToStringTransformerInstance(); - - CAF_BEGIN_QI() - CAF_QI_ENTRY(IIntegrationObject) - CAF_QI_ENTRY(IIntegrationComponentInstance) - CAF_QI_ENTRY(ITransformer) - CAF_END_QI() - -public: // IIntegrationObject - void initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection); - - std::string getId() const; - -public: // IIntegrationComponentInstance - void wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver); - -public: // ITransformer - SmartPtrIIntMessage transformMessage( - const SmartPtrIIntMessage& message); - -private: - bool _isInitialized; - std::string _id; - bool _deleteFiles; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CFileToStringTransformerInstance); -}; -CAF_DECLARE_SMART_QI_POINTER(CFileToStringTransformerInstance); - -} - -#endif // #ifndef CFileToStringTransformerInstance_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CHeaderEnricherTransformerInstance.cpp b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CHeaderEnricherTransformerInstance.cpp deleted file mode 100644 index e5cf4c114..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CHeaderEnricherTransformerInstance.cpp +++ /dev/null @@ -1,184 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Common/IAppContext.h" -#include "IBean.h" -#include "IVariant.h" -#include "Integration/Core/CExpressionHandler.h" -#include "Integration/Core/CIntMessage.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "Integration/ITransformer.h" -#include "Exception/CCafException.h" -#include "Common/IAppConfig.h" -#include "CHeaderEnricherTransformerInstance.h" -#include "Integration/Core/MessageHeaders.h" - -using namespace Caf; - -CHeaderEnricherTransformerInstance::CHeaderEnricherTransformerInstance() : - _isInitialized(false), - CAF_CM_INIT_LOG("CHeaderEnricherTransformerInstance") { -} - -CHeaderEnricherTransformerInstance::~CHeaderEnricherTransformerInstance() { -} - -void CHeaderEnricherTransformerInstance::initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection) { - CAF_CM_FUNCNAME("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - - _id = configSection->findRequiredAttribute("id"); - _configSection = configSection; - - if (_configSection->getAllChildren()->empty()) { - CAF_CM_EXCEPTIONEX_VA1(NoSuchElementException, ERROR_INVALID_DATA, - "Configuration section is empty - %s", _id.c_str()); - } - - _isInitialized = true; -} - -std::string CHeaderEnricherTransformerInstance::getId() const { - CAF_CM_FUNCNAME_VALIDATE("getId"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _id; -} - -void CHeaderEnricherTransformerInstance::wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver) { - CAF_CM_FUNCNAME("wire"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(appContext); - CAF_CM_VALIDATE_INTERFACE(channelResolver); - - SmartPtrIAppConfig appConfig = getAppConfig(); - - const IDocument::SmartPtrCChildCollection configChildren = - _configSection->getAllChildren(); - for (TSmartConstMapIterator configIter(*configChildren); - configIter; configIter++) { - const SmartPtrIDocument config = *configIter; - - if (config->getName().compare("header") == 0) { - const std::string headerName = config->findRequiredAttribute("name"); - const std::string headerRef = config->findOptionalAttribute("ref"); - const std::string headerValue = config->findOptionalAttribute("value"); - const std::string expressionValue = config->findOptionalAttribute("expression"); - - if (! headerRef.empty()) { - CAF_CM_LOG_DEBUG_VA2("Creating the header enricher bean - %s = %s", - headerName.c_str(), - headerRef.c_str()); - SmartPtrIBean bean = appContext->getBean(headerRef); - SmartPtrITransformer transformer; - transformer.QueryInterface(bean, false); - if (transformer.IsNull()) { - CAF_CM_EXCEPTIONEX_VA1( - NoSuchInterfaceException, - 0, - "Bean is not a transformer - %s", - headerRef.c_str()); - } - _headerWithRef.insert(std::make_pair(headerName, transformer)); - } else if (! headerValue.empty()) { - CAF_CM_LOG_DEBUG_VA2("Creating the header enricher value - %s = %s", - headerName.c_str(), headerValue.c_str()); - _headerWithValue.insert(std::make_pair(headerName, headerValue)); - } else if (! expressionValue.empty()) { - CAF_CM_LOG_DEBUG_VA2("Creating the header enricher expression - %s = %s", - headerName.c_str(), expressionValue.c_str()); - SmartPtrCExpressionHandler expressionHandler; - expressionHandler.CreateInstance(); - expressionHandler->init( - appConfig, - appContext, - expressionValue); - _headerWithExpression.insert(std::make_pair(headerName, expressionHandler)); - } else { - CAF_CM_EXCEPTIONEX_VA2( - InvalidArgumentException, - ERROR_INVALID_DATA, - "Configuration error: unrecognized header value type attribute: [id='%s'][header='%s']", - _id.c_str(), - headerName.c_str()); - } - } else if (config->getName().compare("error-channel") == 0) { - _errorChannelRef = config->findRequiredAttribute("ref"); - } else { - CAF_CM_EXCEPTIONEX_VA1(NoSuchElementException, ERROR_INVALID_DATA, - "Configuration section contains unrecognized entry - %s", _id.c_str()); - } - } -} - -SmartPtrIIntMessage CHeaderEnricherTransformerInstance::transformMessage( - const SmartPtrIIntMessage& message) { - CAF_CM_FUNCNAME_VALIDATE("transformMessage"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - SmartPtrCIntMessage messageImpl; - messageImpl.CreateInstance(); - messageImpl->initialize(message->getPayload(), - message->getHeaders(), IIntMessage::SmartPtrCHeaders()); - SmartPtrIIntMessage newMessage = messageImpl; - - for (TSmartMapIterator headerWithRefIter(_headerWithRef); - headerWithRefIter; headerWithRefIter++) { - const SmartPtrIIntMessage transformMessage = - headerWithRefIter->transformMessage(newMessage); - SmartPtrCIntMessage tmpMessageImpl; - tmpMessageImpl.CreateInstance(); - tmpMessageImpl->initialize(message->getPayload(), - transformMessage->getHeaders(), newMessage->getHeaders()); - newMessage = tmpMessageImpl; - } - - IIntMessage::SmartPtrCHeaders newHeaders = newMessage->getHeaders(); - - for (TSmartMapIterator expressionIter(_headerWithExpression); - expressionIter; - expressionIter++) { - const SmartPtrIVariant value = expressionIter->evaluate(newMessage); - CAF_CM_LOG_DEBUG_VA2( - "Inserting/updating a header value - %s = %s", - expressionIter.getKey().c_str(), - value->toString().c_str()); - (*newHeaders)[expressionIter.getKey()] = - std::make_pair(value, SmartPtrICafObject()); - } - - if (! _errorChannelRef.empty()) { - CAF_CM_LOG_DEBUG_VA1("Inserting/updating a new error channel - %s", - _errorChannelRef.c_str()); - (*newHeaders)[MessageHeaders::_sERROR_CHANNEL] = - std::make_pair(CVariant::createString(_errorChannelRef), - SmartPtrICafObject()); - } - - for (TConstMapIterator headerWithValueIter(_headerWithValue); - headerWithValueIter; headerWithValueIter++) { - const std::string name = headerWithValueIter.getKey(); - const std::string value = *headerWithValueIter; - - CAF_CM_LOG_DEBUG_VA2("Inserting/updating a header value - %s = %s", - name.c_str(), value.c_str()); - (*newHeaders)[name] = - std::make_pair(CVariant::createString(value), SmartPtrICafObject()); - } - - return newMessage; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CHeaderEnricherTransformerInstance.h b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CHeaderEnricherTransformerInstance.h deleted file mode 100644 index cbbdcd7f3..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CHeaderEnricherTransformerInstance.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CHeaderEnricherTransformerInstance_h_ -#define CHeaderEnricherTransformerInstance_h_ - - -#include "Integration/IIntegrationComponentInstance.h" - -#include "Common/IAppContext.h" -#include "Integration/Core/CExpressionHandler.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "Integration/ITransformer.h" -#include "Integration/IIntegrationObject.h" - -namespace Caf { - -class CHeaderEnricherTransformerInstance : - public IIntegrationObject, - public IIntegrationComponentInstance, - public ITransformer -{ -public: - CHeaderEnricherTransformerInstance(); - virtual ~CHeaderEnricherTransformerInstance(); - - CAF_BEGIN_QI() - CAF_QI_ENTRY(IIntegrationObject) - CAF_QI_ENTRY(IIntegrationComponentInstance) - CAF_QI_ENTRY(ITransformer) - CAF_END_QI() - -public: // IIntegrationObject - void initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection); - - std::string getId() const; - -public: // IIntegrationComponentInstance - void wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver); - -public: // ITransformer - SmartPtrIIntMessage transformMessage( - const SmartPtrIIntMessage& message); - -private: - bool _isInitialized; - std::string _id; - std::string _errorChannelRef; - SmartPtrIDocument _configSection; - typedef std::map Transformers; - Transformers _headerWithRef; - typedef std::map Expressions; - Expressions _headerWithExpression; - Cmapstrstr _headerWithValue; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CHeaderEnricherTransformerInstance); -}; -CAF_DECLARE_SMART_QI_POINTER(CHeaderEnricherTransformerInstance); - -} - -#endif // #ifndef CHeaderEnricherTransformerInstance_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CHeaderExpressionInvoker.cpp b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CHeaderExpressionInvoker.cpp deleted file mode 100644 index b4266fc4f..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CHeaderExpressionInvoker.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Created on: Jul 23, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "IVariant.h" -#include "Integration/IIntMessage.h" -#include "Exception/CCafException.h" -#include "CHeaderExpressionInvoker.h" - -using namespace Caf; - -CHeaderExpressionInvoker::CHeaderExpressionInvoker() : - _isInitialized(false), - CAF_CM_INIT("CHeaderExpressionInvoker") { -} - -CHeaderExpressionInvoker::~CHeaderExpressionInvoker() { -} - -void CHeaderExpressionInvoker::initializeBean( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties) { - CAF_CM_FUNCNAME("initializeBean"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_ASSERT(ctorArgs.size() == 0); - CAF_CM_ASSERT(properties.size() == 0); - _isInitialized = true; -} - -void CHeaderExpressionInvoker::terminateBean() { -} - -SmartPtrIVariant CHeaderExpressionInvoker::invokeExpression( - const std::string& methodName, - const Cdeqstr& methodParams, - const SmartPtrIIntMessage& message) { - CAF_CM_FUNCNAME("invokeExpression"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(methodName); - CAF_CM_VALIDATE_STL(methodParams); - CAF_CM_VALIDATE_INTERFACE(message); - - SmartPtrIVariant result; - const IIntMessage::SmartPtrCHeaders& headers = message->getHeaders(); - if (methodName == "containsKey") { - CAF_CM_ASSERT(1 == methodParams.size()); - result = CVariant::createBool(headers->end() != headers->find(methodParams.front())); - } else if (methodName == "notContainsKey") { - CAF_CM_ASSERT(1 == methodParams.size()); - result = CVariant::createBool(headers->end() == headers->find(methodParams.front())); - } else if (methodName == "toString") { - CAF_CM_ASSERT(1 == methodParams.size()); - const SmartPtrIVariant value = message->findRequiredHeader(methodParams.front()); - result = CVariant::createString(value->toString()); - } else if (methodName == "prependToString") { - CAF_CM_ASSERT(2 == methodParams.size()); - const SmartPtrIVariant value = message->findRequiredHeader(methodParams.front()); - result = CVariant::createString(methodParams.back() + value->toString()); - } else if (methodName == "appendToString") { - CAF_CM_ASSERT(2 == methodParams.size()); - const SmartPtrIVariant value = message->findRequiredHeader(methodParams.front()); - result = CVariant::createString(value->toString() + methodParams.back()); - } else if (methodName == "isEqualString") { - CAF_CM_ASSERT(2 == methodParams.size()); - const SmartPtrIVariant value = message->findRequiredHeader(methodParams.front()); - result = CVariant::createBool(value->toString().compare(methodParams.back()) == 0); - } else if (methodName == "isNotEqualString") { - CAF_CM_ASSERT(2 == methodParams.size()); - const SmartPtrIVariant value = message->findRequiredHeader(methodParams.front()); - result = CVariant::createBool(value->toString().compare(methodParams.back()) != 0); - } else { - CAF_CM_EXCEPTIONEX_VA1( - NoSuchMethodException, - 0, - "%s", - methodName.c_str()); - } - return result; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CHeaderExpressionInvoker.h b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CHeaderExpressionInvoker.h deleted file mode 100644 index 2a4ad44fd..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CHeaderExpressionInvoker.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Created on: Jul 23, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CHEADEREXPRESSIONINVOKER_H_ -#define CHEADEREXPRESSIONINVOKER_H_ - - -#include "IBean.h" - -#include "IVariant.h" -#include "IntegrationSubsys.h" -#include "Integration/IIntMessage.h" -#include "Integration/IExpressionInvoker.h" - -namespace Caf { - -class CHeaderExpressionInvoker : - public TCafSubSystemObjectRoot, - public IBean, - public IExpressionInvoker { -public: - CHeaderExpressionInvoker(); - virtual ~CHeaderExpressionInvoker(); - - CAF_DECLARE_OBJECT_IDENTIFIER(_sObjIdHeaderExpressionInvoker) - - CAF_BEGIN_INTERFACE_MAP(CHeaderExpressionInvoker) - CAF_INTERFACE_ENTRY(IBean) - CAF_INTERFACE_ENTRY(IExpressionInvoker) - CAF_END_INTERFACE_MAP() - -public: // IBean - void initializeBean( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties); - - void terminateBean(); - -public: // IExpressionInvoker - SmartPtrIVariant invokeExpression( - const std::string& methodName, - const Cdeqstr& methodParams, - const SmartPtrIIntMessage& message); - -private: - bool _isInitialized; - -private: - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(CHeaderExpressionInvoker); -}; - -} - -#endif /* CHEADEREXPRESSIONINVOKER_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CHeaderValueRouterInstance.cpp b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CHeaderValueRouterInstance.cpp deleted file mode 100644 index d3db85248..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CHeaderValueRouterInstance.cpp +++ /dev/null @@ -1,208 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Common/IAppContext.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "Integration/IMessageChannel.h" -#include "Exception/CCafException.h" -#include "CHeaderValueRouterInstance.h" - -using namespace Caf; - -CHeaderValueRouterInstance::CHeaderValueRouterInstance() : - _isInitialized(false), - _resolutionRequired(false), - CAF_CM_INIT_LOG("CHeaderValueRouterInstance") { -} - -CHeaderValueRouterInstance::~CHeaderValueRouterInstance() { -} - -void CHeaderValueRouterInstance::initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection) { - CAF_CM_FUNCNAME("initialize"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - - _id = configSection->findRequiredAttribute("id"); - _headerName = configSection->findRequiredAttribute("header-name"); - _defaultOutputChannelId = - configSection->findOptionalAttribute("default-output-channel"); - - const std::string resolutionRequiredStr = configSection->findOptionalAttribute("resolution-required"); - _resolutionRequired = - (resolutionRequiredStr.empty() || resolutionRequiredStr.compare("true") == 0) ? true : false; - - const IDocument::SmartPtrCChildCollection childCollection = configSection->getAllChildren(); - for(TConstIterator childIter(*childCollection); childIter; childIter++) { - const std::string sectionName = childIter->first; - if (sectionName.compare("mapping") == 0) { - const SmartPtrIDocument document = childIter->second; - const std::string value = document->findRequiredAttribute("value"); - const std::string channel = document->findRequiredAttribute("channel"); - _valueToChannelMapping.insert(std::make_pair(value, channel)); - } - } - - if (_valueToChannelMapping.empty()) { - CAF_CM_EXCEPTIONEX_VA1(NoSuchElementException, ERROR_NOT_FOUND, - "No mapping sections found - %s", _id.c_str()); - } - - _isInitialized = true; - } - CAF_CM_EXIT; -} - -std::string CHeaderValueRouterInstance::getId() const { - CAF_CM_FUNCNAME_VALIDATE("getId"); - - std::string rc; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - rc = _id; - } - CAF_CM_EXIT; - - return rc; -} - -void CHeaderValueRouterInstance::wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver) { - CAF_CM_FUNCNAME("wire"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(appContext); - CAF_CM_VALIDATE_INTERFACE(channelResolver); - - _channelResolver = channelResolver; - - SmartPtrIMessageChannel defaultOutputChannel; - if (_defaultOutputChannelId.length()) { - try { - defaultOutputChannel = - _channelResolver->resolveChannelName(_defaultOutputChannelId); - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_WARN_CAFEXCEPTION; - CAF_CM_CLEAREXCEPTION; - if (defaultOutputChannel) { - CAF_CM_LOG_INFO_VA2( - "Successfully resolved default channel - id: %s, defaultOutputChannelId: %s", - _id.c_str(), - _defaultOutputChannelId.c_str()); - } else { - CAF_CM_EXCEPTIONEX_VA2( - NoSuchElementException, - 0, - "Failed to resolve default channel - id: %s, defaultChannelId: %s", - _id.c_str(), - _defaultOutputChannelId.c_str()); - } - } - - CAbstractMessageRouter::init(defaultOutputChannel, false, -1); - } - CAF_CM_EXIT; -} - -CHeaderValueRouterInstance::ChannelCollection CHeaderValueRouterInstance::getTargetChannels( - const SmartPtrIIntMessage& message) { - CAF_CM_FUNCNAME("getTargetChannels"); - - ChannelCollection messageChannels; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - const std::string outputChannel = calcOutputChannel(message); - if (outputChannel.empty() && _defaultOutputChannelId.empty()) { - CAF_CM_EXCEPTIONEX_VA2(NoSuchElementException, ERROR_NOT_FOUND, - "Did not find output channel and default channel not " - "provided - id: %s, headerName: %s", - _id.c_str(), _headerName.c_str()); - } - - SmartPtrIMessageChannel messageChannel; - if (! outputChannel.empty()) { - try { - messageChannel = _channelResolver->resolveChannelName(outputChannel); - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_WARN_CAFEXCEPTION; - CAF_CM_CLEAREXCEPTION; - - if (messageChannel.IsNull() && _resolutionRequired) { - CAF_CM_EXCEPTIONEX_VA3(NoSuchElementException, ERROR_NOT_FOUND, - "Failed to resolve channel when resolution is required - id: %s, " - "headerName: %s, outputChannel: %s", - _id.c_str(), _headerName.c_str(), outputChannel.c_str()); - } - - if (! messageChannel.IsNull()) { - CAF_CM_LOG_INFO_VA3( - "Successfully resolved channel - id: %s, headerName: %s, outputChannel: %s", - _id.c_str(), _headerName.c_str(), outputChannel.c_str()); - } - } - - if (messageChannel.IsNull() && _defaultOutputChannelId.empty()) { - CAF_CM_EXCEPTIONEX_VA3(NoSuchElementException, ERROR_NOT_FOUND, - "Failed to resolve channel when resolution is not required and default " - "channel is not available - id: %s, headerName: %s, outputChannel: %s", - _id.c_str(), _headerName.c_str(), outputChannel.c_str()); - } - - if (!messageChannel.IsNull()) { - messageChannels.push_back(messageChannel); - } - } - CAF_CM_EXIT; - - return messageChannels; -} - -std::string CHeaderValueRouterInstance::calcOutputChannel( - const SmartPtrIIntMessage& message) const { - CAF_CM_FUNCNAME_VALIDATE("calcOutputChannel"); - - std::string outputChannel; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_SMARTPTR(message); - - const std::string headerValue = message->findOptionalHeaderAsString(_headerName); - if (headerValue.empty()) { - CAF_CM_LOG_WARN_VA2("Header name not found in headers - id: %s, headerName: %s", - _id.c_str(), _headerName.c_str()); - } else { - const Cmapstrstr::const_iterator valueToChannelIter = - _valueToChannelMapping.find(headerValue); - if (valueToChannelIter == _valueToChannelMapping.end()) { - CAF_CM_LOG_WARN_VA3("Header name found in headers, but not config - id: %s, name: %s, val: %s", - _id.c_str(), _headerName.c_str(), headerValue.c_str()); - } else { - outputChannel = valueToChannelIter->second; - } - } - } - CAF_CM_EXIT; - - return outputChannel; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CHeaderValueRouterInstance.h b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CHeaderValueRouterInstance.h deleted file mode 100644 index 97436dbb1..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CHeaderValueRouterInstance.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CHeaderValueRouterInstance_h_ -#define CHeaderValueRouterInstance_h_ - -#include "Integration/IIntegrationComponentInstance.h" -#include "Common/IAppContext.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/Core/CAbstractMessageRouter.h" - -namespace Caf { - -class CHeaderValueRouterInstance : - public IIntegrationObject, - public IIntegrationComponentInstance, - public CAbstractMessageRouter -{ -public: - CHeaderValueRouterInstance(); - virtual ~CHeaderValueRouterInstance(); - - CAF_BEGIN_QI() - CAF_QI_ENTRY(IIntegrationObject) - CAF_QI_ENTRY(IIntegrationComponentInstance) - CAF_QI_ENTRY(IMessageRouter) - CAF_END_QI() - -public: // IIntegrationObject - void initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection); - - std::string getId() const; - -public: // IIntegrationComponentInstance - void wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver); - -private: - ChannelCollection getTargetChannels( - const SmartPtrIIntMessage& message); - -private: - bool _isInitialized; - std::string _id; - std::string _defaultOutputChannelId; - bool _resolutionRequired; - std::string _headerName; - Cmapstrstr _valueToChannelMapping; - SmartPtrIChannelResolver _channelResolver; - -private: - std::string calcOutputChannel( - const SmartPtrIIntMessage& message) const; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CHeaderValueRouterInstance); -}; -CAF_DECLARE_SMART_QI_POINTER(CHeaderValueRouterInstance); -} - -#endif // #ifndef CHeaderValueRouterInstance_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CIntegrationObjectFactory.cpp b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CIntegrationObjectFactory.cpp deleted file mode 100644 index 94eeb4dc2..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CIntegrationObjectFactory.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Created on: Aug 8, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Integration/IDocument.h" -#include "Integration/IIntegrationObject.h" -#include "Exception/CCafException.h" -#include "CIntegrationObjectFactory.h" -#include "CObjectFactoryTables.h" -#include "CDirectChannelInstance.h" -#include "CQueueChannelInstance.h" - -CIntegrationObjectFactory::CIntegrationObjectFactory() : - CAF_CM_INIT("CIntegrationObjectFactory") { -} - -CIntegrationObjectFactory::~CIntegrationObjectFactory() { -} - -void CIntegrationObjectFactory::initializeBean( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties) { - CAF_CM_FUNCNAME_VALIDATE("initializeBean"); - CAF_CM_VALIDATE_STL_EMPTY(ctorArgs); - CAF_CM_VALIDATE_STL_EMPTY(properties); - _ctorArgs = ctorArgs; - _properties = properties; -} - -void CIntegrationObjectFactory::terminateBean() { -} - -bool CIntegrationObjectFactory::isResponsible( - const SmartPtrIDocument& configSection) const { - CAF_CM_FUNCNAME_VALIDATE("isResponsible"); - CAF_CM_VALIDATE_INTERFACE(configSection); - return CObjectFactoryTables::objectCreatorMap.find( - configSection->getName()) != CObjectFactoryTables::objectCreatorMap.end(); -} - -SmartPtrIIntegrationObject CIntegrationObjectFactory::createObject( - const SmartPtrIDocument& configSection) const { - CAF_CM_FUNCNAME("createObject"); - ObjectCreatorMap::const_iterator entry = - CObjectFactoryTables::objectCreatorMap.find(configSection->getName()); - CAF_CM_ASSERT(entry != CObjectFactoryTables::objectCreatorMap.end()); - - SmartPtrIIntegrationObject object; - if (entry->second) { - object = (entry->second)(); - } else if (configSection->getName() == "channel") { - if (configSection->findOptionalChild("queue")) { - SmartPtrCQueueChannelInstance channel; - channel.CreateInstance(); - object = channel; - } else { - SmartPtrCDirectChannelInstance channel; - channel.CreateInstance(); - object = channel; - } - } else { - CAF_CM_EXCEPTIONEX_VA1( - IllegalStateException, - 0, - "config section '%s' is not handled by this factory. report this as a bug.", - configSection->getName().c_str()); - } - - object->initialize(_ctorArgs, _properties, configSection); - return object; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CIntegrationObjectFactory.h b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CIntegrationObjectFactory.h deleted file mode 100644 index 20e201a34..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CIntegrationObjectFactory.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Created on: Aug 8, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CIntegrationObjectFactory_h -#define CIntegrationObjectFactory_h - - -#include "IBean.h" - -#include "IntegrationSubsys.h" -#include "Integration/IDocument.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/IIntegrationComponent.h" - -namespace Caf { - -class CIntegrationObjectFactory : - public TCafSubSystemObjectRoot, - public IBean, - public IIntegrationComponent { -public: - CIntegrationObjectFactory(); - virtual ~CIntegrationObjectFactory(); - - CAF_DECLARE_OBJECT_IDENTIFIER(_sObjIdIntegrationObjectFactory) - - CAF_BEGIN_INTERFACE_MAP(CIntegrationObjectFactory) - CAF_INTERFACE_ENTRY(IBean) - CAF_INTERFACE_ENTRY(IIntegrationComponent) - CAF_END_INTERFACE_MAP() - -public: // IBean - void initializeBean( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties); - - void terminateBean(); - -public: // IIntegrationComponent - bool isResponsible( - const SmartPtrIDocument& configSection) const; - - SmartPtrIIntegrationObject createObject( - const SmartPtrIDocument& configSection) const; - -private: - IBean::Cargs _ctorArgs; - IBean::Cprops _properties; - -private: - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(CIntegrationObjectFactory); -}; - -} - -#endif /* CIntegrationObjectFactory_h */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CLoggingChannelAdapterInstance.cpp b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CLoggingChannelAdapterInstance.cpp deleted file mode 100644 index c05e0d0b1..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CLoggingChannelAdapterInstance.cpp +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Created on: Jan 31, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Common/IAppContext.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "Exception/CCafException.h" -#include "CLoggingChannelAdapterInstance.h" - -using namespace Caf; - -CLoggingChannelAdapterInstance::CLoggingChannelAdapterInstance() : - _isInitialized(false), - _level(log4cpp::Priority::INFO), - _logFullMessage(false), - _category(NULL), - CAF_CM_INIT("CLoggingChannelAdapterInstance") { -} - -CLoggingChannelAdapterInstance::~CLoggingChannelAdapterInstance() { -} - -void CLoggingChannelAdapterInstance::initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection) { - CAF_CM_FUNCNAME("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - - _id = configSection->findRequiredAttribute("id"); - _category = &log4cpp::Category::getInstance(_id.c_str()); - std::string arg = configSection->findOptionalAttribute("level"); - if (!arg.empty()) { - if (g_ascii_strncasecmp(arg.c_str(), "crit", arg.length()) == 0) { - _level = log4cpp::Priority::CRIT; - } else if (g_ascii_strncasecmp(arg.c_str(), "error", arg.length()) == 0) { - _level = log4cpp::Priority::ERROR; - } else if (g_ascii_strncasecmp(arg.c_str(), "warn", arg.length()) == 0) { - _level = log4cpp::Priority::WARN; - } else if (g_ascii_strncasecmp(arg.c_str(), "info", arg.length()) == 0) { - _level = log4cpp::Priority::INFO; - } else if (g_ascii_strncasecmp(arg.c_str(), "debug", arg.length()) == 0) { - _level = log4cpp::Priority::DEBUG; - } else { - CAF_CM_EXCEPTIONEX_VA1( - InvalidArgumentException, - 0, - "'%s' is not a valid logging level. " - "Choices are 'debug', 'info', 'warn', 'error' and 'crit'", - arg.c_str()); - } - } - arg = configSection->findOptionalAttribute("log-full-message"); - if (!arg.empty()) { - if (g_ascii_strncasecmp(arg.c_str(), "true", arg.length()) == 0) { - _logFullMessage = true; - } else if (g_ascii_strncasecmp(arg.c_str(), "false", arg.length()) == 0) { - _logFullMessage = false; - } else { - CAF_CM_EXCEPTIONEX_VA1( - InvalidArgumentException, - 0, - "'%s' is not a valid log-full-message value. " - "Choices are 'true' and 'false'", - arg.c_str()); - } - } - - _isInitialized = true; -} - -std::string CLoggingChannelAdapterInstance::getId() const { - CAF_CM_FUNCNAME_VALIDATE("getId"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _id; -} - -void CLoggingChannelAdapterInstance::wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver) { - CAF_CM_FUNCNAME_VALIDATE("wire"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(appContext); - CAF_CM_VALIDATE_INTERFACE(channelResolver); -} - -void CLoggingChannelAdapterInstance::handleMessage(const SmartPtrIIntMessage& message) { - CAF_CM_FUNCNAME_VALIDATE("handleMessage"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - _savedMessage = message; - _category->log(_level, message->getPayloadStr().c_str()); - if (_logFullMessage) { - IIntMessage::SmartPtrCHeaders headers = message->getHeaders(); - for (IIntMessage::CHeaders::const_iterator headerIter = headers->begin(); - headerIter != headers->end(); - headerIter++) { - std::stringstream logMessage; - logMessage << '[' - << headerIter->first - << '=' - << headerIter->second.first->toString() - << ']'; - _category->log(_level, logMessage.str()); - } - } -} - -SmartPtrIIntMessage CLoggingChannelAdapterInstance::getSavedMessage() const { - CAF_CM_FUNCNAME_VALIDATE("getSavedMessage"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _savedMessage; -} - -void CLoggingChannelAdapterInstance::clearSavedMessage() { - CAF_CM_FUNCNAME_VALIDATE("clearSavedMessage"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - _savedMessage = NULL; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CLoggingChannelAdapterInstance.h b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CLoggingChannelAdapterInstance.h deleted file mode 100644 index d6df13e7a..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CLoggingChannelAdapterInstance.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Created on: Jan 31, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CLOGGINGCHANNELADAPTERINSTANCE_H_ -#define CLOGGINGCHANNELADAPTERINSTANCE_H_ - - -#include "Integration/IIntegrationComponentInstance.h" - -#include "Common/IAppContext.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/IMessageHandler.h" - -namespace Caf { - -class CLoggingChannelAdapterInstance : - public IIntegrationObject, - public IIntegrationComponentInstance, - public IMessageHandler { -public: - CLoggingChannelAdapterInstance(); - virtual ~CLoggingChannelAdapterInstance(); - - CAF_BEGIN_QI() - CAF_QI_ENTRY(IIntegrationObject) - CAF_QI_ENTRY(IIntegrationComponentInstance) - CAF_QI_ENTRY(IMessageHandler) - CAF_END_QI() - -public: // IIntegrationObject - void initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection); - - std::string getId() const; - -public: // IIntegrationComponentInstance - void wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver); - -public: // IMessageHandler - void handleMessage(const SmartPtrIIntMessage& message); - SmartPtrIIntMessage getSavedMessage() const; - void clearSavedMessage(); - -private: - bool _isInitialized; - std::string _id; - log4cpp::Priority::PriorityLevel _level; - bool _logFullMessage; - log4cpp::Category* _category; - SmartPtrIIntMessage _savedMessage; - -private: - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(CLoggingChannelAdapterInstance); -}; -CAF_DECLARE_SMART_QI_POINTER(CLoggingChannelAdapterInstance); -} - -#endif /* CLOGGINGCHANNELADAPTERINSTANCE_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CMessageHandlerChainInstance.cpp b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CMessageHandlerChainInstance.cpp deleted file mode 100644 index 30eed0902..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CMessageHandlerChainInstance.cpp +++ /dev/null @@ -1,474 +0,0 @@ -/* - * Created on: Aug 10, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Common/IAppContext.h" -#include "IBean.h" -#include "ICafObject.h" -#include "Integration/Core/CErrorHandler.h" -#include "Integration/Core/CSimpleAsyncTaskExecutor.h" -#include "Integration/Core/CSourcePollingChannelAdapter.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "Integration/IIntegrationComponent.h" -#include "Integration/IIntegrationComponentInstance.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/IMessageChannel.h" -#include "Integration/IPollableChannel.h" -#include "CMessageHandlerChainInstance.h" -#include "Exception/CCafException.h" -#include "CObjectFactoryTables.h" -#include "Integration/Core/CMessageHeaderUtils.h" - -using namespace Caf; - -CMessageHandlerChainInstance::CMessageHandlerChainInstance() : - _isInitialized(false), - _isRunning(false), - CAF_CM_INIT_LOG("CMessageHandlerChainInstance") { -} - -CMessageHandlerChainInstance::~CMessageHandlerChainInstance() { - if (_weakRefSelf) { - _weakRefSelf->setReference(NULL); - _weakRefSelf = NULL; - } -} - -void CMessageHandlerChainInstance::initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - _ctorArgs = ctorArgs; - _properties = properties; - _configSection = configSection; - _id = _configSection->findRequiredAttribute("id"); - _isInitialized = true; -} - -std::string CMessageHandlerChainInstance::getId() const { - return _id; -} - -void CMessageHandlerChainInstance::wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver) { - CAF_CM_FUNCNAME("wire"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(appContext); - CAF_CM_VALIDATE_INTERFACE(channelResolver); - - // no point in doing a bunch of work if there are no chained components - IDocument::SmartPtrCOrderedChildCollection handlerConfigs = - _configSection->getAllChildrenInOrder(); - if (!handlerConfigs->size()) { - CAF_CM_EXCEPTIONEX_VA1(NoSuchElementException, 0, - "No message handlers are present in the chain '%s'", _id.c_str()); - } - - // an input channel is required - const std::string inputChannelId = _configSection->findRequiredAttribute( - "input-channel"); - SmartPtrIMessageChannel inputChannel = channelResolver->resolveChannelName( - inputChannelId); - SmartPtrIPollableChannel inputPollableChannel; - inputPollableChannel.QueryInterface(inputChannel, false); - _subscribableInputChannel.QueryInterface(inputChannel, false); - if (!inputPollableChannel && !_subscribableInputChannel) { - CAF_CM_EXCEPTIONEX_VA1(NoSuchInterfaceException, 0, - "Input channel '%s' does not support any required interfaces", - inputChannelId.c_str()); - } - - // an output channel may be required - we'll figure it out in a bit - const std::string outputChannelId = _configSection->findOptionalAttribute( - "output-channel"); - SmartPtrIMessageChannel outputChannel; - if (outputChannelId.length()) { - outputChannel = channelResolver->resolveChannelName(outputChannelId); - } - - // build up a collection of messaging objects comprising the chain - ChainLinks chainLinks; - for (TSmartConstIterator handlerConfig( - *handlerConfigs); handlerConfig; handlerConfig++) { - CAF_CM_LOG_DEBUG_VA2("Found handler config '%s' chain '%s'", - handlerConfig->getName().c_str(), _id.c_str()); - const std::string& handlerType = handlerConfig->getName(); - MessageHandlerObjectCreatorMap::const_iterator handlerMapEntry = - CObjectFactoryTables::messageHandlerObjectCreatorMap.find(handlerType); - if (handlerMapEntry - == CObjectFactoryTables::messageHandlerObjectCreatorMap.end()) { - CAF_CM_EXCEPTIONEX_VA1(InvalidArgumentException, 0, - "Message handler type '%s' is not allowed to be part of a chain", - handlerType.c_str()); - } - - // Get the messaging object - std::string messageHandlerId; - SmartPtrICafObject messageHandlerObj; - - if (handlerMapEntry->second.first) { - SmartPtrIIntegrationObject intObj; - intObj = (handlerMapEntry->second.first)(); - intObj->initialize(_ctorArgs, _properties, *handlerConfig); - messageHandlerId = intObj->getId(); - messageHandlerObj = intObj; - } else { - messageHandlerId = handlerConfig->findRequiredAttribute("id"); - const std::string refStr = handlerConfig->findRequiredAttribute("ref"); - SmartPtrIBean bean = appContext->getBean(refStr); - SmartPtrIIntegrationComponent integrationComponent; - integrationComponent.QueryInterface(bean, false); - if (integrationComponent) { - messageHandlerObj = integrationComponent->createObject(*handlerConfig); - } else { - messageHandlerObj = bean; - } - } - - // Create a partially initialized chain link. - SmartPtrChainedMessageHandler handler; - handler.CreateInstance(); - handler->setId(messageHandlerId); - handler->setMessageHandler(messageHandlerObj); - - SmartPtrChainLink chainLink; - chainLink.CreateInstance(); - chainLink->handler = handler; - chainLink->id = messageHandlerId; - chainLink->isMessageProducer = handlerMapEntry->second.second; - chainLinks.push_back(chainLink); - CAF_CM_LOG_DEBUG_VA2("Adding message handler '%s' to chain '%s'", - messageHandlerId.c_str(), _id.c_str()); - } - - // Configure the chain links. - // All handlers in the chain except for the last one must be message producers. - // If the last object is a message producer than the output-channel must be set. - for (size_t i = 0; i < chainLinks.size(); ++i) { - SmartPtrChainLink chainLink = chainLinks[i]; - if (i < chainLinks.size() - 1) { - if (!chainLink->isMessageProducer) { - CAF_CM_EXCEPTIONEX_VA2(InvalidArgumentException, 0, - "Handler '%s' in chain '%s' is not a message producer. " - "All handlers except for the last one in the chain must " - "be message producers.", chainLink->id.c_str(), _id.c_str()); - } - - SmartPtrInterconnectChannel nextChannel; - nextChannel.CreateInstance(); - nextChannel->init(chainLinks[i + 1]->handler); - chainLink->handler->setOutputChannel(nextChannel); - } else { - if (outputChannel && !chainLink->isMessageProducer) { - CAF_CM_EXCEPTIONEX_VA2(InvalidArgumentException, 0, - "Handler '%s' in chain '%s' - " - "An output channel was provided but the last handler " - "in the chain is not a message producer.", chainLink->id.c_str(), - _id.c_str()); - } else if (!outputChannel && chainLink->isMessageProducer) { - CAF_CM_EXCEPTIONEX_VA2(InvalidArgumentException, 0, - "Handler '%s' in chain '%s' - " - "An output channel was not provided but the last handler " - "in the chain is a message producer.", chainLink->id.c_str(), - _id.c_str()); - } - if (chainLink->isMessageProducer) { - chainLink->handler->setOutputChannel(outputChannel); - } - } - } - - // Initialize the chain link handlers and store them - // in this object's state - for (TSmartConstIterator chainLink(chainLinks); chainLink; chainLink++) { - chainLink->handler->init(appContext, channelResolver); - _messageHandlers.push_back(chainLink->handler); - } - - _weakRefSelf.CreateInstance(); - _weakRefSelf->setReference(this); - - if (!_subscribableInputChannel) { - SmartPtrCErrorHandler errorHandler; - errorHandler.CreateInstance(); - errorHandler->initialize(channelResolver, - channelResolver->resolveChannelName("errorChannel")); - - SmartPtrCSourcePollingChannelAdapter channelAdapter; - channelAdapter.CreateInstance(); - channelAdapter->initialize(_weakRefSelf, inputPollableChannel, errorHandler); - - SmartPtrCSimpleAsyncTaskExecutor taskExecutor; - taskExecutor.CreateInstance(); - taskExecutor->initialize(channelAdapter, errorHandler); - - _taskExecutor = taskExecutor; - } -} - -void CMessageHandlerChainInstance::start(const uint32 timeoutMs) { - CAF_CM_FUNCNAME("start"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - if (_subscribableInputChannel) { - CAF_CM_LOG_DEBUG_VA1("Subscribing handler - %s", _id.c_str()); - _subscribableInputChannel->subscribe(_weakRefSelf); - } else if (_taskExecutor) { - CAF_CM_LOG_DEBUG_VA1("Executing task - %s", _id.c_str()); - _taskExecutor->execute(timeoutMs); - } else { - CAF_CM_EXCEPTIONEX_VA1(IllegalStateException, 0, - "handler '%s' : you should not see this. report this bug.", _id.c_str()); - } - _isRunning = true; -} - -void CMessageHandlerChainInstance::stop(const uint32 timeoutMs) { - CAF_CM_FUNCNAME("stop"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - try { - if (_subscribableInputChannel) { - CAF_CM_LOG_DEBUG_VA1("Unsubscribing handler - %s", _id.c_str()); - _subscribableInputChannel->subscribe(_weakRefSelf); - } else if (_taskExecutor) { - CAF_CM_LOG_DEBUG_VA1("Stopping task - %s", _id.c_str()); - _taskExecutor->cancel(timeoutMs); - } else { - CAF_CM_EXCEPTIONEX_VA1(IllegalStateException, 0, - "handler '%s' : you should not see this. report this bug.", _id.c_str()); - } - } - CAF_CM_CATCH_ALL; - _weakRefSelf->setReference(NULL); - _isRunning = false; - CAF_CM_THROWEXCEPTION; -} - -bool CMessageHandlerChainInstance::isRunning() const { - CAF_CM_FUNCNAME_VALIDATE("isRunning"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _isRunning; -} - -void CMessageHandlerChainInstance::handleMessage(const SmartPtrIIntMessage& message) { - CAF_CM_FUNCNAME("handleMessage"); - - try { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STL(_messageHandlers); - CAF_CM_VALIDATE_INTERFACE(message); - //logMessage(message); - - for (TSmartConstIterator messageHandlerIter(_messageHandlers); - messageHandlerIter; messageHandlerIter++) { - const SmartPtrChainedMessageHandler messageHandler = *messageHandlerIter; - CAF_CM_VALIDATE_SMARTPTR(messageHandler); - messageHandler->clearSavedMessage(); - } - - _savedMessage = message; - CAF_CM_VALIDATE_SMARTPTR(_messageHandlers.front()); - _messageHandlers.front()->handleMessage(message); - } - CAF_CM_CATCH_ALL; - - try { - for (TSmartConstIterator messageHandlerIter(_messageHandlers); - messageHandlerIter; messageHandlerIter++) { - const SmartPtrChainedMessageHandler messageHandler = *messageHandlerIter; - CAF_CM_VALIDATE_SMARTPTR(messageHandler); - const SmartPtrIIntMessage savedMessage = messageHandler->getSavedMessage(); - if (!savedMessage.IsNull()) { - _savedMessage = savedMessage; - } - } - } - CAF_CM_CATCH_ALL; - CAF_CM_THROWEXCEPTION; -} - -SmartPtrIIntMessage CMessageHandlerChainInstance::getSavedMessage() const { - CAF_CM_FUNCNAME_VALIDATE("getSavedMessage"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _savedMessage; -} - -void CMessageHandlerChainInstance::clearSavedMessage() { - CAF_CM_FUNCNAME_VALIDATE("clearSavedMessage"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - _savedMessage = NULL; -} - -CMessageHandlerChainInstance::ChainedMessageHandler::ChainedMessageHandler() : - _isInitialized(false), - CAF_CM_INIT("CMessageHandlerChainInstance::ChainedMessageHandler") { -} - -void CMessageHandlerChainInstance::ChainedMessageHandler::init( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver) { - CAF_CM_FUNCNAME_VALIDATE("init"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(appContext); - CAF_CM_VALIDATE_INTERFACE(channelResolver); - CAF_CM_VALIDATE_STRING(_id); - CAF_CM_VALIDATE_INTERFACE(_messageHandlerObj); - // output channel is optional - - // The underlying component may need to be wired - SmartPtrIIntegrationComponentInstance intInstance; - intInstance.QueryInterface(_messageHandlerObj, false); - if (intInstance) { - intInstance->wire(appContext, channelResolver); - } - - _messageHandler.CreateInstance(); - _messageHandler->initialize(_id, _outputChannel, _messageHandlerObj); - _isInitialized = true; -} -void CMessageHandlerChainInstance::ChainedMessageHandler::setId(const std::string& id) { - CAF_CM_FUNCNAME_VALIDATE("setId"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(id); - _id = id; -} - -void CMessageHandlerChainInstance::ChainedMessageHandler::setOutputChannel( - const SmartPtrIMessageChannel& channel) { - CAF_CM_FUNCNAME_VALIDATE("setOutputChannel"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(channel); - _outputChannel = channel; -} - -void CMessageHandlerChainInstance::ChainedMessageHandler::setMessageHandler( - const SmartPtrICafObject& handlerObj) { - CAF_CM_FUNCNAME_VALIDATE("setMessageHandler"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(handlerObj); - _messageHandlerObj = handlerObj; -} - -void CMessageHandlerChainInstance::ChainedMessageHandler::handleMessage( - const SmartPtrIIntMessage& message) { - CAF_CM_FUNCNAME_VALIDATE("handleMessage"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(message); - //logMessage(message); - _messageHandler->handleMessage(message); -} - -SmartPtrIIntMessage CMessageHandlerChainInstance::ChainedMessageHandler::getSavedMessage() const { - CAF_CM_FUNCNAME_VALIDATE("getSavedMessage"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _messageHandler->getSavedMessage(); -} - -void CMessageHandlerChainInstance::ChainedMessageHandler::clearSavedMessage() { - CAF_CM_FUNCNAME_VALIDATE("clearSavedMessage"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - _messageHandler->clearSavedMessage(); -} - -CMessageHandlerChainInstance::InterconnectChannel::InterconnectChannel() : - CAF_CM_INIT("CMessageHandlerChainInstance::InterconnectChannel") { -} - -CMessageHandlerChainInstance::InterconnectChannel::~InterconnectChannel() { -} - -void CMessageHandlerChainInstance::InterconnectChannel::init( - const SmartPtrChainedMessageHandler& nextHandler) { - _nextHandler = nextHandler; -} - -bool CMessageHandlerChainInstance::InterconnectChannel::send( - const SmartPtrIIntMessage& message) { - CAF_CM_FUNCNAME_VALIDATE("send"); - CAF_CM_VALIDATE_SMARTPTR(_nextHandler); - _nextHandler->handleMessage(message); - return true; -} - -bool CMessageHandlerChainInstance::InterconnectChannel::send( - const SmartPtrIIntMessage& message, - const int32 timeout) { - return send(message); -} - -CMessageHandlerChainInstance::SelfWeakReference::SelfWeakReference() : - _reference(NULL) { - CAF_CM_INIT_THREADSAFE; -} - -void CMessageHandlerChainInstance::SelfWeakReference::setReference( - IMessageHandler *handler) { - CAF_CM_LOCK_UNLOCK; - _reference = handler; -} - -void CMessageHandlerChainInstance::SelfWeakReference::handleMessage( - const SmartPtrIIntMessage& message) { - CAF_CM_LOCK_UNLOCK; - if (_reference) { - _reference->handleMessage(message); - } -} - -SmartPtrIIntMessage CMessageHandlerChainInstance::SelfWeakReference::getSavedMessage() const { - CAF_CM_LOCK_UNLOCK; - SmartPtrIIntMessage savedMessage; - if (_reference) { - savedMessage = _reference->getSavedMessage(); - } - - return savedMessage; -} - -void CMessageHandlerChainInstance::SelfWeakReference::clearSavedMessage() { - CAF_CM_LOCK_UNLOCK; - if (_reference) { - _reference->clearSavedMessage(); - } -} - -void CMessageHandlerChainInstance::logMessage( - const SmartPtrIIntMessage& message) const { - CAF_CM_FUNCNAME_VALIDATE("logMessage"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - const std::string prefix = _id.empty() ? "NULL" : _id; - if (message.IsNull()) { - CAF_CM_LOG_DEBUG_VA1("%s - NULL Message", prefix.c_str()); - } else { - CAF_CM_LOG_DEBUG_VA2("%s - payload: %s", prefix.c_str(), - message->getPayloadStr().c_str()); - CMessageHeaderUtils::log(message->getHeaders()); - } -} - -void CMessageHandlerChainInstance::ChainedMessageHandler::logMessage( - const SmartPtrIIntMessage& message) const { - CAF_CM_STATIC_FUNC_LOG_ONLY("ChainedMessageHandler", "logMessage"); - - const std::string prefix = _id.empty() ? "NULL" : _id; - if (message.IsNull()) { - CAF_CM_LOG_DEBUG_VA1("%s - NULL Message", prefix.c_str()); - } else { - CAF_CM_LOG_DEBUG_VA2("%s - payload: %s", prefix.c_str(), - message->getPayloadStr().c_str()); - CMessageHeaderUtils::log(message->getHeaders()); - } -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CNullChannel.cpp b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CNullChannel.cpp deleted file mode 100644 index dff97e716..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CNullChannel.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Integration/IDocument.h" -#include "Integration/IIntegrationObject.h" -#include "CNullChannel.h" -#include "CNullChannelInstance.h" - -using namespace Caf; - -CNullChannel::CNullChannel() : - _isInitialized(false), - CAF_CM_INIT("CNullChannel") { -} - -CNullChannel::~CNullChannel() { -} - -void CNullChannel::initializeBean( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties) { - - CAF_CM_FUNCNAME_VALIDATE("initializeBean"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STL_EMPTY(ctorArgs); - CAF_CM_VALIDATE_STL_EMPTY(properties); - _ctorArgs = ctorArgs; - _properties = properties; - initialize(); - } - CAF_CM_EXIT; -} - -void CNullChannel::terminateBean() { -} - -void CNullChannel::initialize() { - - CAF_CM_FUNCNAME_VALIDATE("initialize"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - - _isInitialized = true; - } - CAF_CM_EXIT; -} - -bool CNullChannel::isResponsible( - const SmartPtrIDocument& configSection) const { - CAF_CM_FUNCNAME_VALIDATE("isResponsible"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - } - CAF_CM_EXIT; - - return false; -} - -SmartPtrIIntegrationObject CNullChannel::createObject( - const SmartPtrIDocument& configSection) const { - CAF_CM_FUNCNAME_VALIDATE("createObject"); - - SmartPtrIIntegrationObject rc; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - // configSection is optional - - SmartPtrCNullChannelInstance instance; - instance.CreateInstance(); - instance->initialize(_ctorArgs, _properties, configSection); - rc.QueryInterface(instance, false); - CAF_CM_VALIDATE_INTERFACE(rc); - } - CAF_CM_EXIT; - - return rc; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CNullChannel.h b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CNullChannel.h deleted file mode 100644 index e2bf860cb..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CNullChannel.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CNullChannel_h_ -#define CNullChannel_h_ - - -#include "IBean.h" - -#include "IntegrationSubsys.h" -#include "Integration/IDocument.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/IIntegrationComponent.h" - -namespace Caf { - -/// Sends responses/errors back to the client. -class CNullChannel : - public TCafSubSystemObjectRoot, - public IBean, - public IIntegrationComponent -{ -public: - CNullChannel(); - virtual ~CNullChannel(); - - CAF_DECLARE_OBJECT_IDENTIFIER(_sObjIdNullChannel) - - CAF_BEGIN_INTERFACE_MAP(CNullChannel) - CAF_INTERFACE_ENTRY(IBean) - CAF_INTERFACE_ENTRY(IIntegrationComponent) - CAF_END_INTERFACE_MAP() - -public: - void initialize(); - -public: // IBean - void initializeBean(const IBean::Cargs& ctorArgs, const IBean::Cprops& properties); - void terminateBean(); - -public: // IIntegrationComponent - bool isResponsible( - const SmartPtrIDocument& configSection) const; - - SmartPtrIIntegrationObject createObject( - const SmartPtrIDocument& configSection) const; - -private: - bool _isInitialized; - IBean::Cargs _ctorArgs; - IBean::Cprops _properties; - -private: - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(CNullChannel); -}; - -} - -#endif // #ifndef CNullChannel_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CNullChannelInstance.cpp b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CNullChannelInstance.cpp deleted file mode 100644 index b0068444d..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CNullChannelInstance.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Common/IAppContext.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "CNullChannelInstance.h" - -using namespace Caf; - -CNullChannelInstance::CNullChannelInstance() : - _isInitialized(false), - CAF_CM_INIT_LOG("CNullChannelInstance") { -} - -CNullChannelInstance::~CNullChannelInstance() { -} - -void CNullChannelInstance::initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection) { - - CAF_CM_FUNCNAME_VALIDATE("initialize"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - // configSection is optional - - _id = "nullChannel"; - - _isInitialized = true; - } - CAF_CM_EXIT; -} - -std::string CNullChannelInstance::getId() const { - CAF_CM_FUNCNAME_VALIDATE("getId"); - - std::string rc; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - rc = _id; - } - CAF_CM_EXIT; - - return rc; -} - -void CNullChannelInstance::wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver) { - CAF_CM_FUNCNAME_VALIDATE("wire"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(appContext); - CAF_CM_VALIDATE_INTERFACE(channelResolver); - } - CAF_CM_EXIT; -} - -bool CNullChannelInstance::doSend( - const SmartPtrIIntMessage& message, - int32 timeout) { - CAF_CM_FUNCNAME_VALIDATE("doSend"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(message); - - CAF_CM_LOG_DEBUG_VA1("Received message - %s", message->getPayloadStr().c_str()); - } - CAF_CM_EXIT; - return true; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CNullChannelInstance.h b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CNullChannelInstance.h deleted file mode 100644 index 0400cf601..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CNullChannelInstance.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CNullChannelInstance_h_ -#define CNullChannelInstance_h_ - - -#include "Integration/IIntegrationComponentInstance.h" - -#include "Common/IAppContext.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/Core/CAbstractMessageChannel.h" - -namespace Caf { - -/// Sends responses/errors back to the client. -class CNullChannelInstance : - public IIntegrationObject, - public IIntegrationComponentInstance, - public CAbstractMessageChannel -{ -public: - CNullChannelInstance(); - virtual ~CNullChannelInstance(); - - CAF_BEGIN_QI() - CAF_QI_ENTRY(IIntegrationObject) - CAF_QI_ENTRY(IIntegrationComponentInstance) - CAF_QI_ENTRY(IMessageChannel) - CAF_QI_ENTRY(IChannelInterceptorSupport) - CAF_END_QI() - -public: // IIntegrationObject - void initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection); - - std::string getId() const; - -public: // IIntegrationComponentInstance - void wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver); - -protected: // CAbstractMessageChannel - bool doSend( - const SmartPtrIIntMessage& message, - int32 timeout); - -private: - bool _isInitialized; - std::string _id; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CNullChannelInstance); -}; -CAF_DECLARE_SMART_QI_POINTER(CNullChannelInstance); -} - -#endif // #ifndef CNullChannelInstance_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CObjectFactoryTables.cpp b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CObjectFactoryTables.cpp deleted file mode 100644 index 6f957bae8..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CObjectFactoryTables.cpp +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Created on: Aug 13, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "CMessageHandlerChainInstance.h" -#include "CObjectFactoryTables.h" -#include "CServiceActivatorInstance.h" -#include "CWireTapInstance.h" -#include "CPublishSubscribeChannelInstance.h" -#include "CFileInboundChannelAdapterInstance.h" -#include "CFileOutboundChannelAdapterInstance.h" -#include "CFileToStringTransformerInstance.h" -#include "CHeaderEnricherTransformerInstance.h" -#include "CHeaderValueRouterInstance.h" -#include "CPayloadContentRouterInstance.h" -#include "CLoggingChannelAdapterInstance.h" -#include "CRecipientListRouterInstance.h" -#include "CRouterInstance.h" -#include "CXPathHeaderEnricherTransformerInstance.h" - -using namespace Caf; - -const ObjectCreatorMap::value_type CObjectFactoryTables::objectCreatorEntries[] = { - ObjectCreatorMap::value_type( - "file-to-string-transformer", - CreateIntegrationObject), - ObjectCreatorMap::value_type( - "header-enricher", - CreateIntegrationObject), - ObjectCreatorMap::value_type( - "transformer", - CreateIntegrationObject), - ObjectCreatorMap::value_type( - "header-value-router", - CreateIntegrationObject), - ObjectCreatorMap::value_type( - "payload-content-router", - CreateIntegrationObject), - ObjectCreatorMap::value_type( - "splitter", - CreateIntegrationObject), - ObjectCreatorMap::value_type( - "service-activator", - CreateIntegrationObject), - ObjectCreatorMap::value_type( - "logging-channel-adapter", - CreateIntegrationObject), - ObjectCreatorMap::value_type( - "wire-tap", - CreateIntegrationObject), - ObjectCreatorMap::value_type( - "publish-subscribe-channel", - CreateIntegrationObject), - ObjectCreatorMap::value_type( - "file-inbound-channel-adapter", - CreateIntegrationObject), - ObjectCreatorMap::value_type( - "file-outbound-channel-adapter", - CreateIntegrationObject), - ObjectCreatorMap::value_type( - "channel", - NULL), - ObjectCreatorMap::value_type( - "recipient-list-router", - CreateIntegrationObject), - ObjectCreatorMap::value_type( - "chain", - CreateIntegrationObject), - ObjectCreatorMap::value_type( - "router", - CreateIntegrationObject), - ObjectCreatorMap::value_type( - "xpath-header-enricher", - CreateIntegrationObject), - }; - -const ObjectCreatorMap CObjectFactoryTables::objectCreatorMap( - objectCreatorEntries, - objectCreatorEntries + - (sizeof(objectCreatorEntries)/sizeof(objectCreatorEntries[0]))); - - -const MessageHandlerObjectCreatorMap::value_type - CObjectFactoryTables::messageHandlerObjectCreatorEntries[] = { - MessageHandlerObjectCreatorMap::value_type( - "service-activator", - MessageHandlerObjectCreatorMap::mapped_type( - NULL, - true)), - MessageHandlerObjectCreatorMap::value_type( - "file-to-string-transformer", - MessageHandlerObjectCreatorMap::mapped_type( - CreateIntegrationObject, - true)), - MessageHandlerObjectCreatorMap::value_type( - "header-enricher", - MessageHandlerObjectCreatorMap::mapped_type( - CreateIntegrationObject, - true)), - MessageHandlerObjectCreatorMap::value_type( - "header-value-router", - MessageHandlerObjectCreatorMap::mapped_type( - CreateIntegrationObject, - false)), - MessageHandlerObjectCreatorMap::value_type( - "payload-content-router", - MessageHandlerObjectCreatorMap::mapped_type( - CreateIntegrationObject, - false)), - MessageHandlerObjectCreatorMap::value_type( - "logging-channel-adapter", - MessageHandlerObjectCreatorMap::mapped_type( - CreateIntegrationObject, - false)), - MessageHandlerObjectCreatorMap::value_type( - "splitter", - MessageHandlerObjectCreatorMap::mapped_type( - NULL, - true)), - MessageHandlerObjectCreatorMap::value_type( - "transformer", - MessageHandlerObjectCreatorMap::mapped_type( - NULL, - true)), - MessageHandlerObjectCreatorMap::value_type( - "recipient-list-router", - MessageHandlerObjectCreatorMap::mapped_type( - CreateIntegrationObject, - false)), - MessageHandlerObjectCreatorMap::value_type( - "router", - MessageHandlerObjectCreatorMap::mapped_type( - CreateIntegrationObject, - false)), - MessageHandlerObjectCreatorMap::value_type( - "file-outbound-channel-adapter", - MessageHandlerObjectCreatorMap::mapped_type( - CreateIntegrationObject, - false)), - MessageHandlerObjectCreatorMap::value_type( - "xpath-header-enricher", - MessageHandlerObjectCreatorMap::mapped_type( - CreateIntegrationObject, - true)) - }; - -const MessageHandlerObjectCreatorMap CObjectFactoryTables::messageHandlerObjectCreatorMap( - messageHandlerObjectCreatorEntries, - messageHandlerObjectCreatorEntries + - (sizeof(messageHandlerObjectCreatorEntries)/ - sizeof(messageHandlerObjectCreatorEntries[0]))); diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CObjectFactoryTables.h b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CObjectFactoryTables.h deleted file mode 100644 index 6eef51761..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CObjectFactoryTables.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Created on: Aug 13, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CObjectFactoryTables_h -#define CObjectFactoryTables_h - -namespace Caf { - -struct CObjectFactoryTables { - static const ObjectCreatorMap objectCreatorMap; - static const ObjectCreatorMap::value_type objectCreatorEntries[]; - - static const MessageHandlerObjectCreatorMap messageHandlerObjectCreatorMap; - static const MessageHandlerObjectCreatorMap::value_type messageHandlerObjectCreatorEntries[]; -}; - -} - -#endif /* CObjectFactoryTables_h */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CPayloadContentRouterInstance.cpp b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CPayloadContentRouterInstance.cpp deleted file mode 100644 index cf483cdde..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CPayloadContentRouterInstance.cpp +++ /dev/null @@ -1,208 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Common/CCafRegex.h" -#include "Common/IAppContext.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "Integration/IMessageChannel.h" -#include "Memory/DynamicArray/DynamicArrayInc.h" -#include "Exception/CCafException.h" -#include "CPayloadContentRouterInstance.h" - -using namespace Caf; - -CPayloadContentRouterInstance::CPayloadContentRouterInstance() : - _isInitialized(false), - _resolutionRequired(false), - CAF_CM_INIT_LOG("CPayloadContentRouterInstance") { -} - -CPayloadContentRouterInstance::~CPayloadContentRouterInstance() { -} - -void CPayloadContentRouterInstance::initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection) { - CAF_CM_FUNCNAME("initialize"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - - _id = configSection->findRequiredAttribute("id"); - _defaultOutputChannelId = configSection->findOptionalAttribute("default-output-channel"); - - const std::string resolutionRequiredStr = configSection->findOptionalAttribute("resolution-required"); - _resolutionRequired = - (resolutionRequiredStr.empty() || resolutionRequiredStr.compare("true") == 0) ? true : false; - - const IDocument::SmartPtrCChildCollection childCollection = configSection->getAllChildren(); - for(TConstIterator childIter(*childCollection); childIter; childIter++) { - const std::string sectionName = childIter->first; - if (sectionName.compare("mapping") == 0) { - const SmartPtrIDocument document = childIter->second; - const std::string value = document->findRequiredAttribute("value"); - const std::string channel = document->findRequiredAttribute("channel"); - _valueToChannelMapping.insert(std::make_pair(value, channel)); - } - } - - if (_valueToChannelMapping.empty()) { - CAF_CM_EXCEPTIONEX_VA1(NoSuchElementException, ERROR_NOT_FOUND, - "No mapping sections found - %s", _id.c_str()); - } - - _isInitialized = true; - } - CAF_CM_EXIT; -} - -std::string CPayloadContentRouterInstance::getId() const { - CAF_CM_FUNCNAME_VALIDATE("getId"); - - std::string rc; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - rc = _id; - } - CAF_CM_EXIT; - - return rc; -} - -void CPayloadContentRouterInstance::wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver) { - CAF_CM_FUNCNAME("wire"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(appContext); - CAF_CM_VALIDATE_INTERFACE(channelResolver); - - _channelResolver = channelResolver; - - SmartPtrIMessageChannel defaultOutputChannel; - if (_defaultOutputChannelId.length()) { - try { - defaultOutputChannel = - _channelResolver->resolveChannelName(_defaultOutputChannelId); - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_WARN_CAFEXCEPTION; - CAF_CM_CLEAREXCEPTION; - if (defaultOutputChannel) { - CAF_CM_LOG_INFO_VA2( - "Successfully resolved default channel - id: %s, defaultOutputChannelId: %s", - _id.c_str(), - _defaultOutputChannelId.c_str()); - } else { - CAF_CM_EXCEPTIONEX_VA2( - NoSuchElementException, - 0, - "Failed to resolve default channel - id: %s, defaultChannelId: %s", - _id.c_str(), - _defaultOutputChannelId.c_str()); - } - } - - CAbstractMessageRouter::init(defaultOutputChannel, false, -1); - } - CAF_CM_EXIT; -} - -CPayloadContentRouterInstance::ChannelCollection CPayloadContentRouterInstance::getTargetChannels( - const SmartPtrIIntMessage& message) { - CAF_CM_FUNCNAME("getTargetChannels"); - - ChannelCollection messageChannels; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - const IIntMessage::SmartPtrCHeaders headers = message->getHeaders(); - - const std::string outputChannel = calcOutputChannel(message->getPayload()); - - if (outputChannel.empty() && _defaultOutputChannelId.empty()) { - CAF_CM_EXCEPTIONEX_VA1(NoSuchElementException, ERROR_NOT_FOUND, - "Did not find output channel and default channel not provided - id: %s", _id.c_str()); - } - - SmartPtrIMessageChannel messageChannel; - if (! outputChannel.empty()) { - try { - messageChannel = _channelResolver->resolveChannelName(outputChannel); - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_WARN_CAFEXCEPTION; - CAF_CM_CLEAREXCEPTION; - - if (messageChannel.IsNull() && _resolutionRequired) { - CAF_CM_EXCEPTIONEX_VA2(NoSuchElementException, ERROR_NOT_FOUND, - "Failed to resolve channel when resolution is required - id: %s, outputChannel: %s", - _id.c_str(), outputChannel.c_str()); - } - - if (! messageChannel.IsNull()) { - CAF_CM_LOG_INFO_VA2( - "Successfully resolved channel - id: %s, outputChannel: %s", - _id.c_str(), outputChannel.c_str()); - } - } - - if (messageChannel.IsNull() && _defaultOutputChannelId.empty()) { - CAF_CM_EXCEPTIONEX_VA2(NoSuchElementException, ERROR_NOT_FOUND, - "Failed to resolve channel when resolution is not required and default channel is not available - id: %s, outputChannel: %s", - _id.c_str(), outputChannel.c_str()); - } - if (!messageChannel.IsNull()) { - messageChannels.push_back(messageChannel); - } - } - CAF_CM_EXIT; - - return messageChannels; -} - -std::string CPayloadContentRouterInstance::calcOutputChannel( - const SmartPtrCDynamicByteArray& payload) const { - CAF_CM_FUNCNAME_VALIDATE("calcOutputChannel"); - - std::string outputChannel; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_SMARTPTR(payload); - - const std::string payloadStr = reinterpret_cast(payload->getPtr()); - CAF_CM_VALIDATE_STRING(payloadStr); - - for(TConstIterator valueToChannelIter(_valueToChannelMapping); valueToChannelIter; valueToChannelIter++) { - const std::string value = valueToChannelIter->first; - - SmartPtrCCafRegex regex; - regex.CreateInstance(); - regex->initialize(value); - - if (regex->isMatched(payloadStr)) { - outputChannel = valueToChannelIter->second; - CAF_CM_LOG_DEBUG_VA2("Matched channel - regex: %s, channel: %s", value.c_str(), outputChannel.c_str()); - break; - } - } - } - CAF_CM_EXIT; - - return outputChannel; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CPayloadContentRouterInstance.h b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CPayloadContentRouterInstance.h deleted file mode 100644 index 328d423c8..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CPayloadContentRouterInstance.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CPayloadContentRouterInstance_h_ -#define CPayloadContentRouterInstance_h_ - -#include "Integration/IIntegrationComponentInstance.h" -#include "Common/IAppContext.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "Memory/DynamicArray/DynamicArrayInc.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/Core/CAbstractMessageRouter.h" - -namespace Caf { - -class CPayloadContentRouterInstance : - public IIntegrationObject, - public IIntegrationComponentInstance, - public CAbstractMessageRouter { -public: - CPayloadContentRouterInstance(); - virtual ~CPayloadContentRouterInstance(); - - CAF_BEGIN_QI() - CAF_QI_ENTRY(IIntegrationObject) - CAF_QI_ENTRY(IIntegrationComponentInstance) - CAF_QI_ENTRY(IMessageRouter) - CAF_END_QI() - -public: // IIntegrationObject - void initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection); - - std::string getId() const; - -public: // IIntegrationComponentInstance - void wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver); - -private: // CAbstractMessageRouter - ChannelCollection getTargetChannels( - const SmartPtrIIntMessage& message); - -private: - bool _isInitialized; - std::string _id; - std::string _defaultOutputChannelId; - bool _resolutionRequired; - Cmapstrstr _valueToChannelMapping; - SmartPtrIChannelResolver _channelResolver; - -private: - std::string calcOutputChannel( - const SmartPtrCDynamicByteArray& payload) const; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CPayloadContentRouterInstance); -}; -CAF_DECLARE_SMART_QI_POINTER(CPayloadContentRouterInstance); -} - -#endif // #ifndef CPayloadContentRouterInstance_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CPublishSubscribeChannelInstance.cpp b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CPublishSubscribeChannelInstance.cpp deleted file mode 100644 index 4e3d78f6a..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CPublishSubscribeChannelInstance.cpp +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Common/IAppContext.h" -#include "Integration/Core/CBroadcastingDispatcher.h" -#include "Integration/Core/CErrorHandler.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "Integration/IMessageChannel.h" -#include "Integration/IMessageHandler.h" -#include "Exception/CCafException.h" -#include "CPublishSubscribeChannelInstance.h" - -using namespace Caf; - -CPublishSubscribeChannelInstance::CPublishSubscribeChannelInstance() : - _isInitialized(false), - CAF_CM_INIT_LOG("CPublishSubscribeChannelInstance") { -} - -CPublishSubscribeChannelInstance::~CPublishSubscribeChannelInstance() { -} - -void CPublishSubscribeChannelInstance::initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection) { - - CAF_CM_FUNCNAME_VALIDATE("initialize"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - - _configSection = configSection; - _id = _configSection->findRequiredAttribute("id"); - - _isInitialized = true; - } - CAF_CM_EXIT; -} - -std::string CPublishSubscribeChannelInstance::getId() const { - CAF_CM_FUNCNAME_VALIDATE("getId"); - - std::string rc; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - rc = _id; - } - CAF_CM_EXIT; - - return rc; -} - -void CPublishSubscribeChannelInstance::wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver) { - CAF_CM_FUNCNAME_VALIDATE("wire"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(appContext); - CAF_CM_VALIDATE_INTERFACE(channelResolver); - - const SmartPtrIMessageChannel errorMessageChannel = - channelResolver->resolveChannelName("errorChannel"); - - SmartPtrCErrorHandler errorHandler; - errorHandler.CreateInstance(); - errorHandler->initialize(channelResolver, errorMessageChannel); - - SmartPtrCBroadcastingDispatcher broadcastingDispatcher; - broadcastingDispatcher.CreateInstance(); - broadcastingDispatcher->initialize(errorHandler); - _messageDispatcher = broadcastingDispatcher; - } - CAF_CM_EXIT; -} - -void CPublishSubscribeChannelInstance::subscribe( - const SmartPtrIMessageHandler& messageHandler) { - CAF_CM_FUNCNAME_VALIDATE("subscribe"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(messageHandler); - - _messageDispatcher->addHandler(messageHandler); - } - CAF_CM_EXIT; -} - -void CPublishSubscribeChannelInstance::unsubscribe( - const SmartPtrIMessageHandler& messageHandler) { - CAF_CM_FUNCNAME_VALIDATE("unsubscribe"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(messageHandler); - - _messageDispatcher->removeHandler(messageHandler); - } - CAF_CM_EXIT; -} - -bool CPublishSubscribeChannelInstance::doSend( - const SmartPtrIIntMessage& message, - int32 timeout) { - CAF_CM_FUNCNAME("doSend"); - - bool sent = false; - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(message); - - if (timeout > 0) { - CAF_CM_EXCEPTIONEX_VA1(UnsupportedOperationException, E_INVALIDARG, - "Timeout not currently supported: %s", _id.c_str()); - } - - CAF_CM_LOG_DEBUG_VA1("Dispatching message - %s", _id.c_str()); - sent = _messageDispatcher->dispatch(message); - if (!sent) { - CAF_CM_LOG_ERROR_VA1("Nothing handled the message - channel: %s", _id.c_str()); - } - } - CAF_CM_EXIT; - return sent; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CPublishSubscribeChannelInstance.h b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CPublishSubscribeChannelInstance.h deleted file mode 100644 index 0d76b55b3..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CPublishSubscribeChannelInstance.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CPublishSubscribeChannelInstance_h_ -#define CPublishSubscribeChannelInstance_h_ - - -#include "Integration/IIntegrationComponentInstance.h" - -#include "Common/IAppContext.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "Integration/IMessageDispatcher.h" -#include "Integration/IMessageHandler.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/ISubscribableChannel.h" -#include "Integration/Core/CAbstractMessageChannel.h" - -namespace Caf { - -/// Sends responses/errors back to the client. -class CPublishSubscribeChannelInstance : - public IIntegrationObject, - public IIntegrationComponentInstance, - public ISubscribableChannel, - public CAbstractMessageChannel -{ -public: - CPublishSubscribeChannelInstance(); - virtual ~CPublishSubscribeChannelInstance(); - - CAF_BEGIN_QI() - CAF_QI_ENTRY(IIntegrationObject) - CAF_QI_ENTRY(IIntegrationComponentInstance) - CAF_QI_ENTRY(ISubscribableChannel) - CAF_QI_ENTRY(IMessageChannel) - CAF_QI_ENTRY(IChannelInterceptorSupport) - CAF_END_QI() - -public: // IIntegrationObject - void initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection); - - std::string getId() const; - -public: // IIntegrationComponentInstance - void wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver); - -public: // ISubscribableChannel - void subscribe( - const SmartPtrIMessageHandler& messageHandler); - - void unsubscribe( - const SmartPtrIMessageHandler& messageHandler); - -protected: // CAbstractMessageChannel - bool doSend( - const SmartPtrIIntMessage& message, - int32 timeout); - -private: - bool _isInitialized; - SmartPtrIDocument _configSection; - std::string _id; - SmartPtrIMessageDispatcher _messageDispatcher; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CPublishSubscribeChannelInstance); -}; - -CAF_DECLARE_SMART_QI_POINTER(CPublishSubscribeChannelInstance); - -} - -#endif // #ifndef CPublishSubscribeChannelInstance_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CQueueChannelInstance.cpp b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CQueueChannelInstance.cpp deleted file mode 100644 index 27494f536..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CQueueChannelInstance.cpp +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Common/IAppContext.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "Exception/CCafException.h" -#include "CQueueChannelInstance.h" - -using namespace Caf; - -CQueueChannelInstance::CQueueChannelInstance() : - _isInitialized(false), - CAF_CM_INIT_LOG("CQueueChannelInstance") { - CAF_CM_INIT_THREADSAFE; -} - -CQueueChannelInstance::~CQueueChannelInstance() { -} - -void CQueueChannelInstance::initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection) { - - CAF_CM_FUNCNAME_VALIDATE("initialize"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - - _configSection = configSection; - _id = _configSection->findRequiredAttribute("id"); - - setPollerMetadata(_configSection->findOptionalChild("poller")); - - _isInitialized = true; - } - CAF_CM_EXIT; -} - -std::string CQueueChannelInstance::getId() const { - CAF_CM_FUNCNAME_VALIDATE("getId"); - - std::string id; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - id = _id; - } - CAF_CM_EXIT; - - return id; -} - -void CQueueChannelInstance::wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver) { - CAF_CM_FUNCNAME_VALIDATE("wire"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(appContext); - CAF_CM_VALIDATE_INTERFACE(channelResolver); - } - CAF_CM_EXIT; -} - -bool CQueueChannelInstance::doSend( - const SmartPtrIIntMessage& message, - int32 timeout) { - CAF_CM_FUNCNAME("doSend"); - - CAF_CM_ENTER_AND_LOCK { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(message); - - if (timeout > 0) { - CAF_CM_EXCEPTIONEX_VA1(UnsupportedOperationException, E_INVALIDARG, - "Queue channel with timeout not currently supported: %s", _id.c_str()); - } - - CAF_CM_LOG_DEBUG_VA2("Queueing message %d - %s", _messageQueue.size(), _id.c_str()); - _messageQueue.push_front(message); - } - CAF_CM_UNLOCK_AND_EXIT; - return true; -} - -SmartPtrIIntMessage CQueueChannelInstance::doReceive(const int32 timeout) { - CAF_CM_FUNCNAME("doReceive"); - - SmartPtrIIntMessage message; - - CAF_CM_ENTER_AND_LOCK { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - if (timeout > 0) { - CAF_CM_EXCEPTIONEX_VA1(UnsupportedOperationException, E_INVALIDARG, - "Queue channel with timeout not currently supported: %s", _id.c_str()); - } - - if (! _messageQueue.empty()) { - CAF_CM_LOG_DEBUG_VA2("Receiving message %d - %s", _messageQueue.size(), _id.c_str()); - - message = _messageQueue.back(); - _messageQueue.pop_back(); - } - } - CAF_CM_UNLOCK_AND_EXIT; - - return message; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CQueueChannelInstance.h b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CQueueChannelInstance.h deleted file mode 100644 index 0398bc3ec..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CQueueChannelInstance.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CQueueChannelInstance_h_ -#define CQueueChannelInstance_h_ - -#include "Integration/IIntegrationComponentInstance.h" -#include "Common/IAppContext.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/Core/CAbstractPollableChannel.h" - -namespace Caf { - -/// Sends responses/errors back to the client. -class CQueueChannelInstance : - public IIntegrationObject, - public IIntegrationComponentInstance, - public CAbstractPollableChannel { -public: - CQueueChannelInstance(); - virtual ~CQueueChannelInstance(); - - CAF_BEGIN_QI() - CAF_QI_ENTRY(IIntegrationObject) - CAF_QI_ENTRY(IIntegrationComponentInstance) - CAF_QI_ENTRY(IPollableChannel) - CAF_QI_ENTRY(IMessageChannel) - CAF_QI_ENTRY(IChannelInterceptorSupport) - CAF_END_QI() - -public: // IIntegrationObject - void initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection); - - std::string getId() const; - -public: // IIntegrationComponentInstance - void wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver); - -protected: // CAbstractPollableChannel - bool doSend( - const SmartPtrIIntMessage& message, - int32 timeout); - - SmartPtrIIntMessage doReceive(const int32 timeout); - -private: - bool _isInitialized; - SmartPtrIDocument _configSection; - std::string _id; - std::deque _messageQueue; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_CREATE_THREADSAFE; - CAF_CM_DECLARE_NOCOPY(CQueueChannelInstance); -}; - -CAF_DECLARE_SMART_QI_POINTER(CQueueChannelInstance); - -} - -#endif // #ifndef CQueueChannelInstance_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CRecipientListRouterInstance.cpp b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CRecipientListRouterInstance.cpp deleted file mode 100644 index 7ee648235..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CRecipientListRouterInstance.cpp +++ /dev/null @@ -1,199 +0,0 @@ -/* - * Created on: Aug 9, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2018 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include - -#include "Common/IAppContext.h" -#include "IVariant.h" -#include "Integration/Core/CExpressionHandler.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "Integration/IMessageChannel.h" -#include "Exception/CCafException.h" -#include "Common/IAppConfig.h" -#include "CRecipientListRouterInstance.h" - -using namespace Caf; - -CRecipientListRouterInstance::CRecipientListRouterInstance() : - _isInitialized(false), - _ignoreSendFailures(false), - _timeout(-1), - CAF_CM_INIT_LOG("CRecipientListRouterInstance") { -} - -CRecipientListRouterInstance::~CRecipientListRouterInstance() { -} - -void CRecipientListRouterInstance::initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection) { - CAF_CM_FUNCNAME("initialize"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - - _id = configSection->findRequiredAttribute("id"); - - std::string val = configSection->findOptionalAttribute("timeout"); - if (val.length()) { - _timeout = CStringConv::fromString(val); - } - - val = configSection->findOptionalAttribute("ignore-send-failures"); - _ignoreSendFailures = (val == "true"); - - Csetstr channelIds; - const IDocument::SmartPtrCChildCollection childCollection = configSection->getAllChildren(); - for(TSmartConstMultimapIterator childIter(*childCollection); - childIter; - childIter++) { - const std::string sectionName = childIter.getKey(); - if (sectionName == "recipient") { - const SmartPtrIDocument document = *childIter; - const std::string channelId = document->findRequiredAttribute("channel"); - const std::string selectorExpression - = document->findOptionalAttribute("selector-expression"); - - if (!channelIds.insert(channelId).second) { - CAF_CM_EXCEPTIONEX_VA2( - DuplicateElementException, - 0, - "Duplicate channelId '%s' in " - "recipient-list-router definition '%s'", - channelId.c_str(), - _id.c_str()); - } - - if (selectorExpression.length()) { - _selectorDefinitions.insert( - Cmapstrstr::value_type(channelId, selectorExpression)); - } else { - _staticChannelIds.push_back(channelId); - } - } - } - - if (!_staticChannelIds.size() && !_selectorDefinitions.size()) { - CAF_CM_EXCEPTIONEX_VA1( - NoSuchElementException, - 0, - "No recipients were listed in the definition of " - "recipient-list-router '%s'", - _id.c_str()); - } - _isInitialized = true; - } - CAF_CM_EXIT; -} - -std::string CRecipientListRouterInstance::getId() const { - CAF_CM_FUNCNAME_VALIDATE("getId"); - - std::string rc; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - rc = _id; - } - CAF_CM_EXIT; - - return rc; -} - -void CRecipientListRouterInstance::wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver) { - CAF_CM_FUNCNAME_VALIDATE("wire"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(appContext); - CAF_CM_VALIDATE_INTERFACE(channelResolver); - - SmartPtrIAppConfig appConfig = getAppConfig(); - - for (TConstIterator channelId(_staticChannelIds); - channelId; - channelId++) { - _staticChannels.push_back( - channelResolver->resolveChannelName(*channelId)); - } - - for (TConstMapIterator selectorPair(_selectorDefinitions); - selectorPair; - selectorPair++) { - SmartPtrIMessageChannel channel = - channelResolver->resolveChannelName(selectorPair.getKey()); - SmartPtrCExpressionHandler handler; - handler.CreateInstance(); - handler->init( - appConfig, - appContext, - *selectorPair); - _selectorChannels.push_back(std::make_pair(handler, channel)); - } - - CAbstractMessageRouter::init( - SmartPtrIMessageChannel(), - _ignoreSendFailures, - _timeout); - } - CAF_CM_EXIT; -} - -CRecipientListRouterInstance::ChannelCollection -CRecipientListRouterInstance::getTargetChannels( - const SmartPtrIIntMessage& message) { - CAF_CM_FUNCNAME("getTargetChannels"); - ChannelCollection channels; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - // Static channels always get the message - std::copy( - _staticChannels.begin(), - _staticChannels.end(), - std::back_inserter(channels)); - - // Execute the selector expression(s) on the message - // and add the channels for the expressions that return 'true' - for (TConstIterator selector(_selectorChannels); - selector; - selector++) { - SmartPtrIVariant evalResult = selector->first->evaluate(message); - if (evalResult->isBool()) { - if (CAF_CM_IS_LOG_DEBUG_ENABLED) { - CAF_CM_LOG_DEBUG_VA3( - "recipient-list-router [%s] selector-expression [%s] returned '%s'", - _id.c_str(), - selector->first->toString().c_str(), - evalResult->toString().c_str()); - } - if (g_variant_get_boolean(evalResult->get())) { - channels.push_back(selector->second); - } - } else { - CAF_CM_EXCEPTIONEX_VA2( - InvalidArgumentException, - 0, - "recipient-list-router [%s] illegal selector-expression [%s] : " - "selector-expression results must return boolean values.", - _id.c_str(), - selector->first->toString().c_str()); - } - } - } - CAF_CM_EXIT; - - return channels; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CRecipientListRouterInstance.h b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CRecipientListRouterInstance.h deleted file mode 100644 index ecb32ca4a..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CRecipientListRouterInstance.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Created on: Aug 9, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CRecipientListRouterInstance_h -#define CRecipientListRouterInstance_h - -#include "Integration/IIntegrationComponentInstance.h" -#include "Common/IAppContext.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "Integration/IMessageChannel.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/Core/CAbstractMessageRouter.h" - -namespace Caf { - -class CRecipientListRouterInstance : - public IIntegrationObject, - public IIntegrationComponentInstance, - public CAbstractMessageRouter { -public: - CRecipientListRouterInstance(); - virtual ~CRecipientListRouterInstance(); - - CAF_BEGIN_QI() - CAF_QI_ENTRY(IIntegrationObject) - CAF_QI_ENTRY(IIntegrationComponentInstance) - CAF_QI_ENTRY(IMessageRouter) - CAF_END_QI() - -public: // IIntegrationObject - void initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection); - - std::string getId() const; - -public: // IIntegrationComponentInstance - void wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver); - -private: // CAbstractMessageRouter - ChannelCollection getTargetChannels( - const SmartPtrIIntMessage& message); - -private: - bool _isInitialized; - std::string _id; - bool _ignoreSendFailures; - int32 _timeout; - Cdeqstr _staticChannelIds; - Cmapstrstr _selectorDefinitions; - std::deque _staticChannels; - typedef std::deque > SelectorChannelCollection; - SelectorChannelCollection _selectorChannels; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CRecipientListRouterInstance); -}; -CAF_DECLARE_SMART_QI_POINTER(CRecipientListRouterInstance); -} - -#endif /* CRecipientListRouterInstance_h */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CRouterInstance.cpp b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CRouterInstance.cpp deleted file mode 100644 index 80beed473..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CRouterInstance.cpp +++ /dev/null @@ -1,198 +0,0 @@ -/* - * Created on: Aug 15, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Common/IAppContext.h" -#include "IVariant.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "Integration/IMessageChannel.h" -#include "Exception/CCafException.h" -#include "Common/IAppConfig.h" -#include "CRouterInstance.h" - -using namespace Caf; - -CRouterInstance::CRouterInstance() : - _isInitialized(false), - _timeout(-1), - _resolutionRequired(false), - CAF_CM_INIT_LOG("CRouterInstance") { -} - -CRouterInstance::~CRouterInstance() { -} - -void CRouterInstance::initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection) { - CAF_CM_FUNCNAME("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - - _id = configSection->findRequiredAttribute("id"); - - std::string val = configSection->findOptionalAttribute("timeout"); - if (val.length()) { - _timeout = CStringConv::fromString(val); - } - - _defaultOutputChannelId = - configSection->findOptionalAttribute("default-output-channel"); - - _expressionStr = configSection->findRequiredAttribute("expression"); - - const std::string resolutionRequiredStr = configSection->findOptionalAttribute("resolution-required"); - _resolutionRequired = - (resolutionRequiredStr.empty() || resolutionRequiredStr.compare("true") == 0) ? true : false; - - const IDocument::SmartPtrCChildCollection childCollection = configSection->getAllChildren(); - for(TConstIterator childIter(*childCollection); childIter; childIter++) { - const std::string sectionName = childIter->first; - if (sectionName.compare("mapping") == 0) { - const SmartPtrIDocument document = childIter->second; - const std::string value = document->findRequiredAttribute("value"); - const std::string channel = document->findRequiredAttribute("channel"); - _valueToChannelMapping.insert(std::make_pair(value, channel)); - } - } - - if (_valueToChannelMapping.empty()) { - CAF_CM_EXCEPTIONEX_VA1( - NoSuchElementException, - 0, - "No mapping sections found - %s", - _id.c_str()); - } - - _isInitialized = true; -} - -std::string CRouterInstance::getId() const { - CAF_CM_FUNCNAME_VALIDATE("getId"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _id; -} - -void CRouterInstance::wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver) { - CAF_CM_FUNCNAME("wire"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(appContext); - CAF_CM_VALIDATE_INTERFACE(channelResolver); - - _channelResolver = channelResolver; - - SmartPtrIMessageChannel defaultOutputChannel; - if (_defaultOutputChannelId.length()) { - try { - defaultOutputChannel = - _channelResolver->resolveChannelName(_defaultOutputChannelId); - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_WARN_CAFEXCEPTION; - CAF_CM_CLEAREXCEPTION; - if (defaultOutputChannel) { - CAF_CM_LOG_INFO_VA2( - "Successfully resolved default channel - id: %s, defaultOutputChannelId: %s", - _id.c_str(), - _defaultOutputChannelId.c_str()); - } else { - CAF_CM_EXCEPTIONEX_VA2( - NoSuchElementException, - 0, - "Failed to resolve default channel - id: %s, defaultChannelId: %s", - _id.c_str(), - _defaultOutputChannelId.c_str()); - } - } - - _expressionHandler.CreateInstance(); - _expressionHandler->init( - getAppConfig(), - appContext, - _expressionStr); - - CAbstractMessageRouter::init(defaultOutputChannel, false, -1); -} - -CRouterInstance::ChannelCollection CRouterInstance::getTargetChannels( - const SmartPtrIIntMessage& message) { - CAF_CM_FUNCNAME("getTargetChannels"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - ChannelCollection messageChannels; - - std::string exprValueStr; - try { - SmartPtrIVariant exprValue = _expressionHandler->evaluate(message); - exprValueStr = exprValue->toString(); - CAF_CM_VALIDATE_STRING(exprValueStr); - CAF_CM_LOG_DEBUG_VA2( - "router '%s' expression returned '%s'", - _id.c_str(), - exprValueStr.c_str()); - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_ERROR_CAFEXCEPTION; - CAF_CM_CLEAREXCEPTION; - - SmartPtrIMessageChannel outputChannel; - std::string outputChannelId; - if (exprValueStr.length()) { - Cmapstrstr::const_iterator valueIter = _valueToChannelMapping.find(exprValueStr); - if (valueIter != _valueToChannelMapping.end()) { - outputChannelId = valueIter->second; - try { - outputChannel = _channelResolver->resolveChannelName(outputChannelId); - CAF_CM_LOG_DEBUG_VA3( - "Successfully resolved channel " - "- id: %s, expression value: %s, outputChannel: %s", - _id.c_str(), - exprValueStr.c_str(), - outputChannelId.c_str()); - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_WARN_CAFEXCEPTION; - CAF_CM_CLEAREXCEPTION; - } else { - CAF_CM_LOG_WARN_VA2( - "Expression value not found in mappings - " - "id: '%s', value: '%s'", - _id.c_str(), - exprValueStr.c_str()); - } - } - - if (outputChannel) { - messageChannels.push_back(outputChannel); - } else { - if (_resolutionRequired) { - CAF_CM_EXCEPTIONEX_VA3( - NoSuchElementException, - 0, - "Failed to resolve channel when resolution is required " - "- id: %s, expression value: '%s', outputChannel: '%s'", - _id.c_str(), - exprValueStr.c_str(), - outputChannelId.c_str()); - } else if (_defaultOutputChannelId.empty()) { - CAF_CM_EXCEPTIONEX_VA2( - NoSuchElementException, - 0, - "Did not resolve output channel and default channel not provided " - "- id: %s, expression value: %s", - _id.c_str(), - exprValueStr.c_str()); - } - } - return messageChannels; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CRouterInstance.h b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CRouterInstance.h deleted file mode 100644 index 9cd850f4f..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CRouterInstance.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Created on: Aug 15, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CRouterInstance_h -#define CRouterInstnace_h - -#include "Integration/IIntegrationComponentInstance.h" -#include "Common/IAppContext.h" -#include "Integration/Core/CExpressionHandler.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/Core/CAbstractMessageRouter.h" - -namespace Caf { - -class CRouterInstance : - public IIntegrationObject, - public IIntegrationComponentInstance, - public CAbstractMessageRouter { -public: - CRouterInstance(); - virtual ~CRouterInstance(); - - CAF_BEGIN_QI() - CAF_QI_ENTRY(IIntegrationObject) - CAF_QI_ENTRY(IIntegrationComponentInstance) - CAF_QI_ENTRY(IMessageRouter) - CAF_END_QI() - -public: // IIntegrationObject - void initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection); - - std::string getId() const; - -public: // IIntegrationComponentInstance - void wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver); - -private: - ChannelCollection getTargetChannels( - const SmartPtrIIntMessage& message); - -private: - bool _isInitialized; - std::string _id; - int32 _timeout; - std::string _defaultOutputChannelId; - bool _resolutionRequired; - std::string _expressionStr; - SmartPtrCExpressionHandler _expressionHandler; - Cmapstrstr _valueToChannelMapping; - SmartPtrIChannelResolver _channelResolver; - - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CRouterInstance); -}; -CAF_DECLARE_SMART_QI_POINTER(CRouterInstance); -} - - -#endif /* CRouterInstance_h */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CServiceActivatorInstance.cpp b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CServiceActivatorInstance.cpp deleted file mode 100644 index fd96adf4d..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CServiceActivatorInstance.cpp +++ /dev/null @@ -1,199 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Common/IAppContext.h" -#include "IBean.h" -#include "ICafObject.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntegrationComponent.h" -#include "Integration/IIntegrationComponentInstance.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/IMessageChannel.h" -#include "Exception/CCafException.h" -#include "CServiceActivatorInstance.h" -#include "CObjectFactoryTables.h" - -using namespace Caf; - -CServiceActivatorInstance::CServiceActivatorInstance() : - _isInitialized(false), - CAF_CM_INIT_LOG("CServiceActivatorInstance") { -} - -CServiceActivatorInstance::~CServiceActivatorInstance() { -} - -void CServiceActivatorInstance::initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection) { - - CAF_CM_FUNCNAME_VALIDATE("initialize"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - - _ctorArgs = ctorArgs; - _properties = properties; - _configSection = configSection; - _id = _configSection->findRequiredAttribute("id"); - - _isInitialized = true; - } - CAF_CM_EXIT; -} - -std::string CServiceActivatorInstance::getId() const { - CAF_CM_FUNCNAME_VALIDATE("getId"); - - std::string rc; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - rc = _id; - } - CAF_CM_EXIT; - - return rc; -} - -void CServiceActivatorInstance::wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver) { - CAF_CM_FUNCNAME("wire"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(appContext); - CAF_CM_VALIDATE_INTERFACE(channelResolver); - - MessageHandlerObjectCreatorMap::const_iterator objectCreatorEntry = - CObjectFactoryTables::messageHandlerObjectCreatorMap.find( - _configSection->getName()); - if (objectCreatorEntry == - CObjectFactoryTables::messageHandlerObjectCreatorMap.end()) { - CAF_CM_EXCEPTIONEX_VA1( - NoSuchElementException, - 0, - "Configuration section '%s' is not handled by this object", - _configSection->getName().c_str()); - } - - const SmartPtrIMessageChannel errorMessageChannel = - channelResolver->resolveChannelName("errorChannel"); - - std::string inputChannelStr; - SmartPtrIMessageChannel outputMessageChannel; - if (objectCreatorEntry->second.second) { - inputChannelStr = _configSection->findRequiredAttribute("input-channel"); - - const std::string outputChannelStr = _configSection->findRequiredAttribute("output-channel"); - outputMessageChannel = channelResolver->resolveChannelName(outputChannelStr); - } else { - inputChannelStr = _configSection->findOptionalAttribute("channel"); - if (inputChannelStr.empty()) { - inputChannelStr = _configSection->findRequiredAttribute("input-channel"); - } - } - const SmartPtrIIntegrationObject inputIntegrationObject = - channelResolver->resolveChannelNameToObject(inputChannelStr); - - SmartPtrICafObject messageHandlerObj; - if (_configSection->getName().compare("service-activator") == 0) { - const std::string refStr = _configSection->findRequiredAttribute("ref"); - CAF_CM_LOG_DEBUG_VA1("Creating the message processor - %s", refStr.c_str()); - const SmartPtrIBean bean = appContext->getBean(refStr); - messageHandlerObj.QueryInterface(bean, false); - CAF_CM_VALIDATE_INTERFACE(messageHandlerObj); - - SmartPtrIIntegrationComponentInstance integrationComponentInstance; - integrationComponentInstance.QueryInterface(bean, false); - if (!integrationComponentInstance.IsNull()) { - // Bean is also an integration component instance...wire - integrationComponentInstance->wire(appContext, channelResolver); - } - } else { - SmartPtrIIntegrationObject integrationObject; - if (objectCreatorEntry->second.first) { - integrationObject = (objectCreatorEntry->second.first)(); - integrationObject->initialize(_ctorArgs, _properties, _configSection); - } else { - const std::string& beanId = _configSection->findRequiredAttribute("ref"); - const SmartPtrIBean bean = appContext->getBean(beanId); - SmartPtrIIntegrationComponent integrationComponent; - integrationComponent.QueryInterface(bean, false); - if (!integrationComponent) { - CAF_CM_EXCEPTIONEX_VA1( - InvalidArgumentException, - 0, - "Bean is not an integration component - %s", - beanId.c_str()); - } - integrationObject = integrationComponent->createObject(_configSection); - } - SmartPtrIIntegrationComponentInstance integrationComponentInstance; - integrationComponentInstance.QueryInterface(integrationObject, false); - CAF_CM_VALIDATE_INTERFACE(integrationComponentInstance); - integrationComponentInstance->wire(appContext, channelResolver); - messageHandlerObj.QueryInterface(integrationObject, false); - CAF_CM_VALIDATE_INTERFACE(messageHandlerObj); - } - - _messagingTemplate.CreateInstance(); - _messagingTemplate->initialize( - channelResolver, - inputIntegrationObject, - errorMessageChannel, - outputMessageChannel, - messageHandlerObj); - } - CAF_CM_EXIT; -} - -void CServiceActivatorInstance::start( - const uint32 timeoutMs) { - CAF_CM_FUNCNAME_VALIDATE("start"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - CAF_CM_LOG_DEBUG_VA0("Starting"); - _messagingTemplate->start(timeoutMs); - } - CAF_CM_EXIT; -} - -void CServiceActivatorInstance::stop( - const uint32 timeoutMs) { - CAF_CM_FUNCNAME_VALIDATE("stop"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - CAF_CM_LOG_DEBUG_VA0("Stopping"); - _messagingTemplate->stop(timeoutMs); - } - CAF_CM_EXIT; -} - -bool CServiceActivatorInstance::isRunning() const { - CAF_CM_FUNCNAME_VALIDATE("isRunning"); - - bool rc = false; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - rc = _messagingTemplate->isRunning(); - } - CAF_CM_EXIT; - - return rc; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CServiceActivatorInstance.h b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CServiceActivatorInstance.h deleted file mode 100644 index 6b212b5d4..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CServiceActivatorInstance.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CServiceActivatorInstance_h_ -#define CServiceActivatorInstance_h_ - - -#include "Integration/IIntegrationComponentInstance.h" - -#include "Common/IAppContext.h" -#include "Integration/Core/CMessagingTemplate.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntegrationObject.h" - -namespace Caf { - -class CServiceActivatorInstance : - public IIntegrationObject, - public IIntegrationComponentInstance, - public ILifecycle -{ -public: - CServiceActivatorInstance(); - virtual ~CServiceActivatorInstance(); - - CAF_BEGIN_QI() - CAF_QI_ENTRY(IIntegrationObject) - CAF_QI_ENTRY(IIntegrationComponentInstance) - CAF_QI_ENTRY(ILifecycle) - CAF_END_QI() - -public: // IIntegrationObject - void initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection); - - std::string getId() const; - -public: // IIntegrationComponentInstance - void wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver); - -public: // ILifecycle - void start(const uint32 timeoutMs); - void stop(const uint32 timeoutMs); - bool isRunning() const; - -private: - bool _isInitialized; - IBean::Cargs _ctorArgs; - IBean::Cprops _properties; - SmartPtrIDocument _configSection; - std::string _id; - SmartPtrCMessagingTemplate _messagingTemplate; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CServiceActivatorInstance); -}; - -CAF_DECLARE_SMART_QI_POINTER(CServiceActivatorInstance); - -} - -#endif // #ifndef CServiceActivatorInstance_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CWireTapInstance.cpp b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CWireTapInstance.cpp deleted file mode 100644 index 7a7b29809..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CWireTapInstance.cpp +++ /dev/null @@ -1,184 +0,0 @@ -/* - * Created on: Jan 25, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Common/IAppContext.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "Integration/IMessageChannel.h" -#include "CWireTapInstance.h" - -CWireTapInstance::CWireTapInstance() : - _order(0), - _timeout(0), - _isRunning(false), - _pattern(NULL), - _isInitialized(false), - CAF_CM_INIT_LOG("CWireTapInstance") { -} - -CWireTapInstance::~CWireTapInstance() { - if (_pattern) { - g_regex_unref(_pattern); - } -} - -void CWireTapInstance::initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection) { - - CAF_CM_FUNCNAME_VALIDATE("initialize"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - - _configSection = configSection; - _id = _configSection->findRequiredAttribute("id"); - - const std::string orderAttr = _configSection->findOptionalAttribute("order"); - if (!orderAttr.empty()) { - _order = CStringConv::fromString(orderAttr); - } - - const std::string timeoutAttr = _configSection->findOptionalAttribute("timeout"); - if (!timeoutAttr.empty()) { - _timeout = CStringConv::fromString(timeoutAttr); - } - - const std::string pattern = _configSection->findRequiredAttribute("pattern"); - GError *error = NULL; - _pattern = g_regex_new( - pattern.c_str(), - (GRegexCompileFlags)(G_REGEX_OPTIMIZE | G_REGEX_UNGREEDY | G_REGEX_RAW), - (GRegexMatchFlags)(G_REGEX_MATCH_ANCHORED | G_REGEX_MATCH_NOTEMPTY), - &error); - if (error) { - throw error; - } - - _channelId = _configSection->findRequiredAttribute("channel"); - _isInitialized = true; - } - CAF_CM_EXIT; -} - -std::string CWireTapInstance::getId() const { - CAF_CM_FUNCNAME_VALIDATE("getId"); - std::string rc; - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - rc = _id; - } - CAF_CM_EXIT; - return rc; -} - -void CWireTapInstance::wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver) { - CAF_CM_FUNCNAME_VALIDATE("wire"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(appContext); - CAF_CM_VALIDATE_INTERFACE(channelResolver); - _channel = channelResolver->resolveChannelName(_channelId); - } - CAF_CM_EXIT; -} - -void CWireTapInstance::start(const uint32 timeoutMs) { - CAF_CM_FUNCNAME_VALIDATE("start"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - _isRunning = true; - } - CAF_CM_EXIT; -} - -void CWireTapInstance::stop(const uint32 timeoutMs) { - CAF_CM_FUNCNAME_VALIDATE("stop"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - _isRunning = false; - } - CAF_CM_EXIT; -} - -bool CWireTapInstance::isRunning() const { - CAF_CM_FUNCNAME_VALIDATE("isRunning"); - bool rc = false; - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - rc = _isRunning; - } - CAF_CM_EXIT; - return rc; -} - -SmartPtrIIntMessage& CWireTapInstance::preSend( - SmartPtrIIntMessage& message, - SmartPtrIMessageChannel& channel) { - CAF_CM_FUNCNAME_VALIDATE("preSend"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_INTERFACE(message); - CAF_CM_VALIDATE_INTERFACE(channel); - - // If the channel passed in is the - // output channel for this wire-tap then - // log a message and no-op this. - if (_channel == channel) { - CAF_CM_LOG_DEBUG_VA2( - "WireTap (%s) will not intercept its own " - "channel (%s),", - _id.c_str(), - _channelId.c_str()); - } else if (_isRunning) { - if (_timeout) { - _channel->send(message); - } else { - _channel->send(message, _timeout); - } - } - } - CAF_CM_EXIT; - return message; -} - -uint32 CWireTapInstance::getOrder() const { - CAF_CM_FUNCNAME_VALIDATE("getOrder"); - uint32 rc; - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - rc = _order; - } - CAF_CM_EXIT; - return rc; -} - -bool CWireTapInstance::isChannelIdMatched(const std::string& channelId) const { - CAF_CM_FUNCNAME_VALIDATE("isChannelIdMatched"); - bool rc = false; - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(channelId); - rc = g_regex_match( - _pattern, - channelId.c_str(), - (GRegexMatchFlags)0, - NULL); - } - CAF_CM_EXIT; - return rc; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CWireTapInstance.h b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CWireTapInstance.h deleted file mode 100644 index 3afbf6c3d..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CWireTapInstance.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Created on: Jan 25, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CWIRETAPINSTANCE_H_ -#define CWIRETAPINSTANCE_H_ - -#include "Integration/IChannelInterceptorInstance.h" -#include "Common/IAppContext.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "Integration/IMessageChannel.h" -#include "Integration/IIntegrationComponentInstance.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/ILifecycle.h" -#include "Integration/Core/CChannelInterceptorAdapter.h" - -namespace Caf { - -class CWireTapInstance : - public IIntegrationObject, - public IIntegrationComponentInstance, - public ILifecycle, - public IChannelInterceptorInstance, - public CChannelInterceptorAdapter { -public: - CWireTapInstance(); - virtual ~CWireTapInstance(); - - CAF_BEGIN_QI() - CAF_QI_ENTRY(IIntegrationObject) - CAF_QI_ENTRY(IIntegrationComponentInstance) - CAF_QI_ENTRY(ILifecycle) - CAF_QI_ENTRY(IChannelInterceptor) - CAF_QI_ENTRY(IChannelInterceptorInstance) - CAF_END_QI() - -public: // IIntegrationObject - void initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection); - - std::string getId() const; - -public: // IIntegrationComponentInstance - void wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver); - -public: // ILifecycle - void start(const uint32 timeoutMs); - void stop(const uint32 timeoutMs); - bool isRunning() const; - -public: // IChannelIntercepter - SmartPtrIIntMessage& preSend( - SmartPtrIIntMessage& message, - SmartPtrIMessageChannel& channel); - -public: // IChannelInterceptorInstance - uint32 getOrder() const; - - bool isChannelIdMatched(const std::string& channelId) const; - -private: - SmartPtrIDocument _configSection; - std::string _id; - uint32 _order; - int32 _timeout; - bool _isRunning; - std::string _channelId; - SmartPtrIMessageChannel _channel; - GRegex* _pattern; - bool _isInitialized; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CWireTapInstance); -}; -CAF_DECLARE_SMART_QI_POINTER(CWireTapInstance); - -} - -#endif /* CWIRETAPINSTANCE_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CXPathHeaderEnricherItem.cpp b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CXPathHeaderEnricherItem.cpp deleted file mode 100644 index 08ac6e96d..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CXPathHeaderEnricherItem.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Integration/IDocument.h" -#include "CXPathHeaderEnricherItem.h" - -using namespace Caf; - -CXPathHeaderEnricherItem::CXPathHeaderEnricherItem() : - _isInitialized(false), - _overwrite(true), - CAF_CM_INIT("CXPathHeaderEnricherItem") { -} - -CXPathHeaderEnricherItem::~CXPathHeaderEnricherItem() { -} - -void CXPathHeaderEnricherItem::initialize( - const SmartPtrIDocument& configSection, - const bool& defaultOverwrite) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - - _name = configSection->findRequiredAttribute("name"); - _evaluationType = configSection->findOptionalAttribute("evaluation-type"); - _xpathExpression = configSection->findOptionalAttribute("xpath-expression"); - _xpathExpressionRef = configSection->findOptionalAttribute("xpath-expression-ref"); - - _overwrite = defaultOverwrite; - const std::string overwriteStr = configSection->findOptionalAttribute("overwrite"); - if (! overwriteStr.empty()) { - _overwrite = (overwriteStr.compare("true") == 0); - } - - if (_evaluationType.empty()) { - _evaluationType = "STRING_RESULT"; - } - - _isInitialized = true; -} - -std::string CXPathHeaderEnricherItem::getName() const { - return _name; -} - -std::string CXPathHeaderEnricherItem::getEvaluationType() const { - return _evaluationType; -} - -bool CXPathHeaderEnricherItem::getOverwrite() const { - return _overwrite; -} - -std::string CXPathHeaderEnricherItem::getXpathExpression() const { - return _xpathExpression; -} - -std::string CXPathHeaderEnricherItem::getXpathExpressionRef() const { - return _xpathExpressionRef; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CXPathHeaderEnricherTransformerInstance.cpp b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CXPathHeaderEnricherTransformerInstance.cpp deleted file mode 100644 index 90824b67c..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CXPathHeaderEnricherTransformerInstance.cpp +++ /dev/null @@ -1,216 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "CXPathHeaderEnricherItem.h" -#include "Common/IAppContext.h" -#include "Integration/Core/CIntMessage.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Exception/CCafException.h" -#include "Common/IAppConfig.h" - -#include "CXPathHeaderEnricherTransformerInstance.h" - -using namespace Caf; - -CXPathHeaderEnricherTransformerInstance::CXPathHeaderEnricherTransformerInstance() : - _isInitialized(false), - _defaultOverwrite(true), - _shouldSkipNulls(true), - CAF_CM_INIT_LOG("CXPathHeaderEnricherTransformerInstance") { -} - -CXPathHeaderEnricherTransformerInstance::~CXPathHeaderEnricherTransformerInstance() { -} - -void CXPathHeaderEnricherTransformerInstance::initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection) { - CAF_CM_FUNCNAME("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - - _id = configSection->findRequiredAttribute("id"); - _configSection = configSection; - - if (_configSection->getAllChildren()->empty()) { - CAF_CM_EXCEPTIONEX_VA1(NoSuchElementException, ERROR_INVALID_DATA, - "Configuration section is empty - %s", _id.c_str()); - } - - _isInitialized = true; -} - -std::string CXPathHeaderEnricherTransformerInstance::getId() const { - CAF_CM_FUNCNAME_VALIDATE("getId"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _id; -} - -void CXPathHeaderEnricherTransformerInstance::wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver) { - CAF_CM_FUNCNAME("wire"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(appContext); - CAF_CM_VALIDATE_INTERFACE(channelResolver); - - SmartPtrIAppConfig appConfig = getAppConfig(); - - const std::string defaultOverwriteStr = - _configSection->findOptionalAttribute("default-overwrite"); - const std::string shouldSkipNullsStr = - _configSection->findOptionalAttribute("should-skip-nulls"); - - _defaultOverwrite = - (defaultOverwriteStr.empty() || defaultOverwriteStr.compare("true") == 0) ? true : false; - _shouldSkipNulls = - (shouldSkipNullsStr.empty() || shouldSkipNullsStr.compare("true") == 0) ? true : false; - - const IDocument::SmartPtrCChildCollection configChildren = - _configSection->getAllChildren(); - for (TSmartConstMapIterator configIter(*configChildren); - configIter; configIter++) { - const SmartPtrIDocument config = *configIter; - - if (config->getName().compare("header") == 0) { - SmartPtrCXPathHeaderEnricherItem item; - item.CreateInstance(); - item->initialize(config, _defaultOverwrite); - - _headerItems.insert(std::make_pair(item->getName(), item)); - } else { - CAF_CM_EXCEPTIONEX_VA1(NoSuchElementException, ERROR_INVALID_DATA, - "Configuration section contains unrecognized entry - %s", _id.c_str()); - } - } -} - -SmartPtrIIntMessage CXPathHeaderEnricherTransformerInstance::transformMessage( - const SmartPtrIIntMessage& message) { - CAF_CM_FUNCNAME_VALIDATE("transformMessage"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - SmartPtrCIntMessage messageImpl; - messageImpl.CreateInstance(); - messageImpl->initialize(message->getPayload(), - message->getHeaders(), IIntMessage::SmartPtrCHeaders()); - SmartPtrIIntMessage newMessage = messageImpl; - - IIntMessage::SmartPtrCHeaders newHeaders = newMessage->getHeaders(); - const std::string payloadXmlStr = newMessage->getPayloadStr(); - - for (TConstMapIterator headerItemIter(_headerItems); - headerItemIter; headerItemIter++) { - const std::string name = headerItemIter.getKey(); - const SmartPtrCXPathHeaderEnricherItem value = *headerItemIter; - - if (isInsertable(name, value, newHeaders)) { - const std::string xpathRc = evaluateXPathExpression(name, value, payloadXmlStr); - if (xpathRc.empty()) { - if (! _shouldSkipNulls) { - CAF_CM_LOG_INFO_VA1("Removing header from unresolvable expression - %s", - name.c_str()); - newHeaders->erase(name); - } - } else { - CAF_CM_LOG_DEBUG_VA2("Inserting/updating a header value - %s = %s", - name.c_str(), xpathRc.c_str()); - (*newHeaders)[name] = - std::make_pair(CVariant::createString(xpathRc), SmartPtrICafObject()); - } - } - } - - return newMessage; -} - -bool CXPathHeaderEnricherTransformerInstance::isInsertable( - const std::string& name, - const SmartPtrCXPathHeaderEnricherItem& value, - const IIntMessage::SmartPtrCHeaders& headers) { - CAF_CM_FUNCNAME_VALIDATE("isInsertable"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(name); - CAF_CM_VALIDATE_SMARTPTR(value); - CAF_CM_VALIDATE_SMARTPTR(headers); - - bool rc = false; - if (value->getEvaluationType().compare("STRING_RESULT") == 0) { - if (headers->find(name) == headers->end()) { - rc = true; - } else { - if (value->getOverwrite()) { - CAF_CM_LOG_DEBUG_VA1("Existing header will be overwritten - name: %s", - name.c_str()); - rc = true; - } else { - CAF_CM_LOG_WARN_VA1("Existing header will not be overwritten - name: %s", - name.c_str()); - } - } - } else { - CAF_CM_LOG_ERROR_VA2("Evaluation type not supported - name: %s, type: %s", - name.c_str(), value->getEvaluationType().c_str()); - } - - return rc; -} - -std::string CXPathHeaderEnricherTransformerInstance::evaluateXPathExpression( - const std::string& name, - const SmartPtrCXPathHeaderEnricherItem& value, - const std::string& payloadXmlStr) { - CAF_CM_FUNCNAME_VALIDATE("isInsertable"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(name); - CAF_CM_VALIDATE_SMARTPTR(value); - CAF_CM_VALIDATE_STRING(payloadXmlStr); - - std::string rc; - const std::string expr = value->getXpathExpression(); - if (expr.empty()) { - CAF_CM_LOG_ERROR_VA1( - "xpath-expression is required until xpath-expression-ref is supported - name: %s", - name.c_str()); - } else { - if (! value->getXpathExpressionRef().empty()) { - CAF_CM_LOG_WARN_VA1( - "Both xpath-expression and xpath-expression-ref cannot be specified... Using xpath-expression - name: %s", - name.c_str()); - } - - if (expr.find_first_of('@') != 0) { - CAF_CM_LOG_ERROR_VA2( - "Currently, only root-level attributes are supported - name: %s, xpath-expression: %s", - name.c_str(), expr.c_str()); - } else { - const std::string attr = expr.substr(1); - - const SmartPtrCXmlElement rootXml = - CXmlUtils::parseString(payloadXmlStr, std::string()); - - const std::string payloadType = rootXml->getName(); - const std::string attrVal = rootXml->findOptionalAttribute(attr); - if (attrVal.empty()) { - CAF_CM_LOG_WARN_VA2( - "Attribute not found at root level: %s", - name.c_str(), expr.c_str()); - } else { - rc = attrVal; - } - } - } - - return rc; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CXPathHeaderEnricherTransformerInstance.h b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CXPathHeaderEnricherTransformerInstance.h deleted file mode 100644 index 08d204c61..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/CXPathHeaderEnricherTransformerInstance.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CXPathHeaderEnricherTransformerInstance_h_ -#define CXPathHeaderEnricherTransformerInstance_h_ - - -#include "Integration/IIntegrationComponentInstance.h" - -#include "CXPathHeaderEnricherItem.h" -#include "Common/IAppContext.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/ITransformer.h" - -namespace Caf { - -class CXPathHeaderEnricherTransformerInstance : - public IIntegrationObject, - public IIntegrationComponentInstance, - public ITransformer -{ -public: - CXPathHeaderEnricherTransformerInstance(); - virtual ~CXPathHeaderEnricherTransformerInstance(); - - CAF_BEGIN_QI() - CAF_QI_ENTRY(IIntegrationObject) - CAF_QI_ENTRY(IIntegrationComponentInstance) - CAF_QI_ENTRY(ITransformer) - CAF_END_QI() - -public: // IIntegrationObject - void initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection); - - std::string getId() const; - -public: // IIntegrationComponentInstance - void wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver); - -public: // ITransformer - SmartPtrIIntMessage transformMessage( - const SmartPtrIIntMessage& message); - -private: - bool isInsertable( - const std::string& name, - const SmartPtrCXPathHeaderEnricherItem& value, - const IIntMessage::SmartPtrCHeaders& headers); - - std::string evaluateXPathExpression( - const std::string& name, - const SmartPtrCXPathHeaderEnricherItem& value, - const std::string& payloadXmlStr); - -private: - bool _isInitialized; - std::string _id; - SmartPtrIDocument _configSection; - - bool _defaultOverwrite; - bool _shouldSkipNulls; - typedef std::map Items; - Items _headerItems; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CXPathHeaderEnricherTransformerInstance); -}; -CAF_DECLARE_SMART_QI_POINTER(CXPathHeaderEnricherTransformerInstance); - -} - -#endif // #ifndef CXPathHeaderEnricherTransformerInstance_h_ diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/Integration.cpp b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/Integration.cpp deleted file mode 100644 index 2b8029eca..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/Integration.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "CIntegrationObjectFactory.h" -#include "CErrorChannel.h" -#include "CNullChannel.h" -#include "CHeaderExpressionInvoker.h" - -using namespace Caf; - -namespace Caf { - const char* _sObjIdIntegrationObjectFactory = "com.vmware.commonagent.integration.objectfactory"; - const char* _sObjIdErrorChannel = "com.vmware.commonagent.integration.channels.errorchannel"; - const char* _sObjIdNullChannel = "com.vmware.commonagent.integration.channels.nullchannel"; - const char* _sObjIdHeaderExpressionInvoker = "com.vmware.commonagent.integration.headerexpressioninvoker"; -} - -CEcmSubSystemModule _Module; - -CAF_BEGIN_OBJECT_MAP(ObjectMap) - CAF_OBJECT_ENTRY(CIntegrationObjectFactory) - CAF_OBJECT_ENTRY(CErrorChannel) - CAF_OBJECT_ENTRY(CNullChannel) - CAF_OBJECT_ENTRY(CHeaderExpressionInvoker) -CAF_END_OBJECT_MAP() - -CAF_DECLARE_SUBSYSTEM_EXPORTS() - -extern "C" BOOL APIENTRY DllMain(HINSTANCE hModule, uint32 dwReason, LPVOID) -{ - try { - if (DLL_PROCESS_ATTACH == dwReason) - { - // initialize the sub-system module - _Module.Init(ObjectMap, hModule); - } - else if (DLL_PROCESS_DETACH == dwReason) - { - // Terminate the sub-system module - _Module.Term(); - } - } catch (std::runtime_error) { - ::exit(2); - } catch (...) { - ::exit(2); - } - - return TRUE; -} diff --git a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/stdafx.h b/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/stdafx.h deleted file mode 100644 index dfe740a3c..000000000 --- a/open-vm-tools/common-agent/Cpp/Framework/Subsystems/Integration/src/stdafx.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef stdafx_h_ -#define stdafx_h_ - -//{{CAF_SUBSYSTEM}} - -#include - -#include "Integration/IIntegrationObject.h" -#include - -namespace Caf { - -// template function to create integration objects -template -SmartPtrIIntegrationObject CreateIntegrationObject() { - Object object; - object.CreateInstance(); - return object; -}; - -// function pointer for integration object creation -typedef SmartPtrIIntegrationObject(*FNOBJECT_CREATOR)(); - -// map of configuration section names to function pointers that create the -// integration object -typedef std::map ObjectCreatorMap; - -// map of configuration section names to a pair: -// pair.first - function pointer that creates the integration object -// pair.second - true if the integration object produces messages -typedef std::map< - std::string, - std::pair > MessageHandlerObjectCreatorMap; -} - -#endif // #ifndef stdafx_h_ diff --git a/open-vm-tools/common-agent/Cpp/InternalProviders/Config_Provider/include/CIniFileWithoutSection.h b/open-vm-tools/common-agent/Cpp/InternalProviders/Config_Provider/include/CIniFileWithoutSection.h deleted file mode 100644 index 0b2a353ed..000000000 --- a/open-vm-tools/common-agent/Cpp/InternalProviders/Config_Provider/include/CIniFileWithoutSection.h +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Author: bwilliams - * Created: May 18, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CINIFILEWITHOUTSECTION_H_ -#define CINIFILEWITHOUTSECTION_H_ - - -#include "Common/CCafRegex.h" -#include "Common/CIniFile.h" - -namespace Caf { - -class CIniFileWithoutSection { -public: - struct SIniEntry { - std::string _name; - std::string _valueRaw; - std::string _valueExpanded; - }; - CAF_DECLARE_SMART_POINTER(SIniEntry); - -public: - CIniFileWithoutSection(); - virtual ~CIniFileWithoutSection(); - -public: - void initialize(const std::string& configFilePath); - - std::deque getEntryCollection(); - - SmartPtrSIniEntry findOptionalEntry( - const std::string& keyName); - - SmartPtrSIniEntry findRequiredEntry( - const std::string& keyName); - - std::string findOptionalString( - const std::string& keyName); - - std::string findRequiredString( - const std::string& keyName); - - std::string findOptionalRawString( - const std::string& keyName); - - std::string findRequiredRawString( - const std::string& keyName); - - void log(); - - void setValue( - const std::string valueName, - const std::string valueValue); - - void deleteValue( - const std::string valueName); - -private: - struct SReplacement { - SmartPtrCCafRegex _regex; - std::string _value; - }; - CAF_DECLARE_SMART_POINTER(SReplacement); - -private: - std::deque parse( - const std::string& configFilePath) const; - - SmartPtrSReplacement createReplacement( - const std::string& keyName, - const std::string& value) const; - - SmartPtrSIniEntry createIniEntry( - const std::string& keyName, - const std::string& valueRaw, - const std::string& valueExpanded) const; - - std::deque loadTextFileIntoCollection( - const std::string& filePath) const; - - void saveTextFile( - const std::deque fileContents, - const std::string filePath) const; - -private: - bool _isInitialized; - std::string _configFilePath; - std::deque _entryCollection; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CIniFileWithoutSection); -}; - -CAF_DECLARE_SMART_POINTER(CIniFileWithoutSection); - -} - -#endif /* CINIFILEWITHOUTSECTION_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/InternalProviders/Config_Provider/src/CConfigProvider.cpp b/open-vm-tools/common-agent/Cpp/InternalProviders/Config_Provider/src/CConfigProvider.cpp deleted file mode 100644 index c010a53ba..000000000 --- a/open-vm-tools/common-agent/Cpp/InternalProviders/Config_Provider/src/CConfigProvider.cpp +++ /dev/null @@ -1,510 +0,0 @@ -/* - * Author: bwilliams - * Created: May 3, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "CIniFileWithoutSection.h" -#include "Common/CIniFile.h" -#include "Doc/CafCoreTypesDoc/COperationDoc.h" -#include "Doc/CafCoreTypesDoc/CParameterCollectionDoc.h" -#include "Doc/ProviderRequestDoc/CProviderCollectInstancesDoc.h" -#include "Doc/ProviderRequestDoc/CProviderInvokeOperationDoc.h" -#include "Doc/ProviderResultsDoc/CSchemaDoc.h" -#include "Doc/SchemaTypesDoc/CActionClassDoc.h" -#include "Doc/SchemaTypesDoc/CClassInstancePropertyDoc.h" -#include "Doc/SchemaTypesDoc/CClassPropertyDoc.h" -#include "Doc/SchemaTypesDoc/CDataClassDoc.h" -#include "Doc/SchemaTypesDoc/CDataClassInstanceDoc.h" -#include "Doc/SchemaTypesDoc/CDataClassPropertyDoc.h" -#include "Doc/SchemaTypesDoc/CDataClassSubInstanceDoc.h" -#include "Doc/SchemaTypesDoc/CMethodDoc.h" -#include "Doc/SchemaTypesDoc/CMethodParameterDoc.h" -#include "Integration/IDocument.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Exception/CCafException.h" -#include "CConfigProvider.h" -#include "IProviderRequest.h" -#include "IProviderResponse.h" - -using namespace Caf; - -CConfigProvider::CConfigProvider() : - _fileAliasPrefix("diagFileAlias_"), - _keyPathDelimStr("/"), - _keyPathDelimChar('/'), - CAF_CM_INIT_LOG("CConfigProvider") { -} - -CConfigProvider::~CConfigProvider() { -} - -const SmartPtrCSchemaDoc CConfigProvider::getSchema() const { - - std::deque dc1Props; - dc1Props.push_back(CProviderDocHelper::createClassProperty("name", PROPERTY_STRING, true)); - dc1Props.push_back(CProviderDocHelper::createClassProperty("value", PROPERTY_STRING, true)); - - std::deque dc2Props; - dc2Props.push_back(CProviderDocHelper::createClassProperty("filePath", PROPERTY_STRING, true)); - dc2Props.push_back(CProviderDocHelper::createClassProperty("encoding", PROPERTY_STRING, true)); - - std::deque instanceProperties; - instanceProperties.push_back(CProviderDocHelper::createClassInstanceProperty( - "configEntry", - CProviderDocHelper::createClassIdentifier("caf", "ConfigEntry", "1.0.0"), - true, - false, - true)); - - std::deque dataClasses; - dataClasses.push_back(CProviderDocHelper::createDataClass("caf", "ConfigEntry", "1.0.0", dc1Props)); - dataClasses.push_back(CProviderDocHelper::createDataClass("caf", "ConfigData", "1.0.0", dc2Props, instanceProperties)); - - std::deque collectMethodParams; - collectMethodParams.push_back(CProviderDocHelper::createMethodParameter("filePath", PARAMETER_STRING, false)); - collectMethodParams.push_back(CProviderDocHelper::createMethodParameter("encoding", PARAMETER_STRING, false)); - - std::deque m1Params; - m1Params.push_back(CProviderDocHelper::createMethodParameter("filePath", PARAMETER_STRING, false)); - m1Params.push_back(CProviderDocHelper::createMethodParameter("encoding", PARAMETER_STRING, false)); - m1Params.push_back(CProviderDocHelper::createMethodParameter("valueName", PARAMETER_STRING, false)); - m1Params.push_back(CProviderDocHelper::createMethodParameter("valueData", PARAMETER_STRING, false)); - - std::deque m2Params; - m2Params.push_back(CProviderDocHelper::createMethodParameter("filePath", PARAMETER_STRING, false)); - m2Params.push_back(CProviderDocHelper::createMethodParameter("encoding", PARAMETER_STRING, false)); - m2Params.push_back(CProviderDocHelper::createMethodParameter("valueName", PARAMETER_STRING, false)); - - std::deque methods; - methods.push_back(CProviderDocHelper::createMethod("setValue", m1Params)); - methods.push_back(CProviderDocHelper::createMethod("deleteValue", m2Params)); - - std::deque actionClasses; - actionClasses.push_back( - CProviderDocHelper::createActionClass( - "caf", - "ConfigActions", - "1.0.0", - CProviderDocHelper::createCollectMethod("collectInstances", collectMethodParams), - methods)); - - return CProviderDocHelper::createSchema(dataClasses, actionClasses); -} - -void CConfigProvider::collect(const IProviderRequest& request, IProviderResponse& response) const { - CAF_CM_FUNCNAME("collect"); - - CAF_CM_ENTER { - SmartPtrCProviderCollectInstancesDoc doc = request.getCollectInstances(); - CAF_CM_VALIDATE_SMARTPTR(doc); - - const SmartPtrCParameterCollectionDoc parameterCollection = - doc->getParameterCollection(); - const std::string filePath = ParameterUtils::findRequiredParameterAsString( - "filePath", parameterCollection); - const std::string encoding = ParameterUtils::findRequiredParameterAsString( - "encoding", parameterCollection); - - if (FileSystemUtils::doesFileExist(filePath)) { - CAF_CM_LOG_DEBUG_VA2("Parsing file - path: %s, encoding: %s", filePath.c_str(), encoding.c_str()); - - std::deque > propertyCollection; - if (encoding.compare("iniFileWithoutSection") == 0) { - propertyCollection = createIniFileWithoutSectionPropertyCollection(filePath); - } else if (encoding.compare("iniFile") == 0) { - propertyCollection = createIniFilePropertyCollection(filePath); - } else if (encoding.compare("xmlFile") == 0) { - propertyCollection = createXmlFilePropertyCollection(filePath); - } else { - CAF_CM_EXCEPTIONEX_VA2(InvalidArgumentException, E_INVALIDARG, - "URI encoding is not recognized - path: %s, encoding: %s", filePath.c_str(), encoding.c_str()); - } - - const SmartPtrCDataClassInstanceDoc dataClassInstance = - createDataClassInstance(filePath, encoding, propertyCollection); - response.addInstance(dataClassInstance); - } else { - CAF_CM_LOG_WARN_VA2( - "File not found - path: %s, encoding: %s", filePath.c_str(), encoding.c_str()); - } - } - CAF_CM_EXIT; -} - -void CConfigProvider::invoke(const IProviderRequest& request, IProviderResponse& response) const { - CAF_CM_FUNCNAME("invoke"); - - CAF_CM_ENTER { - SmartPtrCProviderInvokeOperationDoc doc = request.getInvokeOperations(); - CAF_CM_VALIDATE_SMARTPTR(doc); - - const SmartPtrCOperationDoc operation = doc->getOperation(); - const std::string operationName = operation->getName(); - - const SmartPtrCParameterCollectionDoc parameterCollection = - operation->getParameterCollection(); - const std::string filePath = ParameterUtils::findRequiredParameterAsString( - "filePath", parameterCollection); - const std::string encoding = ParameterUtils::findRequiredParameterAsString( - "encoding", parameterCollection); - const std::string valueName = ParameterUtils::findRequiredParameterAsString( - "valueName", parameterCollection); - - if (operationName.compare("setValue") == 0) { - const std::string valueData = ParameterUtils::findRequiredParameterAsString( - "valueData", parameterCollection); - - setValue(filePath, encoding, valueName, valueData); - } else if (operationName.compare("deleteValue") == 0) { - deleteValue(filePath, encoding, valueName); - } else { - CAF_CM_EXCEPTIONEX_VA1(InvalidArgumentException, E_INVALIDARG, - "Invalid operation name (must be \'setValue\' or \'deleteValue\') - %s", operationName.c_str()) - } - } - CAF_CM_EXIT; -} - -SmartPtrCDataClassInstanceDoc CConfigProvider::createDataClassInstance( - const std::string& filePath, - const std::string& encoding, - const std::deque >& propertyCollection) const { - CAF_CM_FUNCNAME_VALIDATE("createDataClassInstance"); - - CAF_CM_VALIDATE_STRING(filePath); - CAF_CM_VALIDATE_STRING(encoding); - CAF_CM_VALIDATE_STL(propertyCollection); - - std::deque subInstances; - for(TConstIterator > > propertyIter(propertyCollection); - propertyIter; propertyIter++) { - - std::deque siProperties; - siProperties.push_back(CProviderDocHelper::createDataClassProperty("name", propertyIter->first)); - siProperties.push_back(CProviderDocHelper::createDataClassProperty("value", propertyIter->second)); - subInstances.push_back(CProviderDocHelper::createDataClassSubInstance( - "configEntry", - siProperties)); - } - - std::deque dataClassProperties; - dataClassProperties.push_back(CProviderDocHelper::createDataClassProperty("filePath", filePath)); - dataClassProperties.push_back(CProviderDocHelper::createDataClassProperty("encoding", encoding)); - - return CProviderDocHelper::createDataClassInstance( - "caf", - "ConfigData", - "1.0.0", - dataClassProperties, - subInstances); -} - -void CConfigProvider::setValue( - const std::string& filePath, - const std::string& encoding, - const std::string& valueName, - const std::string& valueData) const { - CAF_CM_FUNCNAME("setValue"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(filePath); - CAF_CM_VALIDATE_STRING(encoding); - CAF_CM_VALIDATE_STRING(valueName); - CAF_CM_VALIDATE_STRING(valueData); - - if (encoding.compare("iniFileWithoutSection") == 0) { - SmartPtrCIniFileWithoutSection iniFileWithoutSection; - iniFileWithoutSection.CreateInstance(); - iniFileWithoutSection->initialize(filePath); - iniFileWithoutSection->setValue(valueName, valueData); - } else if (encoding.compare("iniFile") == 0) { - std::string sectionName; - std::string keyName; - parseIniFileValuePath(valueName, sectionName, keyName); - - SmartPtrCIniFile iniFile; - iniFile.CreateInstance(); - iniFile->initialize(filePath); - iniFile->setValue(sectionName, keyName, valueData); - } else if (encoding.compare("xmlFile") == 0) { - std::string keyName; - std::deque keyPathCollection; - parseKeyPath(valueName, keyPathCollection, keyName); - - const SmartPtrCXmlElement rootXml = CXmlUtils::parseFile(filePath, std::string()); - const SmartPtrCXmlElement parentXml = findXmlElement(keyPathCollection, rootXml); - - const SmartPtrCXmlElement foundElement = parentXml->findOptionalChild(keyName); - if (! foundElement.IsNull()) { - foundElement->setValue(valueData); - } else { - const std::string foundAttribute = parentXml->findOptionalAttribute(keyName); - if (! foundAttribute.empty()) { - parentXml->setAttribute(keyName, valueData); - } else { - const SmartPtrCXmlElement createdElement = parentXml->createAndAddElement(keyName); - createdElement->setValue(valueData); - } - } - rootXml->saveToFile(filePath); - } else { - CAF_CM_EXCEPTIONEX_VA2(InvalidArgumentException, E_INVALIDARG, - "URI encoding is not recognized - filePath: %s, encoding: %s", - filePath.c_str(), encoding.c_str()); - } - } - CAF_CM_EXIT; -} - -void CConfigProvider::deleteValue( - const std::string& filePath, - const std::string& encoding, - const std::string& valueName) const { - CAF_CM_FUNCNAME("deleteValue"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(filePath); - CAF_CM_VALIDATE_STRING(encoding); - CAF_CM_VALIDATE_STRING(valueName); - - if (encoding.compare("iniFileWithoutSection") == 0) { - SmartPtrCIniFileWithoutSection iniFileWithoutSection; - iniFileWithoutSection.CreateInstance(); - iniFileWithoutSection->initialize(filePath); - iniFileWithoutSection->deleteValue(valueName); - } else if (encoding.compare("iniFile") == 0) { - std::string sectionName; - std::string keyName; - parseIniFileValuePath(valueName, sectionName, keyName); - - SmartPtrCIniFile iniFile; - iniFile.CreateInstance(); - iniFile->initialize(filePath); - iniFile->deleteValue(sectionName, keyName); - } else if (encoding.compare("xmlFile") == 0) { - std::string keyName; - std::deque keyPathCollection; - parseKeyPath(valueName, keyPathCollection, keyName); - - const SmartPtrCXmlElement rootXml = CXmlUtils::parseFile(filePath, std::string()); - const SmartPtrCXmlElement parentXml = findXmlElement(keyPathCollection, rootXml); - - const SmartPtrCXmlElement foundElement = parentXml->findOptionalChild(keyName); - if (! foundElement.IsNull()) { - parentXml->removeChild(keyName); - } else { - parentXml->removeAttribute(keyName); - } - rootXml->saveToFile(filePath); - } else { - CAF_CM_EXCEPTIONEX_VA2(InvalidArgumentException, E_INVALIDARG, - "URI encoding is not recognized - filePath: %s, encoding: %s", - filePath.c_str(), encoding.c_str()); - } - } - CAF_CM_EXIT; -} - -std::deque > CConfigProvider::createIniFileWithoutSectionPropertyCollection( - const std::string& filePath) const { - CAF_CM_FUNCNAME_VALIDATE("createIniFileWithoutSectionPropertyCollection"); - - std::deque > propertyCollection; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(filePath); - - SmartPtrCIniFileWithoutSection iniFileWithoutSection; - iniFileWithoutSection.CreateInstance(); - iniFileWithoutSection->initialize(filePath); - - const std::deque entryCollection = - iniFileWithoutSection->getEntryCollection(); - - for(TConstIterator > iniEntryIter(entryCollection); - iniEntryIter; iniEntryIter++) { - const CIniFileWithoutSection::SmartPtrSIniEntry iniEntry = *iniEntryIter; - propertyCollection.push_back(std::make_pair(iniEntry->_name, iniEntry->_valueExpanded)); - } - } - CAF_CM_EXIT; - - return propertyCollection; -} - -std::deque > CConfigProvider::createIniFilePropertyCollection( - const std::string& filePath) const { - CAF_CM_FUNCNAME_VALIDATE("createIniFilePropertyCollection"); - - std::deque > propertyCollection; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(filePath); - - SmartPtrCIniFile iniFile; - iniFile.CreateInstance(); - iniFile->initialize(filePath); - - const std::deque sectionCollection = iniFile->getSectionCollection(); - for (TConstIterator > iniSectionIter(sectionCollection); - iniSectionIter; iniSectionIter++) { - const CIniFile::SmartPtrSIniSection iniSection = *iniSectionIter; - const std::string sectionName = iniSection->_sectionName; - - for (TConstIterator > iniEntryIter(iniSection->_entryCollection); - iniEntryIter; iniEntryIter++) { - const CIniFile::SmartPtrSIniEntry iniEntry = *iniEntryIter; - const std::string keyName = iniEntry->_name; - const std::string value = iniEntry->_valueRaw; - - const std::string keyPath = sectionName + _keyPathDelimStr + keyName; - propertyCollection.push_back(std::make_pair(keyPath, value)); - } - } - } - CAF_CM_EXIT; - - return propertyCollection; -} - -std::deque > CConfigProvider::createXmlFilePropertyCollection( - const std::string& filePath) const { - CAF_CM_FUNCNAME_VALIDATE("createXmlFilePropertyCollection"); - - std::deque > propertyCollection; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(filePath); - - const SmartPtrCXmlElement rootXml = CXmlUtils::parseFile(filePath, std::string()); - - const std::string keyPath = rootXml->getName(); - createXmlPropertyCollection(keyPath, rootXml, propertyCollection); - } - CAF_CM_EXIT; - - return propertyCollection; -} - -void CConfigProvider::createXmlPropertyCollection( - const std::string& keyPath, - const SmartPtrCXmlElement& thisXml, - std::deque >& propertyCollection) const { - CAF_CM_FUNCNAME_VALIDATE("createXmlPropertyCollection"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(keyPath); - CAF_CM_VALIDATE_SMARTPTR(thisXml); - // propertyCollection is optional - - const CXmlElement::SmartPtrCAttributeCollection attributeCollection = thisXml->getAllAttributes(); - if (! attributeCollection.IsNull() && ! attributeCollection->empty()) { - for (TConstIterator attributeXmlIter(*attributeCollection); - attributeXmlIter; attributeXmlIter++) { - const std::string attributeName = attributeXmlIter->first; - const std::string attributeValue = attributeXmlIter->second; - - const std::string newKeyPath = keyPath + _keyPathDelimStr + attributeName; - propertyCollection.push_back(std::make_pair(newKeyPath, attributeValue)); - } - } - - const CXmlElement::SmartPtrCElementCollection childrenXml = thisXml->getAllChildren(); - if (! childrenXml.IsNull() && ! childrenXml->empty()) { - for (TConstIterator childrenXmlIter(*childrenXml); - childrenXmlIter; childrenXmlIter++) { - const SmartPtrCXmlElement childXml = childrenXmlIter->second; - const std::string newKeyPath = keyPath + _keyPathDelimStr + childXml->getName(); - - const std::string value = childXml->getValue(); - if (! value.empty()) { - propertyCollection.push_back(std::make_pair(newKeyPath, value)); - } - - createXmlPropertyCollection(newKeyPath, childXml, propertyCollection); - } - } - } - CAF_CM_EXIT; -} - -void CConfigProvider::parseIniFileValuePath( - const std::string& valuePath, - std::string& valueName, - std::string& valueValue) const { - CAF_CM_FUNCNAME("parseIniFileValuePath"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(valuePath); - - const std::string::size_type delimPos = valuePath.find_first_of("/"); - if (delimPos == std::string::npos) { - CAF_CM_EXCEPTIONEX_VA1(NoSuchElementException, ERROR_NOT_FOUND, - "Delim not found in valuePath - valuePath: %s", valuePath.c_str()); - } - - valueName = valuePath.substr(0, delimPos); - valueValue = valuePath.substr(delimPos + 1); - - CAF_CM_LOG_DEBUG_VA3("Parsed valuePath - valuePath: %s, valueName: %s, valueValue: %s", - valuePath.c_str(), valueName.c_str(), valueValue.c_str()); - } - CAF_CM_EXIT; -} - -void CConfigProvider::parseKeyPath( - const std::string& keyPath, - std::deque& keyPathCollection, - std::string& keyName) const { - CAF_CM_FUNCNAME_VALIDATE("parseKeyPath"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(keyPath); - - std::string token; - std::stringstream stream(keyPath); - while(std::getline(stream, token, _keyPathDelimChar)) { - keyPathCollection.push_back(token); - } - - keyName = keyPathCollection.back(); - keyPathCollection.pop_back(); - } - CAF_CM_EXIT; -} - -SmartPtrCXmlElement CConfigProvider::findXmlElement( - const std::deque& keyPathCollection, - const SmartPtrCXmlElement& rootXml) const { - CAF_CM_FUNCNAME("findXmlElement"); - - SmartPtrCXmlElement xmlRc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STL(keyPathCollection); - CAF_CM_VALIDATE_SMARTPTR(rootXml); - - xmlRc = rootXml; - for (std::deque::const_iterator keyPathIter = keyPathCollection.begin(); - keyPathIter != keyPathCollection.end(); - keyPathIter++) { - const std::string keyPath = *keyPathIter; - - if (keyPathIter == keyPathCollection.begin()) { - if (xmlRc->getName().compare(keyPath) != 0) { - CAF_CM_EXCEPTIONEX_VA2(NoSuchElementException, ERROR_NOT_FOUND, - "Root element does not match - %s != %s", keyPath.c_str(), xmlRc->getName().c_str()); - } - } else { - xmlRc = xmlRc->findRequiredChild(keyPath); - } - } - } - CAF_CM_EXIT; - - return xmlRc; -} diff --git a/open-vm-tools/common-agent/Cpp/InternalProviders/Config_Provider/src/CConfigProvider.h b/open-vm-tools/common-agent/Cpp/InternalProviders/Config_Provider/src/CConfigProvider.h deleted file mode 100644 index 8cb1344ff..000000000 --- a/open-vm-tools/common-agent/Cpp/InternalProviders/Config_Provider/src/CConfigProvider.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Author: bwilliams - * Created: May 3, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CConfigProvider_h_ -#define CConfigProvider_h_ - - -#include "IInvokedProvider.h" - -#include "Doc/ProviderResultsDoc/CSchemaDoc.h" -#include "Doc/SchemaTypesDoc/CDataClassInstanceDoc.h" -#include "Xml/XmlUtils/CXmlElement.h" - -namespace Caf { - -/// Sends responses/errors back to the client. -class CConfigProvider : public IInvokedProvider { -public: - CConfigProvider(); - virtual ~CConfigProvider(); - -public: // IInvokedProvider - const std::string getProviderNamespace() const { - return "caf"; - } - - const std::string getProviderName() const { - return "ConfigProvider"; - } - - const std::string getProviderVersion() const { - return "1.0.0"; - } - - const SmartPtrCSchemaDoc getSchema() const; - - void collect(const IProviderRequest& request, IProviderResponse& response) const; - - void invoke(const IProviderRequest& request, IProviderResponse& response) const; - -private: - std::string _fileAliasPrefix; - std::string _keyPathDelimStr; - char _keyPathDelimChar; - -private: - SmartPtrCDataClassInstanceDoc createDataClassInstance( - const std::string& filePath, - const std::string& encoding, - const std::deque >& propertyCollection) const; - - void setValue( - const std::string& filePath, - const std::string& encoding, - const std::string& valueName, - const std::string& valueValue) const; - - void deleteValue( - const std::string& filePath, - const std::string& encoding, - const std::string& valueName) const; - - std::deque > createIniFileWithoutSectionPropertyCollection( - const std::string& filePath) const; - - std::deque > createIniFilePropertyCollection( - const std::string& filePath) const; - - std::deque > createXmlFilePropertyCollection( - const std::string& filePath) const; - - void createXmlPropertyCollection( - const std::string& keyPath, - const SmartPtrCXmlElement& thisXml, - std::deque >& propertyCollection) const; - - void parseIniFileValuePath( - const std::string& valuePath, - std::string& valueName, - std::string& valueValue) const; - - void parseKeyPath( - const std::string& keyPath, - std::deque& keyPathCollection, - std::string& keyName) const; - - SmartPtrCXmlElement findXmlElement( - const std::deque& keyPathCollection, - const SmartPtrCXmlElement& rootXml) const; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CConfigProvider); -}; - -} - -#endif // #ifndef CConfigProvider_h_ diff --git a/open-vm-tools/common-agent/Cpp/InternalProviders/Config_Provider/src/CIniFileWithoutSection.cpp b/open-vm-tools/common-agent/Cpp/InternalProviders/Config_Provider/src/CIniFileWithoutSection.cpp deleted file mode 100644 index 4df09213e..000000000 --- a/open-vm-tools/common-agent/Cpp/InternalProviders/Config_Provider/src/CIniFileWithoutSection.cpp +++ /dev/null @@ -1,479 +0,0 @@ -/* - * Author: bwilliams - * Created: May 18, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Common/CCafRegex.h" -#include "Common/CIniFile.h" -#include "CIniFileWithoutSection.h" -#include "Exception/CCafException.h" - -using namespace Caf; - -CIniFileWithoutSection::CIniFileWithoutSection() : - _isInitialized(false), - CAF_CM_INIT_LOG("CIniFileWithoutSection") { -} - -CIniFileWithoutSection::~CIniFileWithoutSection() { -} - -void CIniFileWithoutSection::initialize( - const std::string& configFilePath) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(configFilePath); - - _configFilePath = configFilePath; - - _isInitialized = true; - } - CAF_CM_EXIT; -} - -std::deque CIniFileWithoutSection::getEntryCollection() { - CAF_CM_FUNCNAME_VALIDATE("getEntryCollection"); - - std::deque entryCollection; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - if (_entryCollection.empty()) { - _entryCollection = parse(_configFilePath); - } - - entryCollection = _entryCollection; - } - CAF_CM_EXIT; - - return entryCollection; -} - -CIniFileWithoutSection::SmartPtrSIniEntry CIniFileWithoutSection::findOptionalEntry( - const std::string& keyName) { - CAF_CM_FUNCNAME_VALIDATE("findOptionalEntry"); - - CIniFileWithoutSection::SmartPtrSIniEntry iniEntry; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(keyName); - - if (_entryCollection.empty()) { - _entryCollection = parse(_configFilePath); - } - - for (TConstIterator > iniEntryIter(_entryCollection); - iniEntryIter; iniEntryIter++) { - const SmartPtrSIniEntry iniEntryTmp = *iniEntryIter; - const std::string keyNameTmp = iniEntryTmp->_name; - if (keyNameTmp.compare(keyName) == 0) { - iniEntry = iniEntryTmp; - break; - } - } - } - CAF_CM_EXIT; - - return iniEntry; -} - -CIniFileWithoutSection::SmartPtrSIniEntry CIniFileWithoutSection::findRequiredEntry( - const std::string& keyName) { - CAF_CM_FUNCNAME("findRequiredEntry"); - - SmartPtrSIniEntry iniEntry; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(keyName); - - iniEntry = findOptionalEntry(keyName); - if (iniEntry.IsNull()) { - CAF_CM_EXCEPTIONEX_VA1(NoSuchElementException, ERROR_NOT_FOUND, - "Value not found - keyName: %s", keyName.c_str()); - } - } - CAF_CM_EXIT; - - return iniEntry; -} - -std::string CIniFileWithoutSection::findOptionalString( - const std::string& keyName) { - CAF_CM_FUNCNAME_VALIDATE("findOptionalString"); - - std::string value; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(keyName); - - const SmartPtrSIniEntry iniEntry = findOptionalEntry(keyName); - if (! iniEntry.IsNull()) { - value = iniEntry->_valueExpanded; - } - } - CAF_CM_EXIT; - - return value; -} - -std::string CIniFileWithoutSection::findRequiredString( - const std::string& keyName) { - CAF_CM_FUNCNAME_VALIDATE("findRequiredString"); - - std::string value; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(keyName); - - const SmartPtrSIniEntry iniEntry = findRequiredEntry(keyName); - value = iniEntry->_valueExpanded; - } - CAF_CM_EXIT; - - return value; -} - -std::string CIniFileWithoutSection::findOptionalRawString( - const std::string& keyName) { - CAF_CM_FUNCNAME_VALIDATE("findOptionalRawString"); - - std::string value; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(keyName); - - const SmartPtrSIniEntry iniEntry = findOptionalEntry(keyName); - if (! iniEntry.IsNull()) { - value = iniEntry->_valueRaw; - } - } - CAF_CM_EXIT; - - return value; -} - -std::string CIniFileWithoutSection::findRequiredRawString( - const std::string& keyName) { - CAF_CM_FUNCNAME_VALIDATE("findRequiredRawString"); - - std::string value; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(keyName); - - const SmartPtrSIniEntry iniEntry = findRequiredEntry(keyName); - value = iniEntry->_valueRaw; - } - CAF_CM_EXIT; - - return value; -} - -void CIniFileWithoutSection::log() { - CAF_CM_FUNCNAME_VALIDATE("log"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - if (_entryCollection.empty()) { - _entryCollection = parse(_configFilePath); - } - - for (TConstIterator > iniEntryIter(_entryCollection); - iniEntryIter; iniEntryIter++) { - const SmartPtrSIniEntry iniEntry = *iniEntryIter; - CAF_CM_LOG_DEBUG_VA3("Entry - %s=%s (%s)", - iniEntry->_name.c_str(), iniEntry->_valueRaw.c_str(), iniEntry->_valueExpanded.c_str()); - } - } - CAF_CM_EXIT; -} - -void CIniFileWithoutSection::setValue( - const std::string valueName, - const std::string valueValue) { - CAF_CM_FUNCNAME_VALIDATE("setValue"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(valueName); - CAF_CM_VALIDATE_STRING(valueValue); - - const std::string srchValueName = valueName + "="; - const std::string newFileLine = valueName + "=" + valueValue + "\n"; - - bool isValueNameFnd = false; - std::deque newFileContents; - const std::deque fileContents = loadTextFileIntoCollection(_configFilePath); - for(TConstIterator > fileLineIter(fileContents); - fileLineIter; fileLineIter++) { - const std::string fileLine = *fileLineIter; - - if (fileLine.find(srchValueName) == 0) { - CAF_CM_LOG_DEBUG_VA2("Matched line... changing - valueName: %s, valueValue: %s", - valueName.c_str(), valueValue.c_str()); - - isValueNameFnd = true; - newFileContents.push_back(newFileLine); - } else { - newFileContents.push_back(fileLine); - } - } - - if (! isValueNameFnd) { - CAF_CM_LOG_WARN_VA1("Value name not found, adding... - %s", newFileLine.c_str()); - newFileContents.push_back(newFileLine); - } - - _entryCollection.clear(); - saveTextFile(newFileContents, _configFilePath); - } - CAF_CM_EXIT; -} - -void CIniFileWithoutSection::deleteValue( - const std::string valueName) { - CAF_CM_FUNCNAME_VALIDATE("deleteValue"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(valueName); - - const std::string srchValueName = valueName + "="; - - std::deque newFileContents; - const std::deque FileContents = loadTextFileIntoCollection(_configFilePath); - for(TConstIterator > fileLineIter(FileContents); - fileLineIter; fileLineIter++) { - const std::string fileLine = *fileLineIter; - - if (fileLine.find(srchValueName) == 0) { - CAF_CM_LOG_DEBUG_VA2("Matched line... deleting - srchValueName: %s, line: %s", - srchValueName.c_str(), fileLine.c_str()); - } else { - newFileContents.push_back(fileLine); - } - } - - _entryCollection.clear(); - saveTextFile(newFileContents, _configFilePath); - } - CAF_CM_EXIT; -} - -std::deque CIniFileWithoutSection::parse( - const std::string& configFilePath) const { - CAF_CM_FUNCNAME_VALIDATE("parse"); - - std::deque entryCollection; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(configFilePath); - - std::deque replacementCollection; - - SmartPtrCCafRegex goodLineRegex; - goodLineRegex.CreateInstance(); - goodLineRegex->initialize("^[A-Za-z0-9]"); - - SmartPtrCCafRegex newLineRegex; - newLineRegex.CreateInstance(); - newLineRegex->initialize("\n"); - - const std::deque fileContents = loadTextFileIntoCollection(configFilePath); - for(TConstIterator > fileLineIter(fileContents); - fileLineIter; fileLineIter++) { - const std::string fileLine = *fileLineIter; - const std::string newFileLine = newLineRegex->replaceLiteral(fileLine, " "); - - if (goodLineRegex->isMatched(newFileLine)) { - const Cdeqstr fileLineTokens = CStringUtils::split(newFileLine, '='); - if (fileLineTokens.size() == 2) { - const std::string keyName = fileLineTokens[0]; - const std::string valueRaw = fileLineTokens[1]; - - std::string valueExpanded = CStringUtils::expandEnv(valueRaw); - for (TConstIterator > replacementIter(replacementCollection); - replacementIter; replacementIter++ ) { - const SmartPtrSReplacement replacement = *replacementIter; - if (replacement->_regex->isMatched(valueExpanded)) { - valueExpanded = replacement->_regex->replaceLiteral(valueExpanded, replacement->_value); - break; - } - } - - const SmartPtrSReplacement replacement = createReplacement(keyName, valueExpanded); - replacementCollection.push_back(replacement); - - const SmartPtrSIniEntry iniEntry = createIniEntry(keyName, valueRaw, valueExpanded); - entryCollection.push_back(iniEntry); - } else { - CAF_CM_LOG_WARN_VA2("Invalid line - file: %s, line: %s", configFilePath.c_str(), newFileLine.c_str()); - } - } - } - } - CAF_CM_EXIT; - - return entryCollection; -} - -CIniFileWithoutSection::SmartPtrSReplacement CIniFileWithoutSection::createReplacement( - const std::string& keyName, - const std::string& value) const { - CAF_CM_FUNCNAME_VALIDATE("createReplacement"); - - SmartPtrSReplacement replacement; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(keyName); - - std::string pattern("\\$\\{"); - pattern += keyName; - pattern += "\\}"; - - SmartPtrCCafRegex regex; - regex.CreateInstance(); - regex->initialize(pattern); - - replacement.CreateInstance(); - replacement->_regex = regex; - replacement->_value = value; - } - CAF_CM_EXIT; - - return replacement; -} - -CIniFileWithoutSection::SmartPtrSIniEntry CIniFileWithoutSection::createIniEntry( - const std::string& keyName, - const std::string& valueRaw, - const std::string& valueExpanded) const { - CAF_CM_FUNCNAME_VALIDATE("createIniEntry"); - - SmartPtrSIniEntry iniEntry; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(keyName); - CAF_CM_VALIDATE_STRING(valueRaw); - CAF_CM_VALIDATE_STRING(valueExpanded); - - iniEntry.CreateInstance(); - iniEntry->_name = keyName; - iniEntry->_valueRaw = valueRaw; - iniEntry->_valueExpanded = valueExpanded; - } - CAF_CM_EXIT; - - return iniEntry; -} - -std::deque CIniFileWithoutSection::loadTextFileIntoCollection( - const std::string& filePath) const { - CAF_CM_FUNCNAME("loadTextFileIntoCollection"); - - std::deque rc; - const uint32 maxLineLen = 512; - - FILE* fileHandle = NULL; - - try { - CAF_CM_VALIDATE_STRING(filePath); - - if (! FileSystemUtils::doesFileExist(filePath)) { - CAF_CM_EXCEPTIONEX_VA1(FileNotFoundException, ERROR_FILE_NOT_FOUND, - "File not found - %s", filePath.c_str()); - } - -#ifdef WIN32 - const errno_t fopenRc = ::fopen_s(&fileHandle, filePath.c_str(), "r" ); - if ((fopenRc != 0) || (fileHandle == NULL)) { - CAF_CM_EXCEPTIONEX_VA1(InvalidHandleException, E_UNEXPECTED, - "Failed to open file - %s", filePath.c_str()); - } -#else - fileHandle = ::fopen(filePath.c_str(), "r" ); - if (fileHandle == NULL) { - CAF_CM_EXCEPTIONEX_VA1(InvalidHandleException, E_UNEXPECTED, - "Failed to open file - %s", filePath.c_str()); - } -#endif - - char buffer[maxLineLen]; - while(::fgets(buffer, maxLineLen, fileHandle) != NULL) { - rc.push_back(buffer); - } - } - CAF_CM_CATCH_ALL; - - try { - if (fileHandle != NULL) { - ::fclose(fileHandle); - } - } - CAF_CM_CATCH_ALL; - CAF_CM_THROWEXCEPTION; - - return rc; -} - -void CIniFileWithoutSection::saveTextFile( - const std::deque fileContents, - const std::string filePath) const { - CAF_CM_FUNCNAME("saveTextFile"); - - FILE* fileHandle = NULL; - - try { - CAF_CM_VALIDATE_STL(fileContents); - CAF_CM_VALIDATE_STRING(filePath); - - if (! FileSystemUtils::doesFileExist(filePath)) { - CAF_CM_EXCEPTIONEX_VA1(FileNotFoundException, ERROR_FILE_NOT_FOUND, - "File not found - %s", filePath.c_str()); - } - -#ifdef WIN32 - const errno_t fopenRc = ::fopen_s(&fileHandle, filePath.c_str(), "w" ); - if ((fopenRc != 0) || (fileHandle == NULL)) { - CAF_CM_EXCEPTIONEX_VA1(InvalidHandleException, E_UNEXPECTED, - "Failed to open file - %s", filePath.c_str()); - } -#else - fileHandle = ::fopen(filePath.c_str(), "w" ); - if (fileHandle == NULL) { - CAF_CM_EXCEPTIONEX_VA1(InvalidHandleException, E_UNEXPECTED, - "Failed to open file - %s", filePath.c_str()); - } -#endif - - for(TConstIterator > fileLineIter(fileContents); - fileLineIter; fileLineIter++) { - const std::string fileLine = *fileLineIter; - ::fputs(fileLine.c_str(), fileHandle); - } - } - CAF_CM_CATCH_ALL; - - try { - if (fileHandle != NULL) { - ::fclose(fileHandle); - } - } - CAF_CM_CATCH_ALL; - CAF_CM_THROWEXCEPTION; -} diff --git a/open-vm-tools/common-agent/Cpp/InternalProviders/Config_Provider/src/ConfigProvider.cpp b/open-vm-tools/common-agent/Cpp/InternalProviders/Config_Provider/src/ConfigProvider.cpp deleted file mode 100644 index 0bc062fc1..000000000 --- a/open-vm-tools/common-agent/Cpp/InternalProviders/Config_Provider/src/ConfigProvider.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Author: bwilliams - * Created: May 3, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -using namespace Caf; - -int main(int csz, char* asz[]) { - CAF_CM_STATIC_FUNC_LOG("ConfigProvider", "main"); - - int rc = 0; - try { - CConfigProvider provider; - rc = CProviderDriver::processProviderCommandline(provider, csz, asz); - } - CAF_CM_CATCH_CAF - CAF_CM_CATCH_DEFAULT - CAF_CM_LOG_CRIT_CAFEXCEPTION; - - rc = CAF_CM_ISEXCEPTION ? 1 : rc; - CAF_CM_CLEAREXCEPTION; - - return rc; -} diff --git a/open-vm-tools/common-agent/Cpp/InternalProviders/Config_Provider/src/stdafx.h b/open-vm-tools/common-agent/Cpp/InternalProviders/Config_Provider/src/stdafx.h deleted file mode 100644 index 58307a6a8..000000000 --- a/open-vm-tools/common-agent/Cpp/InternalProviders/Config_Provider/src/stdafx.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Author: bwilliams - * Created: May 3, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef stdafx_h_ -#define stdafx_h_ - -//{{CAF_SUBSYSTEM}} - -#include -#include -#include - -#include "CConfigProvider.h" - -#endif // #ifndef stdafx_h_ diff --git a/open-vm-tools/common-agent/Cpp/InternalProviders/Install_Provider/include/CPackageInstaller.h b/open-vm-tools/common-agent/Cpp/InternalProviders/Install_Provider/include/CPackageInstaller.h deleted file mode 100644 index 0a445b12f..000000000 --- a/open-vm-tools/common-agent/Cpp/InternalProviders/Install_Provider/include/CPackageInstaller.h +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Author: bwilliams - * Created: May 3, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CPackageInstaller_h_ -#define CPackageInstaller_h_ - - -#include "Doc/CafCoreTypesDoc/CAttachmentCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CAttachmentDoc.h" -#include "Doc/CafCoreTypesDoc/CAttachmentNameCollectionDoc.h" -#include "Doc/CafInstallRequestDoc/CFullPackageElemDoc.h" -#include "Doc/CafInstallRequestDoc/CInstallPackageSpecDoc.h" -#include "Doc/CafInstallRequestDoc/CInstallProviderSpecDoc.h" -#include "Doc/CafInstallRequestDoc/CMinPackageElemDoc.h" - -namespace Caf { - -/// Sends responses/errors back to the client. -class CPackageInstaller { -public: - typedef std::deque CInstallPackageSpecCollection; - CAF_DECLARE_SMART_POINTER(CInstallPackageSpecCollection); - - struct CInstallPackageMatch { - CInstallUtils::MATCH_STATUS _matchStatus; - SmartPtrCInstallPackageSpecDoc _matchedInstallPackageSpec; - }; - CAF_DECLARE_SMART_POINTER(CInstallPackageMatch); - -public: - static void installPackages( - const std::deque& fullPackageElemCollection, - const SmartPtrCAttachmentCollectionDoc& attachmentCollection, - const std::string& outputDir); - - static void uninstallPackages( - const std::deque& minPackageElemCollection, - const std::deque& installProviderSpecCollection, - const std::string& outputDir); - -private: - static void installPackage( - const SmartPtrCInstallPackageSpecDoc& installPackageSpec, - const SmartPtrCInstallPackageSpecDoc& uninstallPackageSpec, - const std::string& outputDir); - - static void executePackage( - const SmartPtrCInstallPackageSpecDoc& installPackageSpec, - const std::string& startupArgument, - const std::string& outputDir); - - static SmartPtrCInstallPackageSpecDoc resolveAndCopyAttachments( - const SmartPtrCInstallPackageSpecDoc& installPackageSpec); - - static void saveInstallPackageSpec( - const SmartPtrCInstallPackageSpecDoc& installPackageSpec); - - static std::map orderFullPackageElems( - const std::deque& fullPackageElemCollection); - - static std::map orderMinPackageElems( - const std::deque& minPackageElemCollection); - - static SmartPtrCAttachmentCollectionDoc resolveAttachments( - const SmartPtrCAttachmentNameCollectionDoc& attachmentNameCollection, - const SmartPtrCAttachmentCollectionDoc& attachmentCollection); - - static SmartPtrCAttachmentCollectionDoc copyAttachments( - const SmartPtrCAttachmentDoc& startupAttachment, - const SmartPtrCAttachmentDoc& packageAttachment, - const SmartPtrCAttachmentCollectionDoc& supportingAttachmentCollection, - const std::string& outputDir); - - static SmartPtrCInstallPackageMatch matchInstallPackageSpec( - const SmartPtrCInstallPackageSpecDoc& installPackageSpec); - - static SmartPtrCInstallPackageSpecCollection readInstallPackageSpecs(); - - static uint32 countPackageReferences( - const SmartPtrCInstallPackageSpecDoc& installPackageSpec, - const std::deque& installProviderSpecCollection); - - static void logDebug( - const std::string& message, - const SmartPtrCInstallPackageSpecDoc& installPackageSpec1, - const SmartPtrCInstallPackageSpecDoc& installPackageSpec2); - - static void logWarn( - const std::string& message, - const SmartPtrCInstallPackageSpecDoc& installPackageSpec1, - const SmartPtrCInstallPackageSpecDoc& installPackageSpec2); - - static void cleanupPackage( - const SmartPtrCInstallPackageMatch& installPackageMatch); - -private: - CAF_CM_DECLARE_NOCREATE(CPackageInstaller); -}; - -} - -#endif // #ifndef CPackageInstaller_h_ diff --git a/open-vm-tools/common-agent/Cpp/InternalProviders/Install_Provider/include/CProviderInstaller.h b/open-vm-tools/common-agent/Cpp/InternalProviders/Install_Provider/include/CProviderInstaller.h deleted file mode 100644 index 19a12414e..000000000 --- a/open-vm-tools/common-agent/Cpp/InternalProviders/Install_Provider/include/CProviderInstaller.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Author: bwilliams - * Created: May 3, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CProviderInstaller_h_ -#define CProviderInstaller_h_ - - -#include "Doc/CafCoreTypesDoc/CAttachmentCollectionDoc.h" -#include "Doc/CafInstallRequestDoc/CInstallProviderJobDoc.h" -#include "Doc/CafInstallRequestDoc/CInstallProviderSpecDoc.h" -#include "Doc/CafInstallRequestDoc/CUninstallProviderJobDoc.h" - -namespace Caf { - -class CProviderInstaller { -public: - typedef std::deque CInstallProviderSpecCollection; - CAF_DECLARE_SMART_POINTER(CInstallProviderSpecCollection); - - struct CInstallProviderMatch { - CInstallUtils::MATCH_STATUS _matchStatus; - SmartPtrCInstallProviderSpecDoc _matchedInstallProviderSpec; - }; - CAF_DECLARE_SMART_POINTER(CInstallProviderMatch); - -public: - static void installProvider( - const SmartPtrCInstallProviderJobDoc& installProviderJob, - const SmartPtrCAttachmentCollectionDoc& attachmentCollection, - const std::string& outputDir); - - static void uninstallProvider( - const SmartPtrCUninstallProviderJobDoc& uninstallProviderJob, - const std::string& outputDir); - - static SmartPtrCInstallProviderSpecCollection readInstallProviderSpecs(); - -private: - static void installProviderLow( - const SmartPtrCInstallProviderJobDoc& installProviderJob, - const SmartPtrCAttachmentCollectionDoc& attachmentCollection, - const std::string& outputDir); - - static void uninstallProviderLow( - const SmartPtrCInstallProviderSpecDoc& installProviderSpec, - const std::string& outputDir); - - static void storeInstallProviderSpec( - const SmartPtrCInstallProviderSpecDoc& installProviderSpec); - - static SmartPtrCInstallProviderMatch matchInstallProviderSpec( - const SmartPtrCInstallProviderSpecDoc& installProviderSpec); - - static SmartPtrCInstallProviderSpecDoc createInstallProviderSpec( - const SmartPtrCInstallProviderJobDoc& installProviderJob); - - static void logDebug( - const std::string& message, - const SmartPtrCInstallProviderSpecDoc& installProviderSpec1, - const SmartPtrCInstallProviderSpecDoc& installProviderSpec2); - - static void logWarn( - const std::string& message, - const SmartPtrCInstallProviderSpecDoc& installProviderSpec1, - const SmartPtrCInstallProviderSpecDoc& installProviderSpec2); - - static void cleanupProvider( - const SmartPtrCInstallProviderSpecDoc& installProviderSpec); - - static std::string calcProviderFqn( - const SmartPtrCInstallProviderSpecDoc& installProviderSpec); - - static std::string calcProviderFqn( - const SmartPtrCUninstallProviderJobDoc& uninstallProviderJob); - -private: - CAF_CM_DECLARE_NOCREATE(CProviderInstaller); -}; - -} - -#endif // #ifndef CProviderInstaller_h_ diff --git a/open-vm-tools/common-agent/Cpp/InternalProviders/Install_Provider/include/IPackage.h b/open-vm-tools/common-agent/Cpp/InternalProviders/Install_Provider/include/IPackage.h deleted file mode 100644 index a64c5362a..000000000 --- a/open-vm-tools/common-agent/Cpp/InternalProviders/Install_Provider/include/IPackage.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Author: bwilliams - * Created: July 25, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef _InstallProvider_IPackage_h_ -#define _InstallProvider_IPackage_h_ - - -#include "ICafObject.h" - -#include "Doc/CafCoreTypesDoc/CAttachmentCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CAttachmentDoc.h" - -namespace Caf { - -/// TODO - describe interface -struct __declspec(novtable) -IPackage : public ICafObject { - CAF_DECL_UUID("e372d4bc-2384-4fcc-8042-f916f2d11bd2") - - virtual void fullPackageElem( - const SmartPtrCAttachmentDoc packageAttachment, - const std::string arguments, - const SmartPtrCAttachmentCollectionDoc supportingAttachmentCollection, - const std::string outputDir) = 0; - - virtual void unfullPackageElem( - const SmartPtrCAttachmentDoc packageAttachment, - const std::string arguments, - const SmartPtrCAttachmentCollectionDoc supportingAttachmentCollection, - const std::string outputDir) = 0; -}; - -CAF_DECLARE_SMART_INTERFACE_POINTER(IPackage); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/InternalProviders/Install_Provider/src/CInstallProvider.cpp b/open-vm-tools/common-agent/Cpp/InternalProviders/Install_Provider/src/CInstallProvider.cpp deleted file mode 100644 index 6faa329cc..000000000 --- a/open-vm-tools/common-agent/Cpp/InternalProviders/Install_Provider/src/CInstallProvider.cpp +++ /dev/null @@ -1,253 +0,0 @@ -/* - * Author: bwilliams - * Created: May 3, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "Doc/CafInstallRequestDoc/CafInstallRequestDocTypes.h" - -#include "CProviderInstaller.h" -#include "Doc/CafCoreTypesDoc/COperationDoc.h" -#include "Doc/CafCoreTypesDoc/CParameterCollectionDoc.h" -#include "Doc/CafInstallRequestDoc/CInstallProviderJobDoc.h" -#include "Doc/CafInstallRequestDoc/CInstallProviderSpecDoc.h" -#include "Doc/CafInstallRequestDoc/CMinPackageElemDoc.h" -#include "Doc/CafInstallRequestDoc/CUninstallProviderJobDoc.h" -#include "Doc/ProviderRequestDoc/CProviderInvokeOperationDoc.h" -#include "Doc/ProviderResultsDoc/CSchemaDoc.h" -#include "Doc/SchemaTypesDoc/CActionClassDoc.h" -#include "Doc/SchemaTypesDoc/CClassInstancePropertyDoc.h" -#include "Doc/SchemaTypesDoc/CClassPropertyDoc.h" -#include "Doc/SchemaTypesDoc/CDataClassDoc.h" -#include "Doc/SchemaTypesDoc/CDataClassInstanceDoc.h" -#include "Doc/SchemaTypesDoc/CDataClassPropertyDoc.h" -#include "Doc/SchemaTypesDoc/CDataClassSubInstanceDoc.h" -#include "Doc/SchemaTypesDoc/CInstanceParameterDoc.h" -#include "Doc/SchemaTypesDoc/CMethodDoc.h" -#include "Doc/SchemaTypesDoc/CMethodParameterDoc.h" -#include "Memory/DynamicArray/DynamicArrayInc.h" -#include "Exception/CCafException.h" -#include "CInstallProvider.h" -#include "IProviderResponse.h" -#include "IProviderRequest.h" -#include "Integration/Caf/CCafMessagePayloadParser.h" -#include "Integration/Caf/CCafMessagePayload.h" - -using namespace Caf; - -CInstallProvider::CInstallProvider() : - CAF_CM_INIT_LOG("CInstallProvider") { -} - -CInstallProvider::~CInstallProvider() { -} - -const SmartPtrCSchemaDoc CInstallProvider::getSchema() const { - std::deque dc1Props; - dc1Props.push_back(CProviderDocHelper::createClassProperty("index", PROPERTY_UINT32, true)); - dc1Props.push_back(CProviderDocHelper::createClassProperty("packageNamespace", PROPERTY_STRING, true)); - dc1Props.push_back(CProviderDocHelper::createClassProperty("packageName", PROPERTY_STRING, true)); - dc1Props.push_back(CProviderDocHelper::createClassProperty("packageVersion", PROPERTY_STRING, true)); - dc1Props.push_back(CProviderDocHelper::createClassProperty("startupAttachmentName", PROPERTY_STRING, true)); - dc1Props.push_back(CProviderDocHelper::createClassProperty("packageAttachmentName", PROPERTY_STRING, true)); - dc1Props.push_back(CProviderDocHelper::createClassProperty("arguments", PROPERTY_STRING, true)); - dc1Props.push_back(CProviderDocHelper::createClassProperty("supportingAttachmentName", PROPERTY_STRING, false, false, true)); - - std::deque dc2Props; - dc2Props.push_back(CProviderDocHelper::createClassProperty("clientId", PROPERTY_STRING, true)); - dc2Props.push_back(CProviderDocHelper::createClassProperty("providerNamespace", PROPERTY_STRING, true)); - dc2Props.push_back(CProviderDocHelper::createClassProperty("providerName", PROPERTY_STRING, true)); - dc2Props.push_back(CProviderDocHelper::createClassProperty("providerVersion", PROPERTY_STRING, true)); - dc2Props.push_back(CProviderDocHelper::createClassProperty("packageOSType", PROPERTY_STRING, true)); - - std::deque instanceProperties; - instanceProperties.push_back(CProviderDocHelper::createClassInstanceProperty( - "fullPackageElem", - CProviderDocHelper::createClassIdentifier("caf", "FullPackageElem", "1.0.0"), - true, - false, - true)); - instanceProperties.push_back(CProviderDocHelper::createClassInstanceProperty( - "unfullPackageElem", - CProviderDocHelper::createClassIdentifier("caf", "FullPackageElem", "1.0.0"), - true, - false, - true)); - - std::deque dc3Props; - dc3Props.push_back(CProviderDocHelper::createClassProperty("packageOSType", PROPERTY_STRING, true)); - dc3Props.push_back(CProviderDocHelper::createClassProperty("clientId", PROPERTY_STRING, true)); - dc3Props.push_back(CProviderDocHelper::createClassProperty("providerNamespace", PROPERTY_STRING, true)); - dc3Props.push_back(CProviderDocHelper::createClassProperty("providerName", PROPERTY_STRING, true)); - dc3Props.push_back(CProviderDocHelper::createClassProperty("providerVersion", PROPERTY_STRING, true)); - dc3Props.push_back(CProviderDocHelper::createClassProperty("packageOSType", PROPERTY_STRING, true)); - - std::deque dataClasses; - dataClasses.push_back(CProviderDocHelper::createDataClass("caf", "FullPackageElem", "1.0.0", dc1Props)); - dataClasses.push_back(CProviderDocHelper::createDataClass("caf", "InstallProviderJob", "1.0.0", dc2Props, instanceProperties)); - dataClasses.push_back(CProviderDocHelper::createDataClass("caf", "UninstallProviderJob", "1.0.0", dc3Props)); - - std::deque m1InstanceParams; - m1InstanceParams.push_back(CProviderDocHelper::createInstanceParameter( - "installProviderJob", - "caf", - "InstallProviderJob", - "1.0.0", - false)); - - std::deque m2InstanceParams; - m2InstanceParams.push_back(CProviderDocHelper::createInstanceParameter( - "uninstallProviderJob", - "caf", - "UninstallProviderJob", - "1.0.0", - false)); - - std::deque emptyParams; - - std::deque methods; - methods.push_back(CProviderDocHelper::createMethod("installProviderJob", emptyParams, m1InstanceParams)); - methods.push_back(CProviderDocHelper::createMethod("uninstallProviderJob", emptyParams, m2InstanceParams)); - - std::deque actionClasses; - actionClasses.push_back( - CProviderDocHelper::createActionClass( - "caf", - "InstallActions", - "1.0.0", - CProviderDocHelper::createCollectMethod("collectInstances"), - methods)); - - return CProviderDocHelper::createSchema(dataClasses, actionClasses); -} - -void CInstallProvider::collect(const IProviderRequest& request, IProviderResponse& response) const { - - const CProviderInstaller::SmartPtrCInstallProviderSpecCollection installProviderSpecCollection = - CProviderInstaller::readInstallProviderSpecs(); - if (!installProviderSpecCollection.IsNull()) { - for (TConstIterator > - installProviderSpecIter(*installProviderSpecCollection); installProviderSpecIter; installProviderSpecIter++) { - const SmartPtrCInstallProviderSpecDoc installProviderSpec = - *installProviderSpecIter; - - const SmartPtrCDataClassInstanceDoc dataClassInstance = createDataClassInstance( - installProviderSpec); - - response.addInstance(dataClassInstance); - } - } -} - -void CInstallProvider::invoke(const IProviderRequest& request, IProviderResponse& response) const { - CAF_CM_FUNCNAME("invoke"); - - SmartPtrCProviderInvokeOperationDoc doc = request.getInvokeOperations(); - CAF_CM_VALIDATE_SMARTPTR(doc); - - const SmartPtrCOperationDoc operation = doc->getOperation(); - const std::string operationName = operation->getName(); - - const SmartPtrCParameterCollectionDoc parameterCollection = - operation->getParameterCollection(); - - const std::string outputDir = doc->getOutputDir(); - - if (operationName.compare("installProviderJob") == 0) { - const std::string installProviderJobStr = - ParameterUtils::findRequiredInstanceParameterAsString("installProviderJob", - parameterCollection); - CAF_CM_VALIDATE_STRING(installProviderJobStr); - - const SmartPtrCDynamicByteArray payload = - CCafMessagePayload::createBufferFromStr(installProviderJobStr); - const SmartPtrCInstallProviderJobDoc installProviderJob = - CCafMessagePayloadParser::getInstallProviderJob(payload); - - if (isCurrentOS(installProviderJob->getPackageOSType())) { - CProviderInstaller::installProvider(installProviderJob, request.getAttachments(), outputDir); - } - } else if (operationName.compare("uninstallProviderJob") == 0) { - const std::string uninstallProviderJobStr = - ParameterUtils::findRequiredInstanceParameterAsString("uninstallProviderJob", - parameterCollection); - - const SmartPtrCDynamicByteArray payload = - CCafMessagePayload::createBufferFromStr(uninstallProviderJobStr); - const SmartPtrCUninstallProviderJobDoc uninstallProviderJob = - CCafMessagePayloadParser::getUninstallProviderJob(payload); - - if (isCurrentOS(uninstallProviderJob->getPackageOSType())) { - CProviderInstaller::uninstallProvider(uninstallProviderJob, outputDir); - } - } else { - CAF_CM_EXCEPTIONEX_VA1(InvalidArgumentException, E_INVALIDARG, - "Invalid operation name (must be \'installProviderJob\' or \'uninstallProviderJob\') - %s", operationName.c_str()) - } -} - -SmartPtrCDataClassInstanceDoc CInstallProvider::createDataClassInstance( - const SmartPtrCInstallProviderSpecDoc& installProviderSpec) const { - CAF_CM_FUNCNAME_VALIDATE("createDataClassInstance"); - CAF_CM_VALIDATE_SMARTPTR(installProviderSpec); - - const std::deque minPackageElemCollection = - installProviderSpec->getPackageCollection(); - - std::deque subInstances; - for (TConstIterator > minPackageElemIter( - minPackageElemCollection); minPackageElemIter; minPackageElemIter++) { - const SmartPtrCMinPackageElemDoc minPackageElem = *minPackageElemIter; - - const std::string packageNamespace = minPackageElem->getPackageNamespace(); - const std::string packageName = minPackageElem->getPackageName(); - const std::string packageVersion = minPackageElem->getPackageVersion(); - - std::deque siProperties; - siProperties.push_back(CProviderDocHelper::createDataClassProperty("packageNamespace", packageNamespace)); - siProperties.push_back(CProviderDocHelper::createDataClassProperty("packageName", packageName)); - siProperties.push_back(CProviderDocHelper::createDataClassProperty("packageVersion", packageVersion)); - subInstances.push_back(CProviderDocHelper::createDataClassSubInstance( - "fullPackageElem", - siProperties)); - } - - const std::string clientId = - BasePlatform::UuidToString(installProviderSpec->getClientId()); - const std::string providerNamespace = installProviderSpec->getProviderNamespace(); - const std::string providerName = installProviderSpec->getProviderName(); - const std::string providerVersion = installProviderSpec->getProviderVersion(); - - std::deque dataClassProperties; - dataClassProperties.push_back(CProviderDocHelper::createDataClassProperty("clientId", clientId)); - dataClassProperties.push_back(CProviderDocHelper::createDataClassProperty("providerNamespace", providerNamespace)); - dataClassProperties.push_back(CProviderDocHelper::createDataClassProperty("providerName", providerName)); - dataClassProperties.push_back(CProviderDocHelper::createDataClassProperty("providerVersion", providerVersion)); - return CProviderDocHelper::createDataClassInstance( - "caf", - "CafProviderInventory", - "1.0.0", - dataClassProperties, - subInstances); -} - -bool CInstallProvider::isCurrentOS(const PACKAGE_OS_TYPE& packageOSType) const { - CAF_CM_FUNCNAME_VALIDATE("isCurrentOS"); - -#ifdef WIN32 - const PACKAGE_OS_TYPE packageOSTypeLocal = PACKAGE_OS_WIN; -#else - const PACKAGE_OS_TYPE packageOSTypeLocal = PACKAGE_OS_NIX; -#endif - - bool rc = false; - if ((packageOSType == packageOSTypeLocal) || (packageOSType == PACKAGE_OS_ALL)) { - rc = true; - } else { - CAF_CM_LOG_WARN_VA0("Wrong OS... Skipping package"); - } - - return rc; -} diff --git a/open-vm-tools/common-agent/Cpp/InternalProviders/Install_Provider/src/CInstallProvider.h b/open-vm-tools/common-agent/Cpp/InternalProviders/Install_Provider/src/CInstallProvider.h deleted file mode 100644 index c987f6145..000000000 --- a/open-vm-tools/common-agent/Cpp/InternalProviders/Install_Provider/src/CInstallProvider.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Author: bwilliams - * Created: May 3, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CInstallProvider_h_ -#define CInstallProvider_h_ - - -#include "IInvokedProvider.h" -#include "Doc/CafInstallRequestDoc/CafInstallRequestDocTypes.h" - -#include "Doc/CafInstallRequestDoc/CInstallProviderSpecDoc.h" -#include "Doc/ProviderResultsDoc/CSchemaDoc.h" -#include "Doc/SchemaTypesDoc/CDataClassInstanceDoc.h" - -namespace Caf { - -/// Sends responses/errors back to the client. -class CInstallProvider : public IInvokedProvider { -public: - CInstallProvider(); - virtual ~CInstallProvider(); - -public: // IInvokedProvider - const std::string getProviderNamespace() const { - return "caf"; - } - - const std::string getProviderName() const { - return "InstallProvider"; - } - - const std::string getProviderVersion() const { - return "1.0.0"; - } - - const SmartPtrCSchemaDoc getSchema() const; - - void collect(const IProviderRequest& request, IProviderResponse& response) const; - - void invoke(const IProviderRequest& request, IProviderResponse& response) const; - -private: - SmartPtrCDataClassInstanceDoc createDataClassInstance( - const SmartPtrCInstallProviderSpecDoc& installProviderSpec) const; - - bool isCurrentOS(const PACKAGE_OS_TYPE& packageOSType) const; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CInstallProvider); -}; - -} - -#endif // #ifndef CInstallProvider_h_ diff --git a/open-vm-tools/common-agent/Cpp/InternalProviders/Install_Provider/src/CInstallUtils.cpp b/open-vm-tools/common-agent/Cpp/InternalProviders/Install_Provider/src/CInstallUtils.cpp deleted file mode 100644 index 2cd210327..000000000 --- a/open-vm-tools/common-agent/Cpp/InternalProviders/Install_Provider/src/CInstallUtils.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Author: bwilliams - * Created: May 3, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "Exception/CCafException.h" -#include "CInstallUtils.h" - -using namespace Caf; - -CInstallUtils::MATCH_STATUS CInstallUtils::compareVersions( - const std::string& packageVersion1, - const std::string& packageVersion2) { - CAF_CM_STATIC_FUNC_LOG("CInstallUtils", "compareVersions"); - - MATCH_STATUS matchStatus = MATCH_NOTEQUAL; - - CAF_CM_ENTER - { - CAF_CM_VALIDATE_STRING(packageVersion1); - CAF_CM_VALIDATE_STRING(packageVersion2); - - const Cdeqstr packageVersionTokens1 = CStringUtils::split(packageVersion1, '.'); - if (packageVersionTokens1.size() != 3) { - CAF_CM_EXCEPTIONEX_VA1(InvalidArgumentException, E_INVALIDARG, - "Package version 1 has a bad format - %s", - packageVersion1.c_str()); - } - - const Cdeqstr packageVersionTokens2 = CStringUtils::split(packageVersion2, '.'); - if (packageVersionTokens2.size() != 3) { - CAF_CM_EXCEPTIONEX_VA1(InvalidArgumentException, E_INVALIDARG, - "Package version 2 has a bad format - %s", - packageVersion2.c_str()); - } - - if ((packageVersionTokens1[0].compare(packageVersionTokens2[0]) == 0) - && (packageVersionTokens1[1].compare(packageVersionTokens2[1]) == 0)) { - const uint32 lastVersionPos1 = CStringConv::fromString( - packageVersionTokens1[2]); - const uint32 lastVersionPos2 = CStringConv::fromString( - packageVersionTokens2[2]); - if (lastVersionPos1 == lastVersionPos2) { - matchStatus = MATCH_VERSION_EQUAL; - } else if (lastVersionPos1 < lastVersionPos2) { - matchStatus = MATCH_VERSION_LESS; - } else { - matchStatus = MATCH_VERSION_GREATER; - } - } - } - CAF_CM_EXIT; - - return matchStatus; -} diff --git a/open-vm-tools/common-agent/Cpp/InternalProviders/Install_Provider/src/CInstallUtils.h b/open-vm-tools/common-agent/Cpp/InternalProviders/Install_Provider/src/CInstallUtils.h deleted file mode 100644 index 038988dad..000000000 --- a/open-vm-tools/common-agent/Cpp/InternalProviders/Install_Provider/src/CInstallUtils.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Author: bwilliams - * Created: May 3, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CInstallUtils_h_ -#define CInstallUtils_h_ - -namespace Caf { - -class CInstallUtils { -public: - typedef enum { - MATCH_NOTEQUAL, - MATCH_VERSION_EQUAL, - MATCH_VERSION_LESS, - MATCH_VERSION_GREATER - } MATCH_STATUS; - - static MATCH_STATUS compareVersions( - const std::string& packageVersion1, - const std::string& packageVersion2); - -private: - CAF_CM_DECLARE_NOCREATE(CInstallUtils); -}; - -} - -#endif // #ifndef CInstallUtils_h_ diff --git a/open-vm-tools/common-agent/Cpp/InternalProviders/Install_Provider/src/CPackageExecutor.cpp b/open-vm-tools/common-agent/Cpp/InternalProviders/Install_Provider/src/CPackageExecutor.cpp deleted file mode 100644 index 777e973cd..000000000 --- a/open-vm-tools/common-agent/Cpp/InternalProviders/Install_Provider/src/CPackageExecutor.cpp +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Author: bwilliams - * Created: May 3, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Doc/CafCoreTypesDoc/CAttachmentCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CAttachmentDoc.h" -#include "Exception/CCafException.h" -#include "CPackageExecutor.h" - -using namespace Caf; - -void CPackageExecutor::executePackage( - const SmartPtrCAttachmentDoc& startupAttachment, - const std::string& startupArgument, - const SmartPtrCAttachmentDoc& packageAttachment, - const std::string& packageArguments, - const SmartPtrCAttachmentCollectionDoc& supportingAttachmentCollection, - const std::string& outputDir) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CPackageExecutor", "executePackage"); - - CAF_CM_ENTER - { - CAF_CM_VALIDATE_SMARTPTR(startupAttachment); - CAF_CM_VALIDATE_STRING(startupArgument); - CAF_CM_VALIDATE_SMARTPTR(packageAttachment); - // packageArguments is optional - // supportingAttachmentCollection is optional - CAF_CM_VALIDATE_STRING(outputDir); - - const std::string installInvoker = createInstallInvoker(startupAttachment, - startupArgument, packageAttachment, packageArguments, - supportingAttachmentCollection, outputDir); - - runInstallInvoker(installInvoker, outputDir); - } - CAF_CM_EXIT; -} - -std::string CPackageExecutor::createInstallInvoker( - const SmartPtrCAttachmentDoc& startupAttachment, - const std::string& startupArgument, - const SmartPtrCAttachmentDoc& packageAttachment, - const std::string& packageArguments, - const SmartPtrCAttachmentCollectionDoc& supportingAttachmentCollection, - const std::string& outputDir) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CPackageExecutor", "createInstallInvoker"); - - std::string installInvoker; - - CAF_CM_ENTER - { - CAF_CM_VALIDATE_SMARTPTR(startupAttachment); - CAF_CM_VALIDATE_STRING(startupArgument); - CAF_CM_VALIDATE_SMARTPTR(packageAttachment); - // packageArguments is optional - // supportingAttachmentCollection is optional - CAF_CM_VALIDATE_STRING(outputDir); - - const std::string inputDir = CPathBuilder::getRootConfigDir(_sConfigInputDir); -#ifdef WIN32 - const std::string installProviderHeaderPath = - FileSystemUtils::buildPath(inputDir, "installProviderHeader.bat"); -#else - const std::string installProviderHeaderPath = - FileSystemUtils::buildPath(inputDir, "installProviderHeader.sh"); -#endif - const std::string installProviderHeader = FileSystemUtils::loadTextFile( - installProviderHeaderPath); - - std::string attachmentUris = ""; - if (!supportingAttachmentCollection.IsNull()) { - const std::deque attachmentCollectionInner = - supportingAttachmentCollection->getAttachment(); - for (TConstIterator > attachmentIter( - attachmentCollectionInner); attachmentIter; attachmentIter++) { - const SmartPtrCAttachmentDoc attachment = *attachmentIter; - attachmentUris += attachment->getUri() + ";"; - } - } - - const std::string startupAttachmentUri = startupAttachment->getUri(); - std::string startupAttachmentFile = UriUtils::parseRequiredFilePath( - startupAttachmentUri); - - const std::string packageAttachmentUri = packageAttachment->getUri(); - std::string packageAttachmentFile = UriUtils::parseRequiredFilePath( - packageAttachmentUri); - - const std::string packageArgumentsTmp = packageArguments.empty() ? "" - : packageArguments; - -#ifdef WIN32 - const std::string newLine = "\r\n"; - const std::string fileContents = - installProviderHeader + newLine - + std::string("set CAF_PACKAGE_FILE=") + packageAttachmentFile + newLine - + std::string("set CAF_PACKAGE_ARGS=") + packageArgumentsTmp + newLine - + std::string("set CAF_ATTACHMENT_URIS=") + attachmentUris + newLine - + startupAttachmentFile + " " + startupArgument + newLine; - installInvoker = FileSystemUtils::buildPath(outputDir, "CafInstallInvoker.bat"); -#else - const std::string newLine = "\n"; - const std::string fileContents = - installProviderHeader + newLine - + std::string("export CAF_PACKAGE_FILE=") + packageAttachmentFile + newLine - + std::string("export CAF_PACKAGE_ARGS=") + packageArgumentsTmp + newLine - + std::string("export CAF_ATTACHMENT_URIS=") + attachmentUris + newLine - + startupAttachmentFile + " " + startupArgument + newLine; - installInvoker = FileSystemUtils::buildPath(outputDir, "CafInstallInvoker"); -#endif - - const uint32 exeByOwner = 0100; - const uint32 writeByOwner = 0200; - const uint32 readByOwner = 0400; - const uint32 fileMode = exeByOwner | writeByOwner | readByOwner; - - FileSystemUtils::saveTextFile(installInvoker, fileContents); - FileSystemUtils::chmod(installInvoker, fileMode); - FileSystemUtils::chmod(startupAttachmentFile, fileMode); - FileSystemUtils::chmod(packageAttachmentFile, fileMode); - } - CAF_CM_EXIT; - - return installInvoker; -} - -void CPackageExecutor::runInstallInvoker( - const std::string& installInvoker, - const std::string& outputDir) { - CAF_CM_STATIC_FUNC_LOG("CPackageExecutor", "runInstallInvoker"); - - CAF_CM_ENTER - { - CAF_CM_VALIDATE_STRING(installInvoker); - CAF_CM_VALIDATE_STRING(outputDir); - - if (!FileSystemUtils::doesFileExist(installInvoker)) { - CAF_CM_EXCEPTIONEX_VA1(FileNotFoundException, ERROR_FILE_NOT_FOUND, - "Install invoker not found - %s", installInvoker.c_str()); - } - - const std::string stdoutPath = FileSystemUtils::buildPath(outputDir, - _sStdoutFilename); - const std::string stderrPath = FileSystemUtils::buildPath(outputDir, - _sStderrFilename); - - Cdeqstr argv; - argv.push_back(installInvoker); - - ProcessUtils::runSyncToFiles(argv, stdoutPath, stderrPath); - } - CAF_CM_EXIT; -} diff --git a/open-vm-tools/common-agent/Cpp/InternalProviders/Install_Provider/src/CPackageExecutor.h b/open-vm-tools/common-agent/Cpp/InternalProviders/Install_Provider/src/CPackageExecutor.h deleted file mode 100644 index a355ffa11..000000000 --- a/open-vm-tools/common-agent/Cpp/InternalProviders/Install_Provider/src/CPackageExecutor.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Author: bwilliams - * Created: May 3, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CPackageExecutor_h_ -#define CPackageExecutor_h_ - - -#include "Doc/CafCoreTypesDoc/CAttachmentCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CAttachmentDoc.h" - -namespace Caf { - -/// Utilities used in the install process. -class CPackageExecutor { -public: - static void executePackage( - const SmartPtrCAttachmentDoc& startupAttachment, - const std::string& startupArgument, - const SmartPtrCAttachmentDoc& packageAttachment, - const std::string& packageArguments, - const SmartPtrCAttachmentCollectionDoc& supportingAttachmentCollection, - const std::string& outputDir); - -private: - static std::string createInstallInvoker( - const SmartPtrCAttachmentDoc& startupAttachment, - const std::string& startupArgument, - const SmartPtrCAttachmentDoc& packageAttachment, - const std::string& packageArguments, - const SmartPtrCAttachmentCollectionDoc& supportingAttachmentCollection, - const std::string& outputDir); - - static void runInstallInvoker( - const std::string& installInvoker, - const std::string& outputDir); - -private: - CAF_CM_DECLARE_NOCREATE(CPackageExecutor); -}; - -} - -#endif // #ifndef CPackageExecutor_h_ diff --git a/open-vm-tools/common-agent/Cpp/InternalProviders/Install_Provider/src/CPackageInstaller.cpp b/open-vm-tools/common-agent/Cpp/InternalProviders/Install_Provider/src/CPackageInstaller.cpp deleted file mode 100644 index b4868e379..000000000 --- a/open-vm-tools/common-agent/Cpp/InternalProviders/Install_Provider/src/CPackageInstaller.cpp +++ /dev/null @@ -1,656 +0,0 @@ -/* - * Author: bwilliams - * Created: May 3, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Doc/DocXml/CafInstallRequestXml/CafInstallRequestXmlRoots.h" - -#include "Doc/CafCoreTypesDoc/CAttachmentCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CAttachmentDoc.h" -#include "Doc/CafCoreTypesDoc/CAttachmentNameCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CInlineAttachmentDoc.h" -#include "Doc/CafInstallRequestDoc/CFullPackageElemDoc.h" -#include "Doc/CafInstallRequestDoc/CInstallPackageSpecDoc.h" -#include "Doc/CafInstallRequestDoc/CInstallProviderSpecDoc.h" -#include "Doc/CafInstallRequestDoc/CMinPackageElemDoc.h" -#include "Doc/CafInstallRequestDoc/CPackageDefnDoc.h" -#include "CPackageInstaller.h" - -using namespace Caf; - -void CPackageInstaller::installPackages( - const std::deque& fullPackageElemCollection, - const SmartPtrCAttachmentCollectionDoc& attachmentCollection, - const std::string& outputDir) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CPackageInstaller", "installPackages"); - - CAF_CM_ENTER - { - CAF_CM_VALIDATE_STL(fullPackageElemCollection); - CAF_CM_VALIDATE_SMARTPTR(attachmentCollection); - CAF_CM_VALIDATE_STRING(outputDir); - - const std::map orderedFullPackageElemCollection = - orderFullPackageElems(fullPackageElemCollection); - - for (TConstMapIterator > fullPackageElemIter( - orderedFullPackageElemCollection); fullPackageElemIter; fullPackageElemIter++) { - const SmartPtrCFullPackageElemDoc fullPackageElem = *fullPackageElemIter; - - const SmartPtrCPackageDefnDoc installPackageDefn = - fullPackageElem->getInstallPackage(); - - SmartPtrCInstallPackageSpecDoc installPackageSpec; - installPackageSpec.CreateInstance(); - installPackageSpec->initialize(fullPackageElem->getPackageNamespace(), - fullPackageElem->getPackageName(), fullPackageElem->getPackageVersion(), - installPackageDefn->getStartupAttachmentName(), - installPackageDefn->getPackageAttachmentName(), - installPackageDefn->getSupportingAttachmentNameCollection(), attachmentCollection, - installPackageDefn->getArguments()); - - const SmartPtrCPackageDefnDoc uninstallPackageDefn = - fullPackageElem->getUninstallPackage(); - - SmartPtrCInstallPackageSpecDoc uninstallPackageSpec; - uninstallPackageSpec.CreateInstance(); - uninstallPackageSpec->initialize(fullPackageElem->getPackageNamespace(), - fullPackageElem->getPackageName(), fullPackageElem->getPackageVersion(), - uninstallPackageDefn->getStartupAttachmentName(), - uninstallPackageDefn->getPackageAttachmentName(), - uninstallPackageDefn->getSupportingAttachmentNameCollection(), - attachmentCollection, uninstallPackageDefn->getArguments()); - - installPackage(installPackageSpec, uninstallPackageSpec, outputDir); - } - } - CAF_CM_EXIT; -} - -void CPackageInstaller::uninstallPackages( - const std::deque& minPackageElemCollection, - const std::deque& installProviderSpecCollection, - const std::string& outputDir) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CPackageInstaller", "uninstallPackages"); - - CAF_CM_ENTER - { - CAF_CM_VALIDATE_STL(minPackageElemCollection); - // installProviderSpecCollection is optional - CAF_CM_VALIDATE_STRING(outputDir); - - const std::map - orderedProviderPackageElemCollection = orderMinPackageElems( - minPackageElemCollection); - - for (TConstMapIterator > - minPackageElemIter(orderedProviderPackageElemCollection); minPackageElemIter; minPackageElemIter++) { - const SmartPtrCMinPackageElemDoc minPackageElem = *minPackageElemIter; - - const std::string installPackageDir = CPathBuilder::calcInstallPackageDir( - minPackageElem->getPackageNamespace(), minPackageElem->getPackageName(), - minPackageElem->getPackageVersion()); - - const std::string installPackageSpecPath = FileSystemUtils::buildPath( - installPackageDir, _sInstallPackageSpecFilename); - - const SmartPtrCInstallPackageSpecDoc installPackageSpec = - XmlRoots::parseInstallPackageSpecFromFile(installPackageSpecPath); - - const uint32 packageRefCnt = countPackageReferences(installPackageSpec, - installProviderSpecCollection); - if (packageRefCnt == 1) { - try { - CPackageInstaller::executePackage(installPackageSpec, "-uninstall", outputDir); - } catch (ProcessFailedException* ex) { - CAF_CM_LOG_DEBUG_VA1("Removing package directory - %s", installPackageDir.c_str()); - FileSystemUtils::recursiveRemoveDirectory(installPackageDir); - ex->throwSelf(); - } - - CAF_CM_LOG_DEBUG_VA1("Removing package directory - %s", installPackageDir.c_str()); - FileSystemUtils::recursiveRemoveDirectory(installPackageDir); - } else { - CAF_CM_LOG_WARN_VA4("Package referenced from more than one provider... not uninstalling - %s::%s::%s = %d", - minPackageElem->getPackageNamespace().c_str(), minPackageElem->getPackageName().c_str(), - minPackageElem->getPackageVersion().c_str(), packageRefCnt); - } - } - } - CAF_CM_EXIT; -} - -void CPackageInstaller::installPackage( - const SmartPtrCInstallPackageSpecDoc& installPackageSpec, - const SmartPtrCInstallPackageSpecDoc& uninstallPackageSpec, - const std::string& outputDir) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CPackageInstaller", "installPackage"); - - CAF_CM_ENTER - { - CAF_CM_VALIDATE_SMARTPTR(installPackageSpec); - CAF_CM_VALIDATE_SMARTPTR(uninstallPackageSpec); - CAF_CM_VALIDATE_STRING(outputDir); - - const SmartPtrCInstallPackageMatch installPackageMatch = matchInstallPackageSpec( - installPackageSpec); - - switch (installPackageMatch->_matchStatus) { - case CInstallUtils::MATCH_NOTEQUAL: { - const SmartPtrCInstallPackageSpecDoc resolvedInstallPackageSpec = - resolveAndCopyAttachments(uninstallPackageSpec); - executePackage(installPackageSpec, "-install", outputDir); - saveInstallPackageSpec(resolvedInstallPackageSpec); - } - break; - case CInstallUtils::MATCH_VERSION_EQUAL: { - logWarn("Package already installed", installPackageSpec, - installPackageMatch->_matchedInstallPackageSpec); - } - break; - case CInstallUtils::MATCH_VERSION_LESS: { - logWarn("More recent package already installed", installPackageSpec, - installPackageMatch->_matchedInstallPackageSpec); - } - break; - case CInstallUtils::MATCH_VERSION_GREATER: { - logWarn("Upgrading installed version", installPackageSpec, - installPackageMatch->_matchedInstallPackageSpec); - - try { - executePackage(installPackageMatch->_matchedInstallPackageSpec, - "-upgrade_uninstall", outputDir); - } catch (ProcessFailedException* ex) { - cleanupPackage(installPackageMatch); - ex->throwSelf(); - } - - cleanupPackage(installPackageMatch); - - const SmartPtrCInstallPackageSpecDoc resolvedInstallPackageSpec = - resolveAndCopyAttachments(uninstallPackageSpec); - executePackage(installPackageSpec, "-upgrade_install", outputDir); - saveInstallPackageSpec(resolvedInstallPackageSpec); - } - break; - } - } - CAF_CM_EXIT; -} - -void CPackageInstaller::executePackage( - const SmartPtrCInstallPackageSpecDoc& installPackageSpec, - const std::string& startupArgument, - const std::string& outputDir) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CPackageInstaller", "executePackage"); - - CAF_CM_ENTER - { - CAF_CM_VALIDATE_SMARTPTR(installPackageSpec); - CAF_CM_VALIDATE_STRING(outputDir); - - const SmartPtrCAttachmentCollectionDoc attachmentCollection = - installPackageSpec->getAttachmentCollection(); - - const SmartPtrCAttachmentDoc startupAttachment = AttachmentUtils::findRequiredAttachment( - installPackageSpec->getStartupAttachmentName(), attachmentCollection); - const SmartPtrCAttachmentDoc packageAttachment = AttachmentUtils::findRequiredAttachment( - installPackageSpec->getPackageAttachmentName(), attachmentCollection); - - const SmartPtrCAttachmentNameCollectionDoc attachmentNameCollection = - installPackageSpec->getSupportingAttachmentNameCollection(); - const SmartPtrCAttachmentCollectionDoc supportingAttachmentCollection = - resolveAttachments(attachmentNameCollection, attachmentCollection); - - const std::string packageDir = CPathBuilder::calcDir( - installPackageSpec->getPackageNamespace(), installPackageSpec->getPackageName(), - installPackageSpec->getPackageVersion(), outputDir); - - const std::string packageArguments = installPackageSpec->getArguments(); - - if (!FileSystemUtils::doesDirectoryExist(packageDir)) { - FileSystemUtils::createDirectory(packageDir); - } - - CPackageExecutor::executePackage(startupAttachment, startupArgument, - packageAttachment, packageArguments, supportingAttachmentCollection, packageDir); - } - CAF_CM_EXIT; -} - -SmartPtrCInstallPackageSpecDoc CPackageInstaller::resolveAndCopyAttachments( - const SmartPtrCInstallPackageSpecDoc& installPackageSpec) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CPackageInstaller", "resolveAndCopyAttachments"); - - SmartPtrCInstallPackageSpecDoc installPackageSpecRc; - - CAF_CM_ENTER - { - CAF_CM_VALIDATE_SMARTPTR(installPackageSpec); - - const std::string installPackageDir = CPathBuilder::calcInstallPackageDir( - installPackageSpec->getPackageNamespace(), installPackageSpec->getPackageName(), - installPackageSpec->getPackageVersion()); - - const SmartPtrCAttachmentCollectionDoc attachmentCollection = - installPackageSpec->getAttachmentCollection(); - - const SmartPtrCAttachmentNameCollectionDoc attachmentNameCollection = - installPackageSpec->getSupportingAttachmentNameCollection(); - - const SmartPtrCAttachmentCollectionDoc resolvedAttachmentCollection = resolveAttachments( - attachmentNameCollection, attachmentCollection); - - const SmartPtrCAttachmentDoc startupAttachment = AttachmentUtils::findRequiredAttachment( - installPackageSpec->getStartupAttachmentName(), attachmentCollection); - const SmartPtrCAttachmentDoc packageAttachment = AttachmentUtils::findRequiredAttachment( - installPackageSpec->getPackageAttachmentName(), attachmentCollection); - - const SmartPtrCAttachmentCollectionDoc copiedAttachmentCollection = copyAttachments( - startupAttachment, packageAttachment, resolvedAttachmentCollection, installPackageDir); - - installPackageSpecRc.CreateInstance(); - installPackageSpecRc->initialize(installPackageSpec->getPackageNamespace(), - installPackageSpec->getPackageName(), installPackageSpec->getPackageVersion(), - installPackageSpec->getStartupAttachmentName(), - installPackageSpec->getPackageAttachmentName(), attachmentNameCollection, - copiedAttachmentCollection, installPackageSpec->getArguments()); - } - CAF_CM_EXIT; - - return installPackageSpecRc; -} - -void CPackageInstaller::saveInstallPackageSpec( - const SmartPtrCInstallPackageSpecDoc& installPackageSpec) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CPackageInstaller", "saveInstallPackageSpec"); - - CAF_CM_ENTER - { - CAF_CM_VALIDATE_SMARTPTR(installPackageSpec); - - const std::string installPackageDir = CPathBuilder::calcInstallPackageDir( - installPackageSpec->getPackageNamespace(), installPackageSpec->getPackageName(), - installPackageSpec->getPackageVersion()); - - const std::string installPackageSpecPath = FileSystemUtils::buildPath(installPackageDir, - _sInstallPackageSpecFilename); - - XmlRoots::saveInstallPackageSpecToFile(installPackageSpec, installPackageSpecPath); - } - CAF_CM_EXIT; -} - -std::map CPackageInstaller::orderFullPackageElems( - const std::deque& fullPackageElemCollection) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CPackageInstaller", "orderFullPackageElems"); - - std::map orderedFullPackageElemCollection; - - CAF_CM_ENTER - { - CAF_CM_VALIDATE_STL(fullPackageElemCollection); - - for (TConstIterator > fullPackageElemIter( - fullPackageElemCollection); fullPackageElemIter; fullPackageElemIter++) { - const SmartPtrCFullPackageElemDoc fullPackageElem = *fullPackageElemIter; - orderedFullPackageElemCollection.insert( - std::make_pair(fullPackageElem->getIndex(), fullPackageElem)); - } - } - CAF_CM_EXIT; - - return orderedFullPackageElemCollection; -} - -std::map CPackageInstaller::orderMinPackageElems( - const std::deque& minPackageElemCollection) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CPackageInstaller", "orderProviderPackageElems"); - - std::map orderedMinPackageElemCollection; - - CAF_CM_ENTER - { - CAF_CM_VALIDATE_STL(minPackageElemCollection); - - for (TConstIterator > minPackageElemIter( - minPackageElemCollection); minPackageElemIter; minPackageElemIter++) { - const SmartPtrCMinPackageElemDoc minPackageElem = *minPackageElemIter; - orderedMinPackageElemCollection.insert( - std::make_pair(minPackageElem->getIndex(), minPackageElem)); - } - } - CAF_CM_EXIT; - - return orderedMinPackageElemCollection; -} - -SmartPtrCAttachmentCollectionDoc CPackageInstaller::resolveAttachments( - const SmartPtrCAttachmentNameCollectionDoc& attachmentNameCollection, - const SmartPtrCAttachmentCollectionDoc& attachmentCollection) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CPackageInstaller", "resolveAttachments"); - - SmartPtrCAttachmentCollectionDoc rc; - - CAF_CM_ENTER - { - // attachmentNameCollection is optional - CAF_CM_VALIDATE_SMARTPTR(attachmentCollection); - - if (!attachmentNameCollection.IsNull()) { - const std::deque attachmentNameCollectionInner = - attachmentNameCollection->getName(); - - std::deque attachmentCollectionInner; - for (TConstIterator > attachmentNameIter( - attachmentNameCollectionInner); attachmentNameIter; attachmentNameIter++) { - const std::string attachmentName = *attachmentNameIter; - - const SmartPtrCAttachmentDoc attachment = AttachmentUtils::findRequiredAttachment( - attachmentName, attachmentCollection); - attachmentCollectionInner.push_back(attachment); - } - - if (!attachmentCollectionInner.empty()) { - rc.CreateInstance(); - rc->initialize(attachmentCollectionInner, - std::deque()); - } - } - } - CAF_CM_EXIT; - - return rc; -} - -SmartPtrCAttachmentCollectionDoc CPackageInstaller::copyAttachments( - const SmartPtrCAttachmentDoc& startupAttachment, - const SmartPtrCAttachmentDoc& packageAttachment, - const SmartPtrCAttachmentCollectionDoc& supportingAttachmentCollection, - const std::string& outputDir) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CPackageInstaller", "copyAttachments"); - - SmartPtrCAttachmentCollectionDoc attachmentCollectionRc; - - CAF_CM_ENTER - { - CAF_CM_VALIDATE_SMARTPTR(startupAttachment); - CAF_CM_VALIDATE_SMARTPTR(packageAttachment); - // supportingAttachmentCollection is optional - CAF_CM_VALIDATE_STRING(outputDir); - - std::deque attachmentCollectionInner; - - attachmentCollectionInner.push_back(startupAttachment); - attachmentCollectionInner.push_back(packageAttachment); - - if (!supportingAttachmentCollection.IsNull()) { - for (TConstIterator > supportingAttachmentIter( - supportingAttachmentCollection->getAttachment()); supportingAttachmentIter; supportingAttachmentIter++) { - attachmentCollectionInner.push_back(*supportingAttachmentIter); - } - } - - std::deque attachmentCollectionInnerRc; - for (TConstIterator > attachmentIter( - attachmentCollectionInner); attachmentIter; attachmentIter++) { - const SmartPtrCAttachmentDoc attachment = *attachmentIter; - - const std::string attachmentUri = attachment->getUri(); - const std::string attachmentFilePath = UriUtils::parseRequiredFilePath(attachmentUri); - - UriUtils::SUriRecord uriRecord; - UriUtils::parseUriString(attachmentUri, uriRecord); - - std::string dstAttachmentDir = outputDir; - std::string relPath = FileSystemUtils::getBasename(attachmentFilePath); - const std::map::const_iterator iterParam = - uriRecord.parameters.find("relPath"); - if (iterParam != uriRecord.parameters.end()) { - relPath = iterParam->second; - const std::string tmpPath = FileSystemUtils::buildPath(outputDir, relPath); - dstAttachmentDir = FileSystemUtils::getDirname(tmpPath); - } else { - CAF_CM_LOG_DEBUG_VA1("Attachment URI does not contain relPath - %s", attachmentUri.c_str()); - } - - if (!FileSystemUtils::doesDirectoryExist(dstAttachmentDir)) { - FileSystemUtils::createDirectory(dstAttachmentDir); - } - - const std::string dstAttachmentFilePath = FileSystemUtils::buildPath(outputDir, - relPath); - - if (FileSystemUtils::doesFileExist(dstAttachmentFilePath)) { - CAF_CM_LOG_WARN_VA2("Destination file already exists... not copying \"%s\" to \"%s\"", - attachmentFilePath.c_str(), dstAttachmentFilePath.c_str()); - } else { - CAF_CM_LOG_DEBUG_VA2("Copying attachment from \"%s\" to \"%s\"", - attachmentFilePath.c_str(), dstAttachmentFilePath.c_str()); - FileSystemUtils::copyFile(attachmentFilePath, dstAttachmentFilePath); - } - - std::string dstAttachmentUri = "file:///" + dstAttachmentFilePath; - if (!relPath.empty()) { - dstAttachmentUri += "?relPath=" + relPath; - } - - SmartPtrCAttachmentDoc dstAttachment; - dstAttachment.CreateInstance(); - dstAttachment->initialize(attachment->getName(), attachment->getType(), - dstAttachmentUri, false, attachment->getCmsPolicy()); - - attachmentCollectionInnerRc.push_back(dstAttachment); - } - - attachmentCollectionRc.CreateInstance(); - attachmentCollectionRc->initialize(attachmentCollectionInnerRc, - std::deque()); - } - CAF_CM_EXIT; - - return attachmentCollectionRc; -} - -CPackageInstaller::SmartPtrCInstallPackageMatch CPackageInstaller::matchInstallPackageSpec( - const SmartPtrCInstallPackageSpecDoc& installPackageSpec) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CPackageInstaller", "matchInstallPackageSpec"); - - SmartPtrCInstallPackageMatch installPackageMatch; - - CAF_CM_ENTER - { - CAF_CM_VALIDATE_SMARTPTR(installPackageSpec); - - installPackageMatch.CreateInstance(); - installPackageMatch->_matchStatus = CInstallUtils::MATCH_NOTEQUAL; - - const SmartPtrCInstallPackageSpecCollection installPackageSpecCollection = - readInstallPackageSpecs(); - - if (!installPackageSpecCollection.IsNull()) { - const std::string packageNamespace = installPackageSpec->getPackageNamespace(); - const std::string packageName = installPackageSpec->getPackageName(); - const std::string packageVersion = installPackageSpec->getPackageVersion(); - - for (TConstIterator > - installPackageSpecIter(*installPackageSpecCollection); installPackageSpecIter; installPackageSpecIter++) { - const SmartPtrCInstallPackageSpecDoc installPackageSpecCur = - *installPackageSpecIter; - - const std::string packageNamespaceCur = - installPackageSpecCur->getPackageNamespace(); - const std::string packageNameCur = installPackageSpecCur->getPackageName(); - - if ((packageNamespace.compare(packageNamespaceCur) == 0) && (packageName.compare( - packageNameCur) == 0)) { - const std::string packageVersionCur = - installPackageSpecCur->getPackageVersion(); - installPackageMatch->_matchStatus = CInstallUtils::compareVersions( - packageVersion, packageVersionCur); - if (installPackageMatch->_matchStatus != CInstallUtils::MATCH_NOTEQUAL) { - installPackageMatch->_matchedInstallPackageSpec = installPackageSpecCur; - break; - } - } else { - logDebug("Package did not match", installPackageSpec, installPackageSpecCur); - } - } - } - } - CAF_CM_EXIT; - - return installPackageMatch; -} - -CPackageInstaller::SmartPtrCInstallPackageSpecCollection CPackageInstaller::readInstallPackageSpecs() { - CAF_CM_STATIC_FUNC_LOG_ONLY("CPackageInstaller", "readInstallPackageSpecs"); - - SmartPtrCInstallPackageSpecCollection installPackageSpecCollection; - - CAF_CM_ENTER - { - const std::string installPackageDir = CPathBuilder::calcInstallPackageDir(); - - const std::deque installPackageSpecFiles = - FileSystemUtils::findOptionalFiles(installPackageDir, _sInstallPackageSpecFilename); - - if (installPackageSpecFiles.empty()) { - CAF_CM_LOG_WARN_VA2("No package install specs found - dir: %s, filename: %s", - installPackageDir.c_str(), _sInstallPackageSpecFilename); - } else { - installPackageSpecCollection.CreateInstance(); - - for (TConstIterator > installPackageSpecFileIter( - installPackageSpecFiles); installPackageSpecFileIter; installPackageSpecFileIter++) { - const std::string installPackageSpecFilePath = *installPackageSpecFileIter; - - CAF_CM_LOG_DEBUG_VA1("Found package install spec - %s", - installPackageSpecFilePath.c_str()); - - const SmartPtrCInstallPackageSpecDoc installPackageSpec = - XmlRoots::parseInstallPackageSpecFromFile(installPackageSpecFilePath); - - installPackageSpecCollection->push_back(installPackageSpec); - } - } - } - CAF_CM_EXIT; - - return installPackageSpecCollection; -} - -uint32 CPackageInstaller::countPackageReferences( - const SmartPtrCInstallPackageSpecDoc& installPackageSpec, - const std::deque& installProviderSpecCollection) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CPackageInstaller", "countPackageReferences"); - - uint32 refCnt = 0; - - CAF_CM_ENTER - { - CAF_CM_VALIDATE_SMARTPTR(installPackageSpec); - // installProviderSpecCollection is optional - - const std::string packageNamespace = installPackageSpec->getPackageNamespace(); - const std::string packageName = installPackageSpec->getPackageName(); - const std::string packageVersion = installPackageSpec->getPackageVersion(); - - for (TConstIterator > installProviderSpecIter( - installProviderSpecCollection); installProviderSpecIter; installProviderSpecIter++) { - const SmartPtrCInstallProviderSpecDoc installProviderSpec = *installProviderSpecIter; - - const std::deque minPackageElemCollection = - installProviderSpec->getPackageCollection(); - for (TConstIterator > - minPackageElemIter(minPackageElemCollection); minPackageElemIter; minPackageElemIter++) { - const SmartPtrCMinPackageElemDoc minPackageElem = - *minPackageElemIter; - - const std::string packageNamespaceCur = minPackageElem->getPackageNamespace(); - const std::string packageNameCur = minPackageElem->getPackageName(); - - if ((packageNamespace.compare(packageNamespaceCur) == 0) && (packageName.compare( - packageNameCur) == 0)) { - const std::string packageVersionCur = minPackageElem->getPackageVersion(); - const CInstallUtils::MATCH_STATUS matchStatus = - CInstallUtils::compareVersions(packageVersion, packageVersionCur); - if (matchStatus != CInstallUtils::MATCH_NOTEQUAL) { - refCnt++; - } - } - } - } - - CAF_CM_LOG_DEBUG_VA4("Package ref cnt - %s::%s::%s = %d", - packageNamespace.c_str(), packageName.c_str(), packageVersion.c_str(), refCnt); - } - CAF_CM_EXIT; - - return refCnt; -} - -void CPackageInstaller::logDebug( - const std::string& message, - const SmartPtrCInstallPackageSpecDoc& installPackageSpec1, - const SmartPtrCInstallPackageSpecDoc& installPackageSpec2) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CPackageInstaller", "logDebug"); - - CAF_CM_ENTER - { - CAF_CM_VALIDATE_STRING(message); - CAF_CM_VALIDATE_SMARTPTR(installPackageSpec1); - CAF_CM_VALIDATE_SMARTPTR(installPackageSpec2); - - const std::string fullMessage = message + " - %s::%s::%s, %s::%s::%s"; - CAF_CM_LOG_DEBUG_VA6(fullMessage.c_str(), - installPackageSpec1->getPackageNamespace().c_str(), - installPackageSpec1->getPackageName().c_str(), - installPackageSpec1->getPackageVersion().c_str(), - installPackageSpec2->getPackageNamespace().c_str(), - installPackageSpec2->getPackageName().c_str(), - installPackageSpec2->getPackageVersion().c_str()); - } - CAF_CM_EXIT; -} - -void CPackageInstaller::logWarn( - const std::string& message, - const SmartPtrCInstallPackageSpecDoc& installPackageSpec1, - const SmartPtrCInstallPackageSpecDoc& installPackageSpec2) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CPackageInstaller", "logWarn"); - - CAF_CM_ENTER - { - CAF_CM_VALIDATE_STRING(message); - CAF_CM_VALIDATE_SMARTPTR(installPackageSpec1); - CAF_CM_VALIDATE_SMARTPTR(installPackageSpec2); - - const std::string fullMessage = message + " - %s::%s::%s, %s::%s::%s"; - CAF_CM_LOG_DEBUG_VA6(fullMessage.c_str(), - installPackageSpec1->getPackageNamespace().c_str(), - installPackageSpec1->getPackageName().c_str(), - installPackageSpec1->getPackageVersion().c_str(), - installPackageSpec2->getPackageNamespace().c_str(), - installPackageSpec2->getPackageName().c_str(), - installPackageSpec2->getPackageVersion().c_str()); - } - CAF_CM_EXIT; -} - -void CPackageInstaller::cleanupPackage( - const SmartPtrCInstallPackageMatch& installPackageMatch) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CPackageInstaller", "cleanupPackage"); - CAF_CM_VALIDATE_SMARTPTR(installPackageMatch); - - const std::string installPackageDir = CPathBuilder::calcInstallPackageDir( - installPackageMatch->_matchedInstallPackageSpec->getPackageNamespace(), - installPackageMatch->_matchedInstallPackageSpec->getPackageName(), - installPackageMatch->_matchedInstallPackageSpec->getPackageVersion()); - CAF_CM_LOG_DEBUG_VA1("Removing package directory - %s", installPackageDir.c_str()); - FileSystemUtils::recursiveRemoveDirectory(installPackageDir); -} diff --git a/open-vm-tools/common-agent/Cpp/InternalProviders/Install_Provider/src/CPathBuilder.cpp b/open-vm-tools/common-agent/Cpp/InternalProviders/Install_Provider/src/CPathBuilder.cpp deleted file mode 100644 index cd77651b5..000000000 --- a/open-vm-tools/common-agent/Cpp/InternalProviders/Install_Provider/src/CPathBuilder.cpp +++ /dev/null @@ -1,203 +0,0 @@ -/* - * Author: bwilliams - * Created: May 3, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "CPathBuilder.h" - -using namespace Caf; - -std::string CPathBuilder::calcInstallProviderDir() { - std::string installProviderDir; - - CAF_CM_ENTER - { - const std::string installDir = getProviderHostConfigDir( - _sConfigInstallDir); - installProviderDir = FileSystemUtils::buildPath(installDir, "providers"); - - if (!FileSystemUtils::doesDirectoryExist(installProviderDir)) { - FileSystemUtils::createDirectory(installProviderDir); - } - } - CAF_CM_EXIT; - - return installProviderDir; -} - -std::string CPathBuilder::calcInstallPackageDir() { - std::string installPackageDir; - - CAF_CM_ENTER - { - const std::string installDir = getProviderHostConfigDir( - _sConfigInstallDir); - installPackageDir = FileSystemUtils::buildPath(installDir, "packages"); - - if (!FileSystemUtils::doesDirectoryExist(installPackageDir)) { - FileSystemUtils::createDirectory(installPackageDir); - } - } - CAF_CM_EXIT; - - return installPackageDir; -} - -std::string CPathBuilder::calcInstallProviderDir( - const std::string& providerNamespace, - const std::string& providerName, - const std::string& providerVersion) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CPathBuilder", "calcInstallProviderDir"); - - std::string installProviderDir; - - CAF_CM_ENTER - { - CAF_CM_VALIDATE_STRING(providerNamespace); - CAF_CM_VALIDATE_STRING(providerName); - CAF_CM_VALIDATE_STRING(providerVersion); - - const std::string installDir = getProviderHostConfigDir( - _sConfigInstallDir); - const std::string providersDir = FileSystemUtils::buildPath(installDir, "providers"); - installProviderDir = calcDir(providerNamespace, providerName, providerVersion, - providersDir); - - if (!FileSystemUtils::doesDirectoryExist(installProviderDir)) { - FileSystemUtils::createDirectory(installProviderDir); - } - } - CAF_CM_EXIT; - - return installProviderDir; -} - -std::string CPathBuilder::calcInstallPackageDir( - const std::string& packageNamespace, - const std::string& packageName, - const std::string& packageVersion) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CPathBuilder", "calcInstallPackageDir"); - - std::string installPackageDir; - - CAF_CM_ENTER - { - CAF_CM_VALIDATE_STRING(packageNamespace); - CAF_CM_VALIDATE_STRING(packageName); - CAF_CM_VALIDATE_STRING(packageVersion); - - const std::string installDir = getProviderHostConfigDir( - _sConfigInstallDir); - const std::string packagesDir = FileSystemUtils::buildPath(installDir, "packages"); - installPackageDir = calcDir(packageNamespace, packageName, packageVersion, packagesDir); - - if (!FileSystemUtils::doesDirectoryExist(installPackageDir)) { - FileSystemUtils::createDirectory(installPackageDir); - } - } - CAF_CM_EXIT; - - return installPackageDir; -} - -std::string CPathBuilder::calcProviderSchemaCacheDir( - const std::string& providerNamespace, - const std::string& providerName, - const std::string& providerVersion) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CPathBuilder", "calcProviderSchemaCacheDir"); - - std::string providerSchemaCacheDir; - - CAF_CM_ENTER - { - CAF_CM_VALIDATE_STRING(providerNamespace); - CAF_CM_VALIDATE_STRING(providerName); - CAF_CM_VALIDATE_STRING(providerVersion); - - const std::string schemaCacheDir = getProviderHostConfigDir( - _sConfigSchemaCacheDir); - providerSchemaCacheDir = calcDir(providerNamespace, providerName, providerVersion, - schemaCacheDir); - } - CAF_CM_EXIT; - - return providerSchemaCacheDir; -} - -std::string CPathBuilder::calcDir( - const std::string& thisNamespace, - const std::string& thisName, - const std::string& thisVersion, - const std::string& outputDir) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CPathBuilder", "calcDir"); - - std::string rc; - - CAF_CM_ENTER - { - CAF_CM_VALIDATE_STRING(thisNamespace); - CAF_CM_VALIDATE_STRING(thisName); - CAF_CM_VALIDATE_STRING(thisVersion); - CAF_CM_VALIDATE_STRING(outputDir); - - const std::string dirName = thisNamespace + "_" + thisName + "_" + thisVersion; - rc = FileSystemUtils::buildPath(outputDir, dirName); - } - CAF_CM_EXIT; - - return rc; -} - -std::string CPathBuilder::getRootConfigDir(const std::string& configName) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CPathBuilder", "getRootConfigDir"); - - std::string rc; - - CAF_CM_ENTER - { - CAF_CM_VALIDATE_STRING(configName); - - const std::string configDir = AppConfigUtils::getRequiredString(configName); - const std::string configDirExp = CStringUtils::expandEnv(configDir); - if (!FileSystemUtils::doesDirectoryExist(configDirExp)) { - CAF_CM_LOG_DEBUG_VA2( - "AppConfig directory does not exist... Creating - name: %s, dir: %s", - configName.c_str(), configDirExp.c_str()); - FileSystemUtils::createDirectory(configDirExp); - } - - rc = FileSystemUtils::normalizePathForPlatform(configDirExp); - } - CAF_CM_EXIT; - - return rc; -} - -std::string CPathBuilder::getProviderHostConfigDir(const std::string& configName) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CPathBuilder", "getProviderHostConfigDir"); - - std::string rc; - - CAF_CM_ENTER - { - CAF_CM_VALIDATE_STRING(configName); - - const std::string configDir = AppConfigUtils::getRequiredString(_sProviderHostArea, - configName); - const std::string configDirExp = CStringUtils::expandEnv(configDir); - if (!FileSystemUtils::doesDirectoryExist(configDirExp)) { - CAF_CM_LOG_DEBUG_VA2( - "AppConfig directory does not exist... Creating - name: %s, dir: %s", - configName.c_str(), configDirExp.c_str()); - FileSystemUtils::createDirectory(configDirExp); - } - - rc = FileSystemUtils::normalizePathForPlatform(configDirExp); - } - CAF_CM_EXIT; - - return rc; -} diff --git a/open-vm-tools/common-agent/Cpp/InternalProviders/Install_Provider/src/CPathBuilder.h b/open-vm-tools/common-agent/Cpp/InternalProviders/Install_Provider/src/CPathBuilder.h deleted file mode 100644 index 4df2c4e6d..000000000 --- a/open-vm-tools/common-agent/Cpp/InternalProviders/Install_Provider/src/CPathBuilder.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Author: bwilliams - * Created: May 3, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CPathBuilder_h_ -#define CPathBuilder_h_ - -namespace Caf { - -class CPathBuilder { -public: - static std::string calcInstallPackageDir(); - - static std::string calcInstallProviderDir(); - - static std::string calcInstallProviderDir( - const std::string& providerNamespace, - const std::string& providerName, - const std::string& providerVersion); - - static std::string calcInstallPackageDir( - const std::string& packageNamespace, - const std::string& packageName, - const std::string& packageVersion); - - static std::string calcProviderSchemaCacheDir( - const std::string& providerNamespace, - const std::string& providerName, - const std::string& providerVersion); - - static std::string calcDir( - const std::string& thisNamespace, - const std::string& thisName, - const std::string& thisVersion, - const std::string& outputDir); - - static std::string getRootConfigDir(const std::string& configName); - - static std::string getProviderHostConfigDir(const std::string& configName); - -private: - CAF_CM_DECLARE_NOCREATE( CPathBuilder); -}; - -} - -#endif // #ifndef CPathBuilder_h_ diff --git a/open-vm-tools/common-agent/Cpp/InternalProviders/Install_Provider/src/CProviderInstaller.cpp b/open-vm-tools/common-agent/Cpp/InternalProviders/Install_Provider/src/CProviderInstaller.cpp deleted file mode 100644 index 91207e011..000000000 --- a/open-vm-tools/common-agent/Cpp/InternalProviders/Install_Provider/src/CProviderInstaller.cpp +++ /dev/null @@ -1,411 +0,0 @@ -/* - * Author: bwilliams - * Created: May 3, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Doc/DocXml/CafInstallRequestXml/CafInstallRequestXmlRoots.h" - -#include "Doc/CafCoreTypesDoc/CAttachmentCollectionDoc.h" -#include "Doc/CafInstallRequestDoc/CFullPackageElemDoc.h" -#include "Doc/CafInstallRequestDoc/CInstallProviderJobDoc.h" -#include "Doc/CafInstallRequestDoc/CInstallProviderSpecDoc.h" -#include "Doc/CafInstallRequestDoc/CMinPackageElemDoc.h" -#include "Doc/CafInstallRequestDoc/CUninstallProviderJobDoc.h" -#include "CProviderInstaller.h" -#include "CPackageInstaller.h" - -using namespace Caf; - -void CProviderInstaller::installProvider( - const SmartPtrCInstallProviderJobDoc& installProviderJob, - const SmartPtrCAttachmentCollectionDoc& attachmentCollection, - const std::string& outputDir) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CProviderInstaller", "installProvider"); - - CAF_CM_ENTER - { - CAF_CM_VALIDATE_SMARTPTR(installProviderJob); - CAF_CM_VALIDATE_SMARTPTR(attachmentCollection); - CAF_CM_VALIDATE_STRING(outputDir); - - const SmartPtrCInstallProviderSpecDoc installProviderSpec = createInstallProviderSpec( - installProviderJob); - - const SmartPtrCInstallProviderMatch installProviderMatch = matchInstallProviderSpec( - installProviderSpec); - - switch (installProviderMatch->_matchStatus) { - case CInstallUtils::MATCH_NOTEQUAL: { - installProviderLow(installProviderJob, attachmentCollection, outputDir); - } - break; - case CInstallUtils::MATCH_VERSION_EQUAL: { - logWarn("Provider already installed", installProviderSpec, - installProviderMatch->_matchedInstallProviderSpec); - } - break; - case CInstallUtils::MATCH_VERSION_LESS: { - logWarn("More recent provider already installed", installProviderSpec, - installProviderMatch->_matchedInstallProviderSpec); - } - break; - case CInstallUtils::MATCH_VERSION_GREATER: { - logWarn("Upgrading provider", installProviderSpec, - installProviderMatch->_matchedInstallProviderSpec); - - uninstallProviderLow(installProviderMatch->_matchedInstallProviderSpec, outputDir); - installProviderLow(installProviderJob, attachmentCollection, outputDir); - } - break; - } - } - CAF_CM_EXIT; -} - -void CProviderInstaller::uninstallProvider( - const SmartPtrCUninstallProviderJobDoc& uninstallProviderJob, - const std::string& outputDir) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CProviderInstaller", "uninstallProvider"); - - CAF_CM_ENTER - { - CAF_CM_VALIDATE_SMARTPTR(uninstallProviderJob); - CAF_CM_VALIDATE_STRING(outputDir); - - const std::string installProviderDir = CPathBuilder::calcInstallProviderDir( - uninstallProviderJob->getProviderNamespace(), uninstallProviderJob->getProviderName(), - uninstallProviderJob->getProviderVersion()); - const std::string installProviderSpecPath = FileSystemUtils::buildPath(installProviderDir, - _sInstallProviderSpecFilename); - - if (FileSystemUtils::doesFileExist(installProviderSpecPath)) { - const SmartPtrCInstallProviderSpecDoc installProviderSpec = - XmlRoots::parseInstallProviderSpecFromFile(installProviderSpecPath); - - uninstallProviderLow(installProviderSpec, outputDir); - } else { - CAF_CM_LOG_INFO_VA1("Uninstall unnecessary... provider is not installed - %s", - calcProviderFqn(uninstallProviderJob).c_str()); - } - } - CAF_CM_EXIT; -} - -CProviderInstaller::SmartPtrCInstallProviderSpecCollection CProviderInstaller::readInstallProviderSpecs() { - CAF_CM_STATIC_FUNC_LOG_ONLY("CProviderInstaller", "readInstallProviderSpecs"); - - SmartPtrCInstallProviderSpecCollection installProviderSpecCollection; - - CAF_CM_ENTER - { - const std::string installProviderDir = CPathBuilder::calcInstallProviderDir(); - - const std::deque installProviderSpecFiles = - FileSystemUtils::findOptionalFiles(installProviderDir, _sInstallProviderSpecFilename); - - if (installProviderSpecFiles.empty()) { - CAF_CM_LOG_WARN_VA2("No provider install specs found - dir: %s, filename: %s", - installProviderDir.c_str(), _sInstallProviderSpecFilename); - } else { - installProviderSpecCollection.CreateInstance(); - - for (TConstIterator > installProviderSpecFileIter( - installProviderSpecFiles); installProviderSpecFileIter; installProviderSpecFileIter++) { - const std::string installProviderSpecFilePath = *installProviderSpecFileIter; - - CAF_CM_LOG_DEBUG_VA1("Found provider install spec - %s", - installProviderSpecFilePath.c_str()); - - const SmartPtrCInstallProviderSpecDoc installProviderSpec = - XmlRoots::parseInstallProviderSpecFromFile(installProviderSpecFilePath); - - installProviderSpecCollection->push_back(installProviderSpec); - } - } - } - CAF_CM_EXIT; - - return installProviderSpecCollection; -} - -void CProviderInstaller::installProviderLow( - const SmartPtrCInstallProviderJobDoc& installProviderJob, - const SmartPtrCAttachmentCollectionDoc& attachmentCollection, - const std::string& outputDir) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CProviderInstaller", "installProviderLow"); - - CAF_CM_ENTER - { - CAF_CM_VALIDATE_SMARTPTR(installProviderJob); - CAF_CM_VALIDATE_SMARTPTR(attachmentCollection); - CAF_CM_VALIDATE_STRING(outputDir); - - const std::deque fullPackageElemCollection = - installProviderJob->getPackageCollection(); - - CPackageInstaller::installPackages(fullPackageElemCollection, attachmentCollection, - outputDir); - - const SmartPtrCInstallProviderSpecDoc uninstallProviderSpec = createInstallProviderSpec( - installProviderJob); - storeInstallProviderSpec(uninstallProviderSpec); - } - CAF_CM_EXIT; -} - -void CProviderInstaller::uninstallProviderLow( - const SmartPtrCInstallProviderSpecDoc& installProviderSpec, - const std::string& outputDir) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CProviderInstaller", "uninstallProviderLow"); - - CAF_CM_ENTER - { - CAF_CM_VALIDATE_SMARTPTR(installProviderSpec); - CAF_CM_VALIDATE_STRING(outputDir); - - const std::deque minPackageElemCollection = - installProviderSpec->getPackageCollection(); - - const SmartPtrCInstallProviderSpecCollection installProviderSpecCollection = - readInstallProviderSpecs(); - - std::deque installProviderSpecCollectionInner; - if (!installProviderSpecCollection.IsNull()) { - installProviderSpecCollectionInner = *installProviderSpecCollection; - } - - try { - CPackageInstaller::uninstallPackages(minPackageElemCollection, - installProviderSpecCollectionInner, outputDir); - } catch (ProcessFailedException* ex) { - cleanupProvider(installProviderSpec); - ex->throwSelf(); - } - - cleanupProvider(installProviderSpec); - } - CAF_CM_EXIT; -} - -void CProviderInstaller::storeInstallProviderSpec( - const SmartPtrCInstallProviderSpecDoc& installProviderSpec) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CProviderInstaller", "storeInstallProviderSpec"); - - CAF_CM_ENTER - { - CAF_CM_VALIDATE_SMARTPTR(installProviderSpec); - - const std::string installProviderDir = CPathBuilder::calcInstallProviderDir( - installProviderSpec->getProviderNamespace(), installProviderSpec->getProviderName(), - installProviderSpec->getProviderVersion()); - - const std::string installProviderSpecPath = FileSystemUtils::buildPath(installProviderDir, - _sInstallProviderSpecFilename); - - XmlRoots::saveInstallProviderSpecToFile(installProviderSpec, installProviderSpecPath); - } - CAF_CM_EXIT; -} - -CProviderInstaller::SmartPtrCInstallProviderMatch CProviderInstaller::matchInstallProviderSpec( - const SmartPtrCInstallProviderSpecDoc& installProviderSpec) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CProviderInstaller", "matchInstallProviderSpec"); - - SmartPtrCInstallProviderMatch installProviderMatch; - - CAF_CM_ENTER - { - CAF_CM_VALIDATE_SMARTPTR(installProviderSpec); - - installProviderMatch.CreateInstance(); - installProviderMatch->_matchStatus = CInstallUtils::MATCH_NOTEQUAL; - - const SmartPtrCInstallProviderSpecCollection installProviderSpecCollection = - readInstallProviderSpecs(); - - if (!installProviderSpecCollection.IsNull()) { - const std::string providerNamespace = installProviderSpec->getProviderNamespace(); - const std::string providerName = installProviderSpec->getProviderName(); - const std::string providerVersion = installProviderSpec->getProviderVersion(); - - for (TConstIterator > - installProviderSpecIter(*installProviderSpecCollection); installProviderSpecIter; installProviderSpecIter++) { - const SmartPtrCInstallProviderSpecDoc installProviderSpecCur = - *installProviderSpecIter; - - const std::string providerNamespaceCur = - installProviderSpecCur->getProviderNamespace(); - const std::string providerNameCur = installProviderSpecCur->getProviderName(); - - if ((providerNamespace.compare(providerNamespaceCur) == 0) - && (providerName.compare(providerNameCur) == 0)) { - const std::string providerVersionCur = - installProviderSpecCur->getProviderVersion(); - installProviderMatch->_matchStatus = CInstallUtils::compareVersions( - providerVersion, providerVersionCur); - if (installProviderMatch->_matchStatus != CInstallUtils::MATCH_NOTEQUAL) { - installProviderMatch->_matchedInstallProviderSpec = installProviderSpecCur; - break; - } - } else { - logDebug("Provider did not match", installProviderSpec, installProviderSpecCur); - } - } - } - } - CAF_CM_EXIT; - - return installProviderMatch; -} - -SmartPtrCInstallProviderSpecDoc CProviderInstaller::createInstallProviderSpec( - const SmartPtrCInstallProviderJobDoc& installProviderJob) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CProviderInstaller", "createInstallProviderSpec"); - - SmartPtrCInstallProviderSpecDoc installProviderSpec; - - CAF_CM_ENTER - { - CAF_CM_VALIDATE_SMARTPTR(installProviderJob); - - const std::deque fullPackageElemCollection = - installProviderJob->getPackageCollection(); - - std::deque minPackageElemCollection; - for (TConstIterator > fullPackageElemIter( - fullPackageElemCollection); fullPackageElemIter; fullPackageElemIter++) { - const SmartPtrCFullPackageElemDoc fullPackageElem = *fullPackageElemIter; - - SmartPtrCMinPackageElemDoc minPackageElem; - minPackageElem.CreateInstance(); - minPackageElem->initialize(fullPackageElem->getIndex(), - fullPackageElem->getPackageNamespace(), fullPackageElem->getPackageName(), - fullPackageElem->getPackageVersion()); - - minPackageElemCollection.push_back(minPackageElem); - } - - installProviderSpec.CreateInstance(); - installProviderSpec->initialize(installProviderJob->getClientId(), - installProviderJob->getProviderNamespace(), installProviderJob->getProviderName(), - installProviderJob->getProviderVersion(), minPackageElemCollection); - } - CAF_CM_EXIT; - - return installProviderSpec; -} - -void CProviderInstaller::logDebug( - const std::string& message, - const SmartPtrCInstallProviderSpecDoc& installProviderSpec1, - const SmartPtrCInstallProviderSpecDoc& installProviderSpec2) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CProviderInstaller", "logDebug"); - - CAF_CM_ENTER - { - CAF_CM_VALIDATE_STRING(message); - CAF_CM_VALIDATE_SMARTPTR(installProviderSpec1); - CAF_CM_VALIDATE_SMARTPTR(installProviderSpec2); - - const std::string fullMessage = message + " - %s::%s::%s, %s::%s::%s"; - CAF_CM_LOG_DEBUG_VA6(fullMessage.c_str(), - installProviderSpec1->getProviderNamespace().c_str(), - installProviderSpec1->getProviderName().c_str(), - installProviderSpec1->getProviderVersion().c_str(), - installProviderSpec2->getProviderNamespace().c_str(), - installProviderSpec2->getProviderName().c_str(), - installProviderSpec2->getProviderVersion().c_str()); - } - CAF_CM_EXIT; -} - -void CProviderInstaller::logWarn( - const std::string& message, - const SmartPtrCInstallProviderSpecDoc& installProviderSpec1, - const SmartPtrCInstallProviderSpecDoc& installProviderSpec2) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CProviderInstaller", "logWarn"); - - CAF_CM_ENTER - { - CAF_CM_VALIDATE_STRING(message); - CAF_CM_VALIDATE_SMARTPTR(installProviderSpec1); - CAF_CM_VALIDATE_SMARTPTR(installProviderSpec2); - - const std::string fullMessage = message + " - %s::%s::%s, %s::%s::%s"; - CAF_CM_LOG_DEBUG_VA6(fullMessage.c_str(), - installProviderSpec1->getProviderNamespace().c_str(), - installProviderSpec1->getProviderName().c_str(), - installProviderSpec1->getProviderVersion().c_str(), - installProviderSpec2->getProviderNamespace().c_str(), - installProviderSpec2->getProviderName().c_str(), - installProviderSpec2->getProviderVersion().c_str()); - } - CAF_CM_EXIT; -} - -void CProviderInstaller::cleanupProvider( - const SmartPtrCInstallProviderSpecDoc& installProviderSpec) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CProviderInstaller", "cleanupProvider"); - CAF_CM_VALIDATE_SMARTPTR(installProviderSpec); - - const std::string providerNamespace = installProviderSpec->getProviderNamespace(); - const std::string providerName = installProviderSpec->getProviderName(); - const std::string providerVersion = installProviderSpec->getProviderVersion(); - const std::string providerFqn = calcProviderFqn(installProviderSpec); - - const std::string installProviderDir = CPathBuilder::calcInstallProviderDir( - providerNamespace, providerName, providerVersion); - if (FileSystemUtils::doesDirectoryExist(installProviderDir)) { - FileSystemUtils::recursiveRemoveDirectory(installProviderDir); - } - - const std::string providerSchemaCacheDir = CPathBuilder::calcProviderSchemaCacheDir( - providerNamespace, providerName, providerVersion); - if (FileSystemUtils::doesDirectoryExist(providerSchemaCacheDir)) { - FileSystemUtils::recursiveRemoveDirectory(providerSchemaCacheDir); - } - - const std::string providerRegDir = AppConfigUtils::getRequiredString( - _sProviderHostArea, _sConfigProviderRegDir); - const std::string providerRegDirExp = CStringUtils::expandEnv(providerRegDir); - const std::string providerRegFilename = providerFqn + ".xml"; - const std::string providerRegPath = FileSystemUtils::buildPath(providerRegDirExp, - providerRegFilename); - if (FileSystemUtils::doesFileExist(providerRegPath)) { - FileSystemUtils::removeFile(providerRegPath); - } - - const std::string invokersDir = AppConfigUtils::getRequiredString( - _sProviderHostArea, _sConfigInvokersDir); - const std::string invokersDirExp = CStringUtils::expandEnv(invokersDir); - const std::string invokersFilename = providerFqn; - const std::string invokersPath = FileSystemUtils::buildPath(invokersDirExp, - invokersFilename); - if (FileSystemUtils::doesFileExist(invokersPath)) { - FileSystemUtils::removeFile(invokersPath); - } -} - -std::string CProviderInstaller::calcProviderFqn( - const SmartPtrCInstallProviderSpecDoc& installProviderSpec) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CProviderInstaller", "calcProviderFqn"); - CAF_CM_VALIDATE_SMARTPTR(installProviderSpec); - - return installProviderSpec->getProviderNamespace() + "_" - + installProviderSpec->getProviderName() + "_" - + installProviderSpec->getProviderVersion(); -} - -std::string CProviderInstaller::calcProviderFqn( - const SmartPtrCUninstallProviderJobDoc& uninstallProviderJob) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CProviderInstaller", "calcProviderFqn"); - CAF_CM_VALIDATE_SMARTPTR(uninstallProviderJob); - - return uninstallProviderJob->getProviderNamespace() + "_" - + uninstallProviderJob->getProviderName() + "_" - + uninstallProviderJob->getProviderVersion(); -} diff --git a/open-vm-tools/common-agent/Cpp/InternalProviders/Install_Provider/src/InstallProvider.cpp b/open-vm-tools/common-agent/Cpp/InternalProviders/Install_Provider/src/InstallProvider.cpp deleted file mode 100644 index b6fd112be..000000000 --- a/open-vm-tools/common-agent/Cpp/InternalProviders/Install_Provider/src/InstallProvider.cpp +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Author: bwilliams - * Created: May 3, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -using namespace Caf; - -namespace Caf { - const char* _sInstallPackageSpecFilename = "installPackageSpec.xml"; - const char* _sInstallProviderSpecFilename = "installProviderSpec.xml"; -} - -int main(int csz, char* asz[]) { - CAF_CM_STATIC_FUNC_LOG("InstallProvider", "main"); - - int rc = 0; - try { - CInstallProvider provider; - rc = CProviderDriver::processProviderCommandline(provider, csz, asz); - } - CAF_CM_CATCH_CAF - CAF_CM_CATCH_DEFAULT - CAF_CM_LOG_CRIT_CAFEXCEPTION; - - rc = CAF_CM_ISEXCEPTION ? 1 : rc; - CAF_CM_CLEAREXCEPTION; - - return rc; -} diff --git a/open-vm-tools/common-agent/Cpp/InternalProviders/Install_Provider/src/stdafx.h b/open-vm-tools/common-agent/Cpp/InternalProviders/Install_Provider/src/stdafx.h deleted file mode 100644 index 1fd74fb76..000000000 --- a/open-vm-tools/common-agent/Cpp/InternalProviders/Install_Provider/src/stdafx.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Author: bwilliams - * Created: May 3, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef stdafx_h_ -#define stdafx_h_ - -//{{CAF_SUBSYSTEM}} - -#include -#include -#include -#include - -namespace Caf { - extern const char* _sInstallPackageSpecFilename; - extern const char* _sInstallProviderSpecFilename; -} - - -#include "CInstallUtils.h" -#include "CPathBuilder.h" - -#include "CPackageExecutor.h" - -#include "CInstallProvider.h" - -#endif // #ifndef stdafx_h_ diff --git a/open-vm-tools/common-agent/Cpp/InternalProviders/Makefile.am b/open-vm-tools/common-agent/Cpp/InternalProviders/Makefile.am deleted file mode 100644 index e9cb4eddf..000000000 --- a/open-vm-tools/common-agent/Cpp/InternalProviders/Makefile.am +++ /dev/null @@ -1,113 +0,0 @@ -################################################################################ -### Copyright (C) 2016 VMware, Inc. All rights reserved. -### -### This program is free software; you can redistribute it and/or modify -### it under the terms of version 2 of the GNU General Public License as -### published by the Free Software Foundation. -### -### 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -################################################################################ - -AUTOMAKE_OPTIONS = subdir-objects -cafbindir = @CAF_PME_BIN_DIR@ -cafbin_PROGRAMS = - -cafbin_PROGRAMS += ConfigProvider - -ConfigProvider_SOURCES= -ConfigProvider_SOURCES += Config_Provider/src/CConfigProvider.cpp -ConfigProvider_SOURCES += Config_Provider/src/CIniFileWithoutSection.cpp -ConfigProvider_SOURCES += Config_Provider/src/ConfigProvider.cpp - -ConfigProvider_CPPFLAGS = -ConfigProvider_CPPFLAGS += @GLIB2_CPPFLAGS@ -ConfigProvider_CPPFLAGS += @LOG4CPP_CPPFLAGS@ -ConfigProvider_CPPFLAGS += @SSL_CPPFLAGS@ -ConfigProvider_CPPFLAGS += @LIBRABBITMQ_CPPFLAGS@ - -ConfigProvider_CPPFLAGS += -I$(top_srcdir)/common-agent/Cpp/Framework/Framework/include -ConfigProvider_CPPFLAGS += -I$(top_srcdir)/common-agent/Cpp/ProviderFx/ProviderFx/include -ConfigProvider_CPPFLAGS += -I$(top_srcdir)/common-agent/Cpp/InternalProviders/Config_Provider/include -ConfigProvider_LDADD = -ConfigProvider_LDADD += @GLIB2_LIBS@ -ConfigProvider_LDADD += @LOG4CPP_LIBS@ -ConfigProvider_LDADD += -ldl -ConfigProvider_LDADD += ../Framework/libFramework.la -ConfigProvider_LDADD += ../ProviderFx/libProviderFx.la - -cafbin_PROGRAMS += InstallProvider - -InstallProvider_SOURCES= -InstallProvider_SOURCES += Install_Provider/src/CInstallProvider.cpp -InstallProvider_SOURCES += Install_Provider/src/CInstallUtils.cpp -InstallProvider_SOURCES += Install_Provider/src/CPackageExecutor.cpp -InstallProvider_SOURCES += Install_Provider/src/CPackageInstaller.cpp -InstallProvider_SOURCES += Install_Provider/src/CPathBuilder.cpp -InstallProvider_SOURCES += Install_Provider/src/CProviderInstaller.cpp -InstallProvider_SOURCES += Install_Provider/src/InstallProvider.cpp - -InstallProvider_CPPFLAGS = -InstallProvider_CPPFLAGS += @GLIB2_CPPFLAGS@ -InstallProvider_CPPFLAGS += @LOG4CPP_CPPFLAGS@ -InstallProvider_CPPFLAGS += @SSL_CPPFLAGS@ -InstallProvider_CPPFLAGS += @LIBRABBITMQ_CPPFLAGS@ - -InstallProvider_CPPFLAGS += -I$(top_srcdir)/common-agent/Cpp/Framework/Framework/include -InstallProvider_CPPFLAGS += -I$(top_srcdir)/common-agent/Cpp/ProviderFx/ProviderFx/include -InstallProvider_CPPFLAGS += -I$(top_srcdir)/common-agent/Cpp/InternalProviders/Install_Provider/include -InstallProvider_LDADD = -InstallProvider_LDADD += @GLIB2_LIBS@ -InstallProvider_LDADD += @LOG4CPP_LIBS@ -InstallProvider_LDADD += -ldl -InstallProvider_LDADD += ../Framework/libFramework.la -InstallProvider_LDADD += ../ProviderFx/libProviderFx.la - -cafbin_PROGRAMS += RemoteCommandProvider - -RemoteCommandProvider_SOURCES= -RemoteCommandProvider_SOURCES += RemoteCommand_Provider/src/CRemoteCommandProvider.cpp -RemoteCommandProvider_SOURCES += RemoteCommand_Provider/src/RemoteCommandProvider.cpp - -RemoteCommandProvider_CPPFLAGS = -RemoteCommandProvider_CPPFLAGS += @GLIB2_CPPFLAGS@ -RemoteCommandProvider_CPPFLAGS += @LOG4CPP_CPPFLAGS@ -RemoteCommandProvider_CPPFLAGS += @SSL_CPPFLAGS@ -RemoteCommandProvider_CPPFLAGS += @LIBRABBITMQ_CPPFLAGS@ - -RemoteCommandProvider_CPPFLAGS += -I$(top_srcdir)/common-agent/Cpp/Framework/Framework/include -RemoteCommandProvider_CPPFLAGS += -I$(top_srcdir)/common-agent/Cpp/ProviderFx/ProviderFx/include -RemoteCommandProvider_LDADD = -RemoteCommandProvider_LDADD += @GLIB2_LIBS@ -RemoteCommandProvider_LDADD += @LOG4CPP_LIBS@ -RemoteCommandProvider_LDADD += -ldl -RemoteCommandProvider_LDADD += ../Framework/libFramework.la -RemoteCommandProvider_LDADD += ../ProviderFx/libProviderFx.la - -cafbin_PROGRAMS += TestInfraProvider - -TestInfraProvider_SOURCES= -TestInfraProvider_SOURCES += TestInfra_Provider/src/CTestInfraProvider.cpp -TestInfraProvider_SOURCES += TestInfra_Provider/src/TestInfraProvider.cpp - -TestInfraProvider_CPPFLAGS = -TestInfraProvider_CPPFLAGS += @GLIB2_CPPFLAGS@ -TestInfraProvider_CPPFLAGS += @LOG4CPP_CPPFLAGS@ -TestInfraProvider_CPPFLAGS += @SSL_CPPFLAGS@ -TestInfraProvider_CPPFLAGS += @LIBRABBITMQ_CPPFLAGS@ - -TestInfraProvider_CPPFLAGS += -I$(top_srcdir)/common-agent/Cpp/Framework/Framework/include -TestInfraProvider_CPPFLAGS += -I$(top_srcdir)/common-agent/Cpp/ProviderFx/ProviderFx/include -TestInfraProvider_LDADD = -TestInfraProvider_LDADD += @GLIB2_LIBS@ -TestInfraProvider_LDADD += @LOG4CPP_LIBS@ -TestInfraProvider_LDADD += -ldl -TestInfraProvider_LDADD += ../Framework/libFramework.la -TestInfraProvider_LDADD += ../ProviderFx/libProviderFx.la - diff --git a/open-vm-tools/common-agent/Cpp/InternalProviders/RemoteCommand_Provider/src/CRemoteCommandProvider.cpp b/open-vm-tools/common-agent/Cpp/InternalProviders/RemoteCommand_Provider/src/CRemoteCommandProvider.cpp deleted file mode 100644 index 5d1031f22..000000000 --- a/open-vm-tools/common-agent/Cpp/InternalProviders/RemoteCommand_Provider/src/CRemoteCommandProvider.cpp +++ /dev/null @@ -1,195 +0,0 @@ -/* - * Author: bwilliams - * Created: May 3, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Doc/CafCoreTypesDoc/CAttachmentCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CAttachmentDoc.h" -#include "Doc/CafCoreTypesDoc/COperationDoc.h" -#include "Doc/CafCoreTypesDoc/CParameterCollectionDoc.h" -#include "Doc/ProviderRequestDoc/CProviderInvokeOperationDoc.h" -#include "Doc/ProviderResultsDoc/CSchemaDoc.h" -#include "Doc/SchemaTypesDoc/CActionClassDoc.h" -#include "Doc/SchemaTypesDoc/CDataClassDoc.h" -#include "Doc/SchemaTypesDoc/CMethodDoc.h" -#include "Doc/SchemaTypesDoc/CMethodParameterDoc.h" -#include "Exception/CCafException.h" -#include "CRemoteCommandProvider.h" -#include "IProviderRequest.h" - -using namespace Caf; - -CRemoteCommandProvider::CRemoteCommandProvider() : - CAF_CM_INIT_LOG("CRemoteCommandProvider") { -} - -CRemoteCommandProvider::~CRemoteCommandProvider() { -} - -const SmartPtrCSchemaDoc CRemoteCommandProvider::getSchema() const { - std::deque m1Params; - m1Params.push_back(CProviderDocHelper::createMethodParameter("scriptAttachmentName", PARAMETER_STRING, false)); - m1Params.push_back(CProviderDocHelper::createMethodParameter("scriptParameters", PARAMETER_STRING, false)); - m1Params.push_back(CProviderDocHelper::createMethodParameter("attachmentNames", PARAMETER_STRING, false)); - - std::deque m2Params; - m2Params.push_back(CProviderDocHelper::createMethodParameter("inlineScript", PARAMETER_STRING, false)); - m2Params.push_back(CProviderDocHelper::createMethodParameter("scriptParameters", PARAMETER_STRING, true, true)); - m2Params.push_back(CProviderDocHelper::createMethodParameter("attachmentNames", PARAMETER_STRING, true, true)); - - std::deque methods; - methods.push_back(CProviderDocHelper::createMethod("executeScript", m1Params)); - methods.push_back(CProviderDocHelper::createMethod("executeInlineScript", m2Params)); - - std::deque actionClasses; - actionClasses.push_back( - CProviderDocHelper::createActionClass( - "caf", - "RemoteCommandActions", - "1.0.0", - SmartPtrCCollectMethodDoc(), - methods)); - - return CProviderDocHelper::createSchema(std::deque(), actionClasses); -} - -void CRemoteCommandProvider::collect(const IProviderRequest& request, IProviderResponse& response) const { - CAF_CM_FUNCNAME("collect"); - - CAF_CM_EXCEPTIONEX_VA0(UnsupportedOperationException, E_NOTIMPL, - "Collect not implemented for Remote Commands") -} - -void CRemoteCommandProvider::invoke(const IProviderRequest& request, IProviderResponse& response) const { - CAF_CM_FUNCNAME("invoke"); - - SmartPtrCProviderInvokeOperationDoc doc = request.getInvokeOperations(); - CAF_CM_VALIDATE_SMARTPTR(doc); - - const SmartPtrCOperationDoc operation = doc->getOperation(); - const std::string operationName = operation->getName(); - - const SmartPtrCParameterCollectionDoc parameterCollection = - operation->getParameterCollection(); - - const std::string outputDir = doc->getOutputDir(); - const std::string scriptResultsDir = - FileSystemUtils::buildPath(outputDir, "scriptResults"); - if (! FileSystemUtils::doesDirectoryExist(scriptResultsDir)) { - FileSystemUtils::createDirectory(scriptResultsDir); - } - - const std::deque scriptParameters = - ParameterUtils::findOptionalParameterAsStringCollection("scriptParameters", - parameterCollection); - const std::deque attachmentNames = - ParameterUtils::findOptionalParameterAsStringCollection("attachmentNames", - parameterCollection); - - const std::string attachmentUris = createAttachmentUris( - attachmentNames, request.getAttachments()); - - std::string scriptPath; - if (operationName.compare("executeScript") == 0) { - const std::string scriptAttachmentName = - ParameterUtils::findRequiredParameterAsString("scriptAttachmentName", - parameterCollection); - - SmartPtrCAttachmentDoc scriptAttachment = AttachmentUtils::findRequiredAttachment( - scriptAttachmentName, request.getAttachments()); - CAF_CM_VALIDATE_BOOL(scriptAttachment->getIsReference() == FALSE); - const std::string attachmentUri = scriptAttachment->getUri(); - - UriUtils::SUriRecord uriRecord; - UriUtils::parseUriString(attachmentUri, uriRecord); - - CAF_CM_LOG_DEBUG_VA3("Parsed URI - Uri: %s, protocol: %s, address: %s", - attachmentUri.c_str(), uriRecord.protocol.c_str(), - uriRecord.address.c_str()); - - CAF_CM_VALIDATE_BOOL(uriRecord.protocol.compare("file") == 0); - UriUtils::SFileUriRecord scriptFileUriRecord; - UriUtils::parseFileAddress(uriRecord.address, scriptFileUriRecord); - scriptPath = scriptFileUriRecord.path; - } else if (operationName.compare("executeInlineScript") == 0) { - const std::string inlineScript = - ParameterUtils::findRequiredParameterAsString("inlineScript", - parameterCollection); - -#ifdef WIN32 - scriptPath = FileSystemUtils::buildPath(outputDir, "script.bat"); -#else - scriptPath = FileSystemUtils::buildPath(outputDir, "_script_"); -#endif - FileSystemUtils::saveTextFile(scriptPath, inlineScript); - } else { - CAF_CM_EXCEPTIONEX_VA1(InvalidArgumentException, E_INVALIDARG, - "Invalid operation name (must be \'executeScript\' or \'executeInlineScript\') - %s", - operationName.c_str()) - } - - FileSystemUtils::chmod(scriptPath); - executeScript(scriptPath, scriptResultsDir, scriptParameters, attachmentUris); -} - -void CRemoteCommandProvider::executeScript( - const std::string& scriptPath, - const std::string& scriptResultsDir, - const std::deque& scriptParameters, - const std::string& attachmentUris) const { - CAF_CM_FUNCNAME_VALIDATE("executeScript"); - CAF_CM_VALIDATE_STRING(scriptPath); - CAF_CM_VALIDATE_STRING(scriptResultsDir); - // scriptParameters are optional - // attachmentUris are optional - - Cdeqstr argv; - argv.push_back(scriptPath); - argv.push_back("-o"); - argv.push_back(scriptResultsDir); - if (! attachmentUris.empty()) { - argv.push_back("-u"); - argv.push_back(attachmentUris); - } - if (! scriptParameters.empty()) { - for(TConstIterator scriptParameterIter(scriptParameters); - scriptParameterIter; scriptParameterIter++) { - argv.push_back(*scriptParameterIter); - } - } - - const std::string stdoutPath = FileSystemUtils::buildPath( - scriptResultsDir, _sStdoutFilename); - const std::string stderrPath = FileSystemUtils::buildPath( - scriptResultsDir, _sStderrFilename); - - ProcessUtils::runSyncToFiles(argv, stdoutPath, stderrPath); - -} - -std::string CRemoteCommandProvider::createAttachmentUris( - const std::deque& attachmentNames, - const SmartPtrCAttachmentCollectionDoc& attachmentCollection) const { - CAF_CM_FUNCNAME_VALIDATE("createAttachmentUris"); - - std::string rc; - if (! attachmentNames.empty()) { - CAF_CM_VALIDATE_SMARTPTR(attachmentCollection); - - rc += "\""; - for(TConstIterator attachmentNameIter(attachmentNames); - attachmentNameIter; attachmentNameIter++) { - const std::string attachmentName = *attachmentNameIter; - const SmartPtrCAttachmentDoc attachment = - AttachmentUtils::findRequiredAttachment( - attachmentName, attachmentCollection); - rc += attachment->getName() + "^" + attachment->getUri() + "|"; - } - rc += "\""; - } - return rc; -} diff --git a/open-vm-tools/common-agent/Cpp/InternalProviders/RemoteCommand_Provider/src/CRemoteCommandProvider.h b/open-vm-tools/common-agent/Cpp/InternalProviders/RemoteCommand_Provider/src/CRemoteCommandProvider.h deleted file mode 100644 index a7e3c850b..000000000 --- a/open-vm-tools/common-agent/Cpp/InternalProviders/RemoteCommand_Provider/src/CRemoteCommandProvider.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Author: bwilliams - * Created: May 3, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CRemoteCommandProvider_h_ -#define CRemoteCommandProvider_h_ - - -#include "IInvokedProvider.h" - -#include "Doc/CafCoreTypesDoc/CAttachmentCollectionDoc.h" -#include "Doc/ProviderResultsDoc/CSchemaDoc.h" - -namespace Caf { - -/// Sends responses/errors back to the client. -class CRemoteCommandProvider : public IInvokedProvider { -public: - CRemoteCommandProvider(); - virtual ~CRemoteCommandProvider(); - -public: // IInvokedProvider - const std::string getProviderNamespace() const { - return "caf"; - } - - const std::string getProviderName() const { - return "RemoteCommandProvider"; - } - - const std::string getProviderVersion() const { - return "1.0.0"; - } - - const SmartPtrCSchemaDoc getSchema() const; - - void collect(const IProviderRequest& request, IProviderResponse& response) const; - - void invoke(const IProviderRequest& request, IProviderResponse& response) const; - -private: - void executeScript( - const std::string& script, - const std::string& scriptResultsDir, - const std::deque& scriptParameters, - const std::string& attachmentUris) const; - - std::string createAttachmentUris( - const std::deque& attachmentNamesStr, - const SmartPtrCAttachmentCollectionDoc& attachmentCollection) const; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CRemoteCommandProvider); -}; - -} - -#endif // #ifndef CRemoteCommandProvider_h_ diff --git a/open-vm-tools/common-agent/Cpp/InternalProviders/RemoteCommand_Provider/src/RemoteCommandProvider.cpp b/open-vm-tools/common-agent/Cpp/InternalProviders/RemoteCommand_Provider/src/RemoteCommandProvider.cpp deleted file mode 100644 index b0a4635c4..000000000 --- a/open-vm-tools/common-agent/Cpp/InternalProviders/RemoteCommand_Provider/src/RemoteCommandProvider.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Author: bwilliams - * Created: May 3, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -using namespace Caf; - -int main(int csz, char* asz[]) { - CAF_CM_STATIC_FUNC_LOG("RemoteCommandProvider", "main"); - - int rc = 0; - try { - CRemoteCommandProvider provider; - rc = CProviderDriver::processProviderCommandline(provider, csz, asz); - } - CAF_CM_CATCH_CAF - CAF_CM_CATCH_DEFAULT - CAF_CM_LOG_CRIT_CAFEXCEPTION; - - rc = CAF_CM_ISEXCEPTION ? 1 : rc; - CAF_CM_CLEAREXCEPTION; - - return rc; -} diff --git a/open-vm-tools/common-agent/Cpp/InternalProviders/RemoteCommand_Provider/src/stdafx.h b/open-vm-tools/common-agent/Cpp/InternalProviders/RemoteCommand_Provider/src/stdafx.h deleted file mode 100644 index 2b77904af..000000000 --- a/open-vm-tools/common-agent/Cpp/InternalProviders/RemoteCommand_Provider/src/stdafx.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Author: bwilliams - * Created: May 3, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef stdafx_h_ -#define stdafx_h_ - -//{{CAF_SUBSYSTEM}} - -#include -#include -#include - -#include "CRemoteCommandProvider.h" - -#endif // #ifndef stdafx_h_ diff --git a/open-vm-tools/common-agent/Cpp/InternalProviders/TestInfra_Provider/src/CTestInfraProvider.cpp b/open-vm-tools/common-agent/Cpp/InternalProviders/TestInfra_Provider/src/CTestInfraProvider.cpp deleted file mode 100644 index 74802974f..000000000 --- a/open-vm-tools/common-agent/Cpp/InternalProviders/TestInfra_Provider/src/CTestInfraProvider.cpp +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Author: bwilliams - * Created: May 3, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Doc/CafCoreTypesDoc/CAttachmentCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CAttachmentDoc.h" -#include "Doc/CafCoreTypesDoc/COperationDoc.h" -#include "Doc/CafCoreTypesDoc/CParameterCollectionDoc.h" -#include "Doc/ProviderRequestDoc/CProviderInvokeOperationDoc.h" -#include "Doc/ProviderResultsDoc/CSchemaDoc.h" -#include "Doc/SchemaTypesDoc/CActionClassDoc.h" -#include "Doc/SchemaTypesDoc/CClassPropertyDoc.h" -#include "Doc/SchemaTypesDoc/CDataClassDoc.h" -#include "Doc/SchemaTypesDoc/CDataClassInstanceDoc.h" -#include "Doc/SchemaTypesDoc/CDataClassPropertyDoc.h" -#include "Doc/SchemaTypesDoc/CMethodDoc.h" -#include "Doc/SchemaTypesDoc/CMethodParameterDoc.h" -#include "Exception/CCafException.h" -#include "CTestInfraProvider.h" -#include "IProviderResponse.h" -#include "IProviderRequest.h" - -using namespace Caf; - -CTestInfraProvider::CTestInfraProvider() : - CAF_CM_INIT_LOG("CTestInfraProvider") { -} - -CTestInfraProvider::~CTestInfraProvider() { -} - -const SmartPtrCSchemaDoc CTestInfraProvider::getSchema() const { - std::deque dc1Props; - dc1Props.push_back(CProviderDocHelper::createClassProperty("name", PROPERTY_STRING, true)); - dc1Props.push_back(CProviderDocHelper::createClassProperty("value", PROPERTY_STRING, true)); - - std::deque dataClasses; - dataClasses.push_back(CProviderDocHelper::createDataClass("cafTestInfra", "TestDataClass", "1.0.0", dc1Props)); - - std::deque m1Params; - m1Params.push_back(CProviderDocHelper::createMethodParameter("requestAttachmentName", PARAMETER_STRING, false)); - - std::deque m2Params; - m2Params.push_back(CProviderDocHelper::createMethodParameter("param1", PARAMETER_STRING, false)); - m2Params.push_back(CProviderDocHelper::createMethodParameter("param2", PARAMETER_STRING, false)); - - std::deque methods; - methods.push_back(CProviderDocHelper::createMethod("echoRequest", m1Params)); - methods.push_back(CProviderDocHelper::createMethod("testMethod", m2Params)); - - std::deque actionClasses; - actionClasses.push_back( - CProviderDocHelper::createActionClass( - "cafTestInfra", - "TestActionClass", - "1.0.0", - CProviderDocHelper::createCollectMethod("collectInstances"), - methods)); - - return CProviderDocHelper::createSchema(dataClasses, actionClasses); -} - -void CTestInfraProvider::collect(const IProviderRequest& request, IProviderResponse& response) const { - CAF_CM_ENTER { - const SmartPtrCDataClassInstanceDoc dataClassInstance = - createDataClassInstance("testName", "testValue"); - response.addInstance(dataClassInstance); - } - CAF_CM_EXIT; -} - -void CTestInfraProvider::invoke(const IProviderRequest& request, IProviderResponse& response) const { - CAF_CM_FUNCNAME("invoke"); - - CAF_CM_ENTER { - SmartPtrCProviderInvokeOperationDoc doc = request.getInvokeOperations(); - CAF_CM_VALIDATE_SMARTPTR(doc); - - const SmartPtrCOperationDoc operation = doc->getOperation(); - const std::string operationName = operation->getName(); - const SmartPtrCParameterCollectionDoc parameterCollection = - operation->getParameterCollection(); - - if (operationName.compare("testMethod") == 0) { - const std::string param1 = ParameterUtils::findRequiredParameterAsString( - "param1", parameterCollection); - const std::string param2Str = ParameterUtils::findRequiredParameterAsString( - "param2", parameterCollection); - const int32 param2 = CStringConv::fromString(param2Str); - - CAF_CM_LOG_DEBUG_VA2("testMethod() called - param1: %s, param2: %d", - param1.c_str(), param2); - } else if (operationName.compare("echoRequest") == 0) { - const std::string requestAttachmentName = ParameterUtils::findRequiredParameterAsString( - "requestAttachmentName", parameterCollection); - - SmartPtrCAttachmentCollectionDoc attachmentCollection = request.getAttachments(); - if (attachmentCollection.IsNull()) { - CAF_CM_EXCEPTIONEX_VA1(InvalidArgumentException, E_INVALIDARG, - "Attachment collection is empty - %s", requestAttachmentName.c_str()) - } - - SmartPtrCAttachmentDoc attachmentFnd; - const std::deque attachmentCollectionInner = - attachmentCollection->getAttachment(); - for (TConstIterator > attachmentIter(attachmentCollectionInner); - attachmentIter; attachmentIter++) { - const SmartPtrCAttachmentDoc attachment = *attachmentIter; - const std::string attachmentName = attachment->getName(); - if (attachmentName.compare(requestAttachmentName) == 0) { - attachmentFnd = attachment; - } - } - - if (attachmentFnd.IsNull()) { - CAF_CM_EXCEPTIONEX_VA1(InvalidArgumentException, E_INVALIDARG, - "Request Attachment not found - %s", requestAttachmentName.c_str()) - } - - response.addAttachment(attachmentFnd); - } else { - CAF_CM_EXCEPTIONEX_VA1(InvalidArgumentException, E_INVALIDARG, - "Invalid operation name (must be \'echoRequest\') - %s", operationName.c_str()) - } - } - CAF_CM_EXIT; -} - -SmartPtrCDataClassInstanceDoc CTestInfraProvider::createDataClassInstance( - const std::string& name, - const std::string& value) const { - CAF_CM_FUNCNAME_VALIDATE("createDataClassInstance"); - CAF_CM_VALIDATE_STRING(name); - CAF_CM_VALIDATE_STRING(value); - - std::deque dataClassProperties; - dataClassProperties.push_back(CProviderDocHelper::createDataClassProperty("name", name)); - dataClassProperties.push_back(CProviderDocHelper::createDataClassProperty("value", value)); - - return CProviderDocHelper::createDataClassInstance( - "cafTestInfra", - "TestDataClass", - "1.0.0", - dataClassProperties); -} diff --git a/open-vm-tools/common-agent/Cpp/InternalProviders/TestInfra_Provider/src/CTestInfraProvider.h b/open-vm-tools/common-agent/Cpp/InternalProviders/TestInfra_Provider/src/CTestInfraProvider.h deleted file mode 100644 index 641143ef2..000000000 --- a/open-vm-tools/common-agent/Cpp/InternalProviders/TestInfra_Provider/src/CTestInfraProvider.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Author: bwilliams - * Created: May 3, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CTestInfraProvider_h_ -#define CTestInfraProvider_h_ - - -#include "IInvokedProvider.h" - -#include "Doc/ProviderResultsDoc/CSchemaDoc.h" -#include "Doc/SchemaTypesDoc/CDataClassInstanceDoc.h" - -namespace Caf { - -/// Sends responses/errors back to the client. -class CTestInfraProvider : public IInvokedProvider { -public: - CTestInfraProvider(); - virtual ~CTestInfraProvider(); - -public: // IInvokedProvider - const std::string getProviderNamespace() const { - return "cafTestInfra"; - } - - const std::string getProviderName() const { - return "CafTestInfraProvider"; - } - - const std::string getProviderVersion() const { - return "1.0.0"; - } - - const SmartPtrCSchemaDoc getSchema() const; - - void collect(const IProviderRequest& request, IProviderResponse& response) const; - - void invoke(const IProviderRequest& request, IProviderResponse& response) const; - -private: - SmartPtrCDataClassInstanceDoc createDataClassInstance( - const std::string& name, - const std::string& value) const; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CTestInfraProvider); -}; - -} - -#endif // #ifndef CTestInfraProvider_h_ diff --git a/open-vm-tools/common-agent/Cpp/InternalProviders/TestInfra_Provider/src/TestInfraProvider.cpp b/open-vm-tools/common-agent/Cpp/InternalProviders/TestInfra_Provider/src/TestInfraProvider.cpp deleted file mode 100644 index 86b4fa498..000000000 --- a/open-vm-tools/common-agent/Cpp/InternalProviders/TestInfra_Provider/src/TestInfraProvider.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Author: bwilliams - * Created: May 3, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -using namespace Caf; - -int main(int csz, char* asz[]) { - CAF_CM_STATIC_FUNC_LOG("TestInfraProvider", "main"); - - int rc = 0; - try { - CTestInfraProvider provider; - rc = CProviderDriver::processProviderCommandline(provider, csz, asz); - } - CAF_CM_CATCH_CAF - CAF_CM_CATCH_DEFAULT - CAF_CM_LOG_CRIT_CAFEXCEPTION; - - rc = CAF_CM_ISEXCEPTION ? 1 : rc; - CAF_CM_CLEAREXCEPTION; - - return rc; -} diff --git a/open-vm-tools/common-agent/Cpp/InternalProviders/TestInfra_Provider/src/stdafx.h b/open-vm-tools/common-agent/Cpp/InternalProviders/TestInfra_Provider/src/stdafx.h deleted file mode 100644 index 02fc87d5c..000000000 --- a/open-vm-tools/common-agent/Cpp/InternalProviders/TestInfra_Provider/src/stdafx.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Author: bwilliams - * Created: May 3, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef stdafx_h_ -#define stdafx_h_ - -//{{CAF_SUBSYSTEM}} - -#include -#include -#include - -#include "../../TestInfra_Provider/src/CTestInfraProvider.h" - -#endif // #ifndef stdafx_h_ diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Makefile.am b/open-vm-tools/common-agent/Cpp/ManagementAgent/Makefile.am deleted file mode 100644 index 40845f4f0..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Makefile.am +++ /dev/null @@ -1,127 +0,0 @@ -################################################################################ -### Copyright (C) 2016-2017 VMware, Inc. All rights reserved. -### -### This program is free software; you can redistribute it and/or modify -### it under the terms of version 2 of the GNU General Public License as -### published by the Free Software Foundation. -### -### 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -################################################################################ - -AUTOMAKE_OPTIONS = subdir-objects -subsysdir = @CAF_SUBSYS_DIR@ -subsys_LTLIBRARIES = -cafbindir = @CAF_PME_BIN_DIR@ -cafbin_PROGRAMS = -subsys_LTLIBRARIES += libMaIntegrationSubsys.la -libMaIntegrationSubsys_la_LDFLAGS = @CAF_SUBSYS_LDFLAGS@ - -libMaIntegrationSubsys_la_SOURCES= -libMaIntegrationSubsys_la_SOURCES += Subsystems/MaIntegration/src/CAttachmentRequestTransformer.cpp -libMaIntegrationSubsys_la_SOURCES += Subsystems/MaIntegration/src/CAttachmentRequestTransformerInstance.cpp -libMaIntegrationSubsys_la_SOURCES += Subsystems/MaIntegration/src/CCollectSchemaExecutor.cpp -libMaIntegrationSubsys_la_SOURCES += Subsystems/MaIntegration/src/CConfigEnv.cpp -libMaIntegrationSubsys_la_SOURCES += Subsystems/MaIntegration/src/CConfigEnvInboundChannelAdapterInstance.cpp -libMaIntegrationSubsys_la_SOURCES += Subsystems/MaIntegration/src/CConfigEnvMerge.cpp -libMaIntegrationSubsys_la_SOURCES += Subsystems/MaIntegration/src/CConfigEnvMessageHandler.cpp -libMaIntegrationSubsys_la_SOURCES += Subsystems/MaIntegration/src/CConfigEnvOutboundChannelAdapterInstance.cpp -libMaIntegrationSubsys_la_SOURCES += Subsystems/MaIntegration/src/CConfigEnvReadingMessageSource.cpp -libMaIntegrationSubsys_la_SOURCES += Subsystems/MaIntegration/src/CDiagToMgmtRequestTransformer.cpp -libMaIntegrationSubsys_la_SOURCES += Subsystems/MaIntegration/src/CDiagToMgmtRequestTransformerInstance.cpp -libMaIntegrationSubsys_la_SOURCES += Subsystems/MaIntegration/src/CInstallToMgmtRequestTransformer.cpp -libMaIntegrationSubsys_la_SOURCES += Subsystems/MaIntegration/src/CInstallToMgmtRequestTransformerInstance.cpp -libMaIntegrationSubsys_la_SOURCES += Subsystems/MaIntegration/src/CMonitorInboundChannelAdapterInstance.cpp -libMaIntegrationSubsys_la_SOURCES += Subsystems/MaIntegration/src/CMonitorListener.cpp -libMaIntegrationSubsys_la_SOURCES += Subsystems/MaIntegration/src/CMonitorReadingMessageSource.cpp -libMaIntegrationSubsys_la_SOURCES += Subsystems/MaIntegration/src/CPersistenceInboundChannelAdapterInstance.cpp -libMaIntegrationSubsys_la_SOURCES += Subsystems/MaIntegration/src/CPersistenceMerge.cpp -libMaIntegrationSubsys_la_SOURCES += Subsystems/MaIntegration/src/CPersistenceMessageHandler.cpp -libMaIntegrationSubsys_la_SOURCES += Subsystems/MaIntegration/src/CPersistenceNamespaceDb.cpp -libMaIntegrationSubsys_la_SOURCES += Subsystems/MaIntegration/src/CPersistenceOutboundChannelAdapterInstance.cpp -libMaIntegrationSubsys_la_SOURCES += Subsystems/MaIntegration/src/CPersistenceReadingMessageSource.cpp -libMaIntegrationSubsys_la_SOURCES += Subsystems/MaIntegration/src/CProviderCollectSchemaExecutor.cpp -libMaIntegrationSubsys_la_SOURCES += Subsystems/MaIntegration/src/CProviderExecutor.cpp -libMaIntegrationSubsys_la_SOURCES += Subsystems/MaIntegration/src/CProviderExecutorRequest.cpp -libMaIntegrationSubsys_la_SOURCES += Subsystems/MaIntegration/src/CProviderExecutorRequestHandler.cpp -libMaIntegrationSubsys_la_SOURCES += Subsystems/MaIntegration/src/CResponseFactory.cpp -libMaIntegrationSubsys_la_SOURCES += Subsystems/MaIntegration/src/CSchemaCacheManager.cpp -libMaIntegrationSubsys_la_SOURCES += Subsystems/MaIntegration/src/CSinglePmeRequestSplitter.cpp -libMaIntegrationSubsys_la_SOURCES += Subsystems/MaIntegration/src/CSinglePmeRequestSplitterInstance.cpp -libMaIntegrationSubsys_la_SOURCES += Subsystems/MaIntegration/src/CVersionTransformer.cpp -libMaIntegrationSubsys_la_SOURCES += Subsystems/MaIntegration/src/CVersionTransformerInstance.cpp -libMaIntegrationSubsys_la_SOURCES += Subsystems/MaIntegration/src/IntegrationObjects.cpp -libMaIntegrationSubsys_la_SOURCES += Subsystems/MaIntegration/src/MaIntegration.cpp - -libMaIntegrationSubsys_la_CPPFLAGS = -libMaIntegrationSubsys_la_CPPFLAGS += @GLIB2_CPPFLAGS@ -libMaIntegrationSubsys_la_CPPFLAGS += @LOG4CPP_CPPFLAGS@ - -libMaIntegrationSubsys_la_CPPFLAGS += -I$(top_srcdir)/common-agent/Cpp/Framework/Framework/include -libMaIntegrationSubsys_la_CPPFLAGS += -I$(top_srcdir)/common-agent/Cpp/Framework/Subsystems/CafIntegration/include -libMaIntegrationSubsys_la_CPPFLAGS += -I$(top_srcdir)/common-agent/Cpp/ManagementAgent/ManagementAgent/include -libMaIntegrationSubsys_la_CPPFLAGS += -I$(top_srcdir)/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/include -libMaIntegrationSubsys_la_LIBADD = -libMaIntegrationSubsys_la_LIBADD += @GLIB2_LIBS@ -libMaIntegrationSubsys_la_LIBADD += @LOG4CPP_LIBS@ -libMaIntegrationSubsys_la_LIBADD += -ldl -libMaIntegrationSubsys_la_LIBADD += ../Framework/libFramework.la - -libMaIntegrationSubsys_la_LDFLAGS += -shared - -cafbin_PROGRAMS += ManagementAgentHost - -ManagementAgentHost_SOURCES= -ManagementAgentHost_SOURCES += ManagementAgent/src/CManagementAgentHostWork.cpp -ManagementAgentHost_SOURCES += ManagementAgent/src/ManagementAgentHost.cpp -ManagementAgentHost_SOURCES += ManagementAgent/src/ManagementAgentHostMain.cpp - -ManagementAgentHost_CPPFLAGS = -ManagementAgentHost_CPPFLAGS += @GLIB2_CPPFLAGS@ -ManagementAgentHost_CPPFLAGS += @LOG4CPP_CPPFLAGS@ - -ManagementAgentHost_CPPFLAGS += -I$(top_srcdir)/common-agent/Cpp/Framework/Framework/include -ManagementAgentHost_CPPFLAGS += -I$(top_srcdir)/common-agent/Cpp/ManagementAgent/ManagementAgent/include -ManagementAgentHost_LDADD = -ManagementAgentHost_LDADD += @GLIB2_LIBS@ -ManagementAgentHost_LDADD += @LOG4CPP_LIBS@ -ManagementAgentHost_LDADD += -ldl -ManagementAgentHost_LDADD += ../Framework/libFramework.la -ManagementAgentHost_LDADD += $(top_builddir)/vgauth/lib/libvgauth.la - -subsys_LTLIBRARIES += libVgAuthIntegrationSubsys.la -libVgAuthIntegrationSubsys_la_LDFLAGS = @CAF_SUBSYS_LDFLAGS@ - -libVgAuthIntegrationSubsys_la_SOURCES= -libVgAuthIntegrationSubsys_la_SOURCES += Subsystems/VgAuth/src/CGuestAuthenticator.cpp -libVgAuthIntegrationSubsys_la_SOURCES += Subsystems/VgAuth/src/CGuestAuthenticatorInstance.cpp -libVgAuthIntegrationSubsys_la_SOURCES += Subsystems/VgAuth/src/CVgAuthContext.cpp -libVgAuthIntegrationSubsys_la_SOURCES += Subsystems/VgAuth/src/CVgAuthError.cpp -libVgAuthIntegrationSubsys_la_SOURCES += Subsystems/VgAuth/src/CVgAuthImpersonation.cpp -libVgAuthIntegrationSubsys_la_SOURCES += Subsystems/VgAuth/src/CVgAuthInitializer.cpp -libVgAuthIntegrationSubsys_la_SOURCES += Subsystems/VgAuth/src/CVgAuthUserHandle.cpp -libVgAuthIntegrationSubsys_la_SOURCES += Subsystems/VgAuth/src/VgAuthIntegration.cpp - -libVgAuthIntegrationSubsys_la_CPPFLAGS = -libVgAuthIntegrationSubsys_la_CPPFLAGS += @GLIB2_CPPFLAGS@ -libVgAuthIntegrationSubsys_la_CPPFLAGS += @LOG4CPP_CPPFLAGS@ -libVgAuthIntegrationSubsys_la_CPPFLAGS += -I$(top_srcdir)/vgauth/public - -libVgAuthIntegrationSubsys_la_CPPFLAGS += -I$(top_srcdir)/common-agent/Cpp/Framework/Framework/include -libVgAuthIntegrationSubsys_la_CPPFLAGS += -I$(top_srcdir)/common-agent/Cpp/ManagementAgent/ManagementAgent/include -libVgAuthIntegrationSubsys_la_CPPFLAGS += -I$(top_srcdir)/common-agent/Cpp/ManagementAgent/Subsystems/VgAuth/include -libVgAuthIntegrationSubsys_la_LIBADD = -libVgAuthIntegrationSubsys_la_LIBADD += @GLIB2_LIBS@ -libVgAuthIntegrationSubsys_la_LIBADD += @LOG4CPP_LIBS@ -libVgAuthIntegrationSubsys_la_LIBADD += -ldl -libVgAuthIntegrationSubsys_la_LIBADD += ../Framework/libFramework.la -libVgAuthIntegrationSubsys_la_LIBADD += $(top_builddir)/vgauth/lib/libvgauth.la - -libVgAuthIntegrationSubsys_la_LDFLAGS += -shared - diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/ManagementAgent/include/CManagementAgentHostWork.h b/open-vm-tools/common-agent/Cpp/ManagementAgent/ManagementAgent/include/CManagementAgentHostWork.h deleted file mode 100644 index c7339dc41..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/ManagementAgent/include/CManagementAgentHostWork.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CManagementAgentHostWork_h_ -#define CManagementAgentHostWork_h_ - -#include "Common/IWork.h" - -namespace Caf { - -/// Sends responses/errors back to the client. -class CManagementAgentHostWork : - public IWork -{ -public: - CManagementAgentHostWork(); - virtual ~CManagementAgentHostWork(); - -public: - void initialize(); - -public: // IWork - void doWork(); - void stopWork(); - -private: - bool _isInitialized; - bool _isWorking; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CManagementAgentHostWork); -}; - -CAF_DECLARE_SMART_POINTER(CManagementAgentHostWork); - -} - -#endif // #ifndef CManagementAgentHostWork_h_ diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/ManagementAgent/src/CManagementAgentHostWork.cpp b/open-vm-tools/common-agent/Cpp/ManagementAgent/ManagementAgent/src/CManagementAgentHostWork.cpp deleted file mode 100644 index 910eac621..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/ManagementAgent/src/CManagementAgentHostWork.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Author: bwilliams - * Created: June 29, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Integration/Core/CIntegrationAppContext.h" -#include "CManagementAgentHostWork.h" -#include "Common/CLoggingUtils.h" - -using namespace Caf; - -CManagementAgentHostWork::CManagementAgentHostWork() : - _isInitialized(false), - _isWorking(false), - CAF_CM_INIT_LOG("CManagementAgentHostWork") { -} - -CManagementAgentHostWork::~CManagementAgentHostWork() { -} - -void CManagementAgentHostWork::initialize() { - - CAF_CM_FUNCNAME_VALIDATE("initialize"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - - _isInitialized = true; - } - CAF_CM_EXIT; -} - -void CManagementAgentHostWork::doWork() { - CAF_CM_FUNCNAME("doWork"); - - SmartPtrCIntegrationAppContext integrationAppContext; - - uint32 hostIntegrationTimeoutMs = 5000; - try { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - _isWorking = true; - - CLoggingUtils::setStartupConfigFile( - AppConfigUtils::getRequiredString(_sAppConfigGlobalParamLogConfigFile), - AppConfigUtils::getRequiredString(_sAppConfigGlobalParamLogDir)); - - const uint32 hostDelaySec = AppConfigUtils::getRequiredUint32( - _sManagementAgentArea, "host_delay_sec"); - hostIntegrationTimeoutMs = AppConfigUtils::getRequiredUint32( - _sManagementAgentArea, "host_integration_timeout_ms"); - - integrationAppContext.CreateInstance(); - integrationAppContext->initialize(hostIntegrationTimeoutMs); - - while (_isWorking) { - CThreadUtils::sleep(hostDelaySec * 1000); - } - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_CLEAREXCEPTION; - - try { - if (! integrationAppContext.IsNull()) { - integrationAppContext->terminate(hostIntegrationTimeoutMs); - } - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_THROWEXCEPTION; -} - -void CManagementAgentHostWork::stopWork() { - CAF_CM_FUNCNAME_VALIDATE("stopWork"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - _isWorking = false; - } - CAF_CM_EXIT; -} diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/ManagementAgent/src/ManagementAgentHost.cpp b/open-vm-tools/common-agent/Cpp/ManagementAgent/ManagementAgent/src/ManagementAgentHost.cpp deleted file mode 100644 index e3d8d9536..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/ManagementAgent/src/ManagementAgentHost.cpp +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -extern "C" { - -BOOL APIENTRY DllMain(HMODULE hModule, uint32 dwReason, LPVOID lpReserved) { - return TRUE; -} - -} diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/ManagementAgent/src/ManagementAgentHostMain.cpp b/open-vm-tools/common-agent/Cpp/ManagementAgent/ManagementAgent/src/ManagementAgentHostMain.cpp deleted file mode 100644 index 137c29277..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/ManagementAgent/src/ManagementAgentHostMain.cpp +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "CManagementAgentHostWork.h" -#include "Common/CLoggingUtils.h" -#include "Exception/CCafException.h" -#include "Common/IAppConfig.h" -#ifndef WIN32 -#include -#endif - -bool _gDaemonized = true; -bool _gSysLogInfos = false; -SmartPtrCManagementAgentHostWork _gManagementAgentHostWork; - -using namespace Caf; - -#ifndef WIN32 -extern "C" void TermHandler(int32 signum); -#endif - -int32 main(int32 argc, char** argv) { - HRESULT hr = CafInitialize::init(); - - if (hr != S_OK) { -#ifndef WIN32 - ::syslog(LOG_ERR, "ManagementAgentHost: CafInitialize::init() failed 0x%08X.", hr); -#endif - ::fprintf(stderr, "ManagementAgentHost: CafInitialize::init() failed 0x%08X\n", hr); - return 1; - } - - - SmartPtrIAppConfig appConfig; - try { - CafInitialize::serviceConfig(); - - std::string appConfigEnv; - CEnvironmentUtils::readEnvironmentVar("CAF_APPCONFIG", appConfigEnv); - if (appConfigEnv.empty()) { - Cdeqstr deqstr; - deqstr.push_back("cafenv-appconfig"); - deqstr.push_back("persistence-appconfig"); - deqstr.push_back("ma-appconfig"); - deqstr.push_back("custom-appconfig"); - appConfig = getAppConfig(deqstr); - } else { - appConfig = getAppConfig(); - } - } catch(CCafException *ex) { -#ifndef WIN32 - ::syslog( - LOG_ERR, - "ManagementAgentHost: getAppConfig() failed . %s", - ex->getFullMsg().c_str()); -#endif - ::fprintf( - stderr, - "ManagementAgentHost: getAppConfig() failed . %s\n", - ex->getFullMsg().c_str()); - ex->Release(); - } catch (std::exception ex) { -#ifndef WIN32 - ::syslog( - LOG_ERR, - "ManagementAgentHost: getAppConfig() failed . %s", - ex.what()); -#endif - ::fprintf( - stderr, - "ManagementAgentHost: getAppConfig() failed . %s\n", - ex.what()); - } catch (...) { -#ifndef WIN32 - ::syslog( - LOG_ERR, - "ManagementAgentHost: getAppConfig() failed . unknown exception"); -#endif - ::fprintf( - stderr, - "ManagementAgentHost: getAppConfig() failed . unknown exception\n"); - } - - CAF_CM_STATIC_FUNC_LOG("ManagementAgentHostMain", "main"); - int32 iRc = 0; - try { - if (!appConfig) { - CafInitialize::term(); - return 1; - } - - const std::string cafBinDir = AppConfigUtils::getRequiredString("globals", "bin_dir"); - g_setenv("CAF_BIN_DIR", cafBinDir.c_str(), TRUE); - - const std::string cafLibDir = AppConfigUtils::getRequiredString("globals", "lib_dir"); - g_setenv("CAF_LIB_DIR", cafLibDir.c_str(), TRUE); - - _gManagementAgentHostWork.CreateInstance(); - _gManagementAgentHostWork->initialize(); - - const uint32 maxStrLen = 4096; - if ((argc < 1) || (NULL == argv) || (NULL == argv[0]) || (::strnlen(argv[0], maxStrLen) >= maxStrLen)) { - CAF_CM_EXCEPTION_VA0(E_INVALIDARG, "argc/argv are invalid"); - } - -#ifdef WIN32 - CWinService::initialize(_gManagementAgentHostWork); - CWinService::execute(argc, argv); -#else - if (S_OK != hr) { - ::syslog(LOG_ERR, "CafInitialize::init() failed (0x%08X.", hr); - return 1; - } - - const std::string procPath(argv[0]); - CDaemonUtils::MakeDaemon( - argc, - argv, - procPath, - "ManagementAgentHost", - TermHandler, - _gDaemonized, - _gSysLogInfos); - - CLoggingUtils::setStartupConfigFile( - AppConfigUtils::getRequiredString(_sAppConfigGlobalParamLogConfigFile), - AppConfigUtils::getRequiredString(_sAppConfigGlobalParamLogDir)); - - _gManagementAgentHostWork->doWork(); -#endif - - } - CAF_CM_CATCH_CAF - CAF_CM_CATCH_DEFAULT - CAF_CM_LOG_CRIT_CAFEXCEPTION; - - if (CAF_CM_ISEXCEPTION) { - const std::string msg = CAF_CM_EXCEPTION_GET_FULLMSG; -#ifndef WIN32 - ::syslog( - LOG_ERR, - "ManagementAgentHost: %s", - msg.c_str()); -#endif - - ::fprintf( - stderr, - "ManagementAgentHost: %s\n", - msg.c_str()); - iRc = 1; - } - CAF_CM_CLEAREXCEPTION; - - CafInitialize::term(); - - return iRc; -} - -#ifndef WIN32 -extern "C" void TermHandler(int32 signum) { - CAF_CM_STATIC_FUNC_LOG_ONLY( "ManagementAgentHost", "TermHandler" ); - - CAF_CM_ENTER { - switch (signum) { - case SIGTERM: - CAF_CM_LOG_INFO_VA0( "Received SIGTERM" ); - if (! _gManagementAgentHostWork.IsNull()) { - _gManagementAgentHostWork->stopWork(); - } - break; - case SIGINT: - CAF_CM_LOG_INFO_VA0( "Received SIGINT" ); - if (! _gManagementAgentHostWork.IsNull()) { - _gManagementAgentHostWork->stopWork(); - } - break; - default: - CAF_CM_LOG_ERROR_VA1( "Ignoring Unexpected signal %d", signum); - break; - } - } - CAF_CM_EXIT; -} -#endif diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/ManagementAgent/src/stdafx.h b/open-vm-tools/common-agent/Cpp/ManagementAgent/ManagementAgent/src/stdafx.h deleted file mode 100644 index ee66cc11e..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/ManagementAgent/src/stdafx.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef stdafx_h_ -#define stdafx_h_ - -#include -#include - -#ifdef WIN32 -#include "CWinService.h" -#endif - - -#endif // #ifndef stdafx_h_ diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/include/CAttachmentRequestTransformerInstance.h b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/include/CAttachmentRequestTransformerInstance.h deleted file mode 100644 index 0f2e75044..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/include/CAttachmentRequestTransformerInstance.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CAttachmentRequestTransformerInstance_h_ -#define CAttachmentRequestTransformerInstance_h_ - - -#include "Integration/IIntegrationComponentInstance.h" - -#include "Common/IAppContext.h" -#include "Doc/PayloadEnvelopeDoc/CPayloadEnvelopeDoc.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/ITransformer.h" - -namespace Caf { - -class CAttachmentRequestTransformerInstance : - public TCafSubSystemObjectRoot, - public IIntegrationObject, - public IIntegrationComponentInstance, - public ITransformer { -public: - struct SExpandedFileAlias { - std::string _filePath; - std::string _encoding; - }; - CAF_DECLARE_SMART_POINTER(SExpandedFileAlias); - -public: - CAttachmentRequestTransformerInstance(); - virtual ~CAttachmentRequestTransformerInstance(); - - CAF_DECLARE_OBJECT_IDENTIFIER(_sObjIdAttachmentRequestTransformerInstance) - - CAF_BEGIN_INTERFACE_MAP(CAttachmentRequestTransformerInstance) - CAF_INTERFACE_ENTRY(IIntegrationObject) - CAF_INTERFACE_ENTRY(IIntegrationComponentInstance) - CAF_INTERFACE_ENTRY(ITransformer) - CAF_END_INTERFACE_MAP() - -public: // IIntegrationObject - void initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection); - - std::string getId() const; - -public: // IIntegrationComponentInstance - void wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver); - -public: // ITransformer - SmartPtrIIntMessage transformMessage( - const SmartPtrIIntMessage& message); - -private: - std::string calcOutputDirPath( - const SmartPtrCPayloadEnvelopeDoc& payloadEnvelope) const; - - std::string calcFilePath( - const UriUtils::SUriRecord& uriRecord) const; - - std::string calcRelPath( - const std::string& filePath, - const UriUtils::SUriRecord& uriRecord) const; - - void moveFile( - const std::string& srcFilePath, - const std::string& dstFilePath) const; - -private: - bool _isInitialized; - std::string _id; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CAttachmentRequestTransformerInstance); -}; - -} - -#endif // #ifndef CAttachmentRequestTransformerInstance_h_ diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/include/CConfigEnvReadingMessageSource.h b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/include/CConfigEnvReadingMessageSource.h deleted file mode 100644 index 08f665108..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/include/CConfigEnvReadingMessageSource.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef _MaIntegration_CConfigEnvReadingMessageSource_h_ -#define _MaIntegration_CConfigEnvReadingMessageSource_h_ - -#include "IConfigEnv.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "Integration/Core/CAbstractPollableChannel.h" - -namespace Caf { - -class CConfigEnvReadingMessageSource : - public CAbstractPollableChannel { -private: - typedef std::map CFileCollection; - CAF_DECLARE_SMART_POINTER(CFileCollection); - -public: - CConfigEnvReadingMessageSource(); - virtual ~CConfigEnvReadingMessageSource(); - -public: - void initialize( - const SmartPtrIDocument& configSection, - const SmartPtrIConfigEnv& configEnv); - -protected: // CAbstractPollableChannel - bool doSend( - const SmartPtrIIntMessage& message, - int32 timeout); - - SmartPtrIIntMessage doReceive(const int32 timeout); - -private: - bool _isInitialized; - std::string _id; - - SmartPtrIConfigEnv _configEnv; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CConfigEnvReadingMessageSource); -}; - -CAF_DECLARE_SMART_POINTER(CConfigEnvReadingMessageSource); - -} - -#endif // #ifndef _MaIntegration_CConfigEnvReadingMessageSource_h_ diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/include/CDiagToMgmtRequestTransformerInstance.h b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/include/CDiagToMgmtRequestTransformerInstance.h deleted file mode 100644 index 9fdf29091..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/include/CDiagToMgmtRequestTransformerInstance.h +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CDiagToMgmtRequestTransformerInstance_h_ -#define CDiagToMgmtRequestTransformerInstance_h_ - - -#include "Integration/IIntegrationComponentInstance.h" - -#include "CEnvelopeToPayloadTransformerInstance.h" -#include "Common/IAppContext.h" -#include "Doc/CafCoreTypesDoc/COperationDoc.h" -#include "Doc/DiagTypesDoc/CDiagCollectInstancesDoc.h" -#include "Doc/DiagTypesDoc/CDiagDeleteValueCollectionDoc.h" -#include "Doc/DiagTypesDoc/CDiagSetValueCollectionDoc.h" -#include "Doc/MgmtTypesDoc/CMgmtCollectInstancesCollectionDoc.h" -#include "Doc/MgmtTypesDoc/CMgmtCollectInstancesDoc.h" -#include "Doc/MgmtTypesDoc/CMgmtInvokeOperationCollectionDoc.h" -#include "Doc/MgmtTypesDoc/CMgmtInvokeOperationDoc.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/ITransformer.h" - -namespace Caf { - -class CDiagToMgmtRequestTransformerInstance : - public TCafSubSystemObjectRoot, - public IIntegrationObject, - public IIntegrationComponentInstance, - public ITransformer { -public: - struct SExpandedFileAlias { - std::string _filePath; - std::string _encoding; - }; - CAF_DECLARE_SMART_POINTER(SExpandedFileAlias); - -public: - CDiagToMgmtRequestTransformerInstance(); - virtual ~CDiagToMgmtRequestTransformerInstance(); - - CAF_DECLARE_OBJECT_IDENTIFIER(_sObjIdDiagToMgmtRequestTransformerInstance) - - CAF_BEGIN_INTERFACE_MAP(CDiagToMgmtRequestTransformerInstance) - CAF_INTERFACE_ENTRY(IIntegrationObject) - CAF_INTERFACE_ENTRY(IIntegrationComponentInstance) - CAF_INTERFACE_ENTRY(ITransformer) - CAF_END_INTERFACE_MAP() - -public: // IIntegrationObject - void initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection); - - std::string getId() const; - -public: // IIntegrationComponentInstance - void wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver); - -public: // ITransformer - SmartPtrIIntMessage transformMessage( - const SmartPtrIIntMessage& message); - -private: - SmartPtrCMgmtCollectInstancesCollectionDoc createMgmtCollectInstancesCollection( - const SmartPtrCDiagCollectInstancesDoc& diagCollectInstances) const; - - SmartPtrCMgmtInvokeOperationCollectionDoc createMgmtInvokeOperationCollection( - const SmartPtrCDiagSetValueCollectionDoc& diagSetValueCollection, - const SmartPtrCDiagDeleteValueCollectionDoc& diagDeleteValueCollection) const; - - SmartPtrCMgmtCollectInstancesDoc createCollectInstances( - const UUID& jobId, - const SmartPtrSExpandedFileAlias& expandedFileAlias) const; - - SmartPtrCOperationDoc createSetValueOperation( - const std::string& valueName, - const std::deque& valueCollection, - const SmartPtrSExpandedFileAlias& expandedFileAlias) const; - - SmartPtrCOperationDoc createDeleteValueOperation( - const std::string& valueName, - const SmartPtrSExpandedFileAlias& expandedFileAlias) const; - - SmartPtrCMgmtInvokeOperationDoc createInvokeOperation( - const UUID& jobId, - const SmartPtrCOperationDoc operation) const; - - std::deque expandFileAliases() const; - - SmartPtrSExpandedFileAlias expandFileAlias( - const std::string& fileAlias) const; - - std::string findUriParameter( - const std::string& parameterName, - const UriUtils::SUriRecord& uri) const; - -private: - bool _isInitialized; - std::string _id; - - std::string _fileAliasPrefix; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CDiagToMgmtRequestTransformerInstance); -}; - -} - -#endif // #ifndef CDiagToMgmtRequestTransformerInstance_h_ diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/include/CMonitorReadingMessageSource.h b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/include/CMonitorReadingMessageSource.h deleted file mode 100644 index 8c2bc5c14..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/include/CMonitorReadingMessageSource.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2017 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef _MaIntegration_CMonitorReadingMessageSource_h_ -#define _MaIntegration_CMonitorReadingMessageSource_h_ - -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "Integration/Core/CAbstractPollableChannel.h" - -namespace Caf { - -class CMonitorReadingMessageSource : - public CAbstractPollableChannel { -private: - typedef std::map CFileCollection; - CAF_DECLARE_SMART_POINTER(CFileCollection); - -public: - CMonitorReadingMessageSource(); - virtual ~CMonitorReadingMessageSource(); - -public: - void initialize( - const SmartPtrIDocument& configSection); - -protected: // CAbstractPollableChannel - bool doSend( - const SmartPtrIIntMessage& message, - int32 timeout); - - SmartPtrIIntMessage doReceive(const int32 timeout); - -private: - bool isListenerRunning() const; - - void startListener( - const std::string& reason) const; - - void stopListener( - const std::string& reason) const; - - void restartListener( - const std::string& reason) const; - - std::string executeScript( - const std::string& scriptPath, - const std::string& scriptResultsDir) const; - - bool areSystemResourcesLow() const; - - bool isTimeForListenerRestart() const; - - uint64 calcListenerRestartMs() const; - -private: - bool _isInitialized; - std::string _id; - - uint64 _listenerStartTimeMs; - uint64 _listenerRestartMs; - - std::string _monitorDir; - std::string _restartListenerPath; - std::string _listenerConfiguredStage2Path; - - std::string _scriptOutputDir; - std::string _stopListenerScript; - std::string _startListenerScript; - std::string _isListenerRunningScript; - - std::string _listenerStartupType; - int32 _listenerRetryCnt; - int32 _listenerRetryMax; - - SmartPtrCMonitorListener _monitorListener; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CMonitorReadingMessageSource); -}; - -CAF_DECLARE_SMART_POINTER(CMonitorReadingMessageSource); - -} - -#endif // #ifndef _MaIntegration_CMonitorReadingMessageSource_h_ diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/include/CPersistenceReadingMessageSource.h b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/include/CPersistenceReadingMessageSource.h deleted file mode 100644 index 5994b1cd1..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/include/CPersistenceReadingMessageSource.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef _MaIntegration_CPersistenceReadingMessageSource_h_ -#define _MaIntegration_CPersistenceReadingMessageSource_h_ - -#include "IPersistence.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "Integration/Core/CAbstractPollableChannel.h" - -namespace Caf { - -class CPersistenceReadingMessageSource : - public CAbstractPollableChannel { -private: - typedef std::map CFileCollection; - CAF_DECLARE_SMART_POINTER(CFileCollection); - -public: - CPersistenceReadingMessageSource(); - virtual ~CPersistenceReadingMessageSource(); - -public: - void initialize( - const SmartPtrIDocument& configSection, - const SmartPtrIPersistence& persistence); - -protected: // CAbstractPollableChannel - bool doSend( - const SmartPtrIIntMessage& message, - int32 timeout); - - SmartPtrIIntMessage doReceive(const int32 timeout); - -private: - bool _isInitialized; - std::string _id; - - SmartPtrIPersistence _persistence; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CPersistenceReadingMessageSource); -}; - -CAF_DECLARE_SMART_POINTER(CPersistenceReadingMessageSource); - -} - -#endif // #ifndef _MaIntegration_CPersistenceReadingMessageSource_h_ diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/include/CProviderExecutorRequest.h b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/include/CProviderExecutorRequest.h deleted file mode 100644 index b21189e79..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/include/CProviderExecutorRequest.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Author: brets - * Created: Nov 20, 2015 - * - * Copyright (C) 2015-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CProviderExecutorRequest_h_ -#define CProviderExecutorRequest_h_ - - -#include "Doc/ProviderRequestDoc/CProviderRequestDoc.h" -#include "Integration/IIntMessage.h" - -namespace Caf { - -/// TODO - describe class -class CProviderExecutorRequest { -public: - CProviderExecutorRequest(); - virtual ~CProviderExecutorRequest(); - -public: - void initialize(const SmartPtrIIntMessage& request); - - const SmartPtrIIntMessage getInternalRequest() const; - const SmartPtrCProviderRequestDoc getRequest() const; - const std::string& getOutputDirectory() const; - const std::string& getProviderUri() const; - -private: - bool _isInitialized; - SmartPtrIIntMessage _internalRequest; - SmartPtrCProviderRequestDoc _request; - std::string _outputDir; - std::string _providerUri; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CProviderExecutorRequest); -}; - -CAF_DECLARE_SMART_POINTER(CProviderExecutorRequest); - -} - -#endif // #ifndef CProviderExecutorRequest_h_ diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/include/CProviderExecutorRequestHandler.h b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/include/CProviderExecutorRequestHandler.h deleted file mode 100644 index f3461ddc5..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/include/CProviderExecutorRequestHandler.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Author: brets - * Created: Nov 20, 2015 - * - * Copyright (C) 2015-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CProviderExecutorRequestHandler_h_ -#define CProviderExecutorRequestHandler_h_ - - -#include "Integration/IRunnable.h" - -#include "CProviderExecutorRequest.h" -#include "Common/CAutoMutex.h" -#include "Integration/IErrorHandler.h" -#include "Integration/ITaskExecutor.h" -#include "Integration/ITransformer.h" - -namespace Caf { - -/// TODO - describe class -class CProviderExecutorRequestHandler : public IRunnable { -public: - CProviderExecutorRequestHandler(); - virtual ~CProviderExecutorRequestHandler(); - -public: - void initialize(const std::string& providerUri, - const SmartPtrITransformer beginImpersonationTransformer, - const SmartPtrITransformer endImpersonationTransformer, - const SmartPtrIErrorHandler errorHandler); - - void handleRequest(const SmartPtrCProviderExecutorRequest request); - -public: // IRunnable - void run(); - void cancel(); - -private: - SmartPtrCProviderExecutorRequest getNextPendingRequest(); - - void processRequest(const SmartPtrCProviderExecutorRequest& request) const; - - void executeRequestAsync( - const SmartPtrCProviderExecutorRequest& request); - - std::deque removeFinishedTaskExecutors( - const std::deque taskExecutors) const; - -private: - bool _isInitialized; - bool _isCancelled; - std::string _providerPath; - std::string _providerUri; - std::deque _taskExecutors; - SmartPtrCAutoMutex _mutex; - std::deque _pendingRequests; - SmartPtrITransformer _beginImpersonationTransformer; - SmartPtrITransformer _endImpersonationTransformer; - SmartPtrIErrorHandler _errorHandler; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_CREATE_THREADSAFE; - CAF_CM_DECLARE_NOCOPY(CProviderExecutorRequestHandler); -}; - -CAF_DECLARE_SMART_POINTER(CProviderExecutorRequestHandler); - -} - -#endif // #ifndef CProviderExecutorRequestHandler_h_ diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/include/CResponseFactory.h b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/include/CResponseFactory.h deleted file mode 100644 index 197ca9ef1..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/include/CResponseFactory.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CResponseFactory_h_ -#define CResponseFactory_h_ - - -#include "Doc/CafCoreTypesDoc/CAttachmentCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CAttachmentDoc.h" -#include "Doc/ProviderRequestDoc/CProviderCollectSchemaRequestDoc.h" -#include "Doc/ProviderRequestDoc/CProviderRequestDoc.h" -#include "Doc/ResponseDoc/CManifestCollectionDoc.h" -#include "Doc/ResponseDoc/CManifestDoc.h" -#include "Doc/ResponseDoc/CResponseDoc.h" - -namespace Caf { - -/// Builds the response XML document. -class CResponseFactory { -public: - static SmartPtrCResponseDoc createResponse( - const SmartPtrCProviderCollectSchemaRequestDoc& providerCollectSchemaRequest, - const std::string& outputDir, - const std::string& schemaCacheDir); - - static SmartPtrCResponseDoc createResponse( - const SmartPtrCProviderRequestDoc& providerRequest, - const std::string& outputDir); - -private: - static void findAndStoreGlobalAttachmentsAndProviderResponses( - const std::string& outputDir, - const std::string& schemaCacheDir, - SmartPtrCManifestCollectionDoc& manifestCollection, - SmartPtrCAttachmentCollectionDoc& attachmentCollection); - - static void findAndStoreProviderResponses( - const std::string& outputDir, - const std::string& schemaCacheDir, - std::map& globalAttachmentCollection, - std::deque& manifestCollection); - - static void findAndStoreGlobalAttachments( - const std::string& outputDir, - std::map& globalAttachmentCollection); - - static void resolveAndStoreGlobalAttachments( - const std::deque attachmentCollectionInner, - const std::string& outputDir, - const std::string& schemaCacheDir, - std::map& globalAttachmentCollection); - - static void storeGlobalAttachments( - const std::string& attachmentName, - const std::string& attachmentType, - const std::deque& attachmentPathCollection, - const std::string& baseDir, - std::map& attachmentCollection); - - static void storeGlobalAttachment( - const std::string& attachmentName, - const std::string& attachmentType, - const std::string& attachmentPath, - const std::string& baseDir, - std::map& attachmentCollection); - - static void resolveAttachmentPath( - const std::string& attachmentPath, - const std::string& baseDir, - std::string& relPath, - std::string& attachmentPathNew); - - static std::string removeLeadingChars( - const std::string& sourceStr, - const char leadingChar); - -private: - CAF_CM_DECLARE_NOCREATE(CResponseFactory); -}; - -CAF_DECLARE_SMART_POINTER(CResponseFactory); - -} - -#endif // #ifndef CResponseFactory_h_ diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/include/CSchemaCacheManager.h b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/include/CSchemaCacheManager.h deleted file mode 100644 index 273d46655..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/include/CSchemaCacheManager.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CSchemaCacheManager_h_ -#define CSchemaCacheManager_h_ - - -#include "Doc/CafCoreTypesDoc/CFullyQualifiedClassGroupDoc.h" -#include "Doc/ProviderInfraDoc/CSchemaSummaryDoc.h" - -namespace Caf { - -/// Simple container class for identifying a class. -class CClassId { -public: - SmartPtrCFullyQualifiedClassGroupDoc _fqc; - std::string toString() const { - return _fqc->getClassNamespace() + "::" + _fqc->getClassName() + "::" + _fqc->getClassVersion(); - } -}; -bool operator< (const CClassId& lhs, const CClassId& rhs); - -/// Creates a provider request. -class CSchemaCacheManager { -private: - typedef std::map CClassCollection; - -public: - CSchemaCacheManager(); - virtual ~CSchemaCacheManager(); - -public: - void initialize(); - - std::string findProvider( - const SmartPtrCFullyQualifiedClassGroupDoc& fqc); - -private: - void processSchemaSummaries( - const std::string& schemaCacheDirPath, - CClassCollection& classCollection) const; - - void addNewClasses( - const SmartPtrCSchemaSummaryDoc& schemaSummary, - const std::string& schemaSummaryFilePath, - CClassCollection& classCollection) const; - - void waitForSchemaCacheCreation( - const std::string& schemaCacheDir, - const uint16 maxWaitSecs) const; - -private: - bool _isInitialized; - std::string _schemaCacheDirPath; - CClassCollection _classCollection; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CSchemaCacheManager); -}; - -CAF_DECLARE_SMART_POINTER(CSchemaCacheManager); - -} - -#endif // #ifndef CSchemaCacheManager_h_ diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/include/CSinglePmeRequestSplitterInstance.h b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/include/CSinglePmeRequestSplitterInstance.h deleted file mode 100644 index 557bea8c9..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/include/CSinglePmeRequestSplitterInstance.h +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CSinglePmeRequestSplitterInstance_h_ -#define CSinglePmeRequestSplitterInstance_h_ - - -#include "Integration/IIntegrationComponentInstance.h" - -#include "CSchemaCacheManager.h" -#include "Common/IAppContext.h" -#include "Doc/CafCoreTypesDoc/CClassSpecifierDoc.h" -#include "Doc/CafCoreTypesDoc/CFullyQualifiedClassGroupDoc.h" -#include "Doc/CafCoreTypesDoc/CRequestHeaderDoc.h" -#include "Doc/MgmtRequestDoc/CMgmtRequestDoc.h" -#include "Doc/MgmtTypesDoc/CMgmtCollectInstancesCollectionDoc.h" -#include "Doc/MgmtTypesDoc/CMgmtCollectInstancesDoc.h" -#include "Doc/MgmtTypesDoc/CMgmtCollectSchemaDoc.h" -#include "Doc/MgmtTypesDoc/CMgmtInvokeOperationCollectionDoc.h" -#include "Doc/MgmtTypesDoc/CMgmtInvokeOperationDoc.h" -#include "Doc/ProviderRequestDoc/CProviderCollectSchemaRequestDoc.h" -#include "Doc/ProviderRequestDoc/CProviderRequestDoc.h" -#include "Doc/ProviderRequestDoc/CProviderRequestHeaderDoc.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "Memory/DynamicArray/DynamicArrayInc.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/IMessageSplitter.h" - -namespace Caf { - -// Moved the following typedefs from the class because Windows produced -// the warning "decorated name length exceeded, name was truncated" because -// their name included CSinglePmeRequestSplitterInstance. -struct CSplitterJob { - SmartPtrCFullyQualifiedClassGroupDoc _fqc; - SmartPtrCMgmtCollectInstancesDoc _mgmtCollectInstances; - SmartPtrCMgmtInvokeOperationDoc _mgmtInvokeOperation; -}; -CAF_DECLARE_SMART_POINTER(CSplitterJob); - -typedef std::deque CSplitterJobsCollection; -CAF_DECLARE_SMART_POINTER(CSplitterJobsCollection); - -typedef std::map CProviderJobsCollection; -CAF_DECLARE_SMART_POINTER(CProviderJobsCollection); - -class CSinglePmeRequestSplitterInstance : - public TCafSubSystemObjectRoot, - public IIntegrationObject, - public IIntegrationComponentInstance, - public IMessageSplitter { -private: - typedef std::deque CClassCollection; - CAF_DECLARE_SMART_POINTER(CClassCollection); - -public: - CSinglePmeRequestSplitterInstance(); - virtual ~CSinglePmeRequestSplitterInstance(); - - CAF_DECLARE_OBJECT_IDENTIFIER(_sObjIdSinglePmeRequestSplitterInstance) - - CAF_BEGIN_INTERFACE_MAP(CSinglePmeRequestSplitterInstance) - CAF_INTERFACE_ENTRY(IIntegrationObject) - CAF_INTERFACE_ENTRY(IIntegrationComponentInstance) - CAF_INTERFACE_ENTRY(IMessageSplitter) - CAF_END_INTERFACE_MAP() - -public: // IIntegrationObject - void initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection); - - std::string getId() const; - -public: // IIntegrationComponentInstance - void wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver); - -public: // IMessageSplitter - SmartPtrCMessageCollection splitMessage( - const SmartPtrIIntMessage& message); - -private: - SmartPtrCProviderCollectSchemaRequestDoc createCollectSchemaRequest( - const SmartPtrCMgmtRequestDoc& mgmtRequest, - const SmartPtrCMgmtCollectSchemaDoc& mgmtCollectSchema, - const SmartPtrCProviderRequestHeaderDoc& providerRequestHeader, - const std::string& outputDir) const; - - SmartPtrCProviderRequestDoc createProviderRequest( - const SmartPtrCMgmtRequestDoc& mgmtRequest, - const SmartPtrCSplitterJobsCollection& jobsCollection, - const SmartPtrCProviderRequestHeaderDoc& providerRequestHeader, - const std::string& outputDir) const; - - void addCollectInstancesJobs( - const SmartPtrCMgmtCollectInstancesCollectionDoc& mgmtCollectInstancesCollection, - SmartPtrCProviderJobsCollection& providerJobsCollection) const; - - void addInvokeOperationJobs( - const SmartPtrCMgmtInvokeOperationCollectionDoc& mgmtInvokeOperationCollection, - SmartPtrCProviderJobsCollection& providerJobsCollection) const; - - SmartPtrCClassCollection resolveClassSpecifier( - const SmartPtrCClassSpecifierDoc& classSpecifier) const; - - std::string findProviderUri( - const SmartPtrCFullyQualifiedClassGroupDoc& fqc) const; - - void createDirectory( - const std::string& directory) const; - - void saveRequest( - const std::string& outputDir, - const SmartPtrCDynamicByteArray& payload) const; - - SmartPtrCProviderRequestHeaderDoc convertRequestHeader( - const SmartPtrCRequestHeaderDoc& requestHeader) const; - -private: - bool _isInitialized; - std::string _id; - SmartPtrCSchemaCacheManager _schemaCacheManager; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CSinglePmeRequestSplitterInstance); -}; - -} - -#endif // #ifndef CSinglePmeRequestSplitterInstance_h_ diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/include/IConfigEnv.h b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/include/IConfigEnv.h deleted file mode 100644 index f4ad39395..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/include/IConfigEnv.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Author: bwilliams - * Created: Nov 12, 2015 - * - * Copyright (C) 2015-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef _MaContracts_IConfigEnv_h_ -#define _MaContracts_IConfigEnv_h_ - - -#include "ICafObject.h" - -#include "Doc/PersistenceDoc/CPersistenceDoc.h" -#include "IPersistence.h" - -namespace Caf { - -/// TODO - describe interface -struct __declspec(novtable) -IConfigEnv : public ICafObject { - CAF_DECL_UUID("dea6cea4-9385-458e-b549-d05640382da6") - - virtual void initialize( - const SmartPtrIPersistence& persistenceRemove = SmartPtrIPersistence()) = 0; - - virtual SmartPtrCPersistenceDoc getUpdated( - const int32 timeout) = 0; - - virtual void update( - const SmartPtrCPersistenceDoc& persistence) = 0; -}; - -CAF_DECLARE_SMART_INTERFACE_POINTER(IConfigEnv); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/include/IPersistence.h b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/include/IPersistence.h deleted file mode 100644 index 44608658e..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/include/IPersistence.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Author: bwilliams - * Created: Nov 12, 2015 - * - * Copyright (C) 2015-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef _MaContracts_IPersistence_h_ -#define _MaContracts_IPersistence_h_ - - -#include "ICafObject.h" - -#include "Doc/PersistenceDoc/CPersistenceDoc.h" - -namespace Caf { - -/// TODO - describe interface -struct __declspec(novtable) -IPersistence : public ICafObject { - CAF_DECL_UUID("5b48f8ef-7023-4583-9d2d-b15ae566b0cc") - - virtual void initialize() = 0; - - virtual SmartPtrCPersistenceDoc getUpdated( - const int32 timeout) = 0; - - virtual void update( - const SmartPtrCPersistenceDoc& persistence) = 0; - - virtual void remove( - const SmartPtrCPersistenceDoc& persistence) = 0; -}; - -CAF_DECLARE_SMART_INTERFACE_POINTER(IPersistence); - -} - -#endif diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/include/MaIntegration.h b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/include/MaIntegration.h deleted file mode 100644 index 9a8b5f8c2..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/include/MaIntegration.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Created on: Nov 11, 2015 - * Author: bwilliams - * - * Copyright (C) 2015-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef _MaIntegration_h_ -#define _MaIntegration_h_ - -namespace Caf { - -/** @brief CAF AMQP Integration */ -namespace MaIntegration { - extern const char* _sObjIdIntegrationObjects; -}} - -namespace Caf { - extern const char* _sObjIdCollectSchemaExecutor; - extern const char* _sObjIdProviderCollectSchemaExecutor; - extern const char* _sObjIdProviderExecutor; - extern const char* _sObjIdSinglePmeRequestSplitterInstance; - extern const char* _sObjIdSinglePmeRequestSplitter; - extern const char* _sObjIdDiagToMgmtRequestTransformerInstance; - extern const char* _sObjIdDiagToMgmtRequestTransformer; - extern const char* _sObjIdInstallToMgmtRequestTransformerInstance; - extern const char* _sObjIdInstallToMgmtRequestTransformer; - - extern const char* _sObjIdAttachmentRequestTransformerInstance; - extern const char* _sObjIdAttachmentRequestTransformer; - extern const char* _sObjIdVersionTransformerInstance; - extern const char* _sObjIdVersionTransformer; - - extern const char* _sObjIdPersistenceNamespaceDb; - extern const char* _sObjIdConfigEnv; -} - -#endif /* _MaIntegration_h_ */ diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CAttachmentRequestTransformer.cpp b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CAttachmentRequestTransformer.cpp deleted file mode 100644 index 9fb838779..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CAttachmentRequestTransformer.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Integration/IDocument.h" -#include "Integration/IIntegrationObject.h" -#include "CAttachmentRequestTransformer.h" - -using namespace Caf; - -CAttachmentRequestTransformer::CAttachmentRequestTransformer() : - _isInitialized(false), - CAF_CM_INIT_LOG("CAttachmentRequestTransformer") { -} - -CAttachmentRequestTransformer::~CAttachmentRequestTransformer() { -} - -void CAttachmentRequestTransformer::initializeBean( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties) { - - CAF_CM_FUNCNAME_VALIDATE("initializeBean"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STL_EMPTY(ctorArgs); - CAF_CM_VALIDATE_STL_EMPTY(properties); - _ctorArgs = ctorArgs; - _properties = properties; - initialize(); - } - CAF_CM_EXIT; -} - -void CAttachmentRequestTransformer::terminateBean() { -} - -void CAttachmentRequestTransformer::initialize() { - - CAF_CM_FUNCNAME_VALIDATE("initialize"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - _isInitialized = true; - } - CAF_CM_EXIT; -} - -bool CAttachmentRequestTransformer::isResponsible( - const SmartPtrIDocument& configSection) const { - CAF_CM_FUNCNAME_VALIDATE("isResponsible"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - } - CAF_CM_EXIT; - - return false; -} - -SmartPtrIIntegrationObject CAttachmentRequestTransformer::createObject( - const SmartPtrIDocument& configSection) const { - CAF_CM_FUNCNAME_VALIDATE("createObject"); - - SmartPtrIIntegrationObject rc; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - - rc.CreateInstance(_sObjIdAttachmentRequestTransformerInstance); - rc->initialize(_ctorArgs, _properties, configSection); - } - CAF_CM_EXIT; - - return rc; -} diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CAttachmentRequestTransformer.h b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CAttachmentRequestTransformer.h deleted file mode 100644 index 76fcbf80d..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CAttachmentRequestTransformer.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CAttachmentRequestTransformer_h_ -#define CAttachmentRequestTransformer_h_ - - -#include "IBean.h" - -#include "Integration/IDocument.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/IIntegrationComponent.h" - -namespace Caf { - -/// Sends responses/errors back to the client. -class CAttachmentRequestTransformer : - public TCafSubSystemObjectRoot, - public IBean, - public IIntegrationComponent { -public: - CAttachmentRequestTransformer(); - virtual ~CAttachmentRequestTransformer(); - - CAF_DECLARE_OBJECT_IDENTIFIER(_sObjIdAttachmentRequestTransformer) - - CAF_BEGIN_INTERFACE_MAP(CAttachmentRequestTransformer) - CAF_INTERFACE_ENTRY(IBean) - CAF_INTERFACE_ENTRY(IIntegrationComponent) - CAF_END_INTERFACE_MAP() - -public: - virtual void initialize(); - -public: // IBean - virtual void initializeBean(const IBean::Cargs& ctorArgs, const IBean::Cprops& properties); - - virtual void terminateBean(); - -public: // IIntegrationComponent - bool isResponsible( - const SmartPtrIDocument& configSection) const; - - SmartPtrIIntegrationObject createObject( - const SmartPtrIDocument& configSection) const; - -private: - bool _isInitialized; - IBean::Cargs _ctorArgs; - IBean::Cprops _properties; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CAttachmentRequestTransformer); -}; - -} - -#endif // #ifndef CAttachmentRequestTransformer_h_ diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CAttachmentRequestTransformerInstance.cpp b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CAttachmentRequestTransformerInstance.cpp deleted file mode 100644 index b3ae62a28..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CAttachmentRequestTransformerInstance.cpp +++ /dev/null @@ -1,247 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Common/IAppContext.h" -#include "Doc/CafCoreTypesDoc/CAttachmentDoc.h" -#include "Doc/PayloadEnvelopeDoc/CPayloadEnvelopeDoc.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "CAttachmentRequestTransformerInstance.h" -#include "Exception/CCafException.h" -#include "Integration/Caf/CCafMessagePayloadParser.h" -#include "Integration/Caf/CCafMessageCreator.h" - -using namespace Caf; - -CAttachmentRequestTransformerInstance::CAttachmentRequestTransformerInstance() : - _isInitialized(false), - CAF_CM_INIT_LOG("CAttachmentRequestTransformerInstance") { -} - -CAttachmentRequestTransformerInstance::~CAttachmentRequestTransformerInstance() { -} - -void CAttachmentRequestTransformerInstance::initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection) { - - CAF_CM_FUNCNAME_VALIDATE("initialize"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - - _id = configSection->findRequiredAttribute("id"); - - _isInitialized = true; - } - CAF_CM_EXIT; -} - -std::string CAttachmentRequestTransformerInstance::getId() const { - CAF_CM_FUNCNAME_VALIDATE("getId"); - - std::string rc; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - rc = _id; - } - CAF_CM_EXIT; - - return rc; -} - -void CAttachmentRequestTransformerInstance::wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver) { - CAF_CM_FUNCNAME_VALIDATE("wire"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(appContext); - CAF_CM_VALIDATE_INTERFACE(channelResolver); - } - CAF_CM_EXIT; -} - -SmartPtrIIntMessage CAttachmentRequestTransformerInstance::transformMessage( - const SmartPtrIIntMessage& message) { - CAF_CM_FUNCNAME_VALIDATE("transformMessage"); - - SmartPtrIIntMessage newMessage; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - newMessage = message; - - const SmartPtrCPayloadEnvelopeDoc payloadEnvelope = - CCafMessagePayloadParser::getPayloadEnvelope(message->getPayload()); - - // The standard is for an optional attachment collection at the root of all - // documents. - const std::deque attachmentCollection = - payloadEnvelope->getAttachmentCollection()->getAttachment(); - - if (! attachmentCollection.empty()) { - const std::string outputDirPath = calcOutputDirPath(payloadEnvelope); - - std::deque newAttachmentCollection; - for (TConstIterator > attachmentIter(attachmentCollection); - attachmentIter; attachmentIter++) { - const SmartPtrCAttachmentDoc attachment = *attachmentIter; - const std::string attachmentName = attachment->getName(); - const std::string attachmentUri = attachment->getUri(); - - UriUtils::SUriRecord uriRecord; - UriUtils::parseUriString(attachmentUri, uriRecord); - - SmartPtrCAttachmentDoc newAttachment = attachment; - if(uriRecord.protocol.compare("file") == 0) { - const std::string origFilePath = calcFilePath(uriRecord); - const std::string relPath = calcRelPath(origFilePath, uriRecord); - const std::string newFilePath = FileSystemUtils::buildPath( - outputDirPath, relPath); - - if (origFilePath.compare(newFilePath) == 0) { - CAF_CM_LOG_DEBUG_VA1("File path unchanged... no-op - %s", newFilePath.c_str()); - } else { - moveFile(origFilePath, newFilePath); - - const std::string newUri = "file:///" + newFilePath + "?relPath=" + relPath; - - newAttachment.CreateInstance(); - newAttachment->initialize(attachment->getName(), - attachment->getType(), newUri, false, - attachment->getCmsPolicy()); - } - } - - newAttachmentCollection.push_back(newAttachment); - } - - newMessage = CCafMessageCreator::createPayloadEnvelope( - payloadEnvelope, newAttachmentCollection, message->getHeaders()); - } - } - CAF_CM_EXIT; - - return newMessage; -} - -std::string CAttachmentRequestTransformerInstance::calcOutputDirPath( - const SmartPtrCPayloadEnvelopeDoc& payloadEnvelope) const { - CAF_CM_FUNCNAME_VALIDATE("calcOutputDirPath"); - - std::string outputDirPath; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_SMARTPTR(payloadEnvelope); - - const std::string clientIdStr = - BasePlatform::UuidToString(payloadEnvelope->getClientId()); - const std::string requestIdStr = - BasePlatform::UuidToString(payloadEnvelope->getRequestId()); - const std::string pmeIdStr = payloadEnvelope->getPmeId(); - - const std::string outputDir = AppConfigUtils::getRequiredString(_sConfigOutputDir); - - outputDirPath = FileSystemUtils::buildPath( - outputDir, "att", clientIdStr, requestIdStr, pmeIdStr); - - outputDirPath = CStringUtils::expandEnv(outputDirPath); - if (! FileSystemUtils::doesDirectoryExist(outputDirPath)) { - CAF_CM_LOG_DEBUG_VA1("Creating output directory - %s", outputDirPath.c_str()); - FileSystemUtils::createDirectory(outputDirPath); - } - } - CAF_CM_EXIT; - - return outputDirPath; -} - -std::string CAttachmentRequestTransformerInstance::calcFilePath( - const UriUtils::SUriRecord& uriRecord) const { - CAF_CM_FUNCNAME("calcFilePath"); - - std::string filePath; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - UriUtils::SFileUriRecord fileUriRecord; - UriUtils::parseFileAddress(uriRecord.address, fileUriRecord); - - filePath = CStringUtils::expandEnv(fileUriRecord.path); - if(! FileSystemUtils::doesFileExist(filePath)) { - CAF_CM_EXCEPTIONEX_VA1(FileNotFoundException, ERROR_FILE_NOT_FOUND, - "URI file not found - %s", filePath.c_str()); - } - } - CAF_CM_EXIT; - - return filePath; -} - -std::string CAttachmentRequestTransformerInstance::calcRelPath( - const std::string& filePath, - const UriUtils::SUriRecord& uriRecord) const { - CAF_CM_FUNCNAME_VALIDATE("calcRelPath"); - - std::string relPath; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - const std::map::const_iterator iterParam = - uriRecord.parameters.find("relPath"); - if (iterParam != uriRecord.parameters.end()) { - relPath = iterParam->second; - } else { - CAF_CM_LOG_DEBUG_VA1("Attachment URI does not contain relPath - %s", uriRecord.address.c_str()); - CAF_CM_VALIDATE_STRING(filePath); - relPath = FileSystemUtils::getBasename(filePath); - } - } - CAF_CM_EXIT; - - return relPath; -} - -void CAttachmentRequestTransformerInstance::moveFile( - const std::string& srcFilePath, - const std::string& dstFilePath) const { - CAF_CM_FUNCNAME_VALIDATE("moveFile"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(srcFilePath); - CAF_CM_VALIDATE_STRING(dstFilePath); - - if (FileSystemUtils::doesFileExist(dstFilePath)) { - CAF_CM_LOG_WARN_VA1("File already exists - %s", dstFilePath.c_str()); - } else { - const std::string newDirPath = FileSystemUtils::getDirname(dstFilePath); - if (! FileSystemUtils::doesDirectoryExist(newDirPath)) { - CAF_CM_LOG_DEBUG_VA1("Creating input directory - %s", newDirPath.c_str()); - FileSystemUtils::createDirectory(newDirPath); - } - - CAF_CM_LOG_DEBUG_VA2("Moving file - \"%s\" to \"%s\"", - srcFilePath.c_str(), dstFilePath.c_str()); - - FileSystemUtils::moveFile(srcFilePath, dstFilePath); - } - } - CAF_CM_EXIT; -} diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CCollectSchemaExecutor.cpp b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CCollectSchemaExecutor.cpp deleted file mode 100644 index 54e3f42c2..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CCollectSchemaExecutor.cpp +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Doc/DocXml/ProviderRequestXml/ProviderRequestXmlRoots.h" - -#include "Integration/Caf/CCafMessageHeaders.h" -#include "Common/CLoggingSetter.h" -#include "Doc/ProviderRequestDoc/CProviderCollectSchemaRequestDoc.h" -#include "Doc/ResponseDoc/CResponseDoc.h" -#include "Integration/IIntMessage.h" -#include "CCollectSchemaExecutor.h" -#include "CResponseFactory.h" -#include "Integration/Caf/CCafMessageCreator.h" - -using namespace Caf; - -CCollectSchemaExecutor::CCollectSchemaExecutor() : - _isInitialized(false), - CAF_CM_INIT_LOG("CCollectSchemaExecutor") { -} - -CCollectSchemaExecutor::~CCollectSchemaExecutor() -{ -} - -void CCollectSchemaExecutor::initializeBean( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties) { - - CAF_CM_FUNCNAME_VALIDATE("initializeBean"); - - CAF_CM_ENTER - { - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STL_EMPTY(ctorArgs); - CAF_CM_VALIDATE_STL_EMPTY(properties); - - const std::string schemaCacheDirPath = - AppConfigUtils::getRequiredString(_sProviderHostArea, _sConfigSchemaCacheDir); - const std::string schemaCacheDirPathExp = CStringUtils::expandEnv(schemaCacheDirPath); - if (!FileSystemUtils::doesDirectoryExist(schemaCacheDirPathExp)) { - CAF_CM_LOG_INFO_VA1( - "Schema cache directory does not exist... creating - %s", - schemaCacheDirPathExp.c_str()); - FileSystemUtils::createDirectory(schemaCacheDirPathExp); - } - - _schemaCacheDirPath = schemaCacheDirPathExp; - _isInitialized = true; - } - CAF_CM_EXIT; -} - -void CCollectSchemaExecutor::terminateBean() { - -} - -SmartPtrIIntMessage CCollectSchemaExecutor::processMessage( - const SmartPtrIIntMessage& message) { - CAF_CM_FUNCNAME_VALIDATE("processMessage"); - - SmartPtrIIntMessage newMessage; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(message); - - CAF_CM_LOG_DEBUG_VA1("Called - schemaCacheDirPath: %s", _schemaCacheDirPath.c_str()); - - const SmartPtrCCafMessageHeaders cafMessageHeaders = - CCafMessageHeaders::create(message->getHeaders()); - - const std::string configOutputDir = - AppConfigUtils::getRequiredString(_sConfigOutputDir); - const std::string relDirectory = cafMessageHeaders->getRelDirectory(); - const std::string outputDir = FileSystemUtils::buildPath( - configOutputDir, _sProviderHostArea, relDirectory); - - SmartPtrCLoggingSetter loggingSetter; - loggingSetter.CreateInstance(); - loggingSetter->initialize(outputDir); - - const std::string providerCollectSchemaMem = message->getPayloadStr(); - const SmartPtrCProviderCollectSchemaRequestDoc providerCollectSchemaRequest = - XmlRoots::parseProviderCollectSchemaRequestFromString(providerCollectSchemaMem); - - CAF_CM_LOG_DEBUG_VA2("Copying directory from \"%s\" to \"%s\"", - _schemaCacheDirPath.c_str(), outputDir.c_str()); - FileSystemUtils::recursiveCopyDirectory(_schemaCacheDirPath, outputDir); - - const SmartPtrCResponseDoc response = - CResponseFactory::createResponse(providerCollectSchemaRequest, outputDir, - _schemaCacheDirPath); - - const std::string randomUuidStr = CStringUtils::createRandomUuid(); - const std::string relFilename = randomUuidStr + "_" + _sResponseFilename; - - newMessage = CCafMessageCreator::createPayloadEnvelope( - response, relFilename, message->getHeaders()); - } - CAF_CM_EXIT; - - return newMessage; -} diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CCollectSchemaExecutor.h b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CCollectSchemaExecutor.h deleted file mode 100644 index 7f21706c1..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CCollectSchemaExecutor.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CCollectSchemaExecutor_h_ -#define CCollectSchemaExecutor_h_ - - -#include "IBean.h" - -#include "Integration/IIntMessage.h" -#include "Integration/IMessageProcessor.h" - -using namespace Caf; - -/// TODO - describe class -class CCollectSchemaExecutor : - public TCafSubSystemObjectRoot, - public IBean, - public IMessageProcessor { -public: - CCollectSchemaExecutor(); - virtual ~CCollectSchemaExecutor(); - - CAF_DECLARE_OBJECT_IDENTIFIER(_sObjIdCollectSchemaExecutor) - - CAF_BEGIN_INTERFACE_MAP(CCollectSchemaExecutor) - CAF_INTERFACE_ENTRY(IBean) - CAF_INTERFACE_ENTRY(IMessageProcessor) - CAF_END_INTERFACE_MAP() - -public: // IBean - virtual void initializeBean( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties); - - virtual void terminateBean(); - -public: // IMessageProcessor - SmartPtrIIntMessage processMessage( - const SmartPtrIIntMessage& message); - -private: - bool _isInitialized; - std::string _schemaCacheDirPath; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CCollectSchemaExecutor); -}; - -#endif // #ifndef CCollectSchemaExecutor_h_ diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CConfigEnv.cpp b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CConfigEnv.cpp deleted file mode 100644 index f1553f739..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CConfigEnv.cpp +++ /dev/null @@ -1,248 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2017 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Doc/PersistenceDoc/CLocalSecurityDoc.h" -#include "Doc/PersistenceDoc/CPersistenceDoc.h" -#include "Doc/PersistenceDoc/CPersistenceProtocolDoc.h" -#include "IPersistence.h" -#include "Exception/CCafException.h" -#include "CConfigEnv.h" - -using namespace Caf; - -CConfigEnv::CConfigEnv() : - _isInitialized(false), - CAF_CM_INIT_LOG("CConfigEnv") { - CAF_CM_INIT_THREADSAFE; -} - -CConfigEnv::~CConfigEnv() { -} - -void CConfigEnv::initializeBean( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties) { -} - -void CConfigEnv::terminateBean() { -} - -void CConfigEnv::initialize( - const SmartPtrIPersistence& persistenceRemove) { - CAF_CM_LOCK_UNLOCK; - - if (_isInitialized) { - if (! persistenceRemove.IsNull() && _persistenceRemove.IsNull()) { - _persistenceRemove = persistenceRemove; - } - } else { - _monitorListener.CreateInstance(); - _monitorListener->initialize(); - - _persistenceRemove = persistenceRemove; - - _persistenceDir = AppConfigUtils::getRequiredString("persistence_dir"); - - _configDir = AppConfigUtils::getRequiredString("config_dir"); - _persistenceAppconfigPath = FileSystemUtils::buildPath(_configDir, "persistence-appconfig"); - - _monitorDir = AppConfigUtils::getRequiredString("monitor_dir"); - _restartListenerPath = FileSystemUtils::buildPath(_monitorDir, "restartListener.txt"); - _listenerConfiguredStage1Path = FileSystemUtils::buildPath( - _monitorDir, "listenerConfiguredStage1.txt"); - _listenerConfiguredStage2Path = FileSystemUtils::buildPath( - _monitorDir, "listenerConfiguredStage2.txt"); - - std::string guestProxyDir; -#ifdef _WIN32 - std::string programData; - CEnvironmentUtils::readEnvironmentVar("ProgramData", programData); - guestProxyDir = FileSystemUtils::buildPath(programData, "VMware", "VMware Tools", "GuestProxyData"); -#else - guestProxyDir = "/etc/vmware-tools/GuestProxyData"; -#endif - - _vcidPath = FileSystemUtils::buildPath(guestProxyDir, "VmVcUuid", "vm.vc.uuid"); - _cacertPath = FileSystemUtils::buildPath(guestProxyDir, "server", "cert.pem"); - - _isInitialized = true; - } -} - -SmartPtrCPersistenceDoc CConfigEnv::getUpdated( - const int32 timeout) { - CAF_CM_FUNCNAME_VALIDATE("getUpdated"); - CAF_CM_LOCK_UNLOCK; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - bool preConfigDoneNow = _monitorListener->preConfigureListener(); - if (FileSystemUtils::doesFileExist(_listenerConfiguredStage1Path)) { - if (_persistence.IsNull() || preConfigDoneNow) { - _persistence = CPersistenceUtils::loadPersistence(_persistenceDir); - if (FileSystemUtils::doesFileExist(_listenerConfiguredStage2Path)) { - _persistenceUpdated = _persistence; - } - } - - SmartPtrCPersistenceDoc persistenceTmp; - if (preConfigDoneNow) { - persistenceTmp = CConfigEnvMerge::mergePersistence( - _persistence, _cacertPath, _vcidPath); - } - if (! persistenceTmp.IsNull()) { - CPersistenceUtils::savePersistence(persistenceTmp, _persistenceDir); - _persistence = CPersistenceUtils::loadPersistence(_persistenceDir); - _persistenceUpdated = _persistence; - - savePersistenceAppconfig(_persistence, _configDir); - - const std::string reason = "Info changed in env"; - listenerConfiguredStage2(reason); - restartListener(reason); - } - } - - SmartPtrCPersistenceDoc rc; - if (! _persistenceUpdated.IsNull()) { - CAF_CM_LOG_DEBUG_VA1("Returning persistence info - %s", _persistenceDir.c_str()); - rc = _persistenceUpdated; - _persistenceUpdated = SmartPtrCPersistenceDoc(); - } - - return rc; -} - -void CConfigEnv::update( - const SmartPtrCPersistenceDoc& persistence) { - CAF_CM_FUNCNAME_VALIDATE("update"); - CAF_CM_LOCK_UNLOCK; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - getUpdated(0); - - const SmartPtrCPersistenceDoc persistenceTmp1 = - CPersistenceMerge::mergePersistence(_persistence, persistence); - - const SmartPtrCPersistenceDoc persistenceIn = persistenceTmp1.IsNull() ? _persistence : persistenceTmp1; - const SmartPtrCPersistenceDoc persistenceTmp2 = - CConfigEnvMerge::mergePersistence(persistenceIn, _cacertPath, _vcidPath); - - const SmartPtrCPersistenceDoc persistenceTmp = persistenceTmp2.IsNull() ? persistenceTmp1 : persistenceTmp2; - - if (! persistenceTmp.IsNull()) { - CPersistenceUtils::savePersistence(persistenceTmp, _persistenceDir); - _persistence = CPersistenceUtils::loadPersistence(_persistenceDir); - _persistenceUpdated = _persistence; - - savePersistenceAppconfig(_persistence, _configDir); - removePrivateKey(_persistence, _persistenceRemove); - - const std::string reason = "Info changed at source"; - listenerConfiguredStage1(reason); - listenerConfiguredStage2(reason); - restartListener(reason); - } -} - -void CConfigEnv::savePersistenceAppconfig( - const SmartPtrCPersistenceDoc& persistence, - const std::string& configDir) const { - CAF_CM_FUNCNAME_VALIDATE("savePersistenceAppconfig"); - CAF_CM_VALIDATE_SMARTPTR(persistence); - CAF_CM_VALIDATE_STRING(configDir); - - const SmartPtrCPersistenceProtocolDoc persistenceProtocol = - CPersistenceUtils::loadPersistenceProtocol( - persistence->getPersistenceProtocolCollection()); - if (persistenceProtocol.IsNull() || persistenceProtocol->getUri().empty()) { - CAF_CM_LOG_DEBUG_VA1( - "Can't create persistence-appconfig until protocol is established - %s", - configDir.c_str()); - } else { -#ifdef WIN32 - const std::string newLine = "\r\n"; -#else - const std::string newLine = "\n"; -#endif - - CAF_CM_LOG_DEBUG_VA1("Saving persistence-appconfig - %s", configDir.c_str()); - - UriUtils::SUriRecord uriRecord; - UriUtils::parseUriString(persistenceProtocol->getUri(), uriRecord); - CAF_CM_VALIDATE_STRING(uriRecord.path); - - const std::string listenerContext = calcListenerContext(uriRecord.protocol, configDir); - - CAF_CM_LOG_DEBUG_VA2("Calculated listener context - uri: %s, protocol: %s", - persistenceProtocol->getUri().c_str(), uriRecord.protocol.c_str()); - - std::string appconfigContents; - appconfigContents = "[globals]" + newLine; - appconfigContents += "reactive_request_amqp_queue_id=" + uriRecord.path + newLine; - appconfigContents += "comm_amqp_listener_context=" + listenerContext + newLine; - - FileSystemUtils::saveTextFile(_persistenceAppconfigPath, appconfigContents); - } -} - -void CConfigEnv::removePrivateKey( - const SmartPtrCPersistenceDoc& persistence, - const SmartPtrIPersistence& persistenceRemove) const { - CAF_CM_FUNCNAME_VALIDATE("removePrivateKey"); - CAF_CM_VALIDATE_SMARTPTR(persistence); - - if (! persistenceRemove.IsNull() - && ! persistence->getLocalSecurity()->getPrivateKey().empty()) { - CAF_CM_LOG_DEBUG_VA0("Removing private key"); - - SmartPtrCLocalSecurityDoc localSecurity; - localSecurity.CreateInstance(); - localSecurity->initialize(std::string(), "removePrivateKey"); - - SmartPtrCPersistenceDoc persistenceRemoveTmp; - persistenceRemoveTmp.CreateInstance(); - persistenceRemoveTmp->initialize(localSecurity); - - persistenceRemove->remove(persistenceRemoveTmp); - } -} - -std::string CConfigEnv::calcListenerContext( - const std::string& uriSchema, - const std::string& configDir) const { - CAF_CM_FUNCNAME("calcListenerContext"); - CAF_CM_VALIDATE_STRING(uriSchema); - CAF_CM_VALIDATE_STRING(configDir); - - std::string rc; - if (uriSchema.compare("amqp") == 0) { - rc = FileSystemUtils::buildPath(configDir, "CommAmqpListener-context-amqp.xml"); - } else if (uriSchema.compare("tunnel") == 0) { - rc = FileSystemUtils::buildPath(configDir, "CommAmqpListener-context-tunnel.xml"); - } else { - CAF_CM_EXCEPTION_VA1(E_INVALIDARG, "Unknown URI schema: %s", uriSchema.c_str()); - } - - return FileSystemUtils::normalizePathWithForward(rc); -} - -void CConfigEnv::restartListener( - const std::string& reason) const { - FileSystemUtils::saveTextFile(_restartListenerPath, reason); -} - -void CConfigEnv::listenerConfiguredStage1( - const std::string& reason) const { - FileSystemUtils::saveTextFile(_listenerConfiguredStage1Path, reason); -} - -void CConfigEnv::listenerConfiguredStage2( - const std::string& reason) const { - FileSystemUtils::saveTextFile(_listenerConfiguredStage2Path, reason); -} diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CConfigEnv.h b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CConfigEnv.h deleted file mode 100644 index 2b661b35d..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CConfigEnv.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2017 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef _MaIntegration_CConfigEnv_h_ -#define _MaIntegration_CConfigEnv_h_ - - -#include "IBean.h" - -#include "Doc/PersistenceDoc/CPersistenceDoc.h" -#include "IPersistence.h" -#include "IConfigEnv.h" - -using namespace Caf; - -/// TODO - describe class -class CConfigEnv : - public TCafSubSystemObjectRoot, - public IBean, - public IConfigEnv { -public: - CConfigEnv(); - virtual ~CConfigEnv(); - - CAF_DECLARE_OBJECT_IDENTIFIER(_sObjIdConfigEnv) - - CAF_BEGIN_INTERFACE_MAP(CConfigEnv) - CAF_INTERFACE_ENTRY(IBean) - CAF_INTERFACE_ENTRY(IConfigEnv) - CAF_END_INTERFACE_MAP() - -public: // IBean - virtual void initializeBean( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties); - - virtual void terminateBean(); - -public: // IConfigEnv - void initialize( - const SmartPtrIPersistence& persistenceRemove); - - SmartPtrCPersistenceDoc getUpdated( - const int32 timeout); - - void update( - const SmartPtrCPersistenceDoc& persistence); - -private: - void savePersistenceAppconfig( - const SmartPtrCPersistenceDoc& persistence, - const std::string& configDir) const; - - void executeScript( - const std::string& scriptPath, - const std::string& scriptResultsDir) const; - - void removePrivateKey( - const SmartPtrCPersistenceDoc& persistence, - const SmartPtrIPersistence& persistenceRemove) const; - - std::string calcListenerContext( - const std::string& uriSchema, - const std::string& configDir) const; - - void restartListener( - const std::string& reason) const; - - void listenerConfiguredStage1( - const std::string& reason) const; - - void listenerConfiguredStage2( - const std::string& reason) const; - -private: - bool _isInitialized; - std::string _persistenceDir; - std::string _configDir; - std::string _persistenceAppconfigPath; - std::string _monitorDir; - std::string _restartListenerPath; - std::string _listenerConfiguredStage1Path; - std::string _listenerConfiguredStage2Path; - std::string _vcidPath; - std::string _cacertPath; - - SmartPtrCPersistenceDoc _persistence; - SmartPtrCPersistenceDoc _persistenceUpdated; - SmartPtrIPersistence _persistenceRemove; - SmartPtrCMonitorListener _monitorListener; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_CREATE_THREADSAFE; - CAF_CM_DECLARE_NOCOPY(CConfigEnv); -}; - -#endif // #ifndef _MaIntegration_CConfigEnv_h_ diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CConfigEnvInboundChannelAdapterInstance.cpp b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CConfigEnvInboundChannelAdapterInstance.cpp deleted file mode 100644 index a780e8522..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CConfigEnvInboundChannelAdapterInstance.cpp +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "CConfigEnvReadingMessageSource.h" -#include "Common/IAppContext.h" -#include "IBean.h" -#include "IConfigEnv.h" -#include "Integration/Core/CErrorHandler.h" -#include "Integration/Core/CMessageHandler.h" -#include "Integration/Core/CSimpleAsyncTaskExecutor.h" -#include "Integration/Core/CSourcePollingChannelAdapter.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IMessageChannel.h" -#include "CConfigEnvInboundChannelAdapterInstance.h" - -using namespace Caf; - -CConfigEnvInboundChannelAdapterInstance::CConfigEnvInboundChannelAdapterInstance() : - _isInitialized(false), - CAF_CM_INIT_LOG("CConfigEnvInboundChannelAdapterInstance") { -} - -CConfigEnvInboundChannelAdapterInstance::~CConfigEnvInboundChannelAdapterInstance() { -} - -void CConfigEnvInboundChannelAdapterInstance::initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - - _configSection = configSection; - _id = _configSection->findRequiredAttribute("id"); - - _isInitialized = true; -} - -std::string CConfigEnvInboundChannelAdapterInstance::getId() const { - CAF_CM_FUNCNAME_VALIDATE("getId"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _id; -} - -void CConfigEnvInboundChannelAdapterInstance::wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver) { - CAF_CM_FUNCNAME_VALIDATE("wire"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(appContext); - CAF_CM_VALIDATE_INTERFACE(channelResolver); - - const std::string outputChannelStr = - _configSection->findRequiredAttribute("channel"); - - const SmartPtrIConfigEnv configEnv = createConfigEnv(appContext); - - SmartPtrCConfigEnvReadingMessageSource configEnvReadingMessageSource; - configEnvReadingMessageSource.CreateInstance(); - configEnvReadingMessageSource->initialize(_configSection, configEnv); - - const SmartPtrIMessageChannel outputMessageChannel = - channelResolver->resolveChannelName(outputChannelStr); - const SmartPtrIMessageChannel errorMessageChannel = - channelResolver->resolveChannelName("errorChannel"); - - SmartPtrCMessageHandler messageHandler; - messageHandler.CreateInstance(); - messageHandler->initialize( - _id, - outputMessageChannel, - SmartPtrICafObject()); - - SmartPtrCErrorHandler errorHandler; - errorHandler.CreateInstance(); - errorHandler->initialize(channelResolver, errorMessageChannel); - - SmartPtrCSourcePollingChannelAdapter sourcePollingChannelAdapter; - sourcePollingChannelAdapter.CreateInstance(); - sourcePollingChannelAdapter->initialize( - messageHandler, configEnvReadingMessageSource, errorHandler); - - SmartPtrCSimpleAsyncTaskExecutor simpleAsyncTaskExecutor; - simpleAsyncTaskExecutor.CreateInstance(); - simpleAsyncTaskExecutor->initialize(sourcePollingChannelAdapter, errorHandler); - _taskExecutor = simpleAsyncTaskExecutor; -} - -void CConfigEnvInboundChannelAdapterInstance::start( - const uint32 timeoutMs) { - CAF_CM_FUNCNAME_VALIDATE("start"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - CAF_CM_LOG_DEBUG_VA0("Starting the executor"); - _taskExecutor->execute(timeoutMs); -} - -void CConfigEnvInboundChannelAdapterInstance::stop( - const uint32 timeoutMs) { - CAF_CM_FUNCNAME_VALIDATE("stop"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - CAF_CM_LOG_DEBUG_VA0("Stopping the executor"); - _taskExecutor->cancel(timeoutMs); -} - -bool CConfigEnvInboundChannelAdapterInstance::isRunning() const { - CAF_CM_FUNCNAME_VALIDATE("isRunning"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - const bool rc = (_taskExecutor->getState() == ITaskExecutor::ETaskStateStarted); - return rc; -} - -bool CConfigEnvInboundChannelAdapterInstance::isMessageProducer() const { - CAF_CM_FUNCNAME_VALIDATE("isMessageProducer"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return true; -} - -SmartPtrIConfigEnv CConfigEnvInboundChannelAdapterInstance::createConfigEnv( - const SmartPtrIAppContext& appContext) const { - CAF_CM_FUNCNAME_VALIDATE("createConfigEnv"); - CAF_CM_VALIDATE_INTERFACE(appContext); - - SmartPtrIConfigEnv rc; - const std::string refStr = _configSection->findRequiredAttribute("ref"); - CAF_CM_LOG_DEBUG_VA1("Creating the configenv impl - %s", refStr.c_str()); - const SmartPtrIBean bean = appContext->getBean(refStr); - rc.QueryInterface(bean, false); - CAF_CM_VALIDATE_INTERFACE(rc); - rc->initialize(); - - return rc; -} diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CConfigEnvInboundChannelAdapterInstance.h b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CConfigEnvInboundChannelAdapterInstance.h deleted file mode 100644 index 608b6eec0..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CConfigEnvInboundChannelAdapterInstance.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CConfigEnvInboundChannelAdapterInstance_h_ -#define CConfigEnvInboundChannelAdapterInstance_h_ - - -#include "Integration/IIntegrationComponentInstance.h" - -#include "Common/IAppContext.h" -#include "IConfigEnv.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/ITaskExecutor.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/ILifecycle.h" -#include "Integration/IMessageProducer.h" - -namespace Caf { - -class CConfigEnvInboundChannelAdapterInstance : - public IIntegrationObject, - public IIntegrationComponentInstance, - public ILifecycle, - public IMessageProducer { -public: - CConfigEnvInboundChannelAdapterInstance(); - virtual ~CConfigEnvInboundChannelAdapterInstance(); - -public: - CAF_BEGIN_QI() - CAF_QI_ENTRY(IIntegrationObject) - CAF_QI_ENTRY(IIntegrationComponentInstance) - CAF_QI_ENTRY(ILifecycle) - CAF_QI_ENTRY(IMessageProducer) - CAF_END_QI() - -public: // IIntegrationObject - void initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection); - - std::string getId() const; - -public: // IIntegrationComponentInstance - void wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver); - -public: // ILifecycle - void start(const uint32 timeoutMs); - void stop(const uint32 timeoutMs); - bool isRunning() const; - -public: // IMessageProducer - bool isMessageProducer() const; - -private: - SmartPtrIConfigEnv createConfigEnv( - const SmartPtrIAppContext& appContext) const; - -private: - bool _isInitialized; - std::string _id; - SmartPtrIDocument _configSection; - SmartPtrITaskExecutor _taskExecutor; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CConfigEnvInboundChannelAdapterInstance); -}; - -CAF_DECLARE_SMART_QI_POINTER(CConfigEnvInboundChannelAdapterInstance); - -} - -#endif // #ifndef CConfigEnvInboundChannelAdapterInstance_h_ diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CConfigEnvMerge.cpp b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CConfigEnvMerge.cpp deleted file mode 100644 index ff6ba4938..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CConfigEnvMerge.cpp +++ /dev/null @@ -1,305 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2018 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Doc/PersistenceDoc/CCertCollectionDoc.h" -#include "Doc/PersistenceDoc/CLocalSecurityDoc.h" -#include "Doc/PersistenceDoc/CPersistenceDoc.h" -#include "Doc/PersistenceDoc/CPersistenceProtocolCollectionDoc.h" -#include "Doc/PersistenceDoc/CPersistenceProtocolDoc.h" -#include "Exception/CCafException.h" -#include "CConfigEnvMerge.h" - -#ifdef WIN32 - #include - #pragma comment (lib, "wsock32.lib") -#else - #include - #include - #include -#endif - -using namespace Caf; - -SmartPtrCPersistenceDoc CConfigEnvMerge::mergePersistence( - const SmartPtrCPersistenceDoc& persistence, - const std::string& cacertPath, - const std::string& vcidPath) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CConfigEnvMerge", "mergePersistence"); - CAF_CM_VALIDATE_SMARTPTR(persistence); - CAF_CM_VALIDATE_STRING(cacertPath); - CAF_CM_VALIDATE_STRING(vcidPath); - - const std::string localId = mergeLocalId(persistence, vcidPath); - - std::string localIdDiff; - if (persistence->getLocalSecurity()->getLocalId().compare(localId) != 0) { - CAF_CM_LOG_DEBUG_VA2("LocalId changed - %s != %s", - persistence->getLocalSecurity()->getLocalId().c_str(), localId.c_str()); - localIdDiff = localId; - } - - const std::string cacert = loadTextFile(cacertPath); - - const std::deque persistenceProtocolCollectionInnerDiff = - mergePersistenceProtocolCollectionInner( - persistence->getPersistenceProtocolCollection()->getPersistenceProtocol(), - localId, cacert); - - SmartPtrCPersistenceDoc rc; - if (! localIdDiff.empty() || ! persistenceProtocolCollectionInnerDiff.empty()) { - SmartPtrCLocalSecurityDoc localSecurity = persistence->getLocalSecurity(); - if (! localIdDiff.empty()) { - CAF_CM_LOG_DEBUG_VA0("Creating local security diff"); - localSecurity.CreateInstance(); - localSecurity->initialize( - localIdDiff, - persistence->getLocalSecurity()->getPrivateKey(), - persistence->getLocalSecurity()->getCert(), - persistence->getLocalSecurity()->getPrivateKeyPath(), - persistence->getLocalSecurity()->getCertPath()); - } - - SmartPtrCPersistenceProtocolCollectionDoc persistenceProtocolCollection = - persistence->getPersistenceProtocolCollection(); - if (! persistenceProtocolCollectionInnerDiff.empty()) { - CAF_CM_LOG_DEBUG_VA0("Creating persistence protocol diff"); - persistenceProtocolCollection.CreateInstance(); - persistenceProtocolCollection->initialize(persistenceProtocolCollectionInnerDiff); - } - - rc.CreateInstance(); - rc->initialize( - localSecurity, - persistence->getRemoteSecurityCollection(), - persistenceProtocolCollection, - persistence->getVersion()); - } - - return rc; -} - -std::string CConfigEnvMerge::mergeLocalId( - const SmartPtrCPersistenceDoc& persistence, - const std::string& vcidPath) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CConfigEnvMerge", "mergeLocalId"); - CAF_CM_VALIDATE_SMARTPTR(persistence); - CAF_CM_VALIDATE_STRING(vcidPath); - - std::string rc = loadTextFile(vcidPath); - if (rc.empty()) { - if (persistence->getLocalSecurity()->getLocalId().empty()) { - rc = CStringUtils::createRandomUuid(); - } else { - rc = persistence->getLocalSecurity()->getLocalId(); - } - } - - return rc; -} - -std::deque CConfigEnvMerge::mergePersistenceProtocolCollectionInner( - const std::deque& persistenceProtocolCollectionInner, - const std::string& localId, - const std::string& cacert) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CConfigEnvMerge", "mergePersistenceProtocolCollectionInner"); - CAF_CM_VALIDATE_BOOL(persistenceProtocolCollectionInner.size() == 1); - CAF_CM_VALIDATE_STRING(localId); - - const bool isTunnelEnabled = isTunnelEnabledFunc(); - - std::deque rc; - std::deque persistenceProtocolCollectionInnerDiff; - std::deque persistenceProtocolCollectionInnerAll; - for (TConstIterator > persistenceProtocolIter(persistenceProtocolCollectionInner); - persistenceProtocolIter; persistenceProtocolIter++) { - const SmartPtrCPersistenceProtocolDoc persistenceProtocol = *persistenceProtocolIter; - - const std::string uriDiff = mergeUri(persistenceProtocol, localId, isTunnelEnabled); - const SmartPtrCCertCollectionDoc tlsCertCollectionDiff = - mergeTlsCertCollection(persistenceProtocol->getTlsCertCollection(), cacert); - - SmartPtrCPersistenceProtocolDoc persistenceProtocolDiff; - persistenceProtocolDiff.CreateInstance(); - persistenceProtocolDiff->initialize( - persistenceProtocol->getProtocolName(), - ! uriDiff.empty() ? uriDiff : persistenceProtocol->getUri(), - ! uriDiff.empty() && ! isTunnelEnabled ? uriDiff : persistenceProtocol->getUriAmqp(), - ! uriDiff.empty() && isTunnelEnabled ? uriDiff : persistenceProtocol->getUriTunnel(), - persistenceProtocol->getTlsCert(), - persistenceProtocol->getTlsProtocol(), - persistenceProtocol->getTlsCipherCollection(), - tlsCertCollectionDiff.IsNull() ? persistenceProtocol->getTlsCertCollection() : tlsCertCollectionDiff, - persistenceProtocol->getUriAmqpPath(), - persistenceProtocol->getUriTunnelPath(), - persistenceProtocol->getTlsCertPath(), - persistenceProtocol->getTlsCertPathCollection()); - persistenceProtocolCollectionInnerAll.push_back(persistenceProtocolDiff); - - CAF_CM_LOG_DEBUG_VA2("uriDiff=%s, isTunnelEnabled=%s", uriDiff.c_str(), isTunnelEnabled?"true":"false" ); - - if (! uriDiff.empty() || ! tlsCertCollectionDiff.IsNull()) { - persistenceProtocolCollectionInnerDiff.push_back(persistenceProtocolDiff); - } - } - - if (! persistenceProtocolCollectionInnerDiff.empty()) { - rc = persistenceProtocolCollectionInnerAll; - } - - return rc; -} - -std::string CConfigEnvMerge::mergeUri( - const SmartPtrCPersistenceProtocolDoc& persistenceProtocol, - const std::string& localId, - const bool isTunnelEnabled) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CConfigEnvMerge", "mergeUri"); - CAF_CM_VALIDATE_SMARTPTR(persistenceProtocol); - CAF_CM_VALIDATE_STRING(localId); - - const std::string uri = persistenceProtocol->getUri(); - const std::string uriNew = isTunnelEnabled ? - persistenceProtocol->getUriTunnel() : - persistenceProtocol->getUriAmqp(); - CAF_CM_VALIDATE_STRING(uriNew); - - CAF_CM_LOG_DEBUG_VA3("uri: %s, uriNew: %s, localId: %s", - uri.c_str(), uriNew.c_str(), localId.c_str()); - - UriUtils::SUriRecord uriDataNew; - UriUtils::parseUriString(uriNew, uriDataNew); - - std::string rc; - std::string pathNew(localId); - if (isTunnelEnabled) { - pathNew += "-agentId1"; - } - if ((uri.compare(uriNew) != 0) || (uriDataNew.path.compare(pathNew) != 0)) { - uriDataNew.path = pathNew; - rc = UriUtils::buildUriString(uriDataNew); - CAF_CM_LOG_DEBUG_VA4("uri changed - %s != %s || %s != %s", - uri.c_str(), rc.c_str(), pathNew.c_str(), uriDataNew.path.c_str()); - } - CAF_CM_LOG_DEBUG_VA1("rc: %s", rc.c_str()); - - return rc; -} - -SmartPtrCCertCollectionDoc CConfigEnvMerge::mergeTlsCertCollection( - const SmartPtrCCertCollectionDoc& tlsCertCollection, - const std::string& cacert) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CConfigEnvMerge", "mergeTlsCertCollection"); - CAF_CM_VALIDATE_SMARTPTR(tlsCertCollection); - - SmartPtrCCertCollectionDoc rc; - if (! cacert.empty()) { - const Cdeqstr tlsCertCollectionInner = tlsCertCollection->getCert(); - if (tlsCertCollectionInner.size() == 1) { - const std::string tlsCert = tlsCertCollectionInner.front(); - if (tlsCert.compare(cacert) != 0) { - CAF_CM_LOG_DEBUG_VA2("cacert changed - %s != %s", cacert.c_str(), tlsCert.c_str()); - - Cdeqstr tlsCertCollectionInnerTmp; - tlsCertCollectionInnerTmp.push_back(cacert); - - rc.CreateInstance(); - rc->initialize(tlsCertCollectionInnerTmp); - } - } - } - - return rc; -} - -bool CConfigEnvMerge::isTunnelEnabledFunc() { - CAF_CM_STATIC_FUNC_LOG("CConfigEnvMerge", "isTunnelEnabledFunc"); - - bool rc = false; - -#ifdef WIN32 - try { - WSADATA wsaData; - int result = ::WSAStartup(MAKEWORD(2, 2), &wsaData); - if (result != NO_ERROR) { - CAF_CM_EXCEPTION_VA0(E_UNEXPECTED, "WSAStartup() Failed"); - } - - SOCKADDR_IN socketClient; - memset(&socketClient, 0, sizeof(SOCKADDR_IN)); - socketClient.sin_family = AF_INET; - socketClient.sin_addr.s_addr = ::inet_addr("127.0.0.1"); - socketClient.sin_port = ::htons(6672); - - SOCKET socketFd = ::socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); - if (socketFd == INVALID_SOCKET) { - CAF_CM_EXCEPTION_VA1(E_UNEXPECTED, "Failed to open socket - %s", WSAGetLastError()); - } - - rc = (0 == ::connect(socketFd, (SOCKADDR*) &socketClient, sizeof(socketClient))); - - if (socketFd != INVALID_SOCKET) { - ::closesocket(socketFd); - } - } - CAF_CM_CATCH_CAF - CAF_CM_CATCH_DEFAULT - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_CLEAREXCEPTION; - - WSACleanup(); -#else - int socketFd = -1; - try { - socketFd = ::socket(AF_INET, SOCK_STREAM, 0); - if (socketFd < 0) { - CAF_CM_EXCEPTION_VA0(E_UNEXPECTED, "Failed to open socket"); - } - - struct sockaddr_in socketClient; - memset(&socketClient, 0, sizeof(sockaddr_in)); - socketClient.sin_family = AF_INET; - socketClient.sin_port = htons(6672); - - int result = ::inet_aton("127.0.0.1", &socketClient.sin_addr); - if (0 == result) { - CAF_CM_EXCEPTION_VA0(ERROR_PATH_NOT_FOUND, - "Failed to get address of 127.0.0.1"); - } - - rc = (0 == ::connect(socketFd, (struct sockaddr *) &socketClient, - sizeof(socketClient))); - } - CAF_CM_CATCH_CAF - CAF_CM_CATCH_DEFAULT - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_CLEAREXCEPTION; - - if (socketFd >= 0) { - ::close(socketFd); - } -#endif - - return rc; -} - -std::string CConfigEnvMerge::loadTextFile( - const std::string& path) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CConfigEnvMerge", "loadTextFile"); - CAF_CM_VALIDATE_STRING(path); - - std::string rc; - if (FileSystemUtils::doesFileExist(path)) { - rc = FileSystemUtils::loadTextFile(path); - rc = CStringUtils::trimRight(rc); - } else { - CAF_CM_LOG_DEBUG_VA1("File does not exist - %s", path.c_str()); - } - - return rc; -} diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CConfigEnvMerge.h b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CConfigEnvMerge.h deleted file mode 100644 index 806c5eda9..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CConfigEnvMerge.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2017 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef _MaIntegration_CConfigEnvMerge_h_ -#define _MaIntegration_CConfigEnvMerge_h_ - - -#include "Doc/PersistenceDoc/CCertCollectionDoc.h" -#include "Doc/PersistenceDoc/CPersistenceDoc.h" -#include "Doc/PersistenceDoc/CPersistenceProtocolDoc.h" - -using namespace Caf; - -/// TODO - describe class -class CConfigEnvMerge { -public: - static SmartPtrCPersistenceDoc mergePersistence( - const SmartPtrCPersistenceDoc& persistence, - const std::string& cacertPath, - const std::string& vcidPath); - - static bool isTunnelEnabledFunc(); - -private: - static std::deque mergePersistenceProtocolCollectionInner( - const std::deque& persistenceProtocolCollectionInner, - const std::string& localId, - const std::string& cacert); - - static std::string mergeLocalId( - const SmartPtrCPersistenceDoc& persistence, - const std::string& vcidPath); - - static std::string mergeUri( - const SmartPtrCPersistenceProtocolDoc& persistenceProtocol, - const std::string& localId, - const bool isTunnelEnabled); - - static SmartPtrCCertCollectionDoc mergeTlsCertCollection( - const SmartPtrCCertCollectionDoc& tlsCertCollection, - const std::string& cacert); - -private: - static std::string loadTextFile( - const std::string& path); - -private: - CAF_CM_DECLARE_NOCREATE(CConfigEnvMerge); -}; - -#endif // #ifndef _MaIntegration_CConfigEnvMerge_h_ diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CConfigEnvMessageHandler.cpp b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CConfigEnvMessageHandler.cpp deleted file mode 100644 index 34aa1501d..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CConfigEnvMessageHandler.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Doc/DocXml/PersistenceXml/PersistenceXmlRoots.h" - -#include "Doc/PersistenceDoc/CPersistenceDoc.h" -#include "IConfigEnv.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "CConfigEnvMessageHandler.h" - -using namespace Caf; - -CConfigEnvMessageHandler::CConfigEnvMessageHandler() : - _isInitialized(false), - CAF_CM_INIT_LOG("CConfigEnvMessageHandler") { -} - -CConfigEnvMessageHandler::~CConfigEnvMessageHandler() { -} - -void CConfigEnvMessageHandler::initialize( - const SmartPtrIDocument& configSection, - const SmartPtrIConfigEnv& configEnv) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - CAF_CM_VALIDATE_SMARTPTR(configEnv); - - _id = configSection->findRequiredAttribute("id"); - - _configEnv = configEnv; - - _isInitialized = true; -} - -void CConfigEnvMessageHandler::handleMessage( - const SmartPtrIIntMessage& message) { - CAF_CM_FUNCNAME_VALIDATE("handleMessage"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(message); - - _savedMessage = message; - - SmartPtrCPersistenceDoc persistence; - const std::string payloadStr = message->getPayloadStr(); - if (! payloadStr.empty()) { - persistence = XmlRoots::parsePersistenceFromString(payloadStr); - } - - _configEnv->update(persistence); -} - -SmartPtrIIntMessage CConfigEnvMessageHandler::getSavedMessage() const { - CAF_CM_FUNCNAME_VALIDATE("getSavedMessage"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _savedMessage; -} - -void CConfigEnvMessageHandler::clearSavedMessage() { - CAF_CM_FUNCNAME_VALIDATE("clearSavedMessage"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - _savedMessage = NULL; -} - -SmartPtrIIntMessage CConfigEnvMessageHandler::processErrorMessage( - const SmartPtrIIntMessage& message) { - CAF_CM_FUNCNAME_VALIDATE("processErrorMessage"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(message); - - _savedMessage = message; - - //TODO: Verify that I'm receiving the error message and decide what - //to do with it. - - return SmartPtrIIntMessage(); -} diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CConfigEnvMessageHandler.h b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CConfigEnvMessageHandler.h deleted file mode 100644 index c0a7f5d11..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CConfigEnvMessageHandler.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef _MaIntegration_CConfigEnvMessageHandler_h_ -#define _MaIntegration_CConfigEnvMessageHandler_h_ - - -#include "Integration/IErrorProcessor.h" - -#include "IConfigEnv.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "Integration/IMessageHandler.h" - -namespace Caf { - -class CConfigEnvMessageHandler : - public IMessageHandler, - public IErrorProcessor { -public: - CConfigEnvMessageHandler(); - virtual ~CConfigEnvMessageHandler(); - -public: - CAF_BEGIN_QI() - CAF_QI_ENTRY(IMessageHandler) - CAF_QI_ENTRY(IErrorProcessor) - CAF_END_QI() - -public: - void initialize( - const SmartPtrIDocument& configSection, - const SmartPtrIConfigEnv& configEnv); - -public: // IMessageHandler - void handleMessage( - const SmartPtrIIntMessage& message); - - SmartPtrIIntMessage getSavedMessage() const; - - void clearSavedMessage(); - -public: // IErrorProcessor - SmartPtrIIntMessage processErrorMessage( - const SmartPtrIIntMessage& message); - -private: - bool _isInitialized; - std::string _id; - SmartPtrIConfigEnv _configEnv; - SmartPtrIIntMessage _savedMessage; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CConfigEnvMessageHandler); -}; - -CAF_DECLARE_SMART_QI_POINTER(CConfigEnvMessageHandler); - -} - -#endif // #ifndef _MaIntegration_CConfigEnvMessageHandler_h_ diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CConfigEnvOutboundChannelAdapterInstance.cpp b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CConfigEnvOutboundChannelAdapterInstance.cpp deleted file mode 100644 index ddd8a5f88..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CConfigEnvOutboundChannelAdapterInstance.cpp +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "CConfigEnvMessageHandler.h" -#include "Common/IAppContext.h" -#include "IBean.h" -#include "IConfigEnv.h" -#include "IPersistence.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/IMessageChannel.h" -#include "Integration/IMessageHandler.h" -#include "CConfigEnvOutboundChannelAdapterInstance.h" - -using namespace Caf; - -CConfigEnvOutboundChannelAdapterInstance::CConfigEnvOutboundChannelAdapterInstance() : - _isInitialized(false), - _isRunning(false), - CAF_CM_INIT_LOG("CConfigEnvOutboundChannelAdapterInstance") { -} - -CConfigEnvOutboundChannelAdapterInstance::~CConfigEnvOutboundChannelAdapterInstance() { -} - -void CConfigEnvOutboundChannelAdapterInstance::initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - - _id = configSection->findRequiredAttribute("id"); - _configSection = configSection; - - _isInitialized = true; -} - -std::string CConfigEnvOutboundChannelAdapterInstance::getId() const { - CAF_CM_FUNCNAME_VALIDATE("getId"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _id; -} - -void CConfigEnvOutboundChannelAdapterInstance::wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver) { - CAF_CM_FUNCNAME_VALIDATE("wire"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(appContext); - CAF_CM_VALIDATE_INTERFACE(channelResolver); - - const SmartPtrIMessageChannel errorMessageChannel = - channelResolver->resolveChannelName("errorChannel"); - - const std::string inputChannelStr = _configSection->findRequiredAttribute("channel"); - SmartPtrIMessageChannel inputChannel = channelResolver->resolveChannelName(inputChannelStr); - SmartPtrIIntegrationObject inputChannelObj; - inputChannelObj.QueryInterface(inputChannel); - - const SmartPtrIConfigEnv configEnv = createConfigEnv(appContext); - - SmartPtrCConfigEnvMessageHandler configEnvMessageHandler; - configEnvMessageHandler.CreateInstance(); - configEnvMessageHandler->initialize(_configSection, configEnv); - SmartPtrIMessageHandler messageHandler; - messageHandler.QueryInterface(configEnvMessageHandler); - - _messagingTemplate.CreateInstance(); - _messagingTemplate->initialize( - channelResolver, - inputChannelObj, - errorMessageChannel, - SmartPtrIMessageChannel(), - messageHandler); -} - -void CConfigEnvOutboundChannelAdapterInstance::start( - const uint32 timeoutMs) { - CAF_CM_FUNCNAME_VALIDATE("start"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_BOOL(!_isRunning); - - _isRunning = true; - _messagingTemplate->start(0); -} - -void CConfigEnvOutboundChannelAdapterInstance::stop( - const uint32 timeoutMs) { - CAF_CM_FUNCNAME_VALIDATE("stop"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_BOOL(_isRunning); - - _isRunning = false; - _messagingTemplate->stop(0); -} - -bool CConfigEnvOutboundChannelAdapterInstance::isRunning() const { - CAF_CM_FUNCNAME_VALIDATE("isRunning"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _isRunning; -} - -SmartPtrIConfigEnv CConfigEnvOutboundChannelAdapterInstance::createConfigEnv( - const SmartPtrIAppContext& appContext) const { - CAF_CM_FUNCNAME_VALIDATE("createConfigEnv"); - CAF_CM_VALIDATE_INTERFACE(appContext); - - const SmartPtrIPersistence persistenceRemove = createOptPersistence(appContext); - - SmartPtrIConfigEnv rc; - const std::string refStr = _configSection->findRequiredAttribute("ref"); - CAF_CM_LOG_DEBUG_VA1("Creating the configenv impl - %s", refStr.c_str()); - const SmartPtrIBean bean = appContext->getBean(refStr); - rc.QueryInterface(bean, false); - CAF_CM_VALIDATE_INTERFACE(rc); - rc->initialize(persistenceRemove); - - return rc; -} - -SmartPtrIPersistence CConfigEnvOutboundChannelAdapterInstance::createOptPersistence( - const SmartPtrIAppContext& appContext) const { - CAF_CM_FUNCNAME("createOptPersistence"); - CAF_CM_VALIDATE_INTERFACE(appContext); - - SmartPtrIPersistence rc; - const std::string removeRefStr = _configSection->findOptionalAttribute("remove-ref"); - if (! removeRefStr.empty()) { - CAF_CM_LOG_DEBUG_VA1("Creating the persistence impl - %s", removeRefStr.c_str()); - const SmartPtrIBean bean = appContext->getBean(removeRefStr); - rc.QueryInterface(bean, false); - CAF_CM_VALIDATE_INTERFACE(rc); - - try { - rc->initialize(); - } - CAF_CM_CATCH_CAF - CAF_CM_CATCH_DEFAULT; - - if (CAF_CM_ISEXCEPTION) { - CAF_CM_LOG_WARN_VA2("initialize failed - ref: %s, msg: %s", - removeRefStr.c_str(), (CAF_CM_EXCEPTION_GET_FULLMSG).c_str()); - rc = SmartPtrIPersistence(); - CAF_CM_CLEAREXCEPTION; - } - } - - return rc; -} diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CConfigEnvOutboundChannelAdapterInstance.h b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CConfigEnvOutboundChannelAdapterInstance.h deleted file mode 100644 index 0abaab42a..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CConfigEnvOutboundChannelAdapterInstance.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CConfigEnvOutboundChannelAdapterInstance_h_ -#define CConfigEnvOutboundChannelAdapterInstance_h_ - - -#include "Integration/IIntegrationComponentInstance.h" - -#include "Common/IAppContext.h" -#include "IConfigEnv.h" -#include "IPersistence.h" -#include "Integration/Core/CMessagingTemplate.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/ILifecycle.h" - -namespace Caf { - -class CConfigEnvOutboundChannelAdapterInstance : - public IIntegrationObject, - public IIntegrationComponentInstance, - public ILifecycle { -public: - CConfigEnvOutboundChannelAdapterInstance(); - virtual ~CConfigEnvOutboundChannelAdapterInstance(); - - CAF_BEGIN_QI() - CAF_QI_ENTRY(IIntegrationObject) - CAF_QI_ENTRY(IIntegrationComponentInstance) - CAF_QI_ENTRY(ILifecycle) - CAF_END_QI() - -public: // IIntegrationObject - void initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection); - - std::string getId() const; - -public: // IIntegrationComponentInstance - void wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver); - -public: // ILifecycle - void start(const uint32 timeoutMs); - - void stop(const uint32 timeoutMs); - - bool isRunning() const; - -private: - SmartPtrIConfigEnv createConfigEnv( - const SmartPtrIAppContext& appContext) const; - - SmartPtrIPersistence createOptPersistence( - const SmartPtrIAppContext& appContext) const; - -private: - bool _isInitialized; - bool _isRunning; - std::string _id; - SmartPtrIDocument _configSection; - SmartPtrCMessagingTemplate _messagingTemplate; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CConfigEnvOutboundChannelAdapterInstance); -}; - -CAF_DECLARE_SMART_QI_POINTER(CConfigEnvOutboundChannelAdapterInstance); -} - -#endif // #ifndef CConfigEnvOutboundChannelAdapterInstance_h_ diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CConfigEnvReadingMessageSource.cpp b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CConfigEnvReadingMessageSource.cpp deleted file mode 100644 index 93a8b1d59..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CConfigEnvReadingMessageSource.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Doc/PersistenceDoc/CPersistenceDoc.h" -#include "IConfigEnv.h" -#include "Integration/Core/CIntMessage.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "CConfigEnvReadingMessageSource.h" -#include "Exception/CCafException.h" -#include "Doc/DocXml/PersistenceXml/PersistenceXmlRoots.h" - -using namespace Caf; - -CConfigEnvReadingMessageSource::CConfigEnvReadingMessageSource() : - _isInitialized(false), - CAF_CM_INIT_LOG("CConfigEnvReadingMessageSource") { -} - -CConfigEnvReadingMessageSource::~CConfigEnvReadingMessageSource() { -} - -void CConfigEnvReadingMessageSource::initialize( - const SmartPtrIDocument& configSection, - const SmartPtrIConfigEnv& configEnv) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - CAF_CM_VALIDATE_INTERFACE(configEnv); - - _id = configSection->findRequiredAttribute("id"); - const SmartPtrIDocument pollerDoc = configSection->findOptionalChild("poller"); - - _configEnv = configEnv; - - setPollerMetadata(pollerDoc); - - _isInitialized = true; -} - -bool CConfigEnvReadingMessageSource::doSend( - const SmartPtrIIntMessage&, - int32) { - CAF_CM_FUNCNAME("doSend"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - CAF_CM_EXCEPTIONEX_VA1( - UnsupportedOperationException, - E_NOTIMPL, - "This is not a sending channel: %s", _id.c_str()); -} - -SmartPtrIIntMessage CConfigEnvReadingMessageSource::doReceive( - const int32 timeout) { - CAF_CM_FUNCNAME("receive"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - if (timeout > 0) { - CAF_CM_EXCEPTIONEX_VA1(UnsupportedOperationException, E_INVALIDARG, - "Timeout not currently supported: %s", _id.c_str()); - } - - SmartPtrIIntMessage message; - const SmartPtrCPersistenceDoc persistence = _configEnv->getUpdated(0); - if (! persistence.IsNull()) { - SmartPtrCIntMessage messageImpl; - messageImpl.CreateInstance(); - messageImpl->initializeStr(XmlRoots::savePersistenceToString(persistence), - IIntMessage::SmartPtrCHeaders(), IIntMessage::SmartPtrCHeaders()); - message = messageImpl; - } - - return message; -} diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CDiagToMgmtRequestTransformer.cpp b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CDiagToMgmtRequestTransformer.cpp deleted file mode 100644 index 4e8c4ae74..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CDiagToMgmtRequestTransformer.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Integration/IDocument.h" -#include "Integration/IIntegrationObject.h" -#include "CDiagToMgmtRequestTransformer.h" - -using namespace Caf; - -CDiagToMgmtRequestTransformer::CDiagToMgmtRequestTransformer() : - _isInitialized(false), - CAF_CM_INIT_LOG("CDiagToMgmtRequestTransformer") { -} - -CDiagToMgmtRequestTransformer::~CDiagToMgmtRequestTransformer() { -} - -void CDiagToMgmtRequestTransformer::initializeBean( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties) { - - CAF_CM_FUNCNAME_VALIDATE("initializeBean"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STL_EMPTY(ctorArgs); - CAF_CM_VALIDATE_STL_EMPTY(properties); - _ctorArgs = ctorArgs; - _properties = properties; - initialize(); - } - CAF_CM_EXIT; -} - -void CDiagToMgmtRequestTransformer::terminateBean() { -} - -void CDiagToMgmtRequestTransformer::initialize() { - - CAF_CM_FUNCNAME_VALIDATE("initialize"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - _isInitialized = true; - } - CAF_CM_EXIT; -} - -bool CDiagToMgmtRequestTransformer::isResponsible( - const SmartPtrIDocument& configSection) const { - CAF_CM_FUNCNAME_VALIDATE("isResponsible"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - } - CAF_CM_EXIT; - - return false; -} - -SmartPtrIIntegrationObject CDiagToMgmtRequestTransformer::createObject( - const SmartPtrIDocument& configSection) const { - CAF_CM_FUNCNAME_VALIDATE("createObject"); - - SmartPtrIIntegrationObject rc; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - - rc.CreateInstance(_sObjIdDiagToMgmtRequestTransformerInstance); - rc->initialize(_ctorArgs, _properties, configSection); - } - CAF_CM_EXIT; - - return rc; -} diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CDiagToMgmtRequestTransformer.h b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CDiagToMgmtRequestTransformer.h deleted file mode 100644 index 6a268adb2..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CDiagToMgmtRequestTransformer.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CDiagToMgmtRequestTransformer_h_ -#define CDiagToMgmtRequestTransformer_h_ - - -#include "IBean.h" - -#include "Integration/IDocument.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/IIntegrationComponent.h" - -namespace Caf { - -/// Sends responses/errors back to the client. -class CDiagToMgmtRequestTransformer : - public TCafSubSystemObjectRoot, - public IBean, - public IIntegrationComponent { -public: - CDiagToMgmtRequestTransformer(); - virtual ~CDiagToMgmtRequestTransformer(); - - CAF_DECLARE_OBJECT_IDENTIFIER(_sObjIdDiagToMgmtRequestTransformer) - - CAF_BEGIN_INTERFACE_MAP(CDiagToMgmtRequestTransformer) - CAF_INTERFACE_ENTRY(IBean) - CAF_INTERFACE_ENTRY(IIntegrationComponent) - CAF_END_INTERFACE_MAP() - -public: - virtual void initialize(); - -public: // IBean - virtual void initializeBean(const IBean::Cargs& ctorArgs, const IBean::Cprops& properties); - - virtual void terminateBean(); - -public: // IIntegrationComponent - bool isResponsible( - const SmartPtrIDocument& configSection) const; - - SmartPtrIIntegrationObject createObject( - const SmartPtrIDocument& configSection) const; - -private: - bool _isInitialized; - IBean::Cargs _ctorArgs; - IBean::Cprops _properties; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CDiagToMgmtRequestTransformer); -}; - -} - -#endif // #ifndef CDiagToMgmtRequestTransformer_h_ diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CDiagToMgmtRequestTransformerInstance.cpp b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CDiagToMgmtRequestTransformerInstance.cpp deleted file mode 100644 index b3ded4351..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CDiagToMgmtRequestTransformerInstance.cpp +++ /dev/null @@ -1,491 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Doc/DocXml/DiagRequestXml/DiagRequestXmlRoots.h" - -#include "CEnvelopeToPayloadTransformerInstance.h" -#include "Common/IAppContext.h" -#include "Doc/CafCoreTypesDoc/CClassSpecifierDoc.h" -#include "Doc/CafCoreTypesDoc/CFullyQualifiedClassGroupDoc.h" -#include "Doc/CafCoreTypesDoc/COperationDoc.h" -#include "Doc/CafCoreTypesDoc/CParameterCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CPropertyDoc.h" -#include "Doc/CafCoreTypesDoc/CRequestInstanceParameterDoc.h" -#include "Doc/CafCoreTypesDoc/CRequestParameterDoc.h" -#include "Doc/DiagRequestDoc/CDiagRequestDoc.h" -#include "Doc/DiagTypesDoc/CDiagCollectInstancesDoc.h" -#include "Doc/DiagTypesDoc/CDiagDeleteValueCollectionDoc.h" -#include "Doc/DiagTypesDoc/CDiagDeleteValueDoc.h" -#include "Doc/DiagTypesDoc/CDiagSetValueCollectionDoc.h" -#include "Doc/DiagTypesDoc/CDiagSetValueDoc.h" -#include "Doc/MgmtRequestDoc/CMgmtRequestDoc.h" -#include "Doc/MgmtTypesDoc/CMgmtBatchDoc.h" -#include "Doc/MgmtTypesDoc/CMgmtCollectInstancesCollectionDoc.h" -#include "Doc/MgmtTypesDoc/CMgmtCollectInstancesDoc.h" -#include "Doc/MgmtTypesDoc/CMgmtInvokeOperationCollectionDoc.h" -#include "Doc/MgmtTypesDoc/CMgmtInvokeOperationDoc.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "CDiagToMgmtRequestTransformerInstance.h" -#include "Exception/CCafException.h" -#include "Integration/Caf/CCafMessageCreator.h" - -using namespace Caf; - -CDiagToMgmtRequestTransformerInstance::CDiagToMgmtRequestTransformerInstance() : - _isInitialized(false), - _fileAliasPrefix("diagFileAlias_"), - CAF_CM_INIT_LOG("CDiagToMgmtRequestTransformerInstance") { -} - -CDiagToMgmtRequestTransformerInstance::~CDiagToMgmtRequestTransformerInstance() { -} - -void CDiagToMgmtRequestTransformerInstance::initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection) { - - CAF_CM_FUNCNAME_VALIDATE("initialize"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - - _id = configSection->findRequiredAttribute("id"); - - _isInitialized = true; - } - CAF_CM_EXIT; -} - -std::string CDiagToMgmtRequestTransformerInstance::getId() const { - CAF_CM_FUNCNAME_VALIDATE("getId"); - - std::string rc; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - rc = _id; - } - CAF_CM_EXIT; - - return rc; -} - -void CDiagToMgmtRequestTransformerInstance::wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver) { - CAF_CM_FUNCNAME_VALIDATE("wire"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(appContext); - CAF_CM_VALIDATE_INTERFACE(channelResolver); - - } - CAF_CM_EXIT; -} - -SmartPtrIIntMessage CDiagToMgmtRequestTransformerInstance::transformMessage( - const SmartPtrIIntMessage& message) { - CAF_CM_FUNCNAME_VALIDATE("transformMessage"); - - SmartPtrIIntMessage newMessage; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - const std::string diagRequestXml = message->getPayloadStr(); - - CAF_CM_LOG_DEBUG_VA1("diagRequestXml - %s", diagRequestXml.c_str()); - - const SmartPtrCDiagRequestDoc diagRequestDoc = - XmlRoots::parseDiagRequestFromString(diagRequestXml); - - const SmartPtrCMgmtCollectInstancesCollectionDoc mgmtCollectInstancesCollection = createMgmtCollectInstancesCollection( - diagRequestDoc->getBatch()->getCollectInstances()); - - const SmartPtrCMgmtInvokeOperationCollectionDoc mgmtInvokeOperationCollection = createMgmtInvokeOperationCollection( - diagRequestDoc->getBatch()->getSetValueCollection(), diagRequestDoc->getBatch()->getDeleteValueCollection()); - - SmartPtrCMgmtBatchDoc mgmtBatch; - mgmtBatch.CreateInstance(); - mgmtBatch->initialize( - SmartPtrCMgmtCollectSchemaDoc(), - mgmtCollectInstancesCollection, - mgmtInvokeOperationCollection); - - SmartPtrCMgmtRequestDoc mgmtRequest; - mgmtRequest.CreateInstance(); - mgmtRequest->initialize( - diagRequestDoc->getClientId(), - diagRequestDoc->getRequestId(), - diagRequestDoc->getPmeId(), - diagRequestDoc->getRequestHeader(), - mgmtBatch, - SmartPtrCAttachmentCollectionDoc()); - - newMessage = CCafMessageCreator::create(mgmtRequest, message->getHeaders()); - } - CAF_CM_EXIT; - - return newMessage; -} - -SmartPtrCMgmtCollectInstancesCollectionDoc CDiagToMgmtRequestTransformerInstance::createMgmtCollectInstancesCollection( - const SmartPtrCDiagCollectInstancesDoc& diagCollectInstances) const { - CAF_CM_FUNCNAME_VALIDATE("createMgmtCollectInstancesCollection"); - - SmartPtrCMgmtCollectInstancesCollectionDoc mgmtCollectInstancesCollection; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - // diagCollectInstances is optional - - if (! diagCollectInstances.IsNull()) { - std::deque mgmtCollectInstancesCollectionInner; - - UUID jobId = diagCollectInstances->getJobId(); - const std::deque expandedFileAliasCollection = expandFileAliases(); - for(TConstIterator > expandedFileAliasIter(expandedFileAliasCollection); - expandedFileAliasIter; expandedFileAliasIter++) { - const SmartPtrSExpandedFileAlias expandedFileAlias = *expandedFileAliasIter; - - const SmartPtrCMgmtCollectInstancesDoc mgmtCollectInstances = - createCollectInstances(jobId, expandedFileAlias); - - mgmtCollectInstancesCollectionInner.push_back(mgmtCollectInstances); - - jobId = CStringUtils::createRandomUuidRaw(); - } - - mgmtCollectInstancesCollection.CreateInstance(); - mgmtCollectInstancesCollection->initialize( - mgmtCollectInstancesCollectionInner); - } - } - CAF_CM_EXIT; - - return mgmtCollectInstancesCollection; -} - -SmartPtrCMgmtInvokeOperationCollectionDoc CDiagToMgmtRequestTransformerInstance::createMgmtInvokeOperationCollection( - const SmartPtrCDiagSetValueCollectionDoc& diagSetValueCollection, - const SmartPtrCDiagDeleteValueCollectionDoc& diagDeleteValueCollection) const { - CAF_CM_FUNCNAME_VALIDATE("createMgmtInvokeOperationCollection"); - - SmartPtrCMgmtInvokeOperationCollectionDoc mgmtInvokeOperationCollection; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - // diagSetValueCollection is optional - // diagDeleteValueCollection is optional - - std::deque mgmtInvokeOperationCollectionInner; - - if (! diagSetValueCollection.IsNull()) { - const std::deque diagSetValueCollectionInner = - diagSetValueCollection->getSetValueCollection(); - for(TConstIterator > diagSetValueIter(diagSetValueCollectionInner); - diagSetValueIter; diagSetValueIter++) { - const SmartPtrCDiagSetValueDoc diagSetValue = *diagSetValueIter; - - const std::string fileAlias = diagSetValue->getFileAlias(); - const SmartPtrSExpandedFileAlias expandedFileAlias = expandFileAlias(fileAlias); - - const SmartPtrCPropertyDoc valueProperty = diagSetValue->getValue(); - const SmartPtrCOperationDoc setValueOperation = createSetValueOperation( - valueProperty->getName(), valueProperty->getValue(), expandedFileAlias); - - SmartPtrCMgmtInvokeOperationDoc mgmtInvokeOperation = createInvokeOperation( - diagSetValue->getJobId(), setValueOperation); - - mgmtInvokeOperationCollectionInner.push_back(mgmtInvokeOperation); - } - } - - if (! diagDeleteValueCollection.IsNull()) { - const std::deque diagDeleteValueCollectionInner = - diagDeleteValueCollection->getDeleteValueCollection(); - for(TConstIterator > diagDeleteValueIter(diagDeleteValueCollectionInner); - diagDeleteValueIter; diagDeleteValueIter++) { - const SmartPtrCDiagDeleteValueDoc diagDeleteValue = *diagDeleteValueIter; - - const std::string fileAlias = diagDeleteValue->getFileAlias(); - const SmartPtrSExpandedFileAlias expandedFileAlias = expandFileAlias(fileAlias); - - const SmartPtrCOperationDoc setValueOperation = createDeleteValueOperation( - diagDeleteValue->getValueName(), expandedFileAlias); - - SmartPtrCMgmtInvokeOperationDoc mgmtInvokeOperation = createInvokeOperation( - diagDeleteValue->getJobId(), setValueOperation); - - mgmtInvokeOperationCollectionInner.push_back(mgmtInvokeOperation); - } - } - - if (! mgmtInvokeOperationCollectionInner.empty()) { - mgmtInvokeOperationCollection.CreateInstance(); - mgmtInvokeOperationCollection->initialize( - mgmtInvokeOperationCollectionInner); - } - } - CAF_CM_EXIT; - - return mgmtInvokeOperationCollection; -} - -SmartPtrCMgmtCollectInstancesDoc CDiagToMgmtRequestTransformerInstance::createCollectInstances( - const UUID& jobId, - const SmartPtrSExpandedFileAlias& expandedFileAlias) const { - CAF_CM_FUNCNAME_VALIDATE("createCollectInstances"); - - SmartPtrCMgmtCollectInstancesDoc mgmtCollectInstances; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_GUID(jobId); - CAF_CM_VALIDATE_SMARTPTR(expandedFileAlias); - - SmartPtrCFullyQualifiedClassGroupDoc fullyQualifiedClass; - fullyQualifiedClass.CreateInstance(); - fullyQualifiedClass->initialize("caf", "ConfigActions", "1.0.0"); - - SmartPtrCClassSpecifierDoc classSpecifier; - classSpecifier.CreateInstance(); - classSpecifier->initialize(fullyQualifiedClass, SmartPtrCClassFiltersDoc()); - - const SmartPtrCRequestParameterDoc filePathParameter = - ParameterUtils::createParameter("filePath", expandedFileAlias->_filePath); - const SmartPtrCRequestParameterDoc encodingParameter = - ParameterUtils::createParameter("encoding", expandedFileAlias->_encoding); - - std::deque parameterCollectionInner; - parameterCollectionInner.push_back(filePathParameter); - parameterCollectionInner.push_back(encodingParameter); - - SmartPtrCParameterCollectionDoc parameterCollection; - parameterCollection.CreateInstance(); - parameterCollection->initialize( - parameterCollectionInner, std::deque()); - - mgmtCollectInstances.CreateInstance(); - mgmtCollectInstances->initialize(jobId, classSpecifier, parameterCollection); - } - CAF_CM_EXIT; - - return mgmtCollectInstances; -} - -SmartPtrCOperationDoc CDiagToMgmtRequestTransformerInstance::createSetValueOperation( - const std::string& valueName, - const std::deque& valueCollection, - const SmartPtrSExpandedFileAlias& expandedFileAlias) const { - CAF_CM_FUNCNAME_VALIDATE("createSetValueOperation"); - - SmartPtrCOperationDoc operation; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(valueName); - CAF_CM_VALIDATE_STL(valueCollection); - CAF_CM_VALIDATE_SMARTPTR(expandedFileAlias); - - const SmartPtrCRequestParameterDoc filePathParameter = - ParameterUtils::createParameter("filePath", expandedFileAlias->_filePath); - const SmartPtrCRequestParameterDoc encodingParameter = - ParameterUtils::createParameter("encoding", expandedFileAlias->_encoding); - const SmartPtrCRequestParameterDoc valueNameParameter = - ParameterUtils::createParameter("valueName", valueName); - const SmartPtrCRequestParameterDoc valueDataParameter = - ParameterUtils::createParameter("valueData", valueCollection); - - std::deque parameterCollectionInner; - parameterCollectionInner.push_back(filePathParameter); - parameterCollectionInner.push_back(encodingParameter); - parameterCollectionInner.push_back(valueNameParameter); - parameterCollectionInner.push_back(valueDataParameter); - - SmartPtrCParameterCollectionDoc parameterCollection; - parameterCollection.CreateInstance(); - parameterCollection->initialize( - parameterCollectionInner, std::deque()); - - operation.CreateInstance(); - operation->initialize("setValue", parameterCollection); - } - CAF_CM_EXIT; - - return operation; -} - -SmartPtrCOperationDoc CDiagToMgmtRequestTransformerInstance::createDeleteValueOperation( - const std::string& valueName, - const SmartPtrSExpandedFileAlias& expandedFileAlias) const { - CAF_CM_FUNCNAME_VALIDATE("createDeleteValueOperation"); - - SmartPtrCOperationDoc operation; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(valueName); - CAF_CM_VALIDATE_SMARTPTR(expandedFileAlias); - - const SmartPtrCRequestParameterDoc filePathParameter = - ParameterUtils::createParameter("filePath", expandedFileAlias->_filePath); - const SmartPtrCRequestParameterDoc encodingParameter = - ParameterUtils::createParameter("encoding", expandedFileAlias->_encoding); - const SmartPtrCRequestParameterDoc valueNameParameter = - ParameterUtils::createParameter("valueName", valueName); - - std::deque parameterCollectionInner; - parameterCollectionInner.push_back(filePathParameter); - parameterCollectionInner.push_back(encodingParameter); - parameterCollectionInner.push_back(valueNameParameter); - - SmartPtrCParameterCollectionDoc parameterCollection; - parameterCollection.CreateInstance(); - parameterCollection->initialize( - parameterCollectionInner, std::deque()); - - operation.CreateInstance(); - operation->initialize("deleteValue", parameterCollection); - } - CAF_CM_EXIT; - - return operation; -} - -SmartPtrCMgmtInvokeOperationDoc CDiagToMgmtRequestTransformerInstance::createInvokeOperation( - const UUID& jobId, - const SmartPtrCOperationDoc operation) const { - CAF_CM_FUNCNAME_VALIDATE("createInvokeOperation"); - - SmartPtrCMgmtInvokeOperationDoc mgmtInvokeOperation; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_GUID(jobId); - CAF_CM_VALIDATE_SMARTPTR(operation); - - SmartPtrCFullyQualifiedClassGroupDoc fullyQualifiedClass; - fullyQualifiedClass.CreateInstance(); - fullyQualifiedClass->initialize("caf", "ConfigActions", "1.0.0"); - - SmartPtrCClassSpecifierDoc classSpecifier; - classSpecifier.CreateInstance(); - classSpecifier->initialize(fullyQualifiedClass, SmartPtrCClassFiltersDoc()); - - mgmtInvokeOperation.CreateInstance(); - mgmtInvokeOperation->initialize(jobId, classSpecifier, operation); - } - CAF_CM_EXIT; - - return mgmtInvokeOperation; -} - -std::deque -CDiagToMgmtRequestTransformerInstance::expandFileAliases() const { - CAF_CM_FUNCNAME_VALIDATE("expandFileAliases"); - - std::deque expandedFileAliasCollection; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - const std::string diagFileAliases = AppConfigUtils::getRequiredString("provider", "diagFileAliases"); - const Cdeqstr diagFileAliasCollection = CStringUtils::split(diagFileAliases, ':'); - - for(TConstIterator diagFileAliasIter(diagFileAliasCollection); - diagFileAliasIter; diagFileAliasIter++) { - const std::string fileAlias = *diagFileAliasIter; - - const SmartPtrSExpandedFileAlias expandedFileAlias = expandFileAlias(fileAlias); - if (! expandedFileAlias.IsNull()) { - expandedFileAliasCollection.push_back(expandedFileAlias); - } - } - } - CAF_CM_EXIT; - - return expandedFileAliasCollection; -} - -CDiagToMgmtRequestTransformerInstance::SmartPtrSExpandedFileAlias -CDiagToMgmtRequestTransformerInstance::expandFileAlias( - const std::string& fileAlias) const { - CAF_CM_FUNCNAME_VALIDATE("expandFileAlias"); - - SmartPtrSExpandedFileAlias expandedFileAlias; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - const std::string fullFileAlias = _fileAliasPrefix + fileAlias; - const std::string diagFileUriStr = AppConfigUtils::getOptionalString("provider", fullFileAlias); - - if (diagFileUriStr.empty()) { - CAF_CM_LOG_WARN_VA1( - "Diag file alias not found in appconfig file - alias: %s", fullFileAlias.c_str()); - } else { - UriUtils::SUriRecord diagFileUri; - UriUtils::parseUriString(diagFileUriStr, diagFileUri); - if (diagFileUri.protocol.compare("file") != 0) { - CAF_CM_LOG_WARN_VA2( - "Diag file alias URI must use \'file\' protocol - alias: %s, uri: %s", - fullFileAlias.c_str(), diagFileUriStr.c_str()) - } else { - UriUtils::SFileUriRecord fileUriRecord; - UriUtils::parseFileAddress(diagFileUri.address, fileUriRecord); - - const std::string diagFile = fileUriRecord.path; - if (! FileSystemUtils::doesFileExist(diagFile)) { - CAF_CM_LOG_WARN_VA2( - "Diag file alias file not found - alias: %s, file: %s", - fullFileAlias.c_str(), diagFile.c_str()); - } else { - expandedFileAlias.CreateInstance(); - expandedFileAlias->_filePath = diagFile; - expandedFileAlias->_encoding = findUriParameter("encoding", diagFileUri); - } - } - } - } - CAF_CM_EXIT; - - return expandedFileAlias; -} - -std::string CDiagToMgmtRequestTransformerInstance::findUriParameter( - const std::string& parameterName, - const UriUtils::SUriRecord& uri) const { - CAF_CM_FUNCNAME("findUriParameter"); - - std::string parameterValue; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(parameterName); - - std::map parameters = uri.parameters; - std::map::const_iterator iterParameter = parameters.find(parameterName); - if (iterParameter == parameters.end()) { - CAF_CM_EXCEPTIONEX_VA3(InvalidArgumentException, E_INVALIDARG, - "URI does not contain required parameter - parameter: %s, protocol: %s, address: %s", - parameterName.c_str(), uri.protocol.c_str(), uri.address.c_str()); - } - - parameterValue = iterParameter->second; - } - CAF_CM_EXIT; - - return parameterValue; -} diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CInstallToMgmtRequestTransformer.cpp b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CInstallToMgmtRequestTransformer.cpp deleted file mode 100644 index ab9620420..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CInstallToMgmtRequestTransformer.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Integration/IDocument.h" -#include "Integration/IIntegrationObject.h" -#include "CInstallToMgmtRequestTransformer.h" - -using namespace Caf; - -CInstallToMgmtRequestTransformer::CInstallToMgmtRequestTransformer() : - _isInitialized(false), - CAF_CM_INIT_LOG("CInstallToMgmtRequestTransformer") { -} - -CInstallToMgmtRequestTransformer::~CInstallToMgmtRequestTransformer() { -} - -void CInstallToMgmtRequestTransformer::initializeBean( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties) { - - CAF_CM_FUNCNAME_VALIDATE("initializeBean"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STL_EMPTY(ctorArgs); - CAF_CM_VALIDATE_STL_EMPTY(properties); - _ctorArgs = ctorArgs; - _properties = properties; - initialize(); - } - CAF_CM_EXIT; -} - -void CInstallToMgmtRequestTransformer::terminateBean() { -} - -void CInstallToMgmtRequestTransformer::initialize() { - - CAF_CM_FUNCNAME_VALIDATE("initialize"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - _isInitialized = true; - } - CAF_CM_EXIT; -} - -bool CInstallToMgmtRequestTransformer::isResponsible( - const SmartPtrIDocument& configSection) const { - CAF_CM_FUNCNAME_VALIDATE("isResponsible"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - } - CAF_CM_EXIT; - - return false; -} - -SmartPtrIIntegrationObject CInstallToMgmtRequestTransformer::createObject( - const SmartPtrIDocument& configSection) const { - CAF_CM_FUNCNAME_VALIDATE("createObject"); - - SmartPtrIIntegrationObject rc; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - - rc.CreateInstance(_sObjIdInstallToMgmtRequestTransformerInstance); - rc->initialize(_ctorArgs, _properties, configSection); - } - CAF_CM_EXIT; - - return rc; -} diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CInstallToMgmtRequestTransformer.h b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CInstallToMgmtRequestTransformer.h deleted file mode 100644 index 8a4772fbc..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CInstallToMgmtRequestTransformer.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CInstallToMgmtRequestTransformer_h_ -#define CInstallToMgmtRequestTransformer_h_ - - -#include "IBean.h" - -#include "Integration/IDocument.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/IIntegrationComponent.h" - -namespace Caf { - -/// Sends responses/errors back to the client. -class CInstallToMgmtRequestTransformer : - public TCafSubSystemObjectRoot, - public IBean, - public IIntegrationComponent { -public: - CInstallToMgmtRequestTransformer(); - virtual ~CInstallToMgmtRequestTransformer(); - - CAF_DECLARE_OBJECT_IDENTIFIER(_sObjIdInstallToMgmtRequestTransformer) - - CAF_BEGIN_INTERFACE_MAP(CInstallToMgmtRequestTransformer) - CAF_INTERFACE_ENTRY(IBean) - CAF_INTERFACE_ENTRY(IIntegrationComponent) - CAF_END_INTERFACE_MAP() - -public: - virtual void initialize(); - -public: // IBean - virtual void initializeBean(const IBean::Cargs& ctorArgs, const IBean::Cprops& properties); - - virtual void terminateBean(); - -public: // IIntegrationComponent - bool isResponsible( - const SmartPtrIDocument& configSection) const; - - SmartPtrIIntegrationObject createObject( - const SmartPtrIDocument& configSection) const; - -private: - bool _isInitialized; - IBean::Cargs _ctorArgs; - IBean::Cprops _properties; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CInstallToMgmtRequestTransformer); -}; - -} - -#endif // #ifndef CInstallToMgmtRequestTransformer_h_ diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CInstallToMgmtRequestTransformerInstance.cpp b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CInstallToMgmtRequestTransformerInstance.cpp deleted file mode 100644 index 4cad013f8..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CInstallToMgmtRequestTransformerInstance.cpp +++ /dev/null @@ -1,385 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Doc/DocXml/CafInstallRequestXml/InstallProviderJobXml.h" -#include "Doc/DocXml/CafInstallRequestXml/UninstallProviderJobXml.h" - -#include "Common/IAppContext.h" -#include "Doc/CafCoreTypesDoc/CClassSpecifierDoc.h" -#include "Doc/CafCoreTypesDoc/CFullyQualifiedClassGroupDoc.h" -#include "Doc/CafCoreTypesDoc/COperationDoc.h" -#include "Doc/CafCoreTypesDoc/CParameterCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CRequestInstanceParameterDoc.h" -#include "Doc/CafCoreTypesDoc/CRequestParameterDoc.h" -#include "Doc/CafInstallRequestDoc/CGetInventoryJobDoc.h" -#include "Doc/CafInstallRequestDoc/CInstallProviderJobDoc.h" -#include "Doc/CafInstallRequestDoc/CInstallRequestDoc.h" -#include "Doc/CafInstallRequestDoc/CUninstallProviderJobDoc.h" -#include "Doc/MgmtRequestDoc/CMgmtRequestDoc.h" -#include "Doc/MgmtTypesDoc/CMgmtBatchDoc.h" -#include "Doc/MgmtTypesDoc/CMgmtCollectInstancesCollectionDoc.h" -#include "Doc/MgmtTypesDoc/CMgmtCollectInstancesDoc.h" -#include "Doc/MgmtTypesDoc/CMgmtInvokeOperationCollectionDoc.h" -#include "Doc/MgmtTypesDoc/CMgmtInvokeOperationDoc.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "Xml/XmlUtils/CXmlElement.h" -#include "Exception/CCafException.h" -#include "CInstallToMgmtRequestTransformerInstance.h" -#include "Integration/Caf/CCafMessagePayloadParser.h" -#include "Integration/Caf/CCafMessageCreator.h" - -using namespace Caf; - -CInstallToMgmtRequestTransformerInstance::CInstallToMgmtRequestTransformerInstance() : - _isInitialized(false), - _fileAliasPrefix("installFileAlias_"), - CAF_CM_INIT_LOG("CInstallToMgmtRequestTransformerInstance") { -} - -CInstallToMgmtRequestTransformerInstance::~CInstallToMgmtRequestTransformerInstance() { -} - -void CInstallToMgmtRequestTransformerInstance::initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection) { - - CAF_CM_FUNCNAME_VALIDATE("initialize"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - - _id = configSection->findRequiredAttribute("id"); - - _isInitialized = true; - } - CAF_CM_EXIT; -} - -std::string CInstallToMgmtRequestTransformerInstance::getId() const { - CAF_CM_FUNCNAME_VALIDATE("getId"); - - std::string rc; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - rc = _id; - } - CAF_CM_EXIT; - - return rc; -} - -void CInstallToMgmtRequestTransformerInstance::wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver) { - CAF_CM_FUNCNAME_VALIDATE("wire"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(appContext); - CAF_CM_VALIDATE_INTERFACE(channelResolver); - - } - CAF_CM_EXIT; -} - -SmartPtrIIntMessage CInstallToMgmtRequestTransformerInstance::transformMessage( - const SmartPtrIIntMessage& message) { - CAF_CM_FUNCNAME_VALIDATE("transformMessage"); - - SmartPtrIIntMessage newMessage; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - const SmartPtrCInstallRequestDoc installRequestDoc = - CCafMessagePayloadParser::getInstallRequest(message->getPayload()); - - const SmartPtrCMgmtCollectInstancesCollectionDoc mgmtCollectInstancesCollection = createMgmtCollectInstancesCollection( - installRequestDoc->getBatch()->getGetInventory()); - - const SmartPtrCMgmtInvokeOperationCollectionDoc mgmtInvokeOperationCollection = createMgmtInvokeOperationCollection( - installRequestDoc->getBatch()->getInstallProvider(), installRequestDoc->getBatch()->getUninstallProvider()); - - SmartPtrCMgmtBatchDoc mgmtBatch; - mgmtBatch.CreateInstance(); - mgmtBatch->initialize( - SmartPtrCMgmtCollectSchemaDoc(), - mgmtCollectInstancesCollection, - mgmtInvokeOperationCollection); - - SmartPtrCMgmtRequestDoc mgmtRequest; - mgmtRequest.CreateInstance(); - mgmtRequest->initialize( - installRequestDoc->getClientId(), - installRequestDoc->getRequestId(), - installRequestDoc->getPmeId(), - installRequestDoc->getRequestHeader(), - mgmtBatch, - installRequestDoc->getAttachmentCollection()); - - newMessage = CCafMessageCreator::create(mgmtRequest, message->getHeaders()); - } - CAF_CM_EXIT; - - return newMessage; -} - -SmartPtrCMgmtCollectInstancesCollectionDoc CInstallToMgmtRequestTransformerInstance::createMgmtCollectInstancesCollection( - const SmartPtrCGetInventoryJobDoc& getInventoryJob) const { - CAF_CM_FUNCNAME_VALIDATE("createMgmtCollectInstancesCollection"); - - SmartPtrCMgmtCollectInstancesCollectionDoc mgmtCollectInstancesCollection; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - // getInventoryJob is optional - - if (! getInventoryJob.IsNull()) { - UUID jobId = getInventoryJob->getJobId(); - const SmartPtrCMgmtCollectInstancesDoc mgmtCollectInstances = - createCollectInstances(jobId); - - std::deque mgmtCollectInstancesCollectionInner; - mgmtCollectInstancesCollectionInner.push_back(mgmtCollectInstances); - - mgmtCollectInstancesCollection.CreateInstance(); - mgmtCollectInstancesCollection->initialize( - mgmtCollectInstancesCollectionInner); - } - } - CAF_CM_EXIT; - - return mgmtCollectInstancesCollection; -} - -SmartPtrCMgmtInvokeOperationCollectionDoc CInstallToMgmtRequestTransformerInstance::createMgmtInvokeOperationCollection( - const SmartPtrCInstallProviderJobDoc& installProviderJob, - const SmartPtrCUninstallProviderJobDoc& uninstallProviderJob) const { - CAF_CM_FUNCNAME_VALIDATE("createMgmtInvokeOperationCollection"); - - SmartPtrCMgmtInvokeOperationCollectionDoc mgmtInvokeOperationCollection; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - // installSetValueCollection is optional - // installDeleteValueCollection is optional - - std::deque mgmtInvokeOperationCollectionInner; - - if (! installProviderJob.IsNull()) { - const SmartPtrCOperationDoc installProviderJobOperation = createInstallProviderOperation(installProviderJob); - - SmartPtrCMgmtInvokeOperationDoc mgmtInvokeOperation = createInvokeOperation(installProviderJobOperation); - - mgmtInvokeOperationCollectionInner.push_back(mgmtInvokeOperation); - } - - if (! uninstallProviderJob.IsNull()) { - const SmartPtrCOperationDoc uninstallProviderJobOperation = createUninstallProviderJobOperation(uninstallProviderJob); - - SmartPtrCMgmtInvokeOperationDoc mgmtInvokeOperation = createInvokeOperation(uninstallProviderJobOperation); - - mgmtInvokeOperationCollectionInner.push_back(mgmtInvokeOperation); - } - - if (! mgmtInvokeOperationCollectionInner.empty()) { - mgmtInvokeOperationCollection.CreateInstance(); - mgmtInvokeOperationCollection->initialize( - mgmtInvokeOperationCollectionInner); - } - } - CAF_CM_EXIT; - - return mgmtInvokeOperationCollection; -} - -SmartPtrCMgmtCollectInstancesDoc CInstallToMgmtRequestTransformerInstance::createCollectInstances( - const UUID& jobId) const { - CAF_CM_FUNCNAME_VALIDATE("createCollectInstances"); - - SmartPtrCMgmtCollectInstancesDoc mgmtCollectInstances; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_GUID(jobId); - - SmartPtrCFullyQualifiedClassGroupDoc fullyQualifiedClass; - fullyQualifiedClass.CreateInstance(); - fullyQualifiedClass->initialize("caf", "InstallActions", "1.0.0"); - - SmartPtrCClassSpecifierDoc classSpecifier; - classSpecifier.CreateInstance(); - classSpecifier->initialize(fullyQualifiedClass, SmartPtrCClassFiltersDoc()); - - SmartPtrCParameterCollectionDoc parameterCollection; - parameterCollection.CreateInstance(); - parameterCollection->initialize( - std::deque(), - std::deque()); - - mgmtCollectInstances.CreateInstance(); - mgmtCollectInstances->initialize(jobId, classSpecifier, parameterCollection); - } - CAF_CM_EXIT; - - return mgmtCollectInstances; -} - -SmartPtrCOperationDoc CInstallToMgmtRequestTransformerInstance::createInstallProviderOperation( - const SmartPtrCInstallProviderJobDoc& installProviderJob) const { - CAF_CM_FUNCNAME_VALIDATE("createInstallProviderOperation"); - - SmartPtrCOperationDoc operation; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_SMARTPTR(installProviderJob); - - const std::string installProviderJobStr = - saveInstallProviderJobToString(installProviderJob); - std::deque valueCollection; - valueCollection.push_back(installProviderJobStr); - - SmartPtrCRequestInstanceParameterDoc instanceParameter; - instanceParameter.CreateInstance(); - instanceParameter->initialize( - "installProviderJob", "caf", "InstallProviderJob", "1.0.0", valueCollection); - - std::deque instanceParameterCollectionInner; - instanceParameterCollectionInner.push_back(instanceParameter); - - SmartPtrCParameterCollectionDoc parameterCollection; - parameterCollection.CreateInstance(); - parameterCollection->initialize( - std::deque(), instanceParameterCollectionInner); - - operation.CreateInstance(); - operation->initialize("installProviderJob", parameterCollection); - } - CAF_CM_EXIT; - - return operation; -} - -SmartPtrCOperationDoc CInstallToMgmtRequestTransformerInstance::createUninstallProviderJobOperation( - const SmartPtrCUninstallProviderJobDoc& uninstallProviderJob) const { - CAF_CM_FUNCNAME_VALIDATE("createUninstallProviderJobOperation"); - - SmartPtrCOperationDoc operation; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_SMARTPTR(uninstallProviderJob); - - const std::string& uninstallProviderJobJobStr = - saveUninstallProviderJobToString(uninstallProviderJob); - std::deque valueCollection; - valueCollection.push_back(uninstallProviderJobJobStr); - - SmartPtrCRequestInstanceParameterDoc instanceParameter; - instanceParameter.CreateInstance(); - instanceParameter->initialize( - "uninstallProviderJob", "caf", "InstallProviderJob", "1.0.0", valueCollection); - - std::deque instanceParameterCollectionInner; - instanceParameterCollectionInner.push_back(instanceParameter); - - SmartPtrCParameterCollectionDoc parameterCollection; - parameterCollection.CreateInstance(); - parameterCollection->initialize( - std::deque(), instanceParameterCollectionInner); - - operation.CreateInstance(); - operation->initialize("uninstallProviderJob", parameterCollection); - } - CAF_CM_EXIT; - - return operation; -} - -SmartPtrCMgmtInvokeOperationDoc CInstallToMgmtRequestTransformerInstance::createInvokeOperation( - const SmartPtrCOperationDoc& operation) const { - CAF_CM_FUNCNAME("createInvokeOperation"); - - SmartPtrCMgmtInvokeOperationDoc mgmtInvokeOperation; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_SMARTPTR(operation); - - SmartPtrCFullyQualifiedClassGroupDoc fullyQualifiedClass; - fullyQualifiedClass.CreateInstance(); - fullyQualifiedClass->initialize("caf", "InstallActions", "1.0.0"); - - SmartPtrCClassSpecifierDoc classSpecifier; - classSpecifier.CreateInstance(); - classSpecifier->initialize(fullyQualifiedClass, SmartPtrCClassFiltersDoc()); - - UUID jobId; - if (S_OK != ::UuidCreate(&jobId)) { - CAF_CM_EXCEPTIONEX_VA0(InvalidHandleException, E_UNEXPECTED, - "Failed to create the UUID"); - } - - mgmtInvokeOperation.CreateInstance(); - mgmtInvokeOperation->initialize(jobId, classSpecifier, operation); - } - CAF_CM_EXIT; - - return mgmtInvokeOperation; -} - -std::string CInstallToMgmtRequestTransformerInstance::saveInstallProviderJobToString( - const SmartPtrCInstallProviderJobDoc& installProviderJob) { - CAF_CM_STATIC_FUNC_VALIDATE("XmlRoots", "saveInstallProviderJobToString"); - - std::string rc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(installProviderJob); - - const std::string schemaNamespace = DocXmlUtils::getSchemaNamespace("fx"); - - const SmartPtrCXmlElement rootXml = CXmlUtils::createRootElement( - "cafInstallProviderJob", schemaNamespace); - InstallProviderJobXml::add(installProviderJob, rootXml); - - rc = rootXml->saveToStringRaw(); - } - CAF_CM_EXIT; - - return rc; -} - -std::string CInstallToMgmtRequestTransformerInstance::saveUninstallProviderJobToString( - const SmartPtrCUninstallProviderJobDoc& uninstallProviderJob) { - CAF_CM_STATIC_FUNC_VALIDATE("XmlRoots", "saveUninstallProviderJobToString"); - - std::string rc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(uninstallProviderJob); - - const std::string schemaNamespace = DocXmlUtils::getSchemaNamespace("fx"); - - const SmartPtrCXmlElement rootXml = CXmlUtils::createRootElement( - "cafUninstallProviderJob", schemaNamespace); - UninstallProviderJobXml::add(uninstallProviderJob, rootXml); - - rc = rootXml->saveToStringRaw(); - } - CAF_CM_EXIT; - - return rc; -} diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CInstallToMgmtRequestTransformerInstance.h b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CInstallToMgmtRequestTransformerInstance.h deleted file mode 100644 index 6feddf68d..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CInstallToMgmtRequestTransformerInstance.h +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CInstallToMgmtRequestTransformerInstance_h_ -#define CInstallToMgmtRequestTransformerInstance_h_ - - -#include "Integration/IIntegrationComponentInstance.h" - -#include "Common/IAppContext.h" -#include "Doc/CafCoreTypesDoc/COperationDoc.h" -#include "Doc/CafInstallRequestDoc/CGetInventoryJobDoc.h" -#include "Doc/CafInstallRequestDoc/CInstallProviderJobDoc.h" -#include "Doc/CafInstallRequestDoc/CUninstallProviderJobDoc.h" -#include "Doc/MgmtTypesDoc/CMgmtCollectInstancesCollectionDoc.h" -#include "Doc/MgmtTypesDoc/CMgmtCollectInstancesDoc.h" -#include "Doc/MgmtTypesDoc/CMgmtInvokeOperationCollectionDoc.h" -#include "Doc/MgmtTypesDoc/CMgmtInvokeOperationDoc.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/ITransformer.h" - -namespace Caf { - -class CInstallToMgmtRequestTransformerInstance : - public TCafSubSystemObjectRoot, - public IIntegrationObject, - public IIntegrationComponentInstance, - public ITransformer { - -public: - CInstallToMgmtRequestTransformerInstance(); - virtual ~CInstallToMgmtRequestTransformerInstance(); - - CAF_DECLARE_OBJECT_IDENTIFIER(_sObjIdInstallToMgmtRequestTransformerInstance) - - CAF_BEGIN_INTERFACE_MAP(CInstallToMgmtRequestTransformerInstance) - CAF_INTERFACE_ENTRY(IIntegrationObject) - CAF_INTERFACE_ENTRY(IIntegrationComponentInstance) - CAF_INTERFACE_ENTRY(ITransformer) - CAF_END_INTERFACE_MAP() - -public: // IIntegrationObject - void initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection); - - std::string getId() const; - -public: // IIntegrationComponentInstance - void wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver); - -public: // ITransformer - SmartPtrIIntMessage transformMessage( - const SmartPtrIIntMessage& message); - -private: - SmartPtrCMgmtCollectInstancesCollectionDoc createMgmtCollectInstancesCollection( - const SmartPtrCGetInventoryJobDoc& getInventoryJob) const; - - SmartPtrCMgmtInvokeOperationCollectionDoc createMgmtInvokeOperationCollection( - const SmartPtrCInstallProviderJobDoc& installProviderJob, - const SmartPtrCUninstallProviderJobDoc& uninstallProviderJob) const; - - SmartPtrCMgmtCollectInstancesDoc createCollectInstances( - const UUID& jobId) const; - - SmartPtrCMgmtInvokeOperationDoc createInvokeOperation( - const SmartPtrCOperationDoc& operation) const; - - SmartPtrCOperationDoc createInstallProviderOperation( - const SmartPtrCInstallProviderJobDoc& installProviderJob) const; - - SmartPtrCOperationDoc createUninstallProviderJobOperation( - const SmartPtrCUninstallProviderJobDoc& uninstallProviderJob) const; - - static std::string saveInstallProviderJobToString( - const SmartPtrCInstallProviderJobDoc& installProviderJob); - - static std::string saveUninstallProviderJobToString( - const SmartPtrCUninstallProviderJobDoc& uninstallProviderJob); - -private: - bool _isInitialized; - std::string _id; - - std::string _fileAliasPrefix; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CInstallToMgmtRequestTransformerInstance); -}; - -} - -#endif // #ifndef CInstallToMgmtRequestTransformerInstance_h_ diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CMonitorInboundChannelAdapterInstance.cpp b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CMonitorInboundChannelAdapterInstance.cpp deleted file mode 100644 index 8e572beac..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CMonitorInboundChannelAdapterInstance.cpp +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "CMonitorReadingMessageSource.h" -#include "Common/IAppContext.h" -#include "Integration/Core/CErrorHandler.h" -#include "Integration/Core/CMessageHandler.h" -#include "Integration/Core/CSimpleAsyncTaskExecutor.h" -#include "Integration/Core/CSourcePollingChannelAdapter.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IMessageChannel.h" -#include "CMonitorInboundChannelAdapterInstance.h" - -using namespace Caf; - -CMonitorInboundChannelAdapterInstance::CMonitorInboundChannelAdapterInstance() : - _isInitialized(false), - CAF_CM_INIT_LOG("CMonitorInboundChannelAdapterInstance") { -} - -CMonitorInboundChannelAdapterInstance::~CMonitorInboundChannelAdapterInstance() { -} - -void CMonitorInboundChannelAdapterInstance::initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - - _configSection = configSection; - _id = _configSection->findRequiredAttribute("id"); - - _isInitialized = true; -} - -std::string CMonitorInboundChannelAdapterInstance::getId() const { - CAF_CM_FUNCNAME_VALIDATE("getId"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _id; -} - -void CMonitorInboundChannelAdapterInstance::wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver) { - CAF_CM_FUNCNAME_VALIDATE("wire"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(appContext); - CAF_CM_VALIDATE_INTERFACE(channelResolver); - - const std::string outputChannelStr = - _configSection->findRequiredAttribute("channel"); - - SmartPtrCMonitorReadingMessageSource monitorReadingMessageSource; - monitorReadingMessageSource.CreateInstance(); - monitorReadingMessageSource->initialize(_configSection); - - const SmartPtrIMessageChannel outputMessageChannel = - channelResolver->resolveChannelName(outputChannelStr); - const SmartPtrIMessageChannel errorMessageChannel = - channelResolver->resolveChannelName("errorChannel"); - - SmartPtrCMessageHandler messageHandler; - messageHandler.CreateInstance(); - messageHandler->initialize( - _id, - outputMessageChannel, - SmartPtrICafObject()); - - SmartPtrCErrorHandler errorHandler; - errorHandler.CreateInstance(); - errorHandler->initialize(channelResolver, errorMessageChannel); - - SmartPtrCSourcePollingChannelAdapter sourcePollingChannelAdapter; - sourcePollingChannelAdapter.CreateInstance(); - sourcePollingChannelAdapter->initialize( - messageHandler, monitorReadingMessageSource, errorHandler); - - SmartPtrCSimpleAsyncTaskExecutor simpleAsyncTaskExecutor; - simpleAsyncTaskExecutor.CreateInstance(); - simpleAsyncTaskExecutor->initialize(sourcePollingChannelAdapter, errorHandler); - _taskExecutor = simpleAsyncTaskExecutor; -} - -void CMonitorInboundChannelAdapterInstance::start( - const uint32 timeoutMs) { - CAF_CM_FUNCNAME_VALIDATE("start"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - CAF_CM_LOG_DEBUG_VA0("Starting the executor"); - _taskExecutor->execute(timeoutMs); -} - -void CMonitorInboundChannelAdapterInstance::stop( - const uint32 timeoutMs) { - CAF_CM_FUNCNAME_VALIDATE("stop"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - CAF_CM_LOG_DEBUG_VA0("Stopping the executor"); - _taskExecutor->cancel(timeoutMs); -} - -bool CMonitorInboundChannelAdapterInstance::isRunning() const { - CAF_CM_FUNCNAME_VALIDATE("isRunning"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - const bool rc = (_taskExecutor->getState() == ITaskExecutor::ETaskStateStarted); - return rc; -} - -bool CMonitorInboundChannelAdapterInstance::isMessageProducer() const { - CAF_CM_FUNCNAME_VALIDATE("isMessageProducer"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return true; -} diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CMonitorInboundChannelAdapterInstance.h b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CMonitorInboundChannelAdapterInstance.h deleted file mode 100644 index ab71bb3f1..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CMonitorInboundChannelAdapterInstance.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CMonitorInboundChannelAdapterInstance_h_ -#define CMonitorInboundChannelAdapterInstance_h_ - - -#include "Integration/IIntegrationComponentInstance.h" - -#include "Common/IAppContext.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/ITaskExecutor.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/ILifecycle.h" -#include "Integration/IMessageProducer.h" - -namespace Caf { - -class CMonitorInboundChannelAdapterInstance : - public IIntegrationObject, - public IIntegrationComponentInstance, - public ILifecycle, - public IMessageProducer { -public: - CMonitorInboundChannelAdapterInstance(); - virtual ~CMonitorInboundChannelAdapterInstance(); - -public: - CAF_BEGIN_QI() - CAF_QI_ENTRY(IIntegrationObject) - CAF_QI_ENTRY(IIntegrationComponentInstance) - CAF_QI_ENTRY(ILifecycle) - CAF_QI_ENTRY(IMessageProducer) - CAF_END_QI() - -public: // IIntegrationObject - void initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection); - - std::string getId() const; - -public: // IIntegrationComponentInstance - void wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver); - -public: // ILifecycle - void start(const uint32 timeoutMs); - void stop(const uint32 timeoutMs); - bool isRunning() const; - -public: // IMessageProducer - bool isMessageProducer() const; - -private: - bool _isInitialized; - std::string _id; - SmartPtrIDocument _configSection; - SmartPtrITaskExecutor _taskExecutor; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CMonitorInboundChannelAdapterInstance); -}; - -CAF_DECLARE_SMART_QI_POINTER(CMonitorInboundChannelAdapterInstance); - -} - -#endif // #ifndef CMonitorInboundChannelAdapterInstance_h_ diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CMonitorListener.cpp b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CMonitorListener.cpp deleted file mode 100644 index cfed73986..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CMonitorListener.cpp +++ /dev/null @@ -1,199 +0,0 @@ -/* - * Copyright (C) 2010-2018 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Exception/CCafException.h" -#include "CMonitorListener.h" - -using namespace Caf; - -CMonitorListener::CMonitorListener() : - _isInitialized(false), - CAF_CM_INIT_LOG("CMonitorListener") { - CAF_CM_INIT_THREADSAFE; -} - -CMonitorListener::~CMonitorListener() { -} - - -void CMonitorListener::initialize() { - CAF_CM_LOCK_UNLOCK; - - if (!_isInitialized) { - _monitorDir = AppConfigUtils::getRequiredString("monitor_dir"); - _restartListenerPath = FileSystemUtils::buildPath(_monitorDir, "restartListener.txt"); - _listenerConfiguredStage1Path = FileSystemUtils::buildPath( - _monitorDir, "listenerConfiguredStage1.txt"); - _listenerConfiguredStage2Path = FileSystemUtils::buildPath( - _monitorDir, "listenerConfiguredStage2.txt"); - _listenerPreConfiguredPath = FileSystemUtils::buildPath( - _monitorDir, "listenerPreConfigured.txt"); - - _listenerCtrlPreConfigure = AppConfigUtils::getRequiredUint32("monitor", - "listener_ctrl_preconfigure") ? true : false; - _listenerCtrlFollowTunnel = AppConfigUtils::getRequiredUint32("monitor", - "listener_ctrl_follow_tunnel") ? true : false; - _listenerPreConfigured = FileSystemUtils::doesFileExist(_listenerPreConfiguredPath) ? true : false; - - _scriptOutputDir = AppConfigUtils::getRequiredString(_sConfigTmpDir); - const std::string installDir = AppConfigUtils::getRequiredString("install_dir"); - const std::string scriptsDir = AppConfigUtils::getRequiredString("scripts_dir"); -#ifdef _WIN32 - _stopListenerScript = FileSystemUtils::buildPath(scriptsDir, "stop-listener.bat"); - _startListenerScript = FileSystemUtils::buildPath(scriptsDir, "start-listener.bat"); - _preConfigureListenerScript = FileSystemUtils::buildPath(installDir, "preconfigure-listener.bat"); - _isListenerRunningScript = FileSystemUtils::buildPath(scriptsDir, "is-listener-running.bat"); -#else - _stopListenerScript = FileSystemUtils::buildPath(scriptsDir, "stop-listener"); - _startListenerScript = FileSystemUtils::buildPath(scriptsDir, "start-listener"); - _preConfigureListenerScript = FileSystemUtils::buildPath(installDir, "preconfigure-listener.sh"); - _isListenerRunningScript = FileSystemUtils::buildPath(scriptsDir, "is-listener-running"); -#endif - _isInitialized = true; - } -} - -bool CMonitorListener::preConfigureListener() { - CAF_CM_FUNCNAME_VALIDATE("preConfigureListener"); - - bool rc = true; - if (!_listenerCtrlPreConfigure) { - rc = false; - CAF_CM_LOG_DEBUG_VA0("monitor/listener_ctrl_preconfigure is not enabled."); - } else if (!isListenerPreConfigured()) { - CAF_CM_LOG_DEBUG_VA0("Pre-configuring the listener..."); - const std::string stdoutStr = FileSystemUtils::executeScript( - _preConfigureListenerScript, _scriptOutputDir); - if (stdoutStr.compare("true") == 0) { - CAF_CM_LOG_DEBUG_VA0("Pre-configured the listener."); - std::string reason = "PreConfiguredByMA"; - listenerConfiguredStage1("Automatic"); - listenerConfiguredStage2(reason); - listenerPreConfigured(reason); - } else { - rc = false; - CAF_CM_LOG_ERROR_VA1("Failed to pre-configure the listener. errstr: %s", stdoutStr.c_str()); - } - } - - return rc; -} - -/* - * Returns - * true if listener is stopped/started upon tunnel and sets listenerStartupType - */ -bool CMonitorListener::followTunnel(std::string& listenerStartupType) { - CAF_CM_FUNCNAME_VALIDATE("followTunnel"); - - // true - followed the tunnel - bool rc = false; - std::string reason; - if (!_listenerCtrlFollowTunnel) { - // If Listener is pre-configured and Tunnel enabled, start listener - if (isListenerPreConfigured()) { - // 1. Start the listener if tunnel is enabled - // 2. Stop the listener otherwise - if (CConfigEnvMerge::isTunnelEnabledFunc()) { - CAF_CM_LOG_DEBUG_VA1("Listener is pre-configured and tunnel is enabled. " - "Starting the listener. PreConfiguredPath=%s", _listenerPreConfiguredPath.c_str()); - listenerConfiguredStage1(LISTENER_STARTUP_TYPE_AUTOMATIC); - listenerConfiguredStage2(LISTENER_STARTUP_TYPE_AUTOMATIC); - listenerStartupType = LISTENER_STARTUP_TYPE_AUTOMATIC; - } else { - CAF_CM_LOG_DEBUG_VA1("Listener is pre-configured and tunnel is disabled. " - "PreConfiguredPath=%s", _listenerPreConfiguredPath.c_str()); - if (isListenerRunning()) { - reason = "Listener pre-configured, tunnel disabled, and listener is running. Stopping it"; - CAF_CM_LOG_DEBUG_VA0(reason.c_str()); - stopListener(reason); - } - listenerUnConfiguredStage1(); - listenerUnConfiguredStage2(); - } - rc = true; - } - } - return rc; -} - -bool CMonitorListener::canListenerBeStarted() { - bool rc = false; - - if (CConfigEnvMerge::isTunnelEnabledFunc()) { - if (_listenerCtrlFollowTunnel) { - rc = true; - } - } else { - //TODO: Implement non-tunnel case. Currently it is not a priority - } - - return rc; -} - -bool CMonitorListener::isListenerRunning() { - const std::string stdoutStr = FileSystemUtils::executeScript( - _isListenerRunningScript, _scriptOutputDir); - return (stdoutStr.compare("true") == 0); -} - -void CMonitorListener::stopListener( - const std::string& reason) { - CAF_CM_FUNCNAME_VALIDATE("stopListener"); - - CAF_CM_LOG_DEBUG_VA1( - "Stopping the listener - reason: %s", reason.c_str()); - FileSystemUtils::executeScript(_stopListenerScript, _scriptOutputDir); -} - -void CMonitorListener::startListener( - const std::string& reason) { - CAF_CM_FUNCNAME_VALIDATE("startListener"); - - if (canListenerBeStarted()) { - CAF_CM_LOG_DEBUG_VA1("Starting the listener - reason: %s", reason.c_str()); - FileSystemUtils::executeScript(_startListenerScript, _scriptOutputDir); - } else { - CAF_CM_LOG_DEBUG_VA0("Listener is not allowed to start. Check setting..."); - } -} - -void CMonitorListener::restartListener( - const std::string& reason) { - FileSystemUtils::saveTextFile(_restartListenerPath, reason); -} - -void CMonitorListener::listenerConfiguredStage1( - const std::string& reason) const { - FileSystemUtils::saveTextFile(_listenerConfiguredStage1Path, reason); -} - -void CMonitorListener::listenerUnConfiguredStage1() { - FileSystemUtils::removeFile(_listenerConfiguredStage1Path); -} - -void CMonitorListener::listenerConfiguredStage2( - const std::string& reason) const { - FileSystemUtils::saveTextFile(_listenerConfiguredStage2Path, reason); -} - -void CMonitorListener::listenerUnConfiguredStage2() { - FileSystemUtils::removeFile(_listenerConfiguredStage2Path); -} - -void CMonitorListener::listenerPreConfigured( - const std::string& reason) const { - FileSystemUtils::saveTextFile(_listenerPreConfiguredPath, reason); -} - -bool CMonitorListener::isListenerPreConfigured() { - // Invalidate the flag - if (!_listenerPreConfigured) { - _listenerPreConfigured = FileSystemUtils::doesFileExist(_listenerPreConfiguredPath); - } - return _listenerPreConfigured; -} - diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CMonitorListener.h b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CMonitorListener.h deleted file mode 100644 index 398e32415..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CMonitorListener.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (C) 2017-2018 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef _MaIntegration_CMonitorListener_h_ -#define _MaIntegration_CMonitorListener_h_ - -using namespace Caf; - -#define LISTENER_STARTUP_TYPE_AUTOMATIC "Automatic" -#define LISTENER_STARTUP_TYPE_MANUAL "Manual" - -/* - * Manages the listener LCM - */ -class CMonitorListener { - -public: - CMonitorListener(); - ~CMonitorListener(); - - void initialize(); - - bool preConfigureListener(); - - bool isListenerPreConfigured(); - - bool followTunnel(std::string& listenerStartupType); - - void stopListener(const std::string& reason); - - bool isListenerRunning(); - - bool canListenerBeStarted(); - - void startListener(const std::string& reason); - - void restartListener(const std::string& reason); - - void listenerConfiguredStage1(const std::string& reason) const; - - void listenerUnConfiguredStage1(); - - void listenerConfiguredStage2(const std::string& reason) const; - - void listenerUnConfiguredStage2(); - - void listenerPreConfigured(const std::string& reason) const; - - - -private: - bool _isInitialized; - bool _listenerCtrlPreConfigure; - bool _listenerCtrlFollowTunnel; - bool _listenerPreConfigured; - - std::string _startListenerScript; - std::string _restartListenerPath; - std::string _listenerConfiguredStage1Path; - std::string _listenerConfiguredStage2Path; - std::string _listenerPreConfiguredPath; - std::string _stopListenerScript; - std::string _isListenerRunningScript; - std::string _preConfigureListenerScript; - std::string _monitorDir; - std::string _scriptOutputDir; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_CREATE_THREADSAFE; - CAF_CM_DECLARE_NOCOPY(CMonitorListener); -}; -CAF_DECLARE_SMART_POINTER(CMonitorListener); - -#endif // #ifndef _MaIntegration_CMonitorListener_h_ diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CMonitorReadingMessageSource.cpp b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CMonitorReadingMessageSource.cpp deleted file mode 100644 index 71fd043fb..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CMonitorReadingMessageSource.cpp +++ /dev/null @@ -1,237 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2017 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Integration/Core/CIntMessage.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "CMonitorReadingMessageSource.h" -#include "Exception/CCafException.h" - -using namespace Caf; - -#define LISTENER_STARTUP_TYPE_AUTOMATIC "Automatic" - -CMonitorReadingMessageSource::CMonitorReadingMessageSource() : - _isInitialized(false), - _listenerStartTimeMs(0), - _listenerRestartMs(0), - _listenerRetryCnt(0), - _listenerRetryMax(0), - CAF_CM_INIT_LOG("CMonitorReadingMessageSource") { -} - -CMonitorReadingMessageSource::~CMonitorReadingMessageSource() { -} - -void CMonitorReadingMessageSource::initialize( - const SmartPtrIDocument& configSection) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - - _id = configSection->findRequiredAttribute("id"); - - const SmartPtrIDocument pollerDoc = configSection->findOptionalChild("poller"); - setPollerMetadata(pollerDoc); - - - _monitorListener.CreateInstance(); - _monitorListener->initialize(); - - _monitorDir = AppConfigUtils::getRequiredString("monitor_dir"); - _restartListenerPath = FileSystemUtils::buildPath(_monitorDir, "restartListener.txt"); - _listenerConfiguredStage2Path = FileSystemUtils::buildPath(_monitorDir, "listenerConfiguredStage2.txt"); - - _scriptOutputDir = AppConfigUtils::getRequiredString(_sConfigTmpDir); - _listenerStartupType = AppConfigUtils::getRequiredString("monitor", "listener_startup_type"); - _listenerRetryMax = AppConfigUtils::getRequiredInt32("monitor", "listener_retry_max"); - - _listenerRestartMs = calcListenerRestartMs(); - CAF_CM_LOG_DEBUG_VA1("_listenerRestartMs: %d", _listenerRestartMs); - - const std::string scriptsDir = AppConfigUtils::getRequiredString("scripts_dir"); -#ifdef _WIN32 - _stopListenerScript = FileSystemUtils::buildPath(scriptsDir, "stop-listener.bat"); - _startListenerScript = FileSystemUtils::buildPath(scriptsDir, "start-listener.bat"); - _isListenerRunningScript = FileSystemUtils::buildPath(scriptsDir, "is-listener-running.bat"); -#else - _stopListenerScript = FileSystemUtils::buildPath(scriptsDir, "stop-listener"); - _startListenerScript = FileSystemUtils::buildPath(scriptsDir, "start-listener"); - _isListenerRunningScript = FileSystemUtils::buildPath(scriptsDir, "is-listener-running"); -#endif - - if (! FileSystemUtils::doesDirectoryExist(_monitorDir)) { - FileSystemUtils::createDirectory(_monitorDir); - } - _isInitialized = true; -} - -bool CMonitorReadingMessageSource::doSend( - const SmartPtrIIntMessage&, - int32) { - CAF_CM_FUNCNAME("doSend"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - CAF_CM_EXCEPTIONEX_VA1( - UnsupportedOperationException, - E_NOTIMPL, - "This is not a sending channel: %s", _id.c_str()); -} - -SmartPtrIIntMessage CMonitorReadingMessageSource::doReceive( - const int32 timeout) { - CAF_CM_FUNCNAME("doReceive"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - if (timeout > 0) { - CAF_CM_EXCEPTIONEX_VA1(UnsupportedOperationException, E_INVALIDARG, - "Timeout not currently supported: %s", _id.c_str()); - } - - std::string reason; - // If Listener is pre-configured and Tunnel enabled, start listener - // Sets startup type if it is following tunnel - _monitorListener->followTunnel(_listenerStartupType); - - if (FileSystemUtils::doesFileExist(_listenerConfiguredStage2Path)) { - if (FileSystemUtils::doesFileExist(_restartListenerPath)) { - reason = FileSystemUtils::loadTextFile(_restartListenerPath); - FileSystemUtils::removeFile(_restartListenerPath); - _listenerRetryCnt = 0; - _listenerStartTimeMs = CDateTimeUtils::getTimeMs(); - restartListener(reason); - } else { - if (isListenerRunning()) { - _listenerRetryCnt = 0; - if (areSystemResourcesLow()) { - reason = "Listener running... Stopping due to low system resources"; - stopListener(reason); - } else if (isTimeForListenerRestart()) { - reason = "Listener running... Restarting due to expired timeout"; - _listenerStartTimeMs = CDateTimeUtils::getTimeMs(); - restartListener(reason); - } - } else { - if (_listenerStartupType.compare("Automatic") == 0) { - if ((_listenerRetryMax < 0) || (_listenerRetryCnt < _listenerRetryMax)) { - reason = "Listener not running... Starting - " - + CStringConv::toString(_listenerRetryCnt + 1) + " of " - + CStringConv::toString(_listenerRetryMax); - _listenerRetryCnt++; - _listenerStartTimeMs = CDateTimeUtils::getTimeMs(); - _monitorListener->startListener(reason); - } else { - reason = "Listener not running... Retries exhausted - " - + CStringConv::toString(_listenerRetryCnt + 1) + " of " - + CStringConv::toString(_listenerRetryMax); - CAF_CM_LOG_WARN_VA0(reason.c_str()); - } - } else { - reason = "Listener not running... Not Automatic startup - " + _listenerStartupType; - CAF_CM_LOG_WARN_VA0(reason.c_str()); - _listenerRetryCnt = 0; - } - } - } - } else { - reason = "Listener not configured"; - _listenerRetryCnt = 0; - } - - SmartPtrCIntMessage messageImpl; - if (! reason.empty()) { - messageImpl.CreateInstance(); - messageImpl->initializeStr(reason, - IIntMessage::SmartPtrCHeaders(), IIntMessage::SmartPtrCHeaders()); - } - - return messageImpl; -} - -bool CMonitorReadingMessageSource::isListenerRunning() const { - const std::string stdoutStr = executeScript(_isListenerRunningScript, _scriptOutputDir); - return (stdoutStr.compare("true") == 0); -} - -void CMonitorReadingMessageSource::startListener( - const std::string& reason) const { - CAF_CM_FUNCNAME_VALIDATE("startListener"); - - CAF_CM_LOG_DEBUG_VA1( - "Starting the listener - reason: %s", reason.c_str()); - executeScript(_startListenerScript, _scriptOutputDir); -} - -void CMonitorReadingMessageSource::stopListener( - const std::string& reason) const { - CAF_CM_FUNCNAME_VALIDATE("stopListener"); - - CAF_CM_LOG_DEBUG_VA1( - "Stopping the listener - reason: %s", reason.c_str()); - executeScript(_stopListenerScript, _scriptOutputDir); -} - -void CMonitorReadingMessageSource::restartListener( - const std::string& reason) const { - CAF_CM_FUNCNAME_VALIDATE("restartListener"); - - CAF_CM_LOG_DEBUG_VA1( - "Restarting the listener - reason: %s", reason.c_str()); - executeScript(_stopListenerScript, _scriptOutputDir); - executeScript(_startListenerScript, _scriptOutputDir); -} - -std::string CMonitorReadingMessageSource::executeScript( - const std::string& scriptPath, - const std::string& scriptResultsDir) const { - CAF_CM_FUNCNAME_VALIDATE("executeScript"); - CAF_CM_VALIDATE_STRING(scriptPath); - CAF_CM_VALIDATE_STRING(scriptResultsDir); - - Cdeqstr argv; - argv.push_back(scriptPath); - - const std::string stdoutPath = FileSystemUtils::buildPath( - scriptResultsDir, "stdout"); - const std::string stderrPath = FileSystemUtils::buildPath( - scriptResultsDir, "stderr"); - - ProcessUtils::runSyncToFiles(argv, stdoutPath, stderrPath); - - std::string rc; - if (FileSystemUtils::doesFileExist(stdoutPath)) { - rc = FileSystemUtils::loadTextFile(stdoutPath); - } - - return rc; -} - -bool CMonitorReadingMessageSource::areSystemResourcesLow() const { - // TODO: Implement - return false; -} - -bool CMonitorReadingMessageSource::isTimeForListenerRestart() const { - return (_listenerRestartMs > 0) && (CDateTimeUtils::calcRemainingTime(_listenerStartTimeMs, _listenerRestartMs) == 0); -} - -uint64 CMonitorReadingMessageSource::calcListenerRestartMs() const { - const uint32 listenerRestartDays = AppConfigUtils::getOptionalUint32("monitor", "listener_restart_days"); - const uint32 listenerRestartHours = AppConfigUtils::getOptionalUint32("monitor", "listener_restart_hours"); - const uint32 listenerRestartMins = AppConfigUtils::getOptionalUint32("monitor", "listener_restart_mins"); - const uint32 listenerRestartSecs = AppConfigUtils::getOptionalUint32("monitor", "listener_restart_secs"); - - uint64 rc = 0; - rc = (rc == 0) && (listenerRestartDays > 0) ? CTimeUnit::DAYS::toMilliseconds(listenerRestartDays) : rc; - rc = (rc == 0) && (listenerRestartHours > 0) ? CTimeUnit::HOURS::toMilliseconds(listenerRestartHours) : rc; - rc = (rc == 0) && (listenerRestartMins > 0) ? CTimeUnit::MINUTES::toMilliseconds(listenerRestartMins) : rc; - rc = (rc == 0) && (listenerRestartSecs > 0) ? CTimeUnit::SECONDS::toMilliseconds(listenerRestartSecs) : rc; - - return rc; -} diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CPersistenceInboundChannelAdapterInstance.cpp b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CPersistenceInboundChannelAdapterInstance.cpp deleted file mode 100644 index 6962b3abb..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CPersistenceInboundChannelAdapterInstance.cpp +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "CPersistenceReadingMessageSource.h" -#include "Common/IAppContext.h" -#include "IBean.h" -#include "IPersistence.h" -#include "Integration/Core/CErrorHandler.h" -#include "Integration/Core/CMessageHandler.h" -#include "Integration/Core/CSimpleAsyncTaskExecutor.h" -#include "Integration/Core/CSourcePollingChannelAdapter.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IMessageChannel.h" -#include "CPersistenceInboundChannelAdapterInstance.h" - -using namespace Caf; - -CPersistenceInboundChannelAdapterInstance::CPersistenceInboundChannelAdapterInstance() : - _isInitialized(false), - CAF_CM_INIT_LOG("CPersistenceInboundChannelAdapterInstance") { -} - -CPersistenceInboundChannelAdapterInstance::~CPersistenceInboundChannelAdapterInstance() { -} - -void CPersistenceInboundChannelAdapterInstance::initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - - _configSection = configSection; - _id = _configSection->findRequiredAttribute("id"); - - _isInitialized = true; -} - -std::string CPersistenceInboundChannelAdapterInstance::getId() const { - CAF_CM_FUNCNAME_VALIDATE("getId"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _id; -} - -void CPersistenceInboundChannelAdapterInstance::wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver) { - CAF_CM_FUNCNAME_VALIDATE("wire"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(appContext); - CAF_CM_VALIDATE_INTERFACE(channelResolver); - - const SmartPtrIPersistence persistence = createPersistence(appContext); - if (! persistence.IsNull()) { - const std::string outputChannelStr = - _configSection->findRequiredAttribute("channel"); - - SmartPtrCPersistenceReadingMessageSource persistenceReadingMessageSource; - persistenceReadingMessageSource.CreateInstance(); - persistenceReadingMessageSource->initialize(_configSection, persistence); - - const SmartPtrIMessageChannel outputMessageChannel = - channelResolver->resolveChannelName(outputChannelStr); - const SmartPtrIMessageChannel errorMessageChannel = - channelResolver->resolveChannelName("errorChannel"); - - SmartPtrCMessageHandler messageHandler; - messageHandler.CreateInstance(); - messageHandler->initialize( - _id, - outputMessageChannel, - SmartPtrICafObject()); - - SmartPtrCErrorHandler errorHandler; - errorHandler.CreateInstance(); - errorHandler->initialize(channelResolver, errorMessageChannel); - - SmartPtrCSourcePollingChannelAdapter sourcePollingChannelAdapter; - sourcePollingChannelAdapter.CreateInstance(); - sourcePollingChannelAdapter->initialize( - messageHandler, persistenceReadingMessageSource, errorHandler); - - SmartPtrCSimpleAsyncTaskExecutor simpleAsyncTaskExecutor; - simpleAsyncTaskExecutor.CreateInstance(); - simpleAsyncTaskExecutor->initialize(sourcePollingChannelAdapter, errorHandler); - _taskExecutor = simpleAsyncTaskExecutor; - } -} - -void CPersistenceInboundChannelAdapterInstance::start( - const uint32 timeoutMs) { - CAF_CM_FUNCNAME_VALIDATE("start"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - if (! _taskExecutor.IsNull()) { - CAF_CM_LOG_DEBUG_VA0("Starting the executor"); - _taskExecutor->execute(timeoutMs); - } -} - -void CPersistenceInboundChannelAdapterInstance::stop( - const uint32 timeoutMs) { - CAF_CM_FUNCNAME_VALIDATE("stop"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - if (! _taskExecutor.IsNull()) { - CAF_CM_LOG_DEBUG_VA0("Stopping the executor"); - _taskExecutor->cancel(timeoutMs); - } -} - -bool CPersistenceInboundChannelAdapterInstance::isRunning() const { - CAF_CM_FUNCNAME_VALIDATE("isRunning"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - const bool rc = ! _taskExecutor.IsNull() - && (_taskExecutor->getState() == ITaskExecutor::ETaskStateStarted); - return rc; -} - -bool CPersistenceInboundChannelAdapterInstance::isMessageProducer() const { - CAF_CM_FUNCNAME_VALIDATE("isMessageProducer"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return true; -} - -SmartPtrIPersistence CPersistenceInboundChannelAdapterInstance::createPersistence( - const SmartPtrIAppContext& appContext) const { - CAF_CM_FUNCNAME("createPersistence"); - CAF_CM_VALIDATE_INTERFACE(appContext); - - SmartPtrIPersistence rc; - const std::string removeRefStr = _configSection->findRequiredAttribute("ref"); - CAF_CM_LOG_DEBUG_VA1("Creating the persistence impl - %s", removeRefStr.c_str()); - const SmartPtrIBean bean = appContext->getBean(removeRefStr); - rc.QueryInterface(bean, false); - CAF_CM_VALIDATE_INTERFACE(rc); - - try { - rc->initialize(); - } - CAF_CM_CATCH_CAF - CAF_CM_CATCH_DEFAULT; - - if (CAF_CM_ISEXCEPTION) { - CAF_CM_LOG_WARN_VA2("initialize failed - ref: %s, msg: %s", - removeRefStr.c_str(), (CAF_CM_EXCEPTION_GET_FULLMSG).c_str()); - rc = SmartPtrIPersistence(); - CAF_CM_CLEAREXCEPTION; - } - - return rc; -} diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CPersistenceInboundChannelAdapterInstance.h b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CPersistenceInboundChannelAdapterInstance.h deleted file mode 100644 index a1b095385..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CPersistenceInboundChannelAdapterInstance.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CPersistenceInboundChannelAdapterInstance_h_ -#define CPersistenceInboundChannelAdapterInstance_h_ - - -#include "Integration/IIntegrationComponentInstance.h" - -#include "Common/IAppContext.h" -#include "IPersistence.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/ITaskExecutor.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/ILifecycle.h" -#include "Integration/IMessageProducer.h" - -namespace Caf { - -class CPersistenceInboundChannelAdapterInstance : - public IIntegrationObject, - public IIntegrationComponentInstance, - public ILifecycle, - public IMessageProducer { -public: - CPersistenceInboundChannelAdapterInstance(); - virtual ~CPersistenceInboundChannelAdapterInstance(); - -public: - CAF_BEGIN_QI() - CAF_QI_ENTRY(IIntegrationObject) - CAF_QI_ENTRY(IIntegrationComponentInstance) - CAF_QI_ENTRY(ILifecycle) - CAF_QI_ENTRY(IMessageProducer) - CAF_END_QI() - -public: // IIntegrationObject - void initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection); - - std::string getId() const; - -public: // IIntegrationComponentInstance - void wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver); - -public: // ILifecycle - void start(const uint32 timeoutMs); - void stop(const uint32 timeoutMs); - bool isRunning() const; - -public: // IMessageProducer - bool isMessageProducer() const; - -private: - SmartPtrIPersistence createPersistence( - const SmartPtrIAppContext& appContext) const; - -private: - bool _isInitialized; - std::string _id; - SmartPtrIDocument _configSection; - SmartPtrITaskExecutor _taskExecutor; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CPersistenceInboundChannelAdapterInstance); -}; - -CAF_DECLARE_SMART_QI_POINTER(CPersistenceInboundChannelAdapterInstance); - -} - -#endif // #ifndef CPersistenceInboundChannelAdapterInstance_h_ diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CPersistenceMerge.cpp b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CPersistenceMerge.cpp deleted file mode 100644 index a9bd20501..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CPersistenceMerge.cpp +++ /dev/null @@ -1,419 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Doc/PersistenceDoc/CCertCollectionDoc.h" -#include "Doc/PersistenceDoc/CLocalSecurityDoc.h" -#include "Doc/PersistenceDoc/CPersistenceDoc.h" -#include "Doc/PersistenceDoc/CPersistenceProtocolCollectionDoc.h" -#include "Doc/PersistenceDoc/CPersistenceProtocolDoc.h" -#include "Doc/PersistenceDoc/CRemoteSecurityCollectionDoc.h" -#include "Doc/PersistenceDoc/CRemoteSecurityDoc.h" -#include "CPersistenceMerge.h" - -using namespace Caf; - -SmartPtrCPersistenceDoc CPersistenceMerge::mergePersistence( - const SmartPtrCPersistenceDoc& persistenceLoaded, - const SmartPtrCPersistenceDoc& persistenceIn) { - SmartPtrCPersistenceDoc rc; - if (persistenceLoaded.IsNull()) { - if (! persistenceIn.IsNull()) { - rc = persistenceIn; - } - } else { - if (persistenceIn.IsNull()) { - rc = persistenceLoaded; - } else { - const SmartPtrCLocalSecurityDoc localSecurity = mergeLocalSecurity( - persistenceLoaded->getLocalSecurity(), - persistenceIn->getLocalSecurity()); - const SmartPtrCPersistenceProtocolCollectionDoc persistenceProtocolCollection = mergePersistenceProtocolCollection( - persistenceLoaded->getPersistenceProtocolCollection(), - persistenceIn->getPersistenceProtocolCollection()); - const SmartPtrCRemoteSecurityCollectionDoc remoteSecurityCollection = mergeRemoteSecurityCollection( - persistenceLoaded->getRemoteSecurityCollection(), - persistenceIn->getRemoteSecurityCollection()); - if (! localSecurity.IsNull() || ! persistenceProtocolCollection.IsNull() || ! remoteSecurityCollection.IsNull()) { - rc.CreateInstance(); - rc->initialize( - localSecurity.IsNull() ? persistenceIn->getLocalSecurity() : localSecurity, - remoteSecurityCollection.IsNull() ? persistenceIn->getRemoteSecurityCollection() : remoteSecurityCollection, - persistenceProtocolCollection.IsNull() ? persistenceIn->getPersistenceProtocolCollection() : persistenceProtocolCollection, - persistenceIn->getVersion()); - } - } - } - - return rc; -} - -SmartPtrCLocalSecurityDoc CPersistenceMerge::mergeLocalSecurity( - const SmartPtrCLocalSecurityDoc& localSecurityLoaded, - const SmartPtrCLocalSecurityDoc& localSecurityIn) { - SmartPtrCLocalSecurityDoc rc; - if (localSecurityLoaded.IsNull()) { - if (! localSecurityIn.IsNull()) { - rc = localSecurityIn; - } - } else { - if (localSecurityIn.IsNull()) { - rc = localSecurityLoaded; - } else { - const std::string localId = mergeStrings( - localSecurityLoaded->getLocalId(), localSecurityIn->getLocalId()); - const std::string privateKey = mergeStrings( - localSecurityIn->getPrivateKey(), localSecurityLoaded->getPrivateKey()); - const std::string certPath = mergeStrings( - localSecurityIn->getCert(), localSecurityLoaded->getCertPath()); - if (! localId.empty() || ! privateKey.empty() || ! certPath.empty()) { - rc.CreateInstance(); - rc->initialize( - localId.empty() ? localSecurityIn->getLocalId() : localId, - privateKey.empty() ? localSecurityIn->getPrivateKey() : privateKey, - certPath.empty() ? localSecurityIn->getCertPath() : certPath, - localSecurityLoaded->getPrivateKeyPath(), - localSecurityLoaded->getCertPath()); - } - } - } - - return rc; -} - -SmartPtrCPersistenceProtocolCollectionDoc CPersistenceMerge::mergePersistenceProtocolCollection( - const SmartPtrCPersistenceProtocolCollectionDoc& persistenceProtocolCollectionLoaded, - const SmartPtrCPersistenceProtocolCollectionDoc& persistenceProtocolCollectionIn) { - SmartPtrCPersistenceProtocolCollectionDoc rc; - if (persistenceProtocolCollectionLoaded.IsNull()) { - if (! persistenceProtocolCollectionIn.IsNull()) { - rc = persistenceProtocolCollectionIn; - } - } else { - if (persistenceProtocolCollectionIn.IsNull()) { - rc = persistenceProtocolCollectionLoaded; - } else { - const std::deque persistenceProtocolCollectionInner = mergePersistenceProtocolCollectionInner( - persistenceProtocolCollectionLoaded->getPersistenceProtocol(), - persistenceProtocolCollectionIn->getPersistenceProtocol()); - if (! persistenceProtocolCollectionInner.empty()) { - rc.CreateInstance(); - rc->initialize(persistenceProtocolCollectionInner); - } - } - } - - return rc; -} - -std::deque CPersistenceMerge::mergePersistenceProtocolCollectionInner( - const std::deque& persistenceProtocolCollectionInnerLoaded, - const std::deque& persistenceProtocolCollectionInnerIn) { - CAF_CM_STATIC_FUNC_VALIDATE("CConfigEnvMerge", "mergePersistenceProtocolCollectionInner"); - - std::deque rc; - if (persistenceProtocolCollectionInnerLoaded.empty()) { - if (! persistenceProtocolCollectionInnerIn.empty()) { - rc = persistenceProtocolCollectionInnerIn; - } - } else { - if (persistenceProtocolCollectionInnerIn.empty()) { - rc = persistenceProtocolCollectionInnerLoaded; - } else { - CAF_CM_VALIDATE_BOOL(persistenceProtocolCollectionInnerLoaded.size() == 1); - CAF_CM_VALIDATE_BOOL(persistenceProtocolCollectionInnerIn.size() == 1); - - typedef std::map > CPersistenceProtocolMap; - CPersistenceProtocolMap persistenceProtocolMap; - for (TConstIterator > persistenceProtocolLoadedIter(persistenceProtocolCollectionInnerLoaded); - persistenceProtocolLoadedIter; persistenceProtocolLoadedIter++) { - const SmartPtrCPersistenceProtocolDoc persistenceProtocolLoaded = *persistenceProtocolLoadedIter; - persistenceProtocolMap.insert(std::make_pair( - persistenceProtocolLoaded->getProtocolName(), - std::make_pair(persistenceProtocolLoaded, SmartPtrCPersistenceProtocolDoc()))); - } - for (TConstIterator > persistenceProtocolInIter(persistenceProtocolCollectionInnerIn); - persistenceProtocolInIter; persistenceProtocolInIter++) { - const SmartPtrCPersistenceProtocolDoc persistenceProtocolIn = *persistenceProtocolInIter; - if (persistenceProtocolMap.find(persistenceProtocolIn->getProtocolName()) == persistenceProtocolMap.end()) { - CAF_CM_VALIDATE_BOOL(persistenceProtocolMap.empty()); - persistenceProtocolMap.insert(std::make_pair( - persistenceProtocolIn->getProtocolName(), - std::make_pair(SmartPtrCPersistenceProtocolDoc(), persistenceProtocolIn))); - } else { - persistenceProtocolMap.find(persistenceProtocolIn->getProtocolName())->second.second = persistenceProtocolIn; - } - } - - CAF_CM_VALIDATE_BOOL(persistenceProtocolMap.size() == 1); - for (TConstMapIterator persistenceProtocolMapIter(persistenceProtocolMap); - persistenceProtocolMapIter; persistenceProtocolMapIter++) { - const SmartPtrCPersistenceProtocolDoc persistenceProtocolLoaded = persistenceProtocolMapIter->first; - const SmartPtrCPersistenceProtocolDoc persistenceProtocolIn = persistenceProtocolMapIter->second; - const SmartPtrCPersistenceProtocolDoc persistenceProtocolTmp = - mergePersistenceProtocol(persistenceProtocolLoaded, persistenceProtocolIn); - if (! persistenceProtocolTmp.IsNull()) { - rc.push_back(persistenceProtocolTmp); - } - } - } - } - - return rc; -} - -SmartPtrCPersistenceProtocolDoc CPersistenceMerge::mergePersistenceProtocol( - const SmartPtrCPersistenceProtocolDoc& persistenceProtocolLoaded, - const SmartPtrCPersistenceProtocolDoc& persistenceProtocolIn) { - SmartPtrCPersistenceProtocolDoc rc; - if (persistenceProtocolLoaded.IsNull()) { - if (! persistenceProtocolIn.IsNull()) { - rc = persistenceProtocolIn; - } - } else { - if (persistenceProtocolIn.IsNull()) { - rc = persistenceProtocolLoaded; - } else { - const std::string protocolName = mergeStrings( - persistenceProtocolLoaded->getProtocolName(), persistenceProtocolIn->getProtocolName()); - const std::string uri = mergeUri( - persistenceProtocolLoaded->getUri(), persistenceProtocolIn->getUri()); - const std::string tlsCert = mergeStrings( - persistenceProtocolIn->getTlsCert(), persistenceProtocolLoaded->getTlsCert()); - const std::string tlsProtocol = mergeStrings( - persistenceProtocolIn->getTlsProtocol(), persistenceProtocolLoaded->getTlsProtocol()); - const Cdeqstr tlsCipherCollection = mergeDeqstr( - persistenceProtocolIn->getTlsCipherCollection(), persistenceProtocolLoaded->getTlsCipherCollection()); - const SmartPtrCCertCollectionDoc tlsCertCollection = mergeCertCollection( - persistenceProtocolIn->getTlsCertCollection(), persistenceProtocolLoaded->getTlsCertCollection()); - - if (! protocolName.empty() || ! uri.empty() || ! tlsCert.empty() || - ! tlsProtocol.empty() || ! tlsCipherCollection.empty() || ! tlsCertCollection.IsNull()) { - rc.CreateInstance(); - rc->initialize( - protocolName.empty() ? persistenceProtocolIn->getProtocolName() : protocolName, - uri.empty() ? persistenceProtocolIn->getUri() : uri, - persistenceProtocolLoaded->getUriAmqp(), - persistenceProtocolLoaded->getUriTunnel(), - tlsCert.empty() ? persistenceProtocolIn->getTlsCert() : tlsCert, - tlsProtocol.empty() ? persistenceProtocolIn->getTlsProtocol() : tlsProtocol, - tlsCipherCollection.empty() ? persistenceProtocolIn->getTlsCipherCollection() : tlsCipherCollection, - tlsCertCollection.IsNull() ? persistenceProtocolIn->getTlsCertCollection() : tlsCertCollection, - persistenceProtocolLoaded->getUriAmqpPath(), - persistenceProtocolLoaded->getUriTunnelPath(), - persistenceProtocolLoaded->getTlsCertPath(), - persistenceProtocolLoaded->getTlsCertPathCollection()); - } - } - } - - return rc; -} - -SmartPtrCRemoteSecurityCollectionDoc CPersistenceMerge::mergeRemoteSecurityCollection( - const SmartPtrCRemoteSecurityCollectionDoc& remoteSecurityCollectionLoaded, - const SmartPtrCRemoteSecurityCollectionDoc& remoteSecurityCollectionIn) { - SmartPtrCRemoteSecurityCollectionDoc rc; - if (remoteSecurityCollectionLoaded.IsNull()) { - if (! remoteSecurityCollectionIn.IsNull()) { - rc = remoteSecurityCollectionIn; - } - } else { - if (remoteSecurityCollectionIn.IsNull()) { - rc = remoteSecurityCollectionLoaded; - } else { - const std::deque remoteSecurityCollectionInner = mergeRemoteSecurityCollectionInner( - remoteSecurityCollectionLoaded->getRemoteSecurity(), - remoteSecurityCollectionIn->getRemoteSecurity()); - if (! remoteSecurityCollectionInner.empty()) { - rc.CreateInstance(); - rc->initialize(remoteSecurityCollectionInner); - } - } - } - - return rc; -} - -std::deque CPersistenceMerge::mergeRemoteSecurityCollectionInner( - const std::deque& remoteSecurityCollectionInnerLoaded, - const std::deque& remoteSecurityCollectionInnerIn) { - std::deque rc; - if (remoteSecurityCollectionInnerLoaded.empty()) { - if (! remoteSecurityCollectionInnerIn.empty()) { - rc = remoteSecurityCollectionInnerIn; - } - } else { - if (remoteSecurityCollectionInnerIn.empty()) { - rc = remoteSecurityCollectionInnerLoaded; - } else { - typedef std::map > CRemoteSecurityMap; - CRemoteSecurityMap remoteSecurityMap; - for (TConstIterator > remoteSecurityLoadedIter(remoteSecurityCollectionInnerLoaded); - remoteSecurityLoadedIter; remoteSecurityLoadedIter++) { - const SmartPtrCRemoteSecurityDoc remoteSecurityLoaded = *remoteSecurityLoadedIter; - remoteSecurityMap.insert(std::make_pair( - remoteSecurityLoaded->getRemoteId(), - std::make_pair(remoteSecurityLoaded, SmartPtrCRemoteSecurityDoc()))); - } - for (TConstIterator > remoteSecurityInIter(remoteSecurityCollectionInnerIn); - remoteSecurityInIter; remoteSecurityInIter++) { - const SmartPtrCRemoteSecurityDoc remoteSecurityIn = *remoteSecurityInIter; - if (remoteSecurityMap.find(remoteSecurityIn->getRemoteId()) == remoteSecurityMap.end()) { - remoteSecurityMap.insert(std::make_pair( - remoteSecurityIn->getRemoteId(), - std::make_pair(SmartPtrCRemoteSecurityDoc(), remoteSecurityIn))); - } else { - remoteSecurityMap.find(remoteSecurityIn->getRemoteId())->second.second = remoteSecurityIn; - } - } - for (TConstMapIterator remoteSecurityMapIter(remoteSecurityMap); - remoteSecurityMapIter; remoteSecurityMapIter++) { - const SmartPtrCRemoteSecurityDoc remoteSecurityLoaded = (*remoteSecurityMapIter).first; - const SmartPtrCRemoteSecurityDoc remoteSecurityIn = (*remoteSecurityMapIter).second; - const SmartPtrCRemoteSecurityDoc remoteSecurityTmp = - mergeRemoteSecurity(remoteSecurityLoaded, remoteSecurityIn); - if (! remoteSecurityTmp.IsNull()) { - rc.push_back(remoteSecurityTmp); - } - } - } - } - - return rc; -} - -SmartPtrCRemoteSecurityDoc CPersistenceMerge::mergeRemoteSecurity( - const SmartPtrCRemoteSecurityDoc& remoteSecurityLoaded, - const SmartPtrCRemoteSecurityDoc& remoteSecurityIn) { - SmartPtrCRemoteSecurityDoc rc; - if (remoteSecurityLoaded.IsNull()) { - if (! remoteSecurityIn.IsNull()) { - rc = remoteSecurityIn; - } - } else { - if (remoteSecurityIn.IsNull()) { - rc = remoteSecurityLoaded; - } else { - const std::string remoteId = mergeStrings( - remoteSecurityLoaded->getRemoteId(), remoteSecurityIn->getRemoteId()); - const std::string protocolName = mergeStrings( - remoteSecurityLoaded->getProtocolName(), remoteSecurityIn->getProtocolName()); - const std::string cmsCert = mergeStrings( - remoteSecurityIn->getCmsCert(), remoteSecurityLoaded->getCmsCert()); - const std::string cmsCipherName = mergeStrings( - remoteSecurityIn->getCmsCipherName(), remoteSecurityLoaded->getCmsCipherName()); - const SmartPtrCCertCollectionDoc cmsCertCollection = mergeCertCollection( - remoteSecurityIn->getCmsCertCollection(), remoteSecurityLoaded->getCmsCertCollection()); - - if (! remoteId.empty() || ! protocolName.empty() || ! cmsCert.empty() || - ! cmsCipherName.empty() || ! cmsCertCollection.IsNull()) { - rc.CreateInstance(); - rc->initialize( - remoteId.empty() ? remoteSecurityIn->getRemoteId() : remoteId, - protocolName.empty() ? remoteSecurityIn->getProtocolName() : protocolName, - cmsCert.empty() ? remoteSecurityIn->getCmsCert() : cmsCert, - cmsCipherName.empty() ? remoteSecurityIn->getCmsCipherName() : cmsCipherName, - cmsCertCollection.IsNull() ? remoteSecurityIn->getCmsCertCollection() : cmsCertCollection, - remoteSecurityLoaded->getCmsCertPath(), - remoteSecurityLoaded->getCmsCertPathCollection()); - } - } - } - - return rc; -} - -SmartPtrCCertCollectionDoc CPersistenceMerge::mergeCertCollection( - const SmartPtrCCertCollectionDoc& certCollectionLoaded, - const SmartPtrCCertCollectionDoc& certCollectionIn) { - SmartPtrCCertCollectionDoc rc; - if (certCollectionLoaded.IsNull()) { - if (! certCollectionIn.IsNull()) { - rc = certCollectionIn; - } - } else { - if (certCollectionIn.IsNull()) { - rc = certCollectionLoaded; - } else { - const std::deque certCollectionInner = mergeDeqstr( - certCollectionLoaded->getCert(), - certCollectionIn->getCert()); - if (! certCollectionInner.empty()) { - rc.CreateInstance(); - rc->initialize(certCollectionInner); - } - } - } - - return rc; -} - -std::string CPersistenceMerge::mergeUri( - const std::string& uriPreferred, - const std::string& uriOther) { - CAF_CM_STATIC_FUNC_LOG_ONLY("CPersistenceMerge", "mergeUri"); - std::string rc; - if (! uriPreferred.empty() && ! uriOther.empty()) { - UriUtils::SUriRecord uriRecordPreferred; - UriUtils::parseUriString(uriPreferred, uriRecordPreferred); - - UriUtils::SUriRecord uriRecordOther; - UriUtils::parseUriString(uriOther, uriRecordOther); - - if (! uriRecordOther.host.empty() && (uriRecordPreferred.host.length() > 1) - && ('#' == uriRecordPreferred.host[0]) - && ('#' == uriRecordPreferred.host[uriRecordPreferred.host.length() - 1])) { - CAF_CM_LOG_DEBUG_VA2("URI host changed - %s != %s", - uriRecordPreferred.host.c_str(), uriRecordOther.host.c_str()); - uriRecordPreferred.host = uriRecordOther.host; - } - if (! uriRecordOther.username.empty() && (uriRecordPreferred.username.length() > 1) - && ('#' == uriRecordPreferred.username[0]) - && ('#' == uriRecordPreferred.username[uriRecordPreferred.username.length() - 1])) { - CAF_CM_LOG_DEBUG_VA2("URI username changed - %s != %s", - uriRecordPreferred.username.c_str(), uriRecordOther.username.c_str()); - uriRecordPreferred.username = uriRecordOther.username; - } - if (! uriRecordOther.username.empty() && (uriRecordPreferred.password.length() > 1) - && ('#' == uriRecordPreferred.password[0]) - && ('#' == uriRecordPreferred.password[uriRecordPreferred.password.length() - 1])) { - CAF_CM_LOG_DEBUG_VA0("URI password changed"); - uriRecordPreferred.password = uriRecordOther.password; - } - - rc = UriUtils::buildUriString(uriRecordPreferred); - } else { - rc = mergeStrings(uriPreferred, uriOther); - } - - return rc; -} - -std::string CPersistenceMerge::mergeStrings( - const std::string& strPreferred, - const std::string& strOther) { - return (strPreferred.compare(strOther) == 0) ? std::string() : strPreferred; -} - -Cdeqstr CPersistenceMerge::mergeDeqstr( - const Cdeqstr& deqstrPreferred, - const Cdeqstr& deqstrOther) { - Cdeqstr rc; - if (deqstrPreferred.empty()) { - if (! deqstrOther.empty()) { - rc = deqstrOther; - } - } else { - if (deqstrOther.empty()) { - rc = deqstrPreferred; - } - } - - return rc; -} diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CPersistenceMerge.h b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CPersistenceMerge.h deleted file mode 100644 index c170f815f..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CPersistenceMerge.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef _MaIntegration_CPersistenceMerge_h_ -#define _MaIntegration_CPersistenceMerge_h_ - - -#include "Doc/PersistenceDoc/CCertCollectionDoc.h" -#include "Doc/PersistenceDoc/CLocalSecurityDoc.h" -#include "Doc/PersistenceDoc/CPersistenceDoc.h" -#include "Doc/PersistenceDoc/CPersistenceProtocolCollectionDoc.h" -#include "Doc/PersistenceDoc/CPersistenceProtocolDoc.h" -#include "Doc/PersistenceDoc/CRemoteSecurityCollectionDoc.h" -#include "Doc/PersistenceDoc/CRemoteSecurityDoc.h" - -using namespace Caf; - -/// TODO - describe class -class CPersistenceMerge { -public: - static SmartPtrCPersistenceDoc mergePersistence( - const SmartPtrCPersistenceDoc& persistenceLoaded, - const SmartPtrCPersistenceDoc& persistenceIn); - -private: - static SmartPtrCLocalSecurityDoc mergeLocalSecurity( - const SmartPtrCLocalSecurityDoc& localSecurityLoaded, - const SmartPtrCLocalSecurityDoc& localSecurityIn); - - static SmartPtrCPersistenceProtocolCollectionDoc mergePersistenceProtocolCollection( - const SmartPtrCPersistenceProtocolCollectionDoc& persistenceProtocolCollectionLoaded, - const SmartPtrCPersistenceProtocolCollectionDoc& persistenceProtocolCollectionIn); - - static std::deque mergePersistenceProtocolCollectionInner( - const std::deque& persistenceProtocolCollectionInnerLoaded, - const std::deque& persistenceProtocolCollectionInnerIn); - - static SmartPtrCPersistenceProtocolDoc mergePersistenceProtocol( - const SmartPtrCPersistenceProtocolDoc& persistenceProtocolLoaded, - const SmartPtrCPersistenceProtocolDoc& persistenceProtocolIn); - - static SmartPtrCRemoteSecurityCollectionDoc mergeRemoteSecurityCollection( - const SmartPtrCRemoteSecurityCollectionDoc& remoteSecurityCollectionLoaded, - const SmartPtrCRemoteSecurityCollectionDoc& remoteSecurityCollectionIn); - - static std::deque mergeRemoteSecurityCollectionInner( - const std::deque& remoteSecurityCollectionInnerLoaded, - const std::deque& remoteSecurityCollectionInnerIn); - - static SmartPtrCRemoteSecurityDoc mergeRemoteSecurity( - const SmartPtrCRemoteSecurityDoc& remoteSecurityLoaded, - const SmartPtrCRemoteSecurityDoc& remoteSecurityIn); - - static SmartPtrCCertCollectionDoc mergeCertCollection( - const SmartPtrCCertCollectionDoc& certCollectionLoaded, - const SmartPtrCCertCollectionDoc& certCollectionIn); - - static std::string mergeStrings( - const std::string& strLoaded, - const std::string& strIn); - - static std::string mergeUri( - const std::string& uriLoaded, - const std::string& uriIn); - - static Cdeqstr mergeDeqstr( - const Cdeqstr& deqstrPreferred, - const Cdeqstr& deqstrOther); - -private: - CAF_CM_DECLARE_NOCREATE(CPersistenceMerge); -}; - -#endif // #ifndef _MaIntegration_CPersistenceMerge_h_ diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CPersistenceMessageHandler.cpp b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CPersistenceMessageHandler.cpp deleted file mode 100644 index 064685e92..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CPersistenceMessageHandler.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Doc/DocXml/PersistenceXml/PersistenceXmlRoots.h" - -#include "Doc/PersistenceDoc/CPersistenceDoc.h" -#include "IPersistence.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "CPersistenceMessageHandler.h" - -using namespace Caf; - -CPersistenceMessageHandler::CPersistenceMessageHandler() : - _isInitialized(false), - CAF_CM_INIT_LOG("CPersistenceMessageHandler") { -} - -CPersistenceMessageHandler::~CPersistenceMessageHandler() { -} - -void CPersistenceMessageHandler::initialize( - const SmartPtrIDocument& configSection, - const SmartPtrIPersistence& persistence) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - CAF_CM_VALIDATE_SMARTPTR(persistence); - - _id = configSection->findRequiredAttribute("id"); - _persistence = persistence; - - _isInitialized = true; -} - -void CPersistenceMessageHandler::handleMessage( - const SmartPtrIIntMessage& message) { - CAF_CM_FUNCNAME_VALIDATE("handleMessage"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(message); - - _savedMessage = message; - - SmartPtrCPersistenceDoc persistence; - const std::string payloadStr = message->getPayloadStr(); - if (! payloadStr.empty()) { - persistence = XmlRoots::parsePersistenceFromString(payloadStr); - } - - _persistence->update(persistence); -} - -SmartPtrIIntMessage CPersistenceMessageHandler::getSavedMessage() const { - CAF_CM_FUNCNAME_VALIDATE("getSavedMessage"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _savedMessage; -} - -void CPersistenceMessageHandler::clearSavedMessage() { - CAF_CM_FUNCNAME_VALIDATE("clearSavedMessage"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - _savedMessage = NULL; -} - -SmartPtrIIntMessage CPersistenceMessageHandler::processErrorMessage( - const SmartPtrIIntMessage& message) { - CAF_CM_FUNCNAME_VALIDATE("processErrorMessage"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(message); - - _savedMessage = message; - - //TODO: Verify that I'm receiving the error message and decide what - //to do with it. - - return SmartPtrIIntMessage(); -} diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CPersistenceMessageHandler.h b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CPersistenceMessageHandler.h deleted file mode 100644 index 71c8a11aa..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CPersistenceMessageHandler.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef _MaIntegration_CPersistenceMessageHandler_h_ -#define _MaIntegration_CPersistenceMessageHandler_h_ - - -#include "Integration/IErrorProcessor.h" - -#include "IPersistence.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "Integration/IMessageHandler.h" - -namespace Caf { - -class CPersistenceMessageHandler : - public IMessageHandler, - public IErrorProcessor { -public: - CPersistenceMessageHandler(); - virtual ~CPersistenceMessageHandler(); - -public: - CAF_BEGIN_QI() - CAF_QI_ENTRY(IMessageHandler) - CAF_QI_ENTRY(IErrorProcessor) - CAF_END_QI() - -public: - void initialize( - const SmartPtrIDocument& configSection, - const SmartPtrIPersistence& persistence); - -public: // IMessageHandler - void handleMessage( - const SmartPtrIIntMessage& message); - - SmartPtrIIntMessage getSavedMessage() const; - - void clearSavedMessage(); - -public: // IErrorProcessor - SmartPtrIIntMessage processErrorMessage( - const SmartPtrIIntMessage& message); - -private: - bool _isInitialized; - std::string _id; - SmartPtrIPersistence _persistence; - SmartPtrIIntMessage _savedMessage; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CPersistenceMessageHandler); -}; - -CAF_DECLARE_SMART_QI_POINTER(CPersistenceMessageHandler); - -} - -#endif // #ifndef _MaIntegration_CPersistenceMessageHandler_h_ diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CPersistenceNamespaceDb.cpp b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CPersistenceNamespaceDb.cpp deleted file mode 100644 index c5cd5a64a..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CPersistenceNamespaceDb.cpp +++ /dev/null @@ -1,606 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Doc/PersistenceDoc/CCertCollectionDoc.h" -#include "Doc/PersistenceDoc/CLocalSecurityDoc.h" -#include "Doc/PersistenceDoc/CPersistenceDoc.h" -#include "Doc/PersistenceDoc/CPersistenceProtocolCollectionDoc.h" -#include "Doc/PersistenceDoc/CPersistenceProtocolDoc.h" -#include "Doc/PersistenceDoc/CRemoteSecurityCollectionDoc.h" -#include "Doc/PersistenceDoc/CRemoteSecurityDoc.h" -#include "Exception/CCafException.h" -#include "CPersistenceNamespaceDb.h" -#include - -using namespace Caf; - -CPersistenceNamespaceDb::CPersistenceNamespaceDb() : - _isInitialized(false), - _isReady(false), - _dataReady2Read(false), - _dataReady2Update(false), - _dataReady2Remove(false), - _polledDuringStart(false), - _pollingIntervalSecs(86400), - _pollingStartedTimeMs(0), - CAF_CM_INIT_LOG("CPersistenceNamespaceDb") { - CAF_CM_INIT_THREADSAFE; - _nsdbNamespace = "com.vmware.caf.guest.rw"; -} - -CPersistenceNamespaceDb::~CPersistenceNamespaceDb() { -} - -void CPersistenceNamespaceDb::initializeBean( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties) { -} - -void CPersistenceNamespaceDb::terminateBean() { -} - -void CPersistenceNamespaceDb::initialize() { - CAF_CM_LOCK_UNLOCK; - - if (! _isInitialized) { - _polledDuringStart = false; - _nsdbPollerSignalFile = AppConfigUtils::getRequiredString("monitor", "nsdb_poller_signal_file"); - _pollingIntervalSecs = AppConfigUtils::getRequiredUint32("monitor", "nsdb_polling_interval_secs"); - _pollingStartedTimeMs = CDateTimeUtils::getTimeMs(); - setCmd(); - _isInitialized = true; - } -} - -SmartPtrCPersistenceDoc CPersistenceNamespaceDb::getUpdated( - const int32 timeout) { - CAF_CM_FUNCNAME_VALIDATE("getUpdated"); - CAF_CM_LOCK_UNLOCK; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - CAF_CM_LOG_DEBUG_VA0("getUpdated"); - SmartPtrCPersistenceDoc rc; - if (isDataReady2Read() && isReady()) { - const std::string updatesCur = getValue("updates"); - if (_updates.compare(updatesCur) != 0) { - _updates = updatesCur; - const std::string version = getValue("version"); - - //EP Doc - const std::string epLocalId = getValue("ep.local_id"); - const std::string epPrivateKey = getValue("ep.private_key"); - const std::string epCert = getValue("ep.cert"); - - SmartPtrCLocalSecurityDoc endpoint; - endpoint.CreateInstance(); - endpoint->initialize(epLocalId, epPrivateKey, epCert); - - //App collection - std::deque applicationCollectionInner; - const std::string applications = getValue("applications"); - Cdeqstr appList = CStringUtils::split(applications, ','); - for (Cdeqstr::iterator appIt = appList.begin(); appIt != appList.end(); appIt++) { - const std::string appKey = "app." + *appIt; - const std::string appId = getValue(appKey + ".remote_id"); - const std::string appProtocolName = getValue(appKey + ".protocol_name"); - const std::string appCmsCipher = getValue(appKey + ".cms.cipher"); - - std::deque cmsCertCollectionInner; - const std::string appCmsCertChain = getValue(appKey + ".cms.cert_chain"); - Cdeqstr appCertList = CStringUtils::split(appCmsCertChain, ','); - for (Cdeqstr::iterator appCertIt = appCertList.begin(); appCertIt != appCertList.end(); appCertIt++) { - cmsCertCollectionInner.push_back(*appCertIt); - } - - SmartPtrCCertCollectionDoc cmsCertCollection; - cmsCertCollection.CreateInstance(); - cmsCertCollection->initialize(cmsCertCollectionInner); - - const std::string cmsCert = getValue(appKey + ".cms.cert"); - SmartPtrCRemoteSecurityDoc application; - application.CreateInstance(); - application->initialize(appId, appProtocolName, cmsCert, appCmsCipher, - cmsCertCollection); - - applicationCollectionInner.push_back(application); - } - - SmartPtrCRemoteSecurityCollectionDoc applicationCollection; - applicationCollection.CreateInstance(); - applicationCollection->initialize(applicationCollectionInner); - - const std::string protocols = getValue("protocols"); - Cdeqstr protocolList = CStringUtils::split(protocols, ','); - std::deque persistenceProtocolCollectionInner; - for (Cdeqstr::iterator protocolIt = protocolList.begin(); protocolIt != protocolList.end(); protocolIt++) { - const std::string protocolKey = "protocol." + *protocolIt; - //Protoccol Doc - std::deque tlsCertCollectionInner; - const std::string tlsCertChain = getValue(protocolKey + ".tls.cert.chain"); - Cdeqstr tlsCertList = CStringUtils::split(tlsCertChain, ','); - for (Cdeqstr::iterator tlsCertIt = tlsCertList.begin(); tlsCertIt != tlsCertList.end(); tlsCertIt++) { - tlsCertCollectionInner.push_back(*tlsCertIt); - } - - Cdeqstr tlsCipherCollection; - const std::string tlsCiphers = getValue(protocolKey + ".tls.ciphers"); - Cdeqstr tlsCipherList = CStringUtils::split(tlsCiphers, ','); - for (Cdeqstr::iterator tlsCipherIt = tlsCipherList.begin(); tlsCipherIt != tlsCipherList.end(); tlsCipherIt++) { - tlsCipherCollection.push_back(*tlsCipherIt); - } - - SmartPtrCCertCollectionDoc tlsCertCollection; - tlsCertCollection.CreateInstance(); - tlsCertCollection->initialize(tlsCertCollectionInner); - - //For now, we only support one broker. - const std::string protocolName = getValue(protocolKey + ".protocol_name"); - const std::string tlsCert = getValue(protocolKey + ".tls.cert"); - const std::string tlsProtocol = getValue(protocolKey + ".tls.protocol"); - const std::string uri = getValue(protocolKey + ".uri"); - const std::string uriAmqp = getValue(protocolKey + ".uri.amqp"); - const std::string uriTunnel = getValue(protocolKey + ".uri.tunnel"); - - SmartPtrCPersistenceProtocolDoc persistenceProtocol; - persistenceProtocol.CreateInstance(); - persistenceProtocol->initialize( - protocolName, uri, uriAmqp, uriTunnel, tlsCert, tlsProtocol, - tlsCipherCollection, tlsCertCollection); - - persistenceProtocolCollectionInner.push_back(persistenceProtocol); - } - - SmartPtrCPersistenceProtocolCollectionDoc persistenceProtocolCollection; - persistenceProtocolCollection.CreateInstance(); - persistenceProtocolCollection->initialize(persistenceProtocolCollectionInner); - - // Persist doc - rc.CreateInstance(); - rc->initialize(endpoint, applicationCollection, persistenceProtocolCollection, version); - } - } - - if (rc.IsNull()) { - rc = _persistenceUpdate; - } - - _dataReady2Read = false; - - - return rc; -} - -void CPersistenceNamespaceDb::update( - const SmartPtrCPersistenceDoc& persistenceDoc) { - CAF_CM_FUNCNAME("update"); - CAF_CM_LOCK_UNLOCK; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - CAF_CM_LOG_DEBUG_VA0("update"); - if (isDataReady2Update() && isReady()) { - const SmartPtrCPersistenceDoc persistenceCur = persistenceDoc.IsNull() ? _persistenceUpdate : persistenceDoc; - if (! persistenceCur.IsNull()) { - _persistenceUpdate = SmartPtrCPersistenceDoc(); - setValue("version", persistenceCur->getVersion()); - - //Update LocalSecurity info - if (!persistenceCur->getLocalSecurity().IsNull()){ - setValue("ep.local_id", persistenceCur->getLocalSecurity()->getLocalId()); - setValue("ep.private_key", persistenceCur->getLocalSecurity()->getPrivateKey()); - setValue("ep.cert", persistenceCur->getLocalSecurity()->getCert()); - } - - //Update RemoteSecurity info - if (!persistenceCur->getRemoteSecurityCollection().IsNull()){ - std::deque applications = - persistenceCur->getRemoteSecurityCollection()->getRemoteSecurity(); - for (std::deque::iterator appIt = applications.begin(); appIt != applications.end(); appIt++) { - const std::string appKey = "app." + (*appIt)->getRemoteId(); - - setValue(appKey + ".remote_id", (*appIt)->getRemoteId()); - setValue(appKey + ".cms.cert", (*appIt)->getCmsCert()); - setValue(appKey + ".cms.cipher", (*appIt)->getCmsCipherName()); - setValue(appKey + ".protocol_name", (*appIt)->getProtocolName()); - - std::string cmsCertChain; - if (! (*appIt)->getCmsCertCollection().IsNull()) { - Cdeqstr cmsCertList = (*appIt)->getCmsCertCollection()->getCert(); - for (Cdeqstr::iterator cmsCertIt=cmsCertList.begin(); cmsCertIt != cmsCertList.end(); cmsCertIt++) { - if (!cmsCertChain.empty()) { - cmsCertChain += ","; - } - cmsCertChain += *cmsCertIt; - } - - setValue(appKey + ".cms.cert_chain", cmsCertChain); - } - } - } - - //Update PersistenceProtocol info - if (!persistenceCur->getPersistenceProtocolCollection().IsNull()) { - //For now, we only support one broker. - CAF_CM_ASSERT(persistenceCur->getPersistenceProtocolCollection()->getPersistenceProtocol().size() <= 1); - - std::deque brokerList = persistenceCur->getPersistenceProtocolCollection()->getPersistenceProtocol(); - for (std::deque::iterator protIt=brokerList.begin(); protIt != brokerList.end(); protIt++) { - const std::string protocolKey = "protocol." + (*protIt)->getProtocolName(); - setValue(protocolKey + ".protocol_name", (*protIt)->getProtocolName()); - setValue(protocolKey + ".uri", (*protIt)->getUri()); - setValue(protocolKey + ".uri.amqp", (*protIt)->getUriAmqp()); - setValue(protocolKey + ".uri.tunnel", (*protIt)->getUriTunnel()); - setValue(protocolKey + ".tls.cert", (*protIt)->getTlsCert()); - setValue(protocolKey + ".tls.protocol", (*protIt)->getTlsProtocol()); - - Cdeqstr tlsCipherList = (*protIt)->getTlsCipherCollection(); - std::string tlsCiphers; - for (Cdeqstr::iterator tlsCipherIt=tlsCipherList.begin(); tlsCipherIt != tlsCipherList.end(); tlsCipherIt++) { - if (!tlsCiphers.empty()) { - tlsCiphers += ","; - } - tlsCiphers += *tlsCipherIt; - } - setValue(protocolKey + ".tls.ciphers", tlsCiphers); - - if (! (*protIt)->getTlsCertCollection().IsNull()) { - Cdeqstr tlsCertList = (*protIt)->getTlsCertCollection()->getCert(); - std::string tlsCerts; - for (Cdeqstr::iterator tlsCertIt=tlsCertList.begin(); tlsCertIt != tlsCertList.end(); tlsCertIt++) { - if (!tlsCerts.empty()) { - tlsCerts += ","; - } - tlsCerts += *tlsCertIt; - } - setValue(protocolKey + ".tls.cert_chain", tlsCerts); - } - } - } - } - } else { - if (! persistenceDoc.IsNull()) { - _persistenceUpdate = persistenceDoc; - } - } - - _dataReady2Update = false; -} - -void CPersistenceNamespaceDb::remove( - const SmartPtrCPersistenceDoc& persistenceDoc) { - CAF_CM_FUNCNAME("remove"); - CAF_CM_LOCK_UNLOCK; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - CAF_CM_LOG_DEBUG_VA0("remove"); - if (isDataReady2Remove() && isReady()) { - const SmartPtrCPersistenceDoc persistenceCur = persistenceDoc.IsNull() ? _persistenceRemove : persistenceDoc; - if (! persistenceCur.IsNull()) { - _persistenceRemove = SmartPtrCPersistenceDoc(); - if (!persistenceCur->getLocalSecurity().IsNull()){ - if (!persistenceCur->getLocalSecurity()->getLocalId().empty()) { - removeKey("ep.local_id"); - } - if (!persistenceCur->getLocalSecurity()->getPrivateKey().empty()) { - removeKey("ep.private_key"); - } - if (!persistenceCur->getLocalSecurity()->getCert().empty()) { - removeKey("ep.cert"); - } - } - - //Remove RemoteSecurity info - if (!persistenceCur->getRemoteSecurityCollection().IsNull()){ - std::deque applications = persistenceCur->getRemoteSecurityCollection()->getRemoteSecurity(); - for (std::deque::iterator it=applications.begin(); it != applications.end(); it++) { - std::string appKey = "app." + (*it)->getRemoteId(); - if (!(*it)->getProtocolName().empty()) { - removeKey(appKey + ".protocol_name"); - } - if (!(*it)->getCmsCert().empty()) { - removeKey(appKey + ".cms.cert"); - } - if (!(*it)->getCmsCertCollection().IsNull() && !(*it)->getCmsCertCollection()->getCert().empty()) { - removeKey(appKey + ".cms.cert_chain"); - } - if (!(*it)->getCmsCipherName().empty()) { - removeKey(appKey + ".cms.cipher"); - } - } - } - - //Remove PersistenceProtocol info - if (!persistenceCur->getPersistenceProtocolCollection().IsNull()) { - //For now, we only support one broker. - CAF_CM_ASSERT(persistenceCur->getPersistenceProtocolCollection()->getPersistenceProtocol().size() <= 1); - - std::deque brokerList = persistenceCur->getPersistenceProtocolCollection()->getPersistenceProtocol(); - for (std::deque::iterator it=brokerList.begin(); it != brokerList.end(); it++) { - std::string protocolKey = "protocol." + (*it)->getProtocolName(); - if (!(*it)->getUri().empty()) { - removeKey(protocolKey + "uri"); - } - if (!(*it)->getUriAmqp().empty()) { - removeKey(protocolKey + "uri.amqp"); - } - if (!(*it)->getUriTunnel().empty()) { - removeKey(protocolKey + "uri.tunnel"); - } - if (!(*it)->getTlsCert().empty()) { - removeKey(protocolKey + "tls.cert"); - } - if (!(*it)->getTlsProtocol().empty()) { - removeKey(protocolKey + "tls.protocol"); - } - if (!(*it)->getTlsCipherCollection().empty()) { - removeKey(protocolKey + "tls.ciphers"); - } - if (!(*it)->getTlsCertCollection().IsNull() && !(*it)->getTlsCertCollection()->getCert().empty()) { - removeKey(protocolKey + "tls.cert_chain"); - } - } - } - } - } else { - if (! persistenceDoc.IsNull()) { - _persistenceRemove = persistenceDoc; - } - } - - _dataReady2Remove = false; -} - -void CPersistenceNamespaceDb::setCmd() { - CAF_CM_FUNCNAME("setCmd"); - - std::string nsdbCmdDir; - std::string nsdbCmdFile; -#ifdef WIN32 - // "C:/Program Files/VMware/VMware Tools/VMwareNamespaceCmd.exe"; - // bin_dir=C:/Program Files/VMware/VMware Tools/VMware CAF/pme//bin - nsdbCmdDir = AppConfigUtils::getRequiredString("globals", "bin_dir"); - - //Back up two levels - nsdbCmdDir = FileSystemUtils::getDirname(nsdbCmdDir); - nsdbCmdDir = FileSystemUtils::getDirname(nsdbCmdDir); - - nsdbCmdFile = "VMwareNamespaceCmd.exe"; -#else - nsdbCmdDir = "/usr/sbin"; - nsdbCmdFile = "vmware-namespace-cmd"; -#endif - - _nsdbCmdPath = FileSystemUtils::buildPath(nsdbCmdDir, nsdbCmdFile); - CAF_CM_LOG_DEBUG_VA1("_nsdbCmdPath: %s", _nsdbCmdPath.c_str()); - if (!FileSystemUtils::doesFileExist(_nsdbCmdPath)) { - CAF_CM_EXCEPTIONEX_VA1(FileNotFoundException, ERROR_FILE_NOT_FOUND, - "Namespace DB command not found - %s", _nsdbCmdPath.c_str()); - } -} - -std::string CPersistenceNamespaceDb::getValue(const std::string& key) { - CAF_CM_FUNCNAME("getValue"); - CAF_CM_VALIDATE_STRING(key); - - CAF_CM_LOG_DEBUG_VA0("getValue"); - std::string value; - std::string stdoutContent; - std::string stderrContent; - try { - value = getValueRaw(key, stdoutContent, stderrContent); - } - catch(ProcessFailedException* ex){ - CAF_CM_LOG_DEBUG_VA1("ProcessFailedException - %s", ex->getMsg().c_str()); - CAF_CM_EXCEPTION_VA3(E_UNEXPECTED, - "NamespaceDB command failed - %s: %s: %s", - ex->getMsg().c_str(), - stdoutContent.c_str(), - stderrContent.c_str()); - } - return value; -} - -void CPersistenceNamespaceDb::setValue( - const std::string& key, - const std::string& value) { - CAF_CM_FUNCNAME("setValue"); - CAF_CM_VALIDATE_STRING(key); - - CAF_CM_LOG_DEBUG_VA0("setValue"); - if (_removedKeys.find(key) == _removedKeys.end()) { - if (value.empty()) { - CAF_CM_LOG_DEBUG_VA1("Cannot set empty value: %s", key.c_str()); - return; - } - - std::string stdoutContent; - std::string stderrContent; - Cdeqstr argv; - std::string tmpFile; - - try { - tmpFile = FileSystemUtils::saveTempTextFile("caf_nsdb_XXXXXX", value); - CAF_CM_LOG_DEBUG_VA2("Setting %s to %s", key.c_str(), value.c_str()); - argv.push_back(_nsdbCmdPath); - argv.push_back("set-key"); - argv.push_back(_nsdbNamespace); - argv.push_back("-k"); - argv.push_back(key); - argv.push_back("-f"); - argv.push_back(tmpFile); - - ProcessUtils::runSync(argv, stdoutContent, stderrContent); - } - catch(ProcessFailedException* ex){ - CAF_CM_LOG_DEBUG_VA1("exception: %s", ex->getMsg().c_str()); - CAF_CM_EXCEPTION_VA3(E_UNEXPECTED, - "NamespaceDB command failed - %s: %s: %s", - ex->getMsg().c_str(), - stdoutContent.c_str(), - stderrContent.c_str()); - } - if ( !tmpFile.empty() && FileSystemUtils::doesFileExist(tmpFile)) { - FileSystemUtils::removeFile(tmpFile); - } - } else { - CAF_CM_LOG_DEBUG_VA1("Cannot set a removed key: %s", key.c_str()); - } -} - -void CPersistenceNamespaceDb::removeKey(const std::string& key) { - CAF_CM_FUNCNAME("removeKey"); - CAF_CM_VALIDATE_STRING(key); - - CAF_CM_LOG_DEBUG_VA0("removeKey"); - if (_removedKeys.find(key) == _removedKeys.end()) { - std::string stdoutContent; - std::string stderrContent; - Cdeqstr argv; - - try { - argv.push_back(_nsdbCmdPath); - argv.push_back("delete-key"); - argv.push_back(_nsdbNamespace); - argv.push_back("-k"); - argv.push_back(key); - - ProcessUtils::runSync(argv, stdoutContent, stderrContent); - _removedKeys.insert(key); - } - catch(ProcessFailedException* ex){ - CAF_CM_LOG_DEBUG_VA1("exception: %s", ex->getMsg().c_str()); - CAF_CM_EXCEPTION_VA3(E_UNEXPECTED, - "NamespaceDB command failed - %s: %s: %s", - ex->getMsg().c_str(), - stdoutContent.c_str(), - stderrContent.c_str()); - } - } else { - CAF_CM_LOG_DEBUG_VA1("Key already removed: %s", key.c_str()); - } -} - -bool CPersistenceNamespaceDb::isDataReady() { - CAF_CM_FUNCNAME_VALIDATE("isDataReady"); - - CAF_CM_LOG_DEBUG_VA0("isDataReady method"); - - // Check if data is ready to read/modify - bool rc = false; - if (!_polledDuringStart) { - rc = true; - _polledDuringStart = true; - CAF_CM_LOG_DEBUG_VA0("Set NSDB polling during service start"); - } - if (FileSystemUtils::doesFileExist(_nsdbPollerSignalFile)) { - rc = true; - CAF_CM_LOG_DEBUG_VA1("NSDB poller signal file %s exists.", _nsdbPollerSignalFile.c_str()); - FileSystemUtils::removeFile(_nsdbPollerSignalFile); - } - CAF_CM_LOG_DEBUG_VA4("NSDB poller signal file %s, _pollingStartedTimeMs=%ld, _pollingIntervalSecs=%ld, rc=%s.", - _nsdbPollerSignalFile.c_str(), long(_pollingStartedTimeMs), long(_pollingIntervalSecs), rc?"true":"false"); - if (CDateTimeUtils::calcRemainingTime(_pollingStartedTimeMs, _pollingIntervalSecs * 1000) <= 0) { - rc = true; - CAF_CM_LOG_DEBUG_VA0("The next polling interval reached."); - } - if (rc) { - _pollingStartedTimeMs = CDateTimeUtils::getTimeMs(); - _dataReady2Read = _dataReady2Update = _dataReady2Remove = true; - } - - return rc; -} - -bool CPersistenceNamespaceDb::isDataReady2Read() { - CAF_CM_FUNCNAME_VALIDATE("isDataReady2Read"); - - CAF_CM_LOG_DEBUG_VA1("_dataReady2Read = %s", _dataReady2Read?"true":"false"); - - return (isDataReady() || _dataReady2Read); -} - -bool CPersistenceNamespaceDb::isDataReady2Update() { - CAF_CM_FUNCNAME_VALIDATE("isDataReady2Update"); - - CAF_CM_LOG_DEBUG_VA1("_dataReady2Update = %s", _dataReady2Update?"true":"false"); - return (isDataReady() || _dataReady2Update); - -} - -bool CPersistenceNamespaceDb::isDataReady2Remove() { - CAF_CM_FUNCNAME_VALIDATE("isDataReady2Remove"); - - CAF_CM_LOG_DEBUG_VA1("_dataReady2Remove = %s", _dataReady2Remove?"true":"false"); - return (isDataReady() || _dataReady2Remove); - -} - -bool CPersistenceNamespaceDb::isReady() { - CAF_CM_FUNCNAME("isReady"); - - CAF_CM_LOG_DEBUG_VA0("isReady method"); - - - bool rc = true; - if (! _isReady) { - std::string stdoutContent; - std::string stderrContent; - try { - (void) getValueRaw("updates", stdoutContent, stderrContent); - _isReady = true; - } - catch(ProcessFailedException* ex) { - if ((stderrContent.find("There is no namespace database associated with this virtual machine") != std::string::npos) - || (stderrContent.find("Permission denied") != std::string::npos)) { - CAF_CM_LOG_DEBUG_VA1( - "Received expected exception - msg: %s", ex->getMsg().c_str()); - rc = false; - } else { - CAF_CM_LOG_DEBUG_VA3( - "ProcessFailedException - msg: %s, stdout: %s, stderr: %s", - ex->getMsg().c_str(), stdoutContent.c_str(), stderrContent.c_str()); - CAF_CM_EXCEPTION_VA1(E_UNEXPECTED, - "NamespaceDB command failed - msg: %s", ex->getMsg().c_str()); - } - } - } - - return rc; -} - -std::string CPersistenceNamespaceDb::getValueRaw( - const std::string& key, - std::string& stdoutContent, - std::string& stderrContent) { - CAF_CM_FUNCNAME_VALIDATE("getValueRaw"); - CAF_CM_VALIDATE_STRING(key); - - CAF_CM_LOG_ERROR_VA0("getValueRaw"); - Cdeqstr argv; - argv.push_back(_nsdbCmdPath); - argv.push_back("get-value"); - argv.push_back(_nsdbNamespace); - argv.push_back("-k"); - argv.push_back(key); - - ProcessUtils::runSync(argv, stdoutContent, stderrContent); - std::string value = stdoutContent; - - //strip spaces - value = CStringUtils::trim(value); - //strip quotes - //TODO: make this less of a hack and add it to StringUtils - if (value.length() > 1) { - if (value[0] == '"') - value.erase(0,1); - if (value[value.length()-1] == '"') - value.erase(value.length()-1,1); - } - - return value; -} diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CPersistenceNamespaceDb.h b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CPersistenceNamespaceDb.h deleted file mode 100644 index 52b8b53c1..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CPersistenceNamespaceDb.h +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef _MaIntegration_CPersistenceNamespaceDb_h_ -#define _MaIntegration_CPersistenceNamespaceDb_h_ - - -#include "IBean.h" - -#include "Doc/PersistenceDoc/CPersistenceDoc.h" -#include "IPersistence.h" - -using namespace Caf; - -/// TODO - describe class -class CPersistenceNamespaceDb : - public TCafSubSystemObjectRoot, - public IBean, - public IPersistence { -public: - CPersistenceNamespaceDb(); - virtual ~CPersistenceNamespaceDb(); - - CAF_DECLARE_OBJECT_IDENTIFIER(_sObjIdPersistenceNamespaceDb) - - CAF_BEGIN_INTERFACE_MAP(CPersistenceNamespaceDb) - CAF_INTERFACE_ENTRY(IBean) - CAF_INTERFACE_ENTRY(IPersistence) - CAF_END_INTERFACE_MAP() - -public: // IBean - virtual void initializeBean( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties); - - virtual void terminateBean(); - -public: // IPersistence - void initialize(); - - SmartPtrCPersistenceDoc getUpdated( - const int32 timeout); - - void update( - const SmartPtrCPersistenceDoc& persistence); - - void remove( - const SmartPtrCPersistenceDoc& persistence); - -private: - void setCmd(); - - std::string getValue( - const std::string& key); - - void setValue( - const std::string& key, - const std::string& value); - - void removeKey(const std::string& key); - - bool isReady(); - - bool isDataReady(); - - bool isDataReady2Read(); - - bool isDataReady2Update(); - - bool isDataReady2Remove(); - - std::string getValueRaw( - const std::string& key, - std::string& stdoutContent, - std::string& stderrContent); - -private: - bool _isInitialized; - bool _isReady; - bool _dataReady2Read; - bool _dataReady2Update; - bool _dataReady2Remove; - - bool _polledDuringStart; - uint32 _pollingIntervalSecs; - uint64 _pollingStartedTimeMs; - - std::string _nsdbCmdPath; - std::string _nsdbNamespace; - std::string _nsdbPollerSignalFile; - Csetstr _removedKeys; - std::string _updates; - - SmartPtrCPersistenceDoc _persistenceUpdate; - SmartPtrCPersistenceDoc _persistenceRemove; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_CREATE_THREADSAFE; - CAF_CM_DECLARE_NOCOPY(CPersistenceNamespaceDb); -}; - -#endif // #ifndef _MaIntegration_CPersistenceNamespaceDb_h_ diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CPersistenceOutboundChannelAdapterInstance.cpp b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CPersistenceOutboundChannelAdapterInstance.cpp deleted file mode 100644 index 9558bb5e4..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CPersistenceOutboundChannelAdapterInstance.cpp +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "CPersistenceMessageHandler.h" -#include "Common/IAppContext.h" -#include "IBean.h" -#include "IPersistence.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/IMessageChannel.h" -#include "Integration/IMessageHandler.h" -#include "CPersistenceOutboundChannelAdapterInstance.h" - -using namespace Caf; - -CPersistenceOutboundChannelAdapterInstance::CPersistenceOutboundChannelAdapterInstance() : - _isInitialized(false), - _isRunning(false), - CAF_CM_INIT_LOG("CPersistenceOutboundChannelAdapterInstance") { -} - -CPersistenceOutboundChannelAdapterInstance::~CPersistenceOutboundChannelAdapterInstance() { -} - -void CPersistenceOutboundChannelAdapterInstance::initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - - _id = configSection->findRequiredAttribute("id"); - _configSection = configSection; - - _isInitialized = true; -} - -std::string CPersistenceOutboundChannelAdapterInstance::getId() const { - CAF_CM_FUNCNAME_VALIDATE("getId"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _id; -} - -void CPersistenceOutboundChannelAdapterInstance::wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver) { - CAF_CM_FUNCNAME_VALIDATE("wire"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(appContext); - CAF_CM_VALIDATE_INTERFACE(channelResolver); - - const SmartPtrIPersistence persistence = createPersistence(appContext); - if (! persistence.IsNull()) { - const SmartPtrIMessageChannel errorMessageChannel = - channelResolver->resolveChannelName("errorChannel"); - - const std::string inputChannelStr = _configSection->findRequiredAttribute("channel"); - SmartPtrIMessageChannel inputChannel = channelResolver->resolveChannelName(inputChannelStr); - SmartPtrIIntegrationObject inputChannelObj; - inputChannelObj.QueryInterface(inputChannel); - - SmartPtrCPersistenceMessageHandler persistenceMessageHandler; - persistenceMessageHandler.CreateInstance(); - persistenceMessageHandler->initialize(_configSection, persistence); - SmartPtrIMessageHandler messageHandler; - messageHandler.QueryInterface(persistenceMessageHandler); - - _messagingTemplate.CreateInstance(); - _messagingTemplate->initialize( - channelResolver, - inputChannelObj, - errorMessageChannel, - SmartPtrIMessageChannel(), - messageHandler); - } -} - -void CPersistenceOutboundChannelAdapterInstance::start( - const uint32 timeoutMs) { - CAF_CM_FUNCNAME_VALIDATE("start"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_BOOL(!_isRunning); - - if (! _messagingTemplate.IsNull()) { - _isRunning = true; - _messagingTemplate->start(0); - } -} - -void CPersistenceOutboundChannelAdapterInstance::stop( - const uint32 timeoutMs) { - CAF_CM_FUNCNAME_VALIDATE("stop"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_BOOL(_isRunning); - - if (! _messagingTemplate.IsNull()) { - _isRunning = false; - _messagingTemplate->stop(0); - } -} - -bool CPersistenceOutboundChannelAdapterInstance::isRunning() const { - CAF_CM_FUNCNAME_VALIDATE("isRunning"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _isRunning; -} - -SmartPtrIPersistence CPersistenceOutboundChannelAdapterInstance::createPersistence( - const SmartPtrIAppContext& appContext) const { - CAF_CM_FUNCNAME("createPersistence"); - CAF_CM_VALIDATE_INTERFACE(appContext); - - SmartPtrIPersistence rc; - const std::string removeRefStr = _configSection->findRequiredAttribute("ref"); - CAF_CM_LOG_DEBUG_VA1("Creating the persistence impl - %s", removeRefStr.c_str()); - const SmartPtrIBean bean = appContext->getBean(removeRefStr); - rc.QueryInterface(bean, false); - CAF_CM_VALIDATE_INTERFACE(rc); - - try { - rc->initialize(); - } - CAF_CM_CATCH_CAF - CAF_CM_CATCH_DEFAULT; - - if (CAF_CM_ISEXCEPTION) { - CAF_CM_LOG_WARN_VA2("initialize failed - ref: %s, msg: %s", - removeRefStr.c_str(), (CAF_CM_EXCEPTION_GET_FULLMSG).c_str()); - rc = SmartPtrIPersistence(); - CAF_CM_CLEAREXCEPTION; - } - - return rc; -} diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CPersistenceOutboundChannelAdapterInstance.h b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CPersistenceOutboundChannelAdapterInstance.h deleted file mode 100644 index 5341c8cd4..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CPersistenceOutboundChannelAdapterInstance.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CPersistenceOutboundChannelAdapterInstance_h_ -#define CPersistenceOutboundChannelAdapterInstance_h_ - - -#include "Integration/IIntegrationComponentInstance.h" - -#include "Common/IAppContext.h" -#include "IPersistence.h" -#include "Integration/Core/CMessagingTemplate.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/ILifecycle.h" - -namespace Caf { - -class CPersistenceOutboundChannelAdapterInstance : - public IIntegrationObject, - public IIntegrationComponentInstance, - public ILifecycle { -public: - CPersistenceOutboundChannelAdapterInstance(); - virtual ~CPersistenceOutboundChannelAdapterInstance(); - - CAF_BEGIN_QI() - CAF_QI_ENTRY(IIntegrationObject) - CAF_QI_ENTRY(IIntegrationComponentInstance) - CAF_QI_ENTRY(ILifecycle) - CAF_END_QI() - -public: // IIntegrationObject - void initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection); - - std::string getId() const; - -public: // IIntegrationComponentInstance - void wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver); - -public: // ILifecycle - void start(const uint32 timeoutMs); - - void stop(const uint32 timeoutMs); - - bool isRunning() const; - -private: - SmartPtrIPersistence createPersistence( - const SmartPtrIAppContext& appContext) const; - -private: - bool _isInitialized; - bool _isRunning; - std::string _id; - SmartPtrIDocument _configSection; - SmartPtrCMessagingTemplate _messagingTemplate; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CPersistenceOutboundChannelAdapterInstance); -}; - -CAF_DECLARE_SMART_QI_POINTER(CPersistenceOutboundChannelAdapterInstance); -} - -#endif // #ifndef CPersistenceOutboundChannelAdapterInstance_h_ diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CPersistenceReadingMessageSource.cpp b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CPersistenceReadingMessageSource.cpp deleted file mode 100644 index 66225e454..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CPersistenceReadingMessageSource.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Doc/PersistenceDoc/CPersistenceDoc.h" -#include "IPersistence.h" -#include "Integration/Core/CIntMessage.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "CPersistenceReadingMessageSource.h" -#include "Exception/CCafException.h" -#include "Doc/DocXml/PersistenceXml/PersistenceXmlRoots.h" - -using namespace Caf; - -CPersistenceReadingMessageSource::CPersistenceReadingMessageSource() : - _isInitialized(false), - CAF_CM_INIT_LOG("CPersistenceReadingMessageSource") { -} - -CPersistenceReadingMessageSource::~CPersistenceReadingMessageSource() { -} - -void CPersistenceReadingMessageSource::initialize( - const SmartPtrIDocument& configSection, - const SmartPtrIPersistence& persistence) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - CAF_CM_VALIDATE_SMARTPTR(persistence); - - _id = configSection->findRequiredAttribute("id"); - const SmartPtrIDocument pollerDoc = configSection->findOptionalChild("poller"); - - _persistence = persistence; - - setPollerMetadata(pollerDoc); - - _isInitialized = true; -} - -bool CPersistenceReadingMessageSource::doSend( - const SmartPtrIIntMessage&, - int32) { - CAF_CM_FUNCNAME("doSend"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - CAF_CM_EXCEPTIONEX_VA1( - UnsupportedOperationException, - E_NOTIMPL, - "This is not a sending channel: %s", _id.c_str()); -} - -SmartPtrIIntMessage CPersistenceReadingMessageSource::doReceive( - const int32 timeout) { - CAF_CM_FUNCNAME("receive"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - if (timeout > 0) { - CAF_CM_EXCEPTIONEX_VA1(UnsupportedOperationException, E_INVALIDARG, - "Timeout not currently supported: %s", _id.c_str()); - } - - SmartPtrIIntMessage message; - const SmartPtrCPersistenceDoc persistence = _persistence->getUpdated(0); - if (! persistence.IsNull()) { - SmartPtrCIntMessage messageImpl; - messageImpl.CreateInstance(); - messageImpl->initializeStr(XmlRoots::savePersistenceToString(persistence), - IIntMessage::SmartPtrCHeaders(), IIntMessage::SmartPtrCHeaders()); - message = messageImpl; - } - - return message; -} diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CProviderCollectSchemaExecutor.cpp b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CProviderCollectSchemaExecutor.cpp deleted file mode 100644 index 420040aa8..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CProviderCollectSchemaExecutor.cpp +++ /dev/null @@ -1,347 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Doc/DocXml/ProviderInfraXml/ProviderInfraXmlRoots.h" -#include "Doc/DocXml/ProviderResultsXml/ProviderResultsXmlRoots.h" -#include "Doc/DocXml/ResponseXml/ResponseXmlRoots.h" - -#include "Common/CLoggingSetter.h" -#include "Doc/CafCoreTypesDoc/CAttachmentCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CAttachmentDoc.h" -#include "Doc/CafCoreTypesDoc/CFullyQualifiedClassGroupDoc.h" -#include "Doc/ProviderInfraDoc/CClassCollectionDoc.h" -#include "Doc/ProviderInfraDoc/CProviderRegDoc.h" -#include "Doc/ProviderInfraDoc/CSchemaSummaryDoc.h" -#include "Doc/ProviderResultsDoc/CSchemaDoc.h" -#include "Doc/ResponseDoc/CProviderResponseDoc.h" -#include "Doc/SchemaTypesDoc/CActionClassDoc.h" -#include "Doc/SchemaTypesDoc/CDataClassDoc.h" -#include "Integration/IIntMessage.h" -#include "Memory/DynamicArray/DynamicArrayInc.h" -#include "Exception/CCafException.h" -#include "CProviderCollectSchemaExecutor.h" -#include "Integration/Caf/CCafMessageCreator.h" -#include "Integration/Caf/CCafMessagePayloadParser.h" - -using namespace Caf; - -CProviderCollectSchemaExecutor::CProviderCollectSchemaExecutor() : - _isInitialized(false), - CAF_CM_INIT_LOG("CProviderCollectSchemaExecutor") { -} - -CProviderCollectSchemaExecutor::~CProviderCollectSchemaExecutor() { -} - -void CProviderCollectSchemaExecutor::initializeBean( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties) { - CAF_CM_FUNCNAME_VALIDATE("initializeBean"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STL_EMPTY(ctorArgs); - CAF_CM_VALIDATE_STL_EMPTY(properties); - - const std::string schemaCacheDirPath = AppConfigUtils::getRequiredString( - _sProviderHostArea, _sConfigSchemaCacheDir); - const std::string schemaCacheDirPathExp = CStringUtils::expandEnv(schemaCacheDirPath); - if (!FileSystemUtils::doesDirectoryExist(schemaCacheDirPathExp)) { - CAF_CM_LOG_INFO_VA1( - "Schema cache directory does not exist... creating - %s", - schemaCacheDirPathExp.c_str()); - FileSystemUtils::createDirectory(schemaCacheDirPathExp); - } - - const std::string invokersDir = AppConfigUtils::getRequiredString( - _sProviderHostArea, _sConfigInvokersDir); - const std::string invokersDirExp = CStringUtils::expandEnv(invokersDir); - if (!FileSystemUtils::doesDirectoryExist(invokersDirExp)) { - CAF_CM_LOG_INFO_VA1( - "Invokers directory does not exist... creating - %s", - invokersDirExp.c_str()); - FileSystemUtils::createDirectory(invokersDirExp); - } - - _schemaCacheDirPath = schemaCacheDirPathExp; - _invokersDir = invokersDirExp; - _isInitialized = true; -} - -void CProviderCollectSchemaExecutor::terminateBean() { - -} - -SmartPtrIIntMessage CProviderCollectSchemaExecutor::processMessage( - const SmartPtrIIntMessage& message) { - CAF_CM_FUNCNAME_VALIDATE("processMessage"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(message); - - CAF_CM_LOG_DEBUG_VA2("Called - schemaCacheDirPath: %s, invokersDir: %s", - _schemaCacheDirPath.c_str(), _invokersDir.c_str()); - - SmartPtrCLoggingSetter loggingSetter; - loggingSetter.CreateInstance(); - - const SmartPtrCProviderRegDoc providerReg = - CCafMessagePayloadParser::getProviderReg(message->getPayload()); - - const std::string providerNamespace = providerReg->getProviderNamespace(); - const std::string providerName = providerReg->getProviderName(); - const std::string providerVersion = providerReg->getProviderVersion(); - - std::string providerVersionNew = providerVersion; - std::replace(providerVersionNew.begin(), providerVersionNew.end(), '.', '_'); - - const std::string providerDirName = - providerNamespace + "_" + providerName + "_" + providerVersionNew; - const std::string providerSchemaCacheDir = - FileSystemUtils::buildPath(_schemaCacheDirPath, providerDirName); - const std::string providerResponsePath = - FileSystemUtils::buildPath(providerSchemaCacheDir, _sProviderResponseFilename); - - executeProvider(providerReg, _invokersDir, providerSchemaCacheDir, - providerResponsePath, loggingSetter); - - const std::string relFilename = - FileSystemUtils::buildPath(providerDirName, _sProviderResponseFilename); - const SmartPtrCDynamicByteArray providerResponse = - FileSystemUtils::loadByteFile(providerResponsePath); - - return CCafMessageCreator::createFromProviderResponse( - providerResponse, relFilename, message->getHeaders()); -} - -void CProviderCollectSchemaExecutor::executeProvider( - const SmartPtrCProviderRegDoc& providerReg, - const std::string& invokersDir, - const std::string& providerSchemaCacheDir, - const std::string& providerResponsePath, - SmartPtrCLoggingSetter& loggingSetter) const { - CAF_CM_FUNCNAME("executeProvider"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_SMARTPTR(providerReg); - CAF_CM_VALIDATE_STRING(invokersDir); - CAF_CM_VALIDATE_STRING(providerSchemaCacheDir); - CAF_CM_VALIDATE_STRING(providerResponsePath); - CAF_CM_VALIDATE_SMARTPTR(loggingSetter); - - const std::string providerNamespace = providerReg->getProviderNamespace(); - const std::string providerName = providerReg->getProviderName(); - const std::string providerVersion = providerReg->getProviderVersion(); - const std::string invokerRelPath = providerReg->getInvokerRelPath(); - - const std::string schemaSummaryPath = - FileSystemUtils::buildPath(providerSchemaCacheDir, _sSchemaSummaryFilename); - - if (FileSystemUtils::doesFileExist(schemaSummaryPath)) { - CAF_CM_LOG_INFO_VA1( - "Schema summary file already exists - %s", schemaSummaryPath.c_str()); - } else { - std::string invokerPath; - if (! invokerRelPath.empty()) { - const std::string invokerRelPathExp = CStringUtils::expandEnv(invokerRelPath); - invokerPath = FileSystemUtils::buildPath(invokersDir, invokerRelPathExp); - - if (!FileSystemUtils::doesFileExist(invokerPath)) { - CAF_CM_EXCEPTIONEX_VA1(FileNotFoundException, ERROR_FILE_NOT_FOUND, - "Invoker does not exist - %s", invokerPath.c_str()); - } - - setupSchemaCacheDir(providerSchemaCacheDir, loggingSetter); - runProvider(invokerPath, providerSchemaCacheDir); - } else { - CAF_CM_EXCEPTIONEX_VA1(InvalidArgumentException, E_INVALIDARG, - "Unrecognized provider URI protocol in Provider Registration file - %s", providerName.c_str()); - } - - const std::string schemaPath = findSchemaPath(providerResponsePath); - const SmartPtrCSchemaSummaryDoc schemaSummary = createSchemaSummary( - schemaPath, invokerPath, providerNamespace, providerName, providerVersion); - - const std::string schemaSummaryMem = XmlRoots::saveSchemaSummaryToString(schemaSummary); - FileSystemUtils::saveTextFile(schemaSummaryPath, schemaSummaryMem); - } -} - -void CProviderCollectSchemaExecutor::setupSchemaCacheDir( - const std::string& providerSchemaCacheDir, - const SmartPtrCLoggingSetter& loggingSetter) const { - CAF_CM_FUNCNAME_VALIDATE("setupSchemaCacheDir"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(providerSchemaCacheDir); - CAF_CM_VALIDATE_SMARTPTR(loggingSetter); - - if (FileSystemUtils::doesDirectoryExist(providerSchemaCacheDir)) { - CAF_CM_LOG_INFO_VA1( - "Removing the schema cache directory because it appears to be incomplete - %s", - providerSchemaCacheDir.c_str()); - FileSystemUtils::recursiveRemoveDirectory(providerSchemaCacheDir); - } - - FileSystemUtils::createDirectory(providerSchemaCacheDir); - loggingSetter->initialize(providerSchemaCacheDir); -} - -void CProviderCollectSchemaExecutor::runProvider( - const std::string& invokerPath, - const std::string& providerSchemaCacheDir) const { - CAF_CM_FUNCNAME_VALIDATE("runProvider"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(invokerPath); - CAF_CM_VALIDATE_STRING(providerSchemaCacheDir); - - CAF_CM_LOG_DEBUG_VA2( - "Executing the command - %s --schema -o %s", - invokerPath.c_str(), providerSchemaCacheDir.c_str()); - - std::string newProviderSchemaCacheDir = FileSystemUtils::normalizePathWithForward( - providerSchemaCacheDir); - - Cdeqstr argv; - argv.push_back(invokerPath); - argv.push_back("--schema"); - argv.push_back("-o"); - argv.push_back(newProviderSchemaCacheDir); - - const std::string stdoutPath = FileSystemUtils::buildPath( - newProviderSchemaCacheDir, _sStdoutFilename); - const std::string stderrPath = FileSystemUtils::buildPath( - newProviderSchemaCacheDir, _sStderrFilename); - - ProcessUtils::runSyncToFiles(argv, stdoutPath, stderrPath); -} - -SmartPtrCSchemaSummaryDoc CProviderCollectSchemaExecutor::createSchemaSummary( - const std::string& schemaPath, - const std::string& invokerPath, - const std::string& providerNamespace, - const std::string& providerName, - const std::string& providerVersion) const { - CAF_CM_FUNCNAME_VALIDATE("createSchemaSummary"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(schemaPath); - CAF_CM_VALIDATE_STRING(invokerPath); - CAF_CM_VALIDATE_STRING(providerNamespace); - CAF_CM_VALIDATE_STRING(providerName); - CAF_CM_VALIDATE_STRING(providerVersion); - - std::deque fqcCollection; - - const std::string schemaMem = FileSystemUtils::loadTextFile(schemaPath); - const SmartPtrCSchemaDoc schema = XmlRoots::parseSchemaFromString(schemaMem); - - const std::deque dataClassCollection = schema->getDataClassCollection(); - for (TConstIterator > dataClassIter(dataClassCollection); - dataClassIter; dataClassIter++) { - const SmartPtrCDataClassDoc dataClass = *dataClassIter; - - SmartPtrCFullyQualifiedClassGroupDoc fqc; - fqc.CreateInstance(); - fqc->initialize(dataClass->getNamespaceVal(), dataClass->getName(), dataClass->getVersion()); - - fqcCollection.push_back(fqc); - } - - const std::deque actionClassCollection = schema->getActionClassCollection(); - for (TConstIterator > actionClassIter(actionClassCollection); - actionClassIter; actionClassIter++) { - const SmartPtrCActionClassDoc actionClass = *actionClassIter; - - SmartPtrCFullyQualifiedClassGroupDoc fqc; - fqc.CreateInstance(); - fqc->initialize(actionClass->getNamespaceVal(), actionClass->getName(), actionClass->getVersion()); - - fqcCollection.push_back(fqc); - } - - SmartPtrCClassCollectionDoc classCollection; - classCollection.CreateInstance(); - classCollection->initialize(fqcCollection); - - SmartPtrCSchemaSummaryDoc schemaSummary; - schemaSummary.CreateInstance(); - schemaSummary->initialize(providerNamespace, providerName, providerVersion, - classCollection, invokerPath); - - return schemaSummary; -} - -std::string CProviderCollectSchemaExecutor::findSchemaPath( - const std::string& providerResponsePath) const { - CAF_CM_FUNCNAME("findSchemaPath"); - CAF_CM_VALIDATE_STRING(providerResponsePath); - - const std::string providerResponseMem = FileSystemUtils::loadTextFile(providerResponsePath); - const SmartPtrCProviderResponseDoc providerResponse = - XmlRoots::parseProviderResponseFromString(providerResponseMem); - - std::string schemaPath; - const SmartPtrCAttachmentCollectionDoc attachmentCollection = providerResponse->getAttachmentCollection(); - if (attachmentCollection.IsNull()) { - CAF_CM_LOG_INFO_VA1( - "Provider response doesn't contain an attachment collection - %s", - providerResponsePath.c_str()); - } else { - const std::deque attachmentCollectionInner = attachmentCollection->getAttachment(); - if (attachmentCollectionInner.empty()) { - CAF_CM_LOG_INFO_VA1( - "Provider response contains an empty attachment collection - %s", - providerResponsePath.c_str()); - } else { - for(TConstIterator > attachmentIter(attachmentCollectionInner); - attachmentIter; attachmentIter++) { - const SmartPtrCAttachmentDoc attachment = *attachmentIter; - const std::string attachmentName = attachment->getName(); - const std::string attachmentType = attachment->getType(); - - if((attachmentType.compare("cdif") == 0) && - (attachmentName.find("-collectSchema-") != std::string::npos)) { - if(! schemaPath.empty()) { - CAF_CM_EXCEPTIONEX_VA3(DuplicateElementException, ERROR_ALREADY_EXISTS, - "Found multiple schema files - \"%s\" and \"%s\" in %s", - attachmentName.c_str(), schemaPath.c_str(), providerResponsePath.c_str()); - } - - const std::string attachmentUri = attachment->getUri(); - - UriUtils::SUriRecord uriRecord; - UriUtils::parseUriString(attachmentUri, uriRecord); - - if(uriRecord.protocol.compare("file") != 0) { - CAF_CM_EXCEPTIONEX_VA3(InvalidArgumentException, ERROR_INVALID_DATA, - "Unsupported protocol (%s != \"file\") - %s in %s", - uriRecord.protocol.c_str(), attachmentUri.c_str(), providerResponsePath.c_str()); - } - - UriUtils::SFileUriRecord fileUriRecord; - UriUtils::parseFileAddress(uriRecord.address, fileUriRecord); - - schemaPath = CStringUtils::expandEnv(fileUriRecord.path); - if(! FileSystemUtils::doesFileExist(schemaPath)) { - CAF_CM_EXCEPTIONEX_VA2(FileNotFoundException, ERROR_FILE_NOT_FOUND, - "Schema file not found - %s in manifest %s", - schemaPath.c_str(), providerResponsePath.c_str()); - } - } else { - CAF_CM_LOG_DEBUG_VA3( - "Provider response attachment is not a cdif collectSchema - type: %s, name: %s, path: %s", - attachmentType.c_str(), attachmentName.c_str(), - providerResponsePath.c_str()); - } - } - } - } - - if(schemaPath.empty()) { - CAF_CM_EXCEPTIONEX_VA1(FileNotFoundException, ERROR_FILE_NOT_FOUND, - "Schema not found in manifest - %s", providerResponsePath.c_str()); - } - - return schemaPath; -} diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CProviderCollectSchemaExecutor.h b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CProviderCollectSchemaExecutor.h deleted file mode 100644 index 87def45bd..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CProviderCollectSchemaExecutor.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CProviderCollectSchemaExecutor_h_ -#define CProviderCollectSchemaExecutor_h_ - - -#include "IBean.h" - -#include "Common/CLoggingSetter.h" -#include "Doc/ProviderInfraDoc/CProviderRegDoc.h" -#include "Doc/ProviderInfraDoc/CSchemaSummaryDoc.h" -#include "Integration/IIntMessage.h" -#include "Integration/IMessageProcessor.h" - -using namespace Caf; - -/// TODO - describe class -class CProviderCollectSchemaExecutor : - public TCafSubSystemObjectRoot, - public IBean, - public IMessageProcessor { -public: - CProviderCollectSchemaExecutor(); - virtual ~CProviderCollectSchemaExecutor(); - - CAF_DECLARE_OBJECT_IDENTIFIER(_sObjIdProviderCollectSchemaExecutor) - - CAF_BEGIN_INTERFACE_MAP(CProviderCollectSchemaExecutor) - CAF_INTERFACE_ENTRY(IBean) - CAF_INTERFACE_ENTRY(IMessageProcessor) - CAF_END_INTERFACE_MAP() - -public: // IBean - virtual void initializeBean( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties); - - virtual void terminateBean(); - -public: // IMessageProcessor - SmartPtrIIntMessage processMessage( - const SmartPtrIIntMessage& message); - -private: - void executeProvider( - const SmartPtrCProviderRegDoc& providerReg, - const std::string& invokersDir, - const std::string& providerSchemaCacheDir, - const std::string& providerResponsePath, - SmartPtrCLoggingSetter& loggingSetter) const; - - void setupSchemaCacheDir( - const std::string& providerSchemaCacheDir, - const SmartPtrCLoggingSetter& loggingSetter) const; - - void runProvider( - const std::string& invokerPath, - const std::string& providerSchemaCacheDir) const; - - SmartPtrCSchemaSummaryDoc createSchemaSummary( - const std::string& schemaPath, - const std::string& invokerPath, - const std::string& providerNamespace, - const std::string& providerName, - const std::string& providerVersion) const; - - std::string findSchemaPath( - const std::string& providerResponsePath) const; - -private: - bool _isInitialized; - std::string _schemaCacheDirPath; - std::string _invokersDir; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CProviderCollectSchemaExecutor); -}; - -#endif // #ifndef CProviderCollectSchemaExecutor_h_ diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CProviderExecutor.cpp b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CProviderExecutor.cpp deleted file mode 100644 index ef22b4d7c..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CProviderExecutor.cpp +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "CProviderExecutorRequest.h" -#include "Common/IAppContext.h" -#include "IBean.h" -#include "Integration/Core/CErrorHandler.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "Integration/IIntegrationComponent.h" -#include "Integration/IIntegrationComponentInstance.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/ITransformer.h" -#include "Exception/CCafException.h" -#include "CProviderExecutor.h" - -using namespace Caf; - -CProviderExecutor::CProviderExecutor() : - _isInitialized(false), - CAF_CM_INIT_LOG("CProviderExecutor") { -} - -CProviderExecutor::~CProviderExecutor() { -} - -void CProviderExecutor::initializeBean( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties) { - - CAF_CM_FUNCNAME_VALIDATE("initializeBean"); - - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STL_EMPTY(ctorArgs); - - IBean::Cprops::const_iterator itr = properties.find("beginImpersonationBeanRef"); - if (itr != properties.end()) { - _beginImpersonationBeanId = itr->second; - } - - itr = properties.find("endImpersonationBeanRef"); - if (itr != properties.end()) { - _endImpersonationBeanId = itr->second; - } - - _isInitialized = true; -} - -void CProviderExecutor::terminateBean() { -} - -void CProviderExecutor::wire(const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver) { - - CAF_CM_FUNCNAME_VALIDATE("wire"); - - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(appContext); - CAF_CM_VALIDATE_INTERFACE(channelResolver); - - if (AppConfigUtils::getOptionalBoolean(_sManagementAgentArea, "use_impersonation")) { - _beginImpersonationTransformer = loadTransformer(_beginImpersonationBeanId, appContext, channelResolver); - _endImpersonationTransformer = loadTransformer(_endImpersonationBeanId, appContext, channelResolver); - } - - SmartPtrCErrorHandler errorHandler; - errorHandler.CreateInstance(); - errorHandler->initialize(channelResolver, channelResolver->resolveChannelName("errorChannel")); - _errorHandler = errorHandler; -} - -SmartPtrITransformer CProviderExecutor::loadTransformer( - const std::string& id, - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver) { - - CAF_CM_FUNCNAME("loadTransformer"); - - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(appContext); - CAF_CM_VALIDATE_STRING(id); - - SmartPtrITransformer transformer; - if (!id.empty()) { - const SmartPtrIBean bean = appContext->getBean(id); - SmartPtrIIntegrationComponent integrationComponent; - integrationComponent.QueryInterface(bean, false); - if (!integrationComponent) { - CAF_CM_EXCEPTIONEX_VA1(InvalidArgumentException, 0, - "Bean is not an integration component - %s", id.c_str()); - } - - SmartPtrIDocument configSection; - SmartPtrIIntegrationObject integrationObject; - integrationObject = integrationComponent->createObject(configSection); - - SmartPtrIIntegrationComponentInstance integrationComponentInstance; - integrationComponentInstance.QueryInterface(integrationObject, false); - if (!integrationComponentInstance.IsNull()) { - integrationComponentInstance->wire(appContext, channelResolver); - } - - transformer.QueryInterface(integrationObject, false); - CAF_CM_VALIDATE_INTERFACE(transformer); - } - return transformer; -} - -void CProviderExecutor::handleMessage(const SmartPtrIIntMessage& message) { - CAF_CM_FUNCNAME_VALIDATE("handleMessage"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_SMARTPTR(message); - - CAF_CM_LOG_DEBUG_VA0("Called"); - - SmartPtrCProviderExecutorRequest executorRequest; - executorRequest.CreateInstance(); - executorRequest->initialize(message); - - const std::string& providerUri = executorRequest->getProviderUri(); - SmartPtrCProviderExecutorRequestHandler handler = _handlers[providerUri]; - if (handler == NULL) { - SmartPtrCProviderExecutorRequestHandler requestHandler; - requestHandler.CreateInstance(); - requestHandler->initialize(providerUri, _beginImpersonationTransformer, - _endImpersonationTransformer, _errorHandler); - _handlers[providerUri] = requestHandler; - handler = requestHandler; - } - handler->handleRequest(executorRequest); -} - -SmartPtrIIntMessage CProviderExecutor::getSavedMessage() const { - return NULL; -} - -void CProviderExecutor::clearSavedMessage() { -} diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CProviderExecutor.h b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CProviderExecutor.h deleted file mode 100644 index b1b499f6f..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CProviderExecutor.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CProviderExecutor_h_ -#define CProviderExecutor_h_ - - -#include "IBean.h" - -#include "CProviderExecutorRequestHandler.h" -#include "Common/IAppContext.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IErrorHandler.h" -#include "Integration/IIntMessage.h" -#include "Integration/ITransformer.h" -#include "Integration/IIntegrationComponentInstance.h" -#include "Integration/IMessageHandler.h" - -using namespace Caf; - -/// TODO - describe class -class CProviderExecutor : - public TCafSubSystemObjectRoot, - public IBean, - public IIntegrationComponentInstance, - public IMessageHandler { - -public: - CProviderExecutor(); - virtual ~CProviderExecutor(); - - CAF_DECLARE_OBJECT_IDENTIFIER(_sObjIdProviderExecutor) - - CAF_BEGIN_INTERFACE_MAP(CProviderExecutor) - CAF_INTERFACE_ENTRY(IBean) - CAF_INTERFACE_ENTRY(IIntegrationComponentInstance) - CAF_INTERFACE_ENTRY(IMessageHandler) - CAF_END_INTERFACE_MAP() - -public: // IBean - virtual void initializeBean( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties); - - virtual void terminateBean(); - -public: // IIntegrationComponentInstance - virtual void wire(const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver); - -public: // IMessageHandler - virtual void handleMessage(const SmartPtrIIntMessage& message); - SmartPtrIIntMessage getSavedMessage() const; - void clearSavedMessage(); - -private: - SmartPtrITransformer loadTransformer( - const std::string& id, - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver); - -private: - bool _isInitialized; - std::map _handlers; - std::string _beginImpersonationBeanId; - std::string _endImpersonationBeanId; - SmartPtrITransformer _beginImpersonationTransformer; - SmartPtrITransformer _endImpersonationTransformer; - SmartPtrIErrorHandler _errorHandler; - - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CProviderExecutor); -}; - -#endif // #ifndef CProviderExecutor_h_ diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CProviderExecutorRequest.cpp b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CProviderExecutorRequest.cpp deleted file mode 100644 index df2999382..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CProviderExecutorRequest.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Author: brets - * Created: Nov 20, 2015 - * - * Copyright (C) 2015-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Doc/CafCoreTypesDoc/CPropertyDoc.h" -#include "Doc/ProviderRequestDoc/CProviderRequestDoc.h" -#include "Integration/IIntMessage.h" -#include "CProviderExecutorRequest.h" -#include "Exception/CCafException.h" -#include "CProviderExecutor.h" -#include "Integration/Caf/CCafMessagePayloadParser.h" - -using namespace Caf; - -CProviderExecutorRequest::CProviderExecutorRequest() : - _isInitialized(false), - CAF_CM_INIT_LOG("CProviderExecutorRequest") { -} - -CProviderExecutorRequest::~CProviderExecutorRequest() { -} - -void CProviderExecutorRequest::initialize(const SmartPtrIIntMessage& message) { - CAF_CM_FUNCNAME("initialize"); - - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(message); - - CAF_CM_LOG_DEBUG_VA0("Called"); - - _internalRequest = message; - _request = CCafMessagePayloadParser::getProviderRequest(message->getPayload()); - - std::deque properties = - _request->getRequestHeader()->getEchoPropertyBag()->getProperty(); - - std::string relDirectory; - for(std::deque::const_iterator itr = properties.begin(); itr != properties.end(); itr++) { - if ((*itr)->getName().compare("relDirectory") == 0) { - relDirectory = (*itr)->getValue().front(); - } else if ((*itr)->getName().compare("providerUri") == 0) { - _providerUri = (*itr)->getValue().front(); - } - } - - if (relDirectory.empty() || _providerUri.empty()) { - CAF_CM_EXCEPTIONEX_VA2(Caf::NoSuchElementException, ERROR_NOT_FOUND, - "Missing provider request information - relDirectory: [%s] providerUri: [%s]", - relDirectory.c_str(), _providerUri.c_str()); - } - - const std::string configOutputDir = AppConfigUtils::getRequiredString(_sConfigOutputDir); - _outputDir = FileSystemUtils::buildPath(configOutputDir, _sProviderHostArea, relDirectory); - - _isInitialized = true; -} - -const SmartPtrCProviderRequestDoc CProviderExecutorRequest::getRequest() const { - CAF_CM_FUNCNAME_VALIDATE("getRequest"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _request; -} - -const SmartPtrIIntMessage CProviderExecutorRequest::getInternalRequest() const { - CAF_CM_FUNCNAME_VALIDATE("getRequest"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _internalRequest; -} - -const std::string& CProviderExecutorRequest::getOutputDirectory() const { - CAF_CM_FUNCNAME_VALIDATE("getOutputDirectory"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _outputDir; -} - -const std::string& CProviderExecutorRequest::getProviderUri() const { - CAF_CM_FUNCNAME_VALIDATE("getProviderUri"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - return _providerUri; -} - diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CProviderExecutorRequestHandler.cpp b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CProviderExecutorRequestHandler.cpp deleted file mode 100644 index 8c1d1ea87..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CProviderExecutorRequestHandler.cpp +++ /dev/null @@ -1,263 +0,0 @@ -/* - * Author: brets - * Created: Nov 20, 2015 - * - * Copyright (C) 2015-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "CResponseFactory.h" -#include "CProviderExecutorRequest.h" -#include "Common/CLoggingSetter.h" -#include "Doc/ProviderRequestDoc/CProviderRequestDoc.h" -#include "Doc/ResponseDoc/CResponseDoc.h" -#include "Integration/Core/CIntException.h" -#include "Integration/Core/CSimpleAsyncTaskExecutor.h" -#include "Integration/IErrorHandler.h" -#include "Integration/IIntMessage.h" -#include "Integration/ITaskExecutor.h" -#include "Integration/ITransformer.h" -#include "Memory/DynamicArray/DynamicArrayInc.h" -#include "CProviderExecutorRequestHandler.h" -#include "Exception/CCafException.h" -#include "Integration/Caf/CCafMessageCreator.h" -#include "Integration/Caf/CCafMessagePayloadParser.h" -#include "Integration/Caf/CCafMessagePayload.h" -#include "Integration/Core/FileHeaders.h" - -using namespace Caf; - -CProviderExecutorRequestHandler::CProviderExecutorRequestHandler() : - _isInitialized(false), - _isCancelled(false), - CAF_CM_INIT_LOG("CProviderExecutorRequestHandler") { - CAF_CM_INIT_THREADSAFE; -} - -CProviderExecutorRequestHandler::~CProviderExecutorRequestHandler() { -} - -void CProviderExecutorRequestHandler::initialize(const std::string& providerUri, - const SmartPtrITransformer beginImpersonationTransformer, - const SmartPtrITransformer endImpersonationTransformer, - const SmartPtrIErrorHandler errorHandler) { - CAF_CM_FUNCNAME("initialize"); - CAF_CM_LOCK_UNLOCK; - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(providerUri); - - _providerUri = providerUri; - UriUtils::SUriRecord providerUriRecord; - UriUtils::parseUriString(providerUri, providerUriRecord); - - if (providerUriRecord.protocol.compare("file") != 0) { - CAF_CM_EXCEPTIONEX_VA2(Caf::NoSuchElementException, ERROR_NOT_FOUND, - "Unrecognized provider URI protocol - %s, %s", - providerUriRecord.protocol.c_str(), providerUri.c_str()); - } - - UriUtils::SFileUriRecord fileUriRecord; - UriUtils::parseFileAddress(providerUriRecord.address, fileUriRecord); - _providerPath = fileUriRecord.path; - - if (!FileSystemUtils::doesFileExist(_providerPath)) { - CAF_CM_EXCEPTIONEX_VA1(FileNotFoundException, ERROR_FILE_NOT_FOUND, - "Provider path not found - %s", _providerPath.c_str()); - } - - _beginImpersonationTransformer = beginImpersonationTransformer; - _endImpersonationTransformer = endImpersonationTransformer; - _errorHandler = errorHandler; - - _isInitialized = true; -} - -void CProviderExecutorRequestHandler::handleRequest( - const SmartPtrCProviderExecutorRequest request) { - CAF_CM_FUNCNAME("handleRequest"); - CAF_CM_LOCK_UNLOCK; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_SMARTPTR(request); - - if (_providerUri.compare(request->getProviderUri()) != 0) { - CAF_CM_EXCEPTIONEX_VA1(InvalidArgumentException, ERROR_INVALID_PARAMETER, - "Provider request not for current provider - %s", _providerUri.c_str()); - } - - executeRequestAsync(request); -} - -void CProviderExecutorRequestHandler::run() { - CAF_CM_FUNCNAME("run"); - CAF_CM_LOCK_UNLOCK; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - SmartPtrIIntMessage message; - const SmartPtrCProviderExecutorRequest request = getNextPendingRequest(); - if (! request.IsNull()) { - try { - processRequest(request); - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_CRIT_CAFEXCEPTION; - - if (CAF_CM_ISEXCEPTION) { - SmartPtrCIntException intException; - intException.CreateInstance(); - intException->initialize(CAF_CM_GETEXCEPTION); - _errorHandler->handleError(intException, request->getInternalRequest()); - - CAF_CM_CLEAREXCEPTION; - } - } - - CAF_CM_LOG_DEBUG_VA0("Finished"); -} - -void CProviderExecutorRequestHandler::cancel() { - CAF_CM_FUNCNAME_VALIDATE("cancel"); - CAF_CM_LOCK_UNLOCK; - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - CAF_CM_LOG_DEBUG_VA0("Canceling"); - _isCancelled = true; -} - -SmartPtrCProviderExecutorRequest CProviderExecutorRequestHandler::getNextPendingRequest() { - - SmartPtrCProviderExecutorRequest rc; - if (! _isCancelled && ! _pendingRequests.empty()) { - rc = _pendingRequests.front(); - _pendingRequests.pop_front(); - } - - return rc; -} - -void CProviderExecutorRequestHandler::processRequest( - const SmartPtrCProviderExecutorRequest& request) const { - CAF_CM_FUNCNAME_VALIDATE("processRequest"); - CAF_CM_VALIDATE_SMARTPTR(request); - - const std::string outputDir = request->getOutputDirectory(); - - SmartPtrCLoggingSetter loggingSetter; - loggingSetter.CreateInstance(); - loggingSetter->initialize(outputDir); - - SmartPtrIIntMessage message = request->getInternalRequest(); - - const std::string providerRequestPath = FileSystemUtils::buildPath(outputDir, _sProviderRequestFilename); - const std::string stdoutPath = FileSystemUtils::buildPath(outputDir, _sStdoutFilename); - const std::string stderrPath = FileSystemUtils::buildPath(outputDir, _sStderrFilename); - - std::string newProviderRequestPath = FileSystemUtils::normalizePathWithForward( - providerRequestPath); - - // Create temporary request file for use by the provider - CCafMessagePayload::saveToFile(message->getPayload(), newProviderRequestPath); - - Cdeqstr argv; - argv.push_back(_providerPath); - argv.push_back("-r"); - argv.push_back(newProviderRequestPath); - - CAF_CM_LOG_INFO_VA2("Running command - %s -r %s", _providerPath.c_str(), - newProviderRequestPath.c_str()); - - ProcessUtils::Priority priority = ProcessUtils::NORMAL; - std::string appConfigPriority = AppConfigUtils::getOptionalString(_sManagementAgentArea, "provider_process_priority"); - if (!appConfigPriority.empty()) { - if (CStringUtils::isEqualIgnoreCase("LOW", appConfigPriority)) { - priority = ProcessUtils::LOW; - } else if (CStringUtils::isEqualIgnoreCase("IDLE", appConfigPriority)) { - priority = ProcessUtils::IDLE; - } - } - - // Begin impersonation - if (!_beginImpersonationTransformer.IsNull()) { - message = _beginImpersonationTransformer->transformMessage(message); - if (message.IsNull()) { - CAF_CM_LOG_WARN_VA0("Begin impersonation transform did not return a message"); - } - } - - { - CAF_CM_UNLOCK_LOCK; - ProcessUtils::runSyncToFiles(argv, stdoutPath, stderrPath, priority); - } - - // End impersonation - if (!_endImpersonationTransformer.IsNull()) { - message = _endImpersonationTransformer->transformMessage(message); - if (message.IsNull()) { - CAF_CM_LOG_WARN_VA0("End impersonation transform did not return a message"); - } - } - - // Delete temporary request file used by the provider - if (FileSystemUtils::doesFileExist(newProviderRequestPath)) { - CAF_CM_LOG_INFO_VA1("Removing handler produced request file - %s", newProviderRequestPath.c_str()); - FileSystemUtils::removeFile(newProviderRequestPath); - } - - // Delete original request - const std::string originalFile = message->findOptionalHeaderAsString(FileHeaders::_sORIGINAL_FILE); - if (!originalFile.empty()) { - if (FileSystemUtils::doesFileExist(originalFile)) { - CAF_CM_LOG_INFO_VA1("Removing original file - %s", originalFile.c_str()); - FileSystemUtils::removeFile(originalFile); - } - } - - // Package response in envelope and write to global response location - const SmartPtrCProviderRequestDoc providerRequest = - CCafMessagePayloadParser::getProviderRequest(message->getPayload()); - const SmartPtrCResponseDoc response = CResponseFactory::createResponse(providerRequest, outputDir); - - const std::string relFilename = CStringUtils::createRandomUuid() + "_" + _sResponseFilename; - - SmartPtrIIntMessage responseMessage = CCafMessageCreator::createPayloadEnvelope( - response, relFilename, message->getHeaders()); - - const std::string directory = AppConfigUtils::getRequiredString("response_dir"); - const std::string filePath = FileSystemUtils::buildPath(directory, relFilename); - - const SmartPtrCDynamicByteArray payload = responseMessage->getPayload(); - FileSystemUtils::saveByteFile(filePath, payload->getPtr(), payload->getByteCount(), - FileSystemUtils::FILE_MODE_REPLACE, ".writing"); -} - -void CProviderExecutorRequestHandler::executeRequestAsync( - const SmartPtrCProviderExecutorRequest& request) { - CAF_CM_FUNCNAME_VALIDATE("executeRequestAsync"); - CAF_CM_VALIDATE_SMARTPTR(request); - - _pendingRequests.push_back(request); - - _taskExecutors = removeFinishedTaskExecutors(_taskExecutors); - - SmartPtrCSimpleAsyncTaskExecutor simpleAsyncTaskExecutor; - simpleAsyncTaskExecutor.CreateInstance(); - simpleAsyncTaskExecutor->initialize(this, _errorHandler); - _taskExecutors.push_back(simpleAsyncTaskExecutor); - simpleAsyncTaskExecutor->execute(0); -} - -std::deque CProviderExecutorRequestHandler::removeFinishedTaskExecutors( - const std::deque taskExecutors) const { - - std::deque taskExecutorsTmp; - for (TConstIterator > iter(taskExecutors); - iter; iter++) { - const SmartPtrITaskExecutor taskExecutorIter = *iter; - if (! ((taskExecutorIter->getState() == ITaskExecutor::ETaskStateFinished) - || (taskExecutorIter->getState() == ITaskExecutor::ETaskStateFailed))) { - taskExecutorsTmp.push_back(taskExecutorIter); - } - } - - return taskExecutorsTmp; -} diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CResponseFactory.cpp b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CResponseFactory.cpp deleted file mode 100644 index 8fe087f5e..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CResponseFactory.cpp +++ /dev/null @@ -1,389 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Doc/DocXml/ResponseXml/ResponseXmlRoots.h" - -#include "Doc/DocUtils/EnumConvertersXml.h" - -#include "Doc/CafCoreTypesDoc/CAttachmentCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CAttachmentDoc.h" -#include "Doc/CafCoreTypesDoc/CInlineAttachmentDoc.h" -#include "Doc/ProviderRequestDoc/CProviderCollectSchemaRequestDoc.h" -#include "Doc/ProviderRequestDoc/CProviderRequestDoc.h" -#include "Doc/ResponseDoc/CManifestCollectionDoc.h" -#include "Doc/ResponseDoc/CManifestDoc.h" -#include "Doc/ResponseDoc/CProviderResponseDoc.h" -#include "Doc/ResponseDoc/CResponseDoc.h" -#include "Doc/ResponseDoc/CResponseHeaderDoc.h" -#include "CResponseFactory.h" -#include "Exception/CCafException.h" - -using namespace Caf; - -SmartPtrCResponseDoc CResponseFactory::createResponse( - const SmartPtrCProviderCollectSchemaRequestDoc& providerCollectSchemaRequest, - const std::string& outputDir, - const std::string& schemaCacheDir) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CResponseFactory", "createResponse"); - CAF_CM_VALIDATE_SMARTPTR(providerCollectSchemaRequest); - CAF_CM_VALIDATE_STRING(outputDir); - CAF_CM_VALIDATE_STRING(schemaCacheDir); - - SmartPtrCManifestCollectionDoc manifestCollection; - SmartPtrCAttachmentCollectionDoc attachmentCollection; - findAndStoreGlobalAttachmentsAndProviderResponses(outputDir, schemaCacheDir, - manifestCollection, attachmentCollection); - - SmartPtrCResponseHeaderDoc responseHeader; - responseHeader.CreateInstance(); - responseHeader->initialize(); - - SmartPtrCResponseDoc response; - response.CreateInstance(); - response->initialize( - providerCollectSchemaRequest->getClientId(), - providerCollectSchemaRequest->getRequestId(), - providerCollectSchemaRequest->getPmeId(), - responseHeader, - manifestCollection, - attachmentCollection, - SmartPtrCStatisticsDoc()); - - return response; -} - -SmartPtrCResponseDoc CResponseFactory::createResponse( - const SmartPtrCProviderRequestDoc& providerRequest, - const std::string& outputDir) { - CAF_CM_STATIC_FUNC_LOG("CResponseFactory", "createResponse"); - CAF_CM_VALIDATE_SMARTPTR(providerRequest); - CAF_CM_VALIDATE_STRING(outputDir); - - SmartPtrCManifestCollectionDoc manifestCollection; - SmartPtrCAttachmentCollectionDoc attachmentCollection; - findAndStoreGlobalAttachmentsAndProviderResponses(outputDir, std::string(), - manifestCollection, attachmentCollection); - - if (manifestCollection.IsNull() && attachmentCollection.IsNull()) { - CAF_CM_EXCEPTIONEX_VA1(FileNotFoundException, ERROR_FILE_NOT_FOUND, - "Did not find any attachments - %s", outputDir.c_str()); - } - - SmartPtrCResponseHeaderDoc responseHeader; - responseHeader.CreateInstance(); - responseHeader->initialize(); - - SmartPtrCResponseDoc response; - response.CreateInstance(); - response->initialize( - providerRequest->getClientId(), - providerRequest->getRequestId(), - providerRequest->getPmeId(), - responseHeader, - manifestCollection, - attachmentCollection, - SmartPtrCStatisticsDoc()); - - return response; -} - -void CResponseFactory::findAndStoreGlobalAttachmentsAndProviderResponses( - const std::string& outputDir, - const std::string& schemaCacheDir, - SmartPtrCManifestCollectionDoc& manifestCollection, - SmartPtrCAttachmentCollectionDoc& attachmentCollection) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CResponseFactory", "findAndStoreGlobalAttachmentsAndProviderResponses"); - CAF_CM_VALIDATE_STRING(outputDir); - // schemaCacheDir is optional - - std::map globalAttachmentCollection; - std::deque manifestCollectionInner; - findAndStoreGlobalAttachments(outputDir, globalAttachmentCollection); - findAndStoreProviderResponses(outputDir, schemaCacheDir, - globalAttachmentCollection, manifestCollectionInner); - - if (!manifestCollectionInner.empty()) { - manifestCollection.CreateInstance(); - manifestCollection->initialize(manifestCollectionInner); - } - - if (!globalAttachmentCollection.empty()) { - std::deque globalAttachmentCollectionInner; - for (TConstMapIterator > - globalAttachmentIter(globalAttachmentCollection); globalAttachmentIter; globalAttachmentIter++) { - const SmartPtrCAttachmentDoc attachment = *globalAttachmentIter; - globalAttachmentCollectionInner.push_back(attachment); - } - - attachmentCollection.CreateInstance(); - attachmentCollection->initialize(globalAttachmentCollectionInner, - std::deque()); - } -} - -void CResponseFactory::findAndStoreProviderResponses( - const std::string& outputDir, - const std::string& schemaCacheDir, - std::map& globalAttachmentCollection, - std::deque& manifestCollection) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CResponseFactory", "findAndStoreProviderResponses"); - CAF_CM_VALIDATE_STRING(outputDir); - // schemaCacheDir is optional - - const std::deque providerResponsePathCollection = - FileSystemUtils::findRequiredFiles(outputDir, _sProviderResponseFilename); - - for (TConstIterator > providerResponsePathIter( - providerResponsePathCollection); providerResponsePathIter; providerResponsePathIter++) { - const std::string providerResponsePath = *providerResponsePathIter; - - CAF_CM_LOG_DEBUG_VA1("Parsing provider response - %s", providerResponsePath.c_str()); - - const SmartPtrCProviderResponseDoc providerResponse = - XmlRoots::parseProviderResponseFromFile(providerResponsePath); - - const SmartPtrCManifestDoc providerResponseManifest = - providerResponse->getManifest(); - if (!providerResponseManifest.IsNull()) { - manifestCollection.push_back(providerResponseManifest); - } - - const SmartPtrCAttachmentCollectionDoc providerResponseAttachmentCollection = - providerResponse->getAttachmentCollection(); - - if (!providerResponseAttachmentCollection.IsNull()) { - std::deque - providerResponseAttachmentCollectionInner = - providerResponseAttachmentCollection->getAttachment(); - - resolveAndStoreGlobalAttachments(providerResponseAttachmentCollectionInner, - outputDir, schemaCacheDir, globalAttachmentCollection); - } - } -} - -void CResponseFactory::findAndStoreGlobalAttachments( - const std::string& outputDir, - std::map& globalAttachmentCollection) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CResponseFactory", "findAndStoreGlobalAttachments"); - CAF_CM_VALIDATE_STRING(outputDir); - - const std::string parentOutputDir = FileSystemUtils::buildPath(outputDir, ".."); - const std::string requestPath = FileSystemUtils::findOptionalFile(parentOutputDir, - _sPayloadRequestFilename); - - const std::deque stdoutPathCollection = - FileSystemUtils::findOptionalFiles(outputDir, _sStdoutFilename); - const std::deque stderrPathCollection = - FileSystemUtils::findOptionalFiles(outputDir, _sStderrFilename); - const std::deque maDebugLogPathCollection = - FileSystemUtils::findOptionalFiles(outputDir, "ma-log4cpp.log"); - - if (!requestPath.empty()) { - std::deque requestPathCollection; - requestPathCollection.push_back(requestPath); - storeGlobalAttachments(std::string(), "request", requestPathCollection, - outputDir, globalAttachmentCollection); - } - if (!stdoutPathCollection.empty()) { - storeGlobalAttachments(std::string(), "stdout", stdoutPathCollection, - outputDir, globalAttachmentCollection); - } - if (!stderrPathCollection.empty()) { - storeGlobalAttachments(std::string(), "stderr", stderrPathCollection, - outputDir, globalAttachmentCollection); - } - if (!maDebugLogPathCollection.empty()) { - storeGlobalAttachments(std::string(), "log", maDebugLogPathCollection, - outputDir, globalAttachmentCollection); - } -} - -void CResponseFactory::resolveAndStoreGlobalAttachments( - const std::deque attachmentCollectionInner, - const std::string& outputDir, - const std::string& schemaCacheDir, - std::map& globalAttachmentCollection) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CResponseFactory", "resolveAndStoreGlobalAttachments"); - CAF_CM_VALIDATE_STL(attachmentCollectionInner); - CAF_CM_VALIDATE_STRING(outputDir); - // schemaCacheDir is optional - - for (TConstIterator > attachmentIter( - attachmentCollectionInner); attachmentIter; attachmentIter++) { - const SmartPtrCAttachmentDoc attachment = *attachmentIter; - - UriUtils::SUriRecord uriRecord; - UriUtils::parseUriString(attachment->getUri(), uriRecord); - - if (uriRecord.protocol.compare("file") == 0) { - UriUtils::SFileUriRecord fileUriRecord; - UriUtils::parseFileAddress(uriRecord.address, fileUriRecord); - - std::string attachmentPath = fileUriRecord.path; - std::string attachmentPathNew = attachmentPath; - if (!schemaCacheDir.empty()) { - std::string relPath; - resolveAttachmentPath(attachmentPath, outputDir, relPath, - attachmentPathNew); - } - - if (!attachmentPathNew.empty()) { - storeGlobalAttachment(attachment->getName(), attachment->getType(), - attachmentPathNew, outputDir, globalAttachmentCollection); - } - } else { - globalAttachmentCollection.insert( - std::make_pair(attachment->getUri(), attachment)); - } - } -} - -void CResponseFactory::storeGlobalAttachments( - const std::string& attachmentName, - const std::string& attachmentType, - const std::deque& attachmentPathCollection, - const std::string& baseDir, - std::map& attachmentCollection) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CResponseFactory", "storeGlobalAttachments"); - // attachmentName is optional - CAF_CM_VALIDATE_STRING(attachmentType); - CAF_CM_VALIDATE_STL(attachmentPathCollection); - CAF_CM_VALIDATE_STRING(baseDir); - - for (TConstIterator > attachmentPathIter( - attachmentPathCollection); attachmentPathIter; attachmentPathIter++) { - const std::string attachmentPath = *attachmentPathIter; - - storeGlobalAttachment(attachmentName, attachmentType, attachmentPath, baseDir, - attachmentCollection); - } -} - -void CResponseFactory::storeGlobalAttachment( - const std::string& attachmentName, - const std::string& attachmentType, - const std::string& attachmentPath, - const std::string& baseDir, - std::map& attachmentCollection) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CResponseFactory", "storeGlobalAttachment"); - // attachmentName is optional - CAF_CM_VALIDATE_STRING(attachmentType); - CAF_CM_VALIDATE_STRING(attachmentPath); - CAF_CM_VALIDATE_STRING(baseDir); - - std::string relPath; - std::string attachmentPathNew; - resolveAttachmentPath(attachmentPath, baseDir, relPath, attachmentPathNew); - - if (!attachmentPathNew.empty()) { - std::string attachmentNameNew = attachmentName; - if (attachmentName.empty()) { - attachmentNameNew = relPath; - std::replace(attachmentNameNew.begin(), attachmentNameNew.end(), '/', '.'); - } - - attachmentPathNew = FileSystemUtils::normalizePathWithForward(attachmentPathNew); - - const std::string attachmentUri = "file:///" + attachmentPathNew + "?relPath=" - + relPath; - - CAF_CM_LOG_DEBUG_VA3("Creating attachment - name: %s, type: %s, uri: %s", - attachmentNameNew.c_str(), attachmentType.c_str(), attachmentUri.c_str()); - - const std::string cmsPolicyStr = AppConfigUtils::getRequiredString( - "security", "cms_policy"); - - SmartPtrCAttachmentDoc attachment; - attachment.CreateInstance(); - attachment->initialize(attachmentNameNew, attachmentType, attachmentUri, false, - EnumConvertersXml::convertStringToCmsPolicy(cmsPolicyStr)); - - attachmentCollection.insert(std::make_pair(attachmentUri, attachment)); - } -} - -void CResponseFactory::resolveAttachmentPath( - const std::string& attachmentPath, - const std::string& baseDir, - std::string& relPath, - std::string& attachmentPathNew) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CResponseFactory", "resolveAttachmentPath"); - CAF_CM_VALIDATE_STRING(attachmentPath); - CAF_CM_VALIDATE_STRING(baseDir); - - // Initialize the input variables - relPath = std::string(); - attachmentPathNew = attachmentPath; - - std::string baseDirNew = baseDir; - - const std::string baseDirNewTmp = baseDirNew + '/'; - const std::string::size_type fndPos = attachmentPathNew.find(baseDirNewTmp); - if (fndPos != std::string::npos) { - relPath = attachmentPathNew; - relPath.replace(fndPos, baseDirNewTmp.length(), ""); - - relPath = removeLeadingChars(relPath, '.'); - relPath = removeLeadingChars(relPath, '/'); - } - - if (relPath.empty()) { - relPath = FileSystemUtils::getBasename(attachmentPathNew); - attachmentPathNew = FileSystemUtils::buildPath(baseDirNew, relPath); - const std::string attachmentPathTmp = - FileSystemUtils::normalizePathForPlatform(attachmentPath); - - if (attachmentPathTmp.compare(attachmentPathNew) != 0) { - if (FileSystemUtils::doesFileExist(attachmentPathNew)) { - bool isFileNameFound = false; - const std::string origRelPath = relPath; - for (uint32 index = 0; !isFileNameFound; index++) { - relPath = CStringConv::toString(index) + "_" + origRelPath; - attachmentPathNew = FileSystemUtils::buildPath(baseDirNew, relPath); - if (! FileSystemUtils::doesFileExist(attachmentPathNew)) { - CAF_CM_LOG_WARN_VA1("File already exists... calculated new name - %s", - attachmentPathNew.c_str()); - isFileNameFound = true; - } - } - } - - if (FileSystemUtils::isRegularFile(attachmentPathTmp)) { - CAF_CM_LOG_WARN_VA3("Attachment not in specified directory... Copying - attPath: \"%s\", goodDir: \"%s\", newPath: \"%s\"", - attachmentPathTmp.c_str(), baseDirNew.c_str(), attachmentPathNew.c_str()); - FileSystemUtils::copyFile(attachmentPathTmp, attachmentPathNew); - } else { - CAF_CM_LOG_ERROR_VA3("Attachment not in specified or calculated directory - attPath: \"%s\", goodDir: \"%s\", newPath: \"%s\"", - attachmentPathTmp.c_str(), baseDirNew.c_str(), attachmentPathNew.c_str()); - attachmentPathNew = std::string(); - } - } - } -} - -std::string CResponseFactory::removeLeadingChars( - const std::string& sourceStr, - const char leadingChar) { - - std::string rc; - if (!sourceStr.empty()) { - bool isCharFnd = false; - for (size_t index = 0; index < sourceStr.length(); index++) { - if (!isCharFnd && (sourceStr[index] != leadingChar)) { - isCharFnd = true; - } - if (isCharFnd) { - rc += sourceStr[index]; - } - } - } - - return rc; -} diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CSchemaCacheManager.cpp b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CSchemaCacheManager.cpp deleted file mode 100644 index ee0b0b75a..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CSchemaCacheManager.cpp +++ /dev/null @@ -1,236 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Doc/DocXml/ProviderInfraXml/ProviderInfraXmlRoots.h" - -#include "Doc/CafCoreTypesDoc/CFullyQualifiedClassGroupDoc.h" -#include "Doc/ProviderInfraDoc/CClassCollectionDoc.h" -#include "Doc/ProviderInfraDoc/CSchemaSummaryDoc.h" -#include "CSchemaCacheManager.h" -#include "Exception/CCafException.h" - -using namespace Caf; - -bool Caf::operator<( - const CClassId& lhs, - const CClassId& rhs) { - bool rc = false; - - if (lhs._fqc->getClassNamespace() < rhs._fqc->getClassNamespace()) { - rc = true; - } else if (lhs._fqc->getClassNamespace() == rhs._fqc->getClassNamespace()) { - if (lhs._fqc->getClassName() < rhs._fqc->getClassName()) { - rc = true; - } else if (lhs._fqc->getClassName() == rhs._fqc->getClassName()) { - if (lhs._fqc->getClassVersion() < rhs._fqc->getClassVersion()) { - rc = true; - } - } - } - - return rc; -} - -CSchemaCacheManager::CSchemaCacheManager() : - _isInitialized(false), - CAF_CM_INIT_LOG("CSchemaCacheManager") { -} - -CSchemaCacheManager::~CSchemaCacheManager() { -} - -void CSchemaCacheManager::initialize() { - - CAF_CM_FUNCNAME("initialize"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - - const std::string schemaCacheDirPath = - AppConfigUtils::getRequiredString(_sProviderHostArea, _sConfigSchemaCacheDir); - const std::string schemaCacheDirPathExp = CStringUtils::expandEnv(schemaCacheDirPath); - if (!FileSystemUtils::doesDirectoryExist(schemaCacheDirPathExp)) { - CAF_CM_EXCEPTIONEX_VA1(FileNotFoundException, ERROR_FILE_NOT_FOUND, - "Schema cache directory does not exist: %s", schemaCacheDirPathExp.c_str()); - } - - _schemaCacheDirPath = schemaCacheDirPathExp; - _isInitialized = true; - } - CAF_CM_EXIT; -} - -std::string CSchemaCacheManager::findProvider( - const SmartPtrCFullyQualifiedClassGroupDoc& fqc) { - - CAF_CM_FUNCNAME_VALIDATE("findProvider"); - - std::string providerUri; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_SMARTPTR(fqc); - - CClassId classId; - classId._fqc = fqc; - - CClassCollection::const_iterator iter = _classCollection.find(classId); - if (iter == _classCollection.end()) { - CAF_CM_LOG_INFO_VA1("Provider not found... refreshing cache - %s", classId.toString().c_str()); - - const uint16 maxWaitSecs = 10; - waitForSchemaCacheCreation(_schemaCacheDirPath, maxWaitSecs); - - processSchemaSummaries(_schemaCacheDirPath, _classCollection); - - CClassCollection::const_iterator iter2 = _classCollection.find(classId); - if (iter2 == _classCollection.end()) { - CAF_CM_LOG_WARN_VA1("Provider not found even after refreshing the cache - %s", classId.toString().c_str()); - } else { - providerUri = iter2->second; - } - } else { - providerUri = iter->second; - } - } - CAF_CM_EXIT; - - return providerUri; -} - -void CSchemaCacheManager::processSchemaSummaries( - const std::string& schemaCacheDirPath, - CClassCollection& classCollection) const { - CAF_CM_FUNCNAME_VALIDATE("processSchemaSummaries"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(schemaCacheDirPath); - - const FileSystemUtils::DirectoryItems schemaCacheDirItems = - FileSystemUtils::itemsInDirectory(schemaCacheDirPath, - FileSystemUtils::REGEX_MATCH_ALL); - - if (schemaCacheDirItems.directories.empty()) { - CAF_CM_LOG_WARN_VA1( - "Schema cache is empty - %s", schemaCacheDirPath.c_str()); - } - - for (TConstIterator schemaCacheDirIter( - schemaCacheDirItems.directories); schemaCacheDirIter; schemaCacheDirIter++) { - const std::string providerSchemaCacheDir = *schemaCacheDirIter; - - const std::string providerSchemaCacheDirPath = FileSystemUtils::buildPath( - schemaCacheDirPath, providerSchemaCacheDir); - const std::string schemaSummaryFilePath = FileSystemUtils::findOptionalFile( - providerSchemaCacheDirPath, _sSchemaSummaryFilename); - - if (schemaSummaryFilePath.empty()) { - CAF_CM_LOG_WARN_VA1( - "Schema cache directory found without schema summary file... might be a timing issue - %s", - providerSchemaCacheDirPath.c_str()); - } else { - CAF_CM_LOG_DEBUG_VA1("Found schema cache summary file - %s", schemaSummaryFilePath.c_str()); - - const SmartPtrCSchemaSummaryDoc schemaSummary = - XmlRoots::parseSchemaSummaryFromFile(schemaSummaryFilePath); - - addNewClasses(schemaSummary, schemaSummaryFilePath, classCollection); - } - } - } - CAF_CM_EXIT; -} - -void CSchemaCacheManager::addNewClasses( - const SmartPtrCSchemaSummaryDoc& schemaSummary, - const std::string& schemaSummaryFilePath, - CClassCollection& classCollection) const { - CAF_CM_FUNCNAME("addNewClasses"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_SMARTPTR(schemaSummary); - CAF_CM_VALIDATE_STRING(schemaSummaryFilePath); - - const std::string invokerPath = schemaSummary->getInvokerPath(); - - std::string providerUri; - if (! invokerPath.empty()) { - const std::string invokerPathExp = CStringUtils::expandEnv(invokerPath); - if (FileSystemUtils::doesFileExist(invokerPathExp)) { - const std::string invokerPathExpTmp = - FileSystemUtils::normalizePathWithForward(invokerPathExp); - providerUri = "file:///" + invokerPathExpTmp; - } else { - CAF_CM_LOG_ERROR_VA2( - "Invoker path does not exist - invokerPath: %s, filePath: %s", - invokerPathExp.c_str(), schemaSummaryFilePath.c_str()); - } - } else { - CAF_CM_EXCEPTIONEX_VA1(InvalidArgumentException, E_INVALIDARG, - "Schema Summary file missing invokerRelPath - %s", schemaSummaryFilePath.c_str()); - } - - if (! providerUri.empty()) { - const SmartPtrCClassCollectionDoc classCollectionDoc = schemaSummary->getClassCollection(); - const std::deque fqcCollection = classCollectionDoc->getFullyQualifiedClass(); - - for (TConstIterator > fqcIter(fqcCollection); - fqcIter; fqcIter++) { - CClassId classId; - classId._fqc = *fqcIter; - - if (classCollection.find(classId) == classCollection.end()) { - CAF_CM_LOG_DEBUG_VA1("Adding class %s", classId.toString().c_str()); - classCollection.insert(std::make_pair(classId, providerUri)); - } - } - } - } - CAF_CM_EXIT; -} - -void CSchemaCacheManager::waitForSchemaCacheCreation( - const std::string& schemaCacheDir, - const uint16 maxWaitSecs) const { - CAF_CM_FUNCNAME_VALIDATE("waitForSchemaCacheCreation"); - CAF_CM_VALIDATE_STRING(schemaCacheDir); - - const std::string providerRegDir = AppConfigUtils::getRequiredString( - _sProviderHostArea, _sConfigProviderRegDir); - const std::string providerRegDirExp = CStringUtils::expandEnv(providerRegDir); - - if (FileSystemUtils::doesDirectoryExist(providerRegDirExp)) { - size_t numSchemaCacheItems = 0; - size_t numProviderRegItems = 0; - for (uint16 retry = 0; retry < maxWaitSecs; retry++) { - numSchemaCacheItems = FileSystemUtils::itemsInDirectory(schemaCacheDir, - FileSystemUtils::REGEX_MATCH_ALL).directories.size(); - numProviderRegItems = FileSystemUtils::itemsInDirectory(providerRegDir, - FileSystemUtils::REGEX_MATCH_ALL).files.size(); - - if (numSchemaCacheItems >= numProviderRegItems) { - break; - } - - CThreadUtils::sleep(1000); - } - - if (numSchemaCacheItems < numProviderRegItems) { - CAF_CM_LOG_WARN_VA5( - "Schema cache initialization not complete - schemaCache: %s::%d, providerReg: %s::%d, maxWaitSecs: %d", - schemaCacheDir.c_str(), numSchemaCacheItems, providerRegDir.c_str(), - numProviderRegItems, maxWaitSecs); - } - } else { - CAF_CM_LOG_WARN_VA1("Provider Reg directory does not exist - %s", - providerRegDirExp.c_str()); - } -} diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CSinglePmeRequestSplitter.cpp b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CSinglePmeRequestSplitter.cpp deleted file mode 100644 index ab47095df..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CSinglePmeRequestSplitter.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Integration/IDocument.h" -#include "Integration/IIntegrationObject.h" -#include "CSinglePmeRequestSplitter.h" - -using namespace Caf; - -CSinglePmeRequestSplitter::CSinglePmeRequestSplitter() : - _isInitialized(false), - CAF_CM_INIT_LOG("CSinglePmeRequestSplitter") { -} - -CSinglePmeRequestSplitter::~CSinglePmeRequestSplitter() { -} - -void CSinglePmeRequestSplitter::initializeBean( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties) { - - CAF_CM_FUNCNAME_VALIDATE("initializeBean"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STL_EMPTY(ctorArgs); - CAF_CM_VALIDATE_STL_EMPTY(properties); - _ctorArgs = ctorArgs; - _properties = properties; - initialize(); - } - CAF_CM_EXIT; -} - -void CSinglePmeRequestSplitter::terminateBean() { -} - -void CSinglePmeRequestSplitter::initialize() { - - CAF_CM_FUNCNAME_VALIDATE("initialize"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - _isInitialized = true; - } - CAF_CM_EXIT; -} - -bool CSinglePmeRequestSplitter::isResponsible( - const SmartPtrIDocument& configSection) const { - CAF_CM_FUNCNAME_VALIDATE("isResponsible"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - } - CAF_CM_EXIT; - - return false; -} - -SmartPtrIIntegrationObject CSinglePmeRequestSplitter::createObject( - const SmartPtrIDocument& configSection) const { - CAF_CM_FUNCNAME_VALIDATE("createObject"); - - SmartPtrIIntegrationObject rc; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - - rc.CreateInstance(_sObjIdSinglePmeRequestSplitterInstance); - rc->initialize(_ctorArgs, _properties, configSection); - } - CAF_CM_EXIT; - - return rc; -} diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CSinglePmeRequestSplitter.h b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CSinglePmeRequestSplitter.h deleted file mode 100644 index 761844286..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CSinglePmeRequestSplitter.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CSinglePmeRequestSplitter_h_ -#define CSinglePmeRequestSplitter_h_ - - -#include "IBean.h" - -#include "Integration/IDocument.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/IIntegrationComponent.h" - -namespace Caf { - -/// Sends responses/errors back to the client. -class CSinglePmeRequestSplitter : - public TCafSubSystemObjectRoot, - public IBean, - public IIntegrationComponent { -public: - CSinglePmeRequestSplitter(); - virtual ~CSinglePmeRequestSplitter(); - - CAF_DECLARE_OBJECT_IDENTIFIER(_sObjIdSinglePmeRequestSplitter) - - CAF_BEGIN_INTERFACE_MAP(CSinglePmeRequestSplitter) - CAF_INTERFACE_ENTRY(IBean) - CAF_INTERFACE_ENTRY(IIntegrationComponent) - CAF_END_INTERFACE_MAP() - -public: - virtual void initialize(); - -public: // IBean - virtual void initializeBean( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties); - - virtual void terminateBean(); - -public: // IIntegrationComponent - bool isResponsible( - const SmartPtrIDocument& configSection) const; - - SmartPtrIIntegrationObject createObject( - const SmartPtrIDocument& configSection) const; - -private: - bool _isInitialized; - IBean::Cargs _ctorArgs; - IBean::Cprops _properties; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CSinglePmeRequestSplitter); -}; - -} - -#endif // #ifndef CSinglePmeRequestSplitter_h_ diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CSinglePmeRequestSplitterInstance.cpp b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CSinglePmeRequestSplitterInstance.cpp deleted file mode 100644 index b35c1efe8..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CSinglePmeRequestSplitterInstance.cpp +++ /dev/null @@ -1,458 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Common/IAppContext.h" -#include "Doc/CafCoreTypesDoc/CClassSpecifierDoc.h" -#include "Doc/CafCoreTypesDoc/CFullyQualifiedClassGroupDoc.h" -#include "Doc/CafCoreTypesDoc/CRequestConfigDoc.h" -#include "Doc/CafCoreTypesDoc/CRequestHeaderDoc.h" -#include "Doc/MgmtRequestDoc/CMgmtRequestDoc.h" -#include "Doc/MgmtTypesDoc/CMgmtBatchDoc.h" -#include "Doc/MgmtTypesDoc/CMgmtCollectInstancesCollectionDoc.h" -#include "Doc/MgmtTypesDoc/CMgmtCollectInstancesDoc.h" -#include "Doc/MgmtTypesDoc/CMgmtCollectSchemaDoc.h" -#include "Doc/MgmtTypesDoc/CMgmtInvokeOperationCollectionDoc.h" -#include "Doc/MgmtTypesDoc/CMgmtInvokeOperationDoc.h" -#include "Doc/ProviderRequestDoc/CProviderBatchDoc.h" -#include "Doc/ProviderRequestDoc/CProviderCollectInstancesCollectionDoc.h" -#include "Doc/ProviderRequestDoc/CProviderCollectInstancesDoc.h" -#include "Doc/ProviderRequestDoc/CProviderCollectSchemaRequestDoc.h" -#include "Doc/ProviderRequestDoc/CProviderInvokeOperationCollectionDoc.h" -#include "Doc/ProviderRequestDoc/CProviderInvokeOperationDoc.h" -#include "Doc/ProviderRequestDoc/CProviderRequestConfigDoc.h" -#include "Doc/ProviderRequestDoc/CProviderRequestDoc.h" -#include "Doc/ProviderRequestDoc/CProviderRequestHeaderDoc.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "Memory/DynamicArray/DynamicArrayInc.h" -#include "CSinglePmeRequestSplitterInstance.h" -#include "Exception/CCafException.h" -#include "Integration/Caf/CCafMessageCreator.h" -#include "Integration/Caf/CCafMessagePayloadParser.h" -#include "Integration/Caf/CCafMessagePayload.h" - -using namespace Caf; - -CSinglePmeRequestSplitterInstance::CSinglePmeRequestSplitterInstance() : - _isInitialized(false), - CAF_CM_INIT_LOG("CSinglePmeRequestSplitterInstance") { -} - -CSinglePmeRequestSplitterInstance::~CSinglePmeRequestSplitterInstance() { -} - -void CSinglePmeRequestSplitterInstance::initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - - _id = configSection->findRequiredAttribute("id"); - _schemaCacheManager.CreateInstance(); - _schemaCacheManager->initialize(); - - _isInitialized = true; -} - -std::string CSinglePmeRequestSplitterInstance::getId() const { - return _id; -} - -void CSinglePmeRequestSplitterInstance::wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver) { - CAF_CM_FUNCNAME_VALIDATE("wire"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(appContext); - CAF_CM_VALIDATE_INTERFACE(channelResolver); -} - -IMessageSplitter::SmartPtrCMessageCollection CSinglePmeRequestSplitterInstance::splitMessage( - const SmartPtrIIntMessage& message) { - CAF_CM_FUNCNAME_VALIDATE("splitMessage"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(message); - - CAF_CM_LOG_DEBUG_VA1("Called - %s", _id.c_str()); - - SmartPtrCMessageCollection messageCollection; - messageCollection.CreateInstance(); - - const SmartPtrCMgmtRequestDoc mgmtRequest = - CCafMessagePayloadParser::getMgmtRequest(message->getPayload()); - - const SmartPtrCMgmtBatchDoc mgmtBatch = mgmtRequest->getBatch(); - - const SmartPtrCProviderRequestHeaderDoc providerRequestHeader = - convertRequestHeader(mgmtRequest->getRequestHeader()); - - const std::string configOutputDir = AppConfigUtils::getRequiredString( - _sConfigOutputDir); - const std::string randomUuidStr = CStringUtils::createRandomUuid(); - const std::string absRandomUuidDir = FileSystemUtils::buildPath(configOutputDir, - _sProviderHostArea, randomUuidStr); - - createDirectory(absRandomUuidDir); - saveRequest(absRandomUuidDir, message->getPayload()); - - // Process the collect schema job first since it follows a - // completely different line of execution. - const SmartPtrCMgmtCollectSchemaDoc mgmtCollectSchema = - mgmtBatch->getCollectSchema(); - if (!mgmtCollectSchema.IsNull()) { - const std::string relProviderNumDir = FileSystemUtils::buildPath(randomUuidStr, - CStringConv::toString(0)); - const std::string absProviderNumDir = FileSystemUtils::buildPath( - absRandomUuidDir, CStringConv::toString(0)); - - const SmartPtrCProviderCollectSchemaRequestDoc providerCollectSchemaRequest = - createCollectSchemaRequest(mgmtRequest, mgmtCollectSchema, - providerRequestHeader, absProviderNumDir); - - const std::string relFilename = FileSystemUtils::buildPath(relProviderNumDir, - _sProviderRequestFilename); - - const SmartPtrIIntMessage messageNew = CCafMessageCreator::create( - providerCollectSchemaRequest, relFilename, relProviderNumDir, - message->getHeaders()); - - messageCollection->push_back(messageNew); - } - - SmartPtrCProviderJobsCollection providerJobsCollection; - providerJobsCollection.CreateInstance(); - addCollectInstancesJobs(mgmtBatch->getCollectInstancesCollection(), - providerJobsCollection); - addInvokeOperationJobs(mgmtBatch->getInvokeOperationCollection(), - providerJobsCollection); - - uint32 providerCnt = 1; - for (TConstIterator providerJobsIter( - *providerJobsCollection); providerJobsIter; providerJobsIter++) { - const std::string providerUri = providerJobsIter->first; - const SmartPtrCSplitterJobsCollection jobsCollection = providerJobsIter->second; - - const std::string provderCntStr = CStringConv::toString(providerCnt); - const std::string absProviderNumDir = FileSystemUtils::buildPath(absRandomUuidDir, provderCntStr); - - const SmartPtrCProviderRequestDoc providerRequest = createProviderRequest( - mgmtRequest, jobsCollection, providerRequestHeader, absProviderNumDir); - - const std::string relProviderNumDir = FileSystemUtils::buildPath(randomUuidStr, provderCntStr); -// const std::string relFilename = FileSystemUtils::buildPath(relProviderNumDir, -// _sProviderRequestFilename); -// const std::string relProviderNumDir = ""; - const std::string relFilename = randomUuidStr + "_" + provderCntStr + "_" + _sProviderRequestFilename; - - const SmartPtrIIntMessage messageNew = CCafMessageCreator::create(providerRequest, - relFilename, relProviderNumDir, providerUri, message->getHeaders()); - - messageCollection->push_back(messageNew); - - providerCnt++; - } - - return messageCollection; -} - -SmartPtrCProviderCollectSchemaRequestDoc CSinglePmeRequestSplitterInstance::createCollectSchemaRequest( - const SmartPtrCMgmtRequestDoc& mgmtRequest, - const SmartPtrCMgmtCollectSchemaDoc& mgmtCollectSchema, - const SmartPtrCProviderRequestHeaderDoc& providerRequestHeader, - const std::string& outputDir) const { - CAF_CM_FUNCNAME_VALIDATE("createCollectSchemaRequest"); - CAF_CM_VALIDATE_SMARTPTR(mgmtRequest); - CAF_CM_VALIDATE_SMARTPTR(mgmtCollectSchema); - CAF_CM_VALIDATE_SMARTPTR(providerRequestHeader); - CAF_CM_VALIDATE_STRING(outputDir); - - SmartPtrCProviderCollectSchemaRequestDoc providerCollectSchemaRequest; - providerCollectSchemaRequest.CreateInstance(); - providerCollectSchemaRequest->initialize(mgmtRequest->getClientId(), - mgmtRequest->getRequestId(), mgmtRequest->getPmeId(), - mgmtCollectSchema->getJobId(), outputDir, providerRequestHeader); - - return providerCollectSchemaRequest; -} - -SmartPtrCProviderRequestDoc CSinglePmeRequestSplitterInstance::createProviderRequest( - const SmartPtrCMgmtRequestDoc& mgmtRequest, - const SmartPtrCSplitterJobsCollection& jobsCollection, - const SmartPtrCProviderRequestHeaderDoc& providerRequestHeader, - const std::string& outputDir) const { - CAF_CM_FUNCNAME_VALIDATE("createProviderRequest"); - CAF_CM_VALIDATE_SMARTPTR(mgmtRequest); - CAF_CM_VALIDATE_SMARTPTR(jobsCollection); - CAF_CM_VALIDATE_SMARTPTR(providerRequestHeader); - CAF_CM_VALIDATE_STRING(outputDir); - - std::deque collectInstancesCollectionInner; - std::deque invokeOperationCollectionInner; - for (TConstIterator > jobIter(*jobsCollection); - jobIter; jobIter++) { - const SmartPtrCSplitterJob job = *jobIter; - - if (!job->_mgmtCollectInstances.IsNull()) { - const UUID jobId = job->_mgmtCollectInstances->getJobId(); - const std::string jobIdStr = BasePlatform::UuidToString(jobId); - const std::string jobOutputDir = FileSystemUtils::buildPath(outputDir, - jobIdStr); - if (FileSystemUtils::doesDirectoryExist(jobOutputDir)) { - FileSystemUtils::recursiveRemoveDirectory(jobOutputDir); - } - FileSystemUtils::createDirectory(jobOutputDir); - - SmartPtrCProviderCollectInstancesDoc providerCollectInstances; - providerCollectInstances.CreateInstance(); - providerCollectInstances->initialize(job->_fqc->getClassNamespace(), - job->_fqc->getClassName(), job->_fqc->getClassVersion(), - job->_mgmtCollectInstances->getJobId(), jobOutputDir, - job->_mgmtCollectInstances->getParameterCollection()); - - collectInstancesCollectionInner.push_back(providerCollectInstances); - } - - if (!job->_mgmtInvokeOperation.IsNull()) { - const UUID jobId = job->_mgmtInvokeOperation->getJobId(); - const std::string jobIdStr = BasePlatform::UuidToString(jobId); - const std::string jobOutputDir = FileSystemUtils::buildPath(outputDir, - jobIdStr); - if (FileSystemUtils::doesDirectoryExist(jobOutputDir)) { - FileSystemUtils::recursiveRemoveDirectory(jobOutputDir); - } - FileSystemUtils::createDirectory(jobOutputDir); - - SmartPtrCProviderInvokeOperationDoc providerInvokeOperation; - providerInvokeOperation.CreateInstance(); - providerInvokeOperation->initialize(job->_fqc->getClassNamespace(), - job->_fqc->getClassName(), job->_fqc->getClassVersion(), - job->_mgmtInvokeOperation->getJobId(), jobOutputDir, - job->_mgmtInvokeOperation->getOperation()); - - invokeOperationCollectionInner.push_back(providerInvokeOperation); - } - } - - SmartPtrCProviderCollectInstancesCollectionDoc collectInstancesCollection; - if (!collectInstancesCollectionInner.empty()) { - collectInstancesCollection.CreateInstance(); - collectInstancesCollection->initialize(collectInstancesCollectionInner); - } - - SmartPtrCProviderInvokeOperationCollectionDoc invokeOperationCollection; - if (!invokeOperationCollectionInner.empty()) { - invokeOperationCollection.CreateInstance(); - invokeOperationCollection->initialize(invokeOperationCollectionInner); - } - - SmartPtrCProviderBatchDoc providerBatch; - providerBatch.CreateInstance(); - providerBatch->initialize(outputDir, collectInstancesCollection, - invokeOperationCollection); - - SmartPtrCProviderRequestDoc providerRequest; - providerRequest.CreateInstance(); - providerRequest->initialize(mgmtRequest->getClientId(), - mgmtRequest->getRequestId(), mgmtRequest->getPmeId(), providerRequestHeader, - providerBatch, mgmtRequest->getAttachmentCollection()); - - return providerRequest; -} - -void CSinglePmeRequestSplitterInstance::addCollectInstancesJobs( - const SmartPtrCMgmtCollectInstancesCollectionDoc& mgmtCollectInstancesCollection, - SmartPtrCProviderJobsCollection& providerJobsCollection) const { - CAF_CM_FUNCNAME_VALIDATE("addCollectInstancesJobs"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - // mgmtCollectInstancesCollection is optional - CAF_CM_VALIDATE_SMARTPTR(providerJobsCollection); - - if (!mgmtCollectInstancesCollection.IsNull()) { - const std::deque mgmtCollectInstancesCollectionInner = - mgmtCollectInstancesCollection->getCollectInstancesCollection(); - for (TConstIterator > mgmtCollectInstancesIter( - mgmtCollectInstancesCollectionInner); mgmtCollectInstancesIter; - mgmtCollectInstancesIter++) { - const SmartPtrCMgmtCollectInstancesDoc mgmtCollectInstances = - *mgmtCollectInstancesIter; - - const SmartPtrCClassSpecifierDoc classSpecifier = - mgmtCollectInstances->getClassSpecifier(); - const SmartPtrCClassCollection fqcCollection = resolveClassSpecifier( - classSpecifier); - - for (TConstIterator > fqcIter( - *fqcCollection); fqcIter; fqcIter++) { - const SmartPtrCFullyQualifiedClassGroupDoc fqc = *fqcIter; - const std::string providerUri = findProviderUri(fqc); - - SmartPtrCSplitterJob job; - job.CreateInstance(); - job->_fqc = fqc; - job->_mgmtCollectInstances = mgmtCollectInstances; - - CProviderJobsCollection::const_iterator fndIter = - providerJobsCollection->find(providerUri); - if (fndIter == providerJobsCollection->end()) { - SmartPtrCSplitterJobsCollection jobsCollection; - jobsCollection.CreateInstance(); - jobsCollection->push_back(job); - providerJobsCollection->insert( - std::make_pair(providerUri, jobsCollection)); - } else { - fndIter->second->push_back(job); - } - } - } - } -} - -void CSinglePmeRequestSplitterInstance::addInvokeOperationJobs( - const SmartPtrCMgmtInvokeOperationCollectionDoc& mgmtInvokeOperationCollection, - SmartPtrCProviderJobsCollection& providerJobsCollection) const { - CAF_CM_FUNCNAME_VALIDATE("addInvokeOperationJobs"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - // mgmtInvokeOperationCollection is optional - CAF_CM_VALIDATE_SMARTPTR(providerJobsCollection); - - if (!mgmtInvokeOperationCollection.IsNull()) { - const std::deque mgmtInvokeOperationCollectionInner = - mgmtInvokeOperationCollection->getInvokeOperationCollection(); - for (TConstIterator > mgmtInvokeOperationIter( - mgmtInvokeOperationCollectionInner); mgmtInvokeOperationIter; - mgmtInvokeOperationIter++) { - const SmartPtrCMgmtInvokeOperationDoc mgmtInvokeOperation = - *mgmtInvokeOperationIter; - - const SmartPtrCClassSpecifierDoc classSpecifier = - mgmtInvokeOperation->getClassSpecifier(); - const SmartPtrCClassCollection fqcCollection = resolveClassSpecifier( - classSpecifier); - - for (TConstIterator > fqcIter( - *fqcCollection); fqcIter; fqcIter++) { - const SmartPtrCFullyQualifiedClassGroupDoc fqc = *fqcIter; - const std::string providerUri = findProviderUri(fqc); - - SmartPtrCSplitterJob job; - job.CreateInstance(); - job->_fqc = fqc; - job->_mgmtInvokeOperation = mgmtInvokeOperation; - - CProviderJobsCollection::const_iterator fndIter = - providerJobsCollection->find(providerUri); - if (fndIter == providerJobsCollection->end()) { - SmartPtrCSplitterJobsCollection jobsCollection; - jobsCollection.CreateInstance(); - jobsCollection->push_back(job); - providerJobsCollection->insert( - std::make_pair(providerUri, jobsCollection)); - } else { - fndIter->second->push_back(job); - } - } - } - } -} - -CSinglePmeRequestSplitterInstance::SmartPtrCClassCollection CSinglePmeRequestSplitterInstance::resolveClassSpecifier( - const SmartPtrCClassSpecifierDoc& classSpecifier) const { - CAF_CM_FUNCNAME("resolveClassSpecifier"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_SMARTPTR(classSpecifier); - - SmartPtrCClassCollection classCollection; - classCollection.CreateInstance(); - - const SmartPtrCFullyQualifiedClassGroupDoc fullyQualifiedClass = - classSpecifier->getFullyQualifiedClass(); - if (!fullyQualifiedClass.IsNull()) { - classCollection->push_back(fullyQualifiedClass); - } - - if (classCollection->empty()) { - CAF_CM_EXCEPTION_VA0(ERROR_INVALID_DATA, - "Failed to resolve to any fully-qualified classes"); - } - - return classCollection; -} - -std::string CSinglePmeRequestSplitterInstance::findProviderUri( - const SmartPtrCFullyQualifiedClassGroupDoc& fqc) const { - CAF_CM_FUNCNAME("findProviderUri"); - - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_SMARTPTR(fqc); - - const std::string providerUri = _schemaCacheManager->findProvider(fqc); - - if (providerUri.empty()) { - CAF_CM_EXCEPTIONEX_VA3(NoSuchElementException, ERROR_NOT_FOUND, - "Provider not found for %s::%s::%s with status %d", - fqc->getClassNamespace().c_str(), fqc->getClassName().c_str(), - fqc->getClassVersion().c_str()); - } - - return providerUri; -} - -void CSinglePmeRequestSplitterInstance::createDirectory( - const std::string& directory) const { - CAF_CM_FUNCNAME_VALIDATE("createDirectory"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(directory); - - if (FileSystemUtils::doesDirectoryExist(directory)) { - CAF_CM_LOG_WARN_VA1( - "Directory already exists (perhaps from a previous failed run)... removing - %s", - directory.c_str()); - FileSystemUtils::recursiveRemoveDirectory(directory); - } - - CAF_CM_LOG_DEBUG_VA1("Creating directory - %s", directory.c_str()); - FileSystemUtils::createDirectory(directory); -} - -void CSinglePmeRequestSplitterInstance::saveRequest( - const std::string& outputDir, - const SmartPtrCDynamicByteArray& payload) const { - CAF_CM_FUNCNAME_VALIDATE("saveRequest"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(outputDir); - CAF_CM_VALIDATE_SMARTPTR(payload); - - const std::string singlePmeRequestPath = FileSystemUtils::buildPath(outputDir, - _sPayloadRequestFilename); - - CCafMessagePayload::saveToFile(payload, singlePmeRequestPath); -} - -SmartPtrCProviderRequestHeaderDoc CSinglePmeRequestSplitterInstance::convertRequestHeader( - const SmartPtrCRequestHeaderDoc& requestHeader) const { - CAF_CM_FUNCNAME_VALIDATE("convertRequestHeader"); - CAF_CM_VALIDATE_SMARTPTR(requestHeader); - - const SmartPtrCRequestConfigDoc requestConfig = requestHeader->getRequestConfig(); - - SmartPtrCProviderRequestConfigDoc providerRequestConfig; - providerRequestConfig.CreateInstance(); - providerRequestConfig->initialize(requestConfig->getResponseFormatType(), - requestConfig->getLoggingLevelCollection()); - - SmartPtrCProviderRequestHeaderDoc providerRequestHeader; - providerRequestHeader.CreateInstance(); - providerRequestHeader->initialize(providerRequestConfig, - requestHeader->getEchoPropertyBag()); - - return providerRequestHeader; -} diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CVersionTransformer.cpp b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CVersionTransformer.cpp deleted file mode 100644 index 4714a6568..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CVersionTransformer.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Integration/IDocument.h" -#include "Integration/IIntegrationObject.h" -#include "CVersionTransformer.h" - -using namespace Caf; - -CVersionTransformer::CVersionTransformer() : - _isInitialized(false), - CAF_CM_INIT_LOG("CVersionTransformer") { -} - -CVersionTransformer::~CVersionTransformer() { -} - -void CVersionTransformer::initializeBean( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties) { - - CAF_CM_FUNCNAME_VALIDATE("initializeBean"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STL_EMPTY(ctorArgs); - CAF_CM_VALIDATE_STL_EMPTY(properties); - _ctorArgs = ctorArgs; - _properties = properties; - initialize(); - } - CAF_CM_EXIT; -} - -void CVersionTransformer::terminateBean() { -} - -void CVersionTransformer::initialize() { - - CAF_CM_FUNCNAME_VALIDATE("initialize"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - _isInitialized = true; - } - CAF_CM_EXIT; -} - -bool CVersionTransformer::isResponsible( - const SmartPtrIDocument& configSection) const { - CAF_CM_FUNCNAME_VALIDATE("isResponsible"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - } - CAF_CM_EXIT; - - return false; -} - -SmartPtrIIntegrationObject CVersionTransformer::createObject( - const SmartPtrIDocument& configSection) const { - CAF_CM_FUNCNAME_VALIDATE("createObject"); - - SmartPtrIIntegrationObject rc; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - - rc.CreateInstance(_sObjIdVersionTransformerInstance); - rc->initialize(_ctorArgs, _properties, configSection); - } - CAF_CM_EXIT; - - return rc; -} diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CVersionTransformer.h b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CVersionTransformer.h deleted file mode 100644 index ca228808a..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CVersionTransformer.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CVersionTransformer_h_ -#define CVersionTransformer_h_ - - -#include "IBean.h" - -#include "Integration/IDocument.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/IIntegrationComponent.h" - -namespace Caf { - -/// Sends responses/errors back to the client. -class CVersionTransformer : - public TCafSubSystemObjectRoot, - public IBean, - public IIntegrationComponent { -public: - CVersionTransformer(); - virtual ~CVersionTransformer(); - - CAF_DECLARE_OBJECT_IDENTIFIER(_sObjIdVersionTransformer) - - CAF_BEGIN_INTERFACE_MAP(CVersionTransformer) - CAF_INTERFACE_ENTRY(IBean) - CAF_INTERFACE_ENTRY(IIntegrationComponent) - CAF_END_INTERFACE_MAP() - -public: - virtual void initialize(); - -public: // IBean - virtual void initializeBean(const IBean::Cargs& ctorArgs, const IBean::Cprops& properties); - - virtual void terminateBean(); - -public: // IIntegrationComponent - bool isResponsible( - const SmartPtrIDocument& configSection) const; - - SmartPtrIIntegrationObject createObject( - const SmartPtrIDocument& configSection) const; - -private: - bool _isInitialized; - IBean::Cargs _ctorArgs; - IBean::Cprops _properties; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CVersionTransformer); -}; - -} - -#endif // #ifndef CVersionTransformer_h_ diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CVersionTransformerInstance.cpp b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CVersionTransformerInstance.cpp deleted file mode 100644 index ba111ae8a..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CVersionTransformerInstance.cpp +++ /dev/null @@ -1,181 +0,0 @@ -/* -G * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Common/IAppContext.h" -#include "Doc/PayloadEnvelopeDoc/CPayloadEnvelopeDoc.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "Exception/CCafException.h" -#include "CVersionTransformerInstance.h" -#include "Integration/Caf/CCafMessagePayloadParser.h" - -using namespace Caf; - -CVersionTransformerInstance::CVersionTransformerInstance() : - _isInitialized(false), - CAF_CM_INIT_LOG("CVersionTransformerInstance") { -} - -CVersionTransformerInstance::~CVersionTransformerInstance() { -} - -void CVersionTransformerInstance::initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - - _id = configSection->findRequiredAttribute("id"); - - _isInitialized = true; -} - -std::string CVersionTransformerInstance::getId() const { - CAF_CM_FUNCNAME_VALIDATE("getId"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _id; -} - -void CVersionTransformerInstance::wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver) { - CAF_CM_FUNCNAME_VALIDATE("wire"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(appContext); - CAF_CM_VALIDATE_INTERFACE(channelResolver); -} - -SmartPtrIIntMessage CVersionTransformerInstance::transformMessage( - const SmartPtrIIntMessage& message) { - CAF_CM_FUNCNAME_VALIDATE("transformMessage"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_SMARTPTR(message); - - const SmartPtrCPayloadEnvelopeDoc payloadEnvelope = - CCafMessagePayloadParser::getPayloadEnvelope(message->getPayload()); - - SmartPtrIIntMessage rc = message; - rc = transformEnvelope(payloadEnvelope, rc); - rc = transformPayload(payloadEnvelope, rc); - - return rc; -} - -SmartPtrIIntMessage CVersionTransformerInstance::transformEnvelope( - const SmartPtrCPayloadEnvelopeDoc& payloadEnvelope, - const SmartPtrIIntMessage& message) const { - CAF_CM_FUNCNAME("transformEnvelope"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_SMARTPTR(payloadEnvelope); - CAF_CM_VALIDATE_SMARTPTR(message); - - const std::string payloadType = payloadEnvelope->getPayloadType(); - const std::string envelopeVersion = payloadEnvelope->getVersion(); - - std::string receivedMajorVersion; - std::string receivedMinorVersion; - parseVersion(payloadType, envelopeVersion, receivedMajorVersion, receivedMinorVersion); - - // Throwing an unsupported version exception is the last resort. - // If at all possible, transform the old version document into the - // new version. For example, if this is a v1.0 envelope, transform - // it into v1.1 and return it, otherwise throw an unsupported version - // exception. - const std::string expectedMajorVersion = "1"; - const std::string expectedMinorVersion = "0"; - if (receivedMajorVersion.compare(expectedMajorVersion) != 0) { - // Major version incompatibilities are not supported - CAF_CM_EXCEPTIONEX_VA5(UnsupportedVersionException, ERROR_NOT_SUPPORTED, - "Unsupported envelope major version - payloadType: %s, received: %s.%s, expected: %s.%s", - payloadType.c_str(), - receivedMajorVersion.c_str(), receivedMinorVersion.c_str(), - expectedMajorVersion.c_str(), expectedMinorVersion.c_str()); - } - if (receivedMinorVersion.compare(expectedMinorVersion) != 0) { - // Minor version incompatibilities are not supported - CAF_CM_EXCEPTIONEX_VA5(UnsupportedVersionException, ERROR_NOT_SUPPORTED, - "Unsupported envelope minor version - payloadType: %s, received: %s.%s, expected: %s.%s", - payloadType.c_str(), - receivedMajorVersion.c_str(), receivedMinorVersion.c_str(), - expectedMajorVersion.c_str(), expectedMinorVersion.c_str()); - } - - return message; -} - -SmartPtrIIntMessage CVersionTransformerInstance::transformPayload( - const SmartPtrCPayloadEnvelopeDoc& payloadEnvelope, - const SmartPtrIIntMessage& message) const { - CAF_CM_FUNCNAME("transformPayload"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_SMARTPTR(payloadEnvelope); - CAF_CM_VALIDATE_SMARTPTR(message); - - const std::string payloadType = payloadEnvelope->getPayloadType(); - const std::string payloadVersion = payloadEnvelope->getPayloadVersion(); - - std::string receivedMajorVersion; - std::string receivedMinorVersion; - parseVersion(payloadType, payloadVersion, receivedMajorVersion, receivedMinorVersion); - - // Throwing an unsupported version exception is the last resort. - // If at all possible, transform the old version document into the - // new version. For example, if this is a v1.0 mgmtRequest, transform - // it into v1.1 and return it, otherwise throw an unsupported version - // exception. The problem is that the payload is probably in an attachment - // that's been signed and encrypted, so it isn't available to be transformed. - // To handle this case, we'll probably do the enforcement here and the - // actual transformation later in the process when the payload has been - // verified and decrypted. - const std::string expectedMajorVersion = "1"; - const std::string expectedMinorVersion = "0"; - if (receivedMajorVersion.compare(expectedMajorVersion) != 0) { - // Major version incompatibilities are not supported - CAF_CM_EXCEPTIONEX_VA5(UnsupportedVersionException, ERROR_NOT_SUPPORTED, - "Unsupported payload major version - payloadType: %s, received: %s.%s, expected: %s.%s", - payloadType.c_str(), - receivedMajorVersion.c_str(), receivedMinorVersion.c_str(), - expectedMajorVersion.c_str(), expectedMinorVersion.c_str()); - } - if (receivedMinorVersion.compare(expectedMinorVersion) != 0) { - // Minor version incompatibilities are not supported - CAF_CM_EXCEPTIONEX_VA5(UnsupportedVersionException, ERROR_NOT_SUPPORTED, - "Unsupported payload minor version - payloadType: %s, received: %s.%s, expected: %s.%s", - payloadType.c_str(), - receivedMajorVersion.c_str(), receivedMinorVersion.c_str(), - expectedMajorVersion.c_str(), expectedMinorVersion.c_str()); - } - - return message; -} - -void CVersionTransformerInstance::parseVersion( - const std::string& messageType, - const std::string& version, - std::string& majorVersion, - std::string& minorVersion) const { - CAF_CM_FUNCNAME("parseVersion"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(messageType); - CAF_CM_VALIDATE_STRING(version); - - const Cdeqstr versionDeq = CStringUtils::split(version, '.'); - if (versionDeq.size() < 2) { - CAF_CM_EXCEPTION_VA2(ERROR_INVALID_DATA, - "Invalid version format - messageType: %s, version: %s", - messageType.c_str(), version.c_str()); - } - - majorVersion = versionDeq[0]; - minorVersion = versionDeq[1]; -} diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CVersionTransformerInstance.h b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CVersionTransformerInstance.h deleted file mode 100644 index 1abc7c6d3..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/CVersionTransformerInstance.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CVersionTransformerInstance_h_ -#define CVersionTransformerInstance_h_ - - -#include "Integration/IIntegrationComponentInstance.h" - -#include "Common/IAppContext.h" -#include "Doc/PayloadEnvelopeDoc/CPayloadEnvelopeDoc.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/ITransformer.h" - -namespace Caf { - -class CVersionTransformerInstance : - public TCafSubSystemObjectRoot, - public IIntegrationObject, - public IIntegrationComponentInstance, - public ITransformer { -public: - CVersionTransformerInstance(); - virtual ~CVersionTransformerInstance(); - - CAF_DECLARE_OBJECT_IDENTIFIER(_sObjIdVersionTransformerInstance) - - CAF_BEGIN_INTERFACE_MAP(CVersionTransformerInstance) - CAF_INTERFACE_ENTRY(IIntegrationObject) - CAF_INTERFACE_ENTRY(IIntegrationComponentInstance) - CAF_INTERFACE_ENTRY(ITransformer) - CAF_END_INTERFACE_MAP() - -public: // IIntegrationObject - void initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection); - - std::string getId() const; - -public: // IIntegrationComponentInstance - void wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver); - -public: // ITransformer - SmartPtrIIntMessage transformMessage( - const SmartPtrIIntMessage& message); - -private: - SmartPtrIIntMessage transformEnvelope( - const SmartPtrCPayloadEnvelopeDoc& payloadEnvelope, - const SmartPtrIIntMessage& message) const; - - SmartPtrIIntMessage transformPayload( - const SmartPtrCPayloadEnvelopeDoc& payloadEnvelope, - const SmartPtrIIntMessage& message) const; - - void parseVersion( - const std::string& payloadType, - const std::string& version, - std::string& majorVersion, - std::string& minorVersion) const; - -private: - bool _isInitialized; - std::string _id; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CVersionTransformerInstance); -}; - -} - -#endif // #ifndef CVersionTransformerInstance_h_ diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/IntegrationObjects.cpp b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/IntegrationObjects.cpp deleted file mode 100644 index 49ae85274..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/IntegrationObjects.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Created on: Nov 13, 2015 - * Author: bwilliams - * - * Copyright (C) 2015-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "CConfigEnvInboundChannelAdapterInstance.h" -#include "CConfigEnvOutboundChannelAdapterInstance.h" -#include "CMonitorInboundChannelAdapterInstance.h" -#include "CPersistenceOutboundChannelAdapterInstance.h" -#include "Integration/IDocument.h" -#include "Integration/IIntegrationObject.h" -#include "Exception/CCafException.h" -#include "IntegrationObjects.h" -#include "CPersistenceInboundChannelAdapterInstance.h" - -using namespace Caf::MaIntegration; - -IntegrationObjects::IntegrationObjects() : - CAF_CM_INIT("IntegrationObjects") { -} - -IntegrationObjects::~IntegrationObjects() { -} - -void IntegrationObjects::initializeBean( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties) { - CAF_CM_FUNCNAME_VALIDATE("initializeBean"); - CAF_CM_VALIDATE_STL_EMPTY(ctorArgs); - CAF_CM_VALIDATE_STL_EMPTY(properties); - _ctorArgs = ctorArgs; - _properties = properties; -} - -void IntegrationObjects::terminateBean() { -} - -bool IntegrationObjects::isResponsible( - const SmartPtrIDocument& configSection) const { - CAF_CM_FUNCNAME_VALIDATE("isResponsible"); - CAF_CM_VALIDATE_INTERFACE(configSection); - - const std::string name = configSection->getName(); - return (name.compare("persistence-inbound-channel-adapter") == 0) - || (name.compare("persistence-outbound-channel-adapter") == 0) - || (name.compare("configenv-inbound-channel-adapter") == 0) - || (name.compare("configenv-outbound-channel-adapter") == 0) - || (name.compare("monitor-inbound-channel-adapter") == 0); -} - -SmartPtrIIntegrationObject IntegrationObjects::createObject( - const SmartPtrIDocument& configSection) const { - CAF_CM_FUNCNAME("createObject"); - CAF_CM_VALIDATE_INTERFACE(configSection); - - SmartPtrIIntegrationObject rc; - const std::string name = configSection->getName(); - if (name.compare("persistence-inbound-channel-adapter") == 0) { - SmartPtrCPersistenceInboundChannelAdapterInstance object; - object.CreateInstance(); - rc = object; - } else if (name.compare("persistence-outbound-channel-adapter") == 0) { - SmartPtrCPersistenceOutboundChannelAdapterInstance object; - object.CreateInstance(); - rc = object; - } else if (name.compare("configenv-inbound-channel-adapter") == 0) { - SmartPtrCConfigEnvInboundChannelAdapterInstance object; - object.CreateInstance(); - rc = object; - } else if (name.compare("configenv-outbound-channel-adapter") == 0) { - SmartPtrCConfigEnvOutboundChannelAdapterInstance object; - object.CreateInstance(); - rc = object; - } else if (name.compare("monitor-inbound-channel-adapter") == 0) { - SmartPtrCMonitorInboundChannelAdapterInstance object; - object.CreateInstance(); - rc = object; - } else { - CAF_CM_EXCEPTION_VA1(E_INVALIDARG, "Unknown name - %s", name.c_str()); - } - - rc->initialize(_ctorArgs, _properties, configSection); - return rc; -} diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/IntegrationObjects.h b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/IntegrationObjects.h deleted file mode 100644 index 347e9e15b..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/IntegrationObjects.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Created on: Nov 13, 2015 - * Author: bwilliams - * - * Copyright (C) 2015-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef _MaIntegration_IntegrationObjects_h_ -#define _MaIntegration_IntegrationObjects_h_ - - -#include "IBean.h" - -#include "Integration/IDocument.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/IIntegrationComponent.h" - -namespace Caf { namespace MaIntegration { - -class IntegrationObjects : - public TCafSubSystemObjectRoot, - public IBean, - public IIntegrationComponent { -public: - IntegrationObjects(); - virtual ~IntegrationObjects(); - -public: - CAF_DECLARE_OBJECT_IDENTIFIER(_sObjIdIntegrationObjects) - - CAF_BEGIN_INTERFACE_MAP(IntegrationObjects) - CAF_INTERFACE_ENTRY(IBean) - CAF_INTERFACE_ENTRY(IIntegrationComponent) - CAF_END_INTERFACE_MAP() - -public: // IBean - void initializeBean( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties); - - void terminateBean(); - -public: // IIntegrationComponent - bool isResponsible( - const SmartPtrIDocument& configSection) const; - - SmartPtrIIntegrationObject createObject( - const SmartPtrIDocument& configSection) const; - -private: - IBean::Cargs _ctorArgs; - IBean::Cprops _properties; - -private: - CAF_CM_CREATE; - CAF_CM_DECLARE_NOCOPY(IntegrationObjects); -}; - -}} - -#endif /* _MaIntegration_IntegrationObjects_h_ */ diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/MaContracts.h b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/MaContracts.h deleted file mode 100644 index 2f9624911..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/MaContracts.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Author: bwilliams - * Created: 1/20/2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef MaContracts_h_ -#define MaContracts_h_ - -//#include - -// Interfaces - -#endif diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/MaIntegration.cpp b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/MaIntegration.cpp deleted file mode 100644 index 4d562eb7f..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/MaIntegration.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "MaIntegration.h" -#include "IntegrationObjects.h" -#include "CAttachmentRequestTransformerInstance.h" -#include "CDiagToMgmtRequestTransformerInstance.h" -#include "CSinglePmeRequestSplitterInstance.h" - -namespace Caf { - -namespace MaIntegration { - const char* _sObjIdIntegrationObjects = "com.vmware.commonagent.maintegration.integrationobjects"; -}} - -namespace Caf { - const char* _sObjIdCollectSchemaExecutor = "com.vmware.commonagent.maintegration.collectschemaexecutor"; - const char* _sObjIdProviderCollectSchemaExecutor = "com.vmware.commonagent.maintegration.providercollectschemaexecutor"; - const char* _sObjIdProviderExecutor = "com.vmware.commonagent.maintegration.providerexecutor"; - const char* _sObjIdSinglePmeRequestSplitterInstance = "com.vmware.commonagent.maintegration.singlepmerequestsplitterinstance"; - const char* _sObjIdSinglePmeRequestSplitter = "com.vmware.commonagent.maintegration.singlepmerequestsplitter"; - const char* _sObjIdDiagToMgmtRequestTransformerInstance = "com.vmware.commonagent.maintegration.diagtomgmtrequesttransformerinstance"; - const char* _sObjIdDiagToMgmtRequestTransformer = "com.vmware.commonagent.maintegration.diagtomgmtrequesttransformer"; - const char* _sObjIdInstallToMgmtRequestTransformerInstance = "com.vmware.commonagent.maintegration.installtomgmtrequesttransformerinstance"; - const char* _sObjIdInstallToMgmtRequestTransformer = "com.vmware.commonagent.maintegration.installtomgmtrequesttransformer"; - const char* _sObjIdPersistenceNamespaceDb = "com.vmware.commonagent.maintegration.persistencenamespacedb"; - const char* _sObjIdConfigEnv = "com.vmware.commonagent.maintegration.configenv"; - - const char* _sObjIdAttachmentRequestTransformerInstance = "com.vmware.commonagent.maintegration.attachmentrequesttransformerinstance"; - const char* _sObjIdAttachmentRequestTransformer = "com.vmware.commonagent.maintegration.attachmentrequesttransformer"; - const char* _sObjIdVersionTransformerInstance = "com.vmware.commonagent.maintegration.versiontransformerinstance"; - const char* _sObjIdVersionTransformer = "com.vmware.commonagent.maintegration.versiontransformer"; -} - -CEcmSubSystemModule _Module; - -using namespace Caf::MaIntegration; - -CAF_BEGIN_OBJECT_MAP(ObjectMap) - CAF_OBJECT_ENTRY(CAttachmentRequestTransformer) - CAF_OBJECT_ENTRY(CAttachmentRequestTransformerInstance) - CAF_OBJECT_ENTRY(CCollectSchemaExecutor) - CAF_OBJECT_ENTRY(CConfigEnv) - CAF_OBJECT_ENTRY(CDiagToMgmtRequestTransformer) - CAF_OBJECT_ENTRY(CDiagToMgmtRequestTransformerInstance) - CAF_OBJECT_ENTRY(CInstallToMgmtRequestTransformer) - CAF_OBJECT_ENTRY(CInstallToMgmtRequestTransformerInstance) - CAF_OBJECT_ENTRY(CPersistenceNamespaceDb) - CAF_OBJECT_ENTRY(CProviderCollectSchemaExecutor) - CAF_OBJECT_ENTRY(CProviderExecutor) - CAF_OBJECT_ENTRY(CSinglePmeRequestSplitter) - CAF_OBJECT_ENTRY(CSinglePmeRequestSplitterInstance) - CAF_OBJECT_ENTRY(CVersionTransformer) - CAF_OBJECT_ENTRY(CVersionTransformerInstance) - CAF_OBJECT_ENTRY(IntegrationObjects) -CAF_END_OBJECT_MAP() - -CAF_DECLARE_SUBSYSTEM_EXPORTS() - -extern "C" BOOL APIENTRY DllMain(HINSTANCE hModule, uint32 dwReason, LPVOID) -{ - try { - if (DLL_PROCESS_ATTACH == dwReason) - { - // initialize the sub-system module - _Module.Init(ObjectMap, hModule); - } - else if (DLL_PROCESS_DETACH == dwReason) - { - // Terminate the sub-system module - _Module.Term(); - } - } catch (std::runtime_error) { - ::exit(2); - } catch (...) { - ::exit(2); - } - - return TRUE; -} diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/stdafx.h b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/stdafx.h deleted file mode 100644 index c8e1e5b4b..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/MaIntegration/src/stdafx.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2017 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef stdafx_h_ -#define stdafx_h_ - -//{{CAF_SUBSYSTEM}} - -#include -#include -#include - -#include "MaContracts.h" -#include "MaIntegration.h" -#include "IntegrationObjects.h" - -#include "CAttachmentRequestTransformer.h" - -#include "CDiagToMgmtRequestTransformer.h" - -#include "CInstallToMgmtRequestTransformerInstance.h" -#include "CInstallToMgmtRequestTransformer.h" - -#include "CPersistenceNamespaceDb.h" -#include "CPersistenceMessageHandler.h" -#include "CPersistenceInboundChannelAdapterInstance.h" -#include "CPersistenceOutboundChannelAdapterInstance.h" - -#include "CMonitorListener.h" - -#include "CPersistenceMerge.h" -#include "CConfigEnvMerge.h" -#include "CConfigEnv.h" -#include "CConfigEnvMessageHandler.h" -#include "CConfigEnvInboundChannelAdapterInstance.h" -#include "CConfigEnvOutboundChannelAdapterInstance.h" - -#include "CCollectSchemaExecutor.h" -#include "CProviderCollectSchemaExecutor.h" -#include "CProviderExecutor.h" - -#include "CSinglePmeRequestSplitter.h" - -#include "CMonitorInboundChannelAdapterInstance.h" - -#include "CVersionTransformer.h" -#include "CVersionTransformerInstance.h" - -#endif // #ifndef stdafx_h_ diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/VgAuth/include/CVgAuthContext.h b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/VgAuth/include/CVgAuthContext.h deleted file mode 100644 index 2c62a2564..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/VgAuth/include/CVgAuthContext.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Author: bwilliams - * Created: Aug 16, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CVgAuthContext_H_ -#define CVgAuthContext_H_ - -namespace Caf { - -class CVgAuthContext { -public: - CVgAuthContext(); - virtual ~CVgAuthContext(); - -public: - void initialize( - const std::string& applicationName); - - VGAuthContext* getPtr() const; - - std::string getApplicationName() const; - -private: - bool _isInitialized; - VGAuthContext* _vgAuthContext; - std::string _applicationName; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CVgAuthContext); -}; - -CAF_DECLARE_SMART_POINTER(CVgAuthContext); - -} - -#endif /* CVgAuthContext_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/VgAuth/include/CVgAuthImpersonation.h b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/VgAuth/include/CVgAuthImpersonation.h deleted file mode 100644 index 5fc3caa12..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/VgAuth/include/CVgAuthImpersonation.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Author: bwilliams - * Created: Aug 16, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CVgAuthImpersonation_H_ -#define CVgAuthImpersonation_H_ - - -#include "CVgAuthContext.h" -#include "CVgAuthUserHandle.h" - -namespace Caf { - -class CVgAuthImpersonation { -public: - CVgAuthImpersonation(); - virtual ~CVgAuthImpersonation(); - -public: - void impersonateAndManage( - const SmartPtrCVgAuthContext& vgAuthContext, - const SmartPtrCVgAuthUserHandle& vgAuthUserHandle); - -public: - static void beginImpersonation( - const SmartPtrCVgAuthContext& vgAuthContext, - const SmartPtrCVgAuthUserHandle& vgAuthUserHandle); - - static void endImpersonation( - const SmartPtrCVgAuthContext& vgAuthContext); - -private: - void impersonateLocal( - const SmartPtrCVgAuthContext& vgAuthContext, - const SmartPtrCVgAuthUserHandle& vgAuthUserHandle) const; - -private: - bool _isInitialized; - SmartPtrCVgAuthContext _vgAuthContext; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CVgAuthImpersonation); -}; - -CAF_DECLARE_SMART_POINTER(CVgAuthImpersonation); - -} - -#endif /* CVgAuthImpersonation_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/VgAuth/include/CVgAuthUserHandle.h b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/VgAuth/include/CVgAuthUserHandle.h deleted file mode 100644 index f0a143f60..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/VgAuth/include/CVgAuthUserHandle.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Author: bwilliams - * Created: Aug 16, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CVgAuthUserHandle_H_ -#define CVgAuthUserHandle_H_ - - -#include "CVgAuthContext.h" - -namespace Caf { - -class CVgAuthUserHandle { -public: - CVgAuthUserHandle(); - virtual ~CVgAuthUserHandle(); - -public: - void initialize( - const SmartPtrCVgAuthContext& vgAuthContext, - const std::string& signedSamlToken); - - void initialize( - const SmartPtrCVgAuthContext& vgAuthContext, - const std::string& signedSamlToken, - const std::string& userName); - -public: - std::string getUserName( - const SmartPtrCVgAuthContext& vgAuthContext) const; - - VGAuthUserHandle* getPtr() const; - -private: - bool _isInitialized; - VGAuthUserHandle* _vgAuthUserHandle; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CVgAuthUserHandle); -}; - -CAF_DECLARE_SMART_POINTER(CVgAuthUserHandle); - -} - -#endif /* CVgAuthUserHandle_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/VgAuth/include/IVgAuthImpersonation.h b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/VgAuth/include/IVgAuthImpersonation.h deleted file mode 100644 index c095ac360..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/VgAuth/include/IVgAuthImpersonation.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Created on: Jan 25, 2012 - * Author: mdonahue - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef _IVgAuthImpersonation_H_ -#define _IVgAuthImpersonation_H_ - -namespace Caf { - -struct __declspec(novtable) - IVgAuthImpersonation : public ICafObject -{ - CAF_DECL_UUID("63cfac22-e1b8-4977-8907-9582657b7420") - - virtual void endImpersonation() = 0; -}; - -CAF_DECLARE_SMART_INTERFACE_POINTER(IVgAuthImpersonation); - -} - -#endif /* _IVgAuthImpersonation_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/VgAuth/src/CGuestAuthenticator.cpp b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/VgAuth/src/CGuestAuthenticator.cpp deleted file mode 100644 index 67a88792e..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/VgAuth/src/CGuestAuthenticator.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Integration/IDocument.h" -#include "Integration/IIntegrationObject.h" -#include "CGuestAuthenticator.h" - -using namespace Caf; - -CGuestAuthenticator::CGuestAuthenticator() : - _isInitialized(false), - CAF_CM_INIT_LOG("CGuestAuthenticator") { -} - -CGuestAuthenticator::~CGuestAuthenticator() { -} - -void CGuestAuthenticator::initializeBean( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties) { - - CAF_CM_FUNCNAME_VALIDATE("initializeBean"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STL_EMPTY(ctorArgs); - CAF_CM_VALIDATE_STL(properties); - - _ctorArgs = ctorArgs; - _properties = properties; - - initialize(); - - CAF_CM_LOG_DEBUG_VA1("num properties - %d", properties.size()); - } - CAF_CM_EXIT; -} - -void CGuestAuthenticator::terminateBean() { -} - -void CGuestAuthenticator::initialize() { - - CAF_CM_FUNCNAME_VALIDATE("initialize"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - _isInitialized = true; - } - CAF_CM_EXIT; -} - -bool CGuestAuthenticator::isResponsible( - const SmartPtrIDocument& configSection) const { - CAF_CM_FUNCNAME_VALIDATE("isResponsible"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - } - CAF_CM_EXIT; - - return false; -} - -SmartPtrIIntegrationObject CGuestAuthenticator::createObject( - const SmartPtrIDocument& configSection) const { - CAF_CM_FUNCNAME_VALIDATE("createObject"); - - SmartPtrIIntegrationObject rc; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(configSection); - - rc.CreateInstance(_sObjIdGuestAuthenticatorInstance); - rc->initialize(_ctorArgs, _properties, configSection); - } - CAF_CM_EXIT; - - return rc; -} diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/VgAuth/src/CGuestAuthenticator.h b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/VgAuth/src/CGuestAuthenticator.h deleted file mode 100644 index 71de5f383..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/VgAuth/src/CGuestAuthenticator.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CGuestAuthenticator_h_ -#define CGuestAuthenticator_h_ - - -#include "IBean.h" - -#include "Integration/IDocument.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/IIntegrationComponent.h" - -namespace Caf { - -/// Sends responses/errors back to the client. -class CGuestAuthenticator : - public TCafSubSystemObjectRoot, - public IBean, - public IIntegrationComponent { -public: - CGuestAuthenticator(); - virtual ~CGuestAuthenticator(); - - CAF_DECLARE_OBJECT_IDENTIFIER(_sObjIdGuestAuthenticator) - - CAF_BEGIN_INTERFACE_MAP(CGuestAuthenticator) - CAF_INTERFACE_ENTRY(IBean) - CAF_INTERFACE_ENTRY(IIntegrationComponent) - CAF_END_INTERFACE_MAP() - -public: - virtual void initialize(); - -public: // IBean - virtual void initializeBean( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties); - - virtual void terminateBean(); - -public: // IIntegrationComponent - bool isResponsible( - const SmartPtrIDocument& configSection) const; - - SmartPtrIIntegrationObject createObject( - const SmartPtrIDocument& configSection) const; - -private: - bool _isInitialized; - IBean::Cargs _ctorArgs; - IBean::Cprops _properties; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CGuestAuthenticator); -}; - -} - -#endif // #ifndef CGuestAuthenticator_h_ diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/VgAuth/src/CGuestAuthenticatorInstance.cpp b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/VgAuth/src/CGuestAuthenticatorInstance.cpp deleted file mode 100644 index 7f18cdd13..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/VgAuth/src/CGuestAuthenticatorInstance.cpp +++ /dev/null @@ -1,271 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Integration/Caf/CCafMessagePayload.h" -#include "CVgAuthImpersonation.h" -#include "CVgAuthInitializer.h" -#include "CVgAuthContext.h" -#include "CVgAuthUserHandle.h" -#include "Common/IAppContext.h" -#include "Doc/CafCoreTypesDoc/CAuthnAuthzCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CAuthnAuthzDoc.h" -#include "Doc/CafCoreTypesDoc/CRequestHeaderDoc.h" -#include "ICafObject.h" -#include "IVgAuthImpersonation.h" -#include "Integration/Core/CIntMessage.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "Memory/DynamicArray/DynamicArrayInc.h" -#include "Integration/Core/CIntMessageHeaders.h" -#include "CGuestAuthenticatorInstance.h" - -using namespace Caf; - -CGuestAuthenticatorInstance::CGuestAuthenticatorInstance() : - _isInitialized(false), - _beginImpersonation(false), - _endImpersonation(false), - CAF_CM_INIT_LOG("CGuestAuthenticatorInstance") { -} - -CGuestAuthenticatorInstance::~CGuestAuthenticatorInstance() { -} - -void CGuestAuthenticatorInstance::initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection) { - - CAF_CM_FUNCNAME_VALIDATE("initialize"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STL_EMPTY(ctorArgs); - CAF_CM_VALIDATE_STL(properties); - CAF_CM_VALIDATE_INTERFACE(configSection); - - _id = configSection->findRequiredAttribute("id"); - - const std::string beginImpersonationStr = - findOptionalProperty("beginImpersonation", properties); - const std::string endImpersonationStr = - findOptionalProperty("endImpersonation", properties); - - _beginImpersonation = - (beginImpersonationStr.empty() || beginImpersonationStr.compare("false") == 0) ? false : true; - _endImpersonation = - (endImpersonationStr.empty() || endImpersonationStr.compare("false") == 0) ? false : true; - - _isInitialized = true; - } - CAF_CM_EXIT; -} - -std::string CGuestAuthenticatorInstance::getId() const { - CAF_CM_FUNCNAME_VALIDATE("getId"); - - std::string rc; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - rc = _id; - } - CAF_CM_EXIT; - - return rc; -} - -void CGuestAuthenticatorInstance::wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver) { - CAF_CM_FUNCNAME_VALIDATE("wire"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_INTERFACE(appContext); - CAF_CM_VALIDATE_INTERFACE(channelResolver); - } - CAF_CM_EXIT; -} - -SmartPtrIIntMessage CGuestAuthenticatorInstance::transformMessage( - const SmartPtrIIntMessage& message) { - CAF_CM_FUNCNAME_VALIDATE("transformMessage"); - - SmartPtrIIntMessage newMessage; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_SMARTPTR(message); - - CAF_CM_LOG_DEBUG_VA1("Called - id: \"%s\"", _id.c_str()); - - CIntMessageHeaders messageHeaders; - - const std::string vgAuthImpersonationStr = "vgAuthImpersonation"; - const SmartPtrICafObject cafObject = - message->findOptionalObjectHeader(vgAuthImpersonationStr); - if (cafObject.IsNull()) { - if (_endImpersonation) { - CAF_CM_LOG_ERROR_VA1("Cannot end impersonation without proper header - %s", - vgAuthImpersonationStr.c_str()); - } else { - SmartPtrCVgAuthInitializer vgAuthInitializer; - vgAuthInitializer.CreateInstance(); - vgAuthInitializer->initialize("CAF"); - const SmartPtrCVgAuthContext vgAuthContext = - vgAuthInitializer->getContext(); - - const std::string signedSamlToken = - getSignedSamlToken(message->getPayload()); - - SmartPtrCVgAuthUserHandle vgAuthUserHandle; - vgAuthUserHandle.CreateInstance(); - vgAuthUserHandle->initialize( - vgAuthContext, signedSamlToken); - - if (_beginImpersonation) { - logUserInfo("Before beginning impersonation"); - CVgAuthImpersonation::beginImpersonation(vgAuthContext, vgAuthUserHandle); - const std::string userName = vgAuthUserHandle->getUserName(vgAuthContext); - logUserInfo("After beginning impersonation"); - - messageHeaders.insertObject(vgAuthImpersonationStr, vgAuthInitializer); - messageHeaders.insertString("AUTHORITY", "IS_AUTHENTICATED_FULLY"); - messageHeaders.insertString("AUTHORITY_USERNAME", userName); - } - } - } else { - if (_endImpersonation) { - SmartPtrIVgAuthImpersonation vgAuthImpersonation; - vgAuthImpersonation.QueryInterface(cafObject, true); - CAF_CM_VALIDATE_SMARTPTR(vgAuthImpersonation); - - logUserInfo("Before ending impersonation"); - vgAuthImpersonation->endImpersonation(); - logUserInfo("After ending impersonation"); - - messageHeaders.insertString("AUTHORITY", "IS_AUTHENTICATED_ANONYMOUSLY"); - messageHeaders.insertString("AUTHORITY_USERNAME", "ANONYMOUS"); - } else { - CAF_CM_LOG_WARN_VA1("Headers contain impersonation interface, but the ending of impersonation was not requested - %s", - vgAuthImpersonationStr.c_str()); - } - - //messageHeaders.insertObject(vgAuthImpersonationStr, SmartPtrICafObject()); - } - - SmartPtrCIntMessage messageImpl; - messageImpl.CreateInstance(); - messageImpl->initialize(message->getPayload(), - messageHeaders.getHeaders(), message->getHeaders()); - newMessage = messageImpl; - } - CAF_CM_EXIT; - - return newMessage; -} - -SmartPtrIIntMessage CGuestAuthenticatorInstance::processErrorMessage( - const SmartPtrIIntMessage& message) { - CAF_CM_FUNCNAME("processErrorMessage"); - - SmartPtrIIntMessage newMessage; - - try { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_SMARTPTR(message); - - CAF_CM_LOG_DEBUG_VA1("Called - %s", _id.c_str()); - - newMessage = transformMessage(message); - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_CLEAREXCEPTION; - - return newMessage; -} - -std::string CGuestAuthenticatorInstance::getSignedSamlToken( - const SmartPtrCDynamicByteArray& payload) const { - CAF_CM_FUNCNAME_VALIDATE("getSignedSamlToken"); - - std::string signedSamlToken; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(payload); - - const SmartPtrCCafMessagePayload cafMessagePayload = - CCafMessagePayload::create(payload); - - const SmartPtrCRequestHeaderDoc requestHeader = - cafMessagePayload->getRequestHeader(); - const SmartPtrCAuthnAuthzCollectionDoc authnAuthzCollection = - requestHeader->getAuthnAuthzCollection(); - CAF_CM_VALIDATE_SMARTPTR(authnAuthzCollection); - CAF_CM_VALIDATE_STL(authnAuthzCollection->getAuthnAuthz()); - - //TODO: Pass the other types (e.g. username / password) to VgAuth. - //TODO: Use the sequence number to prioritize the types. - //TODO: Consider creating a type for the string "SAML" - for (std::deque::const_iterator authnAuthzIter = - authnAuthzCollection->getAuthnAuthz().begin(); - authnAuthzIter != authnAuthzCollection->getAuthnAuthz().end(); - authnAuthzIter++) { - const SmartPtrCAuthnAuthzDoc authnAuthz = *authnAuthzIter; - if (authnAuthz->getType().compare("SAML") == 0) { - signedSamlToken = authnAuthz->getValue(); - } - } - - CAF_CM_VALIDATE_STRING(signedSamlToken); - } - CAF_CM_EXIT; - - return signedSamlToken; -} - -std::string CGuestAuthenticatorInstance::findOptionalProperty( - const std::string& propertyName, - const IBean::Cprops& properties) const { - CAF_CM_FUNCNAME_VALIDATE("findOptionalProperty"); - - std::string rc; - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(propertyName); - CAF_CM_VALIDATE_STL(properties); - - IBean::Cprops::const_iterator propertiesIter = properties.find(propertyName); - if (propertiesIter != properties.end()) { - rc = propertiesIter->second; - } - } - CAF_CM_EXIT; - - return rc; -} - -void CGuestAuthenticatorInstance::logUserInfo( - const std::string& msg) const { - CAF_CM_FUNCNAME_VALIDATE("logUserInfo"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(msg); - -#ifndef WIN32 - CAF_CM_LOG_DEBUG_VA3("%s - UID: %d, GID: %d", msg.c_str(), ::geteuid(), ::getegid()); -#endif - } - CAF_CM_EXIT; -} diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/VgAuth/src/CGuestAuthenticatorInstance.h b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/VgAuth/src/CGuestAuthenticatorInstance.h deleted file mode 100644 index 5963fa4cd..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/VgAuth/src/CGuestAuthenticatorInstance.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CGuestAuthenticatorInstance_h_ -#define CGuestAuthenticatorInstance_h_ - - -#include "Integration/IErrorProcessor.h" - -#include "Common/IAppContext.h" -#include "Integration/IChannelResolver.h" -#include "Integration/IDocument.h" -#include "Integration/IIntMessage.h" -#include "Memory/DynamicArray/DynamicArrayInc.h" -#include "Integration/IIntegrationComponentInstance.h" -#include "Integration/IIntegrationObject.h" -#include "Integration/ITransformer.h" - -namespace Caf { - -class CGuestAuthenticatorInstance : - public TCafSubSystemObjectRoot, - public IIntegrationObject, - public IIntegrationComponentInstance, - public ITransformer, - public IErrorProcessor { -public: - CGuestAuthenticatorInstance(); - virtual ~CGuestAuthenticatorInstance(); - - CAF_DECLARE_OBJECT_IDENTIFIER(_sObjIdGuestAuthenticatorInstance) - - CAF_BEGIN_INTERFACE_MAP(CGuestAuthenticatorInstance) - CAF_INTERFACE_ENTRY(IIntegrationObject) - CAF_INTERFACE_ENTRY(IIntegrationComponentInstance) - CAF_INTERFACE_ENTRY(ITransformer) - CAF_INTERFACE_ENTRY(IErrorProcessor) - CAF_END_INTERFACE_MAP() - -public: // IIntegrationObject - void initialize( - const IBean::Cargs& ctorArgs, - const IBean::Cprops& properties, - const SmartPtrIDocument& configSection); - - std::string getId() const; - -public: // IIntegrationComponentInstance - void wire( - const SmartPtrIAppContext& appContext, - const SmartPtrIChannelResolver& channelResolver); - -public: // ITransformer - SmartPtrIIntMessage transformMessage( - const SmartPtrIIntMessage& message); - -public: // IErrorProcessor - SmartPtrIIntMessage processErrorMessage( - const SmartPtrIIntMessage& message); - -private: - bool _isInitialized; - std::string _id; - bool _beginImpersonation; - bool _endImpersonation; - -private: - std::string getSignedSamlToken( - const SmartPtrCDynamicByteArray& payload) const; - - std::string findOptionalProperty( - const std::string& propertyName, - const IBean::Cprops& properties) const; - - void logUserInfo( - const std::string& msg) const; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CGuestAuthenticatorInstance); -}; - -} - -#endif // #ifndef CGuestAuthenticatorInstance_h_ diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/VgAuth/src/CVgAuthContext.cpp b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/VgAuth/src/CVgAuthContext.cpp deleted file mode 100644 index 0ed53f6e3..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/VgAuth/src/CVgAuthContext.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Author: bwilliams - * Created: Aug 16, 2012 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "CVgAuthContext.h" - -CVgAuthContext::CVgAuthContext() : - _isInitialized(false), - _vgAuthContext(NULL), - CAF_CM_INIT_LOG("CVgAuthContext") { -} - -CVgAuthContext::~CVgAuthContext() { - CAF_CM_FUNCNAME("~CVgAuthContext"); - - try { - if (_isInitialized) { - const VGAuthError vgAuthError = VGAuth_Shutdown(_vgAuthContext); - CVgAuthError::checkErrorExc(vgAuthError, "VGAuth_Shutdown Failed"); - } - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_CLEAREXCEPTION; -} - -void CVgAuthContext::initialize( - const std::string& applicationName) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(applicationName); - - const VGAuthError vgAuthError = VGAuth_Init(applicationName.c_str(), 0, NULL, &_vgAuthContext); - CVgAuthError::checkErrorExc(vgAuthError, "VGAuth_Init Failed", applicationName); - CAF_CM_VALIDATE_PTR(_vgAuthContext); - - _applicationName = applicationName; - _isInitialized = true; - } - CAF_CM_EXIT; -} - -VGAuthContext* CVgAuthContext::getPtr() const { - CAF_CM_FUNCNAME_VALIDATE("getPtr"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _vgAuthContext; -} - -std::string CVgAuthContext::getApplicationName() const { - CAF_CM_FUNCNAME_VALIDATE("getApplicationName"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _applicationName; -} diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/VgAuth/src/CVgAuthError.cpp b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/VgAuth/src/CVgAuthError.cpp deleted file mode 100644 index 604a4109c..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/VgAuth/src/CVgAuthError.cpp +++ /dev/null @@ -1,214 +0,0 @@ -/* - * Author: bwilliams - * Created: Jan 21, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "Exception/CCafException.h" -#include "CVgAuthError.h" - -using namespace Caf; - -void CVgAuthError::checkErrorExc( - const VGAuthError& vgAuthError, - const std::string& msg) { - CAF_CM_STATIC_FUNC("CVgAuthError", "checkErrorExc"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(msg); - - if (VGAUTH_FAILED(vgAuthError)) { - CAF_CM_EXCEPTIONEX_VA2(UnsupportedOperationException, getErrorCode(vgAuthError), - "%s (%s)", msg.c_str(), getErrorMsg(vgAuthError).c_str()); - } - } - CAF_CM_EXIT; -} - -void CVgAuthError::checkErrorExc( - const VGAuthError& vgAuthError, - const std::string& msg, - const std::string& addtlInfo) { - CAF_CM_STATIC_FUNC("CVgAuthError", "checkErrorExc"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(msg); - CAF_CM_VALIDATE_STRING(addtlInfo); - - if (VGAUTH_FAILED(vgAuthError)) { - CAF_CM_EXCEPTIONEX_VA3(UnsupportedOperationException, getErrorCode(vgAuthError), - "%s (%s) - %s", msg.c_str(), getErrorMsg(vgAuthError).c_str(), addtlInfo.c_str()); - } - } - CAF_CM_EXIT; -} - -void CVgAuthError::checkErrorErr( - const VGAuthError& vgAuthError, - const std::string& msg) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CVgAuthError", "checkErrorErr"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(msg); - - if (VGAUTH_FAILED(vgAuthError)) { - CAF_CM_LOG_ERROR_VA2("%s (%s)", msg.c_str(), getErrorMsg(vgAuthError).c_str()); - } - } - CAF_CM_EXIT; -} - -void CVgAuthError::checkErrorErr( - const VGAuthError& vgAuthError, - const std::string& msg, - const std::string& addtlInfo) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CVgAuthError", "checkErrorErr"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_STRING(msg); - CAF_CM_VALIDATE_STRING(addtlInfo); - - if (VGAUTH_FAILED(vgAuthError)) { - CAF_CM_LOG_ERROR_VA3("%s (%s) - %s", msg.c_str(), getErrorMsg(vgAuthError).c_str(), addtlInfo.c_str()); - } - } - CAF_CM_EXIT; -} - -std::string CVgAuthError::getErrorMsg( - const VGAuthError& vgAuthError) { - - std::string vgAuthErrorMsg; - - CAF_CM_ENTER { - switch(vgAuthError) { - case VGAUTH_E_OK: - vgAuthErrorMsg = "VGAUTH_E_OK"; - break; - case VGAUTH_E_FAIL: - vgAuthErrorMsg = "VGAUTH_E_FAIL"; - break; - case VGAUTH_E_INVALID_ARGUMENT: - vgAuthErrorMsg = "VGAUTH_E_INVALID_ARGUMENT"; - break; - case VGAUTH_E_INVALID_CERTIFICATE: - vgAuthErrorMsg = "VGAUTH_E_INVALID_CERTIFICATE"; - break; - case VGAUTH_E_PERMISSION_DENIED: - vgAuthErrorMsg = "VGAUTH_E_PERMISSION_DENIED"; - break; - case VGAUTH_E_OUT_OF_MEMORY: - vgAuthErrorMsg = "VGAUTH_E_OUT_OF_MEMORY"; - break; - case VGAUTH_E_COMM: - vgAuthErrorMsg = "VGAUTH_E_COMM"; - break; - case VGAUTH_E_NOTIMPLEMENTED: - vgAuthErrorMsg = "VGAUTH_E_NOTIMPLEMENTED"; - break; - case VGAUTH_E_NOT_CONNECTED: - vgAuthErrorMsg = "VGAUTH_E_NOT_CONNECTED"; - break; - case VGAUTH_E_VERSION_MISMATCH: - vgAuthErrorMsg = "VGAUTH_E_VERSION_MISMATCH"; - break; - case VGAUTH_E_SECURITY_VIOLATION: - vgAuthErrorMsg = "VGAUTH_E_SECURITY_VIOLATION"; - break; - case VGAUTH_E_CERT_ALREADY_EXISTS: - vgAuthErrorMsg = "VGAUTH_E_CERT_ALREADY_EXISTS"; - break; - case VGAUTH_E_AUTHENTICATION_DENIED: - vgAuthErrorMsg = "VGAUTH_E_AUTHENTICATION_DENIED"; - break; - case VGAUTH_E_INVALID_TICKET: - vgAuthErrorMsg = "VGAUTH_E_INVALID_TICKET"; - break; - case VGAUTH_E_MULTIPLE_MAPPINGS: - vgAuthErrorMsg = "VGAUTH_E_MULTIPLE_MAPPINGS"; - break; - case VGAUTH_E_ALREADY_IMPERSONATING: - vgAuthErrorMsg = "VGAUTH_E_ALREADY_IMPERSONATING"; - break; - case VGAUTH_E_NO_SUCH_USER: - vgAuthErrorMsg = "VGAUTH_E_NO_SUCH_USER"; - break; - case VGAUTH_E_SERVICE_NOT_RUNNING: - vgAuthErrorMsg = "VGAUTH_E_SERVICE_NOT_RUNNING"; - break; - case VGAUTH_E_SYSTEM_ERRNO: - { - const uint32 vgAuthErrorCode = VGAUTH_ERROR_EXTRA_ERROR(vgAuthError); - const std::string errorMsg = CStringConv::toString(vgAuthErrorCode); - vgAuthErrorMsg = std::string("VGAUTH_E_SYSTEM_ERRNO, msg: " + errorMsg); - } - break; - case VGAUTH_E_SYSTEM_WINDOWS: - { - const uint32 vgAuthErrorCode = VGAUTH_ERROR_EXTRA_ERROR(vgAuthError); -#ifdef WIN32 - const std::string errorMsg = BasePlatform::PlatformApi::GetApiErrorMessage(vgAuthErrorCode); -#else - const std::string errorMsg = CStringConv::toString(vgAuthErrorCode); -#endif - vgAuthErrorMsg = std::string("VGAUTH_E_SYSTEM_WINDOWS, msg: " + errorMsg); - } - break; - case VGAUTH_E_TOO_MANY_CONNECTIONS: - vgAuthErrorMsg = "VGAUTH_E_TOO_MANY_CONNECTIONS"; - break; - case VGAUTH_E_UNSUPPORTED: - vgAuthErrorMsg = "VGAUTH_E_UNSUPPORTED"; - break; - default: - vgAuthErrorMsg = "Unknown"; - } - } - CAF_CM_EXIT; - - return vgAuthErrorMsg; -} - -uint32 CVgAuthError::getErrorCode( - const VGAuthError& vgAuthError) { - - uint32 vgAuthErrorCode; - - CAF_CM_ENTER { - switch(vgAuthError) { - case VGAUTH_E_OK: - case VGAUTH_E_FAIL: - case VGAUTH_E_INVALID_ARGUMENT: - case VGAUTH_E_INVALID_CERTIFICATE: - case VGAUTH_E_PERMISSION_DENIED: - case VGAUTH_E_OUT_OF_MEMORY: - case VGAUTH_E_COMM: - case VGAUTH_E_NOTIMPLEMENTED: - case VGAUTH_E_NOT_CONNECTED: - case VGAUTH_E_VERSION_MISMATCH: - case VGAUTH_E_SECURITY_VIOLATION: - case VGAUTH_E_CERT_ALREADY_EXISTS: - case VGAUTH_E_AUTHENTICATION_DENIED: - case VGAUTH_E_INVALID_TICKET: - case VGAUTH_E_MULTIPLE_MAPPINGS: - case VGAUTH_E_ALREADY_IMPERSONATING: - case VGAUTH_E_NO_SUCH_USER: - case VGAUTH_E_SERVICE_NOT_RUNNING: - case VGAUTH_E_TOO_MANY_CONNECTIONS: - case VGAUTH_E_UNSUPPORTED: - vgAuthErrorCode = VGAUTH_ERROR_CODE(vgAuthError); - break; - case VGAUTH_E_SYSTEM_ERRNO: - case VGAUTH_E_SYSTEM_WINDOWS: - vgAuthErrorCode = VGAUTH_ERROR_EXTRA_ERROR(vgAuthError); - break; - default: - vgAuthErrorCode = E_UNEXPECTED; - } - } - CAF_CM_EXIT; - - return vgAuthErrorCode; -} diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/VgAuth/src/CVgAuthError.h b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/VgAuth/src/CVgAuthError.h deleted file mode 100644 index 1ccadd8cf..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/VgAuth/src/CVgAuthError.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Author: bwilliams - * Created: Jan 21, 2011 - * - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CVgAuthError_H_ -#define CVgAuthError_H_ - -namespace Caf { - -class CVgAuthError { -public: - static void checkErrorExc( - const VGAuthError& vgAuthError, - const std::string& msg); - - static void checkErrorExc( - const VGAuthError& vgAuthError, - const std::string& msg, - const std::string& addtlInfo); - - static void checkErrorErr( - const VGAuthError& vgAuthError, - const std::string& msg); - - static void checkErrorErr( - const VGAuthError& vgAuthError, - const std::string& msg, - const std::string& addtlInfo); - - static std::string getErrorMsg( - const VGAuthError& vgAuthError); - - static uint32 getErrorCode( - const VGAuthError& vgAuthError); - -private: - CAF_CM_DECLARE_NOCREATE(CVgAuthError); -}; - -} - -#endif /* CVgAuthError_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/VgAuth/src/CVgAuthImpersonation.cpp b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/VgAuth/src/CVgAuthImpersonation.cpp deleted file mode 100644 index 11fdc8b63..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/VgAuth/src/CVgAuthImpersonation.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Author: bwilliams - * Created: Aug 16, 2012 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "CVgAuthContext.h" -#include "CVgAuthUserHandle.h" -#include "CVgAuthImpersonation.h" - -CVgAuthImpersonation::CVgAuthImpersonation() : - _isInitialized(false), - CAF_CM_INIT_LOG("CVgAuthImpersonation") { -} - -CVgAuthImpersonation::~CVgAuthImpersonation() { - CAF_CM_FUNCNAME("~CVgAuthImpersonation"); - - try { - if (_isInitialized) { - endImpersonation(_vgAuthContext); - } - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_CLEAREXCEPTION; -} - -void CVgAuthImpersonation::impersonateAndManage( - const SmartPtrCVgAuthContext& vgAuthContext, - const SmartPtrCVgAuthUserHandle& vgAuthUserHandle) { - CAF_CM_FUNCNAME_VALIDATE("impersonateAndManage"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_SMARTPTR(vgAuthContext); - CAF_CM_VALIDATE_SMARTPTR(vgAuthUserHandle); - - beginImpersonation(vgAuthContext, vgAuthUserHandle); - - _vgAuthContext = vgAuthContext; - _isInitialized = true; - } - CAF_CM_EXIT; -} - -void CVgAuthImpersonation::beginImpersonation( - const SmartPtrCVgAuthContext& vgAuthContext, - const SmartPtrCVgAuthUserHandle& vgAuthUserHandle) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CVgAuthImpersonation", "beginImpersonation"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(vgAuthContext); - CAF_CM_VALIDATE_SMARTPTR(vgAuthUserHandle); - - const std::string userName = vgAuthUserHandle->getUserName(vgAuthContext); - CAF_CM_LOG_DEBUG_VA1("Beginning impersonation - %s", userName.c_str()); - - const VGAuthError vgAuthError = VGAuth_Impersonate( - vgAuthContext->getPtr(), vgAuthUserHandle->getPtr(), 0, NULL); - CVgAuthError::checkErrorExc(vgAuthError, "VGAuth_Impersonate Failed"); - } - CAF_CM_EXIT; -} - -void CVgAuthImpersonation::endImpersonation( - const SmartPtrCVgAuthContext& vgAuthContext) { - CAF_CM_STATIC_FUNC_LOG_VALIDATE("CVgAuthImpersonation", "endImpersonation"); - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(vgAuthContext); - - CAF_CM_LOG_DEBUG_VA0("Ending impersonation"); - - const VGAuthError vgAuthError = VGAuth_EndImpersonation(vgAuthContext->getPtr()); - CVgAuthError::checkErrorExc(vgAuthError, "VGAuth_EndImpersonation Failed"); - } - CAF_CM_EXIT; -} diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/VgAuth/src/CVgAuthInitializer.cpp b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/VgAuth/src/CVgAuthInitializer.cpp deleted file mode 100644 index 9ec81d6d4..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/VgAuth/src/CVgAuthInitializer.cpp +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Author: bwilliams - * Created: Aug 16, 2012 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "CVgAuthContext.h" -#include "CVgAuthInitializer.h" -#include "CVgAuthImpersonation.h" - -CVgAuthInitializer::CVgAuthInitializer() : - _isInitialized(false), - CAF_CM_INIT_LOG("CVgAuthInitializer") { -} - -CVgAuthInitializer::~CVgAuthInitializer() { -} - -void CVgAuthInitializer::initialize( - const std::string& applicationName) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_STRING(applicationName); - - VGAuth_SetLogHandler(logHandler, NULL, 0, NULL); - - _vgAuthContext.CreateInstance(); - _vgAuthContext->initialize(applicationName); - - _isInitialized = true; - } - CAF_CM_EXIT; -} - -SmartPtrCVgAuthContext CVgAuthInitializer::getContext() const { - CAF_CM_FUNCNAME_VALIDATE("initializeThirdParty"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _vgAuthContext; -} - -void CVgAuthInitializer::installClient() const { - CAF_CM_FUNCNAME_VALIDATE("installClient"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - const VGAuthError vgAuthError = VGAuth_InstallClient(_vgAuthContext->getPtr(), 0, NULL); - CVgAuthError::checkErrorExc(vgAuthError, "VGAuth_InstallClient Failed", _vgAuthContext->getApplicationName()); - } - CAF_CM_EXIT; -} - -void CVgAuthInitializer::uninstallClient() const { - CAF_CM_FUNCNAME_VALIDATE("uninstallClient"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - const VGAuthError vgAuthError = VGAuth_UninstallClient(_vgAuthContext->getPtr(), 0, NULL); - CVgAuthError::checkErrorExc(vgAuthError, "VGAuth_UninstallClient Failed", _vgAuthContext->getApplicationName()); - } - CAF_CM_EXIT; -} - -void CVgAuthInitializer::endImpersonation() { - CAF_CM_FUNCNAME_VALIDATE("endImpersonation"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - CVgAuthImpersonation::endImpersonation(_vgAuthContext); - } - CAF_CM_EXIT; -} - -void CVgAuthInitializer::logHandler( - const char *logDomain, - int32 logLevel, - const char *msg, - void *userData) { - CAF_CM_STATIC_FUNC_LOG_ONLY("CVgAuthInitializer", "logHandler"); - - CAF_CM_ENTER { - switch (logLevel & G_LOG_LEVEL_MASK) { - case G_LOG_LEVEL_ERROR: - CAF_CM_LOG_ERROR_VA2("[ERROR][%s] %s", logDomain ? logDomain : "", msg); - break; - - case G_LOG_LEVEL_CRITICAL: - CAF_CM_LOG_ERROR_VA2("[CRITICAL][%s] %s", logDomain ? logDomain : "", msg); - break; - - case G_LOG_LEVEL_WARNING: - CAF_CM_LOG_WARN_VA2("[WARNING][%s] %s", logDomain ? logDomain : "", msg); - break; - - case G_LOG_LEVEL_INFO: - CAF_CM_LOG_INFO_VA2("[INFO][%s] %s", logDomain ? logDomain : "", msg); - break; - - case G_LOG_LEVEL_MESSAGE: - CAF_CM_LOG_DEBUG_VA2("[MESSAGE][%s] %s", logDomain ? logDomain : "", msg); - break; - - case G_LOG_LEVEL_DEBUG: - CAF_CM_LOG_DEBUG_VA2("[DEBUG][%s] %s", logDomain ? logDomain : "", msg); - break; - - default: - CAF_CM_LOG_WARN_VA2("[default][%s] %s", logDomain ? logDomain : "", msg); - } - } - CAF_CM_EXIT; -} diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/VgAuth/src/CVgAuthInitializer.h b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/VgAuth/src/CVgAuthInitializer.h deleted file mode 100644 index 0973a9160..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/VgAuth/src/CVgAuthInitializer.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Author: bwilliams - * Created: Aug 16, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CVGAUTHINITIALIZER_H_ -#define CVGAUTHINITIALIZER_H_ - - -#include "IVgAuthImpersonation.h" - -#include "CVgAuthContext.h" - -namespace Caf { - -class CVgAuthInitializer : public IVgAuthImpersonation { -public: - CVgAuthInitializer(); - virtual ~CVgAuthInitializer(); - - CAF_BEGIN_QI() - CAF_QI_ENTRY(ICafObject) - CAF_QI_ENTRY(IVgAuthImpersonation) - CAF_END_QI() - -public: - void initialize( - const std::string& applicationName); - -public: - SmartPtrCVgAuthContext getContext() const; - void installClient() const; - void uninstallClient() const; - -public: // IVgAuthImpersonation - void endImpersonation(); - -private: - static void logHandler( - const char *logDomain, - int32 logLevel, - const char *msg, - void *userData); - -private: - bool _isInitialized; - SmartPtrCVgAuthContext _vgAuthContext; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CVgAuthInitializer); -}; - -CAF_DECLARE_SMART_QI_POINTER(CVgAuthInitializer); - -} - -#endif /* CVGAUTHINITIALIZER_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/VgAuth/src/CVgAuthUserHandle.cpp b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/VgAuth/src/CVgAuthUserHandle.cpp deleted file mode 100644 index 981721ffc..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/VgAuth/src/CVgAuthUserHandle.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Author: bwilliams - * Created: Aug 16, 2012 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "CVgAuthContext.h" -#include "CVgAuthUserHandle.h" - -CVgAuthUserHandle::CVgAuthUserHandle() : - _isInitialized(false), - _vgAuthUserHandle(NULL), - CAF_CM_INIT_LOG("CVgAuthUserHandle") { -} - -CVgAuthUserHandle::~CVgAuthUserHandle() { - CAF_CM_FUNCNAME("~CVgAuthUserHandle"); - - try { - if (_isInitialized) { - VGAuth_UserHandleFree(_vgAuthUserHandle); - } - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_CRIT_CAFEXCEPTION; - CAF_CM_CLEAREXCEPTION; -} - -void CVgAuthUserHandle::initialize( - const SmartPtrCVgAuthContext& vgAuthContext, - const std::string& signedSamlToken) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_SMARTPTR(vgAuthContext); - CAF_CM_VALIDATE_STRING(signedSamlToken); - - const VGAuthError vgAuthError = VGAuth_ValidateSamlBearerToken(vgAuthContext->getPtr(), - signedSamlToken.c_str(), NULL, 0, NULL, &_vgAuthUserHandle); - CVgAuthError::checkErrorExc(vgAuthError, "VGAuth_ValidateSamlBearerToken Failed"); - - _isInitialized = true; - } - CAF_CM_EXIT; -} - -void CVgAuthUserHandle::initialize( - const SmartPtrCVgAuthContext& vgAuthContext, - const std::string& signedSamlToken, - const std::string& userName) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - - CAF_CM_ENTER { - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_SMARTPTR(vgAuthContext); - CAF_CM_VALIDATE_STRING(signedSamlToken); - CAF_CM_VALIDATE_STRING(userName); - - const VGAuthError vgAuthError = VGAuth_ValidateSamlBearerToken(vgAuthContext->getPtr(), - signedSamlToken.c_str(), userName.c_str(), 0, NULL, &_vgAuthUserHandle); - CVgAuthError::checkErrorExc(vgAuthError, "VGAuth_ValidateSamlBearerToken Failed", userName); - - _isInitialized = true; - } - CAF_CM_EXIT; -} - -std::string CVgAuthUserHandle::getUserName( - const SmartPtrCVgAuthContext& vgAuthContext) const { - CAF_CM_FUNCNAME_VALIDATE("getUserName"); - - std::string userNameRc; - - CAF_CM_ENTER { - CAF_CM_VALIDATE_SMARTPTR(vgAuthContext); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - char* userName = NULL; - const VGAuthError vgAuthError = VGAuth_UserHandleUsername(vgAuthContext->getPtr(), - _vgAuthUserHandle, &userName); - CVgAuthError::checkErrorExc(vgAuthError, "VGAuth_UserHandleUsername Failed"); - CAF_CM_VALIDATE_PTR(userName); - - userNameRc = userName; - - VGAuth_FreeBuffer(userName); - } - CAF_CM_EXIT; - - return userNameRc; -} - -VGAuthUserHandle* CVgAuthUserHandle::getPtr() const { - CAF_CM_FUNCNAME_VALIDATE("getPtr"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _vgAuthUserHandle; -} diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/VgAuth/src/VgAuthIntegration.cpp b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/VgAuth/src/VgAuthIntegration.cpp deleted file mode 100644 index 99d7f8890..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/VgAuth/src/VgAuthIntegration.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -namespace Caf { - const char* _sObjIdGuestAuthenticatorInstance = "com.vmware.commonagent.maintegration.guestauthenticatorinstance"; - const char* _sObjIdGuestAuthenticator = "com.vmware.commonagent.maintegration.guestauthenticator"; -} - -using namespace Caf; - -CEcmSubSystemModule _Module; - -CAF_BEGIN_OBJECT_MAP(ObjectMap) -#ifndef __APPLE__ - CAF_OBJECT_ENTRY(CGuestAuthenticator) - CAF_OBJECT_ENTRY(CGuestAuthenticatorInstance) -#endif -CAF_END_OBJECT_MAP() - -CAF_DECLARE_SUBSYSTEM_EXPORTS() - -extern "C" BOOL APIENTRY DllMain(HINSTANCE hModule, uint32 dwReason, LPVOID) -{ - try { - if (DLL_PROCESS_ATTACH == dwReason) - { - // initialize the sub-system module - _Module.Init(ObjectMap, hModule); - } - else if (DLL_PROCESS_DETACH == dwReason) - { - // Terminate the sub-system module - _Module.Term(); - } - } catch (std::runtime_error) { - ::exit(2); - } catch (...) { - ::exit(2); - } - - return TRUE; -} diff --git a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/VgAuth/src/stdafx.h b/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/VgAuth/src/stdafx.h deleted file mode 100644 index e49afd9d4..000000000 --- a/open-vm-tools/common-agent/Cpp/ManagementAgent/Subsystems/VgAuth/src/stdafx.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Author: bwilliams - * Created: Oct 22, 2010 - * - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef stdafx_h_ -#define stdafx_h_ - -namespace Caf { - extern const char* _sObjIdGuestAuthenticatorInstance; - extern const char* _sObjIdGuestAuthenticator; -} - -#include -#include -#include - -#ifndef __APPLE__ -#include - -#include "CVgAuthError.h" -#include "CVgAuthInitializer.h" -#include "CGuestAuthenticatorInstance.h" -#include "CGuestAuthenticator.h" -#endif - -#endif // #ifndef stdafx_h_ diff --git a/open-vm-tools/common-agent/Cpp/ProviderFx/Makefile.am b/open-vm-tools/common-agent/Cpp/ProviderFx/Makefile.am deleted file mode 100644 index 23eab441a..000000000 --- a/open-vm-tools/common-agent/Cpp/ProviderFx/Makefile.am +++ /dev/null @@ -1,44 +0,0 @@ -################################################################################ -### Copyright (C) 2016 VMware, Inc. All rights reserved. -### -### This program is free software; you can redistribute it and/or modify -### it under the terms of version 2 of the GNU General Public License as -### published by the Free Software Foundation. -### -### 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -################################################################################ - -AUTOMAKE_OPTIONS = subdir-objects -caflibdir = @CAF_PME_LIB_DIR@ -caflib_LTLIBRARIES = -caflib_LTLIBRARIES += libProviderFx.la - -libProviderFx_la_SOURCES= -libProviderFx_la_SOURCES += ProviderFx/src/CProviderCdifFormatter.cpp -libProviderFx_la_SOURCES += ProviderFx/src/CProviderDocHelper.cpp -libProviderFx_la_SOURCES += ProviderFx/src/CProviderDriver.cpp -libProviderFx_la_SOURCES += ProviderFx/src/ProviderFx.cpp - -libProviderFx_la_CPPFLAGS = -libProviderFx_la_CPPFLAGS += @GLIB2_CPPFLAGS@ -libProviderFx_la_CPPFLAGS += @LOG4CPP_CPPFLAGS@ -libProviderFx_la_CPPFLAGS += @SSL_CPPFLAGS@ -libProviderFx_la_CPPFLAGS += @LIBRABBITMQ_CPPFLAGS@ - -libProviderFx_la_CPPFLAGS += -I$(top_srcdir)/common-agent/Cpp/Framework/Framework/include -libProviderFx_la_CPPFLAGS += -I$(top_srcdir)/common-agent/Cpp/ProviderFx/ProviderFx/include -libProviderFx_la_LIBADD = -libProviderFx_la_LIBADD += @GLIB2_LIBS@ -libProviderFx_la_LIBADD += @LOG4CPP_LIBS@ -libProviderFx_la_LIBADD += -ldl -libProviderFx_la_LIBADD += ../Framework/libFramework.la - -libProviderFx_la_LDFLAGS = -shared - diff --git a/open-vm-tools/common-agent/Cpp/ProviderFx/ProviderFx/include/CProviderDocHelper.h b/open-vm-tools/common-agent/Cpp/ProviderFx/ProviderFx/include/CProviderDocHelper.h deleted file mode 100644 index 4424bc10a..000000000 --- a/open-vm-tools/common-agent/Cpp/ProviderFx/ProviderFx/include/CProviderDocHelper.h +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Author: brets - * Created: Dec 3, 2015 - * - * Copyright (C) 2015-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CProviderDocHelper_H_ -#define CProviderDocHelper_H_ - - -#include "Doc/ProviderResultsDoc/CSchemaDoc.h" -#include "Doc/CafCoreTypesDoc/CafCoreTypesDocTypes.h" -#include "Doc/CafCoreTypesDoc/CafCoreTypesDocTypes.h" -#include "Doc/SchemaTypesDoc/CActionClassDoc.h" -#include "Doc/SchemaTypesDoc/CClassIdentifierDoc.h" -#include "Doc/SchemaTypesDoc/CClassInstancePropertyDoc.h" -#include "Doc/SchemaTypesDoc/CClassPropertyDoc.h" -#include "Doc/SchemaTypesDoc/CCollectMethodDoc.h" -#include "Doc/SchemaTypesDoc/CDataClassDoc.h" -#include "Doc/SchemaTypesDoc/CDataClassInstanceDoc.h" -#include "Doc/SchemaTypesDoc/CDataClassPropertyDoc.h" -#include "Doc/SchemaTypesDoc/CDataClassSubInstanceDoc.h" -#include "Doc/SchemaTypesDoc/CInstanceParameterDoc.h" -#include "Doc/SchemaTypesDoc/CMethodDoc.h" -#include "Doc/SchemaTypesDoc/CMethodParameterDoc.h" - -namespace Caf { - -class PROVIDERFX_LINKAGE CProviderDocHelper { - -public: - static SmartPtrCClassPropertyDoc createClassProperty( - const std::string name, - const PROPERTY_TYPE type, - const bool required = false, - const bool key = false, - const bool list = false); - - static SmartPtrCClassIdentifierDoc createClassIdentifier( - const std::string namespaceVal, - const std::string name, - const std::string version); - - static SmartPtrCClassInstancePropertyDoc createClassInstanceProperty( - const std::string name, - const SmartPtrCClassIdentifierDoc type, - const bool required = false, - const bool transientVal = false, - const bool list = false); - - static SmartPtrCDataClassDoc createDataClass( - const std::string namespaceVal, - const std::string name, - const std::string version, - const std::deque properties, - const std::deque instanceProperties = std::deque()); - - static SmartPtrCMethodParameterDoc createMethodParameter( - const std::string name, - const PARAMETER_TYPE type, - const bool isOptional = false, - const bool isList = false); - - static SmartPtrCInstanceParameterDoc createInstanceParameter( - const std::string name, - const std::string instanceNamespace, - const std::string instanceName, - const std::string instanceVersion, - const bool isOptional = false, - const bool isList = false); - - static SmartPtrCCollectMethodDoc createCollectMethod( - const std::string name, - const std::deque parameters = std::deque(), - const std::deque instanceParameters = std::deque()); - - static SmartPtrCMethodDoc createMethod( - const std::string name, - const std::deque parameters = std::deque(), - const std::deque instanceParameters = std::deque()); - - static SmartPtrCActionClassDoc createActionClass( - const std::string namespaceVal, - const std::string name, - const std::string version, - const SmartPtrCCollectMethodDoc collectMethod, - const std::deque methodCollection); - - static SmartPtrCSchemaDoc createSchema( - const std::deque dataClasses, - const std::deque actionClasses); - - static SmartPtrCDataClassPropertyDoc createDataClassProperty( - const std::string name, - const std::string value); - - static SmartPtrCDataClassSubInstanceDoc createDataClassSubInstance( - const std::string name, - const std::deque properties); - - static SmartPtrCDataClassInstanceDoc createDataClassInstance( - const std::string namespaceVal, - const std::string name, - const std::string version, - const std::deque properties, - const std::deque instanceProperties = std::deque()); - -private: - CProviderDocHelper(); - CAF_CM_DECLARE_NOCOPY(CProviderDocHelper); -}; - -} - -#endif /* CProviderDocHelper_H_ */ diff --git a/open-vm-tools/common-agent/Cpp/ProviderFx/ProviderFx/include/CProviderDriver.h b/open-vm-tools/common-agent/Cpp/ProviderFx/ProviderFx/include/CProviderDriver.h deleted file mode 100644 index 542c5875a..000000000 --- a/open-vm-tools/common-agent/Cpp/ProviderFx/ProviderFx/include/CProviderDriver.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Author: bwilliams - * Created: May 3, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CProviderDriver_h_ -#define CProviderDriver_h_ - - -#include "Doc/ProviderRequestDoc/CProviderCollectInstancesDoc.h" -#include "Doc/ProviderRequestDoc/CProviderInvokeOperationDoc.h" -#include "Doc/ProviderRequestDoc/CProviderRequestDoc.h" -#include "Doc/ProviderResultsDoc/CRequestIdentifierDoc.h" -#include "Doc/ProviderResultsDoc/CSchemaDoc.h" -#include "Doc/SchemaTypesDoc/CActionClassDoc.h" - -namespace Caf { - -struct IInvokedProvider; // Forward declaration - -/// Sends responses/errors back to the client. -class PROVIDERFX_LINKAGE CProviderDriver { -private: - CProviderDriver(IInvokedProvider& provider); - virtual ~CProviderDriver(); - -public: - static int processProviderCommandline(IInvokedProvider& provider, int argc, char* argv[]); - -private: - int processProviderCommandline(int argc, char* argv[]); - - void collectSchema(const std::string& outputDir) const; - - void executeRequest(const std::string& requestPath) const; - - void executeCollectInstances( - const SmartPtrCProviderRequestDoc request, - const SmartPtrCProviderCollectInstancesDoc doc) const; - - void executeInvokeOperation( - const SmartPtrCProviderRequestDoc request, - const SmartPtrCProviderInvokeOperationDoc doc) const; - - SmartPtrCRequestIdentifierDoc createRequestId( - const SmartPtrCProviderRequestDoc request, - const SmartPtrCActionClassDoc actionClass, - const UUID jobId) const; - - SmartPtrCActionClassDoc findActionClass( - const std::string srchClassNamespace, - const std::string srchClassName, - const std::string srchClassVersion, - const std::string srchOperationName) const; - - void saveProviderResponse( - const std::string attachmentFilePath) const; - -private: - IInvokedProvider& _provider; - const SmartPtrCSchemaDoc _schema; - const std::string _providerNamespace; - const std::string _providerName; - const std::string _providerVersion; - std::vector _commandLineArgs; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CProviderDriver); -}; - -} - -#endif // #ifndef CProviderDriver_h_ diff --git a/open-vm-tools/common-agent/Cpp/ProviderFx/ProviderFx/include/IInvokedProvider.h b/open-vm-tools/common-agent/Cpp/ProviderFx/ProviderFx/include/IInvokedProvider.h deleted file mode 100644 index c895b147e..000000000 --- a/open-vm-tools/common-agent/Cpp/ProviderFx/ProviderFx/include/IInvokedProvider.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Author: brets - * Created: October 28, 2015 - * - * Copyright (C) 2015-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef _ProviderContracts_IInvokedProvider_H_ -#define _ProviderContracts_IInvokedProvider_H_ - - -#include "Doc/ProviderResultsDoc/CSchemaDoc.h" - -namespace Caf { - -struct IProviderRequest; // Forward declaration -struct IProviderResponse; // Forward declaration - -struct __declspec(novtable) IInvokedProvider { - - virtual const std::string getProviderNamespace() const = 0; - virtual const std::string getProviderName() const = 0; - virtual const std::string getProviderVersion() const = 0; - - virtual const SmartPtrCSchemaDoc getSchema() const = 0; - - virtual void collect(const IProviderRequest& request, IProviderResponse& response) const = 0; - - virtual void invoke(const IProviderRequest& request, IProviderResponse& response) const = 0; -}; - -//CAF_DECLARE_SMART_INTERFACE_POINTER(IInvokedProvider); - -} - -#endif // #ifndef _ProviderContracts_IInvokedProvider_H_ diff --git a/open-vm-tools/common-agent/Cpp/ProviderFx/ProviderFx/include/IProviderRequest.h b/open-vm-tools/common-agent/Cpp/ProviderFx/ProviderFx/include/IProviderRequest.h deleted file mode 100644 index bbf9e75ba..000000000 --- a/open-vm-tools/common-agent/Cpp/ProviderFx/ProviderFx/include/IProviderRequest.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Author: brets - * Created: October 28, 2015 - * - * Copyright (C) 2015-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef _ProviderContracts_IProviderRequest_H_ -#define _ProviderContracts_IProviderRequest_H_ - - -#include "Doc/CafCoreTypesDoc/CAttachmentCollectionDoc.h" -#include "Doc/ProviderRequestDoc/CProviderCollectInstancesDoc.h" -#include "Doc/ProviderRequestDoc/CProviderInvokeOperationDoc.h" - -namespace Caf { - -struct __declspec(novtable) IProviderRequest { - - virtual const UUID getClientId() const = 0; - - virtual const UUID getRequestId() const = 0; - - virtual const std::string getPmeId() const = 0; - - virtual const std::vector getCommandLine() const = 0; - - virtual const SmartPtrCAttachmentCollectionDoc getAttachments() const = 0; - - virtual const SmartPtrCProviderCollectInstancesDoc getCollectInstances() const = 0; - - virtual const SmartPtrCProviderInvokeOperationDoc getInvokeOperations() const = 0; -}; - -//CAF_DECLARE_SMART_INTERFACE_POINTER(IProviderRequest); - -} - -#endif // #ifndef _ProviderContracts_IProviderRequest_H_ diff --git a/open-vm-tools/common-agent/Cpp/ProviderFx/ProviderFx/include/IProviderResponse.h b/open-vm-tools/common-agent/Cpp/ProviderFx/ProviderFx/include/IProviderResponse.h deleted file mode 100644 index 83c60a5b2..000000000 --- a/open-vm-tools/common-agent/Cpp/ProviderFx/ProviderFx/include/IProviderResponse.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Author: brets - * Created: October 28, 2015 - * - * Copyright (C) 2015-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef _ProviderContracts_IProviderResponse_H_ -#define _ProviderContracts_IProviderResponse_H_ - - -#include "Doc/CafCoreTypesDoc/CAttachmentDoc.h" -#include "Doc/SchemaTypesDoc/CDataClassInstanceDoc.h" - -namespace Caf { - -struct __declspec(novtable) IProviderResponse { - - virtual void addInstance(const SmartPtrCDataClassInstanceDoc instance) = 0; - - virtual void addAttachment(const SmartPtrCAttachmentDoc attachment) = 0; -}; - -//CAF_DECLARE_SMART_INTERFACE_POINTER(IProviderResponse); - -} - -#endif // #ifndef _ProviderContracts_IProviderResponse_H_ diff --git a/open-vm-tools/common-agent/Cpp/ProviderFx/ProviderFx/include/ProviderFxLink.h b/open-vm-tools/common-agent/Cpp/ProviderFx/ProviderFx/include/ProviderFxLink.h deleted file mode 100644 index a3c9e3e2b..000000000 --- a/open-vm-tools/common-agent/Cpp/ProviderFx/ProviderFx/include/ProviderFxLink.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Author: brets - * Created: October 28, 2015 - * - * Copyright (C) 2015-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef PROVIDERFXLINK_H_ -#define PROVIDERFXLINK_H_ - -#ifndef PROVIDERFX_LINKAGE - #ifdef WIN32 - #ifdef PROVIDERFX_BUILD - #define PROVIDERFX_LINKAGE __declspec(dllexport) - #else - #define PROVIDERFX_LINKAGE __declspec(dllimport) - #endif - #else - #define PROVIDERFX_LINKAGE - #endif -#endif - -#include "CProviderDriver.h" -#include "CProviderDocHelper.h" - -#endif // #ifndef PROVIDERFXLINK_H_ diff --git a/open-vm-tools/common-agent/Cpp/ProviderFx/ProviderFx/src/CProviderCdifFormatter.cpp b/open-vm-tools/common-agent/Cpp/ProviderFx/ProviderFx/src/CProviderCdifFormatter.cpp deleted file mode 100644 index 1697222cc..000000000 --- a/open-vm-tools/common-agent/Cpp/ProviderFx/ProviderFx/src/CProviderCdifFormatter.cpp +++ /dev/null @@ -1,223 +0,0 @@ -/* - * Author: bwilliams - * Created: May 3, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Doc/DocXml/ProviderResultsXml/ProviderResultsXmlRoots.h" -#include "Doc/DocXml/ResponseXml/ResponseXmlRoots.h" - -#include "Doc/DocUtils/EnumConvertersXml.h" - -#include "Doc/CafCoreTypesDoc/CAttachmentCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CAttachmentDoc.h" -#include "Doc/CafCoreTypesDoc/CAttachmentNameCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CInlineAttachmentDoc.h" -#include "Doc/ProviderResultsDoc/CCdifDoc.h" -#include "Doc/ProviderResultsDoc/CDefinitionObjectCollectionDoc.h" -#include "Doc/ProviderResultsDoc/CRequestIdentifierDoc.h" -#include "Doc/ProviderResultsDoc/CSchemaDoc.h" -#include "Doc/ResponseDoc/CManifestDoc.h" -#include "Doc/ResponseDoc/CProviderResponseDoc.h" -#include "Doc/ResponseDoc/CResponseHeaderDoc.h" -#include "Doc/SchemaTypesDoc/CActionClassDoc.h" -#include "Doc/SchemaTypesDoc/CCollectMethodDoc.h" -#include "Doc/SchemaTypesDoc/CDataClassInstanceDoc.h" -#include "Doc/SchemaTypesDoc/CMethodDoc.h" -#include "CProviderCdifFormatter.h" -#include "Doc/DocXml/ProviderResultsXml/ProviderResultsXmlLink.h" -#include "Doc/DocXml/ResponseXml/ResponseXmlLink.h" -#include "../../Framework/src/Doc/DocUtils/DocUtilsLink.h" - -using namespace Caf; - -CProviderCdifFormatter::CProviderCdifFormatter() : - _isInitialized(false), - CAF_CM_INIT_LOG("CProviderCdifFormatter") { -} - -CProviderCdifFormatter::~CProviderCdifFormatter() { -} - -void CProviderCdifFormatter::initialize( - const SmartPtrCRequestIdentifierDoc requestIdentifier, - const SmartPtrCSchemaDoc schema, - const std::string outputFilePath) { - CAF_CM_FUNCNAME_VALIDATE("initialize"); - CAF_CM_PRECOND_ISNOTINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_SMARTPTR(requestIdentifier); - CAF_CM_VALIDATE_SMARTPTR(schema); - CAF_CM_VALIDATE_STRING(outputFilePath); - - _requestIdentifier = requestIdentifier; - _schema = schema; - _outputFilePath = outputFilePath; - - _isInitialized = true; -} - -void CProviderCdifFormatter::finished() { - CAF_CM_FUNCNAME_VALIDATE("finished"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - SmartPtrCDefinitionObjectCollectionDoc definitionObjectCollection; - if (!_defnObjCollection.empty()) { - definitionObjectCollection.CreateInstance(); - definitionObjectCollection->initialize(_defnObjCollection); - } - - SmartPtrCCdifDoc cdifDoc; - cdifDoc.CreateInstance(); - cdifDoc->initialize(_requestIdentifier, definitionObjectCollection, _schema); - - const std::string cdifXml = XmlRoots::saveCdifToString(cdifDoc); - - CAF_CM_LOG_DEBUG_VA1("Writing CDIF to file - %s", _outputFilePath.c_str()); - FileSystemUtils::saveTextFile(_outputFilePath, cdifXml); - - saveProviderResponse(); -} - -void CProviderCdifFormatter::addInstance( - const SmartPtrCDataClassInstanceDoc dataClassInstance) { - CAF_CM_FUNCNAME_VALIDATE("format"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_SMARTPTR(dataClassInstance); - - const std::string defnObjXml = DefnObjectConverter::toString(dataClassInstance); - _defnObjCollection.push_back(defnObjXml); -} - -std::string CProviderCdifFormatter::getOutputFilePath() const { - CAF_CM_FUNCNAME_VALIDATE("getOutputFilePath"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - return _outputFilePath; -} - -void CProviderCdifFormatter::addAttachment(const SmartPtrCAttachmentDoc attachment) { - CAF_CM_FUNCNAME_VALIDATE("addAttachment"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - CAF_CM_VALIDATE_SMARTPTR(attachment); - - _attachmentCollectionInner.push_back(attachment); -} - -void CProviderCdifFormatter::saveProviderResponse() { - CAF_CM_FUNCNAME_VALIDATE("saveProviderResponse"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - const SmartPtrCAttachmentDoc attachment = createAttachment(); - _attachmentCollectionInner.push_back(attachment); - - const SmartPtrCAttachmentCollectionDoc attachmentCollection = - createAttachmentCollection(); - - const SmartPtrCAttachmentNameCollectionDoc attachmentNameCollection = - createAttachmentNameCollection(); - - std::string classNamespace; - std::string className; - std::string classVersion; - std::string operationName; - const SmartPtrCActionClassDoc actionClass = _requestIdentifier->getActionClass(); - if (!actionClass.IsNull()) { - classNamespace = actionClass->getNamespaceVal(); - className = actionClass->getName(); - classVersion = actionClass->getVersion(); - - const SmartPtrCCollectMethodDoc collectMethod = actionClass->getCollectMethod(); - const std::deque methodCollection = - actionClass->getMethodCollection(); - if (!collectMethod.IsNull()) { - operationName = collectMethod->getName(); - } else if (!methodCollection.empty()) { - const SmartPtrCMethodDoc method = methodCollection.front(); - operationName = method->getName(); - } - } - - SmartPtrCManifestDoc manifest; - manifest.CreateInstance(); - manifest->initialize(classNamespace, className, classVersion, - _requestIdentifier->getJobId(), operationName, attachmentNameCollection); - - SmartPtrCResponseHeaderDoc responseHeader; - responseHeader.CreateInstance(); - responseHeader->initialize( - "1.0", - CDateTimeUtils::getCurrentDateTime(), - 0, - true, - _requestIdentifier->getSessionId()); - - SmartPtrCProviderResponseDoc providerResponse; - providerResponse.CreateInstance(); - providerResponse->initialize(_requestIdentifier->getClientId(), - _requestIdentifier->getRequestId(), _requestIdentifier->getPmeId(), - responseHeader, manifest, attachmentCollection, - SmartPtrCStatisticsDoc()); - - const std::string attachmentDirPath = FileSystemUtils::getDirname(_outputFilePath); - const std::string providerResponseStr = XmlRoots::saveProviderResponseToString(providerResponse); - const std::string providerResponsePath = FileSystemUtils::buildPath( - attachmentDirPath, _sProviderResponseFilename); - FileSystemUtils::saveTextFile(providerResponsePath, providerResponseStr); - CAF_CM_LOG_DEBUG_VA1("Saved provider response file - %s", providerResponsePath.c_str()); -} - -SmartPtrCAttachmentDoc CProviderCdifFormatter::createAttachment() const { - CAF_CM_FUNCNAME_VALIDATE("createAttachment"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - const std::string attachmentFileName = FileSystemUtils::getBasename(_outputFilePath); - const std::string jobIdStr = BasePlatform::UuidToString(_requestIdentifier->getJobId()); - const std::string attachmentName = jobIdStr + "." + attachmentFileName; - const std::string cdifAttachmentFilePathTmp = - FileSystemUtils::normalizePathWithForward(_outputFilePath); - - const std::string cmsPolicyStr = AppConfigUtils::getRequiredString( - "security", "cms_policy");; - - SmartPtrCAttachmentDoc attachment; - attachment.CreateInstance(); - attachment->initialize(attachmentName, "cdif", - "file:///" + cdifAttachmentFilePathTmp, false, - EnumConvertersXml::convertStringToCmsPolicy(cmsPolicyStr)); - - return attachment; -} - -SmartPtrCAttachmentCollectionDoc CProviderCdifFormatter::createAttachmentCollection() const { - CAF_CM_FUNCNAME_VALIDATE("createAttachmentCollection"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - SmartPtrCAttachmentCollectionDoc attachmentCollection; - attachmentCollection.CreateInstance(); - attachmentCollection->initialize(_attachmentCollectionInner, - std::deque()); - - return attachmentCollection; -} - -SmartPtrCAttachmentNameCollectionDoc CProviderCdifFormatter::createAttachmentNameCollection() const { - CAF_CM_FUNCNAME_VALIDATE("createAttachmentNameCollection"); - CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); - - std::deque attachmentNameCollectionInner; - for (TConstIterator > attachmentIter( - _attachmentCollectionInner); attachmentIter; attachmentIter++) { - const SmartPtrCAttachmentDoc attachment = *attachmentIter; - - attachmentNameCollectionInner.push_back(attachment->getName()); - } - - SmartPtrCAttachmentNameCollectionDoc attachmentNameCollection; - attachmentNameCollection.CreateInstance(); - attachmentNameCollection->initialize(attachmentNameCollectionInner); - - return attachmentNameCollection; -} diff --git a/open-vm-tools/common-agent/Cpp/ProviderFx/ProviderFx/src/CProviderCdifFormatter.h b/open-vm-tools/common-agent/Cpp/ProviderFx/ProviderFx/src/CProviderCdifFormatter.h deleted file mode 100644 index 86197f23b..000000000 --- a/open-vm-tools/common-agent/Cpp/ProviderFx/ProviderFx/src/CProviderCdifFormatter.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Author: bwilliams - * Created: May 3, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CProviderCdifFormatter_h_ -#define CProviderCdifFormatter_h_ - -#include "IProviderResponse.h" -#include "Doc/CafCoreTypesDoc/CAttachmentCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CAttachmentDoc.h" -#include "Doc/CafCoreTypesDoc/CAttachmentNameCollectionDoc.h" -#include "Doc/ProviderResultsDoc/CRequestIdentifierDoc.h" -#include "Doc/ProviderResultsDoc/CSchemaDoc.h" -#include "Doc/SchemaTypesDoc/CDataClassInstanceDoc.h" - -namespace Caf { - -/// Sends responses/errors back to the client. -class CProviderCdifFormatter : public IProviderResponse { -public: - CProviderCdifFormatter(); - virtual ~CProviderCdifFormatter(); - -public: - void initialize( - const SmartPtrCRequestIdentifierDoc requestIdentifier, - const SmartPtrCSchemaDoc schema, - const std::string outputFilePath); - - void finished(); - - std::string getOutputFilePath() const; - -public: // IProviderResponse - void addInstance(const SmartPtrCDataClassInstanceDoc instance); - - void addAttachment(const SmartPtrCAttachmentDoc attachment); - -private: - void saveProviderResponse(); - - SmartPtrCAttachmentDoc createAttachment() const; - - SmartPtrCAttachmentCollectionDoc createAttachmentCollection() const; - - SmartPtrCAttachmentNameCollectionDoc createAttachmentNameCollection() const; - -private: - bool _isInitialized; - - SmartPtrCRequestIdentifierDoc _requestIdentifier; - SmartPtrCSchemaDoc _schema; - std::string _outputFilePath; - - std::deque _defnObjCollection; - std::deque _attachmentCollectionInner; - -private: - CAF_CM_CREATE; - CAF_CM_CREATE_LOG; - CAF_CM_DECLARE_NOCOPY(CProviderCdifFormatter); -}; - -} - -#endif // #ifndef CProviderCdifFormatter_h_ diff --git a/open-vm-tools/common-agent/Cpp/ProviderFx/ProviderFx/src/CProviderDocHelper.cpp b/open-vm-tools/common-agent/Cpp/ProviderFx/ProviderFx/src/CProviderDocHelper.cpp deleted file mode 100644 index 97312d81f..000000000 --- a/open-vm-tools/common-agent/Cpp/ProviderFx/ProviderFx/src/CProviderDocHelper.cpp +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Author: brets - * Created: Dec 3, 2015 - * - * Copyright (C) 2015-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" -#include "Doc/CafCoreTypesDoc/CafCoreTypesDocTypes.h" -#include "Doc/CafCoreTypesDoc/CafCoreTypesDocTypes.h" - -#include "Doc/ProviderResultsDoc/CSchemaDoc.h" -#include "Doc/SchemaTypesDoc/CActionClassDoc.h" -#include "Doc/SchemaTypesDoc/CClassIdentifierDoc.h" -#include "Doc/SchemaTypesDoc/CClassInstancePropertyDoc.h" -#include "Doc/SchemaTypesDoc/CClassPropertyDoc.h" -#include "Doc/SchemaTypesDoc/CCmdlMetadataDoc.h" -#include "Doc/SchemaTypesDoc/CCollectMethodDoc.h" -#include "Doc/SchemaTypesDoc/CDataClassDoc.h" -#include "Doc/SchemaTypesDoc/CDataClassInstanceDoc.h" -#include "Doc/SchemaTypesDoc/CDataClassPropertyDoc.h" -#include "Doc/SchemaTypesDoc/CDataClassSubInstanceDoc.h" -#include "Doc/SchemaTypesDoc/CInstanceParameterDoc.h" -#include "Doc/SchemaTypesDoc/CMethodDoc.h" -#include "Doc/SchemaTypesDoc/CMethodParameterDoc.h" -#include "../include/CProviderDocHelper.h" - -using namespace Caf; - -SmartPtrCClassPropertyDoc CProviderDocHelper::createClassProperty( - const std::string name, - const PROPERTY_TYPE type, - const bool required, - const bool key, - const bool list) { - - SmartPtrCClassPropertyDoc doc; - doc.CreateInstance(); - doc->initialize(name, type, std::deque(), required, key, list); - return doc; -} - -SmartPtrCClassIdentifierDoc CProviderDocHelper::createClassIdentifier( - const std::string namespaceVal, - const std::string name, - const std::string version) { - SmartPtrCClassIdentifierDoc doc; - doc.CreateInstance(); - doc->initialize(namespaceVal, name, version); - return doc; -} - -SmartPtrCClassInstancePropertyDoc CProviderDocHelper::createClassInstanceProperty( - const std::string name, - const SmartPtrCClassIdentifierDoc type, - const bool required, - const bool transientVal, - const bool list) { - - std::deque types; - types.push_back(type); - - SmartPtrCClassInstancePropertyDoc doc; - doc.CreateInstance(); - doc->initialize(name, types, required, transientVal, list); - return doc; -} - -SmartPtrCDataClassDoc CProviderDocHelper::createDataClass( - const std::string namespaceVal, - const std::string name, - const std::string version, - const std::deque properties, - const std::deque instanceProperties) { - - SmartPtrCDataClassDoc doc; - doc.CreateInstance(); - doc->initialize(namespaceVal, name, version, properties, instanceProperties); - return doc; -} - -SmartPtrCMethodParameterDoc CProviderDocHelper::createMethodParameter( - const std::string name, - const PARAMETER_TYPE type, - const bool isOptional, - const bool isList) { - SmartPtrCMethodParameterDoc doc; - doc.CreateInstance(); - doc->initialize(name, type, isOptional, isList); - return doc; -} - -SmartPtrCCollectMethodDoc CProviderDocHelper::createCollectMethod( - const std::string name, - const std::deque parameters, - const std::deque instanceParameters) { - SmartPtrCCollectMethodDoc doc; - doc.CreateInstance(); - doc->initialize(name, parameters, instanceParameters); - return doc; -} - -SmartPtrCInstanceParameterDoc CProviderDocHelper::createInstanceParameter( - const std::string name, - const std::string instanceNamespace, - const std::string instanceName, - const std::string instanceVersion, - const bool isOptional, - const bool isList) { - SmartPtrCInstanceParameterDoc doc; - doc.CreateInstance(); - doc->initialize(name, instanceNamespace, instanceName, instanceVersion, isOptional, isList); - return doc; -} - -SmartPtrCMethodDoc CProviderDocHelper::createMethod( - const std::string name, - const std::deque parameters, - const std::deque instanceParameters) { - SmartPtrCMethodDoc doc; - doc.CreateInstance(); - doc->initialize(name, parameters, instanceParameters); - return doc; -} - -SmartPtrCActionClassDoc CProviderDocHelper::createActionClass( - const std::string namespaceVal, - const std::string name, - const std::string version, - const SmartPtrCCollectMethodDoc collectMethod, - const std::deque methodCollection) { - - SmartPtrCActionClassDoc doc; - doc.CreateInstance(); - doc->initialize(namespaceVal, name, version, collectMethod, methodCollection); - return doc; -} - -SmartPtrCSchemaDoc CProviderDocHelper::createSchema( - const std::deque dataClasses, - const std::deque actionClasses) { - SmartPtrCSchemaDoc doc; - doc.CreateInstance(); - doc->initialize(dataClasses, actionClasses); - return doc; -} - -SmartPtrCDataClassPropertyDoc CProviderDocHelper::createDataClassProperty( - const std::string name, - const std::string value) { - - SmartPtrCDataClassPropertyDoc doc; - doc.CreateInstance(); - doc->initialize(name, std::deque(), value); - return doc; -} - -SmartPtrCDataClassSubInstanceDoc CProviderDocHelper::createDataClassSubInstance( - const std::string name, - const std::deque properties) { - - SmartPtrCDataClassSubInstanceDoc doc; - doc.CreateInstance(); - doc->initialize( - name, - std::deque(), - properties, - std::deque(), - SmartPtrCCmdlUnionDoc()); - return doc; -} - -SmartPtrCDataClassInstanceDoc CProviderDocHelper::createDataClassInstance( - const std::string namespaceVal, - const std::string name, - const std::string version, - const std::deque properties, - const std::deque instanceProperties) { - - SmartPtrCDataClassInstanceDoc doc; - doc.CreateInstance(); - doc->initialize( - namespaceVal, - name, - version, - std::deque(), - properties, - instanceProperties, - SmartPtrCCmdlUnionDoc()); - return doc; -} diff --git a/open-vm-tools/common-agent/Cpp/ProviderFx/ProviderFx/src/CProviderDriver.cpp b/open-vm-tools/common-agent/Cpp/ProviderFx/ProviderFx/src/CProviderDriver.cpp deleted file mode 100644 index 63aefc4b1..000000000 --- a/open-vm-tools/common-agent/Cpp/ProviderFx/ProviderFx/src/CProviderDriver.cpp +++ /dev/null @@ -1,390 +0,0 @@ -/* - * Author: bwilliams - * Created: May 3, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -#include "Doc/DocXml/ProviderRequestXml/ProviderRequestXmlRoots.h" -#include "Doc/DocXml/ProviderResultsXml/ProviderResultsXmlRoots.h" -#include "Doc/DocXml/ResponseXml/ResponseXmlRoots.h" - -#include "Doc/DocUtils/EnumConvertersXml.h" - -#include "Doc/CafCoreTypesDoc/CAttachmentCollectionDoc.h" -#include "Doc/CafCoreTypesDoc/CAttachmentDoc.h" -#include "Doc/CafCoreTypesDoc/CInlineAttachmentDoc.h" -#include "Doc/ProviderRequestDoc/CProviderCollectInstancesCollectionDoc.h" -#include "Doc/ProviderRequestDoc/CProviderCollectInstancesDoc.h" -#include "Doc/ProviderRequestDoc/CProviderInvokeOperationCollectionDoc.h" -#include "Doc/ProviderRequestDoc/CProviderInvokeOperationDoc.h" -#include "Doc/ProviderRequestDoc/CProviderRequestDoc.h" -#include "Doc/ProviderResultsDoc/CRequestIdentifierDoc.h" -#include "Doc/ResponseDoc/CProviderResponseDoc.h" -#include "Doc/SchemaTypesDoc/CActionClassDoc.h" -#include "Doc/SchemaTypesDoc/CCollectMethodDoc.h" -#include "Doc/SchemaTypesDoc/CMethodDoc.h" -#include "Memory/DynamicArray/DynamicArrayInc.h" -#include "Exception/CCafException.h" -#include "Common/IAppConfig.h" -#include "CProviderDriver.h" -#include "CProviderCdifFormatter.h" -#include "CProviderRequest.h" -#include "IInvokedProvider.h" -#include "Integration/Caf/CCafMessagePayload.h" - -using namespace Caf; - -CProviderDriver::CProviderDriver(IInvokedProvider& provider) : - _provider(provider), - _schema(provider.getSchema()), - _providerNamespace(provider.getProviderNamespace()), - _providerName(provider.getProviderName()), - _providerVersion(provider.getProviderVersion()), - CAF_CM_INIT_LOG("CProviderDriver") { -} - -CProviderDriver::~CProviderDriver() { -} - -int CProviderDriver::processProviderCommandline(IInvokedProvider& provider, int argc, char* argv[]) { - SmartPtrIAppConfig appConfig; - try { - if (g_getenv("CAF_APPCONFIG") == NULL) { - Cdeqstr deqstr; - deqstr.push_back("cafenv-appconfig"); - deqstr.push_back("persistence-appconfig"); - deqstr.push_back("providerFx-appconfig"); - deqstr.push_back("custom-appconfig"); - appConfig = getAppConfig(deqstr); - } else { - appConfig = getAppConfig(); - } - } catch(CCafException *ex) { - std::cerr << "CProviderDriver::processProviderCommandline() failed to initialize AppConfig: " << ex->getFullMsg().c_str(); - ex->Release(); - return 1; - } catch (std::exception ex) { - std::cerr << "CProviderDriver::getAppConfig() failed to initialize AppConfig: " << ex.what(); - return 1; - } catch (...) { - std::cerr << "CProviderDriver::getAppConfig() failed to initialize AppConfig: unknown exception"; - return 1; - } - - // NOTE: Want to define parameters as constants - if (argc == 0) { - // Error - std::cerr << "Invalid command line: no options provided"; - return 1; - } - - CProviderDriver driver(provider); - return driver.processProviderCommandline(argc, argv); -} - -int CProviderDriver::processProviderCommandline(int argc, char* argv[]) { - CAF_CM_FUNCNAME("processProviderCommandline"); - - _commandLineArgs.clear(); - _commandLineArgs.reserve(argc); - for (int32 i = 0; i < argc; i++) { - _commandLineArgs.push_back(argv[i]); - } - - for (std::vector::const_iterator itr = _commandLineArgs.begin(); itr != _commandLineArgs.end(); itr++) { - if ((*itr).compare("--schema") == 0) { - itr++; - if (itr == _commandLineArgs.end()) { - std::cerr << "Invalid command line: no schema output directory provided"; - return 1; - } else if ((*itr).compare("-o") != 0) { - std::cerr << "Invalid command line: unexpected option: " << (*itr).c_str(); - return 1; - } - itr++; - if (itr == _commandLineArgs.end()) { - std::cerr << "Invalid command line: no schema output directory provided"; - return 1; - } - - std::string outputDir = *itr; - while (++itr != _commandLineArgs.end()) { - outputDir += " " + *itr; - } - - collectSchema(outputDir); - return 0; - - } else if ((*itr).compare("-r") == 0) { - itr++; - if (itr == _commandLineArgs.end()) { - std::cerr << "Invalid command line: no request location provided"; - return 1; - } - - std::string requestPath = *itr; - while (++itr != _commandLineArgs.end()) { - requestPath += " " + *itr; - } - - try { - executeRequest(requestPath); - return 0; - } - CAF_CM_CATCH_ALL; - CAF_CM_LOG_CRIT_CAFEXCEPTION; - std::cerr << "Error executing request: " << _cm_exception_->getFullMsg().c_str() << std::endl; - CAF_CM_CLEAREXCEPTION - return 1; - } - } - std::cerr << "Invalid command line: unknown options"; - return 1; -} - -void CProviderDriver::collectSchema(const std::string& outputDir) const { - CAF_CM_FUNCNAME_VALIDATE("collectSchema"); - CAF_CM_VALIDATE_STRING(outputDir); - - const std::string schemaStr = XmlRoots::saveSchemaToString(_schema); - const std::string schemaFilename = _providerName + "-collectSchema-Rnd.provider-data.xml"; - const std::string schemaPath = FileSystemUtils::buildPath(outputDir, schemaFilename); - FileSystemUtils::saveTextFile(schemaPath, schemaStr); - CAF_CM_LOG_DEBUG_VA1("Saved schema file - %s", schemaPath.c_str()); - - saveProviderResponse(schemaPath); -} - -void CProviderDriver::executeRequest(const std::string& requestPath) const { - CAF_CM_FUNCNAME("executeRequest"); - CAF_CM_VALIDATE_STRING(requestPath); - - // TODO: Verify file exists - SmartPtrCDynamicByteArray fileContents = CCafMessagePayload::createBufferFromFile(requestPath); - std::string providerRequestXml(reinterpret_cast(fileContents->getPtr())); - - const SmartPtrCProviderRequestDoc request = XmlRoots::parseProviderRequestFromString(providerRequestXml); - - bool isProviderCalled = false; - const SmartPtrCProviderCollectInstancesCollectionDoc collectInstancesCollection = request->getBatch()->getCollectInstancesCollection(); - if (! collectInstancesCollection.IsNull()) { - const std::deque instances = collectInstancesCollection->getCollectInstances(); - for(TConstIterator > iter(instances); iter; iter++) { - isProviderCalled = true; - executeCollectInstances(request, *iter); - } - } - - const SmartPtrCProviderInvokeOperationCollectionDoc invokeOperationCollection = request->getBatch()->getInvokeOperationCollection(); - if (! invokeOperationCollection.IsNull()) { - const std::deque operations = invokeOperationCollection->getInvokeOperation(); - for(TConstIterator > iter(operations); iter; iter++) { - isProviderCalled = true; - executeInvokeOperation(request, *iter); - } - } - - if (! isProviderCalled) { - CAF_CM_EXCEPTIONEX_VA3(NoSuchElementException, ERROR_NOT_FOUND, - "Did not call anything on the provider - %s::%s::%s", - _providerNamespace.c_str(), _providerName.c_str(), _providerVersion.c_str()); - } -} - -void CProviderDriver::executeCollectInstances( - const SmartPtrCProviderRequestDoc request, - const SmartPtrCProviderCollectInstancesDoc doc) const { - CAF_CM_FUNCNAME_VALIDATE("executeCollectInstances"); - CAF_CM_VALIDATE_SMARTPTR(request); - CAF_CM_VALIDATE_SMARTPTR(doc); - - const SmartPtrCActionClassDoc actionClass = findActionClass(doc->getClassNamespace(), - doc->getClassName(), doc->getClassVersion(), "collectInstances"); - - const SmartPtrCRequestIdentifierDoc requestId = createRequestId(request, actionClass, doc->getJobId()); - - const std::string outputFilename = _providerName + std::string("-collectInstances.provider-data.xml"); - const std::string outputFilePath = FileSystemUtils::buildPath(doc->getOutputDir(), outputFilename); - - CProviderCdifFormatter formatter; - CAF_CM_LOG_DEBUG_VA1("Initializing formatter with path - %s", outputFilePath.c_str()); - formatter.initialize(requestId, _schema, outputFilePath); - - CAF_CM_LOG_DEBUG_VA1("Calling collect on the provider - %s", _providerName.c_str()); - CProviderRequest providerRequest(request, _commandLineArgs); - providerRequest.setCollectInstances(doc); - _provider.collect(providerRequest, formatter); - formatter.finished(); -} - -void CProviderDriver::executeInvokeOperation( - const SmartPtrCProviderRequestDoc request, - const SmartPtrCProviderInvokeOperationDoc doc) const { - CAF_CM_FUNCNAME_VALIDATE("executeInvokeOperation"); - CAF_CM_VALIDATE_SMARTPTR(request); - CAF_CM_VALIDATE_SMARTPTR(doc); - - const SmartPtrCActionClassDoc actionClass = findActionClass(doc->getClassNamespace(), - doc->getClassName(), doc->getClassVersion(), doc->getOperation()->getName()); - - const SmartPtrCRequestIdentifierDoc requestId = createRequestId(request, actionClass, doc->getJobId()); - - const std::string outputFilename = _providerName + std::string("-invokeOperation.provider-data.xml"); - const std::string outputFilePath = FileSystemUtils::buildPath(doc->getOutputDir(), outputFilename); - - CProviderCdifFormatter formatter; - CAF_CM_LOG_DEBUG_VA1("Initializing formatter with path - %s", outputFilePath.c_str()); - formatter.initialize(requestId, _schema, outputFilePath); - - CAF_CM_LOG_DEBUG_VA1("Calling invoke on the provider - %s", _providerName.c_str()); - CProviderRequest providerRequest(request, _commandLineArgs); - providerRequest.setInvokeOperations(doc); - _provider.invoke(providerRequest, formatter); - formatter.finished(); -} - -SmartPtrCRequestIdentifierDoc CProviderDriver::createRequestId( - const SmartPtrCProviderRequestDoc request, - const SmartPtrCActionClassDoc actionClass, - const UUID jobId) const { - CAF_CM_FUNCNAME_VALIDATE("createRequestId"); - CAF_CM_VALIDATE_SMARTPTR(request); - CAF_CM_VALIDATE_SMARTPTR(actionClass); - CAF_CM_VALIDATE_GUID(jobId); - - SmartPtrCRequestIdentifierDoc requestIdentifier; - requestIdentifier.CreateInstance(); - requestIdentifier->initialize( - request->getClientId(), - request->getRequestId(), - request->getPmeId(), - jobId, - actionClass, - CAFCOMMON_GUID_NULL); - - return requestIdentifier; -} - -SmartPtrCActionClassDoc CProviderDriver::findActionClass( - const std::string srchClassNamespace, - const std::string srchClassName, - const std::string srchClassVersion, - const std::string srchOperationName) const { - CAF_CM_FUNCNAME("findActionClass"); - CAF_CM_VALIDATE_STRING(srchClassNamespace); - CAF_CM_VALIDATE_STRING(srchClassName); - CAF_CM_VALIDATE_STRING(srchClassVersion); - CAF_CM_VALIDATE_STRING(srchOperationName); - - const std::deque actionClassCollection = _schema->getActionClassCollection(); - CAF_CM_VALIDATE_STL(actionClassCollection); - - SmartPtrCActionClassDoc actionClassRc; - for(TConstIterator > actionClassIter(actionClassCollection); - actionClassIter; actionClassIter++) { - const SmartPtrCActionClassDoc actionClass = *actionClassIter; - - const std::string actionClassNamespace = actionClass->getNamespaceVal(); - const std::string actionClassName = actionClass->getName(); - const std::string actionClassVersion = actionClass->getVersion(); - - if ((srchClassNamespace.compare(actionClassNamespace) == 0) && - (srchClassName.compare(actionClassName) == 0) && - (srchClassVersion.compare(actionClassVersion) == 0)) { - - const SmartPtrCCollectMethodDoc actionCollectMethod = actionClass->getCollectMethod(); - if (! actionCollectMethod.IsNull() && (srchOperationName.compare(actionCollectMethod->getName()) == 0)) { - actionClassRc.CreateInstance(); - actionClassRc->initialize( - actionClassNamespace, - actionClassName, - actionClassVersion, - actionCollectMethod, - std::deque(), - actionClass->getDisplayName(), - actionClass->getDescription()); - break; - } else { - const std::deque actionMethodCollection = actionClass->getMethodCollection(); - for(TConstIterator > actionMethodIter(actionMethodCollection); - actionMethodIter; actionMethodIter++) { - const SmartPtrCMethodDoc actionMethod = *actionMethodIter; - - if (srchOperationName.compare(actionMethod->getName()) == 0) { - std::deque actionMethodCollection; - actionMethodCollection.push_back(actionMethod); - - actionClassRc.CreateInstance(); - actionClassRc->initialize( - actionClassNamespace, - actionClassName, - actionClassVersion, - SmartPtrCCollectMethodDoc(), - actionMethodCollection, - actionClass->getDisplayName(), - actionClass->getDescription()); - break; - } - } - } - } - } - - if (actionClassRc.IsNull()) { - CAF_CM_EXCEPTIONEX_VA4(NoSuchElementException, ERROR_NOT_FOUND, - "Action Class not found - %s::%s::%s::%s", - srchClassNamespace.c_str(), srchClassName.c_str(), srchClassVersion.c_str(), srchOperationName.c_str()); - } - - return actionClassRc; -} - -void CProviderDriver::saveProviderResponse(const std::string attachmentFilePath) const { - CAF_CM_FUNCNAME_VALIDATE("saveProviderResponse"); - CAF_CM_VALIDATE_STRING(attachmentFilePath); - - const std::string attachmentName = FileSystemUtils::getBasename(attachmentFilePath); - const std::string attachmentDirPath = FileSystemUtils::getDirname(attachmentFilePath); - const std::string attachmentFilePathTmp = - FileSystemUtils::normalizePathWithForward(attachmentFilePath); - - const std::string cmsPolicyStr = AppConfigUtils::getRequiredString( - "security", "cms_policy");; - - SmartPtrCAttachmentDoc attachment; - attachment.CreateInstance(); - attachment->initialize(attachmentName, "cdif", - "file:///" + attachmentFilePathTmp, false, - EnumConvertersXml::convertStringToCmsPolicy(cmsPolicyStr)); - - std::deque attachmentCollectionInner; - attachmentCollectionInner.push_back(attachment); - - SmartPtrCAttachmentCollectionDoc attachmentCollection; - attachmentCollection.CreateInstance(); - attachmentCollection->initialize(attachmentCollectionInner, - std::deque()); - - const UUID clientId = CAFCOMMON_GUID_NULL; - const UUID requestId = CAFCOMMON_GUID_NULL; - const std::string pmeId = BasePlatform::UuidToString(CAFCOMMON_GUID_NULL); - - SmartPtrCProviderResponseDoc providerResponse; - providerResponse.CreateInstance(); - providerResponse->initialize( - clientId, - requestId, - pmeId, - SmartPtrCResponseHeaderDoc(), - SmartPtrCManifestDoc(), - attachmentCollection, - SmartPtrCStatisticsDoc()); - - const std::string providerResponseStr = XmlRoots::saveProviderResponseToString(providerResponse); - const std::string providerResponsePath = FileSystemUtils::buildPath(attachmentDirPath, _sProviderResponseFilename); - FileSystemUtils::saveTextFile(providerResponsePath, providerResponseStr); - CAF_CM_LOG_DEBUG_VA1("Saved provider response file - %s", providerResponsePath.c_str()); -} diff --git a/open-vm-tools/common-agent/Cpp/ProviderFx/ProviderFx/src/CProviderRequest.h b/open-vm-tools/common-agent/Cpp/ProviderFx/ProviderFx/src/CProviderRequest.h deleted file mode 100644 index 46d5f4ce8..000000000 --- a/open-vm-tools/common-agent/Cpp/ProviderFx/ProviderFx/src/CProviderRequest.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Author: brets - * Created: November 5, 2015 - * - * Copyright (C) 2015-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef CProviderRequest_h_ -#define CProviderRequest_h_ - - -#include "IProviderRequest.h" - -#include "Doc/CafCoreTypesDoc/CAttachmentCollectionDoc.h" -#include "Doc/ProviderRequestDoc/CProviderCollectInstancesDoc.h" -#include "Doc/ProviderRequestDoc/CProviderInvokeOperationDoc.h" -#include "Doc/ProviderRequestDoc/CProviderRequestDoc.h" - -namespace Caf { - -// Request information forwarded to the provider -class CProviderRequest : public IProviderRequest { -public: - CProviderRequest(const SmartPtrCProviderRequestDoc request, - const std::vector commandLine) : - _request(request), - _commandLine(commandLine) { - } - virtual ~CProviderRequest() {}; - -public: // IProviderRequest - const UUID getClientId() const { - return _request->getClientId(); - } - - const UUID getRequestId() const { - return _request->getRequestId(); - } - - const std::string getPmeId() const { - return _request->getPmeId(); - } - - const std::vector getCommandLine() const { - return _commandLine; - } - - const SmartPtrCAttachmentCollectionDoc getAttachments() const { - return _request->getAttachmentCollection(); - } - - const SmartPtrCProviderCollectInstancesDoc getCollectInstances() const { - return _collectInstances; - } - const SmartPtrCProviderInvokeOperationDoc getInvokeOperations() const { - return _invokeOperations; - } - -public: - void setCollectInstances(SmartPtrCProviderCollectInstancesDoc doc) { - _collectInstances = doc; - _invokeOperations = NULL; - } - - void setInvokeOperations(SmartPtrCProviderInvokeOperationDoc doc) { - _collectInstances = NULL; - _invokeOperations = doc; - } - -private: - const SmartPtrCProviderRequestDoc _request; - const std::vector _commandLine; - SmartPtrCProviderCollectInstancesDoc _collectInstances; - SmartPtrCProviderInvokeOperationDoc _invokeOperations; -}; - -} - -#endif // #ifndef CProviderRequest_h_ diff --git a/open-vm-tools/common-agent/Cpp/ProviderFx/ProviderFx/src/ProviderFx.cpp b/open-vm-tools/common-agent/Cpp/ProviderFx/ProviderFx/src/ProviderFx.cpp deleted file mode 100644 index 46d44f20b..000000000 --- a/open-vm-tools/common-agent/Cpp/ProviderFx/ProviderFx/src/ProviderFx.cpp +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Author: bwilliams - * Created: May 3, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#include "stdafx.h" - -extern "C" BOOL APIENTRY DllMain(HINSTANCE hModule, uint32 dwReason, LPVOID) -{ - return TRUE; -} diff --git a/open-vm-tools/common-agent/Cpp/ProviderFx/ProviderFx/src/stdafx.h b/open-vm-tools/common-agent/Cpp/ProviderFx/ProviderFx/src/stdafx.h deleted file mode 100644 index a3e14e878..000000000 --- a/open-vm-tools/common-agent/Cpp/ProviderFx/ProviderFx/src/stdafx.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Author: bwilliams - * Created: May 3, 2012 - * - * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential - */ - -#ifndef stdafx_h_ -#define stdafx_h_ - -//{{CAF_SUBSYSTEM}} - -#include -#include -#include - -#include "../include/ProviderFxLink.h" -#include "CProviderCdifFormatter.h" -#include "CProviderRequest.h" - -#endif // #ifndef stdafx_h_ diff --git a/open-vm-tools/common-agent/Install/packages/pme/files/common/Linux/install/preconfigure-listener.sh b/open-vm-tools/common-agent/Install/packages/pme/files/common/Linux/install/preconfigure-listener.sh deleted file mode 100644 index 75d49b6bf..000000000 --- a/open-vm-tools/common-agent/Install/packages/pme/files/common/Linux/install/preconfigure-listener.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/sh - -#Standard env -SCRIPT=`basename "$0"` - -installDir=$(dirname $(readlink -f $0)) -scriptsDir=$installDir/../scripts -configDir=$installDir/../config - -set_caf_pme_paths() -{ - PATH=$PATH:$installDir:$scriptsDir - PERSISTENCE_DIR=${CAF_INPUT_DIR}/persistence - CERTS_DIR=${CERTS_DIR:-'/etc/vmware-tools/GuestProxyData/server'} -} - -configure_caf_common() -{ - mkdir -p ${PERSISTENCE_DIR}/local - mkdir -p ${PERSISTENCE_DIR}/remote/remote_default/cmsCertCollection - mkdir -p ${PERSISTENCE_DIR}/protocol/amqpBroker_default/tlsCertCollection - mkdir -p ${PERSISTENCE_DIR}/protocol/amqpBroker_default/tlsCipherCollection/ - - echo "amqpBroker_default" > ${PERSISTENCE_DIR}/remote/remote_default/protocolName.txt - echo "remote_default" > ${PERSISTENCE_DIR}/remote/remote_default/remoteId.txt - echo "des-ede3-cbc" > ${PERSISTENCE_DIR}/remote/remote_default/cmsCipherName.txt - - echo "SRP-RSA-AES-128-CBC-SHA" > ${PERSISTENCE_DIR}/protocol/amqpBroker_default/tlsCipherCollection/tlsCipher0.txt - echo "amqpBroker_default" > ${PERSISTENCE_DIR}/protocol/amqpBroker_default/protocolName.txt - echo "TLSv1" > ${PERSISTENCE_DIR}/protocol/amqpBroker_default/tlsProtocol.txt - - cp -rf ${CERTS_DIR}/cert.pem ${PERSISTENCE_DIR}/local/cert.pem - cp -rf ${CERTS_DIR}/key.pem ${PERSISTENCE_DIR}/local/privateKey.pem - - cp -rf ${CERTS_DIR}/cert.pem ${PERSISTENCE_DIR}/protocol/amqpBroker_default/tlsCert.pem - cp -rf ${CERTS_DIR}/cert.pem ${PERSISTENCE_DIR}/protocol/amqpBroker_default/tlsCertCollection/tlsCert0.pem - - cp -rf ${CERTS_DIR}/cert.pem ${PERSISTENCE_DIR}/remote/remote_default/cmsCertCollection/cmsCert0.pem - cp -rf ${CERTS_DIR}/cert.pem ${PERSISTENCE_DIR}/remote/remote_default/cmsCert.pem - - /usr/bin/vmware-guestproxycerttool -a ${PERSISTENCE_DIR}/local/cert.pem - /usr/bin/vmware-guestproxycerttool -a ${PERSISTENCE_DIR}/protocol/amqpBroker_default/tlsCert.pem - /usr/bin/vmware-guestproxycerttool -a ${PERSISTENCE_DIR}/protocol/amqpBroker_default/tlsCertCollection/tlsCert0.pem - -} - -##============================================================================= -## Main -##============================================================================= -. $scriptsDir/caf-common -sourceCafenv "$configDir" - -set_caf_pme_paths -configure_caf_common - -#echo QUIT | openssl s_client -connect localhost:6672 -cert ${CERTS_DIR}/cert.pem -key ${CERTS_DIR}/key.pem -CAfile ${CERTS_DIR}/cert.pem -tls1_2 -#echo QUIT | openssl s_client -connect localhost:6672 -cert ${CERTS_DIR}/cert.pem -key ${CERTS_DIR}/key.pem -CAfile ${CERTS_DIR}/cert.pem -tls1_2 - -echo -n true - diff --git a/open-vm-tools/common-agent/etc/Makefile.am b/open-vm-tools/common-agent/etc/Makefile.am deleted file mode 100644 index 25b386c42..000000000 --- a/open-vm-tools/common-agent/etc/Makefile.am +++ /dev/null @@ -1,24 +0,0 @@ -################################################################################ -### Copyright (C) 2016 VMware, Inc. All rights reserved. -### -### This program is free software; you can redistribute it and/or modify -### it under the terms of version 2 of the GNU General Public License as -### published by the Free Software Foundation. -### -### 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -################################################################################ - -SUBDIRS = install config scripts - -uninstall-hook: - rm -rf $(DESTDIR)/etc/vmware-caf - rm -rf $(DESTDIR)/var/lib/vmware-caf - rm -rf $(DESTDIR)/var/vmware-caf - rm -rf $(DESTDIR)/$(libdir)/open-vm-tools/vmware-caf/ diff --git a/open-vm-tools/common-agent/etc/config/CommAmqpListener-appconfig b/open-vm-tools/common-agent/etc/config/CommAmqpListener-appconfig deleted file mode 100644 index 52a60c7b1..000000000 --- a/open-vm-tools/common-agent/etc/config/CommAmqpListener-appconfig +++ /dev/null @@ -1,82 +0,0 @@ -# Copyright (C) 2017 VMware, Inc. All rights reserved. -- VMware Confidential - -[globals] -response_dir=${output_dir}/responses -event_dir=${output_dir}/events -request_dir=${output_dir}/requests -tmp_dir=${output_dir}/tmp -persistence_dir=${input_dir}/persistence -monitor_dir=${input_dir}/monitor -log_config_file=${config_dir}/CommAmqpListener-log4cpp_config - -thread_stack_size_kb=0 - -schema_namespace_root=http://schemas.vmware.com/caf/schema -schema_location_root=${input_dir}/schemas/caf - -remap_logging_location=false - -[communication_amqp] -working_dir=${output_dir}/comm-wrk -context_file=${comm_amqp_listener_context} -resolver_cache_file=${output_dir}/cache/commAmqpResolver-cache - -reactive_request_queue_id=${reactive_request_amqp_queue_id} - -startup_timeout=5000 -shutdown_timeout=5000 -connection_retry_interval=5000 - -# Temporarily set to 60MB for Hyperic Agent POC -# 1024 Bytes/KB * 1024 KB/MB * 60 -max_part_size=62976000 - -vhost=caf - -# Wait for (connection_retries * connection_seconds_to_wait) in milli-seconds -connection_timeout=150000 - -connection_retries=10 -connection_seconds_to_wait=15 -channel_cache_size=4 -reply_timeout=5000 - -[security] -cms_policy=None -is_signing_enforced=false -is_encryption_enforced=false - -tls_protocol=TLSv1_2 -tls_ciphers=SRP-RSA-AES-128-CBC-SHA -cms_cipher=des-ede3-cbc - -[subsystems] -# Integration System Beans -com.vmware.commonagent.integration.objectfactory=IntegrationSubsys -com.vmware.commonagent.integration.channels.errorchannel=IntegrationSubsys -com.vmware.commonagent.integration.channels.nullchannel=IntegrationSubsys -com.vmware.commonagent.integration.headerexpressioninvoker=IntegrationSubsys - -# Communication Integration Beans -com.vmware.caf.comm.integration.cmsmessagetransformer=CommIntegrationSubsys -com.vmware.caf.comm.integration.cmsmessagetransformerinstance=CommIntegrationSubsys -com.vmware.caf.comm.integration.eventtopiccalculator=CommIntegrationSubsys -com.vmware.caf.comm.integration.incomingmessagehandler=CommIntegrationSubsys -com.vmware.caf.comm.integration.incomingmessagehandlerinstance=CommIntegrationSubsys -com.vmware.caf.comm.integration.outgoingmessagehandler=CommIntegrationSubsys -com.vmware.caf.comm.integration.protocolheaderenricher=CommIntegrationSubsys -com.vmware.caf.comm.integration.protocolheaderenricherinstance=CommIntegrationSubsys -com.vmware.caf.comm.integration.replytocacher=CommIntegrationSubsys -com.vmware.caf.comm.integration.replytocacherinstance=CommIntegrationSubsys -com.vmware.caf.comm.integration.replytoresolver=CommIntegrationSubsys -com.vmware.caf.comm.integration.objects=CommAmqpIntegrationSubsys - -# Amqp Listener Context Beans -com.vmware.caf.comm.integration.amqp.caching.connection.factory=CommAmqpIntegrationSubsys -com.vmware.caf.comm.integration.amqp.secure.caching.connection.factory=CommAmqpIntegrationSubsys - -# CAF Integration System Beans -com.vmware.commonagent.cafintegration.errortoresponsetransformerinstance=CafIntegrationSubsys -com.vmware.commonagent.cafintegration.errortoresponsetransformer=CafIntegrationSubsys -com.vmware.commonagent.cafintegration.payloadheaderenricherinstance=CafIntegrationSubsys -com.vmware.commonagent.cafintegration.payloadheaderenricher=CafIntegrationSubsys diff --git a/open-vm-tools/common-agent/etc/config/CommAmqpListener-context-amqp.xml b/open-vm-tools/common-agent/etc/config/CommAmqpListener-context-amqp.xml deleted file mode 100644 index 71148568b..000000000 --- a/open-vm-tools/common-agent/etc/config/CommAmqpListener-context-amqp.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/open-vm-tools/common-agent/etc/config/CommAmqpListener-context-common.xml b/open-vm-tools/common-agent/etc/config/CommAmqpListener-context-common.xml deleted file mode 100644 index 8e06ca5a2..000000000 --- a/open-vm-tools/common-agent/etc/config/CommAmqpListener-context-common.xml +++ /dev/null @@ -1,200 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/open-vm-tools/common-agent/etc/config/CommAmqpListener-context-tunnel.xml b/open-vm-tools/common-agent/etc/config/CommAmqpListener-context-tunnel.xml deleted file mode 100644 index 469b5c77b..000000000 --- a/open-vm-tools/common-agent/etc/config/CommAmqpListener-context-tunnel.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/open-vm-tools/common-agent/etc/config/CommAmqpListener-log4cpp_config b/open-vm-tools/common-agent/etc/config/CommAmqpListener-log4cpp_config deleted file mode 100644 index d6949ebc0..000000000 --- a/open-vm-tools/common-agent/etc/config/CommAmqpListener-log4cpp_config +++ /dev/null @@ -1,18 +0,0 @@ -#log4j.rootCategory=DEBUG, console -log4j.rootCategory=ERROR, rolling - -log4j.appender.console=org.apache.log4j.ConsoleAppender -log4j.appender.console.layout=org.apache.log4j.PatternLayout -log4j.appender.console.layout.ConversionPattern=%p|%d{ISO8601}|%t|%c|%m%n - -log4j.appender.logfile=org.apache.log4j.FileAppender -log4j.appender.logfile.fileName=CommAmqpListener-log4cpp.log -log4j.appender.logfile.layout=org.apache.log4j.PatternLayout -log4j.appender.logfile.layout.ConversionPattern=%p|%d{ISO8601}|%t|%c|%m%n - -log4j.appender.rolling=org.apache.log4j.RollingFileAppender -log4j.appender.rolling.fileName=CommAmqpListener-log4cpp_rolling.log -log4j.appender.rolling.layout=org.apache.log4j.PatternLayout -log4j.appender.rolling.layout.ConversionPattern=%p|%d{ISO8601}|%t|%c|%m%n -log4j.appender.rolling.MaxFileSize=1024KB -log4j.appender.rolling.MaxBackupIndex=5 diff --git a/open-vm-tools/common-agent/etc/config/IntBeanConfigFile.xml b/open-vm-tools/common-agent/etc/config/IntBeanConfigFile.xml deleted file mode 100644 index d4e22ed46..000000000 --- a/open-vm-tools/common-agent/etc/config/IntBeanConfigFile.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - diff --git a/open-vm-tools/common-agent/etc/config/Makefile.am b/open-vm-tools/common-agent/etc/config/Makefile.am deleted file mode 100644 index acc715b15..000000000 --- a/open-vm-tools/common-agent/etc/config/Makefile.am +++ /dev/null @@ -1,36 +0,0 @@ -################################################################################ -### Copyright (C) 2016 VMware, Inc. All rights reserved. -### -### This program is free software; you can redistribute it and/or modify -### it under the terms of version 2 of the GNU General Public License as -### published by the Free Software Foundation. -### -### 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -################################################################################ - -confdir=/etc/vmware-caf/pme/config - -conf_DATA = \ - cafenv-appconfig \ - CommAmqpListener-appconfig \ - CommAmqpListener-context-amqp.xml \ - CommAmqpListener-context-common.xml \ - CommAmqpListener-context-tunnel.xml \ - CommAmqpListener-log4cpp_config \ - IntBeanConfigFile.xml \ - ma-appconfig \ - ma-context.xml \ - ma-log4cpp_config \ - providerFx-appconfig \ - providerFx-log4cpp_config \ - vgauth.conf - -install-data-local: - D=$(DESTDIR) /bin/bash $(top_srcdir)/common-agent/etc/install/install.sh -L -l $(libdir)/open-vm-tools -B $(libdir)/open-vm-tools -i /var -o /var diff --git a/open-vm-tools/common-agent/etc/config/cafenv-appconfig b/open-vm-tools/common-agent/etc/config/cafenv-appconfig deleted file mode 100644 index 32b3f8c73..000000000 --- a/open-vm-tools/common-agent/etc/config/cafenv-appconfig +++ /dev/null @@ -1,45 +0,0 @@ -# Copyright (C) 2017 VMware, Inc. All rights reserved. -- VMware Confidential - -[globals] -# Specifies where python is located. -python_dir=/opt/vmware/caf/python - -# Substitute @binDir@ for the value passed in during install -# Maps to 'bin' in the build output -bin_dir=@binDir@ - -# Substitute @libDir@ for the value passed in during install -# Maps to 'lib' in the build output -lib_dir=@libDir@ - -# Substitute @configDir@ for the value passed in during install -# Maps to 'config' in the build output -config_dir=@configDir@ - -# Substitute @inputDir@ for the value passed in during install -# Maps to 'data/input' in the build output -input_dir=@inputDir@ - -# Substitute @outputDir@ for the value passed in during install -# No mapping in the build output since the output files are created at run-time -output_dir=@outputDir@ - -# Substitute @logDir@ for the value passed in during install -# No mapping in the build output since the log files are created at run-time -log_dir=@logDir@ - -# Substitute @invokersDir@ for the value passed in during install -# Maps to 'invokers' in the build output - Used by the internal providers -invokers_dir=@invokersDir@ - -# Substitute @providersDir@ for the value passed in during install -# Maps to 'providers' in the build output - Used by the internal providers -providers_dir=@providersDir@ - -# Substitute @toolsLibDir@ for the value passed in during install -# Maps to 'lib' in the build output -tools_lib_dir=@toolsLibDir@ - -# Substitute @cafInstallMode@ for the value passed in during install -# No mapping in the build output since it is just a reference value -install_mode=@cafInstallMode@ diff --git a/open-vm-tools/common-agent/etc/config/ma-appconfig b/open-vm-tools/common-agent/etc/config/ma-appconfig deleted file mode 100644 index 0ea676299..000000000 --- a/open-vm-tools/common-agent/etc/config/ma-appconfig +++ /dev/null @@ -1,94 +0,0 @@ -# Copyright (C) 2017 VMware, Inc. All rights reserved. -- VMware Confidential - -[globals] -persistence_dir=${input_dir}/persistence -monitor_dir=${input_dir}/monitor -response_dir=${output_dir}/responses -request_dir=${output_dir}/requests -split_request_dir=${output_dir}/split-requests -tmp_dir=${output_dir}/tmp -bean_config_file=${config_dir}/ma-context.xml -log_config_file=${config_dir}/ma-log4cpp_config -scripts_dir=${config_dir}/../scripts -install_dir=${config_dir}/../install - -thread_stack_size_kb=0 - -schema_namespace_root=http://schemas.vmware.com/caf/schema -schema_location_root=${input_dir}/schemas/caf - -remap_logging_location=false - -[security] -cms_policy=None - -[managementAgent] -host_delay_sec=5 -host_integration_timeout_ms=5000 -use_impersonation=false -# Value used to specify the priority that provider sub-process are created at. -# Valid values are: NORMAL, LOW, IDLE. Default value is NORMAL. -provider_process_priority=NORMAL - -[providerHost] -install_dir=${config_dir}/../install -invokers_dir=${invokers_dir} -providers_dir=${providers_dir} -schema_cache_dir=${output_dir}/schemaCache -provider_reg_dir=${input_dir}/providerReg -common_packages_dir=${input_dir}/commonPackages - -[provider] -diagFileAliases=ma-appconfig:ma-log4cpp_config:ma-context:CommAmqpListener-appconfig:CommAmqpListener-log4cpp_config:CommAmqpListener-context:IntBeanConfigFile -diagFileAlias_ma-appconfig=file://${root_dir}/config/ma-appconfig?encoding=iniFile -diagFileAlias_ma-log4cpp_config=file://${root_dir}/config/ma-log4cpp_config?encoding=iniFileWithoutSection -diagFileAlias_ma-context=file://${root_dir}/config/ma-context.xml?encoding=xmlFile -diagFileAlias_CommAmqpListener-appconfig=file://${root_dir}/config/CommAmqpListener-appconfig?encoding=iniFile -diagFileAlias_CommAmqpListener-log4cpp_config=file://${root_dir}/config/CommAmqpListener-log4cpp_config?encoding=iniFileWithoutSection -diagFileAlias_CommAmqpListener-context=file://${root_dir}/config/CommAmqpListener-context.xml?encoding=xmlFile -diagFileAlias_IntBeanConfigFile=file://${root_dir}/config/IntBeanConfigFile.xml?encoding=xmlFile - -[monitor] -listener_retry_max=-1 -listener_startup_type=Automatic -listener_restart_hours=48 -listener_ctrl_preconfigure=1 -listener_ctrl_follow_tunnel=1 -nsdb_poller_signal_file=${monitor_dir}/nsdbPollerSignal.txt -nsdb_polling_interval_secs=86400 - -[subsystems] -# Integration System Beans -com.vmware.commonagent.integration.objectfactory=IntegrationSubsys -com.vmware.commonagent.integration.channels.errorchannel=IntegrationSubsys -com.vmware.commonagent.integration.channels.nullchannel=IntegrationSubsys - -# CAF Integration -com.vmware.commonagent.cafintegration.errortoresponsetransformerinstance=CafIntegrationSubsys -com.vmware.commonagent.cafintegration.errortoresponsetransformer=CafIntegrationSubsys -com.vmware.commonagent.cafintegration.payloadheaderenricherinstance=CafIntegrationSubsys -com.vmware.commonagent.cafintegration.payloadheaderenricher=CafIntegrationSubsys -com.vmware.commonagent.cafintegration.envelopetopayloadtransformerinstance=CafIntegrationSubsys -com.vmware.commonagent.cafintegration.envelopetopayloadtransformer=CafIntegrationSubsys - -# Management Agent - -# MA Integration -com.vmware.commonagent.maintegration.collectschemaexecutor=MaIntegrationSubsys -com.vmware.commonagent.maintegration.providercollectschemaexecutor=MaIntegrationSubsys -com.vmware.commonagent.maintegration.providerexecutor=MaIntegrationSubsys -com.vmware.commonagent.maintegration.singlepmerequestsplitterinstance=MaIntegrationSubsys -com.vmware.commonagent.maintegration.singlepmerequestsplitter=MaIntegrationSubsys -com.vmware.commonagent.maintegration.diagtomgmtrequesttransformerinstance=MaIntegrationSubsys -com.vmware.commonagent.maintegration.diagtomgmtrequesttransformer=MaIntegrationSubsys -com.vmware.commonagent.maintegration.installtomgmtrequesttransformerinstance=MaIntegrationSubsys -com.vmware.commonagent.maintegration.installtomgmtrequesttransformer=MaIntegrationSubsys -com.vmware.commonagent.maintegration.versiontransformerinstance=MaIntegrationSubsys -com.vmware.commonagent.maintegration.versiontransformer=MaIntegrationSubsys -com.vmware.commonagent.maintegration.attachmentrequesttransformerinstance=MaIntegrationSubsys -com.vmware.commonagent.maintegration.attachmentrequesttransformer=MaIntegrationSubsys -com.vmware.commonagent.maintegration.integrationobjects=MaIntegrationSubsys -com.vmware.commonagent.maintegration.guestauthenticatorinstance=VgAuthIntegrationSubsys -com.vmware.commonagent.maintegration.guestauthenticator=VgAuthIntegrationSubsys -com.vmware.commonagent.maintegration.configenv=MaIntegrationSubsys -com.vmware.commonagent.maintegration.persistencenamespacedb=MaIntegrationSubsys diff --git a/open-vm-tools/common-agent/etc/config/ma-context.xml b/open-vm-tools/common-agent/etc/config/ma-context.xml deleted file mode 100644 index 8e9074a72..000000000 --- a/open-vm-tools/common-agent/etc/config/ma-context.xml +++ /dev/null @@ -1,340 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/open-vm-tools/common-agent/etc/config/ma-log4cpp_config b/open-vm-tools/common-agent/etc/config/ma-log4cpp_config deleted file mode 100644 index b4f9156de..000000000 --- a/open-vm-tools/common-agent/etc/config/ma-log4cpp_config +++ /dev/null @@ -1,18 +0,0 @@ -#log4j.rootCategory=DEBUG, console -log4j.rootCategory=ERROR, rolling - -log4j.appender.console=org.apache.log4j.ConsoleAppender -log4j.appender.console.layout=org.apache.log4j.PatternLayout -log4j.appender.console.layout.ConversionPattern=%p|%d{ISO8601}|%t|%c|%m%n - -log4j.appender.logfile=org.apache.log4j.FileAppender -log4j.appender.logfile.fileName=ma-log4cpp.log -log4j.appender.logfile.layout=org.apache.log4j.PatternLayout -log4j.appender.logfile.layout.ConversionPattern=%p|%d{ISO8601}|%t|%c|%m%n - -log4j.appender.rolling=org.apache.log4j.RollingFileAppender -log4j.appender.rolling.fileName=ma-log4cpp_rolling.log -log4j.appender.rolling.layout=org.apache.log4j.PatternLayout -log4j.appender.rolling.layout.ConversionPattern=%p|%d{ISO8601}|%t|%c|%m%n -log4j.appender.rolling.MaxFileSize=1024KB -log4j.appender.rolling.MaxBackupIndex=5 diff --git a/open-vm-tools/common-agent/etc/config/providerFx-appconfig b/open-vm-tools/common-agent/etc/config/providerFx-appconfig deleted file mode 100644 index 747c7fbc0..000000000 --- a/open-vm-tools/common-agent/etc/config/providerFx-appconfig +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright (C) 2017 VMware, Inc. All rights reserved. -- VMware Confidential - -[globals] -#response_dir=${output_dir}/responses -#request_dir=${output_dir}/requests -#tmp_dir=${output_dir}/tmp -#bean_config_file=${config_dir}/ma-context.xml -log_config_file=${config_dir}/providerFx-log4cpp_config - -thread_stack_size_kb=0 - -schema_namespace_root=http://schemas.vmware.com/caf/schema -schema_location_root=${input_dir}/schemas/caf - -remap_logging_location=false - -[providerHost] -install_dir=${config_dir}/../install -invokers_dir=${invokers_dir} -providers_dir=${providers_dir} -schema_cache_dir=${output_dir}/schemaCache -provider_reg_dir=${input_dir}/providerReg -common_packages_dir=${input_dir}/commonPackages - -[security] -cms_policy=None diff --git a/open-vm-tools/common-agent/etc/config/providerFx-log4cpp_config b/open-vm-tools/common-agent/etc/config/providerFx-log4cpp_config deleted file mode 100644 index f4ac36574..000000000 --- a/open-vm-tools/common-agent/etc/config/providerFx-log4cpp_config +++ /dev/null @@ -1,18 +0,0 @@ -#log4j.rootCategory=DEBUG, console -log4j.rootCategory=ERROR, rolling - -log4j.appender.console=org.apache.log4j.ConsoleAppender -log4j.appender.console.layout=org.apache.log4j.PatternLayout -log4j.appender.console.layout.ConversionPattern=%p|%d{ISO8601}|%t|%c|%m%n - -log4j.appender.logfile=org.apache.log4j.FileAppender -log4j.appender.logfile.fileName=providerFx-log4cpp.log -log4j.appender.logfile.layout=org.apache.log4j.PatternLayout -log4j.appender.logfile.layout.ConversionPattern=%p|%d{ISO8601}|%t|%c|%m%n - -log4j.appender.rolling=org.apache.log4j.RollingFileAppender -log4j.appender.rolling.fileName=providerFx-log4cpp_rolling.log -log4j.appender.rolling.layout=org.apache.log4j.PatternLayout -log4j.appender.rolling.layout.ConversionPattern=%p|%d{ISO8601}|%t|%c|%m%n -log4j.appender.rolling.MaxFileSize=1024KB -log4j.appender.rolling.MaxBackupIndex=5 diff --git a/open-vm-tools/common-agent/etc/config/vgauth.conf b/open-vm-tools/common-agent/etc/config/vgauth.conf deleted file mode 100644 index aa13fa7ce..000000000 --- a/open-vm-tools/common-agent/etc/config/vgauth.conf +++ /dev/null @@ -1,9 +0,0 @@ -[service] -logfile=@logDir@/vgauth.log -loglevel=verbose -enableLogging=true -enableCoreDumps=true -samlSchemaDir=${input_dir}/schemas/saml - -[auditing] -auditSuccessEvents=true diff --git a/open-vm-tools/common-agent/etc/install/Makefile.am b/open-vm-tools/common-agent/etc/install/Makefile.am deleted file mode 100644 index ec2ecfcc6..000000000 --- a/open-vm-tools/common-agent/etc/install/Makefile.am +++ /dev/null @@ -1,36 +0,0 @@ -################################################################################ -### Copyright (C) 2016 VMware, Inc. All rights reserved. -### -### This program is free software; you can redistribute it and/or modify -### it under the terms of version 2 of the GNU General Public License as -### published by the Free Software Foundation. -### -### 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -################################################################################ - -confdir = /etc/vmware-caf/pme/install - -conf_SCRIPTS = \ - caf-c-communication-service \ - caf-c-management-agent \ - caf-dbg.sh \ - caf-vgauth \ - commonenv.sh \ - install.sh \ - postinstallInstall.sh \ - postinstallUpgrade.sh \ - preinstallUpgrade.sh \ - preremoveUninstall.sh \ - preuninstall.sh \ - preupgrade.sh \ - restartServices.sh \ - stopAndRemoveServices.sh \ - upgrade.sh - diff --git a/open-vm-tools/common-agent/etc/install/caf-c-communication-service b/open-vm-tools/common-agent/etc/install/caf-c-communication-service deleted file mode 100644 index 61dd89000..000000000 --- a/open-vm-tools/common-agent/etc/install/caf-c-communication-service +++ /dev/null @@ -1,81 +0,0 @@ -#!/bin/bash -# -# Init file for the VMware CAF Communication Service -# -# chkconfig: 35 95 20 -# description: VMware Common Agent Framework Communication Service daemon -# -# processname: CommAmqpListener - -if [ -f /etc/rc.d/init.d/functions ]; then - . /etc/rc.d/init.d/functions -elif [ -f /lib/lsb/init-functions ]; then - . /lib/lsb/init-functions - type success >/dev/null 2>/dev/null - if [ $? -ne 0 ]; then - success() { - echo -en "$@" - echo -e "$rc_done" - } - failure() { - echo -en "$@" - echo -e "$rc_failed" - } - fi -fi - -progName="VMware CAF Communication Service (C Version)" -listenerName=CommAmqpListener -prog="@binDir@/$listenerName" -startScript="@scriptDir@/start-listener" -stopScript="@scriptDir@/stop-listener" -lockFile=/var/lock/subsys/caf-communication-service - -start() -{ - [ -x $startScript ] || exit 0 - echo -n $"Starting $progName:" - msg="$progBase daemon startup" - "$startScript" && success "$msg" || failure "$msg" - rc=$? - [ $rc -eq 0 ] && touch $lockFile - echo - return $rc -} - -stop() -{ - echo -n $"Stoppping $progName:" - killproc $prog -TERM - rc=$? - [ -x $stopScript ] && $stopScript && - [ $rc -ne 0 ] && [ -z "`pidof -x $prog`" ] && rc=0 - [ $rc -eq 0 ] && rm -f $lockFile - echo - return $rc -} - -restart() -{ - stop - sleep 2 - start -} - -condrestart() -{ - [ -e $lockFile ] && restart || : -} - -case "$1" in - start) start ;; - stop) stop ;; - status) status $prog ;; - restart) restart ;; - condrestart) condrestart ;; - *) - echo $"Usage: $0 {start|stop|status|condrestart|restart}" - exit 1 -esac - -exit $? diff --git a/open-vm-tools/common-agent/etc/install/caf-c-management-agent b/open-vm-tools/common-agent/etc/install/caf-c-management-agent deleted file mode 100644 index f38f8b3b3..000000000 --- a/open-vm-tools/common-agent/etc/install/caf-c-management-agent +++ /dev/null @@ -1,81 +0,0 @@ -#!/bin/bash -# -# Init file for the VMware CAF Management Agent -# -# chkconfig: 35 95 20 -# description: VMware Common Agent Framework Management Agent daemon -# -# processname: ManagementAgentHost - -if [ -f /etc/rc.d/init.d/functions ]; then - . /etc/rc.d/init.d/functions -elif [ -f /lib/lsb/init-functions ]; then - . /lib/lsb/init-functions - type success >/dev/null 2>/dev/null - if [ $? -ne 0 ]; then - success() { - echo -en "$@" - echo -e "$rc_done" - } - failure() { - echo -en "$@" - echo -e "$rc_failed" - } - fi -fi - -progName="VMware CAF Management Agent (C Version)" -progBase=ManagementAgentHost -prog="@binDir@/$progBase" -startScript="@scriptDir@/start-ma" -stopScript="@scriptDir@/stop-ma" -lockFile=/var/lock/subsys/caf-management-agent - -start() -{ - [ -x $startScript ] || exit 0 - echo -n $"Starting $progName:" - msg="$progBase daemon startup" - "$startScript" && success "$msg" || failure "$msg" - rc=$? - [ $rc -eq 0 ] && touch $lockFile - echo - return $rc -} - -stop() -{ - echo -n $"Stoppping $progName:" - killproc $prog -TERM - rc=$? - [ -x $stopScript ] && $stopScript && - [ $rc -ne 0 ] && [ -z "`pidof -x $prog`" ] && rc=0 - [ $rc -eq 0 ] && rm -f $lockFile - echo - return $rc -} - -restart() -{ - stop - sleep 2 - start -} - -condrestart() -{ - [ -e $lockFile ] && restart || : -} - -case "$1" in - start) start ;; - stop) stop ;; - status) status $prog ;; - restart) restart ;; - condrestart) condrestart ;; - *) - echo $"Usage: $0 {start|stop|status|condrestart|restart}" - exit 1 -esac - -exit $? diff --git a/open-vm-tools/common-agent/etc/install/caf-dbg.sh b/open-vm-tools/common-agent/etc/install/caf-dbg.sh deleted file mode 100644 index 982b448fb..000000000 --- a/open-vm-tools/common-agent/etc/install/caf-dbg.sh +++ /dev/null @@ -1,548 +0,0 @@ -#!/bin/bash - -# Copyright (C) 2017 VMware, Inc. All rights reserved. -- VMware Confidential - -function prtHeader() { - local header=$1 - - echo "*************************" - echo "***" - echo "*** $header" - echo "***" - echo "*************************" -} - -function validateNotEmpty() { - local value=$1 - local name=$2 - - if [ "$value" = "" ]; then - echo "Value cannot be empty - $name" - exit 1 - fi -} - -function configAmqp() { - local username="$1" - local password="$2" - local brokerAddr="$3" - validateNotEmpty "$username" "username" - validateNotEmpty "$password" "password" - validateNotEmpty "$brokerAddr" "brokerAddr" - - local uriAmqpFile="$CAF_INPUT_DIR/persistence/protocol/amqpBroker_default/uri_amqp.txt" - sed -i -e "s/#amqpUsername#/${username}/g" -e "s/#amqpPassword#/${password}/g" -e "s/#brokerAddr#/$brokerAddr/g" "$uriAmqpFile" -} - -function enableCaf() { - local username="$1" - local password="$2" - validateNotEmpty "$username" "username" - validateNotEmpty "$password" "password" - - local uriAmqpFile="$CAF_INPUT_DIR/persistence/protocol/amqpBroker_default/uri_amqp.txt" - sed -i -e "s/#amqpUsername#/${username}/g" -e "s/#amqpPassword#/${password}/g" "$uriAmqpFile" -} - -function setBroker() { - local brokerAddr="$1" - validateNotEmpty "$brokerAddr" "brokerAddr" - - local uriAmqpFile="$CAF_INPUT_DIR/persistence/protocol/amqpBroker_default/uri_amqp.txt" - sed -i "s/#brokerAddr#/$brokerAddr/g" "$uriAmqpFile" -} - -function setListenerConfigured() { - mkdir -p "$CAF_INPUT_DIR/monitor" - echo "Manual" > "$CAF_INPUT_DIR/monitor/listenerConfiguredStage1.txt" -} - -function setListenerStartupType() { - local startupType="$1" - validateNotEmpty "$startupType" "startupType" - - local appconfigFile="$CAF_CONFIG_DIR/ma-appconfig" - sed -i "s/listener_startup_type=.*/listener_startup_type=$startupType/g" "$appconfigFile" -} - -function prtHelp() { - echo "*** $(basename $0) cmd - Runs commands that help with debugging CAF" - echo " * configAmqp brokerUsername brokerPassword brokerAddress Configures AMQP" - echo " * enableCaf brokerUsername brokerPassword Enables CAF" - echo " * setBroker brokerAddress Sets the Broker into the CAF config file" - echo " * setListenerConfigured Indicates that the Listener is configured" - echo " * setListenerStartupType startupType Sets the startup type used by the Listener (Manual, Automatic)" - echo "" - echo " * getAmqpQueueName Gets the AMQP Queue Name" - echo "" - echo " * checkTunnel Checks the AMQP Tunnel " - echo " * checkCerts Checks the certificates" - echo " * prtCerts Prints the certificates" - echo " * checkVmwTools Checks VMware Tools" - echo "" - echo " * validateXml Validates the XML files against the published schema" - echo " * validateInstall Validates that the files are in the right locations and have the right permissions" - echo " * validateOVTInstall Validates that the files are in the right locations for OVT and have the right permissions" - echo "" - echo " * clearCaches Clears the CAF caches" -} - -function validateXml() { - local schemaArea="$1" - local schemaPrefix="$2" - validateNotEmpty "$schemaArea" "schemaArea" - validateNotEmpty "$schemaPrefix" "schemaPrefix" - - local schemaRoot="$CAF_INPUT_DIR/schemas/caf" - - for file in $(find "$CAF_OUTPUT_DIR" -name '*.xml' -print0 2>/dev/null | xargs -0 egrep -IH -lw "${schemaPrefix}.xsd"); do - prtHeader "Validating $schemaArea/$schemaPrefix - $file" - xmllint --schema "${schemaRoot}/${schemaArea}/${schemaPrefix}.xsd" "$file"; rc=$? - if [ "$rc" != "0" ]; then - exit $rc - fi - done -} - -function checkCerts() { - local localDir="$CAF_INPUT_DIR/persistence/local" - local cacertFile="$CAF_INPUT_DIR/persistence/protocol/amqpBroker_default/tlsCertCollection/tlsCert0.pem" - - prtHeader "Checking private key - $localDir/privateKey.pem" - openssl rsa -in "$localDir/privateKey.pem" -check -noout - - prtHeader "Checking cert - $localDir/cert.pem" - openssl verify -check_ss_sig -x509_strict -CAfile "$cacertFile" "$localDir/cert.pem" - - prtHeader "Validating that private key and cert match - $localDir/cert.pem" - local clientCertMd5=$(openssl x509 -noout -modulus -in "$localDir/cert.pem" | openssl md5 | cut -d' ' -f2) - local clientKeyMd5=$(openssl rsa -noout -modulus -in "$localDir/privateKey.pem" | openssl md5 | cut -d' ' -f2) - if [ "$clientCertMd5" == "$clientKeyMd5" ]; then - echo "Public and Private Key md5's match" - else - echo "*** Public and Private Key md5's do not match" - exit 1 - fi -} - -function prtCerts() { - local localDir="$CAF_INPUT_DIR/persistence/local" - local cacertFile="$CAF_INPUT_DIR/persistence/protocol/amqpBroker_default/tlsCertCollection/tlsCert0.pem" - - prtHeader "Printing - $cacertFile" - openssl x509 -in "$cacertFile" -text -noout - - prtHeader "Printing - $localDir/cert.pem" - openssl x509 -in "$localDir/cert.pem" -text -noout -} - -function checkTunnel() { - local localDir="$CAF_INPUT_DIR/persistence/local" - local cacertFile="$CAF_INPUT_DIR/persistence/protocol/amqpBroker_default/tlsCertCollection/tlsCert0.pem" - - prtHeader "Connecting to tunnel" - openssl s_client -connect localhost:6672 -key "$localDir/privateKey.pem" -cert "$localDir/cert.pem" -CAfile "$cacertFile" -verify 10 -} - -function checkVmwTools() { - local isToolboxCmd=$(which vmware-toolbox-cmd 2>/dev/null) - if [ "$isToolboxCmd" != "" ]; then - vmware-toolbox-cmd --version - else - echo "It doesn't appear as though VMware Tools is installed" - fi - - local isSystemctl=$(which systemctl 2>/dev/null) - if [ "$isSystemctl" != "" ]; then - systemctl status vmware-tools.service - fi -} - -function validateInstall() { - checkFsPermsAll - checkFileExistsBin - checkFileExistsLib - checkFileExistsConfig - checkFileExistsScripts - checkFileExistsInstall - checkFileExistsInvokers - checkFileExistsProviderReg -} - -function checkFsPermsAll() { - checkFsPerms "$CAF_INPUT_DIR" "755" - checkFsPerms "$CAF_OUTPUT_DIR" "755" - checkFsPerms "$CAF_LOG_DIR" "755" - checkFsPerms "$CAF_BIN_DIR" "755" - checkFsPerms "$CAF_LIB_DIR" "755" -} - -function checkFileExistsBin() { - checkFileExists "$CAF_BIN_DIR/CommAmqpListener" - checkFileExists "$CAF_BIN_DIR/ConfigProvider" - checkFileExists "$CAF_BIN_DIR/InstallProvider" - checkFileExists "$CAF_BIN_DIR/ManagementAgentHost" - checkFileExists "$CAF_BIN_DIR/RemoteCommandProvider" - checkFileExists "$CAF_BIN_DIR/TestInfraProvider" - checkFileExists "$CAF_BIN_DIR/VGAuthService" - checkFileExists "$CAF_BIN_DIR/vmware-vgauth-cmd" -} - -function checkFileExistsLib() { - checkFileExists "$CAF_LIB_DIR/libCafIntegrationSubsys.so" - checkFileExists "$CAF_LIB_DIR/libCommAmqpIntegration.so" - checkFileExists "$CAF_LIB_DIR/libCommAmqpIntegrationSubsys.so" - checkFileExists "$CAF_LIB_DIR/libCommIntegrationSubsys.so" - checkFileExists "$CAF_LIB_DIR/libFramework.so" - checkFileExists "$CAF_LIB_DIR/libIntegrationSubsys.so" - checkFileExists "$CAF_LIB_DIR/libMaIntegrationSubsys.so" - checkFileExists "$CAF_LIB_DIR/libProviderFx.so" - checkFileExists "$CAF_LIB_DIR/libVgAuthIntegrationSubsys.so" - checkFileExists "$CAF_LIB_DIR/libcom_err.so.3" - checkFileExists "$CAF_LIB_DIR/libcrypto.so.1.0.2" - if [ "$CAF_INSTALL_MODE" = "standalone" ]; then - checkFileExists "$CAF_LIB_DIR/libgcc_s.so.1" - checkFileExists "$CAF_LIB_DIR/libglib-2.0.so.0.4800.1" - checkFileExists "$CAF_LIB_DIR/libgthread-2.0.so.0.4800.1" - checkFileExists "$CAF_LIB_DIR/libstdc++.so.6.0.13" - checkFileExists "$CAF_LIB_DIR/libpcre.so.1.2.6" - checkFileExists "$CAF_LIB_DIR/libiconv.so.2.5.1" - checkFileExists "$CAF_LIB_DIR/libz.so.1.2.8" - checkFileExists "$CAF_LIB_DIR/libffi.so.6.0.4" - fi - checkFileExists "$CAF_LIB_DIR/liblog4cpp.so.5.0.6" - checkFileExists "$CAF_LIB_DIR/librabbitmq.so.4.2.1" - checkFileExists "$CAF_LIB_DIR/libssl.so.1.0.2" - checkFileExists "$CAF_LIB_DIR/libvgauth.so" - checkFileExists "$CAF_LIB_DIR/libxerces-c-3.1.so" - checkFileExists "$CAF_LIB_DIR/libxml-security-c.so.16" -} - -function checkFileExistsConfig() { - checkFileExists "$CAF_CONFIG_DIR/CommAmqpListener-appconfig" - checkFileExists "$CAF_CONFIG_DIR/CommAmqpListener-context-amqp.xml" - checkFileExists "$CAF_CONFIG_DIR/CommAmqpListener-context-common.xml" - checkFileExists "$CAF_CONFIG_DIR/CommAmqpListener-context-tunnel.xml" - checkFileExists "$CAF_CONFIG_DIR/CommAmqpListener-log4cpp_config" - checkFileExists "$CAF_CONFIG_DIR/IntBeanConfigFile.xml" - checkFileExists "$CAF_CONFIG_DIR/cafenv-appconfig" - checkFileExists "$CAF_CONFIG_DIR/ma-appconfig" - checkFileExists "$CAF_CONFIG_DIR/ma-context.xml" - checkFileExists "$CAF_CONFIG_DIR/ma-log4cpp_config" - checkFileExists "$CAF_CONFIG_DIR/providerFx-appconfig" - checkFileExists "$CAF_CONFIG_DIR/providerFx-log4cpp_config" -} - -function checkFileExistsScripts() { - checkFileExists "$CAF_CONFIG_DIR/../scripts/caf-common" - checkFileExists "$CAF_CONFIG_DIR/../scripts/caf-processes.sh" - checkFileExists "$CAF_CONFIG_DIR/../scripts/setUpVgAuth" - checkFileExists "$CAF_CONFIG_DIR/../scripts/start-VGAuthService" - checkFileExists "$CAF_CONFIG_DIR/../scripts/start-listener" - checkFileExists "$CAF_CONFIG_DIR/../scripts/start-ma" - checkFileExists "$CAF_CONFIG_DIR/../scripts/startTestProc" - checkFileExists "$CAF_CONFIG_DIR/../scripts/stop-VGAuthService" - checkFileExists "$CAF_CONFIG_DIR/../scripts/stop-listener" - checkFileExists "$CAF_CONFIG_DIR/../scripts/stop-ma" - checkFileExists "$CAF_CONFIG_DIR/../scripts/tearDownVgAuth" - checkFileExists "$CAF_CONFIG_DIR/../scripts/vgAuth" -} -function checkFileExistsInstall() { - checkFileExists "$CAF_CONFIG_DIR/../install/caf-c-communication-service" - checkFileExists "$CAF_CONFIG_DIR/../install/caf-c-management-agent" - checkFileExists "$CAF_CONFIG_DIR/../install/caf-dbg.sh" - checkFileExists "$CAF_CONFIG_DIR/../install/caf-vgauth" - checkFileExists "$CAF_CONFIG_DIR/../install/commonenv.sh" - checkFileExists "$CAF_CONFIG_DIR/../install/install.sh" - checkFileExists "$CAF_CONFIG_DIR/../install/postinstallInstall.sh" - checkFileExists "$CAF_CONFIG_DIR/../install/postinstallUpgrade.sh" - checkFileExists "$CAF_CONFIG_DIR/../install/preinstallUpgrade.sh" - checkFileExists "$CAF_CONFIG_DIR/../install/preremoveUninstall.sh" - checkFileExists "$CAF_CONFIG_DIR/../install/preuninstall.sh" - checkFileExists "$CAF_CONFIG_DIR/../install/preupgrade.sh" - checkFileExists "$CAF_CONFIG_DIR/../install/restartServices.sh" - checkFileExists "$CAF_CONFIG_DIR/../install/stopAndRemoveServices.sh" - checkFileExists "$CAF_CONFIG_DIR/../install/upgrade.sh" -} - -function checkFileExistsInvokers() { - checkFileExists "$CAF_INVOKERS_DIR/cafTestInfra_CafTestInfraProvider_1_0_0.sh" - checkFileExists "$CAF_INVOKERS_DIR/caf_ConfigProvider_1_0_0.sh" - checkFileExists "$CAF_INVOKERS_DIR/caf_InstallProvider_1_0_0.sh" - checkFileExists "$CAF_INVOKERS_DIR/caf_RemoteCommandProvider_1_0_0.sh" -} - -function checkFileExistsProviderReg() { - checkFileExists "$CAF_INPUT_DIR/providerReg/cafTestInfra_CafTestInfraProvider_1_0_0.xml" - checkFileExists "$CAF_INPUT_DIR/providerReg/caf_ConfigProvider_1_0_0.xml" - checkFileExists "$CAF_INPUT_DIR/providerReg/caf_InstallProvider_1_0_0.xml" - checkFileExists "$CAF_INPUT_DIR/providerReg/caf_RemoteCommandProvider_1_0_0.xml" -} - -function checkFileExists() { - local path="$1" - validateNotEmpty "$path" "path" - - if [ ! -f "$path" ]; then - echo "*** File existence check failed - expected: $path" - exit 1 - fi -} - -function checkFsPerms() { - local dirOrFile="$1" - local permExp="$2" - local userExp="$3" - local groupExp="$4" - validateNotEmpty "$dirOrFile" "dirOrFile" - validateNotEmpty "$permExp" "permExp" - - if [ "$userExp" = "" ]; then - userExp="root" - fi - if [ "$groupExp" = "" ]; then - groupExp="root" - fi - - local statInfo=( $(stat -c "%a %U %G" $dirOrFile) ) - local permFnd=${statInfo[0]} - local userFnd=${statInfo[1]} - local groupFnd=${statInfo[2]} - - if [ "$permExp" != "$permFnd" ]; then - echo "*** Perm check failed - expected: $permExp, found: $permFnd, dir/file: $dirOrFile" - exit 1 - fi - - if [ "$userExp" != "$userFnd" ]; then - echo "*** User check failed - expected: $userExp, found: $userFnd, dir/file: $dirOrFile" - exit 1 - fi - - if [ "$groupExp" != "$groupFnd" ]; then - echo "*** Group check failed - expected: $groupExp, found: $groupFnd, dir/file: $dirOrFile" - exit 1 - fi -} - -function clearCaches() { - validateNotEmpty "$CAF_OUTPUT_DIR" "CAF_OUTPUT_DIR" - validateNotEmpty "$CAF_LOG_DIR" "CAF_LOG_DIR" - - prtHeader "Clearing the CAF caches" - rm -rf \ - $CAF_OUTPUT_DIR/schemaCache/* \ - $CAF_OUTPUT_DIR/comm-wrk/* \ - $CAF_OUTPUT_DIR/providerHost/* \ - $CAF_OUTPUT_DIR/responses/* \ - $CAF_OUTPUT_DIR/requests/* \ - $CAF_OUTPUT_DIR/split-requests/* \ - $CAF_OUTPUT_DIR/request_state/* \ - $CAF_OUTPUT_DIR/events/* \ - $CAF_OUTPUT_DIR/tmp/* \ - $CAF_OUTPUT_DIR/att/* \ - $CAF_OUTPUT_DIR/cache/* \ - $CAF_LOG_DIR/* \ - $CAF_BIN_DIR/*.log -} - -function validateInstall() { -# checkFsPermsAll - checkFileExistsBin - checkFileExistsLib "$1" - checkFileExistsConfig - checkFileExistsScripts - checkFileExistsInstall - checkFileExistsInvokers - checkFileExistsProviderReg -} - -function checkFsPermsAll() { - checkFsPerms "$CAF_INPUT_DIR" "755" - checkFsPerms "$CAF_OUTPUT_DIR" "755" - checkFsPerms "$CAF_CONFIG_DIR" "755" - checkFsPerms "$CAF_LOG_DIR" "755" - checkFsPerms "$CAF_BIN_DIR" "755" - checkFsPerms "$CAF_LIB_DIR" "755" -} - -function checkFileExistsBin() { - checkFileExists "$CAF_BIN_DIR/InstallProvider" - checkFileExists "$CAF_BIN_DIR/TestInfraProvider" - checkFileExists "$CAF_BIN_DIR/RemoteCommandProvider" - checkFileExists "$CAF_BIN_DIR/ConfigProvider" - checkFileExists "$CAF_BIN_DIR/CommAmqpListener" - checkFileExists "$CAF_BIN_DIR/ManagementAgentHost" -} - -function checkFileExistsLib() { - checkFileExists "$CAF_LIB_DIR/libProviderFx.so" - checkFileExists "$CAF_LIB_DIR/libMaIntegrationSubsys.so" - checkFileExists "$CAF_LIB_DIR/libCommAmqpIntegrationSubsys.so" - checkFileExists "$CAF_LIB_DIR/libCommAmqpIntegration.so" - checkFileExists "$CAF_LIB_DIR/libFramework.so" - checkFileExists "$CAF_LIB_DIR/libCafIntegrationSubsys.so" - checkFileExists "$CAF_LIB_DIR/libIntegrationSubsys.so" - checkFileExists "$CAF_LIB_DIR/libVgAuthIntegrationSubsys.so" - checkFileExists "$CAF_LIB_DIR/libCommIntegrationSubsys.so" - - local OVT=$1 - if [ "$OVT" != "true" ]; then - checkFileExists "$CAF_LIB_DIR/libCommAmqpListener.so" - checkFileExists "$CAF_LIB_DIR/libManagementAgentHost.so" - checkFileExists "$CAF_LIB_DIR/liblog4cpp.so.5.0.6" - checkFileExists "$CAF_LIB_DIR/librabbitmq.so.4.2.1" - if [ "$CAF_INSTALL_MODE" = "standalone" ]; then - checkFileExists "$CAF_LIB_DIR/libgthread-2.0.so.0.4800.1" - checkFileExists "$CAF_LIB_DIR/libglib-2.0.so.0.4800.1" - fi - fi -} - -function checkFileExistsConfig() { - checkFileExists "$CAF_CONFIG_DIR/ma-log4cpp_config" - checkFileExists "$CAF_CONFIG_DIR/ma-context.xml" - checkFileExists "$CAF_CONFIG_DIR/IntBeanConfigFile.xml" - checkFileExists "$CAF_CONFIG_DIR/CommAmqpListener-context-amqp.xml" - checkFileExists "$CAF_CONFIG_DIR/ma-appconfig" - checkFileExists "$CAF_CONFIG_DIR/CommAmqpListener-context-tunnel.xml" - checkFileExists "$CAF_CONFIG_DIR/CommAmqpListener-context-common.xml" - checkFileExists "$CAF_CONFIG_DIR/providerFx-appconfig" - checkFileExists "$CAF_CONFIG_DIR/CommAmqpListener-log4cpp_config" - checkFileExists "$CAF_CONFIG_DIR/CommAmqpListener-appconfig" - checkFileExists "$CAF_CONFIG_DIR/providerFx-log4cpp_config" - checkFileExists "$CAF_CONFIG_DIR/cafenv-appconfig" -} - -function checkFileExistsScripts() { - checkFileExists "$CAF_CONFIG_DIR/../scripts/startTestProc" - checkFileExists "$CAF_CONFIG_DIR/../scripts/caf-processes.sh" - checkFileExists "$CAF_CONFIG_DIR/../scripts/stop-ma" - checkFileExists "$CAF_CONFIG_DIR/../scripts/vgAuth" - checkFileExists "$CAF_CONFIG_DIR/../scripts/start-listener" - checkFileExists "$CAF_CONFIG_DIR/../scripts/stop-VGAuthService" - checkFileExists "$CAF_CONFIG_DIR/../scripts/start-ma" - checkFileExists "$CAF_CONFIG_DIR/../scripts/setUpVgAuth" - checkFileExists "$CAF_CONFIG_DIR/../scripts/start-VGAuthService" - checkFileExists "$CAF_CONFIG_DIR/../scripts/tearDownVgAuth" - checkFileExists "$CAF_CONFIG_DIR/../scripts/stop-listener" - checkFileExists "$CAF_CONFIG_DIR/../scripts/caf-common" -} - -function checkFileExistsInstall() { - checkFileExists "$CAF_CONFIG_DIR/../install/caf-dbg.sh" - checkFileExists "$CAF_CONFIG_DIR/../install/stopAndRemoveServices.sh" - checkFileExists "$CAF_CONFIG_DIR/../install/preuninstall.sh" - checkFileExists "$CAF_CONFIG_DIR/../install/postinstallUpgrade.sh" - checkFileExists "$CAF_CONFIG_DIR/../install/install.sh" - checkFileExists "$CAF_CONFIG_DIR/../install/preremoveUninstall.sh" - checkFileExists "$CAF_CONFIG_DIR/../install/preupgrade.sh" - checkFileExists "$CAF_CONFIG_DIR/../install/restartServices.sh" - checkFileExists "$CAF_CONFIG_DIR/../install/caf-vgauth" - checkFileExists "$CAF_CONFIG_DIR/../install/preinstallUpgrade.sh" - checkFileExists "$CAF_CONFIG_DIR/../install/caf-c-management-agent" - checkFileExists "$CAF_CONFIG_DIR/../install/upgrade.sh" - checkFileExists "$CAF_CONFIG_DIR/../install/commonenv.sh" - checkFileExists "$CAF_CONFIG_DIR/../install/postinstallInstall.sh" - checkFileExists "$CAF_CONFIG_DIR/../install/caf-c-communication-service" -} - -function checkFileExistsInvokers() { - checkFileExists "$CAF_INVOKERS_DIR/caf_RemoteCommandProvider_1_0_0.sh" - checkFileExists "$CAF_INVOKERS_DIR/caf_InstallProvider_1_0_0.sh" - checkFileExists "$CAF_INVOKERS_DIR/caf_ConfigProvider_1_0_0.sh" - checkFileExists "$CAF_INVOKERS_DIR/cafTestInfra_CafTestInfraProvider_1_0_0.sh" -} - -function checkFileExistsProviderReg() { - checkFileExists "$CAF_INPUT_DIR/providerReg/caf_RemoteCommandProvider_1_0_0.xml" - checkFileExists "$CAF_INPUT_DIR/providerReg/cafTestInfra_CafTestInfraProvider_1_0_0.xml" - checkFileExists "$CAF_INPUT_DIR/providerReg/caf_ConfigProvider_1_0_0.xml" - checkFileExists "$CAF_INPUT_DIR/providerReg/caf_InstallProvider_1_0_0.xml" -} - -function checkFileExists() { - local path="$1" - validateNotEmpty "$path" "path" - - if [ ! -f "$path" ]; then - echo "*** File existence check failed - expected: $path" - exit 1 - fi -} - -function getAmqpQueueName() { - grep "^reactive_request_amqp_queue_id" "$CAF_CONFIG_DIR/persistence-appconfig" | cut -d'=' -f2 -} - -if [ $# -lt 1 -o "$1" = "--help" ]; then - prtHelp - exit 1 -fi - -cmd=$1 -shift - -installDir=$(dirname $(readlink -f $0)) -scriptsDir=$installDir/../scripts -configDir=$installDir/../config - -. $scriptsDir/caf-common -sourceCafenv "$configDir" - -case "$cmd" in - "validateXml") - validateXml "fx" "CafInstallRequest" - validateXml "fx" "DiagRequest" - validateXml "fx" "Message" - validateXml "fx" "MgmtRequest" - validateXml "fx" "MultiPmeMgmtRequest" - validateXml "fx" "ProviderInfra" - validateXml "fx" "ProviderRequest" - validateXml "fx" "Response" - validateXml "cmdl" "ProviderResults" - ;; - "checkCerts") - checkCerts "$certDir" - ;; - "prtCerts") - prtCerts "$certDir" - ;; - "checkTunnel") - checkTunnel "$certDir" - ;; - "checkVmwTools") - checkVmwTools - ;; - "getAmqpQueueName") - getAmqpQueueName - ;; - "clearCaches") - clearCaches - ;; - "configAmqp") - configAmqp "$1" "$2" "$3" - ;; - "enableCaf") - enableCaf "$1" "$2" - ;; - "setBroker") - setBroker "$1" - ;; - "setListenerConfigured") - setListenerConfigured - ;; - "setListenerStartupType") - setListenerStartupType "$1" - ;; - "validateInstall") - validateInstall - ;; - "validateOVTInstall") - validateInstall "true" - ;; - *) - echo "Bad command - $cmd" - prtHelp - exit 1 -esac diff --git a/open-vm-tools/common-agent/etc/install/caf-vgauth b/open-vm-tools/common-agent/etc/install/caf-vgauth deleted file mode 100644 index 988a83730..000000000 --- a/open-vm-tools/common-agent/etc/install/caf-vgauth +++ /dev/null @@ -1,81 +0,0 @@ -#!/bin/bash -# -# Init file for the VMware CAF VgAuth Service -# -# chkconfig: 35 95 20 -# description: VMware Common Agent Framework VgAuth daemon -# -# processname: VGAuthService - -if [ -f /etc/rc.d/init.d/functions ]; then - . /etc/rc.d/init.d/functions -elif [ -f /lib/lsb/init-functions ]; then - . /lib/lsb/init-functions - type success >/dev/null 2>/dev/null - if [ $? -ne 0 ]; then - success() { - echo -en "$@" - echo -e "$rc_done" - } - failure() { - echo -en "$@" - echo -e "$rc_failed" - } - fi -fi - -progName="VMware CAF VgAuth" -listenerName=VGAuthService -prog="@binDir@/$listenerName" -startScript="@scriptDir@/start-VGAuthService" -stopScript="@scriptDir@/stop-VGAuthService" -lockFile=/var/lock/subsys/caf-vgauth-service - -start() -{ - [ -x $startScript ] || exit 0 - echo -n $"Starting $progName:" - msg="$progBase daemon startup" - "$startScript" && success "$msg" || failure "$msg" - rc=$? - [ $rc -eq 0 ] && touch $lockFile - echo - return $rc -} - -stop() -{ - echo -n $"Stoppping $progName:" - killproc $prog -TERM - rc=$? - [ -x $stopScript ] && $stopScript && - [ $rc -ne 0 ] && [ -z "`pidof -x $prog`" ] && rc=0 - [ $rc -eq 0 ] && rm -f $lockFile - echo - return $rc -} - -restart() -{ - stop - sleep 2 - start -} - -condrestart() -{ - [ -e $lockFile ] && restart || : -} - -case "$1" in - start) start ;; - stop) stop ;; - status) status $prog ;; - restart) restart ;; - condrestart) condrestart ;; - *) - echo $"Usage: $0 {start|stop|status|condrestart|restart}" - exit 1 -esac - -exit $? diff --git a/open-vm-tools/common-agent/etc/install/commonenv.sh b/open-vm-tools/common-agent/etc/install/commonenv.sh deleted file mode 100644 index 5e31b5de9..000000000 --- a/open-vm-tools/common-agent/etc/install/commonenv.sh +++ /dev/null @@ -1 +0,0 @@ -cafServices="caf-c-communication-service caf-c-management-agent" diff --git a/open-vm-tools/common-agent/etc/install/install.sh b/open-vm-tools/common-agent/etc/install/install.sh deleted file mode 100644 index 1086bf371..000000000 --- a/open-vm-tools/common-agent/etc/install/install.sh +++ /dev/null @@ -1,211 +0,0 @@ -#!/bin/sh - -# Copyright (C) 2017 VMware, Inc. All rights reserved. -- VMware Confidential - -#Args -#brokerAddr -# - default: -#baseLibDir -# - default: /usr/lib -# - expand to "$baseLibDir"/vmware-caf/pme -# -#baseInputDir -# - default: /var/lib -# - expand to "$baseInputDir"/vmware-caf/pme/data/input -# -#baseOutputDir -# - default: /var/lib -# - expand to "$baseOutputDir"/vmware-caf/pme/data/output - -#Standard env -SCRIPT=`basename "$0"` - -#Set defaults -baseLibDir='/usr/lib' -baseBinDir='/usr/lib' -baseInputDir='/var/lib' -baseOutputDir='/var/lib' -brokerAddr='#brokerAddr#' -linkSo='yes' -toolsLibDir='/usr/lib/vmware-tools/lib' # lib is symlink to either lib64 or lib32 -cafInstallMode='standalone' - -#Help function -HELP() { - echo -e \\n"Help documentation for ${SCRIPT}."\\n - echo -e "Basic usage: $SCRIPT"\\n - echo "Command line switches are optional. The following switches are recognized." - echo "b --Sets the value for the broker address. Default is '$brokerAddr'." - echo "i --Sets the base location for the input data. Default is '$baseInputDir'." - echo "l --Sets the base location for the libraries. Default is '$baseLibDir'." - echo "B --Sets the location for the binaries. Default is '$baseLibDir'/bin or 'bin' in base location of libraries." - echo "o --Sets the base location for the output data. Default is '$baseOutputDir'." - echo "L --Do not create symlinks for libraries." - echo "t --Sets the location for the tools lib dir. Default is '$toolsLibDir'." - echo -e "h --Displays this help message. No further functions are performed."\\n - echo -e "Example: $SCRIPT -b 10.25.91.81 -i \"/usr/lib\" -i \"/var/lib\" -o \"/var/lib\""\\n - exit 1 -} - -#Replace tokens with install values -setupCafConfig() { - local pattern="$1" - local value="$2" - local rconfigDir="$3" - local key="$4" ## Add the key if not exists - - if [ ! -n "$pattern" ]; then - echo 'The pattern cannot be empty!' - exit 1 - fi - if [ -n "$value" ]; then - if [ ! -f "$rconfigDir/cafenv-appconfig" ]; then - echo "The config file must exist! - $rconfigDir/cafenv-appconfig" - exit 1 - fi - if [ -n "$key" -a `grep -c -E "^$key=" "$rconfigDir/cafenv-appconfig"` -eq 0 ]; then - echo >> "$rconfigDir" - echo "$key=$value" >> "$rconfigDir/cafenv-appconfig" - fi - sed -i "s?$pattern?$value?g" "$rconfigDir/cafenv-appconfig" - fi -} - -##BEGIN Main - -#Get Optional overrides -while getopts ":b:i:l:B:o:t:hL" opt; do - case $opt in - b) - brokerAddr="$OPTARG" - ;; - i) - baseInputDir="$OPTARG" - ;; - l) - baseLibDir="$OPTARG" - ;; - B) - baseBinDir="$OPTARG" - ;; - o) - baseOutputDir="$OPTARG" - ;; - t) - toolsLibDir="$OPTARG" - cafInstallMode='tools' - ;; - L) - linkSo='no' - ;; - h) - HELP - ;; - \?) - echo "Invalid option: -$OPTARG" >&2 - HELP - ;; - esac -done - -stdQuals="vmware-caf/pme" - -libDir="${D}/$baseLibDir/$stdQuals/lib" -binDir="${D}/$baseBinDir/$stdQuals/bin" -inputDir="${D}/$baseInputDir/$stdQuals/data/input" -outputDir="${D}/$baseOutputDir/$stdQuals/data/output" - -providersDir="$inputDir/providers" -invokersDir="$inputDir/invokers" -amqpBrokerDir="$inputDir/persistence/protocol/amqpBroker_default" - -logDir="${D}/var/log/$stdQuals" - -baseEtcDir="${D}/etc/$stdQuals" -configDir="$baseEtcDir/config" -installDir="$baseEtcDir/install" -scriptDir="$baseEtcDir/scripts" - -mkdir -p "$amqpBrokerDir" -echo -n "amqp:#amqpUsername#:#amqpPassword#@${brokerAddr}:5672/reactiveRequestAmqpQueueId" > "$amqpBrokerDir/uri_amqp.txt" -echo -n "tunnel:agentId1:bogus@localhost:6672/reactiveRequestAmqpQueueId" > "$amqpBrokerDir/uri_tunnel.txt" - -#Substitute values into config files -setupCafConfig '@installDir@' "$installDir" "$configDir" -setupCafConfig '@libDir@' "$libDir" "$configDir" -setupCafConfig '@binDir@' "$binDir" "$configDir" -setupCafConfig '@configDir@' "$configDir" "$configDir" -setupCafConfig '@inputDir@' "$inputDir" "$configDir" -setupCafConfig '@outputDir@' "$outputDir" "$configDir" -setupCafConfig '@providersDir@' "$providersDir" "$configDir" -setupCafConfig '@invokersDir@' "$invokersDir" "$configDir" -setupCafConfig '@logDir@' "$logDir" "$configDir" -setupCafConfig '@toolsLibDir@' "$toolsLibDir" "$configDir" 'tools_lib_dir' -setupCafConfig '@cafInstallMode@' "$cafInstallMode" "$configDir" 'install_mode' - -#Set default permissions -if [ -d "$libDir" ]; then - for directory in $(find "$libDir" -type d); do - chmod 755 "$directory" - done - - for file in $(find "$libDir" -type f); do - chmod 555 "$file" - done -fi - -if [ -d "$inputDir" ]; then - for file in $(find "$inputDir" -type f); do - chmod 644 "$file" - done - - if [ -d "$persistenceDir" ]; then - for file in $(find "$persistenceDir" -type f); do - chmod 440 "$file" - done - fi - - if [ -d "$invokersDir" ]; then - for file in $(find "$invokersDir" -type f); do - chmod 555 "$file" - done - fi -fi - -if [ -d "$scriptDir" ]; then - chmod 555 "$scriptDir"/* -fi - - -#Set up links only in case of CAF Standalone mode -if [ "$linkSo" != "no" ] ; then - cd "$libDir" - if [ "$cafInstallMode" = "standalone" ]; then - ln -sf libglib-2.0.so.0.4800.1 libglib-2.0.so - ln -sf libglib-2.0.so.0.4800.1 libglib-2.0.so.0 - ln -sf libgthread-2.0.so.0.4800.1 libgthread-2.0.so - ln -sf libgthread-2.0.so.0.4800.1 libgthread-2.0.so.0 - ln -sf libpcre.so.1.2.6 libpcre.so - ln -sf libpcre.so.1.2.6 libpcre.so.1 - ln -sf libiconv.so.2.5.1 libiconv.so - ln -sf libiconv.so.2.5.1 libiconv.so.2 - ln -sf libz.so.1.2.8 libz.so - ln -sf libz.so.1.2.8 libz.so.1 - ln -sf libffi.so.6.0.4 libffi.so - ln -sf libffi.so.6.0.4 libffi.so.6 - fi - ln -sf liblog4cpp.so.5.0.6 liblog4cpp.so - ln -sf liblog4cpp.so.5.0.6 liblog4cpp.so.5 - ln -sf librabbitmq.so.4.2.1 librabbitmq.so - ln -sf librabbitmq.so.4.2.1 librabbitmq.so.4 -fi - -#Run provider install logic -installPProviders="$installDir/installPythonProviders.sh" -if [ -e "$installPProviders" ]; then - "$installPProviders" -fi - -#if previous CAF installation - #migrate config - #migrate other state diff --git a/open-vm-tools/common-agent/etc/install/postinstallInstall.sh b/open-vm-tools/common-agent/etc/install/postinstallInstall.sh deleted file mode 100644 index 974c5de28..000000000 --- a/open-vm-tools/common-agent/etc/install/postinstallInstall.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -installDir=$(dirname $(readlink -f $0)) -scriptsDir=$installDir/../scripts - -$installDir/install.sh -l /usr/lib -i /var/lib -o /var/lib -$scriptsDir/start-ma diff --git a/open-vm-tools/common-agent/etc/install/postinstallUpgrade.sh b/open-vm-tools/common-agent/etc/install/postinstallUpgrade.sh deleted file mode 100644 index 42a3aa8a4..000000000 --- a/open-vm-tools/common-agent/etc/install/postinstallUpgrade.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -installDir=$(dirname $(readlink -f $0)) -scriptsDir=$installDir/../scripts - -$installDir/upgrade.sh -$scriptsDir/start-ma diff --git a/open-vm-tools/common-agent/etc/install/preconfigure-listener.sh b/open-vm-tools/common-agent/etc/install/preconfigure-listener.sh deleted file mode 100644 index 75d49b6bf..000000000 --- a/open-vm-tools/common-agent/etc/install/preconfigure-listener.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/sh - -#Standard env -SCRIPT=`basename "$0"` - -installDir=$(dirname $(readlink -f $0)) -scriptsDir=$installDir/../scripts -configDir=$installDir/../config - -set_caf_pme_paths() -{ - PATH=$PATH:$installDir:$scriptsDir - PERSISTENCE_DIR=${CAF_INPUT_DIR}/persistence - CERTS_DIR=${CERTS_DIR:-'/etc/vmware-tools/GuestProxyData/server'} -} - -configure_caf_common() -{ - mkdir -p ${PERSISTENCE_DIR}/local - mkdir -p ${PERSISTENCE_DIR}/remote/remote_default/cmsCertCollection - mkdir -p ${PERSISTENCE_DIR}/protocol/amqpBroker_default/tlsCertCollection - mkdir -p ${PERSISTENCE_DIR}/protocol/amqpBroker_default/tlsCipherCollection/ - - echo "amqpBroker_default" > ${PERSISTENCE_DIR}/remote/remote_default/protocolName.txt - echo "remote_default" > ${PERSISTENCE_DIR}/remote/remote_default/remoteId.txt - echo "des-ede3-cbc" > ${PERSISTENCE_DIR}/remote/remote_default/cmsCipherName.txt - - echo "SRP-RSA-AES-128-CBC-SHA" > ${PERSISTENCE_DIR}/protocol/amqpBroker_default/tlsCipherCollection/tlsCipher0.txt - echo "amqpBroker_default" > ${PERSISTENCE_DIR}/protocol/amqpBroker_default/protocolName.txt - echo "TLSv1" > ${PERSISTENCE_DIR}/protocol/amqpBroker_default/tlsProtocol.txt - - cp -rf ${CERTS_DIR}/cert.pem ${PERSISTENCE_DIR}/local/cert.pem - cp -rf ${CERTS_DIR}/key.pem ${PERSISTENCE_DIR}/local/privateKey.pem - - cp -rf ${CERTS_DIR}/cert.pem ${PERSISTENCE_DIR}/protocol/amqpBroker_default/tlsCert.pem - cp -rf ${CERTS_DIR}/cert.pem ${PERSISTENCE_DIR}/protocol/amqpBroker_default/tlsCertCollection/tlsCert0.pem - - cp -rf ${CERTS_DIR}/cert.pem ${PERSISTENCE_DIR}/remote/remote_default/cmsCertCollection/cmsCert0.pem - cp -rf ${CERTS_DIR}/cert.pem ${PERSISTENCE_DIR}/remote/remote_default/cmsCert.pem - - /usr/bin/vmware-guestproxycerttool -a ${PERSISTENCE_DIR}/local/cert.pem - /usr/bin/vmware-guestproxycerttool -a ${PERSISTENCE_DIR}/protocol/amqpBroker_default/tlsCert.pem - /usr/bin/vmware-guestproxycerttool -a ${PERSISTENCE_DIR}/protocol/amqpBroker_default/tlsCertCollection/tlsCert0.pem - -} - -##============================================================================= -## Main -##============================================================================= -. $scriptsDir/caf-common -sourceCafenv "$configDir" - -set_caf_pme_paths -configure_caf_common - -#echo QUIT | openssl s_client -connect localhost:6672 -cert ${CERTS_DIR}/cert.pem -key ${CERTS_DIR}/key.pem -CAfile ${CERTS_DIR}/cert.pem -tls1_2 -#echo QUIT | openssl s_client -connect localhost:6672 -cert ${CERTS_DIR}/cert.pem -key ${CERTS_DIR}/key.pem -CAfile ${CERTS_DIR}/cert.pem -tls1_2 - -echo -n true - diff --git a/open-vm-tools/common-agent/etc/install/preinstallUpgrade.sh b/open-vm-tools/common-agent/etc/install/preinstallUpgrade.sh deleted file mode 100644 index 87076a6b2..000000000 --- a/open-vm-tools/common-agent/etc/install/preinstallUpgrade.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -installDir=$(dirname $(readlink -f $0)) -scriptsDir=$installDir/../scripts - -#Shutdown any configured services -$scriptsDir/stop-ma -$scriptsDir/stop-listener -$installDir/preupgrade.sh diff --git a/open-vm-tools/common-agent/etc/install/preremoveUninstall.sh b/open-vm-tools/common-agent/etc/install/preremoveUninstall.sh deleted file mode 100644 index 9eb5eb03b..000000000 --- a/open-vm-tools/common-agent/etc/install/preremoveUninstall.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -installDir=$(dirname $(readlink -f $0)) -scriptsDir=$installDir/../scripts - -$scriptsDir/stop-ma -$scriptsDir/stop-listener diff --git a/open-vm-tools/common-agent/etc/install/preuninstall.sh b/open-vm-tools/common-agent/etc/install/preuninstall.sh deleted file mode 100644 index bfe88c3c2..000000000 --- a/open-vm-tools/common-agent/etc/install/preuninstall.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/sh - -#Get info on how the installation was configured -installDir=$(dirname $(readlink -f $0)) -scriptsDir=$installDir/../scripts -configDir=$installDir/../config - -. $scriptsDir/caf-common -sourceCafenv "$configDir" - -#Set a safety check string -VALIDATE_STRING='vmware-caf' - -safe_rm() { - #Only remove directory paths that contain the validate string - if test "${1#*$VALIDATE_STRING}" != "$1"; then - rm -rf "$1" - fi -} - -#The default of this should be /usr/lib/vmware-caf -#base_binary_dir=$(dirname $(dirname $CAF_BIN_DIR)) -#safe_rm "$base_binary_dir" - -#The default of this should be /var/lib/vmware-caf -#base_data_dir=$(dirname $(dirname $(dirname $CAF_INPUT_DIR))) -#safe_rm "$base_data_dir" - -#The default of this should be /var/log/vmware-caf -base_log_dir=$(dirname $CAF_LOG_DIR) -safe_rm "$base_log_dir" - -#07/21/2015 -#Remove some log files that get put into the CAF bin dir. -#This is a hack until we fix the code to prevent this from happening. -base_binary_dir="$CAF_BIN_DIR" -safe_rm "$base_binary_dir/CommAmqpListener-log4cpp.log" -safe_rm "$base_binary_dir/CommAmqpListener-log4cpp_rolling.log" -safe_rm "$base_binary_dir/ma-log4cpp.log" -safe_rm "$base_binary_dir/ma-log4cpp_rolling.log" diff --git a/open-vm-tools/common-agent/etc/install/preupgrade.sh b/open-vm-tools/common-agent/etc/install/preupgrade.sh deleted file mode 100644 index 26d8d82fe..000000000 --- a/open-vm-tools/common-agent/etc/install/preupgrade.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -# Copyright (C) 2017 VMware, Inc. All rights reserved. -- VMware Confidential - -installDir=$(dirname $(readlink -f $0)) -configDir=$installDir/../config - -#Preserve config -mkdir -p "$configDir"/_previous_ -cp -pf "$configDir"/cafenv-appconfig "$configDir"/_previous_/ 2>/dev/null -cp -pf "$configDir"/cafenv.config "$configDir"/_previous_/cafenv.config 2>/dev/null -cat /tmp/_cafenv-appconfig_ >> "$configDir"/_previous_/cafenv.config - -#Temporary until we remove amqp_username/password -cp -pf "$configDir"/CommAmqpListener-appconfig "$configDir"/_previous_/ 2>/dev/null diff --git a/open-vm-tools/common-agent/etc/install/restartServices.sh b/open-vm-tools/common-agent/etc/install/restartServices.sh deleted file mode 100644 index f7b78acae..000000000 --- a/open-vm-tools/common-agent/etc/install/restartServices.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -dir=$(cd -P -- "$(dirname -- "$0")" && pwd -P) - -. "$dir"/commonenv.sh - -#Stop configured services -for cafService in $cafServices; do - /sbin/chkconfig $cafService - if [ $? -eq 0 ]; then - /sbin/service $cafService restart - fi -done diff --git a/open-vm-tools/common-agent/etc/install/stopAndRemoveServices.sh b/open-vm-tools/common-agent/etc/install/stopAndRemoveServices.sh deleted file mode 100644 index 1c3dbfb85..000000000 --- a/open-vm-tools/common-agent/etc/install/stopAndRemoveServices.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh - -dir=$(cd -P -- "$(dirname -- "$0")" && pwd -P) - -. "$dir"/commonenv.sh - -#Stop configured services -for cafService in $cafServices; do - /sbin/chkconfig $cafService - if [ $? -eq 0 ]; then - /sbin/service $cafService stop - chkconfig --del $cafService - fi -done diff --git a/open-vm-tools/common-agent/etc/install/upgrade.sh b/open-vm-tools/common-agent/etc/install/upgrade.sh deleted file mode 100644 index e0991693d..000000000 --- a/open-vm-tools/common-agent/etc/install/upgrade.sh +++ /dev/null @@ -1,107 +0,0 @@ -#!/bin/sh - -# Copyright (C) 2017 VMware, Inc. All rights reserved. -- VMware Confidential - -#Standard env -SCRIPT=`basename "$0"` - -installDir=$(dirname $(readlink -f $0)) -scriptsDir=$installDir/../scripts -configDir=$installDir/../config -toolsLibDir='/usr/lib/vmware-tools/lib' # lib is symlink to either lib64 or lib32 -cafInstallMode='standalone' - -#Help function -HELP() { - echo -e \\n"Help documentation for ${SCRIPT}."\\n - echo -e "Basic usage: $SCRIPT"\\n - echo "Command line switches are optional. The following switches are recognized." - echo "t --Sets the location for the tools lib dir. Default is '$toolsLibDir'." - echo -e "h --Displays this help message. No further functions are performed."\\n - echo -e "Example: $SCRIPT -t \"/usr/lib/vmware-tools/lib\""\\n - exit 1 -} - - -##BEGIN Main - -#Get Optional overrides -while getopts ":t:h" opt; do - case $opt in - t) - toolsLibDir="$OPTARG" - cafInstallMode='tools' - ;; - h) - HELP - ;; - \?) - echo "Invalid option: -$OPTARG" >&2 - HELP - ;; - esac -done - - -prevCafenvConfig="$configDir/_previous_/cafenv.config" -if [ -f "$prevCafenvConfig" ]; then - echo "Upgrading from a really old version of CAF - $prevCafenvConfig" - . $prevCafenvConfig - - inputDir=$(echo "$CAF_INPUT_DIR" | sed 's:/vmware-caf/pme/data/input::') - outputDir=$(echo "$CAF_OUTPUT_DIR" | sed 's:/vmware-caf/pme/data/output::') - libDir=$(echo "$CAF_LIB_DIR" | sed 's:/vmware-caf/pme/lib::') - binDir=$(echo "$CAF_BIN_DIR" | sed 's:/vmware-caf/pme/bin::') - if [ -n "$CAF_TOOLS_LIB_DIR" ]; then - toolsLibDir="$CAF_TOOLS_LIB_DIR" - fi - $installDir/install.sh -L -b "$CAF_BROKER_ADDRESS" -i "$inputDir" \ - -o "$outputDir" -l "$libDir" -B "$binDir" -t "$toolsLibDir" - - rm -f "$prevCafenvConfig" -else - prevCafenvAppconfig="$configDir/_previous_/cafenv-appconfig" - if [ ! -f "$prevCafenvAppconfig" ]; then - echo "The backup file must exist! - $prevCafenvAppconfig" - exit 1 - fi - mv -f "$prevCafenvAppconfig" "$configDir" -fi - -#Remove the backup directory -rm -rf "$configDir"/_previous_ - -. $scriptsDir/caf-common -sourceCafenv "$configDir" - -# Make newer systemd systems (OpenSuSE 13.2) happy -#if [ -x /usr/bin/systemctl ]; then -# /usr/bin/systemctl daemon-reload -#fi - -#"$dir"/restartServices.sh - -if [ ! -d $CAF_LIB_DIR ]; then - echo "CAF_LIB_DIR not found - $CAF_LIB_DIR" - exit 1 -fi - -cd $CAF_LIB_DIR -if [ "$cafInstallMode" = "standalone" ]; then - ln -sf libglib-2.0.so.0.4800.1 libglib-2.0.so - ln -sf libglib-2.0.so.0.4800.1 libglib-2.0.so.0 - ln -sf libgthread-2.0.so.0.4800.1 libgthread-2.0.so - ln -sf libgthread-2.0.so.0.4800.1 libgthread-2.0.so.0 - ln -sf libpcre.so.1.2.6 libpcre.so - ln -sf libpcre.so.1.2.6 libpcre.so.1 - ln -sf libiconv.so.2.5.1 libiconv.so - ln -sf libiconv.so.2.5.1 libiconv.so.2 - ln -sf libz.so.1.2.8 libz.so - ln -sf libz.so.1.2.8 libz.so.1 - ln -sf libffi.so.6.0.4 libffi.so - ln -sf libffi.so.6.0.4 libffi.so.6 -fi -ln -sf liblog4cpp.so.5.0.6 liblog4cpp.so -ln -sf liblog4cpp.so.5.0.6 liblog4cpp.so.5 -ln -sf librabbitmq.so.4.2.1 librabbitmq.so -ln -sf librabbitmq.so.4.2.1 librabbitmq.so.4 diff --git a/open-vm-tools/common-agent/etc/scripts/Makefile.am b/open-vm-tools/common-agent/etc/scripts/Makefile.am deleted file mode 100644 index 3e66df3cc..000000000 --- a/open-vm-tools/common-agent/etc/scripts/Makefile.am +++ /dev/null @@ -1,35 +0,0 @@ -################################################################################ -### Copyright (C) 2016 VMware, Inc. All rights reserved. -### -### This program is free software; you can redistribute it and/or modify -### it under the terms of version 2 of the GNU General Public License as -### published by the Free Software Foundation. -### -### 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -################################################################################ - -confdir=/etc/vmware-caf/pme/scripts - -conf_SCRIPTS = \ - caf-common \ - caf-processes.sh \ - is-listener-running \ - is-ma-running \ - setUpVgAuth \ - start-listener \ - start-ma \ - startTestProc \ - start-VGAuthService \ - stop-listener \ - stop-ma \ - stop-VGAuthService \ - tearDownVgAuth \ - vgAuth - diff --git a/open-vm-tools/common-agent/etc/scripts/caf-common b/open-vm-tools/common-agent/etc/scripts/caf-common deleted file mode 100644 index 38928fc73..000000000 --- a/open-vm-tools/common-agent/etc/scripts/caf-common +++ /dev/null @@ -1,174 +0,0 @@ -#!/bin/sh - -# Copyright (C) 2017 VMware, Inc. All rights reserved. -- VMware Confidential - -sourceCafenv() { - local configDir=$1 - local cafenvAppconfig="$configDir/cafenv-appconfig" - - if [ ! -f "$cafenvAppconfig" ]; then - echo "*** cafenv-appconfig file not found - $cafenvAppconfig" - exit 1 - fi - - local tmpCafenv="/tmp/_cafenv-appconfig_" - cat "$cafenvAppconfig" | sed 's/^\[/#[/g' | sed 's/^\([a-z].*=\)/export CAF_\U\1/g' > "$tmpCafenv" - sed -i 's/[ ]*=[ ]*/=/g' "$tmpCafenv" - . "$tmpCafenv" - if [ "$CAF_INSTALL_MODE" = "standalone" ]; then - export LD_LIBRARY_PATH=$CAF_LIB_DIR - else - export LD_LIBRARY_PATH="$CAF_TOOLS_LIB_DIR/libvgauth.so/:$CAF_TOOLS_LIB_DIR/libcrypto.so.1.0.2/:$CAF_TOOLS_LIB_DIR/libssl.so.1.0.2/:$CAF_TOOLS_LIB_DIR/libz.so.1/:$CAF_TOOLS_LIB_DIR/libffi.so.6/:$CAF_TOOLS_LIB_DIR/libiconv.so.2/:$CAF_TOOLS_LIB_DIR/libpcre.so.1/:$CAF_TOOLS_LIB_DIR/libglib-2.0.so.0/:$CAF_TOOLS_LIB_DIR/libgcc_s.so.1/:$CAF_TOOLS_LIB_DIR/libgthread-2.0.so.0/:$CAF_TOOLS_LIB_DIR/libstdc++.so.6/:$CAF_LIB_DIR" - fi - export VMWARE_USE_SYSTEM_LIBS=1 -} - -getCurrentDir() { - return $(dirname $(readlink -f $0)) -} - -startCafProcess() { - local startType="$1" - local startDir="$2" - local processDir="$3" - local processName="$4" - - local processPath="$processDir/$processName" - verifyProcessNotRunning "$processPath" - setUtf8Locale - - mkdir -p "$startDir" - cd "$startDir" - - case "$startType" in - "daemon") - $processPath - ;; - "foreground") - $processPath -n - ;; - "valgrindMemChecks") - G_SLICE=always-malloc G_DEBUG=gc-friendly valgrind -v --tool=memcheck --leak-check=full --num-callers=40 --track-origins=yes --leak-resolution=med --track-fds=yes --log-file=${processPath}-valgrind-memchecks.log $processPath -n - ;; - "valgrindProfiling") - valgrind --tool=callgrind --log-file=${processPath}-valgrind-profiling.log $processPath -n - ;; - "valgrindThreading") - valgrind --tool=helgrind --track-lockorders=no --log-file=${processPath}-valgrind-threading.log $processPath -n - ;; - *) - echo "Unknown startType - $startType"; exit 1 - ;; - esac -} - -startVgAuthProcess() { - local startType="$1" - local startDir="$2" - local processDir="$3" - local processName="$4" - - local processPath="$processDir/$processName" - verifyProcessNotRunning "$processPath" - setUtf8Locale - - mkdir -p "$startDir" - cd "$startDir" - - # Run the processes using -s rather than -d if you want the logging to go the file instead of the console - case "$startType" in - "daemon") - # This is supposed to start the service as a daemon, but it's failing... perhaps because the service - # hasn't been registered - see above. - #./$processName -b - - # -s tells it to log to a file, -d to the console - nohup $processPath -s > ${processPath}.out 2>&1 & - ;; - "foreground") - $processPath -d - ;; - "valgrindMemChecks") - G_SLICE=always-malloc G_DEBUG=gc-friendly valgrind -v --tool=memcheck --leak-check=full --show-leak-kinds=all --num-callers=40 --log-file=${processPath}-valgrind.log $processPath -d - ;; - "valgrindProfiling") - valgrind --tool=callgrind $processPath -d - ;; - *) - echo "Unknown startType - $startType"; exit 1 - ;; - esac -} - -#Set the locale to something UTF8 -setUtf8Locale() { - locale_list=`locale | egrep -vi '.utf8|.utf-8|=$|LANGUAGE'` - if [ $? -eq 0 ]; then - echo "The locale is currently set to $LANG, looking for UTF-8" - default_locale=$LANG - available_utf8_locales=`locale -a | egrep -i '.utf8|.utf-8' | egrep -vi '^c.utf'` - if [ ! -z "$available_utf8_locales" ]; then - for loc in $available_utf8_locales; do - best_locale=$loc - is_en_US_locale=`echo $loc | egrep -i 'en_US'` - if [ ! -z $is_en_US_locale ]; then - echo "$loc is the best UTF-8 locale required" - break - fi - done - echo "Using the available UTF-8 locale: $best_locale" - else - echo "No UTF-8 locale found, using the default locale $default_locale" - best_locale=$default_locale - fi - - export LANG=$best_locale - export LANGUAGE=$best_locale - export LC_ALL=$best_locale - - echo "The locale is now successfully set to : $LANG" - - else - echo "The locale is already set to UTF-8 : $LANG" - fi -} - -verifyProcessNotRunning() { - local processPath=$1 - - pid=$(ps aux | egrep "${processPath}" | egrep -v "color=auto|grep" | awk '{print $2}') - if [ ! -z "$pid" ]; then - echo "$processPath is already running - $pid"; exit 0 - fi -} - -stopProcess() { - local processDir=$1 - local processName=$2 - - local processPath="$processDir/$processName" - - pid=$(ps aux | egrep "${processPath}" | egrep -v "color=auto|grep" | awk '{print $2}') - if [ -z "$pid" ]; then - echo "$processPath not found" - else - echo "Stopping $processPath - $pid" - counter=0 - while [ ! -z "$pid" ]; do - if [ $counter -lt 20 ]; then - kill $pid - else - echo "Killing $processPath with prejudice- $pid" - kill -9 $pid - fi - counter=`expr $counter + 1`; - #echo "counter=$counter" - sleep 1 - pid=$(ps aux | egrep "${processPath}" | egrep -v "color=auto|grep" | awk '{print $2}') - done - fi -} - -enableCoreFiles() { - ulimit -c unlimited -} diff --git a/open-vm-tools/common-agent/etc/scripts/caf-processes.sh b/open-vm-tools/common-agent/etc/scripts/caf-processes.sh deleted file mode 100644 index e390e6279..000000000 --- a/open-vm-tools/common-agent/etc/scripts/caf-processes.sh +++ /dev/null @@ -1,191 +0,0 @@ -#!/bin/bash - -function prtHeader() { - local header=$1 - - echo "*************************" - echo "***" - echo "*** $header" - echo "***" - echo "*************************" -} - -function prtHelp() { - echo "*** $0 cmd " - echo " Runs various CAF commands" - echo " cmd: The CAF command to run:" - echo " * listServices Lists the CAF Services" - echo " * startServices Starts the Services" - echo " * stopServices Stops the Services" - echo " * killServices Kills the Services" - echo "" - echo " * startListener Starts the Listener Service" - echo " * startListenerForeground Starts the Listener in the foreground" - echo " * startListenerValgrindMemChecks Starts the Listener with Valgrind Mem Checks" - echo " * stopListener Stops the Listener Service" - echo " * killListener Kills the Listener Service" - echo "" - echo " * startMa Starts the Management Agent Service" - echo " * startMaForeground Starts the Management Agent in the foreground" - echo " * startMaValgrindMemChecks Starts the Management Agent with Valgrind Mem Checks" - echo " * stopMa Stops the Management Agent Service" - echo " * killMa Kills the Management Agent Service" -} - -function startProcess() { - local process="$1" - local enableConsoleLogging="$2" - local cmd="$3" - - case "$process" in - "listener") - if [ -f "$scriptsDir/start-listener" ]; then - prtHeader "Starting Listener - $cmd" - if [ "$enableConsoleLogging" = "true" ]; then - enableConsoleLogging "CommAmqpListener" - else - disableConsoleLogging "CommAmqpListener" - fi - $scriptsDir/start-listener "$cmd" - fi - ;; - "ma") - if [ -f "$scriptsDir/start-ma" ]; then - prtHeader "Starting Management Agent - $cmd" - if [ "$enableConsoleLogging" = "true" ]; then - enableConsoleLogging "ma" - else - disableConsoleLogging "ma" - fi - $scriptsDir/start-ma "$cmd" - fi - ;; - *) - echo "Unknown process - $process" - prtHelp - exit 1 - esac - -} - -function stopListener() { - if [ -f "$scriptsDir/stop-listener" ]; then - $scriptsDir/stop-listener - fi -} - -function stopMa() { - if [ -f "$scriptsDir/stop-ma" ]; then - $scriptsDir/stop-ma - fi -} - -function killListener() { - pid=$(ps -eo pid,cmd | egrep "CommAmqpListener" | egrep -v "egrep" | awk '{print $1}') - if [ "$pid" != "" ]; then - echo "Killing Listener - $pid" - kill -9 $pid - fi -} - -function killMa() { - pid=$(ps -eo pid,cmd | egrep "ManagementAgentHost" | egrep -v "egrep" | awk '{print $1}') - if [ "$pid" != "" ]; then - echo "Killing Management Agent - $pid" - kill -9 $pid - fi -} - -function enableConsoleLogging() { - component="$1" - - sed -i 's/^#log4j.rootCategory=DEBUG, console/log4j.rootCategory=DEBUG, console/g' "$CAF_CONFIG_DIR/${component}-log4cpp_config" - sed -i 's/^log4j.rootCategory=DEBUG, logfile/#log4j.rootCategory=DEBUG, logfile/g' "$CAF_CONFIG_DIR/${component}-log4cpp_config" -} - -function disableConsoleLogging() { - component="$1" - - sed -i 's/^log4j.rootCategory=DEBUG, console/#log4j.rootCategory=DEBUG, console/g' "$CAF_CONFIG_DIR/${component}-log4cpp_config" - sed -i 's/^#log4j.rootCategory=DEBUG, logfile/log4j.rootCategory=DEBUG, logfile/g' "$CAF_CONFIG_DIR/${component}-log4cpp_config" -} - -if [ $# -lt 1 -o "$1" = "--help" ]; then - prtHelp - exit 1 -fi - -cmd=$1 -shift -cmd_params=$@ - -scriptsDir=$(dirname $(readlink -f $0)) -configDir=$scriptsDir/../config - -. $scriptsDir/caf-common -sourceCafenv "$configDir" - -case "$cmd" in - "listServices") - prtHeader "Listing services" - ps -ef | egrep "CommAmqpListener|ManagementAgentHost|VGAuthService" | egrep -v "egrep" - ;; - "startListener") - startProcess "listener" "false" "daemon" - ;; - "startMa") - startProcess "ma" "false" "daemon" - ;; - "startServices") - startProcess "listener" "false" "daemon" - startProcess "ma" "false" "daemon" - ;; - "startListenerForeground") - startProcess "listener" "true" "foreground" - ;; - "startMaForeground") - startProcess "ma" "true" "foreground" - ;; - "startListenerValgrindMemChecks") - startProcess "listener" "true" "valgrindMemChecks" - ;; - "startMaValgrindMemChecks") - startProcess "ma" "true" "valgrindMemChecks" - ;; - "startListenerValgrindProfiling") - startProcess "listener" "true" "valgrindProfiling" - ;; - "startMaValgrindProfiling") - startProcess "ma" "true" "valgrindProfiling" - ;; - "startListenerValgrindThreading") - startProcess "listener" "true" "valgrindThreading" - ;; - "startMaValgrindThreading") - startProcess "ma" "true" "valgrindThreading" - ;; - "stopListener") - stopListener - ;; - "stopMa") - stopMa - ;; - "stopServices") - stopListener - stopMa - ;; - "killListener") - killListener - ;; - "killMa") - killMa - ;; - "killServices") - killListener - killMa - ;; - *) - echo "Bad command - $cmd" - prtHelp - exit 1 -esac diff --git a/open-vm-tools/common-agent/etc/scripts/is-listener-running b/open-vm-tools/common-agent/etc/scripts/is-listener-running deleted file mode 100644 index 008aa4d71..000000000 --- a/open-vm-tools/common-agent/etc/scripts/is-listener-running +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -processName="CommAmqpListener" -pid=$(ps aux | egrep "${processName}" | egrep -v "color=auto|grep" | awk '{print $2}') -if [ -z "$pid" ]; then - printf "false" -else - printf "true" -fi diff --git a/open-vm-tools/common-agent/etc/scripts/is-ma-running b/open-vm-tools/common-agent/etc/scripts/is-ma-running deleted file mode 100644 index fa4a9351b..000000000 --- a/open-vm-tools/common-agent/etc/scripts/is-ma-running +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -processName="ManagementAgentHost" -pid=$(ps aux | egrep "${processName}" | egrep -v "color=auto|grep" | awk '{print $2}') -if [ -z "$pid" ]; then - printf "false" -else - printf "true" -fi diff --git a/open-vm-tools/common-agent/etc/scripts/setUpVgAuth b/open-vm-tools/common-agent/etc/scripts/setUpVgAuth deleted file mode 100644 index 6b548ba41..000000000 --- a/open-vm-tools/common-agent/etc/scripts/setUpVgAuth +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/sh - -helpMessage() { - echo "*** $0 {userName} {certPath} {subject}" - echo " Starts the VgAuth service and optionally adds the user and user->subject mapping" - echo " userName: The name of the user to be added [default: $userName]" - echo " certPath: Path to the certificate [default: $certPath]" - echo " subject: Subject that maps to the userName in the SAML [default: $subject]" - exit 1 -} - -scriptsDir=$(dirname $(readlink -f $0)) -certsDir=$scriptsDir/../data/input/certs - -userName="" -certPath=$certsDir/selfSignedCert.pem -subject="samlTestSubject" - -if [ $# -gt 3 -o "$1" = "--help" ]; then - helpMessage -fi -if [ $# -ge 1 ]; then - userName=$1 -fi -if [ $# -ge 2 ]; then - certPath=$2 -fi -if [ $# -ge 3 ]; then - subject=$3 -fi - -$scriptsDir/start-VGAuthService - -if [ $userName != "" ]; then - /usr/sbin/useradd $userName - - sleep 1 - $scriptsDir/vgAuth addUser $userName $certPath $subject -fi diff --git a/open-vm-tools/common-agent/etc/scripts/start-VGAuthService b/open-vm-tools/common-agent/etc/scripts/start-VGAuthService deleted file mode 100644 index 6480f81ae..000000000 --- a/open-vm-tools/common-agent/etc/scripts/start-VGAuthService +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh - -helpMessage() { - local defStartType=$1 - - echo "*** $0 {startType}" - echo " Starts VgAuth" - echo " startType: How to start the listener (daemon, foreground, valgrindMemChecks, valgrindProfiling) [default: $defStartType]" - exit 1 -} - -startType="daemon" -if [ $# -gt 1 -o "$1" = "--help" ]; then - helpMessage "$startType" -fi -if [ $# -ge 1 ]; then - startType=$1 -fi - -scriptsDir=$(dirname $(readlink -f $0)) -configDir=$scriptsDir/../config - -. $scriptsDir/caf-common -sourceCafenv "$configDir" - -processName="VGAuthService" - -export LD_LIBRARY_PATH=$CAF_ROOT_DIR/lib - -#enableCoreFiles - -startVgAuthProcess "$startType" "$CAF_LOG_DIR" "$CAF_BIN_DIR" "$processName" diff --git a/open-vm-tools/common-agent/etc/scripts/start-listener b/open-vm-tools/common-agent/etc/scripts/start-listener deleted file mode 100644 index 361be3d65..000000000 --- a/open-vm-tools/common-agent/etc/scripts/start-listener +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh - -helpMessage() { - local defStartType=$1 - - echo "*** $0 {startType}" - echo " Starts the listener" - echo " startType: How to start the listener (daemon, foreground, valgrindMemChecks, valgrindProfiling) [default: $defStartType]" - exit 1 -} - -startType="daemon" -if [ $# -gt 1 -o "$1" = "--help" ]; then - helpMessage "$startType" -fi -if [ $# -ge 1 ]; then - startType=$1 -fi - -scriptsDir=$(dirname $(readlink -f $0)) -configDir=$scriptsDir/../config -. $scriptsDir/caf-common -sourceCafenv "$configDir" - -processName="CommAmqpListener" - -#enableCoreFiles - -startCafProcess "$startType" "$CAF_LOG_DIR" "$CAF_BIN_DIR" "$processName" diff --git a/open-vm-tools/common-agent/etc/scripts/start-ma b/open-vm-tools/common-agent/etc/scripts/start-ma deleted file mode 100644 index 788557127..000000000 --- a/open-vm-tools/common-agent/etc/scripts/start-ma +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh - -helpMessage() { - local defStartType=$1 - - echo "*** $0 {startType}" - echo " Starts the Management Agent" - echo " startType: How to start the listener (daemon, foreground, valgrindMemChecks, valgrindProfiling) [default: $defStartType]" - exit 1 -} - -startType="daemon" -if [ $# -gt 1 -o "$1" = "--help" ]; then - helpMessage "$startType" -fi -if [ $# -ge 1 ]; then - startType=$1 -fi - -scriptsDir=$(dirname $(readlink -f $0)) -configDir=$scriptsDir/../config - -. $scriptsDir/caf-common -sourceCafenv "$configDir" - -processName="ManagementAgentHost" - -#enableCoreFiles - -startCafProcess "$startType" "$CAF_LOG_DIR" "$CAF_BIN_DIR" "$processName" diff --git a/open-vm-tools/common-agent/etc/scripts/startTestProc b/open-vm-tools/common-agent/etc/scripts/startTestProc deleted file mode 100644 index ab2256a89..000000000 --- a/open-vm-tools/common-agent/etc/scripts/startTestProc +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -echo $$ -while true; do - sleep 1000 -done diff --git a/open-vm-tools/common-agent/etc/scripts/stop-VGAuthService b/open-vm-tools/common-agent/etc/scripts/stop-VGAuthService deleted file mode 100644 index 7b9b671fb..000000000 --- a/open-vm-tools/common-agent/etc/scripts/stop-VGAuthService +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -scriptsDir=$(dirname $(readlink -f $0)) -. $scriptsDir/caf-common - -processName="VGAuthService" -stopProcess "$processName" diff --git a/open-vm-tools/common-agent/etc/scripts/stop-listener b/open-vm-tools/common-agent/etc/scripts/stop-listener deleted file mode 100644 index aadb2bc95..000000000 --- a/open-vm-tools/common-agent/etc/scripts/stop-listener +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -scriptsDir=$(dirname $(readlink -f $0)) -configDir=$scriptsDir/../config -. $scriptsDir/caf-common -sourceCafenv "$configDir" - -processName="CommAmqpListener" -stopProcess "$CAF_BIN_DIR" "$processName" diff --git a/open-vm-tools/common-agent/etc/scripts/stop-ma b/open-vm-tools/common-agent/etc/scripts/stop-ma deleted file mode 100644 index 24b50ce82..000000000 --- a/open-vm-tools/common-agent/etc/scripts/stop-ma +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -scriptsDir=$(dirname $(readlink -f $0)) -configDir=$scriptsDir/../config - -. $scriptsDir/caf-common -sourceCafenv "$configDir" - -processName="ManagementAgentHost" -stopProcess "$CAF_BIN_DIR" "$processName" diff --git a/open-vm-tools/common-agent/etc/scripts/tearDownVgAuth b/open-vm-tools/common-agent/etc/scripts/tearDownVgAuth deleted file mode 100644 index 92f5e63f4..000000000 --- a/open-vm-tools/common-agent/etc/scripts/tearDownVgAuth +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash - -helpMessage() { - echo "*** $0 {userName} {certPath} {subject}" - echo " Stops the VgAuth service and optionally removes the user and user->subject mapping" - echo " userName: The name of the user to be removed [default: $userName]" - echo " certPath: Path to the certificate [default: $certPath]" - echo " subject: Subject that maps to the userName in the SAML [default: $subject]" - exit 1 -} - -scriptsDir=$(dirname $(readlink -f $0)) -certsDir=$scriptsDir/../data/input/certs - -userName="" -certPath=$certsDir/selfSignedCert.pem -subject="samlTestSubject" - -if [ $# -gt 3 -o "$1" = "--help" ]; then - helpMessage -fi -if [ $# -ge 1 ]; then - userName=$1 -fi -if [ $# -ge 2 ]; then - certPath=$2 -fi -if [ $# -ge 3 ]; then - subject=$3 -fi - -if [ $userName != "" ]; then - $scriptsDir/vgAuth removeUser $userName $certPath $subject - - sleep 1 - /usr/sbin/userdel -r $userName -fi - -$scriptsDir/stop-VGAuthService diff --git a/open-vm-tools/common-agent/etc/scripts/vgAuth b/open-vm-tools/common-agent/etc/scripts/vgAuth deleted file mode 100644 index b1b6d8248..000000000 --- a/open-vm-tools/common-agent/etc/scripts/vgAuth +++ /dev/null @@ -1,82 +0,0 @@ -#!/bin/bash - -helpMessage() { - echo "*** $0 Action {Username} {CertPath} {Subject}" - echo " Manages the VGAuth alias store" - echo " Action: help, addUser, removeUser, listAll, listUser" - echo " Username: The name of the user to add to the alias store [default: $username]" - echo " CertPath: Path to the cert [default: $cert]" - echo " Subject: Subject of the cert [default: $subject]" - exit 1 -} - -scriptsDir=$(dirname $(readlink -f $0)) -configDir=$scriptsDir/../config - -. $scriptsDir/caf-common -sourceCafenv "$configDir" - -vgAuthCliName=vmware-vgauth-cmd -if [ -f /usr/lib/vmware-vgauth/$vgAuthCliName ]; then - vgAuthCliPath=/usr/lib/vmware-vgauth/$vgAuthCliName -else - if [ -f $CAF_BIN_DIR/$vgAuthCliName ]; then - vgAuthCliPath=$CAF_BIN_DIR/$vgAuthCliName - export LD_LIBRARY_PATH=$CAF_LIB_DIR - else - echo "*** $vgAuthCliName not found" - exit 1 - fi -fi - -action=$1 -username="testuser" -cert=$CAF_INPUT_DIR/certs/selfSignedCert.pem -subject="samlTestSubject" - -if [ $# -lt 1 -o $# -gt 4 -o "$1" = "--help" ]; then - helpMessage -fi -if [ $# -ge 2 ]; then - username=$2 -fi -if [ $# -ge 3 ]; then - cert=$3 -fi -if [ $# -ge 4 ]; then - subject=$4 -fi - -case "$action" in - "addUser") - userLineCnt=$($vgAuthCli list --username=$username | wc -l) - if [ $userLineCnt = 0 ]; then - echo "*** Addding $username ***" - $vgAuthCli add --global --username=$username --file $cert --subject=$subject - else - echo "*** User already exists... Doing nothing - $username" - fi - ;; - "removeUser") - userLineCnt=$($vgAuthCli list --username=$username | wc -l) - if [ $userLineCnt = 0 ]; then - echo "*** User already gone... Doing nothing - $username" - else - echo "*** Removing $username ***" - $vgAuthCli remove --username=$username --file $cert --subject=$subject - fi - ;; - "listAll") - $vgAuthCli list - ;; - "listUser") - echo "*** Listing $username ***" - $vgAuthCli list --username=$username - ;; - "help") - helpMessage - ;; - *) - helpMessage - ;; -esac diff --git a/open-vm-tools/common-agent/input/Makefile.am b/open-vm-tools/common-agent/input/Makefile.am deleted file mode 100644 index c56518d32..000000000 --- a/open-vm-tools/common-agent/input/Makefile.am +++ /dev/null @@ -1,23 +0,0 @@ -################################################################################ -### Copyright (C) 2016 VMware, Inc. All rights reserved. -### -### This program is free software; you can redistribute it and/or modify -### it under the terms of version 2 of the GNU General Public License as -### published by the Free Software Foundation. -### -### 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -################################################################################ - -confdir=/var/vmware-caf/pme/data/input - -conf_SCRIPTS = \ - installProviderHeader.sh - -SUBDIRS = invokers providerReg diff --git a/open-vm-tools/common-agent/input/installProviderHeader.sh b/open-vm-tools/common-agent/input/installProviderHeader.sh deleted file mode 100644 index 08b085fc4..000000000 --- a/open-vm-tools/common-agent/input/installProviderHeader.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -export CAF_TMP_DIR=$CAF_OUTPUT_DIR/tmp -export CAF_INPUT_DIR=$CAF_INPUT_DIR -export CAF_OUTPUT_DIR=$CAF_OUTPUT_DIR -export CAF_PROVIDERREG_DIR=$CAF_OUTPUT_DIR/providerReg -export CAF_INVOKERS_DIR=$CAF_OUTPUT_DIR/invokers -export CAF_PROVIDERS_DIR=$CAF_OUTPUT_DIR/providers -export CAF_COMMONPACKAGES_DIR=$CAF_OUTPUT_DIR/commonPackages diff --git a/open-vm-tools/common-agent/input/invokers/Makefile.am b/open-vm-tools/common-agent/input/invokers/Makefile.am deleted file mode 100644 index 6998c3be9..000000000 --- a/open-vm-tools/common-agent/input/invokers/Makefile.am +++ /dev/null @@ -1,24 +0,0 @@ -################################################################################ -### Copyright (C) 2016 VMware, Inc. All rights reserved. -### -### This program is free software; you can redistribute it and/or modify -### it under the terms of version 2 of the GNU General Public License as -### published by the Free Software Foundation. -### -### 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -################################################################################ - -confdir=/var/vmware-caf/pme/data/input/invokers - -conf_SCRIPTS = \ - caf_ConfigProvider_1_0_0.sh \ - caf_InstallProvider_1_0_0.sh \ - caf_RemoteCommandProvider_1_0_0.sh \ - cafTestInfra_CafTestInfraProvider_1_0_0.sh diff --git a/open-vm-tools/common-agent/input/invokers/cafTestInfra_CafTestInfraProvider_1_0_0.sh b/open-vm-tools/common-agent/input/invokers/cafTestInfra_CafTestInfraProvider_1_0_0.sh deleted file mode 100644 index 43b0db966..000000000 --- a/open-vm-tools/common-agent/input/invokers/cafTestInfra_CafTestInfraProvider_1_0_0.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CAF_LIB_DIR -$CAF_BIN_DIR/TestInfraProvider $* diff --git a/open-vm-tools/common-agent/input/invokers/caf_ConfigProvider_1_0_0.sh b/open-vm-tools/common-agent/input/invokers/caf_ConfigProvider_1_0_0.sh deleted file mode 100644 index fb75d8fb2..000000000 --- a/open-vm-tools/common-agent/input/invokers/caf_ConfigProvider_1_0_0.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CAF_LIB_DIR -$CAF_BIN_DIR/ConfigProvider $* diff --git a/open-vm-tools/common-agent/input/invokers/caf_InstallProvider_1_0_0.sh b/open-vm-tools/common-agent/input/invokers/caf_InstallProvider_1_0_0.sh deleted file mode 100644 index 14ab9ba8a..000000000 --- a/open-vm-tools/common-agent/input/invokers/caf_InstallProvider_1_0_0.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CAF_LIB_DIR -$CAF_BIN_DIR/InstallProvider $* diff --git a/open-vm-tools/common-agent/input/invokers/caf_RemoteCommandProvider_1_0_0.sh b/open-vm-tools/common-agent/input/invokers/caf_RemoteCommandProvider_1_0_0.sh deleted file mode 100644 index 050683458..000000000 --- a/open-vm-tools/common-agent/input/invokers/caf_RemoteCommandProvider_1_0_0.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CAF_LIB_DIR -$CAF_BIN_DIR/RemoteCommandProvider $* diff --git a/open-vm-tools/common-agent/input/providerReg/Makefile.am b/open-vm-tools/common-agent/input/providerReg/Makefile.am deleted file mode 100644 index 64607e365..000000000 --- a/open-vm-tools/common-agent/input/providerReg/Makefile.am +++ /dev/null @@ -1,24 +0,0 @@ -################################################################################ -### Copyright (C) 2016 VMware, Inc. All rights reserved. -### -### This program is free software; you can redistribute it and/or modify -### it under the terms of version 2 of the GNU General Public License as -### published by the Free Software Foundation. -### -### 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -################################################################################ - -confdir=/var/vmware-caf/pme/data/input/providerReg - -conf_DATA = \ - caf_ConfigProvider_1_0_0.xml \ - caf_InstallProvider_1_0_0.xml \ - caf_RemoteCommandProvider_1_0_0.xml \ - cafTestInfra_CafTestInfraProvider_1_0_0.xml diff --git a/open-vm-tools/common-agent/input/providerReg/cafTestInfra_CafTestInfraProvider_1_0_0.xml b/open-vm-tools/common-agent/input/providerReg/cafTestInfra_CafTestInfraProvider_1_0_0.xml deleted file mode 100644 index 049a680bb..000000000 --- a/open-vm-tools/common-agent/input/providerReg/cafTestInfra_CafTestInfraProvider_1_0_0.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - diff --git a/open-vm-tools/common-agent/input/providerReg/caf_ConfigProvider_1_0_0.xml b/open-vm-tools/common-agent/input/providerReg/caf_ConfigProvider_1_0_0.xml deleted file mode 100644 index 49f96e6c3..000000000 --- a/open-vm-tools/common-agent/input/providerReg/caf_ConfigProvider_1_0_0.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - diff --git a/open-vm-tools/common-agent/input/providerReg/caf_InstallProvider_1_0_0.xml b/open-vm-tools/common-agent/input/providerReg/caf_InstallProvider_1_0_0.xml deleted file mode 100644 index 291b9c622..000000000 --- a/open-vm-tools/common-agent/input/providerReg/caf_InstallProvider_1_0_0.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - diff --git a/open-vm-tools/common-agent/input/providerReg/caf_RemoteCommandProvider_1_0_0.xml b/open-vm-tools/common-agent/input/providerReg/caf_RemoteCommandProvider_1_0_0.xml deleted file mode 100644 index 094bcdbe1..000000000 --- a/open-vm-tools/common-agent/input/providerReg/caf_RemoteCommandProvider_1_0_0.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - diff --git a/open-vm-tools/configure.ac b/open-vm-tools/configure.ac index 7a0667908..6b13e578a 100644 --- a/open-vm-tools/configure.ac +++ b/open-vm-tools/configure.ac @@ -538,26 +538,16 @@ AC_ARG_ENABLE([xmlsecurity], ], []) -if test "$enable_vgauth" = "yes" ; then - AC_ARG_ENABLE([caf], - [AS_HELP_STRING([--disable-caf], - [do not build CAF (Common Agent Framework).])], - [], - [enable_caf=no]) -else - enable_caf=no -fi # # Check for openssl, xerces-c and xml-security-c # AC_ARG_WITH([ssl], [AS_HELP_STRING([--without-ssl], - [compiles without openssl support (disables grabbitmqproxy, vgauth and CAF).])], + [compiles without openssl support (disables grabbitmqproxy and vgauth).])], [ enable_grabbitmqproxy=no enable_vgauth=no - enable_caf=no ], [with_ssl=yes]) @@ -658,8 +648,6 @@ if test "$enable_vgauth" = "yes"; then [], [AC_VMW_LIB_ERROR([XMLSECURITY], [xmlsecurity])]) fi -else - enable_caf=no fi # @@ -1030,51 +1018,6 @@ else CPPFLAGS="$CPPFLAGS -DNO_ICU" fi -if test "$enable_caf" = "yes"; then - AC_VMW_CHECK_LIBXX([log4cpp], - [LOG4CPP], - [], - [log4cpp-config], - [], - [Appender.hh], - [], - [have_log4cpp="yes"], - [AC_VMW_LIB_ERROR([LOG4CPP], [log4cpp])]) - - AC_VMW_CHECK_LIB([rabbitmq], - [LIBRABBITMQ], - [librabbitmq], - [], - [0.8.0], - [amqp_tcp_socket.h], - [], - [have_librabbitmq="yes"], - [AC_VMW_LIB_ERROR([LIBRABBITMQ], [librabbitmq])]) - - # - # CAF requires glib 2.34 or greater. - # - AC_VMW_CHECK_LIB([glib-2.0], - [GLIB2], - [glib-2.0], - [], - [2.34.0], - [glib.h], - [g_key_file_new], - [], - [AC_MSG_ERROR([glib2 >= 2.34.0 is required.])]) - - AC_VMW_CHECK_LIB([gthread-2.0], - [GTHREAD], - [gthread-2.0], - [], - [2.34.0], - [], - [], - [], - [AC_MSG_ERROR([glib >= 2.34.0 is required.])]) - -fi if test "$with_tirpc" != "no"; then AC_VMW_CHECK_LIB([libtirpc], @@ -1483,7 +1426,6 @@ AM_CONDITIONAL(ENABLE_DEPLOYPKG, test "$enable_deploypkg" = "yes") AM_CONDITIONAL(ENABLE_GRABBITMQPROXY, test "$enable_grabbitmqproxy" = "yes") AM_CONDITIONAL(ENABLE_VGAUTH, test "$enable_vgauth" = "yes") AM_CONDITIONAL(USE_XMLSEC1, test "$use_xmlsec1" = "yes") -AM_CONDITIONAL(ENABLE_CAF, test "$enable_caf" = "yes") AM_CONDITIONAL(HAVE_VSOCK, test "$os" = "linux") AM_CONDITIONAL(HAVE_MKDTEMP, test "$have_mkdtemp" = "yes") AM_CONDITIONAL(HAVE_UDEV, test "$have_udev" = "yes") @@ -1536,14 +1478,6 @@ COMMON_PLUGIN_INSTALLDIR=$libdir/open-vm-tools/plugins/common VMSVC_PLUGIN_INSTALLDIR=$libdir/open-vm-tools/plugins/vmsvc VMUSR_PLUGIN_INSTALLDIR=$libdir/open-vm-tools/plugins/vmusr -# Installation directories for caf binary/so files -#CAF_PME_BIN_DIR=${sbindir}/vmware-caf/pme/bin -CAF_PME_BIN_DIR=${libdir}/open-vm-tools/vmware-caf/pme/bin -CAF_PME_LIB_DIR=${libdir}/open-vm-tools/vmware-caf/pme/lib - -# Installation directories for caf subsys so files -CAF_SUBSYS_DIR=${libdir}/open-vm-tools/vmware-caf/pme/lib -CAF_SUBSYS_LDFLAGS="-Wl,-z,defs -Wl,-lc -shared -module -avoid-version" # General definitions INSTVMSG='$(SHELL) $(top_srcdir)/scripts/build/instvmsg.sh' @@ -1575,10 +1509,6 @@ AC_SUBST([TEST_PLUGIN_INSTALLDIR]) AC_SUBST([COMMON_PLUGIN_INSTALLDIR]) AC_SUBST([VMSVC_PLUGIN_INSTALLDIR]) AC_SUBST([VMUSR_PLUGIN_INSTALLDIR]) -AC_SUBST([CAF_SUBSYS_DIR]) -AC_SUBST([CAF_SUBSYS_LDFLAGS]) -AC_SUBST([CAF_PME_BIN_DIR]) -AC_SUBST([CAF_PME_LIB_DIR]) if test "$os" = "freebsd" -a -n "$SYSDIR"; then # If SYSDIR is not defined, AC_SUBST expands to nothing, so we need something # inside this block. @@ -1691,18 +1621,6 @@ AC_CONFIG_FILES([ \ libDeployPkg/libDeployPkg.pc \ libhgfs/Makefile \ libvmtools/Makefile \ - common-agent/Cpp/Framework/Makefile \ - common-agent/Cpp/Communication/Makefile \ - common-agent/Cpp/InternalProviders/Makefile \ - common-agent/Cpp/ManagementAgent/Makefile \ - common-agent/Cpp/ProviderFx/Makefile \ - common-agent/input/Makefile \ - common-agent/input/invokers/Makefile \ - common-agent/input/providerReg/Makefile \ - common-agent/etc/Makefile \ - common-agent/etc/config/Makefile \ - common-agent/etc/scripts/Makefile \ - common-agent/etc/install/Makefile \ xferlogs/Makefile \ modules/Makefile \ vmblock-fuse/Makefile \