Now access management API depends on embedded/extermnal
connection to dbXML.
In case of external db it looks like:
void grantAdminRightsToCollection\( CollectionClient
col ) throws dbXMLException
{
AccessManagerClient managerClient = new
AccessManagerClient( col.getClient() );
managerClient.grant( col.getCanonicalName(), "admin",
Access.READ | Access.WRITE | Access.EXECUTE |
Access.CREATE );
}
In case of embedded db it looks like:
void grantAdminRightsToCollection\( CollectionClient
col ) throws dbXMLException
{
AccessManager manager = (AccessManager)
((com.dbxml.db.client.local.CollectionClientImpl)
col.getSystemCollection()).getInternalCollection().getExtensionManager().get(
"accessmanager" );
manager.grant( col.getCanonicalName(), "admin",
Access.READ | Access.WRITE | Access.EXECUTE |
Access.CREATE );
}
I offer to extract common interface from AccessManager
and AccessManagerClient and make a way to get it
independing on the database connection way.