You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@river.apache.org by Peter Firmstone <ji...@zeus.net.au> on 2009/11/17 04:37:06 UTC

PolicySpi & DynamicPolicyProvider & General Ramblings

During my play around with implementing ConcurrentPermissions, I've 
noticed that GrantPermission is not very thread friendly with some 
synchronization issues, it needs to be reimplemented.

To really open up the throttle for concurrency on DynamicPolicyProvider 
I need to re-implement it in a more concurrent manner too.

the Java 6 PolicySpi interface looks good, giving the option of 
pluggability.

Does anyone know if a Sun Proprietary version of PolicySpi existed prior 
to Java 6?

public class ConcurrentDynamicPolicyProvider extends PolicySpi 
implements DynamicPolicy {

    public boolean grantSupported() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public void grant(Class cl, Principal[] principals, Permission[] 
permissions) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public Permission[] getGrants(Class cl, Principal[] principals) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    protected boolean engineImplies(ProtectionDomain domain, Permission 
permission) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

}


N.B. I haven't forgotten about the new River release, I will get to it 
shortly.

If another committer is reading this, could you upload Sim's two recent 
patches for me please, it'll save me some time.  The AR2 release won't 
contain my recent changes.  I'm looking forward to getting AR2 out so I 
can commit my recent work.

I'm starting to wonder if OSGi can assist us with managing different 
java platform dependencies, we might preserve some of the existing 
implementations for backward compatibility with older or more limited 
platforms so that these can still participate, without holding back 
future development?  If someone else has a good suggestion, I'm all 
ears.  Note I don't have any fixed idea of an implementation, I'm just 
looking to bounce around a few ideas.

Classdep is used in River's build system to package the dist jar files, 
I intend on extending our new implementation of Classdep to identify 
Package API for use with codebase services using ASM.  OSGi's bnd tool 
utilises static analysis to generate bundles, so I'm wondering if there 
might be some synergy there and whether Classdep can be extended to 
support generation of OSGi bundle metadata.

Cheers,

Peter.

Re: PolicySpi & DynamicPolicyProvider & General Ramblings

Posted by Peter Firmstone <ji...@zeus.net.au>.
Other implementations might only implement a subset of the three services.

Peter Firmstone wrote:
> Well there is one caveat, an PolicySpi object is encapsulated, so I 
> need two more SPI's, for DynamicPolicy and RevokableDynamicPolicy and 
> then an internal enum singleton pattern to tie together the 
> implementation to return the same instance, which has to be threadsafe.
>
> So the sequence goes lookup SPI's in this order, depending upon 
> required functionality, each SPI provides only its subset, however the 
> same instance must be called:
>
> 1. Policy
> 2. DynamicPolicy
> 3. RevokableDynamicPolicy
>
> I could change the interface name to:
>
> DynamicPolicy
> DynamicPolicyRevokeable
>
> Cheers,
>
> Peter.
>


Re: PolicySpi & DynamicPolicyProvider & General Ramblings

Posted by Peter Firmstone <ji...@zeus.net.au>.
Well there is one caveat, an PolicySpi object is encapsulated, so I need 
two more SPI's, for DynamicPolicy and RevokableDynamicPolicy and then an 
internal enum singleton pattern to tie together the implementation to 
return the same instance, which has to be threadsafe.

So the sequence goes lookup SPI's in this order, depending upon required 
functionality, each SPI provides only its subset, however the same 
instance must be called:

1. Policy
2. DynamicPolicy
3. RevokableDynamicPolicy

I could change the interface name to:

DynamicPolicy
DynamicPolicyRevokeable

Cheers,

Peter.