DXL Code to check if module has read lock or not

Hi,
I'm writing a DXL code that is traversing links between modules. I had a simple check to make sure that the module was opened and if not, display a general error message. The check is a simple If:

//after attempting to open module...
if (<Module> m null){
     //throw error
}else{
     //access module
}


This would work fine until know, when i realize that there are certain modules with a read lock on them, so although my DXL code still handles this case with the simple null check on the module variable, i would like to treat read locks with a seperate case. Is there a bit of DXL code that will verify that a module has a read lock on it?

I'm guessing the read lock is in relation with your access rights, and I simply don't have enough rights to access this module, hence the read lock.

Thanks,
Pat


Pvienneau - Wed Jun 16 14:48:20 EDT 2010

Re: DXL Code to check if module has read lock or not
a_vestlin - Thu Jun 17 01:56:19 EDT 2010

Try this:

Module m = read("my module name", true)
if ( null(m) )
{
    print "Null module"
}
else if ( !canRead(m) )
{
    print "No read access for module"
}
else
{
    // DO ACTIONS
}


/Anders

Re: DXL Code to check if module has read lock or not
a_vestlin - Thu Jun 17 02:01:36 EDT 2010

a_vestlin - Thu Jun 17 01:56:19 EDT 2010

Try this:

Module m = read("my module name", true)
if ( null(m) )
{
    print "Null module"
}
else if ( !canRead(m) )
{
    print "No read access for module"
}
else
{
    // DO ACTIONS
}


/Anders

After a second thought, if the module is read locked you will never get a module handle.
The code above will never reach the second block in the if-section.

/Anders