Search in sources :

Example 51 with GWException

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

the class S3Request method initBucketInfo.

protected void initBucketInfo(String bucket) throws GWException {
    checkBucket(bucket);
    try {
        setObjManager();
        dstBucket = objManager.getBucket(bucket);
        if (dstBucket != null) {
            if (!dstBucket.getAcl().startsWith(GWConstants.XML_VERSION)) {
                dstBucket.setAcl(GWUtils.makeOriginalXml(dstBucket.getAcl(), s3Parameter));
            }
        }
    } catch (ResourceNotFoundException e) {
        throw new GWException(GWErrorCode.NO_SUCH_BUCKET, s3Parameter);
    } 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);
        }
    }
    if (dstBucket == null) {
        logger.info(GWConstants.LOG_BUCKET_IS_NOT_EXIST, bucket);
        throw new GWException(GWErrorCode.NO_SUCH_BUCKET, s3Parameter);
    }
}
Also used : GWException(com.pspace.ifs.ksan.gw.exception.GWException) ResourceNotFoundException(com.pspace.ifs.ksan.objmanager.ObjManagerException.ResourceNotFoundException) 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 52 with GWException

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

the class DataPostObject method checkPolityStarts.

public void checkPolityStarts(String header, String value) throws GWException {
    if (header.startsWith(GWConstants.DOLLAR_SIGN)) {
        header = header.substring(1);
    }
    String[] comma = value.split(GWConstants.COMMA);
    for (String val : comma) {
        // case들을 enum으로 만들어서 loop로 해결할 예정입니다.
        if (header.equalsIgnoreCase(GWConstants.PARAMETER_ACL) && (acl.startsWith(val) || Strings.isNullOrEmpty(value))) {
            return;
        } else if (header.equalsIgnoreCase(GWConstants.AWS_ACCESS_KEY_ID) && (accesskey.startsWith(val) || Strings.isNullOrEmpty(value))) {
            return;
        } else if (header.equalsIgnoreCase(GWConstants.X_AMZ_CREDENTIAL) && (accesskey.startsWith(val) || Strings.isNullOrEmpty(value))) {
            return;
        } else if (header.equalsIgnoreCase(GWConstants.CONTENT_TYPE) && (contentType.startsWith(val) || Strings.isNullOrEmpty(value))) {
            return;
        } else if (header.equalsIgnoreCase(GWConstants.KEY) && (key.startsWith(val) || Strings.isNullOrEmpty(value))) {
            return;
        } else if (header.equalsIgnoreCase(GWConstants.SIGNATURE) && (signature.startsWith(val) || Strings.isNullOrEmpty(value))) {
            return;
        } else if (header.equalsIgnoreCase(GWConstants.X_AMZ_SIGNATURE) && (signature.startsWith(val) || Strings.isNullOrEmpty(value))) {
            return;
        } else if (header.equalsIgnoreCase(GWConstants.X_AMZ_ALGORITHM) && (algorithm.startsWith(val) || Strings.isNullOrEmpty(value))) {
            return;
        } else if (header.equalsIgnoreCase(GWConstants.CACHE_CONTROL) && (cacheControl.startsWith(val) || Strings.isNullOrEmpty(value))) {
            return;
        } else if (header.equalsIgnoreCase(GWConstants.CONTENT_DISPOSITION) && (contentDisposition.startsWith(val) || Strings.isNullOrEmpty(value))) {
            return;
        } else if (header.equalsIgnoreCase(GWConstants.CONTENT_ENCODING) && (contentEncoding.startsWith(val) || Strings.isNullOrEmpty(value))) {
            return;
        } else if (header.equalsIgnoreCase(GWConstants.TAGGING) && (tagging.startsWith(val) || Strings.isNullOrEmpty(value))) {
            return;
        } else if (header.equalsIgnoreCase(GWConstants.SUCCESS_ACTION_STATUS) && (successActionStatus.startsWith(val) || Strings.isNullOrEmpty(value))) {
            return;
        } else if (header.equalsIgnoreCase(GWConstants.SUCCESS_ACTION_REDIRECT) && (successActionRedirect.startsWith(val) || Strings.isNullOrEmpty(value))) {
            return;
        } else if (header.equalsIgnoreCase(GWConstants.X_AMZ_SERVER_SIDE_ENCRYPTION) && (serverSideEncryption.startsWith(val) || Strings.isNullOrEmpty(value))) {
            return;
        } else if (header.equalsIgnoreCase(GWConstants.X_AMZ_SERVER_SIDE_ENCRYPTION_AWS_KMS_KEY_ID) && (serverSideEncryptionAwsKmsKeyId.startsWith(val) || Strings.isNullOrEmpty(value))) {
            return;
        } else if (header.equalsIgnoreCase(GWConstants.X_AMZ_SERVER_SIDE_ENCRYPTION_CONTEXT) && (serverSideEncryptionContext.startsWith(val) || Strings.isNullOrEmpty(value))) {
            return;
        } else if (header.equalsIgnoreCase(GWConstants.X_AMZ_SERVER_SIDE_ENCRYPTION_BUCKET_KEY_ENABLED) && (serverSideEncryptionBucketKeyEnabled.startsWith(val) || Strings.isNullOrEmpty(value))) {
            return;
        } else if (header.equalsIgnoreCase(GWConstants.X_AMZ_SERVER_SIDE_ENCRYPTION_CUSTOMER_ALGORITHM) && (serverSideEncryptionCustomerAlgorithm.startsWith(val) || Strings.isNullOrEmpty(value))) {
            return;
        } else if (header.equalsIgnoreCase(GWConstants.X_AMZ_SERVER_SIDE_ENCRYPTION_CUSTOMER_KEY) && (serverSideEncryptionCustomerKey.startsWith(val) || Strings.isNullOrEmpty(value))) {
            return;
        } else if (header.equalsIgnoreCase(GWConstants.X_AMZ_SERVER_SIDE_ENCRYPTION_CUSTOMER_KEY_MD5) && (serverSideEncryptionCustomerKeyMD5.startsWith(val) || Strings.isNullOrEmpty(value))) {
            return;
        } else if (header.toLowerCase().startsWith(GWConstants.USER_METADATA_PREFIX)) {
            if (Strings.isNullOrEmpty(userMetadata.get(header))) {
                logger.info(GWErrorCode.ACCESS_DENIED.getMessage());
                throw new GWException(GWErrorCode.ACCESS_DENIED, s3Parameter);
            }
            if ((userMetadata.get(header).startsWith(val) || Strings.isNullOrEmpty(value)))
                return;
        }
    }
    logger.info(GWErrorCode.ACCESS_DENIED.getMessage());
    throw new GWException(GWErrorCode.ACCESS_DENIED, s3Parameter);
}
Also used : GWException(com.pspace.ifs.ksan.gw.exception.GWException)

Example 53 with GWException

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

the class DataPostObject method extract.

@Override
public void extract() throws GWException {
    String boundaryHeader = s3Parameter.getRequest().getHeader(HttpHeaders.CONTENT_TYPE);
    String boundary = boundaryHeader.substring(boundaryHeader.indexOf('=') + 1);
    try {
        s3Parameter.setInputStream(s3Parameter.getRequest().getInputStream());
    } catch (IOException e) {
        PrintStack.logging(logger, e);
        throw new GWException(GWErrorCode.INTERNAL_SERVER_ERROR, s3Parameter);
    }
    MultipartStream multipartStream = new MultipartStream(s3Parameter.getInputStream(), boundary.getBytes(StandardCharsets.UTF_8), 4096, null);
    boolean nextPart = false;
    try {
        nextPart = multipartStream.skipPreamble();
    } catch (IOException e) {
        PrintStack.logging(logger, e);
        throw new GWException(GWErrorCode.INTERNAL_SERVER_ERROR, s3Parameter);
    }
    while (nextPart) {
        String header;
        try {
            header = multipartStream.readHeaders();
            try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
                multipartStream.readBodyData(baos);
                if (GWUtils.isField(header, GWConstants.PARAMETER_ACL)) {
                    aclkeyword = true;
                    acl = new String(baos.toByteArray());
                } else if (GWUtils.isField(header, GWConstants.AWS_ACCESS_KEY_ID) || GWUtils.isField(header, GWConstants.X_AMZ_CREDENTIAL)) {
                    accesskey = new String(baos.toByteArray());
                } else if (GWUtils.isField(header, GWConstants.CONTENT_TYPE)) {
                    contentType = new String(baos.toByteArray());
                } else if (GWUtils.isField(header, GWConstants.OBJECT_TYPE_FILE)) {
                    payload = baos.toByteArray();
                } else if (GWUtils.isField(header, GWConstants.KEY)) {
                    key = new String(baos.toByteArray());
                } else if (GWUtils.isField(header, GWConstants.PARAMETER_POLICY)) {
                    policy = new String(baos.toByteArray());
                } else if (GWUtils.isField(header, GWConstants.SIGNATURE) || GWUtils.isField(header, GWConstants.X_AMZ_SIGNATURE)) {
                    signature = new String(baos.toByteArray());
                } else if (GWUtils.isField(header, GWConstants.X_AMZ_ALGORITHM)) {
                    algorithm = new String(baos.toByteArray());
                } else if (GWUtils.isField(header, GWConstants.CACHE_CONTROL)) {
                    cacheControl = new String(baos.toByteArray());
                } else if (GWUtils.isField(header, GWConstants.CONTENT_DISPOSITION)) {
                    contentDisposition = new String(baos.toByteArray());
                } else if (GWUtils.isField(header, GWConstants.CONTENT_ENCODING)) {
                    contentEncoding = new String(baos.toByteArray());
                } else if (GWUtils.isField(header, GWConstants.EXPIRES)) {
                    expires = new String(baos.toByteArray());
                } else if (GWUtils.isField(header, GWConstants.PARAMETER_TAGGING)) {
                    tagging = new String(baos.toByteArray());
                } else if (GWUtils.isField(header, GWConstants.SUCCESS_ACTION_STATUS)) {
                    successActionStatus = new String(baos.toByteArray());
                } else if (GWUtils.isField(header, GWConstants.SUCCESS_ACTION_REDIRECT)) {
                    successActionRedirect = new String(baos.toByteArray());
                } else if (GWUtils.isField(header, GWConstants.X_AMZ_STORAGE_CLASS)) {
                    storageClass = new String(baos.toByteArray());
                } else if (GWUtils.isField(header, GWConstants.X_AMZ_SERVER_SIDE_ENCRYPTION)) {
                    serverSideEncryption = new String(baos.toByteArray());
                } else if (GWUtils.isField(header, GWConstants.X_AMZ_SERVER_SIDE_ENCRYPTION_AWS_KMS_KEY_ID)) {
                    serverSideEncryptionAwsKmsKeyId = new String(baos.toByteArray());
                } else if (GWUtils.isField(header, GWConstants.X_AMZ_SERVER_SIDE_ENCRYPTION_CONTEXT)) {
                    serverSideEncryptionContext = new String(baos.toByteArray());
                } else if (GWUtils.isField(header, GWConstants.X_AMZ_SERVER_SIDE_ENCRYPTION_BUCKET_KEY_ENABLED)) {
                    serverSideEncryptionBucketKeyEnabled = new String(baos.toByteArray());
                } else if (GWUtils.isField(header, GWConstants.X_AMZ_SERVER_SIDE_ENCRYPTION_CUSTOMER_ALGORITHM)) {
                    serverSideEncryptionCustomerAlgorithm = new String(baos.toByteArray());
                } else if (GWUtils.isField(header, GWConstants.X_AMZ_SERVER_SIDE_ENCRYPTION_CUSTOMER_KEY)) {
                    serverSideEncryptionCustomerKey = new String(baos.toByteArray());
                } else if (GWUtils.isField(header, GWConstants.X_AMZ_SERVER_SIDE_ENCRYPTION_CUSTOMER_KEY_MD5)) {
                    serverSideEncryptionCustomerKeyMD5 = new String(baos.toByteArray());
                } else if (GWUtils.startsField(header, GWConstants.USER_METADATA_PREFIX)) {
                    String parseHeader = header.substring(GWConstants.CONTENT_DISPOSITION_FORM_DATA.length());
                    parseHeader = parseHeader.substring(0, parseHeader.lastIndexOf(GWConstants.DOUBLE_QUOTE));
                    userMetadata.put(parseHeader, new String(baos.toByteArray()));
                }
            } catch (IOException e) {
                PrintStack.logging(logger, e);
                throw new GWException(GWErrorCode.INTERNAL_SERVER_ERROR, s3Parameter);
            }
            nextPart = multipartStream.readBoundary();
        } catch (FileUploadIOException e) {
            PrintStack.logging(logger, e);
            throw new GWException(GWErrorCode.INTERNAL_SERVER_ERROR, s3Parameter);
        } catch (MalformedStreamException e) {
            PrintStack.logging(logger, e);
            throw new GWException(GWErrorCode.INTERNAL_SERVER_ERROR, s3Parameter);
        }
    }
}
Also used : IOException(java.io.IOException) FileUploadIOException(org.apache.commons.fileupload.FileUploadBase.FileUploadIOException) GWException(com.pspace.ifs.ksan.gw.exception.GWException) ByteArrayOutputStream(java.io.ByteArrayOutputStream) MalformedStreamException(org.apache.commons.fileupload.MultipartStream.MalformedStreamException) MultipartStream(org.apache.commons.fileupload.MultipartStream) FileUploadIOException(org.apache.commons.fileupload.FileUploadBase.FileUploadIOException)

Example 54 with GWException

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

the class DataPutBucketLifeCycle method getLifecycleXml.

public String getLifecycleXml() throws GWException {
    lifecycleXml = readXml();
    XmlMapper xmlMapper = new XmlMapper();
    LifecycleConfiguration lcc;
    try {
        lcc = xmlMapper.readValue(lifecycleXml, LifecycleConfiguration.class);
    } catch (JsonMappingException e) {
        PrintStack.logging(logger, e);
        throw new GWException(GWErrorCode.INTERNAL_SERVER_ERROR, s3Parameter);
    } catch (JsonProcessingException e) {
        PrintStack.logging(logger, e);
        throw new GWException(GWErrorCode.INTERNAL_SERVER_ERROR, s3Parameter);
    }
    Map<String, String> id = new HashMap<String, String>();
    if (lcc.rules != null) {
        for (Rule rl : lcc.rules) {
            if (rl.id != null) {
                if (rl.id.length() > 255) {
                    throw new GWException(GWErrorCode.INVALID_ARGUMENT, s3Parameter);
                }
                id.put(rl.id, rl.id);
            } else {
                String generatedString = UUID.randomUUID().toString().substring(24).toUpperCase();
                id.put(generatedString, generatedString);
                rl.id = generatedString;
            }
            if (rl.status != null && rl.status.compareTo(GWConstants.STATUS_ENABLED) != 0 && rl.status.compareTo(GWConstants.STATUS_DISABLED) != 0) {
                logger.error("rl.status : {}", rl.status);
                throw new GWException(GWErrorCode.MALFORMED_X_M_L, s3Parameter);
            }
            // date check
            if (rl.expiration != null) {
                if (!Strings.isNullOrEmpty(rl.expiration.date)) {
                    if (!rl.expiration.date.contains("T00:00:00"))
                        throw new GWException(GWErrorCode.INVALID_ARGUMENT, s3Parameter);
                }
            }
        }
        if (lcc.rules.size() > id.size()) {
            logger.error("lcc.rules.isze : {}, id.size : {}", lcc.rules.size(), id.size());
            throw new GWException(GWErrorCode.INVALID_ARGUMENT, s3Parameter);
        }
    }
    try {
        xmlMapper.setSerializationInclusion(Include.NON_EMPTY);
        lifecycleXml = xmlMapper.writeValueAsString(lcc);
    } catch (JsonMappingException e) {
        PrintStack.logging(logger, e);
        throw new GWException(GWErrorCode.INTERNAL_SERVER_ERROR, s3Parameter);
    } catch (JsonProcessingException e) {
        PrintStack.logging(logger, e);
        throw new GWException(GWErrorCode.INTERNAL_SERVER_ERROR, s3Parameter);
    }
    if (!lifecycleXml.contains(GWConstants.XML_VERSION)) {
        lifecycleXml = GWConstants.XML_VERSION_FULL_STANDALONE + lifecycleXml;
    }
    return lifecycleXml;
}
Also used : HashMap(java.util.HashMap) JsonMappingException(com.fasterxml.jackson.databind.JsonMappingException) LifecycleConfiguration(com.pspace.ifs.ksan.gw.format.LifecycleConfiguration) GWException(com.pspace.ifs.ksan.gw.exception.GWException) Rule(com.pspace.ifs.ksan.gw.format.LifecycleConfiguration.Rule) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) XmlMapper(com.fasterxml.jackson.dataformat.xml.XmlMapper)

Example 55 with GWException

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

the class ListObjectsV2 method process.

@Override
public void process() throws GWException {
    logger.info(GWConstants.LOG_LIST_OBJECT_V2_START);
    String bucket = s3Parameter.getBucketName();
    initBucketInfo(bucket);
    S3Bucket s3Bucket = new S3Bucket();
    s3Bucket.setCors(getBucketInfo().getCors());
    s3Bucket.setAccess(getBucketInfo().getAccess());
    s3Parameter.setBucket(s3Bucket);
    GWUtils.checkCors(s3Parameter);
    if (s3Parameter.isPublicAccess() && GWUtils.isIgnorePublicAcls(s3Parameter)) {
        throw new GWException(GWErrorCode.ACCESS_DENIED, s3Parameter);
    }
    checkGrantBucket(s3Parameter.isPublicAccess(), String.valueOf(s3Parameter.getUser().getUserId()), GWConstants.GRANT_READ);
    DataListObjectV2 dataListObjectV2 = new DataListObjectV2(s3Parameter);
    dataListObjectV2.extract();
    // read header
    S3ObjectList s3ObjectList = new S3ObjectList();
    if (!Strings.isNullOrEmpty(dataListObjectV2.getMaxKeys())) {
        if (Integer.valueOf(dataListObjectV2.getMaxKeys()) < 0) {
            throw new GWException(GWErrorCode.INVALID_ARGUMENT, s3Parameter);
        }
        s3ObjectList.setMaxKeys(dataListObjectV2.getMaxKeys());
    } else {
        s3ObjectList.setMaxKeys(GWConstants.DEFAULT_MAX_KEYS);
    }
    s3ObjectList.setContinuationToken(dataListObjectV2.getContinuationToken());
    s3ObjectList.setDelimiter(dataListObjectV2.getDelimiter());
    s3ObjectList.setEncodingType(dataListObjectV2.getEncodingType());
    s3ObjectList.setPrefix(dataListObjectV2.getPrefix());
    s3ObjectList.setStartAfter(dataListObjectV2.getStartAfter());
    s3ObjectList.setFetchOwner(dataListObjectV2.getFetchOwner());
    s3Parameter.getResponse().setCharacterEncoding(GWConstants.CHARSET_UTF_8);
    XMLOutputFactory xmlOutputFactory = XMLOutputFactory.newInstance();
    ObjectListParameter objectListParameter = listObjectV2(bucket, s3ObjectList);
    try (Writer writer = s3Parameter.getResponse().getWriter()) {
        s3Parameter.getResponse().setContentType(GWConstants.XML_CONTENT_TYPE);
        XMLStreamWriter xmlStreamWriter = xmlOutputFactory.createXMLStreamWriter(writer);
        xmlStreamWriter.writeStartDocument();
        xmlStreamWriter.writeStartElement(GWConstants.LIST_BUCKET_RESULT);
        xmlStreamWriter.writeDefaultNamespace(GWConstants.AWS_XMLNS);
        writeSimpleElement(xmlStreamWriter, GWConstants.XML_NAME, bucket);
        String encodingType = s3ObjectList.getEncodingType();
        String prefix = s3ObjectList.getPrefix();
        if (prefix == null) {
            xmlStreamWriter.writeEmptyElement(GWConstants.XML_PREFIX);
        } else {
            writeSimpleElement(xmlStreamWriter, GWConstants.XML_PREFIX, GWUtils.encodeObjectName(encodingType, prefix));
        }
        writeSimpleElement(xmlStreamWriter, GWConstants.XML_MAX_KEYS, String.valueOf(s3ObjectList.getMaxKeys()));
        if (s3ObjectList.getStartAfter() == null) {
            xmlStreamWriter.writeEmptyElement(GWConstants.XML_START_AFTER);
        } else {
            writeSimpleElement(xmlStreamWriter, GWConstants.XML_START_AFTER, GWUtils.encodeObjectName(encodingType, s3ObjectList.getStartAfter()));
        }
        if (s3ObjectList.getContinuationToken() == null) {
            xmlStreamWriter.writeEmptyElement(GWConstants.XML_CONTINUEATION_TOKEN);
        } else {
            writeSimpleElement(xmlStreamWriter, GWConstants.XML_CONTINUEATION_TOKEN, GWUtils.encodeObjectName(encodingType, s3ObjectList.getContinuationToken()));
        }
        writeSimpleElement(xmlStreamWriter, GWConstants.XML_KEY_COUNT, String.valueOf(objectListParameter.getObjects().size()));
        if (s3ObjectList.getDelimiter() != null) {
            writeSimpleElement(xmlStreamWriter, GWConstants.XML_DELIMITER, GWUtils.encodeObjectName(encodingType, s3ObjectList.getDelimiter()));
        }
        if (encodingType != null && encodingType.equals(GWConstants.URL)) {
            writeSimpleElement(xmlStreamWriter, GWConstants.XML_ENCODING_TYPE, encodingType);
        }
        if (objectListParameter.isTruncated()) {
            writeSimpleElement(xmlStreamWriter, GWConstants.XML_IS_TRUNCATED, GWConstants.XML_TRUE);
            writeSimpleElement(xmlStreamWriter, GWConstants.XML_NEXT_CONTINUATION_TOKEN, GWUtils.encodeObjectName(encodingType, objectListParameter.getNextMarker()));
        } else {
            writeSimpleElement(xmlStreamWriter, GWConstants.XML_IS_TRUNCATED, GWConstants.XML_FALSE);
        }
        for (S3Metadata s3Metadata : objectListParameter.getObjects()) {
            xmlStreamWriter.writeStartElement(GWConstants.XML_CONTENTS);
            writeSimpleElement(xmlStreamWriter, GWConstants.KEY, GWUtils.encodeObjectName(encodingType, s3Metadata.getName()));
            if (s3Metadata.getLastModified() != null) {
                writeSimpleElement(xmlStreamWriter, GWConstants.LAST_MODIFIED, formatDate(s3Metadata.getLastModified()));
            }
            if (s3Metadata.getETag() != null) {
                writeSimpleElement(xmlStreamWriter, GWConstants.ETAG, GWUtils.maybeQuoteETag(s3Metadata.getETag()));
            }
            if (!Strings.isNullOrEmpty(s3ObjectList.getFetchOwner()) && s3ObjectList.getFetchOwner().equals(GWConstants.XML_TRUE)) {
                writeOwnerInfini(xmlStreamWriter, s3Metadata.getOwnerId(), s3Metadata.getOwnerName());
            }
            writeSimpleElement(xmlStreamWriter, GWConstants.XML_SIZE, s3Metadata.getContentLength().toString());
            writeSimpleElement(xmlStreamWriter, GWConstants.STORAGE_CLASS, s3Metadata.getTier());
            xmlStreamWriter.writeEndElement();
        }
        for (Entry<String, String> entry : objectListParameter.getCommonPrefixes().entrySet()) {
            xmlStreamWriter.writeStartElement(GWConstants.XML_COMMON_PREFIXES);
            writeSimpleElement(xmlStreamWriter, GWConstants.XML_PREFIX, GWUtils.encodeObjectName(encodingType, entry.getValue()));
            xmlStreamWriter.writeEndElement();
        }
        xmlStreamWriter.writeEndElement();
        xmlStreamWriter.flush();
    } catch (IOException e) {
        PrintStack.logging(logger, e);
        throw new GWException(GWErrorCode.SERVER_ERROR, s3Parameter);
    } catch (XMLStreamException e) {
        PrintStack.logging(logger, e);
        throw new GWException(GWErrorCode.SERVER_ERROR, s3Parameter);
    }
}
Also used : XMLOutputFactory(javax.xml.stream.XMLOutputFactory) IOException(java.io.IOException) S3ObjectList(com.pspace.ifs.ksan.gw.identity.S3ObjectList) DataListObjectV2(com.pspace.ifs.ksan.gw.data.DataListObjectV2) ObjectListParameter(com.pspace.ifs.ksan.gw.identity.ObjectListParameter) S3Bucket(com.pspace.ifs.ksan.gw.identity.S3Bucket) XMLStreamException(javax.xml.stream.XMLStreamException) XMLStreamWriter(javax.xml.stream.XMLStreamWriter) S3Metadata(com.pspace.ifs.ksan.gw.identity.S3Metadata) GWException(com.pspace.ifs.ksan.gw.exception.GWException) Writer(java.io.Writer) XMLStreamWriter(javax.xml.stream.XMLStreamWriter)

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