users@glassfish.java.net

JACC and PolicyConfigurationImpl

From: Laird Nelson <ljnelson_at_gmail.com>
Date: Fri, 1 Jul 2011 16:05:50 -0400

Can someone shed light on how the default Policy installed by Glassfish 3.1
actually reads granted.policy and excluded.policy files?

I can see how it *generates* them, but I don't actually see the files being
read. Correction: I see the excluded.policy files being read, but not the
granted.policy ones.

If I create a new instance of PolicyConfigurationFactoryImpl and ask it to
get a PolicyConfigurationImpl for a given known context, I can see from the
log output that the policy configuration finds the directory, discovers the
files, and apparently processes them with no problem. This all happens in
PolicyConfigurationImpl#initialize().

But when I investigate the internal Policy object housed by
PolicyConfiguraitonImpl (its "policy" member variable using
setAccessible(true)), it is empty even after initialize() is called when
there are granted.policy files present in The Right Place.

Refreshing the BasePolicyWrapper does not appear to cause the context policy
to be refreshed.

I'm doing all this in a unit test as part of writing a JACC implementation.
I am trying to understand how the default Policy provider implementation
works.

I'm worried that perhaps it regenerates the granted.policy file every single
time, even though you're supposed to be able to pre-create the
granted.policy file and copy it into the right directory. Maybe there isn't
a test case to see if this is the case?

Thanks,
Laird