Introduce CRUD to GCR
[lgpl/argeo-commons.git] / org.argeo.api / src / org / argeo / api / gcr / Content.java
index b032aa7b888020dce1779b34d0434ee36613fd28..9ce6ea4f6b3f70f4add3ac5895c5e603523622de 100644 (file)
@@ -9,17 +9,32 @@ public interface Content extends Iterable<Content>, Map<String, Object> {
 
        String getName();
 
-//     Iterable<String> keys();
+       String getPath();
 
-       <A> A get(String key, Class<A> clss);
+       Content getParent();
 
-//     ContentSession getSession();
+       /*
+        * ATTRIBUTES OPERATIONS
+        */
+
+       <A> A get(String key, Class<A> clss) throws IllegalArgumentException;
+
+       /*
+        * CONTENT OPERATIONS
+        */
+       Content add(String name, ContentName... classes);
+
+       void remove();
 
        /*
         * DEFAULT METHODS
         */
-       default <A> A adapt(Class<A> clss) {
-               return null;
+       default <A> A adapt(Class<A> clss) throws IllegalArgumentException {
+               throw new IllegalArgumentException("Cannot adapt content " + this + " to " + clss.getName());
+       }
+
+       default <C extends AutoCloseable> C open(Class<C> clss) throws Exception, IllegalArgumentException {
+               throw new IllegalArgumentException("Cannot open content " + this + " as " + clss.getName());
        }
 
        /*