Glen Daniels wrote:
I'd like to propose we do the following, in order to achieve a better
design as we move into wider usage.
* Refactor Resource into an interface:
interface Resource {
// These are all accessors, since setting these values
// only makes sense for the backend.
String getAuthorName();
String getLastUpdaterName();
Date getCreated();
Date getModified();
String getParentPath();
String getPath();
String [] getDependencies();
String [] getDependants();
// Content
Object getContent();
void setContent(Object content);
String getMediaType();
void setMediaType(String mediaType);
String getDescription();
void setDescription();
// Properties (these will change if we support
// multi-values)
String getProperty(String name);
void setProperty(String name, String value);
}
* I'd propose at the same time we do this we get rid of "isDirectory()"
and get back to the (IMO much better) design of Collection extends
Resource, which will allow us to implement pagination as well as easier
access to collection entries.... So something like:
interface Collection extends Resource {
String [] getChildren(); // Get 'em all
String [] getChildren(int start, int pageSize); // Paged
}
* Provide the following methods in CoreRegistry:
/**
* Factory for Resources pre-initialized with correct date, author,
* etc.
*/
Resource newResource() throws RegistryException;
/**
* Make a collection at the given path, returning the actual
* path if successful.
*/
String createCollection(String path) throws RegistryException;
* So usage would look something like:
Resource resource = registry.newResource();
Um, did you mean to say ResourceImpl above? Otherwise how do the setter
methods below come into existence on the registry interface?
resource.setContent("hi there");
resource.setMediaType("text/plain");
resource.setDescription("A simple greeting");
registry.put("/helloWorld", resource);
Will rsource.getPath() return "/helloworld" after this operation?
Can I put the same resource into another location? That is, can I say
immediately after above, registry.put("/foo", resource)?
* We'd then have "ResourceImpl implements Resource", and ResourceImpl
would have all the setters - that's what gets used by JDBCRegistry.
I hate the idea of exposing a thing with the name of "*Impl" being exposed
to users. Can we come up with a better model?
Sanjiva.
--
Sanjiva Weerawarana, Ph.D.
Founder, Chairman & CEO; WSO2, Inc.; http://www.wso2.com/
email: [EMAIL PROTECTED]; cell: +1 650 265 8311 | +94 77 787 6880
"Oxygenating the Web Service Platform."
_______________________________________________
Registry-dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/registry-dev