From bda49e2a348266e81320a32590899c363b06d2f4 Mon Sep 17 00:00:00 2001 From: Peter Schiffer Date: Mon, 31 Mar 2014 08:29:25 +0200 Subject: Software-dbus: implemented HostedSoftwareCollectionProvider --- .../LMI_HostedSoftwareCollectionProvider.c | 44 ++++++++++++++++++++-- 1 file changed, 41 insertions(+), 3 deletions(-) (limited to 'src/software-dbus') diff --git a/src/software-dbus/LMI_HostedSoftwareCollectionProvider.c b/src/software-dbus/LMI_HostedSoftwareCollectionProvider.c index d07b752..1284eee 100644 --- a/src/software-dbus/LMI_HostedSoftwareCollectionProvider.c +++ b/src/software-dbus/LMI_HostedSoftwareCollectionProvider.c @@ -1,10 +1,32 @@ +/* + * Copyright (C) 2013-2014 Red Hat, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Authors: Peter Schiffer + */ + #include #include "LMI_HostedSoftwareCollection.h" +#include "LMI_Software.h" static const CMPIBroker* _cb; -static void LMI_HostedSoftwareCollectionInitialize() +static void LMI_HostedSoftwareCollectionInitialize(const CMPIContext *ctx) { + lmi_init(provider_name, _cb, ctx, provider_config_defaults); } static CMPIStatus LMI_HostedSoftwareCollectionCleanup( @@ -32,6 +54,22 @@ static CMPIStatus LMI_HostedSoftwareCollectionEnumInstances( const CMPIObjectPath* cop, const char** properties) { + char instance_id[INSTANCE_ID_LEN] = ""; + + create_instance_id(SYSTEM_SW_COLLECTION_CLASS_NAME, NULL, instance_id, + INSTANCE_ID_LEN); + + LMI_SystemSoftwareCollectionRef ssc; + LMI_SystemSoftwareCollectionRef_Init(&ssc, _cb, KNameSpace(cop)); + LMI_SystemSoftwareCollectionRef_Set_InstanceID(&ssc, instance_id); + + LMI_HostedSoftwareCollection w; + LMI_HostedSoftwareCollection_Init(&w, _cb, KNameSpace(cop)); + LMI_HostedSoftwareCollection_SetObjectPath_Antecedent(&w, + lmi_get_computer_system()); + LMI_HostedSoftwareCollection_Set_Dependent(&w, &ssc); + KReturnInstance(cr, w); + CMReturn(CMPI_RC_OK); } @@ -187,13 +225,13 @@ CMInstanceMIStub( LMI_HostedSoftwareCollection, LMI_HostedSoftwareCollection, _cb, - LMI_HostedSoftwareCollectionInitialize()) + LMI_HostedSoftwareCollectionInitialize(ctx)) CMAssociationMIStub( LMI_HostedSoftwareCollection, LMI_HostedSoftwareCollection, _cb, - LMI_HostedSoftwareCollectionInitialize()) + LMI_HostedSoftwareCollectionInitialize(ctx)) KONKRET_REGISTRATION( "root/cimv2", -- cgit