org.gcube.common.core.utils.proxies
Class ReadOnlyProxyContext

java.lang.Object
  extended by org.gcube.common.core.utils.proxies.GCUBEProxyContext<ReadOnlyProxyContext.ReadOnly>
      extended by org.gcube.common.core.utils.proxies.ReadOnlyProxyContext

public class ReadOnlyProxyContext
extends GCUBEProxyContext<ReadOnlyProxyContext.ReadOnly>

A specialisation of GCUBEProxyContext for proxies which enforce read-only access from untrusted code to the values returned by selected methods of the proxied objects.

Read-only access control is dynamically established by comparing the namespace of the caller code (under inheritance, not necessarily the caller's) with one or more namespaces of trusted code. The latter are specified as the values of annotations of the primary annotation class ReadOnly. Access control checks are heuristically performed on methods whose name begins with set,add,put,remnove,delete. For all other methods, a read-only proxy will proxy their return value (if any) with another read-only proxy. Essentially, this allows the read-only policy to transparently propagate deep within class hierarchies without requiring that ReadOnly annotations are similary propagated.

Author:
Fabio Simeoni (University of Strathclyde)

Nested Class Summary
static interface ReadOnlyProxyContext.ReadOnly
          The primary annotation of the proxy associated with the context.
 
Field Summary
protected  List<String> prefixes
          Method name prefixes used to heuristically identify write-access methods.
 
Constructor Summary
ReadOnlyProxyContext()
           
 
Method Summary
 void addWritePrefix(String prefix)
          Add a new method name prefix used to heuristically to identify write-access methods.
 Class<ReadOnlyProxyContext.ReadOnly> getAnnotationClass()
          Returns the class of the primary annotation.
 net.sf.cglib.proxy.MethodInterceptor getInterceptor(Object proxied)
          Returns the object which will intercept calls to the proxy.
 List<String> getPrefixes()
          Return the current list of method name prefixes used to heuristically to identify write-access methods.
 
Methods inherited from class org.gcube.common.core.utils.proxies.GCUBEProxyContext
getAnnotation, getProxyCaller, setAnnotation, setCaller
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

prefixes

protected List<String> prefixes
Method name prefixes used to heuristically identify write-access methods.

Constructor Detail

ReadOnlyProxyContext

public ReadOnlyProxyContext()
Method Detail

getAnnotationClass

public Class<ReadOnlyProxyContext.ReadOnly> getAnnotationClass()
Returns the class of the primary annotation.

Specified by:
getAnnotationClass in class GCUBEProxyContext<ReadOnlyProxyContext.ReadOnly>
Returns:
the annotation class.

getInterceptor

public net.sf.cglib.proxy.MethodInterceptor getInterceptor(Object proxied)
Returns the object which will intercept calls to the proxy.

Specified by:
getInterceptor in class GCUBEProxyContext<ReadOnlyProxyContext.ReadOnly>
Parameters:
proxied - the proxied object.
Returns:
the intercepting object.

getPrefixes

public List<String> getPrefixes()
Return the current list of method name prefixes used to heuristically to identify write-access methods.

Returns:
the list.

addWritePrefix

public void addWritePrefix(String prefix)
Add a new method name prefix used to heuristically to identify write-access methods.

Parameters:
prefix - the prefix.


Copyright © 2012. All Rights Reserved.