commit 5d59aef409659273952fa297bede04f0410fdb70
Author: Michael Andres
Date: Wed Jan 28 14:15:45 2009 +0100
Pass source ObjectPath and Role to AssocFilter methods
---
src/SUSE_AssocFilter.h | 5 +-
src/SUSE_Common.cc | 8 ++--
src/SUSE_HostedCollectionProvider.cc | 68 +++++++-----------------
src/SUSE_HostedCollectionProvider.h | 4 +-
src/SUSE_InstalledSoftwareIdentityProvider.cc | 53 +++++++++----------
src/SUSE_InstalledSoftwareIdentityProvider.h | 4 +-
src/SUSE_MemberOfCollectionProvider.cc | 70 ++++++++++++++-----------
7 files changed, 94 insertions(+), 118 deletions(-)
diff --git a/src/SUSE_AssocFilter.h b/src/SUSE_AssocFilter.h
index fcc6ad2..f1f7b26 100644
--- a/src/SUSE_AssocFilter.h
+++ b/src/SUSE_AssocFilter.h
@@ -11,13 +11,12 @@ namespace cmpizypp
SUSE_AssocFilter() {};
virtual ~SUSE_AssocFilter() {};
- virtual bool filterInstance(const CmpiInstance &ci, bool associators) const
+ virtual bool filterInstance(const CmpiObjectPath &scop, const char * _RefSource, const CmpiInstance &ci, bool associators) const
{
_CMPIZYPP_TRACE(1,("--- AssocFilter::filterInstance() called"));
return true;
};
-
- virtual bool filterObjectPath(const CmpiObjectPath &op, bool associators) const
+ virtual bool filterObjectPath(const CmpiObjectPath &scop, const char * _RefSource, const CmpiObjectPath &op, bool associators) const
{
_CMPIZYPP_TRACE(1,("--- AssocFilter::filterObjectPath() called"));
return true;
diff --git a/src/SUSE_Common.cc b/src/SUSE_Common.cc
index 647a211..2ba0fd3 100644
--- a/src/SUSE_Common.cc
+++ b/src/SUSE_Common.cc
@@ -189,7 +189,7 @@ namespace cmpizypp
while (en.hasNext() )
{
CmpiInstance ci = en.getNext();
- if( filter.filterInstance(ci, true) )
+ if( filter.filterInstance(cop, _RefSource, ci, true) )
rslt.returnData( ci );
}
}
@@ -222,13 +222,13 @@ namespace cmpizypp
/* associators = 0 && inst = 0 */
CmpiObjectPath tmp = ci.getObjectPath();
tmp.setNameSpace(cop.getNameSpace());
- if( filter.filterObjectPath(tmp, false) )
+ if( filter.filterObjectPath(cop, _RefSource, tmp, false) )
rslt.returnData(tmp);
}
else
{
/* associators = 0 && inst = 1 */
- if( filter.filterInstance(ci, false) )
+ if( filter.filterInstance(cop, _RefSource, ci, false) )
rslt.returnData(ci);
}
}
@@ -238,7 +238,7 @@ namespace cmpizypp
//rslt.returnData(data);
CmpiObjectPath tmp = (CmpiObjectPath)data;
tmp.setNameSpace(cop.getNameSpace());
- if( filter.filterObjectPath(tmp, true) )
+ if( filter.filterObjectPath(cop, _RefSource, tmp, true) )
rslt.returnData(tmp);
}
}
diff --git a/src/SUSE_HostedCollectionProvider.cc b/src/SUSE_HostedCollectionProvider.cc
index 670394a..7cf0d16 100644
--- a/src/SUSE_HostedCollectionProvider.cc
+++ b/src/SUSE_HostedCollectionProvider.cc
@@ -212,10 +212,18 @@ namespace cmpizypp
, csop(op)
{ }
- bool SUSE_HostedCollectionFilter::filterInstance(const CmpiInstance &ci, bool associators) const
+ bool SUSE_HostedCollectionFilter::filterInstance(const CmpiObjectPath &scop, const char * _RefSource, const CmpiInstance &ci, bool associators) const
{
_CMPIZYPP_TRACE(1,("--- SUSE_HostedCollectionFilter::filterInstance called"));
- USR << ci << endl;
+ return filterObjectPath( scop, _RefSource, ci.getObjectPath(), associators );
+
+ }
+
+ bool SUSE_HostedCollectionFilter::filterObjectPath(const CmpiObjectPath &scop, const char * _RefSource, const CmpiObjectPath &op, bool associators) const
+ {
+ _CMPIZYPP_TRACE(1,("--- SUSE_HostedCollectionFilter::filterObjectPath called"));
+ USR << scop << " " <<_RefSource << ": " << op << endl;
+
CmpiString CSName = csop.getKey("CreationClassName");
CmpiString Name = csop.getKey("Name");
@@ -223,21 +231,22 @@ namespace cmpizypp
const char *filterName = "";
if( ! associators )
{
- CmpiObjectPath filterop = ci.getProperty( _RefLeft );
+ CmpiObjectPath filterop = op.getKey( _RefLeft );
filterCSName = filterop.getKey("CreationClassName");
filterName = filterop.getKey("Name");
}
else
{
- CmpiInstance lci( ci );
- if( lci.instanceIsA( _RefLeftClass ) )
+ if ( ::strcmp(_RefSource, _RefLeft ) != 0 )
{
- _CMPIZYPP_TRACE(1,("--- SUSE_HostedCollectionFilter::filterInstance exited: true"));
- return true;
+ filterCSName = op.getKey("CreationClassName");
+ filterName = op.getKey("Name");
+ }
+ else
+ {
+ filterCSName = scop.getKey("CreationClassName");
+ filterName = scop.getKey("Name");
}
-
- filterCSName = ci.getProperty("CreationClassName");
- filterName = ci.getProperty("Name");
}
if(CSName.equals(filterCSName) && Name.equals(filterName) )
@@ -250,44 +259,7 @@ namespace cmpizypp
_CMPIZYPP_TRACE(1,("--- SUSE_HostedCollectionFilter::filterInstance exited: false"));
return false;
}
- }
-
- bool SUSE_HostedCollectionFilter::filterObjectPath(const CmpiObjectPath &op, bool associators) const
- {
- _CMPIZYPP_TRACE(1,("--- SUSE_HostedCollectionFilter::filterObjectPath called"));
- USR << op << endl;
- CmpiString CSName = csop.getKey("CreationClassName");
- CmpiString Name = csop.getKey("Name");
-
- CmpiObjectPath filterop("", "");
- if( ! associators )
- {
- filterop = op.getKey( _RefLeft );
- }
- else
- {
- if( op.classPathIsA( _RefLeftClass ) )
- {
- _CMPIZYPP_TRACE(1,("--- SUSE_HostedCollectionFilter::filterObjectPath exited: true"));
- return true;
- }
-
- filterop = op;
- }
- CmpiString filterCSName = filterop.getKey("CreationClassName");
- CmpiString filterName = filterop.getKey("Name");
-
- if(filterCSName.equals(CSName) && filterName.equals(Name) )
- {
- _CMPIZYPP_TRACE(1,("--- SUSE_HostedCollectionFilter::filterObjectPath exited: true"));
- return true;
- }
- else
- {
- _CMPIZYPP_TRACE(1,("--- SUSE_HostedCollectionFilter::filterObjectPath exited: false"));
- return false;
- }
- }
+}
} // namespace cmpizypp
diff --git a/src/SUSE_HostedCollectionProvider.h b/src/SUSE_HostedCollectionProvider.h
index 9b8b7cb..7c20863 100644
--- a/src/SUSE_HostedCollectionProvider.h
+++ b/src/SUSE_HostedCollectionProvider.h
@@ -49,8 +49,8 @@ namespace cmpizypp
SUSE_HostedCollectionFilter(const CmpiObjectPath &op);
virtual ~SUSE_HostedCollectionFilter() {};
- virtual bool filterInstance(const CmpiInstance &ci, bool associators) const;
- virtual bool filterObjectPath(const CmpiObjectPath &op, bool associators) const;
+ virtual bool filterInstance(const CmpiObjectPath &scop, const char * _RefSource, const CmpiInstance &ci, bool associators) const;
+ virtual bool filterObjectPath(const CmpiObjectPath &scop, const char * _RefSource, const CmpiObjectPath &op, bool associators) const;
};
} // namespace cmpizypp
diff --git a/src/SUSE_InstalledSoftwareIdentityProvider.cc b/src/SUSE_InstalledSoftwareIdentityProvider.cc
index c90a875..6c7b58a 100644
--- a/src/SUSE_InstalledSoftwareIdentityProvider.cc
+++ b/src/SUSE_InstalledSoftwareIdentityProvider.cc
@@ -442,45 +442,30 @@ namespace cmpizypp
, csop(op)
{ }
- bool SUSE_InstalledSoftwareIdentityFilter::filterInstance(const CmpiInstance &ci, bool associators) const
+
+ bool SUSE_InstalledSoftwareIdentityFilter::filterObjectPath(const CmpiObjectPath &scop, const char * _RefSource, const CmpiObjectPath &op, bool associators) const
{
- _CMPIZYPP_TRACE(1,("--- SUSE_InstalledSoftwareIdentityFilter::filterInstance called"));
- USR << ci << endl;
- CmpiString CSName = csop.getKey("CreationClassName");
- CmpiString Name = csop.getKey("Name");
+ _CMPIZYPP_TRACE(1,("--- SUSE_InstalledSoftwareIdentityFilter::filterObjectPath called"));
+ USR << scop << " " <<_RefSource << ": " << op << endl;
- const char *filterCSName = "";
- const char *filterName = "";
- if( ! associators )
+ if ( strcmp(_RefSource,_RefLeft) != 0 )
{
- CmpiObjectPath filterop = ci.getProperty( _RefRight );
- filterCSName = filterop.getKey("CreationClassName");
- filterName = filterop.getKey("Name");
- }
- else
- {
- filterCSName = ci.getProperty("CreationClassName");
- filterName = ci.getProperty("Name");
+ INT << "Unexpected filter!" << endl;
+ return false;
}
- if(CSName.equals(filterCSName) && Name.equals(filterName) )
+ const char * instanceId = scop.getKey("InstanceId");
+ if ( ! instanceId )
{
- _CMPIZYPP_TRACE(1,("--- SUSE_InstalledSoftwareIdentityFilter::filterInstance exited: true"));
- return true;
+ INT << "No instance Id!" << endl;
+ return false;
}
- else
+
+ if ( ! ZyppAC::isSystemSoftwareIdentityInstanceId( instanceId ) )
{
- _CMPIZYPP_TRACE(1,("--- SUSE_InstalledSoftwareIdentityFilter::filterInstance exited: false"));
+ _CMPIZYPP_TRACE(1,("--- SUSE_InstalledSoftwareIdentityFilter::filterObjectPath exited: false"));
return false;
}
- }
-
- bool SUSE_InstalledSoftwareIdentityFilter::filterObjectPath(const CmpiObjectPath &op, bool associators) const
- {
- _CMPIZYPP_TRACE(1,("--- SUSE_InstalledSoftwareIdentityFilter::filterObjectPath called"));
- USR << op << endl;
- CmpiString CSName = csop.getKey("CreationClassName");
- CmpiString Name = csop.getKey("Name");
CmpiObjectPath filterop("", "");
if( ! associators )
@@ -491,6 +476,10 @@ namespace cmpizypp
{
filterop = op;
}
+
+ CmpiString CSName = csop.getKey("CreationClassName");
+ CmpiString Name = csop.getKey("Name");
+
CmpiString filterCSName = filterop.getKey("CreationClassName");
CmpiString filterName = filterop.getKey("Name");
@@ -507,6 +496,12 @@ namespace cmpizypp
}
+ bool SUSE_InstalledSoftwareIdentityFilter::filterInstance(const CmpiObjectPath &scop, const char * _RefSource, const CmpiInstance &ci, bool associators) const
+ {
+ _CMPIZYPP_TRACE(1,("--- SUSE_InstalledSoftwareIdentityFilter::filterInstance called"));
+ return filterObjectPath(scop, _RefSource, ci.getObjectPath(), associators);
+ }
+
} // namespace cmpizypp
CMProviderBase( SUSE_InstalledSoftwareIdentityProvider );
diff --git a/src/SUSE_InstalledSoftwareIdentityProvider.h b/src/SUSE_InstalledSoftwareIdentityProvider.h
index ceee8e8..9739445 100644
--- a/src/SUSE_InstalledSoftwareIdentityProvider.h
+++ b/src/SUSE_InstalledSoftwareIdentityProvider.h
@@ -48,8 +48,8 @@ namespace cmpizypp
SUSE_InstalledSoftwareIdentityFilter(const CmpiObjectPath &op);
virtual ~SUSE_InstalledSoftwareIdentityFilter() {};
- virtual bool filterInstance(const CmpiInstance &ci, bool associators) const;
- virtual bool filterObjectPath(const CmpiObjectPath &op, bool associators) const;
+ virtual bool filterInstance(const CmpiObjectPath &scop, const char * _RefSource, const CmpiInstance &ci, bool associators) const;
+ virtual bool filterObjectPath(const CmpiObjectPath &scop, const char * _RefSource, const CmpiObjectPath &op, bool associators) const;
};
} // namespace cmpizypp
diff --git a/src/SUSE_MemberOfCollectionProvider.cc b/src/SUSE_MemberOfCollectionProvider.cc
index fee0342..bcb60b5 100644
--- a/src/SUSE_MemberOfCollectionProvider.cc
+++ b/src/SUSE_MemberOfCollectionProvider.cc
@@ -228,13 +228,17 @@ namespace cmpizypp
}
else // ( cop.classPathIsA(_RefRightClass) ) //SUSE_SoftwareIdentity
{
- if(! assoc_create_refs_1toN_ST( *broker, ctx, rslt, cop, _ClassName,
- _RefRight, _RefLeft, _RefRightClass, _RefLeftClass, 1, 1) )
- {
- CmpiStatus st(CMPI_RC_ERR_FAILED, "Create references failed.");
- _CMPIZYPP_TRACE(1,("--- CMPI referenceNames() failed."));
- return st;
- }
+ const char * copInstanceId = cop.getKey("InstanceId");
+ if ( ! ZyppAC::isSystemSoftwareIdentityInstanceId( copInstanceId ) )
+ {
+ if(! assoc_create_refs_1toN_ST( *broker, ctx, rslt, cop, _ClassName,
+ _RefRight, _RefLeft, _RefRightClass, _RefLeftClass, 1, 1) )
+ {
+ CmpiStatus st(CMPI_RC_ERR_FAILED, "Create references failed.");
+ _CMPIZYPP_TRACE(1,("--- CMPI referenceNames() failed."));
+ return st;
+ }
+ }
}
}
@@ -298,16 +302,18 @@ namespace cmpizypp
}
else // ( cop.classPathIsA(_RefRightClass) ) //SUSE_SoftwareIdentity
{
- if(! assoc_create_refs_1toN_ST( *broker, ctx, rslt, cop, _ClassName,
- _RefRight, _RefLeft, _RefRightClass, _RefLeftClass, 0, 1) )
- {
- CmpiStatus st(CMPI_RC_ERR_FAILED, "Create references failed.");
- _CMPIZYPP_TRACE(1,("--- CMPI referenceNames() failed."));
- return st;
- }
+ const char * copInstanceId = cop.getKey("InstanceId");
+ if ( ! ZyppAC::isSystemSoftwareIdentityInstanceId( copInstanceId ) )
+ {
+ if(! assoc_create_refs_1toN_ST( *broker, ctx, rslt, cop, _ClassName,
+ _RefRight, _RefLeft, _RefRightClass, _RefLeftClass, 0, 1) )
+ {
+ CmpiStatus st(CMPI_RC_ERR_FAILED, "Create references failed.");
+ _CMPIZYPP_TRACE(1,("--- CMPI referenceNames() failed."));
+ return st;
+ }
+ }
}
-
- USR << op <