Examples of ImageFormat


Examples of com.alibaba.simpleimage.ImageFormat

    public static ImageWrapper readGeneral(InputStream input)
            throws SimpleImageException {
        try {
            ImageWrapper img = null;
            ImageFormat format = ImageUtils.identifyFormat(input);
            if(format == null) {
                throw new IllegalArgumentException("Unsupported image format, only JPEG, GIF, PNG, BMP and TIFF are supported");
            }
            ByteArraySeekableStreamWrap wrap = null;
            wrap = ByteArraySeekableStreamWrap.wrapInputStream(input);
View Full Code Here

Examples of com.cloud.storage.Storage.ImageFormat

       
    if (url.toLowerCase().contains("file://")) {
      throw new InvalidParameterValueException("File:// type urls are currently unsupported");
    }
   
    ImageFormat imgfmt = ImageFormat.valueOf(format.toUpperCase());
    if (imgfmt == null) {
      throw new IllegalArgumentException("Image format is incorrect " + format + ". Supported formats are " + EnumUtils.listValues(ImageFormat.values()));
    }
   
        String userSpecifiedName = volumeName;
View Full Code Here

Examples of com.cloud.storage.Storage.ImageFormat

        if (sortKey != null) {
            template.setSortKey(sortKey);
        }

        ImageFormat imageFormat = null;
        if (format != null) {
            try {
                imageFormat = ImageFormat.valueOf(format.toUpperCase());
            } catch (IllegalArgumentException e) {
                throw new InvalidParameterValueException("Image format: " + format + " is incorrect. Supported formats are "
View Full Code Here

Examples of com.cloud.storage.Storage.ImageFormat

        if (sortKey != null) {
            template.setSortKey(sortKey);
        }

        ImageFormat imageFormat = null;
        if (format != null) {
            try {
                imageFormat = ImageFormat.valueOf(format.toUpperCase());
            } catch (IllegalArgumentException e) {
                throw new InvalidParameterValueException("Image format: " + format + " is incorrect. Supported formats are "
View Full Code Here

Examples of com.cloud.storage.Storage.ImageFormat

        if (url.toLowerCase().contains("file://")) {
            throw new InvalidParameterValueException(
                    "File:// type urls are currently unsupported");
        }

        ImageFormat imgfmt = ImageFormat.valueOf(format.toUpperCase());
        if (imgfmt == null) {
            throw new IllegalArgumentException("Image format is incorrect "
                    + format + ". Supported formats are "
                    + EnumUtils.listValues(ImageFormat.values()));
        }
View Full Code Here

Examples of com.cloud.storage.Storage.ImageFormat

        if (!isAdmin || featured == null) {
            featured = Boolean.FALSE;
        }

        ImageFormat imgfmt = ImageFormat.valueOf(format.toUpperCase());
        if (imgfmt == null) {
            throw new IllegalArgumentException("Image format is incorrect " + format + ". Supported formats are " + EnumUtils.listValues(ImageFormat.values()));
        }

        // Check that the resource limit for templates/ISOs won't be exceeded
View Full Code Here

Examples of com.cloud.storage.Storage.ImageFormat

            return copySnapshotToTemplateFromNfsToNfsXenserver(cmd, srcData, srcDataStore, destData, destDataStore);
        } else if (srcData.getHypervisorType() == HypervisorType.KVM) {
            File srcFile = getFile(srcData.getPath(), srcDataStore.getUrl());
            File destFile = getFile(destData.getPath(), destDataStore.getUrl());

            ImageFormat srcFormat = srcData.getVolume().getFormat();

            // get snapshot file name
            String templateName = srcFile.getName();
            // add kvm file extension for copied template name   
            String fileName = templateName + "." + srcFormat.getFileExtension();
            String destFileFullPath = destFile.getAbsolutePath() + File.separator + fileName;
            s_logger.debug("copy snapshot " + srcFile.getAbsolutePath() + " to template " + destFileFullPath);
            Script.runSimpleBashScript("cp " + srcFile.getAbsolutePath() + " " + destFileFullPath);
            try {
                // generate template.properties file
View Full Code Here

Examples of com.cloud.storage.Storage.ImageFormat

                            return new CopyCmdAnswer("Can't find src file:" + templatePath);
                        }
                    }
                }
            }
            ImageFormat format = this.getTemplateFormat(srcFile.getName());
            String key = destData.getPath() + S3Utils.SEPARATOR + srcFile.getName();
            putFile(s3, srcFile, bucket, key);

            DataTO retObj = null;
            if (destData.getObjectType() == DataObjectType.TEMPLATE) {
View Full Code Here

Examples of com.cloud.storage.Storage.ImageFormat

                long id = rs.getLong(1);
                String uniqueName = rs.getString(2);
                String name = rs.getString(3);
                boolean isPublic = rs.getBoolean(4);
                String value = rs.getString(5);
                ImageFormat format = ImageFormat.valueOf(value);
                String tmpltType = rs.getString(6);
                boolean requiresHVM = rs.getBoolean(7);
                int bits = rs.getInt(8);
                String url = rs.getString(9);
                String createdTS = rs.getString(10);
View Full Code Here

Examples of com.cloud.storage.Storage.ImageFormat

        DataTO srcData = cmd.getSrcTO();
        DataTO destData = cmd.getDestTO();
        DataStoreTO srcStore = srcData.getDataStore();
        DataStoreTO destStore = destData.getDataStore();
        VolumeObjectTO srcVol = (VolumeObjectTO) srcData;
        ImageFormat srcFormat = srcVol.getFormat();
        PrimaryDataStoreTO primaryStore = (PrimaryDataStoreTO) destStore;
        if (!(srcStore instanceof NfsTO)) {
            return new CopyCmdAnswer("can only handle nfs storage");
        }
        NfsTO nfsStore = (NfsTO)srcStore;
        String srcVolumePath = srcData.getPath();
        String secondaryStorageUrl = nfsStore.getUrl();
        KVMStoragePool secondaryStoragePool = null;
        KVMStoragePool primaryPool = null;
        try {
            try {
                primaryPool = storagePoolMgr.getStoragePool(
                        primaryStore.getPoolType(),
                        primaryStore.getUuid());
            } catch (CloudRuntimeException e) {
                if (e.getMessage().contains("not found")) {
                    primaryPool = storagePoolMgr.createStoragePool(primaryStore.getUuid(),
                            primaryStore.getHost(), primaryStore.getPort(),
                            primaryStore.getPath(), null,
                            primaryStore.getPoolType());
                } else {
                    return new CopyCmdAnswer(e.getMessage());
                }
            }

            String volumeName = UUID.randomUUID().toString();

            int index = srcVolumePath.lastIndexOf(File.separator);
            String volumeDir = srcVolumePath.substring(0, index);
            String srcVolumeName = srcVolumePath.substring(index + 1);
            secondaryStoragePool = storagePoolMgr.getStoragePoolByURI(
                    secondaryStorageUrl + File.separator + volumeDir
                           );
            if (!srcVolumeName.endsWith(".qcow2") && srcFormat == ImageFormat.QCOW2) {
                srcVolumeName = srcVolumeName + ".qcow2";
            }
            KVMPhysicalDisk volume = secondaryStoragePool
                    .getPhysicalDisk(srcVolumeName);
            volume.setFormat(PhysicalDiskFormat.valueOf(srcFormat.toString()));
            KVMPhysicalDisk newDisk = storagePoolMgr.copyPhysicalDisk(volume, volumeName,
                    primaryPool);
            VolumeObjectTO newVol = new VolumeObjectTO();
            newVol.setFormat(ImageFormat.valueOf(newDisk.getFormat().toString().toUpperCase()));
            newVol.setPath(volumeName);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.