#!/bin/bash

################################################################################
# Linux Management Providers (LMP), System Memory provider package
# Copyright (C) 2008 Guillaume BOTTEX, ETRI <guillaumebottex@etri.re.kr, guillaumebottex@gmail.com>
# 
# This program is being developed under the "OpenDRIM" project.
# The "OpenDRIM" project web page: http://opendrim.sourceforge.net
# The "OpenDRIM" project mailing list: opendrim@googlegroups.com
# 
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; version 2
# of the License.
# 
# 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 Street, Fifth Floor, Boston, MA  02110-1301, USA.
#################################################################################

#################################################################################
# To contributors, please leave your contact information in this section
# AND comment your changes in the source code.
# 
# Modified by <Author(s)>, <Affiliation>, <Year>
################################################################################

if test "$3" = pegasus
then
	
	cimmof -aE -n $1 $6/mof/OpenDRIM_Memory.mof

	OUTFILE=./TEMP_REGISTRATION
	
cat >> $OUTFILE << EOFC
instance of PG_ProviderModule {
Caption = "OpenDRIM_Memory provider module";
Name = "SystemMemory_OpenDRIM_MemoryModule";
Location = "cmpiSystemMemory_OpenDRIM_MemoryProvider";
Vendor = "$2";
Version = "$5";
InterfaceType = "CMPI";
InterfaceVersion = "2.0.0";
};

instance of PG_Provider {
Caption = "OpenDRIM_Memory provider";
Name = "SystemMemory_OpenDRIM_MemoryProvider";
ProviderModuleName = "SystemMemory_OpenDRIM_MemoryModule";
};

instance of PG_ProviderCapabilities {
Caption = "OpenDRIM_Memory provider capabilities";
ProviderModuleName = "SystemMemory_OpenDRIM_MemoryModule";
ProviderName = "SystemMemory_OpenDRIM_MemoryProvider";
ClassName = "OpenDRIM_Memory";
ProviderType = {2, 5};
Namespaces = {"$1"};
SupportedProperties = {"Caption", "Description", "ElementName", "InstallDate", "OperationalStatus", "StatusDescriptions", "Status", "HealthState", "PrimaryStatus", "DetailedStatus", "OperatingStatus", "CommunicationStatus", "EnabledState", "OtherEnabledState", "RequestedState", "EnabledDefault", "TimeOfLastStateChange", "AvailableRequestedStates", "TransitioningToState", "SystemCreationClassName", "SystemName", "CreationClassName", "DeviceID", "PowerManagementSupported", "PowerManagementCapabilities", "Availability", "StatusInfo", "LastErrorCode", "ErrorDescription", "ErrorCleared", "OtherIdentifyingInfo", "PowerOnHours", "TotalPowerOnHours", "IdentifyingDescriptions", "AdditionalAvailability", "MaxQuiesceTime", "LocationIndicator", "DataOrganization", "Purpose", "Access", "BlockSize", "NumberOfBlocks", "ConsumableBlocks", "IsBasedOnUnderlyingRedundancy", "SequentialAccess", "ExtentStatus", "NoSinglePointOfFailure", "DataRedundancy", "PackageRedundancy", "DeltaReservation", "Primordial", "Name", "NameFormat", "NameNamespace", "OtherNameNamespace", "OtherNameFormat", "Usage", "OtherUsageDescription", "ClientSettableUsage", "Volatile", "ErrorMethodology", "StartingAddress", "EndingAddress", "ErrorInfo", "OtherErrorDescription", "CorrectableError", "ErrorTime", "ErrorAccess", "ErrorTransferSize", "ErrorData", "ErrorDataOrder", "ErrorAddress", "SystemLevelAddress", "ErrorResolution", "AdditionalErrorData"};
SupportedMethods = {"RequestStateChange", "SetPowerState", "Reset", "EnableDevice", "OnlineDevice", "QuiesceDevice", "SaveProperties", "RestoreProperties"};
CapabilityID = "SystemMemory_OpenDRIM_Memory";
};

EOFC
	
	cimmof -n root/PG_InterOp $OUTFILE
	
	rm -f $OUTFILE
	
fi

if test "$3" = sfcb
then
	
	OUTFILE=./OpenDRIM_Memory.reg
	
cat >> $OUTFILE <<EOFC
[OpenDRIM_Memory]   
   provider: SystemMemory_OpenDRIM_MemoryProvider
   location: cmpiSystemMemory_OpenDRIM_MemoryProvider
   type: instance method
   namespace: $1
#
EOFC
	
	sfcbstage -r $OUTFILE -n $1 $6/mof/OpenDRIM_Memory.mof
	
	rm -f $OUTFILE
	
	sfcbrepos -f
	
fi

if test "$3" = openwbem
then
	
	OUTFILE=./OpenDRIM_Memory-reg.mof
	rm -f $OUTFILE
	sed "s/Provider *( *\"cmpi:/Provider(\"cmpi::/g" < $6/mof/OpenDRIM_Memory.mof >> $OUTFILE
	owmofc -u http://localhost/$1 $OUTFILE
	
	rm -f $OUTFILE
	
fi
