clerezza-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject [41/87] [abbrv] [partial] clerezza git commit: CLEREZZA-966: removed platform. prefix of folder names
Date Tue, 14 Apr 2015 13:13:16 GMT
http://git-wip-us.apache.org/repos/asf/clerezza/blob/70220239/platform/content.representations/platform.content.representations.core/src/main/java/org/apache/clerezza/platform/content/representations/core/ThumbnailService.java
----------------------------------------------------------------------
diff --git a/platform/content.representations/platform.content.representations.core/src/main/java/org/apache/clerezza/platform/content/representations/core/ThumbnailService.java b/platform/content.representations/platform.content.representations.core/src/main/java/org/apache/clerezza/platform/content/representations/core/ThumbnailService.java
new file mode 100644
index 0000000..c58865c
--- /dev/null
+++ b/platform/content.representations/platform.content.representations.core/src/main/java/org/apache/clerezza/platform/content/representations/core/ThumbnailService.java
@@ -0,0 +1,378 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.clerezza.platform.content.representations.core;
+
+import java.net.URL;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.concurrent.locks.Lock;
+import javax.ws.rs.DefaultValue;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+import org.apache.clerezza.jaxrs.utils.RedirectUtil;
+import org.apache.clerezza.platform.config.PlatformConfig;
+import org.apache.clerezza.platform.graphprovider.content.ContentGraphProvider;
+import org.apache.clerezza.rdf.core.Literal;
+import org.apache.clerezza.rdf.core.LiteralFactory;
+import org.apache.clerezza.rdf.core.Resource;
+import org.apache.clerezza.rdf.core.TypedLiteral;
+import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.clerezza.rdf.ontologies.DISCOBITS;
+import org.apache.clerezza.rdf.ontologies.EXIF;
+import org.apache.clerezza.rdf.utils.GraphNode;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.Service;
+import org.apache.felix.scr.annotations.Services;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleEvent;
+import org.osgi.framework.BundleListener;
+import org.osgi.service.component.ComponentContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * This JAX-RS resource provides a method to retrieve the uri to
+ * the thumbnail or a other small representation of a InfoDiscoBit.
+ *
+ * @author mir
+ */
+@Component
+@Services({
+    @Service(Object.class),
+    @Service(ThumbnailService.class)
+})
+
+@Property(name = "javax.ws.rs", boolValue = true)
+@Path("thumbnail-service")
+public class ThumbnailService implements BundleListener {
+
+    @Reference
+    ContentGraphProvider cgProvider;
+    @Reference
+    PlatformConfig config;
+    @Reference
+    AlternativeRepresentationGenerator altRepGen;
+    private static final Logger log = LoggerFactory.getLogger(ThumbnailService.class);
+    private BundleContext bundleContext;
+    private String STATICWEB_PATH = "/CLEREZZA-INF/web-resources/style/";
+    private String MEDIA_TYPE_BASE_PATH = STATICWEB_PATH + "images/icons/mediatype/";
+    private Bundle cachedStyleBundle = null;
+    private Map<MediaType, String> mediaTypeIconUriCache =
+            Collections.synchronizedMap(new HashMap<MediaType, String>());
+
+    protected void activate(ComponentContext context) {
+        bundleContext = context.getBundleContext();
+        bundleContext.addBundleListener(this);
+    }
+
+    protected void deactivate(ComponentContext context) {
+        bundleContext.removeBundleListener(this);
+        bundleContext = null;
+        mediaTypeIconUriCache.clear();
+    }
+
+    /**
+     * Returns the thumbnail uri for a InfoDiscoBit which is located at the uri
+     * specified over the query parameter "uri". The thumbnails
+     * maximum width and height can optionally be specified over the query parameters
+     * "width" and "height". Futhermore there is the optional "exact" parameter,
+     * which specifies if the thumbnail must have the exact width and height as
+     * specified or not (default is "false"). If more than one acceptable thumbnail
+     * is available then the thumbnail uri of the thumbnail with the highest resolution
+     * (width * height) is returned. If no thumbnail is available and the logged
+     * in user has the write permission for the content graph, then an attempt is
+     * made to create the thumbnail on the fly. If this fails or the write permission
+     * is missing, then the uri of the icon representing the media type is returned.
+     * If also no media type icon is available the uri to default icon is returned.
+     *
+     * @param infoBitUri the uri of the infoDiscoBit of which the thumbnail uri should
+     *        be returned
+     * @param height the maximum height that the thumbnail has
+     * @param width the maximum width that the thumbnail has
+     * @param exact boolean that specifies if the return thumbnail should have
+     *        the exact width and height.
+     * @return
+     */
+    @GET
+    public Response getThumbnailUri(@QueryParam("uri") UriRef infoBitUri,
+            @QueryParam("width") Integer width, @QueryParam("height") Integer height,
+            @DefaultValue("false") @QueryParam("exact") Boolean exact, @Context UriInfo uriInfo) {
+        return RedirectUtil.createSeeOtherResponse(
+                getThumbnailUri(infoBitUri, width, height, exact).getUnicodeString(), uriInfo);
+    }
+
+
+    /**
+     * Returns the thumbnail uri for a InfoDiscoBit which is located at the uri
+     * specified over the query parameter "uri". The thumbnails
+     * maximum width and height can optionally be specified over the query parameters
+     * "width" and "height". If more than one acceptable thumbnail is available
+     * then the thumbnail uri of the thumbnail with the highest resolution
+     * (width * height) is returned. If no thumbnail is available and the logged
+     * in user has the write permission for the content graph, then an attempt is
+     * made to create the thumbnail on the fly. If this fails or the write permission
+     * is missing, then the uri of the icon representing the media type is returned.
+     * If also no media type icon is available the uri to default icon is returned.
+     *
+     * @param infoBitUri the uri of the infoDiscoBit of which the thumbnail uri should
+     *        be returned
+     * @param height the maximum height that the thumbnail has
+     * @param width the maximum width that the thumbnail has
+     * @return
+     */
+    public UriRef getThumbnailUri(UriRef infoBitUri, Integer width,  Integer height) {
+        return getThumbnailUri(infoBitUri, width, height, false);
+    }
+
+    /**
+     * Returns the thumbnail uri for a InfoDiscoBit which is located at the uri
+     * specified over the query parameter "uri". The thumbnails
+     * maximum width and height can optionally be specified over the query parameters
+     * "width" and "height". Futhermore there is the optional "exact" parameter,
+     * which specifies if the thumbnail must have the exact width and height as
+     * specified or not. If more than one acceptable thumbnail is available then
+     * the thumbnail uri of the thumbnail with the highest resolution (width * height)
+     * is returned. If no thumbnail is available and the logged in user has the write
+     * permission for the content graph, then an attempt is made to create the
+     * thumbnail on the fly. If this fails or the write permission is missing, then
+     * the uri of the icon representing the media type is returned. If also no
+     * media type icon is available the uri to default icon is returned.
+     *
+     * @param infoBitUri the uri of the infoDiscoBit of which the thumbnail uri should
+     *        be returned
+     * @param height the maximum height that the thumbnail has
+     * @param width the maximum width that the thumbnail has
+     * @param exact boolean that specifies if the return thumbnail should have
+     *        the exact width and height.
+     * @return
+     */
+    public UriRef getThumbnailUri(UriRef infoBitUri, Integer width,  Integer height,
+            boolean exact) {
+        if ((width == null) && (height == null)) {
+            throw new IllegalArgumentException("height and/or width must be specified");
+        }
+        if (width == null) {
+            width = Integer.MAX_VALUE;
+        }
+        if (height == null) {
+            height = Integer.MAX_VALUE;
+        }
+        GraphNode infoBitNode = new GraphNode(infoBitUri, cgProvider.getContentGraph());
+        UriRef thumbnailUri = getGeneratedThumbnailUri(infoBitNode, width, height, exact);
+        if (thumbnailUri == null) {
+            Literal mediaTypeLiteral = null;
+            Lock readLock = infoBitNode.readLock();
+            readLock.lock();
+            try {
+                Iterator<Resource> mediaTypes = infoBitNode.getObjects(DISCOBITS.mediaType);
+                if (mediaTypes.hasNext()) {
+                    mediaTypeLiteral = (Literal) mediaTypes.next();
+                }
+            } finally {
+                readLock.unlock();
+            }
+            if (mediaTypeLiteral != null) {
+                MediaType mediaType = MediaType.valueOf(mediaTypeLiteral.getLexicalForm());
+                // if the infoBit is an image, create a thumbnail on the fly.
+                if (mediaType.getType().startsWith("image")) {
+                    try {
+                        thumbnailUri = altRepGen.generateAlternativeImage(infoBitNode, width,
+                                height, exact);
+                    } catch (Exception ex) {
+                        ex.printStackTrace();
+                        // Was worth a try. eLets go on
+                    }
+                }
+                if (thumbnailUri == null) {
+                    String iconUri = mediaTypeIconUriCache.get(mediaType);
+                    if (iconUri == null) {
+                        iconUri = getMediaTypeIconUri(mediaType);
+                        mediaTypeIconUriCache.put(mediaType, iconUri);
+                    }
+                    thumbnailUri = new UriRef(iconUri);
+                }
+            }
+        }
+        if (thumbnailUri == null) {
+            thumbnailUri = new UriRef(getDefaultIconUrl(getStyleBundle()));
+        }
+        return thumbnailUri;
+    }
+
+    private String getMediaTypeIconUri(MediaType mediaType) {
+        Bundle styleBundle = getStyleBundle();
+        if (styleBundle == null) {
+            throw new RuntimeException("no style bundle found");
+        }
+        String path = MEDIA_TYPE_BASE_PATH + mediaType.getType() + "/";
+        Enumeration entries = styleBundle.findEntries(path,
+                mediaType.getSubtype() + ".*", false);
+        String iconUri = createIconUri(entries);
+        if (iconUri != null) {
+            return iconUri;
+        }
+        entries = styleBundle.findEntries(path, "any.*", false);
+        iconUri = createIconUri(entries);
+        if (iconUri != null) {
+            return iconUri;
+        }
+        return getDefaultIconUrl(styleBundle);
+    }
+
+    private String getDefaultIconUrl(Bundle bundle) {
+        Enumeration entries = bundle.findEntries(MEDIA_TYPE_BASE_PATH, "any.*", false);
+        String iconUri = createIconUri(entries);
+        if (iconUri != null) {
+            return iconUri;
+        } else {
+            throw new RuntimeException("No default icon found");
+        }
+    }
+
+    private String createIconUri(Enumeration entries) {
+        if (entries != null && entries.hasMoreElements()) {
+            URL iconUrl = (URL) entries.nextElement();
+            return iconUrl.getPath().replace(STATICWEB_PATH, "style/");
+        }
+        return null;
+    }
+
+    private UriRef getGeneratedThumbnailUri(GraphNode infoBitNode,
+            Integer width, Integer height, boolean exact) {
+        if (isFittingImage(infoBitNode, width, height, exact)) {
+            return (UriRef) infoBitNode.getNode();
+        }
+        UriRef resultThumbnailUri = null;
+        int pixels = 0;
+        Lock readLock = infoBitNode.readLock();
+        readLock.lock();
+        try {
+            Iterator<Resource> thumbnails = infoBitNode.getObjects(DISCOBITS.thumbnail);
+            while (thumbnails.hasNext()) {
+                UriRef thumbnailUri = (UriRef) thumbnails.next();
+                GraphNode thumbnailNode = new GraphNode(thumbnailUri,
+                        cgProvider.getContentGraph());
+                int thumbnailPixels = getSurfaceSizeIfFitting(thumbnailNode, width, height, exact);
+                if (thumbnailPixels > pixels) {
+                    if (exact) {
+                        return thumbnailUri;
+                    }
+                    resultThumbnailUri = thumbnailUri;
+                    pixels = thumbnailPixels;
+                }
+            }
+        } finally {
+            readLock.unlock();
+        }
+        return resultThumbnailUri;
+    }
+
+    /**
+     * returns the surface in pixel if the image fits withing width and height,
+     * or -1 if it doesn't fit
+     */
+    private int getSurfaceSizeIfFitting(GraphNode infoBitNode, Integer width, Integer height,
+            boolean exact) {
+        Resource imageRes = infoBitNode.getNode();
+        if (imageRes instanceof UriRef) {
+            String imageUri = ((UriRef)imageRes).getUnicodeString();
+            if (!exact && imageUri.contains(AlternativeRepresentationGenerator.EXACT_APPENDIX)) {
+                return -1;
+            }
+        }        
+        Iterator<Resource> exifWidths = infoBitNode.getObjects(EXIF.width);
+        Iterator<Resource> exifHeights = infoBitNode.getObjects(EXIF.height);
+        if (!exifWidths.hasNext() || !exifHeights.hasNext()) {
+            log.warn(infoBitNode.getNode() + " doesn't have exif:width and exif:height");
+            return -1;
+        }
+        int thumbnailWidth = LiteralFactory.getInstance().createObject(
+                Integer.class, (TypedLiteral) exifWidths.next());
+        int thumbnailHeight = LiteralFactory.getInstance().createObject(
+                Integer.class, (TypedLiteral) exifHeights.next());
+        if (exact) {
+            if (thumbnailHeight == height && thumbnailWidth == width) {
+                return 1;
+            }
+        } else {
+            if (thumbnailHeight <= height && thumbnailWidth <= width) {
+                return thumbnailWidth * thumbnailHeight;
+            }
+        }
+        return -1;
+    }
+
+    /**
+     * returns true if infoBitNode is an image and fits
+     */
+    private boolean isFittingImage(GraphNode infoBitNode, Integer width, Integer height,
+            boolean exact) {
+        Lock readLock = infoBitNode.readLock();
+        readLock.lock();
+        try {
+            final Iterator<Literal> mediaTypesIter = infoBitNode.getLiterals(DISCOBITS.mediaType);
+            if (!mediaTypesIter.hasNext()) {
+                return false;
+            }
+            if (mediaTypesIter.next().getLexicalForm().startsWith("image")) {
+                return getSurfaceSizeIfFitting(infoBitNode, width, height, exact) > -1;
+            } else {
+                return false;
+            }
+        } finally {
+            readLock.unlock();
+        }
+    }
+
+    private synchronized Bundle getStyleBundle() {
+        if (cachedStyleBundle != null) {
+            return cachedStyleBundle;
+        }
+        Bundle[] bundles = bundleContext.getBundles();
+        for (Bundle bundle : bundles) {
+            URL staticWebPathURL = bundle.getEntry(STATICWEB_PATH);
+            if (staticWebPathURL != null) {
+                cachedStyleBundle = bundle;
+                return bundle;
+            }
+        }
+        return null;
+    }
+
+    @Override
+    public synchronized void bundleChanged(BundleEvent be) {
+        if (be.getType() == BundleEvent.UNINSTALLED
+                && be.getBundle().equals(cachedStyleBundle)) {
+            cachedStyleBundle = null;
+            cachedStyleBundle = getStyleBundle();
+            mediaTypeIconUriCache.clear();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/70220239/platform/content.representations/platform.content.representations.ontologies/LICENSE
----------------------------------------------------------------------
diff --git a/platform/content.representations/platform.content.representations.ontologies/LICENSE b/platform/content.representations/platform.content.representations.ontologies/LICENSE
new file mode 100644
index 0000000..261eeb9
--- /dev/null
+++ b/platform/content.representations/platform.content.representations.ontologies/LICENSE
@@ -0,0 +1,201 @@
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.

http://git-wip-us.apache.org/repos/asf/clerezza/blob/70220239/platform/content.representations/platform.content.representations.ontologies/pom.xml
----------------------------------------------------------------------
diff --git a/platform/content.representations/platform.content.representations.ontologies/pom.xml b/platform/content.representations/platform.content.representations.ontologies/pom.xml
new file mode 100644
index 0000000..41cfd94
--- /dev/null
+++ b/platform/content.representations/platform.content.representations.ontologies/pom.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.clerezza</groupId>
+        <artifactId>platform.content.representations</artifactId>
+        <version>0.2</version>
+    </parent>
+    <groupId>org.apache.clerezza</groupId>
+    <artifactId>platform.content.representations.ontologies</artifactId>
+    <version>1.0.0-SNAPSHOT</version>
+    <packaging>bundle</packaging>
+    <name>Clerezza - Platform Content Representations Ontologies</name>
+    <description>
+        Representations Ontologies
+    </description>
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>rdf.core</artifactId>
+            <version>0.14</version>
+        </dependency>
+    </dependencies>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.clerezza</groupId>
+                <artifactId>maven-ontologies-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <phase>generate-sources</phase>
+                        <configuration>
+                            <resourcePath>${basedir}/src/main/resources</resourcePath>
+                            <sources>
+                                <source>${basedir}/target/generated-sources/main/java</source>
+                            </sources>
+                        </configuration>
+                        <goals>
+                            <goal>generate</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <version>0.4</version>
+        </plugin>
+        </plugins>
+    </build>
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/clerezza/blob/70220239/platform/content.representations/platform.content.representations.ontologies/src/main/resources/org/apache/clerezza/platform/content/representations/ontologies/representations.rdf
----------------------------------------------------------------------
diff --git a/platform/content.representations/platform.content.representations.ontologies/src/main/resources/org/apache/clerezza/platform/content/representations/ontologies/representations.rdf b/platform/content.representations/platform.content.representations.ontologies/src/main/resources/org/apache/clerezza/platform/content/representations/ontologies/representations.rdf
new file mode 100644
index 0000000..01e604d
--- /dev/null
+++ b/platform/content.representations/platform.content.representations.ontologies/src/main/resources/org/apache/clerezza/platform/content/representations/ontologies/representations.rdf
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+<rdf:RDF
+	xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+	xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
+	xmlns:owl="http://www.w3.org/2002/07/owl#"
+	xmlns:dc="http://purl.org/dc/elements/1.1/"
+	xmlns:skos="http://www.w3.org/2008/05/skos#"
+>
+
+<!-- Ontology -->
+
+<owl:Ontology rdf:about="http://clerezza.org/2009/12/representations#">
+	<owl:versionInfo>Revision: 0.1</owl:versionInfo>
+	<dc:title xml:lang="en">
+		Clerezza Content Representations
+	</dc:title>
+</owl:Ontology>
+
+
+<!-- Properties -->
+
+<rdf:Property rdf:about="http://clerezza.org/2009/12/representations#isIconFor">
+	<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#DatatypeProperty" />
+	<rdfs:label xml:lang="en">is icon for</rdfs:label>
+	<skos:definition xml:lang="en">Points to a string specifying the resource type for which the subject is an icon.</skos:definition>
+	<rdfs:isDefinedBy rdf:resource="http://clerezza.org/2009/12/representations#" />
+	<rdfs:domain rdf:resource="http://xmlns.com/foaf/0.1/Image" />
+	<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+</rdf:Property>
+</rdf:RDF>
+

http://git-wip-us.apache.org/repos/asf/clerezza/blob/70220239/platform/content.representations/pom.xml
----------------------------------------------------------------------
diff --git a/platform/content.representations/pom.xml b/platform/content.representations/pom.xml
new file mode 100644
index 0000000..0327c26
--- /dev/null
+++ b/platform/content.representations/pom.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.clerezza</groupId>
+        <artifactId>clerezza</artifactId>
+        <version>0.5</version>
+        <relativePath>../parent</relativePath>
+    </parent>
+    <groupId>org.apache.clerezza</groupId>
+    <artifactId>platform.content.representations</artifactId>
+    <packaging>pom</packaging>
+    <version>1.0.0-SNAPSHOT</version>
+    <name>Clerezza - Platform Content Representations</name>
+    <description>Provides services for creating and retrieving alternative representations of content.</description>
+    
+    <modules>
+        <module>platform.content.representations.ontologies</module>
+        <module>platform.content.representations.core</module>
+    </modules>
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/clerezza/blob/70220239/platform/content/LICENSE
----------------------------------------------------------------------
diff --git a/platform/content/LICENSE b/platform/content/LICENSE
new file mode 100644
index 0000000..261eeb9
--- /dev/null
+++ b/platform/content/LICENSE
@@ -0,0 +1,201 @@
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.

http://git-wip-us.apache.org/repos/asf/clerezza/blob/70220239/platform/content/pom.xml
----------------------------------------------------------------------
diff --git a/platform/content/pom.xml b/platform/content/pom.xml
new file mode 100644
index 0000000..0cb5e24
--- /dev/null
+++ b/platform/content/pom.xml
@@ -0,0 +1,154 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.clerezza</groupId>
+        <artifactId>clerezza</artifactId>
+        <version>0.5</version>
+        <relativePath>../parent</relativePath>
+    </parent>    <groupId>org.apache.clerezza</groupId>
+    <artifactId>platform.content</artifactId>
+    <version>1.0.0-SNAPSHOT</version>
+    <packaging>bundle</packaging>
+
+    <name>Clerezza - Platform Content</name>
+    <description>Clerezza CMS - A handler to manage and access data modeled using
+    the discobits ontology</description>
+    <dependencies>
+        <dependency>
+            <groupId>org.osgi</groupId>
+             <artifactId>org.osgi.core</artifactId>
+         </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+             <artifactId>org.osgi.compendium</artifactId>
+         </dependency>
+        <dependency>
+            <groupId>javax.ws.rs</groupId>
+            <artifactId>jsr311-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>rdf.core</artifactId>
+            <version>0.14</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>platform.typehandlerspace</artifactId>
+            <version>0.9</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>rdf.utils</artifactId>
+            <version>0.14</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>rdf.ontologies</artifactId>
+            <version>0.12</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>platform.graphprovider.content</artifactId>
+            <version>0.7</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>platform.graphnodeprovider</artifactId>
+            <version>0.2</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>platform.typerendering.seedsnipe</artifactId>
+            <version>0.7</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>web.fileserver</artifactId>
+            <exclusions>
+                <exclusion>
+                    <artifactId>javax.servlet</artifactId>
+                    <groupId>org.apache.felix</groupId>
+                </exclusion>
+            </exclusions>
+            <version>0.10</version>
+        </dependency>
+        <dependency>
+            <groupId>org.wymiwyg</groupId>
+            <artifactId>wymiwyg-commons-core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>jaxrs.utils</artifactId>
+            <version>0.9</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.scr.annotations</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>platform.config</artifactId>
+            <version>0.4</version>
+        </dependency>
+    <!--    <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>platform.security</artifactId>
+        </dependency> -->
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>platform.typerendering.scalaserverpages</artifactId>
+            <version>0.4</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>rdf.metadata</artifactId>
+            <version>0.2</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>rdf.core.test</artifactId>
+            <scope>test</scope>
+            <version>0.15</version>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza.ext</groupId>
+            <artifactId>slf4j-scala-api</artifactId>
+            <version>1.6.3</version>
+        </dependency>
+    </dependencies>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>net.sf.alchim</groupId>
+                <artifactId>yuicompressor-maven-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/clerezza/blob/70220239/platform/content/src/main/java/org/apache/clerezza/platform/content/AbstractDiscobitsHandler.java
----------------------------------------------------------------------
diff --git a/platform/content/src/main/java/org/apache/clerezza/platform/content/AbstractDiscobitsHandler.java b/platform/content/src/main/java/org/apache/clerezza/platform/content/AbstractDiscobitsHandler.java
new file mode 100644
index 0000000..e605c40
--- /dev/null
+++ b/platform/content/src/main/java/org/apache/clerezza/platform/content/AbstractDiscobitsHandler.java
@@ -0,0 +1,151 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.clerezza.platform.content;
+
+import org.apache.clerezza.rdf.metadata.MetaDataGenerator;
+import java.util.HashSet;
+import java.util.Iterator;
+
+import java.util.Set;
+import java.util.concurrent.locks.Lock;
+import javax.ws.rs.core.MediaType;
+import org.apache.clerezza.platform.content.collections.CollectionCreator;
+
+import org.apache.clerezza.rdf.core.LiteralFactory;
+import org.apache.clerezza.rdf.core.MGraph;
+import org.apache.clerezza.rdf.core.NonLiteral;
+import org.apache.clerezza.rdf.core.Triple;
+import org.apache.clerezza.rdf.core.TypedLiteral;
+import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.clerezza.rdf.core.access.LockableMGraph;
+import org.apache.clerezza.rdf.ontologies.DISCOBITS;
+import org.apache.clerezza.rdf.ontologies.RDF;
+import org.apache.clerezza.rdf.utils.GraphNode;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ *
+ * @author reto
+ */
+public abstract class AbstractDiscobitsHandler implements DiscobitsHandler {
+
+    private static final Logger logger = LoggerFactory.getLogger(AbstractDiscobitsHandler.class);
+
+    /**
+     *
+     * @return the MGraph to be used to retrieve and create discobits
+     */
+    protected abstract MGraph getMGraph();
+
+    /**
+     * A <code>Set</code> containing <code>MetaDataGenerator</code>s to be used
+     * to add meta data to data putted by the handler.
+     *
+     * @return a Set containing meta data generators
+     */
+    protected abstract Set<MetaDataGenerator> getMetaDataGenerators();
+
+    
+    @Override
+    public void put(UriRef infoDiscoBitUri, MediaType mediaType,
+            byte[] data) {
+
+        GraphNode infoDiscoBitNode;
+        final LockableMGraph mGraph = (LockableMGraph) getMGraph();
+        infoDiscoBitNode = new GraphNode(infoDiscoBitUri, mGraph);
+        CollectionCreator collectionCreator = new CollectionCreator(mGraph);
+        collectionCreator.createContainingCollections(infoDiscoBitUri);
+        Lock writeLock = mGraph.getLock().writeLock();
+        writeLock.lock();
+        try {
+            infoDiscoBitNode.addProperty(RDF.type, DISCOBITS.InfoDiscoBit);
+            TypedLiteral dataLiteral = LiteralFactory.getInstance().createTypedLiteral(data);
+            infoDiscoBitNode.deleteProperties(DISCOBITS.infoBit);
+            infoDiscoBitNode.addProperty(DISCOBITS.infoBit, dataLiteral);
+            TypedLiteral mediaTypeLiteral = LiteralFactory.getInstance().createTypedLiteral(mediaType.toString());
+            infoDiscoBitNode.deleteProperties(DISCOBITS.mediaType);
+            infoDiscoBitNode.addProperty(DISCOBITS.mediaType,mediaTypeLiteral);
+        } finally {
+            writeLock.unlock();
+        }
+        Set<MetaDataGenerator> metaDataGenerators = getMetaDataGenerators();
+        synchronized(metaDataGenerators) {
+            for(MetaDataGenerator generator : metaDataGenerators) {
+                try {
+                    generator.generate(infoDiscoBitNode, data, mediaType);
+                } catch (RuntimeException ex) {
+                    logger.error("Exception in MetaDataGenerator ", ex);
+                }
+            }
+        }
+    }
+
+    @Override
+    public  void remove(NonLiteral node) {
+        MGraph mGraph = getMGraph();        
+        Iterator<Triple> properties = mGraph.filter(node, null, null);
+        //copying properties to set, as we're modifying underlying graph
+        Set<Triple> propertiesSet = new HashSet<Triple>();
+        while (properties.hasNext()) {
+            propertiesSet.add(properties.next());
+        }
+        properties = propertiesSet.iterator();
+        while (properties.hasNext()) {
+            Triple triple = properties.next();
+            UriRef predicate = triple.getPredicate();
+            if (predicate.equals(DISCOBITS.contains)) {
+                try {
+                    GraphNode containedNode = new GraphNode((NonLiteral)triple.getObject(), mGraph);
+                    //The following includes triple
+                    containedNode.deleteNodeContext();
+                } catch (ClassCastException e) {
+                    throw new RuntimeException("The value of "+predicate+" is expected not to be a literal");
+                }
+                //as some other properties of node could have been in the context of the object
+                remove(node);
+                return;
+            }            
+        }
+        GraphNode graphNode = new GraphNode(node, mGraph);
+        graphNode.deleteNodeContext();
+    }
+
+    @Override
+    public byte[] getData(UriRef uriRef) {
+        MGraph mGraph = getMGraph();
+        GraphNode node = new GraphNode(uriRef, mGraph);
+        final InfoDiscobit infoDiscobit = InfoDiscobit.createInstance(node);
+        if (infoDiscobit == null) {
+            return null;
+        }
+        return infoDiscobit.getData();
+    }
+
+    @Override
+    public MediaType getMediaType(UriRef uriRef) {
+        MGraph mGraph = getMGraph();
+        GraphNode node = new GraphNode(uriRef, mGraph);
+        final InfoDiscobit infoDiscobit = InfoDiscobit.createInstance(node);
+        if (infoDiscobit == null) {
+            return null;
+        }
+        return MediaType.valueOf(infoDiscobit.getContentType());
+    }
+}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/70220239/platform/content/src/main/java/org/apache/clerezza/platform/content/CollectionTypeHandler.java
----------------------------------------------------------------------
diff --git a/platform/content/src/main/java/org/apache/clerezza/platform/content/CollectionTypeHandler.java b/platform/content/src/main/java/org/apache/clerezza/platform/content/CollectionTypeHandler.java
new file mode 100644
index 0000000..5bcf1af
--- /dev/null
+++ b/platform/content/src/main/java/org/apache/clerezza/platform/content/CollectionTypeHandler.java
@@ -0,0 +1,164 @@
+/*
+ * Copyright (c) 2008-2009 trialox.org (trialox AG, Switzerland).
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.clerezza.platform.content;
+
+import java.net.URL;
+import java.util.Map;
+import javax.ws.rs.GET;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+
+import org.apache.clerezza.platform.content.WebDavUtils.PropertyMap;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.Service;
+import org.apache.clerezza.platform.content.webdav.COPY;
+import org.apache.clerezza.platform.content.webdav.LOCK;
+import org.apache.clerezza.platform.content.webdav.UNLOCK;
+import org.apache.clerezza.platform.typehandlerspace.SupportedTypes;
+import org.apache.clerezza.platform.typerendering.RenderletManager;
+import org.apache.clerezza.platform.typerendering.scalaserverpages.ScalaServerPagesRenderlet;
+import org.apache.clerezza.rdf.core.MGraph;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.clerezza.rdf.core.impl.SimpleMGraph;
+import org.apache.clerezza.rdf.ontologies.HIERARCHY;
+import org.apache.clerezza.rdf.ontologies.PLATFORM;
+import org.apache.clerezza.rdf.ontologies.RDF;
+import org.apache.clerezza.rdf.utils.GraphNode;
+import org.apache.clerezza.rdf.utils.UnionMGraph;
+import org.apache.felix.scr.annotations.Services;
+import org.osgi.service.component.ComponentContext;
+
+/**
+ * Provides HTTP Methods for WebDav
+ * 
+ * @author ali
+ */
+
+@Component
+@Services({
+    @Service(Object.class),
+    @Service(CollectionTypeHandler.class)
+})
+@Property(name = "org.apache.clerezza.platform.typehandler", boolValue = true)
+@SupportedTypes(types = { "http://clerezza.org/2009/09/hierarchy#Collection" }, prioritize = true)
+public class CollectionTypeHandler extends DiscobitsTypeHandler{
+
+    private Logger logger = LoggerFactory.getLogger(CollectionTypeHandler.class);
+    
+    @Reference
+    private RenderletManager renderletManager;
+
+    /**
+     * The activate method is called when SCR activates the component configuration.
+     * This method gets the system graph or create a new one if it doesn't exist.
+     *
+     * @param componentContext
+     */
+    protected void activate(ComponentContext componentContext) {
+        URL templateURL = getClass().getResource("collection.ssp");
+        renderletManager.registerRenderlet(ScalaServerPagesRenderlet.class.getName(),
+                new UriRef(templateURL.toString()), HIERARCHY.Collection,
+                "naked", MediaType.APPLICATION_XHTML_XML_TYPE, true);
+
+        logger.info("CollectionTypeHandler activated.");
+    }
+
+    /**
+     * Returns a GraphNode of the requested collection
+     * @return 
+     */
+    @GET
+    @Override
+    public GraphNode getResource(@Context UriInfo uriInfo) {
+        final MGraph contentGraph = cgProvider.getContentGraph();
+        final String uriString = uriInfo.getAbsolutePath().toString();
+        final UriRef indexUri = new UriRef(uriString+"index");
+        if (contentGraph.filter(indexUri, null, null).hasNext()) {
+            return new GraphNode(indexUri, contentGraph);
+        }
+        final UriRef uri = new UriRef(uriString);
+        MGraph mGraph = new UnionMGraph(new SimpleMGraph(), contentGraph);
+        final GraphNode graphNode = new GraphNode(uri, mGraph);
+        graphNode.addProperty(RDF.type, PLATFORM.HeadedPage);
+
+        UriRef collectionUri = new UriRef(uriInfo.getAbsolutePath().toString());
+        return graphNode;
+    }
+
+    @Override
+    Map<UriRef, PropertyMap> getPropNames(GraphNode node, String depthHeader) {
+        return WebDavUtils.getCollectionProps(null, null, null, node,
+                            depthHeader, false /* doesNotIncludeValues */);
+    }
+
+    @Override
+    Map<UriRef, PropertyMap> getPropsByName(Node requestNode, GraphNode node,
+            String depthHeader) {
+        Map<UriRef, PropertyMap> result;
+        NodeList children = requestNode.getChildNodes();
+        result = WebDavUtils.getPropsByName(children, node, depthHeader,
+                true /* includeValues */);
+        return result;
+    }
+
+    @Override
+    Map<UriRef, PropertyMap> getAllProps(GraphNode node, String depthHeader) {
+        return WebDavUtils.getCollectionProps(null, null, null, node,
+                            depthHeader, true /* includeValues */);
+    }
+
+    /*-----------------------*
+     * Not Supported Methods * 
+     *-----------------------*/
+    
+    /**
+     * Locks a resource
+     *
+     * @return returns a 501 Not Implemented response
+     */
+    @LOCK
+    public Object lock() {
+        return Response.status(501/* Not Implemented */).build();
+    }
+
+    /**
+     * Unlocks a resource
+     *
+     * @return returns a 501 Not Implemented response
+     */
+    @UNLOCK
+    public Object unlock() {
+        return Response.status(501/* Not Implemented */).build();
+    }
+
+    /**
+     * Copies a resource
+     *
+     * @return returns a 501 Not Implemented response
+     */
+    @COPY
+    public Object copy() {
+        return Response.status(501/* Not Implemented */).build();
+    }
+}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/70220239/platform/content/src/main/java/org/apache/clerezza/platform/content/ContentPostSupport.java
----------------------------------------------------------------------
diff --git a/platform/content/src/main/java/org/apache/clerezza/platform/content/ContentPostSupport.java b/platform/content/src/main/java/org/apache/clerezza/platform/content/ContentPostSupport.java
new file mode 100644
index 0000000..6a7db15
--- /dev/null
+++ b/platform/content/src/main/java/org/apache/clerezza/platform/content/ContentPostSupport.java
@@ -0,0 +1,98 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.clerezza.platform.content;
+
+
+import java.net.URI;
+import java.util.concurrent.locks.Lock;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import org.apache.clerezza.jaxrs.utils.form.FormFile;
+import org.apache.clerezza.jaxrs.utils.form.MultiPartBody;
+import org.apache.clerezza.platform.graphprovider.content.ContentGraphProvider;
+import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.clerezza.rdf.core.access.LockableMGraph;
+import org.apache.clerezza.rdf.ontologies.RDF;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.Service;
+
+/**
+ * This Jax-rs root resource provides a method to post content to the content
+ * graph
+ *
+ * @author mir
+ */
+@Component
+@Service(Object.class)
+@Property(name="javax.ws.rs", boolValue=true)
+@Path("content")
+public class ContentPostSupport {
+    
+    @Reference
+    private DiscobitsHandler handler;
+
+    @Reference
+    private ContentGraphProvider cgProvider;
+
+    /**
+     * Creates an InfoDiscoBt (aka Binary Content) in the content graph.<br/>
+     * This JAX-RS method is available under the path "content". It requires
+     * a multipart/form-data with two fields: "content", which is the content of the
+     * InfoDiscobit to be created and "uri" which is the uri of the new
+     * InfoDiscoBit.
+     *
+     * @param form
+     * @return Returns a Created (201) response, if the info bit was successfully
+     * uploaded. Returns Bad Request (400) response, if required form fields are
+     * missing. Returns a Conflict (409) response, if at the specified URI a
+     * resource already exists.
+     */
+    @POST
+    @Consumes("multipart/form-data")
+    public Response postContent(MultiPartBody form) {
+        FormFile formFile = form.getFormFileParameterValues("content")[0];
+        String uri = form.getTextParameterValues("uri")[0];
+        byte[] content = formFile.getContent();
+        if (content == null || uri == null) {
+            return Response.status(400).entity("Required form field is missing").
+                    type(MediaType.TEXT_PLAIN_TYPE).build();
+        }
+        LockableMGraph contentGraph = cgProvider.getContentGraph();
+        Lock readLock = contentGraph.getLock().readLock();
+        readLock.lock();
+        try {
+            if (contentGraph.filter(new UriRef(uri), RDF.type, null).hasNext()) {
+                return Response.status(Response.Status.CONFLICT).
+                        entity("A resource with the specified URI already exists").
+                        type(MediaType.TEXT_PLAIN_TYPE).build();
+            }
+        } finally {
+            readLock.unlock();
+        }
+        handler.put(new UriRef(uri), formFile.getMediaType(), content);
+        return Response.created(URI.create(uri)).build();
+    }    
+    
+}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/70220239/platform/content/src/main/java/org/apache/clerezza/platform/content/DiscobitTemplating.java
----------------------------------------------------------------------
diff --git a/platform/content/src/main/java/org/apache/clerezza/platform/content/DiscobitTemplating.java b/platform/content/src/main/java/org/apache/clerezza/platform/content/DiscobitTemplating.java
new file mode 100644
index 0000000..3b45d62
--- /dev/null
+++ b/platform/content/src/main/java/org/apache/clerezza/platform/content/DiscobitTemplating.java
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.clerezza.platform.content;
+
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Reference;
+
+
+import javax.ws.rs.core.MediaType;
+
+import org.osgi.service.component.ComponentContext;
+import org.apache.clerezza.platform.typerendering.RenderletManager;
+import org.apache.clerezza.platform.typerendering.scalaserverpages.ScalaServerPagesRenderlet;
+import org.apache.clerezza.platform.typerendering.seedsnipe.SeedsnipeRenderlet;
+import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.clerezza.rdf.ontologies.DISCOBITS;
+import org.apache.clerezza.rdf.ontologies.RDFS;
+
+/**
+ *
+ * @author tio
+ */
+@Component(immediate = true)
+public class DiscobitTemplating {
+
+    @Reference
+    RenderletManager renderletManager;
+
+    protected void activate(ComponentContext context) {
+
+        // register seedsnipe renderlets
+        renderletManager.registerRenderlet(SeedsnipeRenderlet.class.getName(),
+                new UriRef(getClass().getResource("Resource.xhtml").toString()),
+                RDFS.Resource, null, MediaType.APPLICATION_XHTML_XML_TYPE, true);
+
+        renderletManager.registerRenderlet(SeedsnipeRenderlet.class.getName(),
+                new UriRef(getClass().getResource("Resource_naked.xhtml").toString()),
+                RDFS.Resource, "(naked|.*-naked)", MediaType.APPLICATION_XHTML_XML_TYPE, true);
+
+        renderletManager.registerRenderlet(SeedsnipeRenderlet.class.getName(),
+                new UriRef(getClass().getResource("XHTML_InfoDiscoBit_naked.xhtml").toString()),
+                DISCOBITS.XHTMLInfoDiscoBit, "naked", MediaType.APPLICATION_XHTML_XML_TYPE, true);
+
+        renderletManager.registerRenderlet(SeedsnipeRenderlet.class.getName(),
+                new UriRef(getClass().getResource("OrderedContent_naked.xhtml").toString()),
+                DISCOBITS.OrderedContent, "naked", MediaType.APPLICATION_XHTML_XML_TYPE, true);
+
+        renderletManager.registerRenderlet(SeedsnipeRenderlet.class.getName(),
+                new UriRef(getClass().getResource("TitledContent.xhtml").toString()),
+                DISCOBITS.TitledContent, null, MediaType.APPLICATION_XHTML_XML_TYPE, true);
+
+        renderletManager.registerRenderlet(TitledContentRenderlet.class.getName(),
+                null, DISCOBITS.TitledContent, "naked", MediaType.APPLICATION_XHTML_XML_TYPE, true);
+
+        // registre renderlet for XMLLiteral datatype.
+        renderletManager.registerRenderlet(ScalaServerPagesRenderlet.class.getName(),
+                new UriRef(getClass().getResource("XmlLiteral.ssp").toString()),
+                new UriRef("http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral"), null,
+                MediaType.APPLICATION_XHTML_XML_TYPE, true);
+    }
+}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/70220239/platform/content/src/main/java/org/apache/clerezza/platform/content/DiscobitsHandler.java
----------------------------------------------------------------------
diff --git a/platform/content/src/main/java/org/apache/clerezza/platform/content/DiscobitsHandler.java b/platform/content/src/main/java/org/apache/clerezza/platform/content/DiscobitsHandler.java
new file mode 100644
index 0000000..2e3e441
--- /dev/null
+++ b/platform/content/src/main/java/org/apache/clerezza/platform/content/DiscobitsHandler.java
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.clerezza.platform.content;
+
+import javax.ws.rs.core.MediaType;
+
+import org.apache.clerezza.rdf.core.NonLiteral;
+import org.apache.clerezza.rdf.core.UriRef;
+
+/**
+ * Provides utility methods to create, retrieve and remove binary contents.
+ * Binary contents are modeled as InfoDiscoBit from the discobit ontology at
+ * http://discobits.org/ontology
+ *
+ * @author rbn
+ */
+public interface DiscobitsHandler {
+
+    /**
+     * Creates an InfoDiscoBit
+     * 
+     * @param infoDiscoBitUri
+     * @param mediaType
+     * @param data
+     */
+    public abstract void put(UriRef infoDiscoBitUri, MediaType mediaType,
+            byte[] data);
+
+    /**
+     * Removes InfoDiscoBits (aka binary contents), other DiscoBits and
+     * the context of the specified node. If it is in a hierarchy then it
+     * will be removed also form its container.
+     * 
+     * @param node
+     */
+    public abstract void remove(NonLiteral node);
+
+    /**
+     * 
+     * @param uriRef
+     * @return the media type of the InfoDiscoBit with the specified URI or null
+     *         if no MediaType for that URI is known
+     */
+    public MediaType getMediaType(UriRef uriRef);
+
+    /**
+     * 
+     * @param uriRef
+     * @return a byte[] with the data of the InfoDiscoBit with the specified URI
+     *         or null if no data for that URI is known
+     */
+    public byte[] getData(UriRef uriRef);
+
+}
\ No newline at end of file


Mime
View raw message