[Registry-dev] Restricted collections

Afkham Azeez azeez at wso2.com
Thu Jul 10 03:01:49 PDT 2008


I think the nicer way to do this is to introduce a ChildPolicy class


class ChildPolicy{
   private ChidlPolicy(){
   }

   public static final ChildPolicy ALLOW_ALL = new ChildPolicy();

   public static final ChildPolicy ALLOW_SELECTED  = new ChildPolicy();

   public static final ChildPolicy DENY_SELECTED = new ChildPolicy();
}

and

void setChildPolicy(ChildPolicy policy);

ChildPolicy getChildPolicy();


I believe it provides a cleaner API.

Azeez


Chathura C. Ekanayake wrote:
> Current handler implementation allows users to write handlers to 
> restrict the allowed child media types of collections. Axis2 repository 
> collection is an example of such collection. I think this is a frequent 
> use case, where users would like to configure collections on the fly 
> using the UI. We can introduce some UI controls and API methods to 
> support this functionality. First, from the API side, we can have below 
> methods in the Collection interface.
> 
> void setChildPolicy(String policy);
> 
> String getChildPolicy();
> 
> void addChildMediaType(String mediaType);
>    
> void removeChildMediaType(String mediaType);
> 
> String[] getChildMediaTypes();
> 
> Below are the allowed values for child policy.
> 
> ALLOW_ALL --> No restriction (normal collection).
> ALLOW_SELECTED --> Only allow the selected media types given from 
> addChildMediaType(...) method.
> DENY_SELECTED --> Only deny the selected media types given from 
> addChildMediaType(...) method.
> 
> Then you can have a collection with only xml files by calling below methods.
> 
> Collection c = registry.newCollection();
> c.setChildPolicy(Collection.ALLOW_SELECTED);
> c.addChildMediaType("application/xml");
> registry.put("/projects/config", c);
> 
> On the UI side, we can provide some UI controls in the collection's page 
> to set the child policy and child media types.
> 
> Thoughts...
> 
> Thanks,
> Chathura
> 
> 
> _______________________________________________
> Registry-dev mailing list
> Registry-dev at wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/registry-dev
> 




More information about the Registry-dev mailing list