Search in sources :

Example 41 with GWException

use of com.pspace.ifs.ksan.gw.exception.GWException in project ksan by infinistor.

the class S3Request method listObject.

protected ObjectListParameter listObject(String bucket, S3ObjectList s3ObjectList) throws GWException {
    ObjectListParameter objectListParameter = null;
    try {
        setObjManager();
        objectListParameter = objManager.listObject(bucket, s3ObjectList);
    } catch (Exception e) {
        PrintStack.logging(logger, e);
        throw new GWException(GWErrorCode.SERVER_ERROR, s3Parameter);
    } finally {
        try {
            releaseObjManager();
        } catch (Exception e) {
            PrintStack.logging(logger, e);
            throw new GWException(GWErrorCode.SERVER_ERROR, s3Parameter);
        }
    }
    return objectListParameter;
}
Also used : ObjectListParameter(com.pspace.ifs.ksan.gw.identity.ObjectListParameter) GWException(com.pspace.ifs.ksan.gw.exception.GWException) GWException(com.pspace.ifs.ksan.gw.exception.GWException) ResourceAlreadyExistException(com.pspace.ifs.ksan.objmanager.ObjManagerException.ResourceAlreadyExistException) XMLStreamException(javax.xml.stream.XMLStreamException) ResourceNotFoundException(com.pspace.ifs.ksan.objmanager.ObjManagerException.ResourceNotFoundException) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) JsonMappingException(com.fasterxml.jackson.databind.JsonMappingException)

Example 42 with GWException

use of com.pspace.ifs.ksan.gw.exception.GWException in project ksan by infinistor.

the class S3Request method create.

protected Metadata create(String bucket, String object) throws GWException {
    Metadata meta = null;
    try {
        setObjManager();
        meta = objManager.create(bucket, object);
    } catch (Exception e) {
        PrintStack.logging(logger, e);
        throw new GWException(GWErrorCode.SERVER_ERROR, s3Parameter);
    } finally {
        try {
            releaseObjManager();
        } catch (Exception e) {
            PrintStack.logging(logger, e);
            throw new GWException(GWErrorCode.SERVER_ERROR, s3Parameter);
        }
    }
    return meta;
}
Also used : Metadata(com.pspace.ifs.ksan.objmanager.Metadata) GWException(com.pspace.ifs.ksan.gw.exception.GWException) GWException(com.pspace.ifs.ksan.gw.exception.GWException) ResourceAlreadyExistException(com.pspace.ifs.ksan.objmanager.ObjManagerException.ResourceAlreadyExistException) XMLStreamException(javax.xml.stream.XMLStreamException) ResourceNotFoundException(com.pspace.ifs.ksan.objmanager.ObjManagerException.ResourceNotFoundException) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) JsonMappingException(com.fasterxml.jackson.databind.JsonMappingException)

Example 43 with GWException

use of com.pspace.ifs.ksan.gw.exception.GWException in project ksan by infinistor.

the class S3Request method isExistBucket.

protected boolean isExistBucket(String bucket) throws GWException {
    boolean result = false;
    try {
        setObjManager();
        result = objManager.isBucketExist(bucket);
    } catch (Exception e) {
        PrintStack.logging(logger, e);
        throw new GWException(GWErrorCode.SERVER_ERROR, s3Parameter);
    } finally {
        try {
            releaseObjManager();
        } catch (Exception e) {
            PrintStack.logging(logger, e);
            throw new GWException(GWErrorCode.SERVER_ERROR, s3Parameter);
        }
    }
    return result;
}
Also used : GWException(com.pspace.ifs.ksan.gw.exception.GWException) GWException(com.pspace.ifs.ksan.gw.exception.GWException) ResourceAlreadyExistException(com.pspace.ifs.ksan.objmanager.ObjManagerException.ResourceAlreadyExistException) XMLStreamException(javax.xml.stream.XMLStreamException) ResourceNotFoundException(com.pspace.ifs.ksan.objmanager.ObjManagerException.ResourceNotFoundException) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) JsonMappingException(com.fasterxml.jackson.databind.JsonMappingException)

Example 44 with GWException

use of com.pspace.ifs.ksan.gw.exception.GWException in project ksan by infinistor.

the class S3Request method createLocal.

protected Metadata createLocal(String bucket, String object) throws GWException {
    Metadata meta = null;
    try {
        setObjManager();
        meta = objManager.createLocal(bucket, object);
    } catch (Exception e) {
        PrintStack.logging(logger, e);
        throw new GWException(GWErrorCode.SERVER_ERROR, s3Parameter);
    } finally {
        try {
            releaseObjManager();
        } catch (Exception e) {
            PrintStack.logging(logger, e);
            throw new GWException(GWErrorCode.SERVER_ERROR, s3Parameter);
        }
    }
    return meta;
}
Also used : Metadata(com.pspace.ifs.ksan.objmanager.Metadata) GWException(com.pspace.ifs.ksan.gw.exception.GWException) GWException(com.pspace.ifs.ksan.gw.exception.GWException) ResourceAlreadyExistException(com.pspace.ifs.ksan.objmanager.ObjManagerException.ResourceAlreadyExistException) XMLStreamException(javax.xml.stream.XMLStreamException) ResourceNotFoundException(com.pspace.ifs.ksan.objmanager.ObjManagerException.ResourceNotFoundException) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) JsonMappingException(com.fasterxml.jackson.databind.JsonMappingException)

Example 45 with GWException

use of com.pspace.ifs.ksan.gw.exception.GWException in project ksan by infinistor.

the class S3DataRequest method readXml.

protected String readXml() throws GWException {
    String ret = null;
    try {
        byte[] xml = s3Parameter.getInputStream().readAllBytes();
        s3Parameter.addRequestSize(xml.length);
        ret = new String(xml);
    } catch (IOException e) {
        PrintStack.logging(logger, e);
        throw new GWException(GWErrorCode.INTERNAL_SERVER_ERROR, s3Parameter);
    }
    logger.info(ret);
    if (Strings.isNullOrEmpty(ret)) {
        logger.warn(GWErrorCode.INVALID_ARGUMENT.getMessage());
        throw new GWException(GWErrorCode.INVALID_ARGUMENT, s3Parameter);
    }
    if (!ret.contains(GWConstants.XML_VERSION)) {
        ret = GWConstants.XML_VERSION_FULL_STANDALONE + ret;
    }
    return ret;
}
Also used : IOException(java.io.IOException) GWException(com.pspace.ifs.ksan.gw.exception.GWException)

Aggregations

GWException (com.pspace.ifs.ksan.gw.exception.GWException)130 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)61 S3Bucket (com.pspace.ifs.ksan.gw.identity.S3Bucket)58 XMLStreamException (javax.xml.stream.XMLStreamException)48 IOException (java.io.IOException)46 JsonMappingException (com.fasterxml.jackson.databind.JsonMappingException)45 ResourceNotFoundException (com.pspace.ifs.ksan.objmanager.ObjManagerException.ResourceNotFoundException)43 ResourceAlreadyExistException (com.pspace.ifs.ksan.objmanager.ObjManagerException.ResourceAlreadyExistException)32 XmlMapper (com.fasterxml.jackson.dataformat.xml.XmlMapper)23 Metadata (com.pspace.ifs.ksan.objmanager.Metadata)23 S3Metadata (com.pspace.ifs.ksan.gw.identity.S3Metadata)17 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)16 XMLOutputFactory (javax.xml.stream.XMLOutputFactory)15 AccessControlPolicy (com.pspace.ifs.ksan.gw.format.AccessControlPolicy)14 Writer (java.io.Writer)13 XMLStreamWriter (javax.xml.stream.XMLStreamWriter)13 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)11 Grant (com.pspace.ifs.ksan.gw.format.AccessControlPolicy.AccessControlList.Grant)10 S3ObjectOperation (com.pspace.ifs.ksan.gw.object.S3ObjectOperation)10 Date (java.util.Date)8