Package com.semagia.atomico.server.storage

Examples of com.semagia.atomico.server.storage.IModifiableStorage


     * @throws StorageException
     * @throws UnsupportedMediaTypeException
     */
    @POST
    public Response addFragment(final InputStream in, @Context HttpHeaders headers) throws StorageException, UnsupportedMediaTypeException {
        final IModifiableStorage storage = super.getModifiableStorage();
        final MediaType mediaType = MediaTypeUtils.toAtomicoMediaType(headers.getMediaType());
        // Reject request iff the media type is null.
        if (mediaType == null) {
            // 415 == Unsupported Media Type
            return Response.status(415).build();
        }
        final IFragmentInfo info = storage.addFragment(_collInfo.getCollectionId(), null);
        if (info == null) {
            throw new WebApplicationException(Status.INTERNAL_SERVER_ERROR);
        }
        return Response.created(LinkUtils.linkTo(getBaseURI(), _collInfo, info))
                        .lastModified(new Date(info.getUpdated()))
View Full Code Here


     * @throws StorageException
     * @throws UnsupportedMediaTypeException
     */
    @POST
    public Response addSnapshot(final InputStream in, @Context HttpHeaders headers) throws StorageException, UnsupportedMediaTypeException {
        final IModifiableStorage storage = super.getModifiableStorage();
        final MediaType mediaType = MediaTypeUtils.toAtomicoMediaType(headers.getMediaType());
        // Reject request iff the media type is null.
        if (mediaType == null) {
            // 415 == Unsupported Media Type
            return Response.status(415).build();
        }
        final ISnapshotInfo info = storage.addSnapshot(_collInfo.getCollectionId(), null);
        if (info == null) {
            throw new WebApplicationException(Status.INTERNAL_SERVER_ERROR);
        }
        return Response.created(LinkUtils.linkTo(getBaseURI(), _collInfo, info))
                        .lastModified(new Date(info.getUpdated()))
View Full Code Here

     * @throws StorageException In case of an error.
     */
    @DELETE
    @Produces("*/*")
    public Response deleteSnapshot() throws StorageException {
        final IModifiableStorage storage = super.getModifiableStorage();
        if (storage == null) {
            return ResponseUtils.methodNotAllowed();
        }
        final boolean success = storage.deleteSnapshot(_collInfo.getCollectionId(), _snapshotInfo.getSnapshotId());
        final ResponseBuilder builder = success ? Response.ok() : Response.status(Status.INTERNAL_SERVER_ERROR);
        return builder.build();
    }
View Full Code Here

TOP

Related Classes of com.semagia.atomico.server.storage.IModifiableStorage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.