ref: refs/heads/master
commit 894c9027f5cfbb9927a4bfc529bc47f0f627fb67
Author: Michael Calmer
Date: Wed Feb 11 17:45:06 2009 +0100
add makeObjectPath as static method; move makeInstance to public
---
src/SUSE_SoftwareRepositoryProvider.cc | 29 ++++++++++++++++++-----------
src/SUSE_SoftwareRepositoryProvider.h | 8 ++++++--
2 files changed, 24 insertions(+), 13 deletions(-)
diff --git a/src/SUSE_SoftwareRepositoryProvider.cc b/src/SUSE_SoftwareRepositoryProvider.cc
index dd8b517..512613a 100644
--- a/src/SUSE_SoftwareRepositoryProvider.cc
+++ b/src/SUSE_SoftwareRepositoryProvider.cc
@@ -39,8 +39,6 @@ CmpiStatus SUSE_SoftwareRepositoryProviderClass::enumInstanceNames( const CmpiCo
_CMPIZYPP_TRACE(1,("--- %s CMPI EnumInstanceNames() called",_ClassName));
CmpiObjectPath csop = get_this_computersystem(*broker, ctx, cop);
- const char *sccn = csop.getKey("CreationClassName");
- const char *sn = csop.getKey("Name");
// zypp init
zypp::scoped_ptr<ZyppAC> zyppac;
@@ -60,12 +58,7 @@ CmpiStatus SUSE_SoftwareRepositoryProviderClass::enumInstanceNames( const CmpiCo
RepoInfoList repos = repoManager.knownRepositories();
for ( RepoInfoList::iterator it = repos.begin(); it != repos.end(); ++it )
{
- CmpiObjectPath op( cop.getNameSpace(), _ClassName );
- op.setKey( "SystemCreationClassName", sccn);
- op.setKey( "SystemName", sn);
- op.setKey( "CreationClassName", _ClassName);
- op.setKey( "Name", it->alias().c_str() );
- rslt.returnData( op );
+ rslt.returnData( makeObjectPath( *it, cop, csop ) );
}
rslt.returnDone();
@@ -393,7 +386,21 @@ CmpiStatus SUSE_SoftwareRepositoryProviderClass::invokeMethod (const CmpiContext
return st;
}
-/* ========================= private ================================== */
+CmpiObjectPath SUSE_SoftwareRepositoryProviderClass::makeObjectPath(const zypp::RepoInfo &repo, const CmpiObjectPath &cop,
+ const CmpiObjectPath &csop)
+{
+ const char *sccn = csop.getKey("CreationClassName");
+ const char *sn = csop.getKey("Name");
+
+ CmpiObjectPath op( cop.getNameSpace(), _ClassName );
+ op.setKey( "SystemCreationClassName", sccn);
+ op.setKey( "SystemName", sn);
+ op.setKey( "CreationClassName", _ClassName);
+ op.setKey( "Name", repo.alias().c_str() );
+
+ return op;
+}
+
CmpiInstance SUSE_SoftwareRepositoryProviderClass::makeInstance( const RepoInfo &repo,
const CmpiObjectPath & cop,
@@ -450,11 +457,11 @@ CmpiInstance SUSE_SoftwareRepositoryProviderClass::makeInstance( const RepoInfo
ci.setProperty( "RepositoryType", CMPIUint16(1) );
break;
}
-
-
return ci;
}
+/* ========================= private ================================== */
+
void SUSE_SoftwareRepositoryProviderClass::setRepoInfo( zypp::RepoInfo &repoinfo,
const CmpiInstance &inst )
{
diff --git a/src/SUSE_SoftwareRepositoryProvider.h b/src/SUSE_SoftwareRepositoryProvider.h
index 2e9eecf..574106a 100644
--- a/src/SUSE_SoftwareRepositoryProvider.h
+++ b/src/SUSE_SoftwareRepositoryProvider.h
@@ -26,9 +26,13 @@ namespace cmpizypp
const CmpiObjectPath &ref, const char *methodName,
const CmpiArgs &in, CmpiArgs &out);
+ static CmpiObjectPath makeObjectPath(const zypp::RepoInfo &repo, const CmpiObjectPath &cop,
+ const CmpiObjectPath &csop);
+
+ static CmpiInstance makeInstance( const zypp::RepoInfo &repo, const CmpiObjectPath &cop,
+ const CmpiObjectPath &csop, const char ** properties );
+
private:
- CmpiInstance makeInstance( const zypp::RepoInfo &repo, const CmpiObjectPath &cop,
- const CmpiObjectPath &csop, const char ** properties );
void setRepoInfo( zypp::RepoInfo &repoinfo, const CmpiInstance &inst );
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org